<%@ Page Title="" Language="C#" MasterPageFile="~/BackStage/SiteMaster.Master" AutoEventWireup="true" CodeBehind="Frm_UserAttendance.aspx.cs" Inherits="AndroidSevice.Web.WLTGL.Frm_UserAttendance" %>
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=8cb299725cff45869425b1bbdae988aa"></script>
    <script type="text/javascript">
        function ShowDataHelp(_url, _title, _handler) {
            layer.open({
                type: 2,
                area: ['50%', '85%'],
                fix: false, //不固定
                maxmin: true,
                content: _url,
                end: function () {
                    location.reload();
                }
            });
        }
        function ShowDateHelp(_url, _title, _handler) {
            layer.open({
                type: 2,
                area: ['350px', '250px'],
                fix: false, //不固定
                maxmin: true,
                content: _url,
                end: function () {
                    location.reload();
                }
            });
        }
        function sAlert(info) {
            var message = info;
            layer.alert(message, 8); //风格一，layer弹出层特效
        }

        function SelectAll() {
            var checkboxs = document.getElementsByName("Btypecheck");
            for (var i = 0; i < checkboxs.length; i++) {
                var e = checkboxs[i];
                e.checked = !e.checked;
            }
        }
        function sAlertok(info) {
            layer.alert(info, { closeBtn: 0
            }, function () {
                parent.location.reload(); //刷新父页面
            });
        }
        function sAlertOut(info) {
            layer.alert(info, { closeBtn: 0
            }, function () {
                window.location.href = '../../default.aspx'; //刷新父页面
            });
        }



        // 百度地图API功能
        var map = new BMap.Map("allmap");
        var point; //;
        map.centerAndZoom(point, 12);
        // 创建地址解析器实例
        // 将地址解析结果显示在地图上,并调整地图视野
        function Geocode(result, _cbradios, _strdatename, _enddatename, _date1, _date2, _date3, _date4, _radios) {
            // alert(result);
            var address = result;
            var index = 0;
            var pointstring = "123";
            var myGeo = new BMap.Geocoder();
            var results = result.split(',');
            for (var i = 0; i < results.length; i++) {
                myGeo.getPoint(results[i], function (point) {
                    if (point) {
                        //alert(point.lng + ":" + point.lat);
                        pointstring = point.lng + ":" + point.lat;
                        postdata(pointstring, _cbradios, _strdatename, _enddatename, _date1, _date2, _date3, _date4, _radios, address);
                    }
                    else {
                        // alert(results[index] + ":地址无法解析！");
                        // window.external.ShowMessage(":" + ";" + btpeids[index++]);
                        // pointstring = "::" + btpeids[index++];
                        // postdata(pointstring);
                        index;
                    }
                    index++;
                }, "");
            }
            sAlert("保存成功");
        }

        function postdata(pointstring, _cbradios, _strdatename, _enddatename, _date1, _date2, _date3, _date4, _radios, results) {
            //$.post("PtypeShopingListPage.aspx",
            //{
            //    WeiXinID: wxid,
            //    ptypeid: ptypeid,
            //    ptypenum: $("#text_box" + textvalue).val(),
            //    ptypejftotal: $("#total" + textvalue).text()
            //})

            //接收表单的URL地址  
            var url = "Frm_UserAttendance.aspx";
            //需要POST的值，把每个变量都通过&来联接  //_cbradios, _strdatename, _enddatename, _date1, _date2, _date3, _date4, _address, _error, _radios
            //  _cbradios = Request.Params["cbradios"];
            //_strdatename = Request["strdatename"];
           // _enddatename = Request["enddatename"];
          //  _date1 = Request.Params["date1"];
          //  _date2 = Request.Params["date2"];//
          //  _date3 = Request.Params["date3"];
          //  _date4 = Request.Params["date4"];
          //  _address = Request.Params["address"];
          //  _error = Request.Params["error"];
            //   _radios = Request.Params["radios"];
            var postStr = "pointstring=" + pointstring + "&cbradios=" + _cbradios + "&strdatename=" + _strdatename + "&enddatename=" + _enddatename + "&date1=" + _date1 + "&date2=" + _date2 + "&date3=" + _date3 + "&date4=" + _date4 + "&radios=" + _radios + "&address=" + results;
            //实例化Ajax
            //var ajax = InitAjax();  

            var ajax = false;
            //开始初始化XMLHttpRequest对象  
            if (window.XMLHttpRequest) { //Mozilla 浏览器  
                ajax = new XMLHttpRequest();
                if (ajax.overrideMimeType) {//设置MiME类别  
                    ajax.overrideMimeType("text/xml");
                }
            }
            else if (window.ActiveXObject) { // IE浏览器  
                try {
                    ajax = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        ajax = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) { }
                }
            }
            if (!ajax) { // 异常，创建对象实例失败  
                window.alert("不能创建XMLHttpRequest对象实例.");
                return false;
            }

            //通过Post方式打开连接  
            ajax.open("POST", url, false);

            //定义传输的文件HTTP头信息  
            ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            //发送POST数据  
            ajax.send(postStr);

            //获取执行状态  
            //ajax.onreadystatechange = function () {
            //    //如果执行状态成功，那么就把返回信息写到指定的层里  
            //    if (ajax.readyState == 4 && ajax.status == 200) {
            //        msg.innerHTML = ajax.responseText;
            //    }
            //}
        }


    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="content-header">
    <!--可做顶部导航-->
			</div>
	<div id="breadcrumb">
		<a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>物联通管理</a>
		<a href="#" class="current">考勤设置</a>

	</div>
    <div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon">
							<i class="icon-th-list"></i>
						</span>
						<h5>考勤设置</h5>
                         <div class="buttons">
                         <button type="submit" name="sub" value="sub" class="btn"  style=" color:White; background:#00B7EE" ><i class="icon-hdd"></i>保存</button>
                         </div>
					</div>
					<div class="widget-content ">
                        <table class="table table-bordered table-striped table-hover">
							<tbody>
                                <tr>
                                    <td>考勤周期：
                                        <input type="checkbox" <% if(_cbradios.Contains("周一")){%> checked<%} %> value="周一" name="cbradios" />周一
								        <input type="checkbox" <% if(_cbradios.Contains("周二")){%> checked<%} %> value="周二" name="cbradios" />周二
								        <input type="checkbox" <% if(_cbradios.Contains("周三")){%> checked<%} %> value="周三" name="cbradios" />周三
                                        <input type="checkbox" <% if(_cbradios.Contains("周四")){%> checked<%} %> value="周四" name="cbradios" />周四
								        <input type="checkbox" <% if(_cbradios.Contains("周五")){%> checked<%} %> value="周五" name="cbradios" />周五
								        <input type="checkbox" <% if(_cbradios.Contains("周六")){%> checked<%} %> value="周六" name="cbradios" />周六
                                        <input type="checkbox" <% if(_cbradios.Contains("周日")){%> checked<%} %> value="周日" name="cbradios" />周日
                                    </td>
                                    <td>
                                        上班时间：
                                        <input type="text" style="width:80px" onFocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'HH:mm'})"  name="strdatename" id="strdatename" value="<%=_strdatename %>"/>
                                        下班时间：
                                        
                                            <input type="text" style="width:80px" onFocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'HH:mm'})"  name="enddatename" id="enddatename" value="<%=_enddatename %>"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        异常定义：
                                        迟到<input type="text" name="date1"  onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  style="width:35px" id="date1" value="<%=_date1 %>"/>分钟以上视为旷工半天 &nbsp;&nbsp;&nbsp;&nbsp;
                                        迟到<input type="text" name="date2"  onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  style="width:35px" id="date2" value="<%=_date2 %>"/>分钟以上视为旷工一天  &nbsp;&nbsp;&nbsp;&nbsp;
                                        
                                        早退<input type="text" name="date3"  onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  style="width:35px" id="date3" value="<%=_date3 %>"/>分钟以上视为旷工半天 &nbsp;&nbsp;&nbsp;&nbsp;
                                        早退<input type="text" name="date4"  onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  style="width:35px" id="date4" value="<%=_date4 %>"/>分钟以上视为旷工一天
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        公司地址：<input type="text" name="address" style="width:350px" id="address" value="<%=_address %>"/>
                                         &nbsp;&nbsp;&nbsp;
                                         <button  type="button"  class="btn" onclick="ShowDataHelp('Frm_ShowAttendanceMap.aspx?','','')">查看地图</button>
                                        &nbsp; &nbsp;&nbsp; 
                                        考勤距离误差<input type="text" style="width:30px" name="error" id="error" value="<%=_error %>" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();" />  米
                                    </td>
                                    <td>
                                        是否拍照： <input type="radio" value="是" <%=_radios=="是"?"checked":"" %> name="radios" />是
											<input type="radio" value="否" <%=_radios=="否"?"checked":"" %> name="radios" />否
                                    </td>
                                </tr>
							</tbody>
						</table>
                        
                    </div>
                    
                    <div class="row-fluid">
                         <div class="span6">
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-arrow-right"></i>
								</span>
								<h5>考勤人员</h5>
                                <div class="buttons">
									<button type="button" onclick=ShowDataHelp('Frm_UserListEdit.aspx?addsub=listuseradd','','') class="btn btn-mini" ><i class="icon-plus-sign"></i>选择考勤人员</button>
								</div>
							</div>
							<div class="widget-content nopadding">
								<table id="wew" class="table table-bordered table-striped table-hover">
                                        <thead>
								            <tr>
									            <th style=" width:30px">序号</th>
									            <th>姓名</th>
									            <th>删除</th>
								            </tr>
							            </thead>
                                        <tbody>
                                        <%
                                            if (dtKQRY != null && dtKQRY.Rows.Count != 0)
                                            {
                                                for (int i = 0; i < dtKQRY.Rows.Count; i++)
                                                {
                                            %>
                                        <tr>
                                            <td style=" width:30px"><%=i+1 %></td>
									        <td><%=dtKQRY.Rows[i]["Kaoqinname"].ToString()%></td>
                                            <td style="text-align:center">
                                                <a >
                                                <button type="button" onclick="javaScript:if(confirm('您确定要删除吗？')) window.location.href='Frm_UserAttendance.aspx?del=del&loginid=<%=dtKQRY.Rows[i]["loginid"].ToString() %>&num=<%=dtKQRY.Rows[i]["num"].ToString() %>'" class="btn"><i class="icon-trash"></i>删除</button></a>
                                            </td>
							            </tr>
                                            <%
                                                }
                                            }
                                                %>
                                        </tbody>
					            </table>
							
                            <div class="pager">
                                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="尾页" PrevPageText="上一页" NextPageText="下一页" 
                                onpagechanging="AspNetPager1_PageChanging"
                                PageSize="20" AlwaysShow="True" />
                            </div></div>
						</div>
                       
                        </div>
                        <div class="span6">
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-arrow-right"></i>
								</span>
								<h5>节假日</h5>
                                 <div class="buttons">
									<button type="button" onclick=ShowDateHelp('Frm_optDate.aspx?add1=add1','','') class="btn btn-mini" ><i class="icon-plus-sign"></i>选择节假日</button>
								</div>
							</div>
							<div class="widget-content nopadding">
                                <table id="Table1" class="table table-bordered table-striped table-hover">
                                    <thead>
								        <tr>
									        <th style=" width:30px">序号</th>
									        <th>日期</th>
									        <th>删除</th>
								        </tr>
							        </thead>
                                    <tbody>
                                    <%
                                        if (dtJJR != null && dtJJR.Rows.Count != 0)
                                        {
                                            for (int i = 0; i < dtJJR.Rows.Count; i++)
                                            {
                                        %>
                                    <tr>
                                        <td style=" width:30px"><%=i+1 %></td>
									    <td><%=dtJJR.Rows[i]["KaoqinDate"].ToString()%></td>
                                        <td style="text-align:center">
                                            <a>
                                            <button onclick="javaScript:if(confirm('您确定要删除吗？')) window.location.href='Frm_UserAttendance.aspx?del1=del&num1=<%=dtJJR.Rows[i]["num"].ToString() %>'" type="button" class="btn"><i class="icon-trash"></i>删除</button></a>
                                        </td>
							        </tr>
                                        <%
                                            }
                                        }
                                            %>
                                    </tbody>
					        </table>
                            </div>
						</div>
                        <div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-arrow-right"></i>
								</span>
								<h5>特殊工作日</h5>
                                 <div class="buttons">
									<button type="button" onclick=ShowDateHelp('Frm_optDate.aspx?add2=add2','','') class="btn btn-mini" ><i class="icon-plus-sign"></i>选择特殊工作日</button>
								</div>
							</div>
							<div class="widget-content nopadding">
                                <table id="Table2" class="table table-bordered table-striped table-hover">
                                        <thead>
								            <tr>
									            <th style=" width:30px">序号</th>
									            <th>日期</th>
									            <th>删除</th>
								            </tr>
							            </thead>
                                        <tbody>
                                        <%
                                            if (dtTSGZR != null && dtTSGZR.Rows.Count != 0)
                                            {
                                                for (int i = 0; i < dtTSGZR.Rows.Count; i++)
                                                {
                                            %>
                                        <tr>
                                            <td style=" width:30px"><%=i+1 %></td>
									        <td><%=dtTSGZR.Rows[i]["KaoqinDate"].ToString()%></td>
                                            <td style="text-align:center">
                                                <a >
                                                <button type="button" onclick="javaScript:if(confirm('您确定要删除吗？')) window.location.href='Frm_UserAttendance.aspx?del2=del&num2=<%=dtTSGZR.Rows[i]["num"].ToString() %>'" class="btn"><i class="icon-trash"></i>删除</button></a>
                                            </td>
							            </tr>
                                            <%
                                                }
                                            }
                                                %>
                                        </tbody>
					            </table>
                            </div>
						</div>
                        </div>
                    </div>
				</div>
			</div>
		</div>
	</div>
</asp:Content>
