<%@ Page Title="Plan Approve" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="plan_approve_home.aspx.cs" Inherits="edicenter.plan_approve_home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <br /><br /><br /><br />
    <div class="container-fluid">
        <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-12"> 
    <div class="row">

         <div class="panel panel-primary">
      <div class="panel-heading">&nbsp&nbsp Plan Approve - Manager MRP รายการแผนการผลิตและสั่งสินค้า(SA Number) สำหรับอนุมัติ Forecast&nbsp&nbsp&nbsp&nbsp&nbsp[<%= Session["ULogin"].ToString().Trim() %>]</div>
      <div class="panel-body">
        &nbsp&nbsp
        <asp:Label ID="lblPlant" runat="server" Text="Plant:"></asp:Label>
        <asp:TextBox ID="txtPlant" runat="server" ReadOnly = "false" Width="75px"></asp:TextBox>&nbsp&nbsp  
        <asp:Label ID="Label6" runat="server" Text="Vender:"></asp:Label>
        <asp:TextBox ID="txtVender" runat="server" ReadOnly = "false" Width="100px"></asp:TextBox>&nbsp&nbsp      
        <asp:DropDownList ID="ddlF" runat="server" Height ="26px">
        </asp:DropDownList>&nbsp&nbsp&nbsp&nbsp&nbsp
        <asp:Label ID="lblFrom" runat="server" Text="From"></asp:Label>
        <asp:TextBox ID="txtSearchDate" runat="server" ReadOnly = "true" Width="100px"></asp:TextBox>
        <asp:ImageButton ID="imgCalendar" runat="server" Height="20px" ImageUrl="~/Resources/calendar.gif" Width="25px" OnClick="imgCalendar_Click" />
        <asp:Calendar ID="Calendar" runat="server" OnSelectionChanged="Calendar_SelectionChanged" OnVisibleMonthChanged="Calendar_VisibleMonthChanged"></asp:Calendar>
        <asp:Label ID="lblTo" runat="server" Text="To"></asp:Label>
        <asp:TextBox ID="txtSearchDateLast" runat="server" ReadOnly = "true" Width="100px"></asp:TextBox>
        <asp:ImageButton ID="imgCalendar2" runat="server" Height="20px" ImageUrl="~/Resources/calendar.gif" Width="25px" OnClick="imgCalendar2_Click" />&nbsp&nbsp&nbsp
        <asp:Calendar ID="Calendar2" runat="server" OnSelectionChanged="Calendar2_SelectionChanged" OnVisibleMonthChanged="Calendar2_VisibleMonthChanged" ></asp:Calendar>
        <asp:Button ID="btnSearch" runat="server" Text="Search" width="130px" OnClick="btnSearch_Click" />&nbsp
               <br /> <br />
        &nbsp&nbsp&nbsp<asp:Label ID="lblResultSearch" runat="server" Text=""></asp:Label>&nbsp
           <br />
               &nbsp&nbsp&nbsp<asp:Button ID="btnApproveAll" runat="server" Text="Approve All" Font-Bold="true" Width="100px" OnClick="btnApproveAll_Click" />&nbsp
 <br />
&nbsp;<asp:Repeater id="myRepeater" runat="server">
	<HeaderTemplate>
