<?php
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");

$s="SELECT * FROM transferencias ORDER BY id_trans";
$rs = grs($s);
while ($r = $rs->fetch_assoc()){
	$_ID=$r['id_trans'];
	$_SE=$r['tser_'];
	$_NU=$r['tnum_'];
	$SER=vbr("0000".$_SE,4);
	$NUM=vbr("000000".$_NU,6);
	$s="UPDATE transferencias SET tser='$SER',tnum='$NUM' WHERE id_trans=$_ID";
	ejt($s);
}
echo "OK TRANSFERENCIAS<br>";



$s="SELECT * FROM guias ORDER BY id_guia";
$rs = grs($s);
while ($r = $rs->fetch_assoc()){
	$_ID=$r['id_guia'];
	$_SE=$r['iser'];
	$_NU=$r['inum'];
	$SER=vbr("0000".$_SE,4);
	$NUM=vbr("000000".$_NU,6);
	$s="UPDATE guias SET ser='$SER',num='$NUM' WHERE id_guia=$_ID";
	ejt($s);
}
echo "OK GUIAS<br>";


$s="SELECT * FROM ginterna ORDER BY id_gi";
$rs = grs($s);
while ($r = $rs->fetch_assoc()){
	$_ID=$r['id_gi'];
	$_SE=$r['gi_iserie'];
	$_NU=$r['gi_inum'];
	$SER=vbr("0000".$_SE,4);
	$NUM=vbr("000000".$_NU,6);
	$s="UPDATE ginterna SET gi_serie='$SER',gi_num='$NUM' WHERE id_gi=$_ID";
	ejt($s);
}
echo "OK GUIA INTERNA<br>";


$s="SELECT * FROM cotizaciones ORDER BY id_cotizacion";
$rs = grs($s);
while ($r = $rs->fetch_assoc()){
	$_ID=$r['id_cotizacion'];
	$_SE=$r['iser'];
	$_NU=$r['inum'];
	$SER=vbr("0000".$_SE,4);
	$NUM=vbr("000000".$_NU,6);
	$s="UPDATE cotizaciones SET ser='$SER',num='$NUM' WHERE id_cotizacion=$_ID";
	ejt($s);
}
echo "OK COTIZACIONES<br>";


$s="SELECT * FROM ventas ORDER BY id_venta";
$rs = grs($s);
while ($r = $rs->fetch_assoc()){
	$_ID=$r['id_venta'];
	$_SE=$r['iser'];
	$_NU=$r['inum'];
	$SER=vbr("0000".$_SE,4);
	$NUM=vbr("000000".$_NU,6);
	$s="UPDATE ventas SET ser='$SER',num='$NUM' WHERE id_venta=$_ID";
	ejt($s);
}
echo "OK VENTAS<br>";

?>