107 header($_SERVER[
'SERVER_PROTOCOL'].
' 500 Internal Server Error',
true, 500);
113$number =
GETPOST(
'number',
'alpha');
114$idline =
GETPOST(
'idline',
'int');
115$selectedline =
GETPOST(
'selectedline',
'int');
116$desc =
GETPOST(
'desc',
'alphanohtml');
120$invoiceid =
GETPOST(
'invoiceid',
'int');
129if ($pay ==
'cheque') {
136 $sql =
"SELECT id FROM ".MAIN_DB_PREFIX.
"c_paiement";
137 $sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
138 $sql .=
" AND code = '".$db->escape($paycode).
"'";
139 $resql = $db->query($sql);
141 $obj = $db->fetch_object($resql);
143 $paiementid = $obj->id;
150 $ret = $invoice->fetch($invoiceid);
152 $ret = $invoice->fetch(
'',
'(PROV-POS'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'') .
'-'.$place.
')');
155 $placeid = $invoice->id;
158$constforcompanyid =
'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
161if ($invoice->socid > 0) {
162 $soc->fetch($invoice->socid);
168if (isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"])) {
169 if ($invoice->multicurrency_code != $_SESSION[
"takeposcustomercurrency"]) {
170 $invoice->setMulticurrencyCode($_SESSION[
"takeposcustomercurrency"]);
180$reshook=$hookmanager->executeHooks(
'doActions', $parameters, $invoice, $action);
181if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
183if (empty($reshook)) {
185 if ($action ==
'valid' && $user->hasRight(
'facture',
'creer')) {
189 if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
190 $bankaccount =
GETPOST(
'accountid',
'int');
193 $bankaccount =
getDolGlobalString(
'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION[
"takeposterminal"]);
194 } elseif ($pay ==
"CHQ") {
195 $bankaccount =
getDolGlobalString(
'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION[
"takeposterminal"]);
197 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION[
"takeposterminal"];
202 if ($bankaccount <= 0 && $pay !=
"delayed" && isModEnabled(
"banque")) {
203 $errormsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankAccount"));
211 $invoice->fetch($placeid);
213 if ($invoice->total_ttc < 0) {
214 $invoice->type = $invoice::TYPE_CREDIT_NOTE;
216 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
217 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
218 $sql .=
" AND fk_soc = ".((int) $invoice->socid);
219 $sql .=
" AND type <> ".Facture::TYPE_CREDIT_NOTE;
220 $sql .=
" AND fk_statut >= ".$invoice::STATUS_VALIDATED;
221 $sql .=
" ORDER BY rowid DESC";
223 $resql = $db->query($sql);
225 $obj = $db->fetch_object($resql);
226 $fk_source = $obj->rowid;
227 if ($fk_source ==
null) {
228 fail($langs->transnoentitiesnoconv(
"NoPreviousBillForCustomer"));
231 fail($langs->transnoentitiesnoconv(
"NoPreviousBillForCustomer"));
233 $invoice->fk_facture_source = $fk_source;
234 $invoice->update($user);
237 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'.$_SESSION[
"takeposterminal"];
242 if ($invoice->getRemainToPay() > 0) {
248 } elseif (count($invoice->lines) == 0) {
252 } elseif (isModEnabled(
'stock') && $conf->global->$constantforkey !=
"1") {
253 $savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
255 if (isModEnabled(
'productbatch') && !
getDolGlobalInt(
'CASHDESK_FORCE_DECREASE_STOCK')) {
256 $conf->global->STOCK_CALCULATE_ON_BILL = 0;
258 $conf->global->STOCK_CALCULATE_ON_BILL = 1;
261 $constantforkey =
'CASHDESK_ID_WAREHOUSE'.$_SESSION[
"takeposterminal"];
262 dol_syslog(
"Validate invoice with stock change into warehouse defined into constant ".$constantforkey.
" = ".$conf->global->$constantforkey);
264 if (isModEnabled(
'productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
265 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
268 $res = $invoice->validate($user,
'', $conf->global->$constantforkey, 0, $batch_rule);
270 $conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
272 $res = $invoice->validate($user);
275 $langs->load(
"admin");
276 dol_htmloutput_errors($invoice->error ==
'NotConfigured' ? $langs->trans(
"NotConfigured").
' (TakePos numbering module)': $invoice->error, $invoice->errors, 1);
287 if (!$error && $res >= 0) {
288 $remaintopay = $invoice->getRemainToPay();
289 if ($remaintopay > 0) {
291 $payment->datepaye = $now;
292 $payment->fk_account = $bankaccount;
293 $payment->amounts[$invoice->id] = $amountofpayment;
300 if ($amountofpayment <= 0 || $amountofpayment > $remaintopay) {
301 $payment->amounts[$invoice->id] = $remaintopay;
304 $payment->paiementid = $paiementid;
305 $payment->num_payment = $invoice->ref;
307 if ($pay !=
"delayed") {
308 $payment->create($user);
309 $res = $payment->addPaymentToBank($user,
'payment',
'(CustomerInvoicePayment)', $bankaccount,
'',
'');
314 $remaintopay = $invoice->getRemainToPay();
320 if ($remaintopay == 0) {
321 dol_syslog(
"Invoice is paid, so we set it to status Paid");
322 $result = $invoice->setPaid($user);
327 $invoice->setPaymentMethods($paiementid);
329 dol_syslog(
"Invoice is not paid, remain to pay = ".$remaintopay);
336 if ($action ==
'creditnote' && $user->hasRight(
'facture',
'creer')) {
337 $creditnote =
new Facture($db);
338 $creditnote->socid = $invoice->socid;
340 $creditnote->module_source =
'takepos';
341 $creditnote->pos_source = isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'' ;
343 $creditnote->fk_facture_source = $placeid;
344 $creditnote->remise_absolue = $invoice->remise_absolue;
345 $creditnote->remise_percent = $invoice->remise_percent;
346 $creditnote->create($user);
348 foreach ($invoice->lines as $line) {
350 if (method_exists($line,
'fetch_optionals')) {
352 $line->fetch_optionals();
355 if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
360 if (!empty($invoice->situation_counter)) {
361 $source_fk_prev_id = $line->fk_prev_id;
362 $line->fk_prev_id = $line->id;
363 if (!empty($invoice->tab_previous_situation_invoice)) {
366 $tab_jumped_credit_notes = array();
367 $lineIndex = count($invoice->tab_previous_situation_invoice) - 1;
368 $searchPreviousInvoice =
true;
369 while ($searchPreviousInvoice) {
370 if ($invoice->tab_previous_situation_invoice[$lineIndex]->situation_cycle_ref || $lineIndex < 1) {
371 $searchPreviousInvoice =
false;
375 $tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id;
381 $maxPrevSituationPercent = 0;
382 foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) {
383 if ($prevLine->id == $source_fk_prev_id) {
384 $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
387 $line->total_ht = $line->total_ht - $prevLine->total_ht;
388 $line->total_tva = $line->total_tva - $prevLine->total_tva;
389 $line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
390 $line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
391 $line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
393 $line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
394 $line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
395 $line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
396 $line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
401 $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
406 $maxPrevSituationPercent = 0;
407 foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
408 foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) {
409 if ($prevLine->fk_prev_id == $source_fk_prev_id) {
410 $maxPrevSituationPercent = $prevLine->situation_percent;
412 $line->total_ht -= $prevLine->total_ht;
413 $line->total_tva -= $prevLine->total_tva;
414 $line->total_ttc -= $prevLine->total_ttc;
415 $line->total_localtax1 -= $prevLine->total_localtax1;
416 $line->total_localtax2 -= $prevLine->total_localtax2;
418 $line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
419 $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
420 $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
421 $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
427 $line->situation_percent += $maxPrevSituationPercent;
434 $line->fk_facture = $creditnote->id;
435 $line->fk_parent_line = $fk_parent_line;
437 $line->subprice = -$line->subprice;
438 $line->pa_ht = $line->pa_ht;
439 $line->total_ht = -$line->total_ht;
440 $line->total_tva = -$line->total_tva;
441 $line->total_ttc = -$line->total_ttc;
442 $line->total_localtax1 = -$line->total_localtax1;
443 $line->total_localtax2 = -$line->total_localtax2;
445 $line->multicurrency_subprice = -$line->multicurrency_subprice;
446 $line->multicurrency_total_ht = -$line->multicurrency_total_ht;
447 $line->multicurrency_total_tva = -$line->multicurrency_total_tva;
448 $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
450 $result = $line->insert(0, 1);
452 $creditnote->lines[] = $line;
455 if ($result > 0 && $line->product_type == 9) {
456 $fk_parent_line = $result;
459 $creditnote->update_price(1);
461 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'.$_SESSION[
"takeposterminal"];
462 if (isModEnabled(
'stock') && $conf->global->$constantforkey !=
"1") {
463 $savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
464 $conf->global->STOCK_CALCULATE_ON_BILL = 1;
465 $constantforkey =
'CASHDESK_ID_WAREHOUSE'.$_SESSION[
"takeposterminal"];
466 dol_syslog(
"Validate invoice with stock change into warehouse defined into constant ".$constantforkey.
" = ".$conf->global->$constantforkey);
468 if (isModEnabled(
'productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
469 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
472 $res = $creditnote->validate($user,
'', $conf->global->$constantforkey, 0, $batch_rule);
473 $conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
475 $res = $creditnote->validate($user);
479 if ($action ==
'history' || $action ==
'creditnote') {
480 if ($action ==
'creditnote') {
481 $placeid = $creditnote->id;
483 $placeid = (int)
GETPOST(
'placeid',
'int');
486 $invoice->fetch($placeid);
490 if (($action ==
"addline" || $action ==
"freezone") && $placeid == 0) {
493 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
496 $invoice->module_source =
'takepos';
497 $invoice->pos_source = isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'' ;
498 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
500 if ($invoice->socid <= 0) {
501 $langs->load(
'errors');
505 $placeid = $invoice->create($user);
509 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
514 if ($action ==
"addline") {
516 $prod->fetch($idproduct);
519 $customer->fetch($invoice->socid);
521 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
523 $qty = GETPOSTISSET(
'qty') ?
GETPOST(
'qty',
'int') : 1;
524 $price = $datapriceofproduct[
'pu_ht'];
525 $price_ttc = $datapriceofproduct[
'pu_ttc'];
527 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
528 $tva_tx = $datapriceofproduct[
'tva_tx'];
529 $tva_npr = $datapriceofproduct[
'tva_npr'];
532 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
533 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
535 if (!empty($conf->global->TAKEPOS_SUPPLEMENTS)) {
536 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
538 $categories = $cat->containing($idproduct,
'product');
539 $found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories,
'id')));
540 if ($found !==
false) {
541 $sql =
"SELECT fk_parent_line FROM ".MAIN_DB_PREFIX.
"facturedet where rowid=$selectedline";
542 $resql = $db->query($sql);
543 $row = $db->fetch_array($resql);
544 if ($row[0] ==
null) {
545 $parent_line = $selectedline;
547 $parent_line = $row[0];
554 if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) {
555 foreach ($invoice->lines as $line) {
556 if ($line->product_ref == $prod->ref) {
557 if ($line->special_code==4)
continue;
558 $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty + $qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
562 $idoflineadded = $line->id;
568 if ($idoflineadded <= 0) {
569 $invoice->fetch_thirdparty();
570 $array_options = array();
572 $line = array(
'description' => $prod->description,
'price' => $price,
'tva_tx' => $tva_tx,
'localtax1_tx' => $localtax1_tx,
'localtax2_tx' => $localtax2_tx,
'remise_percent' => $customer->remise_percent,
'price_ttc' => $price_ttc,
'array_options' => $array_options);
575 if (isset($conf->global->MARGIN_TYPE)) {
576 if ($conf->global->MARGIN_TYPE ==
'pmp' && !empty($prod->pmp)) {
577 $line[
'fk_fournprice'] =
null;
578 $line[
'pa_ht'] = $prod->pmp;
579 } elseif ($conf->global->MARGIN_TYPE ==
'costprice' && !empty($prod->cost_price)) {
580 $line[
'fk_fournprice'] =
null;
581 $line[
'pa_ht'] = $prod->cost_price;
584 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
586 if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
587 $line[
'fk_fournprice'] = $pf->product_fourn_price_id;
588 $line[
'pa_ht'] = $pf->fourn_unitprice_with_discount;
590 $line[
'pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
596 $parameters = array(
'prod' => $prod,
'line' => $line);
597 $reshook=$hookmanager->executeHooks(
'completeTakePosAddLine', $parameters, $invoice, $action);
598 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
601 if (empty($reshook)) {
602 if (!empty($hookmanager->resArray)) {
603 $line = $hookmanager->resArray;
606 $idoflineadded = $invoice->addline($line[
'description'], $line[
'price'], $qty, $line[
'tva_tx'], $line[
'localtax1_tx'], $line[
'localtax2_tx'], $idproduct, $line[
'remise_percent'],
'', 0, 0, 0,
'', $price_base_type, $line[
'price_ttc'], $prod->type, -1, 0,
'', 0, (!empty($parent_line)) ? $parent_line :
'', $line[
'fk_fournprice'], $line[
'pa_ht'],
'', $line[
'array_options'], 100,
'', null, 0);
609 if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
610 $CUSTOMER_DISPLAY_line1 = $prod->label;
611 $CUSTOMER_DISPLAY_line2 =
price($price_ttc);
615 $invoice->fetch($placeid);
618 if ($action ==
"freezone") {
620 $customer->fetch($invoice->socid);
622 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
624 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
632 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
633 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
635 $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0,
'', 0, 0, 0,
'',
getDolGlobalInt(
'TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ?
'HT' :
'TTC') : (
getDolGlobalInt(
'TAKEPOS_CHANGE_PRICE_HT') ?
'HT' :
'TTC'), $number, 0, -1, 0,
'', 0, 0, null,
'',
'', 0, 100,
'', null, 0);
636 $invoice->fetch($placeid);
639 if ($action ==
"addnote") {
640 $desc =
GETPOST(
'addnote',
'alpha');
642 $invoice->update_note($desc,
'_public');
643 }
else foreach ($invoice->lines as $line) {
644 if ($line->id == $idline) {
645 $result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
648 $invoice->fetch($placeid);
651 if ($action ==
"deleteline") {
652 if ($idline > 0 and $placeid > 0) {
653 $invoice->deleteline($idline);
654 $invoice->fetch($placeid);
655 } elseif ($placeid > 0) {
656 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facturedet where fk_facture = ".((int) $placeid).
" ORDER BY rowid DESC";
657 $resql = $db->query($sql);
658 $row = $db->fetch_array($resql);
659 $deletelineid = $row[0];
660 $invoice->deleteline($deletelineid);
661 $invoice->fetch($placeid);
663 if (count($invoice->lines) == 0) {
664 $invoice->delete($user);
665 header(
"Location: ".DOL_URL_ROOT.
"/takepos/invoice.php");
671 if ($action ==
"delete") {
674 $result = $invoice->fetch($placeid);
681 foreach ($invoice->lines as $line) {
682 $tmpres = $invoice->deleteline($line->id);
689 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture";
690 $varforconst =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
691 $sql .=
" SET fk_soc = ".((int) $conf->global->$varforconst).
", ";
692 $sql .=
" datec = '".$db->idate(
dol_now()).
"'";
693 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
694 $sql .=
" AND ref = '(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
695 $resql1 = $db->query($sql);
697 if ($resdeletelines && $resql1) {
703 $invoice->fetch($placeid);
708 if ($action ==
"updateqty") {
709 foreach ($invoice->lines as $line) {
710 if ($line->id == $idline) {
711 if (!$user->rights->takepos->editlines || (!$user->rights->takepos->editorderedlines && $line->special_code ==
"4")) {
714 $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
719 $invoice->fetch($placeid);
722 if ($action ==
"updateprice") {
724 $customer->fetch($invoice->socid);
726 foreach ($invoice->lines as $line) {
727 if ($line->id == $idline) {
729 $prod->fetch($line->fk_product);
730 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
731 $price_min = $datapriceofproduct[
'price_min'];
732 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
733 $pu_ht =
price2num($number / (1 + ($line->tva_tx / 100)),
'MU');
735 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($pu_ht) * (1 -
price2num($line->remise_percent) / 100) <
price2num($price_min)))) {
736 $langs->load(
"products");
740 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
743 $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
745 $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
752 $invoice->fetch($placeid);
755 if ($action ==
"updatereduction") {
757 $customer->fetch($invoice->socid);
759 foreach ($invoice->lines as $line) {
760 if ($line->id == $idline) {
761 dol_syslog(
"updatereduction Process line ".$line->id.
' to apply discount of '.$number.
'%');
764 $prod->fetch($line->fk_product);
766 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
767 $price_min = $datapriceofproduct[
'price_min'];
768 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
770 $pu_ht =
price2num($line->subprice / (1 + ($line->tva_tx / 100)),
'MU');
773 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($line->subprice) * (1 -
price2num($number) / 100) <
price2num($price_min)))) {
774 $langs->load(
"products");
777 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
780 $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
787 $invoice->fetch($placeid);
788 } elseif ($action ==
'update_reduction_global') {
789 foreach ($invoice->lines as $line) {
790 $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx,
'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
793 $invoice->fetch($placeid);
796 if ($action ==
"order" and $placeid != 0) {
797 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
798 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") {
799 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolreceiptprinter.class.php';
803 $sql =
"SELECT label FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables where rowid=".((int) $place);
804 $resql = $db->query($sql);
805 $row = $db->fetch_object($resql);
806 $headerorder =
'<html><br><b>'.$langs->trans(
'Place').
' '.$row->label.
'<br><table width="65%"><thead><tr><th class="left">'.$langs->trans(
"Label").
'</th><th class="right">'.$langs->trans(
"Qty").
'</th></tr></thead><tbody>';
807 $footerorder =
'</tbody></table>'.dol_print_date(
dol_now(),
'dayhour').
'<br></html>';
808 $order_receipt_printer1 =
"";
809 $order_receipt_printer2 =
"";
810 $order_receipt_printer3 =
"";
811 $catsprinter1 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_1);
812 $catsprinter2 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
813 $catsprinter3 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_3);
815 foreach ($invoice->lines as $line) {
816 if ($line->special_code ==
"4") {
820 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
821 $result = array_intersect($catsprinter1, $existing);
822 $count = count($result);
823 if (!$line->fk_product) {
828 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='1' where rowid=".$line->id;
830 $order_receipt_printer1 .=
'<tr><td class="left">';
831 if ($line->fk_product) {
832 $order_receipt_printer1 .= $line->product_label;
834 $order_receipt_printer1 .= $line->description;
836 $order_receipt_printer1 .=
'</td><td class="right">'.$line->qty;
837 if (!empty($line->array_options[
'options_order_notes'])) {
838 $order_receipt_printer1 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
840 $order_receipt_printer1 .=
'</td></tr>';
843 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
844 $invoice->fetch($placeid);
845 $printer->orderprinter = 1;
847 echo
"var orderprinter1esc='";
848 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION[
"takeposterminal"]));
851 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id;
853 $invoice->fetch($placeid);
856 foreach ($invoice->lines as $line) {
857 if ($line->special_code ==
"4") {
861 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
862 $result = array_intersect($catsprinter2, $existing);
863 $count = count($result);
866 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='2' where rowid=".$line->id;
868 $order_receipt_printer2 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
869 if (!empty($line->array_options[
'options_order_notes'])) {
870 $order_receipt_printer2 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
872 $order_receipt_printer2 .=
'</td></tr>';
875 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
876 $invoice->fetch($placeid);
877 $printer->orderprinter = 2;
879 echo
"var orderprinter2esc='";
880 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION[
"takeposterminal"]));
883 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id;
885 $invoice->fetch($placeid);
888 foreach ($invoice->lines as $line) {
889 if ($line->special_code ==
"4") {
893 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
894 $result = array_intersect($catsprinter3, $existing);
895 $count = count($result);
898 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='3' where rowid=".$line->id;
900 $order_receipt_printer3 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
901 if (!empty($line->array_options[
'options_order_notes'])) {
902 $order_receipt_printer3 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
904 $order_receipt_printer3 .=
'</td></tr>';
907 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
908 $invoice->fetch($placeid);
909 $printer->orderprinter = 3;
911 echo
"var orderprinter3esc='";
912 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION[
"takeposterminal"]));
915 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id;
917 $invoice->fetch($placeid);
920 $sectionwithinvoicelink =
'';
921 if ($action ==
"valid" || $action ==
"history" || $action ==
'creditnote') {
922 $sectionwithinvoicelink .=
'<!-- Section with invoice link -->'.
"\n";
923 $sectionwithinvoicelink .=
'<span style="font-size:120%;" class="center">';
924 $sectionwithinvoicelink .= $invoice->getNomUrl(1,
'', 0, 0,
'', 0, 0, -1,
'_backoffice').
" - ";
925 $remaintopay = $invoice->getRemainToPay();
926 if ($remaintopay > 0) {
927 $sectionwithinvoicelink .= $langs->trans(
'RemainToPay').
': <span class="amountremaintopay" style="font-size: unset">'.
price($remaintopay, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
929 if ($invoice->paye) {
930 $sectionwithinvoicelink .=
'<span class="amountpaymentcomplete" style="font-size: unset">'.$langs->trans(
"Paid").
'</span>';
932 $sectionwithinvoicelink .= $langs->trans(
'BillShortStatusValidated');
935 $sectionwithinvoicelink .=
'</span><br>';
937 $sectionwithinvoicelink .=
' <a target="_blank" class="button" href="' . DOL_URL_ROOT .
'/document.php?token=' . newToken() .
'&modulepart=facture&file=' . $invoice->ref .
'/' . $invoice->ref .
'.pdf">Invoice</a>';
939 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
940 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
942 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
945 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
947 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
949 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="PrintBox('.$placeid.
', \'without_details\')">'.$langs->trans(
'PrintWithoutDetails').
'</button>';
952 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
', 1)">'.$langs->trans(
'GiftReceipt').
'</button>';
955 if (
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE') && $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE > 0) {
956 $sectionwithinvoicelink .=
' <button id="buttonsend" type="button" onclick="SendTicket('.$placeid.
')">'.$langs->trans(
'SendTicket').
'</button>';
959 if ($remaintopay <= 0 &&
getDolGlobalString(
'TAKEPOS_AUTO_PRINT_TICKETS') && $action !=
"history") {
960 $sectionwithinvoicelink .=
'<script type="text/javascript">$("#buttonprint").click();</script>';
969$form =
new Form($db);
972if ((
getDolGlobalString(
'TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout ==
'phone') || defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
973 $title =
'TakePOS - Dolibarr '.DOL_VERSION;
974 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
975 $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
977 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
978 <meta name="apple-mobile-web-app-capable" content="yes">
979 <meta name="mobile-web-app-capable" content="yes">
980 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
982 '/takepos/css/pos.css.php',
984 $arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
987 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
996<script
type=
"text/javascript">
999<?php
if ($action==
"valid") echo
"var place=0;";?>
1000var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>;
1001$(document).ready(
function() {
1002 var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>;
1004 $(
'.posinvoiceline').click(
function(){
1005 console.log(
"Click done on "+this.
id);
1006 $(
'.posinvoiceline').removeClass(
"selected");
1007 $(
this).addClass(
"selected");
1008 if (selectedline==this.
id)
return;
1009 else selectedline=this.id;
1010 selectedtext=$(
'#'+selectedline).find(
"td:first").html();
1012 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
1013 print
'$("#phonediv1").load("auto_order.php?action=editline&token='.newToken().
'&placeid="+placeid+"&selectedline="+selectedline, function() {
1020 if (idoflineadded > 0)
1022 console.log(
"Auto select "+idoflineadded);
1023 $(
'.posinvoiceline#'+idoflineadded).click();
1027if ($action ==
"order" && !empty($order_receipt_printer1)) {
1028 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1032 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php',
1033 data:
'invoice='+orderprinter1esc
1040 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1042 print $headerorder.$order_receipt_printer1.$footerorder; ?>'
1048if ($action ==
"order" && !empty($order_receipt_printer2)) {
1049 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1053 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2',
1054 data:
'invoice='+orderprinter2esc
1061 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print2',
1063 print $headerorder.$order_receipt_printer2.$footerorder; ?>'
1069if ($action ==
"order" && !empty($order_receipt_printer3)) {
1070 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1074 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3',
1075 data:
'invoice='+orderprinter3esc
1082if ($action ==
"search" || $action ==
"valid") {
1084 parent.setFocusOnSearchField();
1089if ($action ==
"temp" && !empty($ticket_printer1)) {
1093 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1095 print $header_soc.$header_ticket.$body_ticket.$ticket_printer1.$ticket_total.$footer_ticket; ?>'
1100if ($action ==
"search") {
1102 $(
'#search').focus();
1110function SendTicket(
id)
1112 console.log(
"Open box to select the Print/Send form");
1113 $.colorbox({href:
"send.php?facid="+id, width:
"70%", height:
"30%", transition:
"none", iframe:
"true", title:
'<?php echo dol_escape_js($langs->trans("SendTicket")); ?>'});
1117function PrintBox(
id, action) {
1118 console.log(
"Open box before printing");
1119 $.colorbox({href:
"printbox.php?facid="+
id+
"&action="+action+
"&token=<?php echo newToken(); ?>", width:
"80%", height:
"200px", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("PrintWithoutDetails
"); ?>"});
1123function Print(
id, gift){
1124 console.log(
"Call Print() to generate the receipt.");
1125 $.colorbox({href:
"receipt.php?facid="+
id+
"&gift="+gift, width:
"40%", height:
"90%", transition:
"none", iframe:
"true", title:
'<?php echo dol_escape_js($langs->trans("PrintTicket")); ?>'});
1129function TakeposPrinting(
id){
1131 console.log(
"TakeposPrinting" +
id);
1132 $.get(
"receipt.php?facid="+
id,
function(data, status) {
1133 receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,
'');
1136 url:
'http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>:8111/print',
1143function TakeposConnector(
id){
1144 console.log(
"TakeposConnector" +
id);
1145 $.get(
"<?php echo DOL_URL_ROOT; ?>/takepos/ajax/ajax.php?action=printinvoiceticket&token=<?php echo newToken(); ?>&term=<?php echo urlencode(isset($_SESSION["takeposterminal
"]) ? $_SESSION["takeposterminal
"] : ''); ?>&id="+
id+
"&token=<?php echo currentToken(); ?>",
function(data, status) {
1148 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/printer/index.php',
1149 data:
'invoice='+data
1155function DolibarrTakeposPrinting(
id) {
1156 console.log(
"DolibarrTakeposPrinting Printing invoice ticket " +
id)
1159 data: { token:
'<?php echo currentToken(); ?>' },
1160 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&token='.newToken().'&term='.urlencode(isset($_SESSION["takeposterminal
"]) ? $_SESSION["takeposterminal
"] : '').'&id='; ?>" + id,
1165function CreditNote() {
1166 $(
"#poslines").load(
"invoice.php?action=creditnote&token=<?php echo newToken() ?>&invoiceid="+placeid,
function() { });
1171 $(
"#poslines").load(
"invoice.php?action=addnote&token=<?php echo newToken() ?>&invoiceid="+placeid+
"&idline="+selectedline, {
"addnote": $(
"#textinput").val() });
1176$( document ).ready(
function() {
1177 console.log(
"Set customer info and sales in header placeid=<?php echo $placeid; ?> status=<?php echo $invoice->statut; ?>");
1180 $s = $langs->trans(
"Customer");
1181 if ($invoice->id > 0 && ($invoice->socid !=
getDolGlobalString($constforcompanyid))) {
1186 $(
"#customerandsales").html(
'');
1187 $(
"#shoppingcart").html(
'');
1189 $(
"#customerandsales").append(
'<a class="valignmiddle tdoverflowmax125 minwidth100" id="customer" onclick="Customer();" title="<?php print dol_escape_js(dol_escape_htmltag($s)); ?>"><span class="fas fa-building paddingrightonly"></span><?php print dol_escape_js($s); ?></a>');
1192 $sql =
"SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX.
"facture";
1193 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
1194 if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
1196 $sql .=
" AND ref LIKE '(PROV-POS".$db->escape(isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'').
"-0%'";
1199 $sql .=
" AND pos_source = '".$db->escape($_SESSION[
"takeposterminal"]).
"'";
1200 $sql .=
" AND module_source = 'takepos'";
1203 $sql .= $db->order(
'datec',
'ASC');
1204 $resql = $db->query($sql);
1207 while ($obj = $db->fetch_object($resql)) {
1208 echo
'$("#shoppingcart").append(\'';
1209 echo
'<a class="valignmiddle" title="'.dol_escape_js($langs->trans(
"SaleStartedAt",
dol_print_date($db->jdate($obj->datec),
'%H:%M',
'tzuser')).
' - '.$obj->ref).
'" onclick="place=\\\'';
1210 $num_sale = str_replace(
")",
"", str_replace(
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-",
"", $obj->ref));
1212 if (str_replace(
"-",
"", $num_sale) > $max_sale) {
1213 $max_sale = str_replace(
"-",
"", $num_sale);
1215 echo
'\\\'; invoiceid=\\\'';
1217 echo
'\\\'; Refresh();">';
1218 if ($placeid == $obj->rowid) {
1219 echo
'<span class="basketselected">';
1221 echo
'<span class="basketnotselected">';
1223 echo
'<span class="fa fa-shopping-cart paddingright"></span>'.dol_print_date($db->jdate($obj->datec),
'%H:%M',
'tzuser');
1227 echo
'$("#shoppingcart").append(\'<a onclick="place=\\\'0-';
1229 echo
'\\\'; invoiceid=0; Refresh();"><div><span class="fa fa-plus" title="'.dol_escape_htmltag($langs->trans(
"StartAParallelSale")).
'"><span class="fa fa-shopping-cart"></span></div></a>\');';
1237 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1238 if (isModEnabled(
'stock')) {
1240 $constantforkey =
'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1242 if ($idwarehouse > 0) {
1243 $s =
'<span class="small">';
1245 $warehouse->fetch($idwarehouse);
1246 $s .=
'<span class="hideonsmartphone">'.$langs->trans(
"Warehouse").
'<br></span>'.$warehouse->ref;
1248 $s .=
' ('.$langs->trans(
"Closed").
')';
1251 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1252 print
'$("#infowarehouse").css("display", "inline-block");';
1254 $s =
'<span class="small hideonsmartphone">';
1255 $s .= $langs->trans(
"StockChangeDisabled").
'<br>'.$langs->trans(
"NoWarehouseDefinedForTerminal");
1257 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1258 if (!empty($conf->dol_optimize_smallscreen)) {
1259 print
'$("#infowarehouse").css("display", "none");';
1263 $s =
'<span class="small hideonsmartphone">'.$langs->trans(
"StockChangeDisabled").
'</span>';
1264 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1265 if (!empty($conf->dol_optimize_smallscreen)) {
1266 print
'$("#infowarehouse").css("display", "none");';
1274 if (isModEnabled(
'adherent') && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
1275 $s =
'<span class="small">';
1276 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
1277 $langs->load(
"members");
1278 $s .= $langs->trans(
"Member").
': ';
1280 $result = $adh->fetch(
'',
'', $invoice->socid);
1282 $adh->ref = $adh->getFullName($langs);
1286 $s .= $adh->getFullName($langs);
1287 $s .=
' - '.$adh->type;
1288 if ($adh->datefin) {
1289 $s .=
'<br>'.$langs->trans(
"SubscriptionEndDate").
': '.
dol_print_date($adh->datefin,
'day');
1290 if ($adh->hasDelay()) {
1291 $s .=
" ".img_warning($langs->trans(
"Late"));
1294 $s .=
'<br>'.$langs->trans(
"SubscriptionNotReceived");
1295 if ($adh->statut > 0) {
1296 $s .=
" ".img_warning($langs->trans(
"Late"));
1303 $s .=
'<br>'.$langs->trans(
"ThirdpartyNotLinkedToMember");
1308 $(
"#moreinfo").html(
'<?php print dol_escape_js($s); ?>');
1314if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
1315 echo
"function CustomerDisplay(){";
1316 echo
"var line1='".$CUSTOMER_DISPLAY_line1.
"'.substring(0,20);";
1317 echo
"line1=line1.padEnd(20);";
1318 echo
"var line2='".$CUSTOMER_DISPLAY_line2.
"'.substring(0,20);";
1319 echo
"line2=line2.padEnd(20);";
1322 data: { text: line1+line2 },
1323 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
1334if (!empty($conf->use_javascript_ajax)) {
1335 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
1336 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.
'"></script>'.
"\n";