<?php

//ini_set('display_errors',1);

require_once ("../../config/Cado.php");
require_once ("../notacredito/cNotacredito.php");
$oNotacredito = new cNotacredito();
require_once ("../formatos/formato.php");


$dts1=$oNotacredito->mostrar_detalle($_POST['notcre_id']);
$num_rowsv= mysqli_num_rows($dts1);

?>
 
<div class="table-responsive">
<table cellspacing="1" id="tabla_venta_detalle" class="table table-bordered table-striped"> 
 
    <thead>
        <tr>
		<th style="white-space: nowrap;">ARTÍCULO</th>
        <th class="" style="white-space: nowrap;" >MARCA</th>
        <th align="right">CAN</th>
		<th align="right" >P. UNI.</th>
		<th align="right" >PRECIO TOTAL</th>
		
        </tr>
    </thead>
    <tbody>
    <?php
		while($dt1 = mysqli_fetch_array($dts1))
    {
		$imei_nom = $dt1['tb_especificacionimei_nom'];
		$can = $dt1['tb_notacreditodetalle_can'];
		
		$esp_id = $dt1['tb_especificacion_id'];
		$cat_id = $dt1['tb_catalogo_id'];
		$mar_id = $dt1['tb_marca_id'];
		$pronom = $dt1['tb_notacreditodetalle_nom'];
		$pre_uni = $dt1['tb_notacreditodetalle_preuni'];
		$pre_tot = $dt1['tb_notacreditodetalle_preuni'] * $can;
		
		
			
	
			
		?>
        <tr <?php if($num_rowsd>0) echo 'style="border-left:red solid 2px;"'; ?>  >
       
          <td style="white-space: nowrap; font-size: 9pt; font-weight: bold;" ><strong> <?php echo $pronom?> </strong>	</td>
          <td><?php echo $dt1['tb_marca_nom'];?></td>		  
          <td class="" align="right"><?php echo $can;?></td>
          <td class="" align="right"><?php echo formato_money($pre_uni);?></td>
          <td class="" align="right"><?php echo formato_money($pre_tot);?></td>
        </tr>
    <?php
    
    	$totpre += $pre_tot;
		
    }
    mysqli_free_result($dts1);
    ?>
    </tbody>
    
     <tr>
          <td colspan="2"></td>
        
          <td class="" align="right"><?php echo '';?></td>
          <td class="" align="right"><?php echo '';?></td>
          <td class="" align="right"><?php echo formato_money($totpre);?></td>
        </tr>
        
</table>

<?php 
  if($num_rowsv=="" or $num_rowsv==0)echo $num_rowsv.' Ningún registro';
  if($num_rowsv==1)echo $num_rowsv.' registro';
  if($num_rowsv>=2)echo $num_rowsv.' registros';
?>

<br/>
</div> 
  
  
<div class="table-responsive">


	<table>
		<tr>
			<td style="width:5%"></td>							
			
			<td>
				<div >
					<label>TOTAL:</label>
					<input type="text"  autocomplete="off" class="form-control text-orange" value="<?php echo formato_money($totpre)?>"  style="text-align:right;font-weight: bold;" readonly >
				</div>
							
			</td>	
		</tr>
	</table>
</div>			


<script type="text/javascript">
  
  function cambiar_estado(detid){
  
		$.ajax({
			type: "POST",
			url: "../venta/venta_reg.php",
			async:true,
			dataType: "json",                      
			data: ({
				action_venta:	'cambiar_estado',
				detid:	detid
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				toastr["success"](data.msj);	
			},
			complete: function(){			
				venta_detalle_tabla_vis(<?php echo $_POST["ven_id"]?>);
			}
		});     
  
  }
  
  </script>
  
  
  
  
  
  
  
  
  
  
  