iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have an ASP.BET page with a webgrid that has its datasource dynamically set at the backend. The soruce of the data varies depending on the option(s) the user takes (for instance, if the user selects a new sales order, the grid shows customer information - whereas if the user selects to open an existing sales order, the webgrid shows existing sales orders).
For aesthetic reasons we use a checkbox above the webgrid to give the user the option of filtering or not. We display the filter pane of the webgrid dependant upon the value of the check box. This appears to work fine for webgrid's that are not dynamically built with different datasources.
I've attached a document showing the details of the error that is thrown.
Below is the code for the web page. I'm on version Webgrid.net 7.0.
The dll's in my projects bin folder are as follows:
09/04/2010 06:18 PM 5,822,464 AjaxControlToolkit.dll07/09/2010 03:49 PM 7,168 Interop.Encore.dll24/01/2008 08:18 PM 8,326,144 ISNet.ActiveReports.Exporting.dll03/02/2010 09:32 PM 60,928 ISNet.Data.Linq.dll03/06/2010 03:20 PM 103,424 ISNet.dll18/09/2006 06:32 PM 2,760,704 ISNet.Nevron.Designer.dll03/06/2010 03:20 PM 32,768 ISNet.WebUI.Design.dll03/06/2010 03:20 PM 791,552 ISNet.WebUI.dll03/06/2010 03:20 PM 61,440 ISNet.WebUI.Editor.dll03/06/2010 03:20 PM 172,544 ISNet.WebUI.Editor.v4.dll09/10/2008 02:31 PM 13,312 ISNet.WebUI.ISLinqDataSource.dll03/06/2010 03:18 PM 417,792 ISNet.WebUI.Resources.dll03/06/2010 03:19 PM 36,864 ISNet.WebUI.Silverlight.dll02/03/2010 11:06 AM 413,696 ISNet.WebUI.WebAqua.Resources.dll18/05/2010 04:25 PM 159,744 ISNet.WebUI.WebCombo.Resources.dll04/06/2010 02:00 PM 1,400,832 ISNet.WebUI.WebDesktop.dll04/06/2010 01:58 PM 1,605,632 ISNet.WebUI.WebDesktop.Resources.dll26/05/2010 05:41 PM 90,112 ISNet.WebUI.WebGrid.ChartEngine.dll26/05/2010 05:42 PM 1,233,920 ISNet.WebUI.WebGrid.DLL26/05/2010 05:41 PM 962,560 ISNet.WebUI.WebGrid.Editor.dll26/05/2010 05:42 PM 729,600 ISNet.WebUI.WebGrid.ISChartEngine.dll26/05/2010 05:41 PM 1,585,152 ISNet.WebUI.WebGrid.Resources.dll08/06/2010 02:11 PM 299,008 ISNet.WebUI.WebInput.Resources.dll03/06/2010 03:58 PM 892,928 ISNet.WebUI.WebScheduler.Resources.dll08/06/2010 09:17 AM 855,552 ISNet.WebUI.WebTextEditor.Resources.dll08/06/2010 10:49 AM 217,088 ISNet.WebUI.WebTreeView.Resources.dll19/11/2004 09:54 PM 212,992 ISNet.WinUI.HtmlEditor.dll13/08/2006 08:20 AM 8,007,680 Microsoft.mshtml.dll21/02/2003 10:12 AM 348,160 msvcr71.dll30/01/2011 02:18 PM 144,384 SCLSalesOrderForm.dll
I know I've probably done something silly, I'd appreciate some assistance.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SorDetail.aspx.vb" Inherits="SCLSalesOrderForm.SorDetail" ValidateRequest="false" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %> <html> <head id="Head1" runat="server"> <title>Master Page</title> <link rel="stylesheet" type="text/css" href="../global.css" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" /> </head> <body id="Body1" runat="server"> <form id="Form1" runat="server" style="height: 552px"> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <div> <ISWebDesktop:WebToolBar AutoPostBack="Yes" ID="WebToolBar1" runat="server" Caption="Intelli Tool Bar" CommandSize="" HeaderHeight="" Height="28px" IntegratedTo="None" NewDockingArea="NotSet" NewDockingRow="0" NewIsFloat="Default" Width="100%" OnCommandClick="WebToolBar1_CommandClick" AllowCustomize="No"> <Commands> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdNew" AutoPostBack="Yes" Image="~/Images/New.gif" Text="New" ToolTip="New Sales Order"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdOpen" AutoPostBack="Yes" Image="~/Images/Open.gif" Text="Open" ToolTip="Open Sales Order"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdSave" AutoPostBack="Yes" Image="~/Images/Save.gif" Text="Save" ToolTip="Save Sales Order"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdDelete" AutoPostBack="Yes" Image="~/Images/Delete.png" Text="Delete" ToolTip="Delete Order Line"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" Name="Separator1" Type="Separator"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdHeader" AutoPostBack="Yes" Image="~/Images/application_edit.png" Text="Header" ToolTip="Sales Order Header"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdDetail" AutoPostBack="Yes" Image="~/Images/application_form.png" Text="Detail" ToolTip="Sales Order Details"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdTotals" AutoPostBack="Yes" Image="~/Images/application_side_contract.png" Text="Totals" ToolTip="Sales Order Totals"> </ISWebDesktop:ToolCommand> <ISWebDesktop:ToolCommand Category="WebToolBar1" DisplayMode="TextAndImage" Name="cmdXML" AutoPostBack="Yes" Image="~/Images/clipboard_text.png" Text="XML" ToolTip="Sales Order XML"> </ISWebDesktop:ToolCommand> </Commands> </ISWebDesktop:WebToolBar> <br /> <asp:Label ID="lblError" runat="server" CssClass="labelerror" Text="Label"></asp:Label> <br /> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="viewStart" runat="server"> <div> <asp:Button ID="btnProcess" CssClass="button" runat="server" Text="Process" /><br /> <asp:CheckBox ID="chFilterMain" AutoPostBack="true" CssClass="CheckBox" Text="Filter List" runat="server" /> <ISWebGrid:WebGrid ID="grdMain" runat="server" Height="60%" UseDefaultStyle="true" DefaultStyleMode="Win7" HorizontalAlign="NotSet" OnInitializeRow="grdMain_InitializeRow" OnInitializeDataSource="grdMain_InitializeDataSource" OnPrepareDataBinding="grdMain_PrepareDataBinding" Width="790px"> <FlyPostBackSettings PostInputControls="True" /> <RootTable DataKeyField="" GridLineStyle="NotSet" Caption="Valuations"> </RootTable> <LayoutSettings AllowAddNew="No" AllowDelete="No" AllowColumnMove="Yes" AllowEdit="No" AllowExport="Yes" AllowFilter="Yes" AllowGrouping="Yes" AllowSelectColumns="Yes" AllowSorting="Yes"> </LayoutSettings> </ISWebGrid:WebGrid> <asp:HiddenField ID="fldMode" runat="server" /> </div> </asp:View> <asp:View ID="viewHeader" runat="server"> <div style="width: 811px; height: 451px"> <asp:SqlDataSource ID="sqlAddress" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [AddrCode], RTrim([ShipToAddr3]) +' - '+[ShipToAddr4] as 'Description' FROM [ArMultAddress] WHERE ([Customer] = @Customer)"> <SelectParameters> <asp:ControlParameter ControlID="txtCustomer" Name="Customer" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="sqlTaxCodeHeader" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [TaxCode], RTrim([TaxCode]) +' - '+[Description] as 'Description' FROM [AdmTax]"> </asp:SqlDataSource> <asp:SqlDataSource ID="sqlTaxCode" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [TaxCode], RTrim([TaxCode]) +' - '+[Description] as 'Description' FROM [AdmTax]"> </asp:SqlDataSource> <asp:SqlDataSource ID="sqlWarehouse" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [Warehouse] FROM [InvWarehouse] WHERE ([StockCode] = @StockCode) Order by [Warehouse] DESC"> <SelectParameters> <asp:ControlParameter ControlID="txtStockCode" Name="StockCode" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:Table ID="Table2" runat="server" Width="758px"> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label19" CssClass="label" runat="server" Text="Sales Order"></asp:Label> <asp:TextBox ID="txtSalesOrder" CssClass="textboxRO" ReadOnly="true" runat="server"></asp:TextBox> </asp:TableCell></asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label7" CssClass="label" runat="server" Text="Customer"></asp:Label> <asp:TextBox ID="txtCustomer" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:Label ID="Label8" CssClass="label" runat="server" Text="Branch"></asp:Label> <asp:TextBox ID="txtBranch" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell></asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label2" CssClass="label" runat="server" Text="Billing Address"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="Label3" CssClass="label" runat="server" Text="Shipping Address"></asp:Label> <asp:DropDownList ID="lstAddress" onkeypress="return KeySortDropDownList_onkeypress(this,false)" AutoPostBack="true" AppendDataBoundItems="true" DataSourceID="sqlAddress" runat="server" Height="26px" Width="225px" DataTextField="Description" DataValueField="AddrCode"> </asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:TextBox ID="txtBillAddr" ReadOnly="true" CssClass="textboxfullRO" Height="80px" Width="325px" TextMode="MultiLine" runat="server"> </asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtShipAddr" CssClass="textboxfull" Height="80px" Width="325px" TextMode="MultiLine" runat="server"> </asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label13" runat="server" CssClass="label" Text="Country"></asp:Label> <asp:TextBox ID="txtBillCountry" CssClass="textboxRO" runat="server"></asp:TextBox> <asp:Label ID="Label14" runat="server" CssClass="label" Text="Post Code"></asp:Label> <asp:TextBox ID="txtBillPC" CssClass="textboxRO" Width="80px" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:Label ID="Label15" runat="server" CssClass="label" Text="Country"></asp:Label> <asp:TextBox ID="txtShipCountry" CssClass="textbox" runat="server"></asp:TextBox> <asp:Label ID="Label16" runat="server" CssClass="label" Text="Post Code"></asp:Label> <asp:TextBox ID="txtShipPC" CssClass="textbox" Width="80px" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> <br /> <asp:Table ID="Table3" runat="server" Width="758px"> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label1" CssClass="label" runat="server" Text="Customer Reference/PO"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtCustPO" CssClass="textbox" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell></asp:TableCell> <asp:TableCell> <asp:Label ID="Label4" CssClass="label" runat="server" Text="Ship Date"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtShipDate" CssClass="textbox" AutoPostBack="true" runat="server"></asp:TextBox> <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtShipDate" Format="dd/MM/yyyy" PopupButtonID="imgDatePicker"> </asp:CalendarExtender> <asp:ImageButton ID="imgDatePicker" runat="server" ImageUrl="~/Images/date_picker.gif" /> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label5" CssClass="label" runat="server" Text="Order Date"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtOrderDate" CssClass="textbox" runat="server"></asp:TextBox> <asp:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtOrderDate" Format="dd/MM/yyyy" PopupButtonID="ImageButton2"> </asp:CalendarExtender> <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Images/date_picker.gif" /> </asp:TableCell> <asp:TableCell></asp:TableCell> <asp:TableCell> <asp:Label ID="Label6" CssClass="label" runat="server" Text="Salesperson"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtSalesperson" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label18" CssClass="label" runat="server" Text="Tax Code"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="lstTaxCodeHeader" DataSourceID="sqlTaxCodeHeader" runat="server" Height="26px" Width="75px" DataTextField="TaxCode" DataValueField="TaxCode"> </asp:DropDownList> </asp:TableCell> <asp:TableCell></asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> </asp:TableCell> </asp:TableRow> </asp:Table> <br /> <asp:Label ID="Label12" CssClass="label" runat="server" Text="Shipping Instructions"></asp:Label> <br /> <asp:TextBox ID="txtShipInst" CssClass="textmemo" runat="server" Height="35px" Width="700px"></asp:TextBox> <br /> <br /> <asp:Label ID="Label9" CssClass="label" runat="server" Text="Special Instructions"></asp:Label> <br /> <asp:TextBox ID="txtComments" CssClass="textmemo" runat="server" Height="35px" Width="700px"></asp:TextBox> <br /> <br /> </div> </asp:View> <asp:View ID="viewDetails" runat="server"> <div style="width: 811px; height: 397px"> <asp:Table ID="Table6" runat="server" Width="800px"> <asp:TableRow> <asp:TableCell> <asp:CheckBox ID="chFilter" AutoPostBack="true" CssClass="CheckBox" Text="Filter List" runat="server" /> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:CheckBox ID="chHideLR" AutoPostBack="true" CssClass="CheckBox" Text="Hide Loans/Rebates" runat="server" /> </asp:TableCell> <asp:TableCell> <asp:Label ID="Label23" CssClass="label" runat="server" Text="Sales Order"></asp:Label> <asp:TextBox ID="txtSalesOrderDetail" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> <ISWebGrid:WebGrid ID="grdStockItems" runat="server" Height="50%" UseDefaultStyle="true" DefaultStyleMode="Win7" HorizontalAlign="NotSet" OnInitializeRow="grdStockItems_InitializeRow" OnInitializeDataSource="grdStockItems_InitializeDataSource" OnPrepareDataBinding="grdStockItems_PrepareDataBinding" Width="850px"> <FlyPostBackSettings PostInputControls="True" /> <RootTable DataKeyField="MStockCode" GridLineStyle="NotSet" Caption="Stock Items"> </RootTable> <LayoutSettings AllowAddNew="No" AllowDelete="No" AllowColumnMove="Yes" AllowEdit="No" AllowExport="Yes" AllowFilter="No" AllowGrouping="Yes" AllowSelectColumns="Yes" AllowSorting="Yes"> </LayoutSettings> </ISWebGrid:WebGrid> <br /> <asp:SqlDataSource ID="sqlStockCode" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [StockCode], RTrim([StockCode]) +' - '+[Description] as 'Description' FROM [InvMaster] where [StockOnHold] <> 'F' order by [Description] ASC "> </asp:SqlDataSource> <asp:SqlDataSource ID="sqlProductClass" runat="server" ConnectionString="<%$ ConnectionStrings:SCL %>" SelectCommand="SELECT [ProductClass] FROM [SalGlIntSale] Where Warehouse= '**' Group By [ProductClass] "> </asp:SqlDataSource> <asp:Table ID="Table1" runat="server"> <asp:TableRow> <asp:TableCell> <asp:Label ID="Label21" CssClass="label" runat="server" Text="Line Type"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblStockCode" CssClass="label" runat="server" Text="Stock Code"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblDescription" CssClass="label" runat="server" Text="Description"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblProductClass" CssClass="label" runat="server" Text="Product Class"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblQty" CssClass="label" runat="server" Text="Qty"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblUom" CssClass="label" runat="server" Text="Uom"></asp:Label> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:TextBox ID="txtLineNo" Visible="false" CssClass="textbox" runat="server"></asp:TextBox> <asp:DropDownList ID="lstLineType" AutoPostBack="true" runat="server"> </asp:DropDownList> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtStockCode" Visible="True" AutoPostBack="true" CssClass="textbox" runat="server"></asp:TextBox> <asp:DropDownList ID="lstStockCode" onkeypress="return KeySortDropDownList_onkeypress(this,false)" AutoPostBack="true" AppendDataBoundItems="true" DataSourceID="sqlStockCode" runat="server" Height="26px" Width="325px" DataTextField="Description" DataValueField="StockCode"> </asp:DropDownList> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtStockDesc" CssClass="textbox" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="lstProductClass" onkeypress="return KeySortDropDownList_onkeypress(this,false)" AutoPostBack="true" AppendDataBoundItems="true" DataSourceID="sqlProductClass" runat="server" Height="26px" Width="125px" DataTextField="ProductClass" DataValueField="ProductClass"> </asp:DropDownList> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtQty" CssClass="textbox" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtUom" CssClass="textboxRO" ReadOnly="true" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:Label ID="lblPrice" CssClass="label" runat="server" Text="Price"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblTaxCode" CssClass="label" runat="server" Text="Tax Code"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblStockDate" CssClass="label" runat="server" Text="Request Date"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:Label ID="lblWarehouse" CssClass="label" runat="server" Text="Warehouse"></asp:Label> </asp:TableCell> <asp:TableCell> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> <asp:TextBox ID="txtPrice" CssClass="textbox" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="lstTaxCode" DataSourceID="sqlTaxCode" runat="server" Height="26px" Width="75px" DataTextField="TaxCode" DataValueField="TaxCode"> </asp:DropDownList> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtStockDate" CssClass="textbox" runat="server"></asp:TextBox> <asp:CalendarExtender ID="CalendarExtender4" runat="server" TargetControlID="txtStockDate" Format="dd/MM/yyyy" PopupButtonID="imgStockDate"> </asp:CalendarExtender> <asp:ImageButton ID="imgStockDate" runat="server" ImageUrl="~/Images/date_picker.gif" /> </asp:TableCell> <asp:TableCell> </asp:TableCell> <asp:TableCell> <asp:DropDownList ID="lstWarehouse" DataSourceID="sqlWarehouse" runat="server" Height="26px" Width="100px" DataTextField="Warehouse" DataValueField="Warehouse"> </asp:DropDownList> </asp:TableCell> <asp:TableCell> </asp:TableCell> </asp:TableRow> </asp:Table> <br /> <asp:Table ID="Table4" runat="server" Width="700px" HorizontalAlign="Center"> <asp:TableRow> <asp:TableCell> <asp:Button ID="btnSaveDetail" runat="server" Text="Save Detail Line" /> </asp:TableCell> <asp:TableCell> <asp:Button ID="btnLoadDetail" runat="server" Text="Load Detail Line" /> </asp:TableCell> <asp:TableCell> <asp:Button ID="btnNewDetail" runat="server" Text="New Detail Line" /> </asp:TableCell> <asp:TableCell> </asp:TableCell> </asp:TableRow> </asp:Table> </div> </asp:View> <asp:View ID="viewTotals" runat="server"> <div style="width: 811px; height: 397px"> <asp:Table ID="Table5" runat="server" Width="300px"> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label22" CssClass="label" runat="server" Text="Sales Order"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtSalesOrderTotal" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label10" CssClass="label" runat="server" Text="Invoice Lines"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtLines" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label20" CssClass="label" runat="server" Text="Merchandise Total"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtTotalMerch" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label24" CssClass="label" runat="server" Text="Loan Total"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtTotalLoan" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label28" CssClass="label" runat="server" Text="Rebate Total"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtTotalRebate" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label17" CssClass="label" runat="server" Text="Tax Amount"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtTax" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell HorizontalAlign="Left"> <asp:Label ID="Label11" CssClass="label" runat="server" Text="Invoice Total"></asp:Label> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtInvoiceAmt" CssClass="textboxRO" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> <br /> </div> </asp:View> <asp:View ID="viewXML" runat="server"> <div style="width: 811px; height: 397px"> <asp:Label ID="Label25" runat="server" Text="Parameters"></asp:Label><br /> <asp:TextBox ID="txtParamXML" CssClass="textmemoRO" ReadOnly="true" runat="server" Height="65px" Width="600px"></asp:TextBox><br /> <br /> <asp:Label ID="Label26" runat="server" Text="Posted XML"></asp:Label><br /> <asp:TextBox ID="txtXML" CssClass="textmemoRO" ReadOnly="true" runat="server" Height="65px" Width="600px"></asp:TextBox> <br /> <asp:Label ID="Label27" runat="server" Text="Result XML"></asp:Label><br /> <asp:TextBox ID="txtResultXML" CssClass="textmemoRO" ReadOnly="true" runat="server" Height="65px" Width="600px"></asp:TextBox> </div> </asp:View> </asp:MultiView> <asp:HiddenField ID="fldUid" runat="server" /> <asp:HiddenField ID="fldCoyName" runat="server" /> <asp:HiddenField ID="fldCustEmail" runat="server" /> <asp:HiddenField ID="fldDefWarehouse" runat="server" /> <asp:HiddenField ID="fldPOReq" runat="server" /> <asp:HiddenField ID="fldInvTerms" runat="server" /> <asp:HiddenField ID="fldArea" runat="server" /> <asp:HiddenField ID="fldErrorMessage" runat="server" /> </div> </form> </body> </html> Imports System.Data.SqlClient Partial Public Class SorDetail Inherits System.Web.UI.Page Dim mw As New MessageWindow Protected PostBackStr As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then fldUid.Value = Request.QueryString("uid") lstLineType.Items.Insert(0, "Stocked Item") lstLineType.Items.Insert(1, "Non Stocked Item") lstLineType.Items.Insert(2, "Comments") lstLineType.SelectedIndex = 0 lstStockCode.Items.Insert(0, " ") lstStockCode.SelectedIndex = 0 lstAddress.Items.Insert(0, " ") lstAddress.SelectedIndex = 0 lstStockCode.SelectedIndex = -1 fldErrorMessage.Value = "" lblError.Text = "" lstTaxCodeHeader.SelectedValue = "A" lstTaxCode.SelectedValue = "A" fldDefWarehouse.Value = "V" lstStockCode.Visible = False chHideLR.Checked = True End If If fldErrorMessage.Value <> "" Then Call mw.UserMsgBox(fldErrorMessage.Value) fldErrorMessage.Value = "" End If 'grdStockItems.RebindDataSource() 'grdMain.RebindDataSource() If chFilter.Checked Then grdStockItems.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes Else grdStockItems.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.No End If If chFilterMain.Checked Then grdMain.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes Else grdMain.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.No End If End Sub Protected Sub grdStockItems_InitializeDataSource(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Dim ds As New DataSet Dim DBConn As SqlConnection Dim da As SqlDataAdapter Dim DBSelect As String If chHideLR.Checked Then DBSelect = "Select [SalesOrderLine] as 'Line Number', [LineType] as 'Line Type', [MStockCode] as 'Stock Code', [MStockDes] as 'Description', [MLineShipDate] as 'Request Date', [MOrderQty] as 'Qty Ordered', [MOrderUom] as 'Uom', ([MPrice] + [NMscChargeValue]) as 'Price', [NComment] as 'Comment', [MTaxCode] as 'Tax Code', [MWarehouse] as 'Warehouse' from [SorDetail] where [SalesOrder] = '" & txtSalesOrder.Text & "' and [NComment] NOT LIKE '%LOAN' and [NComment] NOT LIKE '%REBT'" Else DBSelect = "Select [SalesOrderLine] as 'Line Number', [LineType] as 'Line Type', [MStockCode] as 'Stock Code', [MStockDes] as 'Description', [MLineShipDate] as 'Request Date', [MOrderQty] as 'Qty Ordered', [MOrderUom] as 'Uom', ([MPrice] + [NMscChargeValue]) as 'Price', [NComment] as 'Comment', [MTaxCode] as 'Tax Code', [MWarehouse] as 'Warehouse' from [SorDetail] where [SalesOrder] = '" & txtSalesOrder.Text & "'" End If DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "Stock Items") e.DataSource = ds End Sub Protected Sub grdStockItems_PrepareDataBinding(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) grdStockItems.RetrieveHierarchicalStructure() End Sub Protected Sub grdStockItems_InitializeRow(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.RowEventArgs) Handles grdStockItems.InitializeRow End Sub Sub GetCustomerDetails() Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select * From [ArCustomer] where [Customer] = '" & txtCustomer.Text & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "ArCustomer") If DBPageData.Tables(0).Rows.Count > 0 Then txtBranch.Text = DBPageData.Tables(0).Rows(0)("Branch").ToString txtBillAddr.Text = DBPageData.Tables(0).Rows(0)("SoldToAddr1").ToString txtBillAddr.Text = txtBillAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("SoldToAddr2").ToString txtBillAddr.Text = txtBillAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("SoldToAddr3").ToString txtBillAddr.Text = txtBillAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("SoldToAddr4").ToString txtBillCountry.Text = DBPageData.Tables(0).Rows(0)("SoldToAddr5").ToString txtBillPC.Text = DBPageData.Tables(0).Rows(0)("SoldPostalCode").ToString txtShipAddr.Text = DBPageData.Tables(0).Rows(0)("ShipToAddr1").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr2").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr3").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr4").ToString txtShipCountry.Text = DBPageData.Tables(0).Rows(0)("ShipToAddr5").ToString txtShipPC.Text = DBPageData.Tables(0).Rows(0)("ShipPostalCode").ToString fldCustEmail.Value = DBPageData.Tables(0).Rows(0)("Email").ToString If DBPageData.Tables(0).Rows(0)("PONumberMandatory").ToString = "Y" Then fldPOReq.Value = "Y" Else fldPOReq.Value = "N" End If fldInvTerms.Value = DBPageData.Tables(0).Rows(0)("TermsCode").ToString fldArea.Value = DBPageData.Tables(0).Rows(0)("Area").ToString txtSalesperson.Text = DBPageData.Tables(0).Rows(0)("Salesperson").ToString txtOrderDate.Text = Day(Now()) & "/" & Month(Now()) & "/" & Year(Now()) txtShipDate.Text = Day(Now()) & "/" & Month(Now()) & "/" & Year(Now()) End If DBConn.Dispose() DBCommand.Dispose() txtLineNo.Text = "1" lstLineType.SelectedIndex = 0 lblDescription.Text = "Description" txtTotalMerch.Text = "" txtTotalLoan.Text = "" txtTotalRebate.Text = "" txtTax.Text = "" txtLines.Text = "" txtInvoiceAmt.Text = "" txtCustPO.Text = "" Call DisplayFields("Stocked Item") txtQty.Text = "" txtUom.Text = "" End Sub Sub GetSalesDetails() 'save customer name Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim TempDate As DateTime DBSelect = "Select * From [SorMaster] where [SalesOrder] = '" & txtSalesOrder.Text.Trim & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SorMaster") If DBPageData.Tables(0).Rows.Count > 0 Then txtCustomer.Text = DBPageData.Tables(0).Rows(0)("Customer").ToString Call GetCustomerDetails() txtSalesperson.Text = DBPageData.Tables(0).Rows(0)("Salesperson").ToString TempDate = DBPageData.Tables(0).Rows(0)("OrderDate") txtOrderDate.Text = Day(TempDate) & "/" & Month(TempDate) & "/" & Year(TempDate) TempDate = DBPageData.Tables(0).Rows(0)("ReqShipDate") txtShipDate.Text = Day(TempDate) & "/" & Month(TempDate) & "/" & Year(TempDate) txtShipInst.Text = DBPageData.Tables(0).Rows(0)("ShippingInstrs").ToString txtComments.Text = DBPageData.Tables(0).Rows(0)("SpecialInstrs").ToString txtShipAddr.Text = DBPageData.Tables(0).Rows(0)("ShipAddress1").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipAddress2").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipAddress3").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipAddress4").ToString txtShipCountry.Text = DBPageData.Tables(0).Rows(0)("ShipAddress5").ToString txtShipPC.Text = DBPageData.Tables(0).Rows(0)("ShipPostalCode").ToString txtCustPO.Text = DBPageData.Tables(0).Rows(0)("CustomerPONumber").ToString lstTaxCodeHeader.SelectedValue = "A" lstTaxCode.SelectedValue = "A" Call CalcTotals() 'grdStockItems.RebindDataSource() Call RebindStockGrd() End If DBConn.Dispose() DBCommand.Dispose() Call SetupOrderDetails() End Sub Protected Sub WebToolBar1_CommandClick(ByVal sender As Object, ByVal e As ISNet.WebUI.WebDesktop.ToolCommandClickEventArgs) Dim MessageString As String MessageString = e.ClickedCommand.Text Select Case MessageString Case "New" lblError.Text = "" MultiView1.ActiveViewIndex = 0 txtSalesOrder.Text = "" txtSalesOrderDetail.Text = "" txtSalesOrderTotal.Text = "" Call NewCustomerOrder() lstStockCode.SelectedIndex = -1 lstAddress.SelectedIndex = -1 lstTaxCodeHeader.SelectedValue = "A" lstTaxCode.SelectedValue = "A" chHideLR.Checked = True Case "Open" lblError.Text = "" MultiView1.ActiveViewIndex = 0 Call NewSalesOrder() lstStockCode.SelectedIndex = -1 lstAddress.SelectedIndex = -1 chHideLR.Checked = True Case "Save" lblError.Text = "" Call SaveSalesOrder() 'grdStockItems.RebindDataSource() Call RebindStockGrd() lstLineType.Focus() Case "Delete" If DetailLinePresent() Then Call DeleteOrderLine() 'grdStockItems.RebindDataSource() Call RebindStockGrd() Else Call DeleteOrder() MultiView1.ActiveViewIndex = 0 End If Case "Header" MultiView1.ActiveViewIndex = 1 Case "Detail" If txtSalesOrder.Text.Trim = "" Then mw.UserMsgBox("Please save header details first before adding detail lines") Else Call SetupOrderDetails() lstLineType.Focus() MultiView1.ActiveViewIndex = 2 End If Case "Totals" MultiView1.ActiveViewIndex = 3 Case "XML" MultiView1.ActiveViewIndex = 4 End Select End Sub Sub DeleteOrderLine() Dim ThisConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) Dim NonQueryCommand As SqlCommand = ThisConnection.CreateCommand() Dim Cmd As String Dim ThisRow As Integer Dim LineNo As Decimal Dim StockLine As String Dim LoanCheck As String Dim RebateCheck As String Try ThisRow = grdStockItems.RetrieveClientLastSelectedObject().RowIndex LineNo = Convert.ToDecimal(grdStockItems.RootTable.Rows(ThisRow).Cells(0).Value) Catch ex As Exception Call mw.UserMsgBox("Please select a line to delete") GoTo SUBEND Finally End Try If LineNo >= 0 Then Try ThisConnection.Open() Cmd = "DELETE FROM [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text & "' and [SalesOrderLine] = " & LineNo NonQueryCommand.CommandText = Cmd NonQueryCommand.ExecuteNonQuery() ThisConnection.Close() 'delete any lines that might be attached to this one Catch ex As Exception lblError.Text = Convert.ToString(ex) GoTo SUBEND End Try ThisConnection.Open() StockLine = Convert.ToString(LineNo) Do Until Len(StockLine) > 3 StockLine = "0" & StockLine Loop LoanCheck = StockLine & "LOAN" RebateCheck = StockLine & "REBT" Try Cmd = "DELETE FROM [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text & "' and ([NComment] = '" & LoanCheck & "' OR [NComment] = '" & RebateCheck & "')" NonQueryCommand.CommandText = Cmd NonQueryCommand.ExecuteNonQuery() ThisConnection.Close() Catch ex As Exception lblError.Text = Convert.ToString(ex) GoTo SUBEND End Try Else mw.UserMsgBox("Please select a line to delete") End If SUBEND: End Sub Sub SaveSalesOrder() If Not ValidValues() Then GoTo ENDSUB End If Dim HeaderXML As String Dim DetailXML As String Dim XMLParam As String = GetXMLParam() Dim ResultXML As String = "" If txtSalesOrder.Text.Trim = "" Then HeaderXML = GetHeaderXML("A") DetailXML = "" Else HeaderXML = GetHeaderXML("C") DetailXML = GetDetailXML() End If Dim Util As New Syspro.Utilities.Utilities Dim ValidLogin As Boolean = True Dim Trans As New Syspro.Transaction.Transaction ResultXML = Trans.Post(fldUid.Value, "SORTOI", XMLParam, HeaderXML & DetailXML) If InStr(ResultXML, "System.Runtime.InteropServices") > 0 Then lblError.Text = "Error found - " & ResultXML Else Call GetSalesOrder(ResultXML) End If txtParamXML.Text = XMLParam txtXML.Text = HeaderXML & DetailXML txtResultXML.Text = ResultXML Call SetupOrderDetails() lstLineType.Focus() Call CalcTotals() ENDSUB: End Sub Function GetXMLParam() As String Dim XMLParam As String = "" XMLParam &= "<?xml version=""1.0"" encoding=""Windows-1252""?>" XMLParam &= "<SalesOrders xmlns:xsd=""http://www.w3.org/2001/XMLSchema-instance"" xsd:noNamespaceSchemaLocation=""SORTOI.XSD"">" XMLParam &= " <Parameters>" XMLParam &= " <InBoxMsgReqd>Y</InBoxMsgReqd>" XMLParam &= " <Process>IMPORT</Process>" XMLParam &= " <CustomerToUse/>" XMLParam &= " <WarehouseListToUse>" & fldDefWarehouse.Value & "</WarehouseListToUse>" XMLParam &= " <TypeOfOrder>ORD</TypeOfOrder>" XMLParam &= " <OrderStatus>1</OrderStatus>" XMLParam &= " <MinimumDaysToShip>0</MinimumDaysToShip>" XMLParam &= " <AllowNonStockItems>Y</AllowNonStockItems>" XMLParam &= " <AcceptOrdersIfNoCredit>Y</AcceptOrdersIfNoCredit>" XMLParam &= " <AcceptEarlierShipDate>Y</AcceptEarlierShipDate>" XMLParam &= " <OperatorToInform>" & User.Identity.Name.Trim() & "</OperatorToInform>" XMLParam &= " <CreditFailMessage>No credit available</CreditFailMessage>" XMLParam &= " <ValidProductClassList></ValidProductClassList>" XMLParam &= " <ShipFromDefaultBin>N</ShipFromDefaultBin>" XMLParam &= " <AllowDuplicateOrderNumbers>Y</AllowDuplicateOrderNumbers>" XMLParam &= " <CheckForCustomerPoNumbers>Y</CheckForCustomerPoNumbers>" XMLParam &= " <AllowInvoiceInformationEntry/>" XMLParam &= " <AlwaysUsePriceEntered/>" XMLParam &= " <AllowZeroPrice/>" XMLParam &= " <AllowChangeToZeroPrice></AllowChangeToZeroPrice>" XMLParam &= " <AddStockSalesOrderText>N</AddStockSalesOrderText>" XMLParam &= " <AddDangerousGoodsText>N</AddDangerousGoodsText>" XMLParam &= " <UseStockDescSupplied/>" XMLParam &= " <ValidateShippingInstrs/>" XMLParam &= " <AllocationAction></AllocationAction>" XMLParam &= " <IgnoreWarnings>N</IgnoreWarnings>" XMLParam &= " <AddAttachedServiceCharges></AddAttachedServiceCharges>" XMLParam &= " <StatusInProcess></StatusInProcess>" XMLParam &= " <StatusInProcessResponse></StatusInProcessResponse>" XMLParam &= " <WarnIfCustomerOnHold>N</WarnIfCustomerOnHold>" XMLParam &= " <AcceptKitOptional>N</AcceptKitOptional>" XMLParam &= " <AllowBackOrderForPartialHold></AllowBackOrderForPartialHold>" XMLParam &= " <UseMasterAccountForCustomerPartNo></UseMasterAccountForCustomerPartNo>" XMLParam &= " <ApplyLeadTimeCalculation></ApplyLeadTimeCalculation>" XMLParam &= " <ApplyParentDiscountToComponents>N</ApplyParentDiscountToComponents>" XMLParam &= " <AllowManualOrderNumberToBeUsed>N</AllowManualOrderNumberToBeUsed>" XMLParam &= " <ReserveStock></ReserveStock>" XMLParam &= " <ReserveStockRequestAllocs></ReserveStockRequestAllocs>" XMLParam &= " </Parameters>" XMLParam &= "</SalesOrders>" Return XMLParam End Function Private Function ValidValues() As Boolean ValidValues = True If txtCustPO.Text.Trim = "" And fldPOReq.Value = "Y" Then txtCustPO.ToolTip = "Purchase order cannot be blank" txtCustPO.BackColor = Drawing.Color.Yellow ValidValues = False txtCustPO.Focus() Else txtCustPO.BackColor = Drawing.Color.White txtCustPO.ToolTip = "" End If If txtShipDate.Text.Trim = "" Then txtShipDate.ToolTip = "Shipping date cannot be blank" txtShipDate.BackColor = Drawing.Color.Yellow ValidValues = False txtShipDate.Focus() Else txtShipDate.BackColor = Drawing.Color.White txtShipDate.ToolTip = "" End If If Not ValidValues Then Call mw.UserMsgBox("Errors found on form - please correct before re-submitting") End If End Function Private Function GetHeaderXML(ByVal PostMethod As Char) As String Dim SXml As String Dim TempDate As DateTime Dim addtext() As String Dim line As String Dim DD As String Dim MM As String Dim YY As String Dim arrlist As ArrayList Dim CharSearch As Integer arrlist = New ArrayList addtext = txtShipAddr.Text.Split(vbCrLf) For Each line In addtext line = line.Replace(vbCr, "").Replace(vbLf, "") arrlist.Add(line) Next If arrlist.Count < 5 Then Do Until arrlist.Count = 5 arrlist.Add(" ") Loop End If For i = 0 To 4 CharSearch = InStr(arrlist(i), "&") If CharSearch > 0 Then arrlist(i) = Left(arrlist(i), CharSearch - 1) & "@amp;" & Right(arrlist(i), Len(arrlist(i)) - CharSearch) If Len(arrlist(i)) > 40 Then arrlist(i) = Left(arrlist(i), 40) End If End If Next YY = Convert.ToString(Year(Today())) MM = Convert.ToString(Month(Today())) DD = Convert.ToString(Day(Today())) If Len(MM) <> 2 Then MM = "0" & MM End If If Len(DD) <> 2 Then DD = "0" & DD End If SXml = "<?xml version=""1.0"" encoding=""Windows-1252""?>" SXml &= "<SalesOrders xmlns:xsd=""http://www.w3.org/2001/XMLSchema-instance"" xsd:noNamespaceSchemaLocation=""SORTOIDOC.XSD"">" SXml &= " <TransmissionHeader>" SXml &= " <TransmissionReference>00000000000003</TransmissionReference>" SXml &= " <SenderCode></SenderCode>" SXml &= " <ReceiverCode>HO</ReceiverCode>" SXml &= " <DatePrepared>" & YY & "-" & MM & "-" & DD & "</DatePrepared>" SXml &= " <TimePrepared>" & Hour(Now()) & ":" & Minute(Now()) & "</TimePrepared>" SXml &= " </TransmissionHeader>" SXml &= " <Orders>" SXml &= " <OrderHeader>" SXml &= " <CustomerPoNumber>" & txtCustPO.Text.Trim & "</CustomerPoNumber>" SXml &= " <OrderActionType>" & PostMethod & "</OrderActionType>" SXml &= " <NewCustomerPoNumber/>" SXml &= " <Supplier/>" SXml &= " <Customer>" & txtCustomer.Text.Trim & "</Customer>" TempDate = Convert.ToDateTime(txtOrderDate.Text) YY = Convert.ToString(Year(TempDate)) MM = Convert.ToString(Month(TempDate)) DD = Convert.ToString(Day(TempDate)) If Len(MM) <> 2 Then MM = "0" & MM End If If Len(DD) <> 2 Then DD = "0" & DD End If SXml &= " <OrderDate>" & YY & "-" & MM & "-" & DD & "</OrderDate>" SXml &= " <InvoiceTerms>" & fldInvTerms.Value & "</InvoiceTerms>" SXml &= " <Currency>$</Currency>" SXml &= " <ShippingInstrs>" & txtShipInst.Text.Trim & "</ShippingInstrs>" SXml &= " <CustomerName>" & fldCoyName.Value & "</CustomerName>" SXml &= " <ShipAddress1>" & arrlist.Item(0) & "</ShipAddress1>" SXml &= " <ShipAddress2>" & arrlist.Item(1) & "</ShipAddress2>" SXml &= " <ShipAddress3>" & arrlist.Item(2) & "</ShipAddress3>" SXml &= " <ShipAddress4>" & arrlist.Item(3) & "</ShipAddress4>" SXml &= " <ShipAddress5>" & arrlist.Item(4) & "</ShipAddress5>" SXml &= " <ShipPostalCode>" & txtShipPC.Text & "</ShipPostalCode>" SXml &= " <Email>" & fldCustEmail.Value & "</Email>" SXml &= " <Warehouse>" & fldDefWarehouse.Value & "</Warehouse>" SXml &= " <SpecialInstrs>" & txtComments.Text & "</SpecialInstrs>" SXml &= " <SalesOrder>" & txtSalesOrder.Text.Trim & "</SalesOrder>" SXml &= " <OrderType>1</OrderType>" SXml &= " <MultiShipCode></MultiShipCode>" SXml &= " <ShipAddressPerLine></ShipAddressPerLine>" SXml &= " <AlternateReference/>" SXml &= " <Salesperson>" & txtSalesperson.Text & "</Salesperson>" SXml &= " <Branch></Branch>" SXml &= " <Area></Area>" TempDate = Convert.ToDateTime(txtShipDate.Text) YY = Convert.ToString(Year(TempDate)) MM = Convert.ToString(Month(TempDate)) DD = Convert.ToString(Day(TempDate)) If Len(MM) <> 2 Then MM = "0" & MM End If If Len(DD) <> 2 Then DD = "0" & DD End If SXml &= " <RequestedShipDate>" & YY & "-" & MM & "-" & DD & "</RequestedShipDate>" SXml &= " <InvoiceNumberEntered></InvoiceNumberEntered>" SXml &= " <InvoiceDateEntered></InvoiceDateEntered>" SXml &= " <OrderComments/>" SXml &= " <Nationality/>" SXml &= " <DeliveryTerms/>" SXml &= " <TransactionNature/>" SXml &= " <TransportMode/>" SXml &= " <ProcessFlag/>" SXml &= " <TaxExemptNumber/>" SXml &= " <TaxExemptionStatus></TaxExemptionStatus>" SXml &= " <GstExemptNumber/>" SXml &= " <GstExemptionStatus></GstExemptionStatus>" SXml &= " <CompanyTaxNumber/>" If PostMethod = "D" Then SXml &= " <CancelReasonCode>OB</CancelReasonCode>" Else SXml &= " <CancelReasonCode/>" End If SXml &= " <DocumentFormat/>" SXml &= " <State/>" SXml &= " <CountyZip/>" SXml &= " <City/>" SXml &= " <InvoiceWholeOrderOnly></InvoiceWholeOrderOnly>" SXml &= " <eSignature></eSignature>" SXml &= " </OrderHeader>" If PostMethod <> "C" Then SXml &= " </Orders>" SXml &= "</SalesOrders>" End If 'search for special characters Return SXml End Function Function GetDetailXML() Dim SXml As String = "<OrderDetails>" Dim LineType As String Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim ThisStock As String Dim ThisDesc As String Dim ThisPrice As Decimal Dim ThisQty As String Dim ThisUom As String Dim ThisLineNo As String Dim ThisShipDate As DateTime Dim LastStockLine As String = "" Dim LineWritten As Boolean = False Dim CalcQty As Decimal = 0 Dim ThisTaxCode As String = "" Dim ThisWarehouse As String DBSelect = "Select * from [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text.Trim & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SalesOrder") For i As Integer = 0 To DBPageData.Tables(0).Rows.Count - 1 LineType = DBPageData.Tables(0).Rows(i)("LineType") ThisLineNo = Convert.ToString(DBPageData.Tables(0).Rows(i)("SalesOrderLine")) ThisPrice = Convert.ToDecimal(DBPageData.Tables(0).Rows(i)("MPrice")) CalcQty = Convert.ToDecimal(DBPageData.Tables(0).Rows(i)("MOrderQty")) If ThisLineNo = txtLineNo.Text.Trim Then ThisTaxCode = lstTaxCode.SelectedValue ThisShipDate = Convert.ToDateTime(txtStockDate.Text) LineWritten = True Select Case lstLineType.SelectedValue Case "Stocked Item" ThisWarehouse = lstWarehouse.SelectedValue SXml &= XMLLineType1("C", "A", txtLineNo.Text.Trim, txtStockCode.Text, txtStockDesc.Text.Trim, txtQty.Text.Trim, txtUom.Text.Trim, ThisShipDate, txtPrice.Text, ThisTaxCode, ThisWarehouse) LastStockLine = txtLineNo.Text Case "Non Stocked Item" SXml &= XMLLineType2("C", txtLineNo.Text.Trim, txtStockCode.Text, txtStockDesc.Text.Trim, txtQty.Text.Trim, txtUom.Text.Trim, ThisShipDate, txtPrice.Text, ThisTaxCode) LastStockLine = txtLineNo.Text Case "Comments" SXml &= XMLLinetype6("C", txtLineNo.Text.Trim, txtStockDesc.Text.Trim, LastStockLine.Trim) End Select Else ThisShipDate = Convert.ToDateTime(txtStockDate.Text) Select Case LineType Case "1" ThisStock = DBPageData.Tables(0).Rows(i)("MStockCode") ThisDesc = DBPageData.Tables(0).Rows(i)("MStockDes") ThisQty = DBPageData.Tables(0).Rows(i)("MOrderQty") ThisUom = DBPageData.Tables(0).Rows(i)("MOrderUom") ThisTaxCode = DBPageData.Tables(0).Rows(i)("MTaxCode") ThisShipDate = DBPageData.Tables(0).Rows(i)("MLineShipDate") LastStockLine = ThisLineNo ThisWarehouse = DBPageData.Tables(0).Rows(i)("MWarehouse") SXml &= XMLLineType1("C", "C", ThisLineNo.Trim, ThisStock.Trim, ThisDesc.Trim, ThisQty.Trim, ThisUom.Trim, ThisShipDate, ThisPrice, ThisTaxCode, ThisWarehouse) Case "2" ThisStock = DBPageData.Tables(0).Rows(i)("MStockCode") ThisDesc = DBPageData.Tables(0).Rows(i)("MStockDes") ThisQty = DBPageData.Tables(0).Rows(i)("MOrderQty") ThisUom = DBPageData.Tables(0).Rows(i)("MTaxCode") ThisShipDate = DBPageData.Tables(0).Rows(i)("MLineShipDate") LastStockLine = ThisLineNo SXml &= XMLLineType2("C", ThisLineNo.Trim, ThisStock.Trim, ThisDesc.Trim, ThisQty.Trim, ThisUom.Trim, ThisShipDate, ThisPrice, ThisTaxCode) Case "6" ThisDesc = DBPageData.Tables(0).Rows(i)("NComment") LastStockLine = DBPageData.Tables(0).Rows(i)("NCommentFromLin") SXml &= XMLLinetype6("C", ThisLineNo.Trim, ThisDesc.Trim, LastStockLine.Trim) End Select End If Next If Not LineWritten And (txtStockDesc.Text.Trim <> "" Or txtQty.Text <> "") Then ThisLineNo = txtLineNo.Text Select Case lstLineType.SelectedValue Case "Stocked Item" ThisShipDate = Convert.ToDateTime(txtStockDate.Text) ThisPrice = Convert.ToDecimal(txtPrice.Text) ThisStock = txtStockCode.Text ThisWarehouse = lstWarehouse.SelectedValue SXml &= XMLLineType1("A", "A", txtLineNo.Text.Trim, ThisStock, txtStockDesc.Text.Trim, txtQty.Text.Trim, txtUom.Text.Trim, ThisShipDate, ThisPrice, lstTaxCode.SelectedValue, ThisWarehouse) LastStockLine = txtLineNo.Text Case "Non Stocked Item" ThisShipDate = Convert.ToDateTime(txtStockDate.Text) ThisPrice = Convert.ToDecimal(txtPrice.Text) SXml &= XMLLineType2("A", txtLineNo.Text.Trim, txtStockCode.Text, txtStockDesc.Text.Trim, txtQty.Text.Trim, txtUom.Text.Trim, ThisShipDate, ThisPrice, lstTaxCode.SelectedValue) LastStockLine = txtLineNo.Text Case "Comments" SXml &= XMLLinetype6("A", txtLineNo.Text.Trim, txtStockDesc.Text.Trim, LastStockLine.Trim) End Select End If SXml &= " </OrderDetails>" SXml &= " </Orders>" SXml &= "</SalesOrders>" 'Call CalcTotals() DBCommand.Dispose() DBConn.Dispose() Return SXml End Function Function GetTaxAmt(ByVal ThisTaxCode As String) As Decimal Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select [CurTaxRate] from [AdmTax] WHERE [TaxCode] = '" & ThisTaxCode & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "AdmTax") If DBPageData.Tables(0).Rows.Count > 0 Then Return DBPageData.Tables(0).Rows(0)("CurTaxRate") Else Return 0 End If End Function Function XMLLineType1(ByVal ThisMode As String, ByVal LoanMode As String, ByVal ThisLineNo As String, ByVal ThisStock As String, ByVal ThisDesc As String, ByVal ThisQty As String, ByVal ThisUom As String, ByVal ThisShipDate As DateTime, ByVal ThisPrice As Decimal, ByVal ThisTaxCode As String, ByVal ThisWarehouse As String) As String Dim ThisXml As String = "" Dim LoanXml As String = "" Dim TempDate As DateTime Dim LoanAmt As Decimal = 0 Dim DD As String Dim MM As String Dim YY As String ThisXml &= " <StockLine>" ThisXml &= " <CustomerPoLine>" & ThisLineNo & "</CustomerPoLine>" ThisXml &= " <LineActionType>" & ThisMode & "</LineActionType>" ThisXml &= " <LineCancelCode/>" ThisXml &= " <StockCode>" & ThisStock & "</StockCode>" ThisXml &= " <StockDescription>" & ThisDesc & "</StockDescription>" ThisXml &= " <Warehouse>" & Trim(ThisWarehouse) & "</Warehouse>" 'ThisXml &= " <Warehouse>" & GetWarehouse(ThisStock) & "</Warehouse>" ThisXml &= " <CustomersPartNumber></CustomersPartNumber>" ThisXml &= " <OrderQty>" & ThisQty & "</OrderQty>" ThisXml &= " <OrderUom>" & ThisUom & "</OrderUom>" If fldArea.Value <> "A" Then ThisLineNo = Convert.ToString(Convert.ToInt16(ThisLineNo) + 1) LoanXml = GetLoanAmt(ThisMode, ThisStock, ThisLineNo, LoanAmt, ThisQty) End If 'If LoanMode = "A" Then ' ThisPrice = ThisPrice - LoanAmt 'End If ThisXml &= " <Price>" & Convert.ToString(ThisPrice) & "</Price>" ThisXml &= " <PriceUom>" & ThisUom & "</PriceUom>" ThisXml &= " <PriceCode></PriceCode>" ThisXml &= " <AlwaysUsePriceEntered/>" ThisXml &= " <Units/>" ThisXml &= " <Pieces/>" ThisXml &= " <ProductClass></ProductClass>" ThisXml &= " <LineDiscPercent1></LineDiscPercent1>" ThisXml &= " <LineDiscPercent2></LineDiscPercent2>" ThisXml &= " <LineDiscPercent3></LineDiscPercent3>" TempDate = ThisShipDate YY = Convert.ToString(Year(TempDate)) MM = Convert.ToString(Month(TempDate)) DD = Convert.ToString(Day(TempDate)) If Len(MM) <> 2 Then MM = "0" & MM End If If Len(DD) <> 2 Then DD = "0" & DD End If ThisXml &= " <CustRequestDate>" & YY & "-" & MM & "-" & DD & "</CustRequestDate>" ThisXml &= " <CommissionCode></CommissionCode>" ThisXml &= " <LineShipDate/>" ThisXml &= " <LineDiscValue>0</LineDiscValue>" ThisXml &= " <LineDiscValFlag></LineDiscValFlag>" ThisXml &= " <OverrideCalculatedDiscount/>" ThisXml &= " <NonStockedLine/>" ThisXml &= " <NsProductClass></NsProductClass>" ThisXml &= " <NsUnitCost/>" ThisXml &= " <UnitMass/>" ThisXml &= " <UnitVolume/>" ThisXml &= " <StockTaxCode>" & ThisTaxCode & "</StockTaxCode>" ThisXml &= " <StockNotTaxable/>" ThisXml &= " <StockFstCode/>" ThisXml &= " <StockNotFstTaxable/>" ThisXml &= " <AllocationAction></AllocationAction>" ThisXml &= " <ConfigPrintInv></ConfigPrintInv>" ThisXml &= " <ConfigPrintDel></ConfigPrintDel>" ThisXml &= " <ConfigPrintAck></ConfigPrintAck>" ThisXml &= " <TariffCode></TariffCode>" ThisXml &= " <LineMultiShipCode></LineMultiShipCode>" ThisXml &= " <SupplementaryUnitsFactor></SupplementaryUnitsFactor>" ThisXml &= " <ReserveStock></ReserveStock>" ThisXml &= " <ReserveStockRequestAllocs></ReserveStockRequestAllocs>" ThisXml &= " </StockLine>" If fldArea.Value <> "A" Then ThisLineNo = Convert.ToString(Convert.ToInt16(ThisLineNo) + 1) ThisXml &= LoanXml End If ThisXml &= GetRebateAmt(ThisMode, ThisStock, ThisLineNo) Return ThisXml End Function Function GetLoanAmt(ByVal ThisMode As String, ByVal ThisStock As String, ByVal ThisLineNo As String, ByRef LoanAmt As Decimal, ByVal ThisQty As String) As String Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim StockLine As String StockLine = Convert.ToString(Convert.ToDecimal(ThisLineNo.Trim) - 1) Do Until Len(StockLine) > 3 StockLine = "0" & StockLine Loop DBSelect = "Select [MsaSorLoan].*, [InvMaster].[ConvFactAltUom] from [MsaSorLoan] Inner Join InvMaster on [InvMaster].[StockCode] = [MsaSorLoan].[StockCode] WHERE [Customer] = '" & txtCustomer.Text.Trim & "' and [MsaSorLoan].[StockCode] = '" & ThisStock & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "MsaSorLoan") If DBPageData.Tables(0).Rows.Count = 0 Then LoanAmt = 0 Return "" GoTo ENDSUB End If Dim ThisXml As String = "" LoanAmt = System.Math.Round(Convert.ToDecimal(DBPageData.Tables(0).Rows(0)("LoanAmt")) * Convert.ToDecimal(DBPageData.Tables(0).Rows(0)("ConvFactAltUom")) * Convert.ToDecimal(ThisQty), 2) ThisXml &= " <MiscChargeLine>" ThisXml &= " <CustomerPoLine>" & ThisLineNo & "</CustomerPoLine>" ThisXml &= " <LineActionType>" & ThisMode & "</LineActionType>" ThisXml &= " <LineCancelCode/>" ThisXml &= " <MiscChargeValue>" & Convert.ToString(LoanAmt) & "</MiscChargeValue>" ThisXml &= " <MiscChargeCost>0</MiscChargeCost>" ThisXml &= " <MiscQuantity>" & ThisQty & "</MiscQuantity>" ThisXml &= " <MiscProductClass>LOAN</MiscProductClass>" ThisXml &= " <MiscTaxCode>A</MiscTaxCode>" ThisXml &= " <MiscNotTaxable/>" ThisXml &= " <MiscFstCode></MiscFstCode>" ThisXml &= " <MiscNotFstTaxable/>" ThisXml &= " <MiscDescription>" & StockLine & "LOAN</MiscDescription>" ThisXml &= " <MiscChargeCode></MiscChargeCode>" ThisXml &= " <MiscTariffCode></MiscTariffCode>" ThisXml &= " <ConfigPrintInv></ConfigPrintInv>" ThisXml &= " <ConfigPrintDel></ConfigPrintDel>" ThisXml &= " <ConfigPrintAck></ConfigPrintAck>" ThisXml &= " </MiscChargeLine>" DBCommand.Dispose() DBConn.Dispose() Return ThisXml ENDSUB: End Function Function GetRebateAmt(ByVal ThisMode As String, ByVal ThisStock As String, ByVal ThisLineNo As String) As String Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim StockLine As String StockLine = txtLineNo.Text.Trim Do Until Len(StockLine) > 3 StockLine = "0" & StockLine Loop DBSelect = "Select * from [MsaSorRebate] WHERE [Customer] = '" & txtCustomer.Text.Trim & "' and [StockCode] = '" & ThisStock & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "MsaSorRebate") If DBPageData.Tables(0).Rows.Count = 0 Then Return "" GoTo ENDSUB End If Dim ThisXml As String = "" ThisXml &= " <MiscChargeLine>" ThisXml &= " <CustomerPoLine>" & ThisLineNo & "</CustomerPoLine>" ThisXml &= " <LineActionType>" & ThisMode & "</LineActionType>" ThisXml &= " <LineCancelCode/>" ThisXml &= " <MiscChargeValue>" & DBPageData.Tables(0).Rows(0)("RebateAmt").ToString & "</MiscChargeValue>" ThisXml &= " <MiscChargeCost>0</MiscChargeCost>" ThisXml &= " <MiscQuantity>" & txtQty.Text & "</MiscQuantity>" ThisXml &= " <MiscProductClass>REBT</MiscProductClass>" ThisXml &= " <MiscTaxCode>A</MiscTaxCode>" ThisXml &= " <MiscNotTaxable/>" ThisXml &= " <MiscFstCode></MiscFstCode>" ThisXml &= " <MiscNotFstTaxable/>" ThisXml &= " <MiscDescription>" & StockLine & "REBT</MiscDescription>" ThisXml &= " <MiscChargeCode></MiscChargeCode>" ThisXml &= " <MiscTariffCode></MiscTariffCode>" ThisXml &= " <ConfigPrintInv></ConfigPrintInv>" ThisXml &= " <ConfigPrintDel></ConfigPrintDel>" ThisXml &= " <ConfigPrintAck></ConfigPrintAck>" ThisXml &= " </MiscChargeLine>" DBCommand.Dispose() DBConn.Dispose() Return ThisXml ENDSUB: End Function Function XMLLineType2(ByVal ThisMode As String, ByVal ThisLineNo As String, ByVal ThisStock As String, ByVal ThisDesc As String, ByVal ThisQty As String, ByVal ThisUom As String, ByVal ThisShipDate As DateTime, ByVal ThisPrice As Decimal, ByVal ThisTaxCode As String) As String Dim ThisXml As String = "" Dim TempDate As DateTime Dim YY As String Dim MM As String Dim DD As String ThisXml &= " <StockLine>" ThisXml &= " <CustomerPoLine>" & ThisLineNo & "</CustomerPoLine>" ThisXml &= " <LineActionType>" & ThisMode & "</LineActionType>" ThisXml &= " <LineCancelCode/>" ThisXml &= " <StockCode>" & ThisStock & "</StockCode>" ThisXml &= " <StockDescription>" & ThisDesc & "</StockDescription>" ThisXml &= " <Warehouse>FG</Warehouse>" ThisXml &= " <CustomersPartNumber></CustomersPartNumber>" ThisXml &= " <OrderQty>" & ThisQty & "</OrderQty>" ThisXml &= " <OrderUom>" & ThisUom & "</OrderUom>" ThisXml &= " <Price>" & Convert.ToString(ThisPrice) & "</Price>" ThisXml &= " <PriceUom>" & ThisUom & "</PriceUom>" ThisXml &= " <PriceCode></PriceCode>" ThisXml &= " <AlwaysUsePriceEntered/>" ThisXml &= " <Units/>" ThisXml &= " <Pieces/>" ThisXml &= " <ProductClass>" & lstProductClass.SelectedValue & "</ProductClass>" ThisXml &= " <LineDiscPercent1></LineDiscPercent1>" ThisXml &= " <LineDiscPercent2></LineDiscPercent2>" ThisXml &= " <LineDiscPercent3></LineDiscPercent3>" TempDate = ThisShipDate YY = Convert.ToString(Year(TempDate)) MM = Convert.ToString(Month(TempDate)) DD = Convert.ToString(Day(TempDate)) If Len(MM) <> 2 Then MM = "0" & MM End If If Len(DD) <> 2 Then DD = "0" & DD End If ThisXml &= " <CustRequestDate>" & YY & "-" & MM & "-" & DD & "</CustRequestDate>" ThisXml &= " <CommissionCode></CommissionCode>" ThisXml &= " <LineShipDate/>" ThisXml &= " <LineDiscValue>0</LineDiscValue>" ThisXml &= " <LineDiscValFlag></LineDiscValFlag>" ThisXml &= " <OverrideCalculatedDiscount/>" ThisXml &= " <NonStockedLine/>" ThisXml &= " <NsProductClass>" & lstProductClass.SelectedValue & "</NsProductClass>" ThisXml &= " <NsUnitCost/>" ThisXml &= " <UnitMass/>" ThisXml &= " <UnitVolume/>" ThisXml &= " <StockTaxCode>" & ThisTaxCode & "</StockTaxCode>" ThisXml &= " <StockNotTaxable/>" ThisXml &= " <StockFstCode/>" ThisXml &= " <StockNotFstTaxable/>" ThisXml &= " <AllocationAction></AllocationAction>" ThisXml &= " <ConfigPrintInv></ConfigPrintInv>" ThisXml &= " <ConfigPrintDel></ConfigPrintDel>" ThisXml &= " <ConfigPrintAck></ConfigPrintAck>" ThisXml &= " <TariffCode></TariffCode>" ThisXml &= " <LineMultiShipCode></LineMultiShipCode>" ThisXml &= " <SupplementaryUnitsFactor></SupplementaryUnitsFactor>" ThisXml &= " <ReserveStock></ReserveStock>" ThisXml &= " <ReserveStockRequestAllocs></ReserveStockRequestAllocs>" ThisXml &= " </StockLine>" Return ThisXml End Function Function XMLLinetype6(ByVal ThisMode As String, ByVal ThisLineNo As String, ByVal ThisDesc As String, ByVal LastStockLine As String) As String Dim ThisXML As String = "" ThisXML &= " <CommentLine>" ThisXML &= " <CustomerPoLine>" & ThisLineNo & "</CustomerPoLine>" ThisXML &= " <LineActionType>" & ThisMode & "</LineActionType>" ThisXML &= " <Comment>" & ThisDesc & "</Comment>" ThisXML &= " <AttachedLineNumber>" & LastStockLine & "</AttachedLineNumber>" ThisXML &= " <CommentType/>" ThisXML &= " </CommentLine>" Return ThisXML End Function Sub GetSalesOrder(ByVal XmlOut As String) If InStr(XmlOut, "<ErrorDescription>") > 0 Then lblError.Text = "Error found on form - " & vbCrLf & vbCrLf & Mid(XmlOut, InStr(XmlOut, "<ErrorDescription>") + 18, InStr(XmlOut, "</ErrorDescription>") - 18 - InStr(XmlOut, "<ErrorDescription>")) Call mw.UserMsgBox(lblError.Text) GoTo ENDSUB End If If InStr(XmlOut, "<WarningDescription>") > 0 Then lblError.Text = "Warning - " & vbCrLf & vbCrLf & Mid(XmlOut, InStr(XmlOut, "<WarningDescription>") + 20, InStr(XmlOut, "</WarningDescription>") - 20 - InStr(XmlOut, "<ErrorDescription>")) Call mw.UserMsgBox(lblError.Text) GoTo ENDSUB End If lblError.Text = "Sales Order Saved Successfully" If txtSalesOrder.Text.Trim = "" And InStr(XmlOut, "<SalesOrder>") > 0 Then txtSalesOrder.Text = Mid(XmlOut, InStr(XmlOut, "<SalesOrder>") + 12, InStr(XmlOut, "</SalesOrder>") - 12 - InStr(XmlOut, "<SalesOrder>")) txtSalesOrderDetail.Text = txtSalesOrder.Text txtSalesOrderTotal.Text = txtSalesOrder.Text End If ENDSUB: End Sub Private Sub chFilter_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chFilter.CheckedChanged If chFilter.Checked Then grdStockItems.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes Else grdStockItems.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.No End If End Sub Private Sub chFilterMain_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chFilterMain.CheckedChanged If chFilterMain.Checked Then grdMain.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes Else grdMain.LayoutSettings.AllowFilter = ISNet.WebUI.WebGrid.Filter.No End If End Sub Protected Sub grdMain_InitializeDataSource(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Dim ds As New DataSet Dim DBConn As SqlConnection Dim da As SqlDataAdapter Dim DBSelect As String If fldMode.Value = "Customer" Then DBSelect = "Select [Customer], [Name], [CreditStatus] as 'Credit Status', [ShipToAddr3] as 'Suburb', [ShipToAddr4] as 'State', [Salesperson], [Contact] from [ArCustomer] ORDER BY [Customer] ASC" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "Customer") grdMain.RootTable.DataKeyField = "Customer" Else DBSelect = "Select [SalesOrder] as 'Sales Order', [OrderStatus] as 'Order Status', [Customer], [Salesperson], [CustomerPoNumber] as 'PO Number', [OrderDate] as 'Order Date' from [SorMaster] where ActiveFlag <> 'N' and [OrderStatus] <> '\'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "SalesOrder") grdMain.RootTable.DataKeyField = "SalesOrder" End If e.DataSource = ds End Sub Protected Sub grdMain_PrepareDataBinding(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) ' If (Not IsPostBack) Then grdMain.RetrieveHierarchicalStructure() ' End If End Sub Protected Sub grdMain_InitializeRow(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.RowEventArgs) Handles grdMain.InitializeRow ' If fldMode.Value <> "Customer" Then If grdMain.RootTable.DataKeyField = "SalesOrder" Then grdMain.RootTable.Columns.GetNamedItem("Order Date").DataFormatString = "dd/MM/yyyy" End If ' End If End Sub Private Sub NewSalesOrder() fldMode.Value = "SalesOrder" Dim ds As New DataSet Dim DBConn As SqlConnection Dim da As SqlDataAdapter Dim DBSelect As String DBSelect = "Select [SalesOrder] as 'Sales Order', [OrderStatus] as 'Order Status', [Customer], [Salesperson], [CustomerPoNumber] as 'PO Number', [OrderDate] as 'Order Date' from [SorMaster] where ActiveFlag <> 'N'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "SalesOrder") grdMain.RootTable.DataKeyField = "SalesOrder" grdMain.Width = 650 grdMain.DataSource = ds grdMain.RebindDataSource() End Sub Private Sub NewCustomerOrder() Dim ds As New DataSet Dim DBConn As SqlConnection Dim da As SqlDataAdapter Dim DBSelect As String fldMode.Value = "Customer" DBSelect = "Select [Customer], [Name], [CreditStatus] as 'Credit Status', [ShipToAddr3] as 'Suburb', [ShipToAddr4] as 'State', [Salesperson], [Contact] from [ArCustomer] ORDER BY [Customer] ASC" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "Customer") grdMain.RootTable.DataKeyField = "Customer" grdMain.Width = 790 grdMain.DataSource = ds grdMain.RebindDataSource() End Sub Private Sub lstLineType_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstLineType.TextChanged Call DisplayFields(lstLineType.SelectedValue) End Sub Private Sub btnLoadDetail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoadDetail.Click Try Dim ThisRow As Integer Dim LineType As String ThisRow = grdStockItems.RetrieveClientLastSelectedObject().RowIndex LineType = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(1).Value) If LineType <> "" Then txtLineNo.Text = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(0).Value) Select Case LineType Case "1" lstLineType.SelectedIndex = 0 Call DisplayFields("Stocked Item") txtStockCode.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(2).Value txtStockDate.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(4).Value txtPrice.Text = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(7).Value) txtUom.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(6).Value txtQty.Text = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(5).Value) txtStockDesc.Text = Trim(grdStockItems.RootTable.Rows(ThisRow).Cells(3).Value) txtQty.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(5).Value txtUom.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(6).Value lstTaxCode.SelectedValue = grdStockItems.RootTable.Rows(ThisRow).Cells(9).Value Case "2" lstLineType.SelectedIndex = 1 Call DisplayFields("Non Stocked Item") txtStockCode.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(2).Value txtStockDate.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(4).Value txtPrice.Text = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(7).Value) txtUom.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(6).Value txtQty.Text = Convert.ToString(grdStockItems.RootTable.Rows(ThisRow).Cells(5).Value) txtStockDesc.Text = Trim(grdStockItems.RootTable.Rows(ThisRow).Cells(3).Value) txtQty.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(5).Value txtUom.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(6).Value lstTaxCode.SelectedValue = grdStockItems.RootTable.Rows(ThisRow).Cells(9).Value Case "6" lstLineType.SelectedIndex = 2 txtStockDesc.Text = grdStockItems.RootTable.Rows(ThisRow).Cells(8).Value Call DisplayFields("Comments") End Select Else mw.UserMsgBox("Please select a line to load") End If Catch ex As Exception Call mw.UserMsgBox("Please select a line to load") End Try End Sub Private Sub btnNewDetail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNewDetail.Click If txtSalesOrder.Text.Trim = "" Then mw.UserMsgBox("Please save header details first before adding detail lines") GoTo ENDSUB End If Call SetupOrderDetails() lstLineType.Focus() ENDSUB: End Sub Sub SetupOrderDetails() Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select [SalesOrderLine] from [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text.Trim & "' Order By [SalesOrderLine] DESC" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SorDetail") If DBPageData.Tables(0).Rows.Count > 0 Then Try txtLineNo.Text = Convert.ToString(DBPageData.Tables(0).Rows(0)("SalesOrderLine") + 1) Catch ex As Exception txtLineNo.Text = "1" End Try Else txtLineNo.Text = "1" End If DBCommand.Dispose() DBConn.Dispose() lstLineType.SelectedIndex = 0 Call DisplayFields("Stocked Item") lstStockCode.SelectedIndex = -1 txtStockCode.Text = "" lstTaxCode.SelectedValue = "A" txtStockDate.Text = txtShipDate.Text txtStockDesc.Text = "" txtPrice.Text = "" txtQty.Text = "" txtUom.Text = "" End Sub Function GetWarehouse(ByVal ThisStock As String) As String Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim ThisWarehouse As String DBSelect = "Select [WarehouseToUse] as 'Warehouse' from [InvMaster] WHERE [StockCode] = '" & ThisStock.Trim & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "InvMaster") If DBPageData.Tables(0).Rows.Count > 0 Then ThisWarehouse = DBPageData.Tables(0).Rows(0)("Warehouse") Else ThisWarehouse = "" End If DBCommand.Dispose() DBConn.Dispose() Return ThisWarehouse.Trim End Function Private Sub btnProcess_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnProcess.Click Dim ErrorFound As Boolean = False Try Dim ThisKey As String Dim ThisRow As Integer ThisRow = grdMain.RetrieveClientLastSelectedObject().RowIndex ThisKey = Convert.ToString(grdMain.RootTable.Rows(ThisRow).Cells(0).Value) If ThisKey = "" Then Call mw.UserMsgBox("Please select an record to process.") Else lstTaxCodeHeader.SelectedValue = "A" If fldMode.Value = "Customer" Then txtCustomer.Text = ThisKey fldCoyName.Value = Convert.ToString(grdMain.RootTable.Rows(ThisRow).Cells(1).Value) Call GetCustomerDetails() Else txtSalesOrder.Text = ThisKey txtSalesOrderDetail.Text = ThisKey txtSalesOrderTotal.Text = ThisKey Call GetSalesDetails() End If MultiView1.ActiveViewIndex = 1 End If Catch ex As Exception ErrorFound = True If fldMode.Value = "Customer" Then Call mw.UserMsgBox("Please select a customer to process.") Else Call mw.UserMsgBox("Please select a sales order to process.") End If Finally End Try End Sub Private Sub lstAddress_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstAddress.SelectedIndexChanged Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select * From [ArMultAddress] where [Customer] = '" & txtCustomer.Text & "' AND [AddrCode] = '" & lstAddress.SelectedValue & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "ArMultAddress") If DBPageData.Tables(0).Rows.Count > 0 Then txtShipAddr.Text = DBPageData.Tables(0).Rows(0)("ShipToAddr1").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr2").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr3").ToString txtShipAddr.Text = txtShipAddr.Text & vbCrLf & DBPageData.Tables(0).Rows(0)("ShipToAddr4").ToString txtShipCountry.Text = DBPageData.Tables(0).Rows(0)("ShipToAddr5").ToString txtShipPC.Text = DBPageData.Tables(0).Rows(0)("ShipPostalCode").ToString End If DBConn.Dispose() DBCommand.Dispose() End Sub Private Sub txtShipDate_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtShipDate.TextChanged If txtStockDate.Text = "" Then txtStockDate.Text = txtShipDate.Text End If End Sub Sub DisplayFields(ByVal DispType As String) Select Case DispType Case "Stocked Item" txtStockCode.Visible = True lblDescription.Text = "Description" lstStockCode.Visible = False lblStockCode.Visible = True txtStockDate.Visible = True lblStockDate.Visible = True txtUom.ReadOnly = True txtUom.CssClass = "textboxRO" txtUom.Visible = True lblUom.Visible = True lblProductClass.Visible = False lstProductClass.Visible = False txtQty.Visible = True lblQty.Visible = True imgStockDate.Visible = True lblPrice.Visible = True txtPrice.Visible = True lblTaxCode.Visible = True lstTaxCode.Visible = True lblWarehouse.Visible = True lstWarehouse.Visible = True Case "Non Stocked Item" txtStockCode.Visible = True lblDescription.Text = "Description" lstStockCode.Visible = False lblStockCode.Visible = True txtStockDate.Visible = True lblStockDate.Visible = True txtUom.Visible = True txtUom.ReadOnly = False txtUom.CssClass = "textbox" lblUom.Visible = True lblProductClass.Visible = True lstProductClass.Visible = True txtQty.Visible = True lblQty.Visible = True imgStockDate.Visible = True lblPrice.Visible = True txtPrice.Visible = True lblTaxCode.Visible = True lstTaxCode.Visible = True lblWarehouse.Visible = False lstWarehouse.Visible = False Case "Comments" txtStockCode.Visible = False lblDescription.Text = "Comments" lstStockCode.Visible = False lblStockCode.Visible = False txtStockDate.Visible = False lblStockDate.Visible = False txtUom.Visible = False lblUom.Visible = False lblProductClass.Visible = False lstProductClass.Visible = False txtQty.Visible = False lblQty.Visible = False lblPrice.Visible = False txtPrice.Visible = False imgStockDate.Visible = False lblTaxCode.Visible = False lstTaxCode.Visible = False lblWarehouse.Visible = False lstWarehouse.Visible = False End Select End Sub Private Sub lstStockCode_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstStockCode.TextChanged Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select [Description], [StockUom] from [InvMaster] WHERE [StockCode] = '" & lstStockCode.SelectedValue & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "InvMaster") If DBPageData.Tables(0).Rows.Count > 0 Then txtStockDesc.Text = DBPageData.Tables(0).Rows(0)("Description") txtUom.Text = DBPageData.Tables(0).Rows(0)("StockUom") txtPrice.Text = GetContractPrice(txtCustomer.Text, lstStockCode.SelectedValue) Else txtStockDesc.Text = "" txtPrice.Text = "" txtUom.Text = "" End If lstStockCode.Focus() DBCommand.Dispose() DBConn.Dispose() End Sub Private Sub btnSaveDetail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveDetail.Click lblError.Text = "" Call SaveSalesOrder() 'grdStockItems.RebindDataSource() Call RebindStockGrd() lstLineType.Focus() End Sub Private Sub txtStockCode_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtStockCode.TextChanged If lstLineType.SelectedValue <> "Stocked Item" Then GoTo SUBEND End If Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select [Description], [StockUom] from [InvMaster] WHERE [StockCode] = '" & txtStockCode.Text & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "InvMaster") If DBPageData.Tables(0).Rows.Count > 0 Then txtStockDesc.Text = DBPageData.Tables(0).Rows(0)("Description") txtUom.Text = DBPageData.Tables(0).Rows(0)("StockUom") txtPrice.Text = Convert.ToString(GetContractPrice(txtCustomer.Text, txtStockCode.Text)) Else txtStockDesc.Text = "" txtPrice.Text = "" txtUom.Text = "" End If DBCommand.Dispose() DBConn.Dispose() txtQty.Focus() SUBEND: End Sub Function GetContractPrice(ByVal ThisCustomer As String, ByVal ThisStock As String) As Decimal Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim TodayFormat As String = Convert.ToString(Format(Now(), "yyyy-MM-dd")) DBSelect = "Select [CustListPrice] from [SorContractPrice] WHERE [StockCode] = '" & txtStockCode.Text & "' AND [ContractType] = 'C' AND [CustomerBuygrp] = '" & ThisCustomer & "' AND [StartDate] <= '" & TodayFormat & "' AND ([ExpiryDate] is NULL or [ExpiryDate] >= '" & TodayFormat & "') ORDER BY [Contract] DESC" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SorContractPrice") If DBPageData.Tables(0).Rows.Count > 0 Then GetContractPrice = DBPageData.Tables(0).Rows(0)("CustListPrice") Else GetContractPrice = 0 End If DBCommand.Dispose() DBConn.Dispose() End Function Sub CalcTotals() Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String Dim TotLines As Integer Dim TotMerch As Decimal = 0 Dim TotLoan As Decimal = 0 Dim TotRebate As Decimal = 0 Dim TotTax As Decimal = 0 Dim TotInvoice As Decimal = 0 Dim LineType As String Dim ThisPrice As Decimal = 0 Dim ThisQty As Decimal = 0 Dim LineAmt As Decimal = 0 Dim ThisTaxCode As String Dim Description As String DBSelect = "Select * from [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text.Trim & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SalesOrder") TotLines = DBPageData.Tables(0).Rows.Count For i As Integer = 0 To DBPageData.Tables(0).Rows.Count - 1 Description = DBPageData.Tables(0).Rows(i)("NComment") LineType = DBPageData.Tables(0).Rows(i)("LineType") ThisPrice = Convert.ToDecimal(DBPageData.Tables(0).Rows(i)("MPrice")) + Convert.ToDecimal(DBPageData.Tables(0).Rows(i)("NMscChargeValue")) ThisQty = Convert.ToDecimal(DBPageData.Tables(0).Rows(i)("MOrderQty")) If LineType <> "5" Then LineAmt = (System.Math.Round(ThisPrice * ThisQty, 2)) Else LineAmt = ThisPrice End If ThisTaxCode = DBPageData.Tables(0).Rows(i)("MTaxCode") If LineType = "5" Then If InStr(Description, "LOAN") > 0 Then TotLoan = TotLoan + LineAmt Else If InStr(Description, "REBT") > 0 Then TotRebate = TotRebate + LineAmt Else TotMerch = TotMerch + LineAmt End If End If Else TotMerch = TotMerch + LineAmt End If TotTax = TotTax + (System.Math.Round(LineAmt * GetTaxAmt(ThisTaxCode) / 100, 2)) Next txtLines.Text = Convert.ToString(TotLines) txtTotalMerch.Text = Convert.ToString(TotMerch) txtTotalLoan.Text = Convert.ToString(TotLoan) txtTotalRebate.Text = Convert.ToString(TotRebate) txtInvoiceAmt.Text = Convert.ToString(TotMerch + TotLoan + TotTax) txtTax.Text = Convert.ToString(TotTax) End Sub Function DetailLinePresent() As Boolean Dim DBConn As SqlConnection Dim DBCommand As SqlDataAdapter Dim DBPageData As New DataSet Dim DBSelect As String DBSelect = "Select * from [SorDetail] WHERE [SalesOrder] = '" & txtSalesOrder.Text.Trim & "'" DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) DBCommand = New SqlDataAdapter(DBSelect, DBConn) DBCommand.Fill(DBPageData, "SalesOrder") If DBPageData.Tables(0).Rows.Count > 0 Then Return True Else Return False End If End Function Sub DeleteOrder() Dim HeaderXML As String Dim XMLParam As String = GetXMLParam() Dim ResultXML As String = "" HeaderXML = GetHeaderXML("D") Dim Util As New Syspro.Utilities.Utilities Dim ValidLogin As Boolean = True Dim Trans As New Syspro.Transaction.Transaction ResultXML = Trans.Post(fldUid.Value, "SORTOI", XMLParam, HeaderXML) If InStr(ResultXML, "System.Runtime.InteropServices") > 0 Then lblError.Text = "Error found - " & ResultXML End If txtParamXML.Text = XMLParam txtXML.Text = HeaderXML txtResultXML.Text = ResultXML End Sub Private Sub chHideLR_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chHideLR.CheckedChanged Call RebindStockGrd() End Sub Sub RebindStockGrd() Dim ds As New DataSet Dim DBConn As SqlConnection Dim da As SqlDataAdapter Dim DBSelect As String If chHideLR.Checked Then DBSelect = "Select [SalesOrderLine] as 'Line Number', [LineType] as 'Line Type', [MStockCode] as 'Stock Code', [MStockDes] as 'Description', [MLineShipDate] as 'Request Date', [MOrderQty] as 'Qty Ordered', [MOrderUom] as 'Uom', ([MPrice] + [NMscChargeValue]) as 'Price', [NComment] as 'Comment', [MTaxCode] as 'Tax Code', [MWarehouse] as 'Warehouse' from [SorDetail] where [SalesOrder] = '" & txtSalesOrder.Text & "' and [NComment] NOT LIKE '%LOAN' and [NComment] NOT LIKE '%REBT'" Else DBSelect = "Select [SalesOrderLine] as 'Line Number', [LineType] as 'Line Type', [MStockCode] as 'Stock Code', [MStockDes] as 'Description', [MLineShipDate] as 'Request Date', [MOrderQty] as 'Qty Ordered', [MOrderUom] as 'Uom', ([MPrice] + [NMscChargeValue]) as 'Price', [NComment] as 'Comment', [MTaxCode] as 'Tax Code', [MWarehouse] as 'Warehouse' from [SorDetail] where [SalesOrder] = '" & txtSalesOrder.Text & "'" End If DBConn = New SqlConnection(ConfigurationManager.ConnectionStrings("SCL").ConnectionString) da = New SqlDataAdapter(DBSelect, DBConn) da.Fill(ds, "Stock Items") grdStockItems.DataSource = ds grdStockItems.RebindDataSource() End Sub End Class
Kind Regards,
Jason.
Any ideas on this one? It is becoming urgent.
Thanks,
Another question to add to this - assuming we can get this working, is it possible to be able to get the first column (which is dynamically built) to show as a link button that would call either a javascript function or a back end (preferable) function?
Am I to take it that I'm not even going to get a response to this? Perhaps I should forward on my clients anger onto you guys. Perhaps I've filled out the survey too early?
I’m really sorry for the late respond.
We had the same issue as you reported and had a national holiday that causes the delay to respond back to this thread.
After checking the code in the first post of this thread, I suspect that the problem may have caused by the binding process that is placed in inappropriate event.
In your code, the grid is bind not only in the InitializeDataSource event, but also bind in the NewCustomerOrder() procedure, NewSalesOrder() procedure. All codes related to the assignment of data source to the WebGrid component should be placed in InitializeDataSource.
So, instead of calling RebindDataSource() in NewCustomerOrder() or NewSalesOrder() procedure, I suggest you to set a value to global variable that tell which table that should be bind to the grid. Next, this variable will be consumed and processed in InitializeDataSource event.
Another addition, based on the life cycle of WebGrid, when apply filter in WebGrid, WebGrid will do Fly PostBack. During on the Fly PostBack, the InitializeDataSource and PrepareDataBinding event will be invoked.
I enclosed one simple sample of WebGrid that dynamically bind to different data source. Please have my sample tested on your and let us know whether it helps or not.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname