This commit is contained in:
PhyoThandar
2020-10-16 13:46:02 +06:30
parent ff12b2c24b
commit 0e9e3da0c4
7 changed files with 154 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ import 'package.dart';
import 'receipt.dart';
class Invoice {
String id;
String invoiceNumber;
DateTime invoiceDate;
String customerName;
@@ -16,7 +17,8 @@ class Invoice {
List<String> receiptPhotos;
Invoice(
{this.invoiceNumber,
{this.id,
this.invoiceNumber,
this.invoiceDate,
this.customerName,
this.customerPhoneNumber,
@@ -29,4 +31,21 @@ class Invoice {
this.receipts});
double get getAmount => packages.fold(0, (p, e) => (e.rate * e.weight) + p);
factory Invoice.fromMap(Map<String, dynamic> map, String docID) {
return Invoice(
id: docID,
invoiceNumber: map['invoice_number'],
invoiceDate: map['invoice_date'],
customerName: map['customer_name'],
customerPhoneNumber: map['phone_number'],
amount: map['amount'],
status: map['status'],
discount: map['discount'],
paymentAttachment: map['payment_attachment'],
packages: map['packages'],
receiptPhotos: map['receiptPhotos'],
receipts: map['receipts'],
);
}
}