<%@ Page Title="New Sale" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" 
    CodeBehind="SalesNew_old.aspx.cs" Inherits="SMTBETECH_V3.SalesNew_old" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<style type="text/css">
   
    .GridPager a, .GridPager span {
        display: block;
        height: 28px;
        width: 24px;
        font-weight: bold;
        text-align: center;
        text-decoration: none;
    }

    .GridPager a {
        background-color: #f5f5f5;
        color: #969696;
        border: 1px solid #969696;
    }

    .GridPager span {
        /*background-color: #A1DCF2;*/
        background-color: steelblue;
        color: whitesmoke;
        border: 1px solid #3AC0F2;
    }
</style>

<script>
    function isNumberKey(sender, evt) {
        var txt = sender.value;
        var dotcontainer = txt.split('.');
        var charCode = (evt.which) ? evt.which : event.keyCode;
        if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    }
</script>


<h2 id="title"><%: Title %></h2>



 <asp:ScriptManagerProxy ID="ScriptManagerProxyMaterialsNew" runat="server"></asp:ScriptManagerProxy>
 <asp:UpdatePanel ID="UpdatePanelMaterialsNew" runat="server">

     <ContentTemplate>


<%-- Start Customers --%>

<h5>Customer:</h5>

<asp:Button ID="btnSelectCustomer" runat="server" CssClass="btn btn-primary btn-sm" Text="Select Customer" />

            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderCustomersSalesNew" runat="server"
                BackgroundCssClass="modalBackground"
                DropShadow ="true"
                TargetControlID="btnSelectCustomer"
                PopupControlID="PanelSelectCustomers"
                CancelControlID="btnCancelSelectCustomer" />

            <asp:Panel ID="PanelSelectCustomers" runat="server" style="display:none; text-align:left; width:350px; 
            background-color:White; border-width:2px; border-color:steelblue; border-style:solid; padding:10px;">

                <h4>Select Customer</h4>
                <hr />

                 <%-- Start Grid Customers--%>

              <asp:Panel ID="PanelSearchCustomer" runat="server" DefaultButton="btnSearch">
                  <div class="row" style="width:100%">
                      <div class="col-6">
                          <asp:TextBox CssClass="form-control" placeholder="Search Customer"  runat="server"
                              ID="txtSearchCustomer" AutoPostBack="false" onFocus="this.select()"/>
                      </div>
                      <div class="col-6" style="text-align:left">
                          <asp:Button CssClass="btn btn-primary btn-sm" ID="btnSearch" runat="server" 
                              Text="Search" OnClick="btnSearch_Click"/>
                          <asp:Button CssClass="btn btn-primary btn-sm" ID="btnClearSearch" runat="server"
                              Text="Clear" OnClick="btnClearSearch_Click"/>
                      </div>
                 </div>
                  <p></p>
              </asp:Panel>

                
                <div style="overflow-x:scroll">
                <asp:GridView CssClass="table table-bordered table-striped table-sm"
                    ID="GVCustomers"
                    runat="server"
                    AutoGenerateColumns="False"
                    AllowPaging="True"
                    AllowSorting="False"
                    OnRowCommand="GVCustomers_RowCommand" OnPageIndexChanging="GVCustomers_PageIndexChanging" PageSize="5">
                <HeaderStyle CssClass="table-primary" />
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

                    <asp:ButtonField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" SortExpression="CustomerName" 
                        CommandName="SelectCustomer" DataTextField="CustomerName" HeaderText="Customer Name" />

                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" DataField="CustomerAbbrevation" HeaderText="Customer Abbrevation" SortExpression="CustomerAbbrevation"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" DataField="VendorNo" HeaderText="Vendor No" SortExpression="VendorNo"></asp:BoundField>
                    <asp:BoundField DataField="TaxId" HeaderText="Tax Id" SortExpression="TaxId"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false"  DataField="BillToStreet" HeaderText="Bill To Street" SortExpression="BillToStreet"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false"  DataField="BillToSuburb" HeaderText="Bill To Suburb" SortExpression="BillToSuburb"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillToMunicipality" HeaderText="Bill To Municipality" SortExpression="BillToMunicipality"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillToZipCode" HeaderText="Bill To ZipCode" SortExpression="BillToZipCode"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillToState" HeaderText="Bill To State" SortExpression="BillToState"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillToCountry" HeaderText="Bill To Country" SortExpression="BillToCountry"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false"  DataField="ShipToStreet" HeaderText="Ship To Street" SortExpression="ShipToStreet"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ShipToSuburb" HeaderText="Ship To Suburb" SortExpression="ShipToSuburb"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ShipToMunicipality" HeaderText="Ship To Municipality" SortExpression="ShipToMunicipality"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ShipToZipCode" HeaderText="Ship To ZipCode" SortExpression="ShipToZipCode"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ShipToState" HeaderText="Ship To State" SortExpression="ShipToState"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ShipToCountry" HeaderText="Ship To Country" SortExpression="ShipToCountry"></asp:BoundField>
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="TermsPayment" HeaderText="Terms Payment" SortExpression="TermsPayment"></asp:BoundField>
                    <asp:BoundField DataField="Currency" HeaderText="Currency" SortExpression="Currency"></asp:BoundField>
                    <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"></asp:BoundField>
                    <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate"></asp:BoundField>
                </Columns>
                        <PagerStyle CssClass="GridPager" />

                </asp:GridView>
                </div>

                    <p></p>
                    <div>
                    Total:
                    <asp:Label runat="server" ID="lblCount"></asp:Label>
                    </div>


                    <%--End Grid Customers--%>

                    <p></p>

                    <div style="text-align:right;">            
                        <asp:Button ID="btnCancelSelectCustomer" CssClass="btn btn-secondary btn-sm" runat="server" Text="Cancel" />
                    </div>

            </asp:Panel>



    <div class="row mb-1">
        <div class="col" style="display:none">
            <label style="font-weight:bold" for="FormIdCustomer" class="form-label">Id Customer:</label>
            <asp:TextBox CssClass="form-control" runat="server" ID="FormIdCustomer"></asp:TextBox>
        </div>
        <div class="col">
           <label style="font-weight:bold" for="FormCustomerName" class="form-label">Customer Name:</label>
           <asp:TextBox disabled="true" CssClass="form-control" runat="server" ID="FormCustomerName"></asp:TextBox>
       </div>
   </div>



