ClientForm2.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. // CClientForm2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ClientForm2.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. // CClientForm2
  16. IMPLEMENT_DYNCREATE(CClientForm2, MyFormView)
  17. CClientForm2::CClientForm2()
  18. : MyFormView(CClientForm2::IDD)
  19. {
  20. //{{AFX_DATA_INIT(CClientForm2)
  21. m_filter = _T("");
  22. m_from = _T("");
  23. m_checkcontent = _T("");
  24. m_clientqq = _T("");
  25. m_contact = _T("");
  26. m_clerk = g_user.name;
  27. m_useqq = _T("");
  28. m_date = g_date;
  29. m_time.Format("%02d:%02d", CTime::GetCurrentTime().GetHour(), CTime::GetCurrentTime().GetMinute());
  30. m_question = _T("");
  31. m_solution = _T("");
  32. m_result = _T("");
  33. //}}AFX_DATA_INIT
  34. }
  35. CClientForm2::~CClientForm2()
  36. {
  37. }
  38. void CClientForm2::DoDataExchange(CDataExchange* pDX)
  39. {
  40. MyFormView::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CClientForm2)
  42. DDX_Control(pDX, IDC_COMBOresult, m_comboresult);
  43. DDX_Control(pDX, IDC_EDITdate, m_datectrl);
  44. DDX_Control(pDX, IDC_COMBOuseqq, m_combouseqq);
  45. DDX_Control(pDX, IDC_COMBOclerk, m_comboclerk);
  46. DDX_Control(pDX, IDC_COMBOcheckcontent, m_combocheckcontent);
  47. DDX_Control(pDX, IDC_COMBOfrom, m_combofrom);
  48. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  49. DDX_Control(pDX, IDC_LIST2, m_List1);
  50. DDX_Control(pDX, IDC_STATIC1, m_static1);
  51. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  52. DDX_CBString(pDX, IDC_COMBOfrom, m_from);
  53. DDX_CBString(pDX, IDC_COMBOcheckcontent, m_checkcontent);
  54. DDX_Text(pDX, IDC_EDITclientqq, m_clientqq);
  55. DDX_Text(pDX, IDC_EDITcontact, m_contact);
  56. DDX_CBString(pDX, IDC_COMBOclerk, m_clerk);
  57. DDX_CBString(pDX, IDC_COMBOuseqq, m_useqq);
  58. DDX_Text(pDX, IDC_EDITdate, m_date);
  59. DDX_Text(pDX, IDC_EDITtime, m_time);
  60. DDX_Text(pDX, IDC_EDITquestion, m_question);
  61. DDX_Text(pDX, IDC_EDITsolution, m_solution);
  62. DDX_CBString(pDX, IDC_COMBOresult, m_result);
  63. //}}AFX_DATA_MAP
  64. }
  65. BEGIN_MESSAGE_MAP(CClientForm2, MyFormView)
  66. //{{AFX_MSG_MAP(CClientForm2)
  67. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  68. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  69. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  70. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  71. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  72. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  73. ON_CBN_CLOSEUP(IDC_COMBOcheckcontent, OnCloseupCOMBOcheckcontent)
  74. //}}AFX_MSG_MAP
  75. END_MESSAGE_MAP()
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CClientForm2 diagnostics
  78. #ifdef _DEBUG
  79. void CClientForm2::AssertValid() const
  80. {
  81. MyFormView::AssertValid();
  82. }
  83. void CClientForm2::Dump(CDumpContext& dc) const
  84. {
  85. MyFormView::Dump(dc);
  86. }
  87. #endif //_DEBUG
  88. /////////////////////////////////////////////////////////////////////////////
  89. // CClientForm2 message handlers
  90. void CClientForm2::OnInitialUpdate()
  91. {
  92. MyFormView::OnInitialUpdate();
  93. // TODO: Add your specialized code here and/or call the base class
  94. CMyMdi Mdi;
  95. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  96. m_List1.m_bSortSupport = 0;
  97. GetDlgItem(IDC_BUTTON2)->EnableWindow(IsHasRights2new(49));
  98. // Here we create the outbar control using the splitter as its parent
  99. // and setting its id to the first pane.
  100. CRect rc2;
  101. GetWindowRect(rc2);
  102. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  103. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  104. GetDlgItem(IDC_BUTTON2)->EnableWindow(IsHasRights2new(49));
  105. m_static1.SetFont(&g_titlefont);
  106. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;电话,100;地址,100;QQ,100;版本,100;业务员,100;检查内容,100;技术员,100;使用QQ,100;日期,100");
  107. m_List1.LoadColumnInfo(108);
  108. g_sendhead.bsql = 0;
  109. g_sendhead.code[0] = 200;
  110. g_sendhead.code[1] = 201;
  111. g_sendhead.code[2] = 202;
  112. g_sendhead.code[3] = 203;
  113. g_sendhead.code[4] = 209;
  114. g_sendhead.tabcount = 5;
  115. g_pMainWnd->ProcessChatMessageRequest2(3);
  116. if (g_bSendOK == 0)
  117. {
  118. return;
  119. }
  120. CArray<CStringArray, CStringArray>List1array;
  121. CArray<CStringArray, CStringArray>List2array;
  122. CArray<CStringArray, CStringArray>List3array;
  123. CArray<CStringArray, CStringArray>List4array;
  124. int ii = 0;
  125. DataToArray(&List1array, &List2array, &List3array, &List4array, &m_List1array);
  126. for ( ii = 0; ii < List1array.GetSize(); ii++)
  127. m_combocheckcontent.AddString(List1array.ElementAt(ii).ElementAt(0));
  128. for (ii = 0; ii < List2array.GetSize(); ii++)
  129. m_comboresult.AddString(List2array.ElementAt(ii).ElementAt(0));
  130. for (ii = 0; ii < List3array.GetSize(); ii++)
  131. m_combouseqq.AddString(List3array.ElementAt(ii).ElementAt(0));
  132. for (ii = 0; ii < List4array.GetSize(); ii++)
  133. m_combofrom.AddString(List4array.ElementAt(ii).ElementAt(0));
  134. FillGrid();
  135. m_combo1.GetWindowRect(rc2);
  136. ScreenToClient(rc2);
  137. rc2.bottom += 200;
  138. m_combo1.MoveWindow(rc2);
  139. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  140. SetComboHei(&m_combo1, rc2.Height());
  141. m_comboclerk.RefDroppedWidth();
  142. m_comboclerk.AddString(g_user.name);
  143. m_comboclerk.SetCurSel(m_comboclerk.FindString(0, g_user.name));
  144. #if defined(VC90) || defined(VC80) // 下拉框无显示修改;
  145. m_comboclerk.GetWindowRect(rc2);
  146. rc2.bottom += 100;
  147. ScreenToClient(rc2);
  148. m_comboclerk.MoveWindow(rc2);
  149. //m_comboresult;
  150. m_comboresult.GetWindowRect(rc2);
  151. rc2.bottom += 100;
  152. ScreenToClient(rc2);
  153. m_comboresult.MoveWindow(rc2);
  154. m_combouseqq.GetWindowRect(rc2);
  155. rc2.bottom += 100;
  156. ScreenToClient(rc2);
  157. m_combouseqq.MoveWindow(rc2);
  158. m_combocheckcontent.GetWindowRect(rc2);
  159. rc2.bottom += 100;
  160. ScreenToClient(rc2);
  161. m_combocheckcontent.MoveWindow(rc2);
  162. m_combofrom.GetWindowRect(rc2);
  163. rc2.bottom += 100;
  164. ScreenToClient(rc2);
  165. m_combofrom.MoveWindow(rc2);
  166. #endif
  167. }
  168. void CClientForm2::FillGrid()
  169. {
  170. m_List1.DeleteAllItems2();
  171. int ii = 0;
  172. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  173. int count = 0;
  174. if (m_filter.IsEmpty())
  175. {
  176. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  177. {
  178. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  179. }
  180. }
  181. else
  182. {
  183. int type = GetType(m_filter);
  184. if (type == 1)//电话
  185. {
  186. BOOL bFinded = 0;
  187. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  188. {
  189. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  190. {
  191. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  192. continue;
  193. }
  194. if (m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1)
  195. {
  196. bFinded = 1;
  197. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  198. }
  199. else
  200. {
  201. bFinded = 0;
  202. }
  203. }
  204. }
  205. else if (type == 2)//拼音
  206. {
  207. BOOL bFinded = 0;
  208. m_filter.MakeUpper();
  209. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  210. {
  211. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  212. {
  213. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  214. continue;
  215. }
  216. if (m_List1array.ElementAt(ii).ElementAt(20).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(21).Find(m_filter) != -1)
  217. {
  218. bFinded = 1;
  219. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  220. }
  221. else
  222. {
  223. bFinded = 0;
  224. }
  225. }
  226. }
  227. else
  228. {
  229. BOOL bFinded = 0;
  230. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  231. {
  232. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  233. {
  234. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  235. continue;
  236. }
  237. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  238. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  239. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  240. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  241. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1 || \
  242. m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1 || \
  243. m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1 || \
  244. m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1 || \
  245. m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1 || \
  246. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || \
  247. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  248. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1)
  249. {
  250. bFinded = 1;
  251. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  252. }
  253. else
  254. {
  255. bFinded = 0;
  256. }
  257. }
  258. }
  259. }
  260. m_List1.m_arLabels.SetSize(count, 1);
  261. ii = count;
  262. m_List1.m_LabelCount = ii;
  263. m_List1.SetItemCountEx(ii);
  264. if (!g_id.IsEmpty())
  265. {
  266. for (int i = 0; i < m_List1.GetItemCount(); i++)
  267. {
  268. if (g_id == m_List1.GetItemText(i, 0))
  269. {
  270. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  271. m_List1.EnsureVisible(i, FALSE);
  272. break;
  273. }
  274. }
  275. }
  276. GetDlgItem(IDC_STATIC2)->SetWindowText("");
  277. }
  278. void CClientForm2::OnBUTclose()
  279. {
  280. // TODO: Add your control notification handler code here
  281. GetParent()->SendMessage(WM_CLOSE);
  282. }
  283. BOOL CClientForm2::PreTranslateMessage(MSG* pMsg)
  284. {
  285. // TODO: Add your specialized code here and/or call the base class
  286. try
  287. {
  288. if (pMsg->message == WM_KEYDOWN)
  289. {
  290. switch (pMsg->wParam)
  291. {
  292. case VK_RETURN:
  293. OnButton1();
  294. return 1;
  295. case 0x43: // copy
  296. if ((GetKeyState(VK_CONTROL) & 0x80))
  297. {
  298. GetFocus()->SendMessage(WM_COPY);
  299. return TRUE;
  300. }
  301. break;
  302. case 0x56: //Ctrl + V:
  303. if ((GetKeyState(VK_CONTROL) & 0x80))
  304. {
  305. GetFocus()->SendMessage(WM_PASTE);
  306. return TRUE;
  307. }
  308. break;
  309. case 0x58: // cut
  310. if ((GetKeyState(VK_CONTROL) & 0x80))
  311. {
  312. GetFocus()->SendMessage(WM_CUT);
  313. return TRUE;
  314. }
  315. break;
  316. case 0x5A: //undo
  317. case 0x59: //redo
  318. if ((GetKeyState(VK_CONTROL) & 0x80))
  319. {
  320. GetFocus()->SendMessage(WM_UNDO);
  321. return TRUE;
  322. }
  323. break;
  324. }
  325. }
  326. return MyFormView::PreTranslateMessage(pMsg);
  327. }
  328. catch (...)
  329. {
  330. }
  331. }
  332. void CClientForm2::OnButton1() // 查询按钮;
  333. {
  334. // TODO: Add your control notification handler code here
  335. UpdateData();
  336. m_filter.TrimLeft();
  337. m_filter.TrimRight();
  338. FillGrid();
  339. }
  340. void CClientForm2::OnButton3() // 保存按钮;
  341. {
  342. UpdateData();
  343. CString id;
  344. {
  345. POSITION pos;
  346. pos = m_List1.GetFirstSelectedItemPosition();
  347. if (pos != NULL)
  348. {
  349. int iItem = m_List1.GetNextSelectedItem(pos);
  350. id = m_List1.GetItemText(iItem, 0);
  351. }
  352. else
  353. {
  354. AfxMessageBox("请先选中客户!", MB_ICONINFORMATION); return;
  355. }
  356. }
  357. m_from = m_checkcontent = m_clerk = m_useqq = "";
  358. int pos = m_combofrom.GetCurSel();
  359. if (pos != -1)
  360. {
  361. m_combofrom.GetLBText(pos, m_from);
  362. }
  363. pos = m_combocheckcontent.GetCurSel();
  364. if (pos != -1)
  365. {
  366. m_combocheckcontent.GetLBText(pos, m_checkcontent);
  367. }
  368. pos = m_comboclerk.GetCurSel();
  369. if (pos != -1)
  370. {
  371. m_comboclerk.GetLBText(pos, m_clerk);
  372. }
  373. pos = m_combouseqq.GetCurSel();
  374. if (pos != -1)
  375. {
  376. m_combouseqq.GetLBText(pos, m_useqq);
  377. }
  378. pos = m_comboresult.GetCurSel();
  379. if (pos != -1)
  380. {
  381. m_comboresult.GetLBText(pos, m_result);
  382. }
  383. if (!CheckDateOK(m_date))return;
  384. if (m_checkcontent == "电话回访")
  385. {
  386. if (m_result == "" || m_date == "")
  387. {
  388. AfxMessageBox("资料不全!", MB_ICONINFORMATION); return;
  389. return;
  390. }
  391. }
  392. else
  393. {
  394. if (m_result == "" || m_question == "" || m_from == "" || m_checkcontent == "" || m_clientqq == "" || m_clerk == "" || m_useqq == "" || m_date == "")
  395. {
  396. AfxMessageBox("资料不全!", MB_ICONINFORMATION); return;
  397. return;
  398. }
  399. }
  400. CString sql;
  401. if (m_autoid == "")
  402. sql.Format("insert into [clientservice]([id],[from],[checkcontent],[clientqq],[contact],[clerk],[useqq],[date],[time],[question],[solution],[result])values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", id, m_from, m_checkcontent, m_clientqq, m_contact, m_clerk, m_useqq, m_date, m_time, m_question, m_solution, m_result);
  403. else
  404. sql.Format("update [clientservice] set [from]='%s',[checkcontent]='%s',[clientqq]='%s',[contact]='%s',[clerk]='%s',[useqq]='%s',[date]='%s',[time]='%s',[question]='%s',[solution]='%s',[result]='%s' where [autoid]=%s", m_from, m_checkcontent, m_clientqq, m_contact, m_clerk, m_useqq, m_date, m_time, m_question, m_solution, m_result, m_autoid);
  405. g_sendhead.bsql = 1;
  406. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  407. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  408. GetData();
  409. }
  410. void CClientForm2::GetData()
  411. {
  412. g_sendhead.bsql = 0;
  413. g_sendhead.code[0] = 209;
  414. g_sendhead.tabcount = 1;
  415. g_pMainWnd->ProcessChatMessageRequest2(3);
  416. if (g_bSendOK == 0)
  417. {
  418. return;
  419. }
  420. DataToArray(&m_List1array);
  421. FillGrid();
  422. }
  423. void CClientForm2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  424. {
  425. // TODO: Add your control notification handler code here
  426. POSITION pos;
  427. pos = m_List1.GetFirstSelectedItemPosition();
  428. if (pos == NULL)
  429. {
  430. OnButton4(); GetDlgItem(IDC_STATIC2)->SetWindowText("");
  431. return;
  432. }
  433. int iItem = m_List1.GetNextSelectedItem(pos);
  434. CString id = m_List1.GetItemText(iItem, 0);
  435. int m_nitempos = 0;
  436. while (id == "")
  437. {
  438. m_nitempos++;
  439. iItem--;
  440. id = m_List1.GetItemText(iItem, 0);
  441. }
  442. g_id = id;
  443. CString str;
  444. str.Format("当前客人:%s %s", id, m_List1.GetItemText(iItem, 1) + m_List1.GetItemText(iItem, 2));
  445. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  446. for (int i = 0; i < m_List1.m_arLabels.GetSize(); i++)
  447. {
  448. if (id == m_List1.m_arLabels.ElementAt(i).ElementAt(0))
  449. {
  450. m_checkcontent = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(8);
  451. m_clerk = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(9);
  452. m_useqq = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(10);
  453. m_date = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(11);
  454. m_from = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(12);
  455. m_clientqq = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(13);
  456. m_contact = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(14);
  457. m_time = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(15);
  458. m_question = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(16);
  459. m_solution = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(17);
  460. m_result = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(18);
  461. m_autoid = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(19);
  462. m_combofrom.SetCurSel(-1);
  463. m_combocheckcontent.SetCurSel(-1);
  464. m_combouseqq.SetCurSel(-1);
  465. m_comboresult.SetCurSel(-1);
  466. UpdateData(0);
  467. if (m_comboclerk.FindString(0, m_clerk) == -1)
  468. m_comboclerk.AddString(m_clerk);
  469. m_comboclerk.SetCurSel(m_comboclerk.FindString(0, m_clerk));
  470. if (m_comboresult.FindString(0, m_result) == -1)
  471. m_comboresult.AddString(m_result);
  472. m_comboresult.SetCurSel(m_comboresult.FindString(0, m_result));
  473. if (m_autoid == "")
  474. OnButton4();
  475. else
  476. {
  477. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存更改");
  478. if (g_user.name != m_clerk)
  479. GetDlgItem(IDC_BUTTON3)->EnableWindow(0);
  480. else
  481. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  482. }
  483. return;
  484. }
  485. }
  486. *pResult = 0;
  487. }
  488. void CClientForm2::OnButton4() // 重填按钮;
  489. {
  490. // TODO: Add your control notification handler code here
  491. m_autoid = "";
  492. m_from = _T("");
  493. m_checkcontent = _T("");
  494. m_clientqq = _T("");
  495. m_contact = _T("");
  496. m_clerk = g_user.name;
  497. m_useqq = _T("");
  498. m_date = g_date;
  499. m_time.Format("%02d:%02d", CTime::GetCurrentTime().GetHour(), CTime::GetCurrentTime().GetMinute());
  500. m_question = _T("");
  501. m_solution = _T("");
  502. m_result = _T("");
  503. UpdateData(0);
  504. m_comboclerk.AddString(g_user.name);
  505. m_comboclerk.SetCurSel(m_comboclerk.FindString(0, g_user.name));
  506. m_combofrom.SetCurSel(-1);
  507. m_combocheckcontent.SetCurSel(-1);
  508. m_combouseqq.SetCurSel(-1);
  509. m_comboresult.SetCurSel(-1);
  510. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存");
  511. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  512. }
  513. void CClientForm2::OnButton2() // 删除按钮;
  514. {
  515. // TODO: Add your control notification handler code here
  516. POSITION pos;
  517. pos = m_List1.GetFirstSelectedItemPosition();
  518. if (pos == NULL)
  519. {
  520. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  521. return;
  522. } if (AfxMessageBox("确认删除此服务记录吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  523. int iItem = m_List1.GetNextSelectedItem(pos);
  524. CString id = m_List1.GetItemText(iItem, 0);
  525. int m_nitempos = 0;
  526. while (id == "")
  527. {
  528. m_nitempos++;
  529. iItem--;
  530. id = m_List1.GetItemText(iItem, 0);
  531. }
  532. CString str;
  533. str.Format("当前客人:%s %s", id, m_List1.GetItemText(iItem, 1) + m_List1.GetItemText(iItem, 2));
  534. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  535. for (int i = 0; i < m_List1.m_arLabels.GetSize(); i++)
  536. {
  537. if (id == m_List1.m_arLabels.ElementAt(i).ElementAt(0))
  538. {
  539. m_checkcontent = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(8);
  540. m_clerk = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(9);
  541. m_useqq = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(10);
  542. m_date = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(11);
  543. m_from = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(12);
  544. m_clientqq = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(13);
  545. m_contact = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(14);
  546. m_time = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(15);
  547. m_question = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(16);
  548. m_solution = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(17);
  549. m_result = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(18);
  550. m_autoid = m_List1.m_arLabels.ElementAt(i + m_nitempos).ElementAt(19);
  551. UpdateData(0);
  552. if (m_comboclerk.FindString(0, m_clerk) == -1)
  553. m_comboclerk.AddString(m_clerk);
  554. m_comboclerk.SetCurSel(m_comboclerk.FindString(0, m_clerk));
  555. if (m_autoid != "")
  556. {
  557. CString sql;
  558. sql.Format("delete from [clientservice] where [autoid]=%s", m_autoid);
  559. g_sendhead.bsql = 1;
  560. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  561. GetData();
  562. }
  563. }
  564. }
  565. }
  566. void CClientForm2::OnCloseupCOMBOcheckcontent()
  567. {
  568. // TODO: Add your control notification handler code here
  569. int pos = m_combocheckcontent.GetCurSel();
  570. if (pos != -1)
  571. {
  572. m_checkcontent = "";
  573. m_combocheckcontent.GetLBText(pos, m_checkcontent);
  574. }
  575. else
  576. return;
  577. if (m_checkcontent == "电话回访")
  578. {
  579. GetDlgItem(IDC_STATIC100)->SetWindowText("来源:");
  580. GetDlgItem(IDC_STATIC101)->SetWindowText("反映问题:");
  581. GetDlgItem(IDC_STATIC102)->SetWindowText("客户使用QQ:");
  582. GetDlgItem(IDC_STATIC103)->SetWindowText("技术员:");
  583. GetDlgItem(IDC_STATIC104)->SetWindowText("使用QQ:");
  584. }
  585. else
  586. {
  587. GetDlgItem(IDC_STATIC100)->SetWindowText("*来源:");
  588. GetDlgItem(IDC_STATIC101)->SetWindowText("*反映问题:");
  589. GetDlgItem(IDC_STATIC102)->SetWindowText("*客户使用QQ:");
  590. GetDlgItem(IDC_STATIC103)->SetWindowText("*技术员:");
  591. GetDlgItem(IDC_STATIC104)->SetWindowText("*使用QQ:");
  592. }
  593. }