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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style2 {
            width: 200px;
            height: 34px;
        }
        .auto-style3 {
            width: 150px;
            height: 34px;
        }
        .control-style {
            width: 95%;
            height: 28px;
        }
        .auto-style4 {
            width: 244px;
            /*height: 34px;*/
        }
        .auto-style5 {
            width: 100px;
            height: 34px;
        }
         .auto-style6 {
            width: 50px;
            height: 34px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphJavaScriptContentPlaceHolder" runat="server">     
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPageTitleContentPlaceHolder" runat="server">
    <div id="CssPageTitle">
        <h1>Year End Accrual 
            &amp; Forecast 
        </h1>
    </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="CurrentYTD.aspx">Current</a> <strong>&#8249;&#8249;</strong> Year End Accrual & Forecast</div>
           
             <div style="text-align:left; width: 100%;">
             <fieldset class="masterform">
                <legend>Accrual and Forecast</legend> 
                <div style=" width: 100%; height:35px; ">


		            <table >
                        <tr>
                            <td style="width: 20%">
                                </td>
                            <td style="width: 30%">
                                <asp:RadioButton ID="rbt_accrual" runat="server" GroupName="inspect" AutoPostBack="True" OnCheckedChanged="rbt_accrual_CheckedChanged" /> ACCRUAL 
                            </td>
                             <td style="width: 20%"> 
                                 <asp:RadioButton ID="rbt_forecast" runat="server" GroupName="inspect"  Checked="True"  AutoPostBack="True" OnCheckedChanged="rbt_forecast_CheckedChanged"  /> FORECAST
                                </td>
                            <td style="width: 30%">
                                <asp:RadioButton ID="rbt_yrendforecast" runat="server" GroupName="inspect" AutoPostBack="True" OnCheckedChanged="rbt_forecast_CheckedChanged"  /> YEAR-END FORECAST
                            </td>
                        </tr>
                    </table>


		</div>
       	       </fieldset>
</div>
            
             <div style="text-align: left; width: 100%;">
                <fieldset class="masterform">
                    <legend>Select Section/WA </legend>
                    <div style="width: 100%; height: 60px;">

                        <table class="auto-style2">
                            <tr>
                                
                                 <td style="width: 20%">Business Unit</td>
                                <td style="width: 16%">Work Year</td>
                                <td style="width: 20%">Project/Event</td>
                                <td style="width: 24%">Section/WA</td>
                                <td style="width: 20%">Company</td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                             
                                  <td style="width: 20%">
                                    <asp:DropDownList ID="ddl_BU" runat="server" Width="130px" AutoPostBack="true" OnDataBound="ddl_BU_DataBound" OnSelectedIndexChanged="ddl_BU_SelectedIndexChanged" >
                                    </asp:DropDownList>
                                </td>
                                 <td style="width: 16%">
                                    <asp:DropDownList ID="ddl_Year" runat="server" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="ddl_Year_SelectedIndexChanged" OnDataBound="ddl_Year_DataBound">
                                    </asp:DropDownList>
                                </td>

                                <td style="width: 20%">
                                    <asp:DropDownList ID="ddl_EventCode" runat="server" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="ddl_EventCode_SelectedIndexChanged" OnDataBound="ddl_EventCode_DataBound">
                                    </asp:DropDownList>

                                </td>
                                <td style="width: 24%">
                                    <asp:DropDownList ID="ddl_WorkArea" runat="server" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="ddl_WorkArea_SelectedIndexChanged" OnDataBound="ddl_WorkArea_DataBound">
                                    </asp:DropDownList>
                                </td>
                                <td style="width: 20%">
                                    <asp:DropDownList ID="ddl_Company" runat="server" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="ddl_Company_SelectedIndexChanged" OnDataBound="ddl_Company_DataBound" >
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <asp:Button ID="btn_expExcel" runat="server" CssClass="FormButton" Text="Export to Excel" OnClick="btn_expExcel_Click" />
                                </td>
                            </tr>
                        </table>

                    </div>
                </fieldset>
            </div>
            <div style="text-align: left; width: 100%;">
                <fieldset class="masterform">
                    <legend>Section/WA - Accrued/Forecasted List</legend>

                    <div style="text-align: left; width: 100%; overflow-y: scroll;">
                        <div style="width: 1800px; height: 250px;">
                            <asp:Button ID="btnAdd" runat="server" Text="Add" CssClass="FormButton" OnClick="btnAdd_Click" />&nbsp;<asp:Button ID="btn_addRates" runat="server" CssClass="FormButton" Text="Add" Visible="false" OnClick="btn_addRates_Click" /><br /><br />
                           <%-- <table cellpadding="2" cellspacing="1" border="1" >
                                <tr style="background-color: #98C8DE;">
                                    <td id="rowAdd" runat="server" class="auto-style6">
                                        <asp:ImageButton ID="btnshowhide" runat="server" Height="25px" ImageUrl="resource_gallery/graphics/plus.png" Width="25px" OnClick="btnshowhide_Click" />
                                    </td>
                                    <td class="auto-style2">PROJECT/EVENT</td>
                                    <td class="auto-style3">SECTION/WA</td>
                                    <td class="auto-style5">COMPANY</td>
                                    <td class="auto-style5">YEAR</td>
                                    <td class="auto-style5">MILES </td>
                                    <td class="auto-style5">AMOUNT </td>
                                    <td class="auto-style5">BILLABLE </td>
                                    <td class="auto-style5">NON BILLABLE </td>
                                    <td class="auto-style5">URBAN MILE </td>
                                    <td class="auto-style5">RURAL MILE </td>
                                    <td class="auto-style5">CLIMBING MILE </td>
                                    <td class="auto-style5">HELICOPTER MILE </td>
                                    <td class="auto-style5">URBAN AMOUNT </td>
                                    <td class="auto-style5">RURAL AMOUNT </td>
                                    <td class="auto-style5">CLIMBING AMOUNT </td>
                                    <td class="auto-style5">HELICOPTER AMOUNT </td>                               
                                </tr>--%>
                            <%--</table>
                            <asp:Panel runat="server" ID="CreateNew">
                                <table cellpadding="2" cellspacing="1" border="1" class="auto-style3" style="width: 100%">--%>
                                 <%--   <tr runat="server" ID="CreateNew">
                                        <td id="rowAddBtn" runat="server" class="auto-style6">
                                            <asp:Button ID="btn_addRates" runat="server" CssClass="FormButton" Text="Add" OnClick="btn_addRates_Click" />
                                        </td>
                                        <td class="auto-style2">
                                            <asp:DropDownList ID="ddlEventCode" runat="server" CssClass="control-style" AutoPostBack="true" OnDataBound="ddlEventCode_DataBound" OnSelectedIndexChanged="ddlEventCode_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="auto-style3">
                                            <asp:DropDownList ID="ddlWorkArea" runat="server" CssClass="control-style">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="auto-style3">
                                            <asp:DropDownList ID="ddlCompany" runat="server" CssClass="control-style">
                                            </asp:DropDownList>
                                        </td>
                                         <td class="auto-style5">
                                            <asp:DropDownList ID="ddlYear" runat="server" CssClass="control-style">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtAccruedAmt" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtMileage" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                       <td class="auto-style5">
                                            <asp:TextBox ID="txtBillable" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtNonBillable" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtUrbanMiles" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtRuralMiles" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtClimbingMiles" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtHelicopterMiles" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtUrbanAmount" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtRuralAmount" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtClimbingAmount" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                        <td class="auto-style5">
                                            <asp:TextBox ID="txtHelicopterAmount" runat="server" CssClass="control-style"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>--%>
                        <%--</div>
                        <div style="width: 1800px; height: 200px; overflow-y: scroll;">--%>

                            <asp:GridView ID="gdvAccrual" runat="server" BorderColor="#014567" cellpadding="0" cellspacing="0"  AutoGenerateColumns="False" ShowHeader="True" OnRowCreated="gdvAccrual_RowCreated" OnRowDataBound="gdvAccrual_RowDataBound" OnSelectedIndexChanged="gdvAccrual_SelectedIndexChanged">
                                <AlternatingRowStyle BackColor="#E9EFF2" />
                                <Columns>
                                    <asp:TemplateField HeaderText="PROJECT/EVENT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server"  Visible="false" Text='<%# Bind("EVENT_CODE_ID") %>'></asp:Label>
                                            <a href='<%=System.Configuration.ConfigurationManager.AppSettings["VMSWorkLink"]%>?bu=0&ec=<%# Eval("EVENT_CODE_ID") %>&wa=0&yr=0' target="_blank"> <asp:Label ID="Label2" runat="server" Text='<%# Bind("EVENT_CODE") %>'></asp:Label> </a>
                                             
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style4" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="SECTION/WA">
                                        <ItemTemplate>
                                            <%--<asp:Label ID="Label2" runat="server" Text='<%# Bind("work_area") %>'></asp:Label>--%>
                                            <a href='<%=System.Configuration.ConfigurationManager.AppSettings["VMSWorkLink"]%>?bu=0&ec=<%# Eval("EVENT_CODE_ID") %>&wa=<%# Eval("WORK_AREA_ID") %>&yr=0' target="_blank">  <asp:Label ID="Label4" runat="server" Text='<%# Bind("WORK_AREA") %>'></asp:Label></a>
                                             <asp:Label ID="Label5" runat="server" Visible="false" Text='<%# Bind("work_area_id") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style3" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="COMPANY">
                                        <ItemTemplate>
                                            <asp:Label ID="Label12" runat="server" Text='<%# Bind("Company") %>'></asp:Label>
                                            <asp:Label ID="Label21" runat="server" Visible="false" Text='<%# Bind("COMPANY_ID") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5"/>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="YEAR">
                                        <ItemTemplate>
                                            <asp:Label ID="Label54" runat="server" Text='<%# Bind("work_year") %>'></asp:Label>
                                            <asp:Label ID="lblYrId" runat="server" Visible="false" Text='<%# Bind("year_id") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="MILES">
                                        <ItemTemplate>
                                            <asp:Label ID="Label53" runat="server" Text='<%# Bind("mileage") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="AMOUNT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("amount") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                 
                                    <asp:TemplateField HeaderText="BILLABLE">
                                        <ItemTemplate>
                                            <asp:Label ID="Label55" runat="server" Text='<%# Bind("BILLABLE") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="NON BILLABLE">
                                        <ItemTemplate>
                                            <asp:Label ID="Label56" runat="server" Text='<%# Bind("NON_BILLABLE") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="URBAN_MILES">
                                        <ItemTemplate>
                                            <asp:Label ID="Label57" runat="server" Text='<%# Bind("URBAN_MILES") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="RURAL_MILES">
                                        <ItemTemplate>
                                            <asp:Label ID="Label58" runat="server" Text='<%# Bind("RURAL_MILES") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="CLIMBING_MILES">
                                        <ItemTemplate>
                                            <asp:Label ID="Label59" runat="server" Text='<%# Bind("CLIMBING_MILES") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="HELICOPTER_MILES">
                                        <ItemTemplate>
                                            <asp:Label ID="Label60" runat="server" Text='<%# Bind("HELICOPTER_MILES") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="URBAN_AMT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label61" runat="server" Text='<%# Bind("URBAN_AMT") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="RURAL_AMT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label62" runat="server" Text='<%# Bind("RURAL_AMT") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="CLIMBING_AMT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label63" runat="server" Text='<%# Bind("CLIMBING_AMT") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="HELICOPTER_AMT">
                                        <ItemTemplate>
                                            <asp:Label ID="Label64" runat="server" Text='<%# Bind("HELICOPTER_AMT") %>'></asp:Label>
                                        </ItemTemplate>
                                         <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>
                                   <%-- <asp:TemplateField HeaderText="EFFECTIVE DATE" >
                                        <ItemTemplate>
                                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("effective_date") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>--%>
                                    <%--<asp:TemplateField HeaderText="WA_ID">
                                        <ItemTemplate>
                                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("work_area_id") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="EMPTYCOL">
                                        <ItemTemplate>
                                            <asp:Label ID="Label6" runat="server" Text='<%# Bind("emptycol") %>'></asp:Label>
                                        </ItemTemplate>
                                        <ItemStyle CssClass="auto-style5" />
                                    </asp:TemplateField>--%>

                                   <%-- <asp:TemplateField ShowHeader="False" HeaderText="Delete">
                                        <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" Height="34px" />
                                <SelectedRowStyle BackColor="#FFE98F" />
                            </asp:GridView>


                        </div>
                    </div>
                </fieldset>
            </div>

            <div style="text-align: left; width: 100%;">
                <fieldset class="masterform">
                    <legend>Accrual/Forecast Details</legend>
                    <div style="width: 100%; height: 200px; overflow-y: scroll;">
                        <asp:GridView ID="gdvAccrualDetails" runat="server" Width="100%" AutoGenerateColumns="false" OnRowCreated="gdvAccrualDetails_RowCreated">
                            <HeaderStyle BackColor="#98C8DE" Font-Bold="True" />
                            <Columns>
                                <asp:BoundField DataField="event_code" HeaderText="PROJECT/EVENT" />
                                <asp:BoundField DataField="work_area" HeaderText="SECTION/WA" />
                                <asp:BoundField DataField="accrued_amount" HeaderText="AMOUNT" ItemStyle-HorizontalAlign="Right" />                                
                                <asp:BoundField DataField="COMPANY" HeaderText="COMPANY" />
                                <asp:BoundField DataField="mileage" HeaderText="MILEAGE" ItemStyle-HorizontalAlign="Right" />
                                 <asp:BoundField DataField="BILLABLE" HeaderText="BILLABLE" />
                                 <asp:BoundField DataField="NON_BILLABLE" HeaderText="NON_BILLABLE" />
                                 <asp:BoundField DataField="URBAN_MILES" HeaderText="URBAN_MILES" />
                                 <asp:BoundField DataField="RURAL_MILES" HeaderText="RURAL_MILES" />
                                 <asp:BoundField DataField="CLIMBING_MILES" HeaderText="CLIMBING_MILES" />
                                 <asp:BoundField DataField="HELICOPTER_MILES" HeaderText="HELICOPTER_MILES" />
                                 <asp:BoundField DataField="URBAN_AMT" HeaderText="URBAN_AMT" />
                                 <asp:BoundField DataField="RURAL_AMT" HeaderText="RURAL_AMT" />
                                 <asp:BoundField DataField="CLIMBING_AMT" HeaderText="CLIMBING_AMT" />
                                <asp:BoundField DataField="HELICOPTER_AMT" HeaderText="HELICOPTER_AMT" />                                
                                <asp:BoundField DataField="effective_date" HeaderText="EFFECTIVE DATE" />
                                <asp:BoundField DataField="LAST_UPDATED_USER_ID" HeaderText="UPDATED BY" />
                          <%--  <asp:BoundField DataField="LAST_UPDATED_ON" HeaderText="TIMESTAMP" />--%>
                            </Columns>
                            <SelectedRowStyle BackColor="#FFE98F" />
                        </asp:GridView>
                    </div>
                </fieldset>
            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
