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 "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. int a = 0;
  263. CString filter="weekname='"+m_weekname+"';datetime>'"+m_scurdate+"' and datetime<'"+m_scurdate2+"';staff_dimission='在职';;[date]>'"+m_scurdate+"' and [date]<'"+m_scurdate2+"'";
  264. g_sendhead.code[0]=107; //排班
  265. g_sendhead.code[1]=108; //打卡记录
  266. g_sendhead.code[2]=5; //人员
  267. g_sendhead.code[3]=97; //班次时间
  268. g_sendhead.code[4]=168; //签单记录
  269. g_sendhead.tabcount=5;
  270. g_sendhead.bsql=0;
  271. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  272. CArray<CStringArray, CStringArray>m_List2array;
  273. CArray<CStringArray, CStringArray>m_List3array;
  274. CArray<CStringArray, CStringArray>m_List4array;
  275. CArray<CStringArray, CStringArray>m_List6array;
  276. DataToArray(&m_List1array,&m_List2array,&m_List3array,&m_List4array,&m_List6array);
  277. CStringArray array;
  278. CString no;
  279. int i;
  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. }