<? include "top.php"; ?>
<!DOCTYPE html>
<html>
   <head>
      <?php include('include/head.php'); 
         $stdt=$_POST['stdt'];
         $enddt=$_POST['enddt'];

         $getcom=f(q("SELECT * FROM tbl_company WHERE c_id=1"));
         $title="Input GST Report from ".date("d-m-Y", strtotime($stdt))." to ".date("d-m-Y", strtotime($enddt));
         ?>
      <title>Total Payment Report from <?=$stdt?> to <?=$enddt?></title>
      
      <style type="text/css" media="print">
 @page {
  size: auto;
}
</style>
   <style type="text/css">
      table{

         width: 100%;
      }
      th{

      font-size: 13px !important;
      min-width: 60px;
      padding: 4px;
      text-align: center;
      background-color: #e5eef5;
      color: #5c5c5c;
      border-right: 1px solid white;
      -webkit-print-color-adjust: exact; 
    }
    td{

      font-size: 12px !important;
      text-align: center;
      border: 1px solid gray;

    }
    tr{

      width: 100%;

    }
    .trtot{

      background-color: #e5eef5;
      color: #5c5c5c;
    }
    .noborder{

      border:0px white;
    }
   </style>
   </head>
   <body style="background-color: white !important;padding-left: 5%;padding-right: 5%;">
      <table>
   <tr>
      <td style="border:0px;font-size: 14px;">
         <h3 style="font-weight: bold;color:#0a6587;line-height: 45px;vertical-align: middle; "><img src="vendors/images/logo.png"><?=$getcom['c_name']?></h3>
         <h6><?=$getcom['c_address']?></h6>
         <b>Phone:</b> <?=$getcom['c_phone']?>, <b>Mobile:</b><?=$getcom['c_mobile']?><br>
          <b>GSTN:</b> <?=$getcom['c_emailalt']?>
      </td>
   </tr>
   
</table><br>
<center><?=$title?></center>
<br><br>
      <table class="stripe">
         <thead>
            <tr>
               <th class="table-plus datatable-nosort">Sl. No</th>
               <th>Date</th>
               <th>Customer Id</th>
               <th>Customer Name</th>
               <th>Bill No</th>
               
               <th>Phone</th>
               <th>Address</th>
               <th>Total(in Rs.)</th>
               <th>CGST</th>
               <th>SGST</th>
               
            </tr>
         </thead>
         <tbody>
            <?
               $query=mysqli_query($con,"SELECT * FROM `cbill` WHERE bl_stat='1' AND bl_paydt BETWEEN '$stdt' AND '$enddt'");
               while($arrc=mysqli_fetch_array($query)){$c++;
               $row=f(q("SELECT * FROM `adduser` WHERE id=$arrc[bl_cid]"));
                  $total=floatval($total)+floatval($arrc['bl_amt']);
                  $paid=floatval($paid)+floatval($arrc['bl_payamt']);
                  $dues=floatval($dues)+floatval($arrc['bl_due']);
                  $packamt=$arrc['bl_amt'];
                  $gstamt=round((floatval($packamt)*(18/118)),2);

                  $gsth=round(floatval($gstamt)/2,2);
                  $totsgst=floatval($totsgst)+floatval($gsth);
               ?>
            <tr>
               <td class="table-plus"><?=$c?></td>
               <td><?=date("d-m-Y", strtotime($arrc['bl_paydt']))?></td>
               <td><?=$row['custid']?></td>
               <td><?=$row['name']?></td>
               <td><?=$arrc['blid']?></td>
                
               <td><?=$row['phone']?></td>
               <td><?=$row['address']?></td>
                <td><?=$arrc['bl_amt']?></td>
               <td><?=$gsth?></td>
               <td><?=$gsth?></td>
               
            </tr>
            <?}?>	
         </tbody>
         <tfoot>
            <tr>
               <td class="table-plus"></td>
               
                <td></td>
                 <td></td>
                 <td></td>
               <td></td>
               <td></td>
               <td><b>Total</b></td>
               <td><b><?=$total?></b></td>
                <td><b><?=$totsgst?></b></td>
                <td><b><?=$totsgst?></b></td>
                 

            </tr> 
            </tfoot>
      </table><br><br>
      <?php include('include/script.php'); ?>
      
   </body>
</html>