<%-- End Customers --%>


         <hr />


 <%--Start Materials--%>

<h5>Materials:</h5>

<asp:Button Enabled="false" ID="btnSelectMaterial" runat="server" CssClass="btn btn-primary btn-sm" Text="Select Material" />

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderMaterials" runat="server" BackgroundCssClass="modalBackground" DropShadow="True" 
    TargetControlID="btnSelectMaterial" 
    PopupControlID="PanelMaterials" 
    CancelControlID="btnCancelSelectMaterial" />


        <asp:Panel ID="PanelMaterials" runat="server" style="display:none; text-align:left; width:350px; 
        background-color:White; border-width:2px; border-color:steelblue; border-style:solid; padding:10px;">

    <h4>Select Material</h4>
    <hr />

   <%-- Start Grid Materials--%>

    <asp:Panel runat="server" DefaultButton="btnSearchMaterial">
        <div class="row" style="width:100%">
            <div class="col-6">
                <asp:TextBox CssClass="form-control" placeholder="Search Part Number"  runat="server"
                    ID="txtSearchMaterial" AutoPostBack="false" onFocus="this.select()"/>
            </div>
            <div class="col-6" style="text-align:left">
                <asp:Button CssClass="btn btn-primary btn-sm" ID="btnSearchMaterial" runat="server" 
                    Text="Search" OnClick="btnSearchMaterial_Click"/>
                <asp:Button CssClass="btn btn-primary btn-sm" ID="btnClearSearchMaterial" runat="server"
                    Text="Clear" OnClick="btnClearSearchMaterial_Click"/>
            </div>
       </div>

       <p></p>
    </asp:Panel>

