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(); }
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(); }
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(); }
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(); }
public override void ActionComplete() { base.ActionComplete(); ReceiptEntities entity = (ReceiptEntities)CurrentModuleEntity; ICReceiptsInfo mainobject = (ICReceiptsInfo)CurrentModuleEntity.MainObject; mainobject.ICReceiptStatus = ReceiptStatus.Complete; entity.UpdateMainObject(); ActionPosted(); }
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(); }
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(); }
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(); }
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(); }
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); }
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(); }
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(); }
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(); }
public override void InitMainObject() { MainObject = new ICReceiptsInfo(); SearchObject = new ICReceiptsInfo(); }