PhoneRecord.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. // PhoneRecord.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "PhoneRecord.h"
  6. #include "MyMdi.H"
  7. #include "AVIPlayerDlg.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // PhoneRecord
  15. IMPLEMENT_DYNCREATE(PhoneRecord, MyFormView)
  16. PhoneRecord::PhoneRecord()
  17. : MyFormView(PhoneRecord::IDD)
  18. {
  19. //{{AFX_DATA_INIT(PhoneRecord)
  20. m_filter = _T("");
  21. //}}AFX_DATA_INIT
  22. bLoad1 = bLoad2 = bLoad3 = bLoad4 = bLoad5 = 0;
  23. }
  24. PhoneRecord::~PhoneRecord()
  25. {
  26. }
  27. void PhoneRecord::DoDataExchange(CDataExchange* pDX)
  28. {
  29. MyFormView::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(PhoneRecord)
  31. DDX_Control(pDX, IDC_LIST8, m_List5);
  32. DDX_Control(pDX, IDC_LIST7, m_List4);
  33. DDX_Control(pDX, IDC_LIST6, m_List3);
  34. DDX_Control(pDX, IDC_LIST4, m_List2);
  35. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  36. DDX_Control(pDX, IDC_LIST2, m_List1);
  37. DDX_Control(pDX, IDC_STATIC1, m_static1);
  38. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(PhoneRecord, MyFormView)
  42. //{{AFX_MSG_MAP(PhoneRecord)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  48. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  49. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  50. ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
  51. ON_BN_CLICKED(IDC_BUTdel2, OnBUTdel2)
  52. ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. /////////////////////////////////////////////////////////////////////////////
  56. // PhoneRecord diagnostics
  57. #ifdef _DEBUG
  58. void PhoneRecord::AssertValid() const
  59. {
  60. MyFormView::AssertValid();
  61. }
  62. void PhoneRecord::Dump(CDumpContext& dc) const
  63. {
  64. MyFormView::Dump(dc);
  65. }
  66. #endif //_DEBUG
  67. /////////////////////////////////////////////////////////////////////////////
  68. // PhoneRecord message handlers
  69. void PhoneRecord::OnInitialUpdate()
  70. {
  71. MyFormView::OnInitialUpdate();
  72. // TODO: Add your specialized code here and/or call the base class
  73. GetDlgItem(IDC_BUTTON4)->EnableWindow(IsHasRights2new(49));
  74. CMyMdi Mdi;
  75. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  76. // Here we create the outbar control using the splitter as its parent
  77. // and setting its id to the first pane.
  78. CRect rc2;
  79. GetWindowRect(rc2);
  80. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  81. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  82. int idarray[] = { IDC_BUTdel2, IDC_BUTTON4, IDC_BUTclose };
  83. int idcount = 3;
  84. int btnwid;
  85. CRect prerc;
  86. for (int a = idcount - 2; a >= 0; a--)
  87. {
  88. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  89. ScreenToClient(prerc);
  90. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  91. ScreenToClient(rc2);
  92. btnwid = rc2.Width();
  93. rc2.right = prerc.left;
  94. rc2.left = rc2.right - btnwid;
  95. GetDlgItem(idarray[a])->MoveWindow(rc2);
  96. }
  97. {
  98. int idarray[] = { IDC_BUTTON1, IDC_BUTTON6, IDC_BUTTON2, IDC_BUTTON3, IDC_BUTTON10 };
  99. int idcount = 5;
  100. int btnwid;
  101. CRect prerc;
  102. for (int a = 1; a < idcount; a++)
  103. {
  104. GetDlgItem(idarray[a - 1])->GetWindowRect(prerc);
  105. ScreenToClient(prerc);
  106. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  107. ScreenToClient(rc2);
  108. btnwid = rc2.Width();
  109. rc2.left = prerc.right;
  110. rc2.right = rc2.left + btnwid;
  111. GetDlgItem(idarray[a])->MoveWindow(rc2);
  112. }
  113. }
  114. m_static1.SetFont(&g_titlefont);
  115. #ifdef CHILD_VERSION
  116. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;手机,100;固定电话,100;来电号码,100;来电时间,150");
  117. #else
  118. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;男宾电话,100;女宾电话,100;来电号码,100;来电时间,150" );
  119. #endif
  120. m_List1.LoadColumnInfo(151);
  121. m_List2.SetHeadings("客人姓名,150;性别,100;电话,150;来电时间,200");
  122. m_List2.LoadColumnInfo(152);
  123. m_List3.SetHeadings("员工姓名,150;电话,100;来电时间,200");
  124. m_List3.LoadColumnInfo(153);
  125. m_List4.SetHeadings("电话,200;来电时间,200");
  126. m_List4.LoadColumnInfo(154);
  127. m_List5.SetHeadings("客人姓名,150;电话,100;来电时间,200");
  128. m_List5.LoadColumnInfo(153);
  129. m_combo1.GetWindowRect(rc2);
  130. ScreenToClient(rc2);
  131. rc2.bottom += 200;
  132. m_combo1.MoveWindow(rc2);
  133. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  134. SetComboHei(&m_combo1, rc2.Height());
  135. OnButton1();
  136. }
  137. void PhoneRecord::OnBUTclose()//关闭按钮;
  138. {
  139. // TODO: Add your control notification handler code here
  140. GetParent()->SendMessage(WM_CLOSE);
  141. }
  142. void PhoneRecord::OnSelchangeCombo1()
  143. {
  144. // TODO: Add your control notification handler code here
  145. SetTimer(1, 100, NULL);
  146. }
  147. void PhoneRecord::OnTimer(UINT nIDEvent)
  148. {
  149. // TODO: Add your message handler code here and/or call default
  150. KillTimer(nIDEvent);
  151. // OnButton1();
  152. }
  153. BOOL PhoneRecord::PreTranslateMessage(MSG* pMsg)
  154. {
  155. // TODO: Add your specialized code here and/or call the base class
  156. try
  157. {
  158. if (pMsg->message == WM_KEYDOWN)
  159. {
  160. switch (pMsg->wParam)
  161. {
  162. case VK_RETURN:
  163. OnButton1();
  164. return 1;
  165. case 0x43: // copy
  166. if ((GetKeyState(VK_CONTROL) & 0x80))
  167. {
  168. GetFocus()->SendMessage(WM_COPY);
  169. return TRUE;
  170. }
  171. break;
  172. case 0x56: //Ctrl + V:
  173. if ((GetKeyState(VK_CONTROL) & 0x80))
  174. {
  175. GetFocus()->SendMessage(WM_PASTE);
  176. return TRUE;
  177. }
  178. break;
  179. case 0x58: // cut
  180. if ((GetKeyState(VK_CONTROL) & 0x80))
  181. {
  182. GetFocus()->SendMessage(WM_CUT);
  183. return TRUE;
  184. }
  185. break;
  186. case 0x5A: //undo
  187. case 0x59: //redo
  188. if ((GetKeyState(VK_CONTROL) & 0x80))
  189. {
  190. GetFocus()->SendMessage(WM_UNDO);
  191. return TRUE;
  192. }
  193. break;
  194. }
  195. }
  196. return MyFormView::PreTranslateMessage(pMsg);
  197. }
  198. catch (...)
  199. {
  200. }
  201. return TRUE;
  202. }
  203. void PhoneRecord::OnButton1()//客户来电按钮;
  204. {
  205. // TODO: Add your control notification handler code here
  206. UpdateData();
  207. m_filter.TrimLeft();
  208. m_filter.TrimRight();
  209. if (!bLoad1)
  210. {
  211. bLoad1 = 1;
  212. g_sendhead.bsql = 0;
  213. g_sendhead.code[0] = 109;
  214. g_sendhead.tabcount = 1;
  215. g_pMainWnd->ProcessChatMessageRequest2(15); if (g_bSendOK == 0)return;
  216. DataToArray(&m_List1array);
  217. }
  218. FillGrid();
  219. }
  220. void PhoneRecord::OnButton2()//意向客户来电按钮;
  221. {
  222. // TODO: Add your control notification handler code here
  223. UpdateData();
  224. m_filter.TrimLeft();
  225. m_filter.TrimRight();
  226. if (!bLoad2)
  227. {
  228. bLoad2 = 1;
  229. g_sendhead.bsql = 0;
  230. g_sendhead.code[0] = 110;
  231. g_sendhead.tabcount = 1;
  232. g_pMainWnd->ProcessChatMessageRequest2(15); if (g_bSendOK == 0)return;
  233. DataToArray(&m_List2array);
  234. }
  235. FillGrid2();
  236. }
  237. void PhoneRecord::OnButton3()//员工电话按钮;
  238. {
  239. // TODO: Add your control notification handler code here
  240. UpdateData();
  241. m_filter.TrimLeft();
  242. m_filter.TrimRight();
  243. if (!bLoad3)
  244. {
  245. bLoad3 = 1;
  246. g_sendhead.bsql = 0;
  247. g_sendhead.code[0] = 111;
  248. g_sendhead.tabcount = 1;
  249. g_pMainWnd->ProcessChatMessageRequest2(15); if (g_bSendOK == 0)return;
  250. DataToArray(&m_List3array);
  251. }
  252. FillGrid3();
  253. }
  254. void PhoneRecord::OnButton10()//其他电话按钮;
  255. {
  256. // TODO: Add your control notification handler code here
  257. UpdateData();
  258. if (!bLoad4)
  259. {
  260. bLoad4 = 1;
  261. g_sendhead.bsql = 0;
  262. g_sendhead.code[0] = 112;
  263. g_sendhead.tabcount = 1;
  264. g_pMainWnd->ProcessChatMessageRequest2(15); if (g_bSendOK == 0)return;
  265. DataToArray(&m_List4array);
  266. }
  267. FillGrid4();
  268. }
  269. void PhoneRecord::FillGrid(int mode)
  270. {
  271. m_List1.ShowWindow(SW_SHOW);
  272. m_List2.ShowWindow(SW_HIDE);
  273. m_List3.ShowWindow(SW_HIDE);
  274. m_List4.ShowWindow(SW_HIDE);
  275. m_List5.ShowWindow(SW_HIDE);
  276. m_List1.DeleteAllItems2();
  277. int ii = 0;
  278. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  279. int count = 0;
  280. if (m_filter.IsEmpty())
  281. {
  282. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  283. {
  284. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  285. }
  286. }
  287. else
  288. {
  289. int type = GetType(m_filter);
  290. if (type == 1)//电话
  291. {
  292. BOOL bFinded = 0;
  293. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  294. {
  295. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  296. {
  297. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  298. continue;
  299. }
  300. if (m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1\
  301. || m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1)
  302. {
  303. bFinded = 1;
  304. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  305. }
  306. else
  307. {
  308. bFinded = 0;
  309. }
  310. }
  311. }
  312. else if (type == 2)//拼音
  313. {
  314. BOOL bFinded = 0;
  315. m_filter.MakeUpper();
  316. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  317. {
  318. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  319. {
  320. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  321. continue;
  322. }
  323. if (m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1\
  324. || m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1)
  325. {
  326. bFinded = 1;
  327. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  328. }
  329. else
  330. {
  331. bFinded = 0;
  332. }
  333. }
  334. }
  335. else
  336. {
  337. BOOL bFinded = 0;
  338. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  339. {
  340. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  341. {
  342. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  343. continue;
  344. }
  345. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1\
  346. || m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1\
  347. || m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1\
  348. || m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1)
  349. {
  350. bFinded = 1;
  351. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  352. }
  353. else
  354. {
  355. bFinded = 0;
  356. }
  357. }
  358. }
  359. }
  360. m_List1.m_arLabels.SetSize(count, 1);
  361. ii = count;
  362. m_List1.m_LabelCount = ii;
  363. m_List1.SetItemCountEx(ii);
  364. }
  365. void PhoneRecord::FillGrid2()
  366. {
  367. m_List2.ShowWindow(SW_SHOW);
  368. m_List1.ShowWindow(SW_HIDE);
  369. m_List3.ShowWindow(SW_HIDE);
  370. m_List4.ShowWindow(SW_HIDE);
  371. m_List5.ShowWindow(SW_HIDE);
  372. m_List2.DeleteAllItems2();
  373. int ii = 0;
  374. m_List2.m_arLabels.SetSize(m_List2array.GetSize(), 1);
  375. int count = 0;
  376. if (m_filter.IsEmpty())
  377. {
  378. for (ii = 0; ii < m_List2.m_arLabels.GetSize(); ii++)
  379. {
  380. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  381. }
  382. }
  383. else
  384. {
  385. int type = GetType(m_filter);
  386. if (type == 1)//电话
  387. {
  388. BOOL bFinded = 0;
  389. for (ii = 0; ii < m_List2.m_arLabels.GetSize(); ii++)
  390. {
  391. if (bFinded && m_List2array.ElementAt(ii).ElementAt(0).IsEmpty())
  392. {
  393. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  394. continue;
  395. }
  396. if (m_List2array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
  397. {
  398. bFinded = 1;
  399. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  400. }
  401. else
  402. {
  403. bFinded = 0;
  404. }
  405. }
  406. }
  407. else if (type == 2)//拼音
  408. {
  409. BOOL bFinded = 0;
  410. m_filter.MakeUpper();
  411. for (ii = 0; ii < m_List2.m_arLabels.GetSize(); ii++)
  412. {
  413. if (bFinded && m_List2array.ElementAt(ii).ElementAt(0).IsEmpty())
  414. {
  415. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  416. continue;
  417. }
  418. if (m_List2array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1)
  419. {
  420. bFinded = 1;
  421. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  422. }
  423. else
  424. {
  425. bFinded = 0;
  426. }
  427. }
  428. }
  429. else
  430. {
  431. BOOL bFinded = 0;
  432. for (ii = 0; ii < m_List2.m_arLabels.GetSize(); ii++)
  433. {
  434. if (bFinded && m_List2array.ElementAt(ii).ElementAt(0).IsEmpty())
  435. {
  436. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  437. continue;
  438. }
  439. if (m_List2array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || m_List2array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || m_List2array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || m_List2array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1)
  440. {
  441. bFinded = 1;
  442. m_List2.m_arLabels.ElementAt(count++).Copy(m_List2array.ElementAt(ii));
  443. }
  444. else
  445. {
  446. bFinded = 0;
  447. }
  448. }
  449. }
  450. }
  451. m_List2.m_arLabels.SetSize(count, 1);
  452. ii = count;
  453. m_List2.m_LabelCount = ii;
  454. m_List2.SetItemCountEx(ii);
  455. }
  456. void PhoneRecord::FillGrid3()
  457. {
  458. m_List3.ShowWindow(SW_SHOW);
  459. m_List1.ShowWindow(SW_HIDE);
  460. m_List2.ShowWindow(SW_HIDE);
  461. m_List4.ShowWindow(SW_HIDE);
  462. m_List5.ShowWindow(SW_HIDE);
  463. m_List3.DeleteAllItems2();
  464. int ii = 0;
  465. m_List3.m_arLabels.SetSize(m_List3array.GetSize(), 1);
  466. int count = 0;
  467. if (m_filter.IsEmpty())
  468. {
  469. for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++)
  470. {
  471. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  472. }
  473. }
  474. else
  475. {
  476. int type = GetType(m_filter);
  477. if (type == 1)//电话
  478. {
  479. BOOL bFinded = 0;
  480. for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++)
  481. {
  482. if (bFinded && m_List3array.ElementAt(ii).ElementAt(0).IsEmpty())
  483. {
  484. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  485. continue;
  486. }
  487. if (m_List3array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1)
  488. {
  489. bFinded = 1;
  490. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  491. }
  492. else
  493. {
  494. bFinded = 0;
  495. }
  496. }
  497. }
  498. else
  499. {
  500. BOOL bFinded = 0;
  501. for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++)
  502. {
  503. if (bFinded && m_List3array.ElementAt(ii).ElementAt(0).IsEmpty())
  504. {
  505. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  506. continue;
  507. }
  508. if (m_List3array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || m_List3array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || m_List3array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
  509. {
  510. bFinded = 1;
  511. m_List3.m_arLabels.ElementAt(count++).Copy(m_List3array.ElementAt(ii));
  512. }
  513. else
  514. {
  515. bFinded = 0;
  516. }
  517. }
  518. }
  519. }
  520. m_List3.m_arLabels.SetSize(count, 1);
  521. ii = count;
  522. m_List3.m_LabelCount = ii;
  523. m_List3.SetItemCountEx(ii);
  524. }
  525. void PhoneRecord::FillGrid4()
  526. {
  527. m_List4.ShowWindow(SW_SHOW);
  528. m_List1.ShowWindow(SW_HIDE);
  529. m_List2.ShowWindow(SW_HIDE);
  530. m_List3.ShowWindow(SW_HIDE);
  531. m_List5.ShowWindow(SW_HIDE);
  532. m_List4.DeleteAllItems2();
  533. int ii = 0;
  534. m_List4.m_arLabels.SetSize(m_List4array.GetSize(), 1);
  535. int count = 0;
  536. if (m_filter.IsEmpty())
  537. {
  538. for (ii = 0; ii < m_List4.m_arLabels.GetSize(); ii++)
  539. {
  540. m_List4.m_arLabels.ElementAt(count++).Copy(m_List4array.ElementAt(ii));
  541. }
  542. }
  543. else
  544. {
  545. for (ii = 0; ii < m_List4.m_arLabels.GetSize(); ii++)
  546. {
  547. if (m_List4array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  548. m_List4array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1)
  549. {
  550. m_List4.m_arLabels.ElementAt(count++).Copy(m_List4array.ElementAt(ii));
  551. }
  552. }
  553. }
  554. m_List4.m_arLabels.SetSize(count, 1);
  555. ii = count;
  556. m_List4.m_LabelCount = ii;
  557. m_List4.SetItemCountEx(ii);
  558. }
  559. void PhoneRecord::OnButton4()//录音回调按钮;
  560. {
  561. // TODO: Add your control notification handler code here
  562. if (m_List1.IsWindowVisible())
  563. {
  564. POSITION pos;
  565. pos = m_List1.GetFirstSelectedItemPosition();
  566. if (pos == NULL)
  567. {
  568. AfxMessageBox("请先选中您要回放的录音!", MB_ICONINFORMATION);
  569. return;
  570. }
  571. int iItem = m_List1.GetNextSelectedItem(pos);
  572. CString id = m_List1.GetItemText(iItem, 0);
  573. CString datetime = m_List1.GetItemText(iItem, 6);
  574. datetime.Replace(":", "");
  575. CString path = g_path6 + "\\客户电话\\" + id + "\\" + datetime + ".mp3";
  576. if (::PathFileExists(path) == 0)
  577. path = g_path6 + "\\客户电话\\" + id + "\\" + datetime + ".wav";
  578. if (PathFileExists(path))
  579. {
  580. CAVIPlayerDlg dlg;
  581. dlg.m_Path = path;
  582. dlg.DoModal();
  583. }
  584. else
  585. AfxMessageBox("文件未找到!", MB_ICONINFORMATION);
  586. }
  587. if (m_List2.IsWindowVisible())
  588. {
  589. POSITION pos;
  590. pos = m_List2.GetFirstSelectedItemPosition();
  591. if (pos == NULL)
  592. {
  593. AfxMessageBox("请先选中您要回放的录音!", MB_ICONINFORMATION);
  594. return;
  595. }
  596. int iItem = m_List2.GetNextSelectedItem(pos);
  597. CString phone = m_List2.GetItemText(iItem, 2);
  598. CString datetime = m_List2.GetItemText(iItem, 3);
  599. datetime.Replace(":", "");
  600. CString path = g_path6 + "\\意向客户\\" + phone + "\\" + datetime + ".mp3";
  601. if (PathFileExists(path) == 0)
  602. path = g_path6 + "\\意向客户\\" + phone + "\\" + datetime + ".wav";
  603. if (PathFileExists(path))
  604. {
  605. CAVIPlayerDlg dlg;
  606. dlg.m_Path = path;
  607. dlg.DoModal();
  608. }
  609. else
  610. AfxMessageBox("文件未找到!", MB_ICONINFORMATION);
  611. }
  612. if (m_List3.IsWindowVisible())
  613. {
  614. POSITION pos;
  615. pos = m_List3.GetFirstSelectedItemPosition();
  616. if (pos == NULL)
  617. {
  618. AfxMessageBox("请先选中您要回放的录音!", MB_ICONINFORMATION);
  619. return;
  620. }
  621. int iItem = m_List3.GetNextSelectedItem(pos);
  622. CString name = m_List3.GetItemText(iItem, 0);
  623. CString datetime = m_List3.GetItemText(iItem, 2);
  624. datetime.Replace(":", "");
  625. CString path = g_path6 + "\\员工电话\\" + name + "\\" + datetime + ".mp3";
  626. if (PathFileExists(path) == 0)
  627. path = g_path6 + "\\员工电话\\" + name + "\\" + datetime + ".wav";
  628. if (PathFileExists(path))
  629. {
  630. CAVIPlayerDlg dlg;
  631. dlg.m_Path = path;
  632. dlg.DoModal();
  633. }
  634. else
  635. AfxMessageBox("文件未找到!", MB_ICONINFORMATION);
  636. }
  637. if (m_List4.IsWindowVisible())
  638. {
  639. POSITION pos;
  640. pos = m_List4.GetFirstSelectedItemPosition();
  641. if (pos == NULL)
  642. {
  643. AfxMessageBox("请先选中您要回放的录音!", MB_ICONINFORMATION);
  644. return;
  645. }
  646. int iItem = m_List4.GetNextSelectedItem(pos);
  647. CString phone = m_List4.GetItemText(iItem, 0);
  648. CString datetime = m_List4.GetItemText(iItem, 1);
  649. datetime.Replace(":", "");
  650. CString path = g_path6 + "\\未知电话\\" + phone + "\\" + datetime + ".mp3";
  651. if (PathFileExists(path) == 0)
  652. path = g_path6 + "\\未知电话\\" + phone + "\\" + datetime + ".wav";
  653. if (PathFileExists(path))
  654. {
  655. CAVIPlayerDlg dlg;
  656. dlg.m_Path = path;
  657. dlg.DoModal();
  658. }
  659. else
  660. AfxMessageBox("文件未找到!", MB_ICONINFORMATION);
  661. }
  662. if (m_List5.IsWindowVisible())
  663. {
  664. POSITION pos;
  665. pos = m_List5.GetFirstSelectedItemPosition();
  666. if (pos == NULL)
  667. {
  668. AfxMessageBox("请先选中您要回放的录音!", MB_ICONINFORMATION);
  669. return;
  670. }
  671. int iItem = m_List5.GetNextSelectedItem(pos);
  672. CString phone = m_List5.GetItemText(iItem, 1);
  673. CString datetime = m_List5.GetItemText(iItem, 2);
  674. datetime.Replace(":", "");
  675. CString path = g_path6 + "\\老客户\\" + phone + "\\" + datetime + ".mp3";
  676. if (PathFileExists(path) == 0)
  677. path = g_path6 + "\\老客户\\" + phone + "\\" + datetime + ".wav";
  678. if (PathFileExists(path))
  679. {
  680. CAVIPlayerDlg dlg;
  681. dlg.m_Path = path;
  682. dlg.DoModal();
  683. }
  684. else
  685. AfxMessageBox("文件未找到!", MB_ICONINFORMATION);
  686. }
  687. }
  688. void PhoneRecord::OnBUTdel2()//删除按钮;
  689. {
  690. // TODO: Add your control notification handler code here
  691. if (IsHasRights2new(49) == 0)return;
  692. // TODO: Add your control notification handler code here
  693. if (m_List1.IsWindowVisible())
  694. {
  695. POSITION pos;
  696. pos = m_List1.GetFirstSelectedItemPosition();
  697. if (pos == NULL)
  698. {
  699. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  700. return;
  701. }
  702. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  703. int iItem = m_List1.GetNextSelectedItem(pos);
  704. CString datetime = m_List1.GetItemText(iItem, 6);
  705. CString id = m_List1.GetItemText(iItem, 0);
  706. CString sql;
  707. sql.Format("delete from phonerecord where datetime='%s' ", datetime);
  708. g_sendhead.bsql = 1;
  709. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  710. datetime.Replace(":", "");
  711. CString path = g_path6 + "\\客户电话\\" + id + "\\" + datetime + ".mp3";
  712. ::DeleteFile(path); // 删除客户电话目录下的mp3;
  713. path = g_path6 + "\\客户电话\\" + id + "\\" + datetime + ".wav";
  714. ::DeleteFile(path); // 删除客户电话目录下的.wav;
  715. bLoad1 = 0;
  716. OnButton1();
  717. }
  718. if (m_List2.IsWindowVisible())
  719. {
  720. POSITION pos;
  721. pos = m_List2.GetFirstSelectedItemPosition();
  722. if (pos == NULL)
  723. {
  724. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  725. return;
  726. }
  727. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  728. int iItem = m_List2.GetNextSelectedItem(pos);
  729. CString datetime = m_List2.GetItemText(iItem, 3);
  730. CString phone = m_List2.GetItemText(iItem, 2);
  731. CString sql;
  732. sql.Format("delete from client2phonerecord where datetime='%s' ", datetime);
  733. g_sendhead.bsql = 1;
  734. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  735. datetime.Replace(":", "");
  736. CString path = g_path6 + "\\意向客户\\" + phone + "\\" + datetime + ".mp3";
  737. ::DeleteFile(path); // 删除客户电话目录下的mp3;
  738. path = g_path6 + "\\意向客户\\" + phone + "\\" + datetime + ".wav";
  739. ::DeleteFile(path); // 删除客户电话目录下的.wav;
  740. bLoad2 = 0;
  741. OnButton2();
  742. }
  743. if (m_List3.IsWindowVisible())
  744. {
  745. POSITION pos;
  746. pos = m_List3.GetFirstSelectedItemPosition();
  747. if (pos == NULL)
  748. {
  749. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  750. return;
  751. }
  752. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  753. int iItem = m_List3.GetNextSelectedItem(pos);
  754. CString datetime = m_List3.GetItemText(iItem, 2);
  755. CString name = m_List3.GetItemText(iItem, 0);
  756. CString sql;
  757. sql.Format("delete from employeephonerecord where datetime='%s' ", datetime);
  758. g_sendhead.bsql = 1;
  759. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  760. datetime.Replace(":", "");
  761. CString path = g_path6 + "\\员工电话\\" + name + "\\" + datetime + ".mp3";
  762. ::DeleteFile(path); // 删除客户电话目录下的mp3;
  763. path = g_path6 + "\\员工电话\\" + name + "\\" + datetime + ".wav";
  764. ::DeleteFile(path); // 删除客户电话目录下的.wav;
  765. bLoad3 = 0;
  766. OnButton3();
  767. }
  768. if (m_List4.IsWindowVisible())
  769. {
  770. POSITION pos;
  771. pos = m_List4.GetFirstSelectedItemPosition();
  772. if (pos == NULL)
  773. {
  774. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  775. return;
  776. }
  777. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  778. int iItem = m_List4.GetNextSelectedItem(pos);
  779. CString datetime = m_List4.GetItemText(iItem, 1);
  780. CString phone = m_List4.GetItemText(iItem, 0);
  781. CString sql;
  782. sql.Format("delete from unknownphonerecord where datetime='%s' ", datetime);
  783. g_sendhead.bsql = 1;
  784. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  785. datetime.Replace(":", "");
  786. CString path = g_path6 + "\\未知电话\\" + phone + "\\" + datetime + ".mp3";
  787. ::DeleteFile(path); // 删除客户电话目录下的mp3;
  788. path = g_path6 + "\\未知电话\\" + phone + "\\" + datetime + ".wav";
  789. ::DeleteFile(path); // 删除客户电话目录下的.wav;
  790. bLoad4 = 0;
  791. OnButton10();
  792. }
  793. if (m_List5.IsWindowVisible())
  794. {
  795. POSITION pos;
  796. pos = m_List5.GetFirstSelectedItemPosition();
  797. if (pos == NULL)
  798. {
  799. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  800. return;
  801. }
  802. if (AfxMessageBox("删除后将无法恢复,是否继续?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  803. int iItem = m_List5.GetNextSelectedItem(pos);
  804. CString datetime = m_List5.GetItemText(iItem, 2);
  805. CString phone = m_List5.GetItemText(iItem, 1);
  806. CString sql;
  807. sql.Format("delete from client3phonerecord where datetime='%s' ", datetime);
  808. g_sendhead.bsql = 1;
  809. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  810. datetime.Replace(":", "");
  811. CString path = g_path6 + "\\老客户\\" + phone + "\\" + datetime + ".mp3";
  812. ::DeleteFile(path); // 删除客户电话目录下的mp3;
  813. path = g_path6 + "\\老客户\\" + phone + "\\" + datetime + ".wav";
  814. ::DeleteFile(path); // 删除客户电话目录下的.wav;
  815. bLoad5 = 0;
  816. OnButton6();
  817. }
  818. }
  819. void PhoneRecord::OnButton6()//老客户来电按钮;
  820. {
  821. // TODO: Add your control notification handler code here
  822. UpdateData();
  823. m_filter.TrimLeft();
  824. m_filter.TrimRight();
  825. if (!bLoad5)
  826. {
  827. bLoad5 = 1;
  828. g_sendhead.bsql = 0;
  829. g_sendhead.code[0] = 175;
  830. g_sendhead.tabcount = 1;
  831. g_pMainWnd->ProcessChatMessageRequest2(15); if (g_bSendOK == 0)return;
  832. DataToArray(&m_List5array);
  833. }
  834. FillGrid5();
  835. }
  836. void PhoneRecord::FillGrid5()
  837. {
  838. m_List5.ShowWindow(SW_SHOW);
  839. m_List1.ShowWindow(SW_HIDE);
  840. m_List2.ShowWindow(SW_HIDE);
  841. m_List4.ShowWindow(SW_HIDE);
  842. m_List3.ShowWindow(SW_HIDE);
  843. m_List5.DeleteAllItems2();
  844. int ii = 0;
  845. m_List5.m_arLabels.SetSize(m_List5array.GetSize(), 1);
  846. int count = 0;
  847. if (m_filter.IsEmpty())
  848. {
  849. for (ii = 0; ii < m_List5.m_arLabels.GetSize(); ii++)
  850. {
  851. m_List5.m_arLabels.ElementAt(count++).Copy(m_List5array.ElementAt(ii));
  852. }
  853. }
  854. else
  855. {
  856. int type = GetType(m_filter);
  857. if (type == 1)//电话
  858. {
  859. BOOL bFinded = 0;
  860. for (ii = 0; ii < m_List5.m_arLabels.GetSize(); ii++)
  861. {
  862. if (bFinded && m_List5array.ElementAt(ii).ElementAt(0).IsEmpty())
  863. {
  864. m_List5.m_arLabels.ElementAt(count++).Copy(m_List5array.ElementAt(ii));
  865. continue;
  866. }
  867. if (m_List5array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1)
  868. {
  869. bFinded = 1;
  870. m_List5.m_arLabels.ElementAt(count++).Copy(m_List5array.ElementAt(ii));
  871. }
  872. else
  873. {
  874. bFinded = 0;
  875. }
  876. }
  877. }
  878. else
  879. {
  880. BOOL bFinded = 0;
  881. for (ii = 0; ii < m_List5.m_arLabels.GetSize(); ii++)
  882. {
  883. if (bFinded && m_List5array.ElementAt(ii).ElementAt(0).IsEmpty())
  884. {
  885. m_List5.m_arLabels.ElementAt(count++).Copy(m_List5array.ElementAt(ii));
  886. continue;
  887. }
  888. if (m_List5array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || m_List5array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || m_List5array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
  889. {
  890. bFinded = 1;
  891. m_List5.m_arLabels.ElementAt(count++).Copy(m_List5array.ElementAt(ii));
  892. }
  893. else
  894. {
  895. bFinded = 0;
  896. }
  897. }
  898. }
  899. }
  900. m_List5.m_arLabels.SetSize(count, 1);
  901. ii = count;
  902. m_List5.m_LabelCount = ii;
  903. m_List5.SetItemCountEx(ii);
  904. }