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

$sql_m_con2='select max(iddet)as maxid from cont2 where idnum2='.$_POST['iddetx'];


$res_m_con2=mysql_query($sql_m_con2,$link_vcrx);
if(mysql_num_rows($res_m_con2)!=0)
{
	$iddetx=mysql_result($res_m_con2,0,'maxid');
}
else
{
	$iddetx=0;
}
$iddetx++;
$sql_con2='insert into cont2(
idnum2,
iddet,
ctas,
csub,
cant,
detalle)
values(
'.$_POST['iddetx'].',
'.$iddetx.',
"'.$_POST['ctasx'].'",
"'.$_POST['csubx'].'",
"'.$_POST['cantx'].'",
"'.$_POST['detax'].'"
)';

if(mysql_query($sql_con2,$link_vcrx))
{
	echo '0';
}
else
{
	echo $sql_con2;
	//echo mysql_error($link_vcrx);
}

?>