/// <summary>
 /// Gets the list for GRV pricing.
 /// </summary>
 /// <returns></returns>
 public static DataView GetListForGRVPricing()
 {
     MovingAverageHistory wal = new MovingAverageHistory();
     var query = HCMIS.Repository.Queries.MovingAverageHistory.SelectGetListForGRVPricing(ReceiptType.CONSTANTS.BEGINNING_BALANCE);
        wal.LoadFromRawSql(query);
        return wal.DefaultView;
 }
 /// <summary>
 /// Gets the moving average by receipt ID.
 /// </summary>
 /// <param name="ReceiptID">The receipt ID.</param>
 /// <returns></returns>
 public static DataTable GetMovingAverageByReceiptID(int ReceiptID)
 {
     MovingAverageHistory wal = new MovingAverageHistory();
     var query = HCMIS.Repository.Queries.MovingAverageHistory.SelectGetMovingAverageByReceiptId(ReceiptID);
     wal.LoadFromRawSql(query);
     return wal.DataTable;
 }
Beispiel #3
0
        /// <summary>
        /// Gets the moving average by receipt ID.
        /// </summary>
        /// <param name="ReceiptID">The receipt ID.</param>
        /// <returns></returns>
        public static DataTable GetMovingAverageByReceiptID(int ReceiptID)
        {
            MovingAverageHistory wal = new MovingAverageHistory();
            var query = HCMIS.Repository.Queries.MovingAverageHistory.SelectGetMovingAverageByReceiptId(ReceiptID);

            wal.LoadFromRawSql(query);
            return(wal.DataTable);
        }
Beispiel #4
0
        /// <summary>
        /// Gets the list for GRV pricing.
        /// </summary>
        /// <returns></returns>
        public static DataView GetListForGRVPricing()
        {
            MovingAverageHistory wal = new MovingAverageHistory();
            var query = HCMIS.Repository.Queries.MovingAverageHistory.SelectGetListForGRVPricing(ReceiptType.CONSTANTS.BEGINNING_BALANCE);

            wal.LoadFromRawSql(query);
            return(wal.DefaultView);
        }
Beispiel #5
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();
        }
Beispiel #6
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();
        }
 private void WeightedAverageHistory_Load(object sender, EventArgs e)
 {
     MovingAverageHistory history = new MovingAverageHistory();
     gridBeggining.DataSource = history.GetBeginningBalance(costElement);
     gridAllSimilarItems.DataSource = history.GetHistory(costElement);
 }
        /// <summary>
        /// Load All Neccessary Data and Bind To DataSource
        /// </summary>
        void LoadAndBind()
        {
            //Bind

            //Load Detail Table To Grid
            Item item = new Item();
            gridReceiveDoc.DataSource = item.GetReceiveDocDetailForDiagnostics(ItemId, ManufacturerId, UnitId,
                                                                               MovingAverageId);

            gridJournalEntries.DataSource = item.GetJournalEntriesForDiagnostics(AffectedLedgerID);

            MovingAverageHistory history = new MovingAverageHistory();
            CostElement costElement = new CostElement(ItemId, MovingAverageId, ManufacturerId, UnitId, ManufacturerId);
            gridAllSimilarItems.DataSource = history.GetHistory(costElement);

            //Load Header Information From first row to be displayed

                txtItemName.EditValue = Item;
                txtItemUnit.EditValue = Unit;
                txtManufacturerName.EditValue = Manufacturer;
                txtActivityName.EditValue = MovingAverage;
                txtUnitCost.EditValue = UnitCost;
                txtMargin.EditValue = Margin;
                txtSellingPrice.EditValue = SellingPrice;
        }
        /// <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();
        }