<div style="overflow-x:scroll">
<asp:GridView CssClass="table table-bordered table-striped table-sm"
    ID="GVMaterials"
    runat="server"
    AutoGenerateColumns="False"
    AllowPaging="True"
    AllowSorting="False"
    OnRowCommand="GVMaterials_RowCommand" OnPageIndexChanging="GVMaterials_PageIndexChanging" PageSize="5">
<HeaderStyle CssClass="table-primary" />
    <Columns>
        <asp:BoundField HeaderStyle-Width="80px" DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

        <asp:ButtonField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" SortExpression="PartNumber" 
            CommandName="SelectMaterial" DataTextField="PartNumber" HeaderText="Part Number" />
    
        <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="400px" ItemStyle-Wrap="false" DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>                    
        <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="100px" ItemStyle-Wrap="false" DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" ItemStyle-HorizontalAlign="Right"></asp:BoundField>                    
        <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="100px" ItemStyle-Wrap="false" DataField="Price" HeaderText="Price" SortExpression="Price" ItemStyle-HorizontalAlign="Right"></asp:BoundField>                    
    </Columns>
        <PagerStyle CssClass="GridPager" />
    
</asp:GridView>
</div>
    <p></p>
    <div>
    Total:
    <asp:Label runat="server" ID="lblCountMaterials"></asp:Label>
    </div>


    <%--End Grid Materials--%>

    <p></p>

    <div style="text-align:right;">
        <asp:Button ID="btnCancelSelectMaterial" CssClass="btn btn-secondary btn-sm" runat="server" Text="Cancel"/>
    </div>
</asp:Panel>


<div class="row mb-1">
    <div class="col" style="display:none">
        <label style="font-weight:bold" for="FormIdMaterial" class="form-label">Id Material:</label>
        <asp:TextBox CssClass="form-control" runat="server" ID="FormIdMaterial"></asp:TextBox>
    </div>
    <div class="col">
        <label style="font-weight:bold" for="FormPartNumber" class="form-label">Part Number:</label>
        <asp:TextBox disabled="true" CssClass="form-control" runat="server" ID="FormPartNumber"></asp:TextBox>
    </div>
     <div class="col">
        <label style="font-weight:bold" for="FormPartNumberCustomer" class="form-label">Part Number for Customer:</label>
        <asp:TextBox disabled="true" CssClass="form-control" runat="server" ID="FormPartNumberCustomer"></asp:TextBox>
    </div>
</div>
<div class="row mb-1">
    <div class="col">
        <label style="font-weight:bold" for="FormDescription" class="form-label">Description:</label>
        <asp:TextBox disabled="true" CssClass="form-control" runat="server" ID="FormDescription"></asp:TextBox>
    </div>
</div>
      
 <%--End Materials--%>

<p></p>

<%--Start Materials Income--%>

