WorkMsg.cpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. // WorkMsg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "WorkMsg.h"
  6. #include "MyMdi.H"
  7. #include "SendMsgDlg.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // WorkMsg
  15. IMPLEMENT_DYNCREATE(WorkMsg, MyFormView)
  16. WorkMsg::WorkMsg()
  17. : MyFormView(WorkMsg::IDD)
  18. {
  19. //{{AFX_DATA_INIT(WorkMsg)
  20. m_filter = _T("");
  21. //}}AFX_DATA_INIT
  22. m_mode=0;
  23. }
  24. WorkMsg::~WorkMsg()
  25. {
  26. }
  27. void WorkMsg::DoDataExchange(CDataExchange* pDX)
  28. {
  29. MyFormView::DoDataExchange(pDX);
  30. //{{AFX_DATA_MAP(WorkMsg)
  31. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  32. DDX_Control(pDX, IDC_LIST2, m_List1);
  33. DDX_Control(pDX, IDC_STATIC1, m_static1);
  34. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  35. //}}AFX_DATA_MAP
  36. }
  37. BEGIN_MESSAGE_MAP(WorkMsg, MyFormView)
  38. //{{AFX_MSG_MAP(WorkMsg)
  39. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  40. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  41. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  42. ON_WM_TIMER()
  43. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  44. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  45. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  46. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  47. ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
  48. ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
  49. //}}AFX_MSG_MAP
  50. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // WorkMsg diagnostics
  54. #ifdef _DEBUG
  55. void WorkMsg::AssertValid() const
  56. {
  57. MyFormView::AssertValid();
  58. }
  59. void WorkMsg::Dump(CDumpContext& dc) const
  60. {
  61. MyFormView::Dump(dc);
  62. }
  63. #endif //_DEBUG
  64. /////////////////////////////////////////////////////////////////////////////
  65. // WorkMsg message handlers
  66. void WorkMsg::OnInitialUpdate()
  67. {
  68. MyFormView::OnInitialUpdate();
  69. // TODO: Add your specialized code here and/or call the base class
  70. CMyMdi Mdi;
  71. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  72. // Here we create the outbar control using the splitter as its parent
  73. // and setting its id to the first pane.
  74. CRect rc2;
  75. GetWindowRect(rc2);
  76. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  77. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  78. m_static1.SetFont (&g_titlefont);
  79. #ifdef CHILD_VERSION
  80. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;手机,100;固定电话,100;拍照,50;初修,50;选片,50;设计,50;看设计,50;是否完成,80;取件,50;预约时间,100;拍照时间,100;选片时间,100;看设计时间,100;取件时间,100;接单人,100;套系名称,100;套系价格,100" );
  81. #else
  82. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;男宾电话,100;女宾电话,100;拍照,50;初修,50;选片,50;设计,50;看设计,50;是否完成,80;取件,50;预约时间,100;拍照时间,100;选片时间,100;看设计时间,100;取件时间,100;接单人,100;套系名称,100;套系价格,100" );
  83. #endif
  84. m_List1.LoadColumnInfo (146);
  85. #ifdef LKAY_VERSION
  86. GetDlgItem(IDC_BUTTON3)->SetWindowText("预约未拍");
  87. GetDlgItem(IDC_BUTTON10)->ShowWindow(SW_SHOW);
  88. int idarray[]={IDC_BUTTON1,IDC_BUTTON3,IDC_BUTTON10,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6};
  89. int idcount=6;
  90. if(IsHasRights2new(53)==0)
  91. {
  92. GetDlgItem(IDC_BUTTON1)->EnableWindow(0);
  93. GetDlgItem(IDC_BUTTON4)->EnableWindow(0);
  94. GetDlgItem(IDC_BUTTON5)->EnableWindow(0);
  95. GetDlgItem(IDC_BUTTON6)->EnableWindow(0);
  96. }
  97. #else
  98. int idarray[]={IDC_BUTTON1,IDC_BUTTON3,IDC_BUTTON4,IDC_BUTTON5,IDC_BUTTON6};
  99. int idcount=5;
  100. #endif
  101. int btnwid;
  102. CRect prerc;
  103. for(int a=1; a<idcount; a++)
  104. {
  105. GetDlgItem(idarray[a-1])->GetWindowRect (prerc);
  106. ScreenToClient(prerc);
  107. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  108. ScreenToClient(rc2);
  109. btnwid=rc2.Width ();
  110. rc2.left =prerc.right ;
  111. rc2.right =rc2.left+btnwid;
  112. GetDlgItem(idarray[a])->MoveWindow (rc2);
  113. }
  114. if(g_bShowOK==0)
  115. {
  116. CString filter="status3='未取'";
  117. g_sendhead.bsql=0;
  118. g_sendhead.code[0]=95;
  119. g_sendhead.tabcount=1;
  120. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  121. }
  122. else
  123. {
  124. g_sendhead.bsql=0;
  125. g_sendhead.code[0]=95;
  126. g_sendhead.tabcount=1;
  127. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  128. }
  129. DataToArray(&m_List1array);
  130. FillGrid();
  131. m_combo1.GetWindowRect (rc2);
  132. ScreenToClient(rc2);
  133. rc2.bottom +=200;
  134. m_combo1.MoveWindow (rc2);
  135. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  136. SetComboHei(&m_combo1, rc2.Height ());
  137. }
  138. void WorkMsg::FillGrid(int mode)
  139. {
  140. GetDlgItem(IDC_BUTTON2)->EnableWindow(mode);
  141. #ifdef LKAY_VERSION
  142. if(IsHasRights2new(53)==0)
  143. {
  144. mode=4;
  145. }
  146. #endif
  147. m_mode=mode;
  148. UpdateData();
  149. m_List1.DeleteAllItems2 ();
  150. int ii=0;
  151. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  152. int count=0;
  153. if(m_filter.IsEmpty ())
  154. {
  155. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  156. {
  157. if(mode==1)
  158. {
  159. if(m_List1array.ElementAt (ii).ElementAt (5)=="OK"&&m_List1array.ElementAt (ii).ElementAt (7)!="OK")
  160. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  161. }
  162. else if(mode==2)
  163. {
  164. if(m_List1array.ElementAt (ii).ElementAt (8)=="OK"&&m_List1array.ElementAt (ii).ElementAt (9)!="OK")
  165. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  166. }
  167. else if(mode==3)
  168. {
  169. if(m_List1array.ElementAt (ii).ElementAt (10)=="OK"&&m_List1array.ElementAt (ii).ElementAt (11)!="OK")
  170. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  171. }
  172. #ifdef LKAY_VERSION
  173. else if(mode==4)
  174. {
  175. if(m_List1array.ElementAt (ii).ElementAt (5)=="未拍" && m_List1array.ElementAt (ii).ElementAt (27)=="预约客户")
  176. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  177. }
  178. else if(mode==5)
  179. {
  180. if(m_List1array.ElementAt (ii).ElementAt (5)=="未拍" && m_List1array.ElementAt (ii).ElementAt (27)=="定金客户")
  181. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  182. }
  183. #else
  184. else if(mode==4)
  185. {
  186. if(m_List1array.ElementAt (ii).ElementAt (5)=="未拍")
  187. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  188. }
  189. #endif
  190. else
  191. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  192. }
  193. }
  194. else
  195. {
  196. int type=GetType(m_filter);
  197. if(type==1)//电话
  198. {
  199. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  200. {
  201. if(m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  202. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1)
  203. {
  204. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  205. }
  206. }
  207. }
  208. else if(type==2)//拼音
  209. {
  210. m_filter.MakeUpper ();
  211. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  212. {
  213. if(m_List1array.ElementAt (ii).ElementAt (20).Find (m_filter)!=-1 || \
  214. m_List1array.ElementAt (ii).ElementAt (21).Find (m_filter)!=-1)
  215. {
  216. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  217. }
  218. }
  219. }
  220. else
  221. {
  222. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  223. {
  224. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 || \
  225. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 ||\
  226. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 ||\
  227. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 ||\
  228. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 ||\
  229. m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1 ||\
  230. m_List1array.ElementAt (ii).ElementAt (6).Find (m_filter)!=-1 ||\
  231. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1 ||\
  232. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1)
  233. {
  234. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  235. }
  236. }
  237. }
  238. }
  239. m_List1.m_arLabels.SetSize(count, 1);
  240. ii=count;
  241. m_List1.m_LabelCount=ii;
  242. m_List1.SetItemCountEx (ii);
  243. }
  244. void WorkMsg::OnBUTclose()
  245. {
  246. // TODO: Add your control notification handler code here
  247. GetParent()->SendMessage(WM_CLOSE);
  248. }
  249. void WorkMsg::OnSelchangeCombo1()
  250. {
  251. // TODO: Add your control notification handler code here
  252. SetTimer(1, 100, NULL);
  253. }
  254. void WorkMsg::OnTimer(UINT nIDEvent)
  255. {
  256. // TODO: Add your message handler code here and/or call default
  257. KillTimer(nIDEvent);
  258. OnButton1();
  259. }
  260. BOOL WorkMsg::PreTranslateMessage(MSG* pMsg)
  261. {
  262. // TODO: Add your specialized code here and/or call the base class
  263. try
  264. {
  265. if(pMsg->message==WM_KEYDOWN)
  266. {
  267. switch (pMsg->wParam)
  268. {
  269. case VK_RETURN:
  270. OnButton1();
  271. return 1;
  272. case 0x43: // copy
  273. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  274. {
  275. GetFocus()->SendMessage(WM_COPY);
  276. return TRUE;
  277. }
  278. break;
  279. case 0x56: //Ctrl + V:
  280. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  281. {
  282. GetFocus()->SendMessage(WM_PASTE);
  283. return TRUE;
  284. }
  285. break;
  286. case 0x58: // cut
  287. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  288. {
  289. GetFocus()->SendMessage(WM_CUT);
  290. return TRUE;
  291. }
  292. break;
  293. case 0x5A: //undo
  294. case 0x59: //redo
  295. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  296. {
  297. GetFocus()->SendMessage(WM_UNDO);
  298. return TRUE;
  299. }
  300. break;
  301. }
  302. }
  303. return MyFormView::PreTranslateMessage(pMsg);
  304. }
  305. catch(...)
  306. {
  307. }
  308. return TRUE;
  309. }
  310. void WorkMsg::OnButton2()
  311. {
  312. // TODO: Add your control notification handler code here
  313. POSITION pos;
  314. pos=m_List1.GetFirstSelectedItemPosition();
  315. if(pos==NULL)
  316. {
  317. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  318. return;
  319. }
  320. int iItem;
  321. CStringArray array;
  322. CStringArray idarray;
  323. while (pos)
  324. {
  325. iItem = m_List1.GetNextSelectedItem(pos);
  326. idarray.Add (m_List1.GetItemText (iItem, 0));
  327. array.Add (m_List1.GetItemText (iItem, 3));
  328. #ifndef CHILD_VERSION
  329. array.Add (m_List1.GetItemText (iItem, 4));
  330. #endif
  331. }
  332. SendMsgDlg dlg;
  333. dlg.m_sendmode=m_mode;
  334. dlg.m_pArray=&array;
  335. dlg.m_pIdArray=&idarray;
  336. dlg.DoModal ();
  337. if(g_bShowOK==0)
  338. {
  339. CString filter="status3='未取'";
  340. g_sendhead.bsql=0;
  341. g_sendhead.code[0]=95;
  342. g_sendhead.tabcount=1;
  343. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  344. }
  345. else
  346. {
  347. g_sendhead.bsql=0;
  348. g_sendhead.code[0]=95;
  349. g_sendhead.tabcount=1;
  350. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  351. }
  352. DataToArray(&m_List1array);
  353. FillGrid(m_mode);
  354. }
  355. void WorkMsg::OnButton1()
  356. {
  357. // TODO: Add your control notification handler code here
  358. UpdateData();
  359. m_filter.TrimLeft ();
  360. m_filter.TrimRight ();
  361. FillGrid();
  362. }
  363. void WorkMsg::OnButton4()
  364. {
  365. // TODO: Add your control notification handler code here
  366. UpdateData();
  367. m_filter.TrimLeft ();
  368. m_filter.TrimRight ();
  369. FillGrid(1);
  370. }
  371. void WorkMsg::OnButton5()
  372. {
  373. // TODO: Add your control notification handler code here
  374. UpdateData();
  375. m_filter.TrimLeft ();
  376. m_filter.TrimRight ();
  377. FillGrid(2);
  378. }
  379. void WorkMsg::OnButton6()
  380. {
  381. // TODO: Add your control notification handler code here
  382. UpdateData();
  383. m_filter.TrimLeft ();
  384. m_filter.TrimRight ();
  385. FillGrid(3);
  386. }
  387. void WorkMsg::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  388. {
  389. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  390. // Take the default processing unless we set this to something else below.
  391. *pResult = 0;
  392. // First thing - check the draw stage. If it's the control's prepaint
  393. // stage, then tell Windows we want messages for every item.
  394. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  395. {
  396. *pResult = CDRF_NOTIFYITEMDRAW;
  397. }
  398. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  399. {
  400. // This is the prepaint stage for an item. Here's where we set the
  401. // item's text color. Our return value will tell Windows to draw the
  402. // item itself, but it will use the new color we set here.
  403. // We'll cycle the colors through red, green, and light blue.
  404. if(m_mode)
  405. {
  406. if(m_mode==1 && m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (22)=="1")
  407. pLVCD->clrText = RGB(220,0,0);
  408. else if(m_mode==2 && m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (23)=="1")
  409. pLVCD->clrText = RGB(220,0,0);
  410. else if(m_mode==3 && m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (24)=="1")
  411. pLVCD->clrText = RGB(220,0,0);
  412. else if(m_mode==4 && m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (25)=="1")
  413. pLVCD->clrText = RGB(220,0,0);
  414. else if(m_mode==5 && m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (26)=="1")
  415. pLVCD->clrText = RGB(220,0,0);
  416. else
  417. pLVCD->clrText = RGB(20,133,20);
  418. }
  419. if(pLVCD->nmcd.dwItemSpec%2)
  420. pLVCD->clrTextBk = g_gridcol1;
  421. else
  422. pLVCD->clrTextBk = g_gridcol2;
  423. // Store the color back in the NMLVCUSTOMDRAW struct.
  424. // Tell Windows to paint the control itself.
  425. *pResult = CDRF_DODEFAULT;
  426. }
  427. }
  428. void WorkMsg::OnButton3()
  429. {
  430. // TODO: Add your control notification handler code here
  431. UpdateData();
  432. m_filter.TrimLeft ();
  433. m_filter.TrimRight ();
  434. FillGrid(4);
  435. }
  436. void WorkMsg::OnButton10()
  437. {
  438. // TODO: Add your control notification handler code here
  439. UpdateData();
  440. m_filter.TrimLeft ();
  441. m_filter.TrimRight ();
  442. FillGrid(5);
  443. }