LoginReg.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. // LoginReg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "LoginReg.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "SelWaiter2.h"
  9. #include "TakeStautsSel.h"
  10. #include "LoginSign.h"
  11. #include "ReChargeReg.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. #pragma comment(lib, "Shlwapi.lib")
  18. /////////////////////////////////////////////////////////////////////////////
  19. // LoginReg
  20. IMPLEMENT_DYNCREATE(LoginReg, MyFormView)
  21. LoginReg::LoginReg()
  22. : MyFormView(LoginReg::IDD)
  23. {
  24. //{{AFX_DATA_INIT(LoginReg)
  25. m_filter = _T("");
  26. m_pos=0;
  27. //}}AFX_DATA_INIT
  28. }
  29. LoginReg::~LoginReg()
  30. {
  31. }
  32. void LoginReg::DoDataExchange(CDataExchange* pDX)
  33. {
  34. MyFormView::DoDataExchange(pDX);
  35. //{{AFX_DATA_MAP(LoginReg)
  36. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  37. DDX_Control(pDX, IDC_LIST2, m_List1);
  38. DDX_Control(pDX, IDC_STATIC1, m_static1);
  39. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  40. //}}AFX_DATA_MAP
  41. }
  42. BEGIN_MESSAGE_MAP(LoginReg, MyFormView)
  43. //{{AFX_MSG_MAP(LoginReg)
  44. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  45. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  46. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  47. ON_WM_TIMER()
  48. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  49. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  50. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  51. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  52. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  53. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  54. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  55. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  56. ON_BN_CLICKED(IDC_BUTmoney5, OnBUTmoney5)
  57. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  58. //}}AFX_MSG_MAP
  59. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  60. END_MESSAGE_MAP()
  61. /////////////////////////////////////////////////////////////////////////////
  62. // LoginReg diagnostics
  63. #ifdef _DEBUG
  64. void LoginReg::AssertValid() const
  65. {
  66. MyFormView::AssertValid();
  67. }
  68. void LoginReg::Dump(CDumpContext& dc) const
  69. {
  70. MyFormView::Dump(dc);
  71. }
  72. #endif //_DEBUG
  73. /////////////////////////////////////////////////////////////////////////////
  74. // LoginReg message handlers messageBox
  75. void LoginReg::OnInitialUpdate()
  76. {
  77. MyFormView::OnInitialUpdate();
  78. // TODO: Add your specialized code here and/or call the base class
  79. CMyMdi Mdi;
  80. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  81. if(IsHasRights2new(19)==0)
  82. {
  83. GetDlgItem(IDC_BUTmoney)->EnableWindow(0);
  84. }
  85. // Here we create the outbar control using the splitter as its parent
  86. // and setting its id to the first pane.
  87. CRect rc2;
  88. GetWindowRect(rc2);
  89. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  90. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  91. m_static1.SetFont (&g_titlefont);
  92. m_List1.SetHeadings("姓名,100;星期日,120;星期一,120;星期二,120;星期三,120;星期四,120;星期五,120;星期六,120" );
  93. m_List1.LoadColumnInfo (150);
  94. GetTimeRange();
  95. CenterWindow();
  96. }
  97. int __cdecl CompareByLabel2( const void *elem1, const void *elem2)
  98. {
  99. CStringArray *p1 = (CStringArray*)elem1;
  100. CStringArray *p2 = (CStringArray*)elem2;
  101. return lstrcmp( p1->ElementAt (0), p2->ElementAt (0) ) ;
  102. }
  103. int __cdecl CompareByLabel10( const void *elem1, const void *elem2)
  104. {
  105. CStringArray *p1 = (CStringArray*)elem1;
  106. CStringArray *p2 = (CStringArray*)elem2;
  107. if(p1->ElementAt (10)==p2->ElementAt (10))
  108. {
  109. return lstrcmp( p1->ElementAt (0), p2->ElementAt (0) ) ;
  110. }
  111. return (p1->ElementAt (10)>p2->ElementAt (10)?0:1) ;
  112. return 1;
  113. }
  114. int __cdecl CompareByLabel9( const void *elem1, const void *elem2)
  115. {
  116. CStringArray *p1 = (CStringArray*)elem1;
  117. CStringArray *p2 = (CStringArray*)elem2;
  118. return (p1->ElementAt (10)>p2->ElementAt (10)?0:1) ;
  119. }
  120. void LoginReg::FillGrid()
  121. {
  122. if(!m_List1array.GetSize ())return;
  123. qsort( static_cast<void*>(&m_List1array[0]), m_List1array.GetSize (), sizeof(m_List1array[0]), CompareByLabel9 );
  124. qsort( static_cast<void*>(&m_List1array[0]), m_List1array.GetSize (), sizeof(m_List1array[0]), CompareByLabel10 );
  125. m_List1.DeleteAllItems2 ();
  126. int ii=0;
  127. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  128. int count=0;
  129. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  130. {
  131. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  132. }
  133. m_List1.m_arLabels.SetSize(count, 1);
  134. ii=count;
  135. m_List1.m_LabelCount=ii;
  136. m_List1.SetItemCountEx (ii);
  137. if(!m_curname.IsEmpty ())
  138. {
  139. for(int i=0; i<m_List1.GetItemCount (); i++)
  140. {
  141. if(m_curname==m_List1.GetItemText (i, 0))
  142. {
  143. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  144. m_List1.EnsureVisible(i,FALSE);
  145. break;
  146. }
  147. }
  148. }
  149. }
  150. void LoginReg::OnBUTclose()
  151. {
  152. // TODO: Add your control notification handler code here
  153. GetParent()->SendMessage(WM_CLOSE);
  154. }
  155. void LoginReg::OnSelchangeCombo1()
  156. {
  157. // TODO: Add your control notification handler code here
  158. }
  159. void LoginReg::OnTimer(UINT nIDEvent)
  160. {
  161. // TODO: Add your message handler code here and/or call default
  162. KillTimer(nIDEvent);
  163. }
  164. BOOL LoginReg::PreTranslateMessage(MSG* pMsg)
  165. {
  166. // TODO: Add your specialized code here and/or call the base class
  167. try
  168. {
  169. if(pMsg->message==WM_KEYDOWN)
  170. {
  171. switch (pMsg->wParam)
  172. {
  173. case VK_RETURN:
  174. OnButton1();
  175. return 1;
  176. case 0x43: // copy
  177. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  178. {
  179. GetFocus()->SendMessage(WM_COPY);
  180. return TRUE;
  181. }
  182. break;
  183. case 0x56: //Ctrl + V:
  184. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  185. {
  186. GetFocus()->SendMessage(WM_PASTE);
  187. return TRUE;
  188. }
  189. break;
  190. case 0x58: // cut
  191. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  192. {
  193. GetFocus()->SendMessage(WM_CUT);
  194. return TRUE;
  195. }
  196. break;
  197. case 0x5A: //undo
  198. case 0x59: //redo
  199. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  200. {
  201. GetFocus()->SendMessage(WM_UNDO);
  202. return TRUE;
  203. }
  204. break;
  205. }
  206. }
  207. return MyFormView::PreTranslateMessage(pMsg);
  208. }
  209. catch(...)
  210. {
  211. }
  212. return TRUE;
  213. }
  214. void LoginReg::OnBUTimportphoto()
  215. {
  216. }
  217. void LoginReg::OnBUTshowphoto()
  218. {
  219. }
  220. void LoginReg::OnBUTmoney()
  221. {
  222. // TODO: Add your control notification handler code here
  223. if(IsHasRights2new(19)==0)return;
  224. // TODO: Add your control notification handler code here
  225. UpdateData();
  226. POSITION pos;
  227. pos=m_List1.GetFirstSelectedItemPosition();
  228. if(pos==NULL)
  229. {
  230. AfxMessageBox("请先选中您要签单的员工!", MB_ICONINFORMATION);
  231. return;
  232. }
  233. int iItem=m_List1.GetNextSelectedItem(pos);
  234. CString name=m_List1.GetItemText (iItem, 0);
  235. LoginSign dlg;
  236. dlg.m_name =name;
  237. if(dlg.DoModal ()==IDOK)
  238. {
  239. GetTimeRange();
  240. }
  241. }
  242. void LoginReg::OnBTNaddsp()
  243. {
  244. }
  245. void LoginReg::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  246. {
  247. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  248. // TODO: Add your control notification handler code here
  249. *pResult = 0;
  250. }
  251. void LoginReg::OnButton1()
  252. {
  253. // TODO: Add your control notification handler code here
  254. }
  255. void LoginReg::OnButton2()
  256. {
  257. // TODO: Add your control notification handler code here
  258. }
  259. void LoginReg::ShowLoginData()
  260. {
  261. CString filter="weekname='"+m_weekname+"';datetime>'"+m_scurdate+"' and datetime<'"+m_scurdate2+"';dimission='在职';;[date]>'"+m_scurdate+"' and [date]<'"+m_scurdate2+"'";
  262. g_sendhead.code[0]=107; //排班
  263. g_sendhead.code[1]=108; //打卡记录
  264. g_sendhead.code[2]=5; //人员
  265. g_sendhead.code[3]=97; //班次时间
  266. g_sendhead.code[4]=168; //签单记录
  267. g_sendhead.tabcount=5;
  268. g_sendhead.bsql=0;
  269. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  270. CArray<CStringArray, CStringArray>m_List2array;
  271. CArray<CStringArray, CStringArray>m_List3array;
  272. CArray<CStringArray, CStringArray>m_List4array;
  273. CArray<CStringArray, CStringArray>m_List6array;
  274. DataToArray(&m_List1array,&m_List2array,&m_List3array,&m_List4array,&m_List6array);
  275. CStringArray array;
  276. CString no;
  277. int i = 0;
  278. int a = 0;
  279. for( i=0; i<m_List2array.GetSize (); i++)
  280. {
  281. no=m_List2array.ElementAt (i).ElementAt (0);
  282. int pos=FindArray(&array, no);
  283. if(pos!=-1)
  284. {
  285. m_List2array.ElementAt (i).SetAt (0, array.ElementAt (pos+1));
  286. }
  287. else
  288. {
  289. BOOL bFind=0;
  290. for(int j=0; j<m_List3array.GetSize (); j++)
  291. {
  292. if(no==m_List3array.ElementAt (j).ElementAt (11) || no==m_List3array.ElementAt (j).ElementAt (12))
  293. {
  294. bFind=1;
  295. array.Add (no);
  296. array.Add (m_List3array.ElementAt (j).ElementAt (1));
  297. m_List2array.ElementAt (i).SetAt (0, m_List3array.ElementAt (j).ElementAt (1) ) ;
  298. break;
  299. }
  300. }
  301. }
  302. }
  303. ///////////
  304. for(i=0; i<m_List1array.GetSize (); i++)
  305. {
  306. CString bStr="0";
  307. int ncot=0;
  308. CString name=m_List1array.ElementAt (i).ElementAt (0);
  309. BOOL bExist=0;
  310. for(int j=1; j<=7; j++)
  311. {
  312. CString in,out,time1,time2,time3,time4,in2,out2;
  313. CString ban=m_List1array.ElementAt (i).ElementAt (j);
  314. if(ban!="休息")
  315. {
  316. for( a=0; a<m_List4array.GetSize (); a++)
  317. {
  318. if(ban==m_List4array.ElementAt (a).ElementAt (0))
  319. {
  320. time1=m_List4array.ElementAt (a).ElementAt (1);
  321. time2=m_List4array.ElementAt (a).ElementAt (2);
  322. time3=m_List4array.ElementAt (a).ElementAt (3);
  323. time4=m_List4array.ElementAt (a).ElementAt (4);
  324. break;
  325. }
  326. }
  327. }
  328. CTime tm=m_curtm;
  329. if(j>1)
  330. tm+=CTimeSpan(j-1, 0, 0, 0);
  331. CString date=tm.Format("%Y-%m-%d");
  332. CStringArray array;
  333. for( a=0; a<m_List2array.GetSize (); a++)
  334. {
  335. if(name==m_List2array.ElementAt (a).ElementAt (0) && m_List2array.ElementAt (a).ElementAt (1).Find (date)!=-1)
  336. {
  337. array.Add (m_List2array.ElementAt (a).ElementAt (1));
  338. }
  339. }
  340. if(time3!="")//多时间段
  341. {
  342. int dt1,dt2,dt3,dt4;
  343. for( a=0; a<array.GetSize (); a++)
  344. {
  345. CString datetime=array.ElementAt (a);
  346. datetime=datetime.Mid (11, 5);
  347. // time1
  348. CTime tmcur(2012, 5, 29, atoi(datetime.Left (2)), atoi(datetime.Right(2)), 0);
  349. CTime tm1(2012, 5, 29, atoi(time1.Left (2)), atoi(time1.Right(2)), 0);
  350. CTime tm2(2012, 5, 29, atoi(time2.Left (2)), atoi(time2.Right(2)), 0);
  351. CTime tm3(2012, 5, 29, atoi(time3.Left (2)), atoi(time3.Right(2)), 0);
  352. CTime tm4(2012, 5, 29, atoi(time4.Left (2)), atoi(time4.Right(2)), 0);
  353. CTimeSpan sp;
  354. if(tmcur>tm1)
  355. sp=tmcur-tm1;
  356. else
  357. sp=tm1-tmcur;
  358. dt1=sp.GetHours ()*60+sp.GetMinutes ();
  359. if(tmcur>tm2)
  360. sp=tmcur-tm2;
  361. else
  362. sp=tm2-tmcur;
  363. dt2=sp.GetHours ()*60+sp.GetMinutes ();
  364. if(tmcur>tm3)
  365. sp=tmcur-tm3;
  366. else
  367. sp=tm3-tmcur;
  368. dt3=sp.GetHours ()*60+sp.GetMinutes ();
  369. if(tmcur>tm4)
  370. sp=tmcur-tm4;
  371. else
  372. sp=tm4-tmcur;
  373. dt4=sp.GetHours ()*60+sp.GetMinutes ();
  374. // CString ss;
  375. // ss.Format("%s %s-%d,%s-%d,%s-%d,%s-%d", datetime,time1,dt1, time2,dt2, time3,dt3, time4,dt4);
  376. // MessageBox(ss);
  377. if(dt1<=dt2 && dt1<=dt3 && dt1<=dt4 && in=="")
  378. {
  379. in=datetime;
  380. continue;
  381. }
  382. if(dt2<=dt1 && dt2<=dt3 && dt2<=dt4 && out=="")
  383. {
  384. out=datetime;continue;
  385. }
  386. if(dt3<=dt1 && dt3<=dt2 && dt3<=dt4 && in2=="")
  387. {
  388. in2=datetime;continue;
  389. }
  390. if(dt4<=dt1 && dt4<=dt2 && dt4<=dt3 && out2=="")
  391. {
  392. out2=datetime;continue;
  393. }
  394. }
  395. }
  396. else//单时间段
  397. {
  398. if(array.GetSize ())
  399. {
  400. in=array.ElementAt (0);
  401. in=in.Mid (11, 5);
  402. }
  403. if(array.GetSize ()>1)
  404. {
  405. out=array.ElementAt (array.GetSize ()-1);
  406. out=out.Mid (11, 5);
  407. }
  408. }
  409. for(a=0; a<m_List6array.GetSize (); a++)
  410. {
  411. if(name==m_List6array.ElementAt (a).ElementAt (1) && m_List6array.ElementAt (a).ElementAt (2).Find (date)!=-1)
  412. {
  413. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("段")==-1)
  414. in="签单";
  415. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("段")==-1)
  416. out="签单";
  417. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("上段")!=-1)
  418. in="签单";
  419. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("上段")!=-1)
  420. out="签单";
  421. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("下段")!=-1)
  422. in2="签单";
  423. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("下段")!=-1)
  424. out2="签单";
  425. }
  426. }
  427. if(time3=="" && array.GetSize () && in=="签单" && out!="签单")//防止上班签卡,只打了下班卡,会被认为是上班卡而没有下班时间
  428. {
  429. out=array.ElementAt (array.GetSize ()-1);
  430. out=out.Mid (11, 5);
  431. }
  432. if(ban!="休息")
  433. {
  434. if(date<m_today)
  435. {
  436. if(time3!="")//多时间段
  437. {
  438. if (in>time1 && in!="签单")
  439. bStr="1";
  440. if (out<time2 && out!="签单")
  441. bStr="1";
  442. if (in2>time3 && in2!="签单")
  443. bStr="1";
  444. if (out2<time4 && out2!="签单")
  445. bStr="1";
  446. if(in==""||out==""||in2==""||out2=="")
  447. bStr="1";
  448. }
  449. else
  450. {
  451. if (in>time1 && in!="签单")
  452. bStr="1";
  453. if (out<time2 && out!="签单")
  454. bStr="1";
  455. if(in==""||out=="")
  456. bStr="1";
  457. }
  458. }
  459. }
  460. if(time3!="")//多时间段
  461. m_List1array.ElementAt (i).SetAt (j, ban+"("+in+"-"+out+")"+"("+in2+"-"+out2+")");
  462. else
  463. m_List1array.ElementAt (i).SetAt (j, ban+"("+in+"-"+out+")");
  464. if(in!="")ncot++; if(out!="")ncot++;
  465. if(in2!="")ncot++; if(out2!="")ncot++;
  466. }
  467. m_List1array.ElementAt (i).Add (bStr);
  468. CString scot;
  469. scot.Format("%d", ncot);
  470. m_List1array.ElementAt (i).Add (scot);
  471. }
  472. FillGrid();
  473. }
  474. void LoginReg::GetTimeRange()
  475. {
  476. CTime tm(atoi(g_date.Mid (0,4)),atoi(g_date.Mid (5,2)),atoi(g_date.Mid (8,2)),0,0,0);
  477. m_today=tm.Format ("%Y-%m-%d");
  478. if(m_pos)
  479. {
  480. CTimeSpan sp(abs(m_pos)*7, 0, 0, 0);
  481. if(m_pos>0)
  482. tm+=sp;
  483. else
  484. tm-=sp;
  485. }
  486. int nDayWeek = tm.GetDayOfWeek()-1;
  487. int days1=nDayWeek;
  488. int days2=6-nDayWeek;
  489. CTime tm2,tm3;
  490. CTimeSpan sp(days1, 0, 0, 0);
  491. tm2=tm-sp;
  492. CTimeSpan sp2(days2, 0, 0, 0);
  493. tm3=tm+sp2;
  494. CString str;
  495. str.Format ("时间段:%04d-%02d-%02d 至 %04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay (), tm3.GetYear (), tm3.GetMonth (), tm3.GetDay () );
  496. SetDlgItemText(IDC_STATIC16, str);
  497. m_curtm=tm2;
  498. m_weekname.Format ("%04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay () );
  499. {
  500. CTimeSpan sp2(1, 0, 0, 0);
  501. tm2-=sp2;
  502. }
  503. m_scurdate.Format ("%04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay () );
  504. {
  505. CTimeSpan sp2(1, 0, 0, 0);
  506. tm3+=sp2;
  507. }
  508. m_scurdate2.Format ("%04d-%02d-%02d", tm3.GetYear (), tm3.GetMonth (), tm3.GetDay () );
  509. ShowLoginData();
  510. }
  511. void LoginReg::OnButton4()
  512. {
  513. // TODO: Add your control notification handler code here
  514. m_pos--;
  515. GetTimeRange();
  516. }
  517. void LoginReg::OnButton5()
  518. {
  519. // TODO: Add your control notification handler code here
  520. m_pos++;
  521. GetTimeRange();
  522. }
  523. void LoginReg::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  524. {
  525. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  526. // Take the default processing unless we set this to something else below.
  527. *pResult = 0;
  528. // First thing - check the draw stage. If it's the control's prepaint
  529. // stage, then tell Windows we want messages for every item.
  530. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  531. {
  532. *pResult = CDRF_NOTIFYITEMDRAW;
  533. }
  534. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  535. {
  536. // This is the prepaint stage for an item. Here's where we set the
  537. // item's text color. Our return value will tell Windows to draw the
  538. // item itself, but it will use the new color we set here.
  539. // We'll cycle the colors through red, green, and light blue.
  540. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (9)!="0")
  541. pLVCD->clrText = RGB(220,0,0);
  542. else
  543. pLVCD->clrText = RGB(20,133,20);
  544. // if(pLVCD->nmcd.dwItemSpec==2)
  545. // pLVCD->clrText = RGB(0,0,200);
  546. if(pLVCD->nmcd.dwItemSpec%2)
  547. pLVCD->clrTextBk = g_gridcol1;
  548. else
  549. pLVCD->clrTextBk = g_gridcol2;
  550. // Store the color back in the NMLVCUSTOMDRAW struct.
  551. // Tell Windows to paint the control it self.
  552. *pResult = CDRF_DODEFAULT;
  553. }
  554. }
  555. void LoginReg::OnBUTmoney5()
  556. {
  557. // TODO: Add your control notification handler code here
  558. ReChargeReg dlg;
  559. dlg.m_mode=4;
  560. dlg.m_scurdate=m_scurdate;
  561. dlg.m_scurdate2=m_scurdate2;
  562. dlg.DoModal ();
  563. if(dlg.m_bNeedRefsh)GetTimeRange();
  564. }
  565. void LoginReg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  566. {
  567. // TODO: Add your control notification handler code here
  568. POSITION pos;
  569. pos=m_List1.GetFirstSelectedItemPosition();
  570. if(pos==NULL)return;
  571. int iItem=m_List1.GetNextSelectedItem(pos);
  572. m_curname = m_List1.GetItemText (iItem, 0);
  573. *pResult = 0;
  574. }