<asp:Button Enabled="false" ID="btnSelectMaterialIncome" runat="server" CssClass="btn btn-primary btn-sm" Text="Select Material Income" />

        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderMaterialsIncome" runat="server" BackgroundCssClass="modalBackground" DropShadow="True" 
            TargetControlID="btnSelectMaterialIncome" 
            PopupControlID="PanelMaterialsIncome" 
            CancelControlID="btnCancelSelectMaterialIncome" />

              <asp:Panel ID="PanelMaterialsIncome" runat="server" style="display:none; text-align:left; width:350px; 
                 background-color:White; border-width:2px; border-color:steelblue; border-style:solid; padding:10px;">

             <h4>Select Material Income</h4>

             <hr />

            <%-- Start Grid Materials Income--%>


          <asp:Panel runat="server" DefaultButton="btnSearchMaterialIncome">
              <div class="row" style="width:100%">
                  <div class="col-6">
                      <asp:TextBox CssClass="form-control" placeholder="Search Part Number"  runat="server"
                          ID="txtSearchMaterialIncome" AutoPostBack="false" onFocus="this.select()"/>
                  </div>
                  <div class="col-6" style="text-align:left">
                      <asp:Button CssClass="btn btn-primary btn-sm" ID="btnSearchMaterialIncome" runat="server" 
                          Text="Search" OnClick="btnSearchMaterialIncome_Click"/>
                      <asp:Button CssClass="btn btn-primary btn-sm" ID="btnClearSearchMaterialIncome" runat="server"
                          Text="Clear" OnClick="btnClearSearchMaterialIncome_Click"/>
                  </div>
             </div>

             <p></p>
          </asp:Panel>

        <div style="overflow-x:scroll">
        <asp:GridView CssClass="table table-bordered table-striped table-sm"
            ID="GVMaterialsIncome"
            runat="server"
            AutoGenerateColumns="False"
            AllowPaging="True"
            AllowSorting="False"
            OnRowCommand="GVMaterialsIncome_RowCommand" OnPageIndexChanging="GVMaterialsIncome_PageIndexChanging" PageSize="10">
        <HeaderStyle CssClass="table-primary" />
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

                <asp:BoundField Visible="false" DataField="IdMaterial" HeaderText="IdMaterial" ReadOnly="True" InsertVisible="False" SortExpression="IdMaterial"></asp:BoundField>

                <asp:ButtonField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" SortExpression="PartNumber" 
                    CommandName="SelectMaterialIncome" DataTextField="PartNumber" HeaderText="Part Number" />

                        
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>
                
                
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" ItemStyle-ForeColor="Blue" ItemStyle-HorizontalAlign="Right"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportDocType" HeaderText="Import Doc Type" SortExpression="ImportDocType"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ConditionOfGoods" HeaderText="Condition of Goods" SortExpression="ConditionOfGoods"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BrandUsed" HeaderText="Brand Used" SortExpression="BrandUsed"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SerialNumber" HeaderText="Serial Number" SortExpression="SerialNumber"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportNo" HeaderText="Import No" SortExpression="ImportNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalNo" HeaderText="Local No" SortExpression="LocalNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="DateIncomming" HeaderText="Date Incomming" SortExpression="DateIncomming"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="IdSupplier" HeaderText="IdSupplier" SortExpression="IdSupplier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SupplierName" HeaderText="Supplier Name" SortExpression="SupplierName"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="TaxID" HeaderText="TaxID" SortExpression="TaxID"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportCarrier" HeaderText="Import Carrier" SortExpression="ImportCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalCarrier" HeaderText="Local Carrier" SortExpression="LocalCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="AWBTrackingNo" HeaderText="AWB Tracking No" SortExpression="AWBTrackingNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillLadingNo" HeaderText="Bill Lading No" SortExpression="BillLadingNo"></asp:BoundField>
                
                <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"></asp:BoundField>
                <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate"></asp:BoundField>
            </Columns>
                <PagerStyle CssClass="GridPager" />
    
            </asp:GridView>
        </div>
        <p></p>
        <div>
            Total:
            <asp:Label runat="server" ID="lblCountMaterialsIncome"></asp:Label>
        </div>

       <%--End Grid Materials Income--%>

    <p></p>

    <div style="text-align:right;">
        <asp:Button ID="btnCancelSelectMaterialIncome" CssClass="btn btn-secondary btn-sm" runat="server" Text="Cancel"/>
    </div>
</asp:Panel>


 <%--End Materials Income--%>

         <p></p>

