                                                                                                                                                                                                                        
<html>
<head>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
</head>




<?php

 include ("conexion.php");

date_default_timezone_set('America/Costa_Rica');

$cdgusu = "EXCEL";

$fecha=date("Y-m-d");

$nomusu = "EXCEL";

$fectom=date("Y-m-d");





	
$consulta ="SELECT * FROM web_1001, proforlineas WHERE web_1001.CDGBAR = proforlineas.codigo and proforlineas.codfactura = 311 ";
//$consulta ="SELECT * FROM web_1001, cade WHERE web_1001.CDGBAR = cade.CDGBAR  ";
$contador=0;
if ($resultado = $mysqli->query($consulta)) 
	$count=0;

    while ($row = $resultado->fetch_assoc()) {

	
       
		$cantidad  = $row["cantidad"];
		$cdgbar  =  $row["CDGBAR"];
		$cdgart  =  $row["CDGART"];
		$dscart  =  $row["DSCART"];
		$cob_iv  =  $row["COB_IV"];
		$desart  =  $row["DESART"];
		$exiact  =  $row["EXIACT"];
		$cosart  =  $row["cosart"];
		$utiart1 =  $row["utiart1"];
		$pre001  =  $row["PRE001"];
		$impart  =  $row["impart"];
		$preivi  =  $row["PREIVI"];
		$cdgfam  =  $row["CDGFAM"];
		$cdglin  =  $row["CDGLIN"];
		$ivporc  =  $row["ivporc"];

$query_operacion="INSERT INTO toma_fisica (numlin, cdgart, cdgbar, dscart, cob_iv,  desart,  exiant, cosart, utiart1,  pre001, impart, preivi, cdgfam, cdglin, cdgusu, fectom, cantom , ivporc ) VALUES ('', '$cdgart', '$cdgbar', '$dscart', '$cob_iv','$desart','$exiact','$cosart', '$utiart1',  '$pre001', '$impart', '$preivi', '$cdgfam', '$cdglin',  '$nomusu', '$fectom' , '$cantidad' , '$ivporc' )";					
	$mysqli->query($query_operacion);
		
			  
	
	$nuevo_saldo="UPDATE web_1001 SET  EXIACT='$cantidad' , nomusu =  '$cdgusu'  WHERE  cdgbar='$cdgbar'  ";
	$mysqli->query($nuevo_saldo);
	
	$count++;
	
	echo $count." CODIGO  ".$cdgbar." PRODUCTO ".$dscart." CANTIDAD ".$cantidad."<BR>";
	
	
	
	
	
		}   
		
		
		
		
		