LoginReg.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  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. int a = 0;
  336. for(/*int*/ a=0; a<m_List2array.GetSize (); a++)
  337. {
  338. if(name==m_List2array.ElementAt (a).ElementAt (0) && m_List2array.ElementAt (a).ElementAt (1).Find (date)!=-1)
  339. {
  340. array.Add (m_List2array.ElementAt (a).ElementAt (1));
  341. }
  342. }
  343. if(time3!="")//多时间段
  344. {
  345. int dt1,dt2,dt3,dt4;
  346. for(/*int*/ a=0; a<array.GetSize (); a++)
  347. {
  348. CString datetime=array.ElementAt (a);
  349. datetime=datetime.Mid (11, 5);
  350. // time1
  351. CTime tmcur(2012, 5, 29, atoi(datetime.Left (2)), atoi(datetime.Right(2)), 0);
  352. CTime tm1(2012, 5, 29, atoi(time1.Left (2)), atoi(time1.Right(2)), 0);
  353. CTime tm2(2012, 5, 29, atoi(time2.Left (2)), atoi(time2.Right(2)), 0);
  354. CTime tm3(2012, 5, 29, atoi(time3.Left (2)), atoi(time3.Right(2)), 0);
  355. CTime tm4(2012, 5, 29, atoi(time4.Left (2)), atoi(time4.Right(2)), 0);
  356. CTimeSpan sp;
  357. if(tmcur>tm1)
  358. sp=tmcur-tm1;
  359. else
  360. sp=tm1-tmcur;
  361. dt1=sp.GetHours ()*60+sp.GetMinutes ();
  362. if(tmcur>tm2)
  363. sp=tmcur-tm2;
  364. else
  365. sp=tm2-tmcur;
  366. dt2=sp.GetHours ()*60+sp.GetMinutes ();
  367. if(tmcur>tm3)
  368. sp=tmcur-tm3;
  369. else
  370. sp=tm3-tmcur;
  371. dt3=sp.GetHours ()*60+sp.GetMinutes ();
  372. if(tmcur>tm4)
  373. sp=tmcur-tm4;
  374. else
  375. sp=tm4-tmcur;
  376. dt4=sp.GetHours ()*60+sp.GetMinutes ();
  377. // CString ss;
  378. // ss.Format("%s %s-%d,%s-%d,%s-%d,%s-%d", datetime,time1,dt1, time2,dt2, time3,dt3, time4,dt4);
  379. // MessageBox(ss);
  380. if(dt1<=dt2 && dt1<=dt3 && dt1<=dt4 && in=="")
  381. {
  382. in=datetime;
  383. continue;
  384. }
  385. if(dt2<=dt1 && dt2<=dt3 && dt2<=dt4 && out=="")
  386. {
  387. out=datetime;continue;
  388. }
  389. if(dt3<=dt1 && dt3<=dt2 && dt3<=dt4 && in2=="")
  390. {
  391. in2=datetime;continue;
  392. }
  393. if(dt4<=dt1 && dt4<=dt2 && dt4<=dt3 && out2=="")
  394. {
  395. out2=datetime;continue;
  396. }
  397. }
  398. }
  399. else//单时间段
  400. {
  401. if(array.GetSize ())
  402. {
  403. in=array.ElementAt (0);
  404. in=in.Mid (11, 5);
  405. }
  406. if(array.GetSize ()>1)
  407. {
  408. out=array.ElementAt (array.GetSize ()-1);
  409. out=out.Mid (11, 5);
  410. }
  411. }
  412. for(a=0; a<m_List6array.GetSize (); a++)
  413. {
  414. if(name==m_List6array.ElementAt (a).ElementAt (1) && m_List6array.ElementAt (a).ElementAt (2).Find (date)!=-1)
  415. {
  416. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("段")==-1)
  417. in="签单";
  418. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("段")==-1)
  419. out="签单";
  420. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("上段")!=-1)
  421. in="签单";
  422. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("上段")!=-1)
  423. out="签单";
  424. if(m_List6array.ElementAt (a).ElementAt (3).Find ("上班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("下段")!=-1)
  425. in2="签单";
  426. if(m_List6array.ElementAt (a).ElementAt (3).Find ("下班")!=-1 && m_List6array.ElementAt (a).ElementAt (3).Find ("下段")!=-1)
  427. out2="签单";
  428. }
  429. }
  430. if(time3=="" && array.GetSize () && in=="签单" && out!="签单")//防止上班签卡,只打了下班卡,会被认为是上班卡而没有下班时间
  431. {
  432. out=array.ElementAt (array.GetSize ()-1);
  433. out=out.Mid (11, 5);
  434. }
  435. if(ban!="休息")
  436. {
  437. if(date<m_today)
  438. {
  439. if(time3!="")//多时间段
  440. {
  441. if (in>time1 && in!="签单")
  442. bStr="1";
  443. if (out<time2 && out!="签单")
  444. bStr="1";
  445. if (in2>time3 && in2!="签单")
  446. bStr="1";
  447. if (out2<time4 && out2!="签单")
  448. bStr="1";
  449. if(in==""||out==""||in2==""||out2=="")
  450. bStr="1";
  451. }
  452. else
  453. {
  454. if (in>time1 && in!="签单")
  455. bStr="1";
  456. if (out<time2 && out!="签单")
  457. bStr="1";
  458. if(in==""||out=="")
  459. bStr="1";
  460. }
  461. }
  462. }
  463. if(time3!="")//多时间段
  464. m_List1array.ElementAt (i).SetAt (j, ban+"("+in+"-"+out+")"+"("+in2+"-"+out2+")");
  465. else
  466. m_List1array.ElementAt (i).SetAt (j, ban+"("+in+"-"+out+")");
  467. if(in!="")ncot++; if(out!="")ncot++;
  468. if(in2!="")ncot++; if(out2!="")ncot++;
  469. }
  470. m_List1array.ElementAt (i).Add (bStr);
  471. CString scot;
  472. scot.Format("%d", ncot);
  473. m_List1array.ElementAt (i).Add (scot);
  474. }
  475. FillGrid();
  476. }
  477. void LoginReg::GetTimeRange()
  478. {
  479. CTime tm(atoi(g_date.Mid (0,4)),atoi(g_date.Mid (5,2)),atoi(g_date.Mid (8,2)),0,0,0);
  480. m_today=tm.Format ("%Y-%m-%d");
  481. if(m_pos)
  482. {
  483. CTimeSpan sp(abs(m_pos)*7, 0, 0, 0);
  484. if(m_pos>0)
  485. tm+=sp;
  486. else
  487. tm-=sp;
  488. }
  489. int nDayWeek = tm.GetDayOfWeek()-1;
  490. int days1=nDayWeek;
  491. int days2=6-nDayWeek;
  492. CTime tm2,tm3;
  493. CTimeSpan sp(days1, 0, 0, 0);
  494. tm2=tm-sp;
  495. CTimeSpan sp2(days2, 0, 0, 0);
  496. tm3=tm+sp2;
  497. CString str;
  498. str.Format ("时间段:%04d-%02d-%02d 至 %04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay (), tm3.GetYear (), tm3.GetMonth (), tm3.GetDay () );
  499. SetDlgItemText(IDC_STATIC16, str);
  500. m_curtm=tm2;
  501. m_weekname.Format ("%04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay () );
  502. {
  503. CTimeSpan sp2(1, 0, 0, 0);
  504. tm2-=sp2;
  505. }
  506. m_scurdate.Format ("%04d-%02d-%02d", tm2.GetYear (), tm2.GetMonth (), tm2.GetDay () );
  507. {
  508. CTimeSpan sp2(1, 0, 0, 0);
  509. tm3+=sp2;
  510. }
  511. m_scurdate2.Format ("%04d-%02d-%02d", tm3.GetYear (), tm3.GetMonth (), tm3.GetDay () );
  512. ShowLoginData();
  513. }
  514. void LoginReg::OnButton4()
  515. {
  516. // TODO: Add your control notification handler code here
  517. m_pos--;
  518. GetTimeRange();
  519. }
  520. void LoginReg::OnButton5()
  521. {
  522. // TODO: Add your control notification handler code here
  523. m_pos++;
  524. GetTimeRange();
  525. }
  526. void LoginReg::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  527. {
  528. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  529. // Take the default processing unless we set this to something else below.
  530. *pResult = 0;
  531. // First thing - check the draw stage. If it's the control's prepaint
  532. // stage, then tell Windows we want messages for every item.
  533. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  534. {
  535. *pResult = CDRF_NOTIFYITEMDRAW;
  536. }
  537. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  538. {
  539. // This is the prepaint stage for an item. Here's where we set the
  540. // item's text color. Our return value will tell Windows to draw the
  541. // item itself, but it will use the new color we set here.
  542. // We'll cycle the colors through red, green, and light blue.
  543. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (9)!="0")
  544. pLVCD->clrText = RGB(220,0,0);
  545. else
  546. pLVCD->clrText = RGB(20,133,20);
  547. // if(pLVCD->nmcd.dwItemSpec==2)
  548. // pLVCD->clrText = RGB(0,0,200);
  549. if(pLVCD->nmcd.dwItemSpec%2)
  550. pLVCD->clrTextBk = g_gridcol1;
  551. else
  552. pLVCD->clrTextBk = g_gridcol2;
  553. // Store the color back in the NMLVCUSTOMDRAW struct.
  554. // Tell Windows to paint the control it self.
  555. *pResult = CDRF_DODEFAULT;
  556. }
  557. }
  558. void LoginReg::OnBUTmoney5()
  559. {
  560. // TODO: Add your control notification handler code here
  561. ReChargeReg dlg;
  562. dlg.m_mode=4;
  563. dlg.m_scurdate=m_scurdate;
  564. dlg.m_scurdate2=m_scurdate2;
  565. dlg.DoModal ();
  566. if(dlg.m_bNeedRefsh)GetTimeRange();
  567. }
  568. void LoginReg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  569. {
  570. // TODO: Add your control notification handler code here
  571. POSITION pos;
  572. pos=m_List1.GetFirstSelectedItemPosition();
  573. if(pos==NULL)return;
  574. int iItem=m_List1.GetNextSelectedItem(pos);
  575. m_curname = m_List1.GetItemText (iItem, 0);
  576. *pResult = 0;
  577. }