MonthForm2.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  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. GetDlgItem(IDC_BUTprint5)->SetWindowText("财务审核");
  122. GetDlgItem(IDC_BUTprint6)->SetWindowText("经理审核");
  123. GetDlgItem(IDC_BUTprint7)->SetWindowText("老总审核");
  124. m_List1.SetHeadings("id,0;项目名称,180;金额,100;日期,150;收银,90;发票/收据,100;财务审核,150;经理审核,150;老总审核,150" );
  125. m_List1.LoadColumnInfo (301);
  126. m_spinyear.SetRange (1900, 3000);
  127. m_spinmonth.SetRange (1, 12);
  128. m_spinday.SetRange (1, 31);
  129. m_bInit=1;
  130. DateChange();
  131. }
  132. void MonthForm2::FillGrid()
  133. {
  134. m_List1.DeleteAllItems2 ();
  135. int ii=0;
  136. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  137. int count=0;
  138. CString str;float payout=0;
  139. if(m_radio2==0)
  140. {
  141. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  142. {
  143. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  144. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  145. }
  146. }
  147. else if(m_radio2==1)
  148. {
  149. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  150. {
  151. if(atoi(m_List1array.ElementAt (ii).ElementAt (2))<10000)
  152. {
  153. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  154. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  155. }
  156. }
  157. }
  158. else if(m_radio2==2)
  159. {
  160. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  161. {
  162. if(atoi(m_List1array.ElementAt (ii).ElementAt (2))>=10000)
  163. {
  164. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  165. payout+=atof(m_List1array.ElementAt (ii).ElementAt (2));
  166. }
  167. }
  168. }
  169. str.Format ("%d", count);
  170. SetDlgItemText(IDC_EDITmoney1, str);
  171. str.Format ("%0.2f", payout);
  172. ::ConvertToPrice (str);
  173. SetDlgItemText(IDC_EDITmoney2, str);
  174. m_List1.m_arLabels.SetSize(count, 1);
  175. ii=count;
  176. m_List1.m_LabelCount=ii;
  177. m_List1.SetItemCountEx (ii);
  178. // str.Format ("单数:%d", ii);
  179. // SetDlgItemText(IDC_STATIC2, str);
  180. }
  181. void MonthForm2::OnBUTclose()
  182. {
  183. // TODO: Add your control notification handler code here
  184. GetParent()->SendMessage(WM_CLOSE);
  185. }
  186. void MonthForm2::OnChangeEDITyear()
  187. {
  188. // TODO: If this is a RICHEDIT control, the control will not
  189. // send this notification unless you override the MyFormView::OnInitDialog()
  190. // function and call CRichEditCtrl().SetEventMask()
  191. // with the ENM_CHANGE flag ORed into the mask.
  192. DateChange();
  193. // TODO: Add your control notification handler code here
  194. }
  195. void MonthForm2::OnChangeEDITmonth()
  196. {
  197. // TODO: If this is a RICHEDIT control, the control will not
  198. // send this notification unless you override the MyFormView::OnInitDialog()
  199. // function and call CRichEditCtrl().SetEventMask()
  200. // with the ENM_CHANGE flag ORed into the mask.
  201. DateChange();
  202. // TODO: Add your control notification handler code here
  203. }
  204. void MonthForm2::OnChangeEDITday()
  205. {
  206. // TODO: If this is a RICHEDIT control, the control will not
  207. // send this notification unless you override the MyFormView::OnInitDialog()
  208. // function and call CRichEditCtrl().SetEventMask()
  209. // with the ENM_CHANGE flag ORed into the mask.
  210. // DateChange();
  211. // TODO: Add your control notification handler code here
  212. }
  213. void MonthForm2::DateChange()
  214. {
  215. if(m_bInit==0)return;
  216. m_spinyear.EnableWindow(0);
  217. m_spinmonth.EnableWindow(0);
  218. m_spinday.EnableWindow(0);
  219. UpdateData();
  220. int i;
  221. int g_nYearposTemp=g_nYearpos;
  222. BOOL bLastYear=0;
  223. BOOL bThisYear=0;
  224. #if JEFF_TEST_ON // 2015开始禁用跨年数据;
  225. int g_nYearposPre = -1;
  226. if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize())
  227. {
  228. g_nYearpos = -1;
  229. bThisYear = 1;
  230. if (m_year == 2014)
  231. {
  232. g_nYearposPre = GetYearPos(m_year - 1);
  233. }
  234. }
  235. else if (m_year <= 2013 && g_hisyeararray.GetSize())
  236. {
  237. g_nYearpos = GetYearPos(m_year);
  238. if (g_nYearpos != -1)
  239. g_nYearposPre = GetYearPos(m_year - 1);
  240. bLastYear = 1;
  241. }
  242. #else
  243. if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  244. bThisYear=1;
  245. else if(m_year<=atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  246. bLastYear=1;
  247. g_nYearpos=GetYearPos(m_year);
  248. int g_nYearposPre=GetYearPos(m_year-1);
  249. #endif
  250. g_sendhead.bsql=0;
  251. g_sendhead.code[0]=14;
  252. g_sendhead.code[1]=13;
  253. g_sendhead.code[2]=16;
  254. g_sendhead.code[3]=198;
  255. g_sendhead.code[4]=216;
  256. g_sendhead.tabcount=5;
  257. CString sql,strdate,strdate2;
  258. strdate.Format ("%04d-%02d-%02d", m_year, m_month, 1);
  259. strdate2.Format ("%04d-%02d-%02d", m_year, m_month, 31);
  260. CRect rc;
  261. m_static1.GetWindowRect (rc);
  262. ScreenToClient(rc);
  263. InvalidateRect(rc);
  264. m_static1.SetWindowText (strdate.Left (7)+"支出报表");
  265. 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+"'");
  266. g_pMainWnd->ProcessChatMessageRequest2(sql);
  267. if(g_bSendOK==0)
  268. {
  269. g_nYearpos=g_nYearposTemp;
  270. m_spinyear.EnableWindow(1);
  271. m_spinmonth.EnableWindow(1);
  272. m_spinday.EnableWindow(1);
  273. return;
  274. }
  275. DataToArray(&List2array,&List3array,&List11array,&other2salearray,&memberarray);
  276. if(bLastYear)//如果是去年, 则加今年的补款
  277. {
  278. g_nYearpos=-1;//今年
  279. g_sendhead.bsql=0;
  280. g_sendhead.code[0]=14;
  281. g_sendhead.code[1]=13;
  282. g_sendhead.code[2]=16;
  283. g_sendhead.code[3]=198;
  284. g_sendhead.code[4]=216;
  285. g_sendhead.tabcount=5;
  286. g_pMainWnd->ProcessChatMessageRequest2(sql);
  287. if(g_bSendOK==0)
  288. {
  289. g_nYearpos=g_nYearposTemp;
  290. m_spinyear.EnableWindow(1);
  291. m_spinmonth.EnableWindow(1);
  292. m_spinday.EnableWindow(1);
  293. return;
  294. }
  295. CArray<CStringArray, CStringArray>ThisYearList11array;
  296. CArray<CStringArray, CStringArray>ThisYearList3array;
  297. CArray<CStringArray, CStringArray>ThisYearList2array;
  298. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  299. CArray<CStringArray, CStringArray>ThisYearmemberarray;
  300. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray, &ThisYearmemberarray);
  301. int oldsize=List11array.GetSize ();
  302. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  303. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  304. {
  305. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  306. }
  307. oldsize=List3array.GetSize ();
  308. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  309. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  310. {
  311. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  312. }
  313. oldsize=List2array.GetSize ();
  314. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  315. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  316. {
  317. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  318. }
  319. oldsize=other2salearray.GetSize ();
  320. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  321. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  322. {
  323. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  324. }
  325. oldsize=memberarray.GetSize ();
  326. memberarray.SetSize(oldsize+ThisYearmemberarray.GetSize ());
  327. for(i=oldsize; i<oldsize+ThisYearmemberarray.GetSize (); i++)
  328. {
  329. memberarray.ElementAt (i).Copy(ThisYearmemberarray.ElementAt (i-oldsize));
  330. }
  331. }
  332. if(g_nYearposPre!=-1)//如果是今年, 则加去年的补款
  333. {
  334. g_nYearpos=g_nYearposPre;//去年
  335. g_sendhead.bsql=0;
  336. g_sendhead.code[0]=14;
  337. g_sendhead.code[1]=13;
  338. g_sendhead.code[2]=16;
  339. g_sendhead.code[3]=198;
  340. g_sendhead.tabcount=4;
  341. g_pMainWnd->ProcessChatMessageRequest2(sql);
  342. if(g_bSendOK==0)
  343. {
  344. g_nYearpos=g_nYearposTemp;
  345. m_spinyear.EnableWindow(1);
  346. m_spinmonth.EnableWindow(1);
  347. m_spinday.EnableWindow(1);
  348. return;
  349. }
  350. CArray<CStringArray, CStringArray>ThisYearList11array;
  351. CArray<CStringArray, CStringArray>ThisYearList3array;
  352. CArray<CStringArray, CStringArray>ThisYearList2array;
  353. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  354. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray);
  355. int oldsize=List11array.GetSize ();
  356. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  357. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  358. {
  359. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  360. }
  361. oldsize=List3array.GetSize ();
  362. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  363. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  364. {
  365. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  366. }
  367. oldsize=List2array.GetSize ();
  368. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  369. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  370. {
  371. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  372. }
  373. oldsize=other2salearray.GetSize ();
  374. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  375. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  376. {
  377. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  378. }
  379. }
  380. g_nYearpos=g_nYearposTemp;
  381. KindChange();
  382. m_spinyear.EnableWindow(1);
  383. m_spinmonth.EnableWindow(1);
  384. m_spinday.EnableWindow(1);
  385. }
  386. void MonthForm2::KindChange()
  387. {
  388. m_jdd="";
  389. CString str;
  390. int pos=0;
  391. int dindanshu=0;
  392. float income=0;
  393. float income2=0;
  394. float payout=0;
  395. int count=List2array.GetSize ()+List3array.GetSize ()+List11array.GetSize ()+other2salearray.GetSize ()+memberarray.GetSize ();
  396. m_List1array.RemoveAll ();
  397. m_List1array.SetSize(count);
  398. int i=0;
  399. if(m_radio1==3)
  400. {
  401. /*if(payoutdlg.GetSafeHwnd ()==NULL)
  402. {
  403. payoutdlg.Create (IDD_DLGPayOutSet, this);
  404. CRect rc;
  405. m_List1.GetWindowRect (rc);
  406. payoutdlg.MoveWindow2 (rc);
  407. payoutdlg.m_pParent=this;
  408. payoutdlg.m_mode=1;
  409. }
  410. payoutdlg.ShowWindow (SW_SHOW);*/
  411. }
  412. else
  413. {
  414. m_filter.Empty ();
  415. if(payoutdlg.GetSafeHwnd ())payoutdlg.ShowWindow (SW_HIDE);
  416. }
  417. for(i=0; i<List3array.GetSize (); i++)
  418. {
  419. if(List3array.ElementAt (i).ElementAt (7).IsEmpty ())
  420. List3array.ElementAt (i).SetAt (7, "未审核");
  421. if(List3array.ElementAt (i).ElementAt (9).IsEmpty ())
  422. List3array.ElementAt (i).SetAt (9, "未审核");
  423. if(List3array.ElementAt (i).ElementAt (10).IsEmpty ())
  424. List3array.ElementAt (i).SetAt (10, "未审核");
  425. List3array.ElementAt (i).SetAt (0, List3array.ElementAt (i).ElementAt (0)+":1");
  426. }
  427. if(m_radio1==3)//支出
  428. {
  429. for( i=0; i<List3array.GetSize (); i++)
  430. {
  431. if(List3array.ElementAt (i).ElementAt (6).GetLength ()>120)
  432. List3array.ElementAt (i).SetAt (6, List3array.ElementAt (i).ElementAt (6).Left (120)+"..");
  433. str=List3array.ElementAt (i).ElementAt (1)+";"+List3array.ElementAt (i).ElementAt (4)+";"+List3array.ElementAt (i).ElementAt (6);
  434. str.Replace (";;;;", ";");str.Replace (";;;", ";");str.Replace (";;", ";");
  435. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (0));
  436. m_List1array.ElementAt (pos).Add(str);
  437. str=List3array.ElementAt (i).ElementAt (2);
  438. m_List1array.ElementAt (pos).Add(str);
  439. payout+=atof(str);
  440. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (3)+" "+List3array.ElementAt (i).ElementAt (8));
  441. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (5));
  442. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (11));
  443. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (7));
  444. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (9));
  445. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (10));
  446. pos++;
  447. }
  448. }
  449. m_List1array.SetSize(pos);
  450. str.Format ("%0.2f", income);
  451. ::ConvertToPrice (str);
  452. SetDlgItemText(IDC_EDITmoney1, str);
  453. str.Format ("%0.2f", income2);
  454. ::ConvertToPrice (str);
  455. SetDlgItemText(IDC_EDITmoney5, str);
  456. str.Format ("%0.2f", payout);
  457. ::ConvertToPrice (str);
  458. SetDlgItemText(IDC_EDITmoney2, str);
  459. str.Format ("%0.2f", income-payout);
  460. ::ConvertToPrice (str);
  461. SetDlgItemText(IDC_EDITmoney3, str);
  462. str.Format ("%d", dindanshu);
  463. SetDlgItemText(IDC_EDITmoney4, str);
  464. FillGrid();
  465. }
  466. void MonthForm2::OnRadio3()
  467. {
  468. // TODO: Add your control notification handler code here
  469. UpdateData();
  470. KindChange();
  471. }
  472. void MonthForm2::OnRadio4()
  473. {
  474. // TODO: Add your control notification handler code here
  475. UpdateData();
  476. KindChange();
  477. }
  478. void MonthForm2::OnRadio5()
  479. {
  480. // TODO: Add your control notification handler code here
  481. UpdateData();
  482. KindChange();
  483. }
  484. void MonthForm2::OnRadio6()
  485. {
  486. // TODO: Add your control notification handler code here
  487. UpdateData();
  488. m_filter.Empty ();
  489. KindChange();
  490. }
  491. void MonthForm2::OnRadio7()
  492. {
  493. // TODO: Add your control notification handler code here
  494. UpdateData();
  495. KindChange();
  496. }
  497. void MonthForm2::OnRadio8()
  498. {
  499. // TODO: Add your control notification handler code here
  500. UpdateData();
  501. KindChange();
  502. }
  503. void MonthForm2::OnRadio9()
  504. {
  505. // TODO: Add your control notification handler code here
  506. UpdateData();
  507. KindChange();
  508. }
  509. void MonthForm2::OnRadio10()
  510. {
  511. // TODO: Add your control notification handler code here
  512. UpdateData();
  513. KindChange();
  514. }
  515. void MonthForm2::OnRadio11()
  516. {
  517. // TODO: Add your control notification handler code here
  518. UpdateData();
  519. KindChange();
  520. }
  521. void MonthForm2::OnRadio12()
  522. {
  523. // TODO: Add your control notification handler code here
  524. UpdateData();
  525. KindChange();
  526. }
  527. void MonthForm2::OnRadio13()
  528. {
  529. // TODO: Add your control notification handler code here
  530. UpdateData();
  531. KindChange();
  532. }
  533. void MonthForm2::OnBUTprint()
  534. {
  535. // TODO: Add your control notification handler code here
  536. POSITION pos;
  537. pos=m_List1.GetFirstSelectedItemPosition();
  538. if(pos==NULL)
  539. {
  540. AfxMessageBox("请先选中您要查看的项目!", MB_ICONINFORMATION);return;
  541. }
  542. int iItem=m_List1.GetNextSelectedItem(pos);
  543. CString m_id=m_List1.GetItemText (iItem, 0);
  544. int pos2=m_id.Find (":");
  545. if(pos2==-1)return;
  546. m_id=m_id.Left (pos2);
  547. char no[100];
  548. memset(no, 0, 100);
  549. #ifdef VC60
  550. strcpy(no, m_id);
  551. #else
  552. strcpy_s(no, 100, m_id);
  553. #endif
  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. }