123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679 |
- // StaffAchievement.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "StaffAchievement.h"
- #include "MyMdi.H"
- #include "VcPlot.h"
- #include "VcAxis.h"
- #include "VcValueScale.h"
- #include "VcSeriesCollection.h"
- #include "VcSeries.h"
- #include "VcPen.h"
- #include "VcCategoryScale.h"
- #include "VcColor.h"
- #include "VcDataGrid.h"
- #include "VcBackdrop.h"
- #include "VcFill.h"
- #include "VcBrush.h"
- #include "VcDataPoints.h"
- #include "VcDataPoint.h"
- #include "VcDataPointLabel.h"
- #include "VcAxisTitle.h"
- #include "StaffAchievementShowAll.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // StaffAchievement IDC_STATIC1
- IMPLEMENT_DYNCREATE(StaffAchievement, CFormView)
- StaffAchievement::StaffAchievement()
- : CFormView(StaffAchievement::IDD)
- {
- //{{AFX_DATA_INIT(StaffAchievement)
- m_year = CTime::GetCurrentTime ().GetYear ();
- m_month = CTime::GetCurrentTime ().GetMonth ();
- m_day = 12;
- m_radio2 = 0;
- m_radio1 = 0;
- m_bInit=0;
- m_timestmap=0;
- //}}AFX_DATA_INIT
- g_pMainWnd->GetOcx();
- }
- StaffAchievement::~StaffAchievement()
- {
- }
- void StaffAchievement::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(StaffAchievement)
- DDX_Control(pDX, IDC_SPIN3, m_spinday);
- DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
- DDX_Control(pDX, IDC_SPIN1, m_spinyear);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_Text(pDX, IDC_EDITyear, m_year);
- DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
- DDX_Text(pDX, IDC_EDITmonth, m_month);
- DDV_MinMaxUInt(pDX, m_month, 1, 12);
- DDX_Text(pDX, IDC_EDITday, m_day);
- DDV_MinMaxUInt(pDX, m_day, 1, 31);
- DDX_Radio(pDX, IDC_RADIO6, m_radio2);
- DDX_Radio(pDX, IDC_RADIO3, m_radio1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(StaffAchievement, CFormView)
- //{{AFX_MSG_MAP(StaffAchievement)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
- ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
- ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
- ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
- ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
- ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
- ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
- ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
- ON_WM_DESTROY()
- ON_BN_CLICKED(IDC_BUTprint, OnBUTshowall)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // StaffAchievement diagnostics
- #ifdef _DEBUG
- void StaffAchievement::AssertValid() const
- {
- CFormView::AssertValid();
- }
- void StaffAchievement::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // StaffAchievement message handlers
- void StaffAchievement::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
-
- // Here we create the outbar control using the splitter as its parent
- // and setting its id to the first pane.
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
- EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
-
- m_static1.SetFont (&g_titlefont);
-
- m_spinyear.SetRange (1900, 3000);
- m_spinmonth.SetRange (1, 12);
- m_spinday.SetRange (1, 31);
- CString version = _T ("Version 1.0");
- m_day=AfxGetApp()->GetProfileInt (version, "rowcount", 12);
- UpdateData(false);
-
- m_bInit=1;
- DateChange();
- // if(g_bStaffAchievementShow)
- // OnBUTshowall();
- }
- void StaffAchievement::FillGrid()
- {
-
- }
- void StaffAchievement::OnBUTclose()
- {
- // TODO: Add your control notification handler code here
- GetParent()->SendMessage(WM_CLOSE);
- }
- void StaffAchievement::OnChangeEDITyear()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- DateChange();
- // TODO: Add your control notification handler code here
-
- }
- void StaffAchievement::OnChangeEDITmonth()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- DateChange();
- // TODO: Add your control notification handler code here
-
- }
- void StaffAchievement::OnChangeEDITday()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- if(m_bInit==0)return;
- DateChange();
- UpdateData();
- CString version = _T ("Version 1.0");
- AfxGetApp()->WriteProfileInt (version, "rowcount", m_day);
- // TODO: Add your control notification handler code here
-
- }
- extern void IsWaiter(CString id, CString name, CArray<CStringArray, CStringArray>*waiterarray, BOOL &bWait1, BOOL &bWait2);
- extern int GetYearPos(int year);
- void StaffAchievement::DateChange()
- {
- if(m_bInit==0)return;
- // if(::GetTickCount ()-m_timestmap<500)return;
- // m_timestmap=::GetTickCount ();
- UpdateData();
-
- CString date1,date2;
- date1.Format ("%d-%02d-01", m_year, m_month);
- date2.Format ("%d-%02d-31", m_year, m_month);
- CArray<CStringArray, CStringArray>bukuanarray;
- CArray<CStringArray, CStringArray>bukuanarray2;
- CArray<CStringArray, CStringArray>singleincomearray;
- int i;
- int g_nYearposTemp=g_nYearpos;
- BOOL bLastYear=0;
- BOOL bThisYear=0;
- BOOL bOldYear=0;
- if(m_year==atoi(g_date.Left (4)) && g_hisyeararray.GetSize () )
- bThisYear=1;
- else if(m_year==atoi(g_date.Left (4))-1 && g_hisyeararray.GetSize ())
- bLastYear=1;
- else if(atoi(g_date.Left (4))-m_year>1 && g_hisyeararray.GetSize ()>=(atoi(g_date.Left (4))-m_year))
- {
- bOldYear=1;
- }
- g_nYearpos=GetYearPos(m_year);
-
- CString filter="date>='"+date1+"' and date<='"+date2+"';\
- dat>='"+date1+"' and dat<='"+date2+"';\
- ;\
- ;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
- //;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'
- g_sendhead.code[0]=59;
- g_sendhead.code[1]=14;
- g_sendhead.code[2]=60;
- g_sendhead.code[3]=34;
- g_sendhead.code[4]=61;
- g_sendhead.tabcount=5;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if(g_bSendOK==0)
- {
- g_nYearpos=g_nYearposTemp;
- return;
- }
- DataToArray(&bukuanarray,&singleincomearray,&waiterarray,&m_List1array,&bukuanarray2);
- if(bLastYear)//如果是去年, 则加今年的补款
- {
- g_nYearpos=-1;//今年
-
- filter="date>='"+date1+"' and date<='"+date2+"';;;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
- g_sendhead.code[0]=59;
- g_sendhead.code[1]=60;
- g_sendhead.code[2]=34;
- g_sendhead.code[3]=61;
- g_sendhead.tabcount=4;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if(g_bSendOK==0)
- {
- g_nYearpos=g_nYearposTemp;
- return;
- }
- CArray<CStringArray, CStringArray>ThisYearbukuanarray;
- CArray<CStringArray, CStringArray>ThisYearwaiterarray;
- CArray<CStringArray, CStringArray>ThisYearbukuanarray2;
- DataToArray(&ThisYearbukuanarray,&ThisYearwaiterarray,&m_List1array,&ThisYearbukuanarray2);
- int oldsize=bukuanarray.GetSize ();
- bukuanarray.SetSize(oldsize+ThisYearbukuanarray.GetSize ());
- for(i=oldsize; i<oldsize+ThisYearbukuanarray.GetSize (); i++)
- {
- bukuanarray.ElementAt (i).Copy(ThisYearbukuanarray.ElementAt (i-oldsize));
- }
- oldsize=bukuanarray2.GetSize ();
- bukuanarray2.SetSize(oldsize+ThisYearbukuanarray2.GetSize ());
- for(i=oldsize; i<oldsize+ThisYearbukuanarray2.GetSize (); i++)
- {
- bukuanarray2.ElementAt (i).Copy(ThisYearbukuanarray2.ElementAt (i-oldsize));
- }
- oldsize=waiterarray.GetSize ();
- waiterarray.SetSize(oldsize+ThisYearwaiterarray.GetSize ());
- for(i=oldsize; i<oldsize+ThisYearwaiterarray.GetSize (); i++)
- {
- waiterarray.ElementAt (i).Copy(ThisYearwaiterarray.ElementAt (i-oldsize));
- }
- }
- else if(bThisYear)//如果是今年, 则加去年的补款
- {
- g_nYearpos=0;//去年
- filter="date>='"+date1+"' and date<='"+date2+"';;time2>='"+date1+"' and time2<='"+date2+"' and status<>'未拍'";
- g_sendhead.code[0]=59;
- g_sendhead.code[1]=60;
- g_sendhead.code[2]=61;
- g_sendhead.tabcount=3;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if(g_bSendOK==0)
- {
- g_nYearpos=g_nYearposTemp;
- return;
- }
- CArray<CStringArray, CStringArray>LastYearbukuanarray;
- CArray<CStringArray, CStringArray>LastYearwaiterarray;
- CArray<CStringArray, CStringArray>LastYearbukuanarray2;
- DataToArray(&LastYearbukuanarray,&LastYearwaiterarray,&LastYearbukuanarray2);
- int oldsize=bukuanarray.GetSize ();
- bukuanarray.SetSize(oldsize+LastYearbukuanarray.GetSize ());
- for(i=oldsize; i<oldsize+LastYearbukuanarray.GetSize (); i++)
- {
- bukuanarray.ElementAt (i).Copy(LastYearbukuanarray.ElementAt (i-oldsize));
- }
- oldsize=bukuanarray2.GetSize ();
- bukuanarray2.SetSize(oldsize+LastYearbukuanarray2.GetSize ());
- for(i=oldsize; i<oldsize+LastYearbukuanarray2.GetSize (); i++)
- {
- bukuanarray2.ElementAt (i).Copy(LastYearbukuanarray2.ElementAt (i-oldsize));
- }
- oldsize=waiterarray.GetSize ();
- waiterarray.SetSize(oldsize+LastYearwaiterarray.GetSize ());
- for(i=oldsize; i<oldsize+LastYearwaiterarray.GetSize (); i++)
- {
- waiterarray.ElementAt (i).Copy(LastYearwaiterarray.ElementAt (i-oldsize));
- }
- }
- else if(bLastYear)//如果是以往年份, 则需更新员工信息
- {
- g_nYearpos=-1;//今年
-
- g_sendhead.code[0]=34;
- g_sendhead.tabcount=1;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- if(g_bSendOK==0)
- {
- g_nYearpos=g_nYearposTemp;
- return;
- }
- DataToArray(&m_List1array);
- }
- g_nYearpos=g_nYearposTemp;
-
- ////////////////////////////
- int ii=0;
- money1array.RemoveAll ();
- money1array.SetSize(m_List1array.GetSize ());
- money2array.RemoveAll ();
- money2array.SetSize(m_List1array.GetSize ());
- for(int n=0; n<m_List1array.GetSize (); n++)
- {
- CString name=m_List1array.ElementAt (n).ElementAt (0);
- float money1=0;
- float money2=0;
- int arraypos=0;
- for( ii=0; ii<bukuanarray.GetSize (); ii++)
- {
- if(bukuanarray.ElementAt (ii).ElementAt (2)=="3" || bukuanarray.ElementAt (ii).ElementAt (2)=="4")
- {
- /* BOOL bWait1=0;
- BOOL bWait2=0;
- IsWaiter(bukuanarray.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
- if(bWait1)//我是摄影师
- {
- money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- if(bWait2)//我是化妆师
- {
- money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }*/
- if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
- money1+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- else if(bukuanarray.ElementAt (ii).ElementAt (2)=="2")//选片补款, 需加摄影师和化妆师
- {
- BOOL bWait1=0;
- BOOL bWait2=0;
- IsWaiter(bukuanarray.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
- if(bWait1)//我是摄影师
- {
- money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- if(bWait2)//我是化妆师
- {
- money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
- money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- else
- {
- if(bukuanarray.ElementAt (ii).ElementAt (6)!=name)continue;
- money2+=atof(bukuanarray.ElementAt (ii).ElementAt (0));
- }
- }
- for( ii=0; ii<bukuanarray2.GetSize (); ii++)
- {
- if(bukuanarray2.ElementAt (ii).ElementAt (2)=="3" || bukuanarray2.ElementAt (ii).ElementAt (2)=="4")
- {
- BOOL bWait1=0;
- BOOL bWait2=0;
- IsWaiter(bukuanarray2.ElementAt (ii).ElementAt (5), name, &waiterarray, bWait1, bWait2);
- if(bWait1)//我是摄影师
- {
- money1+=atof(bukuanarray2.ElementAt (ii).ElementAt (0));
- }
- if(bWait2)//我是化妆师
- {
- money1+=atof(bukuanarray2.ElementAt (ii).ElementAt (0));
- }
- }
- }
- for( ii=0; ii<singleincomearray.GetSize (); ii++)
- {
- if(singleincomearray.ElementAt (ii).ElementAt (6)!=name)continue;
- money2+=atof(singleincomearray.ElementAt (ii).ElementAt (2));
- }
- money1array.SetAt (n, money1);
- money2array.SetAt (n, money2);
- }
- KindChange();
- }
- void StaffAchievement::KindChange()
- {
- if(m_day<1)return;
- int chartcount=m_List1array.GetSize ()/m_day;
- if(m_List1array.GetSize ()%m_day)chartcount++;
- if(chartcount==0)return;
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- pChart->ShowWindow (SW_HIDE);
- }
- while(m_pChartArray.GetSize ()<chartcount)
- {
- CMSChart *pChart=new CMSChart;
- CRect rc(0,0,0,0);
- WCHAR pwchLicenseKey[] =
- {
- 0x0038, 0x0045, 0x0031, 0x0034, 0x0037, 0x0043,
- 0x0036, 0x0039, 0x002D, 0x0042, 0x0044, 0x0035,
- 0x0030, 0x002D, 0x0031, 0x0031, 0x0064, 0x0031,
- 0x002D, 0x0042, 0x0031, 0x0033, 0x0037, 0x002D,
- 0x0030, 0x0030, 0x0030, 0x0030, 0x0046, 0x0038,
- 0x0037, 0x0035, 0x0033, 0x0046, 0x0035, 0x0044
- };
- BSTR bstrLicense = ::SysAllocStringLen(pwchLicenseKey,
- sizeof(pwchLicenseKey)/sizeof(WCHAR));
- pChart->Create ("", WS_VISIBLE|WS_CHILD, rc, this, m_pChartArray.GetSize (), NULL, 0, bstrLicense );
- ::SysFreeString(bstrLicense);
- m_pChartArray.Add (pChart);
- InitChartStyle(pChart);
- SetChartStyle(pChart);
- }
- CRect rc;
- GetDlgItem(IDC_STATIC2)->GetWindowRect(rc);
- ScreenToClient(rc);
- int hei=rc.Height ()/chartcount;
- for( i=0; i<chartcount; i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- rc.bottom =rc.top +hei;
- pChart->MoveWindow (rc);
- pChart->ShowWindow (SW_SHOW);
- rc.top +=hei;
- int nRowCount=min(m_day, m_List1array.GetSize ()-i*m_day);
- pChart->SetRowCount(nRowCount);
- if(m_radio2==0)//叠加
- {
- for(int row = 1; row <= nRowCount; ++row)
- {
- pChart->SetRow(row);
- pChart->SetRowLabel(m_List1array.ElementAt (i*m_day+row-1).ElementAt (0));
- pChart->GetDataGrid().SetData(row, 1, money1array.ElementAt (i*m_day+row-1)+money2array.ElementAt (i*m_day+row-1), 0);
- }
- }
- else
- {
- for(int row = 1; row <= nRowCount; ++row)
- {
- pChart->SetRow(row);
- pChart->SetRowLabel(m_List1array.ElementAt (i*m_day+row-1).ElementAt (0));
- pChart->GetDataGrid().SetData(row, 1, money1array.ElementAt (i*m_day+row-1), 0);
- pChart->GetDataGrid().SetData(row, 2, money2array.ElementAt (i*m_day+row-1), 0);
- }
- }
- pChart->Refresh();
- }
- }
- void StaffAchievement::OnRadio3()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- if(m_radio1==0)
- {
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- pChart->SetChartType(3);
- }
- }
- else if(m_radio1==1)
- {
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- pChart->SetChartType(1);
- }
- }
- else if(m_radio1==2)
- {
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- pChart->SetChartType(14);
- }
- }
- }
- void StaffAchievement::OnRadio4()
- {
- // TODO: Add your control notification handler code here
- OnRadio3();
- }
- void StaffAchievement::OnRadio5()
- {
- // TODO: Add your control notification handler code here
- OnRadio3();
- }
- void StaffAchievement::OnRadio6() //叠加
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- SetChartStyle(pChart);
- }
- KindChange();
- }
- void StaffAchievement::OnRadio7() //对比
- {
- // TODO: Add your control notification handler code here
- OnRadio6();
- }
- void StaffAchievement::SetChartStyle(CMSChart *pChart)
- {
- if(m_radio2==0)
- {
- pChart->SetColumnCount(1);
- pChart->SetColumn(1);
- pChart->SetColumnLabel((LPCTSTR)"全部");
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
- // 线宽(对点线图有效)
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
- // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
- // 0: 不显示 1: 显示在柱状图外
- // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
- }
- else
- {
- pChart->SetColumnCount(2);
- pChart->SetColumn(1);
- pChart->SetColumnLabel((LPCTSTR)"前期");
- pChart->SetColumn(2);
- pChart->SetColumnLabel((LPCTSTR)"后期");
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(255, 0, 0);
- pChart->GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(0, 255, 0);
- // 线宽(对点线图有效)
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
- pChart->GetPlot().GetSeriesCollection().GetItem(2).GetPen().SetWidth(30);
- // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
- // 0: 不显示 1: 显示在柱状图外
- // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
- pChart->GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
- pChart->GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
- }
- }
- void StaffAchievement::InitChartStyle(CMSChart *pChart)
- {
- VARIANT var;
- pChart->GetBackdrop().GetFill().SetStyle(1);
- pChart->GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
- pChart->SetShowLegend(TRUE);
- pChart->SetChartType(3);
- // 栈模式
- pChart->SetStacking(FALSE);
- pChart->GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
- pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
- pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
- pChart->GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
- }
- void StaffAchievement::OnDestroy()
- {
- CFormView::OnDestroy();
- for(int i=0; i<m_pChartArray.GetSize (); i++)
- {
- CMSChart *pChart=m_pChartArray.ElementAt (i);
- pChart->DestroyWindow ();
- delete pChart;
- }
- m_pChartArray.RemoveAll ();
- }
- void StaffAchievement::OnBUTshowall()
- {
- // TODO: Add your control notification handler code here
- StaffAchievementShowAll dlg;
- dlg.m_year=m_year;
- dlg.m_month=m_month;
- dlg.m_day=m_day;
- dlg.m_radio2=1;
- dlg.m_radio1=1;
- dlg.DoModal ();
- }
- BOOL StaffAchievement::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- try
- {
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case 0x43: // copy
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- return CFormView::PreTranslateMessage(pMsg);
- }
- catch(...)
- {
- }
- }
|