Created
January 23, 2014 18:55
-
-
Save ChrisGehm/8584593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('../includes/connect.php'); | |
$idcliente = ""; | |
$idusario = ""; | |
$cliente=""; | |
$fecha=""; | |
$para= ""; | |
$concepto= ""; | |
$responsable= ""; | |
$enviadopor= ""; | |
$receptor= ""; | |
$observaciones= ""; | |
if($_POST['cliente']!="" AND $_POST['fecha']!= "" AND $_POST['responsable']!= "" AND (($_POST['enviadopor']!="")) AND (($_POST['concepto']!=""))) | |
{ | |
$fecha= $_POST['fecha']; | |
//Acá hay que pasar IDCliente,no va más el varchar cliente | |
$cliente= $_POST['cliente']; | |
$para= $_POST['para']; | |
$concepto= $_POST['concepto']; | |
//Acá hay que pasar id_usuario,no va más responsable | |
$responsable= $_POST['responsable']; | |
$enviadopor= $_POST['enviadopor']; | |
$receptor= $_POST['receptor']; | |
$observaciones= $_POST['observaciones']; | |
$sql1 = ("SELECT IDCliente | |
FROM clientes | |
WHERE Denominacion = '".$cliente."'"); | |
$result1 = mysql_query("$sql1",$conexion) or die(mysql_error()); | |
while($f = mysql_fetch_array($result1)) | |
{ | |
$idcliente = $f['IDCliente']; | |
} | |
$sql2= ("SELECT id_usuario | |
FROM Usuarios | |
WHERE Nombre = '".$responsable."'"); | |
$result2 = mysql_query("$sql2",$conexion) or die(mysql_error()); | |
while($f = mysql_fetch_array($result2)) | |
{ | |
$idusuario = $f['id_usuario']; | |
} | |
$sql3 = ("SELECT max(Numero_mov) AS num | |
FROM movimiento_doc | |
WHERE id_tmd = 1"); | |
$result3 = mysql_query("$sql3",$conexion) or die (mysql_error()); | |
while($f = mysql_fetch_array($result3)) | |
{ | |
$num_mov = $f['num'] + 1; | |
} | |
echo $num_mov; | |
//truncate envio// //para borrar todo y reiniciar el autoincrement | |
$insertar2=mysql_query("Insert INTO movimiento_doc (fecha_mov_doc,id_cliente,id_tmd,Para,Concepto,id_usuario,Receptor, observaciones,enviado_por,Numero_mov) | |
values ('{$fecha}','{$idcliente}',1,'{$para}','{$concepto}','{$idusuario}','{$receptor}','{$observaciones}','{$enviadopor}','{$num_mov}')"); | |
$result2= mysql_query($insertar2); | |
header('Location: envio.php'); | |
} | |
else | |
{ | |
echo '<p class="error"> Error al ingresar datos!</p>'; | |
echo '<a href="formenvio.php" >Volver a intentar</a>'; | |
echo '<br><br>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment