public void ChangeCustomer(int customerID) { if (Toolbar.IsNullOrNoneAction() || customerID <= 0) { return; } ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject; ARCustomersController objCustomersController = new ARCustomersController(); ARCustomersInfo objCustomersInfo = objCustomersController.GetObjectByID(customerID) as ARCustomersInfo; if (objCustomersInfo == null) { return; } if (objCustomersInfo.ARCustomerActiveCheck == false) { MessageBox.Show("Khách hàng này đã bỏ hoạt động!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } mainObject.FK_ARCustomerID = customerID; mainObject.ARProposalCustomerName = objCustomersInfo.ARCustomerName; mainObject.FK_GECurrencyID = objCustomersInfo.FK_GECurrencyID; mainObject.ARProposalPaymentMethod = string.IsNullOrEmpty(objCustomersInfo.ARCustomerPaymentMethod) ? string.Empty : objCustomersInfo.ARCustomerPaymentMethod; entity.UpdateMainObjectBindingSource(); SetDefaultProposalName(); }
public void ChangeItemFromProposalItemsList() { if (Toolbar.IsNullOrNoneAction()) { return; } ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject; if (entity.ProposalItemList.CurrentIndex < 0) { return; } ARProposalItemsInfo objProposalItemsInfo = entity.ProposalItemList[entity.ProposalItemList.CurrentIndex]; if (objProposalItemsInfo == null) { return; } entity.UpdateTotalAmountProposalItemList(mainObject.FK_GECurrencyID); UpdateTotalAmount(); entity.ProposalItemList.GridControl.RefreshDataSource(); entity.UpdateMainObjectBindingSource(); }
public void AddItemFromProposalItemsList(int productID) { if (Toolbar.IsNullOrNoneAction() || productID <= 0) { return; } ICProductsController objProductsController = new ICProductsController(); ICProductsInfo objProductsInfo = objProductsController.GetObjectByID(productID) as ICProductsInfo; if (objProductsInfo == null) { return; } ProposalEntities entity = CurrentModuleEntity as ProposalEntities; entity.ProposalItemList.Add( new ARProposalItemsInfo() { FK_ICProductID = objProductsInfo.ICProductID, FK_ICMeasureUnitID = objProductsInfo.FK_ICProductBasicUnitID, ARProposalItemProductNo = objProductsInfo.ICProductNo, ARProposalItemProductName = objProductsInfo.ICProductName, ARProposalItemDesc = objProductsInfo.ICProductDesc, ARProposalItemProductType = objProductsInfo.ICProductTemplateType, ARProposalItemProductUnitPrice = objProductsInfo.ICProductPrice, ARProposalItemPrice = objProductsInfo.ICProductPrice, ARProposalItemQty = 1, ARProposalItemTotalAmount = objProductsInfo.ICProductPrice }); UpdateTotalAmount(); entity.ProposalItemList.GridControl.RefreshDataSource(); }
public ProposalModule() { this.CurrentModuleName = "Proposal"; CurrentModuleEntity = new ProposalEntities(); CurrentModuleEntity.Module = this; InitializeModule(); }
protected override void GridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { base.GridView_CellValueChanged(sender, e); ProposalEntities entity = (ProposalEntities)(this.Screen.Module as BaseModuleERP).CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)entity.MainObject; if (entity.ProposalItemList.CurrentIndex >= 0) { ARProposalItemsInfo item = entity.ProposalItemList[entity.ProposalItemList.CurrentIndex]; if (item != null) { if (e.Column.FieldName == "ARProposalItemDiscountAmount") { item.ARProposalItemDiscountPercent = item.ARProposalItemDiscountAmount / (item.ARProposalItemPrice * item.ARProposalItemQty) * 100; entity.UpdateTotalAmountProposalItemList(mainObject.FK_GECurrencyID); } else if (e.Column.FieldName == "ARProposalItemTaxAmount") { item.ARProposalItemTaxPercent = item.ARProposalItemTaxAmount / (item.ARProposalItemPrice * item.ARProposalItemQty - item.ARProposalItemDiscountAmount) * 100; entity.UpdateTotalAmountProposalItemList(mainObject.FK_GECurrencyID); } else { ((ProposalModule)Screen.Module).ChangeItemFromProposalItemsList(); } } } }
public void UpdateTotalAmount() { if (!Toolbar.IsNullOrNoneAction()) { ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; entity.UpdateTotalAmount(); } }
public override void InitGridControlDataSource() { ProposalEntities entity = (ProposalEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity; BindingSource bds = new BindingSource(); bds.DataSource = entity.ProposalItemList; this.DataSource = bds; }
public void ChangeCurrency(int currencyID) { ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)entity.MainObject; mainObject.FK_GECurrencyID = currencyID; entity.UpdatePriceBelongCurrency(currencyID); entity.UpdateMainObjectBindingSource(); }
public override void ActionNew() { base.ActionNew(); ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject; mainObject.ARProposalStatus = ProposalStatus.New; entity.UpdateMainObject(); }
protected override void GridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { base.GridView_CellValueChanged(sender, e); ProposalEntities entity = (ProposalEntities)(this.Screen.Module as BaseModuleERP).CurrentModuleEntity; if (entity.ProposalItemList.CurrentIndex >= 0) { ((ProposalModule)Screen.Module).ChangeItemFromProposalItemsList(); } }
public override void ActionApproved() { ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)entity.MainObject; ARProposalsController objProposalsController = new ARProposalsController(); mainObject.ARProposalStatus = "Approved"; entity.UpdateMainObject(); InvalidateToolbar(); }
public void DeleteItemFromProposalItemList() { if (Toolbar.IsNullOrNoneAction()) { return; } ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; entity.ProposalItemList.RemoveSelectedRowObjectFromList(); UpdateTotalAmount(); }
public void ChangeTaxAmount() { if (Toolbar.IsNullOrNoneAction()) { return; } ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)entity.MainObject; if (mainObject.ARProposalSubTotalAmount > 0) { mainObject.ARProposalDiscountPerCent = mainObject.ARProposalTaxAmount / mainObject.ARProposalSubTotalAmount * 100; } UpdateTotalAmount(); }
public override void InvalidateToolbar() { base.InvalidateToolbar(); ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)entity.MainObject; ParentScreen.SetEnableOfToolbarButton("Approve", false); if (mainObject.ARProposalID > 0) { ParentScreen.SetEnableOfToolbarButton("Approve", true); if (mainObject.ARProposalStatus == "Approve") { ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, false); ParentScreen.SetEnableOfToolbarButton("Approve", false); } } }
public override int ActionSave() { ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject; if (mainObject.FK_ARCustomerID == 0) { MessageBox.Show("Khách hàng không được để trống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return(0); } if (string.IsNullOrEmpty(mainObject.ARProposalName)) { MessageBox.Show("Tên báo giá không được để trống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return(0); } return(base.ActionSave()); }
public void SetDefaultProposalName() { ProposalEntities entity = (ProposalEntities)CurrentModuleEntity; ARProposalsInfo mainObject = (ARProposalsInfo)CurrentModuleEntity.MainObject; if (!String.IsNullOrWhiteSpace(mainObject.ARProposalName)) { return; } if (mainObject.FK_ARCustomerID == 0) { return; } mainObject.ARProposalName = string.Format("Bán hàng cho {0}", mainObject.ARProposalCustomerName); entity.UpdateMainObjectBindingSource(); }