<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
?>
<html>
<HEAD> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8"></HEAD>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<?php
 
$ayuda = 'DV3500A_PR.php';
include("DYAYUDA.php");
?>
<div align="center">
  <form name="form3" id="form3" method="post" action="">
    <table width="714" border="0">
	<tr>
	  <th colspan="2">PAGO DE DOCUMENTOS</th>
	</tr><tr>
        <td colspan="2"><div align="center">&nbsp;
          <input name="r1" type="radio" value="no" tabindex="3" onClick="arriba(this.value)"/>
          X # de Documento
          &nbsp;&nbsp;&nbsp;&nbsp;
          <input name="r1" type="radio" value="p" tabindex="4" onClick="arriba(this.value)"/>
          X Proveedores
          &nbsp;&nbsp;&nbsp;&nbsp;
          <input name="r1" type="radio" value="f" tabindex="5" onClick="arriba(this.value)"/>
          X Fecha </div></td>
      </tr>
      <tr>
        <td width="29%"> Buscar:
          <input name="tt" type="text" id="tt" onKeyUp="may(this)"/>
        </td>
        <td width="71%">De:
           
            <input name="fec" type="text" class="emplea" id="fec" size="20" maxlength="20"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?>onkeypress="return soloNumeros(event)"//solo fechas
		/>
            <input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
            <script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "fec",        // ID of the input field
      ifFormat    : "%d/%m/%Y",    // the date format
      button      : "bot"      // ID of the button
    }
  );
            </script>
            A:
            <input name="fec2" type="text" class="emplea" id="fec2" size="20" maxlength="20"
			<?php

				if(isset($_POST['fec2'])){ //este es el truco
					echo 'value="' . $_POST['fec2'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?>onkeypress="return soloNumeros(event)"//solo fechas
		/>
            <input name="bot12" id="bot1" type="image" value="Cal" src="logos/cal4.jpg" />
            <script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "fec2",        // ID of the input field
      ifFormat    : "%d/%m/%Y",    // the date format
      button      : "bot1"      // ID of the button
    }
  );
            </script>
            <input type="submit" name="Submit32" value="Buscar" />
          </td>
      </tr>
    </table>
     
  </form>
</div>
<div align="center">
  <form name="frm1" method="post" action="" >
    <?php
 
	$fecha_actual=date("Y/m/d");
	@$result = mysqli_query($con ,"SELECT * FROM dvcobdoc where cli_pro = 'P' and fec_cob='$fecha_actual'");
	?>
    <table width="825"   align="center" >
      <tr>
        <th colspan="9"><div align="left">
          <input type="button" name="Submit6" value="Agregar" onClick="openpage('DW23000_AG.php','_self')"/>
          <input type="button" name="bot3" value="Consultar"  onClick="openpage('DW23000_CO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick="openpage('DW23000_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('DW23000_IM.php','_blank')"/>
          </div></th>
      </tr>
      <tr>
        <th colspan="9">Conceptos - Pago de Documentos </th>
      </tr>
      <tr>
        <th width="25"><div align="center">Sel</div></th>
        <th width="75"><div align="center">Tipo C/P </div></th>
		<th width="115"><div align="center">Fecha Cobro/Pago </div></th>
		<th width="114"><div align="center">Folio Cobro/Pago</div></th>
		<th width="189"><div align="center">Numero de Documento </div></th>
		<th width="78"><div align="center">Importe</div></th>
		<th width="71"><div align="center">Iva/Cobro</div></th>
		<th width="106"><div align="center">Total de Cobro </div></th>
      </tr>
	<?php

	 // --->
	  	$fec = $_POST['fec'];
		include('DF20000.php');
		$fecha_inicial = $f_m;
		//$pdf->Cell(15,5,$fecha_inicial,1,0,'C');
		$fec = $_POST['fec2'];
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
	if($_POST['r1']=="no"){
		echo '<input name="tbusqueda" type="hidden" value="no">';
	  	$result = mysqli_query($con ,"SELECT * FROM dvcobdoc WHERE num_doc = $_POST['tt'] and cli_pro = 'P'");
   	}elseif($_POST['r1']=="f"){
		//$fec = $_POST['tt'];
		//include("DF20000.php");
		//echo $f_m;
		echo '<input name="tbusqueda" type="hidden" value="f">';
		$result = mysqli_query($con ,"SELECT * FROM dvcobdoc WHERE fec_cob between '$fecha_inicial' and '$fecha_final'  and cli_pro = 'P'");
   	}elseif($_POST['r1']=="p"){
		echo '<input name="tbusqueda" type="hidden" value="p">';
	  	$result = mysqli_query($con ,"SELECT * FROM dvcobdoc WHERE codigo = $_POST['tt']  and cli_pro = 'P'");
	}
	include("DE10000.php");
	while(@$reg = mysqli_fetch_array($result))
	{
	  	echo "<tr>";
		echo '<td><div align="center"><input name="bot" type="radio" value="'. $reg['n_reg'].'">&nbsp</div></td>';
		echo '<td><div align="center">' . $reg['tip_cob'] . '&nbsp</div></td>';
		$fec1 = $reg['fec_cob'];
		include('DF20000.php');
		echo '<td><div align="center">' . $f_f . '&nbsp</div></td>';
		echo '<td><div align="center">' . $reg['fol_cob'] . '&nbsp</div></td>';
		echo '<td><div align="center">' . $reg['num_doc'] . '&nbsp</div></td>';
		echo '<td><div align="center">' . '$' . number_format($reg['imp_cob'], 2, '.', ',') . '&nbsp</div></td>';
		echo '<td><div align="center">' . '$' . number_format($reg['iva_cob'], 2, '.', ','). '&nbsp</div></td>';
		echo '<td><div align="center">' . '$' . number_format($reg['tot_cob'], 2, '.', ',') . '&nbsp</div></td>';
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>