outsourcing4.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. // outsourcing4.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "outsourcing4.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // outsourcing4
  13. outsourcing4::outsourcing4(CWnd* pParent /*=NULL*/)
  14. : CDialog(outsourcing4::IDD)
  15. {
  16. //{{AFX_DATA_INIT(outsourcing4)
  17. m_year = atoi(g_date.Mid(0, 4));
  18. m_month = atoi(g_date.Mid(5, 2));
  19. m_day = atoi(g_date.Mid(8, 2));
  20. m_check1 = FALSE;
  21. m_bInit = 0;
  22. m_timestmap = 0;
  23. m_radio = 0;
  24. //}}AFX_DATA_INIT
  25. }
  26. void outsourcing4::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(outsourcing4)
  30. DDX_Control(pDX, IDC_COMBObranch, m_combobranch);
  31. DDX_Control(pDX, IDC_COMBOsplb3, m_waiter1);
  32. DDX_Control(pDX, IDC_COMBOsplb2, m_combosplb2);
  33. DDX_Control(pDX, IDC_COMBOsp2, m_combosp2);
  34. DDX_Control(pDX, IDC_COMBOsp, m_combosp);
  35. DDX_Control(pDX, IDC_COMBOsplb, m_combosplb);
  36. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  37. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  38. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  39. DDX_Control(pDX, IDC_LIST2, m_List1);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. DDX_Text(pDX, IDC_EDITyear, m_year);
  42. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  43. DDX_Text(pDX, IDC_EDITmonth, m_month);
  44. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  45. DDX_Text(pDX, IDC_EDITday, m_day);
  46. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  47. DDX_Check(pDX, IDC_CHECK1, m_check1);
  48. DDX_Radio(pDX, IDC_RADIO3, m_radio);
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(outsourcing4, CDialog)
  52. //{{AFX_MSG_MAP(outsourcing4)
  53. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  54. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  55. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  56. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  57. ON_CBN_SELCHANGE(IDC_COMBOsplb, OnSelchangeCOMBOsplb)
  58. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  59. ON_CBN_SELCHANGE(IDC_COMBOsplb2, OnSelchangeCOMBOsplb2)
  60. ON_CBN_SELCHANGE(IDC_COMBOsp2, OnSelchangeCOMBOsp2)
  61. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  62. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  63. ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
  64. ON_CBN_SELCHANGE(IDC_COMBOsplb3, OnSelchangeCOMBOsplb3)
  65. ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
  66. ON_CBN_CLOSEUP(IDC_COMBOsplb3, OnCloseupCOMBOsplb3)
  67. ON_CBN_SELCHANGE(IDC_COMBObranch, OnSelchangeCOMBObranch)
  68. //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70. /////////////////////////////////////////////////////////////////////////////
  71. // outsourcing4 diagnostics
  72. #ifdef _DEBUG
  73. void outsourcing4::AssertValid() const
  74. {
  75. CDialog::AssertValid();
  76. }
  77. void outsourcing4::Dump(CDumpContext& dc) const
  78. {
  79. CDialog::Dump(dc);
  80. }
  81. #endif //_DEBUG
  82. /////////////////////////////////////////////////////////////////////////////
  83. // outsourcing4 message handlers
  84. extern BOOL CALLBACK EnumChildProc2(HWND hwnd, LPARAM lParam);
  85. BOOL outsourcing4::OnInitDialog()
  86. {
  87. CDialog::OnInitDialog();
  88. // TODO: Add your specialized code here and/or call the base class
  89. int i = 0;
  90. if (g_bAllBranch)
  91. {
  92. GetDlgItem(IDC_STATIC3)->ShowWindow(SW_SHOW);
  93. GetDlgItem(IDC_COMBObranch)->ShowWindow(SW_SHOW);
  94. // m_combobranch.AddString ("");
  95. for ( i = 0; i < g_brancharray.GetSize(); i++)
  96. {
  97. m_combobranch.AddString(g_brancharray.ElementAt(i).ElementAt(0));
  98. }
  99. }
  100. CRect rc2;
  101. GetWindowRect(rc2);
  102. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  103. g_WidthScale2 = (float)g_rc.Width() / (float)rc2.Width(); // new/Old
  104. g_HeightScale2 = (float)g_rc.Height() / (float)rc2.Height();
  105. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc2, 0);
  106. m_waiter1.RefDroppedWidth();
  107. m_combosplb.GetWindowRect(rc2);
  108. ScreenToClient(rc2);
  109. rc2.bottom += 200;
  110. m_combosplb.MoveWindow(rc2);
  111. m_combosp.GetWindowRect(rc2);
  112. ScreenToClient(rc2);
  113. rc2.bottom += 200;
  114. m_combosp.MoveWindow(rc2);
  115. m_combosplb2.GetWindowRect(rc2);
  116. ScreenToClient(rc2);
  117. rc2.bottom += 200;
  118. m_combosplb2.MoveWindow(rc2);
  119. m_combosp2.GetWindowRect(rc2);
  120. ScreenToClient(rc2);
  121. rc2.bottom += 200;
  122. m_combosp2.MoveWindow(rc2);
  123. m_static1.SetFont(&g_titlefont);
  124. #ifdef CHILD_VERSION // 2015-05-18 添加制作费;
  125. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;产品名称,100;制作费,100;数量,100;是否发出,100;是否返工,100;返工日期,100;是否完成,100;完成日期,100" );
  126. #else
  127. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;产品名称,100;制作费,100;数量,100;是否发出,100;是否返工,100;返工日期,100;是否完成,100;完成日期,100");
  128. #endif
  129. m_List1.m_bSortSupport = 0;
  130. m_List1.LoadColumnInfo(180);
  131. m_spinyear.SetRange(1900, 3000);
  132. m_spinmonth.SetRange(1, 12);
  133. m_spinday.SetRange(1, 31);
  134. m_bInit = 1;
  135. DateChange();
  136. g_sendhead.bsql = 0;
  137. g_sendhead.code[0] = 2; // 商品类别表;
  138. g_sendhead.code[1] = 4; // 商品表;
  139. g_sendhead.code[2] = 9; // 供应商表;
  140. g_sendhead.tabcount = 3;
  141. g_pMainWnd->ProcessChatMessageRequest2(1);
  142. if (g_bSendOK == 0)
  143. {
  144. CDialog::OnOK();
  145. return 0;
  146. }
  147. CArray<CStringArray, CStringArray>g_List2array;
  148. DataToArray(&g_List1array, &m_List3array, &g_List2array);
  149. m_combosplb2.ResetContent();
  150. m_combosplb2.AddString("全部");
  151. for ( i = 0; i < g_List1array.GetSize(); i++)
  152. m_combosplb2.AddString(g_List1array.ElementAt(i).ElementAt(0));
  153. m_combosplb.ResetContent();
  154. m_combosplb.AddString("全部");
  155. for (i = 0; i < g_List2array.GetSize(); i++)
  156. {
  157. m_combosplb.AddString(g_List2array.ElementAt(i).ElementAt(1));
  158. }
  159. m_combosplb.SetCurSel(0);
  160. return TRUE;
  161. }
  162. void outsourcing4::FillGrid()
  163. {
  164. UpdateData();
  165. if (m_radio == 1)
  166. {
  167. FillGrid2();
  168. return;
  169. }
  170. else if (m_radio == 2)
  171. {
  172. FillGrid3();
  173. return;
  174. }
  175. m_List1.DeleteAllItems2();
  176. int ii = 0;
  177. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  178. int count = 0;
  179. CString str;
  180. CString splb = "全部";
  181. int pos = m_combosplb.GetCurSel();
  182. if (pos != -1)
  183. {
  184. m_combosplb.GetLBText(pos, splb);
  185. }
  186. if (splb == "全部")
  187. {
  188. if (!m_check1)
  189. {
  190. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  191. {
  192. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  193. }
  194. }
  195. else
  196. {
  197. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  198. {
  199. //if (m_List1array.ElementAt(ii).ElementAt(7) == "OK")continue;
  200. if (m_List1array.ElementAt(ii).ElementAt(8) == "OK")continue;
  201. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  202. if (m_List1.m_arLabels.ElementAt(count - 1).ElementAt(0) == "")
  203. {
  204. int aa = ii;
  205. while (aa)
  206. {
  207. if (m_List1array.ElementAt(aa).ElementAt(0) != "")break;
  208. aa--;
  209. }
  210. m_List1.m_arLabels.ElementAt(count - 1).SetAt(0, m_List1array.ElementAt(aa).ElementAt(0));
  211. m_List1.m_arLabels.ElementAt(count - 1).SetAt(1, m_List1array.ElementAt(aa).ElementAt(1));
  212. m_List1.m_arLabels.ElementAt(count - 1).SetAt(2, m_List1array.ElementAt(aa).ElementAt(2));
  213. }
  214. }
  215. }
  216. }
  217. else
  218. {
  219. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  220. {
  221. if (m_List1array.ElementAt(ii).ElementAt(6).GetLength() < 4)continue;
  222. if (m_List1array.ElementAt(ii).ElementAt(6).Right(m_List1array.ElementAt(ii).ElementAt(6).GetLength() - 4) != splb)continue;
  223. if (m_List1array.ElementAt(ii).ElementAt(7).Find("工厂") == -1)continue;
  224. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  225. if (m_List1.m_arLabels.ElementAt(count - 1).ElementAt(0) == "")
  226. {
  227. int aa = ii;
  228. while (aa)
  229. {
  230. if (m_List1array.ElementAt(aa).ElementAt(0) != "")break;
  231. aa--;
  232. }
  233. m_List1.m_arLabels.ElementAt(count - 1).SetAt(0, m_List1array.ElementAt(aa).ElementAt(0));
  234. m_List1.m_arLabels.ElementAt(count - 1).SetAt(1, m_List1array.ElementAt(aa).ElementAt(1));
  235. m_List1.m_arLabels.ElementAt(count - 1).SetAt(2, m_List1array.ElementAt(aa).ElementAt(2));
  236. }
  237. }
  238. }
  239. m_List1.m_arLabels.SetSize(count, 1);
  240. ii = count;
  241. m_List1.m_LabelCount = ii;
  242. m_List1.SetItemCountEx(ii);
  243. str.Format("项目:%d", ii);
  244. SetDlgItemText(IDC_STATIC2, str);
  245. }
  246. void outsourcing4::OnBUTclose()
  247. {
  248. // TODO: Add your control notification handler code here
  249. CDialog::OnCancel();
  250. }
  251. void outsourcing4::OnChangeEDITyear()
  252. {
  253. DateChange();
  254. }
  255. void outsourcing4::OnChangeEDITmonth()
  256. {
  257. DateChange();
  258. }
  259. void outsourcing4::OnChangeEDITday()
  260. {
  261. }
  262. void outsourcing4::DateChange()
  263. {
  264. if (m_bInit == 0)return;
  265. m_spinyear.EnableWindow(0);
  266. m_spinmonth.EnableWindow(0);
  267. m_spinday.EnableWindow(0);
  268. UpdateData();
  269. if (m_branch != "")
  270. {
  271. g_pMainWnd->OnDisconnect();
  272. g_branchip = GetIP(m_branch);
  273. g_pMainWnd->OnDisconnect();
  274. g_branchname = m_branch;
  275. g_bBranchModify = 1;
  276. }
  277. int i;
  278. int g_nYearposTemp = g_nYearpos;
  279. BOOL bLastYear = 0;
  280. BOOL bThisYear = 0;
  281. #if JEFF_TEST_ON // 2015开始禁用跨年数据;
  282. int g_nYearposPre = -1;
  283. if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize())
  284. {
  285. g_nYearpos = -1;
  286. bThisYear = 1;
  287. if (m_year == 2014)
  288. {
  289. g_nYearposPre = GetYearPos(m_year - 1);
  290. }
  291. }
  292. else if (m_year <= 2013 && g_hisyeararray.GetSize())
  293. {
  294. g_nYearpos = GetYearPos(m_year);
  295. if (g_nYearpos != -1)
  296. g_nYearposPre = GetYearPos(m_year - 1);
  297. bLastYear = 1;
  298. }
  299. #else
  300. if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  301. bThisYear=1;
  302. else if(m_year<=atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  303. bLastYear=1;
  304. g_nYearpos=GetYearPos(m_year);
  305. int g_nYearposPre=GetYearPos(m_year-1);
  306. #endif
  307. g_sendhead.bsql = 0;
  308. g_sendhead.code[0] = 219;
  309. g_sendhead.tabcount = 1;
  310. CString sql, strdate, strdate2;
  311. strdate.Format("%04d-%02d-%02d", m_year, m_month, 1);
  312. strdate2.Format("%04d-%02d-%02d", m_year, m_month, 31);
  313. m_static1.SetWindowText(strdate.Left(7) + "返工资料");
  314. sql.Format("[date2]>='" + strdate + "' and [date2]<='" + strdate2 + "' and [status4] like '返';");
  315. g_pMainWnd->ProcessChatMessageRequest2(sql);
  316. if (g_bSendOK == 0)
  317. {
  318. m_spinyear.EnableWindow(1);
  319. m_spinmonth.EnableWindow(1);
  320. m_spinday.EnableWindow(1);
  321. g_nYearpos = g_nYearposTemp;
  322. return;
  323. }
  324. DataToArray(&m_List1array);
  325. if (bLastYear)//如果是去年, 则加今年的补款
  326. {
  327. g_nYearpos = -1;//今年
  328. g_sendhead.bsql = 0;
  329. g_sendhead.code[0] = 219;
  330. g_sendhead.tabcount = 1;
  331. g_pMainWnd->ProcessChatMessageRequest2(sql);
  332. if (g_bSendOK == 0)
  333. {
  334. m_spinyear.EnableWindow(1);
  335. m_spinmonth.EnableWindow(1);
  336. m_spinday.EnableWindow(1);
  337. g_nYearpos = g_nYearposTemp;
  338. return;
  339. }
  340. CArray<CStringArray, CStringArray>ThisYearList1array;
  341. DataToArray(&ThisYearList1array);
  342. int oldsize = m_List1array.GetSize();
  343. m_List1array.SetSize(oldsize + ThisYearList1array.GetSize());
  344. for (i = oldsize; i < oldsize + ThisYearList1array.GetSize(); i++)
  345. {
  346. m_List1array.ElementAt(i).Copy(ThisYearList1array.ElementAt(i - oldsize));
  347. }
  348. }
  349. if (g_nYearposPre != -1)//如果是今年, 则加去年的补款
  350. {
  351. g_nYearpos = g_nYearposPre;//去年
  352. g_sendhead.bsql = 0;
  353. g_sendhead.code[0] = 219;
  354. g_sendhead.tabcount = 1;
  355. g_pMainWnd->ProcessChatMessageRequest2(sql);
  356. if (g_bSendOK == 0)
  357. {
  358. m_spinyear.EnableWindow(1);
  359. m_spinmonth.EnableWindow(1);
  360. m_spinday.EnableWindow(1);
  361. g_nYearpos = g_nYearposTemp;
  362. return;
  363. }
  364. CArray<CStringArray, CStringArray>ThisYearList1array;
  365. DataToArray(&ThisYearList1array);
  366. int oldsize = m_List1array.GetSize();
  367. m_List1array.SetSize(oldsize + ThisYearList1array.GetSize());
  368. for (i = oldsize; i < oldsize + ThisYearList1array.GetSize(); i++)
  369. {
  370. m_List1array.ElementAt(i).Copy(ThisYearList1array.ElementAt(i - oldsize));
  371. }
  372. }
  373. g_nYearpos = g_nYearposTemp;
  374. FillGrid();
  375. m_spinyear.EnableWindow(1);
  376. m_spinmonth.EnableWindow(1);
  377. m_spinday.EnableWindow(1);
  378. }
  379. void outsourcing4::OnSelchangeCOMBOsplb()
  380. {
  381. // TODO: Add your control notification handler code here
  382. FillGrid();
  383. }
  384. void outsourcing4::OnCheck1()
  385. {
  386. // TODO: Add your control notification handler code here
  387. FillGrid();
  388. }
  389. void outsourcing4::OnSelchangeCOMBOsplb2()
  390. {
  391. // TODO: Add your control notification handler code here
  392. int pos = m_combosplb2.GetCurSel();
  393. if (pos == -1)return;
  394. CString str;
  395. m_combosplb2.GetLBText(pos, str);
  396. m_combosp2.ResetContent();
  397. m_combosp2.AddString("全部");
  398. for (int ii = 0; ii < m_List3array.GetSize(); ii++)
  399. {
  400. if (m_List3array.ElementAt(ii).ElementAt(6) == str)
  401. {
  402. m_combosp2.AddString(m_List3array.ElementAt(ii).ElementAt(1));
  403. }
  404. }
  405. m_combosp2.SetCurSel(0);
  406. FillGrid();
  407. }
  408. void outsourcing4::FillGrid2()
  409. {
  410. m_List1.DeleteAllItems2();
  411. int ii = 0;
  412. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  413. int count = 0;
  414. CString str;
  415. CString splb = "全部";
  416. CString sp = "全部";
  417. int pos = m_combosplb2.GetCurSel();
  418. if (pos != -1)
  419. {
  420. m_combosplb2.GetLBText(pos, splb);
  421. }
  422. pos = m_combosp2.GetCurSel();
  423. if (pos != -1)
  424. {
  425. m_combosp2.GetLBText(pos, sp);
  426. }
  427. if (splb == "全部")
  428. {
  429. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  430. {
  431. if (m_check1)
  432. {
  433. if (m_List1array.ElementAt(ii).ElementAt(8) == "OK")continue;
  434. }
  435. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  436. }
  437. }
  438. else
  439. {
  440. if (sp != "全部")
  441. {
  442. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  443. {
  444. if (sp != m_List1array.ElementAt(ii).ElementAt(3))continue;
  445. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  446. if (m_List1.m_arLabels.ElementAt(count - 1).ElementAt(0) == "")
  447. {
  448. int aa = ii;
  449. while (aa)
  450. {
  451. if (m_List1array.ElementAt(aa).ElementAt(0) != "")break;
  452. aa--;
  453. }
  454. m_List1.m_arLabels.ElementAt(count - 1).SetAt(0, m_List1array.ElementAt(aa).ElementAt(0));
  455. m_List1.m_arLabels.ElementAt(count - 1).SetAt(1, m_List1array.ElementAt(aa).ElementAt(1));
  456. m_List1.m_arLabels.ElementAt(count - 1).SetAt(2, m_List1array.ElementAt(aa).ElementAt(2));
  457. }
  458. }
  459. }
  460. else
  461. {
  462. CStringArray cursparray;
  463. for (int aa = 0; aa < m_combosp2.GetCount(); aa++)
  464. {
  465. m_combosp2.GetLBText(aa, str);
  466. cursparray.Add(str);
  467. }
  468. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  469. {
  470. BOOL bFind = 0;
  471. for (int aa = 0; aa < cursparray.GetSize(); aa++)
  472. {
  473. if (cursparray.ElementAt(aa) == m_List1array.ElementAt(ii).ElementAt(3))
  474. {
  475. bFind = 1; break;
  476. }
  477. }
  478. if (bFind == 0)continue;
  479. if (m_check1)
  480. {
  481. if (m_List1array.ElementAt(ii).ElementAt(8) == "OK")continue;
  482. }
  483. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  484. if (m_List1.m_arLabels.ElementAt(count - 1).ElementAt(0) == "")
  485. {
  486. int aa = ii;
  487. while (aa)
  488. {
  489. if (m_List1array.ElementAt(aa).ElementAt(0) != "")break;
  490. aa--;
  491. }
  492. m_List1.m_arLabels.ElementAt(count - 1).SetAt(0, m_List1array.ElementAt(aa).ElementAt(0));
  493. m_List1.m_arLabels.ElementAt(count - 1).SetAt(1, m_List1array.ElementAt(aa).ElementAt(1));
  494. m_List1.m_arLabels.ElementAt(count - 1).SetAt(2, m_List1array.ElementAt(aa).ElementAt(2));
  495. }
  496. }
  497. }
  498. }
  499. m_List1.m_arLabels.SetSize(count, 1);
  500. ii = count;
  501. m_List1.m_LabelCount = ii;
  502. m_List1.SetItemCountEx(ii);
  503. str.Format("项目:%d", ii);
  504. SetDlgItemText(IDC_STATIC2, str);
  505. }
  506. void outsourcing4::OnSelchangeCOMBOsp2()
  507. {
  508. // TODO: Add your control notification handler code here
  509. FillGrid();
  510. }
  511. void outsourcing4::OnRadio3()
  512. {
  513. // TODO: Add your control notification handler code here
  514. UpdateData();
  515. GetDlgItem(IDC_STATIC5)->ShowWindow(m_radio == 0);
  516. GetDlgItem(IDC_COMBOsplb)->ShowWindow(m_radio == 0);
  517. GetDlgItem(IDC_STATIC6)->ShowWindow(m_radio == 1);
  518. GetDlgItem(IDC_STATIC7)->ShowWindow(m_radio == 1);
  519. GetDlgItem(IDC_COMBOsplb2)->ShowWindow(m_radio == 1);
  520. GetDlgItem(IDC_COMBOsp2)->ShowWindow(m_radio == 1);
  521. GetDlgItem(IDC_STATIC8)->ShowWindow(m_radio == 2);
  522. GetDlgItem(IDC_COMBOsplb3)->ShowWindow(m_radio == 2);
  523. FillGrid();
  524. }
  525. void outsourcing4::OnRadio4()
  526. {
  527. // TODO: Add your control notification handler code here
  528. OnRadio3();
  529. }
  530. void outsourcing4::OnBUTprint()
  531. {
  532. // TODO: Add your control notification handler code here
  533. UpdateData();
  534. CString str;
  535. str.Format("c:\\%d%02d返工资料.xls", m_year, m_month);
  536. ListToXLS(&m_List1, str, 0);
  537. }
  538. void outsourcing4::OnSelchangeCOMBOsplb3()
  539. {
  540. // TODO: Add your control notification handler code here
  541. }
  542. void outsourcing4::OnCloseupCOMBOsplb3()
  543. {
  544. // TODO: Add your control notification handler code here
  545. FillGrid();
  546. }
  547. void outsourcing4::OnRadio5()
  548. {
  549. // TODO: Add your control notification handler code here
  550. OnRadio3();
  551. }
  552. void outsourcing4::FillGrid3()
  553. {
  554. UpdateData();
  555. m_List1.DeleteAllItems2();
  556. int ii = 0;
  557. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  558. int count = 0;
  559. CString str;
  560. CString splb = "全部";
  561. int pos = m_waiter1.GetCurSel();
  562. if (pos != -1)
  563. {
  564. m_waiter1.GetLBText(pos, splb);
  565. }
  566. if (splb == "全部" || splb == "")
  567. {
  568. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  569. {
  570. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  571. }
  572. }
  573. else
  574. {
  575. splb = "员工:" + splb;
  576. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  577. {
  578. // if(m_List1array.ElementAt (ii).ElementAt (5).GetLength ()<4)continue;
  579. // if(m_List1array.ElementAt (ii).ElementAt (5).Right (m_List1array.ElementAt (ii).ElementAt (5).GetLength ()-4)!=splb)continue;
  580. if (m_List1array.ElementAt(ii).ElementAt(7).Find(splb) == -1)continue;
  581. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  582. if (m_List1.m_arLabels.ElementAt(count - 1).ElementAt(0) == "")
  583. {
  584. int aa = ii;
  585. while (aa)
  586. {
  587. if (m_List1array.ElementAt(aa).ElementAt(0) != "")break;
  588. aa--;
  589. }
  590. m_List1.m_arLabels.ElementAt(count - 1).SetAt(0, m_List1array.ElementAt(aa).ElementAt(0));
  591. m_List1.m_arLabels.ElementAt(count - 1).SetAt(1, m_List1array.ElementAt(aa).ElementAt(1));
  592. m_List1.m_arLabels.ElementAt(count - 1).SetAt(2, m_List1array.ElementAt(aa).ElementAt(2));
  593. }
  594. }
  595. }
  596. m_List1.m_arLabels.SetSize(count, 1);
  597. ii = count;
  598. m_List1.m_LabelCount = ii;
  599. m_List1.SetItemCountEx(ii);
  600. str.Format("项目:%d", ii);
  601. SetDlgItemText(IDC_STATIC2, str);
  602. }
  603. void outsourcing4::OnSelchangeCOMBObranch()
  604. {
  605. int pos = m_combobranch.GetCurSel();
  606. if (pos == -1)return;
  607. m_combobranch.GetLBText(pos, m_branch);
  608. DateChange();
  609. g_sendhead.bsql = 0;
  610. g_sendhead.code[0] = 2;
  611. g_sendhead.code[1] = 4;
  612. g_sendhead.code[2] = 9;
  613. g_sendhead.tabcount = 3;
  614. g_pMainWnd->ProcessChatMessageRequest2(1);
  615. if (g_bSendOK == 0)
  616. {
  617. return;
  618. }
  619. CArray<CStringArray, CStringArray>g_List2array;
  620. DataToArray(&g_List1array, &m_List3array, &g_List2array);
  621. m_combosplb2.ResetContent();
  622. m_combosplb2.AddString("全部");
  623. int i = 0;
  624. for ( i = 0; i < g_List1array.GetSize(); i++)
  625. m_combosplb2.AddString(g_List1array.ElementAt(i).ElementAt(0));
  626. m_combosplb.ResetContent();
  627. m_combosplb.AddString("全部");
  628. for (i = 0; i < g_List2array.GetSize(); i++)
  629. {
  630. m_combosplb.AddString(g_List2array.ElementAt(i).ElementAt(1));
  631. }
  632. m_combosplb.SetCurSel(0);
  633. }