Done Category, Product Catalogue, Customer, Vendor, Purchase Invoice Module
This commit is contained in:
@@ -164,7 +164,9 @@ class Invoice {
|
||||
discountTotal: json['discountTotal']?.toDouble() ?? 0.0,
|
||||
totalAmount: json['totalAmount'].toDouble(),
|
||||
amountPaid: json['amountPaid']?.toDouble() ?? 0.0,
|
||||
nextPaymentDate: json['nextPaymentDate'] != null ? DateTime.parse(json['nextPaymentDate']) : null,
|
||||
nextPaymentDate: json['nextPaymentDate'] != null
|
||||
? DateTime.parse(json['nextPaymentDate'])
|
||||
: null,
|
||||
paymentMethod: json['paymentMethod'],
|
||||
paymentWalletId: json['paymentWalletId'],
|
||||
status: json['status'] ?? 'DRAFT',
|
||||
@@ -172,9 +174,17 @@ class Invoice {
|
||||
isEmi: json['isEmi'] ?? false,
|
||||
emiAmount: json['emiAmount']?.toDouble(),
|
||||
emiCycle: json['emiCycle'],
|
||||
emiStartDate: json['emiStartDate'] != null ? DateTime.parse(json['emiStartDate']) : null,
|
||||
items: json['items'] != null ? (json['items'] as List).map((i) => InvoiceItem.fromJson(i)).toList() : [],
|
||||
payments: json['payments'] != null ? (json['payments'] as List).map((i) => InvoicePayment.fromJson(i)).toList() : null,
|
||||
emiStartDate: json['emiStartDate'] != null
|
||||
? DateTime.parse(json['emiStartDate'])
|
||||
: null,
|
||||
items: json['items'] != null
|
||||
? (json['items'] as List).map((i) => InvoiceItem.fromJson(i)).toList()
|
||||
: [],
|
||||
payments: json['payments'] != null
|
||||
? (json['payments'] as List)
|
||||
.map((i) => InvoicePayment.fromJson(i))
|
||||
.toList()
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -184,13 +194,17 @@ class Invoice {
|
||||
if (customerId != null) data['customerId'] = customerId;
|
||||
data['invoiceNumber'] = invoiceNumber;
|
||||
data['issueDate'] = issueDate.toIso8601String().split('T')[0];
|
||||
if (dueDate != null) data['dueDate'] = dueDate!.toIso8601String().split('T')[0];
|
||||
if (dueDate != null)
|
||||
data['dueDate'] = dueDate!.toIso8601String().split('T')[0];
|
||||
data['subtotal'] = subtotal;
|
||||
data['taxTotal'] = taxTotal;
|
||||
data['discountTotal'] = discountTotal;
|
||||
data['totalAmount'] = totalAmount;
|
||||
if (amountPaid > 0) data['amountPaid'] = amountPaid;
|
||||
if (nextPaymentDate != null) data['nextPaymentDate'] = nextPaymentDate!.toIso8601String().split('T')[0];
|
||||
if (nextPaymentDate != null)
|
||||
data['nextPaymentDate'] = nextPaymentDate!.toIso8601String().split(
|
||||
'T',
|
||||
)[0];
|
||||
if (paymentMethod != null) data['paymentMethod'] = paymentMethod;
|
||||
if (paymentWalletId != null) data['paymentWalletId'] = paymentWalletId;
|
||||
data['status'] = status;
|
||||
@@ -198,9 +212,11 @@ class Invoice {
|
||||
data['isEmi'] = isEmi;
|
||||
if (emiAmount != null) data['emiAmount'] = emiAmount;
|
||||
if (emiCycle != null) data['emiCycle'] = emiCycle;
|
||||
if (emiStartDate != null) data['emiStartDate'] = emiStartDate!.toIso8601String().split('T')[0];
|
||||
if (emiStartDate != null)
|
||||
data['emiStartDate'] = emiStartDate!.toIso8601String().split('T')[0];
|
||||
data['items'] = items.map((i) => i.toJson()).toList();
|
||||
if (payments != null) data['payments'] = payments!.map((i) => i.toJson()).toList();
|
||||
if (payments != null)
|
||||
data['payments'] = payments!.map((i) => i.toJson()).toList();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -229,7 +245,9 @@ class InvoicePayment {
|
||||
id: json['id'],
|
||||
invoiceId: json['invoiceId'],
|
||||
amount: json['amount'].toDouble(),
|
||||
paymentDate: json['paymentDate'] != null ? DateTime.parse(json['paymentDate']) : null,
|
||||
paymentDate: json['paymentDate'] != null
|
||||
? DateTime.parse(json['paymentDate'])
|
||||
: null,
|
||||
paymentMethod: json['paymentMethod'] ?? 'Cash',
|
||||
emiInstallmentNumber: json['emiInstallmentNumber'],
|
||||
walletId: json['walletId'],
|
||||
@@ -241,9 +259,11 @@ class InvoicePayment {
|
||||
if (id != null) data['id'] = id;
|
||||
if (invoiceId != null) data['invoiceId'] = invoiceId;
|
||||
data['amount'] = amount;
|
||||
if (paymentDate != null) data['paymentDate'] = paymentDate!.toIso8601String().split('T')[0];
|
||||
if (paymentDate != null)
|
||||
data['paymentDate'] = paymentDate!.toIso8601String().split('T')[0];
|
||||
data['paymentMethod'] = paymentMethod;
|
||||
if (emiInstallmentNumber != null) data['emiInstallmentNumber'] = emiInstallmentNumber;
|
||||
if (emiInstallmentNumber != null)
|
||||
data['emiInstallmentNumber'] = emiInstallmentNumber;
|
||||
if (walletId != null) data['walletId'] = walletId;
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user