<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="PurchaseOrder.aspx.cs" Inherits="HRMS.Purcahsing.PurchaseOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main-panel">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                        Purcahse Order
                        <div class="pull-right">
                            <asp:Button Text="Save" CssClass="btn btn-info" ID="btn_save" Width="120px" ValidationGroup="save"
                                runat="server" OnClick="btn_save_Click" />
                            <asp:Button Text="Back" CssClass="btn btn-info" ID="btn_cancel"
                                runat="server" OnClick="btn_cancel_Click" />
                        </div>
                    </header>

                    <div class="panel-body">
                        <div class="span6">
                            <div id="divmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                <asp:Label Text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:Label>
                            </div>
                        </div>

                        <div class="span6">
                            <div id="diverrmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                <asp:Label Text="" ID="lbl_err_msg" CssClass="msg" runat="server"></asp:Label>
                            </div>
                        </div>


                        <div class="row" style="padding-top: 10px">

                            <asp:HiddenField ID="hid_po_header_id" runat="server" />
                            <asp:HiddenField ID="hid_Supplier" runat="server" />
                            <asp:HiddenField ID="OrgID" runat="server" />
                            <asp:HiddenField ID="hid_ShipLocation" runat="server" />
                            <asp:HiddenField ID="hid_Agent" runat="server" />
                            <asp:HiddenField ID="hid_Site" runat="server" />
                            <asp:HiddenField ID="hid_billto" runat="server" />
                            <asp:HiddenField ID="hid_Contact" runat="server" />

                            <label class="control-label col-md-2">Operating Unit</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox CssClass="form-control" ID="txt_OperatingUnit" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" ID="req_OperatingUnit" ControlToValidate="txt_OperatingUnit" ErrorMessage="OperatingUnit is Required!" />
                                    <span class="input-group-btn">
                                        <button id="btn_lov_OperatingUnit" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_OperatingUnit_Click"><i class="fa fa-search"></i></button>
                                    </span>

                                </div>
                            </div>

                            <label class="col-md-2 control-label">Created Date</label>
                            <div class="col-md-3">

                                <asp:TextBox ID="txt_createdate" runat="server" CssClass="form-control datetime"></asp:TextBox>


                            </div>
                        </div>

                        <div class="row" style="padding-top: 10px">


                            <label class="col-md-2 control-label">PO Rec No</label>
                            <div class="col-md-3">

                                <asp:TextBox ID="txt_Porecno" runat="server" CssClass="form-control"></asp:TextBox>
                            </div>
                            <label class="control-label col-md-2">Type</label>
                            <div class="col-md-3">

                                <asp:DropDownList CssClass="form-control" ID="ddl_Type" runat="server"></asp:DropDownList>


                            </div>

                        </div>

                        <div class="row" style="padding-top: 10px">

                            <label class="control-label col-md-2">Supplier</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox CssClass="form-control" ID="txt_Suppier" runat="server"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_Suppier" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_Suppier_Click"><i class="fa fa-search"></i></button>
                                    </span>

                                </div>
                            </div>
                            <label class="control-label col-md-2">Site</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox CssClass="form-control" ID="txt_Site" runat="server"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_Site" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_Site_Click"><i class="fa fa-search"></i></button>
                                    </span>

                                </div>
                            </div>



                        </div>

                        <div class="row" style="padding-top: 10px">

                            <label class="col-md-2 control-label">Contact</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox ID="txt_Contact" runat="server" CssClass="form-control"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_Contact" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_Contact_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>
                            </div>
                            <label class="control-label col-md-2">Ship To</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox ID="txt_shipto" runat="server" CssClass="form-control"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_shipto" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_shipto_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>
                            </div>

                        </div>

                        <div class="row" style="padding-top: 10px">
                            <label class="col-md-2 control-label">Bill To</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox ID="txt_billto" runat="server" CssClass="form-control"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_billto" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_billto_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>
                            </div>
                            <label class="col-md-2 control-label">Currency</label>
                            <div class="col-md-3">

                                <asp:DropDownList CssClass="form-control" ID="ddl_Currency" runat="server"></asp:DropDownList>
                                <%--<asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="RequiredFieldValidator2" controltovalidate="txt_Country" errormessage="Country is Required!" />--%>
                            </div>
                        </div>

                        <div class="row" style="padding-top: 10px">

                            <label class="control-label col-md-2">Buyer</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox ID="txt_Buyer" runat="server" CssClass="form-control"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <button id="btn_lov_Buyer" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_Buyer_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>
                            </div>


                            <label class="col-md-2 control-label">Status</label>
                            <div class="col-md-3">

                                <asp:DropDownList CssClass="form-control" ID="ddl_Status" runat="server"></asp:DropDownList>

                            </div>


                        </div>
                        <div class="row" style="padding-top: 10px">
                            <label class="control-label col-md-2">P-CArd</label>
                            <div class="col-md-3">

                                <asp:TextBox ID="txt_PCard" runat="server" CssClass="form-control"></asp:TextBox>

                            </div>


                            <label class="col-md-2 control-label">Total</label>
                            <div class="col-md-3">

                                <asp:TextBox ID="txt_Total" runat="server" CssClass="form-control"></asp:TextBox>

                            </div>
                        </div>
                        <div class="row" style="padding-top: 10px">
                            <label class="col-md-2 control-label">Description</label>
                            <div class="col-md-8">

                                <asp:TextBox ID="txt_Desc" runat="server" CssClass="form-control" TextMode="MultiLine"></asp:TextBox>
                            </div>
                        </div>
                        <hr />
                        <div class="row">
                            <asp:Label CssClass="control-label col-md-offset-2" ID="lbl_due" runat="server"></asp:Label>
                        </div>
                    </div>
                    <updatepanel>
                        <asp:HiddenField runat="server" ID="hidTAB" Value="0" />

                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" id="Line_click" href="#Line" aria-expanded="true">Line</a></li>
                            <li class="inactive"><a data-toggle="tab" id="PriceRef_click" href="#Priceref" aria-expanded="false">Price Refernce</a></li>
                            <li class="inactive"><a data-toggle="tab" id="RefDoc_click" href="#RefDoc" aria-expanded="false">Reference Document</a></li>
                            <li class="inactive"><a data-toggle="tab" id="More_click" href="#More" aria-expanded="false">More</a></li>
                            <li class="inactive"><a data-toggle="tab" id="TempLabor_click" href="#TempLabor" aria-expanded="false">Temporary Labor</a>
                            </li>
                        </ul>


                        <div class="tab-content">
                            <div id="Line" class="tab-pane fade active in">
                                <br />

                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                                        CssClass="table table-striped table-bordered table-hover" CellPadding="0"
                                        OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <asp:HiddenField ID="hid_line_id" runat="server" Value='<%#Bind("po_line_id")%>' />
                                                    <asp:HiddenField ID="hid_Item" runat="server"
                                                        Value='<%#Bind("item_id")%>' />
                                                    <asp:HiddenField ID="hid_UOM" runat="server"
                                                        Value='<%#Bind("unit_meas_lookup_code")%>' />
                                                    <asp:HiddenField ID="hid_Cat" runat="server"
                                                        Value='<%#Bind("category_id")%>' />
                                                    <asp:HiddenField ID="hid_line_type" runat="server" Value='<%#Bind("line_type_id") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>


                                            <asp:TemplateField HeaderText="Type" ControlStyle-Width="180px" ItemStyle-Width="180px">
                                                <ItemTemplate>
                                                    <asp:DropDownList ID="ddl_line_type" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Item" ControlStyle-Width="220px" ItemStyle-Width="220px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:TextBox CssClass="form-control" ID="txt_Item"
                                                            runat="server" Text='<%#Bind("ItemName") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_Item" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_Item_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Rev" ControlStyle-Width="50px" ItemStyle-Width="50px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_rev" runat="server"
                                                        Text='<%#Bind("item_revision") %>'
                                                        CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Job" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_Job" runat="server"
                                                        Text='<%#Bind("job_id") %>'
                                                        CssClass="form-control"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Category" ControlStyle-Width="180px" ItemStyle-Width="180px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:TextBox CssClass="form-control" ID="txt_Category"
                                                            runat="server" Text='<%#Bind("CatName") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_Category" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_Category_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <%--<asp:TemplateField HeaderText="Description" ControlStyle-Width="220px" ItemStyle-Width="220px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_Desc" runat="server"
                                                        Text='<%#Bind("item_description") %>' CssClass="form-control"
                                                        ></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>--%>

                                            <asp:TemplateField HeaderText="UOM" ControlStyle-Width="180px" ItemStyle-Width="180px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:TextBox CssClass="form-control" ID="txt_UOM"
                                                            runat="server" Text='<%#Bind("UOM") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_UOMLine" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_UOMLine_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Quantity" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_qty" runat="server"
                                                        Text='<%#Bind("quantity") %>' CssClass="form-control"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Price" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_Price" runat="server"
                                                        Text='<%#Bind("unit_price") %>' CssClass="form-control"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Promised" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_Promised" runat="server"
                                                        Text='<%#Bind("start_date") %>' CssClass="form-control datetime"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Need-By" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_Needby" runat="server"
                                                        Text='<%#Bind("closed_flag") %>' CssClass="form-control datetime"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Supplier Item" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>


                                                    <asp:TextBox ID="txt_Supplieritem" runat="server"
                                                        Text='<%#Bind("VENDOR_PRODUCT_NUM") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Amount" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>

                                                    <asp:TextBox ID="txt_Amount" runat="server"
                                                        Text='<%#Bind("amount") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Charge Account" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_chargAccount" runat="server"
                                                        Text='<%#Bind("committed_amount") %>' CssClass="form-control"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>


                                            <asp:TemplateField HeaderText="Reserved" ControlStyle-Width="50px" ItemStyle-Width="50px">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk_rsvrd" runat="server" CssClass="checkbox" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server" Visible="false"
                                                        CommandName="gEdit"><i class="fa fa-pencil"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add"
                                                        runat="server" CommandName="gadd"><i class="fa fa-plus"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        OnClientClick="return confirm('Are you sure to delete?')">
                                                        <i class="fa fa-trash" style="font-size:20px !important"></i>
                                                    </asp:LinkButton>
                                                    <%--<a id="Fac" href="Shipment.aspx?Plan_Header=<%# HRMS.Global.Encrypt(hid_ReqplanId.Value.ToString())+"&Request_ID="+HRMS.Global.Encrypt(Eval("REQUEST_HEADER_ID").ToString()) + "&Req_Name="+HRMS.Global.Encrypt(Eval("RequestName").ToString()) +"&bg_id="+ HRMS.Global.Encrypt(ddl_Busunit.SelectedValue.ToString())+"&pos_id="+HRMS.Global.Encrypt(Eval("POSITION_ID").ToString())+"&pos_name="+ HRMS.Global.Encrypt(Eval("Position").ToString())+"&City_id="+HRMS.Global.Encrypt(Eval("CITY_ID").ToString())+"&City_name="+ HRMS.Global.Encrypt(Eval("City").ToString())%>">Factor</a>--%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <%--  <FooterStyle CssClass="footerStyle" />
                                        <HeaderStyle CssClass="headerStyle" />
                                        <RowStyle CssClass="rowStyle" />--%>
                                    </asp:GridView>
                                </div>
                                <br />
                            </div>

                            <div id="Priceref" class="tab-pane fade">
                                <br />
                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
                                        CssClass="table table-striped table-bordered table-hover" CellPadding="0"
                                        OnRowCommand="GridView2_RowCommand" OnRowDataBound="GridView2_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-Width="10px">
                                                <ItemTemplate>
                                                    <asp:HiddenField ID="hid_priceref_id" runat="server" Value='<%#Bind("po_line_id")%>' />
                                                    <asp:HiddenField ID="hid_Pricetpe" runat="server" Value='<%#Bind("price_type_lookup_code")%>' />

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <%-- <asp:TemplateField HeaderText="Number" HeaderStyle-Width="10%">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_Number1" runat="server" Text='<%#Bind("line_num") %>'></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>--%>
                                            <asp:TemplateField HeaderText="List Price" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_listprice"
                                                        runat="server" Text='<%#Bind("list_price_per_unit") %>'>
                                                    </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Market Price" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_Market"
                                                        runat="server" Text='<%#Bind("Market_Price") %>'>
                                                    </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>


                                            <asp:TemplateField HeaderText="Price Type" ControlStyle-Width="220px" ItemStyle-Width="220px">
                                                <ItemTemplate>
                                                    <asp:DropDownList ID="ddl_pr_type" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Allow Price Override" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk_pr_ovr_rd" Style="text-align: center" runat="server" Enabled="false" CssClass="checkbox" />
                                                </ItemTemplate>
                                            </asp:TemplateField>


                                            <asp:TemplateField HeaderText="Price Limit" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_pr_lmt" Enabled="false"
                                                        runat="server">
                                                    </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>



                                            <asp:TemplateField HeaderText="Negotiated" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk_neg" runat="server" CssClass="checkbox" Style="text-align: center" />
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server" Visible="false"
                                                        CommandName="gEdit"><i class="fa fa-pencil"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add"
                                                        runat="server" CommandName="gadd"><i class="fa fa-plus"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        OnClientClick="return confirm('Are you sure to delete?')">
                                                        <i class="fa fa-trash" style="font-size:20px !important"></i>
                                                    </asp:LinkButton>

                                                </ItemTemplate>
                                                <ItemStyle Width="6%"></ItemStyle>
                                            </asp:TemplateField>
                                        </Columns>
                                        <%--  <FooterStyle CssClass="footerStyle" />
                                        <HeaderStyle CssClass="headerStyle" />
                                        <RowStyle CssClass="rowStyle" />--%>
                                    </asp:GridView>
                                </div>
                                <br />

                            </div>

                            <div id="RefDoc" class="tab-pane fade">
                                <br />
                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False"
                                        CssClass="table table-striped table-bordered table-hover" CellPadding="0"
                                        OnRowCommand="GridView3_RowCommand">
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-Width="10px">
                                                <ItemTemplate>
                                                    <asp:HiddenField ID="hid_priceDoc_id" runat="server" Value='<%#Bind("po_line_id")%>' />
                                                    <asp:HiddenField ID="hid_Contract_Num" runat="server" Value='<%#Bind("Contract_Num")%>' />
                                                    <asp:HiddenField ID="hid_oke_contract_header" runat="server" Value='<%#Bind("oke_contract_header_id")%>' />

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <%-- <asp:TemplateField HeaderText="Numeber" HeaderStyle-Width="10%">
                                                <ItemTemplate>
                                                    <div class="input-group">

                                                        <asp:TextBox CssClass="form-control" ID="txt_Number2"
                                                            runat="server" Text='<%#Bind("line_num") %>'>
                                                        </asp:TextBox>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>--%>
                                            <asp:TemplateField HeaderText="Contract"  ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:TextBox CssClass="form-control" ID="txt_Contract"
                                                            runat="server" Text='<%#Bind("ContractName") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_Contract" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_Contract_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>


                                            <asp:TemplateField HeaderText="Global" HeaderStyle-Width="10%">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk_globl" Enabled="false" runat="server" CssClass="checkbox" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Owning ORg"  ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" Enabled="false" ID="txt_Owningorg" runat="server"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Document Type" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_Doctype" runat="server" Enabled="false"> </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Document" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="Doc" Enabled="false" runat="server"> </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Line" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_Line" runat="server" Enabled="false"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>



                                            <asp:TemplateField HeaderText="Global" HeaderStyle-Width="10%">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chk_globl1" Enabled="false" runat="server" CssClass="checkbox" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Owning ORg" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>

                                                    <asp:TextBox CssClass="form-control" Enabled="false" ID="txt_Owningorg1" runat="server"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>


                                             <asp:TemplateField HeaderText="Supplier Quotation" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" Enabled="false" ID="txt_sup_quot" runat="server"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Contract Num" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:TextBox CssClass="form-control" ID="txt_ContractNum"
                                                            runat="server" Text='<%#Bind("ContractNames") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_ContractNum" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_ContractNum_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Rev" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                        <asp:TextBox CssClass="form-control" ID="txt_Rev"
                                                            runat="server" Text='<%#Bind("Oke_Contract_Version_Id") %>'>
                                                        </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server" Visible="false"
                                                        CommandName="gEdit"><i class="fa fa-pencil"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add"
                                                        runat="server" CommandName="gadd"><i class="fa fa-plus"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        OnClientClick="return confirm('Are you sure to delete?')">
                                                        <i class="fa fa-trash" style="font-size:20px !important"></i>
                                                    </asp:LinkButton>

                                                </ItemTemplate>
                                                <ItemStyle Width="6%"></ItemStyle>
                                            </asp:TemplateField>

                                        </Columns>
                                    <%--    <FooterStyle CssClass="footerStyle" />
                                        <HeaderStyle CssClass="headerStyle" />
                                        <RowStyle CssClass="rowStyle" />--%>
                                    </asp:GridView>
                                </div>
                                <br />

                            </div>

                            <div id="More" class="tab-pane fade">
                                <br />
                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False"
                                        CssClass="table table-striped table-bordered table-hover" CellPadding="0"
                                        OnRowCommand="GridView4_RowCommand">
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-Width="10px">
                                                <ItemTemplate>

                                                <%--    <asp:HiddenField ID="Hid_Notetosipp_ID" runat="server"
                                                        Value='<%#Bind("Note_To_Vendor")%>' />--%>
                                                    <asp:HiddenField ID="hid_po_line_id" runat="server"
                                                        Value='<%#Bind("po_line_id")%>' />
                                                    <asp:HiddenField ID="hid_UNnumber_Id" runat="server"
                                                        Value='<%#Bind("un_number_id")%>' />

                                                    <asp:HiddenField ID="hid_Hazard" runat="server"
                                                        Value='<%#Bind("HAZARD_CLASS_ID")%>' />
                                                    <asp:HiddenField ID="hid_Transnature" runat="server"
                                                        Value='<%#Bind("Transaction_Reason_Code")%>' />

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                           <%-- <asp:TemplateField HeaderText="Number" HeaderStyle-Width="10%">
                                                <ItemTemplate>
                                                    <div class="input-group">

                                                        <asp:TextBox CssClass="form-control" ID="txt_NumberMore"
                                                            runat="server" Text='<%#Bind("line_num") %>'>
                                                        </asp:TextBox>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>--%>
                                            <asp:TemplateField HeaderText="Note To Supplier" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                        <asp:TextBox CssClass="form-control" ID="txt_Notetosupplier"
                                                            runat="server" Text='<%#Bind("note_to_vendor") %>'>
                                                        </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="UN Number" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox CssClass="form-control" ID="txt_Unnumber"
                                                        runat="server" Text='<%#Bind("un_number_id") %>'>
                                                    </asp:TextBox>


                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="UN Description" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_UNDesc" runat="server"
                                                        Text='<%#Bind("clm_idc_type") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Hazard" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                          <asp:TextBox CssClass="form-control" ID="txt_Hazard"
                                                        runat="server" Text='<%#Bind("Hazard") %>'>
                                                    </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_hzrd" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_hzrd_ServerClick">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>



                                                  


                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Transaction Nature" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <div class="input-group">

                                                        <asp:TextBox CssClass="form-control" ID="txt_Transnature"
                                                            runat="server" Text='<%#Bind("TransName") %>'>
                                                        </asp:TextBox>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_Transnature" type="button" runat="server"
                                                                class="btn btn-white"
                                                                onserverclick="btn_lov_Transnature_Click">
                                                                <i
                                                                    class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server" Visible="false"
                                                        CommandName="gEdit"><i class="fa fa-pencil"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add"
                                                        runat="server" CommandName="gadd"><i class="fa fa-plus"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        OnClientClick="return confirm('Are you sure to delete?')">
                                                        <i class="fa fa-trash" style="font-size:20px !important"></i>
                                                    </asp:LinkButton>

                                                </ItemTemplate>
                                                <ItemStyle Width="6%"></ItemStyle>
                                            </asp:TemplateField>
                                        </Columns>
                                        <%--<FooterStyle CssClass="footerStyle" />
                                        <HeaderStyle CssClass="headerStyle" />
                                        <RowStyle CssClass="rowStyle" />--%>
                                    </asp:GridView>
                                </div>
                                <br />

                            </div>

                            <div id="TempLabor" class="tab-pane fade">
                                <br />
                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False"
                                        CssClass="table table-striped table-bordered table-hover" CellPadding="0" OnRowCommand="GridView5_RowCommand">
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-Width="10px">
                                                <ItemTemplate>
                                                    <asp:HiddenField ID="hidlab_po_line_id" runat="server"
                                                        Value='<%#Bind("po_line_id")%>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <%--<asp:TemplateField HeaderText="Number" HeaderStyle-Width="140px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_tempnumber" runat="server"
                                                        Text='<%#Bind("line_num") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>--%>
                                            <asp:TemplateField HeaderText="First Name" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_FirstName" runat="server"
                                                        Text='<%#Bind("contractor_first_name") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Last Name" ControlStyle-Width="200px" ItemStyle-Width="200px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_LastName" runat="server"
                                                        Text='<%#Bind("contractor_last_name") %>' CssClass="form-control"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Start Date" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_StartDate" runat="server"
                                                        Text='<%#Bind("start_date") %>' CssClass="form-control datetime"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="End Date" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_EndDate" runat="server"
                                                        Text='<%#Bind("start_date") %>' CssClass="form-control datetime"></asp:TextBox>

                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server" Visible="false"
                                                        CommandName="gEdit"><i class="fa fa-pencil"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add"
                                                        runat="server" CommandName="gadd"><i class="fa fa-plus"
                                                            style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        OnClientClick="return confirm('Are you sure to delete?')">
                                                        <i class="fa fa-trash" style="font-size:20px !important"></i>
                                                    </asp:LinkButton>

                                                </ItemTemplate>
                                                <ItemStyle Width="6%"></ItemStyle>
                                            </asp:TemplateField>
                                        </Columns>
                                        <FooterStyle CssClass="footerStyle" />
                                        <HeaderStyle CssClass="headerStyle" />
                                        <RowStyle CssClass="rowStyle" />
                                    </asp:GridView>
                                </div>

                                <hr />
                            </div>

                        </div>
                    </updatepanel>
                    <div class="pull-left">
                        <asp:Button Text="Catalog" CssClass="btn btn-info" ID="btn_Catlog" Width="120px" ValidationGroup="Catalog"
                            runat="server" OnClick="btn_Catlog_Click" />
                        <asp:Button Text="Currency" CssClass="btn btn-info" ID="btn_Currency" Width="120px" ValidationGroup="Currency"
                            runat="server" OnClick="btn_Currency_Click" />
                        <asp:Button Text="Terms" CssClass="btn btn-info" ID="btn_Terms" Width="120px" ValidationGroup="Terms"
                            runat="server" OnClick="btn_Terms_Click" />
                        <asp:Button Text="Shipments" CssClass="btn btn-info" ID="btn_Shipment" Width="120px" ValidationGroup="Shipments"
                            runat="server" OnClick="btn_Shipment_Click" />
                        <asp:Button Text="Approve" CssClass="btn btn-info" ID="btn_Approve" Width="120px" ValidationGroup="Approve"
                            runat="server" OnClick="btn_Approve_Click" />

                    </div>
                </section>
            </div>
        </div>
    </div>
    </div>
     <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css" rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <%--<script src="/ThemeScrips/select2.min.js"></script>--%>


    <script src="Scripts/jquery-2.1.3.min.js"></script>
    <script src="Scripts/bootstrap.js"></script>

    <script>


        $(document).ready(function () {

            var tabId = document.getElementById('<%= hidTAB.ClientID%>').value;
            if (tabId == "5") {
                $('#myTabs a[href="#TempLabor"]').tab('show');
                //alert(tabId);
                //$('.nav-tabs a[href="#Location"]').tab('show');
            }
            else if (tabId == "4") {
                $('#myTabs a[href="#More"]').tab('show');
                //alert(tabId);
            }
            else if (tabId == "3") {
                $('#myTabs a[href="#RefDoc"]').tab('show');
                //alert(tabId);
            }
            else if (tabId == "2") {
                $('#myTabs a[href="#Priceref"]').tab('show');
                //alert(tabId);
            }
            else {
                $('#myTabs a[href="#Line"]').tab('show');
                //alert(tabId);
            }

            //$('.nav-tabs a[href="#' + tabId + '"]').tab('show');
            //$('#myTabs a[href="' + tab + '"]').tab('show');

            //$("btn_lov_ReqPlan").click(function ()){
            //    $('#myTabs a[href="#Action"]').tab('show');
            //    alert('Yes Action');
            //});

        });

        $("#Line_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "1";
            //var x = document.getElementById('<%= hidTAB.ClientID%>').value;           
            //alert(x);
        });

        $("#PriceRef_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "2";
            //var y = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(y);
        });

        $("#RefDoc_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "3";
            //var z = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(z);
        });

        $("#More_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "4";
             //var z = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(z);
        });

        $("#TempLabor_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "5";
             //var z = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(z);
        });

        //$("btn_lov_ReqPlan").click(function ()){
        //        $('#myTabs a[href="#Action"]').tab('show');
        //        alert('Yes Action');
        //});


        // Open & Close Modal Popup \\

        //function openModal() {
        //    $('[id*=myModal2]').modal('show');
        //}  

        //function closeModal() {
        //    $('[id*=myModal2]').modal('hide');
        //} 

        // Open & Close Modal Popup \\

        //$("#lnkpopup").click(function () {
        //    // show Modal
        //    //$('[id*=myModal2]').modal('show');
        //});

    </script>
</asp:Content>
