<%@ Page Title="Purchase Request" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="PurchaseRequest.aspx.cs" Inherits="ZFJINV.Purchase.PurchaseRequest" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div class="row">
        <div class="col-md-12 mySpace">
            <asp:UpdatePanel runat="server">
                <ContentTemplate>


                    <div class="caption cap">
                        <span class="caption-subject font-blue sbold" style="font-size: 150%;">Purchase Request </span>

                        <%--  <div class="pull-right">
                            <button type="button" class="btn btn-success" disabled="disabled" style="height: 28px;">saved</button>
                        </div>--%>

                        <div class="btn-group pull-right">
                            <img src="../assets/global/img/gridicons/addgrid.png" />
                            <asp:LinkButton ID="lblAdd" Text="Add" runat="server" class="imgCss" OnClick="Add"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/gridsearch.png" />
                            <asp:LinkButton ID="lblFind" Text="Find" runat="server" class="imgCss" OnClick="Find"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/editgrid.png" />
                            <asp:LinkButton ID="lblEdit" Text="Edit" runat="server" class="imgCss" OnClick="Edit"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/previous.png" onclick="#" />
                            <asp:LinkButton ID="lblFirst" Text="First" runat="server" class="imgCss" OnClick="First"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/first.png" />
                            <asp:LinkButton ID="lblNext" Text="Next" runat="server" class="imgCss" OnClick="Next"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/last.png" class="imgCss" />
                            <asp:LinkButton ID="lblPrevious" Text="Previous" runat="server" OnClick="Previous"></asp:LinkButton>

                            <img src="../assets/global/img/gridicons/next.png" class="imgCss" />
                            <asp:LinkButton ID="lblLast" Text="Last" runat="server" OnClick="Last"></asp:LinkButton>
                        </div>
                    </div>

                    <div class="ui segment">
                        <div class="ui stackable form">

                            <div class="col-md-3">
                                <label class="lbStyle">PR ID</label>
                                <asp:TextBox ID="txtPRID" AutoPostBack="True" OnTextChanged="txtPRDate_OnTextChanged" CssClass="myInput" runat="server" title="PR ID"></asp:TextBox>
                            </div>

                            <div class="col-md-3">
                                <label class="lbStyle">Date:</label>
                                <asp:TextBox ID="txtPRDate" runat="server" class="mydatepickerclass myInput" title="PR Date"></asp:TextBox>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3"
                                    ControlToValidate="txtPRDate"
                                    ValidationGroup="formValidation"
                                    ErrorMessage="Required Field" EnableClientScript="false" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>

                            <div class="col-md-3">

                                <label class="lbStyle">Supplier:</label>
                                <asp:DropDownList ID="txtSupplier" runat="server" class="select2 form-control "></asp:DropDownList>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4"
                                    ControlToValidate="txtSupplier"
                                    ValidationGroup="formValidation"
                                    ErrorMessage="Required Field" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>
                            <div class="col-md-3">

                                <label class="lbStyle">Country:</label>
                                <asp:DropDownList ID="CountryID" runat="server" CssClass="select2 form-control " AutoPostBack="true" OnSelectedIndexChanged="CountryID_SelectedIndexChanged"></asp:DropDownList>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6"
                                    ControlToValidate="CountryID"
                                    ValidationGroup="formValidation"
                                    ErrorMessage="Required Field" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>
                            <%--<div class="col-md-3">

                                <label class="lbStyle">WareHouse:</label>
                                <asp:DropDownList ID="txtWareHouse" runat="server" class="select2 form-control " OnSelectedIndexChanged ="txtWareHouse_SelectedIndexChanged" AutoPostBack ="true"   AppendDataBoundItems ="true"   ></asp:DropDownList>
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator5"
                                    ControlToValidate="txtWareHouse"
                                    ValidationGroup="formValidation"
                                    ErrorMessage="Required Field" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>--%>



                            <div class="col-md-3">
                                <label class="lbStyle">Ref. No:</label>
                                <asp:TextBox ID="txtRefNo" CssClass="myInput" runat="server" title="PR Reference No." Enabled="false" ReadOnly="True"></asp:TextBox>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator7"
                                    ControlToValidate="txtRefNo"
                                    ValidationGroup="formValidation"
                                    ErrorMessage="Required Field" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>

                            <div class="col-md-3">
                                <label class="lbStyle">Ref. Date:</label>
                                <asp:TextBox ID="txtRefDate" runat="server" CssClass="mydatepickerclass myInput" title="PR Reference Date"></asp:TextBox>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator8"
                                    ControlToValidate="txtRefDate"
                                    ValidationGroup="formValidation" EnableClientScript="false"
                                    ErrorMessage="Required Field" CssClass="message"
                                    runat="Server">
                                </asp:RequiredFieldValidator>
                            </div>

                            <div class="col-md-3">
                                <label class="lbStyle">Remarks:</label>
                                <asp:TextBox ID="txtRemarks" runat="server" class="myInput" title="Remarks"></asp:TextBox>

                                <%--  <asp:RequiredFieldValidator ID="RequiredFieldValidator9"
                                    ControlToValidate="txtRemarks"
                                    ValidationGroup="formValidation" CssClass="message"
                                    ErrorMessage="Required Field"
                                    runat="Server">
                                </asp:RequiredFieldValidator>--%>
                            </div>
                            <div class="row">
                            </div>
                        </div>
                    </div>

                    <div id="dvGrid1" class="clearfix">
                        <div class="rounded-corners">
                            <div style="width: 100%; overflow: auto;">

                                <asp:GridView ID="grdPurchaseRequest" ShowHeaderWhenEmpty="True"
                                    GridLines="Horizontal" BRequestColor="WhiteSmoke" RowStyle-Wrap="false"
                                    HeaderStyle-Wrap="false" RowStyle-BRequestColor="#e8e8ec"
                                    CssClass="uimy ui table" runat="server" AutoGenerateColumns="False"
                                    ShowFooter="True"
                                    OnRowCommand="grdPurchaseRequest_RowCommand" AllowPaging="true"
                                    OnPageIndexChanging="grdPurchaseRequest_PageIndexChanging"
                                    OnRowEditing="grdPurchaseRequest_RowEditing"
                                    OnRowUpdating="grdPurchaseRequest_RowUpdating"
                                    OnRowCancelingEdit="grdPurchaseRequest_RowCancelingEdit"
                                    OnRowDataBound="grdPurchaseRequest_OnRowDataBound"
                                    PageSize="10"
                                    PagerStyle="pagination-ys">

                                    <Columns>

                                        <asp:TemplateField HeaderText="PRID" InsertVisible="False" Visible="False" SortExpression="PRID">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("PRID") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("PRID") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="TextBox1" CssClass="myInput1" runat="server"></asp:TextBox>
                                            </FooterTemplate>

                                        </asp:TemplateField>


                                        <asp:TemplateField HeaderText="Product Code" InsertVisible="False" SortExpression="ProductCode" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label3" runat="server" Text='<%# Eval("ProductCode") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label4" runat="server" Text='<%# Bind("ProductCode") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtCode" Enabled="true" CssClass="itemCode" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Brand" InsertVisible="False" SortExpression="Brand" HeaderStyle-CssClass="gridViewModel" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label15" runat="server" Text='<%# Eval("Brand") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label16" runat="server" Text='<%# Bind("Brand") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtBrand" Enabled="True" CssClass="Tax" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Name" InsertVisible="False" SortExpression="Name" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle2">
                                            <EditItemTemplate>
                                                <asp:DropDownList ID="txtName" Text='<%# Eval("Name") %>' CssClass="select2 form-control gvModel" AutoPostBack="false" required="required" AppendDataBoundItems="true" runat="server"></asp:DropDownList>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label6" Text='<%# Eval("Name") %>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtName" CssClass="select2 form-control gvModel" AutoPostBack="false" AppendDataBoundItems="true" runat="server"></asp:TextBox>

                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                                    ControlToValidate="txtName"
                                                    ValidationGroup="gvValidation" CssClass="message1"
                                                    ErrorMessage="Required Field."
                                                    runat="Server">
                                                </asp:RequiredFieldValidator>

                                            </FooterTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Unit Price" InsertVisible="False" SortExpression="UnitPrice" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label7" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label8" runat="server" Text='<%# Bind("UnitPrice") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtUnitPrice" Enabled="True" CssClass="UnitPrice" OnTextChanged="txtUnitPrice_TextChanged" runat="server"></asp:TextBox>
                                            </FooterTemplate>

                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Qty" InsertVisible="False" SortExpression="Qty" HeaderStyle-CssClass="gridViewModel" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtQty" AutoPostBack="True" Text='<%# Bind("Qty") %>' TextMode="Number" OnTextChanged="txtQty_OnTextChanged" CssClass="Quatntity" runat="server" required="required"></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label12" runat="server" Text='<%# Bind("Qty") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtQty" AutoPostBack="True" TextMode="Number" OnTextChanged="txtQty_OnTextChanged" CssClass="Quatntity" runat="server"></asp:TextBox>

                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator11"
                                                    ControlToValidate="txtQty"
                                                    ValidationGroup="gvValidation" CssClass="message1"
                                                    ErrorMessage="Required Field."
                                                    runat="Server">
                                                </asp:RequiredFieldValidator>
                                            </FooterTemplate>

                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Batch No" InsertVisible="False" SortExpression="BatchNo" HeaderStyle-CssClass="gridViewModel" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle" Visible="false">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label13" runat="server" Text='<%# Eval("BatchNo") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label14" runat="server" Text='<%# Bind("BatchNo") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtBatchNo" Enabled="True" CssClass="Amount" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Tax %" InsertVisible="False" SortExpression="Tax" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle" Visible="false">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label17" runat="server" Text='<%# Eval("Tax") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label18" runat="server" Text='<%# Bind("Tax") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtTax" Enabled="True" CssClass="Tax" runat="server"></asp:TextBox>
                                            </FooterTemplate>

                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Discount" InsertVisible="False" SortExpression="Discount" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle" Visible="false">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label19" runat="server" Text='<%# Eval("Discount") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label20" runat="server" Text='<%# Bind("Discount") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtDiscount" Enabled="True" CssClass="Discount" runat="server"></asp:TextBox>
                                            </FooterTemplate>

                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Amount" InsertVisible="False" SortExpression="Amount" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <EditItemTemplate>
                                                <asp:Label ID="Label21" runat="server" Text='<%# Eval("Amount") %>'></asp:Label>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label22" runat="server" Text='<%# Bind("Amount") %>'></asp:Label>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtAmount" Enabled="False" CssClass="Amount" runat="server"></asp:TextBox>
                                            </FooterTemplate>

                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Action" InsertVisible="False" SortExpression="Action" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                            <ItemTemplate>

                                                <asp:Button CssClass="small ui button red" Text="Delete" ID="lblDelete" ToolTip="Delete" CommandArgument='<%# Eval("PRID") %>' formnovalidate="formnovalidate" ImageUrl="~/assets/global/img/deletee.pngg" runat="server" CommandName="DeleteRow" />

                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <asp:Button ID="lblSave" CommandName="InsertRow" CssClass="small ui button blue" Text="Add" runat="server"
                                                    CausesValidation="true" ValidationGroup="gvValidation"></asp:Button>
                                            </FooterTemplate>

                                        </asp:TemplateField>
                                    </Columns>

                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                    
                    <div class="ui segment col-md-5" style="border-color: #AAB7B8;">
                        
                        <div class="col-md-12">
                            <div class="messagealert" id="alert_container">
                            </div>
                        </div>
                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px;">Running Total:</label>
                        <asp:TextBox ID="txtRunningBalance" type="text" disabled="disabled" runat="server" class=" form-control" />

                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Total Tax:</label>
                        <asp:TextBox ID="txtTotalTax" type="text" disabled="disabled" class=" form-control" runat="server" />

                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Total Discount:</label>
                        <asp:TextBox ID="txtTotalDiscount" type="text" disabled="disabled" class=" form-control" runat="server" />

                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Grand Total:</label>
                        <asp:TextBox ID="txtGrandTotal" type="text" disabled="disabled" class=" form-control" runat="server" /><br />

                        <asp:Button ID="btnAdd" runat="server" class="ui button green"
                            CausesValidation="true" ValidationGroup="formValidation"
                            OnClick="btnSave_OnClick" Text="Save" /><tb />
                        <asp:Button ID="btnPrint" runat="server" class="ui button green" OnClick="lblShow_Click" Text="Print Preview"
                            CausesValidation="true" ValidationGroup="formValidation" /><br />
                    </div>
                    <div class="ui segment col-md-5" style="border-color: #AAB7B8;">
                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Tax Percent:</label>
                        <asp:TextBox ID="txtTaxPercent" type="text" class=" form-control" runat="server" TextMode="Number"/>

                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Discount Percent:</label>
                        <asp:TextBox ID="txtDiscountPercent" type="text" class=" form-control" runat="server" TextMode="Number"/>

                        <label style="font-size: 12px; color: #2E4053; font-weight: 700; padding-bottom: 3px; padding-top: 7px;">Total Qty:</label>
                        <asp:TextBox ID="txtTotalQty" type="text" class=" form-control" runat="server" TextMode="Number" ReadOnly="true"/>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="grdPurchaseRequest" />
                </Triggers>
            </asp:UpdatePanel>
            <%--   <div class="row">
                        <div class="col-md-6 col-md-offset-6">
                            <div class="well" style="bRequest: 1px solid #e3e3e3;">
                                <div class="well">
                                    Running Total:
               
                                        <asp:TextBox ID="txtRunningBalance" type="text" disabled="disabled" runat="server" class=" form-control" />

                                    Tax Total:
               
                                        <asp:TextBox ID="txtTax" type="text" disabled="disabled" class=" form-control" runat="server" />

                                    Grand Total:
                                        <asp:TextBox ID="txtGrandTotal" type="text" disabled="disabled" class=" form-control" runat="server" />
                                    <asp:Button ID="btnAdd" runat="server" class="btn btn-success" OnClick="btnSave_OnClick" /><br />


                                </div>
                            </div>
                        </div>
                    </div>--%>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="footerContent" runat="server">
    <%--   <script type="text/javascript">
    
    $(document).ready(function () {
        var grd = $('#ContentPlaceHolder1_grdPurchaseRequest').dataTable().editable();
        });
    
       </script>--%>
</asp:Content>
