LoginReg.cpp 16 KB

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