WorkerReport.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. // WorkerReport.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "WorkerReport.h"
  6. #include "MyMdi.H"
  7. #include "SendMsgDlg.h"
  8. #include "SelBrunDevice.h"
  9. #include "GetClientInfo.h"
  10. #include "ShowRemark.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. /////////////////////////////////////////////////////////////////////////////
  17. // WorkerReport
  18. IMPLEMENT_DYNCREATE(WorkerReport, MyFormView)
  19. WorkerReport::WorkerReport()
  20. : MyFormView(WorkerReport::IDD)
  21. {
  22. //{{AFX_DATA_INIT(WorkerReport)
  23. m_filter = _T("");
  24. m_clerk = _T("");
  25. m_worker = g_user.name ;
  26. m_addr = _T("");
  27. m_date1 = ::GetTmFromStr (g_date);
  28. m_date2 = ::GetTmFromStr (g_date);
  29. m_remark = _T("");
  30. m_check1 = FALSE;
  31. m_remark2 = _T("");
  32. m_days=0;
  33. m_remark3 = _T("");
  34. //}}AFX_DATA_INIT
  35. }
  36. WorkerReport::~WorkerReport()
  37. {
  38. }
  39. void WorkerReport::DoDataExchange(CDataExchange* pDX)
  40. {
  41. MyFormView::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(WorkerReport)
  43. DDX_Control(pDX, IDC_COMBOclerk, m_comboclerk);
  44. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  45. DDX_Control(pDX, IDC_LIST2, m_List1);
  46. DDX_Control(pDX, IDC_STATIC1, m_static1);
  47. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  48. DDX_CBString(pDX, IDC_COMBOclerk, m_clerk);
  49. DDX_Text(pDX, IDC_EDITworker, m_worker);
  50. DDX_Text(pDX, IDC_EDITaddr, m_addr);
  51. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_date1);
  52. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_date2);
  53. DDX_Text(pDX, IDC_EDITremark, m_remark);
  54. DDX_Check(pDX, IDC_CHECK1, m_check1);
  55. DDX_Text(pDX, IDC_EDITremark2, m_remark2);
  56. DDX_Text(pDX, IDC_EDITremark3, m_remark3);
  57. //}}AFX_DATA_MAP
  58. }
  59. BEGIN_MESSAGE_MAP(WorkerReport, MyFormView)
  60. //{{AFX_MSG_MAP(WorkerReport)
  61. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  62. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  63. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  64. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  65. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  66. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  67. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  68. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  69. ON_CBN_CLOSEUP(IDC_COMBOclerk, OnCloseupCOMBOclerk)
  70. ON_CBN_CLOSEUP(IDC_COMBO1, OnCloseupCombo1)
  71. ON_WM_TIMER()
  72. ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
  73. ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
  74. ON_BN_CLICKED(IDC_BUTTON32, OnButton32)
  75. ON_BN_CLICKED(IDC_BUTTON14, OnButton14)
  76. ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
  77. ON_BN_CLICKED(IDC_BUTTON16, OnButton16)
  78. ON_BN_CLICKED(IDC_BUTTON12, OnButton12)
  79. //}}AFX_MSG_MAP
  80. END_MESSAGE_MAP()
  81. // ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  82. /////////////////////////////////////////////////////////////////////////////
  83. // WorkerReport diagnostics
  84. #ifdef _DEBUG
  85. void WorkerReport::AssertValid() const
  86. {
  87. MyFormView::AssertValid();
  88. }
  89. void WorkerReport::Dump(CDumpContext& dc) const
  90. {
  91. MyFormView::Dump(dc);
  92. }
  93. #endif //_DEBUG
  94. /////////////////////////////////////////////////////////////////////////////
  95. // WorkerReport message handlers
  96. void WorkerReport::OnInitialUpdate()
  97. {
  98. MyFormView::OnInitialUpdate();
  99. // TODO: Add your specialized code here and/or call the base class
  100. CMyMdi Mdi;
  101. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  102. GetDlgItem(IDC_BUTTON2)->EnableWindow(IsHasRights2new(49));
  103. GetDlgItem(IDC_BUTTON14)->EnableWindow(IsHasRights2new(53));
  104. // Here we create the outbar control using the splitter as its parent
  105. // and setting its id to the first pane.
  106. CRect rc2;
  107. GetWindowRect(rc2);
  108. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  109. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  110. m_static1.SetFont (&g_titlefont);
  111. m_List1.SetHeadings("id,0;人员,100;客户全称,180;日期,110;填写日期,110;工作内容,180;明日计划,180;领导评定,180;状态,50" );
  112. // m_List1.LoadColumnInfo (201);
  113. GetData();
  114. m_combo1.GetWindowRect (rc2);
  115. ScreenToClient(rc2);
  116. rc2.bottom +=200;
  117. m_combo1.MoveWindow (rc2);
  118. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  119. SetComboHei(&m_combo1, rc2.Height ());
  120. m_combo1.AddString("广东");
  121. m_combo1.AddString("广西");
  122. m_combo1.AddString("河南");
  123. m_combo1.AddString("河北");
  124. m_combo1.AddString("山东");
  125. m_combo1.AddString("山西");
  126. m_combo1.AddString("湖南");
  127. m_combo1.AddString("湖北");
  128. m_combo1.AddString("云南");
  129. m_combo1.AddString("黑龙江");
  130. m_combo1.AddString("吉林");
  131. m_combo1.AddString("甘肃");
  132. m_combo1.AddString("陕西");
  133. m_combo1.AddString("四川");
  134. m_combo1.AddString("重庆");
  135. m_combo1.AddString("北京");
  136. m_combo1.AddString("天津");
  137. m_combo1.AddString("内蒙");
  138. m_combo1.AddString("新疆");
  139. m_combo1.AddString("辽宁");
  140. m_combo1.AddString("青海");
  141. m_combo1.AddString("江苏");
  142. m_combo1.AddString("江西");
  143. m_combo1.AddString("浙江");
  144. m_combo1.AddString("福建");
  145. m_combo1.AddString("海南");
  146. m_combo1.AddString("贵州");
  147. m_combo1.AddString("安徽");
  148. m_combo1.AddString("上海");
  149. m_combo1.AddString("西藏");
  150. m_combo1.AddString("宁夏");
  151. m_combo1.AddString("香港");
  152. m_combo1.AddString("澳门");
  153. m_combo1.AddString("台湾");
  154. m_comboclerk.RefDroppedWidth();
  155. }
  156. void WorkerReport::FillGrid()
  157. {
  158. m_List1.DeleteAllItems2 ();
  159. int ii=0;
  160. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  161. int count=0;
  162. if(m_days)
  163. {
  164. CTime tm=::GetTmFromStr (g_date);
  165. CTimeSpan dt=CTimeSpan(m_days, 0, 0, 0);
  166. CTime begintm=tm-dt;
  167. CString begindate=begintm.Format ("%Y-%m-%d");
  168. CStringArray existarray;
  169. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  170. {
  171. if(::FindArray(&existarray, m_List1array.ElementAt (ii).ElementAt(1))!=-1)continue;
  172. if(m_List1array.ElementAt (ii).ElementAt (3)<=begindate )
  173. {
  174. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  175. }
  176. //else
  177. existarray.Add(m_List1array.ElementAt (ii).ElementAt(1));
  178. }
  179. m_days=0;
  180. }
  181. else if(m_clerk!="")
  182. {
  183. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  184. {
  185. if(m_List1array.ElementAt (ii).ElementAt (1)==m_clerk )
  186. {
  187. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  188. }
  189. }
  190. }
  191. else if(m_filter.IsEmpty ())
  192. {
  193. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  194. {
  195. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  196. }
  197. }
  198. else
  199. {
  200. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  201. {
  202. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  203. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  204. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  205. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  206. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 )
  207. {
  208. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  209. }
  210. }
  211. }
  212. m_List1.m_arLabels.SetSize(count, 1);
  213. ii=count;
  214. m_List1.m_LabelCount=ii;
  215. m_List1.SetItemCountEx (ii);
  216. }
  217. void WorkerReport::OnBUTclose()
  218. {
  219. // TODO: Add your control notification handler code here
  220. GetParent()->SendMessage(WM_CLOSE);
  221. }
  222. BOOL WorkerReport::PreTranslateMessage(MSG* pMsg)
  223. {
  224. // TODO: Add your specialized code here and/or call the base class
  225. try
  226. {
  227. if(pMsg->message==WM_KEYDOWN)
  228. {
  229. switch (pMsg->wParam)
  230. {
  231. case VK_RETURN:
  232. OnButton1();
  233. return 1;
  234. case 0x43: // copy
  235. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  236. {
  237. GetFocus()->SendMessage(WM_COPY);
  238. return TRUE;
  239. }
  240. break;
  241. case 0x56: //Ctrl + V:
  242. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  243. {
  244. GetFocus()->SendMessage(WM_PASTE);
  245. return TRUE;
  246. }
  247. break;
  248. case 0x58: // cut
  249. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  250. {
  251. GetFocus()->SendMessage(WM_CUT);
  252. return TRUE;
  253. }
  254. break;
  255. case 0x5A: //undo
  256. case 0x59: //redo
  257. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  258. {
  259. GetFocus()->SendMessage(WM_UNDO);
  260. return TRUE;
  261. }
  262. break;
  263. }
  264. }
  265. return MyFormView::PreTranslateMessage(pMsg);
  266. }
  267. catch(...)
  268. {
  269. }
  270. }
  271. void WorkerReport::OnButton1()
  272. {
  273. // TODO: Add your control notification handler code here
  274. UpdateData();
  275. m_filter.TrimLeft ();
  276. m_filter.TrimRight ();
  277. FillGrid();
  278. }
  279. void WorkerReport::OnButton3()
  280. {
  281. UpdateData();
  282. m_addr.TrimLeft ();
  283. m_addr.TrimRight ();
  284. m_remark.TrimLeft ();
  285. m_remark.TrimRight ();
  286. if(m_remark=="" || m_remark3=="" || m_addr=="")
  287. {
  288. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  289. return;
  290. }
  291. if(m_date2>m_date1)
  292. {
  293. CTimeSpan dt=m_date2-m_date1;
  294. if(dt.GetDays()>6)
  295. {
  296. AfxMessageBox("只能签到近一星期!", MB_ICONINFORMATION);
  297. return;
  298. }
  299. }
  300. else
  301. {
  302. CTimeSpan dt=m_date1-m_date2;
  303. if(dt.GetDays()>2)
  304. {
  305. AfxMessageBox("请不要玩穿越!", MB_ICONINFORMATION);
  306. return;
  307. }
  308. }
  309. CString date1=m_date1.Format ("%Y-%m-%d");
  310. CString date2=m_date2.Format ("%Y-%m-%d");
  311. CString sql;
  312. if(m_id=="")
  313. sql.Format ("insert into [workerreport] ([worker],[addr],[date1],[date2],[remark],[remark3])values( '%s','%s','%s','%s','%s','%s')",m_worker,m_addr, date1, date2, m_remark, m_remark3);
  314. else
  315. sql.Format ("update [workerreport] set [addr]='%s',[date1]='%s',[date2]='%s',[remark]='%s',[remark3]='%s' where id=%s", m_addr, date1, date2, m_remark, m_remark3, m_id);
  316. g_sendhead.bsql=1;
  317. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  318. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  319. GetData();
  320. }
  321. void WorkerReport::GetData()
  322. {
  323. UpdateData();
  324. g_sendhead.bsql=0;
  325. g_sendhead.code[0]=212;
  326. g_sendhead.tabcount=1;
  327. if(m_check1)
  328. g_pMainWnd->ProcessChatMessageRequest2(3);
  329. else
  330. {
  331. CString filter;
  332. CTime tm=::GetTmFromStr (g_date);
  333. CTimeSpan dt=CTimeSpan(30, 0, 0, 0);
  334. CTime begintm=tm-dt;
  335. CString begindate=begintm.Format ("%Y-%m-%d");
  336. CString enddate=tm.Format ("%Y-%m-%d");
  337. filter.Format ("date2>='%s' and date2<='%s'", begindate, enddate);
  338. g_pMainWnd->ProcessChatMessageRequest2(filter);
  339. }
  340. if(g_bSendOK==0)
  341. {
  342. return;
  343. }
  344. DataToArray(&m_List1array);
  345. int size=m_List1array.GetSize ();
  346. CStringArray array;
  347. int i = 0;
  348. for( i=0; i<g_userarray.GetSize (); i++)
  349. {
  350. CString worker=g_userarray.ElementAt (i).ElementAt (1);
  351. BOOL bFind=0;
  352. for(int j=0; j<size; j++)
  353. {
  354. if(m_List1array.ElementAt (j).ElementAt (1)==worker)
  355. {
  356. bFind=1;break;
  357. }
  358. }
  359. if(bFind==0)array.Add (worker);
  360. }
  361. m_List1array.SetSize(size+array.GetSize (), 1);
  362. for(i=0; i<array.GetSize (); i++)
  363. {
  364. m_List1array.ElementAt (size+i).Add ("");
  365. m_List1array.ElementAt (size+i).Add (array.ElementAt (i));
  366. m_List1array.ElementAt (size+i).Add ("");
  367. m_List1array.ElementAt (size+i).Add ("");
  368. m_List1array.ElementAt (size+i).Add ("");
  369. m_List1array.ElementAt (size+i).Add ("");
  370. m_List1array.ElementAt (size+i).Add ("");
  371. m_List1array.ElementAt (size+i).Add ("");
  372. m_List1array.ElementAt (size+i).Add ("");
  373. }
  374. m_List1arrayBak.SetSize(m_List1array.GetSize ());
  375. for( i=0; i<m_List1array.GetSize (); i++)
  376. {
  377. m_List1arrayBak.ElementAt (i).Copy (m_List1array.ElementAt (i));
  378. if(m_List1array.ElementAt (i).ElementAt (5).GetLength ()>100)
  379. m_List1array.ElementAt (i).SetAt (5, m_List1array.ElementAt (i).ElementAt (5).Left (100)+"..");
  380. if(m_List1array.ElementAt (i).ElementAt (6).GetLength ()>100)
  381. m_List1array.ElementAt (i).SetAt (6, m_List1array.ElementAt (i).ElementAt (6).Left (100)+"..");
  382. if(m_List1array.ElementAt (i).ElementAt (7).GetLength ()>100)
  383. m_List1array.ElementAt (i).SetAt (7, m_List1array.ElementAt (i).ElementAt (7).Left (100)+"..");
  384. if(m_List1array.ElementAt (i).ElementAt (7)!="")
  385. {
  386. if(0==atoi(m_List1array.ElementAt (i).ElementAt (8)))
  387. m_List1array.ElementAt (i).SetAt (8, "未读");
  388. else
  389. m_List1array.ElementAt (i).SetAt (8, "已读");
  390. }
  391. }
  392. FillGrid();
  393. BOOL bFind=0;
  394. for( i=0; i<m_List1arrayBak.GetSize (); i++)
  395. {
  396. if(0==atoi(m_List1arrayBak.ElementAt (i).ElementAt (8)) && m_List1arrayBak.ElementAt (i).ElementAt (7)!="" && m_List1arrayBak.ElementAt (i).ElementAt (1)==g_user.name)
  397. {
  398. ShowRemark dlg;
  399. dlg.m_remark=m_List1arrayBak.ElementAt (i).ElementAt (7);
  400. dlg.DoModal();
  401. CString sql;
  402. sql.Format ("update [workerreport] set [read]='1' where id=%s", m_List1arrayBak.ElementAt (i).ElementAt (0));
  403. g_sendhead.bsql=1;
  404. g_pMainWnd->ProcessChatMessageRequest2(sql);
  405. bFind=1;
  406. }
  407. }
  408. if(bFind)GetData();
  409. }
  410. void WorkerReport::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  411. {
  412. // TODO: Add your control notification handler code here
  413. POSITION pos;
  414. pos=m_List1.GetFirstSelectedItemPosition();
  415. if(pos==NULL)
  416. {
  417. OnButton4();
  418. return;
  419. }
  420. int iItem=m_List1.GetNextSelectedItem(pos);
  421. m_id=m_List1.GetItemText (iItem, 0);
  422. if(m_id=="")
  423. {
  424. OnButton4();
  425. return;
  426. }
  427. for(int i=0; i<m_List1arrayBak.GetSize(); i++)
  428. {
  429. if(m_id==m_List1arrayBak.ElementAt(i).ElementAt(0))
  430. {
  431. m_worker = m_List1arrayBak.ElementAt(i).ElementAt(1);
  432. m_addr = m_List1arrayBak.ElementAt(i).ElementAt(2);
  433. m_date1 = ::GetTmFromStr (m_List1arrayBak.ElementAt(i).ElementAt(3));
  434. m_date2 = ::GetTmFromStr (m_List1arrayBak.ElementAt(i).ElementAt(4));
  435. m_remark = m_List1arrayBak.ElementAt(i).ElementAt(5);
  436. m_remark3 = m_List1arrayBak.ElementAt(i).ElementAt(6);
  437. m_remark2 = m_List1arrayBak.ElementAt(i).ElementAt(7);
  438. UpdateData(0);
  439. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存更改");
  440. if(g_user.name!=m_worker || m_List1arrayBak.ElementAt(i).ElementAt(4)!=g_date || m_List1arrayBak.ElementAt(i).ElementAt(7)!="")
  441. GetDlgItem(IDC_BUTTON3)->EnableWindow(0);
  442. else
  443. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  444. break;
  445. }
  446. }
  447. *pResult = 0;
  448. }
  449. void WorkerReport::OnButton4()
  450. {
  451. // TODO: Add your control notification handler code here
  452. m_id="";
  453. m_worker = g_user.name ;
  454. m_addr = _T("");
  455. m_date1 = ::GetTmFromStr (g_date);
  456. m_date2 = ::GetTmFromStr (g_date);
  457. m_remark = _T(""); m_remark2 = _T("");m_remark3 = _T("");
  458. UpdateData(0);
  459. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存");
  460. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  461. }
  462. void WorkerReport::OnButton2()
  463. {
  464. // TODO: Add your control notification handler code here
  465. POSITION pos;
  466. pos=m_List1.GetFirstSelectedItemPosition();
  467. if(pos==NULL)
  468. {
  469. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  470. return;
  471. }
  472. if(AfxMessageBox("确认删除此记录吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  473. int iItem=m_List1.GetNextSelectedItem(pos);
  474. CString id=m_List1.GetItemText (iItem, 0);
  475. CString sql;
  476. sql.Format ("delete from [workerreport] where [id]=%s", id);
  477. g_sendhead.bsql=1;
  478. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  479. GetData();
  480. }
  481. void WorkerReport::OnButton5()
  482. {
  483. // TODO: Add your control notification handler code here
  484. UpdateData();
  485. GetClientInfo dlg;
  486. if(dlg.DoModal ()==IDOK)
  487. {
  488. m_addr = dlg.m_name2 ;
  489. UpdateData(0);
  490. }
  491. }
  492. void WorkerReport::OnCheck1()
  493. {
  494. // TODO: Add your control notification handler code here
  495. GetData();
  496. }
  497. void WorkerReport::OnCloseupCOMBOclerk()
  498. {
  499. // TODO: Add your control notification handler code here
  500. int pos=m_comboclerk.GetCurSel ();
  501. if(pos==-1)return;
  502. m_comboclerk.GetLBText (pos, m_clerk);
  503. FillGrid();
  504. }
  505. void WorkerReport::OnCloseupCombo1()
  506. {
  507. // TODO: Add your control notification handler code here
  508. SetTimer(1, 100, NULL);
  509. }
  510. void WorkerReport::OnTimer(UINT nIDEvent)
  511. {
  512. // TODO: Add your message handler code here and/or call default
  513. KillTimer(1);
  514. UpdateData();
  515. FillGrid();
  516. MyFormView::OnTimer(nIDEvent);
  517. }
  518. void WorkerReport::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  519. {
  520. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  521. // Take the default processing unless we set this to something else below.
  522. *pResult = 0;
  523. // First thing - check the draw stage. If it's the control's prepaint
  524. // stage, then tell Windows we want messages for every item.
  525. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  526. {
  527. *pResult = CDRF_NOTIFYITEMDRAW;
  528. }
  529. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  530. {
  531. // This is the prepaint stage for an item. Here's where we set the
  532. // item's text color. Our return value will tell Windows to draw the
  533. // item itself, but it will use the new color we set here.
  534. // We'll cycle the colors through red, green, and light blue.
  535. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (8)!="0")
  536. pLVCD->clrText = RGB(220,0,0);
  537. else
  538. pLVCD->clrText = RGB(20,133,20);
  539. if(pLVCD->nmcd.dwItemSpec%2)
  540. pLVCD->clrTextBk = g_gridcol1;
  541. else
  542. pLVCD->clrTextBk = g_gridcol2;
  543. // Store the color back in the NMLVCUSTOMDRAW struct.
  544. // Tell Windows to paint the control itself.
  545. *pResult = CDRF_DODEFAULT;
  546. }
  547. }
  548. void WorkerReport::OnButton10()
  549. {
  550. // TODO: Add your control notification handler code here
  551. m_days=2;
  552. FillGrid();
  553. }
  554. void WorkerReport::OnButton11()
  555. {
  556. // TODO: Add your control notification handler code here
  557. m_days=3;
  558. FillGrid();
  559. }
  560. void WorkerReport::OnButton32()
  561. {
  562. // TODO: Add your control notification handler code here
  563. m_days=5;
  564. FillGrid();
  565. }
  566. void WorkerReport::OnButton14()
  567. {
  568. // TODO: Add your control notification handler code here
  569. POSITION pos;
  570. pos=m_List1.GetFirstSelectedItemPosition();
  571. if(pos==NULL)
  572. {
  573. AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
  574. return;
  575. }
  576. int iItem=m_List1.GetNextSelectedItem(pos);
  577. CString id=m_List1.GetItemText (iItem, 0);
  578. ShowRemark dlg;
  579. dlg.m_remark =m_remark2;
  580. if(dlg.DoModal ()==IDOK)
  581. {
  582. CString right=g_user.name+"示";
  583. if(dlg.m_remark.GetLength ()>=right.GetLength ())
  584. {
  585. if(dlg.m_remark.Right (right.GetLength ())!=right)
  586. dlg.m_remark+=" "+right;
  587. }
  588. else
  589. dlg.m_remark+=" "+right;
  590. CString m_remark2=dlg.m_remark;
  591. CString sql;
  592. sql.Format ("update [workerreport] set [remark2]='%s',[read]='0' where id=%s",m_remark2, id);
  593. g_sendhead.bsql=1;
  594. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  595. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  596. GetData();
  597. }
  598. }
  599. void WorkerReport::OnButton9()
  600. {
  601. // TODO: Add your control notification handler code here
  602. UpdateData();
  603. ShowRemark dlg;
  604. dlg.m_remark =m_remark;
  605. if(dlg.DoModal ()==IDOK)
  606. {
  607. m_remark=dlg.m_remark;
  608. UpdateData(0);
  609. }
  610. }
  611. void WorkerReport::OnButton16()
  612. {
  613. // TODO: Add your control notification handler code here
  614. UpdateData();
  615. ShowRemark dlg;
  616. dlg.m_remark =m_remark2;
  617. if(dlg.DoModal ()==IDOK)
  618. {
  619. }
  620. }
  621. void WorkerReport::OnButton12()
  622. {
  623. // TODO: Add your control notification handler code here
  624. UpdateData();
  625. ShowRemark dlg;
  626. dlg.m_remark =m_remark3;
  627. if(dlg.DoModal ()==IDOK)
  628. {
  629. m_remark3=dlg.m_remark;
  630. UpdateData(0);
  631. }
  632. }