Exemplo n.º 1
0
        public void InOutGoodItems(ReturnInOutParam inOutParam)
        {
            Item   ItemAfterInOrOut = _itemService.Find(inOutParam.ItemId);
            double oldQty           = ItemAfterInOrOut.GetAppropriateQuantity;

            if (inOutParam.InOrOut == InOrOut.In)
            {
                InOutHelper.AddToAppopriateMeasurement(ItemAfterInOrOut, inOutParam.ReturnedItem.Qty);
            }
            else
            {
                InOutHelper.SubtractToAppopriateMeasurement(ItemAfterInOrOut, inOutParam.ReturnedItem.Qty);
            }

            double newQty = ItemAfterInOrOut.GetAppropriateQuantity;

            _itemService.Edit(ItemAfterInOrOut);

            if (inOutParam.InOrOut == InOrOut.In)
            {
                var         p = CreateHistoryParameterForReturnedItems(inOutParam, oldQty, newQty);
                ItemHistory h = InOutHelper.MakeHistory(p);
                _historyService.Add(h);

                _returnedHistoryService.AddReturnedGoodItem(inOutParam.ReturnedItem.ReturnedHistory.Id,
                                                            inOutParam.ReturnedItem);
            }
            else
            {
                _returnedHistoryService.DeleteGoodItem(inOutParam.ReturnedItem.Id);
                _historyService.DeleteReturnedHistoryByDRAndItem(inOutParam.DrId
                                                                 , inOutParam.ItemId);
            }
        }
Exemplo n.º 2
0
        private void RemoveGoodItemFromDBandMakeHistory()
        {
            ReturnInOutParam p = new ReturnInOutParam();

            p.ReturnedItem = GetGoodItemInListView();
            p.Note         = p.ReturnedItem.Qty + " Item(s) is removed from Return History";
            p.InOrOut      = InOrOut.Out;
            p.DrId         = _dr.Id;
            p.ItemId       = p.ReturnedItem.Item.Id;

            _inOutService.InOutGoodItems(p);
        }
Exemplo n.º 3
0
        private static HistoryParam CreateHistoryParameterForReturnedItems(ReturnInOutParam param
                                                                           , double oldQty, double newQty)
        {
            HistoryParam p = new HistoryParam();

            p.InOrOut       = param.InOrOut;
            p.ItemToMonitor = param.ReturnedItem.Item;
            p.OldQty        = oldQty;
            p.NewQty        = newQty;

            p.InOutQty   = param.ReturnedItem.Qty;
            p.Note       = param.Note;
            p.DR         = param.ReturnedItem.ReturnedHistory.DR;
            p.IsMistaken = true;
            p.Name       = param.Name;

            return(p);
        }
Exemplo n.º 4
0
        private void AddToStocksAndMakeHistory(ReturnedItem itemTobeReturned)
        {
            ReturnedItem rI = new ReturnedItem();

            rI.Item            = itemTobeReturned.Item;
            rI.ReturnedHistory = _history;
            rI.Qty             = Convert.ToDouble(itemTobeReturned.Qty);
            rI.DateAdded       = DateTime.Now;

            ReturnInOutParam p = new ReturnInOutParam();

            p.ReturnedItem = rI;
            p.InOrOut      = InOrOut.In;
            p.Note         = rI.Qty + " Item(s) Returned To Stocks. Please refer to Return History. DR : " +
                             _dr.DRNumberToDisplay;
            p.DrId   = _dr.Id;
            p.ItemId = rI.Item.Id;
            p.Name   = _name;

            _inOutService.InOutGoodItems(p);
        }