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 $dolnowtzuserrel =
dol_now(
'tzuserrel');
497 $dateinvoice =
dol_mktime(0, 0, 0, (
int) $monthuser, (
int) $dayuser, (
int) $yearuser,
'tzserver');
499 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
500 $invoice->date = $dateinvoice;
502 $invoice->module_source =
'takepos';
503 $invoice->pos_source = isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'' ;
504 $invoice->entity = !empty($_SESSION[
"takeposinvoiceentity"]) ? $_SESSION[
"takeposinvoiceentity"] : $conf->entity;
506 if ($invoice->socid <= 0) {
507 $langs->load(
'errors');
511 $placeid = $invoice->create($user);
515 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
520 if ($action ==
"addline") {
522 $prod->fetch($idproduct);
525 $customer->fetch($invoice->socid);
527 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
529 $qty = GETPOSTISSET(
'qty') ?
GETPOST(
'qty',
'int') : 1;
530 $price = $datapriceofproduct[
'pu_ht'];
531 $price_ttc = $datapriceofproduct[
'pu_ttc'];
533 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
534 $tva_tx = $datapriceofproduct[
'tva_tx'];
535 $tva_npr = $datapriceofproduct[
'tva_npr'];
538 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
539 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
541 if (!empty($conf->global->TAKEPOS_SUPPLEMENTS)) {
542 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
544 $categories = $cat->containing($idproduct,
'product');
545 $found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories,
'id')));
546 if ($found !==
false) {
547 $sql =
"SELECT fk_parent_line FROM ".MAIN_DB_PREFIX.
"facturedet where rowid=$selectedline";
548 $resql = $db->query($sql);
549 $row = $db->fetch_array($resql);
550 if ($row[0] ==
null) {
551 $parent_line = $selectedline;
553 $parent_line = $row[0];
560 if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) {
561 foreach ($invoice->lines as $line) {
562 if ($line->product_ref == $prod->ref) {
563 if ($line->special_code==4)
continue;
564 $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);
568 $idoflineadded = $line->id;
574 if ($idoflineadded <= 0) {
575 $invoice->fetch_thirdparty();
576 $array_options = array();
578 $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);
581 if (isset($conf->global->MARGIN_TYPE)) {
582 if ($conf->global->MARGIN_TYPE ==
'pmp' && !empty($prod->pmp)) {
583 $line[
'fk_fournprice'] =
null;
584 $line[
'pa_ht'] = $prod->pmp;
585 } elseif ($conf->global->MARGIN_TYPE ==
'costprice' && !empty($prod->cost_price)) {
586 $line[
'fk_fournprice'] =
null;
587 $line[
'pa_ht'] = $prod->cost_price;
590 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
592 if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
593 $line[
'fk_fournprice'] = $pf->product_fourn_price_id;
594 $line[
'pa_ht'] = $pf->fourn_unitprice_with_discount;
596 $line[
'pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
602 $parameters = array(
'prod' => $prod,
'line' => $line);
603 $reshook=$hookmanager->executeHooks(
'completeTakePosAddLine', $parameters, $invoice, $action);
604 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
607 if (empty($reshook)) {
608 if (!empty($hookmanager->resArray)) {
609 $line = $hookmanager->resArray;
612 $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);
615 if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
616 $CUSTOMER_DISPLAY_line1 = $prod->label;
617 $CUSTOMER_DISPLAY_line2 =
price($price_ttc);
621 $invoice->fetch($placeid);
624 if ($action ==
"freezone") {
626 $customer->fetch($invoice->socid);
628 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
630 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
638 $localtax1_tx =
get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
639 $localtax2_tx =
get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
641 $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);
642 $invoice->fetch($placeid);
645 if ($action ==
"addnote") {
646 $desc =
GETPOST(
'addnote',
'alpha');
648 $invoice->update_note($desc,
'_public');
649 }
else foreach ($invoice->lines as $line) {
650 if ($line->id == $idline) {
651 $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);
654 $invoice->fetch($placeid);
657 if ($action ==
"deleteline") {
658 if ($idline > 0 and $placeid > 0) {
659 $invoice->deleteline($idline);
660 $invoice->fetch($placeid);
661 } elseif ($placeid > 0) {
662 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facturedet where fk_facture = ".((int) $placeid).
" ORDER BY rowid DESC";
663 $resql = $db->query($sql);
664 $row = $db->fetch_array($resql);
665 $deletelineid = $row[0];
666 $invoice->deleteline($deletelineid);
667 $invoice->fetch($placeid);
669 if (count($invoice->lines) == 0) {
670 $invoice->delete($user);
671 header(
"Location: ".DOL_URL_ROOT.
"/takepos/invoice.php");
677 if ($action ==
"delete") {
680 $result = $invoice->fetch($placeid);
687 foreach ($invoice->lines as $line) {
688 $tmpres = $invoice->deleteline($line->id);
695 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture";
696 $varforconst =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
697 $sql .=
" SET fk_soc = ".((int) $conf->global->$varforconst).
", ";
698 $sql .=
" datec = '".$db->idate(
dol_now()).
"'";
699 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
700 $sql .=
" AND ref = '(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
701 $resql1 = $db->query($sql);
703 if ($resdeletelines && $resql1) {
709 $invoice->fetch($placeid);
714 if ($action ==
"updateqty") {
715 foreach ($invoice->lines as $line) {
716 if ($line->id == $idline) {
717 if (!$user->rights->takepos->editlines || (!$user->rights->takepos->editorderedlines && $line->special_code ==
"4")) {
720 $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);
725 $invoice->fetch($placeid);
728 if ($action ==
"updateprice") {
730 $customer->fetch($invoice->socid);
732 foreach ($invoice->lines as $line) {
733 if ($line->id == $idline) {
735 $prod->fetch($line->fk_product);
736 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
737 $price_min = $datapriceofproduct[
'price_min'];
738 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
739 $pu_ht =
price2num($number / (1 + ($line->tva_tx / 100)),
'MU');
741 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($pu_ht) * (1 -
price2num($line->remise_percent) / 100) <
price2num($price_min)))) {
742 $langs->load(
"products");
746 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
749 $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);
751 $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);
758 $invoice->fetch($placeid);
761 if ($action ==
"updatereduction") {
763 $customer->fetch($invoice->socid);
765 foreach ($invoice->lines as $line) {
766 if ($line->id == $idline) {
767 dol_syslog(
"updatereduction Process line ".$line->id.
' to apply discount of '.$number.
'%');
770 $prod->fetch($line->fk_product);
772 $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
773 $price_min = $datapriceofproduct[
'price_min'];
774 $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
776 $pu_ht =
price2num($line->subprice / (1 + ($line->tva_tx / 100)),
'MU');
779 if ($usercanproductignorepricemin && (!empty($price_min) && (
price2num($line->subprice) * (1 -
price2num($number) / 100) <
price2num($price_min)))) {
780 $langs->load(
"products");
783 if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code ==
"4")) {
786 $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);
794 } elseif ($action ==
'update_reduction_global') {
795 foreach ($invoice->lines as $line) {
796 $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);
799 $invoice->fetch($placeid);
802 if ($action ==
"order" and $placeid != 0) {
803 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
804 if ($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") {
805 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolreceiptprinter.class.php';
809 $sql =
"SELECT label FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables where rowid=".((int) $place);
810 $resql = $db->query($sql);
811 $row = $db->fetch_object($resql);
812 $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>';
813 $footerorder =
'</tbody></table>'.dol_print_date(
dol_now(),
'dayhour').
'<br></html>';
814 $order_receipt_printer1 =
"";
815 $order_receipt_printer2 =
"";
816 $order_receipt_printer3 =
"";
817 $catsprinter1 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_1);
818 $catsprinter2 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
819 $catsprinter3 = explode(
';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_3);
821 foreach ($invoice->lines as $line) {
822 if ($line->special_code ==
"4") {
826 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
827 $result = array_intersect($catsprinter1, $existing);
828 $count = count($result);
829 if (!$line->fk_product) {
834 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='1' where rowid=".$line->id;
836 $order_receipt_printer1 .=
'<tr><td class="left">';
837 if ($line->fk_product) {
838 $order_receipt_printer1 .= $line->product_label;
840 $order_receipt_printer1 .= $line->description;
842 $order_receipt_printer1 .=
'</td><td class="right">'.$line->qty;
843 if (!empty($line->array_options[
'options_order_notes'])) {
844 $order_receipt_printer1 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
846 $order_receipt_printer1 .=
'</td></tr>';
849 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
850 $invoice->fetch($placeid);
851 $printer->orderprinter = 1;
853 echo
"var orderprinter1esc='";
854 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION[
"takeposterminal"]));
857 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id;
859 $invoice->fetch($placeid);
862 foreach ($invoice->lines as $line) {
863 if ($line->special_code ==
"4") {
867 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
868 $result = array_intersect($catsprinter2, $existing);
869 $count = count($result);
872 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='2' where rowid=".$line->id;
874 $order_receipt_printer2 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
875 if (!empty($line->array_options[
'options_order_notes'])) {
876 $order_receipt_printer2 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
878 $order_receipt_printer2 .=
'</td></tr>';
881 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
882 $invoice->fetch($placeid);
883 $printer->orderprinter = 2;
885 echo
"var orderprinter2esc='";
886 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION[
"takeposterminal"]));
889 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id;
891 $invoice->fetch($placeid);
894 foreach ($invoice->lines as $line) {
895 if ($line->special_code ==
"4") {
899 $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT,
'id');
900 $result = array_intersect($catsprinter3, $existing);
901 $count = count($result);
904 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='3' where rowid=".$line->id;
906 $order_receipt_printer3 .=
'<tr>'.$line->product_label.
'<td class="right">'.$line->qty;
907 if (!empty($line->array_options[
'options_order_notes'])) {
908 $order_receipt_printer3 .=
"<br>(".$line->array_options[
'options_order_notes'].
")";
910 $order_receipt_printer3 .=
'</td></tr>';
913 if (($conf->global->TAKEPOS_PRINT_METHOD ==
"receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD ==
"takeposconnector") && $linestoprint > 0) {
914 $invoice->fetch($placeid);
915 $printer->orderprinter = 3;
917 echo
"var orderprinter3esc='";
918 $ret = $printer->sendToPrinter($invoice,
getDolGlobalInt(
'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION[
"takeposterminal"]),
getDolGlobalInt(
'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION[
"takeposterminal"]));
921 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id;
923 $invoice->fetch($placeid);
926 $sectionwithinvoicelink =
'';
927 if ($action ==
"valid" || $action ==
"history" || $action ==
'creditnote') {
928 $sectionwithinvoicelink .=
'<!-- Section with invoice link -->'.
"\n";
929 $sectionwithinvoicelink .=
'<span style="font-size:120%;" class="center">';
930 $sectionwithinvoicelink .= $invoice->getNomUrl(1,
'', 0, 0,
'', 0, 0, -1,
'_backoffice').
" - ";
931 $remaintopay = $invoice->getRemainToPay();
932 if ($remaintopay > 0) {
933 $sectionwithinvoicelink .= $langs->trans(
'RemainToPay').
': <span class="amountremaintopay" style="font-size: unset">'.
price($remaintopay, 1, $langs, 1, -1, -1, $conf->currency).
'</span>';
935 if ($invoice->paye) {
936 $sectionwithinvoicelink .=
'<span class="amountpaymentcomplete" style="font-size: unset">'.$langs->trans(
"Paid").
'</span>';
938 $sectionwithinvoicelink .= $langs->trans(
'BillShortStatusValidated');
941 $sectionwithinvoicelink .=
'</span><br>';
943 $sectionwithinvoicelink .=
' <a target="_blank" class="button" href="' . DOL_URL_ROOT .
'/document.php?token=' . newToken() .
'&modulepart=facture&file=' . $invoice->ref .
'/' . $invoice->ref .
'.pdf">Invoice</a>';
945 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
946 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
948 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
951 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
953 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
')">'.$langs->trans(
'PrintTicket').
'</button>';
955 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="PrintBox('.$placeid.
', \'without_details\')">'.$langs->trans(
'PrintWithoutDetails').
'</button>';
958 $sectionwithinvoicelink .=
' <button id="buttonprint" type="button" onclick="Print('.$placeid.
', 1)">'.$langs->trans(
'GiftReceipt').
'</button>';
961 if (
getDolGlobalString(
'TAKEPOS_EMAIL_TEMPLATE_INVOICE') && $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE > 0) {
962 $sectionwithinvoicelink .=
' <button id="buttonsend" type="button" onclick="SendTicket('.$placeid.
')">'.$langs->trans(
'SendTicket').
'</button>';
965 if ($remaintopay <= 0 &&
getDolGlobalString(
'TAKEPOS_AUTO_PRINT_TICKETS') && $action !=
"history") {
966 $sectionwithinvoicelink .=
'<script type="text/javascript">$("#buttonprint").click();</script>';
975$form =
new Form($db);
978if ((
getDolGlobalString(
'TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout ==
'phone') || defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
979 $title =
'TakePOS - Dolibarr '.DOL_VERSION;
980 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
981 $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
983 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
984 <meta name="apple-mobile-web-app-capable" content="yes">
985 <meta name="mobile-web-app-capable" content="yes">
986 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
988 '/takepos/css/pos.css.php',
990 $arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
993 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
1002<script
type=
"text/javascript">
1005<?php
if ($action==
"valid") echo
"var place=0;";?>
1006var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>;
1007$(document).ready(
function() {
1008 var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>;
1010 $(
'.posinvoiceline').click(
function(){
1011 console.log(
"Click done on "+this.
id);
1012 $(
'.posinvoiceline').removeClass(
"selected");
1013 $(
this).addClass(
"selected");
1014 if (selectedline==this.
id)
return;
1015 else selectedline=this.id;
1016 selectedtext=$(
'#'+selectedline).find(
"td:first").html();
1018 if (defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
1019 print
'$("#phonediv1").load("auto_order.php?action=editline&token='.newToken().
'&placeid="+placeid+"&selectedline="+selectedline, function() {
1026 if (idoflineadded > 0)
1028 console.log(
"Auto select "+idoflineadded);
1029 $(
'.posinvoiceline#'+idoflineadded).click();
1033if ($action ==
"order" && !empty($order_receipt_printer1)) {
1034 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1038 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php',
1039 data:
'invoice='+orderprinter1esc
1046 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1048 print $headerorder.$order_receipt_printer1.$footerorder; ?>'
1054if ($action ==
"order" && !empty($order_receipt_printer2)) {
1055 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1059 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2',
1060 data:
'invoice='+orderprinter2esc
1067 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print2',
1069 print $headerorder.$order_receipt_printer2.$footerorder; ?>'
1075if ($action ==
"order" && !empty($order_receipt_printer3)) {
1076 if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1080 url:
'<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3',
1081 data:
'invoice='+orderprinter3esc
1088if ($action ==
"search" || $action ==
"valid") {
1090 parent.setFocusOnSearchField();
1095if ($action ==
"temp" && !empty($ticket_printer1)) {
1099 url:
'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
1101 print $header_soc.$header_ticket.$body_ticket.$ticket_printer1.$ticket_total.$footer_ticket; ?>'
1106if ($action ==
"search") {
1108 $(
'#search').focus();
1116function SendTicket(
id)
1118 console.log(
"Open box to select the Print/Send form");
1119 $.colorbox({href:
"send.php?facid="+id, width:
"70%", height:
"30%", transition:
"none", iframe:
"true", title:
'<?php echo dol_escape_js($langs->trans("SendTicket")); ?>'});
1123function PrintBox(
id, action) {
1124 console.log(
"Open box before printing");
1125 $.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
"); ?>"});
1129function Print(
id, gift){
1130 console.log(
"Call Print() to generate the receipt.");
1131 $.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")); ?>'});
1135function TakeposPrinting(
id){
1137 console.log(
"TakeposPrinting" +
id);
1138 $.get(
"receipt.php?facid="+
id,
function(data, status) {
1139 receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,
'');
1142 url:
'http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>:8111/print',
1149function TakeposConnector(
id){
1150 console.log(
"TakeposConnector" +
id);
1151 $.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) {
1154 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/printer/index.php',
1155 data:
'invoice='+data
1161function DolibarrTakeposPrinting(
id) {
1162 console.log(
"DolibarrTakeposPrinting Printing invoice ticket " +
id)
1165 data: { token:
'<?php echo currentToken(); ?>' },
1166 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&token='.newToken().'&term='.urlencode(isset($_SESSION["takeposterminal
"]) ? $_SESSION["takeposterminal
"] : '').'&id='; ?>" + id,
1171function CreditNote() {
1172 $(
"#poslines").load(
"invoice.php?action=creditnote&token=<?php echo newToken() ?>&invoiceid="+placeid,
function() { });
1177 $(
"#poslines").load(
"invoice.php?action=addnote&token=<?php echo newToken() ?>&invoiceid="+placeid+
"&idline="+selectedline, {
"addnote": $(
"#textinput").val() });
1182$( document ).ready(
function() {
1183 console.log(
"Set customer info and sales in header placeid=<?php echo $placeid; ?> status=<?php echo $invoice->statut; ?>");
1186 $s = $langs->trans(
"Customer");
1187 if ($invoice->id > 0 && ($invoice->socid !=
getDolGlobalString($constforcompanyid))) {
1192 $(
"#customerandsales").html(
'');
1193 $(
"#shoppingcart").html(
'');
1195 $(
"#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>');
1198 $sql =
"SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX.
"facture";
1199 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
1200 if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
1202 $sql .=
" AND ref LIKE '(PROV-POS".$db->escape(isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'').
"-0%'";
1205 $sql .=
" AND pos_source = '".$db->escape($_SESSION[
"takeposterminal"]).
"'";
1206 $sql .=
" AND module_source = 'takepos'";
1209 $sql .= $db->order(
'datec',
'ASC');
1210 $resql = $db->query($sql);
1213 while ($obj = $db->fetch_object($resql)) {
1214 echo
'$("#shoppingcart").append(\'';
1215 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=\\\'';
1216 $num_sale = str_replace(
")",
"", str_replace(
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-",
"", $obj->ref));
1218 if (str_replace(
"-",
"", $num_sale) > $max_sale) {
1219 $max_sale = str_replace(
"-",
"", $num_sale);
1221 echo
'\\\'; invoiceid=\\\'';
1223 echo
'\\\'; Refresh();">';
1224 if ($placeid == $obj->rowid) {
1225 echo
'<span class="basketselected">';
1227 echo
'<span class="basketnotselected">';
1229 echo
'<span class="fa fa-shopping-cart paddingright"></span>'.dol_print_date($db->jdate($obj->datec),
'%H:%M',
'tzuser');
1233 echo
'$("#shoppingcart").append(\'<a onclick="place=\\\'0-';
1235 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>\');';
1243 $constantforkey =
'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1244 if (isModEnabled(
'stock')) {
1246 $constantforkey =
'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION[
"takeposterminal"]) ? $_SESSION[
"takeposterminal"] :
'');
1248 if ($idwarehouse > 0) {
1249 $s =
'<span class="small">';
1251 $warehouse->fetch($idwarehouse);
1252 $s .=
'<span class="hideonsmartphone">'.$langs->trans(
"Warehouse").
'<br></span>'.$warehouse->ref;
1254 $s .=
' ('.$langs->trans(
"Closed").
')';
1257 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1258 print
'$("#infowarehouse").css("display", "inline-block");';
1260 $s =
'<span class="small hideonsmartphone">';
1261 $s .= $langs->trans(
"StockChangeDisabled").
'<br>'.$langs->trans(
"NoWarehouseDefinedForTerminal");
1263 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1264 if (!empty($conf->dol_optimize_smallscreen)) {
1265 print
'$("#infowarehouse").css("display", "none");';
1269 $s =
'<span class="small hideonsmartphone">'.$langs->trans(
"StockChangeDisabled").
'</span>';
1270 print
"$('#infowarehouse').html('".dol_escape_js($s).
"');";
1271 if (!empty($conf->dol_optimize_smallscreen)) {
1272 print
'$("#infowarehouse").css("display", "none");';
1280 if (isModEnabled(
'adherent') && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
1281 $s =
'<span class="small">';
1282 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
1283 $langs->load(
"members");
1284 $s .= $langs->trans(
"Member").
': ';
1286 $result = $adh->fetch(
'',
'', $invoice->socid);
1288 $adh->ref = $adh->getFullName($langs);
1292 $s .= $adh->getFullName($langs);
1293 $s .=
' - '.$adh->type;
1294 if ($adh->datefin) {
1295 $s .=
'<br>'.$langs->trans(
"SubscriptionEndDate").
': '.
dol_print_date($adh->datefin,
'day');
1296 if ($adh->hasDelay()) {
1297 $s .=
" ".img_warning($langs->trans(
"Late"));
1300 $s .=
'<br>'.$langs->trans(
"SubscriptionNotReceived");
1301 if ($adh->statut > 0) {
1302 $s .=
" ".img_warning($langs->trans(
"Late"));
1309 $s .=
'<br>'.$langs->trans(
"ThirdpartyNotLinkedToMember");
1314 $(
"#moreinfo").html(
'<?php print dol_escape_js($s); ?>');
1320if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
1321 echo
"function CustomerDisplay(){";
1322 echo
"var line1='".$CUSTOMER_DISPLAY_line1.
"'.substring(0,20);";
1323 echo
"line1=line1.padEnd(20);";
1324 echo
"var line2='".$CUSTOMER_DISPLAY_line2.
"'.substring(0,20);";
1325 echo
"line2=line2.padEnd(20);";
1328 data: { text: line1+line2 },
1329 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
1340if (!empty($conf->use_javascript_ajax)) {
1341 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
1342 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.
'"></script>'.
"\n";