using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.StatisticalInquiry { public partial class FrmSatisfactionReport : LYFZ.Software.UI.StatisticalInquiry.FrmSatisfactionReport { LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); public FrmSatisfactionReport() { this.Shown += FrmSatisfactionReport_Shown; this.btnSelect.Click += btnSelect_Click; this.dgvData.MouseDoubleClick += dgvData_MouseDoubleClick; this.btnSeeDetails.Click += btnSeeDetails_Click; this.btnClose.Click += btnClose_Click; } /// /// 窗体加载事件 /// /// /// void FrmSatisfactionReport_Shown(object sender, EventArgs e) { this.txtTimeStart.DateValue = SDateTime.Now.ToString("yyyy-MM-01"); this.txtTimeEnd.DateValue = Convert.ToDateTime(this.txtTimeStart.DateValue).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbServicePersonnel, IsFirstNodeNull: true); DataTable dt = orbll.GetView_Custom("tb_ErpSatisfactionRatingSet", StrWhere: "", ShowColumnName: "Sfrs_Name", filedOrder: "ID").Tables[0]; string StrColumnName = "人员ID,服务人员"; for (int i = 0; i < dt.Rows.Count; i++) { StrColumnName += "," + dt.Rows[i]["Sfrs_Name"].ToString().Trim(); } this.dgvData.DataColumns(StrColumnName, strHideField: "人员ID"); this.PublicFunctionRows(); bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.统计查询满意度报表); if (!b) { btnClose_Click(null, null); } } /// /// 查询 /// /// /// void btnSelect_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtTimeStart.DateValue)) { MessageBoxCustom.Show("开始时间不能为空!"); return; } if (string.IsNullOrEmpty(this.txtTimeEnd.DateValue)) { MessageBoxCustom.Show("结束时间不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtTimeStart.DateValue) && !string.IsNullOrEmpty(this.txtTimeEnd.Text)) { this.PublicFunctionRows(); } } /// /// 双击列表 /// /// /// void dgvData_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Location.Y > this.dgvData.ColumnHeadersHeight) { if (string.IsNullOrEmpty(txtTimeStart.DateValue)) { MessageBoxCustom.Show("开始时间不能为空!"); return; } if (string.IsNullOrEmpty(txtTimeEnd.DateValue)) { MessageBoxCustom.Show("结束时间不能为空!"); return; } if (dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择你要查看的资料!"); return; } LYFZ.Software.MainBusiness.StatisticalInquiry.SatisfactionReport.FrmSatisfactionSeeDetails frm = new SatisfactionReport.FrmSatisfactionSeeDetails(); frm.PersonnelNumber = dgvData.CurrentRow.Cells["人员ID"].Value.ToString(); frm.PersonnelName = dgvData.CurrentRow.Cells["服务人员"].Value.ToString(); frm.TimeStar = txtTimeStart.Text.Trim(); frm.TimeEnd = txtTimeEnd.Text.Trim(); frm.ShowDialog(); } } /// /// 详情 /// /// /// void btnSeeDetails_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTimeStart.DateValue)) { MessageBoxCustom.Show("开始时间不能为空!"); return; } if (string.IsNullOrEmpty(txtTimeEnd.DateValue)) { MessageBoxCustom.Show("结束时间不能为空!"); return; } if (dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择你要查看的资料!"); return; } LYFZ.Software.MainBusiness.StatisticalInquiry.SatisfactionReport.FrmSatisfactionSeeDetails frm = new SatisfactionReport.FrmSatisfactionSeeDetails(); frm.PersonnelNumber = dgvData.CurrentRow.Cells["人员ID"].Value.ToString(); frm.PersonnelName = dgvData.CurrentRow.Cells["服务人员"].Value.ToString(); frm.TimeStar = txtTimeStart.Text.Trim(); frm.TimeEnd = txtTimeEnd.Text.Trim(); frm.ShowDialog(); } /// /// 关闭 /// /// /// void btnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 获取人员满意度列表 /// void PublicFunctionRows() { this.dgvData.Rows.Clear(); string StrWhere = " Where User_Name is not null"; string StrWhere2 = ""; if (!string.IsNullOrEmpty(txtTimeStart.DateValue) && !string.IsNullOrEmpty(txtTimeEnd.Text)) { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Sfs_CreateTime", this.txtTimeStart.DateValue, this.txtTimeEnd.DateValue); StrWhere2 += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Sfs_CreateTime", this.txtTimeStart.DateValue, this.txtTimeEnd.DateValue); } if (!string.IsNullOrEmpty(cmbServicePersonnel.Text.Trim())) { StrWhere += " And Sfs_EmployeeID='" + cmbServicePersonnel.Tag.ToString() + "'"; StrWhere2 += " And Sfs_EmployeeID='" + cmbServicePersonnel.Tag.ToString() + "'"; } DataTable newTable = new DataTable(); DataTable newTable2 = new DataTable(); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { newTable = orbll.GetView_Custom("select distinct Sfs_EmployeeID,User_Name from tb_ErpSatisfactionSurvey Left Join tb_ErpUser on User_EmployeeID = Sfs_EmployeeID " + StrWhere).Tables[0]; newTable2 = orbll.GetView_Custom("select Sfs_RatingSetID,Sfs_EmployeeID,Count(Sfs_EmployeeID) AS CountID from tb_ErpSatisfactionSurvey Where Sfs_EmployeeID != '' " + StrWhere2 + " Group By Sfs_RatingSetID,Sfs_EmployeeID").Tables[0]; }); #region for (int t = 0; t < newTable.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["User_Name"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); DataRow[] dtRows1 = newTable2.Select("Sfs_RatingSetID = 1 and Sfs_EmployeeID = '" + newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim() + "'"); if (dtRows1.Length > 0) { cell.Value = dtRows1[0]["CountID"].ToString().Trim(); } else { cell.Value = 0; } dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); DataRow[] dtRows2 = newTable2.Select("Sfs_RatingSetID = 2 and Sfs_EmployeeID = '" + newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim() + "'"); if (dtRows2.Length > 0) { cell.Value = dtRows2[0]["CountID"].ToString().Trim(); } else { cell.Value = 0; } dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); DataRow[] dtRows3 = newTable2.Select("Sfs_RatingSetID = 3 and Sfs_EmployeeID = '" + newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim() + "'"); if (dtRows3.Length > 0) { cell.Value = dtRows3[0]["CountID"].ToString().Trim(); } else { cell.Value = 0; } dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); DataRow[] dtRows4 = newTable2.Select("Sfs_RatingSetID = 4 and Sfs_EmployeeID = '" + newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim() + "'"); if (dtRows4.Length > 0) { cell.Value = dtRows4[0]["CountID"].ToString().Trim(); } else { cell.Value = 0; } dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); DataRow[] dtRows5 = newTable2.Select("Sfs_RatingSetID = 5 and Sfs_EmployeeID = '" + newTable.Rows[t]["Sfs_EmployeeID"].ToString().Trim() + "'"); if (dtRows5.Length > 0) { cell.Value = dtRows5[0]["CountID"].ToString().Trim(); } else { cell.Value = 0; } dgvr.Cells.Add(cell); this.dgvData.Rows.Add(dgvr); } this.dgvData.ClearSelection(); #endregion } } }