<?php
 
session_start();
include("DMMYSQLG.php");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<?php

$idBascps="";
$tipDocs="";
$tipMov='P';
$pag_reg2 = 'DW21000_AG2.php';//A DONDE VA SI ES TODO OK
$pag_reg1 = 'DW21000_AG1.php';//A DONDE VA SI ES ERROR

if(isset($_REQUEST['solDocs'])){
	if($_REQUEST['botPR']==""){
		echo '<h2>!!! SELECCIONA UN REGISTRO... ACTUALIZANDO !!!</h2>';
		echo '<meta content="1; url=DW21000_PR.php"  HTTP-EQUIV="REFRESH">';
		exit();	
	}
	else{
		$ArgsPag_reg="&solDocs=solDocs&botPR=$_REQUEST['botPR']&idpas=".date("H:i:s").date('d').date('m').date("Y");
		$tipDocs="solDocs";
		$idBascps=$_REQUEST['botPR'];	
	}
}
elseif(isset($_REQUEST['todDocs'])){
	$tipDocs="todDocs";
	$ArgsPag_reg="&todDocs=todDocs&idpas=".date("H:i:s").date('d').date('m').date("Y");
	
}
?>
<?php

if($_POST['t2']==''){
	echo '<h2>ERROR: FALTA MOVIMIENTO CONTABLE, DOCUMENTO NO AGREGADO!!!</h2>';
	echo '<meta content="2; url='.$pag_reg1.'?ids=none'.$ArgsPag_reg.'" HTTP-EQUIV="REFRESH">';
	exit();
} 
//-------------------------------------------------------->
//Mandar datos a documentos x cobrar o por pagar 
//-->
//Variables
$tm = "A";//tipo de movimiento AGREGAR (A) MODIFICAR (M) ELIMINAR (E)
$num_reg = $_REQUEST['bot'];
$num_doc = $_REQUEST['t1'];//numero de docuemnto 
$cli_pro = $_REQUEST['tncli'];//cliente
$tip_per = "P";//CLIENTE O PROVEEDOR
$fec = $_REQUEST['fec'];
include('DF20000.php');
$fec_doc = $f_m;//FECHA DE LA FACTURA
$fec = $_REQUEST['fec2'];
include('DF20000.php');
$fec_rev = $f_m;//FECHA DE LA FACTURA
$cve_mto=$_REQUEST['t2'];//CUENTA CONTABLE
$ssop = mysqli_fetch_array(mysqli_query($con ,"select * from dvparame")); //cuenta contable de parametros generales
$cuenta_para = $ssop['cve_mto_gas']; //cuenta contable de parametros generales
$sub_tot=$_REQUEST['t3'];
$iva_tot=$_REQUEST['t5'];
$afe_pol=$_REQUEST['t7'];
$total=$_REQUEST['t14'];
$cve_i = explode("|",$_REQUEST['t4']);
$cve_iva = $cve_i[0];
$tt = explode("|",$_REQUEST['t8']);
$ret1=$tt[0];
$ret1_po=$_REQUEST['t9'];
$ret1_im=$_REQUEST['t10'];      
$tt = explode("|",$_REQUEST['t11']);
$ret2=$tt[0];
$ret2_po=$_REQUEST['t12'];
$ret2_im=$_REQUEST['t13'];
$tot_doc=$_REQUEST['t14'];
$tot_pag=0.00;
$tot_not=0.00;
$tot_car=0.00;
$tot_abo=0.00;
$tot_sal=$_REQUEST['t19'];
$moneda=$_REQUEST['ttmon'];
$cve_mon=$_REQUEST['select33'];
$cve_pai=$_REQUEST['tpai'];
$tip_cam=$_REQUEST['ttc'];
$dia_cre=$_REQUEST['t24'];
$con_cre=$_REQUEST['t26'];
$tip_mot=$_REQUEST['t28'];
$fec_ven=$_REQUEST['t27'];
$des=$_REQUEST['t25'];
if(isset($_POST['afe_ietu']))
	$afe_ietu=$_POST['afe_ietu'];
else
	$afe_ietu='N';
if(isset($_POST['afe_caj']))
	$afe_caj=$_POST['afe_caj'];
else
	$afe_caj='0';

$regresar = 1;
//echo 'EL IETU ES:'.$afe_ietu.'<br>';
include("DYDOCXCP.php");
//<--
//fin
//---------------------------------------------------------|
?>
</body>
</html>