|
3 | 3 | import { _t } from "@web/core/l10n/translation";
|
4 | 4 | import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
|
5 | 5 | import { ErrorTracebackPopup } from "@point_of_sale/app/errors/popups/error_traceback_popup";
|
| 6 | +import { roundPrecision as round_pr } from "@web/core/utils/numbers"; |
6 | 7 |
|
7 | 8 | export class EpsonEposPrint {
|
8 | 9 | constructor(...args) {
|
@@ -247,13 +248,31 @@ export class EpsonEposPrint {
|
247 | 248 |
|
248 | 249 | // Process payment lines
|
249 | 250 | //receipt.ticket = "";
|
| 251 | + |
| 252 | + //Gestione arrotondamento pagamenti |
| 253 | + //Viene aggiunta una riga di pagamento con payment method type a 6 |
| 254 | + if (receipt.amount_total != receipt.amount_paid) { |
| 255 | + let payment_round = 0; |
| 256 | + if (receipt.amount_paid < receipt.amount_total) { |
| 257 | + const rounding = this.pos.currency.rounding; |
| 258 | + payment_round = round_pr( |
| 259 | + (receipt.amount_total - receipt.amount_paid), rounding |
| 260 | + ); |
| 261 | + xml += this.printRecTotal({ |
| 262 | + payment: Math.abs(payment_round), |
| 263 | + paymentType: "6", |
| 264 | + operator: fiscalOperator, |
| 265 | + }); |
| 266 | + } |
| 267 | + } |
| 268 | + |
250 | 269 | receipt.statement_ids.forEach((st) => {
|
251 | 270 | let l = st[2];
|
252 | 271 | // vedi modulo fiscal_epos_print_meal_voucher
|
253 | 272 | //receipt.ticket += l.ticket; // Append ticket to receipt
|
254 | 273 |
|
255 | 274 | // TODO
|
256 |
| - //const method = hasRefund ? "printRecTotalRefund" : "printRecTotal"; |
| 275 | + //const method = hasRefund ? "printRecTotalRefund" : "printRecTotal"; |
257 | 276 | xml += this.printRecTotal({
|
258 | 277 | payment: Math.abs(l.amount),
|
259 | 278 | paymentType: l.fiscalprinter_payment_type,
|
|
0 commit comments