YearForm2.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. // YearForm2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "YearForm2.h"
  6. #include "MyMdi.H"
  7. #include "VcPlot.h"
  8. #include "VcAxis.h"
  9. #include "VcValueScale.h"
  10. #include "VcSeriesCollection.h"
  11. #include "VcSeries.h"
  12. #include "VcPen.h"
  13. #include "VcCategoryScale.h"
  14. #include "VcColor.h"
  15. #include "VcDataGrid.h"
  16. #include "VcBackdrop.h"
  17. #include "VcFill.h"
  18. #include "VcBrush.h"
  19. #include "VcDataPoints.h"
  20. #include "VcDataPoint.h"
  21. #include "VcDataPointLabel.h"
  22. #include "VcAxisTitle.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // YearForm2
  30. IMPLEMENT_DYNCREATE(YearForm2, CFormView)
  31. YearForm2::YearForm2()
  32. : CFormView(YearForm2::IDD)
  33. {
  34. //{{AFX_DATA_INIT(YearForm2)
  35. m_year = CTime::GetCurrentTime ().GetYear ();
  36. m_month = CTime::GetCurrentTime ().GetMonth ();
  37. m_day = CTime::GetCurrentTime ().GetDay ();
  38. m_check1 = 1;
  39. m_check2 = 1;
  40. m_check3 = 1;
  41. m_check4 = 1;
  42. m_radio2 = 0;
  43. m_radio1 = 0;
  44. m_bInit=0;
  45. m_timestmap=0;
  46. m_check5 = 1;
  47. //}}AFX_DATA_INIT
  48. //m_date = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
  49. }
  50. YearForm2::~YearForm2()
  51. {
  52. }
  53. void YearForm2::DoDataExchange(CDataExchange* pDX)
  54. {
  55. CFormView::DoDataExchange(pDX);
  56. //{{AFX_DATA_MAP(YearForm2)
  57. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  58. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  59. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  60. DDX_Control(pDX, IDC_STATIC1, m_static1);
  61. DDX_Text(pDX, IDC_EDITyear, m_year);
  62. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  63. DDX_Text(pDX, IDC_EDITmonth, m_month);
  64. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  65. DDX_Text(pDX, IDC_EDITday, m_day);
  66. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  67. DDX_Control(pDX, IDC_MSCHART1, m_Chart);
  68. DDX_Check(pDX, IDC_CHECK1, m_check1);
  69. DDX_Check(pDX, IDC_CHECK2, m_check2);
  70. DDX_Check(pDX, IDC_CHECK3, m_check3);
  71. DDX_Check(pDX, IDC_CHECK4, m_check4);
  72. DDX_Radio(pDX, IDC_RADIO6, m_radio2);
  73. DDX_Radio(pDX, IDC_RADIO3, m_radio1);
  74. DDX_Control(pDX, IDC_MSCHART2, m_Chart2);
  75. DDX_Control(pDX, IDC_MSCHART3, m_Chart3);
  76. DDX_Check(pDX, IDC_CHECK5, m_check5);
  77. //}}AFX_DATA_MAP
  78. }
  79. BEGIN_MESSAGE_MAP(YearForm2, CFormView)
  80. //{{AFX_MSG_MAP(YearForm2)
  81. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  82. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  83. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  84. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  85. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  86. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  87. ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
  88. ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
  89. ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
  90. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  91. ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
  92. ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
  93. ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
  94. ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
  95. //}}AFX_MSG_MAP
  96. END_MESSAGE_MAP()
  97. /////////////////////////////////////////////////////////////////////////////
  98. // YearForm2 diagnostics
  99. #ifdef _DEBUG
  100. void YearForm2::AssertValid() const
  101. {
  102. CFormView::AssertValid();
  103. }
  104. void YearForm2::Dump(CDumpContext& dc) const
  105. {
  106. CFormView::Dump(dc);
  107. }
  108. #endif //_DEBUG
  109. /////////////////////////////////////////////////////////////////////////////
  110. // YearForm2 message handlers
  111. void YearForm2::OnInitialUpdate()
  112. {
  113. CFormView::OnInitialUpdate();
  114. // TODO: Add your specialized code here and/or call the base class
  115. CMyMdi Mdi;
  116. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  117. // Here we create the outbar control using the splitter as its parent
  118. // and setting its id to the first pane.
  119. CRect rc2;
  120. GetWindowRect(rc2);
  121. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  122. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  123. m_static1.SetFont (&g_titlefont);
  124. m_spinyear.SetRange (1900, 3000);
  125. m_spinmonth.SetRange (1, 12);
  126. m_spinday.SetRange (1, 31);
  127. m_Chart.GetBackdrop().GetFill().SetStyle(1);
  128. m_Chart.GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
  129. m_Chart.SetShowLegend(TRUE);
  130. m_Chart.SetColumn(1);
  131. m_Chart.SetColumnLabel((LPCTSTR)"总收入");
  132. m_Chart.SetChartType(3);
  133. // 栈模式
  134. m_Chart.SetStacking(FALSE);
  135. VARIANT var;
  136. m_Chart.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
  137. m_Chart.GetPlot().GetAxis(0,var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
  138. m_Chart.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
  139. m_Chart.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
  140. m_Chart.SetColumnCount(1);
  141. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  142. // 线宽(对点线图有效)
  143. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  144. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  145. // 0: 不显示 1: 显示在柱状图外
  146. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  147. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  148. //////////////////////
  149. m_Chart2.GetBackdrop().GetFill().SetStyle(1);
  150. m_Chart2.GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
  151. m_Chart2.SetShowLegend(TRUE);
  152. m_Chart2.SetColumn(1);
  153. m_Chart2.SetColumnLabel((LPCTSTR)"总支出");
  154. m_Chart2.SetChartType(3);
  155. // 栈模式
  156. m_Chart2.SetStacking(FALSE);
  157. m_Chart2.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
  158. m_Chart2.GetPlot().GetAxis(0,var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
  159. m_Chart2.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
  160. m_Chart2.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
  161. m_Chart2.SetColumnCount(1);
  162. m_Chart2.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  163. // 线宽(对点线图有效)
  164. m_Chart2.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  165. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  166. // 0: 不显示 1: 显示在柱状图外
  167. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  168. m_Chart2.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  169. ///////////////////////////
  170. m_Chart3.GetBackdrop().GetFill().SetStyle(1);
  171. m_Chart3.GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
  172. m_Chart3.SetShowLegend(TRUE);
  173. m_Chart3.SetColumn(1);
  174. m_Chart3.SetColumnLabel((LPCTSTR)"定单数");
  175. m_Chart3.SetChartType(3);
  176. // 栈模式
  177. m_Chart3.SetStacking(FALSE);
  178. m_Chart3.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
  179. m_Chart3.GetPlot().GetAxis(0,var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
  180. m_Chart3.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
  181. m_Chart3.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
  182. m_Chart3.SetColumnCount(1);
  183. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  184. // 线宽(对点线图有效)
  185. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  186. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  187. // 0: 不显示 1: 显示在柱状图外
  188. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  189. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  190. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc2);
  191. ScreenToClient(rc2);
  192. m_Chart.MoveWindow (rc2);
  193. GetDlgItem(IDC_STATIC3)->GetWindowRect(rc2);
  194. ScreenToClient(rc2);
  195. m_Chart2.MoveWindow (rc2);
  196. GetDlgItem(IDC_STATIC12)->GetWindowRect(rc2);
  197. ScreenToClient(rc2);
  198. m_Chart3.MoveWindow (rc2);
  199. m_bInit=1;
  200. DateChange();
  201. }
  202. void YearForm2::FillGrid()
  203. {
  204. }
  205. void YearForm2::OnBUTclose()
  206. {
  207. // TODO: Add your control notification handler code here
  208. GetParent()->SendMessage(WM_CLOSE);
  209. }
  210. void YearForm2::OnChangeEDITyear()
  211. {
  212. // TODO: If this is a RICHEDIT control, the control will not
  213. // send this notification unless you override the CFormView::OnInitDialog()
  214. // function and call CRichEditCtrl().SetEventMask()
  215. // with the ENM_CHANGE flag ORed into the mask.
  216. DateChange();
  217. // TODO: Add your control notification handler code here
  218. }
  219. void YearForm2::OnChangeEDITmonth()
  220. {
  221. // TODO: If this is a RICHEDIT control, the control will not
  222. // send this notification unless you override the CFormView::OnInitDialog()
  223. // function and call CRichEditCtrl().SetEventMask()
  224. // with the ENM_CHANGE flag ORed into the mask.
  225. // DateChange();
  226. // TODO: Add your control notification handler code here
  227. }
  228. void YearForm2::OnChangeEDITday()
  229. {
  230. // TODO: If this is a RICHEDIT control, the control will not
  231. // send this notification unless you override the CFormView::OnInitDialog()
  232. // function and call CRichEditCtrl().SetEventMask()
  233. // with the ENM_CHANGE flag ORed into the mask.
  234. // DateChange();
  235. // TODO: Add your control notification handler code here
  236. }
  237. int GetYearPos(int year)
  238. {
  239. for(int i=0; i<g_hisyeararray.GetSize (); i++)
  240. {
  241. if(year==atoi(g_hisyeararray.ElementAt (i).ElementAt (0)))
  242. return i;
  243. }
  244. return -1;
  245. }
  246. void YearForm2::DateChange()
  247. {
  248. if(m_bInit==0)return;
  249. // if(::GetTickCount ()-m_timestmap<500)return;
  250. // m_timestmap=::GetTickCount ();
  251. UpdateData();
  252. int i;
  253. int g_nYearposTemp=g_nYearpos;
  254. BOOL bLastYear=0;
  255. BOOL bThisYear=0;
  256. if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  257. bThisYear=1;
  258. else if(m_year==atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  259. bLastYear=1;
  260. g_nYearpos=GetYearPos(m_year);
  261. g_sendhead.bsql=0;
  262. g_sendhead.code[0]=14;
  263. g_sendhead.code[1]=13;
  264. g_sendhead.code[2]=16;
  265. g_sendhead.tabcount=3;
  266. CString sql,strdate,strdate2;
  267. strdate.Format ("%04d-%02d-%02d", m_year, 1, 1);
  268. strdate2.Format ("%04d-%02d-%02d", m_year, 12, 31);
  269. m_static1.SetWindowText (strdate.Left (4)+"年财务表");
  270. sql.Format ("dat>='"+strdate+"' and dat<='"+strdate2+"';dat>='"+strdate+"' and dat<='"+strdate2+"';date>='"+strdate+"' and date<='"+strdate2+"'");
  271. g_pMainWnd->ProcessChatMessageRequest2(sql);
  272. if(g_bSendOK==0)
  273. {
  274. g_nYearpos=g_nYearposTemp;
  275. return;
  276. }
  277. DataToArray(&List2array,&List3array,&List11array);
  278. if(bLastYear)//如果是去年, 则加今年的补款
  279. {
  280. g_nYearpos=-1;//今年
  281. g_sendhead.bsql=0;
  282. g_sendhead.code[0]=16;
  283. g_sendhead.tabcount=1;
  284. CString sql,strdate,strdate2;
  285. strdate.Format ("%04d-%02d-%02d", m_year, 1, 1);
  286. strdate2.Format ("%04d-%02d-%02d", m_year, 12, 31);
  287. sql.Format ("date>='"+strdate+"' and date<='"+strdate2+"'");
  288. g_pMainWnd->ProcessChatMessageRequest2(sql);
  289. if(g_bSendOK==0)
  290. {
  291. g_nYearpos=g_nYearposTemp;
  292. return;
  293. }
  294. CArray<CStringArray, CStringArray>ThisYearList11array;
  295. DataToArray(&ThisYearList11array);
  296. int oldsize=List11array.GetSize ();
  297. int newsize=ThisYearList11array.GetSize ();
  298. List11array.SetSize(oldsize+ThisYearList11array.GetSize ());
  299. for(i=oldsize; i<oldsize+ThisYearList11array.GetSize (); i++)
  300. {
  301. List11array.ElementAt (i).Copy(ThisYearList11array.ElementAt (i-oldsize));
  302. }
  303. }
  304. else if(bThisYear)//如果是今年, 则加去年的补款
  305. {
  306. g_nYearpos=0;//去年
  307. g_sendhead.bsql=0;
  308. g_sendhead.code[0]=16;
  309. g_sendhead.tabcount=1;
  310. CString sql,strdate,strdate2;
  311. strdate.Format ("%04d-%02d-%02d", m_year, 1, 1);
  312. strdate2.Format ("%04d-%02d-%02d", m_year, 12, 31);
  313. sql.Format ("date>='"+strdate+"' and date<='"+strdate2+"'");
  314. g_pMainWnd->ProcessChatMessageRequest2(sql);
  315. if(g_bSendOK==0)
  316. {
  317. g_nYearpos=g_nYearposTemp;
  318. return;
  319. }
  320. CArray<CStringArray, CStringArray>LastYearList11array;
  321. DataToArray(&LastYearList11array);
  322. int oldsize=List11array.GetSize ();
  323. int newsize=LastYearList11array.GetSize ();
  324. List11array.SetSize(oldsize+LastYearList11array.GetSize ());
  325. for(i=oldsize; i<oldsize+LastYearList11array.GetSize (); i++)
  326. {
  327. List11array.ElementAt (i).Copy(LastYearList11array.ElementAt (i-oldsize));
  328. }
  329. }
  330. g_nYearpos=g_nYearposTemp;
  331. KindChange();
  332. }
  333. void YearForm2::KindChange()
  334. {
  335. int i=0;
  336. float incomedata1[12]={0};
  337. float incomedata2[12]={0};
  338. float incomedata3[12]={0};
  339. float incomedata4[12]={0};
  340. float payoutdata[12]={0};
  341. int dindandata[12]={0};
  342. CString stryear[12]={"1月",\
  343. "2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
  344. for( i=0; i<List11array.GetSize (); i++)
  345. {
  346. if(List11array.ElementAt (i).ElementAt (5)=="预约收款"||List11array.ElementAt (i).ElementAt (5)=="预约补款")
  347. incomedata1[atoi(List11array.ElementAt (i).ElementAt (7).Mid (5, 2))-1]+=atof(List11array.ElementAt (i).ElementAt (4));
  348. else if(List11array.ElementAt (i).ElementAt (5)=="拍照补款")
  349. incomedata2[atoi(List11array.ElementAt (i).ElementAt (7).Mid (5, 2))-1]+=atof(List11array.ElementAt (i).ElementAt (4));
  350. else if(List11array.ElementAt (i).ElementAt (5)=="选片补款")
  351. incomedata3[atoi(List11array.ElementAt (i).ElementAt (7).Mid (5, 2))-1]+=atof(List11array.ElementAt (i).ElementAt (4));
  352. if(List11array.ElementAt (i).ElementAt (5)=="预约收款")
  353. dindandata[atoi(List11array.ElementAt (i).ElementAt (7).Mid (5, 2))-1]++;
  354. }
  355. for( i=0; i<List2array.GetSize (); i++)
  356. {
  357. incomedata4[atoi(List2array.ElementAt (i).ElementAt (3).Mid (5, 2))-1]+=atof(List2array.ElementAt (i).ElementAt (2));
  358. }
  359. for( i=0; i<List3array.GetSize (); i++)
  360. {
  361. payoutdata[atoi(List3array.ElementAt (i).ElementAt (3).Mid (5, 2))-1]+=atof(List3array.ElementAt (i).ElementAt (2));
  362. }
  363. int nRowCount=12;// VARIANT var;
  364. m_Chart.SetRowCount(nRowCount);
  365. m_Chart2.SetRowCount(nRowCount);
  366. m_Chart3.SetRowCount(nRowCount);
  367. float ftemp;
  368. if(m_radio2==0)//叠加
  369. {
  370. for(int row = 1; row <= nRowCount; ++row)
  371. {
  372. m_Chart.SetRow(row);
  373. m_Chart.SetRowLabel(stryear[row-1]);
  374. if(m_check1)
  375. m_Chart.GetDataGrid().SetData(row, 1, incomedata1[row-1]+incomedata2[row-1]+incomedata3[row-1]+incomedata4[row-1], 0);
  376. else
  377. {
  378. ftemp=0;
  379. if(m_check2)
  380. ftemp+=incomedata1[row-1];
  381. if(m_check3)
  382. ftemp+=incomedata2[row-1];
  383. if(m_check4)
  384. ftemp+=incomedata3[row-1];
  385. if(m_check5)
  386. ftemp+=incomedata4[row-1];
  387. m_Chart.GetDataGrid().SetData(row, 1, ftemp, 0);
  388. }
  389. }
  390. }
  391. else
  392. {
  393. for(int row = 1; row <= nRowCount; ++row)
  394. {
  395. m_Chart.SetRow(row);
  396. m_Chart.SetRowLabel(stryear[row-1]);
  397. m_Chart.GetDataGrid().SetData(row, 1, incomedata1[row-1], 0);
  398. m_Chart.GetDataGrid().SetData(row, 2, incomedata2[row-1], 0);
  399. m_Chart.GetDataGrid().SetData(row, 3, incomedata3[row-1], 0);
  400. m_Chart.GetDataGrid().SetData(row, 4, incomedata4[row-1], 0);
  401. }
  402. }
  403. for(int row = 1; row <= nRowCount; ++row)
  404. {
  405. m_Chart2.SetRow(row);
  406. m_Chart2.SetRowLabel(stryear[row-1]);
  407. m_Chart2.GetDataGrid().SetData(row, 1, payoutdata[row-1], 0);
  408. m_Chart3.SetRow(row);
  409. m_Chart3.SetRowLabel(stryear[row-1]);
  410. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row-1], 0);
  411. }
  412. m_Chart.Refresh();
  413. m_Chart2.Refresh();
  414. m_Chart3.Refresh();
  415. }
  416. void YearForm2::OnRadio3()
  417. {
  418. // TODO: Add your control notification handler code here
  419. UpdateData();
  420. if(m_radio1==0)
  421. {
  422. m_Chart.SetChartType(3);
  423. m_Chart2.SetChartType(3);
  424. m_Chart3.SetChartType(3);
  425. }
  426. else if(m_radio1==1)
  427. {
  428. m_Chart.SetChartType(1);
  429. m_Chart2.SetChartType(1);
  430. m_Chart3.SetChartType(1);
  431. }
  432. else if(m_radio1==2)
  433. {
  434. m_Chart.SetChartType(14);
  435. m_Chart2.SetChartType(14);
  436. m_Chart3.SetChartType(14);
  437. }
  438. }
  439. void YearForm2::OnRadio4()
  440. {
  441. // TODO: Add your control notification handler code here
  442. OnRadio3();
  443. }
  444. void YearForm2::OnRadio5()
  445. {
  446. // TODO: Add your control notification handler code here
  447. OnRadio3();
  448. }
  449. void YearForm2::OnCheck1()
  450. {
  451. // TODO: Add your control notification handler code here
  452. UpdateData();
  453. m_check2=m_check3=m_check4=m_check5=m_check1;
  454. UpdateData(false);
  455. KindChange();
  456. }
  457. void YearForm2::OnCheck2()
  458. {
  459. // TODO: Add your control notification handler code here
  460. UpdateData();
  461. if(m_check2==0)
  462. {
  463. m_check1=m_check2;
  464. UpdateData(false);
  465. }
  466. KindChange();
  467. }
  468. void YearForm2::OnCheck3()
  469. {
  470. // TODO: Add your control notification handler code here
  471. UpdateData();
  472. if(m_check3==0)
  473. {
  474. m_check1=m_check3;
  475. UpdateData(false);
  476. }
  477. KindChange();
  478. }
  479. void YearForm2::OnCheck4()
  480. {
  481. // TODO: Add your control notification handler code here
  482. UpdateData();
  483. if(m_check4==0)
  484. {
  485. m_check1=m_check4;
  486. UpdateData(false);
  487. }
  488. KindChange();
  489. }
  490. void YearForm2::OnCheck5()
  491. {
  492. // TODO: Add your control notification handler code here
  493. UpdateData();
  494. if(m_check5==0)
  495. {
  496. m_check1=m_check5;
  497. UpdateData(false);
  498. }
  499. KindChange();
  500. }
  501. void YearForm2::OnRadio6() //叠加
  502. {
  503. // TODO: Add your control notification handler code here
  504. UpdateData();
  505. if(m_radio2==0)
  506. {
  507. m_Chart.SetColumnCount(1);
  508. m_Chart.SetColumn(1);
  509. m_Chart.SetColumnLabel((LPCTSTR)"总收入");
  510. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  511. // 线宽(对点线图有效)
  512. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  513. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  514. // 0: 不显示 1: 显示在柱状图外
  515. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  516. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  517. }
  518. else
  519. {
  520. m_Chart.SetColumnCount(4);
  521. m_Chart.SetColumn(1);
  522. m_Chart.SetColumnLabel((LPCTSTR)"前期");
  523. m_Chart.SetColumn(2);
  524. m_Chart.SetColumnLabel((LPCTSTR)"拍照后期");
  525. m_Chart.SetColumn(3);
  526. m_Chart.SetColumnLabel((LPCTSTR)"选片后期");
  527. m_Chart.SetColumn(4);
  528. m_Chart.SetColumnLabel((LPCTSTR)"其他收入");
  529. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  530. m_Chart.GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(0, 255, 0);
  531. m_Chart.GetPlot().GetSeriesCollection().GetItem(3).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(0, 0, 255);
  532. m_Chart.GetPlot().GetSeriesCollection().GetItem(4).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(0, 255, 255);
  533. // 线宽(对点线图有效)
  534. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  535. m_Chart.GetPlot().GetSeriesCollection().GetItem(2).GetPen().SetWidth(30);
  536. m_Chart.GetPlot().GetSeriesCollection().GetItem(3).GetPen().SetWidth(30);
  537. m_Chart.GetPlot().GetSeriesCollection().GetItem(4).GetPen().SetWidth(30);
  538. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  539. // 0: 不显示 1: 显示在柱状图外
  540. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  541. m_Chart.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  542. m_Chart.GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  543. m_Chart.GetPlot().GetSeriesCollection().GetItem(3).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  544. m_Chart.GetPlot().GetSeriesCollection().GetItem(4).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  545. }
  546. GetDlgItem(IDC_CHECK1)->EnableWindow(m_radio2==0);
  547. GetDlgItem(IDC_CHECK2)->EnableWindow(m_radio2==0);
  548. GetDlgItem(IDC_CHECK3)->EnableWindow(m_radio2==0);
  549. GetDlgItem(IDC_CHECK4)->EnableWindow(m_radio2==0);
  550. GetDlgItem(IDC_CHECK5)->EnableWindow(m_radio2==0);
  551. KindChange();
  552. }
  553. void YearForm2::OnRadio7() //对比
  554. {
  555. // TODO: Add your control notification handler code here
  556. OnRadio6();
  557. }