<%--Start Materials Income Selected--%>

    <asp:Panel runat="server" DefaultButton="btnAddMaterial">

        <div style="overflow-x:scroll">
        <asp:GridView CssClass="table table-bordered table-striped table-sm"
            ID="GVMaterialsIncomeSelected"
            runat="server"
            AutoGenerateColumns="False">
        <HeaderStyle CssClass="table-primary" />
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

                <asp:BoundField Visible="false" DataField="IdMaterial" HeaderText="IdMaterial" ReadOnly="True" InsertVisible="False" SortExpression="IdMaterial"></asp:BoundField>

                <%--<asp:ButtonField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" SortExpression="PartNumber" 
                    CommandName="EditMaterial" DataTextField="PartNumber" HeaderText="Part Number" />--%>
        
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" DataField="PartNumber" HeaderText="PartNumber" SortExpression="PartNumber"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>
                
                
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" ItemStyle-ForeColor="Blue" ItemStyle-HorizontalAlign="Right"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportDocType" HeaderText="Import Doc Type" SortExpression="ImportDocType"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ConditionOfGoods" HeaderText="Condition of Goods" SortExpression="ConditionOfGoods"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BrandUsed" HeaderText="Brand Used" SortExpression="BrandUsed"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SerialNumber" HeaderText="Serial Number" SortExpression="SerialNumber"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportNo" HeaderText="Import No" SortExpression="ImportNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalNo" HeaderText="Local No" SortExpression="LocalNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="DateIncomming" HeaderText="Date Incomming" SortExpression="DateIncomming"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="IdSupplier" HeaderText="IdSupplier" SortExpression="IdSupplier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SupplierName" HeaderText="Supplier Name" SortExpression="SupplierName"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="TaxID" HeaderText="TaxID" SortExpression="TaxID"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportCarrier" HeaderText="Import Carrier" SortExpression="ImportCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalCarrier" HeaderText="Local Carrier" SortExpression="LocalCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="AWBTrackingNo" HeaderText="AWB Tracking No" SortExpression="AWBTrackingNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillLadingNo" HeaderText="Bill Lading No" SortExpression="BillLadingNo"></asp:BoundField>
                
                <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"></asp:BoundField>
                <asp:BoundField ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate"></asp:BoundField>
            </Columns>
                   <EmptyDataTemplate>No Material Income Selected</EmptyDataTemplate>
        </asp:GridView>
        </div>

<%--End Materials Income Selected--%>

         <p></p>

    <div class="row mb-1">
        <div class="col-6">
            <label style="font-weight:bold" for="FormQuantity" class="form-label">Quantity (-):</label>
            <asp:TextBox Enabled="false" AutoPostBack="true" CssClass="form-control" runat="server" ID="FormQuantity" style="text-align:right;color:blue"
                OnFocus="this.select()" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="FormQuantity_TextChanged"></asp:TextBox>
        </div>
        <div class="col-6">
            <label style="font-weight:bold" for="FormPrice" class="form-label">Price:</label>
            <asp:TextBox Enabled="false" CssClass="form-control" runat="server" ID="FormPrice" style="text-align:right;color:blue" 
                OnTextChanged="FormPrice_TextChanged" AutoPostBack="true"
                OnFocus="this.select()" OnKeyPress="return isNumberKey(this, event);"></asp:TextBox>
        </div>
    </div>

    <div class="row mb-1">
        <div class="col-6">
            <label style="font-weight:bold" for="FormQuotationNo" class="form-label">Quotation No:</label>
            <asp:TextBox CssClass="form-control" runat="server" ID="FormQuotationNo" ></asp:TextBox>
        </div>
        <div class="col-6">
            <label style="font-weight:bold" for="FormAdditionalComments" class="form-label">Additional Comments:</label>
            <asp:TextBox CssClass="form-control" runat="server" ID="FormAdditionalComments"></asp:TextBox>
        </div>
    </div>

    <div class="row mb-1">
        <div class="col-6">
            <label style="font-weight:bold" for="FormAmountOfCommissionsToPay" class="form-label">Amount Of Commissions To Pay:</label>
            <asp:TextBox CssClass="form-control" runat="server" ID="FormAmountOfCommissionsToPay"  AutoPostBack="true"
                style="text-align:right;color:blue" OnFocus="this.select()" OnKeyPress="return isNumberKey(this, event);"></asp:TextBox>
        </div>
        <div class="col-6">
            <label style="font-weight:bold" for="FormSalesmanSalesCommission" class="form-label">Salesman:</label>
            <asp:TextBox CssClass="form-control" runat="server" ID="FormSalesmanSalesCommission"></asp:TextBox>
        </div>
    </div>



    <p></p>

    <div class="row mb-3">
        <div style="text-align:right">
            <asp:Button Enabled="false" ID="btnAddMaterial" runat="server" CssClass="btn btn-primary btn-sm" Text="Add Material" OnClick="btnAddMaterial_Click" />
        </div>
   </div>

