$bankcashLink = $bankcash->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) { $bankcb = new Account($db); $bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]); $bankcbLink = $bankcb->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) { $bankcheque = new Account($db); $bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]); $bankchequeLink = $bankcheque->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) { $warehouse = new Entrepot($db); $warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]); $warehouseLink = $warehouse->getNomUrl(1); } $langs->load("cashdesk"); $langs->load("main"); print '<div class="menu_bloc">'; print '<ul class="menu">'; // Link to new sell print '<li class="menu_choix1"><a href="affIndex.php?menu=facturation&id=NOUV"><span>' . $langs->trans("NewSell") . '</span></a></li>'; // Open new tab on backoffice (this is not a disconnect from POS) print '<li class="menu_choix2"><a href=".." target="backoffice"><span>' . $langs->trans("BackOffice") . '</span></a></li>'; // Disconnect print '<li class="menu_choix0">' . $langs->trans("User") . ': ' . $_SESSION['firstname'] . ' ' . $_SESSION['lastname']; print ' <a href="deconnexion.php">' . img_picto($langs->trans('Logout'), 'logout.png') . '</a><br>'; print $langs->trans("CashDeskThirdParty") . ': ' . $companyLink . '<br>'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
$productstatic->type = $objp->type; print $productstatic->getNomUrl(1, '', 16); print "</td>\n"; // Warehouse print '<td>'; //if($entrepot_origen != '') //{ $warehousestatic->id = $entrepot_id_origen; $warehousestatic->libelle = $entrepot_origen; //} //else //{ //$warehousestatic->id=$objp->entrepot_id; //$warehousestatic->libelle=$objp->stock; //} print $warehousestatic->getNomUrl(1); print "</td>\n"; // Checkpoint: Almacén Destino print '<td>'; //if($entrepot_destino != '') //{ $warehousestatic->id = $entrepot_id_destino; $warehousestatic->libelle = $entrepot_destino; //} //else //{ //$warehousestatic->id=$objp->entrepot_id; //$warehousestatic->libelle=$objp->stock; //} print $warehousestatic->getNomUrl(1); print "</td>\n";
print '<td align="center">'; if ($lines[$i]->fk_product_type == 0) { print $lines[$i]->volume * $lines[$i]->qty_shipped . ' ' . measuring_units_string($lines[$i]->volume_units, "volume"); } else { print ' '; } print '</td>'; // Size //print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>'; // Entrepot source if ($conf->stock->enabled) { print '<td align="left">'; if ($lines[$i]->entrepot_id > 0) { $entrepot = new Entrepot($db); $entrepot->fetch($lines[$i]->entrepot_id); print $entrepot->getNomUrl(1); } print '</td>'; } print "</tr>"; $var = !$var; } } print "</table>\n"; print "\n</div>\n"; /* * Boutons actions */ if ($user->societe_id == 0) { print '<div class="tabsAction">'; if ($object->statut == 0 && $num_prod > 0) {
$subj = 0; print '<input name="idl' . $indiceAsked . '" type="hidden" value="' . $line->id . '">'; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { $warehouseObject = new Entrepot($db); $warehouseObject->fetch($warehouse_id); if ($stock_warehouse->real > 0 && count($stock_warehouse->detail_batch)) { foreach ($stock_warehouse->detail_batch as $dbatch) { //var_dump($dbatch); $batchStock = +$dbatch->qty; // To get a numeric $deliverableQty = min($quantityToBeDelivered, $batchStock); print '<tr><td colspan="3"></td><td align="center">'; print '<input name="qtyl' . $indiceAsked . '_' . $subj . '" id="qtyl' . $indiceAsked . '_' . $subj . '" type="text" size="4" value="' . $deliverableQty . '">'; print '</td>'; print '<td align="left">'; print $warehouseObject->getNomUrl(0) . ' / '; print '<!-- Show details of lot -->'; print '<input name="batchl' . $indiceAsked . '_' . $subj . '" type="hidden" value="' . $dbatch->id . '">'; print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby, "day"), dol_print_date($dbatch->sellby, "day"), $dbatch->qty); $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) { $quantityToBeDelivered = 0; } //dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock); $subj++; print '</td></tr>'; } } } } if ($subj == 0) {
print '</td>'; print '<td class="liste_titre nowrap" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("RemoveFilter"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; print '</td>'; print '</tr>'; if ($num) { $entrepot = new Entrepot($db); $var = false; while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); $entrepot->id = $objp->rowid; $entrepot->libelle = $objp->ref; $entrepot->lieu = $objp->lieu; print "<tr " . $bc[$var] . ">"; print '<td>' . $entrepot->getNomUrl(1) . '</td>'; // Location print '<td>' . $objp->lieu . '</td>'; // Stock qty print '<td align="right">' . price2num($objp->stockqty, 5) . '</td>'; // PMP value print '<td align="right">'; if (price2num($objp->estimatedvalue, 'MT')) { print price(price2num($objp->estimatedvalue, 'MT'), 1); } else { print ''; } print '</td>'; // Selling value print '<td align="right">'; if (empty($conf->global->PRODUIT_MULTIPRICES)) {
$entrepotstatic = new Entrepot($db); $total = 0; $totalvalue = $totalvaluesell = 0; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $total = $totalwithpmp; $i = 0; $var = false; while ($i < $num) { $obj = $db->fetch_object($resql); $entrepotstatic->id = $obj->rowid; $entrepotstatic->libelle = $obj->label; $entrepotstatic->lieu = $obj->lieu; print '<tr ' . $bc[$var] . '>'; print '<td colspan="4">' . $entrepotstatic->getNomUrl(1) . '</td>'; print '<td align="right">' . $obj->reel . ($obj->reel < 0 ? ' ' . img_warning() : '') . '</td>'; // PMP print '<td align="right">' . (price2num($product->pmp) ? price2num($product->pmp, 'MU') : '') . '</td>'; // Value purchase print '<td align="right">' . (price2num($product->pmp) ? price(price2num($product->pmp * $obj->reel, 'MT')) : '') . '</td>'; // Sell price print '<td align="right">'; if (empty($conf->global->PRODUIT_MULTI_PRICES)) { print price(price2num($product->price, 'MU'), 1); } else { print $langs->trans("Variable"); } print '</td>'; // Value sell print '<td align="right">';
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) { print $regs[1] . ' ' . $langs->trans("DurationMonth"); } elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) { print $regs[1] . ' ' . $langs->trans("DurationDay"); } else { print $objp->duration; } print '</td>'; } //print '<td align="right">'.$objp->stock_theorique.'</td>'; //print '<td align="right">'.$objp->seuil_stock_alerte.'</td>'; //print '<td align="right">'.$objp->desiredstock.'</td>'; // Warehouse print '<td>'; $warehousetmp->fetch($obj->fk_entrepot); print $warehousetmp->getNomUrl(1); print '</td>'; print '<td align="center">' . $objp->batch . '</td>'; print '<td align="center">' . dol_print_date($db->jdate($objp->eatby), 'day') . '</td>'; print '<td align="center">' . dol_print_date($db->jdate($objp->sellby), 'day') . '</td>'; print '<td align="right">'; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique; print '</td>'; print '<td align="right"><a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?idproduct=' . $product_static->id . '&search_batch=' . $objp->batch . '">' . $langs->trans("Movements") . '</a></td>'; print '<td align="right" class="nowrap">' . $product_static->LibStatut($objp->statut, 5, 0) . '</td>'; print '<td align="right" class="nowrap">' . $product_static->LibStatut($objp->tobuy, 5, 1) . '</td>'; print "</tr>\n"; $i++; } print "</table>";
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial $staticwarehouse = new Entrepot($db); $staticwarehouse->fetch($warehouse_id); $subj = 0; print '<input name="idl' . $indiceAsked . '" type="hidden" value="' . $line->id . '">'; if (count($product->stock_warehouse[$warehouse_id]->detail_batch)) { foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) { //var_dump($dbatch); $substock = $dbatch->qty + 0; // To get a numeric print '<tr><td colspan="3" ></td><td align="center"><!-- qty to ship (with lot management) -->'; print '<input name="qtyl' . $indiceAsked . '_' . $subj . '" id="qtyl' . $indiceAsked . '_' . $subj . '" type="text" size="4" value="' . ($substock > 0 ? min($defaultqty, $substock) : '0') . '">'; print '</td>'; print '<td align="left">'; print $staticwarehouse->getNomUrl(0) . ' / '; print '<!-- Show details of lot -->'; print '<input name="batchl' . $indiceAsked . '_' . $subj . '" type="hidden" value="' . $dbatch->id . '">'; print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby, "day"), dol_print_date($dbatch->sellby, "day"), $dbatch->qty); if ($defaultqty <= 0) { $defaultqty = 0; } else { $defaultqty -= $substock > 0 ? min($defaultqty, $substock) : 0; } $subj++; } } else { print '<tr><td colspan="3" ></td><td align="center">'; print '<input name="qtyl' . $indiceAsked . '_' . $subj . '" id="qtyl' . $indiceAsked . '_' . $subj . '" type="text" size="4" value="0" disabled="disabled"> '; print '</td>'; print '<td align="left">';
/** * Display form to select warehouse * * @param string $page Page * @param int $selected Id of warehouse * @param string $htmlname Name of select html field * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @return void */ function formSelectWarehouses($page, $selected = '', $htmlname = 'warehouse_id', $addempty = 0) { global $langs; if ($htmlname != "none") { print '<form method="POST" action="' . $page . '">'; print '<input type="hidden" name="action" value="setwarehouse">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<tr><td>'; print $this->selectWarehouses($selected, $htmlname, '', $addempty); print '</td>'; print '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>'; print '</tr></table></form>'; } else { if ($selected) { require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; $warehousestatic = new Entrepot($this->db); $warehousestatic->fetch($selected); print $warehousestatic->getNomUrl(); } else { print " "; } } }
function _list_already_dispatched(&$commande) { global $db, $langs; // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty"; if ((double) DOL_VERSION > 3.7) { $sql .= ", cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; } $sql .= " FROM " . MAIN_DB_PREFIX . "product as p,"; $sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid"; $sql .= " WHERE cfd.fk_commande = " . $commande->id; $sql .= " AND cfd.fk_product = p.rowid"; $sql .= " ORDER BY cfd.rowid ASC"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; if ($num > 0) { print "<br/>\n"; print load_fiche_titre($langs->trans("ReceivingForSameOrder")); print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td>' . $langs->trans("Description") . '</td>'; if (!empty($conf->productbatch->enabled) && (double) DOL_VERSION > 3.7) { print '<td>' . $langs->trans("batch_number") . '</td>'; print '<td>' . $langs->trans("l_eatby") . '</td>'; print '<td>' . $langs->trans("l_sellby") . '</td>'; } print '<td align="right">' . $langs->trans("QtyDispatched") . '</td>'; print '<td></td>'; print '<td>' . $langs->trans("Warehouse") . '</td>'; print '<td>' . $langs->trans("Comment") . '</td>'; if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && (double) DOL_VERSION > 3.7) { print '<td align="center" colspan="2">' . $langs->trans("Status") . '</td>'; } print "</tr>\n"; $var = false; while ($i < $num) { $objp = $db->fetch_object($resql); print "<tr " . $bc[$var] . ">"; print '<td>'; print '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>'; print ' - ' . $objp->label; print "</td>\n"; if (!empty($conf->productbatch->enabled) && (double) DOL_VERSION > 3.7) { print '<td>' . $objp->batch . '</td>'; print '<td>' . dol_print_date($db->jdate($objp->eatby), 'day') . '</td>'; print '<td>' . dol_print_date($db->jdate($objp->sellby), 'day') . '</td>'; } // Qty print '<td align="right">' . $objp->qty . '</td>'; print '<td> </td>'; // Warehouse print '<td>'; $warehouse_static = new Entrepot($db); $warehouse_static->id = $objp->warehouse_id; $warehouse_static->libelle = $objp->entrepot; print $warehouse_static->getNomUrl(1); print '</td>'; // Comment print '<td>' . dol_trunc($objp->comment) . '</td>'; // Status if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && (double) DOL_VERSION > 3.7) { print '<td align="right">'; $supplierorderdispatch->status = empty($objp->status) ? 0 : $objp->status; //print $supplierorderdispatch->status; print $supplierorderdispatch->getLibStatut(5); print '</td>'; // Add button to check/uncheck disaptching print '<td align="center">'; if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner) || !empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)) { if (empty($objp->status)) { print '<a class="button buttonRefused" href="#">' . $langs->trans("Approve") . '</a>'; print '<a class="button buttonRefused" href="#">' . $langs->trans("Deny") . '</a>'; } else { print '<a class="button buttonRefused" href="#">' . $langs->trans("Disapprove") . '</a>'; print '<a class="button buttonRefused" href="#">' . $langs->trans("Deny") . '</a>'; } } else { $disabled = ''; if ($commande->statut == 5) { $disabled = 1; } if (empty($objp->status)) { print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=checkdispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Approve") . '</a>'; print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=denydispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Deny") . '</a>'; } if ($objp->status == 1) { print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=uncheckdispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Reinit") . '</a>'; print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=denydispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Deny") . '</a>'; } if ($objp->status == 2) { print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=uncheckdispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Reinit") . '</a>'; print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=checkdispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Approve") . '</a>'; } } print '</td>'; } print "</tr>\n"; $i++; $var = !$var; } $db->free($resql); print "</table>\n"; } } else { dol_print_error($db); } }
$total=0; $totalvalue=$totalvaluesell=0; $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $total=$totalwithpmp; $i=0; $var=false; while ($i < $num) { $obj = $db->fetch_object($resql); $entrepotstatic->id=$obj->rowid; $entrepotstatic->libelle=$obj->label; print '<tr '.$bc[$var].'>'; print '<td>'.$entrepotstatic->getNomUrl(1).'</td>'; print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>'; // PMP print '<td align="right">'.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').'</td>'; // Ditto : Show PMP from movement or from product print '<td align="right">'.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').'</td>'; // Ditto : Show PMP from movement or from product // Sell price print '<td align="right">'; if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price,'MU')); else print $langs->trans("Variable"); print '</td>'; // Ditto : Show PMP from movement or from product print '<td align="right">'; if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price*$obj->reel,'MT')).'</td>'; // Ditto : Show PMP from movement or from product else print $langs->trans("Variable"); print '</tr>'; ; $total += $obj->reel; if (price2num($obj->pmp)) $totalwithpmp += $obj->reel;