outsourcing2.cpp 22 KB

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