public StockAction(ActionType action, ActionTypeChange typechange, Stock stock, IStockDocument doc, decimal quantity, decimal?discountsum = null) { ActionType = action; TypeChange = typechange; ClientStockId = stock.Id; SourceStockId = stock.ServerId; SourceStockVersion = stock.ServerVersion; Quantity = quantity; SrcStock = stock; Timestamp = DateTime.Now; DisplayDoc = doc.DisplayName; NumberDoc = doc.NumberDoc; FromIn = doc.FromIn; OutTo = doc.OutTo; RetailCost = stock.RetailCost; RetailMarkup = stock.RetailMarkup; DiscountSum = TypeChange == ActionTypeChange.Minus && discountsum != null ? -discountsum : discountsum; }
// отмена перемещения между складами. С поставки наружу на др. склад public virtual StockAction CancelDisplacementFrom(IStockDocument doc, decimal quantity) { ReservedQuantity -= quantity; return(new StockAction(ActionType.CancelDisplacementFrom, ActionTypeChange.Minus, this, doc, quantity)); }
// отмена возврат поставщику, снаружи в резерв public virtual StockAction CancelReturnToSupplier(IStockDocument doc, decimal quantity) { ReservedQuantity += quantity; return(new StockAction(ActionType.CancelReturnToSupplier, ActionTypeChange.Plus, this, doc, quantity)); }
// отмена инвентаризации, с поставки наружу public virtual StockAction CancelInventoryDoc(IStockDocument doc, decimal quantity) { ReservedQuantity -= quantity; return(new StockAction(ActionType.CancelInventoryDoc, ActionTypeChange.Minus, this, doc, quantity)); }
// продажа, из резерва наружу public virtual StockAction ApplyReserved(IStockDocument doc, decimal quantity) { ReservedQuantity -= quantity; return(new StockAction(ActionType.Sale, ActionTypeChange.Minus, this, doc, quantity)); }