<? 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="Output GST Report from ".date("d-m-Y", strtotime($stdt))." to ".date("d-m-Y", strtotime($enddt));
         ?>
      <title>Output GST Report from <?=date("d-m-Y", strtotime($stdt))?> to <?=date("d-m-Y", strtotime($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><br>
<center><?=$title?></center>
<br><br>
      <table class="stripe">
         <thead>
            <tr>
               <th class="table-plus datatable-nosort">Sl. No</th>
               <th>Paid For</th>
               <th>Date</th>
               <th>Details</th>
               <th>Amount</th>
               <th>CGST</th>
               <th>SGST</th>
               <th>IGST</th>
                
               
            </tr>
         </thead>
         <tbody>
            <?
              //echo "SELECT * FROM `tbl_trans` WHERE trn_gst='1' AND trn_ac='EXPENSE AC' AND trn_date BETWEEN '$stdt' AND '$enddt'";
               $query=mysqli_query($con,"SELECT * FROM `tbl_trans` WHERE trn_gst='1' AND trn_type='EXPENSE AC' AND trn_date BETWEEN '$stdt' AND '$enddt'");
               while($arrc=mysqli_fetch_array($query)){$c++;
               
                  $gstamt=$arrc['trn_gamt'];
                  $total=floatval($total)+floatval($arrc['trn_amt']);

                  if($arrc['trn_igst']!='1'){

                    $gsth=round(floatval($gstamt)/2,2);
                  $totsgst=floatval($totsgst)+floatval($gsth);
                  $igst=0;

                  }else{

                    $gsth='0';
                    $igst=round(floatval($gstamt)/2,2);
                  $totigst=floatval($totigst)+floatval($igst);

                  }
                  
               ?>
            <tr>
               <td class="table-plus"><?=$c?></td>
               <td><?=$arrc['trn_name']?></td>
               <td><?=date("d-m-Y", strtotime($arrc['trn_date']))?></td>
               <td><?=$arrc['trn_memo']?></td>
               <td><?=$arrc['trn_amt']?></td>
               
               <td><?=$gsth?></td>
               <td><?=$gsth?></td>
               <td><?=$igst?></td>
               
            </tr>
            <?}?>	
         </tbody>
         <tfoot>
            <tr>
               <td class="table-plus"></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>
                <td><b><?=$totigst?></b></td>
                 

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