<table class="table table-bordered">
<tr style="background-color:#fa7b16; color:black; font-weight:bold;height:35px;" align="Left">
                <td>No.</td>
                <td>VenderID.</td>
                <td>SA No.</td>
                <td>Company</td>
                <td>Quantity</td>
                <td>Total Price(Baht)</td>
                <td>Approve</td>
                <td width="10%">Item</td>
                <td width="10%">Ship.</td>
                </tr>           	
   </HeaderTemplate>             
	<ItemTemplate>    
			 <tr style="background-color:#FFFFFF; color:black; height:35px;" align="left">
             <td><asp:Label id="Label5" runat="server" Text='<%# myRepeater.Items.Count + 1 %>' ></asp:Label></td>    
             <td><asp:Label id="Label3" runat="server" Text='<%#  valueTB[cntTB+2].ToString().Trim() %>' ></asp:Label></td>   
             <td><asp:Label id="Label2" runat="server" Text='<%#  valueTB[cntTB+1].ToString().Trim() %>' ></asp:Label></td>     
             <td><asp:Label id="Label4" runat="server" Text='<%#  valueTB[cntTB+3].ToString().TrimEnd() %>' width="300px"></asp:Label></td> 
             <td><asp:Label id="Label11" runat="server" Text='<%#  Text_Qty(valueTB[cntTB+4].ToString().Trim()) %>'></asp:Label></td>          
             <td><asp:Label id="Label12" runat="server" Text='<%#  Text_Qty(valueTB[cntTB+5].ToString().Trim()) %>' Font-Bold="true" width="75px"></asp:Label></td> 
             <td><input id="btnCF_<%# valueTB[cntTB].ToString() %>" type='<%# Type_StatusApprove(Session["event_f"].ToString(),valueTB[cntTB+6].ToString()) %>' value="App." onclick="confirm_click(<%# valueTB[cntTB].ToString().Trim() %>)" class="btn-block" /></td>  
             <td><input id="btnVW_<%# valueTB[cntTB].ToString() %>" type="button" value="Item" onclick="view_click(<%# valueTB[cntTB+1].ToString() %>)" class="btn-block" /></td>               
             <td><input id="btnSH_<%# valueTB[cntTB].ToString() %>" type='<%# Type_StatusShip(Session["event_f"].ToString().Trim()) %>' value="Ship" onclick="ship_click(<%# valueTB[cntTB+1].ToString() %>)" <%# cntTB+=10 %> class="btn-block" /></td>                             
             </tr>
   </ItemTemplate>
       
        <AlternatingItemTemplate>          
			 <tr style="background-color:#20B2AA; color:black; height:35px;" align="left">
             <td><asp:Label id="Label2" runat="server" Text='<%# myRepeater.Items.Count + 1 %>' ></asp:Label></td>
             <td><asp:Label id="Label8" runat="server" Text='<%# valueTB[cntTB+2].ToString().Trim() %>' ></asp:Label></td> 
             <td><asp:Label id="Label7" runat="server" Text='<%# valueTB[cntTB+1].ToString().Trim() %>' ></asp:Label></td>                 
             <td><asp:Label id="Label9" runat="server" Text='<%# valueTB[cntTB+3].ToString().TrimEnd() %>' width="300px"></asp:Label></td> 
             <td><asp:Label id="Label10" runat="server" Text='<%# Text_Qty(valueTB[cntTB+4].ToString().Trim())  %>'></asp:Label></td>    
             <td><asp:Label id="Label13" runat="server" Text='<%#  Text_Qty(valueTB[cntTB+5].ToString().Trim()) %>' Font-Bold="true" width="75px"></asp:Label></td>     
             <td><input id="btnCF_<%# valueTB[cntTB].ToString() %>" type='<%# Type_StatusApprove(Session["event_f"].ToString(),valueTB[cntTB+6].ToString()) %>' value="App." onclick="confirm_click(<%# valueTB[cntTB].ToString().Trim() %>)" class="btn-block" style="color:black"/></td>                                       
             <td><input id="btnVW_<%# valueTB[cntTB].ToString() %>" type="button" value="Item" onclick="view_click(<%# valueTB[cntTB+1].ToString() %>)" class="btn-block" style="color:black"/></td>                             
             <td><input id="btnSH_<%# valueTB[cntTB].ToString() %>" type='<%# Type_StatusShip(Session["event_f"].ToString().Trim()) %>' value="Ship" onclick="ship_click(<%# valueTB[cntTB+1].ToString() %>)" <%# cntTB+=10 %> class="btn-block" style="color:black"/></td>                          
             </tr>		           
	</AlternatingItemTemplate> 

	</asp:Repeater> </table>
               <br />
        
      </div>
    </div>
                
      </div>
            </div>

         </div>

       <script src="css/js/jquery.min.js"></script>
       <script src="css/js/bootstrap.min.js"></script>
       <script type="text/javascript">
           function view_click(id)
           {
               //$.post("plan_upload_forecast.aspx", { id: id });
               window.open("plan_approve_item.aspx?DC="+id+"","_self"); 
               //window.open("plan_upload_work.aspx?DC="+id+"",""); 
           }
           function ship_click(id)
           {
               //$.post("plan_upload_forecast.aspx", { id: id });
               window.open("plan_mgr_label.aspx?DC="+id+"","_self"); 
               //window.open("plan_upload_work.aspx?DC="+id+"",""); 
           }
           function confirm_click(id)
           {
               var confirm_value = document.createElement("INPUT");
               confirm_value.type = "hidden";
               confirm_value.name = "confirm_value";
               if(confirm("Press Button Yes to Confirm?")) 
               {
                   confirm_value.value = "Yes";
                   <%= Session["ShowPageMGConfirm"] = "1" %>
                   //$.post("MGR_Confirm.aspx",{flag:"a",id:id});
                   //window.location.reload();   
                   window.open("MGR_Confirm.aspx?id="+id+"","_self");
               } 
               else 
                   confirm_value.value = "No";  
               //$.post("Vender_Confirm.aspx",{A:"B",B:"B"});
           }
       </script>
    </div>
</asp:Content>
