Ejemplo n.º 1
0
        public bool IsValidInventoryStockQty(List <ARSaleOrderItemsInfo> saleOrderItemList)
        {
            bool                        isValid    = true;
            ARSaleOrdersInfo            mainObject = (ARSaleOrdersInfo)CurrentModuleEntity.MainObject;
            List <ARSaleOrderItemsInfo> mergeList  = MergeSaleOrderItemSameProduct(saleOrderItemList);
            ICTransactionsController    objTransactionsController = new ICTransactionsController();
            decimal                     inventoryStockQty         = 0;
            List <string>               errorMessagesList         = new List <string>();

            mergeList.ForEach(o =>
            {
                inventoryStockQty = objTransactionsController.GetAvailabilityQtyForSale(o.FK_ICProductID, o.FK_ICStockID, o.ARSaleOrderItemStockLotNo, mainObject.ARSaleOrderDate);
                if (inventoryStockQty >= o.ARSaleOrderItemProductQty)
                {
                    return;
                }

                errorMessagesList.Add(string.Format("Sản phẩm {0} không đủ tồn kho. Vui lòng kiểm tra lại!", o.ARSaleOrderItemProductNo));
            });
            if (errorMessagesList.Count() > 0)
            {
                GuiErrorMessage guiErrorMessage = new GuiErrorMessage(errorMessagesList);
                guiErrorMessage.Module = this;
                guiErrorMessage.ShowDialog();
                return(false);
            }
            return(isValid);
        }
Ejemplo n.º 2
0
        public bool IsValidInventoryStock()
        {
            SaleOrderShipmentEntities  entity     = (SaleOrderShipmentEntities)CurrentModuleEntity;
            ICShipmentsInfo            mainobject = (ICShipmentsInfo)CurrentModuleEntity.MainObject;
            List <ICShipmentItemsInfo> mergeList  = MergeSaleOrderItemSameProduct(entity.ShipmentItemsList.Select(o => (ICShipmentItemsInfo)o.Clone()).ToList());
            ICTransactionsController   objTransactionsController = new ICTransactionsController();
            decimal       inventoryStockQty = 0;
            List <string> errorMessagesList = new List <string>();

            mergeList.ForEach(o =>
            {
                inventoryStockQty = objTransactionsController.GetAvailabilityQtyForShipment(o.FK_ICProductID, o.FK_ICStockID, o.ICShipmentItemStockLotNo, mainobject.ICShipmentDate);
                if (inventoryStockQty >= o.ICShipmentItemProductQty)
                {
                    return;
                }

                errorMessagesList.Add(string.Format("Sản phẩm {0} không đủ tồn kho. Vui lòng kiểm tra lại!", o.ICShipmentItemProductNo));
            });

            if (errorMessagesList.Count() > 0)
            {
                GuiErrorMessage guiErrorMessage = new GuiErrorMessage(errorMessagesList);
                guiErrorMessage.Module = this;
                guiErrorMessage.ShowDialog();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public void InventoryStatistics()
        {
            int?     stockID        = StockLookup.EditValue == null ? (int?)null : Convert.ToInt32(StockLookup.EditValue);
            int?     productID      = ProductLookup.EditValue == null ? (int?)null : Convert.ToInt32(ProductLookup.EditValue);
            bool     isGroupByStock = IsGroupByStock.Checked;
            DateTime fromDate       = Convert.ToDateTime(FromDateDateEdit.EditValue);
            DateTime toDate         = Convert.ToDateTime(ToDateDateEdit.EditValue);

            ICTransactionsController  controller          = new ICTransactionsController();
            List <ICTransactionsInfo> inventoryStatistics = controller.GetInventoryStatistics(fromDate, toDate, productID, stockID, isGroupByStock);

            InventoryStatisticsEntities entity = (InventoryStatisticsEntities)CurrentModuleEntity;

            entity.ICTransactionStatisticsList.Invalidate(inventoryStatistics);
        }
Ejemplo n.º 4
0
        private void GuiShowInventoryStock_Load(object sender, EventArgs e)
        {
            fld_dgcInventoryStocks.Screen = this;
            fld_dgcInventoryStocks.InitializeControl();
            (fld_dgcInventoryStocks.MainView as GridView).ExpandAllGroups();
            ICTransactionsController  objTransactionsController = new ICTransactionsController();
            List <ICTransactionsInfo> inventoryStockList        = objTransactionsController.GetInventoryStockByProductID(ICProductID, ICProductDesc, DateTime.Now);
            decimal onHandQty        = inventoryStockList.Where(o => o.ICStockType == StockType.Sale).Sum(o => o.ICTransactionExchangeQty);
            decimal saleOrderQty     = inventoryStockList.Where(o => o.ICStockType == StockType.SaleOrder).Sum(o => o.ICTransactionExchangeQty);
            decimal purchaseOrderQty = inventoryStockList.Where(o => o.ICStockType == StockType.Purchasre).Sum(o => o.ICTransactionExchangeQty);
            decimal availableQty     = (purchaseOrderQty + onHandQty) - saleOrderQty;

            fld_lblOnHandQty.Text    = onHandQty.ToString("n3");
            fld_lblSOQty.Text        = saleOrderQty.ToString("n3");
            fld_lblPOQty.Text        = purchaseOrderQty.ToString("n3");
            fld_lblAvailableQty.Text = availableQty.ToString("n3");

            fld_dgcInventoryStocks.DataSource = inventoryStockList.Where(o => o.ICStockType == StockType.Sale).ToList();
            fld_dgcInventoryStocks.RefreshDataSource();
        }