diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 8ba3bda053f..83c217b06f7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -67,4 +67,5 @@ ValidateAndClose=Validate and close Terminal=Terminal NumberOfTerminals=Number of Terminals TerminalSelect=Select terminal you want to use: -POSTicket=POS Ticket \ No newline at end of file +POSTicket=POS Ticket +BasicPhoneLayout=Use basic layout for phones \ No newline at end of file diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f331587723b..3fb9d869cd0 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -73,6 +73,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -199,6 +200,15 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ print ''; } +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + print ''; + print $langs->trans("BasicPhoneLayout"); + print ''; + print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); + print ''; +} + print ''; print $langs->trans('TicketVatGrouped'); print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 510b949b92b..aac6f7ecaf8 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -44,6 +44,31 @@ $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1 && $conf->browser->layout == 'phone') +{ + // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED + if ($_SESSION["takeposterminal"]=="") + { + if ($conf->global->TAKEPOS_NUM_TERMINALS=="1") $_SESSION["takeposterminal"]=1; + else + { + header("Location: takepos.php"); + exit; + } + } + $mobilepage = GETPOST('mobilepage', 'alpha'); + $title='TakePOS - Dolibarr '.DOL_VERSION; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; + $head=' + + + '; + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + print ' + + '; +} + /** * Abort invoice creationg with a given error message * @@ -497,13 +522,88 @@ print $langs->trans('TotalTTC'); print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; print '
'.$sectionwithinvoicelink; print ''; -print '' . $langs->trans('ReductionShort') . ''; -print '' . $langs->trans('Qty') . ''; -print '' . $langs->trans('TotalHTShort') . ''; +if ($_SESSION["basiclayout"]!=1) +{ + print '' . $langs->trans('ReductionShort') . ''; + print '' . $langs->trans('Qty') . ''; + print '' . $langs->trans('TotalHTShort') . ''; +} print "\n"; +if ($_SESSION["basiclayout"]==1) +{ + if ($mobilepage=="cats") + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $categorie = new Categorie($db); + $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; + foreach ($categories as $row){ + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row['label']; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } + + if ($mobilepage=="products") + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $object = new Categorie($db); + $catid = GETPOST('catid', 'int'); + $result=$object->fetch($catid); + $prods = $object->getObjectsInCateg("product"); + $htmlforlines = ''; + foreach ($prods as $row) { + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row->label; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Categories").''; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } + + if ($mobilepage=="places") + { + $sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $resql = $db->query($sql); + $rows = array(); + $htmlforlines = ''; + while($row = $db->fetch_array($resql)){ + $rows[] = $row; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row['label']; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Categories").''; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } +} + if ($placeid > 0) { + if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice") return; if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -538,11 +638,14 @@ if ($placeid > 0) } } if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; - $htmlforlines.= ''; - $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; - $htmlforlines.= '' . $line->qty . ''; - $htmlforlines.= '' . price($line->total_ttc) . ''; - $htmlforlines.= ''."\n"; + if ($_SESSION["basiclayout"]!=1) + { + $htmlforlines.= ''; + $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; + $htmlforlines.= '' . $line->qty . ''; + $htmlforlines.= '' . price($line->total_ttc) . ''; + } + $htmlforlines.= ''."\n"; print $htmlforlines; } @@ -558,6 +661,14 @@ else { // No invoice generated yet print ''; +if ($_SESSION["basiclayout"]==1 && $mobilepage=="invoice") +{ + print '
'; + print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Floors").''; + print '
'; +} + if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { $soc = new Societe($db); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index c0a37881cf9..7e55bbc5936 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -57,6 +57,13 @@ if ($conf->browser->layout == 'phone') { $maxcategbydefaultforthisdevice=8; $maxproductbydefaultforthisdevice=16; + //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED + if ($_SESSION["takeposterminal"]!="" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1) + { + $_SESSION["basiclayout"]=1; + header("Location: invoice.php?mobilepage=invoice"); + exit; + } } $MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?$maxcategbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXCATEG); $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXPRODUCT);