New: show the name of place and floor on main takepos page

This commit is contained in:
Laurent Destailleur 2019-03-27 20:13:12 +01:00
parent 0dc8082179
commit ff10a2ab5a
7 changed files with 86 additions and 45 deletions

View File

@ -45,7 +45,8 @@ $show_files=GETPOST('show_files', 'int');
$confirm=GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$idcustomer = GETPOST('idcustomer', 'int');
$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):0);
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$_GET['optioncss'] = 'print';

View File

@ -35,7 +35,10 @@ $id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$left = GETPOST('left', 'alpha');
$top = GETPOST('top', 'alpha');
$place = GETPOST('place', 'int');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$newname = GETPOST('newname', 'alpha');
$mode = GETPOST('mode', 'alpha');
@ -63,7 +66,7 @@ if ($action=="updatename")
{
$newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars
if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars
$db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' where rowid='".$place."'");
$db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid='".$place."'");
}
if ($action=="add")

View File

@ -29,7 +29,9 @@ require '../main.inc.php'; // Load $user and permissions
$langs->loadLangs(array("bills", "cashdesk"));
$place = GETPOST('place', 'int');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$idline = GETPOST('idline', 'int');
$action = GETPOST('action');

View File

@ -35,7 +35,10 @@ $langs->loadLangs(array("bills", "cashdesk"));
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$idproduct = GETPOST('idproduct', 'int');
$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):0); // $place is id of POS
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$number = GETPOST('number', 'alpha');
$idline = GETPOST('idline', 'int');
$desc = GETPOST('desc', 'alpha');
@ -124,7 +127,7 @@ if (($action=="addline" || $action=="freezone") && $placeid == 0)
$invoice->socid = $conf->global->CASHDESK_ID_THIRDPARTY;
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = (string) $place;
$invoice->pos_source = (string) $posnb;
$placeid = $invoice->create($user);
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS-".$place.")' where rowid=".$placeid;
@ -178,8 +181,8 @@ if ($action == "deleteline") {
$invoice->deleteline($idline);
$invoice->fetch($placeid);
}
elseif ($placeid > 0) { //If exist invoice, but no line selected, proced to delete last line
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='$placeid' order by rowid DESC";
elseif ($placeid > 0) { //If exist invoice, but no line selected, proceed to delete last line
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."' order by rowid DESC";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
$deletelineid = $row[0];
@ -375,55 +378,73 @@ if (! empty($conf->use_javascript_ajax))
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext?'&'.$ext:'').'"></script>'."\n";
}
print '<div class="div-table-responsive-no-min invoice">';
print '<table id="tablelines" class="noborder noshadow" width="100%">';
print '<tr class="liste_titre nodrag nodrop">';
print '<td class="linecoldescription">' . $langs->trans('Description') . '</td>';
print '<td class="linecoldescription">';
print '<span style="font-size:120%;" class="right">';
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
{
$sql="SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place);
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj)
{
$label = $obj->label;
$floor = $obj->floor;
}
print $langs->trans('Place')." <b>".$label."</b> - ";
print $langs->trans('Floor')." <b>".$floor."</b> - ";
}
print $langs->trans('TotalTTC');
print ' : <b>'.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</b></span>';
print '</td>';
print '<td class="linecolqty right">' . $langs->trans('ReductionShort') . '</td>';
print '<td class="linecolqty right">' . $langs->trans('Qty') . '</td>';
print '<td class="linecolht right">' . $langs->trans('TotalHTShort') . '</td>';
print "</tr>\n";
if ($placeid > 0) {
foreach($invoice->lines as $line)
if ($placeid > 0)
{
$tmplines = array_reverse($invoice->lines);
foreach($tmplines as $line)
{
print '<tr class="drag drop oddeven';
$htmlforlines = '';
$htmlforlines.= '<tr class="drag drop oddeven';
if ($line->special_code == "3") {
print ' order';
$htmlforlines.= ' order';
}
print '" id="' . $line->id . '">';
print '<td class="left">';
print $line->product_label;
if ($line->product_label && $line->desc) print '<br>';
$htmlforlines.= '" id="' . $line->id . '">';
$htmlforlines.= '<td class="left">';
$htmlforlines.= $line->product_label;
if ($line->product_label && $line->desc) $htmlforlines.= '<br>';
if ($line->product_label != $line->desc)
{
$firstline = dolGetFirstLineOfText($line->desc);
if ($firstline != $line->desc)
{
print $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
$htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
}
else
{
print $line->desc;
$htmlforlines.= $line->desc;
}
}
if (!empty($line->array_options['options_order_notes'])) echo "<br>(".$line->array_options['options_order_notes'].")";
print '</td>';
print '<td class="right">' . vatrate($line->remise_percent, true) . '</td>';
print '<td class="right">' . $line->qty . '</td>';
print '<td class="right">' . price($line->total_ttc) . '</td>';
print '</tr>';
if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "<br>(".$line->array_options['options_order_notes'].")";
$htmlforlines.= '</td>';
$htmlforlines.= '<td class="right">' . vatrate($line->remise_percent, true) . '</td>';
$htmlforlines.= '<td class="right">' . $line->qty . '</td>';
$htmlforlines.= '<td class="right">' . price($line->total_ttc) . '</td>';
$htmlforlines.= '</tr>'."\n";
print $htmlforlines;
}
}
print '</table>';
print '<p style="font-size:120%;" class="right"><b>'.$langs->trans('TotalTTC');
if ($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place;
print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'&nbsp;</b></p>';
if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY)
{
$soc = new Societe($db);

View File

@ -34,7 +34,9 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$place = GETPOST('place', 'int');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$invoiceid = GETPOST('invoiceid', 'int');
@ -51,15 +53,18 @@ else
{
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
$placeid=$row[0];
if (! $placeid)
$obj = $db->fetch_object($resql);
if ($obj)
{
$placeid=0; // Invoice does not exist yet
$invoiceid = $obj->rowid;
}
if (! $invoiceid)
{
$invoiceid=0; // Invoice does not exist yet
}
else
{
$invoice->fetch($placeid);
$invoice->fetch($invoiceid);
}
}

View File

@ -24,19 +24,27 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->loadLangs(array("main", "cashdesk"));
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$facid=GETPOST('facid', 'int');
/*
* View
*/
top_httphead('text/html');
$facid=GETPOST('facid', 'int');
$place=GETPOST('place', 'int');
if ($place>0){
if ($place > 0)
{
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
$facid=$row[0];
$obj = $db->fetch_object($resql);
if ($obj)
{
$facid=$obj->rowid;
}
}
$object=new Facture($db);
$object->fetch($facid);

View File

@ -32,8 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$place = GETPOST('place', 'int');
if ($place=="") $place="0";
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS
$action = GETPOST('action', 'alpha');
$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter"));
@ -259,7 +260,7 @@ function ClickProduct(position) {
if (idproduct=="") return;
// Call page invoice.php to generate the section with product lines
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
}