Update: 2026-05-15 17:43:57
This commit is contained in:
@@ -29,7 +29,7 @@ class ThermalPrinterService {
|
||||
printer.feed(2);
|
||||
printer.cut();
|
||||
printer.disconnect();
|
||||
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
AppLogger.error('Thermal printing failed', e);
|
||||
@@ -37,7 +37,8 @@ class ThermalPrinterService {
|
||||
}
|
||||
}
|
||||
|
||||
void _buildInvoiceTicket(NetworkPrinter printer, Map<String, dynamic> invoice) {
|
||||
void _buildInvoiceTicket(
|
||||
NetworkPrinter printer, Map<String, dynamic> invoice) {
|
||||
// Header
|
||||
printer.text(
|
||||
'M U S A D A Q',
|
||||
@@ -66,8 +67,14 @@ class ThermalPrinterService {
|
||||
// Table Header
|
||||
printer.row([
|
||||
PosColumn(text: 'البند', width: 6),
|
||||
PosColumn(text: 'الكمية', width: 2, styles: const PosStyles(align: PosAlign.center)),
|
||||
PosColumn(text: 'الإجمالي', width: 4, styles: const PosStyles(align: PosAlign.right)),
|
||||
PosColumn(
|
||||
text: 'الكمية',
|
||||
width: 2,
|
||||
styles: const PosStyles(align: PosAlign.center)),
|
||||
PosColumn(
|
||||
text: 'الإجمالي',
|
||||
width: 4,
|
||||
styles: const PosStyles(align: PosAlign.right)),
|
||||
]);
|
||||
printer.hr();
|
||||
|
||||
@@ -76,8 +83,14 @@ class ThermalPrinterService {
|
||||
for (var item in items) {
|
||||
printer.row([
|
||||
PosColumn(text: item['description'] ?? '-', width: 6),
|
||||
PosColumn(text: item['quantity']?.toString() ?? '1', width: 2, styles: const PosStyles(align: PosAlign.center)),
|
||||
PosColumn(text: item['line_total']?.toString() ?? '0', width: 4, styles: const PosStyles(align: PosAlign.right)),
|
||||
PosColumn(
|
||||
text: item['quantity']?.toString() ?? '1',
|
||||
width: 2,
|
||||
styles: const PosStyles(align: PosAlign.center)),
|
||||
PosColumn(
|
||||
text: item['line_total']?.toString() ?? '0',
|
||||
width: 4,
|
||||
styles: const PosStyles(align: PosAlign.right)),
|
||||
]);
|
||||
}
|
||||
printer.hr();
|
||||
@@ -85,15 +98,27 @@ class ThermalPrinterService {
|
||||
// Totals
|
||||
printer.row([
|
||||
PosColumn(text: 'المجموع الجزئي:', width: 8),
|
||||
PosColumn(text: '${invoice['subtotal'] ?? 0}', width: 4, styles: const PosStyles(align: PosAlign.right)),
|
||||
PosColumn(
|
||||
text: '${invoice['subtotal'] ?? 0}',
|
||||
width: 4,
|
||||
styles: const PosStyles(align: PosAlign.right)),
|
||||
]);
|
||||
printer.row([
|
||||
PosColumn(text: 'الضريبة:', width: 8),
|
||||
PosColumn(text: '${invoice['tax_amount'] ?? 0}', width: 4, styles: const PosStyles(align: PosAlign.right)),
|
||||
PosColumn(
|
||||
text: '${invoice['tax_amount'] ?? 0}',
|
||||
width: 4,
|
||||
styles: const PosStyles(align: PosAlign.right)),
|
||||
]);
|
||||
printer.row([
|
||||
PosColumn(text: 'الإجمالي الكلي:', width: 8, styles: const PosStyles(bold: true)),
|
||||
PosColumn(text: '${invoice['grand_total'] ?? 0} JOD', width: 4, styles: const PosStyles(align: PosAlign.right, bold: true)),
|
||||
PosColumn(
|
||||
text: 'الإجمالي الكلي:',
|
||||
width: 8,
|
||||
styles: const PosStyles(bold: true)),
|
||||
PosColumn(
|
||||
text: '${invoice['grand_total'] ?? 0} JOD',
|
||||
width: 4,
|
||||
styles: const PosStyles(align: PosAlign.right, bold: true)),
|
||||
]);
|
||||
|
||||
printer.hr();
|
||||
|
||||
Reference in New Issue
Block a user