Exemplo n.º 1
0
        public void ChangeReceiptProductLotNo()
        {
            DialogResult rs = MessageBox.Show("Bạn có muốn thay đổi mã lô hàng cho toàn bộ sản phẩm không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rs != DialogResult.Yes)
            {
                return;
            }

            ReceiptEntities      entity                = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo       mainobject            = (ICReceiptsInfo)CurrentModuleEntity.MainObject;
            ICProductsController objProductsController = new ICProductsController();
            ICProductsInfo       objProductsInfo       = new ICProductsInfo();

            entity.ReceiptItemsList.ForEach(o =>
            {
                objProductsInfo = (ICProductsInfo)objProductsController.GetObjectByID(o.FK_ICProductID);
                if (objProductsInfo == null)
                {
                    return;
                }

                if (objProductsInfo.ICPriceCalculationMethodType != PriceCalculationMethod.Specific)
                {
                    return;
                }

                o.ICReceiptItemStockLotNo = mainobject.ICReceiptProductLotNo;
            });
            entity.ReceiptItemsList.GridControl.RefreshDataSource();
        }
Exemplo n.º 2
0
        public override void SetDefaultMainObject()
        {
            base.SetDefaultMainObject();
            ICReceiptsInfo mainObject = (ICReceiptsInfo)MainObject;

            mainObject.ICReceiptDate         = DateTime.Now;
            mainObject.FK_HREmployeeID       = VinaApp.CurrentUserInfo.FK_HREmployeeID;
            mainObject.ICReceiptProductLotNo = GetStockLotNo();
            UpdateMainObjectBindingSource();
        }
Exemplo n.º 3
0
        public void UpdateTotalAmount()
        {
            ICReceiptsInfo mainobject = (ICReceiptsInfo)MainObject;

            mainobject.ICReceiptSubTotalAmount = ReceiptItemsList.Sum(o => o.ICReceiptItemTotalAmount);
            mainobject.ICReceiptDiscountAmount = mainobject.ICReceiptSubTotalAmount * mainobject.ICReceiptDiscountPercent / 100;
            mainobject.ICReceiptTaxAmount      = (mainobject.ICReceiptSubTotalAmount - mainobject.ICReceiptDiscountAmount) * mainobject.ICReceiptTaxPercent / 100;
            mainobject.ICReceiptTotalAmount    = mainobject.ICReceiptSubTotalAmount - mainobject.ICReceiptDiscountAmount + mainobject.ICReceiptTaxAmount;
            UpdateMainObjectBindingSource();
        }
Exemplo n.º 4
0
        public virtual void ActionUnPosted()
        {
            GLReceiptEntities entity          = (GLReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo    objReceiptsInfo = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            objReceiptsInfo.ICReceiptPostedStatus = PostedTransactionStatus.UnPosted.ToString();
            entity.UpdateMainObject();
            GLHelper.UnPostedTransactions(this.CurrentModuleName, objReceiptsInfo.ICReceiptID, ModulePostingType.Accounting, ModulePostingType.Stock);
            InvalidateToolbar();
        }
Exemplo n.º 5
0
        public override void ActionComplete()
        {
            base.ActionComplete();
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainobject = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            mainobject.ICReceiptStatus = ReceiptStatus.Complete;
            entity.UpdateMainObject();
            ActionPosted();
        }
Exemplo n.º 6
0
        public void ChangeCurrency(int currencyID)
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainObject = (ICReceiptsInfo)entity.MainObject;

            mainObject.FK_GECurrencyID = currencyID;
            GECurrenciesInfo objCurrenciesInfo = VinaApp.CurrencyList.Where(o => o.GECurrencyID == currencyID).FirstOrDefault();

            mainObject.ICReceiptExchangeRate = objCurrenciesInfo == null ? 1 : objCurrenciesInfo.GECurrencyTransferRate;
            ChangeExchangeRate();
            entity.UpdateMainObjectBindingSource();
        }
Exemplo n.º 7
0
        public override void InvalidateToolbar()
        {
            ICReceiptsInfo receipt = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            if (receipt.ICReceiptID > 0)
            {
                //ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, true);
                ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit,
                                                      receipt.ICReceiptPostedStatus != PostedTransactionStatus.Posted.ToString());
            }

            base.InvalidateToolbar();
        }