</asp:Panel>

<hr />


<h5>Added Materials:</h5>

<div class="row mb-1">        
    <div title="Other Information" style="max-width:40%"">
        <h7>Materials Income</h7>
    </div>
    <div title="Sale Items" style="max-width:60%">
        <h7>Sale Items</h7>
    </div>
</div>
       
     
    <div class="row mb-1">
        
        <%--Start Materials Added--%>

        <div style="overflow-x:scroll;max-width:40%"">
        <asp:GridView CssClass="table table-bordered table-striped table-sm"
            ID="GVMaterialsAdded" runat="server" AutoGenerateColumns="False">
        <HeaderStyle CssClass="table-primary" />
            <Columns>
                <asp:BoundField Visible="false" DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

                <asp:BoundField DataField="IdMaterial" HeaderText="IdMaterial" ></asp:BoundField>
          
        
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" DataField="PartNumber" HeaderText="PartNumber" SortExpression="PartNumber"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>
                
                
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" ItemStyle-ForeColor="Blue" ItemStyle-HorizontalAlign="Right"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportDocType" HeaderText="Import Doc Type" SortExpression="ImportDocType"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ConditionOfGoods" HeaderText="Condition of Goods" SortExpression="ConditionOfGoods"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BrandUsed" HeaderText="Brand Used" SortExpression="BrandUsed"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SerialNumber" HeaderText="Serial Number" SortExpression="SerialNumber"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportNo" HeaderText="Import No" SortExpression="ImportNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalNo" HeaderText="Local No" SortExpression="LocalNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="DateIncomming" HeaderText="Date Incomming" SortExpression="DateIncomming"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="IdSupplier" HeaderText="IdSupplier" SortExpression="IdSupplier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SupplierName" HeaderText="Supplier Name" SortExpression="SupplierName"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="TaxID" HeaderText="TaxID" SortExpression="TaxID"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="ImportCarrier" HeaderText="Import Carrier" SortExpression="ImportCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="LocalCarrier" HeaderText="Local Carrier" SortExpression="LocalCarrier"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="AWBTrackingNo" HeaderText="AWB Tracking No" SortExpression="AWBTrackingNo"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="BillLadingNo" HeaderText="Bill Lading No" SortExpression="BillLadingNo"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="QuotationNo" HeaderText="Quotation No"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="AdditionalComments" HeaderText="Additional Comments"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="AmountOfCommissionsToPay" HeaderText="Amount Of Commissions To Pay" ItemStyle-ForeColor="Blue" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="200px" ItemStyle-Wrap="false" DataField="SalesmanSalesCommission" HeaderText="Salesman"></asp:BoundField>
                
                <asp:BoundField Visible="false" ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"></asp:BoundField>
                <asp:BoundField Visible="false" ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate"></asp:BoundField>
            </Columns>
                   <EmptyDataTemplate>No Materials Income Added</EmptyDataTemplate>
        </asp:GridView>
        </div>

<%--End Materials Added--%>




