Exemple #1
0
<?php

include_once "../../login/check.php";
$cod = $_GET['cod'];
include_once "../../class/inventario.php";
$inventario = new inventario();
$dat = $inventario->mostrarTodoRegistro(" codinventario='{$cod}'", 1, "");
$dat = array_shift($dat);
include_once "../../class/materiaprima.php";
$materiaprima = new materiaprima();
$mat = $materiaprima->mostrarTodoRegistro("", 1, "nombre,codigo");
$titulo = "Modificar Inventario de Materia Prima";
$folder = "../../";
include_once $folder . "cabecerahtml.php";
include_once $folder . "cabecera.php";
?>
<div class="widgetbox box-inverse">
    <h4 class="widgettitle">REGISTRO DE NUEVO INVENTARIO DE MATERIA PRIMA </h4>
        <div class="widgetcontent wc1">
            <form name="provedor" class="stdform" method="post" action="actualizar.php">
                <input name="codinventario" value="<?php 
echo $cod;
?>
" type="hidden">
                <table class="table">
                    <tr>
                        <td width="200" class="der">MATERIA PRIMA</td>
                        <td><select name="codmateriaprima" id="codmateriaprima" class="input-xl" autofocus>
                            <?php 
foreach ($mat as $m) {
    ?>
include_once "../../login/check.php";
$folder = "../../";
$Cod = $_GET['Cod'];
$titulo = "NDetalleInventario";
include_once "../../class/producto.php";
$producto = new producto();
$pro = $producto->mostrarRegistro($Cod);
$pro = array_shift($pro);
include_once "../../class/productotipo.php";
$productotipo = new productotipo();
$protipo = $productotipo->mostrarRegistro($pro['CodProductoTipo']);
$protipo = array_shift($protipo);
//$pt=todolista($productotipo->mostrarTodoRegistro("",1,"Nombre"),"CodProductoTipo","Nombre","");
include_once "../../class/inventario.php";
$inventario = new inventario();
$inv = $inventario->mostrarTodoRegistro("CodProducto=" . $Cod);
include_once "../../class/usuario.php";
$usuario = new usuario();
include_once "../../class/optica.php";
$optica = new optica();
if (in_array($_SESSION['Nivel'], array(1, 2, 3))) {
    $sw = 1;
} else {
    $sw = 0;
}
include_once $folder . "cabecerahtml.php";
?>
<script language="javascript">
configuracion={todayBtn: false, endDate: "'0d'"};
</script>
<?php 
 $cantidadproducto = $d['cantidad'] * $pmp['cantidad'];
 //echo $cantidadproducto;
 /*echo "<pre>";
   print_r($pmp);    
   echo "</pre>";*/
 /*Comienza a Descontar*/
 $inv = $inventario->SumaTotal($pmp['codmateriaprima']);
 $inv = array_shift($inv);
 $totalproducto = $inv['cantidadstocktotal'];
 $cantidad = $cantidadproducto;
 $fechasalida = date("Y-m-d");
 if ($totalproducto < $cantidad) {
     $mensaje[] = "No Existe en Inventario la Cantidad que Solicita<hr><strong><br>Nombre Producto: {$nombreproducto}<br>Cantidad de Inventario: {$totalproducto}<br>Cantidad de Solicitada: {$cantidad}</strong>";
 } else {
     $inventario->campos = array("*");
     foreach ($inventario->mostrarTodoRegistro("codmateriaprima=" . $pmp['codmateriaprima'] . " and cantidadstock>0", 1, "fecha") as $inv) {
         if ((double) $cantidad <= (double) $inv['cantidadstock']) {
             //echo "Si";
             $mensaje[] = "La Salida del producto <b>" . mb_strtoupper($nombreproducto, "utf8") . " </b>se registro correctamente";
             $cantidad = $inv['cantidadstock'] - $cantidad;
             $valores = array("cantidadstock" => "{$cantidad}", "fechasalida" => "'{$fechasalida}'");
             $inventario->actualizarRegistro($valores, "codinventario=" . $inv["codinventario"]);
             $valores = array("codmateriaprima" => "'" . $pmp['codmateriaprima'] . "'", "codproducto" => "'" . $d['codproducto'] . "'", "codpedido" => "'" . $codpedido . "'", "codpedidodetalle" => "'" . $codpedidodetalle . "'", "cantidad" => "'" . $cantidadproducto . "'", "fechasalida" => "'" . $fechasalida . "'");
             /*echo "<pre>";
               print_r($valores);    
               echo "</pre>";*/
             $inventariosalida->insertarRegistro($valores);
             break;
         } else {
             $cantidad = $cantidad - $inv['cantidadstock'];
             $valores = array("cantidadstock" => 0, "fechasalida" => "'{$fechasalida}'");
Exemple #4
0
<?php

extract($_POST);
include_once "../../class/inventario.php";
$inventario = new inventario();
include_once "../../class/materiaprima.php";
$materiaprima = new materiaprima();
$fecha = $fecha != "" ? $fecha : '%';
$inv = $inventario->mostrarTodoRegistro(" codmateriaprima LIKE '{$codmateriaprima}' and fecha LIKE '{$fecha}'", 1, "");
?>
<table class="table table-bordered table-striped table-hover">
<thead>
<tr><th width="50">Nº</th><th>Código</th><th>Nombre</th><th>Unidad</th><th>Cantidad Recargada</th><th>Cantidad en Stock</th><th>Fecha de Recarga</th></tr>
</thead>
<?php 
foreach ($inv as $in) {
    $i++;
    $cmp = $materiaprima->mostrarTodoRegistro(" codmateriaprima=" . $in['codmateriaprima'], 1, "nombre");
    $cmp = array_shift($cmp);
    ?>
<tr>
    <td class="der"><?php 
    echo $i;
    ?>
</td>
    <td><?php 
    echo $cmp['codigo'];
    ?>
</td>
    <td><?php 
    echo $cmp['nombre'];