Track inventory
This commit is contained in:
parent
9749076df0
commit
eec4f537fd
|
|
@ -65,6 +65,8 @@ class ProductFields {
|
|||
static const String taxName2 = 'tax_name2';
|
||||
static const String taxRate3 = 'tax_rate3';
|
||||
static const String taxName3 = 'tax_name3';
|
||||
static const String stockQuantity = 'stock_quantity';
|
||||
static const String notificationThreshold = 'notification_threshold';
|
||||
}
|
||||
|
||||
abstract class ProductEntity extends Object
|
||||
|
|
|
|||
|
|
@ -149,6 +149,8 @@ class EntityPresenter {
|
|||
'age_group_60',
|
||||
'age_group_90',
|
||||
'age_group_120',
|
||||
'stock_quantity',
|
||||
'notification_threshold',
|
||||
].contains(field);
|
||||
|
||||
return value;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class ProductPresenter extends EntityPresenter {
|
|||
ProductFields.taxName1,
|
||||
ProductFields.taxName2,
|
||||
ProductFields.taxName3,
|
||||
ProductFields.stockQuantity,
|
||||
ProductFields.notificationThreshold,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +93,13 @@ class ProductPresenter extends EntityPresenter {
|
|||
case ProductFields.taxRate3:
|
||||
return Text(formatNumber(product.taxRate3, context,
|
||||
formatNumberType: FormatNumberType.percent));
|
||||
case ProductFields.stockQuantity:
|
||||
return Text(formatNumber(product.stockQuantity.toDouble(), context,
|
||||
formatNumberType: FormatNumberType.int));
|
||||
case ProductFields.notificationThreshold:
|
||||
return Text(formatNumber(
|
||||
product.stockNotificationThreshold.toDouble(), context,
|
||||
formatNumberType: FormatNumberType.int));
|
||||
}
|
||||
|
||||
return super.getField(field: field, context: context);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,18 @@ class _ProductOverviewState extends State<ProductOverview> {
|
|||
value: product.customValue4);
|
||||
}
|
||||
|
||||
if (company.trackInventory) {
|
||||
fields[localization.stockQuantity] = formatNumber(
|
||||
product.stockQuantity.toDouble(), context,
|
||||
formatNumberType: FormatNumberType.int);
|
||||
|
||||
if (product.stockNotificationThreshold != 0) {
|
||||
fields[localization.notificationThreshold] = formatNumber(
|
||||
product.stockNotificationThreshold.toDouble(), context,
|
||||
formatNumberType: FormatNumberType.int);
|
||||
}
|
||||
}
|
||||
|
||||
return ScrollableListView(
|
||||
children: <Widget>[
|
||||
EntityHeader(
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ enum ProductReportFields {
|
|||
product2,
|
||||
product3,
|
||||
product4,
|
||||
stock_quantity,
|
||||
notification_threshold
|
||||
}
|
||||
|
||||
var memoizedProductReport = memo6((
|
||||
|
|
@ -142,6 +144,12 @@ ReportResult productReport(
|
|||
company: userCompany.company,
|
||||
);
|
||||
break;
|
||||
case ProductReportFields.stock_quantity:
|
||||
value = product.stockQuantity;
|
||||
break;
|
||||
case ProductReportFields.notification_threshold:
|
||||
value = product.stockNotificationThreshold;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ReportResult.matchField(
|
||||
|
|
|
|||
Loading…
Reference in New Issue