Option Explicit On Option Strict On Imports System Imports Microsoft.VisualBasic Imports Mongoose.IDO.Protocol Imports Mongoose.Scripting Namespace Mongoose.FormScripts Public Class OrderVerificationReportViewer Inherits FormScript Sub GetExpressionValues() If ThisForm.Variables("CoTypeRegular").GetValueOfBoolean(False) And ThisForm.Variables("CoTypeBlanket").GetValueOfBoolean(False) Then ThisForm.Components("CoTypeStatic").Caption = Application.GetStringValue("sR") & Application.GetStringValue("sB") ElseIf ThisForm.Variables("CoTypeRegular").GetValueOfBoolean(False) Then ThisForm.Components("CoTypeStatic").Caption = Application.GetStringValue("sR") Else ThisForm.Components("CoTypeStatic").Caption = Application.GetStringValue("sB") End If End Sub Sub SetPropertiesValues() Dim oCache As IWSIDOCollection = ThisForm.PrimaryIDOCollection Dim row As Integer = 0 For row = 0 To oCache.GetNumEntries - 1 ' Subtotal and total calculation Dim strSumIncludeTaxInPrc As String = oCache.GetObjectAggregateValue(WSAggregateFunctions.SUM, "IncludeTaxInPrice", "CoNum", row) Dim dSumIncludeTaxInPrc As Decimal = CDec(IIf(String.IsNullOrEmpty(strSumIncludeTaxInPrc), "0", strSumIncludeTaxInPrc)) Dim bIncludeTaxInPrc As Boolean = oCache.Item(row).Properties("IncludeTaxInPrice").GetValueOfBoolean(False) Dim dCoDisc As Decimal = oCache.Item(row).Properties("CoDisc").GetValueOfDecimal(Decimal.Zero) Dim dMisc As Decimal = oCache.Item(row).Properties("Misc").GetValueOfDecimal(Decimal.Zero) Dim strSumPrcBeforeTax As String = oCache.GetObjectAggregateValue(WSAggregateFunctions.SUM, "PriceBeforeTax", "CoNum", row) Dim dSumPrcBeforeTax As Decimal = CDec(IIf(String.IsNullOrEmpty(strSumPrcBeforeTax), "0", strSumPrcBeforeTax)) Dim strSumNetAmt As String = oCache.GetObjectAggregateValue(WSAggregateFunctions.SUM, "NetAmount", "CoNum", row) Dim dSumNetAmt As Decimal = CDec(IIf(String.IsNullOrEmpty(strSumNetAmt), "0", strSumNetAmt)) Dim strSumSalesTax1 As String = oCache.GetObjectAggregateValue(WSAggregateFunctions.SUM, "SalesTax1", "CoNum", row) Dim dSumSalesTax1 As Decimal = CDec(IIf(String.IsNullOrEmpty(strSumSalesTax1), "0", strSumSalesTax1)) Dim strSumSalesTax2 As String = oCache.GetObjectAggregateValue(WSAggregateFunctions.SUM, "SalesTax2", "CoNum", row) Dim dSumSalesTax2 As Decimal = CDec(IIf(String.IsNullOrEmpty(strSumSalesTax2), "0", strSumSalesTax2)) Dim dTotalSurcharge As Decimal = oCache.Item(row).Properties("SumTotalSurcharge").GetValueOfDecimal(Decimal.Zero) Dim dFreight As Decimal = oCache.Item(row).Properties("Freight").GetValueOfDecimal(Decimal.Zero) Dim dPrepaid As Decimal = oCache.Item(row).Properties("Prepaid").GetValueOfDecimal(Decimal.Zero) 'Set value to flag for visible when conditions 'If dTotalSurcharge = 0 Then ' oCache.SetObjectPropertyPlusModifyRefresh("Flag1",row,"0") 'Else ' oCache.SetObjectPropertyPlusModifyRefresh("Flag1",row,"1") 'End If Dim dDiscAmt As Decimal = dSumNetAmt * dCoDisc / -100 Dim dSalesAmt As Decimal = CDec(IIf(dSumIncludeTaxInPrc.Equals(Decimal.Zero), 0, dSumPrcBeforeTax)) + dSumNetAmt * CDec(IIf(Not bIncludeTaxInPrc, 1, dCoDisc / 100)) SetFormatTotalNumber(oCache,row,"SalesAmt1",dSalesAmt,"T") SetFormatTotalNumber(oCache,row,"SumDiscAmt1",dDiscAmt,"T") SetFormatTotalNumber(oCache,row,"SumSurcharge1",dTotalSurcharge,"T") SetFormatTotalNumber(oCache,row,"SumSalesTax4",dSumSalesTax2,"T") SetFormatTotalNumber(oCache,row,"SumSalesTax3",dSumSalesTax1,"T") SetFormatTotalNumber(oCache,row,"SumFreight1",dFreight,"T") Dim dTotalAmount As Decimal = CDec(IIf(Not bIncludeTaxInPrc, dSumNetAmt + dDiscAmt, dSumPrcBeforeTax)) _ + dTotalSurcharge + dSumSalesTax1 + dSumSalesTax2 + dMisc + dFreight - dPrepaid SetFormatTotalNumber(oCache,row,"TotalAmt1",dTotalAmount,"T") SetFormatTotalNumber(oCache,row,"Misc1",dMisc,"T") SetFormatTotalNumber(oCache,row,"Prepaid1",dPrepaid,"T") 'Formatting SetFormatTotalNumber(oCache, row, "Price1", oCache.Item(row).Properties("Price").GetValueOfDecimal(0), "P") SetFormatTotalNumber(oCache, row, "NetAmount1", oCache.Item(row).Properties("NetAmount").GetValueOfDecimal(0), "C") SetFormatTotalNumber(oCache, row, "CompPrice1", oCache.Item(row).Properties("CompPrice").GetValueOfDecimal(0), "C") 'Set Value on OrderDiscHeaderStatic Dim sCoDisc As String = Application.GetStringValue("sOrderDisc") & "(" & Format(dCoDisc, "##0.0000####") & "%)" oCache.Item(row).Properties("CoDisc1").SetValue(sCoDisc) Next End Sub Function SetFormatTotalNumber(oCache As IWSIDOCollection, Row As Integer, PropertyName As String, Value As Decimal, FormatType As String) As String Dim CurrencyTotPlaces As Integer = oCache.Item(row).Properties("CurrencyTotPlaces").GetValueOfInteger(0) Dim CurrencyTotFormat As String = "{0:" & oCache.Item(row).Properties("CurrencyTotFormat").GetValueOfString("") & "}" Dim CurrencyPricePlaces As Integer = oCache.Item(row).Properties("CurrencyPricePlaces").GetValueOfInteger(0) Dim CurrencyPriceFormat As String = "{0:" & oCache.Item(row).Properties("CurrencyPriceFormat").GetValueOfString("") & "}" Dim CurrencyPlaces As Integer = oCache.Item(row).Properties("CurrencyPlaces").GetValueOfInteger(0) Dim CurrencyFormat As String = "{0:" & oCache.Item(row).Properties("CurrencyFormat").GetValueOfString("") & "}" Dim PropertyValue As String Select Case FormatType Case "T" ' Total PropertyValue = String.Format(CurrencyTotFormat, Math.Round(Value, CurrencyTotPlaces)) Case "P" ' Price PropertyValue = String.Format(CurrencyPriceFormat, Math.Round(Value, CurrencyPricePlaces)) Case "C" ' Currency PropertyValue = String.Format(CurrencyFormat, Math.Round(Value, CurrencyPlaces)) End Select oCache.Item(Row).Properties(PropertyName).SetValue(PropertyValue) End Function 'GDS Started Sub ue_BENN_ShippingInstructions() Dim oCache As IWSIDOCollection oCache = ThisForm.PrimaryIDOCollection Dim oShip As LoadCollectionResponseData Dim shipfilter as String = "='"+oCache.GetCurrentObjectProperty("")+"'" oShip = IDOClient.LoadCollection("SLCos","",shipfilter,"",-1) End Sub Sub ue_BENN_BillToAddress() Dim oCache As IWSIDOCollection oCache = ThisForm.PrimaryIDOCollection Dim oBill As LoadCollectionResponseData Dim billAdress As String Dim billfilter as String = "CoNum='"+oCache.GetCurrentObjectProperty("CoNum")+"'" oBill = IDOClient.LoadCollection("SLCos","BillToContact_3,TermsCode",billfilter,"",-1) if String.IsNULLOrEmpty(oBill(0,"BillToContact_3").ToString()) Then billAdress = oCache.GetCurrentObjectProperty("ShipAddr").ToString() else billAdress = oBill(0,"BillToContact_3").ToString() & oCache.GetCurrentObjectProperty("ShipAddr").ToString() End If ThisForm.Variables("ue_BENN_BillToName").Value = billAdress.ToString() If oBill(0,"TermsCode").ToString().StartsWith("E") Then ThisForm.Variables("ue_BENN_Cotext").Value = "Prices stated are current pricing and are subjected to adjustment" End Sub End Class End Namespace
Write, Run & Share VB.net code online using OneCompiler's VB.net online compiler for free. It's one of the robust, feature-rich online compilers for VB.net language, running on the latest version 16. Getting started with the OneCompiler's VB.net compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as VB.net
. OneCompiler also has reference programs, where you can look for the sample code to get started with.
OneCompiler's VB.net online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample VB.net program which takes name as input and prints hello message with your name.
Public Module Program
Public Sub Main(args() As string)
Dim name as String = Console.ReadLine() ' Reading input from STDIN
Console.WriteLine("Hello " & name) ' Writing output to STDOUT
End Sub
End Module
Visual Basic is a event driven programming language by Microsoft, first released in the year 1991.
Variable is a name given to the storage area in order to identify them in our programs.
Simple syntax of Variable declaration is as follows
Dim variableName [ As [ New ] dataType ] [ = initializer ]
variableName = value
If condition-expression Then
'code
End If
If(conditional-expression)Then
'code if the conditional-expression is true
Else
'code if the conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
Else If(conditional-expression) Then
'code if the above conditional-expression is true
Else
'code if the above conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
If(conditional-expression)Then
'code if the above conditional-expression is true
End If
End If
Select [ Case ] expression
[ Case expressionlist
'code ]
[ Case Else
'code ]
End Select
For counter [ As datatype ] = begin To end [ Step step ]
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ counter ]
For Each element [ As datatype ] In group
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ element ]
While conditional-expression
'Code
[ Continue While ]
'Code
[ Exit While ]
'Code
End While
Do { While | Until } conditional-expression
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop
Do
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop { While | Until } conditional-expression
Procedure is a sub-routine which contains set of statements. Usually Procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
Procedures are of two types.
Functions return a value when they are called.
[accessModifiers] Function functionName [(parameterList)] As returnType
'code
End Function
Sub-procedures are similar to functions but they don't return any value.
Sub ProcedureName (parameterList)
'Code
End Sub