StaffAchievement.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. // StaffAchievement.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "StaffAchievement.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. #include "StaffAchievementShowAll.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // StaffAchievement IDC_STATIC1
  31. IMPLEMENT_DYNCREATE(StaffAchievement, CFormView)
  32. StaffAchievement::StaffAchievement()
  33. : CFormView(StaffAchievement::IDD)
  34. {
  35. //{{AFX_DATA_INIT(StaffAchievement)
  36. m_year = CTime::GetCurrentTime ().GetYear ();
  37. m_month = CTime::GetCurrentTime ().GetMonth ();
  38. m_day = 12;
  39. m_radio2 = 0;
  40. m_radio1 = 0;
  41. m_bInit=0;
  42. m_timestmap=0;
  43. //}}AFX_DATA_INIT
  44. g_pMainWnd->GetOcx();
  45. }
  46. StaffAchievement::~StaffAchievement()
  47. {
  48. }
  49. void StaffAchievement::DoDataExchange(CDataExchange* pDX)
  50. {
  51. CFormView::DoDataExchange(pDX);
  52. //{{AFX_DATA_MAP(StaffAchievement)
  53. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  54. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  55. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  56. DDX_Control(pDX, IDC_STATIC1, m_static1);
  57. DDX_Text(pDX, IDC_EDITyear, m_year);
  58. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  59. DDX_Text(pDX, IDC_EDITmonth, m_month);
  60. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  61. DDX_Text(pDX, IDC_EDITday, m_day);
  62. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  63. DDX_Radio(pDX, IDC_RADIO6, m_radio2);
  64. DDX_Radio(pDX, IDC_RADIO3, m_radio1);
  65. //}}AFX_DATA_MAP
  66. }
  67. BEGIN_MESSAGE_MAP(StaffAchievement, CFormView)
  68. //{{AFX_MSG_MAP(StaffAchievement)
  69. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  70. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  71. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  72. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  73. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  74. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  75. ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
  76. ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
  77. ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
  78. ON_WM_DESTROY()
  79. ON_BN_CLICKED(IDC_BUTprint, OnBUTshowall)
  80. //}}AFX_MSG_MAP
  81. END_MESSAGE_MAP()
  82. /////////////////////////////////////////////////////////////////////////////
  83. // StaffAchievement diagnostics
  84. #ifdef _DEBUG
  85. void StaffAchievement::AssertValid() const
  86. {
  87. CFormView::AssertValid();
  88. }
  89. void StaffAchievement::Dump(CDumpContext& dc) const
  90. {
  91. CFormView::Dump(dc);
  92. }
  93. #endif //_DEBUG
  94. /////////////////////////////////////////////////////////////////////////////
  95. // StaffAchievement message handlers
  96. void StaffAchievement::OnInitialUpdate()
  97. {
  98. CFormView::OnInitialUpdate();
  99. // TODO: Add your specialized code here and/or call the base class
  100. CMyMdi Mdi;
  101. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  102. // Here we create the outbar control using the splitter as its parent
  103. // and setting its id to the first pane.
  104. CRect rc2;
  105. GetWindowRect(rc2);
  106. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  107. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  108. m_static1.SetFont (&g_titlefont);
  109. m_spinyear.SetRange (1900, 3000);
  110. m_spinmonth.SetRange (1, 12);
  111. m_spinday.SetRange (1, 31);
  112. CString version = _T ("Version 1.0");
  113. m_day=AfxGetApp()->GetProfileInt (version, "rowcount", 12);
  114. UpdateData(false);
  115. m_bInit=1;
  116. DateChange();
  117. // if(g_bStaffAchievementShow)
  118. // OnBUTshowall();
  119. }
  120. void StaffAchievement::FillGrid()
  121. {
  122. }
  123. void StaffAchievement::OnBUTclose()
  124. {
  125. // TODO: Add your control notification handler code here
  126. GetParent()->SendMessage(WM_CLOSE);
  127. }
  128. void StaffAchievement::OnChangeEDITyear()
  129. {
  130. // TODO: If this is a RICHEDIT control, the control will not
  131. // send this notification unless you override the CFormView::OnInitDialog()
  132. // function and call CRichEditCtrl().SetEventMask()
  133. // with the ENM_CHANGE flag ORed into the mask.
  134. DateChange();
  135. // TODO: Add your control notification handler code here
  136. }
  137. void StaffAchievement::OnChangeEDITmonth()
  138. {
  139. // TODO: If this is a RICHEDIT control, the control will not
  140. // send this notification unless you override the CFormView::OnInitDialog()
  141. // function and call CRichEditCtrl().SetEventMask()
  142. // with the ENM_CHANGE flag ORed into the mask.
  143. DateChange();
  144. // TODO: Add your control notification handler code here
  145. }
  146. void StaffAchievement::OnChangeEDITday()
  147. {
  148. // TODO: If this is a RICHEDIT control, the control will not
  149. // send this notification unless you override the CFormView::OnInitDialog()
  150. // function and call CRichEditCtrl().SetEventMask()
  151. // with the ENM_CHANGE flag ORed into the mask.
  152. if(m_bInit==0)return;
  153. DateChange();
  154. UpdateData();
  155. CString version = _T ("Version 1.0");
  156. AfxGetApp()->WriteProfileInt (version, "rowcount", m_day);
  157. // TODO: Add your control notification handler code here
  158. }
  159. extern void IsWaiter(CString id, CString name, CArray<CStringArray, CStringArray>*waiterarray, BOOL &bWait1, BOOL &bWait2);
  160. extern int GetYearPos(int year);
  161. void StaffAchievement::DateChange()
  162. {
  163. if(m_bInit==0)return;
  164. // if(::GetTickCount ()-m_timestmap<500)return;
  165. // m_timestmap=::GetTickCount ();
  166. UpdateData();
  167. CString date1,date2;
  168. date1.Format ("%d-%02d-01", m_year, m_month);
  169. date2.Format ("%d-%02d-31", m_year, m_month);
  170. CArray<CStringArray, CStringArray>bukuanarray;
  171. CArray<CStringArray, CStringArray>bukuanarray2;
  172. CArray<CStringArray, CStringArray>singleincomearray;
  173. int i;
  174. int g_nYearposTemp=g_nYearpos;
  175. BOOL bLastYear=0;
  176. BOOL bThisYear=0;
  177. BOOL bOldYear=0;
  178. if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
  179. bThisYear=1;
  180. else if(m_year==atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
  181. bLastYear=1;
  182. else if(atoi(g_date.Left (4))-m_year>1 && g_hisyeararray.GetSize ()>=(atoi(g_date.Left (4))-m_year))
  183. {
  184. bOldYear=1;
  185. }
  186. g_nYearpos=GetYearPos(m_year);
  187. CString filter="date>='"+date1+"' and date<='"+date2+"';\
  188. dat>='"+date1+"' and dat<='"+date2+"';\
  189. ;\
  190. ;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
  191. //;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'
  192. g_sendhead.code[0]=59;
  193. g_sendhead.code[1]=14;
  194. g_sendhead.code[2]=60;
  195. g_sendhead.code[3]=34;
  196. g_sendhead.code[4]=61;
  197. g_sendhead.tabcount=5;
  198. g_sendhead.bsql=0;
  199. g_pMainWnd->ProcessChatMessageRequest2(filter);
  200. if(g_bSendOK==0)
  201. {
  202. g_nYearpos=g_nYearposTemp;
  203. return;
  204. }
  205. DataToArray(&bukuanarray,&singleincomearray,&waiterarray,&m_List1array,&bukuanarray2);
  206. if(bLastYear)//如果是去年, 则加今年的补款
  207. {
  208. g_nYearpos=-1;//今年
  209. filter="date>='"+date1+"' and date<='"+date2+"';;;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
  210. g_sendhead.code[0]=59;
  211. g_sendhead.code[1]=60;
  212. g_sendhead.code[2]=34;
  213. g_sendhead.code[3]=61;
  214. g_sendhead.tabcount=4;
  215. g_sendhead.bsql=0;
  216. g_pMainWnd->ProcessChatMessageRequest2(filter);
  217. if(g_bSendOK==0)
  218. {
  219. g_nYearpos=g_nYearposTemp;
  220. return;
  221. }
  222. CArray<CStringArray, CStringArray>ThisYearbukuanarray;
  223. CArray<CStringArray, CStringArray>ThisYearwaiterarray;
  224. CArray<CStringArray, CStringArray>ThisYearbukuanarray2;
  225. DataToArray(&ThisYearbukuanarray,&ThisYearwaiterarray,&m_List1array,&ThisYearbukuanarray2);
  226. int oldsize=bukuanarray.GetSize ();
  227. bukuanarray.SetSize(oldsize+ThisYearbukuanarray.GetSize ());
  228. for(i=oldsize; i<oldsize+ThisYearbukuanarray.GetSize (); i++)
  229. {
  230. bukuanarray.ElementAt (i).Copy(ThisYearbukuanarray.ElementAt (i-oldsize));
  231. }
  232. oldsize=bukuanarray2.GetSize ();
  233. bukuanarray2.SetSize(oldsize+ThisYearbukuanarray2.GetSize ());
  234. for(i=oldsize; i<oldsize+ThisYearbukuanarray2.GetSize (); i++)
  235. {
  236. bukuanarray2.ElementAt (i).Copy(ThisYearbukuanarray2.ElementAt (i-oldsize));
  237. }
  238. oldsize=waiterarray.GetSize ();
  239. waiterarray.SetSize(oldsize+ThisYearwaiterarray.GetSize ());
  240. for(i=oldsize; i<oldsize+ThisYearwaiterarray.GetSize (); i++)
  241. {
  242. waiterarray.ElementAt (i).Copy(ThisYearwaiterarray.ElementAt (i-oldsize));
  243. }
  244. }
  245. else if(bThisYear)//如果是今年, 则加去年的补款
  246. {
  247. g_nYearpos=0;//去年
  248. filter="date>='"+date1+"' and date<='"+date2+"';;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
  249. g_sendhead.code[0]=59;
  250. g_sendhead.code[1]=60;
  251. g_sendhead.code[2]=61;
  252. g_sendhead.tabcount=3;
  253. g_sendhead.bsql=0;
  254. g_pMainWnd->ProcessChatMessageRequest2(filter);
  255. if(g_bSendOK==0)
  256. {
  257. g_nYearpos=g_nYearposTemp;
  258. return;
  259. }
  260. CArray<CStringArray, CStringArray>LastYearbukuanarray;
  261. CArray<CStringArray, CStringArray>LastYearwaiterarray;
  262. CArray<CStringArray, CStringArray>LastYearbukuanarray2;
  263. DataToArray(&LastYearbukuanarray,&LastYearwaiterarray,&LastYearbukuanarray2);
  264. int oldsize=bukuanarray.GetSize ();
  265. bukuanarray.SetSize(oldsize+LastYearbukuanarray.GetSize ());
  266. for(i=oldsize; i<oldsize+LastYearbukuanarray.GetSize (); i++)
  267. {
  268. bukuanarray.ElementAt (i).Copy(LastYearbukuanarray.ElementAt (i-oldsize));
  269. }
  270. oldsize=bukuanarray2.GetSize ();
  271. bukuanarray2.SetSize(oldsize+LastYearbukuanarray2.GetSize ());
  272. for(i=oldsize; i<oldsize+LastYearbukuanarray2.GetSize (); i++)
  273. {
  274. bukuanarray2.ElementAt (i).Copy(LastYearbukuanarray2.ElementAt (i-oldsize));
  275. }
  276. oldsize=waiterarray.GetSize ();
  277. waiterarray.SetSize(oldsize+LastYearwaiterarray.GetSize ());
  278. for(i=oldsize; i<oldsize+LastYearwaiterarray.GetSize (); i++)
  279. {
  280. waiterarray.ElementAt (i).Copy(LastYearwaiterarray.ElementAt (i-oldsize));
  281. }
  282. }
  283. else if(bLastYear)//如果是以往年份, 则需更新员工信息
  284. {
  285. g_nYearpos=-1;//今年
  286. g_sendhead.code[0]=34;
  287. g_sendhead.tabcount=1;
  288. g_sendhead.bsql=0;
  289. g_pMainWnd->ProcessChatMessageRequest2(1);
  290. if(g_bSendOK==0)
  291. {
  292. g_nYearpos=g_nYearposTemp;
  293. return;
  294. }
  295. DataToArray(&m_List1array);
  296. }
  297. g_nYearpos=g_nYearposTemp;
  298. ////////////////////////////
  299. int ii=0;
  300. money1array.RemoveAll ();
  301. money1array.SetSize(m_List1array.GetSize ());
  302. money2array.RemoveAll ();
  303. money2array.SetSize(m_List1array.GetSize ());
  304. for(int n=0; n<m_List1array.GetSize (); n++)
  305. {
  306. CString name=m_List1array.ElementAt (n).ElementAt (0);
  307. float money1=0;
  308. float money2=0;
  309. int arraypos=0;
  310. for( ii=0; ii<bukuanarray.GetSize (); ii++)
  311. {
  312. if(bukuanarray.ElementAt (ii).ElementAt (2)=="3" || bukuanarray.ElementAt (ii).ElementAt (2)=="4")
  313. {
  314. /* BOOL bWait1=0;
  315. BOOL bWait2=0;
  316. IsWaiter(bukuanarray.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
  317. if(bWait1)//我是摄影师
  318. {
  319. money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  320. }
  321. if(bWait2)//我是化妆师
  322. {
  323. money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  324. }*/
  325. if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
  326. money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  327. }
  328. else if(bukuanarray.ElementAt (ii).ElementAt (2)=="2")//选片补款, 需加摄影师和化妆师
  329. {
  330. BOOL bWait1=0;
  331. BOOL bWait2=0;
  332. IsWaiter(bukuanarray.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
  333. if(bWait1)//我是摄影师
  334. {
  335. money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  336. }
  337. if(bWait2)//我是化妆师
  338. {
  339. money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  340. }
  341. if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
  342. money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  343. }
  344. else
  345. {
  346. if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
  347. money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
  348. }
  349. }
  350. for( ii=0; ii<bukuanarray2.GetSize (); ii++)
  351. {
  352. if(bukuanarray2.ElementAt (ii).ElementAt (2)=="3" || bukuanarray2.ElementAt (ii).ElementAt (2)=="4")
  353. {
  354. BOOL bWait1=0;
  355. BOOL bWait2=0;
  356. IsWaiter(bukuanarray2.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
  357. if(bWait1)//我是摄影师
  358. {
  359. money1+=atof(bukuanarray2.ElementAt (ii).ElementAt (0));
  360. }
  361. if(bWait2)//我是化妆师
  362. {
  363. money1+=atof(bukuanarray2.ElementAt (ii).ElementAt (0));
  364. }
  365. }
  366. }
  367. for( ii=0; ii<singleincomearray.GetSize (); ii++)
  368. {
  369. if(singleincomearray.ElementAt (ii).ElementAt (6)!=name)continue;
  370. money2+=atof(singleincomearray.ElementAt (ii).ElementAt (2));
  371. }
  372. money1array.SetAt (n, money1);
  373. money2array.SetAt (n, money2);
  374. }
  375. KindChange();
  376. }
  377. void StaffAchievement::KindChange()
  378. {
  379. if(m_day<1)return;
  380. int chartcount=m_List1array.GetSize ()/m_day;
  381. if(m_List1array.GetSize ()%m_day)chartcount++;
  382. if(chartcount==0)return;
  383. for(int i=0; i<m_pChartArray.GetSize (); i++)
  384. {
  385. CMSChart *pChart=m_pChartArray.ElementAt (i);
  386. pChart->ShowWindow (SW_HIDE);
  387. }
  388. while(m_pChartArray.GetSize ()<chartcount)
  389. {
  390. CMSChart *pChart=new CMSChart;
  391. CRect rc(0,0,0,0);
  392. WCHAR pwchLicenseKey[] =
  393. {
  394. 0x0038, 0x0045, 0x0031, 0x0034, 0x0037, 0x0043,
  395. 0x0036, 0x0039, 0x002D, 0x0042, 0x0044, 0x0035,
  396. 0x0030, 0x002D, 0x0031, 0x0031, 0x0064, 0x0031,
  397. 0x002D, 0x0042, 0x0031, 0x0033, 0x0037, 0x002D,
  398. 0x0030, 0x0030, 0x0030, 0x0030, 0x0046, 0x0038,
  399. 0x0037, 0x0035, 0x0033, 0x0046, 0x0035, 0x0044
  400. };
  401. BSTR bstrLicense = ::SysAllocStringLen(pwchLicenseKey,
  402. sizeof(pwchLicenseKey)/sizeof(WCHAR));
  403. pChart->Create ("", WS_VISIBLE|WS_CHILD, rc, this, m_pChartArray.GetSize (), NULL, 0, bstrLicense );
  404. ::SysFreeString(bstrLicense);
  405. m_pChartArray.Add (pChart);
  406. InitChartStyle(pChart);
  407. SetChartStyle(pChart);
  408. }
  409. CRect rc;
  410. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
  411. ScreenToClient(rc);
  412. int hei=rc.Height ()/chartcount;
  413. for( i=0; i<chartcount; i++)
  414. {
  415. CMSChart *pChart=m_pChartArray.ElementAt (i);
  416. rc.bottom =rc.top +hei;
  417. pChart->MoveWindow (rc);
  418. pChart->ShowWindow (SW_SHOW);
  419. rc.top +=hei;
  420. int nRowCount=min(m_day, m_List1array.GetSize ()-i*m_day);
  421. pChart->SetRowCount(nRowCount);
  422. if(m_radio2==0)//叠加
  423. {
  424. for(int row = 1; row <= nRowCount; ++row)
  425. {
  426. pChart->SetRow(row);
  427. pChart->SetRowLabel(m_List1array.ElementAt (i*m_day+row-1).ElementAt (0));
  428. pChart->GetDataGrid().SetData(row, 1, money1array.ElementAt (i*m_day+row-1)+money2array.ElementAt (i*m_day+row-1), 0);
  429. }
  430. }
  431. else
  432. {
  433. for(int row = 1; row <= nRowCount; ++row)
  434. {
  435. pChart->SetRow(row);
  436. pChart->SetRowLabel(m_List1array.ElementAt (i*m_day+row-1).ElementAt (0));
  437. pChart->GetDataGrid().SetData(row, 1, money1array.ElementAt (i*m_day+row-1), 0);
  438. pChart->GetDataGrid().SetData(row, 2, money2array.ElementAt (i*m_day+row-1), 0);
  439. }
  440. }
  441. pChart->Refresh();
  442. }
  443. }
  444. void StaffAchievement::OnRadio3()
  445. {
  446. // TODO: Add your control notification handler code here
  447. UpdateData();
  448. if(m_radio1==0)
  449. {
  450. for(int i=0; i<m_pChartArray.GetSize (); i++)
  451. {
  452. CMSChart *pChart=m_pChartArray.ElementAt (i);
  453. pChart->SetChartType(3);
  454. }
  455. }
  456. else if(m_radio1==1)
  457. {
  458. for(int i=0; i<m_pChartArray.GetSize (); i++)
  459. {
  460. CMSChart *pChart=m_pChartArray.ElementAt (i);
  461. pChart->SetChartType(1);
  462. }
  463. }
  464. else if(m_radio1==2)
  465. {
  466. for(int i=0; i<m_pChartArray.GetSize (); i++)
  467. {
  468. CMSChart *pChart=m_pChartArray.ElementAt (i);
  469. pChart->SetChartType(14);
  470. }
  471. }
  472. }
  473. void StaffAchievement::OnRadio4()
  474. {
  475. // TODO: Add your control notification handler code here
  476. OnRadio3();
  477. }
  478. void StaffAchievement::OnRadio5()
  479. {
  480. // TODO: Add your control notification handler code here
  481. OnRadio3();
  482. }
  483. void StaffAchievement::OnRadio6() //叠加
  484. {
  485. // TODO: Add your control notification handler code here
  486. UpdateData();
  487. for(int i=0; i<m_pChartArray.GetSize (); i++)
  488. {
  489. CMSChart *pChart=m_pChartArray.ElementAt (i);
  490. SetChartStyle(pChart);
  491. }
  492. KindChange();
  493. }
  494. void StaffAchievement::OnRadio7() //对比
  495. {
  496. // TODO: Add your control notification handler code here
  497. OnRadio6();
  498. }
  499. void StaffAchievement::SetChartStyle(CMSChart *pChart)
  500. {
  501. if(m_radio2==0)
  502. {
  503. pChart->SetColumnCount(1);
  504. pChart->SetColumn(1);
  505. pChart->SetColumnLabel((LPCTSTR)"全部");
  506. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  507. // 线宽(对点线图有效)
  508. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  509. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  510. // 0: 不显示 1: 显示在柱状图外
  511. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  512. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  513. }
  514. else
  515. {
  516. pChart->SetColumnCount(2);
  517. pChart->SetColumn(1);
  518. pChart->SetColumnLabel((LPCTSTR)"前期");
  519. pChart->SetColumn(2);
  520. pChart->SetColumnLabel((LPCTSTR)"后期");
  521. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
  522. pChart->GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(0, 255, 0);
  523. // 线宽(对点线图有效)
  524. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  525. pChart->GetPlot().GetSeriesCollection().GetItem(2).GetPen().SetWidth(30);
  526. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  527. // 0: 不显示 1: 显示在柱状图外
  528. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  529. pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  530. pChart->GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  531. }
  532. }
  533. void StaffAchievement::InitChartStyle(CMSChart *pChart)
  534. {
  535. VARIANT var;
  536. pChart->GetBackdrop().GetFill().SetStyle(1);
  537. pChart->GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
  538. pChart->SetShowLegend(TRUE);
  539. pChart->SetChartType(3);
  540. // 栈模式
  541. pChart->SetStacking(FALSE);
  542. pChart->GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
  543. pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
  544. pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
  545. pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
  546. }
  547. void StaffAchievement::OnDestroy()
  548. {
  549. CFormView::OnDestroy();
  550. for(int i=0; i<m_pChartArray.GetSize (); i++)
  551. {
  552. CMSChart *pChart=m_pChartArray.ElementAt (i);
  553. pChart->DestroyWindow ();
  554. delete pChart;
  555. }
  556. m_pChartArray.RemoveAll ();
  557. }
  558. void StaffAchievement::OnBUTshowall()
  559. {
  560. // TODO: Add your control notification handler code here
  561. StaffAchievementShowAll dlg;
  562. dlg.m_year=m_year;
  563. dlg.m_month=m_month;
  564. dlg.m_day=m_day;
  565. dlg.m_radio2=1;
  566. dlg.m_radio1=1;
  567. dlg.DoModal ();
  568. }
  569. BOOL StaffAchievement::PreTranslateMessage(MSG* pMsg)
  570. {
  571. // TODO: Add your specialized code here and/or call the base class
  572. try
  573. {
  574. if(pMsg->message==WM_KEYDOWN)
  575. {
  576. switch (pMsg->wParam)
  577. {
  578. case 0x43: // copy
  579. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  580. {
  581. GetFocus()->SendMessage(WM_COPY);
  582. return TRUE;
  583. }
  584. break;
  585. case 0x56: //Ctrl + V:
  586. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  587. {
  588. GetFocus()->SendMessage(WM_PASTE);
  589. return TRUE;
  590. }
  591. break;
  592. case 0x58: // cut
  593. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  594. {
  595. GetFocus()->SendMessage(WM_CUT);
  596. return TRUE;
  597. }
  598. break;
  599. case 0x5A: //undo
  600. case 0x59: //redo
  601. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  602. {
  603. GetFocus()->SendMessage(WM_UNDO);
  604. return TRUE;
  605. }
  606. break;
  607. }
  608. }
  609. return CFormView::PreTranslateMessage(pMsg);
  610. }
  611. catch(...)
  612. {
  613. }
  614. }