// AddIncome.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "AddIncome.h" #include "SPLBDlg.h" #include "SelPayType.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // AddIncome dialog AddIncome::AddIncome(CWnd* pParent /*=NULL*/) : CDialog(AddIncome::IDD, pParent) { //{{AFX_DATA_INIT(AddIncome) m_bz = _T(""); m_date = g_date; m_money = _T(""); m_name = _T(""); m_renyuan1 = _T(""); m_renyuan2 = g_user.name; m_phone = _T(""); m_count = _T(""); //}}AFX_DATA_INIT } void AddIncome::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(AddIncome) DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Control(pDX, IDC_COMBO4, m_combobz); DDX_Control(pDX, IDC_COMBO2, m_comboren); DDX_Control(pDX, IDC_EDITmoney, m_editctrl1); DDX_Text(pDX, IDC_EDITbz, m_bz); DDV_MaxChars(pDX, m_bz, 1000); DDX_Text(pDX, IDC_EDITdate, m_date); DDX_Text(pDX, IDC_EDITmoney, m_money); DDX_Text(pDX, IDC_EDITname, m_name); DDX_Text(pDX, IDC_EDITrenyuan1, m_renyuan1); DDX_Text(pDX, IDC_EDITrenyuan2, m_renyuan2); DDX_Text(pDX, IDC_EDITphone, m_phone); DDX_Text(pDX, IDC_EDITcount, m_count); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(AddIncome, CDialog) //{{AFX_MSG_MAP(AddIncome) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_CBN_DROPDOWN(IDC_COMBOname, OnDropdownCOMBOname) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // AddIncome message handlers BOOL AddIncome::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here int i = 0; for( i=0; iGetSize (); i++) { m_combobz.AddString (expendtypearray->ElementAt (i).ElementAt (0)); } m_combobz.AddString ("摄影二销"); m_combobz.AddString ("化妆二销"); m_combobz.AddString ("选片二销"); if(m_combobz.FindString (0, m_sale2type)==-1) m_combobz.AddString (m_sale2type); m_combobz.SetCurSel (m_combobz.FindString (0, m_sale2type)); m_comboren.AddString (m_renyuan3); m_comboren.SetCurSel (m_comboren.FindString (0, m_renyuan3)); for( i=0; iGetSize(); i++) { if(m_List1.GetCount()%2) m_List1.AddEntry( itemarray->ElementAt(i).ElementAt(0), g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( itemarray->ElementAt(i).ElementAt(0) , g_gridcol2, m_List1.GetCount()); } m_List1.Invalidate (); SetMySel(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void AddIncome::OnOK() { // TODO: Add extra validation here UpdateData(); m_phone.TrimLeft(); m_phone.TrimRight(); if(!m_phone.IsEmpty ()) { if(m_phone.Left (1)=="1") { if(CheckPhoneType(m_phone)==-1) { AfxMessageBox("手机号码:"+m_phone+"错误!", MB_ICONINFORMATION); return; } } } else return; int pos=m_comboren.GetCurSel (); if(pos==-1) { AfxMessageBox("请填写开单人!", MB_ICONINFORMATION); return; } m_comboren.GetLBText (pos, m_renyuan3); pos=m_combobz.GetCurSel(); if(pos==-1) { AfxMessageBox("请选择正确的二销类别!", MB_ICONINFORMATION); return; } m_combobz.GetLBText (pos, m_sale2type); if(m_name=="") { AfxMessageBox("请选择正确的二销项目!", MB_ICONINFORMATION); return; } m_renyuan1.TrimLeft(); m_renyuan1.TrimRight(); if(m_renyuan1=="")return; CString strRes1; GetFirstLetter(m_renyuan1, strRes1); CString paytype; /* SelPayType seltype; seltype.m_paymoney=m_money; if(seltype.DoModal ()!=IDOK)return; if(seltype.m_radio1==0) paytype="现金"; else if(seltype.m_radio1==1) paytype="POS机刷卡"; else if(seltype.m_radio1==2) paytype="储值卡扣款"; else if(seltype.m_radio1==3) paytype="积分兑换";*/ CString sql; if(m_id.IsEmpty ()) sql.Format ("insert into singleincome([name],[phone],[money],[dat],[renyuan1],[renyuan2],[renyuan3],[sale2type],[bz],[paytype],[pinyin],[payed],[balance],[count])values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','0','%s','%s')",m_name,m_phone,m_money,m_date,m_renyuan1,m_renyuan2,m_renyuan3,m_sale2type,m_bz,paytype,strRes1,m_money,m_count); else { sql.Format ("update singleincome set [name]='%s',[phone]='%s',[money]='%s',[renyuan1]='%s',[renyuan3]='%s',[sale2type]='%s',[bz]='%s',[pinyin]='%s',[count]='%s' where [id]=%d", m_name,m_phone,m_money,m_renyuan1,m_renyuan3,m_sale2type,m_bz, strRes1,m_count,atoi(m_id)); sql+="***refresh singleincomemoney"+m_id; } /* CString m_id="其它二销:"+m_name; if(paytype=="储值卡扣款") { if(seltype.m_bChildMoneyCard) { sql+="***insert into [membercard3childusereg]([memberno],[dindanid],[money],[date])values('"+seltype.m_cardno+"','"+m_id+"','"+m_money+"','"+m_date+"')"; sql+="***refresh balance memberreg4"+seltype.m_parentno+";"+seltype.m_cardno; } else { sql+="***insert into [membercard3usereg]([memberno],[dindanid],[money],[date])values('"+seltype.m_cardno+"','"+m_id+"','"+m_money+"','"+m_date+"')"; sql+="***refresh balance memberreg3";sql+=seltype.m_cardno; } } else if(paytype=="积分兑换") { CString point; float rate=atof(g_cominfoarray.ElementAt (0).ElementAt (38))/100.0; point.Format ("%d", (int)(atof(m_money)*GetPointScale2()/rate)); sql+="***insert into [memberreg2]([memberno],[dindanid],[money],[point],[date])values('"+seltype.m_cardno+"','"+m_id+"','"+m_money+"','"+point+"','"+g_date+"')"; sql+="***refresh balance memberreg2"; sql+=seltype.m_cardno; }*/ g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); CDialog::OnOK(); } void AddIncome::OnButton1() { // TODO: Add your control notification handler code here SPLBDlg dlg; dlg.m_mode=6; dlg.DoModal (); g_sendhead.bsql=0; g_sendhead.code[0]=160; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(1); if(g_bSendOK==0)return; DataToArray(expendtypearray); m_combobz.ResetContent (); for(int i=0; iGetSize (); i++) { m_combobz.AddString (expendtypearray->ElementAt (i).ElementAt (0)); } m_combobz.AddString ("摄影二销"); m_combobz.AddString ("化妆二销"); m_combobz.AddString ("选片二销"); } void AddIncome::OnDropdownCOMBOname() { // TODO: Add your control notification handler code here } void AddIncome::OnButton2() { // TODO: Add your control notification handler code here SPLBDlg dlg; dlg.m_mode=13; dlg.DoModal (); g_sendhead.bsql=0; g_sendhead.code[0]=195; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(1); if(g_bSendOK==0)return; DataToArray(itemarray); m_List1.ResetContent (); for(int i=0; iGetSize(); i++) { if(m_List1.GetCount()%2) m_List1.AddEntry( itemarray->ElementAt(i).ElementAt(0), g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( itemarray->ElementAt(i).ElementAt(0) , g_gridcol2, m_List1.GetCount()); } m_List1.Invalidate (); SetMySel(); } void AddIncome::OnSelchangeList1() { // TODO: Add your control notification handler code here UpdateData(); int pos=m_List1.GetCurSel(); if(pos==-1)return; m_List1.GetText (pos, m_name); UpdateData(0); } void AddIncome::SetMySel() { CString str; for(int i=0; i