// SetSalary.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "SetSalary.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // SetSalary dialog SetSalary::SetSalary(CWnd* pParent /*=NULL*/) : CDialog(SetSalary::IDD, pParent) { //{{AFX_DATA_INIT(SetSalary) m_money = _T(""); //}}AFX_DATA_INIT } void SetSalary::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(SetSalary) DDX_Control(pDX, IDC_EDIT1, m_editnum); DDX_Text(pDX, IDC_EDIT1, m_money); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(SetSalary, CDialog) //{{AFX_MSG_MAP(SetSalary) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SetSalary message handlers BOOL SetSalary::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString str; str.Format("%s %d年-%d月 提成总额", name, year, month); SetDlgItemText(IDC_STATIC1, str); g_sendhead.bsql = 0; g_sendhead.code[0] = 85; g_sendhead.tabcount = 1; CString filter; filter.Format("[name]='%s' and [year]='%d' and [month]='%d'", name, year, month); g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK) { CArrayarray; DataToArray(&array); if (array.GetSize()) { m_money = array.ElementAt(0).ElementAt(1); UpdateData(false); } } CenterWindow(); return false; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void SetSalary::OnOK() { // TODO: Add extra validation here UpdateData(); CString sql, temp; sql.Format("delete from salary where [name]='" + name + "' and [year]='%d' and [month]='%d'", year, month); temp.Format("***insert into salary([name],[year],[month],[money])values('" + name + "','%d','%d','" + m_money + "')", year, month); sql += temp; for (int i = 0; i < pArray->GetSize(); i++) { if (selpos == 1) temp.Format("***update dindan set [tichenren1]='%s/%d-%02d' where [id]='" + pArray->ElementAt(i) + "'", name, year, month); else if (selpos == 2) temp.Format("***update dindan set [tichenren2]='%s/%d-%02d' where [id]='" + pArray->ElementAt(i) + "'", name, year, month); else if (selpos == 3) temp.Format("***update dindan set [tichenren3]='%s/%d-%02d' where [id]='" + pArray->ElementAt(i) + "'", name, year, month); else if (selpos == 4) temp.Format("***update dindan set [tichenren4]='%s/%d-%02d' where [id]='" + pArray->ElementAt(i) + "'", name, year, month); else if (selpos == 5) temp.Format("***update dindan set [tichenren5]='%s/%d-%02d' where [id]='" + pArray->ElementAt(i) + "'", name, year, month); sql += temp; } g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; AfxMessageBox("保存成功!"); CDialog::OnOK(); }