<?php
 

$dbuser = "root";
$dbpass = "castillejos";
$dbhost = "localhost";
$dbname = "nylex";
@$con = mysqli_connect($dbhost,$dbuser,$dbpass);
if (!$con){
	die("SIN CONEXION: " . mysqli_error($con));
}
$cag=mysqli_select_db($dbname); 

$strbus=" SELECT dvredocl.num_doc as docDV, dgrefcom.num_doc asdocDG, dgrefcom.codigo as codCom, dvredocl.codigo as codRed, dgcatpro.codigo as codProx, dgcatpro.cod_pro as codProp FROM dvredocl INNER JOIN dgcatpro ON(dgcatpro.codigo=dvredocl.codigo) INNER JOIN dgrefcom ON(dgrefcom.num_doc = dvredocl.num_doc and dgrefcom.codigo=dgcatpro.cod_pro)";

$sq_reford=mysqli_query($con ,"UPDATE dvredocl INNER JOIN dgcatpro ON(dgcatpro.codigo=dvredocl.codigo) INNER JOIN dgrefcom ON(dgrefcom.num_doc = dvredocl.num_doc and dgrefcom.codigo=dgcatpro.cod_pro) INNER JOIN dxbascpt ON(dxbascpt.codigo=dvredocl.codigo) SET dvredocl.fec_doc=dgrefcom.fec_doc, dvredocl.fec_ven=DATE_FORMAT(DATE_ADD(dgrefcom.fec_doc,INTERVAL 15 DAY) ,'%Y-%m-%d'), dvredocl.fec_rev=dgrefcom.fec_doc,dvredocl.afe_pol='N'");
?>