
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php

session_start();
date_default_timezone_set('Asia/Colombo');
?>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    <title><?php echo $_GET['type']?> REPORT</title>

    <style>
        .center {
            text-align: center;
        }

        .right {
            text-align: right;
        }

        .tb  {
           width: 1100px;
           border: 1px solid black;


           border-collapse: collapse;
       }
        
       .tb td  {

           border-top: 1px solid black;
           border-left: 1px solid black;
           font-size:18px;

           border-collapse: collapse;
       }
       .tb th  {

           border-top: 1px solid black;
           border-left: 1px solid black;


           border-collapse: collapse;
       }
       .tb2  {
           
           border: 1px solid black;


           border-collapse: collapse;
       }
       .tb2 td  {

           border-top: 1px solid black;
           border-left: 1px solid black;
           font-size:18px;

           border-collapse: collapse;
       }
       .tb2 th  {

           border-top: 1px solid black;
           border-left: 1px solid black;


           border-collapse: collapse;
       }

       .tb1 {

           border: 1px solid #000000;
       }
 

   </style>

</head>
<?php
require_once ("connection_sql.php");

 

$sql_invpara = "SELECT * from invpara";
$result_invpara = $conn->query($sql_invpara);
$row_invpara = $result_invpara->fetch(); 






?>
<body>
    <center>
    <table width="1100px;" cellspacing="0" border="0">

        <tr>
            <th class="center"  colspan=5 ><?php echo $row_invpara['COMPANY']; ?></th>
        </tr> 
        
        <tr> 
            <th class='center' colspan='5'> <?php echo $_GET['type']?> REPORT - (<?php echo date('Y-m-d H:i:s');?>)</th> 
        </tr>
         
        <tr> 
            <th class='center' colspan='5'> <?php echo $_GET['dtfrom']?> To - <?php echo $_GET['dtfrom']?></th> 
        </tr>
           <tr> 
        <?php 
         if($_GET['Txtcusco'] !=""){
            
?>
            <th class='center' colspan='5'>Customer Wise - (<?php echo $_GET['Txtcusco']?> ) </th> 
           <?php } ?>
        </tr> 
        <tr> 
        <?php 
         if($_GET['company'] !=""){
            $sql_sto = "SELECT * from s_stomas where CODE='".$_GET['company']."'";
            $result_sto= $conn->query($sql_sto);
            $row_sto = $result_sto->fetch(); 
?>
            <th class='center' colspan='5'>Company Wise - (<?php echo $row_sto['DESCRIPTION']?> ) </th> 
           <?php } ?>
        </tr> 
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td align="right">&nbsp;</td>
        </tr>
        
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
       
    </table>
