} } } } } } } } } else { $function = $_GET["function"]; if ($function == 'getPedidos') { getPedidos($_GET["all"]); } elseif ($function == 'getPedidoDetalles') { getPedidosDetalles($_GET["pedido_id"]); } elseif ($function == 'getStocks') { getStocks($_GET["reducido"]); } } /////// INSERT //////// /**Crea un pedido con fecha de entrega "vacia" = 0000-00-00 00:00:00 * @param $pedido */ function createPedido($pedido) { $db = new MysqliDb(); $db->startTransaction(); $item_decoded = checkPedido(json_decode($pedido)); $data = array('proveedor_id' => $item_decoded->proveedor_id, 'usuario_id' => $item_decoded->usuario_id, 'total' => $item_decoded->total, 'iva' => $item_decoded->iva, 'sucursal_id' => $item_decoded->sucursal_id); $result = $db->insert('pedidos', $data); if ($result > -1) { foreach ($item_decoded->pedidos_detalles as $pedido_detalle) {
public static function stock() { return getStocks(); }
#!/usr/bin/php <?php require_once 'func.inc.php'; getStocks();