POS Grosir Dutra Store: update kasir/produk/riwayat/pengaturan + offline queue
This commit is contained in:
@@ -97,11 +97,13 @@ class OfflineQueueService {
|
||||
final items = (transaction['items'] as List?) ?? [];
|
||||
|
||||
final saleId = sale['id'] as String;
|
||||
final storeId = sale['store_id'] as String?;
|
||||
final existing = await _withTimeout(
|
||||
_supabase
|
||||
.from('sales')
|
||||
.select('id, total_cost')
|
||||
.eq('id', saleId)
|
||||
.eq('store_id', storeId ?? '00000000-0000-0000-0000-000000000000')
|
||||
.maybeSingle(),
|
||||
'Check existing sale',
|
||||
);
|
||||
@@ -118,7 +120,8 @@ class OfflineQueueService {
|
||||
_supabase
|
||||
.from('sales')
|
||||
.update({'total_cost': sale['total_cost']})
|
||||
.eq('id', saleId),
|
||||
.eq('id', saleId)
|
||||
.eq('store_id', storeId ?? '00000000-0000-0000-0000-000000000000'),
|
||||
'Update sale total_cost',
|
||||
);
|
||||
}
|
||||
@@ -132,6 +135,7 @@ class OfflineQueueService {
|
||||
.from('products')
|
||||
.select()
|
||||
.eq('id', productId)
|
||||
.eq('store_id', storeId ?? '00000000-0000-0000-0000-000000000000')
|
||||
.maybeSingle(),
|
||||
'Load product for stock update',
|
||||
);
|
||||
@@ -142,7 +146,8 @@ class OfflineQueueService {
|
||||
_supabase
|
||||
.from('products')
|
||||
.update({'stock': newStock})
|
||||
.eq('id', productId),
|
||||
.eq('id', productId)
|
||||
.eq('store_id', storeId ?? '00000000-0000-0000-0000-000000000000'),
|
||||
'Update product stock',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,6 @@ class PrinterService {
|
||||
]));
|
||||
}
|
||||
}
|
||||
bytes.addAll(generator.hr());
|
||||
if (kasirName != null && kasirName.isNotEmpty) {
|
||||
bytes.addAll(generator.text('Kasir: $kasirName',
|
||||
styles: const PosStyles(align: PosAlign.center)));
|
||||
@@ -195,12 +194,10 @@ class PrinterService {
|
||||
styles: const PosStyles(align: PosAlign.center)));
|
||||
}
|
||||
}
|
||||
bytes.addAll(generator.hr());
|
||||
bytes.addAll(generator.text(
|
||||
'Terima kasih!',
|
||||
styles: const PosStyles(align: PosAlign.center),
|
||||
));
|
||||
bytes.addAll(generator.feed(2));
|
||||
bytes.addAll(generator.cut());
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user