Satisfaction.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. // Satisfaction.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "Satisfaction.h"
  6. #include "MyMdi.H"
  7. #include "SendMsgDlg.h"
  8. #include "SelBrunDevice.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // Satisfaction
  16. IMPLEMENT_DYNCREATE(Satisfaction, MyFormView)
  17. Satisfaction::Satisfaction()
  18. : MyFormView(Satisfaction::IDD)
  19. {
  20. //{{AFX_DATA_INIT(Satisfaction)
  21. m_filter = _T("");
  22. m_radio1 = -1;
  23. m_radio2 = -1;
  24. m_radio3 = -1;
  25. m_radio4 = -1;
  26. m_radio5 = -1;
  27. m_radio6 = -1;
  28. m_radio7 = -1;
  29. m_bz5 = _T("");
  30. //}}AFX_DATA_INIT
  31. }
  32. Satisfaction::~Satisfaction()
  33. {
  34. }
  35. void Satisfaction::DoDataExchange(CDataExchange* pDX)
  36. {
  37. MyFormView::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(Satisfaction)
  39. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  40. DDX_Control(pDX, IDC_LIST2, m_List1);
  41. DDX_Control(pDX, IDC_STATIC1, m_static1);
  42. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  43. DDX_Radio(pDX, IDC_RADIO1, m_radio1);
  44. DDX_Radio(pDX, IDC_RADIO14, m_radio2);
  45. DDX_Radio(pDX, IDC_RADIO16, m_radio3);
  46. DDX_Radio(pDX, IDC_RADIO18, m_radio4);
  47. DDX_Radio(pDX, IDC_RADIO20, m_radio5);
  48. DDX_Radio(pDX, IDC_RADIO22, m_radio6);
  49. DDX_Radio(pDX, IDC_RADIO25, m_radio7);
  50. DDX_Text(pDX, IDC_EDITbz5, m_bz5);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(Satisfaction, MyFormView)
  54. //{{AFX_MSG_MAP(Satisfaction)
  55. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  56. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  57. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  58. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  59. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // Satisfaction diagnostics
  64. #ifdef _DEBUG
  65. void Satisfaction::AssertValid() const
  66. {
  67. MyFormView::AssertValid();
  68. }
  69. void Satisfaction::Dump(CDumpContext& dc) const
  70. {
  71. MyFormView::Dump(dc);
  72. }
  73. #endif //_DEBUG
  74. /////////////////////////////////////////////////////////////////////////////
  75. // Satisfaction message handlers
  76. void Satisfaction::OnInitialUpdate()
  77. {
  78. MyFormView::OnInitialUpdate();
  79. // TODO: Add your specialized code here and/or call the base class
  80. CMyMdi Mdi;
  81. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  82. // Here we create the outbar control using the splitter as its parent
  83. // and setting its id to the first pane.
  84. CRect rc2;
  85. GetWindowRect(rc2);
  86. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  87. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  88. m_static1.SetFont (&g_titlefont);
  89. #ifdef CHILD_VERSION
  90. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;门市,100;接待,100;化妆,100;摄影,100;数码,100;选片,100;进度,100;产品,100;备注,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  91. #else
  92. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;门市,100;接待,100;化妆,100;摄影,100;数码,100;选片,100;进度,100;产品,100;备注,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  93. #endif
  94. m_List1.LoadColumnInfo (250);
  95. GetData();
  96. m_combo1.AddString (g_user.name);
  97. m_combo1.GetWindowRect (rc2);
  98. ScreenToClient(rc2);
  99. rc2.bottom +=200;
  100. m_combo1.MoveWindow (rc2);
  101. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  102. SetComboHei(&m_combo1, rc2.Height ());
  103. }
  104. void Satisfaction::FillGrid()
  105. {
  106. BOOL bStatus=0;
  107. {
  108. m_List1.DeleteAllItems2 ();
  109. int ii=0;
  110. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  111. int count=0;
  112. if(m_filter.IsEmpty ())
  113. {
  114. if(bStatus)
  115. {
  116. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  117. {
  118. if(m_List1array.ElementAt (ii).ElementAt (4)=="OK"&&m_List1array.ElementAt (ii).ElementAt (5)!="OK")
  119. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  120. }
  121. }
  122. else
  123. {
  124. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  125. {
  126. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  127. }
  128. }
  129. }
  130. else
  131. {
  132. int type=GetType(m_filter);
  133. if(type==1)//电话
  134. {
  135. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  136. {
  137. if(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  138. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1)
  139. {
  140. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  141. }
  142. }
  143. }
  144. else if(type==2)//拼音
  145. {
  146. m_filter.MakeUpper ();
  147. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  148. {
  149. if(m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1 || \
  150. m_List1array.ElementAt (ii).ElementAt (17).Find (m_filter)!=-1)
  151. {
  152. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  153. }
  154. }
  155. }
  156. else
  157. {
  158. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  159. {
  160. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  161. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  162. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  163. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  164. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  165. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  166. m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1 || \
  167. m_List1array.ElementAt (ii).ElementAt (17).Find (m_filter)!=-1)
  168. {
  169. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  170. }
  171. }
  172. }
  173. }
  174. m_List1.m_arLabels.SetSize(count, 1);
  175. ii=count;
  176. m_List1.m_LabelCount=ii;
  177. m_List1.SetItemCountEx (ii);
  178. CString str;
  179. str.Format ("单数:%d", ii);
  180. SetDlgItemText(IDC_STATIC2, str);
  181. }
  182. if(!g_id.IsEmpty ())
  183. {
  184. for(int i=0; i<m_List1.GetItemCount (); i++)
  185. {
  186. if(g_id==m_List1.GetItemText (i, 0))
  187. {
  188. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  189. m_List1.EnsureVisible(i,FALSE);
  190. CString str;
  191. str.Format("当前客人:%s %s", g_id, m_List1.GetItemText (i, 1)+m_List1.GetItemText (i, 2));
  192. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  193. return;
  194. }
  195. }
  196. }
  197. GetDlgItem(IDC_STATIC2)->SetWindowText("");
  198. }
  199. void Satisfaction::OnBUTclose()
  200. {
  201. // TODO: Add your control notification handler code here
  202. GetParent()->SendMessage(WM_CLOSE);
  203. }
  204. BOOL Satisfaction::PreTranslateMessage(MSG* pMsg)
  205. {
  206. // TODO: Add your specialized code here and/or call the base class
  207. try
  208. {
  209. if(pMsg->message==WM_KEYDOWN)
  210. {
  211. switch (pMsg->wParam)
  212. {
  213. case VK_RETURN:
  214. OnButton1();
  215. return 1;
  216. case 0x43: // copy
  217. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  218. {
  219. GetFocus()->SendMessage(WM_COPY);
  220. return TRUE;
  221. }
  222. break;
  223. case 0x56: //Ctrl + V:
  224. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  225. {
  226. GetFocus()->SendMessage(WM_PASTE);
  227. return TRUE;
  228. }
  229. break;
  230. case 0x58: // cut
  231. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  232. {
  233. GetFocus()->SendMessage(WM_CUT);
  234. return TRUE;
  235. }
  236. break;
  237. case 0x5A: //undo
  238. case 0x59: //redo
  239. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  240. {
  241. GetFocus()->SendMessage(WM_UNDO);
  242. return TRUE;
  243. }
  244. break;
  245. }
  246. }
  247. return MyFormView::PreTranslateMessage(pMsg);
  248. }
  249. catch(...)
  250. {
  251. }
  252. }
  253. void Satisfaction::OnButton1()
  254. {
  255. // TODO: Add your control notification handler code here
  256. UpdateData();
  257. m_filter.TrimLeft ();
  258. m_filter.TrimRight ();
  259. FillGrid();
  260. }
  261. void Satisfaction::OnButton3()
  262. {
  263. UpdateData();
  264. CString id;
  265. {
  266. POSITION pos;
  267. pos=m_List1.GetFirstSelectedItemPosition();
  268. if(pos!=NULL)
  269. {
  270. int iItem=m_List1.GetNextSelectedItem(pos);
  271. id = m_List1.GetItemText (iItem, 0);
  272. }
  273. else
  274. {
  275. AfxMessageBox("请先选中客户!", MB_ICONINFORMATION);return;
  276. }
  277. }
  278. CString sql;
  279. sql.Format ("update [dindan] set [satisfaction1]=%d,[satisfaction2]=%d,[satisfaction3]=%d,[satisfaction4]=%d,[satisfaction5]=%d,[satisfaction6]=%d,[satisfaction7]=%d,[bz5]='%s' where [id]='%s'", m_radio1,m_radio2,m_radio3,m_radio4,m_radio5,m_radio6,m_radio7,m_bz5, id);
  280. g_sendhead.bsql=1;
  281. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  282. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  283. GetData();
  284. }
  285. void Satisfaction::GetData()
  286. {
  287. if(g_bShowOK==0)
  288. {
  289. #ifdef LKAY_VERSION
  290. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  291. #else
  292. CString filter="status3='未取'";
  293. #endif
  294. g_sendhead.bsql=0;
  295. g_sendhead.code[0]=211;
  296. g_sendhead.tabcount=1;
  297. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  298. }
  299. else
  300. {
  301. g_sendhead.bsql=0;
  302. g_sendhead.code[0]=211;
  303. g_sendhead.tabcount=1;
  304. #ifdef LKAY_VERSION
  305. CString filter="dindantype<>'意向客户' or dindantype is null";
  306. g_pMainWnd->ProcessChatMessageRequest2(filter);
  307. #else
  308. g_pMainWnd->ProcessChatMessageRequest2(1);
  309. #endif
  310. if(g_bSendOK==0)return;
  311. }
  312. DataToArray(&m_List1array);
  313. m_List1arrayBak.SetSize(m_List1array.GetSize ());
  314. for(int i=0; i<m_List1array.GetSize (); i++)
  315. {
  316. m_List1arrayBak.ElementAt (i).Copy (m_List1array.ElementAt (i));
  317. if(m_List1array.ElementAt (i).ElementAt (11).GetLength ()>256)
  318. m_List1array.ElementAt (i).SetAt (11, m_List1array.ElementAt (i).ElementAt (11).Left (256)+"..");
  319. for(int aa=4; aa<11; aa++)
  320. {
  321. if(m_List1array.ElementAt (i).ElementAt (aa)=="0")m_List1array.ElementAt (i).SetAt (aa, "满意");
  322. else if(m_List1array.ElementAt (i).ElementAt (aa)=="1")m_List1array.ElementAt (i).SetAt (aa, "一般");
  323. else if(m_List1array.ElementAt (i).ElementAt (aa)=="2")m_List1array.ElementAt (i).SetAt (aa, "不满意");
  324. else if(m_List1array.ElementAt (i).ElementAt (aa)=="-1")m_List1array.ElementAt (i).SetAt (aa, "");
  325. }
  326. }
  327. FillGrid();
  328. }
  329. void Satisfaction::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  330. {
  331. // TODO: Add your control notification handler code here
  332. POSITION pos;
  333. pos=m_List1.GetFirstSelectedItemPosition();
  334. if(pos==NULL)
  335. {
  336. OnButton4();GetDlgItem(IDC_STATIC2)->SetWindowText("");
  337. return;
  338. }
  339. int iItem=m_List1.GetNextSelectedItem(pos);
  340. CString id=m_List1.GetItemText (iItem, 0);
  341. g_id = id;
  342. CString str;
  343. str.Format("当前客人:%s %s", id, m_List1.GetItemText (iItem, 1)+m_List1.GetItemText (iItem, 2));
  344. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  345. for(int i=0; i<m_List1.m_arLabels.GetSize(); i++)
  346. {
  347. if(id==m_List1arrayBak.ElementAt(i).ElementAt(0))
  348. {
  349. m_radio1=atoi(m_List1arrayBak.ElementAt (i).ElementAt (4));
  350. if(m_List1arrayBak.ElementAt (i).ElementAt (4)=="")m_radio1 = -1;
  351. m_radio2=atoi(m_List1arrayBak.ElementAt (i).ElementAt (5));
  352. if(m_List1arrayBak.ElementAt (i).ElementAt (5)=="")m_radio2 = -1;
  353. m_radio3=atoi(m_List1arrayBak.ElementAt (i).ElementAt (6));
  354. if(m_List1arrayBak.ElementAt (i).ElementAt (6)=="")m_radio3 = -1;
  355. m_radio4=atoi(m_List1arrayBak.ElementAt (i).ElementAt (7));
  356. if(m_List1arrayBak.ElementAt (i).ElementAt (7)=="")m_radio4 = -1;
  357. m_radio5=atoi(m_List1arrayBak.ElementAt (i).ElementAt (8));
  358. if(m_List1arrayBak.ElementAt (i).ElementAt (8)=="")m_radio5 = -1;
  359. m_radio6=atoi(m_List1arrayBak.ElementAt (i).ElementAt (9));
  360. if(m_List1arrayBak.ElementAt (i).ElementAt (9)=="")m_radio6 = -1;
  361. m_radio7=atoi(m_List1arrayBak.ElementAt (i).ElementAt (10));
  362. if(m_List1arrayBak.ElementAt (i).ElementAt (10)=="")m_radio7 = -1;
  363. m_bz5 = m_List1arrayBak.ElementAt (i).ElementAt (11);
  364. UpdateData(0);
  365. return;
  366. }
  367. }
  368. *pResult = 0;
  369. }
  370. void Satisfaction::OnButton4()
  371. {
  372. // TODO: Add your control notification handler code here
  373. m_radio1 = -1;
  374. m_radio2 = -1;
  375. m_radio3 = -1;
  376. m_radio4 = -1;
  377. m_radio5 = -1;
  378. m_radio6 = -1;
  379. m_radio7 = -1;
  380. m_bz5="";
  381. UpdateData(0);
  382. }