<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>EHONGMD</title>
  <?php
  error_reporting(0);
  // error_reporting(E_ALL);
  include '_plugin.php';
  include '_connect.php';
?>
</head>
<body class="hold-transition skin-red sidebar-mini">
<div class="wrapper">

<?php
include '_header.php';
include '_menu.php';
?>
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
      <!-- ค้นหา -->
      <!-- ตาราง -->
      <?php include 'act_search_1.php' ?>

      <div class="col-md-12">
        <div class="box box-success">
          <div class="box-header">
            <h3 class="box-title"><p class="text-success">รายงานค่าใช้จ่ายที่ใช้จดพรบ (ทำให้ลูกค้าฟรี)</p></h3>
            <!-- <p class="text-warning">วันที่ <?php // echo $calcdate; ?> ถึงวันที่ <?php // echo $calcdate2; ?></p> -->
          </div>
          <div class="box-body">
            <div class="form-group">
              <table id="example" class="table table-striped table-bordered" style="width:100%">
                <thead style="white-space: nowrap">
                  <tr>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>No.</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>บริษัทที่จำหน่าย</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>จำนวนคัน</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>ค่าใช้จ่ายพรบที่เบิก (บาท)</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>เลขที่เช็ค</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>หมายเหตุ</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>ใบรับรองแทนใบเสร็จรับเงิน</b></th>
                  </tr>
                </thead>
                <tbody style="white-space: nowrap">
                  <?php
                  //  $sql = "SELECT
                  //      CROP_NAME as AX
                  //     ,COUNT(CROP_NAME) as BX
                  //     ,SUM(FEE_PRICE) as CX
                  //   from [EHONGDB].[dbo].[reg_billdata] a
                  //   left outer join [EHONGDB].[dbo].[reg_bill] b on(a.bill_no=b.bill_no)
                  //   left outer join(SELECT * FROM [EHONGDB].[dbo].[BRANCH]) c on (a.BR_ID=c.BR_ID)
                  //   left outer join(SELECT * FROM  [EHONGDB].[dbo].[REG_GWORK]) d on(b.g_id=d.G_ID)
                  //   where a.status<>'V' and fee_no='11'
                  //   and a.bill_date between '$DMY_1' and '$DMY_2'
                  //   GROUP by CROP_NAME
                  //   ORDER by CROP_NAME";
                  // // echo $sql;
                  // $select=$conn->prepare($sql);
                  // $select->execute();
                  // $item = 1;
                  // $BX1 = 0;
                  // $CX1 = 0;
                  // while($fetch=$select->fetch()){
                  // $BX1  += $fetch['BX'];
                  // $CX1  += $fetch['CX'];

                  $sql = "SELECT a.bill_no as xbill_no,a.bill_date as xbill_date,*,a.rectime as xrectime from [EHONGDB].[dbo].[reg_billdata] a
                  left outer join(SELECT * FROM [EHONGDB].[dbo].[reg_bill]) b on(a.bill_no=b.bill_no)
                  left outer join(SELECT * FROM [EHONGDB].[dbo].[BRANCH]) c on (a.BR_ID=c.BR_ID)
                  left outer join(SELECT * FROM [EHONGDB].[dbo].[REG_GWORK]) d on(b.g_id=d.G_ID)
                  where a.status<>'V' and fee_no='11' and a.bill_date between '$DMY_1' and '$DMY_2'
                  order by a.rectime,a.br_id,a.bill_date";
                    // echo $sql;
                    $select=$conn->prepare($sql);
                    $select->execute();
                    $item = 1;
                    // $icar1 = 1; $icar2 = 1; $icar3 = 1; $icar4 = 1; $icar5 = 1; $icar6 = 1; $icar7 = 1; $icar8 = 1; $icar9 = 1;
                    $B10 = '0.00';
                    $B10x = '10.00';
                    $SUMFEE_SUMPRICE = '0';
                    $SUMFEE_PRICE = '0';
                    $SUMB10 = '0';
                    $SUM_x1 = '0';
                    $SUM_x2 = '0';
                    $SUM1_FEE_SUMPRICE = '0'; $SUM2_FEE_SUMPRICE = '0'; $SUM3_FEE_SUMPRICE = '0'; $SUM4_FEE_SUMPRICE = '0'; $SUM5_FEE_SUMPRICE = '0'; $SUM6_FEE_SUMPRICE = '0'; $SUM7_FEE_SUMPRICE = '0'; $SUM8_FEE_SUMPRICE = '0'; $SUM9_FEE_SUMPRICE = '0';
                    $SUM1_FEE_PRICE = '0'; $SUM2_FEE_PRICE = '0'; $SUM3_FEE_PRICE = '0'; $SUM4_FEE_PRICE = '0'; $SUM5_FEE_PRICE = '0'; $SUM6_FEE_PRICE = '0'; $SUM7_FEE_PRICE = '0'; $SUM8_FEE_PRICE = '0'; $SUM9_FEE_PRICE = '0';
                    $SUM1_B10 = '0'; $SUM2_B10 = '0'; $SUM3_B10 = '0'; $SUM4_B10 = '0'; $SUM5_B10 = '0'; $SUM6_B10 = '0'; $SUM7_B10 = '0'; $SUM8_B10 = '0'; $SUM9_B10 = '0';
                    $SUM1_SUM_1 = '0'; $SUM2_SUM_1 = '0'; $SUM3_SUM_1 = '0'; $SUM4_SUM_1 = '0'; $SUM5_SUM_1 = '0'; $SUM6_SUM_1 = '0'; $SUM7_SUM_1 = '0'; $SUM8_SUM_1 = '0'; $SUM9_SUM_1 = '0';
                    $SUM1_SUM_2 = '0'; $SUM2_SUM_2 = '0'; $SUM3_SUM_2 = '0'; $SUM4_SUM_2 = '0'; $SUM5_SUM_2 = '0'; $SUM6_SUM_2 = '0'; $SUM7_SUM_2 = '0'; $SUM8_SUM_2 = '0'; $SUM9_SUM_2 = '0';
                    while($fetch=$select->fetch()){
                      if ($fetch['BILL_DATE'] != '') {
                        $BILL_DATE1 = substr($fetch['BILL_DATE'],0,4)+543; $BILL_DATE2 = substr($fetch['BILL_DATE'],5,2); $BILL_DATE3 = substr($fetch['BILL_DATE'],8,2);
                        $BILL_DATE = $BILL_DATE3."/".$BILL_DATE2."/".$BILL_DATE1;
                      } else {
                        $BILL_DATE = '';
                      }
                    $FEE_PRICE = number_format($fetch['FEE_PRICE']-$B10,2);
                    // $FEE_SUMPRICE = number_format($fetch['FEE_SUMPRICE'],2);
                    // $FEE_SUMPRICE = number_format(350,2);
                    if ($fetch['FEE_SUMPRICE'] != '0') {
                      if ($fetch['CC_SIZE'] < '75') {
                        $FEE_SUMPRICE = number_format(190,2);
                      }
                      if ($fetch['CC_SIZE'] >= '75') {
                        $FEE_SUMPRICE = number_format(350,2);
                      }
                      if ($fetch['CC_SIZE'] > '125') {
                        $FEE_SUMPRICE = number_format(450,2);
                      }
                      if ($fetch['CC_SIZE'] > '150') {
                        $FEE_SUMPRICE = number_format(700,2);
                      }
                      $SUM_1 = number_format(($FEE_SUMPRICE-$B10-$FEE_PRICE)/1.07,2);
                      $SUM_2 = number_format(($SUM_1*0.07),2);
                      $SUMFEE_SUMPRICE += $FEE_SUMPRICE;
                      $SUM_x1 += $SUM_1;
                      $SUM_x2 += $SUM_2;
                    }
                    else {
                      $FEE_SUMPRICE = '';
                      $SUM_1 = '';
                      $SUM_2 = '';
                    }
                    if ($fetch['FEE_SUMPRICE'] != '0') {
                      if ($fetch['g_id'] == 'G01') {
                        $FEE_STATUSX = "03";
                        $FEE_STATUSX1 = "คิดค่าบริการ (".$fetch['G_NAME'].")";
                        if ($fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (สาขาซำสูง)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ประทาย)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ยางตลาด)") {
                          $CROP_NAME = "บริษัท อีฮงมดแดงยามาฮ่า จำกัด";
                        }
                        else {
                          $CROP_NAME = $fetch['CROP_NAME'];
                        }
                      }
                      if ($fetch['g_id'] == 'G05') {
                        $FEE_STATUSX = "04";
                        $FEE_STATUSX1 = "คิดค่าบริการ (".$fetch['G_NAME'].")";
                        $CROP_NAME = "บริษัท มดแดงลิสซิ่ง จำกัด";
                      }
                    }
                    else {
                      if ($fetch['g_id'] == 'G01') {
                        $FEE_STATUSX = "01";
                        $FEE_STATUSX1 = "ฟรี (".$fetch['G_NAME'].")";
                        if ($fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (สาขาซำสูง)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ประทาย)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ยางตลาด)") {
                          $CROP_NAME = "บริษัท อีฮงมดแดงยามาฮ่า จำกัด";
                        }
                        else {
                          $CROP_NAME = $fetch['CROP_NAME'];
                        }
                      }
                      if ($fetch['g_id'] == 'G02') {
                        $FEE_STATUSX = "02";
                        $FEE_STATUSX1 = "ฟรี (".$fetch['G_NAME'].")";
                        if ($fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (สาขาซำสูง)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ประทาย)" || $fetch['CROP_NAME'] == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด (ยางตลาด)") {
                          $CROP_NAME = "บริษัท อีฮงมดแดงยามาฮ่า จำกัด";
                        }
                        else {
                          $CROP_NAME = $fetch['CROP_NAME'];
                        }
                      }
                    }
                    $SUMFEE_PRICE += $FEE_PRICE;
                    $SUMB10 += $B10x;
                    $REF_NO = $fetch['REF_NO'];
                    $BILL_NO = $fetch['BILL_NO'];

                    if ($CROP_NAME == "บริษัท มดแดงลิสซิ่ง จำกัด") {
                      $SUM1_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM1_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM1_B10 += str_replace(',','',$B10);
                      $SUM1_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM1_SUM_2 += str_replace(',','',$SUM_2);
                      $icar1 = array($CROP_NAME);
                      $icar1x = COUNT($icar1);
                      $icar1c += $icar1x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงฮอนด้า จำกัด") {
                      $SUM2_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM2_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM2_B10 += str_replace(',','',$B10);
                      $SUM2_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM2_SUM_2 += str_replace(',','',$SUM_2);
                      $icar2 = array($CROP_NAME);
                      $icar2x = COUNT($icar2);
                      $icar2c += $icar2x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด") {
                      $SUM3_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM3_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM3_B10 += str_replace(',','',$B10);
                      $SUM3_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM3_SUM_2 += str_replace(',','',$SUM_2);
                      $icar3 = array($CROP_NAME);
                      $icar3x = COUNT($icar3);
                      $icar3c += $icar3x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงคาวาซากิ") {
                      $SUM4_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM4_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM4_B10 += str_replace(',','',$B10);
                      $SUM4_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM4_SUM_2 += str_replace(',','',$SUM_2);
                      $icar4 = array($CROP_NAME);
                      $icar4x = COUNT($icar4);
                      $icar4c += $icar4x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงพยัคฆ์") {
                      $SUM5_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM5_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM5_B10 += str_replace(',','',$B10);
                      $SUM5_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM5_SUM_2 += str_replace(',','',$SUM_2);
                      $icar5 = array($CROP_NAME);
                      $icar5x = COUNT($icar5);
                      $icar5c += $icar5x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงมอเตอร์ไบค์ จำกัด") {
                      $SUM6_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM6_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM6_B10 += str_replace(',','',$B10);
                      $SUM6_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM6_SUM_2 += str_replace(',','',$SUM_2);
                      $icar6 = array($CROP_NAME);
                      $icar6x = COUNT($icar6);
                      $icar6c += $icar6x;
                    }
                    if ($CROP_NAME == "บริษัท มดแดงมอเตอร์เมค จำกัด") {
                      $SUM7_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM7_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM7_B10 += str_replace(',','',$B10);
                      $SUM7_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM7_SUM_2 += str_replace(',','',$SUM_2);
                      $icar7 = array($CROP_NAME);
                      $icar7x = COUNT($icar7);
                      $icar7c += $icar7x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงมอเตอร์ ลิส จำกัด") {
                      $SUM8_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM8_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM8_B10 += str_replace(',','',$B10);
                      $SUM8_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM8_SUM_2 += str_replace(',','',$SUM_2);
                      $icar8 = array($CROP_NAME);
                      $icar8x = COUNT($icar8);
                      $icar8c += $icar8x;
                    }
                    if ($CROP_NAME == "บริษัท มีสติมอเตอร์ จำกัด") {
                      $SUM9_FEE_SUMPRICE += str_replace(',','',$FEE_SUMPRICE);
                      $SUM9_FEE_PRICE += str_replace(',','',$FEE_PRICE);
                      $SUM9_B10 += str_replace(',','',$B10);
                      $SUM9_SUM_1 += str_replace(',','',$SUM_1);
                      $SUM9_SUM_2 += str_replace(',','',$SUM_2);
                      $icar9 = array($CROP_NAME);
                      $icar9x = COUNT($icar9);
                      $icar9c += $icar9x;
                    }
                  }
                  $Sumicar = $icar1c+$icar2c+$icar3c+$icar4c+$icar5c+$icar6c+$icar7c+$icar8c+$icar9c;
                  ?>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">1.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท มดแดงลิสซิ่ง จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar1c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM1_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">2.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงฮอนด้า จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar2c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM2_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">3.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงมดแดงยามาฮ่า จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar3c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM3_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">4</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงคาวาซากิ</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar4c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM4_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">5.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงพยัคฆ์</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar5c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM5_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">6.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงมดแดงมอเตอร์ไบค์ จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar6c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM6_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">7.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท มดแดงมอเตอร์เมค จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar7c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM7_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">8.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท อีฮงมดแดงมอเตอร์ ลิส จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar8c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM8_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">9.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท มีสติมอเตอร์ จำกัด</td>
                    <td style="background-color:; color:red; text-align:center;"><?php echo number_format($icar9c,2); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUM9_FEE_PRICE,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">10.</td>
                    <td style="background-color:; color:; text-align:;">ค่าเครื่องเขียน พ.ร.บ.</td>
                    <td style="background-color:; color:red; text-align:center;"><?php //echo number_format($fetch['BX']); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php //echo number_format($fetch['CX'],2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">11.</td>
                    <td style="background-color:; color:; text-align:;">รายได้ค่าเครื่องเขียน</td>
                    <td style="background-color:; color:red; text-align:center;"><?php //echo number_format($fetch['BX']); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php //echo number_format($fetch['CX'],2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">12.</td>
                    <td style="background-color:; color:; text-align:;">ค่านายหน้า</td>
                    <td style="background-color:; color:red; text-align:center;"><?php //echo number_format($fetch['BX']); ?></td>
                    <td style="background-color:; color:blue; text-align:right;"><?php echo number_format($SUMB10,2); ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php  ?></td>
                    <td style="background-color:; color:; text-align:center;"><?php ?></td>
                    <td style="background-color:; color:; text-align:center;"><a href="#" class="text-red">พิมพ์</a></td>
                  </tr>
                </tbody>
                <tfoot>
                  <td colspan="2" style="background-color:black; color:#fff; text-align:center;"><b>รวม</b></td>
                  <td colspan="" style="background-color:black; color:#fff; text-align:center;"><b><?php echo number_format($Sumicar); ?></b></td>
                  <td colspan="" style="background-color:black; color:#fff; text-align:right;"><b><?php //echo number_format($CX1,2); ?></b></td>
                  <td colspan="" style="background-color:black; color:#fff; text-align:;"><b></b></td>
                  <td colspan="" style="background-color:black; color:#fff; text-align:;"><b></b></td>
                  <td colspan="" style="background-color:black; color:#fff; text-align:;"><b></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'; ?>
<?php include 'scroll0.php' ?>
</body>
</html>
