예제 #1
0
파일: procesa.php 프로젝트: jalvaran/SCTV52
        $y = substr($nit, $i, 1);
        $x += $y * $arr[$z - $i];
    }
    $y = $x % 11;
    if ($y > 1) {
        $dv = 11 - $y;
        return $dv;
    } else {
        $dv = $y;
        return $dv;
    }
}
//////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>';
    }