<!--==================================================================================-->
   <?php if($_GET['type'] == "SUMMERY"){?>
                <table class="tb" width="1100px;" >
                <tr >
        
                   <th width="30px;">NO</th> 
                    <th width="100px;">COMPANY</th> 
                    <th width="120px;">GRAND TOTAL</th> 
                    <th width="100px;">PAID</th> 
                    <th width="100px;">BALANCE</th> 
                </tr>
                <?php
                $i=1;  
                $part="";
                $BAL=0;
                $sql1 = "Select sum(GRAND_TOT) AS GRAND_TOT,sum(TOTPAY) AS TOTPAY,sum(GRAND_TOT-TOTPAY) AS BAL,DEPARTMENT from s_salma  where CANCELL='0' and TRN_TYPE='INV' AND SDATE >='" . $_GET["dtfrom"] . "' and SDATE <='" . $_GET["dtto"] . "'";
                  
                if($_GET['company'] !=""){
                     $sql1.=" and DEPARTMENT='".$_GET['company']."'"; 
                }
                  if($_GET['Txtcusco'] !=""){
                     $sql1.=" and C_CODE='".$_GET['Txtcusco']."'"; 
                }
                
                $sql1.=" group by DEPARTMENT"; 
                
     
                $i=1;
                foreach ($conn->query($sql1) as $row1) {
                    $sql_sto1 = "SELECT * from s_stomas where CODE='".$row1['DEPARTMENT']."'";
                    $result_sto1= $conn->query($sql_sto1);
                    $row_sto1 = $result_sto1->fetch(); 
                    ?>
                    <tr style="font-size:13px;">
           
                        <td class="center" style='font-size:20px;'><?php echo $i ?></td>
                        <td class="left"  style='font-size:20px;'><?php echo $row_sto1['DESCRIPTION']; ?> </td> 
                        <td align="right" style='font-size:20px;'><?php echo number_format($row1['GRAND_TOT'], 2, ".", ","); ?></td> 
                        <td align="right" style='font-size:20px;'><?php echo number_format($row1['TOTPAY'], 2, ".", ","); ?></td> 
                        <td align="right" style='font-size:20px;'><?php echo number_format($row1['BAL'], 2, ".", ","); ?></td> 
                    </tr>
                    <?php
                     $i=$i+1;
                     $company=$row1['DEPARTMENT']; 
                     
                     $GTOT=$GTOT+$row1['GRAND_TOT'];
                     $TOTPAY=$TOTPAY+$row1['TOTPAY'];
                     $BAL=$BAL+$row1['BAL'] ;
                }
                ?>
           
           
            <tr> 
                <td  align="right" colspan='2' style='font-size:20px;'><b></b></td> 
                <td align="right" style='font-size:24px;'><b><?php   echo number_format($GTOT, 2, ".", ",");  ?><b/></td>
                <td align="right" style='font-size:24px;'><b><?php   echo number_format($TOTPAY, 2, ".", ",");  ?><b/></td>
                <td align="right" style='font-size:24px;'><b><?php   echo number_format($BAL, 2, ".", ",");  ?><b/></td>
            </tr>
            
            
        </table>
    
 <?php }else{?>
       <table class="tb" width="1100px;" >
                 <tr style='background-color:#c4f2c4'>
                    <td class="center" colspan='12'><b>PAYMENTS</b></td> </tr>
                </tr>        
                <tr >
        
                    <th width="30px;">NO</th> 
                    <th width="100px;">REFNO</th>
                    <th width="80px;">DATE</th>
                    <th width="400px;">CUSTOMER</th>   
                    <th width="80px;">CASH</th> 
                    <th width="80px;">CHEQUE</th> 
                    <th width="100px;">CASH TT</th> 
                    <th width="100px;">CARD</th> 
                    <th width="100px;">ONLINE PAY</th> 
                    <th width="100px;">J/ENTRY</th> 
                    <th width="100px;">UTILIZE</th> 
                     
                </tr>
                <?php
                $i=1;  
                $part="";
                $BAL=0;
                $sql1 = "Select * from view_salma_s_sttr  where   ST_DATE >='" . $_GET["dtfrom"] . "' and ST_DATE <='" . $_GET["dtto"] . "' and CANCELL='0'";
                
                
                if($_GET['company'] !=""){
                     $sql1.=" and SALMA_DEP='".$_GET['company']."'"; 
                }
                
                if($_GET['paytype'] !=""){
                     $sql1.=" and ST_FLAG='".$_GET['paytype']."'"; 
                }
                  if($_GET['Txtcusco'] !=""){
                     $sql1.=" and C_CODE='".$_GET['Txtcusco']."'"; 
                }
                $sql1.=" order by SALMA_DEP,ST_REFNO";
                 
 
                $i=0;
                $company="";
                 $cashpay_tot=0;
                 $chequepay_tot=0;
                 $cashttpay_tot=0;
                 $cardpay_tot=0;
                 $onlinepay_tot=0;
                 $jentrypay_tot=0;
                 $utlizepay_tot=0;
                foreach ($conn->query($sql1) as $row1) {
                     $sql_sto1 = "SELECT * from s_stomas where CODE='".$row1['SALMA_DEP']."'";
                    $result_sto1= $conn->query($sql_sto1);
                    $row_sto1 = $result_sto1->fetch(); 
                    ?>
                    <tr style="font-size:13px;">
          
                        <?php  
                        
                        if($company!=$row1['SALMA_DEP']){
                           if($i !=0){
                                echo "<tr>
                                 <td colspan='4'><b>   </b></td>
                                <td colspan='1' align=right><b>  ".number_format($cashpay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($chequepay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($cashttpay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($cardpay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($onlinepay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($jentrypay_tot, 2, ".", ",") ."   </b></td> 
                                <td colspan='1' align=right><b>  ".number_format($utlizepay_tot, 2, ".", ",") ."   </b></td> 
                                </tr>";
                                
                           } 
                            $i = 1;
                            echo "<tr>
                                    <td colspan='11'><b>  ". $row_sto1['DESCRIPTION'] ."   </b></td> </tr>";
                                    
                                if($row1['ST_FLAG'] =='CAS'){
                                     $cashpay_tot=$row1['ST_PAID'];  
                                }else if($row1['ST_FLAG'] =='CHK'){
                                     $chequepay_tot=$row1['ST_PAID'];   
                                }else if($row1['ST_FLAG'] =='Cash TT'){
                                     $cashttpay_tot=$row1['ST_PAID'];  
                                // }else if($row1['ST_FLAG'] =='Card'){
                                //      $cardpay_tot=$row1['ST_PAID']; 
                                // }else if($row1['ST_FLAG'] =='Online Payment'){
                                //      $onlinepay_tot=$row1['ST_PAID']; 
                                // }else if($row1['ST_FLAG'] =='J/Entry'){
                                //      $jentrypay_tot=$row1['ST_PAID']; 
                                }else if($row1['ST_FLAG'] =='UT'){
                                     $utlizepay_tot=$row1['ST_PAID']; 
                                } 
                                 
                             
                        }else{ 
                            
                            if($row1['ST_FLAG'] =='CAS'){
                                     $cashpay_tot +=$row1['ST_PAID'];  
                                }else if($row1['ST_FLAG'] =='CHK'){
                                     $chequepay_tot +=$row1['ST_PAID'];   
                                }else if($row1['ST_FLAG'] =='Cash TT'){
                                     $cashttpay_tot +=$row1['ST_PAID'];  
                                // }else if($row1['ST_FLAG'] =='Card'){
                                //      $cardpay_tot +=$row1['ST_PAID']; 
                                // }else if($row1['ST_FLAG'] =='Online Payment'){
                                //      $onlinepay_tot +=$row1['ST_PAID']; 
                                // }else if($row1['ST_FLAG'] =='J/Entry'){
                                //      $jentrypay_tot +=$row1['ST_PAID']; 
                                }else if($row1['ST_FLAG'] =='UT'){
                                     $utlizepay_tot +=$row1['ST_PAID']; 
                                } 
                                 
                                
                        }
                        ?>
                        <td class="center" style='font-size:12px;'><?php echo $i ?></td>
                        <td class="left"  style='font-size:12px;'><?php echo $row1['ST_REFNO']; ?> </td>
                        <td class="left"  style='font-size:12px;'><?php echo $row1['ST_DATE']; ?> </td> 
                        <td class="left"  style='font-size:12px;'> <?php echo $row1['CUS_NAME']; ?> </td>  
                      <?php  if($row1['ST_FLAG'] =='CAS'){
                                     $cashpay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($row1['ST_PAID'], 2, ".", ",")." </td> ";
                                }else{ 
                                     $cashpay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                } 
                                
                                if($row1['ST_FLAG'] =='CHK'){
                                     $chequepay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($chequepay, 2, ".", ",")." </td> ";
                                }else{ 
                                    $chequepay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                } 
                                
                                if($row1['ST_FLAG'] =='Cash TT'){
                                     $cashttpay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($cashttpay, 2, ".", ",")." </td> ";
                                }else{ 
                                    $cashttpay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                }
                                
                                if($row1['ST_FLAG'] =='Card'){
                                     $cardpay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($cardpay, 2, ".", ",")." </td> ";
                                }else{ 
                                     $cardpay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                }
                                
                                if($row1['ST_FLAG'] =='Online Payment'){
                                     $onlinepay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($onlinepay, 2, ".", ",")." </td> ";
                                }else{ 
                                    $onlinepay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                }
                                
                                if($row1['ST_FLAG'] =='J/Entry'){
                                     $jentrypay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($jentrypay, 2, ".", ",")." </td> ";
                                }else{ 
                                    $jentrypay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                }
                                
                                if($row1['ST_FLAG'] =='UT'){
                                     $utlizepay=$row1['ST_PAID']; 
                                     echo"<td class='right'  style='font-size:12px;'>". number_format($utlizepay, 2, ".", ",")." </td> ";
                                }else{ 
                                    $utlizepay=0; 
                                     echo"<td class='right'  style='font-size:12px;'> </td> ";
                                }
                                
                        
                        
                        ?>
                           
                    </tr>
                    
                     
                    <?php
                     $i=$i+1;
                     $company=$row1['SALMA_DEP']; 
                     
                     $cashpay_totmain=$cashpay_totmain+$cashpay;
                     $chequepay_totmain=$chequepay_totmain+$chequepay;
                     $cashttpay_totmain=$cashttpay_totmain+$cashttpay;
                     $cardpay_totmain=$cardpay_totmain+$cardpay;
                     $onlinepay_totmain=$onlinepay_totmain+$onlinepay;
                     $jentrypay_totmain=$jentrypay_totmain+$jentrypay;
                     $utlizepay_totmain=$utlizepay_totmain+$utlizepay;
                }
                ?>
           
           
            <tr> 
                <td  align="right" colspan='4' style='font-size:20px;'><b></b></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cashpay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($chequepay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cashttpay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cardpay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($onlinepay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($jentrypay_tot, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($utlizepay_tot, 2, ".", ",");  ?><b/></td> 
            </tr>
            
            <tr> 
                <td  align="right" colspan='4' style='font-size:20px;'><b></b></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cashpay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($chequepay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cashttpay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($cardpay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($onlinepay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($jentrypay_totmain, 2, ".", ",");  ?><b/></td> 
                <td align="right" style='font-size:20px;'><b><?php   echo number_format($utlizepay_totmain, 2, ".", ",");  ?><b/></td> 
            </tr>
            
            <!--<tr style='background-color:#e2e288'>-->
            <!--        <td class="center" colspan='12'><b>EXPENSES</b></td> </tr>-->
            <!--</tr>  -->
            
            <!--<tr >-->
            <!--    <th width="30px;">NO</th> -->
            <!--    <th width="100px;">REFNO</th>-->
            <!--    <th width="80px;">DATE</th>-->
            <!--    <th width="300px;">TYPE</th>   -->
            <!--    <th width="100px;">AMOUNT</th>-->
            <!--    <th colspan='6'>REMARK</th>-->
                 
            <!--</tr>-->
            
            <?php
                // $j=1;  
                // $ii=0;
                // $sql_exp = "Select * from s_expenses where  SDATE >='" . $_GET["dtfrom"] . "' and SDATE <='" . $_GET["dtto"] . "' and CANCELL='0' and TYPE != 'EX/0022'";
                 
                // if($_GET['company'] !=""){
                //      $sql_exp.=" and COMPANY='".$_GET['company']."'"; 
                // }
                 
                // $sql_exp.=" order by DEPARTMENT,REFNO"; 
                // foreach ($conn->query($sql_exp) as $row_exp) {
                //     $sql_ext = "SELECT * from s_expense_type where REFNO='".$row_exp['TYPE']."'";
                //     $result_ext= $conn->query($sql_ext);
                //     $row_ext = $result_ext->fetch(); 
                    
                    
                //       $sql_sto11 = "SELECT * from s_stomas where CODE='".$row_exp['DEPARTMENT']."'";
                //     $result_sto11= $conn->query($sql_sto11);
                //     $row_sto11 = $result_sto11->fetch(); 
                      
                //         if($expdep!=$row_exp['DEPARTMENT']){
                //           if($ii !=0){
                //                 echo "<tr style='background-color:#e2e288'>
                //                  <td colspan='4'><b>   </b></td>
                //                 <td colspan='1' align=right><b>  ".number_format($exp_sub, 2, ".", ",") ."   </b></td>
                //                 <td colspan='6'><b>   </b></td>
                //                 </tr>";
                                
                //           } 
                //             $ii = 1;
                //             echo "<tr>
                //                     <td colspan='12'><b>  ". $row_sto11['DESCRIPTION'] ."   </b></td> </tr>";
                //             $exp_sub=$row_exp['AMOUNT'];
                             
                //         }else{
                //             $exp_sub=$exp_sub+$row_exp['AMOUNT'];
                //         }
                    ?>
                    <!--<tr style="font-size:13px;">-->
          
                    <!--    <td class="center" style='font-size:12px;'><?php echo $j ?></td>-->
                    <!--    <td class="left"  style='font-size:12px;'><?php echo $row_exp['REFNO']; ?> </td>-->
                    <!--    <td class="left"  style='font-size:12px;'><?php echo $row_exp['SDATE']; ?> </td> -->
                    <!--    <td class="left"  style='font-size:12px;'><?php echo $row_ext['NAME']; ?> </td>-->
                    <!--    <td class="right"  style='font-size:12px;'><?php echo $row_exp['AMOUNT']; ?> </td>-->
                    <!--    <td class="left"  style='font-size:12px;' colspan='6'>&nbsp;<?php echo $row_exp['REMARK']; ?> </td>-->
                    <!--</tr>-->
                    
                     
                    <?php
                //      $j=$j+1;
                //      $expdep=$row_exp['DEPARTMENT']; 
                //      $exp_tot= $exp_tot+$row_exp['AMOUNT'];
                     
                // }
            ?>
            
            <!--<tr>-->
            <!--    <td  align="right" colspan='4' style='font-size:20px;'><b></b></td>-->
            <!--    <td align="right" style='font-size:20px;'><b><?php   echo number_format($exp_sub, 2, ".", ",");  ?><b/></td>-->
            <!--    <td colspan='6' style='font-size:12px;'></td>-->
            <!--</tr>-->
            <!-- <tr>-->
            <!--    <td  align="right" colspan='4' style='font-size:20px;'><b></b></td>-->
            <!--    <td align="right" style='font-size:20px;'><b><?php   echo number_format($exp_tot, 2, ".", ",");  ?><b/></td>-->
            <!--    <td colspan='6' style='font-size:12px;'></td>-->
            <!--</tr>-->

            
            <!--<tr style='background-color:#87cefa'>-->
            <!--        <td class="center" colspan='12'><b>CASH BOOK IN</b></td> </tr>-->
            <!--</tr>  -->
            
            <!--<tr >-->
            <!--    <th width="30px;">NO</th> -->
            <!--    <th width="100px;">REFNO</th>-->
            <!--    <th width="80px;">DATE</th>-->
            <!--    <th width="300px;">TYPE</th>   -->
            <!--    <th width="100px;">AMOUNT</th>-->
            <!--    <th colspan='6'>REMARK</th>-->
                 
            <!--</tr>-->
            <?php
                // $g=1;  
                // $iii=0;
                // $sql_exp_cb = "Select * from s_expenses where  SDATE >='" . $_GET["dtfrom"] . "' and SDATE <='" . $_GET["dtto"] . "' and CANCELL='0' and TYPE= 'EX/0022'";
                 
                // if($_GET['company'] !=""){
                //      $sql_exp_cb.=" and COMPANY='".$_GET['company']."'"; 
                // }
                 
                // $sql_exp_cb.=" order by DEPARTMENT,REFNO"; 
                // foreach ($conn->query($sql_exp_cb) as $row_exp_cb) {
                //     $sql_ext_cb = "SELECT * from s_expense_type where REFNO='".$row_exp_cb['TYPE']."'";
                //     $result_ext_cb= $conn->query($sql_ext_cb);
                //     $row_ext_cb = $result_ext_cb->fetch(); 
                    
                    
                //     $sql_sto111 = "SELECT * from s_stomas where CODE='".$row_exp_cb['DEPARTMENT']."'";
                //     $result_sto111= $conn->query($sql_sto111);
                //     $row_sto111 = $result_sto111->fetch(); 
                      
                //         if($expdep!=$row_exp_cb['DEPARTMENT']){
                //           if($iii !=0){
                //                 echo "<tr style='background-color:#e2e288'>
                //                  <td colspan='4'><b>   </b></td>
                //                 <td colspan='1' align=right><b>  ".number_format($exp_sub, 2, ".", ",") ."   </b></td>
                //                 <td colspan='6'><b>   </b></td>
                //                 </tr>";
                                
                //           } 
                //             $iii = 1;
                //             echo "<tr>
                //                     <td colspan='12'><b>  ". $row_sto111['DESCRIPTION'] ."   </b></td> </tr>";
                //             $exp_sub_cb=$row_exp_cb['AMOUNT'];
                             
                //         }else{
                //             $exp_sub_cb=$exp_sub_cb+$row_exp_cb['AMOUNT'];
                //         }
            ?>
            
             <!--<tr style="font-size:13px;">-->
          
             <!--           <td class="center" style='font-size:12px;'><?php echo $g ?></td>-->
             <!--           <td class="left"  style='font-size:12px;'><?php echo $row_exp_cb['REFNO']; ?> </td>-->
             <!--           <td class="left"  style='font-size:12px;'><?php echo $row_exp_cb['SDATE']; ?> </td> -->
             <!--           <td class="left"  style='font-size:12px;'><?php echo $row_ext_cb['NAME']; ?> </td>-->
             <!--           <td class="right"  style='font-size:12px;'><?php echo $row_exp_cb['AMOUNT']; ?> </td>-->
             <!--           <td class="left"  style='font-size:12px;' colspan='6'>&nbsp;<?php echo $row_exp['REMARK']; ?> </td>-->
             <!--       </tr>-->
                    
                     
                    <?php
                //      $g=$g+1;
                //      $expdep=$row_exp_cb['DEPARTMENT']; 
                //      $exp_tot_cb= $exp_tot_cb+$row_exp_cb['AMOUNT'];
                     
                // }
            ?>
            
            <!--<tr>-->
            <!--    <td  align="right" colspan='4' style='font-size:20px;'><b></b></td>-->
            <!--    <td align="right" style='font-size:20px;'><b><?php   echo number_format($exp_sub_cb, 2, ".", ",");  ?><b/></td>-->
            <!--    <td colspan='6' style='font-size:12px;'></td>-->
            <!--</tr>-->
            <!-- <tr>-->
            <!--    <td  align="right" colspan='4' style='font-size:20px;'><b></b></td>-->
            <!--    <td align="right" style='font-size:20px;'><b><?php   echo number_format($exp_tot_cb, 2, ".", ",");  ?><b/></td>-->
            <!--    <td colspan='6' style='font-size:12px;'></td>-->
            <!--</tr>-->
            <!--<tr>-->
            <!--    <td  align="right" colspan='4' style='font-size:20px;'><b>CASH BALANCE</b></td> -->
            <!--    <td align="right" style='font-size:20px;'><b><?php   echo number_format(($cashpay_totmain+$exp_tot_cb)-$exp_tot, 2, ".", ",");  ?><b/></td> -->
            <!--    <td colspan='6' style='font-size:12px;'></td>-->
                 
            <!--</tr>            -->
                    
            
        </table>
    
    
     <?php }?>
    <!--===================================================================================-->
    
    
    
 
<!-- ************************************************************************** -->
</center>
</body>

</html>
