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