outsourcing2.cpp 22 KB

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