From d9cbd8f998c2d62a571231181e0bdd31a0c87ed8 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sat, 22 Aug 2020 18:28:15 +0200 Subject: [PATCH 01/10] NEW: Print payment method and change in TakePOS --- .../compta/paiement/class/paiement.class.php | 7 +++- htdocs/core/class/dolreceiptprinter.class.php | 31 +++++++++++++- .../install/mysql/migration/12.0.0-13.0.0.sql | 2 + htdocs/install/mysql/tables/llx_paiement.sql | 3 +- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/takepos/admin/receipt.php | 8 ++++ htdocs/takepos/invoice.php | 1 + htdocs/takepos/pay.php | 3 +- htdocs/takepos/receipt.php | 41 +++++++++++++++++++ 9 files changed, 92 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 5e01454dd75..38ad5637767 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Andreu Bisquerra Gaya * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,6 +73,8 @@ class Paiement extends CommonObject public $multicurrency_amount; // Total amount of payment (in the currency of the bank account) public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> + + public $takepos_change = 0; // Excess received in TakePOS cash payment public $author; public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement @@ -288,8 +291,8 @@ class Paiement extends CommonObject $num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement); $note = ($this->note_public ? $this->note_public : $this->note); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, takepos_change)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->takepos_change.")"; $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 3234b1900f2..08cf0297e15 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -186,7 +186,7 @@ class dolReceiptPrinter extends Printer 'dol_value_month' => 'DOL_VALUE_MONTH', 'dol_value_day' => 'DOL_VALUE_DAY', 'dol_value_day_letters' => 'DOL_VALUE_DAY', - //'dol_print_payment', + 'dol_print_payment' => 'DOL_PRINT_PAYMENT', 'dol_print_logo' => 'DOL_PRINT_LOGO', 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD', 'dol_value_object_id' => 'InvoiceID', @@ -775,6 +775,35 @@ class dolReceiptPrinter extends Printer } } break; + case 'DOL_PRINT_PAYMENT': + $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql .= " cp.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; + $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; + $sql .= " ORDER BY p.datep"; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $this->db->fetch_object($resql); + $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; + $spaces = str_repeat(' ', $spacestoadd); + $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n"); + if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + { + $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12; + $spaces = str_repeat(' ', $spacestoadd); + $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->takepos_change), 10, ' ', STR_PAD_LEFT)."\n"); + } + $i++; + } + } + break; default: $this->printer->text($vals[$tplline]['tag']); $this->printer->text($vals[$tplline]['value']); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index d25f5c2975d..7870e051b1c 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -256,3 +256,5 @@ ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255); +ALTER TABLE llx_paiement ADD takepos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; + diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index d0cfd727d95..9e6df8f1a4d 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -37,5 +37,6 @@ create table llx_paiement fk_user_creat integer, -- utilisateur qui a cree l'info fk_user_modif integer, -- utilisateur qui a modifie l'info statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable - fk_export_compta integer DEFAULT 0 NOT NULL -- fk_export_compta 0 pas exporte + fk_export_compta integer DEFAULT 0 NOT NULL, -- fk_export_compta 0 pas exporte + takepos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment )ENGINE=innodb; diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 094c70ca687..40691eb70e7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -121,3 +121,4 @@ GiftReceiptButton=Add a "Gift receipt" button GiftReceipt=Gift receipt ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first AllowDelayedPayment=Allow delayed payment +PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts \ No newline at end of file diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 252781ec635..c17787c0ea1 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -48,6 +48,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PRINT_PAYMENT_METHOD", GETPOST('TAKEPOS_PRINT_PAYMENT_METHOD', 'alpha'), 'chaine', 0, '', $conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -216,6 +217,13 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print ''; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "\n"; + + // Print payment method + print ''; + print $langs->trans('PrintPaymentMethodOnReceipts'); + print ''; + print $form->selectyesno("TAKEPOS_PRINT_PAYMENT_METHOD", $conf->global->TAKEPOS_PRINT_PAYMENT_METHOD, 1); + print "\n"; } // Auto print tickets diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d4274d90444..20bf23cc215 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -241,6 +241,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->datepaye = $now; $payment->fk_account = $bankaccount; $payment->amounts[$invoice->id] = $amountofpayment; + if ($pay == 'cash') $payment->takepos_change = price2num(GETPOST('excess', 'alpha')); // If user has not used change control, add total invoice payment // Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 0a1c60a5a57..f63aec61289 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -186,11 +186,12 @@ else print "var received=0;"; var invoiceid = 0 ? $invoiceid : 0); ?>; var accountid = $("#selectaccountid").val(); var amountpayed = $("#change1").val(); + var excess = $("#change2").val(); if (amountpayed > total_ttc; ?>) { amountpayed = total_ttc; ?>; } console.log("We click on the payment mode to pay amount = "+amountpayed); - parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { + parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { if (amountpayed > || amountpayed == || amountpayed==0 ) parent.$.colorbox.close(); else location.reload(); }); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 99000c278de..a03cb24d373 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -181,6 +181,47 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?> +global->TAKEPOS_PRINT_PAYMENT_METHOD) { + $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql .= " cp.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; + $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$facid; + $sql .= " ORDER BY p.datep"; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_object($resql); + echo ''; + echo ''; + echo $langs->transnoentitiesnoconv("PaymentTypeShort".$row->code); + echo ''; + echo ''; + $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency); + echo ''; + echo ''; + if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + { + echo ''; + echo ''; + echo $langs->trans("Change"); + echo ''; + echo ''; + echo price($row->takepos_change, 1, '', 1, - 1, - 1, $conf->currency); + echo ''; + echo ''; + } + $i++; + } + } +} +?>

