// DailyForm.cpp : implementation file // #include "stdafx.h" #include "LYFZIPManage.h" #include "DailyForm.h" #include "MyMdi.H" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DailyForm IMPLEMENT_DYNCREATE(DailyForm, CFormView) DailyForm::DailyForm() : CFormView(DailyForm::IDD) { //{{AFX_DATA_INIT(DailyForm) m_year = CTime::GetCurrentTime ().GetYear (); m_month = CTime::GetCurrentTime ().GetMonth (); m_day = CTime::GetCurrentTime ().GetDay (); m_bInit=0; m_timestmap=0; m_radio1 = 0; //}}AFX_DATA_INIT //m_date = CTime::GetCurrentTime ().Format ("%Y-%m-%d"); } DailyForm::~DailyForm() { } void DailyForm::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(DailyForm) 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_LIST2, m_List1); 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_RADIO3, m_radio1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DailyForm, CFormView) //{{AFX_MSG_MAP(DailyForm) 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_BN_CLICKED(IDC_RADIO8, OnRadio8) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DailyForm diagnostics #ifdef _DEBUG void DailyForm::AssertValid() const { CFormView::AssertValid(); } void DailyForm::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // DailyForm message handlers void DailyForm::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_List1.SetHeadings("项目名称,300;金额,100;项目类别,100;收入/支出,100;日期,100" ); m_List1.LoadColumnInfo (107); m_spinyear.SetRange (1900, 3000); m_spinmonth.SetRange (1, 12); m_spinday.SetRange (1, 31); m_bInit=1; DateChange(); } void DailyForm::FillGrid() { m_List1.DeleteAllItems2 (); int ii=0; m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 ); int count=0; for(ii=0; iiSendMessage(WM_CLOSE); } void DailyForm::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 DailyForm::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 DailyForm::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. DateChange(); // TODO: Add your control notification handler code here } extern int GetYearPos(int year); void DailyForm::DateChange() { if(m_bInit==0)return; // if(::GetTickCount ()-m_timestmap<500)return; // m_timestmap=::GetTickCount (); UpdateData(); int i; int g_nYearposTemp=g_nYearpos; BOOL bLastYear=0; BOOL bThisYear=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; g_nYearpos=GetYearPos(m_year); g_sendhead.bsql=0; g_sendhead.code[0]=14; g_sendhead.code[1]=13; g_sendhead.code[2]=16; g_sendhead.tabcount=3; CString sql,strdate,strdate2; strdate.Format ("%04d-%02d-%02d", m_year, m_month, m_day); m_static1.SetWindowText (strdate+"日财务表"); sql.Format ("dat='"+strdate+"';dat='"+strdate+"';date='"+strdate+"'"); g_pMainWnd->ProcessChatMessageRequest2(sql); if(g_bSendOK==0) { g_nYearpos=g_nYearposTemp; return; } DataToArray(&List2array,&List3array,&List11array); if(bLastYear)//如果是去年, 则加今年的补款 { g_nYearpos=-1;//今年 g_sendhead.bsql=0; g_sendhead.code[0]=16; g_sendhead.tabcount=1; CString sql,strdate,strdate2; strdate.Format ("%04d-%02d-%02d", m_year, m_month, m_day); sql.Format ("date='"+strdate+"'"); g_pMainWnd->ProcessChatMessageRequest2(sql); if(g_bSendOK==0) { g_nYearpos=g_nYearposTemp; return; } CArrayThisYearList11array; DataToArray(&ThisYearList11array); int oldsize=List11array.GetSize (); int newsize=ThisYearList11array.GetSize (); List11array.SetSize(oldsize+ThisYearList11array.GetSize ()); for(i=oldsize; iProcessChatMessageRequest2(sql); if(g_bSendOK==0) { g_nYearpos=g_nYearposTemp; return; } CArrayLastYearList11array; DataToArray(&LastYearList11array); int oldsize=List11array.GetSize (); int newsize=LastYearList11array.GetSize (); List11array.SetSize(oldsize+LastYearList11array.GetSize ()); for(i=oldsize; i