private void CreateSalaryTabelList() { Options.SetWaitDialogCaption("Đang khởi tạo dữ liệu..."); if ((new HRM_TIMEKEEPER_TABLELIST()).Exist(this.m_Month, this.m_Year)) { HRM_SALARY_TABLELIST hRMSALARYTABLELIST = new HRM_SALARY_TABLELIST(); DIC_SALARY_FORMULA dICSALARYFORMULA = new DIC_SALARY_FORMULA(); dICSALARYFORMULA.Get(); if (!hRMSALARYTABLELIST.Exist(this.m_Month, this.m_Year)) { Guid guid = Guid.NewGuid(); if (hRMSALARYTABLELIST.Insert(guid.ToString(), string.Concat("Tháng ", this.m_Month.ToString(), " - ", this.m_Year.ToString()), this.m_Month, this.m_Year, dICSALARYFORMULA.SocialInsurance, dICSALARYFORMULA.HealthInsurance, dICSALARYFORMULA.UnemploymentInsurance, dICSALARYFORMULA.SocialInsurance1, dICSALARYFORMULA.HealthInsurance1, dICSALARYFORMULA.UnemploymentInsurance1, dICSALARYFORMULA.OvertimeSaturdayType, false, false) == "OK") { HRM_SALARY_ALLOWANCE.Create(guid.ToString(), true); HRM_SALARY_INCOME.Create(guid.ToString()); HRM_SALARY.Create(0, "", guid.ToString(), string.Concat("Tháng ", this.m_Month.ToString(), " - ", this.m_Year.ToString()), this.m_Month, this.m_Year); } this.RaiseCreatedHandler(); } Options.HideDialog(); } else { MessageBox.Show("Bảng chấm công tháng này chưa được khởi tạo! Vui lòng tạo bảng chấm công trước khi thực hiện tính lương!"); Options.HideDialog(); } }
private void UpdateIncomeRow() { HRM_SALARY_INCOME hRMSALARYINCOME = new HRM_SALARY_INCOME(); HRM_SALARY hRMSALARY = new HRM_SALARY(); foreach (DataRow row in hRMSALARYINCOME.GetList().Rows) { try { this.gbList.SetFocusedRowCellValue(string.Concat("Income", row["IncomeCode"].ToString()), hRMSALARY.GetTotalIncome(this.m_SalaryTableListID, this.m_EmployeeCode, row["IncomeCode"].ToString())); } catch { } } }
protected override void ReCreate() { base.ReCreate(); Options.SetWaitDialogCaption("Đang tính lại lương..."); HRM_SALARY_TABLELIST hRMSALARYTABLELIST = new HRM_SALARY_TABLELIST(); DIC_SALARY_FORMULA dICSALARYFORMULA = new DIC_SALARY_FORMULA(); dICSALARYFORMULA.Get(); hRMSALARYTABLELIST.Update(this.m_SalaryTableListID.ToString(), this.bbeName.EditValue.ToString(), this.m_Month, this.m_Year, dICSALARYFORMULA.SocialInsurance, dICSALARYFORMULA.HealthInsurance, dICSALARYFORMULA.UnemploymentInsurance, dICSALARYFORMULA.SocialInsurance1, dICSALARYFORMULA.HealthInsurance1, dICSALARYFORMULA.UnemploymentInsurance1, dICSALARYFORMULA.OvertimeSaturdayType, false, false); clsSalaryOption _clsSalaryOption = new clsSalaryOption(); HRM_SALARY_ALLOWANCE.Create(this.m_SalaryTableListID.ToString(), _clsSalaryOption.IsAllowanceReCreate); HRM_SALARY_INCOME.Create(this.m_SalaryTableListID.ToString()); HRM_SALARY.Create(this.m_Level, this.m_Code, this.m_SalaryTableListID.ToString(), this.bbeName.EditValue.ToString(), this.m_Month, this.m_Year); this.LoadGrid(); Options.HideDialog(); }
private void gbList_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (e.Column != this.colDebtMoney) { if (e.Column == this.colMoney) { this.m_Money = decimal.Parse(e.Value.ToString()); try { this.m_PayMoney = decimal.Parse(this.gbList.GetFocusedRowCellValue(this.colPayMoney).ToString()); } catch { this.m_PayMoney = new decimal(0); } } else if (e.Column == this.colPayMoney) { this.m_PayMoney = decimal.Parse(e.Value.ToString()); try { this.m_Money = decimal.Parse(this.gbList.GetFocusedRowCellValue(this.colMoney).ToString()); } catch { this.m_Money = new decimal(0); } } if (!(this.m_Money >= this.m_PayMoney)) { this.gbList.SetFocusedRowCellValue(this.colPayMoney, 0); this.gbList.SetFocusedRowCellValue(this.colDebtMoney, this.m_Money); } else { this.gbList.SetFocusedRowCellValue(this.colDebtMoney, this.m_Money - this.m_PayMoney); } if (e.Column == this.colIncomeCode) { HRM_SALARY_INCOME hRMSALARYINCOME = new HRM_SALARY_INCOME(); } } }
private void InitSalaryPlusMinus() { //BandedGridColumn column = null; // DataRow row = null; BandedGridColumn bandedGridColumn; GridSummaryItem gridGroupSummaryItem; BandedGridColumn blue; GridSummaryItem gridSummaryItem; List <BandedGridColumn> bandedGridColumns = new List <BandedGridColumn>(); foreach (BandedGridColumn column in this.bandPlusMinusBefore.Columns) { bandedGridColumns.Add(column); } foreach (BandedGridColumn bandedGridColumn1 in bandedGridColumns) { this.gbList.Columns.Remove(bandedGridColumn1); } List <BandedGridColumn> bandedGridColumns1 = new List <BandedGridColumn>(); foreach (BandedGridColumn column1 in this.bandPlusMinusAfter.Columns) { bandedGridColumns1.Add(column1); } foreach (BandedGridColumn bandedGridColumn2 in bandedGridColumns1) { this.gbList.Columns.Remove(bandedGridColumn2); } if (!(this.m_SalaryTableListID == Guid.Empty)) { HRM_SALARY_DEDUCTION hRMSALARYDEDUCTION = new HRM_SALARY_DEDUCTION(); DataTable list = hRMSALARYDEDUCTION.GetList(this.m_SalaryTableListID, true); foreach (DataRow row in list.Rows) { bandedGridColumn = new BandedGridColumn() { FieldName = string.Concat("Deduction", row["DeductionCode"].ToString()), Caption = string.Concat(row["DeductionName"].ToString().Remove(1).ToUpper(), row["DeductionName"].ToString().Remove(0, 1).ToLower()), ColumnEdit = this.repCalculator, Name = string.Concat("colDeductionCode", row["DeductionCode"].ToString()) }; bandedGridColumn.AppearanceHeader.Options.UseForeColor = true; bandedGridColumn.AppearanceHeader.ForeColor = Color.Blue; bandedGridColumn.AppearanceCell.Options.UseBackColor = true; bandedGridColumn.AppearanceCell.BackColor = Color.Azure; bandedGridColumn.OptionsColumn.ReadOnly = true; bandedGridColumn.SummaryItem.DisplayFormat = "{0:##,##0}"; bandedGridColumn.SummaryItem.SummaryType = SummaryItemType.Sum; bandedGridColumn.Visible = true; bandedGridColumn.Width = 76; this.bandPlusMinusBefore.Columns.Add(bandedGridColumn); gridGroupSummaryItem = new GridGroupSummaryItem(SummaryItemType.Sum, bandedGridColumn.FieldName, bandedGridColumn, "{0:##,##0}"); this.gbList.GroupSummary.Add(gridGroupSummaryItem); bandedGridColumn.Width = 76; } HRM_SALARY_INCOME hRMSALARYINCOME = new HRM_SALARY_INCOME(); DataTable dataTable = hRMSALARYINCOME.GetList(this.m_SalaryTableListID, true); if (dataTable.Rows.Count + list.Rows.Count <= 0) { this.bandPlusMinusBefore.Visible = false; } foreach (DataRow dataRow in dataTable.Rows) { blue = new BandedGridColumn() { FieldName = string.Concat("Income", dataRow["IncomeCode"].ToString()), Caption = string.Concat(dataRow["IncomeName"].ToString().Remove(1).ToUpper(), dataRow["IncomeName"].ToString().Remove(0, 1).ToLower()), ColumnEdit = this.repCalculator, Name = string.Concat("colIncomeCode", dataRow["IncomeCode"].ToString()) }; blue.AppearanceHeader.Options.UseForeColor = true; blue.AppearanceHeader.ForeColor = Color.Blue; blue.AppearanceCell.Options.UseBackColor = true; blue.AppearanceCell.BackColor = Color.Azure; blue.OptionsColumn.ReadOnly = true; blue.SummaryItem.DisplayFormat = "{0:##,##0}"; blue.SummaryItem.SummaryType = SummaryItemType.Sum; blue.Visible = true; blue.Width = 76; this.bandPlusMinusBefore.Columns.Add(blue); gridSummaryItem = new GridGroupSummaryItem(SummaryItemType.Sum, blue.FieldName, blue, "{0:##,##0}"); this.gbList.GroupSummary.Add(gridSummaryItem); blue.Width = 76; } list = hRMSALARYDEDUCTION.GetList(this.m_SalaryTableListID, false); foreach (DataRow row1 in list.Rows) { bandedGridColumn = new BandedGridColumn() { FieldName = string.Concat("Deduction", row1["DeductionCode"].ToString()), Caption = string.Concat(row1["DeductionName"].ToString().Remove(1).ToUpper(), row1["DeductionName"].ToString().Remove(0, 1).ToLower()), ColumnEdit = this.repCalculator, Name = string.Concat("colDeductionCode", row1["DeductionCode"].ToString()) }; bandedGridColumn.AppearanceHeader.Options.UseForeColor = true; bandedGridColumn.AppearanceHeader.ForeColor = Color.Blue; bandedGridColumn.AppearanceCell.Options.UseBackColor = true; bandedGridColumn.AppearanceCell.BackColor = Color.Azure; bandedGridColumn.OptionsColumn.ReadOnly = true; bandedGridColumn.SummaryItem.DisplayFormat = "{0:##,##0}"; bandedGridColumn.SummaryItem.SummaryType = SummaryItemType.Sum; bandedGridColumn.Visible = true; bandedGridColumn.Width = 76; this.bandPlusMinusAfter.Columns.Add(bandedGridColumn); gridGroupSummaryItem = new GridGroupSummaryItem(SummaryItemType.Sum, bandedGridColumn.FieldName, bandedGridColumn, "{0:##,##0}"); this.gbList.GroupSummary.Add(gridGroupSummaryItem); bandedGridColumn.Width = 76; } dataTable = hRMSALARYINCOME.GetList(this.m_SalaryTableListID, false); if (dataTable.Rows.Count + list.Rows.Count <= 0) { this.bandPlusMinusAfter.Visible = false; } foreach (DataRow dataRow1 in dataTable.Rows) { blue = new BandedGridColumn() { FieldName = string.Concat("Income", dataRow1["IncomeCode"].ToString()), Caption = string.Concat(dataRow1["IncomeName"].ToString().Remove(1).ToUpper(), dataRow1["IncomeName"].ToString().Remove(0, 1).ToLower()), ColumnEdit = this.repCalculator, Name = string.Concat("colIncomeCode", dataRow1["IncomeCode"].ToString()) }; blue.AppearanceHeader.Options.UseForeColor = true; blue.AppearanceHeader.ForeColor = Color.Blue; blue.AppearanceCell.Options.UseBackColor = true; blue.AppearanceCell.BackColor = Color.Azure; blue.OptionsColumn.ReadOnly = true; blue.SummaryItem.DisplayFormat = "{0:##,##0}"; blue.SummaryItem.SummaryType = SummaryItemType.Sum; blue.Visible = true; blue.Width = 76; this.bandPlusMinusAfter.Columns.Add(blue); gridSummaryItem = new GridGroupSummaryItem(SummaryItemType.Sum, blue.FieldName, blue, "{0:##,##0}"); this.gbList.GroupSummary.Add(gridSummaryItem); blue.Width = 76; } this.colEmployeeCode.Width = 65; this.colFirstName.Width = 121; this.colLastName.Width = 56; this.colCoefficientSalary.Width = 54; this.colBasicSalary.Width = 76; this.colInsuranceSalary.Width = 76; this.colAllowanceInsurance.Width = 76; this.colAllowance.Width = 64; this.colTotalSalary.Width = 76; this.colTaxYourSelfMoney.Width = 75; this.colNumberDepend.Width = 66; this.colDependMoney.Width = 77; this.colTaxOvertime150Money.Width = 75; this.colTaxOvertime200Money.Width = 75; this.colTaxOvertime300Money.Width = 75; this.colTaxOvertime195Money.Width = 75; this.colTaxOvertime260Money.Width = 75; this.colTaxOvertime390Money.Width = 75; } }