From e8c8cb53cb581ce28af96393bb4147a0f0c78bde Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 22 Aug 2020 18:45:54 +0200 Subject: [PATCH 02/10] Fix travis --- htdocs/takepos/admin/receipt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index c17787c0ea1..5679f861a29 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -217,7 +217,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print ''; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "\n"; - + // Print payment method print ''; print $langs->trans('PrintPaymentMethodOnReceipts'); From e36eb42568f6de45222d3ed27b2583d21dc2ee97 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 22 Aug 2020 18:46:39 +0200 Subject: [PATCH 03/10] Fix travis --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 38ad5637767..ab12405748b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -73,7 +73,7 @@ class Paiement extends CommonObject public $multicurrency_amount; // Total amount of payment (in the currency of the bank account) public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> - + public $takepos_change = 0; // Excess received in TakePOS cash payment public $author; From a5ab711b27ca81df3328a8c6be3179a4b3eb863b Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:22:05 +0200 Subject: [PATCH 04/10] Change variable to pos_change --- htdocs/compta/paiement/class/paiement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ab12405748b..4ec28bf2935 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -74,7 +74,7 @@ class Paiement extends CommonObject public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> - public $takepos_change = 0; // Excess received in TakePOS cash payment + public $pos_change = 0; // Excess received in TakePOS cash payment public $author; public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement @@ -291,8 +291,8 @@ class Paiement extends CommonObject $num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement); $note = ($this->note_public ? $this->note_public : $this->note); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, takepos_change)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->takepos_change.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->pos_change.")"; $resql = $this->db->query($sql); if ($resql) From f9913be7198f3af28325ccc90f4f27761bfcf795 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:24:46 +0200 Subject: [PATCH 05/10] Change variable to pos_change --- htdocs/core/class/dolreceiptprinter.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 08cf0297e15..b7929e6a159 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -776,7 +776,7 @@ class dolReceiptPrinter extends Printer } break; case 'DOL_PRINT_PAYMENT': - $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql .= " cp.code"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; @@ -792,13 +792,13 @@ class dolReceiptPrinter extends Printer $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; $spaces = str_repeat(' ', $spacestoadd); $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; - if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n"); - if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + if ($row->code == "LIQ" && $row->pos_change>0) // Print change only in cash payments { $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12; $spaces = str_repeat(' ', $spacestoadd); - $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->takepos_change), 10, ' ', STR_PAD_LEFT)."\n"); + $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->pos_change), 10, ' ', STR_PAD_LEFT)."\n"); } $i++; } From ec2479a41aaee7bde7433cfd603321ede4f8bace Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:26:22 +0200 Subject: [PATCH 06/10] Update 12.0.0-13.0.0.sql --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 7870e051b1c..02231edfc6e 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -256,5 +256,5 @@ ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255); -ALTER TABLE llx_paiement ADD takepos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; +ALTER TABLE llx_paiement ADD pos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta; From e032ddc035ac1f2655fae87c5e81d410c427536e Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:27:18 +0200 Subject: [PATCH 07/10] Change variable to pos_change --- htdocs/install/mysql/tables/llx_paiement.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index 9e6df8f1a4d..d19d38312a4 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -38,5 +38,5 @@ create table llx_paiement fk_user_modif integer, -- utilisateur qui a modifie l'info statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable fk_export_compta integer DEFAULT 0 NOT NULL, -- fk_export_compta 0 pas exporte - takepos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment + pos_change double(24,8) DEFAULT 0 -- Excess received in TakePOS cash payment )ENGINE=innodb; From 8f933c324a34f2368ab222bc7a51acfd18ca0238 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:28:26 +0200 Subject: [PATCH 08/10] Change variable to pos_change --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 20bf23cc215..a25c809b551 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -241,7 +241,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->datepaye = $now; $payment->fk_account = $bankaccount; $payment->amounts[$invoice->id] = $amountofpayment; - if ($pay == 'cash') $payment->takepos_change = price2num(GETPOST('excess', 'alpha')); + if ($pay == 'cash') $payment->pos_change = price2num(GETPOST('excess', 'alpha')); // If user has not used change control, add total invoice payment // Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay From 915aa56a958c4a3e0b6aea622c1ef8015af20358 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 23 Aug 2020 22:29:55 +0200 Subject: [PATCH 09/10] Change variable to pos_change --- htdocs/takepos/receipt.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index a03cb24d373..c7ca395a316 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -183,7 +183,7 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) global->TAKEPOS_PRINT_PAYMENT_METHOD) { - $sql = "SELECT p.takepos_change as takepos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; + $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql .= " cp.code"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; @@ -202,18 +202,18 @@ if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) { echo ''; echo ''; $amount_payment=($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; - if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->takepos_change; // Show amount with excess received if is cash payment + if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency); echo ''; echo ''; - if ($row->code == "LIQ" && $row->takepos_change>0) // Print change only in cash payments + if ($row->code == "LIQ" && $row->pos_change>0) // Print change only in cash payments { echo ''; echo ''; echo $langs->trans("Change"); echo ''; echo ''; - echo price($row->takepos_change, 1, '', 1, - 1, - 1, $conf->currency); + echo price($row->pos_change, 1, '', 1, - 1, - 1, $conf->currency); echo ''; echo ''; } From 3b4508b44fb3e6547d24779b284fab01dccfd67a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 19:59:46 +0200 Subject: [PATCH 10/10] Update paiement.class.php --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 4ec28bf2935..c7dd83ee253 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -292,7 +292,7 @@ class Paiement extends CommonObject $note = ($this->note_public ? $this->note_public : $this->note); $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".$this->pos_change.")"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((int) $this->pos_change).")"; $resql = $this->db->query($sql); if ($resql)