<%@ Page Language="C#" %>
<%@ Register TagPrefix="aspxform" Namespace="XFormDesigner.Framework.Web.UI" Assembly="XFormDesigner.Framework" %>
<script runat="server">

    // Insert page code here
    //

</script>
<html xmlns:xform="xmlns:xform">
<head id="Head1" runat="server">
    <link href="/Oimec/Styles/css/StyleSheet.css" rel="Stylesheet" type="text/css" />
    <title>BPM Form</title> <style>
    BODY {FONT-SIZE: 12px; FONT-FAMILY: verdana}
    TABLE {border-collapse: collapse; FONT-SIZE: 12px; FONT-FAMILY: verdana}
    P {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-SIZE: 12px; FONT-FAMILY: verdana}
    TD {PADDING-RIGHT: 0px; PADDING-LEFT: 2px; PADDING-BOTTOM: 0px}
    TD.NoPadding {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px}
    INPUT {HEIGHT: 20px}
    INPUT.UL {BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: #33ff33 1px solid}
    TEXTAREA {FONT-SIZE:12px}
    .yz-inp-cnt {display:inline;}
    .yz-textbox{display:inline;}
    </style>
    <script type="text/javascript">
        /*
        * 获得时间差,时间格式为 年-月-日 小时:分钟:秒 或者 年/月/日 小时：分钟：秒
        * 其中，年月日为全格式，例如 ： 2010-10-12 01:00:00
        * 返回精度为：秒，分，小时，天
        */

        function GetDateDiff(startTime, endTime, diffType) {
            //将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式
            startTime = startTime.replace(/\-/g, "/");
            endTime = endTime.replace(/\-/g, "/");

            //将计算间隔类型字符转换为小写
            diffType = diffType.toLowerCase();
            var sTime = new Date(startTime);      //开始时间
            var eTime = new Date(endTime);  //结束时间
            //作为除数的数字
            var divNum = 1;
            switch (diffType) {
                case "second":
                    divNum = 1000;
                    break;
                case "minute":
                    divNum = 1000 * 60;
                    break;
                case "hour":
                    divNum = 1000 * 3600;
                    break;
                case "day":
                    divNum = 1000 * 3600 * 24;
                    break;
                default:
                    break;
            }
            if (parseFloat((eTime.getTime() - sTime.getTime()) / parseInt(divNum)) == 0) {
                return 0;
            }

            else {
                return parseFloat((eTime.getTime() - sTime.getTime()) / parseInt(divNum));
            }
        }

        //给X控件赋值
        function SetValue(id, value) {
            var a = agent.Eles[document.getElementById(id).getAttribute("xform_xele_index")];
            a.setValue(value);
        }

        function getCumulativeOvertime(starTime, account) {
            //alert(starTime);
            var formNo = agent.Eles[document.getElementById("XLabel94").getAttribute("xform_xele_index")].getValue();
            //alert(formNo);
            YZSoft.Ajax.request({
                url: YZSoft.$url('Oimec/ApiServices/HRAPIHandler.ashx'),
                method: 'POST',
                params: {
                    method: 'GetCumulativeOvertime',
                    account: account,
                    date: starTime,
                    formNo: formNo
                },
                success: function (action) {
                    var result = action.result;
                    var value = result.Value;
                    //alert(value);
                    SetValue("XTextBox16", value);
                },
                failure: function (action) {
                    alert(action.result.Message);
                }
            });
        }

        function ActTotalHours(type, hours) {
            var actHours;
            if (type != null && type != '') {
                if (type == "平时加班") {
                    actHours = hours * 1.5;
                }
                if (type == "周末加班") {
                    actHours = hours * 2;
                }
                if (type == "节假日加班") {
                    actHours = hours * 3;
                }
            }
            else
                actHours = hours;

            return actHours;
        }

</script>
</head>

<body>
    <form id="Form1" runat="server">
        <table width="1200" align="center" class="head" border="0" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td class="logo">
                    </td>
                    <td class="biaoti">
                        <asp:Label id="XLabel2" runat="server" value valuetodisplaytext text="加班申请单"></asp:Label></td>
                    <td class="formno">
                        <asp:Label id="XLabel93" runat="server" value valuetodisplaytext text="表单号："></asp:Label>
                        <aspxform:XLabel id="XLabel94" runat="server" text="--系统自动生成--" BackColor="#8AB3DF" XDataBind="DF_HR_WORKOVERTIMEAPP.FormNo" ValueToDisplayText Value></aspxform:XLabel>
                    </td>
                </tr>
            </tbody>
        </table>
        <br />
        <table width="1200" align="center" class="table">
            <tbody>
                <tr>
                    <td class="title1" colspan="4">
                        <asp:Label id="XLabel1" runat="server" value valuetodisplaytext text="个人信息  "></asp:Label></td>
                </tr>
                <tr>
                    <td class="td" style="WIDTH: 10%">
                        <asp:Label id="XLabel3" runat="server" value valuetodisplaytext text="姓名"></asp:Label>
                        <aspxform:XTextBox id="XTextBox7" runat="server" ValueToDisplayText="TableName:DF_HR_EMPLOYEEINFORMATION_INFO;FilterColumn:AttendanceKakaNO;DisplayColumn:AttendanceKakaNO" DataMap="Shift->var1" Express="DF_HR_WORKOVERTIMEAPP.AppName" HiddenInput="True" BorderColor="#DCDCDC" BorderWidth="1" width="60%" CssClass="text" backColor="#e6f1f8" ReadOnly="True"></aspxform:XTextBox>
                    </td>
                    <td class="td1" style="WIDTH: 35%">
                        <aspxform:XTextBox id="XTextBox2" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.AppName" ValueToDisplayText="TableName:V_DF_HR_BasicInfo;FilterColumn:AttendanceKakaNO;DisplayColumn:Name" DataMap="BUID->varbu;Department->DF_HR_WORKOVERTIMEAPP.AppDepartment;PostName->DF_HR_WORKOVERTIMEAPP.AppJobs" BorderColor="#DCDCDC" BorderWidth="1" width="60%" CssClass="text" backColor="#e6f1f8" ReadOnly="True"></aspxform:XTextBox>
                    </td>
                    <td class="td" style="WIDTH: 10%">
                        <asp:Label id="XLabel5" runat="server" value valuetodisplaytext text="部门"></asp:Label>
                        <aspxform:XTextBox id="XTextBox13" runat="server" ValueToDisplayText="TableName:V_DF_HR_BasicInfo;FilterColumn:AttendanceKakaNO;DisplayColumn:AttendanceKakaNO" Value DataMap="PostName->DF_HR_WORKOVERTIMEAPP.AppJobs;Department->DF_HR_WORKOVERTIMEAPP.AppDepartment;BUID->DF_HR_WORKOVERTIMEAPP.AppBU" Express="DF_HR_WORKOVERTIMEAPP.AppName" HiddenInput="True" BorderColor="Gainsboro" BorderWidth="1px" Max="0" Min="0" Width="30px"></aspxform:XTextBox>
                    </td>
                    <td class="td1" style="WIDTH: 35%">
                        <aspxform:XTextBox id="XTextBox5" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.AppDepartment" BorderColor="#DCDCDC" BorderWidth="1" width="70%" CssClass="text" backColor="#e6f1f8" ReadOnly="True"></aspxform:XTextBox>
                    </td>
                </tr>
                <tr>
                    <td class="td" style="WIDTH: 10%">
                        <asp:Label id="XLabel15" runat="server" value valuetodisplaytext text="BU"></asp:Label>
                        <aspxform:XTextBox id="XTextBox14" runat="server" XDataBind="varbu" ValueToDisplayText Value HiddenInput="True" BorderColor="Gainsboro" BorderWidth="1px" Max="0" Min="0" Width="30px"></aspxform:XTextBox>
                    </td>
                    <td class="td1" style="WIDTH: 35%">
                        <aspxform:XTextBox id="XTextBox15" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.AppBU" ValueToDisplayText="TableName:DF_HR_OrgBU;FilterColumn:BUID;DisplayColumn:BUName" Express="varbu" BorderColor="#DCDCDC" BorderWidth="1" width="60%" CssClass="text" backColor="#e6f1f8" ReadOnly="True"></aspxform:XTextBox>
                    </td>
                   <td class="td" style="WIDTH: 10%">
                        <asp:Label id="XLabel6" runat="server" value valuetodisplaytext text="岗位"></asp:Label></td>
                    <td class="td1" style="WIDTH: 35%">
                        <aspxform:XTextBox id="XTextBox6" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.AppJobs" BorderColor="#DCDCDC" BorderWidth="1" width="60%" CssClass="text" backColor="#e6f1f8" ReadOnly="True"></aspxform:XTextBox>
                    </td>
                </tr>
              
            </tbody>
        </table>
        <br />
        <table width="1200" class="table" border="0" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td class="title1" colspan="6">
                        <asp:Label id="XLabel7" runat="server" value valuetodisplaytext text="加班明细"></asp:Label></td>
                </tr>
                <tr>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; WIDTH: 10%; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" bgcolor="#d4e4f4">
                        <asp:Label id="XLabel8" runat="server" value valuetodisplaytext text="加班事由" font-names="微软雅黑" font-size="10pt"></asp:Label></td>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; WIDTH: 80%; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" colspan="5">
                        <div align="left">
                            <aspxform:XTextBox id="XTextBox1" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.WorkOvertimeQeason" ValueToDisplayText Value HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" width="100%" Max="0" Min="0" TextMode="MultiLine" Rows="6"></aspxform:XTextBox>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" bgcolor="#d4e4f4">
                        <asp:Label id="XLabel10" runat="server" value valuetodisplaytext text="班次" font-names="微软雅黑" font-size="10pt"></asp:Label></td>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" colspan="5">
                        <aspxform:XTextBox id="XTextBox8" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.ShiftType" ValueToDisplayText Value HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" ReadOnly="True" Max="0" Min="0" Width="36px" TextAlign="Center"></aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox4" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.ShiftStartDate" ValueToDisplayText Value HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" ReadOnly="True" Max="0" Min="0" Width="96px"></aspxform:XTextBox>
                        <asp:Label id="XLabel11" runat="server" value valuetodisplaytext text="到"></asp:Label>
                        <aspxform:XTextBox id="XTextBox12" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.ShiftEndDate" ValueToDisplayText Value HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" ReadOnly="True" Max="0" Min="0" Width="96px"></aspxform:XTextBox>
                    </td>
                </tr>
                <tr>
                    <td height="23" style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" bgcolor="#d4e4f4">
                        <asp:Label id="XLabel9" runat="server" value valuetodisplaytext text="加班时间" font-names="微软雅黑" font-size="10pt"></asp:Label></td>
                    <td width="297" style="BORDER-TOP: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid">
                        <aspxform:XDateTimePicker id="XDateTimePicker1" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.WorkOvertimeSDate" BorderColor="Gainsboro" BorderWidth="1px" Width="295px" Type="TimeMinutes30"></aspxform:XDateTimePicker>
                    </td>
                    <td width="35">
                        <div align="center"><asp:Label id="XLabel13" runat="server" value valuetodisplaytext text="到"></asp:Label>
                        </div>
                    </td>
                    <td width="301">
                        <aspxform:XDateTimePicker id="XDateTimePicker3" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.WorkOvertimeEDate" BorderColor="Gainsboro" BorderWidth="1px" Width="295px" Type="TimeMinutes30"></aspxform:XDateTimePicker>
                    </td>
                    <td width="16">
                        <div align="right"><asp:Label id="XLabel14" runat="server" value valuetodisplaytext text="共"></asp:Label>
                        </div>
                    </td>
                    <td width="453" style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid">
                        <aspxform:XTextBox id="XTextBox9" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.TotalHours" ValueToDisplayText Value Express='javascript("GetDateDiff",DF_HR_WORKOVERTIMEAPP.WorkOvertimeSDate,DF_HR_WORKOVERTIMEAPP.WorkOvertimeEDate,vhour)' HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" ReadOnly="True" Max="0" Min="0" Width="54px"></aspxform:XTextBox>
                        小时<aspxform:XTextBox id="XTextBox10" runat="server" XDataBind="vhour" ValueToDisplayText Value HiddenInput="True" BorderColor="Gainsboro" BorderWidth="1px" Max="0" Min="0" Width="32px">hour</aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox19" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.ActTotalHours" Express="javascript('ActTotalHours',DF_HR_WORKOVERTIMEAPP.WorkOvertimeType,DF_HR_WORKOVERTIMEAPP.TotalHours)" HiddenInput="True" BorderColor="#DCDCDC" BorderWidth="1" ReadOnly="True" DisableExpress="1"></aspxform:XTextBox>
                    </td>
                </tr>
                <tr>
                    <td height="22" style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" bgcolor="#d4e4f4">
                        <asp:Label id="XLabel12" runat="server" value valuetodisplaytext text="加班类型" font-names="微软雅黑" font-size="10pt"></asp:Label></td>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" colspan="5">
                        <aspxform:XDropDownList id="XDropDownList1" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.WorkOvertimeType" Width="144px" XDataSource PromptText="-请选择-" DisableExpress="Global.StepName!='考勤岗审批'">
                            <asp:ListItem>平时加班</asp:ListItem>
                            <asp:ListItem>周末加班</asp:ListItem>
                            <asp:ListItem>节假日加班</asp:ListItem>
                        </aspxform:XDropDownList>
                        <aspxform:XDropDownList id="XDropDownList2" runat="server" XDataBind="var1" DataMap="Name->DF_HR_WORKOVERTIMEAPP.ShiftType;StartDate->DF_HR_WORKOVERTIMEAPP.ShiftStartDate;EndDate->DF_HR_WORKOVERTIMEAPP.ShiftEndDate" XDataSource="TableName:V_DF_HR_SHIFT;BufferType:RuntimeUpdate" HiddenExpress="1" ValueColumn="ItemID" DisplayColumn="ItemID">
                            <asp:ListItem>未绑定</asp:ListItem>
                        </aspxform:XDropDownList>
                        <aspxform:XTextBox id="XTextBox11" runat="server" Express="DF_HR_WORKOVERTIMEAPP.WorkOvertimeSDate" HiddenInput="True" BorderColor="#DCDCDC" BorderWidth="1"></aspxform:XTextBox>
                    </td>
                </tr>
                <tr>
                    <td height="22" style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" bgcolor="#d4e4f4">
                        <asp:Label id="Label1" runat="server" value valuetodisplaytext text="当月已申请加班小时数" font-names="微软雅黑" font-size="10pt"></asp:Label></td>
                    <td style="BORDER-TOP: #b2bccd 1px solid; BORDER-RIGHT: #b2bccd 1px solid; BORDER-BOTTOM: #b2bccd 1px solid; BORDER-LEFT: #b2bccd 1px solid" colspan="5">
                        <aspxform:XTextBox id="XTextBox16" runat="server" XDataBind="DF_HR_WORKOVERTIMEAPP.CumulativeOvertime" ValueToDisplayText Value Express='javascript("getCumulativeOvertime",DF_HR_WORKOVERTIMEAPP.WorkOvertimeSDate,DF_HR_WORKOVERTIMEAPP.AppName)' HiddenInput="False" BorderColor="Gainsboro" BorderWidth="1px" backColor="#e6f1f8" ReadOnly="True" Max="0" Min="0" DisableBehavior="ReadOnly" Width="54px" DisableExpress="1"></aspxform:XTextBox>
                        小时 
                        <aspxform:XTextBox id="XTextBox17" runat="server" XDataBind="varTotal" Express="DF_HR_WORKOVERTIMEAPP.CumulativeOvertime+DF_HR_WORKOVERTIMEAPP.TotalHours" HiddenInput="true" BorderColor="#DCDCDC" BorderWidth="1" Width="50px"></aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox18" runat="server" HiddenInput="true" BorderColor="#DCDCDC" BorderWidth="1" Width="50px">36</aspxform:XTextBox>
                    </td>
                </tr>
            </tbody>
        </table>
        <br />
        <table width="1200" align="center" border="0" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td width="1200">
                        <aspxform:XLabel id="XLabel16" runat="server" text="说明：按公司规定，每月申请加班时长累积不能超过 36小时，超出的小时数请申请调休（加班调休申请）。在加班调休申请里，请假类型选：公假 — 加班调休" ForeColor="Blue"></aspxform:XLabel>
                    </td>
                </tr>
            </tbody>
        </table>
        <br />
        <p align="center">
            <aspxform:XSignTrace id="XSignTrace1" runat="server" BorderColor="#dcdcdc" BorderWidth="1" Width="1200px"></aspxform:XSignTrace>
            <aspxform:XRangeValidator id="XRangeValidator1" runat="server" Type="Double" MinValueExpress="0.5" ControlToValidate="XTextBox9" ErrorMessage="加班小时不能小于0"></aspxform:XRangeValidator>
            <aspxform:XRequiredFieldValidator id="XRequiredFieldValidator1" runat="server" ControlToValidate="XTextBox1" ErrorMessage="请填写加班事由"></aspxform:XRequiredFieldValidator>
            &nbsp;<aspxform:XRequiredFieldValidator id="XRequiredFieldValidator2" runat="server" ControlToValidate="XDateTimePicker1" ErrorMessage="请填写加班时间"></aspxform:XRequiredFieldValidator>
            &nbsp;<aspxform:XRequiredFieldValidator id="XRequiredFieldValidator4" runat="server" ControlToValidate="XDateTimePicker3" ErrorMessage="请填写加班时间"></aspxform:XRequiredFieldValidator>
            &nbsp;&nbsp; 
            <aspxform:XCompareValidator id="XCompareValidator1" runat="server" Type="Double" ControlToValidate="XTextBox17" ErrorMessage="累计申请加班小时已超过36小时，超出的小时数请申请调休" Operator="LessThanEqual" Display="None" ControlToCompare="XTextBox18">累计加班时间验证</aspxform:XCompareValidator>
            <aspxform:XRequiredFieldValidator id="XRequiredFieldValidator3" runat="server" ControlToValidate="XDropDownList1" ErrorMessage="请填写加班类型" ValidationGroup="kaoqinggang"></aspxform:XRequiredFieldValidator>
        </p>
    </form>
</body>
</html>
