<?php 
// ini_set('display_errors',1);
session_start();
require_once ("../../config/Cado.php");
require_once ("../ingreso/cIngreso.php");
$oIngreso = new cIngreso();
require_once ("../egreso/cEgreso.php");
$oEgreso = new cEgreso();
require_once ("../venta/cVentapago.php");
$oVentapago = new cVentapago();
require_once("../formatos/formato.php");
$dtsv = $oVentapago->mostrarUno($_POST['venpagid']);
$dtv = mysqli_fetch_array($dtsv);
$cli_nom = $dtv['tb_cliente_nom'];
$cli_ruc = $dtv['tb_cliente_doc'];
$dts1 = $oIngreso->ver_cobro($_POST['vdetpagid']);
$dtsd = $oIngreso->ver_dev($_POST['vdetpagid']);
$rowd = mysqli_num_rows($dtsd); 
?>
	<div class="modal-header">
        <h5 class="modal-title">COBROS RELACIONADOS A LA CUENTA -  <strong style="color:red;"><?php echo  $_POST['numdoc']; ?></strong> </h5>
      </div>
	 
  <div class="table-responsive">
	<div class="col-lg-12 col-md-12 col-xs-12 " >
         
        <table id="tabla_pago" class="table table-bordered table-striped">
        
		<thead>
          <tr>
		  <th>CLIENTE</th>
		  <td colspan="4"><?php echo $cli_nom;?></td>
		  </tr>
		  <tr>
		  <th>RUC</th>
		  <td colspan="4"><?php echo $cli_ruc;?></td>
		  </tr>
		  
		  <tr>
          <th nowrap title="Fecha">FECHA COBRO</th> 
          <th>CAJA</th>
          <th>DETALLE</th>
          <th nowrap >FORMA PAGO</th>
          <th nowrap >NRO OPERACION</th>
          <th nowrap >MONTO</th>
          </tr>
        </thead>
        <tbody>	
		<?php while($dt1 = mysqli_fetch_array($dts1)){
			if($dt1['tb_ingreso_modpag']==1){
				$forpag = 'EFECTIVO';
			}else if($dt1['tb_ingreso_modpag']==2){
				$forpag = 'DEPOSITO';
			}else if($dt1['tb_ingreso_modpag']==3){
				$forpag = 'DETRACCION';
			}else if($dt1['tb_ingreso_modpag']==4){
				$forpag = 'TRANSFERENCIA';
			}else if($dt1['tb_ingreso_modpag']==5){
				$forpag = 'CHEQUE';
			}
			else if($dt1['tb_ingreso_modpag']==6){
				$forpag = 'TARJETA';
			}else if($dt1['tb_ingreso_modpag']==7){
				$forpag = 'RETENCION';
			}
			
			
			?>
		
          <tr>
          <td nowrap="nowrap"><?php echo mostrarFecha($dt1['tb_ingreso_fec']); ?></td>                   
          <td nowrap="nowrap"><?php echo $dt1['tb_moneda_sim'].' '.$dt1['tb_caja_nom']; ?></td>         
		  <td nowrap="nowrap"><?php echo $dt1['tb_ingreso_det']; ?></td>               
		  <td nowrap="nowrap"><?php echo $forpag; ?></td>        
		  <td nowrap="nowrap"><?php echo $dt1['tb_ingreso_nroope']; ?></td>        
          <td nowrap="nowrap"><?php echo formato_money($dt1['tb_ingreso_imp'])?></td>     
          </tr>
   		<?php }?>
		<?php if($rowd>0){
			?>
		<tr>
		<td class="bg bg-yellow" colspan="6" >REEMBOLSOS</td>
		</tr>
		<?php while($dtd = mysqli_fetch_array($dtsd)){?>
		
          <tr>
          <td nowrap="nowrap"><?php echo mostrarFecha($dtd['tb_egreso_fec']); ?></td>                   
          <td nowrap="nowrap"><?php echo $dtd['tb_moneda_sim'].' '.$dtd['tb_caja_nom']; ?></td>         
		  <td nowrap="nowrap"><?php echo $dtd['tb_egreso_det']; ?></td>               
          <td nowrap="nowrap"><?php echo ''?></td>         
          <td nowrap="nowrap"><?php echo ''?></td>         
          <td nowrap="nowrap"><?php echo formato_money($dtd['tb_egreso_imp'])?></td>     
          </tr>
   		<?php }}?>
		
		</tbody>  
		</table>  
	</div>
   </div>
   
   <div class="box-footer float-right ">
				<button title="CERRAR VENTANA" type="button" data-dismiss="modal" class="btn btn-danger "><i class="fas fa-times"></i></button>			
	</div>