<?php session_start();
require('../cfg/cfg.php');
require('../cfg/res.php');
require('../../_lib/vrdocu0.php');

$docum=new vrdocu0('../cfg/res.php',$_POST['docux']);
$numerox=$docum->numero;
$numerox++;
//echo $docum->numero;
$sql_cont='insert into cont1(
empr,
docu,
ptoe,
numero,
fecha,
enti,
iuser,
concepto,
idate)
values(
"'.strtoupper($_SESSION['user_vcrx_empr']).'",
"'.strtoupper($_POST['docux']).'",
"'.$_POST['ptoex'].'",
"'.$numerox.'",
"'.$_POST['fechx'].'",
"'.$_POST['entix'].'",
"'.$_SESSION['user_vcrx_id'].'",
"'.$_POST['conse'].'",
NOW()

)';


if(mysql_query($sql_cont,$link_vcrx))
{
	$docum->vrdocu_setplus();
	$sql_cont='SELECT MAX(idnum1)as maximo from cont1 where docu="'.strtoupper($_POST['docux']).'"';
	$res_cont=mysql_query($sql_cont,$link_vcrx);
	$max_cont=mysql_result($res_cont,0,'maximo');
	echo $max_cont;
	
}
else
{
	echo '0';
}

?>