MonthForm2.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  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(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  229. bThisYear=1;
  230. else if(m_year<=atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  231. bLastYear=1;
  232. g_nYearpos=GetYearPos(m_year);
  233. int g_nYearposPre=GetYearPos(m_year-1);
  234. g_sendhead.bsql=0;
  235. g_sendhead.code[0]=14;
  236. g_sendhead.code[1]=13;
  237. g_sendhead.code[2]=16;
  238. g_sendhead.code[3]=198;
  239. g_sendhead.code[4]=216;
  240. g_sendhead.tabcount=5;
  241. CString sql,strdate,strdate2;
  242. strdate.Format ("%04d-%02d-%02d", m_year, m_month, 1);
  243. strdate2.Format ("%04d-%02d-%02d", m_year, m_month, 31);
  244. CRect rc;
  245. m_static1.GetWindowRect (rc);
  246. ScreenToClient(rc);
  247. InvalidateRect(rc);
  248. m_static1.SetWindowText (strdate.Left (7)+"支出报表");
  249. 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+"'");
  250. g_pMainWnd->ProcessChatMessageRequest2(sql);
  251. if(g_bSendOK==0)
  252. {
  253. g_nYearpos=g_nYearposTemp;
  254. m_spinyear.EnableWindow(1);
  255. m_spinmonth.EnableWindow(1);
  256. m_spinday.EnableWindow(1);
  257. return;
  258. }
  259. DataToArray(&List2array,&List3array,&List11array,&other2salearray,&memberarray);
  260. if(bLastYear)//如果是去年, 则加今年的补款
  261. {
  262. g_nYearpos=-1;//今年
  263. g_sendhead.bsql=0;
  264. g_sendhead.code[0]=14;
  265. g_sendhead.code[1]=13;
  266. g_sendhead.code[2]=16;
  267. g_sendhead.code[3]=198;
  268. g_sendhead.code[4]=216;
  269. g_sendhead.tabcount=5;
  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. CArray<CStringArray, CStringArray>ThisYearList11array;
  280. CArray<CStringArray, CStringArray>ThisYearList3array;
  281. CArray<CStringArray, CStringArray>ThisYearList2array;
  282. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  283. CArray<CStringArray, CStringArray>ThisYearmemberarray;
  284. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray, &ThisYearmemberarray);
  285. int oldsize=List11array.GetSize ();
  286. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  287. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  288. {
  289. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  290. }
  291. oldsize=List3array.GetSize ();
  292. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  293. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  294. {
  295. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  296. }
  297. oldsize=List2array.GetSize ();
  298. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  299. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  300. {
  301. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  302. }
  303. oldsize=other2salearray.GetSize ();
  304. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  305. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  306. {
  307. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  308. }
  309. oldsize=memberarray.GetSize ();
  310. memberarray.SetSize(oldsize+ThisYearmemberarray.GetSize ());
  311. for(i=oldsize; i<oldsize+ThisYearmemberarray.GetSize (); i++)
  312. {
  313. memberarray.ElementAt (i).Copy(ThisYearmemberarray.ElementAt (i-oldsize));
  314. }
  315. }
  316. if(g_nYearposPre!=-1)//如果是今年, 则加去年的补款
  317. {
  318. g_nYearpos=g_nYearposPre;//去年
  319. g_sendhead.bsql=0;
  320. g_sendhead.code[0]=14;
  321. g_sendhead.code[1]=13;
  322. g_sendhead.code[2]=16;
  323. g_sendhead.code[3]=198;
  324. g_sendhead.tabcount=4;
  325. g_pMainWnd->ProcessChatMessageRequest2(sql);
  326. if(g_bSendOK==0)
  327. {
  328. g_nYearpos=g_nYearposTemp;
  329. m_spinyear.EnableWindow(1);
  330. m_spinmonth.EnableWindow(1);
  331. m_spinday.EnableWindow(1);
  332. return;
  333. }
  334. CArray<CStringArray, CStringArray>ThisYearList11array;
  335. CArray<CStringArray, CStringArray>ThisYearList3array;
  336. CArray<CStringArray, CStringArray>ThisYearList2array;
  337. CArray<CStringArray, CStringArray>ThisYearother2salearray;
  338. DataToArray(&ThisYearList2array, &ThisYearList3array, &ThisYearList11array, &ThisYearother2salearray);
  339. int oldsize=List11array.GetSize ();
  340. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  341. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  342. {
  343. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  344. }
  345. oldsize=List3array.GetSize ();
  346. List3array.SetSize(oldsize+ThisYearList3array.GetSize ());
  347. for(i=oldsize; i<oldsize+ThisYearList3array.GetSize (); i++)
  348. {
  349. List3array.ElementAt (i).Copy(ThisYearList3array.ElementAt (i-oldsize));
  350. }
  351. oldsize=List2array.GetSize ();
  352. List2array.SetSize(oldsize+ThisYearList2array.GetSize ());
  353. for(i=oldsize; i<oldsize+ThisYearList2array.GetSize (); i++)
  354. {
  355. List2array.ElementAt (i).Copy(ThisYearList2array.ElementAt (i-oldsize));
  356. }
  357. oldsize=other2salearray.GetSize ();
  358. other2salearray.SetSize(oldsize+ThisYearother2salearray.GetSize ());
  359. for(i=oldsize; i<oldsize+ThisYearother2salearray.GetSize (); i++)
  360. {
  361. other2salearray.ElementAt (i).Copy(ThisYearother2salearray.ElementAt (i-oldsize));
  362. }
  363. }
  364. g_nYearpos=g_nYearposTemp;
  365. KindChange();
  366. m_spinyear.EnableWindow(1);
  367. m_spinmonth.EnableWindow(1);
  368. m_spinday.EnableWindow(1);
  369. }
  370. void MonthForm2::KindChange()
  371. {
  372. m_jdd="";
  373. CString str;
  374. int pos=0;
  375. int dindanshu=0;
  376. float income=0;
  377. float income2=0;
  378. float payout=0;
  379. int count=List2array.GetSize ()+List3array.GetSize ()+List11array.GetSize ()+other2salearray.GetSize ()+memberarray.GetSize ();
  380. m_List1array.RemoveAll ();
  381. m_List1array.SetSize(count);
  382. int i=0;
  383. if(m_radio1==3)
  384. {
  385. /*if(payoutdlg.GetSafeHwnd ()==NULL)
  386. {
  387. payoutdlg.Create (IDD_DLGPayOutSet, this);
  388. CRect rc;
  389. m_List1.GetWindowRect (rc);
  390. payoutdlg.MoveWindow2 (rc);
  391. payoutdlg.m_pParent=this;
  392. payoutdlg.m_mode=1;
  393. }
  394. payoutdlg.ShowWindow (SW_SHOW);*/
  395. }
  396. else
  397. {
  398. m_filter.Empty ();
  399. if(payoutdlg.GetSafeHwnd ())payoutdlg.ShowWindow (SW_HIDE);
  400. }
  401. for(i=0; i<List3array.GetSize (); i++)
  402. {
  403. if(List3array.ElementAt (i).ElementAt (7).IsEmpty ())
  404. List3array.ElementAt (i).SetAt (7, "未审核");
  405. if(List3array.ElementAt (i).ElementAt (9).IsEmpty ())
  406. List3array.ElementAt (i).SetAt (9, "未审核");
  407. if(List3array.ElementAt (i).ElementAt (10).IsEmpty ())
  408. List3array.ElementAt (i).SetAt (10, "未审核");
  409. List3array.ElementAt (i).SetAt (0, List3array.ElementAt (i).ElementAt (0)+":1");
  410. }
  411. if(m_radio1==3)//支出
  412. {
  413. for( i=0; i<List3array.GetSize (); i++)
  414. {
  415. if(List3array.ElementAt (i).ElementAt (6).GetLength ()>120)
  416. List3array.ElementAt (i).SetAt (6, List3array.ElementAt (i).ElementAt (6).Left (120)+"..");
  417. str=List3array.ElementAt (i).ElementAt (1)+";"+List3array.ElementAt (i).ElementAt (4)+";"+List3array.ElementAt (i).ElementAt (6);
  418. str.Replace (";;;;", ";");str.Replace (";;;", ";");str.Replace (";;", ";");
  419. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (0));
  420. m_List1array.ElementAt (pos).Add(str);
  421. str=List3array.ElementAt (i).ElementAt (2);
  422. m_List1array.ElementAt (pos).Add(str);
  423. payout+=atof(str);
  424. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (3)+" "+List3array.ElementAt (i).ElementAt (8));
  425. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (5));
  426. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (11));
  427. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (7));
  428. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (9));
  429. m_List1array.ElementAt (pos).Add(List3array.ElementAt (i).ElementAt (10));
  430. pos++;
  431. }
  432. }
  433. m_List1array.SetSize(pos);
  434. str.Format ("%0.2f", income);
  435. ::ConvertToPrice (str);
  436. SetDlgItemText(IDC_EDITmoney1, str);
  437. str.Format ("%0.2f", income2);
  438. ::ConvertToPrice (str);
  439. SetDlgItemText(IDC_EDITmoney5, str);
  440. str.Format ("%0.2f", payout);
  441. ::ConvertToPrice (str);
  442. SetDlgItemText(IDC_EDITmoney2, str);
  443. str.Format ("%0.2f", income-payout);
  444. ::ConvertToPrice (str);
  445. SetDlgItemText(IDC_EDITmoney3, str);
  446. str.Format ("%d", dindanshu);
  447. SetDlgItemText(IDC_EDITmoney4, str);
  448. FillGrid();
  449. }
  450. void MonthForm2::OnRadio3()
  451. {
  452. // TODO: Add your control notification handler code here
  453. UpdateData();
  454. KindChange();
  455. }
  456. void MonthForm2::OnRadio4()
  457. {
  458. // TODO: Add your control notification handler code here
  459. UpdateData();
  460. KindChange();
  461. }
  462. void MonthForm2::OnRadio5()
  463. {
  464. // TODO: Add your control notification handler code here
  465. UpdateData();
  466. KindChange();
  467. }
  468. void MonthForm2::OnRadio6()
  469. {
  470. // TODO: Add your control notification handler code here
  471. UpdateData();
  472. m_filter.Empty ();
  473. KindChange();
  474. }
  475. void MonthForm2::OnRadio7()
  476. {
  477. // TODO: Add your control notification handler code here
  478. UpdateData();
  479. KindChange();
  480. }
  481. void MonthForm2::OnRadio8()
  482. {
  483. // TODO: Add your control notification handler code here
  484. UpdateData();
  485. KindChange();
  486. }
  487. void MonthForm2::OnRadio9()
  488. {
  489. // TODO: Add your control notification handler code here
  490. UpdateData();
  491. KindChange();
  492. }
  493. void MonthForm2::OnRadio10()
  494. {
  495. // TODO: Add your control notification handler code here
  496. UpdateData();
  497. KindChange();
  498. }
  499. void MonthForm2::OnRadio11()
  500. {
  501. // TODO: Add your control notification handler code here
  502. UpdateData();
  503. KindChange();
  504. }
  505. void MonthForm2::OnRadio12()
  506. {
  507. // TODO: Add your control notification handler code here
  508. UpdateData();
  509. KindChange();
  510. }
  511. void MonthForm2::OnRadio13()
  512. {
  513. // TODO: Add your control notification handler code here
  514. UpdateData();
  515. KindChange();
  516. }
  517. void MonthForm2::OnBUTprint()
  518. {
  519. // TODO: Add your control notification handler code here
  520. POSITION pos;
  521. pos=m_List1.GetFirstSelectedItemPosition();
  522. if(pos==NULL)
  523. {
  524. AfxMessageBox("请先选中您要查看的项目!", MB_ICONINFORMATION);return;
  525. }
  526. int iItem=m_List1.GetNextSelectedItem(pos);
  527. CString m_id=m_List1.GetItemText (iItem, 0);
  528. int pos2=m_id.Find (":");
  529. if(pos2==-1)return;
  530. m_id=m_id.Left (pos2);
  531. char no[100];
  532. memset(no, 0, 100);
  533. strcpy(no, m_id);
  534. g_nSendCode=36;
  535. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)no, 100);
  536. g_nSendCode=0;
  537. if(g_bSendOK==0)
  538. {
  539. return;
  540. }
  541. CString path=g_mainpath+"\\1.jpg"; ::DeleteFile(path);
  542. CFile fp;
  543. fp.Open(path, CFile::modeCreate|CFile::modeWrite);
  544. fp.Write(g_pData, g_nLeng);
  545. fp.Close();
  546. ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWMAXIMIZED);
  547. }
  548. void MonthForm2::TypeChange(CString str)
  549. {
  550. m_filter=str;
  551. FillGrid();
  552. }
  553. void MonthForm2::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  554. {
  555. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  556. // Take the default processing unless we set this to something else below.
  557. *pResult = 0;
  558. // First thing - check the draw stage. If it's the control's prepaint
  559. // stage, then tell Windows we want messages for every item.
  560. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  561. {
  562. *pResult = CDRF_NOTIFYITEMDRAW;
  563. }
  564. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  565. {
  566. // This is the prepaint stage for an item. Here's where we set the
  567. // item's text color. Our return value will tell Windows to draw the
  568. // item itself, but it will use the new color we set here.
  569. // We'll cycle the colors through red, green, and light blue.
  570. int cot=0;
  571. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (6).Find("已审核")!=-1)
  572. cot++;
  573. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7).Find("已审核")!=-1)
  574. cot++;
  575. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (8).Find("已审核")!=-1)
  576. cot++;
  577. if(cot==3)
  578. pLVCD->clrText = RGB(20,133,20);
  579. else if(cot==2)
  580. pLVCD->clrText = RGB(255,255,0);//RGB(138,194,10);
  581. else if(cot==1)
  582. pLVCD->clrText = RGB(255,255,0);
  583. else if(cot==0)
  584. pLVCD->clrText = RGB(220,0,0);
  585. if(pLVCD->nmcd.dwItemSpec%2)
  586. pLVCD->clrTextBk = g_gridcol1;
  587. else
  588. pLVCD->clrTextBk = g_gridcol2;
  589. // Store the color back in the NMLVCUSTOMDRAW struct.
  590. // Tell Windows to paint the control itself.
  591. *pResult = CDRF_DODEFAULT;
  592. }
  593. }
  594. void MonthForm2::OnBUTprint4()
  595. {
  596. // TODO: Add your control notification handler code here
  597. if(atoi(g_cominfoarray.ElementAt(0).ElementAt(115)))
  598. {
  599. SelExpendType dlg;
  600. dlg.m_mode=3;
  601. if(dlg.DoModal()==IDOK)
  602. {
  603. m_jdd=dlg.m_sel;
  604. FillGrid();
  605. }
  606. }
  607. }
  608. void MonthForm2::OnRadio14()
  609. {
  610. // TODO: Add your control notification handler code here
  611. UpdateData();
  612. FillGrid();
  613. }
  614. void MonthForm2::OnRadio15()
  615. {
  616. // TODO: Add your control notification handler code here
  617. UpdateData();
  618. FillGrid();
  619. }
  620. void MonthForm2::OnRadio16()
  621. {
  622. // TODO: Add your control notification handler code here
  623. UpdateData();
  624. FillGrid();
  625. }
  626. void MonthForm2::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  627. {
  628. // TODO: Add your control notification handler code here
  629. OnBUTprint();
  630. *pResult = 0;
  631. }
  632. void MonthForm2::OnBUTprint5()
  633. {
  634. // TODO: Add your control notification handler code here
  635. if(!IsHasRights2new(51))return;
  636. POSITION pos;
  637. pos=m_List1.GetFirstSelectedItemPosition();
  638. if(pos==NULL)
  639. {
  640. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  641. return;
  642. }
  643. int iItem;
  644. CStringArray array;
  645. int count=0;
  646. while (pos)
  647. {
  648. count++;
  649. if(count>100)
  650. {
  651. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  652. break;
  653. }
  654. iItem = m_List1.GetNextSelectedItem(pos);
  655. array.Add (m_List1.GetItemText (iItem, 0));
  656. }
  657. CString id,type,temp,sql;
  658. CString financecheck="已审核";
  659. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  660. financecheck="未审核";
  661. financecheck+="\\"+g_user.name;
  662. financecheck.Replace("(", "(");
  663. financecheck.Replace(")", ")");
  664. int pos2;
  665. for(int i=0; i<array.GetSize (); i++)
  666. {
  667. temp=array.ElementAt (i);
  668. pos2=temp.Find (":");
  669. if(pos2==-1)continue;
  670. id=temp.Left (pos2);
  671. type=temp.Right (1);
  672. if(type=="1")
  673. {
  674. temp.Format ("***update gudingfeiyong set financecheck='%s' where id=%s", financecheck, id);
  675. }
  676. sql+=temp;
  677. }
  678. sql.TrimLeft ("***");
  679. g_sendhead.bsql=1;
  680. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  681. DateChange();
  682. }
  683. void MonthForm2::OnBUTprint6()
  684. {
  685. // TODO: Add your control notification handler code here
  686. if(!IsHasRights2new(51))return;
  687. POSITION pos;
  688. pos=m_List1.GetFirstSelectedItemPosition();
  689. if(pos==NULL)
  690. {
  691. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  692. return;
  693. }
  694. int iItem;
  695. CStringArray array;
  696. int count=0;
  697. while (pos)
  698. {
  699. count++;
  700. if(count>100)
  701. {
  702. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  703. break;
  704. }
  705. iItem = m_List1.GetNextSelectedItem(pos);
  706. array.Add (m_List1.GetItemText (iItem, 0));
  707. }
  708. CString id,type,temp,sql;
  709. CString financecheck="已审核";
  710. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  711. financecheck="未审核";
  712. financecheck+="\\"+g_user.name;
  713. financecheck.Replace("(", "(");
  714. financecheck.Replace(")", ")");
  715. int pos2;
  716. for(int i=0; i<array.GetSize (); i++)
  717. {
  718. temp=array.ElementAt (i);
  719. pos2=temp.Find (":");
  720. if(pos2==-1)continue;
  721. id=temp.Left (pos2);
  722. type=temp.Right (1);
  723. if(type=="1")
  724. {
  725. temp.Format ("***update gudingfeiyong set financecheck2='%s' where id=%s", financecheck, id);
  726. }
  727. sql+=temp;
  728. }
  729. sql.TrimLeft ("***");
  730. g_sendhead.bsql=1;
  731. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  732. DateChange();
  733. }
  734. void MonthForm2::OnBUTprint7()
  735. {
  736. // TODO: Add your control notification handler code here
  737. if(!IsHasRights2new(51))return;
  738. POSITION pos;
  739. pos=m_List1.GetFirstSelectedItemPosition();
  740. if(pos==NULL)
  741. {
  742. AfxMessageBox("请先选中您要审核的项目!", MB_ICONINFORMATION);
  743. return;
  744. }
  745. int iItem;
  746. CStringArray array;
  747. int count=0;
  748. while (pos)
  749. {
  750. count++;
  751. if(count>100)
  752. {
  753. AfxMessageBox("仅前100个项目生效,请选中少于100个项目!", MB_ICONINFORMATION);
  754. break;
  755. }
  756. iItem = m_List1.GetNextSelectedItem(pos);
  757. array.Add (m_List1.GetItemText (iItem, 0));
  758. }
  759. CString id,type,temp,sql;
  760. CString financecheck="已审核";
  761. if(AfxMessageBox(" 此单审核是否通过? \r\n", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  762. financecheck="未审核";
  763. financecheck+="\\"+g_user.name;
  764. financecheck.Replace("(", "(");
  765. financecheck.Replace(")", ")");
  766. int pos2;
  767. for(int i=0; i<array.GetSize (); i++)
  768. {
  769. temp=array.ElementAt (i);
  770. pos2=temp.Find (":");
  771. if(pos2==-1)continue;
  772. id=temp.Left (pos2);
  773. type=temp.Right (1);
  774. if(type=="1")
  775. {
  776. temp.Format ("***update gudingfeiyong set financecheck3='%s' where id=%s", financecheck, id);
  777. }
  778. sql+=temp;
  779. }
  780. sql.TrimLeft ("***");
  781. g_sendhead.bsql=1;
  782. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  783. DateChange();
  784. }