<!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_2.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 $calcdate25; ?></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>จำนวนขายสด (1)</b></th>
                    <th rowspan="" style="background-color:black; color:#fff; text-align:center;"><b>จำนวนขายผ่อน (2,5)</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
                    $sql1 = "SELECT *,(price-cost) as product_profit1 from EHONGDB.dbo.hps_ctmain a
                    left outer join (select br_id as bbr_id,br_name from EHONGDB.dbo.branch) b on (a.br_id=b.bbr_id)
                    left outer join (select serial_no as xserial_no,product_id as xproduct_id,product_cost,color_name as xcolor_name,crop_no as zcorp_no from EHONGDB.dbo.product_vserialno) c on(a.product_id=c.xproduct_id and a.serial_no=c.xserial_no)
                    where br_id like '%' and (ct_date between '$DMY_1' and '$DMY_2') and (product_id like 'มซ%') and (ct_no like '0%' or ct_no like '2%')
                    and (ptype_no like 'N') and (type_sale like '%') and (xcorp_no like '%' or xcorp_no is null) and ptype_no<>'F' and status<>'X'
                    order by ct_date,ct_no";
                    // echo $sql1;
                    $select1=$conn->prepare($sql1);
                    $select1->execute();
                    $sumics = '0';
                    $sumi2cs = '0';
                    $ics1 = '0'; $ics2 = '0'; $ics3 = '0'; $ics4 = '0'; $ics5 = '0'; $ics6 = '0'; $ics7 = '0'; $ics8 = '0'; $ics9 = '0';
                    $i2cs1 = '0'; $i2cs2 = '0'; $i2cs3 = '0'; $i2cs4 = '0'; $i2cs5 = '0'; $i2cs6 = '0'; $i2cs7 = '0'; $i2cs8 = '0'; $i2cs9 = '0';
                    while($fetch1=$select1->fetch()){
                      if ($fetch1['type_sale'] == "1") {
                        if ($fetch1['xcorp_no'] == "EMD") {
                          $icar1 = array($fetch1['xcorp_no']);
                          $icar1x = COUNT($icar1);
                          $ics1 += $icar1x;
                        }
                        if ($fetch1['xcorp_no'] == "EH") {
                          $icar2 = array($fetch1['xcorp_no']);
                          $icar2x = COUNT($icar2);
                          $ics2 += $icar2x;
                        }
                        if ($fetch1['xcorp_no'] == "EYM") {
                          $icar3 = array($fetch1['xcorp_no']);
                          $icar3x = COUNT($icar3);
                          $ics3 += $icar3x;
                        }
                        if ($fetch1['xcorp_no'] == "EHK") {
                          $icar4 = array($fetch1['xcorp_no']);
                          $icar4x = COUNT($icar4);
                          $ics4 += $icar4x;
                        }
                        if ($fetch1['xcorp_no'] == "EP") {
                          $icar5 = array($fetch1['xcorp_no']);
                          $icar5x = COUNT($icar5);
                          $ics5 += $icar5x;
                        }
                        if ($fetch1['xcorp_no'] == "EMB") {
                          $icar6 = array($fetch1['xcorp_no']);
                          $icar6x = COUNT($icar6);
                          $ics6 += $icar6x;
                        }
                        if ($fetch1['xcorp_no'] == "EMM" || $fetch1['xcorp_no'] == "MTM") {
                          $icar7 = array($fetch1['xcorp_no']);
                          $icar7x = COUNT($icar7);
                          $ics7 += $icar7x;
                        }
                        if ($fetch1['xcorp_no'] == "EML") {
                          $icar8 = array($fetch1['xcorp_no']);
                          $icar8x = COUNT($icar8);
                          $ics8 += $icar8x;
                        }
                        if ($fetch1['xcorp_no'] == "MST" || $fetch1['xcorp_no'] == "มีส") {
                          $icar9 = array($fetch1['xcorp_no']);
                          $icar9x = COUNT($icar9);
                          $ics9 += $icar9x;
                        }
                      }
                      if ($fetch1['type_sale'] == "2" || $fetch1['type_sale'] == "5") {
                        if ($fetch1['xcorp_no'] == "EMD") {
                          $icar1 = array($fetch1['xcorp_no']);
                          $icar1x = COUNT($icar1);
                          $i2cs1 += $icar1x;
                        }
                        if ($fetch1['xcorp_no'] == "EH") {
                          $icar2 = array($fetch1['xcorp_no']);
                          $icar2x = COUNT($icar2);
                          $i2cs2 += $icar2x;
                        }
                        if ($fetch1['xcorp_no'] == "EYM") {
                          $icar3 = array($fetch1['xcorp_no']);
                          $icar3x = COUNT($icar3);
                          $i2cs3 += $icar3x;
                        }
                        if ($fetch1['xcorp_no'] == "EHK") {
                          $icar4 = array($fetch1['xcorp_no']);
                          $icar4x = COUNT($icar4);
                          $i2cs4 += $icar4x;
                        }
                        if ($fetch1['xcorp_no'] == "EP") {
                          $icar5 = array($fetch1['xcorp_no']);
                          $icar5x = COUNT($icar5);
                          $i2cs5 += $icar5x;
                        }
                        if ($fetch1['xcorp_no'] == "EMB") {
                          $icar6 = array($fetch1['xcorp_no']);
                          $icar6x = COUNT($icar6);
                          $i2cs6 += $icar6x;
                        }
                        if ($fetch1['xcorp_no'] == "EMM" || $fetch1['xcorp_no'] == "MTM") {
                          $icar7 = array($fetch1['xcorp_no']);
                          $icar7x = COUNT($icar7);
                          $i2cs7 += $icar7x;
                        }
                        if ($fetch1['xcorp_no'] == "EML") {
                          $icar8 = array($fetch1['xcorp_no']);
                          $icar8x = COUNT($icar8);
                          $i2cs8 += $icar8x;
                        }
                        if ($fetch1['xcorp_no'] == "MST" || $fetch1['xcorp_no'] == "มีส") {
                          $icar9 = array($fetch1['xcorp_no']);
                          $icar9x = COUNT($icar9);
                          $i2cs9 += $icar9x;
                        }
                      }
                    }
                    $sumics = $ics1+$ics2+$ics3+$ics4+$ics5+$ics6+$ics7+$ics8+$ics9;
                    $sumi2cs = $i2cs1+$i2cs2+$i2cs3+$i2cs4+$i2cs5+$i2cs6+$i2cs7+$i2cs8+$i2cs9;
                    $sum1icar = $ics1+$i2cs1; $sum2icar = $ics2+$i2cs2; $sum3icar = $ics3+$i2cs3; $sum4icar = $ics4+$i2cs4; $sum5icar = $ics5+$i2cs5;
                    $sum6icar = $ics6+$i2cs6; $sum7icar = $ics7+$i2cs7; $sum8icar = $ics8+$i2cs8; $sum9icar = $ics9+$i2cs9;
                    $sumicar2 = $sum1icar+$sum2icar+$sum3icar+$sum4icar+$sum5icar+$sum6icar+$sum7icar+$sum8icar+$sum9icar;

                    $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 bill_no as reg_bill_no,plcno,plcdate,plcexp from [EHONGDB].[dbo].[reg_billdatadocument] WHERE FEE_NO = '11' and (plcno is not null) ) ax1 on(ax1.reg_bill_no=a.bill_no)
                    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)
                    left outer join(SELECT BILL_NO as EBILL_NO,ACT_DATE FROM [CONFIG].[dbo].[ACT_EXPOST]) e on(a.bill_no=e.EBILL_NO)
                    left outer JOIN(SELECT BILL_NO as sBILL_NO,ACT_STATUS,ACT_USDATE FROM CONFIG.dbo.ACT_STATUSEXPOST) dx on(a.bill_no=dx.sBILL_NO)
                    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;
                    $B10 = '0.00';
                    $B10x = '10.00';
                    $SUMFEE_SUMPRICE = '0';
                    $SUMFEE_PRICE = '0';
                    $SUMB10 = '0';
                    $SUM_x1 = '0';
                    $SUM_x2 = '0';
                    $SUMB10X = '0';
                    $icar1c = '0'; $icar2c = '0'; $icar3c = '0'; $icar4c = '0'; $icar5c = '0'; $icar6c = '0'; $icar7c = '0'; $icar8c = '0'; $icar9c = '0'; $icar10c = '0';
                    $Sumicar = '0';
                    while($fetch=$select->fetch()){
                    $FEE_PRICE = number_format($fetch['FEE_PRICE']-$B10,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 = '';
                    }
                    include 'act_sum_1.php';
                    $SUMB10X += $B10x;
                    // echo $CROP_NAME;
                    if ($CROP_NAME == "บริษัท มดแดงลิสซิ่ง จำกัด") {
                      $icar1 = array($CROP_NAME);
                      $icar1x = COUNT($icar1);
                      $icar1c += $icar1x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงฮอนด้า จำกัด") {
                      $icar2 = array($CROP_NAME);
                      $icar2x = COUNT($icar2);
                      $icar2c += $icar2x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงยามาฮ่า จำกัด") {
                      $icar3 = array($CROP_NAME);
                      $icar3x = COUNT($icar3);
                      $icar3c += $icar3x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงคาวาซากิ จำกัด") {
                      $icar4 = array($CROP_NAME);
                      $icar4x = COUNT($icar4);
                      $icar4c += $icar4x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงพยัคฆ์") {
                      $icar5 = array($CROP_NAME);
                      $icar5x = COUNT($icar5);
                      $icar5c += $icar5x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงมอเตอร์ไบค์ จำกัด") {
                      $icar6 = array($CROP_NAME);
                      $icar6x = COUNT($icar6);
                      $icar6c += $icar6x;
                    }
                    if ($CROP_NAME == "บริษัท มดแดงมอเตอร์เมค จำกัด") {
                      $icar7 = array($CROP_NAME);
                      $icar7x = COUNT($icar7);
                      $icar7c += $icar7x;
                    }
                    if ($CROP_NAME == "บริษัท อีฮงมดแดงมอเตอร์ ลิส จำกัด") {
                      $icar8 = array($CROP_NAME);
                      $icar8x = COUNT($icar8);
                      $icar8c += $icar8x;
                    }
                    if ($CROP_NAME == "บริษัท มีสติมอเตอร์ จำกัด") {
                      $icar9 = array($CROP_NAME);
                      $icar9x = COUNT($icar9);
                      $icar9c += $icar9x;
                    }
                    if ($FEE_STATUSX == "04") {
                      $icar10 = array($CROP_NAME);
                      $icar10x = COUNT($icar10);
                      $icar10c += $icar10x;
                    }
                    // if ($CROP_NAME != "บริษัท มีสติมอเตอร์ จำกัด" && $CROP_NAME != "บริษัท อีฮงมดแดงมอเตอร์ ลิส จำกัด" && $CROP_NAME != "บริษัท มดแดงมอเตอร์เมค จำกัด" && $CROP_NAME != "บริษัท อีฮงมดแดงมอเตอร์ไบค์ จำกัด" && $CROP_NAME != "บริษัท อีฮงพยัคฆ์" &&
                    // $CROP_NAME != "บริษัท มดแดงลิสซิ่ง จำกัด" && $CROP_NAME != "บริษัท อีฮงฮอนด้า จำกัด" && $CROP_NAME != "บริษัท อีฮงมดแดงยามาฮ่า จำกัด" && $CROP_NAME != "บริษัท อีฮงมดแดงคาวาซากิ จำกัด") {
                    //   echo $item." ".$CROP_NAME."<br>";
                    // }
                    // echo $item." ".$CROP_NAME."<br>";
                    $item++;
                  }
                  $Sumicar = $icar1c+$icar2c+$icar3c+$icar4c+$icar5c+$icar6c+$icar7c+$icar8c+$icar9c;
                  $sum12icer = $Sumicar-$sumicar2;
                  $sum12icer1 = $Sumicar-$sum12icer;
                  ?>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">1.</td>
                    <td style="background-color:; color:; text-align:;">บริษัท มดแดงลิสซิ่ง จำกัด</td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMD&type_sale=1" target="_blank"><?php echo number_format($ics1,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMD&type_sale=2" target="_blank"><?php echo number_format($i2cs1,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum1icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท มดแดงลิสซิ่ง จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar1c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EH&type_sale=1" target="_blank"><?php echo number_format($ics2,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EH&type_sale=2" target="_blank"><?php echo number_format($i2cs2,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum2icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงฮอนด้า จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar2c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EYM&type_sale=1" target="_blank"><?php echo number_format($ics3,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EYM&type_sale=2" target="_blank"><?php echo number_format($i2cs3,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum3icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงมดแดงยามาฮ่า จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar3c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EHK&type_sale=1" target="_blank"><?php echo number_format($ics4,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EHK&type_sale=2" target="_blank"><?php echo number_format($i2cs4,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum4icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงมดแดงคาวาซากิ จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar4c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EP&type_sale=1" target="_blank"><?php echo number_format($ics5,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EP&type_sale=2" target="_blank"><?php echo number_format($i2cs5,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum5icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงพยัคฆ์&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar5c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMB&type_sale=1" target="_blank"><?php echo number_format($ics6,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMB&type_sale=2" target="_blank"><?php echo number_format($i2cs6,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum6icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงมดแดงมอเตอร์ไบค์ จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar6c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMM&type_sale=1" target="_blank"><?php echo number_format($ics7,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EMM&type_sale=2" target="_blank"><?php echo number_format($i2cs7,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum7icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท มดแดงมอเตอร์เมค จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar7c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EML&type_sale=1" target="_blank"><?php echo number_format($ics8,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=EML&type_sale=2" target="_blank"><?php echo number_format($i2cs8,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum8icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท อีฮงมดแดงมอเตอร์ ลิส จำกัด&STATUSXS=1&&G04=" target="_blank"><?php echo number_format($icar8c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></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:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=MST&type_sale=1" target="_blank"><?php echo number_format($ics9,2); ?></a></td>
                    <td style="background-color:; color:blue; text-align:right;"><a class="text-blue" href="act_index_8.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&xcorp_no=MST&type_sale=2" target="_blank"><?php echo number_format($i2cs9,2); ?></a></td>
                    <td style="background-color:; color:green; text-align:right;"><?php echo number_format($sum9icar,2); ?></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=บริษัท มีสติมอเตอร์ จำกัด&STATUSXS=1&&G04=04" target="_blank"><?php echo number_format($icar9c,2); ?></a></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                  </tr>
                  <tr>
                    <td style="background-color:yellow; color:black; text-align:right;">10.</td>
                    <td style="background-color:yellow; color:black; text-align:;">รวม (1,2,3,4,5)</td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b><?php echo number_format($sumics,2); ?><b></td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b><?php echo number_format($sumi2cs,2); ?><b></td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b><?php echo number_format($sumicar2,2); ?><b></td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b><?php echo number_format($Sumicar,2); ?></b></td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b></b></td>
                    <td style="background-color:yellow; color:black; text-align:right;"><b></b></td>
                  </tr>
                  <tr>
                    <td style="background-color:; color:; text-align:right;">11.</td>
                    <td style="background-color:; color:; text-align:;">ต่อ พ.ร.บ. (2 ปีเป็นต้นไป) (4,5)</td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:red; text-align:right;"> <a class="text-red" href="act_index_7.php?DMY_1=<?php echo $DMY_1; ?>&DMY_2=<?php echo $DMY_2; ?>&CROP_NAME1=&STATUSXS=1&G04=04" target="_blank"><?php echo number_format($icar10c,2); ?></a></td>
                    <!-- <td style="background-color:; color:; text-align:right;"><b><?php echo number_format($icar10c,2); ?></b></td> -->
                    <td style="background-color:; color:; text-align:right;"></td>
                    <td style="background-color:; color:; text-align:right;"></td>
                  </tr>
                </tbody>
                <tfoot>
                  <td colspan="2" style="background-color:black; color:#fff; text-align:center;"><b>คงเหลือ (1,2,3)</b></td>
                  <td style="background-color:black; color:#fff; text-align:right;"><b><?php echo number_format($sumics,2); ?><b></td>
                  <td style="background-color:black; color:#fff; text-align:right;"><b><?php echo number_format($sumi2cs,2); ?><b></td>
                  <td style="background-color:black; color:#fff; text-align:right;"><b><?php echo number_format($sumicar2,2); ?><b></td>
                  <td style="background-color:black; color:#fff; text-align:right;"><b><?php echo number_format($sum12icer1,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>
                </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>
