private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $stock = new stock();
     $articulo = new articulo();
     $codfamilia = '';
     if (isset($_REQUEST['codfamilia'])) {
         $codfamilia = $_REQUEST['codfamilia'];
     }
     $codfabricante = '';
     if (isset($_REQUEST['codfabricante'])) {
         $codfabricante = $_REQUEST['codfabricante'];
     }
     $con_stock = isset($_REQUEST['con_stock']);
     $this->results = $articulo->search($this->query, 0, $codfamilia, $con_stock, $codfabricante);
     /// añadimos la busqueda, el descuento, la cantidad, etc...
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->cantidad = 1;
         /// añadimos el stock de cada almacén
         $this->results[$i]->origen = 0;
         if (isset($_REQUEST['origen'])) {
             $this->results[$i]->origen = $stock->total_from_articulo($this->results[$i]->referencia, $_REQUEST['origen']);
         }
         $this->results[$i]->destino = 0;
         if (isset($_REQUEST['destino'])) {
             $this->results[$i]->destino = $stock->total_from_articulo($this->results[$i]->referencia, $_REQUEST['destino']);
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
 public function __construct()
 {
     parent::__construct();
     $this->vars = new config_vars();
     $this->vars->load_vars();
     $this->modulo = 'almacen';
     $this->submodulo = 'aprobar_ajustes';
     $this->seccion = 'ajustes';
     $this->icon = 'fa fa-thumbs-up';
     //Icono de modulo
     $this->path = $this->modulo . '/' . $this->submodulo . '/';
     //almacen/entradas_recepcion/
     $this->view_content = 'content';
     $this->limit_max = 10;
     $this->offset = 0;
     // Tabs
     $this->tab1 = 'agregar';
     $this->tab2 = 'listado';
     $this->tab3 = 'detalle';
     //$this->tab3 			= 'listado_afectado';
     // DB Model
     $this->load->model($this->modulo . '/' . $this->seccion . '_model', 'db_model');
     $this->load->model($this->modulo . '/catalogos_model', 'catalogos_model');
     $this->load->model('stock_model', 'stock_model');
     // Diccionario
     $this->lang->load($this->modulo . '/' . $this->seccion, "es_ES");
     // Tabs
     $this->tab_inicial = 2;
     $this->tab_indice = array($this->tab1, $this->tab2, $this->tab3);
     for ($i = 0; $i <= count($this->tab_indice) - 1; $i++) {
         $this->tab[$this->tab_indice[$i]] = $this->tab_indice[$i];
     }
 }
示例#3
0
 /**
  * 实例化类和指定API KEY
  * @param  apikey  string
  * @return instance object
  */
 public static function getInstance($apikey)
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
         self::$apikey = $apikey;
     }
     return self::$instance;
 }
示例#4
0
 /**
  * Suma la cantidad especificada al stock del artículo en el almacén especificado.
  * @param type $almacen
  * @param type $cantidad
  * @param type $recalcula_coste
  * @return boolean
  */
 public function sum_stock($almacen, $cantidad = 1, $recalcula_coste = FALSE)
 {
     if ($this->nostock) {
         return TRUE;
     } else {
         $result = FALSE;
         $stock = new stock();
         $encontrado = FALSE;
         $stocks = $stock->all_from_articulo($this->referencia);
         foreach ($stocks as $k => $value) {
             if ($value->codalmacen == $almacen) {
                 $stocks[$k]->sum_cantidad($cantidad);
                 $result = $stocks[$k]->save();
                 $encontrado = TRUE;
                 break;
             }
         }
         if (!$encontrado) {
             $stock->referencia = $this->referencia;
             $stock->codalmacen = $almacen;
             $stock->set_cantidad($cantidad);
             $result = $stock->save();
         }
         if ($result) {
             $nuevo_stock = $stock->total_from_articulo($this->referencia);
             if ($this->stockfis != $nuevo_stock) {
                 $this->stockfis = $nuevo_stock;
                 if ($recalcula_coste) {
                     $this->costemedio = $this->get_costemedio();
                 }
                 if ($this->exists) {
                     $this->clean_cache();
                     $result = $this->db->exec("UPDATE " . $this->table_name . " SET stockfis = " . $this->var2str($this->stockfis) . ",\n                     costemedio = " . $this->var2str($this->costemedio) . " WHERE referencia = " . $this->var2str($this->referencia) . ";");
                 } else {
                     if (!$this->save()) {
                         $this->new_error_msg("¡Error al actualizar el stock del artículo!");
                     }
                 }
             }
         } else {
             $this->new_error_msg("¡Error al guardar el stock!");
         }
         return $result;
     }
 }
