Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public override int ActionSave()
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainobject = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            entity.ReceiptItemsList.EndCurrentEdit();
            entity.UpdateTotalAmount();
            List <string> errorMessages = new List <string>();

            if (mainobject.FK_ICStockID == 0)
            {
                errorMessages.Add("Kho không được bỏ trống!");
            }
            if (mainobject.FK_GECurrencyID == 0 || mainobject.ICReceiptExchangeRate == 0)
            {
                errorMessages.Add("Vui lòng chọn loại tiền tề và tỷ giá!");
            }
            ICProductsController objProductsController = new ICProductsController();
            ICProductsInfo       objProductsInfo       = new ICProductsInfo();

            entity.ReceiptItemsList.ForEach(o =>
            {
                objProductsInfo = (ICProductsInfo)objProductsController.GetObjectByID(o.FK_ICProductID);
                if (objProductsInfo.ICPriceCalculationMethodType == PriceCalculationMethod.Specific && string.IsNullOrWhiteSpace(o.ICReceiptItemStockLotNo))
                {
                    errorMessages.Add("Vui lòng nhập mã lô cho sản phẩm: " + o.ICReceiptItemProductNo);
                }
            });
            if (errorMessages.Count() > 0)
            {
                GuiErrorMessage guiError = new GuiErrorMessage(errorMessages);
                guiError.Module = this;
                guiError.ShowDialog();
                return(0);
            }
            int iObjectID = base.ActionSave();

            if (iObjectID > 0)
            {
                this.ActionComplete();
            }
            return(iObjectID);
        }
Пример #4
0
        public override int ActionSave()
        {
            SaleOrderEntities entity     = (SaleOrderEntities)CurrentModuleEntity;
            ARSaleOrdersInfo  mainObject = (ARSaleOrdersInfo)CurrentModuleEntity.MainObject;

            SetDefaultSaleOrderName();
            List <string> errorList = new List <string>();

            if (mainObject.FK_ARCustomerID == 0)
            {
                errorList.Add("Khách hàng không được để trống!");
            }
            if (mainObject.FK_GEPaymentTermID == 0)
            {
                errorList.Add("Điều khoản thanh toán không được bỏ trống!");
            }
            if (string.IsNullOrWhiteSpace(mainObject.ARSaleOrderPaymentMethodType))
            {
                errorList.Add("Phương thức thanh toán không được bỏ trống!");
            }
            if (mainObject.FK_GECurrencyID == 0 || mainObject.ARSaleOrderExchangeRate == 0)
            {
                errorList.Add("Vui lòng chọn loại tiền tề và tỷ giá!");
            }
            entity.SaleOrderItemsList.ForEach(o =>
            {
                if (o.ARSaleOrderItemGrantedFrom == ProductGrantedFrom.Inventory && o.FK_ICStockID == 0)
                {
                    errorList.Add("Vui lòng chọn kho cho sản phẩm có mã: " + o.ARSaleOrderItemProductNo);
                }
            });
            if (errorList.Count() > 0)
            {
                GuiErrorMessage guiError = new GuiErrorMessage(errorList);
                guiError.Module = this;
                guiError.ShowDialog();
                return(0);
            }
            return(base.ActionSave());
        }
Пример #5
0
        public override int ActionSave()
        {
            CustomerPaymentEntities entity     = (CustomerPaymentEntities)CurrentModuleEntity;
            ARCustomerPaymentsInfo  mainObject = (ARCustomerPaymentsInfo)CurrentModuleEntity.MainObject;

            SetDefaultCustomerPaymentName();
            List <string> errorList = new List <string>();

            if (mainObject.FK_ARCustomerID == 0)
            {
                errorList.Add("Khách hàng không được để trống!");
            }
            if (string.IsNullOrWhiteSpace(mainObject.ARCustomerPaymentPaymentMethodType))
            {
                errorList.Add("Phương thức thanh toán không được bỏ trống!");
            }
            if (mainObject.FK_GECurrencyID == 0 || mainObject.ARCustomerPaymentExchangeRate == 0)
            {
                errorList.Add("Vui lòng chọn loại tiền tề và tỷ giá!");
            }
            entity.CustomerPaymentTimePaymentsList.ForEach(p =>
            {
                if (p.ARCustomerPaymentTimePaymentAmount > p.ARCustomerPaymentTimePaymentRemainAmount)
                {
                    errorList.Add("Số tiền thanh toán vượt quá số tiền còn lại!");
                }
            });
            if (errorList.Count() > 0)
            {
                GuiErrorMessage guiError = new GuiErrorMessage(errorList);
                guiError.Module = this;
                guiError.ShowDialog();
                return(0);
            }

            return(base.ActionSave());
        }