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

<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">
                        Adjust Invoices
                        <div class="pull-right">
                            <asp:Button ID="btn_save" runat="server" CssClass="btn btn-info" Text="Save" OnClick="btn_save_Click" />
                            <asp:Button ID="btn_bck" runat="server" CssClass="btn btn-info" Text="Back" OnClick="btn_bck_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">
                                <label class="control-label col-md-3 col-md-offset-7">Payment Amount</label>
                                <div class="col-md-2">
                                    <asp:TextBox ID="txt_h_amt" runat="server" Enabled="false" CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>

                           <div class="row">
                                <label class="control-label col-md-3 col-md-offset-7">Total</label>
                                <div class="col-md-2">
                                    <asp:TextBox ID="txt_h_total" runat="server" Enabled="false" CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                        <hr />


                                                 <asp:HiddenField ID="vid" runat="server" />
                                                  <asp:GridView ID="GridView2"  Visible="false" runat="server" AutoGenerateColumns="False" 
                        CssClass="table table-striped table-bordered table-hover" CellPadding="0">
                                <Columns>
                                <asp:TemplateField HeaderStyle-Width="10px">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hid_line" runat="server" Value='<%#Bind("INVOICE_PAYMENT_ID")%>' />
                                        <asp:HiddenField ID="hid_inv" runat="server" Value='<%#Bind("INVOICE_ID")%>' />
                                        <asp:HiddenField ID="hid_inv_amt" runat="server" Value='<%#Bind("INVOICE_AMOUNT")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                     <asp:TemplateField HeaderStyle-Width="10px">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chk" Enabled='<%# bool.Parse(Eval("PAYMENT_STATUS_FLAG").ToString()=="P"?"False":"True") %>' runat="server"/>
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                <asp:TemplateField HeaderText="Invoice Number" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_inv" Enabled="false" runat="server" CssClass="form-control" Text='<%# Bind("INVOICE_NUM") %>'></asp:TextBox>
                                         <asp:DropDownList Visible="false" ID="ddl_inv_no" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                  <asp:TemplateField HeaderText="Payment Amount"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_amount" runat="server" CssClass="form-control"  Text='<%# Bind("INVOICE_AMOUNT") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Discount Amount" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_disc_amt" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Unpaid Amount"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_up_amt" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Discount Available"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_disc_avl" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Status"  ControlStyle-Width="100px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_status" Text='<%#Eval("INVOICE_PAYMENT_ID")+""==""?"Unpaid":"Paid" %>' runat="server" Enabled="false" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                    <asp:TemplateField HeaderText="Action" Visible="false" ItemStyle-Width="6%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkadd" Visible="false"  runat="server" CommandName="gadd" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'><i class="fa fa-plus" style="font-size:20px !important;"></i></asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="linkedit" Visible="false"  runat="server" CommandName="gEdit"><i class="fa fa-pencil" style="font-size:20px !important;"></i></asp:LinkButton>
                                            <asp:linkbutton ID="linkdlt" CausesValidation="false" CommandName="gDelete" runat="server" Visible="false" 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>


                           <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CssClass="table table-striped table-bordered table-hover" CellPadding="0" OnRowDataBound="GridView1_RowDataBound">
                                <Columns>
                                <asp:TemplateField HeaderStyle-Width="10px">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hid_line" runat="server" Value='<%# Bind("INVOICE_PAYMENT_ID") %>' />
                                        <asp:HiddenField ID="hid_inv" runat="server"   />
                                        <asp:HiddenField ID="hid_inv_no" runat="server" Value='<%#Bind("INVOICE_ID")%>' />
                                        <asp:HiddenField ID="hid_inv_amt" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                <asp:TemplateField HeaderText="Invoice Number" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                         <asp:DropDownList ID="ddl_inv_no" runat="server" CssClass="form-control select2" OnSelectedIndexChanged="ddl_inv_no_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

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

                                <asp:TemplateField HeaderText="Discount Amount" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_disc_amt" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Unpaid Amount"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_up_amt" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Discount Available"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_disc_avl" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

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

                                    <asp:TemplateField HeaderText="Action" Visible="false" ItemStyle-Width="6%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkadd" Visible="false"  runat="server" CommandName="gadd" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'><i class="fa fa-plus" style="font-size:20px !important;"></i></asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="linkedit" Visible="false"  runat="server" CommandName="gEdit"><i class="fa fa-pencil" style="font-size:20px !important;"></i></asp:LinkButton>
                                            <asp:linkbutton ID="linkdlt" CausesValidation="false" CommandName="gDelete" runat="server" Visible="false" 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>

                </section>
            </div>
        </div>
    </div>
</asp:Content>
