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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphJavaScriptContentPlaceHolder" runat="server">
    <script type="text/javascript">
        //function isNumber(evt) {
        //    evt = (evt) ? evt : window.event;
        //    var charCode = (evt.which) ? evt.which : evt.keyCode;
        //    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        //        return false;
        //    }
        //    return true;
        //}

        function digits(obj, e, allowDecimal, allowNegative) {
            var key;
            var isCtrl = false;
            var keychar;
            var reg;

            if (window.event) {
                key = e.keyCode;
                isCtrl = window.event.ctrlKey
            }
            else if (e.which) {
                key = e.which;
                isCtrl = e.ctrlKey;
            }

            if (isNaN(key)) return true;

            keychar = String.fromCharCode(key);

            // check for backspace or delete, or if Ctrl was pressed
            if (key == 8 || isCtrl) {
                return true;
            }

            reg = /\d/;
            //var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
            var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;

            return isFirstD || reg.test(keychar);
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPageTitleContentPlaceHolder" runat="server">
     <div id="CssPageTitle">
        <h1>
            Compare Project/Event

        </h1>
    </div>
    <div id="SubPageTitle">
        <!-- OPTIONAL SUB PAGE TITLE -->
     
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphMainContentPlaceHolder" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div id="loaderdiv">
                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel2" DynamicLayout="true">
                    <ProgressTemplate>

                        <img src="resource_gallery/graphics/loader.gif" class="ajax-loader">
                    </ProgressTemplate>
                </asp:UpdateProgress>

            </div>
           <div style="text-align:right;"><a href="default.aspx">Home</a> <strong>&#8249;&#8249;</strong> <a href="History.aspx">Reports</a> <strong>&#8249;&#8249;</strong> Compare Project/Event</div>
            <div>
                <fieldset class="masterform">
                    <legend>Rate Area Company</legend>
                    <div style="width: 100%; height: 40px;">
                        <table>
                            <tr>
                                <td>Business Unit:
                                    <asp:DropDownList ID="ddlBUnit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlBUnit_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>

                                <td>Year:
                                    <asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged" OnDataBound="ddlYear_DataBound">
                                    </asp:DropDownList>
                                </td>

                                <td>Project/Event:
                                    <asp:DropDownList ID="ddlEventCode" runat="server" OnDataBound="ddlEventCode_DataBound" AutoPostBack="true" OnSelectedIndexChanged="ddlEventCode_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                                <td>Section/WA:
                                    <asp:DropDownList ID="ddlWorkArea" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlWorkArea_SelectedIndexChanged" OnDataBound="ddlWorkArea_DataBound">
                                    </asp:DropDownList>
                                </td>
                               <%-- <td><asp:Button ID="btnGo" runat="server" Text="Go" CssClass="FormButton" OnClick="btnGo_Click" /></td>--%>
                            </tr>
                        </table>
                        <br />                        
                    </div>
                </fieldset>
            </div>
            <div style="text-align:left; width: 100%;">
                <fieldset class="masterform">
                    <legend>Comparison</legend>
                    <div style="width: 100%; height: 400px; overflow-y: scroll;">
                            <div style="float: left; width: 48%; height: 300px;">
                                <div style="text-align: center;">
                                    <asp:Label ID="lblHistory" runat="server" Font-Bold="true"></asp:Label><br />
                                </div>
                                <asp:GridView ID="gdvRateHistory" runat="server" BorderColor="#014567" CellPadding="3" Width="99%"
                                    AutoGenerateColumns="False" EmptyDataText="No data in the data source.">
                                    <AlternatingRowStyle BackColor="#E9EFF2" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <asp:Label ID="lblRateTypeName" runat="server" Text="RATE TYPE"></asp:Label>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("rate_type_name") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <asp:Label ID="lblUOM" runat="server" Text="UOM"></asp:Label>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("uom") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <asp:Label ID="lblRateTypeAmount" runat="server" Text="AMOUNT"></asp:Label>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("rate_type_amount") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <asp:Label ID="lblRateRatio" runat="server" Text="RATIO"></asp:Label>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ratio") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                    </Columns>
                                    <HeaderStyle BackColor="#98C8DE" Font-Bold="True" />
                                    <SelectedRowStyle BackColor="#FFE98F" />
                                </asp:GridView>
                                <table border="0" id="tableHistory" runat="server" visible="false">
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblBillText" runat="server" Text="Billable Length"></asp:Label></td>
                                        <td>
                                            <asp:Label ID="lblBillable" runat="server"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblNonBillText" runat="server" Text="Non-Billable Length"></asp:Label></td>
                                        <td>
                                            <asp:Label ID="lblNonBillable" runat="server"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblSkippedText" runat="server" Text="Skipped Length"></asp:Label></td>
                                        <td>
                                            <asp:Label ID="lblSkipped" runat="server"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblBillAmtText" runat="server" Text="Total Bill Amt. in $"></asp:Label></td>
                                        <td>
                                            <asp:Label ID="lblTotBillAmt" runat="server"></asp:Label></td>
                                    </tr>
                                </table>
                            </div>
                            <div style="float: right; width: 48%; height: 400px;">
                                <div style="text-align: center;">
                                    <asp:Label ID="lblNew" runat="server" Font-Bold="true"></asp:Label><br />
                                </div>
                                <asp:Panel runat="server" ID="Header" Visible="false">
                                    <table cellpadding="4" cellspacing="1" border="1" class="auto-style3" Width="99%">
                                        <tr style="background-color:#98C8DE;">
                                            <td style="width: 24%">TRIM TYPE</td>
                                            <td style="width: 16%">UOM</td>
                                            <td style="width: 22%">AMOUNT</td>
                                            <td style="width: 22%">RATIO</td>
                                            <td style="width: 10%">
                                                <asp:ImageButton ID="btnshowhide" runat="server" Height="25px" ImageUrl="resource_gallery/graphics/plus.png" OnClick="btnshowhide_Click" Width="24px" />
                                            </td>
                                        </tr>                                        
                                    </table>
                                </asp:Panel>
                                 <asp:Panel runat="server" ID="AddNew" Visible="false" Width="99%">
                                    <table cellpadding="2" cellspacing="1" border="1" class="auto-style3">
                                        <tr>
                                            <td style="width: 24%">
                                                <asp:DropDownList ID="ddlRateTypes" runat="server" Width="90px" AutoPostBack="True" OnSelectedIndexChanged="ddlRateTypes_SelectedIndexChanged" OnDataBound="ddlRateTypes_DataBound" >
                                                </asp:DropDownList>
                                            </td>
                                            <td style="width: 16%">
                                                <asp:Label ID="lblUOM" runat="server" Text=""></asp:Label>
                                            </td>
                                            <td style="width: 22%">
                                                <asp:TextBox ID="txtRateamount" Width="70px" runat="server">0</asp:TextBox>
                                            </td>
                                            <td style="width: 22%">
                                                <asp:TextBox ID="txtRatio" Width="70px" runat="server">0</asp:TextBox>
                                            </td>
                                            <td style="width: 10%">
                                                <asp:Button ID="btnAddRates" runat="server" CssClass="FormButton" Width="36px" Text="Add" OnClick="btnAddRates_Click" />
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>

                                <asp:GridView ID="gdvRateNew" runat="server" BorderColor="#014567" CellPadding="3" Width="99%" ShowHeader="false" OnRowDeleting="gdvRateNew_RowDeleting"
                                    AutoGenerateColumns="False" EmptyDataText="No data in the data source." OnRowDataBound="gdvRateNew_RowDataBound" ShowFooter="true">
                                    <AlternatingRowStyle BackColor="#E9EFF2" />
                                    <FooterStyle Font-Bold="true" BackColor="#61A6F8" ForeColor="black" />
                                    <Columns>
                                        <asp:TemplateField>
                                           <%-- <HeaderTemplate>
                                                <asp:Label ID="lblRateTypeName" runat="server" Text="RATE TYPE"></asp:Label>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <%# Eval("rate_type_name") %>
                                                <asp:Label ID="lblRateTypeId" runat="server" Text='<%# Eval("rate_type_id") %>' Visible="false"></asp:Label>
                                                <asp:Label ID="lblRateTypeName" runat="server" Text='<%# Eval("rate_type_name") %>' Visible="false"></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle Width="24%" />
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <%--<HeaderTemplate>
                                                <asp:Label ID="lblUOM" runat="server" Text="UOM"></asp:Label>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <%# Eval("uom") %>
                                                <asp:Label ID="lblUOM" runat="server" Text='<%# Eval("uom") %>' Visible="false"></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle Width="16%" />
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <%--<HeaderTemplate>
                                                <asp:Label ID="lblRateTypeAmount" runat="server" Text="AMOUNT"></asp:Label>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtRateTypeAmount" runat="server" Text='<%# Bind("rate_type_amount") %>' Width="70px" onkeypress="return isNumber(event);" OnTextChanged="txtRateTypeAmount_TextChanged" AutoPostBack="True"></asp:TextBox>
                                            </ItemTemplate>
                                            <ItemStyle Width="22%" />
                                            <FooterTemplate>
                                                <asp:Label ID="lblTotal" runat="server" Text="Total"/>
                                            </FooterTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <%--<HeaderTemplate>
                                                <asp:Label ID="lblRateRatio" runat="server" Text="RATIO"></asp:Label>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtRateRatio" runat="server" Text='<%# Bind("ratio") %>' Width="70px" onkeypress="return isNumber(event);" OnTextChanged="txtRateRatio_TextChanged" AutoPostBack="True"></asp:TextBox>
                                            </ItemTemplate>
                                            <ItemStyle Width="22%" />
                                            <FooterTemplate>
                                                <asp:Label ID="lblTotalRatio" runat="server" />
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField ShowHeader="False" HeaderText="Delete">
                                            <ItemStyle Width="10%"/>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"><img src="resource_gallery/graphics/icon_delete.png" /></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <%--<HeaderStyle BackColor="#98C8DE" Font-Bold="True" />--%>
                                    <SelectedRowStyle BackColor="#FFE98F" />
                                </asp:GridView>
                               
                                <table border="0" id="tableNew" runat="server" visible="false">
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblBillableText" runat="server" Text="Billable Length"></asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="txtBillable" runat="server" MaxLength="10" OnTextChanged="txtBillable_TextChanged" onkeypress="return digits(this,event,true, true);" ondrop="return false;" onpaste="return false;" AutoPostBack="true"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblNonBillableText" runat="server" Text="Non-Billable Length"></asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="txtNonBillable" MaxLength="10" runat="server" onkeypress="return digits(this,event,true, true);"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblSkippedText1" runat="server" Text="Skipped Length"></asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="txtSkipped" MaxLength="10" runat="server" onkeypress="return digits(this,event,true, true);"></asp:TextBox></td>
                                    </tr> 
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblTotAmtText" runat="server" Text="Total Bill Amt. in $"></asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="txtTotBillAmt" runat="server" ReadOnly="true"></asp:TextBox></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                </fieldset>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
