WorkerReport.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. // WorkerReport.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "WorkerReport.h"
  6. #include "MyMdi.H"
  7. #include "SelBrunDevice.h"
  8. #include "GetClientInfo.h"
  9. #include "ShowRemark.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // WorkerReport
  17. IMPLEMENT_DYNCREATE(WorkerReport, MyFormView)
  18. WorkerReport::WorkerReport()
  19. : MyFormView(WorkerReport::IDD)
  20. {
  21. //{{AFX_DATA_INIT(WorkerReport)
  22. m_filter = _T("");
  23. m_clerk = _T("");
  24. m_worker = g_user.name;
  25. m_addr = _T("");
  26. m_date1 = ::GetTmFromStr(g_date);
  27. m_date2 = ::GetTmFromStr(g_date);
  28. m_remark = _T("");
  29. m_check1 = FALSE;
  30. m_remark2 = _T("");
  31. m_days = 0;
  32. m_remark3 = _T("");
  33. //}}AFX_DATA_INIT
  34. }
  35. WorkerReport::~WorkerReport()
  36. {
  37. }
  38. void WorkerReport::DoDataExchange(CDataExchange* pDX)
  39. {
  40. MyFormView::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(WorkerReport)
  42. DDX_Control(pDX, IDC_COMBOclerk, m_comboclerk);
  43. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  44. DDX_Control(pDX, IDC_LIST2, m_List1);
  45. DDX_Control(pDX, IDC_STATIC1, m_static1);
  46. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  47. DDX_CBString(pDX, IDC_COMBOclerk, m_clerk);
  48. DDX_Text(pDX, IDC_EDITworker, m_worker);
  49. DDX_Text(pDX, IDC_EDITaddr, m_addr);
  50. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_date1);
  51. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_date2);
  52. DDX_Text(pDX, IDC_EDITremark, m_remark);
  53. DDX_Check(pDX, IDC_CHECK1, m_check1);
  54. DDX_Text(pDX, IDC_EDITremark2, m_remark2);
  55. DDX_Text(pDX, IDC_EDITremark3, m_remark3);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(WorkerReport, MyFormView)
  59. //{{AFX_MSG_MAP(WorkerReport)
  60. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  61. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  62. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  63. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  64. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  65. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  66. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  67. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  68. ON_CBN_CLOSEUP(IDC_COMBOclerk, OnCloseupCOMBOclerk)
  69. ON_CBN_CLOSEUP(IDC_COMBO1, OnCloseupCombo1)
  70. ON_WM_TIMER()
  71. ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
  72. ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
  73. ON_BN_CLICKED(IDC_BUTTON32, OnButton32)
  74. ON_BN_CLICKED(IDC_BUTTON14, OnButton14)
  75. ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
  76. ON_BN_CLICKED(IDC_BUTTON16, OnButton16)
  77. ON_BN_CLICKED(IDC_BUTTON12, OnButton12)
  78. //}}AFX_MSG_MAP
  79. END_MESSAGE_MAP()
  80. // ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  81. /////////////////////////////////////////////////////////////////////////////
  82. // WorkerReport diagnostics
  83. #ifdef _DEBUG
  84. void WorkerReport::AssertValid() const
  85. {
  86. MyFormView::AssertValid();
  87. }
  88. void WorkerReport::Dump(CDumpContext& dc) const
  89. {
  90. MyFormView::Dump(dc);
  91. }
  92. #endif //_DEBUG
  93. /////////////////////////////////////////////////////////////////////////////
  94. // WorkerReport message handlers
  95. void WorkerReport::OnInitialUpdate()
  96. {
  97. MyFormView::OnInitialUpdate();
  98. // TODO: Add your specialized code here and/or call the base class
  99. CMyMdi Mdi;
  100. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  101. GetDlgItem(IDC_BUTTON2)->EnableWindow(IsHasRights2new(49));
  102. GetDlgItem(IDC_BUTTON14)->EnableWindow(IsHasRights2new(53));
  103. // Here we create the outbar control using the splitter as its parent
  104. // and setting its id to the first pane.
  105. CRect rc2;
  106. GetWindowRect(rc2);
  107. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  108. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  109. m_static1.SetFont(&g_titlefont);
  110. m_List1.SetHeadings("id,0;人员,100;客户全称,180;日期,110;填写日期,110;工作内容,180;明日计划,180;领导评定,180;状态,50");
  111. // m_List1.LoadColumnInfo (201);
  112. GetData();
  113. m_combo1.GetWindowRect(rc2);
  114. ScreenToClient(rc2);
  115. rc2.bottom += 200;
  116. m_combo1.MoveWindow(rc2);
  117. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  118. SetComboHei(&m_combo1, rc2.Height());
  119. m_combo1.AddString("广东");
  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_comboclerk.RefDroppedWidth();
  154. }
  155. void WorkerReport::FillGrid()
  156. {
  157. m_List1.DeleteAllItems2();
  158. int ii = 0;
  159. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  160. int count = 0;
  161. if (m_days)
  162. {
  163. CTime tm = ::GetTmFromStr(g_date);
  164. CTimeSpan dt = CTimeSpan(m_days, 0, 0, 0);
  165. CTime begintm = tm - dt;
  166. CString begindate = begintm.Format("%Y-%m-%d");
  167. CStringArray existarray;
  168. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  169. {
  170. if (::FindArray(&existarray, m_List1array.ElementAt(ii).ElementAt(1)) != -1)continue;
  171. if (m_List1array.ElementAt(ii).ElementAt(3) <= begindate)
  172. {
  173. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  174. }
  175. //else
  176. existarray.Add(m_List1array.ElementAt(ii).ElementAt(1));
  177. }
  178. m_days = 0;
  179. }
  180. else if (m_clerk != "")
  181. {
  182. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  183. {
  184. if (m_List1array.ElementAt(ii).ElementAt(1) == m_clerk)
  185. {
  186. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  187. }
  188. }
  189. }
  190. else if (m_filter.IsEmpty())
  191. {
  192. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  193. {
  194. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  195. }
  196. }
  197. else
  198. {
  199. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  200. {
  201. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  202. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  203. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  204. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  205. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1)
  206. {
  207. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  208. }
  209. }
  210. }
  211. m_List1.m_arLabels.SetSize(count, 1);
  212. ii = count;
  213. m_List1.m_LabelCount = ii;
  214. m_List1.SetItemCountEx(ii);
  215. }
  216. void WorkerReport::OnBUTclose()
  217. {
  218. // TODO: Add your control notification handler code here
  219. GetParent()->SendMessage(WM_CLOSE);
  220. }
  221. BOOL WorkerReport::PreTranslateMessage(MSG* pMsg)
  222. {
  223. // TODO: Add your specialized code here and/or call the base class
  224. try
  225. {
  226. if (pMsg->message == WM_KEYDOWN)
  227. {
  228. switch (pMsg->wParam)
  229. {
  230. case VK_RETURN:
  231. OnButton1();
  232. return 1;
  233. case 0x43: // copy
  234. if ((GetKeyState(VK_CONTROL) & 0x80))
  235. {
  236. GetFocus()->SendMessage(WM_COPY);
  237. return TRUE;
  238. }
  239. break;
  240. case 0x56: //Ctrl + V:
  241. if ((GetKeyState(VK_CONTROL) & 0x80))
  242. {
  243. GetFocus()->SendMessage(WM_PASTE);
  244. return TRUE;
  245. }
  246. break;
  247. case 0x58: // cut
  248. if ((GetKeyState(VK_CONTROL) & 0x80))
  249. {
  250. GetFocus()->SendMessage(WM_CUT);
  251. return TRUE;
  252. }
  253. break;
  254. case 0x5A: //undo
  255. case 0x59: //redo
  256. if ((GetKeyState(VK_CONTROL) & 0x80))
  257. {
  258. GetFocus()->SendMessage(WM_UNDO);
  259. return TRUE;
  260. }
  261. break;
  262. }
  263. }
  264. return MyFormView::PreTranslateMessage(pMsg);
  265. }
  266. catch (...)
  267. {
  268. }
  269. return TRUE;
  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. int i = 0;
  347. CStringArray array;
  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. }