<?php
 
session_start();
/* if($_SESSION['tipven']==""){
	$_SESSION['tipven'] = $_POST['tip_ven'];
}
$com = "A"; */
include("DMMYSQLG.php");
//include("DSA3000.php");
include("DMMYSQLG.php");
if(isset($_POST['bot2'])){
	@$r1=mysqli_query($con ,"select * from dgpemema where fol_ven = '".$_POST['bot']."'");
	@$r2=mysqli_fetch_array($r1);	
	$p1 = $r2['tip_ven'];
}
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<form name="frm1" id="frm1" method="post" >
  <table  align="center">
    <tr>
      <th colspan="6">VENTA DE MOSTRADOR</th>
    </tr>
    <tr>
      <td width="57">Tipo de venta: </td>
      <td width="280" class="inputcodigo">
<?php

	@$resultado=mysqli_query($con ,"select * from dgtipven where tip_ven = '".$_SESSION['tipven']."'");
	@$registro=mysqli_fetch_array($resultado);
	echo '<input name="tip_ven" type="hidden" value="'.$registro['tip_ven'].'" >';
	echo $registro['des_tipven'];
?>    </td>
      <td width="54">Fecha:</td>
      <td width="112" >
      <input name="tfec" type="tfe" id="tfec" size="11" maxlength="10"  readonly
			  <?php

		if(isset($_POST['tfe'])){ 
			echo 'value="' . $_POST['tfe'] .  '"';
		}else{
			echo 'value="' . date("d/m/Y") .  '"';
		}
		?> 
		></td>
      <td width="69">Venta a: </td>
      <td width="99">
        <select name="select2">
		 <?php
 
		 if(isset($_REQUEST['select2']) and $_REQUEST['select2'] == 1){
		 	echo '<option value="1" selected>CONTADO</option>';
		 }else{
		 	echo '<option value="1">CONTADO</option>';
		 }
		 if(isset($_REQUEST['select2']) and $_REQUEST['select2'] == 2){
		 	echo '<option value="2" selected>CREDITO</option>';
		 }else{
		 	echo '<option value="2">CREDITO</option>';
		 } 
		 ?>
          
          
      </select>      </td>
    </tr>
    <tr>
      <td>Vendedor</td>
      <td><select name="select" tabindex="2">
<?php

@$resultado=mysqli_query($con ,"select * from dgcatven") or die ("Consulta inv&aacute;lida");
while(@$registro=mysqli_fetch_array($resultado)){
	if($_POST['select']==$registro['cod_ven']){
	echo '<option value="'.$registro['cod_ven'].'" selected>'.$registro['cod_ven'].'<--->'.$registro['nom_ven'].' '.$registro['ap_pat_ven'] . '</option>';
	}else{
	echo '<option value="'.$registro['cod_ven'].'">'.$registro['cod_ven'].'<--->' . $registro['nom_ven'] . ' ' . $registro['ap_pat_ven'] . '</option>';
	}
	
}			
?>
      </select></td>
      <td> Descuento:</td>
      <td><input name="tdes" type="tdesc" id="tdes" value="0" size="11" maxlength="10"></td>
      <td>IVA Desglosado: </td>
      <td>
        <select name="select3" onChange="openpage('DG23000_PR.php','_self')">
<?php
 
if(isset($_POST['select3']) and $_POST['select3']==0){
	echo '<option value="0" selected>NO</option>';
}else{
	echo '<option value="0">NO</option>';
}
if(isset($_POST['select3']) and $_POST['select3']==1){
	echo '<option value="1" selected>SI</option>';
}else{
	echo '<option value="1">SI</option>';
}
?>
        </select>      </td>
    </tr>
    <tr>
      <td>N&ordf; de cliente </td>
      <td>
	  <?php
 echo  $_POST['Submit5']?>
        <input name="tncli" type="text" id="tncli" size="8"
		readonly 
<?php
 
if((isset($_POST['select3']) and $_POST['select3']==0) or (isset($_POST['tip_ven']) or isset($_GET['rr'])) or ($_POST['Submit6']=="Agregar")){
	//buscar el cliente por default
	@$re=mysqli_query($con ,"select * from dgparame");
	@$re1=mysqli_fetch_array($re);
	@$resultado=mysqli_query($con ,"select * from dgcatcli WHERE cod_cli = '".$re1['cod_pubgral']."'");
	@$registro=mysqli_fetch_array($resultado);
	echo 'value="'.$registro['cod_cli'].'"';
	
}
?>>
        <input type="button" name="Submit" value="Buscar" onClick="window.open('DG23000_AG1.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" 
<?php
 
if((isset($_POST['select3']) and $_POST['select3']==0) or ($_POST['Submit6']=="Agregar")){
	echo " disabled";
}
?>	
	 >
      <input type="button" name="Submit3" value="Agregar" onClick="openpage('DG12000_AG.php','_black')"
	  <?php
 
if((isset($_POST['select3']) and $_POST['select3']==0) or ($_POST['Submit6']=="Agregar")){
	echo "disabled";
}
?>
	  >
	  </td>
      <td>Nom Clte:</td>
      <td colspan="3"> 
        <input name="tnom_alt" type="text" id="tnom_alt" size="50" readonly
		<?php
 
if((isset($_POST['select3']) and $_POST['select3']==0) or (isset($_POST['tip_ven']) or isset($_GET['rr'])) or ($_POST['Submit6']=="Agregar")){
	//buscar el cliente por default
	echo 'value="'.$registro['nom_cli']. ' ' .$registro['ap_pat_cli'] . ' ' .$registro['ap_mat_cli'].'"';
	
}
?>
		>
      </td>
    </tr>
    <tr>
      <td>Referencia:</td>
      <td colspan="5">
	  <input name="trefe" type="text" id="trefe" size="50" 
	  <?php
 
if(isset($_REQUEST['trefe'])){
		echo 'value = "'.$_REQUEST['trefe'].'"';
}	  ?>
	  ></td>
    </tr>
    <tr>
      <th colspan="6">
  <div align="center">
  <input type="submit" name="Submit22" value="Generar Pedido" onClick="openpage('DG23000_AC.php','_self')"/>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="submit" name="Submit2" value="Regresar" onClick="openpage('DG23000_PR2.php','_self')">
  </div></th>
    </tr>
  </table>
</form>
</body>
</html>
