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 "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. for (int i = 0; i < g_userarray.GetSize(); i++)
  348. {
  349. CString worker = g_userarray.ElementAt(i).ElementAt(1);
  350. BOOL bFind = 0;
  351. for (int j = 0; j < size; j++)
  352. {
  353. if (m_List1array.ElementAt(j).ElementAt(1) == worker)
  354. {
  355. bFind = 1; break;
  356. }
  357. }
  358. if (bFind == 0)array.Add(worker);
  359. }
  360. m_List1array.SetSize(size + array.GetSize(), 1);
  361. for (i = 0; i < array.GetSize(); i++)
  362. {
  363. m_List1array.ElementAt(size + i).Add("");
  364. m_List1array.ElementAt(size + i).Add(array.ElementAt(i));
  365. m_List1array.ElementAt(size + i).Add("");
  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. }
  373. m_List1arrayBak.SetSize(m_List1array.GetSize());
  374. for (i = 0; i < m_List1array.GetSize(); i++)
  375. {
  376. m_List1arrayBak.ElementAt(i).Copy(m_List1array.ElementAt(i));
  377. if (m_List1array.ElementAt(i).ElementAt(5).GetLength()>100)
  378. m_List1array.ElementAt(i).SetAt(5, m_List1array.ElementAt(i).ElementAt(5).Left(100) + "..");
  379. if (m_List1array.ElementAt(i).ElementAt(6).GetLength()>100)
  380. m_List1array.ElementAt(i).SetAt(6, m_List1array.ElementAt(i).ElementAt(6).Left(100) + "..");
  381. if (m_List1array.ElementAt(i).ElementAt(7).GetLength() > 100)
  382. m_List1array.ElementAt(i).SetAt(7, m_List1array.ElementAt(i).ElementAt(7).Left(100) + "..");
  383. if (m_List1array.ElementAt(i).ElementAt(7) != "")
  384. {
  385. if (0 == atoi(m_List1array.ElementAt(i).ElementAt(8)))
  386. m_List1array.ElementAt(i).SetAt(8, "未读");
  387. else
  388. m_List1array.ElementAt(i).SetAt(8, "已读");
  389. }
  390. }
  391. FillGrid();
  392. BOOL bFind = 0;
  393. for (i = 0; i < m_List1arrayBak.GetSize(); i++)
  394. {
  395. if (0 == atoi(m_List1arrayBak.ElementAt(i).ElementAt(8)) && m_List1arrayBak.ElementAt(i).ElementAt(7) != "" && m_List1arrayBak.ElementAt(i).ElementAt(1) == g_user.name)
  396. {
  397. ShowRemark dlg;
  398. dlg.m_remark = m_List1arrayBak.ElementAt(i).ElementAt(7);
  399. dlg.DoModal();
  400. CString sql;
  401. sql.Format("update [workerreport] set [read]='1' where id=%s", m_List1arrayBak.ElementAt(i).ElementAt(0));
  402. g_sendhead.bsql = 1;
  403. g_pMainWnd->ProcessChatMessageRequest2(sql);
  404. bFind = 1;
  405. }
  406. }
  407. if (bFind)GetData();
  408. }
  409. void WorkerReport::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  410. {
  411. // TODO: Add your control notification handler code here
  412. POSITION pos;
  413. pos = m_List1.GetFirstSelectedItemPosition();
  414. if (pos == NULL)
  415. {
  416. OnButton4();
  417. return;
  418. }
  419. int iItem = m_List1.GetNextSelectedItem(pos);
  420. m_id = m_List1.GetItemText(iItem, 0);
  421. if (m_id == "")
  422. {
  423. OnButton4();
  424. return;
  425. }
  426. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  427. {
  428. if (m_id == m_List1arrayBak.ElementAt(i).ElementAt(0))
  429. {
  430. m_worker = m_List1arrayBak.ElementAt(i).ElementAt(1);
  431. m_addr = m_List1arrayBak.ElementAt(i).ElementAt(2);
  432. m_date1 = ::GetTmFromStr(m_List1arrayBak.ElementAt(i).ElementAt(3));
  433. m_date2 = ::GetTmFromStr(m_List1arrayBak.ElementAt(i).ElementAt(4));
  434. m_remark = m_List1arrayBak.ElementAt(i).ElementAt(5);
  435. m_remark3 = m_List1arrayBak.ElementAt(i).ElementAt(6);
  436. m_remark2 = m_List1arrayBak.ElementAt(i).ElementAt(7);
  437. UpdateData(0);
  438. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存更改");
  439. if (g_user.name != m_worker || m_List1arrayBak.ElementAt(i).ElementAt(4) != g_date || m_List1arrayBak.ElementAt(i).ElementAt(7) != "")
  440. GetDlgItem(IDC_BUTTON3)->EnableWindow(0);
  441. else
  442. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  443. break;
  444. }
  445. }
  446. *pResult = 0;
  447. }
  448. void WorkerReport::OnButton4()
  449. {
  450. // TODO: Add your control notification handler code here
  451. m_id = "";
  452. m_worker = g_user.name;
  453. m_addr = _T("");
  454. m_date1 = ::GetTmFromStr(g_date);
  455. m_date2 = ::GetTmFromStr(g_date);
  456. m_remark = _T(""); m_remark2 = _T(""); m_remark3 = _T("");
  457. UpdateData(0);
  458. GetDlgItem(IDC_BUTTON3)->SetWindowText("保存");
  459. GetDlgItem(IDC_BUTTON3)->EnableWindow(1);
  460. }
  461. void WorkerReport::OnButton2()
  462. {
  463. // TODO: Add your control notification handler code here
  464. POSITION pos;
  465. pos = m_List1.GetFirstSelectedItemPosition();
  466. if (pos == NULL)
  467. {
  468. AfxMessageBox("请先选中您要删除的记录!", MB_ICONINFORMATION);
  469. return;
  470. }
  471. if (AfxMessageBox("确认删除此记录吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  472. int iItem = m_List1.GetNextSelectedItem(pos);
  473. CString id = m_List1.GetItemText(iItem, 0);
  474. CString sql;
  475. sql.Format("delete from [workerreport] where [id]=%s", id);
  476. g_sendhead.bsql = 1;
  477. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  478. GetData();
  479. }
  480. void WorkerReport::OnButton5()
  481. {
  482. // TODO: Add your control notification handler code here
  483. UpdateData();
  484. GetClientInfo dlg;
  485. if (dlg.DoModal() == IDOK)
  486. {
  487. m_addr = dlg.m_name2;
  488. UpdateData(0);
  489. }
  490. }
  491. void WorkerReport::OnCheck1()
  492. {
  493. // TODO: Add your control notification handler code here
  494. GetData();
  495. }
  496. void WorkerReport::OnCloseupCOMBOclerk()
  497. {
  498. // TODO: Add your control notification handler code here
  499. int pos = m_comboclerk.GetCurSel();
  500. if (pos == -1)return;
  501. m_comboclerk.GetLBText(pos, m_clerk);
  502. FillGrid();
  503. }
  504. void WorkerReport::OnCloseupCombo1()
  505. {
  506. // TODO: Add your control notification handler code here
  507. SetTimer(1, 100, NULL);
  508. }
  509. void WorkerReport::OnTimer(UINT nIDEvent)
  510. {
  511. // TODO: Add your message handler code here and/or call default
  512. KillTimer(1);
  513. UpdateData();
  514. FillGrid();
  515. MyFormView::OnTimer(nIDEvent);
  516. }
  517. void WorkerReport::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  518. {
  519. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  520. // Take the default processing unless we set this to something else below.
  521. *pResult = 0;
  522. // First thing - check the draw stage. If it's the control's prepaint
  523. // stage, then tell Windows we want messages for every item.
  524. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  525. {
  526. *pResult = CDRF_NOTIFYITEMDRAW;
  527. }
  528. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  529. {
  530. // This is the prepaint stage for an item. Here's where we set the
  531. // item's text color. Our return value will tell Windows to draw the
  532. // item itself, but it will use the new color we set here.
  533. // We'll cycle the colors through red, green, and light blue.
  534. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(8) != "0")
  535. pLVCD->clrText = RGB(220, 0, 0);
  536. else
  537. pLVCD->clrText = RGB(20, 133, 20);
  538. if (pLVCD->nmcd.dwItemSpec % 2)
  539. pLVCD->clrTextBk = g_gridcol1;
  540. else
  541. pLVCD->clrTextBk = g_gridcol2;
  542. // Store the color back in the NMLVCUSTOMDRAW struct.
  543. // Tell Windows to paint the control itself.
  544. *pResult = CDRF_DODEFAULT;
  545. }
  546. }
  547. void WorkerReport::OnButton10()
  548. {
  549. // TODO: Add your control notification handler code here
  550. m_days = 2;
  551. FillGrid();
  552. }
  553. void WorkerReport::OnButton11()
  554. {
  555. // TODO: Add your control notification handler code here
  556. m_days = 3;
  557. FillGrid();
  558. }
  559. void WorkerReport::OnButton32()
  560. {
  561. // TODO: Add your control notification handler code here
  562. m_days = 5;
  563. FillGrid();
  564. }
  565. void WorkerReport::OnButton14()
  566. {
  567. // TODO: Add your control notification handler code here
  568. POSITION pos;
  569. pos = m_List1.GetFirstSelectedItemPosition();
  570. if (pos == NULL)
  571. {
  572. AfxMessageBox("请先选中项目!", MB_ICONINFORMATION);
  573. return;
  574. }
  575. int iItem = m_List1.GetNextSelectedItem(pos);
  576. CString id = m_List1.GetItemText(iItem, 0);
  577. ShowRemark dlg;
  578. dlg.m_remark = m_remark2;
  579. if (dlg.DoModal() == IDOK)
  580. {
  581. CString right = g_user.name + "示";
  582. if (dlg.m_remark.GetLength() >= right.GetLength())
  583. {
  584. if (dlg.m_remark.Right(right.GetLength()) != right)
  585. dlg.m_remark += " " + right;
  586. }
  587. else
  588. dlg.m_remark += " " + right;
  589. CString m_remark2 = dlg.m_remark;
  590. CString sql;
  591. sql.Format("update [workerreport] set [remark2]='%s',[read]='0' where id=%s", m_remark2, id);
  592. g_sendhead.bsql = 1;
  593. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  594. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  595. GetData();
  596. }
  597. }
  598. void WorkerReport::OnButton9()
  599. {
  600. // TODO: Add your control notification handler code here
  601. UpdateData();
  602. ShowRemark dlg;
  603. dlg.m_remark = m_remark;
  604. if (dlg.DoModal() == IDOK)
  605. {
  606. m_remark = dlg.m_remark;
  607. UpdateData(0);
  608. }
  609. }
  610. void WorkerReport::OnButton16()
  611. {
  612. // TODO: Add your control notification handler code here
  613. UpdateData();
  614. ShowRemark dlg;
  615. dlg.m_remark = m_remark2;
  616. if (dlg.DoModal() == IDOK)
  617. {
  618. }
  619. }
  620. void WorkerReport::OnButton12()
  621. {
  622. // TODO: Add your control notification handler code here
  623. UpdateData();
  624. ShowRemark dlg;
  625. dlg.m_remark = m_remark3;
  626. if (dlg.DoModal() == IDOK)
  627. {
  628. m_remark3 = dlg.m_remark;
  629. UpdateData(0);
  630. }
  631. }