Ejemplo n.º 1
0
        /// <summary>
        /// Saves the weighted average log.
        /// </summary>
        /// <param name="Userid">The userid.</param>
        public void SaveWeightedAverageLog(int Userid)
        {
            MovingAverageHistory wal = new MovingAverageHistory();

            wal.AddNew();
            if (ReceiptID != null)
            {
                wal.ReceiptId = (int)ReceiptID;
            }
            wal.ItemID = ItemID;
            if (UnitID != null)
            {
                wal.UnitID = (int)UnitID;
            }
            wal.SupplierID     = SupplierID;
            wal.ManufacturerID = ManufacturerID;
            wal.UserID         = Userid;
            wal.StoreID        = StoreID;
            wal.UPQty          = UnpricedQuantity;

            if (UnpricedQuantity != 0)
            {
                wal.UPUnitCost = Math.Round(UnPricedTotalCost / UnpricedQuantity, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
            }
            else
            {
                wal.UPUnitCost = 0;
            }
            wal.UPTotalCost = UnPricedTotalCost;
            wal.PQty        = OldQuantity;
            wal.PUnitCost   = OldUnitCost;
            wal.PTotalCost  = OldTotalCost;
            wal.NQty        = NewQuantity;
            wal.NUnitCost   = NewUnitCost;
            wal.NTotalCost  = NewTotalCost;
            wal.Insurance   = AdditionalCost;
            if (!Double.IsNaN(PriceDifference))
            {
                wal.PriceDifference = PriceDifference;
            }
            wal.Margin = Margin;
            wal.Price  = NewSellingPrice;
            wal.Date   = DateTimeHelper.ServerDateTime;
            //wal.Remark = Remark;
            wal.Save();
        }
Ejemplo n.º 2
0
        public void SaveWeightedAverageLog(int Userid, int ReceiptID, double Margin, double NewSellingPrice)
        {
            MovingAverageHistory wal = new MovingAverageHistory();

            wal.AddNew();
            wal.ReceiptId      = ReceiptID;
            wal.ItemID         = CostElements.ItemID;
            wal.UnitID         = CostElements.ItemUnitID;
            wal.SupplierID     = 0;
            wal.ManufacturerID = CostElements.ManufacturerID;
            wal.UserID         = Userid;
            wal.StoreID        = CostElements.MovingAverageID;
            wal.UPQty          = Convert.ToInt32(_receivedQty);

            if (_receivedUnitCost != 0)
            {
                wal.UPUnitCost = _receivedUnitCost;
            }
            else
            {
                wal.UPUnitCost = 0;
            }
            wal.UPTotalCost = _receivedTotalCost;
            wal.PQty        = Convert.ToInt32(_previousQty);
            wal.PUnitCost   = _previousUnitCost;
            wal.PTotalCost  = _previousTotalCost;
            wal.NQty        = Convert.ToInt32(_newQty);
            wal.NUnitCost   = _newUnitCost;
            wal.NTotalCost  = _newTotalCost;

            if (!Double.IsNaN(_priceDifference))
            {
                wal.PriceDifference = _priceDifference;
            }
            wal.Margin = Margin;
            wal.Price  = NewSellingPrice;
            wal.Date   = DateTimeHelper.ServerDateTime;
            //wal.Remark = Remark;P
            wal.Save();
        }
        /// <summary>
        /// Saves the weighted average log.
        /// </summary>
        /// <param name="Userid">The userid.</param>
        public void SaveWeightedAverageLog(int Userid)
        {
            MovingAverageHistory wal = new MovingAverageHistory();
            wal.AddNew();
            if (ReceiptID != null)
                wal.ReceiptId = (int)ReceiptID;
            wal.ItemID = ItemID;
            if (UnitID != null)
                wal.UnitID = (int)UnitID;
            wal.SupplierID = SupplierID;
            wal.ManufacturerID = ManufacturerID;
            wal.UserID = Userid;
            wal.StoreID = StoreID;
            wal.UPQty = UnpricedQuantity;

            if (UnpricedQuantity != 0)
                wal.UPUnitCost = Math.Round(UnPricedTotalCost / UnpricedQuantity, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
            else
                wal.UPUnitCost = 0;
            wal.UPTotalCost = UnPricedTotalCost;
            wal.PQty = OldQuantity;
            wal.PUnitCost = OldUnitCost;
            wal.PTotalCost = OldTotalCost;
            wal.NQty = NewQuantity;
            wal.NUnitCost = NewUnitCost;
            wal.NTotalCost = NewTotalCost;
            wal.Insurance = AdditionalCost;
            if (!Double.IsNaN(PriceDifference))
                wal.PriceDifference = PriceDifference;
            wal.Margin = Margin;
            wal.Price = NewSellingPrice;
            wal.Date = DateTimeHelper.ServerDateTime;
            //wal.Remark = Remark;
            wal.Save();
        }
        public void SaveWeightedAverageLog(int Userid,int ReceiptID,double Margin,double NewSellingPrice)
        {
            MovingAverageHistory wal = new MovingAverageHistory();
            wal.AddNew();
            wal.ReceiptId = ReceiptID;
            wal.ItemID = CostElements.ItemID;
            wal.UnitID = CostElements.ItemUnitID;
            wal.SupplierID = 0;
            wal.ManufacturerID = CostElements.ManufacturerID;
            wal.UserID = Userid;
            wal.StoreID = CostElements.MovingAverageID;
            wal.UPQty = Convert.ToInt32(_receivedQty);

            if (_receivedUnitCost != 0)
                wal.UPUnitCost = _receivedUnitCost;
            else
                wal.UPUnitCost = 0;
            wal.UPTotalCost = _receivedTotalCost;
            wal.PQty = Convert.ToInt32(_previousQty);
            wal.PUnitCost = _previousUnitCost;
            wal.PTotalCost = _previousTotalCost;
            wal.NQty = Convert.ToInt32(_newQty);
            wal.NUnitCost = _newUnitCost;
            wal.NTotalCost = _newTotalCost;

            if (!Double.IsNaN(_priceDifference))
                wal.PriceDifference = _priceDifference;
            wal.Margin = Margin;
            wal.Price = NewSellingPrice;
            wal.Date = DateTimeHelper.ServerDateTime;
            //wal.Remark = Remark;P
            wal.Save();
        }