<?php   
	include_once("../view/header-footer/header.php");  
?>  
  
  
  
   <!-- Features -->
   <div class="innerDeader">
      <div class="container">
          <a href="javascript:void(0);" id="go-back" class="goBack PaySound">
           <img src="<?php echo ROOTPATH;?>/images/Arrow 1.svg" alt="back">
       </a>  
          <h4>CREDIT DEBIT </h4>
     </div>    
   </div>
   <div class="innerBody">
       <div class="container">
         <di class="tableBox">
            <table>
                
                <tr>
                          <th>S No.</th> 
                                        <th>Amount</th> 
                                        <th>Date</th> 
                                        <th>Type</th> 
                                        <th>Flow</th> 
                                        <th>Balance</th> 
                                        <th>By</th> 
                                        <th>Receipt</th> 
                                        <th>Status</th> 
                </tr>  
                
                      <?php 
                                $sr = 1;
                                foreach($Result as $dmm) 
                                {        
                                        $Idp =0;
                                    
                                        if( (($_SESSION['userId']=='DP647792') ||  ($_SESSION['userId']=='DP609575')  ||  ($_SESSION['userId']=='DP889773')) && ( ($dmm->byw!='DP213439') || ($dmm->byw!='DP360639') || ($dmm->byw!='DP244196')  )   )
                                            $Idp =1;
                                        
                                        if($Idp==0)
                                        { 
                                ?>
                    <tr>
                         
                                        <td><?php echo $sr++;?></td>
                                        <td <?php if($dmm->type==1) {?> style="color:green;" <?php } else {?> style="color:red;"<?php }?> >&#8377;<?php echo $dmm->addDel;?> </td>
                                        <td><?php echo $dmm->Tdate;?> </td>
                                        <td <?php if($dmm->type==1) {?> style="color:green;" <?php } else {?> style="color:red;"<?php }?> ><?php if($dmm->type==1) echo "Credit"; else echo "Debit";?></td> 
                                        <td><?php echo $dmm->Intype ?></td>
                                        <td> <?php echo  number_format((float)($dmm->availableBal), 2, '.', ''); ?></td>
                                        <td><?php echo $dmm->byw; ?></td> 
                                        <td> 
                                        
                                        <?php 
                                            if( ($dmm->Intype!='Level Balance') && ($dmm->Intype!='Daily Balance') ) 
                                            { 
                                                    
                                                    $stmt=$conn->prepare("select type  from   UI__Receipt  where cdId =:cdId    ");   
                                                    $stmt->bindValue(':cdId',  $dmm->id , PDO::PARAM_INT);  
                                                    $stmt->execute(); 
                                                    $cdId = $stmt->fetch(PDO::FETCH_OBJ);  

                                                    if($cdId->type==7) 
                                                    { 
                                                    if($dmm->Intype!='REFUNDED') { ?> 
                                                    <a href="moneyRec.php?id=<?php echo $dmm->id;?>"> View </a> 
                                                    <?php }
                                                    
                                                    }else if($cdId->type==1) { 
                                                    ?>    
                                                        <a href="viewRecUpi.php?id=<?php echo $dmm->id;?>"> View </a>  
                                                    <?php } else { ?>
                                                    
                                                     <a href="viewRec.php?id=<?php echo $dmm->id;?>"> View </a>  
                                                    <?php 
                                                        
                                                    }    
                                            }
                                        ?> 
                                        </td> 
                                        <td  style="color:green;"> <?php if($dmm->type==2)   echo "Success";?></td> 
                                       
                    </tr>
                    <?php                
                                
                                }
                    		}     
                	?>    
              </table>
         </div>
       </div>
   </div>
     
</div>
 
<?php 
  include_once("../view/header-footer/footer.php");  
    unset($_SESSION['TpMsg']);