예제 #1
0
파일: pedidos.inc.php 프로젝트: klich3/gPOS
 function CrearAlbaran($Origen, $Destino, $Motivo)
 {
     $this->_stockMover = array();
     $this->_origen = $Origen;
     $this->_destino = $Destino;
     $codigo = getNextId('ges_comprobantes', 'NComprobante');
     if (!$Origen or !$Destino) {
         return false;
     }
     //Compras
     $this->_IdPedido = $Motivo != '4' ? registrarAlbaranDestino($Destino, $Origen, $Motivo, $codigo, 'TrasLocal') : 0;
     //Ventas
     $this->_IdComprobante = registrarAlbaranOrigen($Destino, $Origen, $Motivo, $codigo, $this->_IdPedido);
 }
예제 #2
0
ob_start("ob_gzhandler", 0, PHP_OUTPUT_HANDLER_CLEANABLE);
$path = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $_SERVER["PATH_INFO"];
$isAPI = substr($path, -4) === "/api" ? true : false;
if ($isAPI) {
    $path = substr($path, 0, -4);
    header("Content-Type: application/json");
}
$path = explode("/", ltrim($path, "/"));
$main = array_shift($path);
$page = new TemplateStack();
$page[] = new Template("header", $isAPI);
switch ($main === "" ? "home" : $main) {
    case "home":
        $page[] = $tpl = new Template("home", $isAPI);
        if ($isAPI) {
            $tpl->addTransform("lastId", getNextId() - 1);
        }
        break;
    case "download":
    case "view":
        if (!isset($path[0])) {
            $error = new Template("error", $isAPI);
            $error->addTransform("message", "Please specify a report");
            $error->addTransform("url", "/home");
            $page[] = $error;
            break;
        }
        $reportId = (int) $path[0];
        $path = "reports/" . sha1($reportId . SECRET_SALT) . ".log";
        if (!file_exists($path)) {
            $error = new Template("error", $isAPI);
예제 #3
0
파일: selkardex.php 프로젝트: klich3/gPOS
 //>IdInventario
 $tipInvent = CleanText($_GET["xtipoinventario"]);
 //TipoInventario(inicial,final,etc)
 $esAjuste = $_GET["xinventario"] == "Ajuste" ? true : false;
 $esInvent = $_GET["xinventario"] == "Inventario" ? true : false;
 $esPendInvent = $_GET["xestinvent"] == "Pendiente" ? true : false;
 //EstadoInventario
 $esNewInvent = $esInvent && !$esPendInvent ? true : false;
 $esPedido = $esPendInvent && $xIdPedido != 0 ? true : false;
 $Motivo = $esAjuste ? 7 : 8;
 //7:Ajuste,8:Inventario>IdMotivoAlbaran
 $Operacion = $esAjuste ? 5 : 6;
 //5:Ajuste,6:Inventario>IdKardexOperacion
 $Destino = $IdLocal;
 $Origen = $IdLocal;
 $Codigo = getNextId('ges_comprobantesprov', 'IdComprobanteProv');
 $campoxdato = " EstadoPago='Exonerado',EstadoDocumento='Confirmado'," . " ImportePendiente=0";
 $vrKardex = getResumenKardex2Producto($IdProducto, $IdLocal);
 $CostoOP = CleanDinero($_GET["xcostoop"]);
 $mensajens = '';
 //Control cambios Remotos
 if (!($vrKardex == $xrKardex)) {
     echo "Operación cancelada por tener cambios remotos en kardex:\n" . "-  Para continuar carge nuevamente la busqueda.";
     return;
 }
 //Control NS activo
 if (getSerie2Producto($IdProducto)) {
     if (!$esSerie) {
         $mensajens = 'Habilitado';
     }
 }
예제 #4
0
		<link rel="stylesheet" type="text/css" href="style.css"/>
	</head>

	<body>
		<?php 
require 'logic.php';
require 'tables_dict.php';
if (isset($_POST['sequence_step'])) {
    $sequence_step = $_POST['sequence_step'];
} else {
    $sequence_step = 1;
}
$current_table = $tables_dict[$sequence_step];
$table_col_count = getColumnCount($current_table);
$names = getColumnNames($current_table);
$last_id = getNextId($current_table, $names[0]);
$stored_id_map = array();
if (isset($_POST['iterator'])) {
    rebuildStoredIdMap();
}
echo "\n\t\t\t<form action=\"connector.php\" method=\"post\">\n\t\t\t\t<table>";
for ($i = 0; $i < $table_col_count; $i++) {
    if ($i == 0) {
        $column_name = getColumnName($current_table, $i);
        $label = strval($column_name);
        $current_field = $i + 1;
        $stored_id_map[$column_name] = $last_id;
        echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>{$label}</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"field_" . $i . "\" value=\"" . $last_id . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_field\" value=\"" . $current_field . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_table\" value=\"" . $current_table . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"sequence_step\" value=\"" . $sequence_step . "\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>";
    } else {
        $column_name = getColumnName($current_table, $i);
        $label = strval($column_name);
예제 #5
0
function EjecutarTicket($idDependiente, $entregado, $IdLocal, $IdCliente, $modoTicket, $entregaEfectivo, $entregaBono, $entregaTarjeta, $cambio, $modoTPV, $IdMProducto, $Estado, $IdMetaProducto)
{
    global $TotalImporte;
    global $ImporteNeto;
    global $IvaImporte;
    global $carrito, $UltimaInsercion;
    global $trabajos;
    $ImporteNeto = $TotalImporte - $IvaImporte;
    $IGV = getSesionDato("IGV");
    $CBMP = $modoTicket == "endmproducto" ? $IdMProducto : generaCBMP();
    $TipoVenta = getSesionDato("TipoVentaTPV");
    $vigencia = getSesionDato("VigenciaPresupuesto");
    $SerialNum = "";
    //Ensamblaje
    if ($modoTicket == "mproducto") {
        $esquema = " IdProducto, IdLocal, FechaRegistro, TipoVentaOperacion," . " UsuarioAlmacen, Costo , Status, CBMetaProducto, IdCliente,VigenciaMetaProducto";
        $datos = " '{$IdMProducto}', '{$IdLocal}', NOW(),'{$TipoVenta}'," . " '{$idDependiente}', '{$TotalImporte}','{$Estado}','{$CBMP}','{$IdCliente}','{$vigencia}' ";
        //IdProducto IdLocal Fecha UsuarioAlmacen Costo Estado
        $sql = "INSERT INTO ges_metaproductos (" . $esquema . ")" . "VALUES (" . $datos . ")";
        $res = query($sql, "Inserta Metaproducto ({$CBMP})");
    }
    //Finaliza...
    if ($modoTicket == "endmproducto") {
        //Costo...
        $sql = " update ges_metaproductos " . " set    Costo           = '" . $TotalImporte . "'," . "        IdCliente       = '" . $IdCliente . "'" . " where  IdMetaProducto  = '" . $IdMetaProducto . "'";
        $res = query($sql, "Actualiza TotalCosto MetaProducto ({$IdMProducto})");
        //Finaliza MetaProducto...
        if ($Estado == "Finalizado") {
            //Registros...
            $IdProducto = getIdProductoFromIdMetaProducto($IdMetaProducto);
            $Destino = $IdLocal;
            $Origen = $IdLocal;
            $Motivo = '9';
            $Codigo = getNextId('ges_comprobantesprov', 'IdComprobanteProv');
            //Ventas
            $IdComprobante = registrarAlbaranOrigen($Destino, $Origen, $Motivo, $Codigo, 0);
            //Compras...
            $IdPedido = registrarAlbaranDestino($Destino, $Origen, $Motivo, $Codigo, 'MetaProducto');
            $Costo = $TotalImporte;
            $Precio = abs(intval((abs($TotalImporte) + abs($TotalImporte * $IGV / 100)) * 100) / 100.0);
            $LoteVence = 0;
            $Cantidad = 1;
            //Detale Mproducto...
            $IdPedidoDet = registrarDetalleTrasladoEntrada($IdPedido, $IdProducto, $LoteVence, $Cantidad, $Costo, $Precio, true);
            //Series Mproducto...
            registrarNumeroSerieExtra($IdProducto, $IdPedidoDet, $CBMP, false, 'Pedido', 'MetaProducto', '0');
            //Fecha ensamblaje...
            $sql = " update ges_metaproductos " . " set    FechaEnsamblaje = NOW(),IdComprobante = " . $IdComprobante . " where  FechaEnsamblaje = '0000-00-00 00:00:00'" . " and    IdMetaProducto  = '" . $IdMetaProducto . "'";
            query($sql);
            //Importes Compras & Ventas
            registrarImportesTraslado($TotalImporte, $IdComprobante, $IdPedido, '9');
        }
    }
    if (!$res) {
        return false;
    }
    //Detalles...
    if ($modoTicket != "endmproducto") {
        $IdMetaProducto = $UltimaInsercion;
    }
    if ($modoTicket == "endmproducto") {
        setDelDetMetaProducto($IdMetaProducto);
    }
    foreach ($carrito as $fila) {
        //Detalle Mproducto...
        $fila->AltaMProductos($IdMetaProducto);
        //Detalle Albaran...
        if ($Estado == "Finalizado" && $modoTicket == "endmproducto") {
            $fila->Alta($IdComprobante, $SerialNum, $IdLocal, "venta");
        }
    }
    //Numero Pre-Venta
    return $CBMP;
}