Пример #1
0
<html>
<?php 
session_start();
$_SESSION["contador"]++;
//echo "contador ".$_SESSION["contador"]."<br>";
//echo "nuevaope ".$_SESSION["nuevaope"]."<br>";
$cat = $_POST['cbocat'];
include "GestionBD.php";
$obj = new GestionBD();
$cn = $obj->conectar();
if (isset($_SESSION["ope"])) {
    $vcodcli = substr($_SESSION["ope"], 14, 3);
} else {
    $vcodcli = $_GET["cod"];
}
if (isset($vcodcli)) {
    $fecha = date("d-m-Y");
}
$cad1 = "Select * from clientes where codcli='" . $vcodcli . "'";
$rs = $obj->ejecutarConsulta($cad1);
$fila = mysql_fetch_array($rs);
$rs = $obj->ejecutarConsulta("Select * from categoria");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sistema de Ventas Virtual</title>
<link href="plantilla.css" rel="stylesheet" type="text/css">
</head>
Пример #2
0
<?php

session_start();
include "GestionBD.php";
$obj = new GestionBD();
$cn = $obj->conectar();
$_SESSION["n"]++;
//echo "session N° ".$_SESSION["n"]."<br>";
if ($_SESSION["n"] == 1) {
    $cadena = "Select nrofac from facturas order by nrofac desc";
    $rs = $obj->ejecutarConsulta($cadena);
    $fila = mysql_fetch_array($rs);
    $nrofact = $fila[0] + 1;
    $nuevonro = str_pad($nrofact, 6, 0, 0);
    $_SESSION['nf'] = $nuevonro;
}
$hoy = date("Y-m-d");
$vcodcli = substr($_SESSION['ope'], 14, 3);
$cadena2 = "Select sum(total) from carrito where codope='" . $_SESSION['ope'] . "'";
$rs2 = $obj->ejecutarConsulta($cadena2);
$fila2 = mysql_fetch_array($rs2);
$total = $fila2[0];
$cadena3 = "Select * from carrito where codope='" . $_SESSION['ope'] . "'";
$rs3 = $obj->ejecutarConsulta($cadena3);
$cadena4 = "Select * from clientes where codcli='" . $vcodcli . "'";
//echo $cadena4;
$rs4 = $obj->ejecutarConsulta($cadena4);
$fila4 = mysql_fetch_array($rs4);
$vapecli = $fila4[1];
$vnomcli = $fila4[2];
$vdircli = $fila4[3];
Пример #3
0
<?php

session_start();
include "GestionBD.php";
$obj = new GestionBD();
$cn = $obj->conectar();
$cad = "select * from clientes where codcli='" . substr($_SESSION["ope"], 14, 3) . "'";
$rsc = $obj->ejecutarConsulta($cad);
$filac = mysql_fetch_array($rsc);
$vcodproducto = $_GET["codpro"];
//echo $vcodproducto."<br>";
//precio unitario
$pu = "select * from producto where codpro='" . $vcodproducto . "'";
$rspu = $obj->ejecutarConsulta($pu);
$filapu = mysql_fetch_array($rspu);
//echo $filapu[4]."<br>";
//insertar
//$cadinsertar="Insert into carrito values('".$_SESSION["ope"]."','".$vcodproducto."',1,'".number_format($filapu[4],2)."')";
//echo  $cadinsertar;
//$obj->ejecutarActualizacion($cadinsertar);
$cad4 = "Select * from carrito where codope='" . $ope . "' and codpro='" . $vcodproducto . "'";
$rs4 = $obj->ejecutarConsulta($cad4);
if (mysql_num_rows($rs4) == 0) {
    $cadinsertar = "Insert into carrito values('" . $_SESSION["ope"] . "','" . $vcodproducto . "',1,'" . number_format($filapu[4], 2) . "')";
    $obj->ejecutarActualizacion($cadinsertar);
} else {
    ?>
<script languaje="javascript">
//alert("Este producto ya existe...");
</script>
<?php