MonthForm2.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. // MonthForm2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "MonthForm2.h"
  6. #include "MyMdi.H"
  7. #include "SelExpendType.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // MonthForm2
  15. IMPLEMENT_DYNCREATE(MonthForm2, MyFormView)
  16. MonthForm2::MonthForm2()
  17. : MyFormView(MonthForm2::IDD)
  18. {
  19. m_year = atoi(g_date.Mid (0,4));
  20. m_month = atoi(g_date.Mid (5,2));
  21. m_day = atoi(g_date.Mid (8,2));
  22. m_radio1 = 3;
  23. m_bInit=0;
  24. m_timestmap=0;
  25. m_radio2 = 0;
  26. //}}AFX_DATA_INIT
  27. }
  28. MonthForm2::~MonthForm2()
  29. {
  30. }
  31. void MonthForm2::DoDataExchange(CDataExchange* pDX)
  32. {
  33. MyFormView::DoDataExchange(pDX);
  34. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  35. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  36. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  37. DDX_Control(pDX, IDC_LIST2, m_List1);
  38. DDX_Control(pDX, IDC_STATIC1, m_static1);
  39. DDX_Text(pDX, IDC_EDITyear, m_year);
  40. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  41. DDX_Text(pDX, IDC_EDITmonth, m_month);
  42. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  43. DDX_Text(pDX, IDC_EDITday, m_day);
  44. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  45. DDX_Radio(pDX, IDC_RADIO3, m_radio1);
  46. DDX_Radio(pDX, IDC_RADIO14, m_radio2);
  47. //}}AFX_DATA_MAP
  48. }
  49. BEGIN_MESSAGE_MAP(MonthForm2, MyFormView)
  50. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  51. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  52. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  53. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  54. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  55. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  56. ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
  57. ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
  58. ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
  59. ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
  60. ON_BN_CLICKED(IDC_RADIO9, OnRadio9)
  61. ON_BN_CLICKED(IDC_RADIO10, OnRadio10)
  62. ON_BN_CLICKED(IDC_RADIO11, OnRadio11)
  63. ON_BN_CLICKED(IDC_RADIO12, OnRadio12)
  64. ON_BN_CLICKED(IDC_RADIO13, OnRadio13)
  65. ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
  66. ON_BN_CLICKED(IDC_BUTprint5, OnBUTprint5)
  67. ON_BN_CLICKED(IDC_BUTprint4, OnBUTprint4)
  68. ON_BN_CLICKED(IDC_RADIO14, OnRadio14)
  69. ON_BN_CLICKED(IDC_RADIO15, OnRadio15)
  70. ON_BN_CLICKED(IDC_RADIO16, OnRadio16)
  71. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  72. ON_BN_CLICKED(IDC_BUTprint6, OnBUTprint6)
  73. ON_BN_CLICKED(IDC_BUTprint7, OnBUTprint7)
  74. //}}AFX_MSG_MAP
  75. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  76. END_MESSAGE_MAP()
  77. /////////////////////////////////////////////////////////////////////////////
  78. // MonthForm2 diagnostics
  79. #ifdef _DEBUG
  80. void MonthForm2::AssertValid() const
  81. {
  82. MyFormView::AssertValid();
  83. }
  84. void MonthForm2::Dump(CDumpContext& dc) const
  85. {
  86. MyFormView::Dump(dc);
  87. }
  88. #endif //_DEBUG
  89. /////////////////////////////////////////////////////////////////////////////
  90. // MonthForm2 message handlers
  91. void MonthForm2::OnInitialUpdate()
  92. {
  93. //AfxMessageBox("void MonthForm2::OnInitialUpdate()");
  94. // LOG4C((LOG_NOTICE,"月财务报表2::OnInitialUpdate"));
  95. MyFormView::OnInitialUpdate();
  96. // TODO: Add your specialized code here and/or call the base class
  97. CMyMdi Mdi;
  98. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  99. // Here we create the outbar control using the splitter as its parent
  100. // and setting its id to the first pane.
  101. CRect rc2;
  102. GetWindowRect(rc2);
  103. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  104. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  105. m_static1.SetFont (&g_titlefont);
  106. int idarray[]={IDC_BUTprint5,IDC_BUTprint6,IDC_BUTprint7,IDC_BUTprint,IDC_BUTclose};
  107. int idcount=5;
  108. int btnwid;
  109. CRect prerc;
  110. for(int a=idcount-2; a>=0; a--)
  111. {
  112. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  113. ScreenToClient(prerc);
  114. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  115. ScreenToClient(rc2);
  116. btnwid=rc2.Width ();
  117. rc2.right =prerc.left ;
  118. rc2.left =rc2.right -btnwid;
  119. GetDlgItem(idarray[a])->MoveWindow (rc2);
  120. }
  121. #ifdef LYFZ_VERSION
  122. m_List1.SetHeadings("id,0;项目名称,180;金额,100;日期,150;收银,90;发票/收据,100;钟总审核,150;钟经理审核,150;肖工审核,150" );
  123. #else
  124. GetDlgItem(IDC_BUTprint5)->SetWindowText("财务审核");
  125. GetDlgItem(IDC_BUTprint6)->SetWindowText("经理审核");
  126. GetDlgItem(IDC_BUTprint7)->SetWindowText("老总审核");
  127. m_List1.SetHeadings("id,0;项目名称,180;金额,100;日期,150;收银,90;发票/收据,100;财务审核,150;经理审核,150;老总审核,150" );
  128. #endif
  129. m_List1.LoadColumnInfo (301);
  130. m_spinyear.SetRange (1900, 3000);
  131. m_spinmonth.SetRange (1, 12);
  132. m_spinday.SetRange (1, 31);
  133. m_bInit=1;
  134. DateChange();
  135. }
  136. void MonthForm2::FillGrid()
  137. {
  138. m_List1.DeleteAllItems2 ();
  139. int ii=0;
  140. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  141. int count=0;
  142. CString str;float payout=0;
  143. if(m_radio2==0)
  144. {
  145. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  146. {
  147. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  148. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  149. }
  150. }
  151. else if(m_radio2==1)
  152. {
  153. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  154. {
  155. if(atoi(m_List1array.ElementAt (ii).ElementAt (2))<10000)
  156. {
  157. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  158. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  159. }
  160. }
  161. }
  162. else if(m_radio2==2)
  163. {
  164. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  165. {
  166. if(atoi(m_List1array.ElementAt (ii).ElementAt (2))>=10000)
  167. {
  168. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  169. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  170. }
  171. }
  172. }
  173. str.Format ("%d", count);
  174. SetDlgItemText(IDC_EDITmoney1, str);
  175. str.Format ("%0.2f", payout);
  176. ::ConvertToPrice (str);
  177. SetDlgItemText(IDC_EDITmoney2, str);
  178. m_List1.m_arLabels.SetSize(count, 1);
  179. ii=count;
  180. m_List1.m_LabelCount=ii;
  181. m_List1.SetItemCountEx (ii);
  182. // str.Format ("单数:%d", ii);
  183. // SetDlgItemText(IDC_STATIC2, str);
  184. }
  185. void MonthForm2::OnBUTclose()
  186. {
  187. // TODO: Add your control notification handler code here
  188. GetParent()->SendMessage(WM_CLOSE);
  189. }
  190. void MonthForm2::OnChangeEDITyear()
  191. {
  192. // TODO: If this is a RICHEDIT control, the control will not
  193. // send this notification unless you override the MyFormView::OnInitDialog()
  194. // function and call CRichEditCtrl().SetEventMask()
  195. // with the ENM_CHANGE flag ORed into the mask.
  196. DateChange();
  197. // TODO: Add your control notification handler code here
  198. }
  199. void MonthForm2::OnChangeEDITmonth()
  200. {
  201. // TODO: If this is a RICHEDIT control, the control will not
  202. // send this notification unless you override the MyFormView::OnInitDialog()
  203. // function and call CRichEditCtrl().SetEventMask()
  204. // with the ENM_CHANGE flag ORed into the mask.
  205. DateChange();
  206. // TODO: Add your control notification handler code here
  207. }
  208. void MonthForm2::OnChangeEDITday()
  209. {
  210. // TODO: If this is a RICHEDIT control, the control will not
  211. // send this notification unless you override the MyFormView::OnInitDialog()
  212. // function and call CRichEditCtrl().SetEventMask()
  213. // with the ENM_CHANGE flag ORed into the mask.
  214. // DateChange();
  215. // TODO: Add your control notification handler code here
  216. }
  217. void MonthForm2::DateChange()
  218. {
  219. if(m_bInit==0)return;
  220. m_spinyear.EnableWindow(0);
  221. m_spinmonth.EnableWindow(0);
  222. m_spinday.EnableWindow(0);
  223. UpdateData();
  224. int i;
  225. int g_nYearposTemp=g_nYearpos;
  226. BOOL bLastYear=0;
  227. BOOL bThisYear=0;
  228. #if JEFF_TEST_ON // 2015开始禁用跨年数据;
  229. int g_nYearposPre = -1;
  230. if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize())
  231. {
  232. g_nYearpos = -1;
  233. bThisYear = 1;
  234. if (m_year == 2014)
  235. {
  236. g_nYearposPre = GetYearPos(m_year - 1);
  237. }
  238. }
  239. else if (m_year <= 2013 && g_hisyeararray.GetSize())
  240. {
  241. g_nYearpos = GetYearPos(m_year);
  242. if (g_nYearpos != -1)
  243. g_nYearposPre = GetYearPos(m_year - 1);
  244. bLastYear = 1;
  245. }
  246. #else
  247. if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  248. bThisYear=1;
  249. else if(m_year<=atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  250. bLastYear=1;
  251. g_nYearpos=GetYearPos(m_year);
  252. int g_nYearposPre=GetYearPos(m_year-1);
  253. #endif
  254. g_sendhead.bsql=0;
  255. g_sendhead.code[0]=14;
  256. g_sendhead.code[1]=13;
  257. g_sendhead.code[2]=16;
  258. g_sendhead.code[3]=198;
  259. g_sendhead.code[4]=216;
  260. g_sendhead.tabcount=5;
  261. CString sql,strdate,strdate2;
  262. strdate.Format ("%04d-%02d-%02d", m_year, m_month, 1);
  263. strdate2.Format ("%04d-%02d-%02d", m_year, m_month, 31);
  264. CRect rc;
  265. m_static1.GetWindowRect (rc);
  266. ScreenToClient(rc);
  267. InvalidateRect(rc);
  268. m_static1.SetWindowText (strdate.Left (7)+"支出报表");
  269. sql.Format ("dat>='"+strdate+"' and dat<='"+strdate2+"' and (sale2type is null or sale2type='');dat>='"+strdate+"' and dat<='"+strdate2+"';date>='"+strdate+"' and date<='"+strdate2+"';date>='"+strdate+"' and date<='"+strdate2+"';date>='"+strdate+"' and date<='"+strdate2+"'");
  270. g_pMainWnd->ProcessChatMessageRequest2(sql);
  271. if(g_bSendOK==0)
  272. {
  273. g_nYearpos=g_nYearposTemp;
  274. m_spinyear.EnableWindow(1);
  275. m_spinmonth.EnableWindow(1);
  276. m_spinday.EnableWindow(1);
  277. return;
  278. }
  279. DataToArray(&List2array,&List3array,&List11array,&other2salearray,&memberarray);
  280. if(bLastYear)//如果是去年, 则加今年的补款
  281. {
  282. g_nYearpos=-1;//今年
  283. g_sendhead.bsql=0;
  284. g_sendhead.code[0]=14;
  285. g_sendhead.code[1]=13;
  286. g_sendhead.code[2]=16;
  287. g_sendhead.code[3]=198;
  288. g_sendhead.code[4]=216;
  289. g_sendhead.tabcount=5;
  290. g_pMainWnd->ProcessChatMessageRequest2(sql);
  291. if(g_bSendOK==0)
  292. {
  293. g_nYearpos=g_nYearposTemp;
  294. m_spinyear.EnableWindow(1);
  295. m_spinmonth.EnableWindow(1);
  296. m_spinday.EnableWindow(1);
  297. return;
  298. }
  299. CArray<CStringArray, CStringArray>ThisYearList11array;
  300. CArray<CStringArray, CStringArray>ThisYearList3array;
  301. CArray<CStringArray, CStringArray>ThisYearList2array;
  302. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  303. CArray<CStringArray, CStringArray>ThisYearmemberarray;
  304. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray, &ThisYearmemberarray);
  305. int oldsize=List11array.GetSize ();
  306. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  307. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  308. {
  309. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  310. }
  311. oldsize=List3array.GetSize ();
  312. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  313. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  314. {
  315. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  316. }
  317. oldsize=List2array.GetSize ();
  318. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  319. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  320. {
  321. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  322. }
  323. oldsize=other2salearray.GetSize ();
  324. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  325. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  326. {
  327. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  328. }
  329. oldsize=memberarray.GetSize ();
  330. memberarray.SetSize(oldsize+ThisYearmemberarray.GetSize ());
  331. for(i=oldsize; i<oldsize+ThisYearmemberarray.GetSize (); i++)
  332. {
  333. memberarray.ElementAt (i).Copy(ThisYearmemberarray.ElementAt (i-oldsize));
  334. }
  335. }
  336. if(g_nYearposPre!=-1)//如果是今年, 则加去年的补款
  337. {
  338. g_nYearpos=g_nYearposPre;//去年
  339. g_sendhead.bsql=0;
  340. g_sendhead.code[0]=14;
  341. g_sendhead.code[1]=13;
  342. g_sendhead.code[2]=16;
  343. g_sendhead.code[3]=198;
  344. g_sendhead.tabcount=4;
  345. g_pMainWnd->ProcessChatMessageRequest2(sql);
  346. if(g_bSendOK==0)
  347. {
  348. g_nYearpos=g_nYearposTemp;
  349. m_spinyear.EnableWindow(1);
  350. m_spinmonth.EnableWindow(1);
  351. m_spinday.EnableWindow(1);
  352. return;
  353. }
  354. CArray<CStringArray, CStringArray>ThisYearList11array;
  355. CArray<CStringArray, CStringArray>ThisYearList3array;
  356. CArray<CStringArray, CStringArray>ThisYearList2array;
  357. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  358. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray);
  359. int oldsize=List11array.GetSize ();
  360. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  361. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  362. {
  363. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  364. }
  365. oldsize=List3array.GetSize ();
  366. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  367. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  368. {
  369. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  370. }
  371. oldsize=List2array.GetSize ();
  372. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  373. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  374. {
  375. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  376. }
  377. oldsize=other2salearray.GetSize ();
  378. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  379. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  380. {
  381. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  382. }
  383. }
  384. g_nYearpos=g_nYearposTemp;
  385. KindChange();
  386. m_spinyear.EnableWindow(1);
  387. m_spinmonth.EnableWindow(1);
  388. m_spinday.EnableWindow(1);
  389. }
  390. void MonthForm2::KindChange()
  391. {
  392. m_jdd="";
  393. CString str;
  394. int pos=0;
  395. int dindanshu=0;
  396. float income=0;
  397. float income2=0;
  398. float payout=0;
  399. int count=List2array.GetSize ()+List3array.GetSize ()+List11array.GetSize ()+other2salearray.GetSize ()+memberarray.GetSize ();
  400. m_List1array.RemoveAll ();
  401. m_List1array.SetSize(count);
  402. int i=0;
  403. if(m_radio1==3)
  404. {
  405. /*if(payoutdlg.GetSafeHwnd ()==NULL)
  406. {
  407. payoutdlg.Create (IDD_DLGPayOutSet, this);
  408. CRect rc;
  409. m_List1.GetWindowRect (rc);
  410. payoutdlg.MoveWindow2 (rc);
  411. payoutdlg.m_pParent=this;
  412. payoutdlg.m_mode=1;
  413. }
  414. payoutdlg.ShowWindow (SW_SHOW);*/
  415. }
  416. else
  417. {
  418. m_filter.Empty ();
  419. if(payoutdlg.GetSafeHwnd ())payoutdlg.ShowWindow (SW_HIDE);
  420. }
  421. for(i=0; i<List3array.GetSize (); i++)
  422. {
  423. if(List3array.ElementAt (i).ElementAt (7).IsEmpty ())
  424. List3array.ElementAt (i).SetAt (7, "未审核");
  425. if(List3array.ElementAt (i).ElementAt (9).IsEmpty ())
  426. List3array.ElementAt (i).SetAt (9, "未审核");
  427. if(List3array.ElementAt (i).ElementAt (10).IsEmpty ())
  428. List3array.ElementAt (i).SetAt (10, "未审核");
  429. List3array.ElementAt (i).SetAt (0, List3array.ElementAt (i).ElementAt (0)+":1");
  430. }
  431. if(m_radio1==3)//支出
  432. {
  433. for( i=0; i<List3array.GetSize (); i++)
  434. {
  435. if(List3array.ElementAt (i).ElementAt (6).GetLength ()>120)
  436. List3array.ElementAt (i).SetAt (6, List3array.ElementAt (i).ElementAt (6).Left (120)+"..");
  437. str=List3array.ElementAt (i).ElementAt (1)+";"+List3array.ElementAt (i).ElementAt (4)+";"+List3array.ElementAt (i).ElementAt (6);
  438. str.Replace (";;;;", ";");str.Replace (";;;", ";");str.Replace (";;", ";");
  439. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (0));
  440. m_List1array.ElementAt (pos).Add(str);
  441. str=List3array.ElementAt (i).ElementAt (2);
  442. m_List1array.ElementAt (pos).Add(str);
  443. payout+=atof(str);
  444. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (3)+" "+List3array.ElementAt (i).ElementAt (8));
  445. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (5));
  446. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (11));
  447. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (7));
  448. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (9));
  449. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (10));
  450. pos++;
  451. }
  452. }
  453. m_List1array.SetSize(pos);
  454. str.Format ("%0.2f", income);
  455. ::ConvertToPrice (str);
  456. SetDlgItemText(IDC_EDITmoney1, str);
  457. str.Format ("%0.2f", income2);
  458. ::ConvertToPrice (str);
  459. SetDlgItemText(IDC_EDITmoney5, str);
  460. str.Format ("%0.2f", payout);
  461. ::ConvertToPrice (str);
  462. SetDlgItemText(IDC_EDITmoney2, str);
  463. str.Format ("%0.2f", income-payout);
  464. ::ConvertToPrice (str);
  465. SetDlgItemText(IDC_EDITmoney3, str);
  466. str.Format ("%d", dindanshu);
  467. SetDlgItemText(IDC_EDITmoney4, str);
  468. FillGrid();
  469. }
  470. void MonthForm2::OnRadio3()
  471. {
  472. // TODO: Add your control notification handler code here
  473. UpdateData();
  474. KindChange();
  475. }
  476. void MonthForm2::OnRadio4()
  477. {
  478. // TODO: Add your control notification handler code here
  479. UpdateData();
  480. KindChange();
  481. }
  482. void MonthForm2::OnRadio5()
  483. {
  484. // TODO: Add your control notification handler code here
  485. UpdateData();
  486. KindChange();
  487. }
  488. void MonthForm2::OnRadio6()
  489. {
  490. // TODO: Add your control notification handler code here
  491. UpdateData();
  492. m_filter.Empty ();
  493. KindChange();
  494. }
  495. void MonthForm2::OnRadio7()
  496. {
  497. // TODO: Add your control notification handler code here
  498. UpdateData();
  499. KindChange();
  500. }
  501. void MonthForm2::OnRadio8()
  502. {
  503. // TODO: Add your control notification handler code here
  504. UpdateData();
  505. KindChange();
  506. }
  507. void MonthForm2::OnRadio9()
  508. {
  509. // TODO: Add your control notification handler code here
  510. UpdateData();
  511. KindChange();
  512. }
  513. void MonthForm2::OnRadio10()
  514. {
  515. // TODO: Add your control notification handler code here
  516. UpdateData();
  517. KindChange();
  518. }
  519. void MonthForm2::OnRadio11()
  520. {
  521. // TODO: Add your control notification handler code here
  522. UpdateData();
  523. KindChange();
  524. }
  525. void MonthForm2::OnRadio12()
  526. {
  527. // TODO: Add your control notification handler code here
  528. UpdateData();
  529. KindChange();
  530. }
  531. void MonthForm2::OnRadio13()
  532. {
  533. // TODO: Add your control notification handler code here
  534. UpdateData();
  535. KindChange();
  536. }
  537. void MonthForm2::OnBUTprint()
  538. {
  539. // TODO: Add your control notification handler code here
  540. POSITION pos;
  541. pos=m_List1.GetFirstSelectedItemPosition();
  542. if(pos==NULL)
  543. {
  544. AfxMessageBox("请先选中您要查看的项目!", MB_ICONINFORMATION);return;
  545. }
  546. int iItem=m_List1.GetNextSelectedItem(pos);
  547. CString m_id=m_List1.GetItemText (iItem, 0);
  548. int pos2=m_id.Find (":");
  549. if(pos2==-1)return;
  550. m_id=m_id.Left (pos2);
  551. char no[100];
  552. memset(no, 0, 100);
  553. strcpy(no, m_id);
  554. g_nSendCode=36;
  555. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)no, 100);
  556. g_nSendCode=0;
  557. if(g_bSendOK==0)
  558. {
  559. return;
  560. }
  561. CString path=g_mainpath+"\\1.jpg";
  562. ::DeleteFile(path); // 删除1.jpg;
  563. CFile fp;
  564. fp.Open(path, CFile::modeCreate|CFile::modeWrite);
  565. fp.Write(g_pData, g_nLeng);
  566. fp.Close();
  567. ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWMAXIMIZED);
  568. }
  569. void MonthForm2::TypeChange(CString str)
  570. {
  571. m_filter=str;
  572. FillGrid();
  573. }
  574. void MonthForm2::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  575. {
  576. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  577. // Take the default processing unless we set this to something else below.
  578. *pResult = 0;
  579. // First thing - check the draw stage. If it's the control's prepaint
  580. // stage, then tell Windows we want messages for every item.
  581. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  582. {
  583. *pResult = CDRF_NOTIFYITEMDRAW;
  584. }
  585. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  586. {
  587. // This is the prepaint stage for an item. Here's where we set the
  588. // item's text color. Our return value will tell Windows to draw the
  589. // item itself, but it will use the new color we set here.
  590. // We'll cycle the colors through red, green, and light blue.
  591. int cot=0;
  592. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (6).Find("已审核")!=-1)
  593. cot++;
  594. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7).Find("已审核")!=-1)
  595. cot++;
  596. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (8).Find("已审核")!=-1)
  597. cot++;
  598. if(cot==3)
  599. pLVCD->clrText = RGB(20,133,20);
  600. else if(cot==2)
  601. pLVCD->clrText = RGB(255,255,0);//RGB(138,194,10);
  602. else if(cot==1)
  603. pLVCD->clrText = RGB(255,255,0);
  604. else if(cot==0)
  605. pLVCD->clrText = RGB(220,0,0);
  606. if(pLVCD->nmcd.dwItemSpec%2)
  607. pLVCD->clrTextBk = g_gridcol1;
  608. else
  609. pLVCD->clrTextBk = g_gridcol2;
  610. // Store the color back in the NMLVCUSTOMDRAW struct.
  611. // Tell Windows to paint the control itself.
  612. *pResult = CDRF_DODEFAULT;
  613. }
  614. }
  615. void MonthForm2::OnBUTprint4()
  616. {
  617. // TODO: Add your control notification handler code here
  618. if(atoi(g_cominfoarray.ElementAt(0).ElementAt(115)))
  619. {
  620. SelExpendType dlg;
  621. dlg.m_mode=3;
  622. if(dlg.DoModal()==IDOK)
  623. {
  624. m_jdd=dlg.m_sel;
  625. FillGrid();
  626. }
  627. }
  628. }
  629. void MonthForm2::OnRadio14()
  630. {
  631. // TODO: Add your control notification handler code here
  632. UpdateData();
  633. FillGrid();
  634. }
  635. void MonthForm2::OnRadio15()
  636. {
  637. // TODO: Add your control notification handler code here
  638. UpdateData();
  639. FillGrid();
  640. }
  641. void MonthForm2::OnRadio16()
  642. {
  643. // TODO: Add your control notification handler code here
  644. UpdateData();
  645. FillGrid();
  646. }
  647. void MonthForm2::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  648. {
  649. // TODO: Add your control notification handler code here
  650. OnBUTprint();
  651. *pResult = 0;
  652. }
  653. void MonthForm2::OnBUTprint5()
  654. {
  655. // TODO: Add your control notification handler code here
  656. if(!IsHasRights2new(51))return;
  657. POSITION pos;
  658. pos=m_List1.GetFirstSelectedItemPosition();
  659. if(pos==NULL)
  660. {
  661. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  662. return;
  663. }
  664. int iItem;
  665. CStringArray array;
  666. int count=0;
  667. while (pos)
  668. {
  669. count++;
  670. if(count>100)
  671. {
  672. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  673. break;
  674. }
  675. iItem = m_List1.GetNextSelectedItem(pos);
  676. array.Add (m_List1.GetItemText (iItem, 0));
  677. }
  678. CString id,type,temp,sql;
  679. CString financecheck="已审核";
  680. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  681. financecheck="未审核";
  682. financecheck+="\\"+g_user.name;
  683. financecheck.Replace("(", "(");
  684. financecheck.Replace(")", ")");
  685. int pos2;
  686. for(int i=0; i<array.GetSize (); i++)
  687. {
  688. temp=array.ElementAt (i);
  689. pos2=temp.Find (":");
  690. if(pos2==-1)continue;
  691. id=temp.Left (pos2);
  692. type=temp.Right (1);
  693. if(type=="1")
  694. {
  695. temp.Format ("***update gudingfeiyong set financecheck='%s' where id=%s", financecheck, id);
  696. }
  697. sql+=temp;
  698. }
  699. sql.TrimLeft ("***");
  700. g_sendhead.bsql=1;
  701. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  702. DateChange();
  703. }
  704. void MonthForm2::OnBUTprint6()
  705. {
  706. // TODO: Add your control notification handler code here
  707. if(!IsHasRights2new(51))return;
  708. POSITION pos;
  709. pos=m_List1.GetFirstSelectedItemPosition();
  710. if(pos==NULL)
  711. {
  712. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  713. return;
  714. }
  715. int iItem;
  716. CStringArray array;
  717. int count=0;
  718. while (pos)
  719. {
  720. count++;
  721. if(count>100)
  722. {
  723. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  724. break;
  725. }
  726. iItem = m_List1.GetNextSelectedItem(pos);
  727. array.Add (m_List1.GetItemText (iItem, 0));
  728. }
  729. CString id,type,temp,sql;
  730. CString financecheck="已审核";
  731. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  732. financecheck="未审核";
  733. financecheck+="\\"+g_user.name;
  734. financecheck.Replace("(", "(");
  735. financecheck.Replace(")", ")");
  736. int pos2;
  737. for(int i=0; i<array.GetSize (); i++)
  738. {
  739. temp=array.ElementAt (i);
  740. pos2=temp.Find (":");
  741. if(pos2==-1)continue;
  742. id=temp.Left (pos2);
  743. type=temp.Right (1);
  744. if(type=="1")
  745. {
  746. temp.Format ("***update gudingfeiyong set financecheck2='%s' where id=%s", financecheck, id);
  747. }
  748. sql+=temp;
  749. }
  750. sql.TrimLeft ("***");
  751. g_sendhead.bsql=1;
  752. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  753. DateChange();
  754. }
  755. void MonthForm2::OnBUTprint7()
  756. {
  757. // TODO: Add your control notification handler code here
  758. if(!IsHasRights2new(51))return;
  759. POSITION pos;
  760. pos=m_List1.GetFirstSelectedItemPosition();
  761. if(pos==NULL)
  762. {
  763. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  764. return;
  765. }
  766. int iItem;
  767. CStringArray array;
  768. int count=0;
  769. while (pos)
  770. {
  771. count++;
  772. if(count>100)
  773. {
  774. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  775. break;
  776. }
  777. iItem = m_List1.GetNextSelectedItem(pos);
  778. array.Add (m_List1.GetItemText (iItem, 0));
  779. }
  780. CString id,type,temp,sql;
  781. CString financecheck="已审核";
  782. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  783. financecheck="未审核";
  784. financecheck+="\\"+g_user.name;
  785. financecheck.Replace("(", "(");
  786. financecheck.Replace(")", ")");
  787. int pos2;
  788. for(int i=0; i<array.GetSize (); i++)
  789. {
  790. temp=array.ElementAt (i);
  791. pos2=temp.Find (":");
  792. if(pos2==-1)continue;
  793. id=temp.Left (pos2);
  794. type=temp.Right (1);
  795. if(type=="1")
  796. {
  797. temp.Format ("***update gudingfeiyong set financecheck3='%s' where id=%s", financecheck, id);
  798. }
  799. sql+=temp;
  800. }
  801. sql.TrimLeft ("***");
  802. g_sendhead.bsql=1;
  803. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  804. DateChange();
  805. }