merge
This commit is contained in:
@@ -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'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user