示例#5
0
<?php

include_once "../../login/check.php";
/*echo "<pre>";
print_r($_POST);
echo "</pre>";*/
include_once "../../class/stocksalida.php";
$stocksalida = new stocksalida();
include_once "../../class/stock.php";
$stock = new stock();
include_once "../../class/producto.php";
$producto = new producto();
extract($_POST);
foreach ($p as $r) {
    /*echo "<pre>";
      print_r($r);
      echo "</pre>";
      echo "<hr>";*/
    $codproducto = $r['codproducto'];
    $pr = array_shift($producto->mostrarTodoRegistro("codproducto=" . $codproducto));
    $nombreproducto = $pr['nombre'];
    $inv = $stock->sumarTotalProducto($r['codproducto']);
    $inv = array_shift($inv);
    $totalproducto = $inv['cantidadtotalstock'];
    $cantidad = $r['cantidad'];
    $fechasalida = $r['fechasalida'];
    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 {
        $stock->campos = array("*");
        foreach ($stock->mostrarTodoRegistro("codproducto={$codproducto} and cantidadstock>0", 1, "fecha") as $inv) {
        $_SESSION["lista"] = $arr;
    }
    header("Location: paso.php?c=5");
} else {
    //NOTA:FALTA DESCONTAR DE STOCK SI EL ID DE OBRA ES 0;
    $stock = new stock();
    $idobra = $_POST["obras"];
    if ($idobra == "Ninguna") {
        $idobra = 0;
    }
    $folio = $_SESSION["folio"];
    $fecha = time();
    $fechaactual = date("Y-m-d h:m:s", $fecha);
    $arr = $_SESSION["lista1"];
    $ejecuta = new ejecuta();
    $stock = new stock();
    //ingresar retiro
    $contiene = new contiene();
    $retiro = new retiro();
    $retiro->Add($_POST["nombreD"], $_POST["motivo"], 0);
    $sretiro = $retiro->Select2($_POST["nombreD"], $_POST["motivo"], 0);
    $rowretiro = mysql_fetch_array($sretiro);
    //ingresar ejecuta
    for ($i = 0; $i < count($arr); $i++) {
        $n = "cantidad" . $i;
        $ejecuta->Add($rowretiro["ID_RETIRO"], $arr[$i][0], $_POST["unidadp"], $folio, $fechaactual, $_POST["{$n}"]);
        $contiene->Update($_POST["{$n}"], $arr[$i][0], $idobra);
        if ($idobra == 0) {
            //descontar de stock si es que se saca de bodega general osea el id de obra es 0
            $stock->UpdateRC($arr[$i][0], $_POST["{$n}"]);
        }
示例#7
0
<?php

include_once "../../login/check.php";
$cod = $_GET['cod'];
include_once "../../class/stock.php";
$stock = new stock();
$dat = $stock->mostrarTodoRegistro(" codstock='{$cod}'", 1, "");
$dat = array_shift($dat);
include_once "../../class/producto.php";
$producto = new producto();
$prod = $producto->mostrarTodoRegistro("", 1, "nombre,codigo");
$titulo = "Modificar Stock";
$folder = "../../";
include_once $folder . "cabecerahtml.php";
include_once $folder . "cabecera.php";
?>
<div class="widgetbox box-inverse">
    <h4 class="widgettitle">REGISTRO DE STOCK </h4>
        <div class="widgetcontent wc1">
            <form name="provedor" class="stdform" method="post" action="actualizar.php">
                <input name="codstock" value="<?php 
echo $cod;
?>
" type="hidden">
                <table class="table">
                    <tr>
                        <td width="200" class="der">PRODUCTO</td>
                        <td><select name="codproducto" id="codproducto" class="input-xl" autofocus required>
                            <?php 
foreach ($prod as $p) {
    ?>
示例#8
0
<?php

include "../../../system.php";
include "../../system.php";
include "../../../function/new_function.php";
include "stock_unit.php";
//System-----------------------------------------------------------
$now_table = $pro_stock_table;
//System-----------------------------------------------------------
$tool = new My_Tool();
$sam = new guard();
$unit = new stock();
$id = $_POST['id'];
$num = $_POST['num'];
$unit->table = $now_table;
$unit->id = $id;
$unit->get_db_var();
$unit->num = $num;
$unit->upd();
 if ($obra == "Ninguna") {
     $idobra = 0;
 } else {
     $idobra = $obra;
 }
 //$obra1=new obra();
 //$rowobra=$obra1->Select($obra);
 //$idobra=mysql_fetch_array($rowobra);
 //observacion
 $observ = $_POST["ObservacionDoc"];
 //objeto clase contiene
 $cont = new contiene();
 //objeto clase documento
 $doc = new documento();
 //objeto clase stock
 $stock = new stock();
 //lista de materiales
 $arr = $_SESSION["lista1"];
 //buscar documento
 $docs = $doc->Select($ndoc);
 //if($docs==null){
 //validar cantidades
 $a = 0;
 for ($i = 0; $i < count($arr); $i++) {
     $n = "cantidadr" . $i;
     if ($_POST["{$n}"] > $arr[$i][2] - $arr[$i][3]) {
         $a = $i + 1;
     }
 }
 if ($a != 0) {
     $_SESSION["mensajeIM"] = "CANTIDAD DEL MATERIAL " . $a . " ERRONEA";
 private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $fsvar = new fs_var();
     $multi_almacen = $fsvar->simple_get('multi_almacen');
     $stock = new stock();
     $articulo = new articulo();
     $codfamilia = '';
     if (isset($_REQUEST['codfamilia'])) {
         $codfamilia = $_REQUEST['codfamilia'];
     }
     $codfabricante = '';
     if (isset($_REQUEST['codfabricante'])) {
         $codfabricante = $_REQUEST['codfabricante'];
     }
     $con_stock = isset($_REQUEST['con_stock']);
     $this->results = $articulo->search($this->query, 0, $codfamilia, $con_stock, $codfabricante);
     /// añadimos la busqueda, el descuento, la cantidad, etc...
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->dtopor = 0;
         $this->results[$i]->cantidad = 1;
         $this->results[$i]->stockalm = $this->results[$i]->stockfis;
         if ($multi_almacen and isset($_REQUEST['codalmacen'])) {
             $this->results[$i]->stockalm = $stock->total_from_articulo($this->results[$i]->referencia, $_REQUEST['codalmacen']);
         }
     }
     /// ejecutamos las funciones de las extensiones
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'function' and $ext->params == 'new_search') {
             $name = $ext->text;
             $name($this->db, $this->results);
         }
     }
     /// buscamos el grupo de clientes y la tarifa
     if (isset($_REQUEST['codcliente'])) {
         $cliente = $this->cliente->get($_REQUEST['codcliente']);
         if ($cliente) {
             if ($cliente->codgrupo) {
                 $grupo0 = new grupo_clientes();
                 $tarifa0 = new tarifa();
                 $grupo = $grupo0->get($cliente->codgrupo);
                 if ($grupo) {
                     $tarifa = $tarifa0->get($grupo->codtarifa);
                     if ($tarifa) {
                         $tarifa->set_precios($this->results);
                     }
                 }
             }
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
示例#11
0
<?php

$l = $_POST['l'];
include_once "../../class/producto.php";
$producto = new producto();
$prod = $producto->mostrarTodoRegistro("", 1, "nombre,codigo");
include_once "../../class/stock.php";
$stock = new stock();
?>
<tr>
    <td><?php 
echo $l;
?>
</td>
    <td>
        <select name="p[<?php 
echo $l;
?>
][codproducto]" class="codproducto input-xl" rel="<?php 
echo $l;
?>
">
            <option value="">Ninguno</option>
            <?php 
foreach ($prod as $m) {
    $stock->campos = array("sum(cantidadstock) as cantidadstock");
    $st = $stock->mostrarTodoRegistro("codproducto=" . $m['codproducto'], 1, "");
    $st = array_shift($st);
    $cantidad = $st['cantidadstock'];
    ?>
            <option value="<?php 
示例#12
0
<?php

extract($_POST);
include_once "../../class/stock.php";
$stock = new stock();
$inventariostock = $stock->mostrarTodoRegistro(" codproducto LIKE '{$codproducto}' ", 1, "");
include_once "../../class/producto.php";
$producto = new producto();
?>
<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 ($inventariostock as $st) {
    $i++;
    $pro = $producto->mostrarTodoRegistro(" codproducto=" . $st['codproducto'], 1, "nombre");
    $pro = array_shift($pro);
    ?>
<tr>
    <td class="der"><?php 
    echo $i;
    ?>
</td>
    <td><?php 
    echo $pro['codigo'];
    ?>
</td>
    <td><?php 
    echo $pro['nombre'];
    ?>
示例#13
0
 private function new_search()
 {
     /// desactivamos la plantilla HTML
     $this->template = FALSE;
     $fsvar = new fs_var();
     $multi_almacen = $fsvar->simple_get('multi_almacen');
     $stock = new stock();
     $this->results = $this->search_from_proveedor();
     /// completamos los datos de la búsqueda
     foreach ($this->results as $i => $value) {
         $this->results[$i]->query = $this->query;
         $this->results[$i]->coste = $value->preciocoste();
         $this->results[$i]->dtopor = 0;
         $this->results[$i]->cantidad = 1;
         $this->results[$i]->coddivisa = $this->empresa->coddivisa;
         /// si tenemos un codproveedor, ahí que buscar el coste para este proveedor
         if (isset($_REQUEST['codproveedor'])) {
             $ap = $this->articulo_prov->get_by($value->referencia, $_REQUEST['codproveedor']);
             if ($ap) {
                 $this->results[$i]->coste = $ap->precio;
                 $this->results[$i]->dtopor = $ap->dto;
             }
         }
         /// añadimos el stock del almacén y el general
         $this->results[$i]->stockalm = $this->results[$i]->stockfis;
         if ($multi_almacen and isset($_REQUEST['codalmacen'])) {
             $this->results[$i]->stockalm = $stock->total_from_articulo($this->results[$i]->referencia, $_REQUEST['codalmacen']);
         }
         /// convertimos la divisa
         if (isset($_REQUEST['coddivisa'])) {
             if ($_REQUEST['coddivisa'] != $this->empresa->coddivisa) {
                 $this->results[$i]->coddivisa = $_REQUEST['coddivisa'];
                 $this->results[$i]->coste = $this->divisa_convert($value->coste, $this->empresa->coddivisa, $_REQUEST['coddivisa']);
                 $this->results[$i]->pvp = $this->divisa_convert($value->pvp, $this->empresa->coddivisa, $_REQUEST['coddivisa']);
             }
         }
     }
     /// ejecutamos las funciones de las extensiones
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'function' and $ext->params == 'new_search') {
             $name = $ext->text;
             $name($this->db, $this->results);
         }
     }
     header('Content-Type: application/json');
     echo json_encode($this->results);
 }
示例#14
0
<?php

include "../../../system.php";
include "../../system.php";
include "../../../function/new_function.php";
include "stock_unit.php";
//System-----------------------------------------------------------
$now_table = $pro_stock_table;
$color_table = $pro_color_relate_table;
$size_table = $pro_size_relate_table;
//System-----------------------------------------------------------
$tool = new My_Tool();
$sam = new guard();
$unit = new stock();
$unit->table = $now_table;
$id = $pid = $_POST['id'];
//Make ID List --Color  ---------------------------------------------------------------
$ColorID = array();
$sql = "select id from `{$color_table}` where upid='" . $id . "' order by id DESC";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
    array_push($ColorID, $row['id']);
}
//End  ---------------------------------------------------------------------------------
//Make ID List --Size  ---------------------------------------------------------------
$SizeID = array();
$sql = "select id from `{$size_table}` where upid='" . $id . "' order by id DESC";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
    array_push($SizeID, $row['id']);
}
示例#15
0
 public function standard_settle($db, $standardcount)
 {
     $users = new users();
     $bizset = new bizset();
     $award = new award();
     //获取最新结算号
     $settle_no = self::get_settle_no();
     //获取最新股价
     $stockinfo = new stock();
     $new_price = $stockinfo->get_newprice(1);
     //根据等级获取达标金额
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE2");
     $standard_price2 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE3");
     $standard_price3 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE4");
     $standard_price4 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE5");
     $standard_price5 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE6");
     $standard_price6 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE7");
     $standard_price7 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE8");
     $standard_price8 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE9");
     $standard_price9 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE10");
     $standard_price10 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PRICE11");
     $standard_price11 = $bizsetinfo["bizvalue"];
     //根据等级获取达标分红比例
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT2");
     $standard_percent2 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT3");
     $standard_percent3 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT4");
     $standard_percent4 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT5");
     $standard_percent5 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT6");
     $standard_percent6 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT7");
     $standard_percent7 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT8");
     $standard_percent8 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT9");
     $standard_percent9 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT10");
     $standard_percent10 = $bizsetinfo["bizvalue"];
     $bizsetinfo = $bizset->get_bizset_bykey("STANDARD_PERCENT11");
     $standard_percent11 = $bizsetinfo["bizvalue"];
     //遍历users
     $query = $db->query("select * from users where states = 1");
     $count = $db->num_rows($query);
     for ($i = 0; $i < $count; $i++) {
         $row = $db->fetch_array($query);
         $uid = $row["id"];
         $usersinfo = $users->get_user_byid($uid);
         $stock = $usersinfo["stock"];
         //用户投资额
         //$user_stock_price = $stock*$new_price;
         //获取达标个数
         $pidcount = $users->get_usercount_bypid($uid);
         if ($pidcount == $standardcount) {
             //判断三个市场是否都达标 获取达标系数
             $sql_standard = "select * from users where states = 1 and pid = " . $uid;
             $query_standard = $db->query($sql_standard);
             for ($i = 0; $i < $standardcount; $i++) {
                 $row_standard = $db->fetch_array($query_standard);
                 $uid_standard = $row_standard["id"];
                 $usersids = $users->getrecursiveallusersid($uid_standard);
                 $usersids = substr($usersids, 0, strlen($usersids) - 1);
                 if (strlen($usersids) <= 0) {
                     $usersids = "0";
                 }
                 if ($usersids != "0") {
                     //$sql = "select sum(stock) as price from users where id in ($usersids) ";
                     //获取投资者投资额
                     $sql = "select abs(sum(amount)) as price  from income where types='BUYSTOCK' and userid = {$uid}";
                     $query_s = $db->query($sql);
                     $result = $db->fetch_array($query_s);
                     $sumamount = $result["price"];
                     //用户投资额
                     //$sumamount = $sumamount*$new_price;
                     //达标分红比例
                     if ($sumamount >= $standard_price11) {
                         $percent = $standard_percent11;
                         $standard_amout = $standard_price11;
                     } else {
                         if ($sumamount >= $standard_price10) {
                             $percent = $standard_percent10;
                             $standard_amout = $standard_price10;
                         } else {
                             if ($sumamount >= $standard_price9) {
                                 $percent = $standard_percent9;
                                 $standard_amout = $standard_price9;
                             } else {
                                 if ($sumamount >= $standard_price8) {
                                     $percent = $standard_percent8;
                                     $standard_amout = $standard_price8;
                                 } else {
                                     if ($sumamount >= $standard_price7) {
                                         $percent = $standard_percent7;
                                         $standard_amout = $standard_price7;
                                     } else {
                                         if ($sumamount >= $standard_price6) {
                                             $percent = $standard_percent6;
                                             $standard_amout = $standard_price6;
                                         } else {
                                             if ($sumamount >= $standard_price5) {
                                                 $percent = $standard_percent5;
                                                 $standard_amout = $standard_price5;
                                             } else {
                                                 if ($sumamount >= $standard_price4) {
                                                     $percent = $standard_percent4;
                                                     $standard_amout = $standard_price4;
                                                 } else {
                                                     if ($sumamount >= $standard_price3) {
                                                         $percent = $standard_percent3;
                                                         $standard_amout = $standard_price3;
                                                     } else {
                                                         if ($sumamount >= $standard_price2) {
                                                             $percent = $standard_percent2;
                                                             $standard_amout = $standard_price2;
                                                         } else {
                                                             $percent = 0;
                                                             break;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             //根据分红比例加权分红
             $usersids_all = $users->getrecursiveallusersid($uid);
             $usersids_all = substr($usersids_all, 0, strlen($usersids_all) - 1);
             if (strlen($usersids_all) <= 0) {
                 $usersids_all = "0";
             }
             if ($usersids_all != "0" && $percent > 0) {
                 self::award_standard_settle($db, $uid, $usersids_all, $percent, $settle_no, $standard_amout);
             }
         }
         //更新结算状态变成已结算,并将结算期号增加到income表
         $sql = "update income set  settlementno = '" . $settle_no . "' where  (settlementno is null or settlementno='') and userid ={$uid} ";
         $db->query($sql);
     }
     //将本次结算设置为已结算
     $sql = "update settlement set states = 1 where numbers = '" . $settle_no . "'";
     $db->query($sql);
 }
示例#16
0
<?php

include_once "../../login/check.php";
extract($_POST);
include_once "../../class/stock.php";
$stock = new stock();
$valores = array("codproducto" => "'{$codproducto}'", "cantidad" => "'{$cantidad}'", "cantidadstock" => "'{$cantidad}'", "observacion" => "'{$observacion}'");
$stock->insertarRegistro($valores);
$folder = "../../";
include_once $folder . "cabecerahtml.php";
include_once $folder . "cabecera.php";
?>
<div class="widgetbox box-inverse">
    <h4 class="widgettitle">Mensaje de Confirmación</h4>
        <div class="widgetcontent wc1">
            <h5>Sus Datos se Registraron Correctamente</h5>
            <br>
            <a href="./" class="btn btn-primary">NUEVO</a>
            <a href="listar.php" class="btn btn-default">LISTAR</a>
        </div>
</div>
<?php 
include_once $folder . "pie.php";
示例#17
0
 public function split_stock($split_num, $sid)
 {
     $db = new DB();
     $db->Connect(DBHOST, DBUSER, DBPW, DBNAME);
     //系统总股仓更新
     $stock = new stock();
     $stockconfig = $stock->get_stockconfig(1);
     $allsotckcount = $stockconfig["counts"];
     $sql = "update stock set counts = {$allsotckcount}*{$split_num}  where id={$sid}";
     $db->query($sql);
     //股价更新
     $sql = "select * from stock_price where sid = {$sid}  order by id desc limit 1";
     $query = $db->query($sql);
     $result = $db->fetch_array($query);
     $now_price = $result["price"];
     $now_price_id = $result["id"];
     $split_price = $now_price / $split_num;
     $sql = "update stock_price set price = {$split_price} where id={$now_price_id}";
     $db->query($sql);
     //用户股票更新
     $sql = "select * from users where states = 1 ";
     $query = $db->query($sql);
     $count = $db->num_rows($query);
     for ($i = 0; $i < $count; $i++) {
         $row = $db->fetch_array($query);
         $uid = $row["id"];
         $old_stock = $row["stock"];
         $new_stock = $old_stock * $split_num;
         //更新user stock
         $sql = "update users set stock=" . $new_stock . " where id={$uid}";
         $db->query($sql);
     }
 }
示例#18
0
<?php

include_once "../../login/check.php";
extract($_POST);
include_once "../../class/stock.php";
$stock = new stock();
$valores = array("codproducto" => "'{$codproducto}'", "cantidad" => "'{$cantidad}'", "cantidadstock" => "'{$cantidad}'", "observacion" => "'{$observacion}'");
$stock->actualizarRegistro($valores, "codstock=" . $codstock);
$folder = "../../";
include_once $folder . "cabecerahtml.php";
include_once $folder . "cabecera.php";
?>
<div class="widgetbox box-inverse">
    <h4 class="widgettitle">Mensaje de Confirmación</h4>
        <div class="widgetcontent wc1">
            <h5>Sus Datos se Registraron Correctamente</h5>
            <br>
            <a href="./" class="btn btn-primary">NUEVO</a>
            <a href="listar.php" class="btn btn-default">LISTAR</a>
        </div>
</div>
<?php 
include_once $folder . "pie.php";
示例#19
0
<?php

include_once "../../login/check.php";
$folder = "../../";
$cod = $_POST['cod'];
include_once "../../class/stock.php";
$stock = new stock();
$dat = $stock->eliminarRegistro("codstock=" . $cod);