<%--Start Quantity, Price--%>

   
    <div style="overflow-x:scroll;max-width:60%">
    <asp:GridView CssClass="table table-bordered table-striped table-sm"
        ID="GVQP" runat="server" AutoGenerateColumns="False" OnRowCommand="GVQP_RowCommand">
        <HeaderStyle CssClass="table-primary" />
            <Columns>
                
                <asp:BoundField Visible="false" HeaderStyle-Width="80px" DataField="IdMaterial" HeaderText="Id Material" ReadOnly="True" InsertVisible="False"></asp:BoundField>

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" DataField="PartNumber" HeaderText="Part Number"></asp:BoundField>                        

                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" DataField="PartNumberCustomer" HeaderText="PN Customer" ></asp:BoundField>                    
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="100px" ItemStyle-Wrap="false" DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Right"></asp:BoundField>                    
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="100px" ItemStyle-Wrap="false" DataField="Price" HeaderText="Price" ItemStyle-HorizontalAlign="Right"></asp:BoundField>                    
                <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="100px" ItemStyle-Wrap="false" DataField="Subtotal" HeaderText="Subtotal" ItemStyle-HorizontalAlign="Right"></asp:BoundField>                    

                <asp:TemplateField HeaderStyle-CssClass="col-1" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>                        
                        <asp:Button runat="server" ID="btnDeleteSalesItem" CssClass="btn btn-close" 
                            CommandName="DeleteSalesItem" CommandArgument='<%# Container.DataItemIndex %>'/>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
                 <EmptyDataTemplate>No Items Added</EmptyDataTemplate>
        </asp:GridView>
    </div>
<%--End Quantity, Price--%>

    </div>

            <table width="100%">
               <tr>
                 <td style="width: 50%">Total Items: <asp:Label runat="server" ID="lblCountItems" ForeColor="Blue"></asp:Label></td>
                 <td style="width: 50%; text-align: right;">Total $: <asp:Label runat="server" ID="lblTotal" Font-Bold="true" ForeColor="Blue"></asp:Label></td>
               </tr>
             </table>


         <hr />


         <div class="row mb-1">
            <div class="col-6">
                <label style="font-weight:bold" for="FormNetDaysCredit" class="form-label">Net Days Credit:</label>
                <asp:TextBox AutoPostBack="true" CssClass="form-control" runat="server" ID="FormNetDaysCredit" style="text-align:right;color:blue"
                    OnFocus="this.select()" OnKeyPress="return isNumberKey(this, event);"></asp:TextBox>
            </div>
            <div class="col-6">
                <label style="font-weight:bold" for="FormDateOfDelivery" class="form-label">Date Of Delivery:</label>
                <asp:TextBox CssClass="form-control" runat="server" ID="FormDateOfDelivery" TextMode="Date" ></asp:TextBox>
            </div>
        </div>

          <div class="row mb-1">
            <div class="col-6">
                <label style="font-weight:bold" for="FormDateBilling" class="form-label">Date Billing:</label>
                <asp:TextBox CssClass="form-control" runat="server" ID="FormDateBilling" TextMode="Date" ></asp:TextBox>
            </div>
            <div class="col-6">
                <label style="font-weight:bold" for="FormTaxIdInvoiced" class="form-label">Tax Id Invoiced:</label>
                <asp:TextBox CssClass="form-control" runat="server" ID="FormTaxIdInvoiced" ></asp:TextBox>
            </div>
        </div>

        
         <hr />

          <asp:Button ID="btnSave" runat="server" CssClass="btn btn-primary" Text="Save" OnClick="btnSave_Click" OnClientClick="return confirm('Create New Sale ? ');" />
 <asp:Button ID="btnBack" runat="server" CssClass="btn btn-secondary" Text="Back to Sales" OnClick="btnBack_Click" />



     </ContentTemplate>

</asp:UpdatePanel>

</asp:Content>
