// InputCard2PointBlue.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "InputCard2PointBlue.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // InputCard2PointBlue dialog IDC_EDITtaoxijiage InputCard2PointBlue::InputCard2PointBlue(CWnd* pParent /*=NULL*/) : CDialog(InputCard2PointBlue::IDD, pParent) { //{{AFX_DATA_INIT(InputCard2PointBlue) m_name1 = _T(""); m_name2 = _T(""); m_id = _T(""); m_ren = _T(""); m_taoxiname = _T(""); m_memberno = _T(""); m_name = _T(""); m_point = _T(""); m_taoxijiage = _T(""); m_card2no = _T(""); m_jiage = _T(""); m_rate = _T(""); //}}AFX_DATA_INIT } void InputCard2PointBlue::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(InputCard2PointBlue) DDX_Control(pDX, IDC_COMBO5, m_combobox); DDX_Text(pDX, IDC_EDITname, m_name1); DDX_Text(pDX, IDC_EDITname2, m_name2); DDX_Text(pDX, IDC_EDITid, m_id); DDX_Text(pDX, IDC_EDITOren, m_ren); DDX_Text(pDX, IDC_EDITtaoxiname, m_taoxiname); DDX_Text(pDX, IDC_EDIT1, m_memberno); DDX_Text(pDX, IDC_EDITmembername, m_name); DDX_Text(pDX, IDC_EDIT2, m_point); DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage); DDX_Text(pDX, IDC_EDITcard2no, m_card2no); DDX_Text(pDX, IDC_EDIT7, m_jiage); DDX_Text(pDX, IDC_EDIT3, m_rate); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(InputCard2PointBlue, CDialog) //{{AFX_MSG_MAP(InputCard2PointBlue) ON_CBN_SELCHANGE(IDC_COMBO5, OnSelchangeCombo5) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // InputCard2PointBlue message handlers BOOL InputCard2PointBlue::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here #ifdef CHILD_VERSION GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:"); GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:"); #endif m_acCombo.Init(&m_combobox); CString filter="hashistory;[memberno]='"+m_memberno+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=30; g_sendhead.code[1]=132; g_sendhead.tabcount=2; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return 0; DataToArray(&m_List1array,&g_List1array); m_acCombo.m_pArray=&m_List1array; m_combobox.SetFocus (); CString m_bluescale1; CString m_bluescale2; CString m_bluescale3; CString m_bluescale4; CString m_bluescale5; CString m_bluescale6; CString m_bluescale7; CString m_bluescale8; CString m_bluescale9; CString m_bluescale10; CString str=(g_cominfoarray.ElementAt (0).ElementAt (119)); if(str=="") str="5,10,15,20,50,0,0,0,0,0"; int pos=str.Find(","); m_bluescale1=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale2=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale3=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale4=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale5=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale6=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale7=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale8=str.Left(pos); str=str.Right(str.GetLength()-pos-1); pos=str.Find(","); m_bluescale9=str.Left(pos); str=str.Right(str.GetLength()-pos-1); m_bluescale10=str.Left(pos); if(g_List1array.GetSize ()%10==0) m_rate=m_bluescale1+"%"; else if(g_List1array.GetSize ()%10==1) m_rate=m_bluescale2+"%"; else if(g_List1array.GetSize ()%10==2) m_rate=m_bluescale3+"%"; else if(g_List1array.GetSize ()%10==3) m_rate=m_bluescale4+"%"; else if(g_List1array.GetSize ()%10==4) m_rate=m_bluescale5+"%"; else if(g_List1array.GetSize ()%10==5) m_rate=m_bluescale6+"%"; else if(g_List1array.GetSize ()%10==6) m_rate=m_bluescale7+"%"; else if(g_List1array.GetSize ()%10==7) m_rate=m_bluescale8+"%"; else if(g_List1array.GetSize ()%10==8) m_rate=m_bluescale9+"%"; else if(g_List1array.GetSize ()%10==9) m_rate=m_bluescale10+"%"; else m_rate="0%"; UpdateData(false); this->CenterWindow (g_pMainWnd); return false; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void InputCard2PointBlue::OnOK() { // TODO: Add extra validation here UpdateData(); if(atol(m_point)<1) { AfxMessageBox("现金不能小于1!", MB_ICONINFORMATION); return; } m_card2no.TrimLeft (); m_card2no.TrimRight (); if(m_card2no.IsEmpty ()) { AfxMessageBox("副卡卡号不能为空!", MB_ICONINFORMATION); return; } CString filter="[card2no]='"+m_card2no+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=131; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&g_List1array); if(g_List1array.GetSize ()==0) { AfxMessageBox("没有此副卡号的记录!");return; } CString date2=g_List1array.ElementAt (0).ElementAt (2); CString sql; sql="delete from membercard2blue where [card2no]='"+m_card2no+"'"; sql+="~~~insert into memberregblue([memberno],[dindanid],[money],[date],[card2no],[type],[taoxi],[date2])values('"+m_memberno+"','"+m_id+"','"+m_point+"','"+g_date+"','"+m_card2no+"','转介绍','"+m_taoxiname+"','"+date2+"')"; sql+="~~~"; if( atoi(g_cominfoarray.ElementAt(0).ElementAt(51)) ) { CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52); CString content,timestamp; CString name; if(!m_name1.IsEmpty ()) name=m_name1+","; name+=m_name2; name.TrimRight (","); CString name2=m_name; #ifndef CHILD_VERSION if(m_sex=="男") name2+="先生"; else if(m_sex=="女") name2+="女士"; #endif content.Format ("%s您好,您的朋友%s为您返现金%s元.", name2, name, m_point); content+=m_content5; timestamp="msgtimestamp"; if( CheckPhoneType(m_phone)!=-1 && CheckBadWords(content,0)&& CheckBadWords2(content,0) ) { int count=GetLengthEx(content)/MSG_LENGTH; if(GetLengthEx(content)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); CString sql2="insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone+"','"+content+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2;sql+="~~~"; } } sql+=m_memberno; g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); CDialog::OnOK(); } void InputCard2PointBlue::ClientChange() { CString filter="id='"+id+"'"; g_sendhead.code[0]=11; g_sendhead.tabcount=1; g_sendhead.bsql=0; int g_nYearposTemp=g_nYearpos; g_nYearpos=curyear; g_pMainWnd->ProcessChatMessageRequest2(filter); g_nYearpos=g_nYearposTemp; if(g_bSendOK==0)return; DataToArray(&g_List1array); if(g_List1array.GetSize ()) { m_id=g_List1array.ElementAt (0).ElementAt (0); m_name1=g_List1array.ElementAt (0).ElementAt (4); m_name2=g_List1array.ElementAt (0).ElementAt (5); m_taoxiname=g_List1array.ElementAt (0).ElementAt (7); m_taoxijiage=g_List1array.ElementAt (0).ElementAt (8); m_ren=g_List1array.ElementAt (0).ElementAt (14); float frate=atof(m_rate)/100.0; m_point.Format ("%d", (int)(min(atof(m_taoxijiage),atof(m_jiage))*frate)); GetDlgItem(IDOK)->EnableWindow(1); if(atof(m_taoxijiage)EnableWindow(0); } UpdateData(false); } } void InputCard2PointBlue::OnSelchangeCombo5() { // TODO: Add your control notification handler code here int pos=m_combobox.GetCurSel (); if(pos==-1)return; if(m_acCombo.m_posarray.GetSize ()<=pos)return; int pos2=m_acCombo.m_posarray .ElementAt (pos); id=m_List1array.ElementAt (pos2).ElementAt (0); curyear=atoi(m_List1array.ElementAt (pos2).ElementAt (16)); ClientChange(); }