feat: report page
This commit is contained in:
@@ -38,7 +38,7 @@ class ItemSalesInvoice {
|
||||
|
||||
return HelperPdfService.saveDocument(
|
||||
name:
|
||||
'Enaklo POS | Item Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
'Apskel POS | Item Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
pdf: pdf);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class ItemSalesInvoice {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 1 * PdfPageFormat.cm),
|
||||
Text('Enaklo POS | Item Sales Report',
|
||||
Text('Apskel POS | Item Sales Report',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -22,13 +22,14 @@ class RevenueInvoice {
|
||||
log("Starting PDF generation for summary report");
|
||||
log("Summary model: ${summaryModel.toMap()}");
|
||||
log("Search date formatted: $searchDateFormatted");
|
||||
|
||||
|
||||
final pdf = Document();
|
||||
log("PDF document created");
|
||||
|
||||
|
||||
// Load logo image
|
||||
log("Loading logo image...");
|
||||
final ByteData dataImage = await rootBundle.load('assets/images/logo.png');
|
||||
final ByteData dataImage =
|
||||
await rootBundle.load('assets/images/logo.png');
|
||||
final Uint8List bytes = dataImage.buffer.asUint8List();
|
||||
final image = pw.MemoryImage(bytes);
|
||||
log("Logo image loaded successfully, size: ${bytes.length} bytes");
|
||||
@@ -49,7 +50,7 @@ class RevenueInvoice {
|
||||
log("Saving PDF document...");
|
||||
return HelperPdfService.saveDocument(
|
||||
name:
|
||||
'Enaklo POS | Summary Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
'Apskel POS | Summary Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
pdf: pdf,
|
||||
);
|
||||
} catch (e) {
|
||||
@@ -69,7 +70,7 @@ class RevenueInvoice {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 1 * PdfPageFormat.cm),
|
||||
Text('Enaklo POS | Summary Sales Report',
|
||||
Text('Apskel POS | Summary Sales Report',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -93,7 +94,7 @@ class RevenueInvoice {
|
||||
|
||||
static Widget buildTotal(SummaryModel summaryModel) {
|
||||
log("Building total section with summary model: ${summaryModel.toMap()}");
|
||||
|
||||
|
||||
// Helper function to safely parse string to int
|
||||
int safeParseInt(String? value) {
|
||||
if (value == null || value.isEmpty) return 0;
|
||||
@@ -104,7 +105,7 @@ class RevenueInvoice {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
@@ -125,7 +126,8 @@ class RevenueInvoice {
|
||||
buildText(
|
||||
title: 'Discount',
|
||||
titleStyle: TextStyle(fontWeight: FontWeight.normal),
|
||||
value: "- ${safeParseInt(summaryModel.totalDiscount).currencyFormatRp}",
|
||||
value:
|
||||
"- ${safeParseInt(summaryModel.totalDiscount).currencyFormatRp}",
|
||||
unite: true,
|
||||
textStyle: TextStyle(
|
||||
color: PdfColor.fromHex('#FF0000'),
|
||||
@@ -147,7 +149,8 @@ class RevenueInvoice {
|
||||
titleStyle: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
value: safeParseInt(summaryModel.totalServiceCharge).currencyFormatRp,
|
||||
value:
|
||||
safeParseInt(summaryModel.totalServiceCharge).currencyFormatRp,
|
||||
unite: true,
|
||||
),
|
||||
Divider(),
|
||||
|
||||
@@ -38,7 +38,7 @@ class TransactionSalesInvoice {
|
||||
|
||||
return HelperPdfService.saveDocument(
|
||||
name:
|
||||
'Enaklo POS | Transaction Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
'Apskel POS | Transaction Sales Report | ${DateTime.now().millisecondsSinceEpoch}.pdf',
|
||||
pdf: pdf);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class TransactionSalesInvoice {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 1 * PdfPageFormat.cm),
|
||||
Text('Enaklo POS | Transaction Sales Report',
|
||||
Text('Apskel POS | Transaction Sales Report',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
Reference in New Issue
Block a user