outsourcing2.cpp 23 KB

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