<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>EHONGMD | รายงาน LINE ID</title>
  <?php
  include '_plugin.php';
  include '_connect.php';
  ?>
  <script src="bower_components/jquery/dist/jquery.min.js"></script>
  <script language="JavaScript">
	function ClickCheckAll(vol)
	{

		var i=1;
		for(i=1;i<=document.frmMain.hdnCount.value;i++)
		{
			if(vol.checked == true)
			{
				eval("document.frmMain.chkDel"+i+".checked=true");
			}
			else
			{
				eval("document.frmMain.chkDel"+i+".checked=false");
			}
		}
	}

	function onDelete()
	{
		if(confirm('ต้องการออกใบส่งเงินหรือไม่?')==true)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
  </script>
</head>
<body class="hold-transition skin-red sidebar-mini">

  <style media="screen">
  div.ex1 {
    /* height: 550px;
    overflow-y: scroll; */
  }
  th, td, tbody { white-space: nowrap; }
  </style>

<div class="wrapper">
<?php
include '_header.php';
include '_menu.php';
?>
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
      <!-- ค้นหา -->
      <?php
      include '_connect.php';
      // include 'line_search_1.php'

      ?>
      <?php
      $DMY1 = $_POST["DMY1"]; // วันที่
      $DMY2 = $_POST["DMY2"]; // ถึงวันที่
      $BR_IDx = $_POST["BR_ID"]; // สาขา
      $zone_codex = $_POST["zone_code"]; // เขต
      $zstaff_idx = $_POST["zstaff_id"]; // ภาค
      $zstaff_id = "";
      $zstaff_id3 = "";

      // $pr_codex = $_POST["pr_code"]; // จังหวัด
      // $infofromx = $_POST["infofrom"]; // ช่องทางการรับรู้

      if ($_POST["BR_ID"] != '') {
        // $BR_ID = "AND a.BR_ID = '$BR_IDx'";
        // $BR_IDXSD = "WHERE b.BR_ID = '$BR_IDx'";
        $BR_ID = '';
        $BR_IDXSD = "";
      }
      else {
        $BR_ID = '';
        $BR_IDXSD = '';
      }

      // echo $BR_ID;

      $_month_name = array("01"=>"มกราคม",  "02"=>"กุมภาพันธ์",  "03"=>"มีนาคม",
         "04"=>"เมษายน",  "05"=>"พฤษภาคม",  "06"=>"มิถุนายน",
         "07"=>"กรกฎาคม",  "08"=>"สิงหาคม",  "09"=>"กันยายน",
         "10"=>"ตุลาคม", "11"=>"พฤศจิกายน",  "12"=>"ธันวาคม");
      $m = date('m');

      $calcdate1 = substr($DMY1,0,4); $calcdate2 = substr($DMY1,5,2); $calcdate3 = substr($DMY1,8,2);
      $calcdate = $calcdate3."/".$calcdate2."/".$calcdate1;

      $calcdate12 = substr($DMY2,0,4); $calcdate22 = substr($DMY2,5,2); $calcdate32 = substr($DMY2,8,2);
      $calcdate25 = $calcdate32."/".$calcdate22."/".$calcdate12;

      $MY = $calcdate1."_".$calcdate2;
      // if ($_POST["BR_ID"] != '') { $BR_ID = "AND a.BR_ID = $BR_IDx"; }
      // else { $BR_ID = ''; }
      //
      if ($_POST["zone_code"] != '') { $zone_code = "AND a.SZONE_CODE = '$zone_codex'"; $zone_code1 = "WHERE c.SZONE_CODE = '$zone_codex'";}
      else { $zone_code = ''; $zone_code1 = '';}
      //
      // if ($_POST["pr_code"] != '') { $pr_code = "AND b.PR_CODE = $pr_codex"; }
      // else { $pr_code = ''; }
      //
      // if ($_POST["infofrom"] != '') { $infofrom = "AND a.infofrom = '$infofromx'"; }
      // else { $infofrom = ''; }
      // echo "$infofrom";
      ?>
      <script src="bower_components/jquery/dist/jquery.min.js"></script>
      <div class="col-md-12">
        <div class="box box-warning">
          <div class="box-header with-border">
            <h3 class="box-title">ค้นหารายงาน LINE ID</h3>
          </div>
          <?php
            $D = date('d');
            $Y = date('Y')+543;
            $Eday = date('d');
            $year = date('Y');
            $month2 = date('m');
            $Eday1 = date('Y-m-t',strtotime($year."-".$month2."-".'01'));
            $Eday2 = substr($Eday1,8,2);
            $day1 = $year."-".$month2."-01";
            $day2 = $year."-".$month2."-".$Eday;
          ?>
          <form role="form" action="line_x.php" method="POST" enctype="multipart/form-data" >
            <div class="box-body">
              <div class="row">
                <div class="col-xs-2">
                  <p>วันที่</p>
                  <input type="date" class="form-control" placeholder="" name="DMY1" value="<?php echo $DMY1; ?>">
                </div>
                <div class="col-xs-2">
                  <p>ถึงวันที่</p>
                  <input type="date" class="form-control" placeholder="" name="DMY2" value="<?php echo $DMY2; ?>">
                </div>
                <div class="col-xs-2">
                  <p>สาขา</p>
                  <select class="form-control" name="BR_ID" >
                    <?php
                    $sql = "SELECT * FROM EHONGDB.dbo.BRANCH WHERE BR_NAME NOT IN ('รวมทุกสาขา') AND BR_ID = '$BR_IDx' ORDER BY BR_ID";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['BR_ID'];?>"><?php echo $fetch['BR_ID']." : ".$fetch['BR_NAME'];?></option>
                    <?php } ?>
                    <option value="">-- ดูทั้งหมด --</option>
                    <?php
                    $sql = "SELECT * FROM EHONGDB.dbo.BRANCH WHERE BR_NAME NOT IN ('รวมทุกสาขา') ORDER BY BR_ID";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['BR_ID'];?>"><?php echo $fetch['BR_ID']." : ".$fetch['BR_NAME'];?></option>
                    <?php } ?>
                  </select>
                </div>
                <div class="col-xs-2">
                  <p>เขต</p>
                  <select class="form-control" name="zone_code" placeholder="ผจก.เขต">
                    <?php
                    $sql = "SELECT * FROM EHONGDB.dbo.branch_salezone WHERE szone_code = '$zone_codex' ORDER BY szone_code";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['szone_code'];?>"><?php echo $fetch['szone_code']." : ".$fetch['staff_nick'];?></option>
                    <?php } ?>
                    <option value="">-- รวมทุกเขต --</option>
                    <?php
                    $sql = "SELECT * FROM EHONGDB.dbo.branch_salezone ORDER BY szone_code";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['szone_code'];?>"><?php echo $fetch['szone_code']." : ".$fetch['staff_nick'];?></option>
                    <?php } ?>
                  </select>
                </div>
                <div class="col-xs-2">
                  <p>ภาค</p>
                  <select class="form-control" name="zstaff_id" placeholder="ผจก.เขต">
                    <?php
                    $sql = "SELECT DISTINCT zstaff_id,zstaff_name FROM EHONGDB.dbo.branch_salezone WHERE zstaff_id = '$zstaff_idx' ORDER BY zstaff_id,zstaff_name";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['zstaff_id'];?>"><?php echo $fetch['zstaff_id']." : ".$fetch['zstaff_name'];?></option>
                    <?php } ?>
                    <option value="">-- รวมทุกภาค --</option>
                    <?php
                    $sql = "SELECT DISTINCT zstaff_id,zstaff_name FROM EHONGDB.dbo.branch_salezone ORDER BY zstaff_id,zstaff_name";
                    $select=$conn->prepare($sql);
                    $select->execute();
                    while($fetch=$select->fetch()) {
                    ?>
                    <option value="<?php echo $fetch['zstaff_id'];?>"><?php echo $fetch['zstaff_id']." : ".$fetch['zstaff_name'];?></option>
                    <?php } ?>
                  </select>
                </div>
              </div>
            </div>
            <div class="box-footer">
              <input type="submit" class="btn btn-warning" name="search" value="ดูรายงานสาขา">
              <input type="submit" class="btn btn-warning" name="search" value="ดูรายงานเขต">
              <input type="submit" class="btn btn-warning" name="search" value="ดูรายงานภาค">
            </div>
          </form>

        </div>
      </div>

      <!-- ตาราง -->
      <div class="col-md-12">
        <div class="box box-success">
          <div class="box-header">
            <h3 class="box-title"><p class="text-success">รายงาน LINE ID กลุ่มลูกค้า "เขต"</p></h3>
            <p class="text-warning">วันที่ <?php echo $calcdate; ?> ถึงวันที่ <?php echo $calcdate25; ?></p>
          </div>
          <div class="box-body">
            <div class="form-group">
              <table id="tabla2xx" class="table table-striped table-bordered" style="width:100%">
                <thead>
                  <tr>
                    <th rowspan="2" colspan="" style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>No.</b></th>
                    <th rowspan="2" colspan="" style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>เขต</b></th>
                    <th colspan="6"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>รวมทั้งหมด</b></th>
                    <th colspan="4"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>จักรยานยนต์</b></th>
                    <th colspan="4"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>เครื่องใช้ไฟฟ้า</b></th>
                    <th colspan="4"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>จัดไฟแนนซ์</b></th>
                    <th colspan="4"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>ฮีโร่</b></th>
                    <th colspan="4"  style="background-color:black; color:#fff; text-align:center;" width="" rowspan="" ><b>จำนำ</b></th>
                  </tr>
                  <tr>
                    <th rowspan="" colspan="" style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th rowspan="" colspan="" style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>

                    <th rowspan="" colspan="" style="background-color:red; color:#fff; text-align:center;" width="" rowspan="" ><b>ลูกค้าเก่า</b></th>
                    <th rowspan="" colspan="" style="background-color:blue; color:#fff; text-align:center;" width="" rowspan="" ><b>ลูกค้าใหม่</b></th>

                    <th rowspan="" colspan="" style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th rowspan="" colspan="" style="background-color:LightSteelBlue; color:#000; text-align:center;" width="" rowspan="" ><b>%</b></th>
                    <th style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>
                    <th style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th style="background-color:LightSteelBlue; color:#000; text-align:center;"><b>%</b></th>
                    <th style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>
                    <th style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th style="background-color:LightSteelBlue; color:#000; text-align:center;"><b>%</b></th>
                    <th style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>
                    <th style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th style="background-color:LightSteelBlue; color:#000; text-align:center;"><b>%</b></th>
                    <th style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>
                    <th style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th style="background-color:LightSteelBlue; color:#000; text-align:center;"><b>%</b></th>
                    <th style="background-color:CornflowerBlue; color:#fff; text-align:center;" width="" rowspan="" ><b>ไม่มี LINE ID</b></th>
                    <th style="background-color:green; color:#fff; text-align:center;" width="" rowspan="" ><b>มี LINE ID</b></th>
                    <th style="background-color:yellow; color:#000; text-align:center;" width="" rowspan="" ><b>รวม</b></th>
                    <th style="background-color:LightSteelBlue; color:#000; text-align:center;"><b>%</b></th>
                  </tr>
                </thead>
                <tbody style="white-space: nowrap">
                  <?php
                  // จักรยานยนต์
                  $sql = "SELECT a.SZONE_CODE as dx,
                      count(b1.ps_id) as PS_IDb,
                      sum(t1.line_id) as line_id,
                      sum(t1.line_id2) as line_id2
                    FROM [EHONGDB].[dbo].[BRANCH] a
                    left outer join(SELECT * FROM [HPSDB].[dbo].[hps_ctmain_".$MY."]) b1 on (a.BR_ID=b1.BR_ID)
                    left outer join(SELECT BR_ID,PS_ID
                    	,sum(case when (lineid is not null) then 1 else 0 end) as line_id
                    	,sum(case when (lineid is null) then 1 else 0 end) as line_id2
                   FROM [EHONGDB].[dbo].[PERSON] GROUP BY BR_ID,PS_ID) t1 on (b1.ps_id=t1.PS_ID)
                   left outer join(SELECT * FROM [EHONGDB].[dbo].[branch_salezone]) b on (a.SZONE_CODE=b.szone_code)
                   WHERE b1.BILL_DATE BETWEEN '$DMY1' AND '$DMY2' and (b1.status<>'X')
                   and (b1.product_id like 'มซ%') and (b1.ct_no like '0%' or b1.ct_no like '2%')
                   $zone_code $BR_ID
                   GROUP BY a.SZONE_CODE
                   ORDER BY a.SZONE_CODE ASC";
                  // echo $sql;
                  $rs=$conn->prepare($sql);
                  $rs->execute();
                  $xrow = array();
                  $xrow1 = array();
                  $xrow2 = array();
                    foreach($rs as $row){
                  $xrow[$row['dx']]=$row['line_id'];
                  $xrow1[$row['dx']]=$row['line_id2'];
                  $xrow2[$row['dx']]=$row['PS_IDb'];
                  };
                  // เครื่องใช้ไฟฟ้า
                  $sql = "SELECT a.SZONE_CODE as dx,
                      count(b1.ps_id) as PS_IDb,
                      sum(t1.line_id) as line_id,
                      sum(t1.line_id2) as line_id2
                    FROM [EHONGDB].[dbo].[BRANCH] a
                    left outer join(SELECT * FROM [HPSDB].[dbo].[hps_ctmain_".$MY."]) b1 on (a.BR_ID=b1.BR_ID)
                    left outer join(SELECT BR_ID,PS_ID
                      ,sum(case when (lineid is not null) then 1 else 0 end) as line_id
                      ,sum(case when (lineid is null) then 1 else 0 end) as line_id2
                   FROM [EHONGDB].[dbo].[PERSON] GROUP BY BR_ID,PS_ID) t1 on (b1.ps_id=t1.PS_ID)
                   left outer join(SELECT * FROM [EHONGDB].[dbo].[branch_salezone]) b on (a.SZONE_CODE=b.szone_code)
                   WHERE b1.BILL_DATE BETWEEN '$DMY1' AND '$DMY2' and (b1.status<>'X')
                   and ( b1.product_id not like 'มซ%') and ( b1.ct_no like '0%' or  b1.ct_no like '1%' or  b1.ct_no like '2%')
                   $zone_code $BR_ID
                   GROUP BY a.SZONE_CODE
                   ORDER BY a.SZONE_CODE ASC";
                  // echo $sql;
                  $rs=$conn->prepare($sql);
                  $rs->execute();
                  $xrowa = array();
                  $xrow1a = array();
                  $xrow2a = array();
                    foreach($rs as $row){
                  $xrowa[$row['dx']]=$row['line_id'];
                  $xrow1a[$row['dx']]=$row['line_id2'];
                  $xrow2a[$row['dx']]=$row['PS_IDb'];
                  };
                  // จัดไฟแนนซ์
                  $sql = "SELECT a.SZONE_CODE as dx,
                      count(b1.ps_id) as PS_IDb,
                      sum(t1.line_id) as line_id,
                      sum(t1.line_id2) as line_id2
                    FROM [EHONGDB].[dbo].[BRANCH] a
                    left outer join(SELECT * FROM [HPSDB].[dbo].[hps_ctmain_".$MY."]) b1 on (a.BR_ID=b1.BR_ID)
                    left outer join(SELECT BR_ID,PS_ID
                      ,sum(case when (lineid is not null) then 1 else 0 end) as line_id
                      ,sum(case when (lineid is null) then 1 else 0 end) as line_id2
                   FROM [EHONGDB].[dbo].[PERSON] GROUP BY BR_ID,PS_ID) t1 on (b1.ps_id=t1.PS_ID)
                   left outer join(SELECT * FROM [EHONGDB].[dbo].[branch_salezone]) b on (a.SZONE_CODE=b.szone_code)
                   WHERE b1.BILL_DATE BETWEEN '$DMY1' AND '$DMY2' and (b1.status<>'X')
                   and (b1.ct_no like '3%')
                   $zone_code $BR_ID
                   GROUP BY a.SZONE_CODE
                   ORDER BY a.SZONE_CODE ASC";
                  // echo $sql;
                  $rs=$conn->prepare($sql);
                  $rs->execute();
                  $xrowb = array();
                  $xrow1b = array();
                  $xrow2b = array();
                    foreach($rs as $row){
                  $xrowb[$row['dx']]=$row['line_id'];
                  $xrow1b[$row['dx']]=$row['line_id2'];
                  $xrow2b[$row['dx']]=$row['PS_IDb'];
                  };
                  // ฮีโร่
                  $sql = "SELECT a.SZONE_CODE as dx,
                      count(b1.ps_id) as PS_IDb,
                      sum(t1.line_id) as line_id,
                      sum(t1.line_id2) as line_id2
                    FROM [EHONGDB].[dbo].[BRANCH] a
                    left outer join(SELECT * FROM [HPSDB].[dbo].[hps_ctmain_".$MY."]) b1 on (a.BR_ID=b1.BR_ID)
                    left outer join(SELECT BR_ID,PS_ID
                      ,sum(case when (lineid is not null) then 1 else 0 end) as line_id
                      ,sum(case when (lineid is null) then 1 else 0 end) as line_id2
                   FROM [EHONGDB].[dbo].[PERSON] GROUP BY BR_ID,PS_ID) t1 on (b1.ps_id=t1.PS_ID)
                   left outer join(SELECT * FROM [EHONGDB].[dbo].[branch_salezone]) b on (a.SZONE_CODE=b.szone_code)
                   WHERE b1.BILL_DATE BETWEEN '$DMY1' AND '$DMY2' and (b1.status<>'X')
                   and (b1.ct_no like '4%' or b1.ct_no like '5%')
                   $zone_code $BR_ID
                   GROUP BY a.SZONE_CODE
                   ORDER BY a.SZONE_CODE ASC";
                  // echo $sql;
                  $rs=$conn->prepare($sql);
                  $rs->execute();
                  $xrowc = array();
                  $xrow1c = array();
                  $xrow2c = array();
                    foreach($rs as $row){
                  $xrowc[$row['dx']]=$row['line_id'];
                  $xrow1c[$row['dx']]=$row['line_id2'];
                  $xrow2c[$row['dx']]=$row['PS_IDb'];
                  };
                  // จำนำ
                  $sql = "SELECT a.SZONE_CODE as dx,
                      count(b1.ps_id) as PS_IDb,
                      sum(t1.line_id) as line_id,
                      sum(t1.line_id2) as line_id2
                    FROM [EHONGDB].[dbo].[BRANCH] a
                    left outer join(SELECT * FROM [HPSDB].[dbo].[hps_ctmain_".$MY."]) b1 on (a.BR_ID=b1.BR_ID)
                    left outer join(SELECT BR_ID,PS_ID
                      ,sum(case when (lineid is not null) then 1 else 0 end) as line_id
                      ,sum(case when (lineid is null) then 1 else 0 end) as line_id2
                   FROM [EHONGDB].[dbo].[PERSON] GROUP BY BR_ID,PS_ID) t1 on (b1.ps_id=t1.PS_ID)
                   left outer join(SELECT * FROM [EHONGDB].[dbo].[branch_salezone]) b on (a.SZONE_CODE=b.szone_code)
                   WHERE b1.BILL_DATE BETWEEN '$DMY1' AND '$DMY2' and (b1.status<>'X')
                   and (b1.ct_no like '6%')
                   $zone_code $BR_ID
                   GROUP BY a.SZONE_CODE
                   ORDER BY a.SZONE_CODE ASC";
                  // echo $sql;
                  $rs=$conn->prepare($sql);
                  $rs->execute();
                  $xrowd = array();
                  $xrow1d = array();
                  $xrow2d = array();
                    foreach($rs as $row){
                  $xrowd[$row['dx']]=$row['line_id'];
                  $xrow1d[$row['dx']]=$row['line_id2'];
                  $xrow2d[$row['dx']]=$row['PS_IDb'];
                  };
                  // $SZONE_CODxE = $row['dx'];
                  // $zone_code2 = "SZONE_CODE = '$SZONE_CODxE'";
                  // echo $SZONE_CODxE;

                  include 'sumline_1.php';

                  $sql = "SELECT c.szone_code,szone_name,staff_nick FROM [EHONGDB].[dbo].[branch_salezone] c
                  left outer join(SELECT * FROM [EHONGDB].[dbo].[BRANCH]) b on (b.SZONE_CODE=c.szone_code)
                  $zone_code1 $BR_IDXSD
                  GROUP BY c.szone_code,szone_name,staff_nick
                  ORDER BY c.szone_code ";
                  // echo "$sql";
                  $select=$conn->prepare($sql);
                  $select->execute();
                  $item = 1;
                  $sp2 = 0;
                  $spa2 = 0;
                  $spb2 = 0;
                  $spc2 = 0;
                  $spd2 = 0;
                  $soxc = 0;
                  $soxa = 0;
                  $soxax = 0;
                  $soxbx = 0;
                  $soxcx = 0;
                  $soxdx = 0;
                  while($fetch=$select->fetch()){
                    $dcnt = isset($xrow[$fetch['szone_code']]) ? $xrow[$fetch['szone_code']] : "0";
                    $xrows = array_sum($xrow);
                    $dcnt1 = isset($xrow1[$fetch['szone_code']]) ? $xrow1[$fetch['szone_code']] : "0";
                    $xrows1 = array_sum($xrow1);
                    $dcnt2 = isset($xrow2[$fetch['szone_code']]) ? $xrow2[$fetch['szone_code']] : "0";
                    $xrows2 = array_sum($xrow2);
                    // $dcnt3 = isset($xrow3[$fetch['szone_code']]) ? $xrow3[$fetch['szone_code']] : "0";
                    // $xrows3 = array_sum($xrow3);
                    $dcnta = isset($xrowa[$fetch['szone_code']]) ? $xrowa[$fetch['szone_code']] : "0";
                    $xrowsa = array_sum($xrowa);
                    $dcnt1a = isset($xrow1a[$fetch['szone_code']]) ? $xrow1a[$fetch['szone_code']] : "0";
                    $xrows1a = array_sum($xrow1a);
                    $dcnt2a = isset($xrow2a[$fetch['szone_code']]) ? $xrow2a[$fetch['szone_code']] : "0";
                    $xrows2a = array_sum($xrow2a);
                    $dcntb = isset($xrowb[$fetch['szone_code']]) ? $xrowb[$fetch['szone_code']] : "0";
                    $xrowsb = array_sum($xrowb);
                    $dcnt1b = isset($xrow1b[$fetch['szone_code']]) ? $xrow1b[$fetch['szone_code']] : "0";
                    $xrows1b = array_sum($xrow1b);
                    $dcnt2b = isset($xrow2b[$fetch['szone_code']]) ? $xrow2b[$fetch['szone_code']] : "0";
                    $xrows2b = array_sum($xrow2b);
                    $dcntc = isset($xrowc[$fetch['szone_code']]) ? $xrowc[$fetch['szone_code']] : "0";
                    $xrowsc = array_sum($xrowc);
                    $dcnt1c = isset($xrow1c[$fetch['szone_code']]) ? $xrow1c[$fetch['szone_code']] : "0";
                    $xrows1c = array_sum($xrow1c);
                    $dcnt2c = isset($xrow2c[$fetch['szone_code']]) ? $xrow2c[$fetch['szone_code']] : "0";
                    $xrows2c = array_sum($xrow2c);
                    $dcntd = isset($xrowd[$fetch['szone_code']]) ? $xrowd[$fetch['szone_code']] : "0";
                    $xrowsd = array_sum($xrowd);
                    $dcnt1d = isset($xrow1d[$fetch['szone_code']]) ? $xrow1d[$fetch['szone_code']] : "0";
                    $xrows1d = array_sum($xrow1d);
                    $dcnt2d = isset($xrow2d[$fetch['szone_code']]) ? $xrow2d[$fetch['szone_code']] : "0";
                    $xrows2d = array_sum($xrow2d);

                    $soxa = $dcnt2+$dcnt2a+$dcnt2b+$dcnt2c+$dcnt2d;
                    $soxa1 = $dcnt1+$dcnt1a+$dcnt1b+$dcnt1c+$dcnt1d;
                    $soxa2 = $dcnt+$dcnta+$dcntb+$dcntc+$dcntd;
                    $soxax += $soxa1;
                    $soxbx += $soxa2;
                    $soxcx = $xrows2+$xrows2a+$xrows2b+$xrows2c+$xrows2d;

                    if ($dcnt == "0") {
                    $sp = "0";
                    } else {
                    $sp = ($dcnt/$dcnt2)*100;
                    }
                    if ($dcnta == "0") {
                    $spa = "0";
                    } else {
                    $spa = ($dcnta/$dcnt2a)*100;
                    }
                    if ($dcntb == "0") {
                    $spb = "0";
                    } else {
                    $spb = ($dcntb/$dcnt2b)*100;
                    }
                    if ($dcntc == "0") {
                    $spc = "0";
                    } else {
                    $spc = ($dcntc/$dcnt2c)*100;
                    }
                    if ($dcntd == "0") {
                    $spd = "0";
                    } else {
                    $spd = ($dcntd/$dcnt2d)*100;
                    }
                    if ($soxa2 == "0") {
                    $soxas = "0";
                    } else {
                    $soxas = ($soxa2/$soxa)*100;
                    }

                    $sl_c1 = isset($sumline_c1[$fetch['szone_code']]) ? $sumline_c1[$fetch['szone_code']] : "0";
                    $sl_c2 = $soxa2-$sl_c1;
                    $sl_sc1 += $sl_c1;
                    $sl_sc2 += $sl_c2;

                  ?>
                  <tr>
                    <td style="background-color:; color:; text-align:center;"><?= number_format($item)."."?></td>
                    <td style="background-color:; color:#;"><?php echo $fetch["szone_name"]." : ".$fetch["staff_nick"]; ?></td>
                    <td style="background-color:; color:; text-align:right;"><a><b><?php echo $soxa1; ?></b></a></td>
                    <td style="background-color:; color:green; text-align:right;"><b><?php echo $soxa2; ?></b></td>

                    <td style="background-color:; color:red; text-align:right;"><b><?php echo $sl_c1; ?></b></td>
                    <td style="background-color:; color:blue; text-align:right;"><b><?php echo $sl_c2; ?></b></td>

                    <td style="background-color:; color:; text-align:right;"><b><?php echo $soxa; ?></b></td>
                    <td style="background-color:LightSteelBlue; color:red; text-align:right;"><b><?php echo number_format($soxas,2); ?>%</b></td>
                    <td style="background-color:; color:#; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=2x" style="color:CornflowerBlue;" target="_blank"><?php echo number_format($dcnt1);?></a></b></td>
                    <td style="background-color:; color:#fff; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=1x" style="color:green;" target="_blank"> <?php echo number_format($dcnt); ?></a></b></td>
                    <td style="background-color:; color:; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=3x" style="color:#000;" target="_blank"><?php echo number_format($dcnt2); ?></a></b></td>
                    <td style="background-color:LightSteelBlue; color:#000; text-align:right;"><b><?php echo number_format($sp,2); ?>%</b></td>
                    <td style="background-color:; color:#; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=2ax" style="color:CornflowerBlue;" target="_blank"><?php echo number_format($dcnt1a);?></a></b></td>
                    <td style="background-color:; color:#fff; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=1ax" style="color:green;" target="_blank"> <?php echo number_format($dcnta); ?></a></b></td>
                    <td style="background-color:; color:; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=3ax" style="color:#000;" target="_blank"><?php echo number_format($dcnt2a); ?></a></b></td>
                    <td style="background-color:LightSteelBlue; color:#000; text-align:right;"><b><?php echo number_format($spa,2); ?>%</b></td>
                    <td style="background-color:; color:#; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=2bx" style="color:CornflowerBlue;" target="_blank"><?php echo number_format($dcnt1b);?></a></b></td>
                    <td style="background-color:; color:#fff; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=1bx" style="color:green;" target="_blank"> <?php echo number_format($dcntb); ?></a></b></td>
                    <td style="background-color:; color:; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=3bx" style="color:#000;" target="_blank"><?php echo number_format($dcnt2b); ?></a></b></td>
                    <td style="background-color:LightSteelBlue; color:#000; text-align:right;"><b><?php echo number_format($spb,2); ?>%</b></td>
                    <td style="background-color:; color:#; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=2cx" style="color:CornflowerBlue;" target="_blank"><?php echo number_format($dcnt1c);?></a></b></td>
                    <td style="background-color:; color:#fff; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=1cx" style="color:green;" target="_blank"> <?php echo number_format($dcntc); ?></a></b></td>
                    <td style="background-color:; color:; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=3cx" style="color:#000;" target="_blank"><?php echo number_format($dcnt2c); ?></a></b></td>
                    <td style="background-color:LightSteelBlue; color:#000; text-align:right;"><b><?php echo number_format($spc,2); ?>%</b></td>
                    <td style="background-color:; color:#; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=2dx" style="color:CornflowerBlue;" target="_blank"><?php echo number_format($dcnt1d);?></a></b></td>
                    <td style="background-color:; color:#fff; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=1dx" style="color:green;" target="_blank"> <?php echo number_format($dcntd); ?></a></b></td>
                    <td style="background-color:; color:; text-align:right;"><b> <a href="linezoom_1.php?BR_ID=<?php //echo $fetch['szone_code'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=3dx" style="color:#000;" target="_blank"><?php echo number_format($dcnt2d); ?></a></b></td>
                    <td style="background-color:LightSteelBlue; color:#000; text-align:right;"><b><?php echo number_format($spd,2); ?>%</b></td>
                  </tr>
                   <?php $item++; } ?>
                </tbody>
                <?php
                  if ($soxbx == "0") { $ps1 = "0.00"; }
                  else { $ps1 = number_format(($soxbx/$soxcx)*100,2); }
                  if ($xrows == "0") { $ps2 = "0.00"; }
                  else { $ps2 = number_format(($xrows/$xrows2)*100,2); }
                  if ($xrowsa == "0") { $ps3 = "0.00"; }
                  else { $ps3 = number_format(($xrowsa/$xrows2a)*100,2); }
                  if ($xrowsb == "0") { $ps4 = "0.00"; }
                  else { $ps4 = number_format(($xrowsb/$xrows2b)*100,2); }
                  if ($xrowsc == "0") { $ps5 = "0.00"; }
                  else { $ps5 = number_format(($xrowsc/$xrows2c)*100,2); }
                  if ($xrowsd == "0") { $ps6 = "0.00"; }
                  else { $ps6 = number_format(($xrowsd/$xrows2d)*100,2); }
                ?>
                <tfoot>
                  <td colspan="2" style="background-color:black; color:#fff; text-align:center;"><b>รวม</b></td>
                  <td colspan="" style="background-color:CornflowerBlue; color:#fff; text-align:center;"><b><?php echo number_format($soxax,2); ?></b></td>
                  <td colspan="" style="background-color:green; color:#fff; text-align:center;"><b><?php echo number_format($soxbx,2); ?></b></td>

                  <td style="background-color:red; color:#fff; text-align:center;"><b><?php echo $sl_sc1; ?></b></td>
                  <td style="background-color:blue; color:#fff; text-align:center;"><b><?php echo $sl_sc2; ?></b></td>

                  <td style="background-color:yellow; color:#000; text-align:center;"><b><?php echo number_format($soxcx,2); ?></b></td>
                  <td colspan="" style="background-color:LightSteelBlue; color:red; text-align:center;"><b><?php echo number_format($ps1,2); ?>%</b></td>
                  <td style="background-color:CornflowerBlue; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=4" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows1); ?></B></a></td>
                  <td style="background-color:green; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=5" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows); ?></B></a></td>
                  <td colspan="" style="background-color:yellow; color:#; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=6" style="color:#000;" target="_blank"><b><?php echo number_format($xrows2); ?></b></a></td>
                  <td style="background-color:LightSteelBlue; color:#000; text-align:center;"><b><?php echo $ps2; ?>%</b></td>
                  <td style="background-color:CornflowerBlue; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=4a" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows1a); ?></B></a></td>
                  <td style="background-color:green; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=5a" style="color:#fff;" target="_blank"><B><?php echo number_format($xrowsa); ?></B></a></td>
                  <td colspan="" style="background-color:yellow; color:#; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=6a" style="color:#000;" target="_blank"><b><?php echo number_format($xrows2a); ?></b></a></td>
                  <td style="background-color:LightSteelBlue; color:#000; text-align:center;"><b><?php echo $ps3; ?>%</b></td>
                  <td style="background-color:CornflowerBlue; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=4b" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows1b); ?></B></a></td>
                  <td style="background-color:green; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=5b" style="color:#fff;" target="_blank"><B><?php echo number_format($xrowsb); ?></B></a></td>
                  <td colspan="" style="background-color:yellow; color:#; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=6b" style="color:#000;" target="_blank"><b><?php echo number_format($xrows2b); ?></b></a></td>
                  <td style="background-color:LightSteelBlue; color:#000; text-align:center;"><b><?php echo $ps4;?>%</b></td>
                  <td style="background-color:CornflowerBlue; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=4c" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows1c); ?></B></a></td>
                  <td style="background-color:green; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=5c" style="color:#fff;" target="_blank"><B><?php echo number_format($xrowsc); ?></B></a></td>
                  <td colspan="" style="background-color:yellow; color:#; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=6c" style="color:#000;" target="_blank"><b><?php echo number_format($xrows2c); ?></b></a></td>
                  <td style="background-color:LightSteelBlue; color:#000; text-align:center;"><b><?php echo $ps5; ?>%</b></td>
                  <td style="background-color:CornflowerBlue; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=4d" style="color:#fff;" target="_blank"><B><?php echo number_format($xrows1d); ?></B></a></td>
                  <td style="background-color:green; color:; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=5d" style="color:#fff;" target="_blank"><B><?php echo number_format($xrowsd); ?></B></a></td>
                  <td colspan="" style="background-color:yellow; color:#; text-align:center;"><a href="linezoom_1.php?BR_ID=<?php echo $fetch['BR_ID'];?>&BR_IDSX=<?php echo $BR_IDx; ?>&SZXONE=<?php //echo $zone_codex; ?>&ZSFID=<?php //echo $zstaff_idx; ?>&DMY1=<?php echo $DMY1;?>&DMY2=<?php echo $DMY2;?>&LINEX=6d" style="color:#000;" target="_blank"><b><?php echo number_format($xrows2d); ?></b></a></td>
                  <td style="background-color:LightSteelBlue; color:#000; text-align:center;"><b><?php echo $ps6; ?>%</b></td>
                </tfoot>
            </table>
            </div>
          </div>
        </div>
      </div>

      </div>
    </section>
  </div>
</div>

<?php
// include '_footer.php';
// include '_form.php';
?>
<div class="control-sidebar-bg"></div>
<?php include '_script_2.php'; ?>
<!-- <script>
    var myApp = new function () {
        this.printTable = function () {
            var tab = document.getElementById('tab');
            var win = window.open('', '', 'height=700,width=1200');
            win.document.write(tab.outerHTML);
            win.document.close();
            win.print();
            // tab.style.font = "bold 2px arial,serif";
            // tab.style.backgroundColor = "#FF0000";
            // win.close();
        }
    }
</script> -->
</body>
</html>
<?php include '3datatable.php' ?>
