add invoice pdf

This commit is contained in:
Sai Naw Wun
2020-10-26 04:41:24 +06:30
parent feec3c8687
commit 2786acfd08
33 changed files with 787 additions and 1114 deletions

View File

@@ -63,14 +63,14 @@ class InvoiceTable extends StatelessWidget {
List<InvoiceTableRow> getTableRows() {
List<InvoiceTableRow> tableRows = [];
// add cargo types
List<CargoType> _cargoTypes = invoice.getCargoTypes(rate);
List<CargoType> _cargoTypes = invoice.getCargoTypes(rate) ?? [];
_cargoTypes.forEach((c) {
tableRows.add(InvoiceTableRow(
invoiceDataType: InvoiceDataType.CargoDataType,
desc: c.name,
rate:
"${c.calWeight.toStringAsFixed(2)} x ${c.calRate.toStringAsFixed(2)}",
amount: "${c.amount.toStringAsFixed(2)}"));
amount: "${c.calAmount.toStringAsFixed(2)}"));
});
invoice.shipments.where((ss) => (ss.isSelected ?? false)).forEach((s) {
tableRows.add(InvoiceTableRow(
@@ -80,7 +80,7 @@ class InvoiceTable extends StatelessWidget {
rate: "",
amount: "${s.handlingFee.toStringAsFixed(2)}"));
});
// add custom fee
// // add custom fee
invoice.customDuties.forEach((c) {
tableRows.add(InvoiceTableRow(
data: c,
@@ -89,7 +89,7 @@ class InvoiceTable extends StatelessWidget {
rate: "",
amount: "${c.fee.toStringAsFixed(2)}"));
});
// add delivery fee
// // add delivery fee
tableRows.add(InvoiceTableRow(
data: invoice.deliveryFee == null || invoice.deliveryFee == 0
? null
@@ -99,7 +99,7 @@ class InvoiceTable extends StatelessWidget {
rate: "",
amount: "${invoice?.deliveryFee?.toStringAsFixed(2) ?? '0'}"));
// add discounts
// // add discounts
if (invoice.discount != null) {
tableRows.add(InvoiceTableRow(
data: invoice.discount,