Inventory Management | Customer Management | Invoice Management Done | Commodity Rate Sync Done
This commit is contained in:
@@ -25,6 +25,7 @@ class Product {
|
||||
final bool trackInventory;
|
||||
final bool isActive;
|
||||
final List<int> imageIds;
|
||||
final double? currentStock;
|
||||
|
||||
Product({
|
||||
this.id,
|
||||
@@ -53,38 +54,40 @@ class Product {
|
||||
this.trackInventory = true,
|
||||
this.isActive = true,
|
||||
this.imageIds = const [],
|
||||
this.currentStock = 0.0,
|
||||
});
|
||||
|
||||
factory Product.fromJson(Map<String, dynamic> json) {
|
||||
return Product(
|
||||
id: json['id'],
|
||||
userId: json['userId'],
|
||||
categoryId: json['categoryId'],
|
||||
uomId: json['uomId'],
|
||||
userId: json['userId'] ?? json['user_id'],
|
||||
categoryId: json['categoryId'] ?? json['category_id'],
|
||||
uomId: json['uomId'] ?? json['uom_id'],
|
||||
name: json['name'],
|
||||
sku: json['sku'],
|
||||
barcode: json['barcode'],
|
||||
description: json['description'],
|
||||
purchasePrice: (json['purchasePrice'] as num?)?.toDouble(),
|
||||
sellingPrice: (json['sellingPrice'] as num?)?.toDouble(),
|
||||
minStock: (json['minStock'] as num?)?.toDouble(),
|
||||
reorderLevel: (json['reorderLevel'] as num?)?.toDouble(),
|
||||
gstRate: (json['gstRate'] as num?)?.toDouble(),
|
||||
purchasePrice: (json['purchasePrice'] ?? json['purchase_price'] as num?)?.toDouble(),
|
||||
sellingPrice: (json['sellingPrice'] ?? json['selling_price'] as num?)?.toDouble(),
|
||||
minStock: (json['minStock'] ?? json['min_stock'] as num?)?.toDouble(),
|
||||
reorderLevel: (json['reorderLevel'] ?? json['reorder_level'] as num?)?.toDouble(),
|
||||
gstRate: (json['gstRate'] ?? json['gst_rate'] as num?)?.toDouble(),
|
||||
dimensions: json['dimensions'],
|
||||
weight: (json['weight'] as num?)?.toDouble(),
|
||||
color: json['color'],
|
||||
size: json['size'],
|
||||
priceCalcRule: json['priceCalcRule'] ?? 'MANUAL',
|
||||
autoCalculatePrice: json['autoCalculatePrice'] ?? false,
|
||||
purityFactor: (json['purityFactor'] as num?)?.toDouble() ?? 1.0,
|
||||
makingCharges: (json['makingCharges'] as num?)?.toDouble() ?? 0.0,
|
||||
makingChargesType: json['makingChargesType'] ?? 'FLAT',
|
||||
wastagePercentage: (json['wastagePercentage'] as num?)?.toDouble() ?? 0.0,
|
||||
trackInventory: json['trackInventory'] ?? true,
|
||||
isActive: json['isActive'] ?? true,
|
||||
priceCalcRule: json['priceCalcRule'] ?? json['price_calc_rule'] ?? 'MANUAL',
|
||||
autoCalculatePrice: json['autoCalculatePrice'] ?? json['auto_calculate_price'] ?? false,
|
||||
purityFactor: (json['purityFactor'] ?? json['purity_factor'] as num?)?.toDouble() ?? 1.0,
|
||||
makingCharges: (json['makingCharges'] ?? json['making_charges'] as num?)?.toDouble() ?? 0.0,
|
||||
makingChargesType: json['makingChargesType'] ?? json['making_charges_type'] ?? 'FLAT',
|
||||
wastagePercentage: (json['wastagePercentage'] ?? json['wastage_percentage'] as num?)?.toDouble() ?? 0.0,
|
||||
trackInventory: json['trackInventory'] ?? json['track_inventory'] ?? true,
|
||||
isActive: json['isActive'] ?? json['is_active'] ?? true,
|
||||
imageIds: json['images'] != null
|
||||
? (json['images'] as List).map((i) => i['id'] as int).toList()
|
||||
: [],
|
||||
currentStock: (json['currentStock'] ?? json['current_stock'] as num?)?.toDouble() ?? 0.0,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user