public static StockCard CreateStockCard(EventItem item, Period period) { return(new StockCard(item.PART, item.WAREHOUSE, period)); }
public void ProcessConfirm(EventItem item) { assertSamePartLocation(item.PART, item.WAREHOUSE); assertPeriodIsCurrent(); assertInPeriodRange(item.EVENT.TRANSACTION_DATE); double qty = item.GetAmountInSmallestUnit(); recalculateAvailable(); switch (item.STOCK_CARD_ENTRY_TYPE) { case StockCardEntryType.OpeningStock: BALANCE += qty; BALANCE_AVAILABLE_RECALCULATE += qty; break; case StockCardEntryType.StockTaking: BALANCE += qty; BALANCE_AVAILABLE_RECALCULATE += qty; assertNotMinusBalanceStock(); break; case StockCardEntryType.PurchaseOrder: BACK_ORDER += qty; BACK_ORDER_AVAILABLE_RECALCULATE += qty; break; case StockCardEntryType.GoodReceiveNote: BALANCE += qty; BALANCE_AVAILABLE_RECALCULATE += qty; BACK_ORDER -= qty; BACK_ORDER_AVAILABLE_RECALCULATE -= qty; assertNotMinusBackOrderStock(); break; case StockCardEntryType.SalesOrder: BOOKED += qty; BOOK_AVAILABLE_RECALCULATE += qty; break; case StockCardEntryType.DeliveryOrder: BOOKED -= qty; BOOK_AVAILABLE_RECALCULATE -= qty; assertNotMinusBookedStock(); BALANCE -= qty; BALANCE_AVAILABLE_RECALCULATE -= qty; assertNotMinusBalanceStock(); break; case StockCardEntryType.PurchaseReturn: BALANCE -= qty; BALANCE_AVAILABLE_RECALCULATE -= qty; assertNotMinusBalanceStock(); break; case StockCardEntryType.SalesReturn: BALANCE += qty; BALANCE_AVAILABLE_RECALCULATE += qty; break; case StockCardEntryType.SupplierInvoice: SupplierInvoiceItem sit = (SupplierInvoiceItem)item; if (sit.GRN_ITEM != null) { if (sit.GRN_ITEM.ID == 0) { BALANCE += qty; BALANCE_AVAILABLE_RECALCULATE += qty; } } break; case StockCardEntryType.CustomerInvoice: CustomerInvoiceItem cit = (CustomerInvoiceItem)item; if (cit.DO_ITEM != null) { if (cit.DO_ITEM.ID == 0) { BALANCE -= qty; BALANCE_AVAILABLE_RECALCULATE -= qty; assertNotMinusBalanceStock(); } } break; case StockCardEntryType.POS: BALANCE -= qty; BALANCE_AVAILABLE_RECALCULATE -= qty; assertNotMinusBalanceStock(); break; default: break; } createStockCardEntry(item); }
private void createStockCardEntry(EventItem item) { StockCardEntry sce = new StockCardEntry(this, item); STOCK_CARD_ENTRIES.Add(sce); }