Feature: Added product Stock Keeping Units to prevent duplicate products. A lot of refactoring because of this.

Removed: Reset Stock as it was never used and don't think it is even needed with this new batch system.
Fix: Incentive update was not working
This commit is contained in:
2021-09-27 09:31:58 +05:30
parent 4f907e965b
commit 1647d356c9
71 changed files with 1272 additions and 904 deletions

View File

@ -6,6 +6,7 @@ import { round } from 'mathjs';
import { Observable, of as observableOf } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { Batch } from '../core/batch';
import { Inventory } from '../core/inventory';
import { Product } from '../core/product';
import { ProductService } from '../product/product.service';
@ -47,13 +48,13 @@ export class PurchaseDialogComponent implements OnInit {
ngOnInit() {
this.form.setValue({
product: this.data.inventory.product,
product: this.data.inventory.batch?.sku,
quantity: this.data.inventory.quantity,
price: this.data.inventory.rate,
tax: this.data.inventory.tax,
discount: this.data.inventory.discount,
});
this.product = this.data.inventory.product;
this.product = this.data.inventory.batch?.sku;
}
displayFn(product?: Product): string {
@ -71,7 +72,10 @@ export class PurchaseDialogComponent implements OnInit {
const price = this.math.parseAmount(formValue.price, 2);
const tax = this.math.parseAmount(formValue.tax, 5);
const discount = this.math.parseAmount(formValue.discount, 5);
this.data.inventory.product = this.product;
if (this.data.inventory.batch === null) {
this.data.inventory.batch = new Batch();
}
this.data.inventory.batch.sku = this.product;
this.data.inventory.quantity = quantity;
this.data.inventory.rate = price;
this.data.inventory.tax = tax;