public void UpdateTotalAmountProposalItemList(int currencyID) { ProposalItemList.ForEach(o => { o.ARProposalItemDiscountAmount = o.ARProposalItemPrice * o.ARProposalItemQty * o.ARProposalItemDiscountPercent / 100; VinaApp.RoundByCurrency(o, "ARProposalItemDiscountAmount", currencyID); o.ARProposalItemTaxAmount = (o.ARProposalItemPrice * o.ARProposalItemQty - o.ARProposalItemDiscountAmount) * o.ARProposalItemTaxPercent / 100; VinaApp.RoundByCurrency(o, "ARProposalItemTaxAmount", currencyID); o.ARProposalItemTotalAmount = o.ARProposalItemPrice * o.ARProposalItemQty - o.ARProposalItemDiscountAmount + o.ARProposalItemTaxAmount; VinaApp.RoundByCurrency(o, "ARProposalItemTotalAmount", currencyID); }); ProposalItemList.GridControl.RefreshDataSource(); }
public void UpdateTotalAmount() { ARCustomerPaymentsInfo mainObject = (ARCustomerPaymentsInfo)MainObject; foreach (ARCustomerPaymentTimePaymentsInfo item in CustomerPaymentTimePaymentsList) { item.ARCustomerPaymentTimePaymentPercent = item.ARCustomerPaymentTimePaymentAmount / item.ARCustomerPaymentTimePaymentTotalAmount * 100; } mainObject.ARCustomerPaymentTotalAmount = CustomerPaymentTimePaymentsList.Sum(p => p.ARCustomerPaymentTimePaymentAmount); VinaApp.RoundByCurrency(mainObject, "ARCustomerPaymentTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARCustomerPaymentExchangeAmount = mainObject.ARCustomerPaymentExchangeRate * mainObject.ARCustomerPaymentTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARCustomerPaymentExchangeAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public void UpdateTotalAmount() { ARSaleOrdersInfo mainObject = (ARSaleOrdersInfo)MainObject; mainObject.ARSaleOrderSubTotalAmount = SaleOrderItemsList.Sum(o => o.ARSaleOrderItemTotalAmount); VinaApp.RoundByCurrency(mainObject, "ARSaleOrderSubTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderDiscountAmount = mainObject.ARSaleOrderDiscountPercent / 100 * mainObject.ARSaleOrderSubTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARSaleOrderDiscountAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderTaxAmount = mainObject.ARSaleOrderTaxPercent / 100 * (mainObject.ARSaleOrderSubTotalAmount - mainObject.ARSaleOrderDiscountAmount); VinaApp.RoundByCurrency(mainObject, "ARSaleOrderTaxAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderTotalAmount = mainObject.ARSaleOrderSubTotalAmount - mainObject.ARSaleOrderDiscountAmount + mainObject.ARSaleOrderTaxAmount; VinaApp.RoundByCurrency(mainObject, "ARSaleOrderTotalAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public void UpdateTotalAmount() { ARProposalsInfo mainObject = (ARProposalsInfo)MainObject; mainObject.ARProposalSubTotalAmount = ProposalItemList.Sum(o => o.ARProposalItemTotalAmount); VinaApp.RoundByCurrency(mainObject, "ARProposalSubTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalDiscountAmount = mainObject.ARProposalDiscountPerCent / 100 * mainObject.ARProposalSubTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARProposalDiscountAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalTaxAmount = mainObject.ARProposalTaxPercent / 100 * (mainObject.ARProposalSubTotalAmount - mainObject.ARProposalDiscountAmount); VinaApp.RoundByCurrency(mainObject, "ARProposalTaxAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalTotalAmount = mainObject.ARProposalSubTotalAmount - mainObject.ARProposalDiscountAmount + mainObject.ARProposalTaxAmount; VinaApp.RoundByCurrency(mainObject, "ARProposalTotalAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public List <string> GetColumnFieldNameByTypeEndOfWeek() { ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity; HRArrangementShiftsInfo objArrangementShiftsInfo = (HRArrangementShiftsInfo)entity.MainObject; List <string> list = new List <string>(); int numDays = NumOfDayInMonth(); for (int i = 1; i <= numDays; i++) { DateTime dt = objArrangementShiftsInfo.HRArrangementShiftFromDate.Date.AddDays(i - 1); bool isDayOfWeek = (VinaApp.IsEndOfWeek(objArrangementShiftsInfo.HRArrangementShiftFromDate.Date.AddDays(i - 1).DayOfWeek)); if (isDayOfWeek) { string columnName = String.Format("{0}{1}", "HREmployeeArrangementShiftDate", i.ToString()); list.Add(columnName); } } return(list); }
public void UpdatePriceBelongCurrency(int currencyID) { ARProposalsInfo mainObject = (ARProposalsInfo)MainObject; ProposalItemList.ForEach(o => { if (mainObject.ARProposalExchangeRate != mainObject.ARProposalExchangeRateOld) { o.ARProposalItemProductUnitPrice = o.ARProposalItemProductUnitPrice * mainObject.ARProposalExchangeRate; o.ARProposalItemPrice = o.ARProposalItemPrice * mainObject.ARProposalExchangeRate; } VinaApp.RoundByCurrency(o, "ARProposalItemProductUnitPrice", currencyID); VinaApp.RoundByCurrency(o, "ARProposalItemPrice", currencyID); }); mainObject.ARProposalExchangeRateOld = mainObject.ARProposalExchangeRate; UpdateTotalAmountProposalItemList(currencyID); UpdateTotalAmount(); }
private void fld_btnLogin_Click(object sender, EventArgs e) { string strLoginMessage = string.Empty; if (string.IsNullOrWhiteSpace(fld_txtUserName.Text) || string.IsNullOrWhiteSpace(fld_txtPassword.Text)) { MessageBox.Show("Tài khoản hoặc mật khẩu không được bỏ trống !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!VinaApp.IsAuthenticated(fld_txtUserName.Text, fld_txtPassword.Text, out strLoginMessage)) { MessageBox.Show(strLoginMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } this.Hide(); VinaApp.InitApplication(); this.Show(); this.fld_txtPassword.Text = string.Empty; this.fld_txtUserName.Text = string.Empty; this.fld_txtUserName.Focus(); }
public bool SaveConfigValues(String strGroup) { CompanyConstantEntities entity = (CompanyConstantEntities)CurrentModuleEntity; VinaList <ADConfigValuesInfo> configValues = null; if (strGroup == ConfigValueGroup.RewardType.ToString()) { configValues = entity.RewardTypesList; } else if (strGroup == ConfigValueGroup.DisciplineType.ToString()) { configValues = entity.DisciplineTypesList; } if (configValues != null) { foreach (ADConfigValuesInfo objConfigValuesInfo in configValues) { if (objConfigValuesInfo.ADConfigValueID == 0) { objConfigValuesInfo.ADConfigKeyGroup = strGroup; objConfigValuesInfo.ADConfigKeyValue = VinaApp.ConvertUnicodeStringToUnSign(objConfigValuesInfo.ADConfigText) .Replace(" ", string.Empty); objConfigValuesInfo.ADConfigKey = string.Format("{0}{1}", strGroup, objConfigValuesInfo.ADConfigKeyValue); } } configValues.SaveItemObjects(); } if (VinaUtil.ADConfigValueUtility.ContainsKey(strGroup)) { VinaUtil.ADConfigValueUtility.Remove(strGroup); } VinaUtil.ADConfigValueUtility.Add(strGroup, configValues); XtraMessageBox.Show("Luu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); }
public void GeneratePaymentTime(int paymentTermID) { if (Toolbar.IsNullOrNoneAction()) { return; } SaleOrderEntities entity = (SaleOrderEntities)CurrentModuleEntity; ARSaleOrdersInfo mainObject = (ARSaleOrdersInfo)entity.MainObject; GEPaymentTermsController objPaymentTermsController = new GEPaymentTermsController(); GEPaymentTermsInfo objPaymentTermsInfo = objPaymentTermsController.GetObjectByID(paymentTermID) as GEPaymentTermsInfo; if (objPaymentTermsInfo == null) { return; } GEPaymentTermItemsController objPaymentTermItemsController = new GEPaymentTermItemsController(); List <GEPaymentTermItemsInfo> paymentTermItems = objPaymentTermItemsController.GetListItemByPaymentTermID(paymentTermID); if (paymentTermItems.Count() <= 0) { return; } mainObject.FK_GEPaymentTermID = paymentTermID; if (entity.SaleOrderPaymentTimeList.Count() > 0) { entity.SaleOrderPaymentTimeList.Clear(); } if (mainObject.ARSaleOrderTotalAmount == 0) { return; } ARSaleOrderPaymentTimesInfo objPayment; paymentTermItems.ForEach(o => { objPayment = new ARSaleOrderPaymentTimesInfo(); objPayment.ARSaleOrderPaymentTimePaymentType = o.GEPaymentTermItemPaymentType; objPayment.ARSaleOrderPaymentTimeStatus = "New"; objPayment.ARSaleOrderPaymentTimeAmount = mainObject.ARSaleOrderTotalAmount * o.GEPaymentTermItemPaymentPercent / 100; objPayment.ARSaleOrderPaymentTimeDueAmount = mainObject.ARSaleOrderTotalAmount * o.GEPaymentTermItemPaymentPercent / 100; objPayment.FK_GEPaymentTermID = paymentTermID; objPayment.ARSaleOrderPaymentTimePaymentMethod = mainObject.ARSaleOrderPaymentMethodType; objPayment.FK_ARSaleOrderID = mainObject.ARSaleOrderID; objPayment.ARSaleOrderPaymentTimePaymentTermItemPaymentTime = o.GEPaymentTermItemPaymentTime; objPayment.ARSaleOrderPaymentTimePaymentTermItemDay = o.GEPaymentTermItemDay; objPayment.ARSaleOrderPaymentTimePaymentTermItemPercentPayment = o.GEPaymentTermItemPaymentPercent; objPayment.ARSaleOrderPaymentTimePaymentTermItemPaymentType = o.GEPaymentTermItemPaymentType; objPayment.ARSaleOrderPaymentTimePaymentTermItemType = o.GEPaymentTermItemPaymentType; objPayment.FK_GEPaymentTermItemID = o.GEPaymentTermItemID; if (o.GEPaymentTermItemPaymentTime == "IsContract") { if (mainObject.ARSaleOrderDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDate; objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDate; } } if (o.GEPaymentTermItemPaymentTime == "IsBeforeDelivery") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(-o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(-o.GEPaymentTermItemDay); } } if (o.GEPaymentTermItemPaymentTime == "IsAfterDelivery") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); } } if (o.GEPaymentTermItemPaymentTime == "IsSaleOrder") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); } } VinaApp.RoundByCurrency(objPayment, mainObject.FK_GECurrencyID); entity.SaleOrderPaymentTimeList.Add(objPayment); entity.SaleOrderPaymentTimeList.GridControl.RefreshDataSource(); }); }
protected override void AddColumnsToGridView(string strTableName, DevExpress.XtraGrid.Views.Grid.GridView gridView) { base.AddColumnsToGridView(strTableName, gridView); GridColumn column = new GridColumn(); column.Caption = "Mã nhân viên"; column.FieldName = "HREmployeeNo"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Mã ID"; column.FieldName = "HREmployeeCardNumber"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Chi nhánh"; column.FieldName = "BRBranchName"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Bộ phận"; column.FieldName = "HRDepartmentRoomName"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Phòng ban"; column.FieldName = "HRDepartmentName"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Tên nhân viên"; column.FieldName = "HREmployeeName"; gridView.Columns.Add(column); column = new GridColumn(); column.Caption = "Tổ"; column.FieldName = "HRDepartmentRoomGroupItemName"; gridView.Columns.Add(column); int numDays = ((TimeSheetModule)Screen.Module).NumOfDayInMonth(); TimeSheetEntities entity = (TimeSheetEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity; HRTimeSheetsInfo objTimeSheetsInfo = (HRTimeSheetsInfo)entity.MainObject; for (int i = 1; i <= numDays; i++) { GridColumn columnDays = new GridColumn(); DateTime dt = objTimeSheetsInfo.HRTimeSheetFromDate.Date.AddDays(i - 1); columnDays.Caption = dt.ToString("dd/MM"); bool isDayOfWeek = (VinaApp.IsEndOfWeek(dt.DayOfWeek)); if (isDayOfWeek) { columnDays.Caption = "CN (" + dt.ToString("dd/MM") + ")"; } columnDays.FieldName = String.Format("{0}{1}", "HREmployeeTimeSheetDate", i.ToString()); gridView.Columns.Add(columnDays); } HRTimeSheetParamsController objTimeSheetParamsController = new HRTimeSheetParamsController(); List <HRTimeSheetParamsInfo> OTFactorlist = objTimeSheetParamsController.GetDistinctOTTimeSheetParamsList(); foreach (var item in OTFactorlist) { column = new GridColumn(); column.Caption = "TC HS " + item.HRTimeSheetParamValue2.ToString(); column.FieldName = item.HRTimeSheetParamValue2.ToString(); column.Tag = item.HRTimeSheetParamValue2; gridView.Columns.Add(column); } if (WorkingShiftList != null) { WorkingShiftList.ForEach(o => { column = new GridColumn(); column.Caption = "Công " + o.ADWorkingShiftName; column.FieldName = "CONG" + o.ADWorkingShiftID.ToString(); column.Tag = "CONG" + o.ADWorkingShiftID.ToString(); gridView.Columns.Add(column); }); } }