
<table border="1">
  <tr>
    <th>0.</th>
    <th>0.</th>
    <th>1.บริษัทที่เป็นเจ้าของรถ</th>
    <th>2.ลงในนาม</th>
  </tr>
<?php
include '_connect.php';
$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 '2020-07-01' and '2020-09-30'
order by a.rectime,a.br_id,a.bill_date";
// echo $sql;
$select=$conn->prepare($sql);
$select->execute();
$item = 1;
$B10 = '10.00';
$SUMFEE_SUMPRICE = '0';
$SUMFEE_PRICE = '0';
$SUMB10 = '0';
$SUM_x1 = '0';
$SUM_x2 = '0';
$FEE_PRICE = '0';
while($fetch=$select->fetch()){
  include 'act_sum_1.php';
?>
  <tr>
    <td><?php echo $FEE_STATUSX; ?></td>
    <td><?php echo $FEE_STATUSX1; ?></td>
    <td><?php echo $fetch['CROP_NAME']; ?></td>
    <td><?php echo $CROP_NAME; ?></td>
  </tr>
<?php } ?>

</table>
