private void loadEmployeeName() { var listDB = employeeBO.GetData(u => u.isDelete == false); txtEmployeeName.Properties.Items.Clear(); int i = 0; foreach (var item in listDB) { int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.MonthOfPay == Month && u.YearOfPay == Year).Count; if (count != 0) { bool isPayed = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.MonthOfPay == Month && u.YearOfPay == Year).First().isPayed; if (isPayed == true) { txtEmployeeName.Properties.Items.Add(new ImageComboBoxItem(item.Hoten, item.Hoten, 0)); } else { txtEmployeeName.Properties.Items.Add(new ImageComboBoxItem(item.Hoten, item.Hoten, -1)); } } else { txtEmployeeName.Properties.Items.Add(new ImageComboBoxItem(item.Hoten, item.Hoten, -1)); } i++; } }
private void frmPrint_Load(object sender, EventArgs e) { var listTT = _list; var _detail = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == _month && u.YearOfPay == _year).First(); double debtAgo = 0; if (_month == 1) { int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).Where(u => u.MonthOfPay == 12 && u.YearOfPay == _year - 1).Count(); if (count != 0) { debtAgo = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).Where(u => u.MonthOfPay == 12 && u.YearOfPay == _year - 1).First().NEBT; } } else { int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).Where(u => u.DATE.Value.Month == _month - 1 && u.DATE.Value.Year == _year).Count(); if (count != 0) { debtAgo = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).Where(u => u.MonthOfPay == _month - 1 && u.YearOfPay == _year).First().NEBT; } } printEmployee1.SetDataSource(_list); printEmployee1.SetParameterValue("pEmployeeName", EmployeeBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).First().Hoten); printEmployee1.SetParameterValue("pMSTT", "TT" + _detail.ID.ToString("d6")); printEmployee1.SetParameterValue("pDate", _detail.DATE); printEmployee1.SetParameterValue("pTimekeeping", _detail.MonthOfPay + "/" + _detail.YearOfPay); printEmployee1.SetParameterValue("pWage", _detail.Wage); printEmployee1.SetParameterValue("pCash", _detail.Cash); printEmployee1.SetParameterValue("pFood", _list.Sum(u => u.Food)); printEmployee1.SetParameterValue("pBonus", _list.Sum(u => u.Bunus)); printEmployee1.SetParameterValue("pPunish", _list.Sum(u => u.Punish)); printEmployee1.SetParameterValue("pPayment", _detail.PAY); printEmployee1.SetParameterValue("pDept", debtAgo); printEmployee1.SetParameterValue("pMSNV", _msnv); crystalReportViewer.ReportSource = printEmployee1; }
private void loadEmployee() { var listDB = employeeBO.GetData(u => u.isDelete == false); dataEmployee.Rows.Clear(); int i = 0; foreach (var item in listDB) { dataEmployee.Rows.Add(); dataEmployee.Rows[i].Cells[0].Value = item.MSNV; dataEmployee.Rows[i].Cells[1].Value = item.Hoten; dataEmployee.Rows[i].Cells[2].Value = item.Gioitinh; dataEmployee.Rows[i].Cells[3].Value = item.Ngaysinh; dataEmployee.Rows[i].Cells[4].Value = item.Diachi; dataEmployee.Rows[i].Cells[5].Value = item.CMND; dataEmployee.Rows[i].Cells[6].Value = item.SDT; i++; } }
public void LoadDataDS(DateTime date) { try { dataDS.Columns.Clear(); #region DataGridView dataDS.ColumnCount = 12; dataDS.Columns[0].Name = "MSNV"; dataDS.Columns[1].Name = "Họ tên"; dataDS.Columns[2].Name = "Ngày"; dataDS.Columns[3].Name = "Thời gian(h)"; dataDS.Columns[4].Name = "Số bao"; dataDS.Columns[5].Name = "Loại bao(KG)"; dataDS.Columns[6].Name = "Số lượng"; dataDS.Columns[7].Name = "Tiền ứng"; dataDS.Columns[8].Name = "Tiền cơm"; dataDS.Columns[9].Name = "Tiền phạt"; dataDS.Columns[10].Name = "Tiền thưởng"; dataDS.Columns[11].Name = "Ngày làm"; dataDS.Columns[0].Width = 80; dataDS.Columns[1].Width = 150; dataDS.Columns[2].Width = 110; dataDS.Columns[3].Width = 100; dataDS.Columns[4].Width = 100; dataDS.Columns[5].Width = 100; dataDS.Columns[6].Width = 100; dataDS.Columns[7].Width = 120; dataDS.Columns[8].Width = 100; dataDS.Columns[9].Width = 100; dataDS.Columns[10].Width = 100; dataDS.Columns[11].Width = 100; #endregion var ListEmployee = employeeBO.GetData(u => u.isDelete == false); var listData = timekeepingBO.GetData(u => u.isDelete == false && u.Date.Value.Month == int.Parse(txtMonth.Text) && u.Date.Value.Year == int.Parse(txtYear.Text)); txtCountWork.Visible = false; int i = 0; foreach (var item in ListEmployee) { var ListDB = timekeepingBO.GetData(u => u.isDelete == false && u.MSNV == item.MSNV && u.Date.Value.Month == date.Month && u.Date.Value.Year == date.Year).ToList(); if (ListDB.Count != 0) { foreach (var itemType in ListDB.Select(u => u.Type).Distinct()) { dataDS.Rows.Add(); if (i % 2 == 0) { dataDS.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[1].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[3].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[4].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[5].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[6].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[7].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[8].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[9].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[10].Style.BackColor = System.Drawing.Color.Gainsboro; dataDS.Rows[i].Cells[11].Style.BackColor = System.Drawing.Color.Gainsboro; } else { dataDS.Rows[i].Cells[0].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[1].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[3].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[4].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[5].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[6].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[7].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[8].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[9].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[10].Style.BackColor = System.Drawing.Color.WhiteSmoke; dataDS.Rows[i].Cells[11].Style.BackColor = System.Drawing.Color.WhiteSmoke; } dataDS.Rows[i].Cells[0].Value = item.MSNV; dataDS.Rows[i].Cells[1].Value = timekeepingBO.GetNameEmployee(item.MSNV); dataDS.Rows[i].Cells[2].Value = ListDB.First().Date.Value.Month + "/" + ListDB.First().Date.Value.Year; dataDS.Rows[i].Cells[3].Value = ListDB.Sum(u => u.Time); dataDS.Rows[i].Cells[4].Value = ListDB.Where(u => u.Type == itemType).Sum(u => u.Weight) == 0 ? "0" : ListDB.Where(u => u.Type == itemType).Sum(u => u.Weight).ToString("#,###"); dataDS.Rows[i].Cells[5].Value = itemType;//Type sack dataDS.Rows[i].Cells[6].Value = ListDB.Where(u => u.Type == itemType).Sum(u => u.TotalWeight) == 0 ? "0" : ListDB.Where(u => u.Type == itemType).Sum(u => u.TotalWeight).ToString("#,###"); dataDS.Rows[i].Cells[7].Value = ListDB.Sum(u => u.AdvancePayment) == 0 ? "0" : ListDB.Sum(u => u.AdvancePayment).ToString("#,###"); dataDS.Rows[i].Cells[8].Value = ListDB.Sum(u => u.Food) == 0 ? "0" : ListDB.Sum(u => u.Food).ToString("#,###"); dataDS.Rows[i].Cells[9].Value = ListDB.Sum(u => u.Punish) == 0 ? "0" : ListDB.Sum(u => u.Punish).ToString("#,###"); dataDS.Rows[i].Cells[10].Value = ListDB.Sum(u => u.Bunus) == 0 ? "0" : ListDB.Sum(u => u.Bunus).ToString("#,###"); dataDS.Rows[i].Cells[11].Value = ListDB.Count() - ListDB.Count(u => u.isRest == true); i++; } } } lbCashAdvance.Text = listData.Sum(u => u.AdvancePayment) == 0 ? "0" : string.Format("{0:0,0 (VNĐ)}", listData.Sum(u => u.AdvancePayment)); lbTotalWeight.Text = listData.Sum(u => u.TotalWeight) == 0 ? "0" : string.Format("{0:0,0 (KG)}", listData.Sum(u => u.TotalWeight)); txtTotalTime.Text = listData.Sum(u => u.Time) == 0 ? "0" : ((double)listData.Sum(u => u.Time)).ToString(); txtFood.Text = listData.Sum(u => u.Food).ToString("#,###") == string.Empty ? "0" : ((double)listData.Sum(u => u.Food)).ToString("#,###") + "VNĐ"; txtPunish.Text = listData.Sum(u => u.Punish).ToString("#,###") == string.Empty ? "0" : listData.Sum(u => u.Punish).ToString("#,###") + "VNĐ"; txtBonus.Text = listData.Sum(u => u.Bunus).ToString("#,###") == string.Empty ? "0" : listData.Sum(u => u.Bunus).ToString("#,###") + "VNĐ"; } catch { } }
private void frmPrintTimekeeping_Load(object sender, EventArgs e) { try { var listTT = _list; int month = listTT.First().Date.Month; int year = listTT.First().Date.Year; int Moneyproduct = 0; int Moneytime = 0; var listPay = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == month && u.YearOfPay == year); if (listPay.Count != 0) { Moneyproduct = listPay.First().ProductPrice; Moneytime = listPay.First().TimePrice; } else { Moneyproduct = preferceProductPriceBO.GetData(u => u.isDelete == false && u.ID == 1).First().Price.Value; Moneytime = preferceProductPriceBO.GetData(u => u.isDelete == false && u.ID == 2).First().Price.Value; } double Debt = 0; if (month != 1) { int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == month - 1 && u.YearOfPay == year).Count(); if (count != 0) { Debt = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == month - 1 && u.YearOfPay == year).First().NEBT; } } if (month == 1) { int count = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == 12 && u.YearOfPay == year - 1).Count; if (count != 0) { Debt = employeePaymentBO.GetData(u => u.isDelete == false && u.MSNV == _msnv && u.MonthOfPay == 12 && u.YearOfPay == year - 1).First().NEBT; } } Double Pay = 0; printTimekeeping1.SetDataSource(_list); int Countwork = _list.Count() - _list.Where(u => u.isRest == "Yes").Count(); printTimekeeping1.SetParameterValue("pCountWork", Countwork); printTimekeeping1.SetParameterValue("pEmployeeName", EmployeeBO.GetData(u => u.isDelete == false && u.MSNV == _msnv).First().Hoten); printTimekeeping1.SetParameterValue("pTimekeeping", listTT.First().Date.Month + "/" + listTT.First().Date.Year); printTimekeeping1.SetParameterValue("pCash", listTT.Sum(u => u.AdvancePayment)); printTimekeeping1.SetParameterValue("pFood", listTT.Sum(u => u.Food)); printTimekeeping1.SetParameterValue("pBonus", _list.Sum(u => u.Bunus)); printTimekeeping1.SetParameterValue("pPunish", _list.Sum(u => u.Punish)); printTimekeeping1.SetParameterValue("pProduct", _list.Sum(u => u.TotalWeight)); printTimekeeping1.SetParameterValue("pTime", _list.Sum(u => u.Time)); printTimekeeping1.SetParameterValue("pMSNV", _msnv); printTimekeeping1.SetParameterValue("pDebt", Debt); printTimekeeping1.SetParameterValue("pMoneyProduct", Moneyproduct); printTimekeeping1.SetParameterValue("pMoneyTime", Moneytime); Pay = _list.Sum(u => u.TotalWeight) * Moneyproduct + _list.Sum(u => u.Time) * Moneytime + _list.Sum(u => u.Bunus) - _list.Sum(u => u.Punish) - listTT.Sum(u => u.Food) - listTT.Sum(u => u.AdvancePayment) - Debt; printTimekeeping1.SetParameterValue("pWage", Pay); crystalReportViewer.ReportSource = printTimekeeping1; } catch { } }