LoginReg.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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 "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "SelWaiter2.h"
  11. #include "TakeStautsSel.h"
  12. #include "LoginSign.h"
  13. #include "ReChargeReg.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. #pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // LoginReg
  22. IMPLEMENT_DYNCREATE(LoginReg, MyFormView)
  23. LoginReg::LoginReg()
  24. : MyFormView(LoginReg::IDD)
  25. {
  26. //{{AFX_DATA_INIT(LoginReg)
  27. m_filter = _T("");
  28. m_pos=0;
  29. //}}AFX_DATA_INIT
  30. }
  31. LoginReg::~LoginReg()
  32. {
  33. }
  34. void LoginReg::DoDataExchange(CDataExchange* pDX)
  35. {
  36. MyFormView::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(LoginReg)
  38. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  39. DDX_Control(pDX, IDC_LIST2, m_List1);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(LoginReg, MyFormView)
  45. //{{AFX_MSG_MAP(LoginReg)
  46. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  47. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  48. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  49. ON_WM_TIMER()
  50. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  51. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  52. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  53. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  54. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  55. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  56. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  57. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  58. ON_BN_CLICKED(IDC_BUTmoney5, OnBUTmoney5)
  59. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  60. //}}AFX_MSG_MAP
  61. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  62. END_MESSAGE_MAP()
  63. /////////////////////////////////////////////////////////////////////////////
  64. // LoginReg diagnostics
  65. #ifdef _DEBUG
  66. void LoginReg::AssertValid() const
  67. {
  68. MyFormView::AssertValid();
  69. }
  70. void LoginReg::Dump(CDumpContext& dc) const
  71. {
  72. MyFormView::Dump(dc);
  73. }
  74. #endif //_DEBUG
  75. /////////////////////////////////////////////////////////////////////////////
  76. // LoginReg message handlers messageBox
  77. void LoginReg::OnInitialUpdate()
  78. {
  79. MyFormView::OnInitialUpdate();
  80. // TODO: Add your specialized code here and/or call the base class
  81. CMyMdi Mdi;
  82. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  83. if(IsHasRights2new(19)==0)
  84. {
  85. GetDlgItem(IDC_BUTmoney)->EnableWindow(0);
  86. }
  87. // Here we create the outbar control using the splitter as its parent
  88. // and setting its id to the first pane.
  89. CRect rc2;
  90. GetWindowRect(rc2);
  91. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  92. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  93. m_static1.SetFont (&g_titlefont);
  94. m_List1.SetHeadings("姓名,100;星期日,120;星期一,120;星期二,120;星期三,120;星期四,120;星期五,120;星期六,120" );
  95. m_List1.LoadColumnInfo (150);
  96. GetTimeRange();
  97. CenterWindow();
  98. }
  99. int __cdecl CompareByLabel2( const void *elem1, const void *elem2)
  100. {
  101. CStringArray *p1 = (CStringArray*)elem1;
  102. CStringArray *p2 = (CStringArray*)elem2;
  103. return lstrcmp( p1->ElementAt (0), p2->ElementAt (0) ) ;
  104. }
  105. int __cdecl CompareByLabel10( const void *elem1, const void *elem2)
  106. {
  107. CStringArray *p1 = (CStringArray*)elem1;
  108. CStringArray *p2 = (CStringArray*)elem2;
  109. if(p1->ElementAt (10)==p2->ElementAt (10))
  110. {
  111. return lstrcmp( p1->ElementAt (0), p2->ElementAt (0) ) ;
  112. }
  113. return (p1->ElementAt (10)>p2->ElementAt (10)?0:1) ;
  114. return 1;
  115. }
  116. int __cdecl CompareByLabel9( const void *elem1, const void *elem2)
  117. {
  118. CStringArray *p1 = (CStringArray*)elem1;
  119. CStringArray *p2 = (CStringArray*)elem2;
  120. return (p1->ElementAt (10)>p2->ElementAt (10)?0:1) ;
  121. }
  122. void LoginReg::FillGrid()
  123. {
  124. if(!m_List1array.GetSize ())return;
  125. qsort( static_cast<void*>(&m_List1array[0]), m_List1array.GetSize (), sizeof(m_List1array[0]), CompareByLabel9 );
  126. qsort( static_cast<void*>(&m_List1array[0]), m_List1array.GetSize (), sizeof(m_List1array[0]), CompareByLabel10 );
  127. m_List1.DeleteAllItems2 ();
  128. int ii=0;
  129. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  130. int count=0;
  131. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  132. {
  133. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  134. }
  135. m_List1.m_arLabels.SetSize(count, 1);
  136. ii=count;
  137. m_List1.m_LabelCount=ii;
  138. m_List1.SetItemCountEx (ii);
  139. if(!m_curname.IsEmpty ())
  140. {
  141. for(int i=0; i<m_List1.GetItemCount (); i++)
  142. {
  143. if(m_curname==m_List1.GetItemText (i, 0))
  144. {
  145. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  146. m_List1.EnsureVisible(i,FALSE);
  147. break;
  148. }
  149. }
  150. }
  151. }
  152. void LoginReg::OnBUTclose()
  153. {
  154. // TODO: Add your control notification handler code here
  155. GetParent()->SendMessage(WM_CLOSE);
  156. }
  157. void LoginReg::OnSelchangeCombo1()
  158. {
  159. // TODO: Add your control notification handler code here
  160. }
  161. void LoginReg::OnTimer(UINT nIDEvent)
  162. {
  163. // TODO: Add your message handler code here and/or call default
  164. KillTimer(nIDEvent);
  165. }
  166. BOOL LoginReg::PreTranslateMessage(MSG* pMsg)
  167. {
  168. // TODO: Add your specialized code here and/or call the base class
  169. try
  170. {
  171. if(pMsg->message==WM_KEYDOWN)
  172. {
  173. switch (pMsg->wParam)
  174. {
  175. case VK_RETURN:
  176. OnButton1();
  177. return 1;
  178. case 0x43: // copy
  179. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  180. {
  181. GetFocus()->SendMessage(WM_COPY);
  182. return TRUE;
  183. }
  184. break;
  185. case 0x56: //Ctrl + V:
  186. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  187. {
  188. GetFocus()->SendMessage(WM_PASTE);
  189. return TRUE;
  190. }
  191. break;
  192. case 0x58: // cut
  193. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  194. {
  195. GetFocus()->SendMessage(WM_CUT);
  196. return TRUE;
  197. }
  198. break;
  199. case 0x5A: //undo
  200. case 0x59: //redo
  201. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  202. {
  203. GetFocus()->SendMessage(WM_UNDO);
  204. return TRUE;
  205. }
  206. break;
  207. }
  208. }
  209. return MyFormView::PreTranslateMessage(pMsg);
  210. }
  211. catch(...)
  212. {
  213. }
  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;
  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(int 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(int 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(int 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. }