28 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
29 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
30 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
31 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
32 if (!defined(
'NOREQUIREAJAX')) define(
'NOREQUIREAJAX',
'1');
34 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
40 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
44 $place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') : 0);
46 $action =
GETPOST(
'action',
'aZ09');
47 $setterminal =
GETPOST(
'setterminal',
'int');
48 $idproduct =
GETPOST(
'idproduct',
'int');
52 $_SESSION[
"takeposterminal"] = $setterminal;
55 $langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter"));
57 if (empty($user->rights->takepos->run) && !defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
65 if ($action ==
"productinfo") {
67 $prod->fetch($idproduct);
68 print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="AddProductConfirm(place, '.$idproduct.
');">'.$langs->trans(
'Add').
'</button>';
69 print "<br><b>".$prod->label.
"</b><br>";
70 print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$idproduct.
'">';
71 print "<br>".$prod->description;
72 print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).
"</b>";
74 } elseif ($action ==
"publicpreorder") {
75 print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="TakeposPrintingOrder();">'.$langs->trans(
'Confirm').
'</button>';
77 print '<div class="comment">
78 <textarea class="textinput" placeholder="'.$langs->trans(
'Note').
'"></textarea>
81 } elseif ($action ==
"publicpayment") {
82 $langs->loadLangs(array(
"orders"));
83 print '<h1>'.$langs->trans(
'StatusOrderDelivered').
'</h1>';
84 print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans(
'Payment').
'</button>';
87 elseif ($action ==
"checkplease") {
89 print '<h1>'.$langs->trans(
'StatusOrderDelivered').
'</h1>';
90 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolreceiptprinter.class.php';
91 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
93 $printer->initPrinter($conf->global->{
'TAKEPOS_PRINTER_TO_USE'.$_SESSION[
"takeposterminal"]});
94 $printer->printer->feed();
95 $printer->printer->feed();
96 $printer->printer->text($langs->trans(
'IM'));
97 $printer->printer->feed();
98 $printer->printer->text($langs->trans(
'Place').
": ".$place);
99 $printer->printer->feed();
100 $printer->printer->text($langs->trans(
'Payment').
": ".$langs->trans(
GETPOST(
'payment',
'alpha')));
101 $printer->printer->feed();
102 $printer->printer->feed();
103 $printer->printer->feed();
104 $printer->printer->feed();
105 $printer->printer->feed();
108 print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'Cash\');">'.$langs->trans(
'Cash').
'</button>';
109 print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'CreditCard\');">'.$langs->trans(
'CreditCard').
'</button>';
112 } elseif ($action ==
"editline") {
113 $placeid =
GETPOST(
'placeid',
'int');
114 $selectedline =
GETPOST(
'selectedline',
'int');
116 $invoice->fetch($placeid);
117 foreach ($invoice->lines as $line)
119 if ($line->id == $selectedline)
122 $prod->fetch($line->fk_product);
123 print "<b>".$prod->label.
"</b><br>";
124 print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$line->fk_product.
'">';
125 print "<br>".$prod->description;
126 print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).
"</b>";
128 print '<button type="button" class="publicphonebutton2 phonered width24" onclick="SetQty(place, '.$selectedline.
', '.($line->qty - 1).
');">-</button>';
129 print '<button type="button" class="publicphonebutton2 phonegreen width24" onclick="SetQty(place, '.$selectedline.
', '.($line->qty + 1).
');">+</button>';
130 print '<button type="button" class="publicphonebutton2 phoneblue width24" onclick="SetNote(place, '.$selectedline.
');">'.$langs->trans(
'Note').
'</button>';
135 $title =
'TakePOS - Dolibarr '.DOL_VERSION;
136 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
137 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
138 <meta name="apple-mobile-web-app-capable" content="yes">
139 <meta name="mobile-web-app-capable" content="yes">
140 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
141 $arrayofcss = array(
'/takepos/css/phone.css');
142 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
144 <script language=
"javascript">
147 $categories = $categorie->get_full_arbo(
'product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
151 $levelofrootcategory = 0;
152 if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
154 foreach ($categories as $key => $categorycursor)
156 if ($categorycursor[
'id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
158 $levelofrootcategory = $categorycursor[
'level'];
163 $levelofmaincategories = $levelofrootcategory + 1;
165 $maincategories = array();
166 $subcategories = array();
167 foreach ($categories as $key => $categorycursor)
169 if ($categorycursor[
'level'] == $levelofmaincategories)
171 $maincategories[$key] = $categorycursor;
173 $subcategories[$key] = $categorycursor;
177 sort($maincategories);
178 sort($subcategories);
183 var categories = <?php echo json_encode($maincategories); ?>;
184 var subcategories = <?php echo json_encode($subcategories); ?>;
188 var pagecategories=0;
190 var place=
"<?php echo $place; ?>";
191 var editaction=
"qty";
195 $( document ).ready(
function() {
196 console.log(
"Refresh");
200 function LoadPlace(placeid){
203 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
204 echo
'$("#phonediv2").load("auto_order.php?mobilepage=invoice&place="+place, function() {
208 echo
'$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
215 function AddProduct(placeid, productid){
218 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
219 print 'place=placeid;
220 $("#phonediv1").load("auto_order.php?action=productinfo&place="+place+"&idproduct="+productid, function() {
224 print 'AddProductConfirm(placeid, productid);';
229 function PublicPreOrder(){
230 $(
"#phonediv1").load(
"auto_order.php?action=publicpreorder&place="+place,
function() {
234 function AddProductConfirm(placeid, productid){
237 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
238 echo
'$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
242 echo
'$("#phonediv2").load("invoice.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
248 function SetQty(place, selectedline, qty){
250 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
253 $(
"#phonediv2").load(
"auto_order.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline,
function() {
257 $(
"#phonediv2").load(
"auto_order.php?mobilepage=invoice&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+qty,
function() {
265 $(
"#phonediv2").load(
"invoice.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline,
function() {
269 $(
"#phonediv2").load(
"invoice.php?mobilepage=invoice&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+qty,
function() {
278 function SetNote(place, selectedline){
279 var
note = prompt(
"<?php $langs->trans('Note'); ?>",
"");
280 $(
"#phonediv2").load(
"auto_order.php?mobilepage=invoice&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+qty,
function() {
287 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
288 echo
'$("#phonediv1").load("auto_order.php?mobilepage=cats&place="+place, function() {
292 echo
'$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
298 function LoadProducts(idcat){
301 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
302 echo
'$("#phonediv1").load("auto_order.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
306 echo
'$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
312 function LoadPlacesList(){
313 $(
"#phonediv1").load(
"invoice.php?mobilepage=places",
function() {
317 function TakeposPrintingOrder(){
318 console.log(
"TakeposPrintingOrder");
320 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
321 echo
'$("#phonediv2").load("auto_order.php?action=order&mobilepage=order&place="+place, function() {
323 echo
'$("#phonediv1").load("auto_order.php?action=publicpayment&place="+place, function() {
327 echo
'$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
334 window.location.href=
'../user/logout.php';
337 function CheckPlease(payment){
338 if (payment==undefined){
339 $(
"#phonediv1").load(
"auto_order.php?action=checkplease&place="+place,
function() {
343 console.log(
"Request the check to the waiter");
344 $(
"#phonediv1").load(
"auto_order.php?action=checkplease&place=<?php echo $place; ?>&payment="+payment,
function() {
351 <body style=
"background-color:#D1D1D1;">
353 if ($conf->global->TAKEPOS_NUM_TERMINALS !=
"1" && $_SESSION[
"takeposterminal"] ==
"")
print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans(
'TerminalSelect').
'</div>';
355 <div
class=
"container">
356 <div
class=
"phonebuttonsrow">
358 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
359 print '<button type="button" class="phonebutton" onclick="LoadPlacesList();">'.strtoupper(substr($langs->trans(
'Floors'), 0, 3)).
'</button>';
360 print '<button type="button" class="phonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans(
'Categories'), 0, 3)).
'</button>';
361 print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans(
'Order'), 0, 3)).
'</button>';
362 print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans(
'Logout'), 0, 3)).
'</button>';
365 print '<button type="button" class="publicphonebutton phoneblue" onclick="LoadCats();">'.strtoupper(substr($langs->trans(
'Categories'), 0, 5)).
'</button>';
366 print '<button type="button" class="publicphonebutton phoneorange" onclick="PublicPreOrder();">'.strtoupper(substr($langs->trans(
'Order'), 0, 5)).
'</button>';
367 print '<button type="button" class="publicphonebutton phonegreen" onclick="CheckPlease();">'.strtoupper(substr($langs->trans(
'Payment'), 0, 5)).
'</button>';
371 <div
class=
"phonerow2">
372 <div
id=
"phonediv2" class=
"phonediv2"></div>
374 <div
class=
"phonerow1">
375 <div
id=
"phonediv1" class=
"phonediv1"></div>
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_decode($chain, $key= '1')
Decode a base 64 encoded + specific delta change.
Class to manage products or services.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage categories.
Class to manage Receipt Printers.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print
Draft customers invoices.
Class to manage invoices.
if(!empty($search_group)) natural_search(array("g.nom"g note