LoginReg.cpp 16 KB

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