//////Creo una Preventa if (!empty($_REQUEST['BtnAgregarPreventa'])) { $obVenta = new ProcesoVenta($idUser); $obVenta->CrearPreventa($idUser); // Crea otra preventa header("location:VentaFacil.php"); } if (!empty($_REQUEST['TxtCodigoBarras'])) { $CodBar = $_POST['TxtCodigoBarras']; $obVenta = new ProcesoVenta($idUser); $DatosCodigo = $obVenta->DevuelveValores('prod_codbarras', "CodigoBarras", $CodBar); //$DatosPreventa=$obVenta->DevuelveValores('vestasactivas',"idVestasActivas",$idPreventa); if ($DatosCodigo['ProductosVenta_idProductosVenta'] > 0) { $fecha = date("Y-m-d"); $Cantidad = 1; $obVenta->AgregaPreventa($fecha, $Cantidad, $idPreventa, $DatosCodigo['ProductosVenta_idProductosVenta'], '1', $idUser); } else { print '<script language="JavaScript">alert("Este producto no esta en la base de datos por favor no lo entregue")</script>'; } } if (!empty($_REQUEST['TxtAsociarCliente'])) { $idCliente = $_REQUEST['TxtAsociarCliente']; header("location:Cotizaciones.php?TxtIdCliente={$idCliente}"); } if (!empty($_REQUEST['del'])) { $id = $_REQUEST['del']; $Tabla = $_REQUEST['TxtTabla']; $IdTabla = $_REQUEST['TxtIdTabla']; $IdPre = $_REQUEST['TxtIdPre']; mysql_query("DELETE FROM {$Tabla} WHERE {$IdTabla}='{$id}'") or die(mysql_error()); header("location:Cotizaciones.php?TxtIdCliente={$IdPre}");
$id = $_REQUEST['del']; $Tabla = $_REQUEST['TxtTabla']; $IdTabla = $_REQUEST['TxtIdTabla']; $IdPre = $_REQUEST['TxtIdPre']; mysql_query("DELETE FROM {$Tabla} WHERE {$IdTabla}='{$id}'") or die(mysql_error()); header("location:VentaFacil.php?CmbPreVentaAct={$IdPre}"); } if (!empty($_REQUEST['TxtAgregarItemPreventa'])) { $idItem = $_REQUEST['TxtAgregarItemPreventa']; $fecha = date("Y-m-d"); $Cantidad = 1; $idPreventa = $_REQUEST['TxtIdPre']; $obVenta = new ProcesoVenta($idUser); //$DatosPreventa=$obVenta->DevuelveValores('vestasactivas',"idVestasActivas",$idPreventa); if ($idPreventa > 0) { $obVenta->AgregaPreventa($fecha, $Cantidad, $idPreventa, $idItem, '1', $idUser); } header("location:VentaFacil.php?CmbPreVentaAct={$idPreventa}"); } ////Se recibe edicion if (!empty($_REQUEST['TxtEditar'])) { $idItem = $_REQUEST['TxtPrecotizacion']; $idPreventa = $_REQUEST['CmbPreVentaAct']; $Cantidad = $_REQUEST['TxtEditar']; $obVenta = new ProcesoVenta($idUser); $DatosPreventa = $obVenta->DevuelveValores('preventa', "idPrecotizacion", $idItem); $Subtotal = $DatosPreventa["ValorUnitario"] * $Cantidad; $DatosProductos = $obVenta->DevuelveValores('productosventa', "idProductosVenta", $DatosPreventa["ProductosVenta_idProductosVenta"]); $IVA = $Subtotal * $DatosProductos["IVA"]; $Total = $Subtotal + $IVA; $filtro = "idPrecotizacion";
$id = $_REQUEST['del']; $Tabla = $_REQUEST['TxtTabla']; $IdTabla = $_REQUEST['TxtIdTabla']; $IdPre = $_REQUEST['TxtIdPre']; mysql_query("DELETE FROM {$Tabla} WHERE {$IdTabla}='{$id}'") or die(mysql_error()); header("location:{$myPage}?CmbPreVentaAct={$IdPre}"); } if (!empty($_REQUEST['CmbIDProducto'])) { $DatosBuscar = explode(";", $_REQUEST['CmbIDProducto']); $idItem = $DatosBuscar[0]; $TablaItem = $DatosBuscar[1]; $fecha = date("Y-m-d"); $Cantidad = 1; $obVenta = new ProcesoVenta($idUser); $Cantidad = 1; $obVenta->AgregaPreventa($fecha, $Cantidad, $idPreventa, $idItem, $TablaItem); header("location:VentasRapidas.php?CmbPreVentaAct={$idPreventa}"); } ////Se recibe edicion if (!empty($_REQUEST['TxtEditar'])) { $obVenta = new ProcesoVenta($idUser); $idItem = $_REQUEST['TxtPrecotizacion']; //$idClientes=$_REQUEST['TxtIdCliente']; $idPreventa = $_REQUEST['CmbPreVentaAct']; $Cantidad = $_REQUEST['TxtEditar']; echo " {$Cantidad} {$idItem}"; //$ValorAcordado=$_REQUEST['TxtValorUnitario']; $DatosPreventa = $obVenta->DevuelveValores("preventa", "idPrecotizacion", $idItem); $ValorAcordado = $DatosPreventa["ValorAcordado"]; $idProducto = $DatosPreventa["ProductosVenta_idProductosVenta"]; $Tabla = $DatosPreventa["TablaItem"];