if ($_POST["getShoeProperties"]) { $stockid = $_POST["stockid"]; $query = new Query(); $shoe = $query->select("shoe.colorid, shoe.modelid, shoe.sizesid", "detail_stock s join shoe on s.shoeid = shoe.shoeid", "s.stockid = {$stockid}", "", "arr"); if ($shoe == null) { $miArray = array("error" => "El producto no existe."); echo json_encode($miArray); } else { $miArray = array("error" => null, "colorid" => $shoe[0], "modelid" => $shoe[1], "sizesid" => $shoe[2]); echo json_encode($miArray); } } else { if ($_POST["sendShoe"]) { $transactionid = $_POST["transactionid"]; $employeeid_sender = $_POST["employeeid_sender"]; $branchid = getBranchId(); $query = new Query(); $em = $query->select("employeeid", "employee", "employeeid = {$employeeid_sender}", "and branchid = {$branchid}", "arr"); $tr = $query->select("transitionid", "transition_shoe_log", "transitionid = {$transactionid}", "", "arr"); if ($em != null && $tr != null) { if ($query->update("transition_shoe_log", "employeeid_sender = {$employeeid_sender}", "transitionid = {$transactionid}", "")) { $miArray = array("error" => null); echo json_encode($miArray); } else { $miArray = array("error" => "La transacción no ha podido ser modificada."); echo json_encode($miArray); } } else { $miArray = array("error" => "Los datos no son correctos, verifique sus datos."); echo json_encode($miArray); }
function getShoes($branchid) { $query = new Query(); $stocks = $query->select("s.stockid as id, shoe.price as price, m.title as model, c.title as color, z.size as size, b.name as branch_name, b.address as branch_address, s.status, b.branchid", "detail_stock s\n\t\t\tjoin shoe on s.shoeid = shoe.shoeid\n\t\t\tjoin model m on m.modelid = shoe.modelid\n\t\t\tjoin sizes z on z.sizesid = shoe.sizesid\n\t\t\tjoin color c on c.colorid = shoe.colorid\n\t\t\tjoin branch b on b.branchid = s.branchid", "b.branchid = {$branchid} and (s.status = 0 or s.status = 1 or s.status = 3) order by s.status", "", "obj"); if (count($stocks) > 0) { echo "<table id='tableShoes' class='table table-striped'><thead><tr>\n\t\t\t\t<th>Modelo</th>\n\t\t\t\t<th>Talla</th>\n\t\t\t\t<th>Color</th>\n\t\t\t\t<th>Precio</th>\n\t\t\t\t<th>Sucursal</th>\n\t\t\t\t<th>Agregar</th>\n\t\t\t\t<th>Acción</th>\n\t\t\t\t</tr></thead><tbody>"; foreach ($stocks as $stock) { $transacciones = $query->select("stockid", "transition_shoe_log", "stockid = {$stock->id}", "and employeeid_receiber is null", "obj"); echo '<tr> <td>' . $stock->model . '</td> <td>' . $stock->size . '</td> <td>' . $stock->color . '</td> <td class="viewDiscount">' . $stock->price . '</td> <td><code>' . $stock->branch_name . '</code> <i class="icon-home icon-small"></i> ' . $stock->branch_address . '</td>'; if ($stock->status == 1) { echo '<td><i class="icon-frown icon-small"></i> No disponible</td> <td><i class="icon-frown icon-small"></i> No disponible</td>'; } else { if (count($transacciones) > 0) { echo '<td><span class="glyphicon glyphicon-send" aria-hidden="true"></span> Importando...</td> <td><span class="glyphicon glyphicon-send" aria-hidden="true"></span> Importando...</td>'; } else { echo '<td><a href="#" class="addShoeList" stockid=' . $stock->id . '><span class="glyphicon glyphicon-plus"></span> Lista de Venta</a></td>'; if (getBranchId() == $stock->branchid) { echo '<td><a role="button" stockid=' . $stock->id . ' data-loading-text="Importando..." class="btn btn-primary btn-sm orderImport" disabled="disabled"><span class="glyphicon glyphicon-import"></span> Importar</a></td>'; } else { echo '<td><a role="button" stockid=' . $stock->id . ' branchid=' . $stock->branchid . ' data-loading-text="Importando..." class="btn btn-primary btn-sm orderImport" autocomplete="off"><span class="glyphicon glyphicon-import"></span> Importar</a></td>'; } } } echo '</tr>'; } echo "</tbody></table>"; } else { echo "<div class='alert alizarin' role='alert'>No hay resultados para la búsqueda.</div>"; } }
</div> <div id="liveclock" style="background:#34495E;color:#fff;border-radius:10px;padding:5px 10px 5px 25px;" class="block"></div> </div> </div> <div class="row"> <div class="col-xs-12"> <ul class="nav nav-tabs nav-justified" id="tablasProductos"> <li role="presentation" class="active" id="busquedaProductosTab"><a href="#busquedaProductos" aria-controls="busquedaProductos" role="tab" data-toggle="tab">Productos</a></li> <li role="presentation" id="listaVentasTab"><a href="#listaVentas" aria-controls="listaVentas" role="tab" data-toggle="tab">Lista de Venta</a></li> </ul> <div class="tab-content"> <div id="busquedaProductos" class="panel panel-warning tab-pane fade in active" role="tabpanel"> <div class="panel-heading">Resultados de Búsqueda</div> <div id="search_shoe_result" class="panel-body"> <?php getShoes(getBranchId()); ?> </div> </div> <div id="listaVentas" class="panel panel-warning tab-pane fade" role="tabpanel"> <div class='panel-heading'> <p> Lista de Venta <button type="button" id="add-list-shoe-qr" class="btn btn-success pull-right play-qr"><i class='icon-qrcode icon-small'></i> Agregar con QR</button> <button type="button" id="realizaVenta" class="btn btn-primary pull-right" ><span class='glyphicon glyphicon-new-window'></span> Realizar</button> </p> </div> <div class='panel-body'> <?php if (existSaleList(getUsuId()) == 0) { echo "<div id='noResultSaleList' class='alert alizarin' role='alert'>Aún no hay listas de venta por mostrar.</div>";