90 header($_SERVER[
'SERVER_PROTOCOL'].
' 500 Internal Server Error',
true, 500);
96$number =
GETPOST(
'number',
'alpha');
97$idline =
GETPOST(
'idline',
'int');
98$selectedline =
GETPOST(
'selectedline',
'int');
99$desc =
GETPOST(
'desc',
'alphanohtml');
103$invoiceid =
GETPOST(
'invoiceid',
'int');
112if ($pay ==
'cheque') {
119 $sql =
"SELECT id FROM ".MAIN_DB_PREFIX.
"c_paiement";
120 $sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
121 $sql .=
" AND code = '".$db->escape($paycode).
"'";
122 $resql = $db->query($sql);
124 $obj = $db->fetch_object($resql);
126 $paiementid = $obj->id;
133 $ret = $invoice->fetch($invoiceid);
135 $ret = $invoice->fetch(
'',
'(PROV-POS'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'') .
'-'.$place.
')');
138 $placeid = $invoice->id;
141$constforcompanyid =
'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
144if ($invoice->socid > 0) {
145 $soc->fetch($invoice->socid);
151if (isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"])) {
152 if ($invoice->multicurrency_code != $_SESSION[
"takeposcustomercurrency"]) {
153 $invoice->setMulticurrencyCode($_SESSION[
"takeposcustomercurrency"]);
163$reshook=$hookmanager->executeHooks(
'doActions', $parameters, $invoice, $action);
164if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
166if (empty($reshook)) {
168 if ($action ==
'valid' && $user->hasRight(
'facture',
'creer')) {
172 if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
173 $bankaccount =
GETPOST(
'accountid',
'int');
176 $bankaccount =
getDolGlobalString(
'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION[
"takeposterminal"]);
177 } elseif ($pay ==
"CHQ") {
178 $bankaccount =
getDolGlobalString(
'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION[
"takeposterminal"]);
180 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION[
"takeposterminal"];
185 if ($bankaccount <= 0 && $pay !=
"delayed" && isModEnabled(
"banque")) {
186 $errormsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankAccount"));
194 $invoice->fetch($placeid);
196 if ($invoice->total_ttc < 0) {
197 $invoice->type = $invoice::TYPE_CREDIT_NOTE;
199 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
200 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
201 $sql .=
" AND fk_soc = ".((int) $invoice->socid);
202 $sql .=
" AND type <> ".Facture::TYPE_CREDIT_NOTE;
203 $sql .=
" AND fk_statut >= ".$invoice::STATUS_VALIDATED;
204 $sql .=
" ORDER BY rowid DESC";
206 $resql = $db->query($sql);
208 $obj = $db->fetch_object($resql);
209 $fk_source = $obj->rowid;
210 if ($fk_source ==
null) {
211 fail($langs->transnoentitiesnoconv(
"NoPreviousBillForCustomer"));
214 fail($langs->transnoentitiesnoconv(
"NoPreviousBillForCustomer"));
216 $invoice->fk_facture_source = $fk_source;
217 $invoice->update($user);
220 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'.$_SESSION[
"takeposterminal"];
225 if ($invoice->getRemainToPay() > 0) {
231 } elseif (count($invoice->lines) == 0) {
235 } elseif (isModEnabled(
'stock') && $conf->global->$constantforkey !=
"1") {
236 $savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
238 if (isModEnabled(
'productbatch') && !
getDolGlobalInt(
'CASHDESK_FORCE_DECREASE_STOCK')) {
239 $conf->global->STOCK_CALCULATE_ON_BILL = 0;
241 $conf->global->STOCK_CALCULATE_ON_BILL = 1;
244 $constantforkey =
'CASHDESK_ID_WAREHOUSE'.$_SESSION[
"takeposterminal"];
245 dol_syslog(
"Validate invoice with stock change into warehouse defined into constant ".$constantforkey.
" = ".$conf->global->$constantforkey);
247 if (isModEnabled(
'productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
248 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
251 $res = $invoice->validate($user,
'', $conf->global->$constantforkey, 0, $batch_rule);
253 $conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
255 $res = $invoice->validate($user);
258 $langs->load(
"admin");
259 dol_htmloutput_errors($invoice->error ==
'NotConfigured' ? $langs->trans(
"NotConfigured").
' (TakePos numbering module)': $invoice->error, $invoice->errors, 1);
270 if (!$error && $res >= 0) {
271 $remaintopay = $invoice->getRemainToPay();
272 if ($remaintopay > 0) {
274 $payment->datepaye = $now;
275 $payment->fk_account = $bankaccount;
276 $payment->amounts[$invoice->id] = $amountofpayment;
283 if ($amountofpayment <= 0 || $amountofpayment > $remaintopay) {
284 $payment->amounts[$invoice->id] = $remaintopay;
287 $payment->paiementid = $paiementid;
288 $payment->num_payment = $invoice->ref;
290 if ($pay !=
"delayed") {
291 $payment->create($user);
292 $res = $payment->addPaymentToBank($user,
'payment',
'(CustomerInvoicePayment)', $bankaccount,
'',
'');
297 $remaintopay = $invoice->getRemainToPay();
303 if ($remaintopay == 0) {
304 dol_syslog(
"Invoice is paid, so we set it to status Paid");
305 $result = $invoice->setPaid($user);
310 $invoice->setPaymentMethods($paiementid);
312 dol_syslog(
"Invoice is not paid, remain to pay = ".$remaintopay);
319 if ($action ==
'creditnote' && $user->hasRight(
'facture',
'creer')) {
320 $creditnote =
new Facture($db);
321 $creditnote->socid = $invoice->socid;
323 $creditnote->module_source =
'takepos';
324 $creditnote->pos_source = isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'' ;
326 $creditnote->fk_facture_source = $placeid;
327 $creditnote->remise_absolue = $invoice->remise_absolue;
328 $creditnote->remise_percent = $invoice->remise_percent;
329 $creditnote->create($user);
331 foreach ($invoice->lines as $line) {
333 if (method_exists($line,
'fetch_optionals')) {
335 $line->fetch_optionals();
338 if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
343 if (!empty($invoice->situation_counter)) {
344 $source_fk_prev_id = $line->fk_prev_id;
345 $line->fk_prev_id = $line->id;
346 if (!empty($invoice->tab_previous_situation_invoice)) {
349 $tab_jumped_credit_notes = array();
350 $lineIndex = count($invoice->tab_previous_situation_invoice) - 1;
351 $searchPreviousInvoice =
true;
352 while ($searchPreviousInvoice) {
353 if ($invoice->tab_previous_situation_invoice[$lineIndex]->situation_cycle_ref || $lineIndex < 1) {
354 $searchPreviousInvoice =
false;
358 $tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id;
364 $maxPrevSituationPercent = 0;
365 foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) {
366 if ($prevLine->id == $source_fk_prev_id) {
367 $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
370 $line->total_ht = $line->total_ht - $prevLine->total_ht;
371 $line->total_tva = $line->total_tva - $prevLine->total_tva;
372 $line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
373 $line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
374 $line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
376 $line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
377 $line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
378 $line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
379 $line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
384 $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
389 $maxPrevSituationPercent = 0;
390 foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
391 foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) {
392 if ($prevLine->fk_prev_id == $source_fk_prev_id) {
393 $maxPrevSituationPercent = $prevLine->situation_percent;
395 $line->total_ht -= $prevLine->total_ht;
396 $line->total_tva -= $prevLine->total_tva;
397 $line->total_ttc -= $prevLine->total_ttc;
398 $line->total_localtax1 -= $prevLine->total_localtax1;
399 $line->total_localtax2 -= $prevLine->total_localtax2;
401 $line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
402 $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
403 $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
404 $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
410 $line->situation_percent += $maxPrevSituationPercent;
417 $line->fk_facture = $creditnote->id;
418 $line->fk_parent_line = $fk_parent_line;
420 $line->subprice = -$line->subprice;
421 $line->pa_ht = $line->pa_ht;
422 $line->total_ht = -$line->total_ht;
423 $line->total_tva = -$line->total_tva;
424 $line->total_ttc = -$line->total_ttc;
425 $line->total_localtax1 = -$line->total_localtax1;
426 $line->total_localtax2 = -$line->total_localtax2;
428 $line->multicurrency_subprice = -$line->multicurrency_subprice;
429 $line->multicurrency_total_ht = -$line->multicurrency_total_ht;
430 $line->multicurrency_total_tva = -$line->multicurrency_total_tva;
431 $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
433 $result = $line->insert(0, 1);
435 $creditnote->lines[] = $line;
438 if ($result > 0 && $line->product_type == 9) {
439 $fk_parent_line = $result;
442 $creditnote->update_price(1);
444 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'.$_SESSION[
"takeposterminal"];
445 if (isModEnabled(
'stock') && $conf->global->$constantforkey !=
"1") {
446 $savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
447 $conf->global->STOCK_CALCULATE_ON_BILL = 1;
448 $constantforkey =
'CASHDESK_ID_WAREHOUSE'.$_SESSION[
"takeposterminal"];
449 dol_syslog(
"Validate invoice with stock change into warehouse defined into constant ".$constantforkey.
" = ".$conf->global->$constantforkey);
451 if (isModEnabled(
'productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
452 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
455 $res = $creditnote->validate($user,
'', $conf->global->$constantforkey, 0, $batch_rule);
456 $conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
458 $res = $creditnote->validate($user);
462 if ($action ==
'history' || $action ==
'creditnote') {
463 if ($action ==
'creditnote') {
464 $placeid = $creditnote->id;
466 $placeid = (int)
GETPOST(
'placeid',
'int');
469 $invoice->fetch($placeid);
473 if (($action ==
"addline" || $action ==
"freezone") && $placeid == 0) {
476 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
479 $invoice->module_source =
'takepos';
480 $invoice->pos_source = isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'' ;
481 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
483 if ($invoice->socid <= 0) {
484 $langs->load(
'errors');
488 $placeid = $invoice->create($user);
492 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
497 if ($action ==
"addline") {
499 $prod->fetch($idproduct);
502 $customer->fetch($invoice->socid);
504 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
506 $qty = GETPOSTISSET(
'qty') ?
GETPOST(
'qty',
'int') : 1;
507 $price = $datapriceofproduct[
'pu_ht'];
508 $price_ttc = $datapriceofproduct[
'pu_ttc'];
510 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
511 $tva_tx = $datapriceofproduct[
'tva_tx'];
512 $tva_npr = $datapriceofproduct[
'tva_npr'];
515 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
516 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
518 if (!empty($conf->global->TAKEPOS_SUPPLEMENTS)) {
519 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
521 $categories = $cat->containing($idproduct,
'product');
522 $found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories,
'id')));
523 if ($found !==
false) {
524 $sql =
"SELECT fk_parent_line FROM ".MAIN_DB_PREFIX.
"facturedet where rowid=$selectedline";
525 $resql = $db->query($sql);
526 $row = $db->fetch_array($resql);
527 if ($row[0] ==
null) {
528 $parent_line = $selectedline;
530 $parent_line = $row[0];
537 if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) {
538 foreach ($invoice->lines as $line) {
539 if ($line->product_ref == $prod->ref) {
540 if ($line->special_code==4)
continue;
541 $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);
545 $idoflineadded = $line->id;
551 if ($idoflineadded <= 0) {
552 $invoice->fetch_thirdparty();
553 $array_options = array();
555 $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);
558 if (isset($conf->global->MARGIN_TYPE)) {
559 if ($conf->global->MARGIN_TYPE ==
'pmp' && !empty($prod->pmp)) {
560 $line[
'fk_fournprice'] =
null;
561 $line[
'pa_ht'] = $prod->pmp;
562 } elseif ($conf->global->MARGIN_TYPE ==
'costprice' && !empty($prod->cost_price)) {
563 $line[
'fk_fournprice'] =
null;
564 $line[
'pa_ht'] = $prod->cost_price;
567 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
569 if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
570 $line[
'fk_fournprice'] = $pf->product_fourn_price_id;
571 $line[
'pa_ht'] = $pf->fourn_unitprice_with_discount;
573 $line[
'pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
579 $parameters = array(
'prod' => $prod,
'line' => $line);
580 $reshook=$hookmanager->executeHooks(
'completeTakePosAddLine', $parameters, $invoice, $action);
581 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
584 if (empty($reshook)) {
585 if (!empty($hookmanager->resArray)) {
586 $line = $hookmanager->resArray;
589 $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);
592 if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
593 $CUSTOMER_DISPLAY_line1 = $prod->label;
594 $CUSTOMER_DISPLAY_line2 =
price($price_ttc);
598 $invoice->fetch($placeid);
601 if ($action ==
"freezone") {
603 $customer->fetch($invoice->socid);
605 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
607 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
615 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
616 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
618 $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);
619 $invoice->fetch($placeid);
622 if ($action ==
"addnote") {
623 $desc =
GETPOST(
'addnote',
'alpha');
625 $invoice->update_note($desc,
'_public');
626 }
else foreach ($invoice->lines as $line) {
627 if ($line->id == $idline) {
628 $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);
631 $invoice->fetch($placeid);
634 if ($action ==
"deleteline") {
635 if ($idline > 0 and $placeid > 0) {
636 $invoice->deleteline($idline);
637 $invoice->fetch($placeid);
638 } elseif ($placeid > 0) {
639 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facturedet where fk_facture = ".((int) $placeid).
" ORDER BY rowid DESC";
640 $resql = $db->query($sql);
641 $row = $db->fetch_array($resql);
642 $deletelineid = $row[0];
643 $invoice->deleteline($deletelineid);
644 $invoice->fetch($placeid);
646 if (count($invoice->lines) == 0) {
647 $invoice->delete($user);
648 header(
"Location: ".DOL_URL_ROOT.
"/takepos/invoice.php");
654 if ($action ==
"delete") {
657 $result = $invoice->fetch($placeid);
664 foreach ($invoice->lines as $line) {
665 $tmpres = $invoice->deleteline($line->id);
672 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture";
673 $varforconst =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
674 $sql .=
" SET fk_soc = ".((int) $conf->global->$varforconst).
", ";
675 $sql .=
" datec = '".$db->idate(
dol_now()).
"'";
676 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
677 $sql .=
" AND ref = '(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
678 $resql1 = $db->query($sql);
680 if ($resdeletelines && $resql1) {
686 $invoice->fetch($placeid);
691 if ($action ==
"updateqty") {
692 foreach ($invoice->lines as $line) {
693 if ($line->id == $idline) {
694 if (!$user->rights->takepos->editlines || (!$user->rights->takepos->editorderedlines && $line->special_code ==
"4")) {
697 $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);
702 $invoice->fetch($placeid);
705 if ($action ==
"updateprice") {
707 $customer->fetch($invoice->socid);
709 foreach ($invoice->lines as $line) {
710 if ($line->id == $idline) {
712 $prod->fetch($line->fk_product);
713 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
714 $price_min = $datapriceofproduct[
'price_min'];
715 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
716 $pu_ht =
price2num($number / (1 + ($line->tva_tx / 100)),
'MU');
718 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($pu_ht) * (1 -
price2num($line->remise_percent) / 100) <
price2num($price_min)))) {
719 $langs->load(
"products");
723 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
726 $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);
728 $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);
735 $invoice->fetch($placeid);
738 if ($action ==
"updatereduction") {
740 $customer->fetch($invoice->socid);
742 foreach ($invoice->lines as $line) {
743 if ($line->id == $idline) {
744 dol_syslog(
"updatereduction Process line ".$line->id.
' to apply discount of '.$number.
'%');
747 $prod->fetch($line->fk_product);
749 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
750 $price_min = $datapriceofproduct[
'price_min'];
751 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
753 $pu_ht =
price2num($line->subprice / (1 + ($line->tva_tx / 100)),
'MU');
756 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($line->subprice) * (1 -
price2num($number) / 100) <
price2num($price_min)))) {
757 $langs->load(
"products");
760 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
763 $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);
770 $invoice->fetch($placeid);
771 } elseif ($action ==
'update_reduction_global') {
772 foreach ($invoice->lines as $line) {
773 $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);
776 $invoice->fetch($placeid);
779 if ($action ==
"order" and $placeid != 0) {
780 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
781 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") {
782 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolreceiptprinter.class.php';
786 $sql =
"SELECT label FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables where rowid=".((int) $place);
787 $resql = $db->query($sql);
788 $row = $db->fetch_object($resql);
789 $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>';
790 $footerorder =
'</tbody></table>'.dol_print_date(
dol_now(),
'dayhour').
'<br></html>';
791 $order_receipt_printer1 =
"";
792 $order_receipt_printer2 =
"";
793 $order_receipt_printer3 =
"";
794 $catsprinter1 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_1);
795 $catsprinter2 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
796 $catsprinter3 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_3);
798 foreach ($invoice->lines as $line) {
799 if ($line->special_code ==
"4") {
803 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
804 $result = array_intersect($catsprinter1, $existing);
805 $count = count($result);
806 if (!$line->fk_product) {
811 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='1' where rowid=".$line->id;
813 $order_receipt_printer1 .=
'<tr><td class="left">';
814 if ($line->fk_product) {
815 $order_receipt_printer1 .= $line->product_label;
817 $order_receipt_printer1 .= $line->description;
819 $order_receipt_printer1 .=
'</td><td class="right">'.$line->qty;
820 if (!empty($line->array_options[
'options_order_notes'])) {
821 $order_receipt_printer1 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
823 $order_receipt_printer1 .=
'</td></tr>';
826 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
827 $invoice->fetch($placeid);
828 $printer->orderprinter = 1;
830 echo
"var orderprinter1esc='";
831 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION[
"takeposterminal"]));
834 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id;
836 $invoice->fetch($placeid);
839 foreach ($invoice->lines as $line) {
840 if ($line->special_code ==
"4") {
844 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
845 $result = array_intersect($catsprinter2, $existing);
846 $count = count($result);
849 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='2' where rowid=".$line->id;
851 $order_receipt_printer2 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
852 if (!empty($line->array_options[
'options_order_notes'])) {
853 $order_receipt_printer2 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
855 $order_receipt_printer2 .=
'</td></tr>';
858 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
859 $invoice->fetch($placeid);
860 $printer->orderprinter = 2;
862 echo
"var orderprinter2esc='";
863 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION[
"takeposterminal"]));
866 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id;
868 $invoice->fetch($placeid);
871 foreach ($invoice->lines as $line) {
872 if ($line->special_code ==
"4") {
876 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
877 $result = array_intersect($catsprinter3, $existing);
878 $count = count($result);
881 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='3' where rowid=".$line->id;
883 $order_receipt_printer3 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
884 if (!empty($line->array_options[
'options_order_notes'])) {
885 $order_receipt_printer3 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
887 $order_receipt_printer3 .=
'</td></tr>';
890 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
891 $invoice->fetch($placeid);
892 $printer->orderprinter = 3;
894 echo
"var orderprinter3esc='";
895 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION[
"takeposterminal"]));
898 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id;
900 $invoice->fetch($placeid);
903 $sectionwithinvoicelink =
'';
904 if ($action ==
"valid" || $action ==
"history" || $action ==
'creditnote') {
905 $sectionwithinvoicelink .=
'<!-- Section with invoice link -->'.
"\n";
906 $sectionwithinvoicelink .=
'<span style="font-size:120%;" class="center">';
907 $sectionwithinvoicelink .= $invoice->getNomUrl(1,
'', 0, 0,
'', 0, 0, -1,
'_backoffice').
" - ";
908 $remaintopay = $invoice->getRemainToPay();
909 if ($remaintopay > 0) {
910 $sectionwithinvoicelink .= $langs->trans(
'RemainToPay').
': <span class="amountremaintopay" style="font-size: unset">'.
price($remaintopay, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
912 if ($invoice->paye) {
913 $sectionwithinvoicelink .=
'<span class="amountpaymentcomplete" style="font-size: unset">'.$langs->trans(
"Paid").
'</span>';
915 $sectionwithinvoicelink .= $langs->trans(
'BillShortStatusValidated');
918 $sectionwithinvoicelink .=
'</span><br>';
920 $sectionwithinvoicelink .=
' <a target="_blank" class="button" href="' . DOL_URL_ROOT .
'/document.php?token=' . newToken() .
'&modulepart=facture&file=' . $invoice->ref .
'/' . $invoice->ref .
'.pdf">Invoice</a>';
922 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
923 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
925 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
928 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
930 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
932 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="PrintBox('.$placeid.
', \'without_details\')">'.$langs->trans(
'PrintWithoutDetails').
'</button>';
935 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
', 1)">'.$langs->trans(
'GiftReceipt').
'</button>';
938 if (
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE') && $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE > 0) {
939 $sectionwithinvoicelink .=
' <button id="buttonsend" type="button" onclick="SendTicket('.$placeid.
')">'.$langs->trans(
'SendTicket').
'</button>';
942 if ($remaintopay <= 0 &&
getDolGlobalString(
'TAKEPOS_AUTO_PRINT_TICKETS') && $action !=
"history") {
943 $sectionwithinvoicelink .=
'<script type="text/javascript">$("#buttonprint").click();</script>';
952$form =
new Form($db);
955if ((
getDolGlobalString(
'TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout ==
'phone') || defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
956 $title =
'TakePOS - Dolibarr '.DOL_VERSION;
957 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
958 $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
960 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
961 <meta name="apple-mobile-web-app-capable" content="yes">
962 <meta name="mobile-web-app-capable" content="yes">
963 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
965 '/takepos/css/pos.css.php',
967 $arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
970 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
979<script
type=
"text/javascript">
982<?php
if ($action==
"valid") echo
"var place=0;";?>
983var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>;
984$(document).ready(
function() {
985 var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>;
987 $(
'.posinvoiceline').click(
function(){
988 console.log(
"Click done on "+this.
id);
989 $(
'.posinvoiceline').removeClass(
"selected");
990 $(
this).addClass(
"selected");
991 if (selectedline==this.
id)
return;
992 else selectedline=this.id;
993 selectedtext=$(
'#'+selectedline).find(
"td:first").html();
995 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
996 print
'$("#phonediv1").load("auto_order.php?action=editline&token='.newToken().
'&placeid="+placeid+"&selectedline="+selectedline, function() {
1003 if (idoflineadded > 0)
1005 console.log(
"Auto select "+idoflineadded);
1006 $(
'.posinvoiceline#'+idoflineadded).click();
1010if ($action ==
"order" && !empty($order_receipt_printer1)) {
1011 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1015 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php',
1016 data:
'invoice='+orderprinter1esc
1023 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1025 print $headerorder.$order_receipt_printer1.$footerorder; ?>'
1031if ($action ==
"order" && !empty($order_receipt_printer2)) {
1032 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1036 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2',
1037 data:
'invoice='+orderprinter2esc
1044 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print2',
1046 print $headerorder.$order_receipt_printer2.$footerorder; ?>'
1052if ($action ==
"order" && !empty($order_receipt_printer3)) {
1053 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1057 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3',
1058 data:
'invoice='+orderprinter3esc
1065if ($action ==
"search" || $action ==
"valid") {
1067 parent.setFocusOnSearchField();
1072if ($action ==
"temp" && !empty($ticket_printer1)) {
1076 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1078 print $header_soc.$header_ticket.$body_ticket.$ticket_printer1.$ticket_total.$footer_ticket; ?>'
1083if ($action ==
"search") {
1085 $(
'#search').focus();
1093function SendTicket(
id)
1095 console.log(
"Open box to select the Print/Send form");
1096 $.colorbox({href:
"send.php?facid="+id, width:
"70%", height:
"30%", transition:
"none", iframe:
"true", title:
'<?php echo dol_escape_js($langs->trans("SendTicket")); ?>'});
1100function PrintBox(
id, action) {
1101 console.log(
"Open box before printing");
1102 $.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
"); ?>"});
1106function Print(
id, gift){
1107 console.log(
"Call Print() to generate the receipt.");
1108 $.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")); ?>'});
1112function TakeposPrinting(
id){
1114 console.log(
"TakeposPrinting" +
id);
1115 $.get(
"receipt.php?facid="+
id,
function(data, status) {
1116 receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,
'');
1119 url:
'http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>:8111/print',
1126function TakeposConnector(
id){
1127 console.log(
"TakeposConnector" +
id);
1128 $.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) {
1131 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/printer/index.php',
1132 data:
'invoice='+data
1138function DolibarrTakeposPrinting(
id) {
1139 console.log(
"DolibarrTakeposPrinting Printing invoice ticket " +
id)
1142 data: { token:
'<?php echo currentToken(); ?>' },
1143 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&token='.newToken().'&term='.urlencode(isset($_SESSION["takeposterminal
"]) ? $_SESSION["takeposterminal
"] : '').'&id='; ?>" + id,
1148function CreditNote() {
1149 $(
"#poslines").load(
"invoice.php?action=creditnote&token=<?php echo newToken() ?>&invoiceid="+placeid,
function() { });
1154 $(
"#poslines").load(
"invoice.php?action=addnote&token=<?php echo newToken() ?>&invoiceid="+placeid+
"&idline="+selectedline, {
"addnote": $(
"#textinput").val() });
1159$( document ).ready(
function() {
1160 console.log(
"Set customer info and sales in header placeid=<?php echo $placeid; ?> status=<?php echo $invoice->statut; ?>");
1163 $s = $langs->trans(
"Customer");
1164 if ($invoice->id > 0 && ($invoice->socid !=
getDolGlobalString($constforcompanyid))) {
1169 $(
"#customerandsales").html(
'');
1170 $(
"#shoppingcart").html(
'');
1172 $(
"#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>');
1175 $sql =
"SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX.
"facture";
1176 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
1177 if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
1179 $sql .=
" AND ref LIKE '(PROV-POS".$db->escape(isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'').
"-0%'";
1182 $sql .=
" AND pos_source = '".$db->escape($_SESSION[
"takeposterminal"]).
"'";
1183 $sql .=
" AND module_source = 'takepos'";
1186 $sql .= $db->order(
'datec',
'ASC');
1187 $resql = $db->query($sql);
1190 while ($obj = $db->fetch_object($resql)) {
1191 echo
'$("#shoppingcart").append(\'';
1192 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=\\\'';
1193 $num_sale = str_replace(
")",
"", str_replace(
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-",
"", $obj->ref));
1195 if (str_replace(
"-",
"", $num_sale) > $max_sale) {
1196 $max_sale = str_replace(
"-",
"", $num_sale);
1198 echo
'\\\'; invoiceid=\\\'';
1200 echo
'\\\'; Refresh();">';
1201 if ($placeid == $obj->rowid) {
1202 echo
'<span class="basketselected">';
1204 echo
'<span class="basketnotselected">';
1206 echo
'<span class="fa fa-shopping-cart paddingright"></span>'.dol_print_date($db->jdate($obj->datec),
'%H:%M',
'tzuser');
1210 echo
'$("#shoppingcart").append(\'<a onclick="place=\\\'0-';
1212 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>\');';
1220 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1221 if (isModEnabled(
'stock')) {
1223 $constantforkey =
'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1225 if ($idwarehouse > 0) {
1226 $s =
'<span class="small">';
1228 $warehouse->fetch($idwarehouse);
1229 $s .=
'<span class="hideonsmartphone">'.$langs->trans(
"Warehouse").
'<br></span>'.$warehouse->ref;
1231 $s .=
' ('.$langs->trans(
"Closed").
')';
1234 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1235 print
'$("#infowarehouse").css("display", "inline-block");';
1237 $s =
'<span class="small hideonsmartphone">';
1238 $s .= $langs->trans(
"StockChangeDisabled").
'<br>'.$langs->trans(
"NoWarehouseDefinedForTerminal");
1240 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1241 if (!empty($conf->dol_optimize_smallscreen)) {
1242 print
'$("#infowarehouse").css("display", "none");';
1246 $s =
'<span class="small hideonsmartphone">'.$langs->trans(
"StockChangeDisabled").
'</span>';
1247 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1248 if (!empty($conf->dol_optimize_smallscreen)) {
1249 print
'$("#infowarehouse").css("display", "none");';
1257 if (isModEnabled(
'adherent') && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
1258 $s =
'<span class="small">';
1259 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
1260 $langs->load(
"members");
1261 $s .= $langs->trans(
"Member").
': ';
1263 $result = $adh->fetch(
'',
'', $invoice->socid);
1265 $adh->ref = $adh->getFullName($langs);
1269 $s .= $adh->getFullName($langs);
1270 $s .=
' - '.$adh->type;
1271 if ($adh->datefin) {
1272 $s .=
'<br>'.$langs->trans(
"SubscriptionEndDate").
': '.
dol_print_date($adh->datefin,
'day');
1273 if ($adh->hasDelay()) {
1274 $s .=
" ".img_warning($langs->trans(
"Late"));
1277 $s .=
'<br>'.$langs->trans(
"SubscriptionNotReceived");
1278 if ($adh->statut > 0) {
1279 $s .=
" ".img_warning($langs->trans(
"Late"));
1286 $s .=
'<br>'.$langs->trans(
"ThirdpartyNotLinkedToMember");
1291 $(
"#moreinfo").html(
'<?php print dol_escape_js($s); ?>');
1297if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
1298 echo
"function CustomerDisplay(){";
1299 echo
"var line1='".$CUSTOMER_DISPLAY_line1.
"'.substring(0,20);";
1300 echo
"line1=line1.padEnd(20);";
1301 echo
"var line2='".$CUSTOMER_DISPLAY_line2.
"'.substring(0,20);";
1302 echo
"line2=line2.padEnd(20);";
1305 data: { text: line1+line2 },
1306 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
1317if (!empty($conf->use_javascript_ajax)) {
1318 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
1319 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.
'"></script>'.
"\n";