#include "stdafx.h" #include "ylgl.h" #include "SatisfactionDetails.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif SatisfactionDetails::SatisfactionDetails(CWnd* pParent) : CDialog(SatisfactionDetails::IDD, pParent) { m_pAllLogArr = NULL; m_strKind = _T(""); m_strObj = _T(""); m_pcfgArr = NULL; m_nScoreModel = 1; m_strOrder = _T(""); //订单号 m_strClient1 = _T(""); //客户1 m_strClient2 = _T(""); //客户2 } void SatisfactionDetails::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_SURVEYDETAILS_LIST, m_Detailslist); DDX_Control(pDX, IDC_SURVEYDETAILS_LIST2, m_Detailedslist); } BEGIN_MESSAGE_MAP(SatisfactionDetails, CDialog) ON_WM_DESTROY() ON_BN_CLICKED(IDCANCEL, OnCancel) END_MESSAGE_MAP() BOOL SatisfactionDetails::OnInitDialog() { CDialog::OnInitDialog(); m_Detailslist.SetHeadings("回访事项,220;回访总数,120;非常满意/百分比,120;满意/百分比,120;一般/百分比,120;不满意/百分比,120;非常不满意/百分比,120"); m_Detailslist.LoadColumnInfo(7); m_Detailedslist.SetHeadings("回访类型,120;评分,120;内容,420"); m_Detailedslist.LoadColumnInfo(7); InitDetailslist(); CString strOrder = _T(""); strOrder.Format(_T("订单号:%s"), m_strOrder); ((CStatic*)GetDlgItem(IDC_STATIC_Order))->SetWindowText(strOrder); CString strClient1 = _T(""); #ifdef CHILD_VERSION strClient1.Format(_T("男宾:%s"), m_strClient1); #else strClient1.Format(_T("家长:%s"), m_strClient1); #endif ((CStatic*)GetDlgItem(IDC_STATIC_Client1))->SetWindowText(strClient1); CString strClient2 = _T(""); #ifdef CHILD_VERSION strClient2.Format(_T("女宾:%s"), m_strClient2); #else strClient2.Format(_T("宝宝:%s"), m_strClient2); #endif ((CStatic*)GetDlgItem(IDC_STATIC_Client2))->SetWindowText(strClient2); InitDetailedslist(); this->CenterWindow (g_pMainWnd); return TRUE; } void SatisfactionDetails::OnDestroy() { m_pAllLogArr = NULL; m_pcfgArr = NULL; CDialog::OnDestroy(); } /* 函数名: InitDetailslist 描述: 初始化详情列表 参数: 返回值: */ void SatisfactionDetails::InitDetailslist() { if(m_strKind == _T("") || m_strObj == _T("") || m_pAllLogArr == NULL || m_pcfgArr == NULL) return; if(m_pAllLogArr->GetSize() == 0 || m_pcfgArr->GetSize() == 0) return; int nCount = 0; m_Detailslist.DeleteAllItems2(); m_Detailslist.m_arLabels.SetSize(m_pcfgArr->GetSize(), 1); for(int j=0; jGetSize(); j++) { if(m_pcfgArr->ElementAt(j).ElementAt(2) != m_strKind) continue; //统计数据 int szScore[5] = {0}; //各级别评分数量 CString strOldOrder = _T(""); int nSurveyCount = 0; CString strCfgID = m_pcfgArr->ElementAt(j).ElementAt(0); int i = 0; for( i=0; iGetSize(); i++) { if(m_pAllLogArr->ElementAt(i).ElementAt(4) == m_strObj && m_pAllLogArr->ElementAt(i).ElementAt(2) == m_strKind) { if(strOldOrder != m_pAllLogArr->ElementAt(i).ElementAt(5)) { //统计回访总数 strOldOrder = m_pAllLogArr->ElementAt(i).ElementAt(5); ++nSurveyCount; } if(m_pAllLogArr->ElementAt(i).ElementAt(1) != strCfgID) continue; int nSingleScore = _ttoi(m_pAllLogArr->ElementAt(i).ElementAt(6)); switch(nSingleScore) { case 1: szScore[4] += 1; break; case 2: szScore[3] += 1; break; case 3: szScore[2] += 1; break; case 4: szScore[1] += 1; break; case 5: szScore[0] += 1; break; } } } if(nSurveyCount == 0) continue; //将统计的数据写入列表 m_Detailslist.m_arLabels.ElementAt(nCount).Add(m_pcfgArr->ElementAt(j).ElementAt(6)); //回访事项 CString strSurveyCount = _T(""); strSurveyCount.Format(_T("%d"), nSurveyCount); m_Detailslist.m_arLabels.ElementAt(nCount).Add(strSurveyCount); //回访总数 for(i=0; i<5; i++) { CString strScore = _T(""); if(szScore[i] <= 0) strScore = _T("0(0%)"); else { strScore.Format(_T("%d(%d"), szScore[i], (int)(((float)szScore[i]/(float)nSurveyCount)*100)); strScore += _T("%)"); } m_Detailslist.m_arLabels.ElementAt(nCount).Add(strScore); } ++nCount; } if(nCount == 0) return; m_Detailslist.m_LabelCount = nCount; m_Detailslist.SetItemCountEx(nCount); } /* 函数名: InitDetailedslist 描述: 初始化选中的订单详情列表 参数: 返回值: */ void SatisfactionDetails::InitDetailedslist() { if(m_strKind == _T("") || m_strObj == _T("") || m_pAllLogArr == NULL || m_strOrder == _T("")) return; if(m_pAllLogArr->GetSize() == 0) return; int nCount = 0; int i=0; m_Detailedslist.DeleteAllItems2(); m_Detailedslist.m_arLabels.SetSize(m_pAllLogArr->GetSize(), 1); for(i=0; iGetSize(); i++) { if(m_strOrder == m_pAllLogArr->ElementAt(i).ElementAt(5)) { printf("obj1=%s, obj2 = %s\n", m_strObj, m_pAllLogArr->ElementAt(i).ElementAt(4)); printf("Kind1=%s, Kind2 = %s\n", m_strKind, m_pAllLogArr->ElementAt(i).ElementAt(2)); printf("Order1=%s, Order2 = %s\n", m_strOrder, m_pAllLogArr->ElementAt(i).ElementAt(5)); } if(m_pAllLogArr->ElementAt(i).ElementAt(4) == m_strObj && m_pAllLogArr->ElementAt(i).ElementAt(2) == m_strKind && m_strOrder == m_pAllLogArr->ElementAt(i).ElementAt(5)) { m_Detailedslist.m_arLabels.ElementAt(nCount).Add(m_pAllLogArr->ElementAt(i).ElementAt(2)); CString strScore = _T(""); int nScore = _ttoi(m_pAllLogArr->ElementAt(i).ElementAt(6)); switch(nScore) { case 1: strScore = _T("非常不满意"); break; case 2: strScore = _T("不满意"); break; case 3: strScore = _T("一般"); break; case 4: strScore = _T("满意"); break; case 5: strScore = _T("非常满意"); break; } m_Detailedslist.m_arLabels.ElementAt(nCount).Add(strScore); m_Detailedslist.m_arLabels.ElementAt(nCount).Add(m_pAllLogArr->ElementAt(i).ElementAt(12)); ++nCount; } } if(nCount == 0) return; m_Detailedslist.m_LabelCount = nCount; m_Detailedslist.SetItemCountEx(nCount); } void SatisfactionDetails::OnCancel() { CDialog::OnCancel(); }