Exemplo n.º 8
0
        public void ChangeTaxAmount()
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainObject = (ICReceiptsInfo)entity.MainObject;

            if (mainObject.ICReceiptSubTotalAmount - mainObject.ICReceiptDiscountAmount != 0)
            {
                mainObject.ICReceiptTaxPercent = 100 * mainObject.ICReceiptTaxAmount / (mainObject.ICReceiptSubTotalAmount - mainObject.ICReceiptDiscountAmount);
            }
            else
            {
                mainObject.ICReceiptTaxPercent = 0;
            }
            mainObject.ICReceiptTaxPercent = Math.Round(mainObject.ICReceiptTaxPercent, 2, MidpointRounding.AwayFromZero);
            entity.UpdateTotalAmount();
        }
Exemplo n.º 9
0
        public override void InvalidateToolbar()
        {
            ICReceiptsInfo receipt = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            if (receipt.ICReceiptID > 0)
            {
                ParentScreen.SetEnableOfToolbarButton(ToolbarButtons.PostedTransactions, false);
                ParentScreen.SetEnableOfToolbarButton(ToolbarButtons.UnPostedTransactions, false);
                if (receipt.ICReceiptStatus == ReceiptStatus.Complete.ToString())
                {
                    ParentScreen.SetEnableOfToolbarButton(ToolbarButtons.PostedTransactions,
                                                          receipt.ICReceiptPostedStatus != PostedTransactionStatus.Posted.ToString());
                    ParentScreen.SetEnableOfToolbarButton(ToolbarButtons.UnPostedTransactions,
                                                          receipt.ICReceiptPostedStatus == PostedTransactionStatus.Posted.ToString());
                }
            }

            base.InvalidateToolbar();
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public void AddItemToReceiptItemsList(int productID)
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainobject = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            ICProductsController objProductsController = new ICProductsController();
            ICProductsInfo       objProductsInfo       = (ICProductsInfo)objProductsController.GetObjectByID(productID);

            if (objProductsInfo == null)
            {
                return;
            }

            ICReceiptItemsInfo objReceiptItemsInfo = objProductsInfo.ToReceiptItem();

            entity.ReceiptItemsList.Add(objReceiptItemsInfo);
            entity.ReceiptItemsList.GridControl.RefreshDataSource();
            entity.UpdateTotalAmount();
            entity.UpdateMainObjectBindingSource();
        }
Exemplo n.º 12
0
        public void ChangeExchangeRate()
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainObject = (ICReceiptsInfo)entity.MainObject;

            entity.ReceiptItemsList.ForEach(o =>
            {
                if (mainObject.ICReceiptExchangeRate != 0)
                {
                    o.ICReceiptItemProductUnitPrice = o.ICReceiptItemProductBasicPrice / mainObject.ICReceiptExchangeRate;
                }
                else
                {
                    o.ICReceiptItemProductUnitPrice = 0;
                }

                ChangeItemFromReceiptItemsList(o);
            });
            entity.ReceiptItemsList.GridControl.RefreshDataSource();
            entity.UpdateTotalAmount();
        }
Exemplo n.º 13
0
        public void ChangeStock(int stockID)
        {
            ReceiptEntities entity     = (ReceiptEntities)CurrentModuleEntity;
            ICReceiptsInfo  mainobject = (ICReceiptsInfo)CurrentModuleEntity.MainObject;

            mainobject.FK_ICStockID = stockID;
            entity.UpdateMainObjectBindingSource();
            DialogResult rs = MessageBox.Show("Bạn có muốn thay đổi kho cho toàn bộ sản phẩm không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rs != DialogResult.Yes)
            {
                return;
            }

            entity.ReceiptItemsList.ForEach(o =>
            {
                o.FK_ICStockID            = stockID;
                o.ICReceiptItemStockLotNo = string.Empty;
            });

            entity.ReceiptItemsList.GridControl.RefreshDataSource();
        }
Exemplo n.º 14
0
 public override void InitMainObject()
 {
     MainObject   = new ICReceiptsInfo();
     SearchObject = new ICReceiptsInfo();
 }