perbaikan data report
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -25,16 +25,16 @@ class DueCollection {
|
|||||||
this.branch});
|
this.branch});
|
||||||
|
|
||||||
DueCollection.fromJson(dynamic json) {
|
DueCollection.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
businessId = json['business_id'];
|
businessId = num.tryParse(json['business_id']?.toString() ?? '');
|
||||||
partyId = json['party_id'];
|
partyId = num.tryParse(json['party_id']?.toString() ?? '');
|
||||||
userId = json['user_id'];
|
userId = num.tryParse(json['user_id']?.toString() ?? '');
|
||||||
saleId = json['sale_id'];
|
saleId = num.tryParse(json['sale_id']?.toString() ?? '');
|
||||||
purchaseId = json['purchase_id'];
|
purchaseId = num.tryParse(json['purchase_id']?.toString() ?? '');
|
||||||
totalDue = json['totalDue'];
|
totalDue = num.tryParse(json['totalDue']?.toString() ?? '');
|
||||||
dueAmountAfterPay = json['dueAmountAfterPay'];
|
dueAmountAfterPay = num.tryParse(json['dueAmountAfterPay']?.toString() ?? '');
|
||||||
payDueAmount = json['payDueAmount'];
|
payDueAmount = num.tryParse(json['payDueAmount']?.toString() ?? '');
|
||||||
paymentTypeId = int.tryParse(json["payment_type_id"].toString());
|
paymentTypeId = int.tryParse(json["payment_type_id"]?.toString() ?? '');
|
||||||
// paymentType = json['paymentType'];
|
// paymentType = json['paymentType'];
|
||||||
paymentDate = json['paymentDate'];
|
paymentDate = json['paymentDate'];
|
||||||
invoiceNumber = json['invoiceNumber'];
|
invoiceNumber = json['invoiceNumber'];
|
||||||
@@ -131,7 +131,7 @@ class Branch {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Branch.fromJson(dynamic json) {
|
Branch.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
phone = json['phone'];
|
phone = json['phone'];
|
||||||
address = json['address'];
|
address = json['address'];
|
||||||
|
|||||||
@@ -35,24 +35,24 @@ class PurchaseTransaction {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseTransaction.fromJson(dynamic json) {
|
PurchaseTransaction.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
partyId = json['party_id'];
|
partyId = num.tryParse(json['party_id']?.toString() ?? '');
|
||||||
businessId = json['business_id'];
|
businessId = num.tryParse(json['business_id']?.toString() ?? '');
|
||||||
userId = json['user_id'];
|
userId = num.tryParse(json['user_id']?.toString() ?? '');
|
||||||
discountAmount = json['discountAmount'];
|
discountAmount = num.tryParse(json['discountAmount']?.toString() ?? '');
|
||||||
discountPercent = json['discount_percent'];
|
discountPercent = num.tryParse(json['discount_percent']?.toString() ?? '');
|
||||||
shippingCharge = json['shipping_charge'];
|
shippingCharge = num.tryParse(json['shipping_charge']?.toString() ?? '');
|
||||||
discountType = json['discount_type'];
|
discountType = json['discount_type'];
|
||||||
dueAmount = json['dueAmount'];
|
dueAmount = num.tryParse(json['dueAmount']?.toString() ?? '');
|
||||||
changeAmount = json['change_amount'];
|
changeAmount = num.tryParse(json['change_amount']?.toString() ?? '');
|
||||||
vatAmount = json['vat_amount'];
|
vatAmount = num.tryParse(json['vat_amount']?.toString() ?? '');
|
||||||
vatPercent = json['vat_percent'];
|
vatPercent = num.tryParse(json['vat_percent']?.toString() ?? '');
|
||||||
vatId = json['vat_id'];
|
vatId = num.tryParse(json['vat_id']?.toString() ?? '');
|
||||||
paidAmount = json['paidAmount'];
|
paidAmount = num.tryParse(json['paidAmount']?.toString() ?? '');
|
||||||
totalAmount = json['totalAmount'];
|
totalAmount = num.tryParse(json['totalAmount']?.toString() ?? '');
|
||||||
invoiceNumber = json['invoiceNumber'];
|
invoiceNumber = json['invoiceNumber'];
|
||||||
isPaid = json['isPaid'];
|
isPaid = json['isPaid'];
|
||||||
paymentTypeId = int.tryParse(json["payment_type_id"].toString());
|
paymentTypeId = int.tryParse(json["payment_type_id"]?.toString() ?? '');
|
||||||
|
|
||||||
vat = json['vat'] != null ? PurchaseVat.fromJson(json['vat']) : null;
|
vat = json['vat'] != null ? PurchaseVat.fromJson(json['vat']) : null;
|
||||||
purchaseDate = json['purchaseDate'];
|
purchaseDate = json['purchaseDate'];
|
||||||
@@ -137,19 +137,19 @@ class PurchaseDetails {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseDetails.fromJson(dynamic json) {
|
PurchaseDetails.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
purchaseId = json['purchase_id'];
|
purchaseId = num.tryParse(json['purchase_id']?.toString() ?? '');
|
||||||
productId = json['product_id'];
|
productId = num.tryParse(json['product_id']?.toString() ?? '');
|
||||||
productPurchasePrice = json['productPurchasePrice'];
|
productPurchasePrice = num.tryParse(json['productPurchasePrice']?.toString() ?? '');
|
||||||
quantities = json['quantities'];
|
quantities = num.tryParse(json['quantities']?.toString() ?? '');
|
||||||
productDealerPrice = json['productDealerPrice'];
|
productDealerPrice = num.tryParse(json['productDealerPrice']?.toString() ?? '');
|
||||||
productSalePrice = json['productSalePrice'];
|
productSalePrice = num.tryParse(json['productSalePrice']?.toString() ?? '');
|
||||||
productStock = json['productStock'];
|
productStock = num.tryParse(json['productStock']?.toString() ?? '');
|
||||||
profitPercent = json['profit_percent'];
|
profitPercent = num.tryParse(json['profit_percent']?.toString() ?? '');
|
||||||
mfgDate = json['mfg_date'];
|
mfgDate = json['mfg_date'];
|
||||||
expireDate = json['expire_date'];
|
expireDate = json['expire_date'];
|
||||||
stockId = json['stock_id']; // Added
|
stockId = num.tryParse(json['stock_id']?.toString() ?? ''); // Added
|
||||||
productWholeSalePrice = json['productWholeSalePrice'];
|
productWholeSalePrice = num.tryParse(json['productWholeSalePrice']?.toString() ?? '');
|
||||||
product = json['product'] != null ? Product.fromJson(json['product']) : null;
|
product = json['product'] != null ? Product.fromJson(json['product']) : null;
|
||||||
stock = json['stock'] != null ? PurchaseStock.fromJson(json['stock']) : null;
|
stock = json['stock'] != null ? PurchaseStock.fromJson(json['stock']) : null;
|
||||||
}
|
}
|
||||||
@@ -198,11 +198,11 @@ class Product {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Product.fromJson(dynamic json) {
|
Product.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
productName = json['productName'];
|
productName = json['productName'];
|
||||||
productType = json['product_type'];
|
productType = json['product_type'];
|
||||||
categoryId = json['category_id'];
|
categoryId = num.tryParse(json['category_id']?.toString() ?? '');
|
||||||
vatAmount = json['vat_amount'];
|
vatAmount = num.tryParse(json['vat_amount']?.toString() ?? '');
|
||||||
vatType = json['vat_type'];
|
vatType = json['vat_type'];
|
||||||
|
|
||||||
category = json['category'] != null ? Category.fromJson(json['category']) : null;
|
category = json['category'] != null ? Category.fromJson(json['category']) : null;
|
||||||
@@ -238,7 +238,7 @@ class Category {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Category.fromJson(dynamic json) {
|
Category.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
categoryName = json['categoryName'];
|
categoryName = json['categoryName'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,10 +262,10 @@ class PurchaseStock {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseStock.fromJson(dynamic json) {
|
PurchaseStock.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
batchNo = json['batch_no'] ?? 'N/A';
|
batchNo = json['batch_no'] ?? 'N/A';
|
||||||
variantName = json['variant_name']; // Added
|
variantName = json['variant_name']; // Added
|
||||||
warehouseId = json['warehouse_id']; // Added
|
warehouseId = num.tryParse(json['warehouse_id']?.toString() ?? ''); // Added
|
||||||
}
|
}
|
||||||
|
|
||||||
num? id;
|
num? id;
|
||||||
@@ -285,7 +285,7 @@ class Party {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Party.fromJson(dynamic json) {
|
Party.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
email = json['email'];
|
email = json['email'];
|
||||||
phone = json['phone'];
|
phone = json['phone'];
|
||||||
@@ -320,7 +320,7 @@ class User {
|
|||||||
});
|
});
|
||||||
|
|
||||||
User.fromJson(dynamic json) {
|
User.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
role = json['role'];
|
role = json['role'];
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ class Branch {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Branch.fromJson(dynamic json) {
|
Branch.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
phone = json['phone'];
|
phone = json['phone'];
|
||||||
address = json['address'];
|
address = json['address'];
|
||||||
@@ -372,9 +372,9 @@ class PurchaseReturn {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseReturn.fromJson(dynamic json) {
|
PurchaseReturn.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
businessId = json['business_id'];
|
businessId = num.tryParse(json['business_id']?.toString() ?? '');
|
||||||
purchaseId = json['purchase_id'];
|
purchaseId = num.tryParse(json['purchase_id']?.toString() ?? '');
|
||||||
invoiceNo = json['invoice_no'];
|
invoiceNo = json['invoice_no'];
|
||||||
returnDate = json['return_date'];
|
returnDate = json['return_date'];
|
||||||
createdAt = json['created_at'];
|
createdAt = json['created_at'];
|
||||||
@@ -423,12 +423,12 @@ class PurchaseReturnDetails {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseReturnDetails.fromJson(dynamic json) {
|
PurchaseReturnDetails.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
businessId = json['business_id'];
|
businessId = num.tryParse(json['business_id']?.toString() ?? '');
|
||||||
purchaseReturnId = json['purchase_return_id'];
|
purchaseReturnId = num.tryParse(json['purchase_return_id']?.toString() ?? '');
|
||||||
purchaseDetailId = json['purchase_detail_id'];
|
purchaseDetailId = num.tryParse(json['purchase_detail_id']?.toString() ?? '');
|
||||||
returnAmount = json['return_amount'];
|
returnAmount = num.tryParse(json['return_amount']?.toString() ?? '');
|
||||||
returnQty = json['return_qty'];
|
returnQty = num.tryParse(json['return_qty']?.toString() ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
num? id;
|
num? id;
|
||||||
@@ -458,9 +458,9 @@ class PurchaseVat {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseVat.fromJson(dynamic json) {
|
PurchaseVat.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
rate = json['rate'];
|
rate = num.tryParse(json['rate']?.toString() ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
num? id;
|
num? id;
|
||||||
@@ -475,7 +475,7 @@ class PaymentType {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PaymentType.fromJson(dynamic json) {
|
PaymentType.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,9 +491,9 @@ class PurchaseProductVat {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PurchaseProductVat.fromJson(dynamic json) {
|
PurchaseProductVat.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
rate = json['rate'];
|
rate = num.tryParse(json['rate']?.toString() ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
num? id;
|
num? id;
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ class TransactionModel {
|
|||||||
factory TransactionModel.fromJson(Map<String, dynamic> json) {
|
factory TransactionModel.fromJson(Map<String, dynamic> json) {
|
||||||
return TransactionModel(
|
return TransactionModel(
|
||||||
message: json['message'],
|
message: json['message'],
|
||||||
totalAmount: json['total_amount'],
|
totalAmount: num.tryParse(json['total_amount']?.toString() ?? ''),
|
||||||
moneyIn: json['money_in'],
|
moneyIn: num.tryParse(json['money_in']?.toString() ?? ''),
|
||||||
moneyOut: json['money_out'],
|
moneyOut: num.tryParse(json['money_out']?.toString() ?? ''),
|
||||||
data: json['data'] != null
|
data: json['data'] != null
|
||||||
? List<TransactionModelData>.from(
|
? List<TransactionModelData>.from(
|
||||||
json['data'].map((v) => TransactionModelData.fromJson(v)),
|
json['data'].map((v) => TransactionModelData.fromJson(v)),
|
||||||
@@ -105,20 +105,20 @@ class TransactionModelData {
|
|||||||
final _partyKey = json['sale']?['party'] ?? json['purchase']?['party'] ?? json['due_collect']?['party'];
|
final _partyKey = json['sale']?['party'] ?? json['purchase']?['party'] ?? json['due_collect']?['party'];
|
||||||
|
|
||||||
return TransactionModelData(
|
return TransactionModelData(
|
||||||
id: json['id'],
|
id: num.tryParse(json['id']?.toString() ?? ''),
|
||||||
platform: json['platform'],
|
platform: json['platform'],
|
||||||
transactionType: json['transaction_type'],
|
transactionType: json['transaction_type'],
|
||||||
type: json['type'],
|
type: json['type'],
|
||||||
amount: json['amount'],
|
amount: num.tryParse(json['amount']?.toString() ?? ''),
|
||||||
totalAmount: json['total_amount'],
|
totalAmount: num.tryParse(json['total_amount']?.toString() ?? ''),
|
||||||
date: json['date'],
|
date: json['date'],
|
||||||
businessId: json['business_id'],
|
businessId: num.tryParse(json['business_id']?.toString() ?? ''),
|
||||||
branchId: json['branch_id'],
|
branchId: num.tryParse(json['branch_id']?.toString() ?? ''),
|
||||||
paymentTypeId: json['payment_type_id'],
|
paymentTypeId: num.tryParse(json['payment_type_id']?.toString() ?? ''),
|
||||||
userId: json['user_id'],
|
userId: num.tryParse(json['user_id']?.toString() ?? ''),
|
||||||
fromBank: json['from_bank'],
|
fromBank: json['from_bank'],
|
||||||
toBank: json['to_bank'],
|
toBank: int.tryParse(json['to_bank']?.toString() ?? ''),
|
||||||
referenceId: json['reference_id'],
|
referenceId: num.tryParse(json['reference_id']?.toString() ?? ''),
|
||||||
invoiceNo: json['invoice_no'],
|
invoiceNo: json['invoice_no'],
|
||||||
image: json['image'],
|
image: json['image'],
|
||||||
note: json['note'],
|
note: json['note'],
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class BalanceSheetModel {
|
|||||||
|
|
||||||
factory BalanceSheetModel.fromJson(Map<String, dynamic> json) {
|
factory BalanceSheetModel.fromJson(Map<String, dynamic> json) {
|
||||||
return BalanceSheetModel(
|
return BalanceSheetModel(
|
||||||
totalAsset: json["total_asset"],
|
totalAsset: num.tryParse(json["total_asset"].toString()),
|
||||||
data: json["asset_datas"] == null
|
data: json["asset_datas"] == null
|
||||||
? []
|
? []
|
||||||
: List<AssetData>.from(json["asset_datas"]!.map((x) => AssetData.fromJson(x))),
|
: List<AssetData>.from(json["asset_datas"]!.map((x) => AssetData.fromJson(x))),
|
||||||
@@ -40,8 +40,8 @@ class AssetData {
|
|||||||
if (stocks is List && stocks.isNotEmpty) {
|
if (stocks is List && stocks.isNotEmpty) {
|
||||||
final _firstStock = stocks.first as Map<String, dynamic>;
|
final _firstStock = stocks.first as Map<String, dynamic>;
|
||||||
|
|
||||||
final _purchasePrice = (_firstStock["productPurchasePrice"] as num?) ?? 0;
|
final _purchasePrice = num.tryParse(_firstStock["productPurchasePrice"].toString()) ?? 0;
|
||||||
final _stockQty = (_firstStock["productStock"] as num?) ?? 0;
|
final _stockQty = num.tryParse(_firstStock["productStock"].toString()) ?? 0;
|
||||||
|
|
||||||
_amount = _purchasePrice * _stockQty;
|
_amount = _purchasePrice * _stockQty;
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,8 @@ class AssetData {
|
|||||||
if (comboProducts is List) {
|
if (comboProducts is List) {
|
||||||
_amount = comboProducts.fold<num>(0, (sum, item) {
|
_amount = comboProducts.fold<num>(0, (sum, item) {
|
||||||
if (item is Map<String, dynamic>) {
|
if (item is Map<String, dynamic>) {
|
||||||
final _price = (item["purchase_price"] as num?) ?? 0;
|
final _price = num.tryParse(item["purchase_price"].toString()) ?? 0;
|
||||||
final _qty = (item["quantity"] as num?) ?? 0;
|
final _qty = num.tryParse(item["quantity"].toString()) ?? 0;
|
||||||
return sum + (_price * _qty);
|
return sum + (_price * _qty);
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
@@ -60,7 +60,7 @@ class AssetData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_source == "bank") {
|
} else if (_source == "bank") {
|
||||||
_amount = (json["balance"] as num?) ?? 0;
|
_amount = num.tryParse(json["balance"].toString()) ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AssetData(
|
return AssetData(
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ class BillWiseLossProfitReportModel {
|
|||||||
|
|
||||||
factory BillWiseLossProfitReportModel.fromJson(Map<String, dynamic> json) {
|
factory BillWiseLossProfitReportModel.fromJson(Map<String, dynamic> json) {
|
||||||
return BillWiseLossProfitReportModel(
|
return BillWiseLossProfitReportModel(
|
||||||
totalSaleAmount: json["total_amount"],
|
totalSaleAmount: num.tryParse(json["total_amount"].toString()),
|
||||||
totalProfit: json['total_bill_profit'],
|
totalProfit: num.tryParse(json['total_bill_profit'].toString()),
|
||||||
totalLoss: json['total_bill_loss'],
|
totalLoss: num.tryParse(json['total_bill_loss'].toString()),
|
||||||
transactions: json['data'] == null
|
transactions: json['data'] == null
|
||||||
? null
|
? null
|
||||||
: List<TransactionModel>.from(json['data'].map((x) => TransactionModel.fromJson(x))),
|
: List<TransactionModel>.from(json['data'].map((x) => TransactionModel.fromJson(x))),
|
||||||
@@ -50,8 +50,8 @@ class TransactionModel {
|
|||||||
partyName: json['party']?['name'],
|
partyName: json['party']?['name'],
|
||||||
invoiceNumber: json['invoiceNumber'],
|
invoiceNumber: json['invoiceNumber'],
|
||||||
transactionDate: json["saleDate"] == null ? null : DateTime.parse(json['saleDate']),
|
transactionDate: json["saleDate"] == null ? null : DateTime.parse(json['saleDate']),
|
||||||
totalAmount: json['totalAmount'],
|
totalAmount: num.tryParse(json['totalAmount'].toString()),
|
||||||
lossProfit: json['lossProfit'],
|
lossProfit: num.tryParse(json['lossProfit'].toString()),
|
||||||
items: json['details'] == null
|
items: json['details'] == null
|
||||||
? null
|
? null
|
||||||
: List<TransactionItem>.from(json['details'].map((x) => TransactionItem.fromJson(x))),
|
: List<TransactionItem>.from(json['details'].map((x) => TransactionItem.fromJson(x))),
|
||||||
@@ -82,10 +82,10 @@ class TransactionItem {
|
|||||||
return TransactionItem(
|
return TransactionItem(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
name: json['product']?['productName'],
|
name: json['product']?['productName'],
|
||||||
quantity: json['quantities'],
|
quantity: int.tryParse(json['quantities'].toString()),
|
||||||
purchasePrice: json['productPurchasePrice'],
|
purchasePrice: num.tryParse(json['productPurchasePrice'].toString()),
|
||||||
salesPrice: json['price'],
|
salesPrice: num.tryParse(json['price'].toString()),
|
||||||
lossProfit: json['lossProfit'],
|
lossProfit: num.tryParse(json['lossProfit'].toString()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ class CashflowModel {
|
|||||||
|
|
||||||
factory CashflowModel.fromJson(Map<String, dynamic> json) {
|
factory CashflowModel.fromJson(Map<String, dynamic> json) {
|
||||||
return CashflowModel(
|
return CashflowModel(
|
||||||
cashIn: json["cash_in"],
|
cashIn: num.tryParse(json["cash_in"].toString()),
|
||||||
cashOut: json["cash_out"],
|
cashOut: num.tryParse(json["cash_out"].toString()),
|
||||||
runningCash: json["running_cash"],
|
runningCash: num.tryParse(json["running_cash"].toString()),
|
||||||
initialRunningCash: json["initial_running_cash"],
|
initialRunningCash: num.tryParse(json["initial_running_cash"].toString()),
|
||||||
data: json["data"] == null ? [] : List<CashflowData>.from(json["data"]!.map((x) => CashflowData.fromJson(x))),
|
data: json["data"] == null ? [] : List<CashflowData>.from(json["data"]!.map((x) => CashflowData.fromJson(x))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ class CashflowData {
|
|||||||
platform: json["platform"],
|
platform: json["platform"],
|
||||||
transactionType: json["transaction_type"],
|
transactionType: json["transaction_type"],
|
||||||
type: json["type"],
|
type: json["type"],
|
||||||
amount: json["amount"],
|
amount: num.tryParse(json["amount"].toString()),
|
||||||
date: json["date"] == null ? null : DateTime.parse(json["date"]),
|
date: json["date"] == null ? null : DateTime.parse(json["date"]),
|
||||||
invoiceNo: json["invoice_no"],
|
invoiceNo: json["invoice_no"],
|
||||||
paymentType: json["payment_type"]?["name"],
|
paymentType: json["payment_type"]?["name"],
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ class LossProfitModel {
|
|||||||
expenseSummary: json["mergedExpenseData"] == null
|
expenseSummary: json["mergedExpenseData"] == null
|
||||||
? []
|
? []
|
||||||
: List<ExpenseSummaryModel>.from(json["mergedExpenseData"]!.map((x) => ExpenseSummaryModel.fromJson(x))),
|
: List<ExpenseSummaryModel>.from(json["mergedExpenseData"]!.map((x) => ExpenseSummaryModel.fromJson(x))),
|
||||||
grossSalProfit: json["grossSaleProfit"],
|
grossSalProfit: num.tryParse(json["grossSaleProfit"].toString()),
|
||||||
grossIncomeProfit: json['grossIncomeProfit'],
|
grossIncomeProfit: num.tryParse(json['grossIncomeProfit'].toString()),
|
||||||
totalExpenses: json['totalExpenses'],
|
totalExpenses: num.tryParse(json['totalExpenses'].toString()),
|
||||||
netProfit: json['netProfit'],
|
netProfit: num.tryParse(json['netProfit'].toString()),
|
||||||
cartGrossProfit: json['cardGrossProfit'],
|
cartGrossProfit: num.tryParse(json['cardGrossProfit'].toString()),
|
||||||
totalCardExpense: json['totalCardExpenses'],
|
totalCardExpense: num.tryParse(json['totalCardExpenses'].toString()),
|
||||||
cardNetProfit: json['cardNetProfit'],
|
cardNetProfit: num.tryParse(json['cardNetProfit'].toString()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ class IncomeSummaryModel {
|
|||||||
return IncomeSummaryModel(
|
return IncomeSummaryModel(
|
||||||
type: json["type"],
|
type: json["type"],
|
||||||
date: json["date"],
|
date: json["date"],
|
||||||
totalIncome: json["total_incomes"],
|
totalIncome: num.tryParse(json["total_incomes"].toString()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ class ExpenseSummaryModel {
|
|||||||
return ExpenseSummaryModel(
|
return ExpenseSummaryModel(
|
||||||
type: json["type"],
|
type: json["type"],
|
||||||
date: json["date"],
|
date: json["date"],
|
||||||
totalExpense: json["total_expenses"],
|
totalExpense: num.tryParse(json["total_expenses"].toString()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ class ProductHistoryListModel {
|
|||||||
|
|
||||||
factory ProductHistoryListModel.fromJson(Map<String, dynamic> json) {
|
factory ProductHistoryListModel.fromJson(Map<String, dynamic> json) {
|
||||||
return ProductHistoryListModel(
|
return ProductHistoryListModel(
|
||||||
totalPurchaseQuantity: json['total_purchase_qty'],
|
totalPurchaseQuantity: int.tryParse(json['total_purchase_qty']?.toString() ?? ''),
|
||||||
totalSaleQuantity: json['total_sale_qty'],
|
totalSaleQuantity: int.tryParse(json['total_sale_qty']?.toString() ?? ''),
|
||||||
items: json['data'] == null
|
items: json['data'] == null
|
||||||
? null
|
? null
|
||||||
: List<ProductHistoryItemModel>.from(json['data']!.map((x) => ProductHistoryItemModel.fromJson(x))),
|
: List<ProductHistoryItemModel>.from(json['data']!.map((x) => ProductHistoryItemModel.fromJson(x))),
|
||||||
@@ -54,34 +54,40 @@ class ProductHistoryItemModel {
|
|||||||
factory ProductHistoryItemModel.fromJson(Map<String, dynamic> json) {
|
factory ProductHistoryItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
final int _totalPurchaseQuantity = json["purchase_details"] == null
|
final int _totalPurchaseQuantity = json["purchase_details"] == null
|
||||||
? 0
|
? 0
|
||||||
: (json["purchase_details"] as List<dynamic>).fold<int>(0, (p, ev) => p + (ev["quantities"] as int? ?? 0));
|
: (json["purchase_details"] as List<dynamic>)
|
||||||
|
.fold<int>(0, (p, ev) => p + (int.tryParse(ev["quantities"]?.toString() ?? '') ?? 0));
|
||||||
|
|
||||||
final int _totalSaleQuantity = json["sale_details"] == null
|
final int _totalSaleQuantity = json["sale_details"] == null
|
||||||
? 0
|
? 0
|
||||||
: (json["sale_details"] as List<dynamic>).fold<int>(0, (p, ev) => p + (ev["quantities"] as int? ?? 0));
|
: (json["sale_details"] as List<dynamic>)
|
||||||
|
.fold<int>(0, (p, ev) => p + (int.tryParse(ev["quantities"]?.toString() ?? '') ?? 0));
|
||||||
|
|
||||||
final _remainingQuantity = switch (json["product_type"]?.trim().toLowerCase()) {
|
final _remainingQuantity = switch (json["product_type"]?.trim().toLowerCase()) {
|
||||||
"combo" => json["combo_products"] == null
|
"combo" => json["combo_products"] == null
|
||||||
? 0
|
? 0
|
||||||
: (json["combo_products"] as List<dynamic>).fold<int>(0, (p, ev) {
|
: (json["combo_products"] as List<dynamic>).fold<int>(0, (p, ev) {
|
||||||
return p + (ev["stock"]?["productStock"] as int? ?? 0);
|
return p + (int.tryParse(ev["stock"]?["productStock"]?.toString() ?? '') ?? 0);
|
||||||
}),
|
}),
|
||||||
_ => json["stocks"] == null ? null : (json["stocks"] as List<dynamic>).firstOrNull?["productStock"] as int? ?? 0,
|
_ => json["stocks"] == null
|
||||||
|
? null
|
||||||
|
: int.tryParse((json["stocks"] as List<dynamic>).firstOrNull?["productStock"]?.toString() ?? '') ?? 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
final _salePrice = switch (json["product_type"]?.trim().toLowerCase()) {
|
final _salePrice = switch (json["product_type"]?.trim().toLowerCase()) {
|
||||||
"combo" => json["productSalePrice"] ?? 0,
|
"combo" => num.tryParse(json["productSalePrice"]?.toString() ?? '') ?? 0,
|
||||||
_ =>
|
_ => json["stocks"] == null
|
||||||
json["stocks"] == null ? null : (json["stocks"] as List<dynamic>).firstOrNull?["productSalePrice"] as num? ?? 0,
|
? null
|
||||||
|
: num.tryParse((json["stocks"] as List<dynamic>).firstOrNull?["productSalePrice"]?.toString() ?? '') ?? 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
final _purchasePrice = switch (json["product_type"]?.trim().toLowerCase()) {
|
final _purchasePrice = switch (json["product_type"]?.trim().toLowerCase()) {
|
||||||
"combo" => json["combo_products"] == null
|
"combo" => json["combo_products"] == null
|
||||||
? 0
|
? 0
|
||||||
: (json["combo_products"] as List<dynamic>).fold<num>(0, (p, ev) => p + (ev["purchase_price"] as num? ?? 0)),
|
: (json["combo_products"] as List<dynamic>)
|
||||||
|
.fold<num>(0, (p, ev) => p + (num.tryParse(ev["purchase_price"]?.toString() ?? '') ?? 0)),
|
||||||
_ => json["stocks"] == null
|
_ => json["stocks"] == null
|
||||||
? null
|
? null
|
||||||
: (json["stocks"] as List<dynamic>).firstOrNull?["productPurchasePrice"] as num? ?? 0,
|
: num.tryParse((json["stocks"] as List<dynamic>).firstOrNull?["productPurchasePrice"]?.toString() ?? '') ?? 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
return ProductHistoryItemModel(
|
return ProductHistoryItemModel(
|
||||||
@@ -116,9 +122,9 @@ class ProductHistoryDetailsModel {
|
|||||||
final _detailsKey = _json["sale_details"] ?? _json["purchase_details"];
|
final _detailsKey = _json["sale_details"] ?? _json["purchase_details"];
|
||||||
|
|
||||||
return ProductHistoryDetailsModel(
|
return ProductHistoryDetailsModel(
|
||||||
totalQuantities: j['total_quantities'],
|
totalQuantities: int.tryParse(j['total_quantities']?.toString() ?? ''),
|
||||||
totalSalePrice: j['total_sale_price'],
|
totalSalePrice: num.tryParse(j['total_sale_price']?.toString() ?? ''),
|
||||||
totalPurchasePrice: j['total_purchase_price'],
|
totalPurchasePrice: num.tryParse(j['total_purchase_price']?.toString() ?? ''),
|
||||||
productName: _json?["productName"],
|
productName: _json?["productName"],
|
||||||
items: _detailsKey == null
|
items: _detailsKey == null
|
||||||
? null
|
? null
|
||||||
@@ -155,9 +161,9 @@ class ProductHistoryDetailsItem {
|
|||||||
invoiceNo: _invoiceKey,
|
invoiceNo: _invoiceKey,
|
||||||
type: 'Purchase',
|
type: 'Purchase',
|
||||||
transactionDate: _transactionDate != null ? DateTime.parse(_transactionDate) : null,
|
transactionDate: _transactionDate != null ? DateTime.parse(_transactionDate) : null,
|
||||||
quantities: json['quantities'],
|
quantities: int.tryParse(json['quantities']?.toString() ?? ''),
|
||||||
salePrice: json['price'],
|
salePrice: num.tryParse(json['price']?.toString() ?? ''),
|
||||||
purchasePrice: json['productPurchasePrice'],
|
purchasePrice: num.tryParse(json['productPurchasePrice']?.toString() ?? ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SubscriptionReportModel {
|
|||||||
|
|
||||||
factory SubscriptionReportModel.fromJson(Map<String, dynamic> json) {
|
factory SubscriptionReportModel.fromJson(Map<String, dynamic> json) {
|
||||||
final _startDate = json["created_at"] == null ? null : DateTime.parse(json['created_at']);
|
final _startDate = json["created_at"] == null ? null : DateTime.parse(json['created_at']);
|
||||||
final int _duration = json['duration'] ?? 0;
|
final int _duration = int.tryParse(json['duration']?.toString() ?? '') ?? 0;
|
||||||
|
|
||||||
return SubscriptionReportModel(
|
return SubscriptionReportModel(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
|
|||||||
@@ -18,16 +18,16 @@ class TaxReportModel {
|
|||||||
overviews: [
|
overviews: [
|
||||||
// Sales
|
// Sales
|
||||||
OverviewModel(
|
OverviewModel(
|
||||||
totalAmount: json['sales_total_amount'] ?? 0,
|
totalAmount: num.tryParse(json['sales_total_amount'].toString()) ?? 0,
|
||||||
totalDiscount: json['sales_total_discount'] ?? 0,
|
totalDiscount: num.tryParse(json['sales_total_discount'].toString()) ?? 0,
|
||||||
totalVat: json['sales_total_vat'] ?? 0,
|
totalVat: num.tryParse(json['sales_total_vat'].toString()) ?? 0,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Purchase
|
// Purchase
|
||||||
OverviewModel(
|
OverviewModel(
|
||||||
totalAmount: json['purchases_total_amount'] ?? 0,
|
totalAmount: num.tryParse(json['purchases_total_amount'].toString()) ?? 0,
|
||||||
totalDiscount: json['purchases_total_discount'] ?? 0,
|
totalDiscount: num.tryParse(json['purchases_total_discount'].toString()) ?? 0,
|
||||||
totalVat: json['purchases_total_vat'] ?? 0,
|
totalVat: num.tryParse(json['purchases_total_vat'].toString()) ?? 0,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -63,10 +63,10 @@ class InvoiceModel {
|
|||||||
partyName: json['party']?['name'],
|
partyName: json['party']?['name'],
|
||||||
invoiceNumber: json['invoiceNumber'],
|
invoiceNumber: json['invoiceNumber'],
|
||||||
transactionDate: _dateKey == null ? null : DateTime.parse(_dateKey),
|
transactionDate: _dateKey == null ? null : DateTime.parse(_dateKey),
|
||||||
amount: json['totalAmount'],
|
amount: num.tryParse(json['totalAmount'].toString()),
|
||||||
discountAmount: json['discountAmount'],
|
discountAmount: num.tryParse(json['discountAmount'].toString()),
|
||||||
vatName: json['vat']?['name'],
|
vatName: json['vat']?['name'],
|
||||||
vatAmount: json['vat_amount'],
|
vatAmount: num.tryParse(json['vat_amount'].toString()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ class PaymentsTransaction {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PaymentsTransaction.fromJson(dynamic json) {
|
PaymentsTransaction.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
platform = json['platform'];
|
platform = json['platform'];
|
||||||
transactionType = json['transaction_type'];
|
transactionType = json['transaction_type'];
|
||||||
amount = num.tryParse(json['amount'].toString());
|
amount = num.tryParse(json['amount']?.toString() ?? '');
|
||||||
date = json['date'];
|
date = json['date'];
|
||||||
invoiceNo = json['invoice_no'];
|
invoiceNo = json['invoice_no'];
|
||||||
referenceId = json['reference_id'];
|
referenceId = num.tryParse(json['reference_id']?.toString() ?? '');
|
||||||
paymentTypeId = json['payment_type_id'];
|
paymentTypeId = num.tryParse(json['payment_type_id']?.toString() ?? '');
|
||||||
meta = json['meta'] != null ? TransactionMeta.fromJson(json['meta']) : null;
|
meta = json['meta'] != null ? TransactionMeta.fromJson(json['meta']) : null;
|
||||||
paymentType = json['payment_type'] != null ? PaymentType.fromJson(json['payment_type']) : null;
|
paymentType = json['payment_type'] != null ? PaymentType.fromJson(json['payment_type']) : null;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ class PaymentType {
|
|||||||
});
|
});
|
||||||
|
|
||||||
PaymentType.fromJson(dynamic json) {
|
PaymentType.fromJson(dynamic json) {
|
||||||
id = json['id'];
|
id = num.tryParse(json['id']?.toString() ?? '');
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
paymentTypeMeta = json['meta'] != null ? PaymentTypeMeta.fromJson(json['meta']) : null;
|
paymentTypeMeta = json['meta'] != null ? PaymentTypeMeta.fromJson(json['meta']) : null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user