refactor: update order print discount display to use pre-formatted string value
This commit is contained in:
parent
1296e10be7
commit
2793abd8ed
@ -1,6 +1,5 @@
|
|||||||
import { usePrinter } from '@/hooks/use-printer';
|
import { usePrinter } from '@/hooks/use-printer';
|
||||||
import { EscPosEncoder } from '@/lib/esc-pos-encoder';
|
import { EscPosEncoder } from '@/lib/esc-pos-encoder';
|
||||||
import { formatCurrency } from '@/lib/formatters';
|
|
||||||
import type { Order } from '@/types/order';
|
import type { Order } from '@/types/order';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { id } from 'date-fns/locale';
|
import { id } from 'date-fns/locale';
|
||||||
@ -68,7 +67,7 @@ export function useOrderPrint() {
|
|||||||
|
|
||||||
if (discountAmount > 0) {
|
if (discountAmount > 0) {
|
||||||
const discountLabel = 'Diskon:';
|
const discountLabel = 'Diskon:';
|
||||||
const discountVal = `- ${formatCurrency(discountAmount)}`;
|
const discountVal = '-' + order.discount_formatted;
|
||||||
const dSpaces = width - discountLabel.length - discountVal.length;
|
const dSpaces = width - discountLabel.length - discountVal.length;
|
||||||
result.line(discountLabel + ' '.repeat(Math.max(0, dSpaces)) + discountVal);
|
result.line(discountLabel + ' '.repeat(Math.max(0, dSpaces)) + discountVal);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user