// GetPhoneAge.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "GetPhoneAge.h" #include "MyMdi.H" #include "SetStyle.h" #include "CalendarConvert.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern float g_WidthScale; extern float g_HeightScale; extern BOOL CALLBACK EnumChildProc2(HWND hwnd,LPARAM lParam); extern BOOL CovertDate(CString &date, CString &date2); ////////////////////////////////////////////////////////////IDC_STATIC1///////////////// GetPhoneAge::GetPhoneAge(CWnd* pParent /*=NULL*/) : CDialog(GetPhoneAge::IDD) { //{{AFX_DATA_INIT(GetPhoneAge) m_age1 = 0; m_age2 = 0; m_age3 = 0; m_age4 = 0; //}}AFX_DATA_INIT } void GetPhoneAge::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(GetPhoneAge) DDX_Control(pDX, IDC_SPIN6, m_spin4); DDX_Control(pDX, IDC_SPIN2, m_spin3); DDX_Control(pDX, IDC_SPIN4, m_spin2); DDX_Control(pDX, IDC_SPIN1, m_spin1); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Text(pDX, IDC_EDIT1, m_age1); DDX_Text(pDX, IDC_EDIT2, m_age2); DDX_Text(pDX, IDC_EDIT3, m_age3); DDX_Text(pDX, IDC_EDIT7, m_age4); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(GetPhoneAge, CDialog) //{{AFX_MSG_MAP(GetPhoneAge) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // GetPhoneAge diagnostics #ifdef _DEBUG void GetPhoneAge::AssertValid() const { CDialog::AssertValid(); } void GetPhoneAge::Dump(CDumpContext& dc) const { CDialog::Dump(dc); } #endif //_DEBUG void GetPhoneAge::OnBUTclose() { // TO DO: Add your control notification handler code here CDialog::OnOK (); } BOOL GetPhoneAge::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CRect rc2; GetWindowRect(rc2); ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE); g_WidthScale2 = (float)g_rc.Width()/(float)rc2.Width(); // new/Old g_HeightScale2 = (float)g_rc.Height()/(float)rc2.Height(); EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc2,0); GetDlgItem(IDC_BUTTON3)->EnableWindow(IsHasRights2new(49)); m_List1.SetHeadings("家长姓名,100;宝宝姓名,100;手机,100;宝宝生日,100;宝宝年龄,100;天数,100;套系名称,100;套系价格,100;预约时间,100" ); m_List1.LoadColumnInfo (184); m_spin1.SetRange (1, 20); m_spin2.SetRange (1, 20); m_spin3.SetRange (1, 20); m_spin4.SetRange (1, 20); CArrayList1array[10]; g_sendhead.bsql=0; g_sendhead.code[0]=64; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(15); if(g_bSendOK==0) { return true; } DataToArray(&(List1array[0])); int i = 0; int g_nYearposTemp=g_nYearpos; for( i=0; i< g_hisyeararray.GetSize (); i++) { if(i>=9)break; g_nYearpos=i; g_sendhead.bsql=0; g_sendhead.code[0]=64; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(15); if(g_bSendOK==0) { g_nYearpos=g_nYearposTemp; return true; } DataToArray(&(List1array[i+1])); } g_nYearpos=g_nYearposTemp; int size=0; for(i=0; i<10; i++) { size+=List1array[i].GetSize (); } m_List1array.SetSize(size); int pos=0; for(i=0; i<10; i++) { if(List1array[i].GetSize ()==0)continue; for(int a=0; aRemoveAll (); BOOL bcheck=0; int age1=m_age1; int age2=m_age2; if(age1==0 && age2==0) { bcheck=1; age2=1000; } //生日 { for(ii=0; ii=age1 && atoi(m_List1array.ElementAt (ii).ElementAt (4))<=age2 ) { m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii)); if(!m_List1array.ElementAt (ii).ElementAt (9).IsEmpty ()) { m_pArray->Add (m_List1array.ElementAt (ii).ElementAt (0)); m_pArray->Add (m_List1array.ElementAt (ii).ElementAt (9)); } } } } m_List1.m_arLabels.SetSize(count, 1); ii=count; m_List1.m_LabelCount=ii; m_List1.SetItemCountEx (ii); } void GetPhoneAge::FillGrid2() { UpdateData(); m_List1.DeleteAllItems2 (); int ii=0; m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 ); int count=0; m_pArray->RemoveAll (); BOOL bcheck=0; int age1=m_age3; int age2=m_age4; if(age1==0 && age2==0) { bcheck=1; age2=1000000; } //生日 { for(ii=0; ii=age1 && atoi(m_List1array.ElementAt (ii).ElementAt (5))<=age2 ) { m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii)); if(!m_List1array.ElementAt (ii).ElementAt (9).IsEmpty ()) { m_pArray->Add (m_List1array.ElementAt (ii).ElementAt (0)); m_pArray->Add (m_List1array.ElementAt (ii).ElementAt (9)); } } } } m_List1.m_arLabels.SetSize(count, 1); ii=count; m_List1.m_LabelCount=ii; m_List1.SetItemCountEx (ii); } void GetPhoneAge::OnButton1() { // TODO: Add your control notification handler code here FillGrid(); } void GetPhoneAge::OnButton2() { // TODO: Add your control notification handler code here FillGrid2(); } void GetPhoneAge::OnButton3() { // TODO: Add your control notification handler code here ListToXLS(&m_List1, "c:\\客户资料.xls", 0); }