// ModifyDinDan.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "ModifyDinDan.h" #include "MyMdi.H" #include "ClientDlg.h" #include "ClientDlg2.h" #include "SetStyle.h" #include "SPLBDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif BOOL CALLBACK EnumChildProc2(HWND hwnd, LPARAM lParam) { CRect rtCtrl, rtWnd; if (hwnd) { ::GetWindowRect(hwnd, &rtCtrl); ::GetWindowRect(GetParent(hwnd), &rtWnd); // rtCtrl.OffsetRect(-rtWnd.left,-rtWnd.top-10); rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top - 20 * g_HeightScale); float temp; temp = (float)rtCtrl.left*g_WidthScale2; rtCtrl.left = (int)temp; temp = (float)rtCtrl.top*g_HeightScale2; rtCtrl.top = (int)temp; temp = (float)rtCtrl.right*g_WidthScale2; rtCtrl.right = (int)temp; temp = (float)rtCtrl.bottom*g_HeightScale2; rtCtrl.bottom = (int)temp; ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE); return TRUE; } else { return FALSE; } } ////////////////////////////////////////////////////////////IDC_EDITtaoxijiage///////////////// ModifyDinDan::ModifyDinDan(CWnd* pParent /*=NULL*/) : CDialog(ModifyDinDan::IDD) { //{{AFX_DATA_INIT(ModifyDinDan) IDC_LIST9 m_taoxijiage = _T(""); m_zs = _T(""); m_discount = _T(""); m_money1 = _T(""); m_money2 = _T(""); m_money3 = _T(""); m_name1 = _T(""); m_name2 = _T(""); m_payed1 = _T(""); m_payed2 = _T(""); m_payed3 = _T(""); m_payed4 = _T(""); m_payed5 = _T(""); m_time1 = _T(""); m_time2 = _T(""); m_time3 = _T(""); m_bz = _T(""); m_clothescount = _T(""); m_clothescount2 = _T(""); m_outside = _T(""); m_outside2 = _T(""); m_style = _T(""); m_waiter6 = g_user.name; m_id = _T(""); m_time4 = _T(""); m_time5 = _T(""); m_choosephotomoney = _T(""); m_takephotomoney = _T(""); m_cost1 = 0; //}}AFX_DATA_INIT } void ModifyDinDan::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ModifyDinDan) DDX_Control(pDX, IDC_LIST9, m_listbox1); DDX_Control(pDX, IDC_COMBOwaiter7, m_combowaiter7); DDX_Control(pDX, IDC_COMBOwaiter5, m_combowaiter5); DDX_Control(pDX, IDC_COMBOwaiter4, m_combowaiter4); DDX_Control(pDX, IDC_COMBOwaiter3, m_combowaiter3); DDX_Control(pDX, IDC_COMBOwaiter2, m_combowaiter2); DDX_Control(pDX, IDC_COMBOwaiter1, m_combowaiter1); DDX_Control(pDX, IDC_COMBOstatus5, m_combostatus5); DDX_Control(pDX, IDC_COMBOstatus6, m_combostatus6); DDX_Control(pDX, IDC_COMBOstatus4, m_combostatus4); DDX_Control(pDX, IDC_COMBOstatus3, m_combostatus3); DDX_Control(pDX, IDC_COMBOstatus2, m_combostatus2); DDX_Control(pDX, IDC_COMBOstatus1, m_combostatus1); DDX_Control(pDX, IDC_COMBOtype, m_combotype); DDX_Control(pDX, IDC_EDITtime8, m_datectrl5); DDX_Control(pDX, IDC_EDITtime7, m_datectrl4); DDX_Control(pDX, IDC_EDITtime3, m_datectrl2); DDX_Control(pDX, IDC_EDITtime2, m_datectrl1); DDX_Control(pDX, IDC_EDITpayed1, m_edit2); DDX_Control(pDX, IDC_EDITdiscount, m_edit1); DDX_Control(pDX, IDC_COMBObm, m_combobm); DDX_Control(pDX, IDC_COMBOrenyuan, m_comborenyuan); DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Control(pDX, IDC_COMBOtaoxiname, m_combotaoxiname); DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage); DDX_Text(pDX, IDC_EDITzs, m_zs); DDX_Text(pDX, IDC_EDITdiscount, m_discount); DDX_Text(pDX, IDC_EDITmoney1, m_money1); DDX_Text(pDX, IDC_EDITmoney2, m_money2); DDX_Text(pDX, IDC_EDITmoney3, m_money3); DDX_Text(pDX, IDC_EDITname1, m_name1); DDX_Text(pDX, IDC_EDITname2, m_name2); DDX_Text(pDX, IDC_EDITpayed1, m_payed1); DDX_Text(pDX, IDC_EDITpayed2, m_payed2); DDX_Text(pDX, IDC_EDITpayed3, m_payed3); DDX_Text(pDX, IDC_EDITpayed4, m_payed4); DDX_Text(pDX, IDC_EDITpayed5, m_payed5); DDX_Text(pDX, IDC_EDITtime1, m_time1); DDX_Text(pDX, IDC_EDITtime2, m_time2); DDX_Text(pDX, IDC_EDITtime3, m_time3); DDX_Text(pDX, IDC_EDITbz, m_bz); DDV_MaxChars(pDX, m_bz, 1000); DDX_Text(pDX, IDC_EDITOclothescount, m_clothescount); DDX_Text(pDX, IDC_EDITOclothescount2, m_clothescount2); DDX_Text(pDX, IDC_EDITOoutside, m_outside); DDX_Text(pDX, IDC_EDITOoutside2, m_outside2); DDX_Text(pDX, IDC_EDITwaiter6, m_waiter6); DDX_Text(pDX, IDC_EDITid3, m_id); DDX_Text(pDX, IDC_EDITtime7, m_time4); DDX_Text(pDX, IDC_EDITtime8, m_time5); DDX_Control(pDX, IDC_COMBOarea, m_comboarea); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ModifyDinDan, CDialog) //{{AFX_MSG_MAP(ModifyDinDan) ON_BN_CLICKED(IDC_BUTsave, OnBUTsave) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_CBN_SELCHANGE(IDC_COMBOtaoxiname, OnSelchangeCOMBOtaoxiname) ON_WM_TIMER() ON_EN_CHANGE(IDC_EDITtaoxijiage, OnChangeEDITtaoxijiage) ON_EN_CHANGE(IDC_EDITdiscount, OnChangeEDITdiscount) ON_EN_CHANGE(IDC_EDITpayed1, OnChangeEDITpayed1) ON_CBN_DROPDOWN(IDC_COMBObm, OnDropdownCOMBObm) ON_CBN_DROPDOWN(IDC_COMBOrenyuan, OnDropdownCOMBOrenyuan) ON_CBN_SELCHANGE(IDC_COMBObm, OnSelchangeCOMBObm) ON_BN_CLICKED(IDC_BUTclient, OnBUTclient) ON_BN_CLICKED(IDC_BUTWaiter, OnBUTWaiter) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTprint, OnBUTprint) ON_BN_CLICKED(IDC_BUTstyle, OnBUTstyle) ON_BN_CLICKED(IDC_BUTspbox2, OnBUTspbox2) ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3) ON_BN_CLICKED(IDC_BUTaddjd, OnBUTaddjd) ON_BN_CLICKED(IDC_BUTdeljd, OnBUTdeljd) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // ModifyDinDan diagnostics #ifdef _DEBUG void ModifyDinDan::AssertValid() const { CDialog::AssertValid(); } void ModifyDinDan::Dump(CDumpContext& dc) const { CDialog::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // ModifyDinDan message handlers void ModifyDinDan::OnSelchangeCOMBOtaoxiname() { // TODO: Add your control notification handler code here } void ModifyDinDan::FillGrid() { return; m_List1.DeleteAllItems(); int pos = 0; int i = 0; for ( i = 0; i < m_List2array.GetSize(); i++) { if (m_List2array.ElementAt(i).ElementAt(0) != m_taoxiid)continue; m_List1.InsertItem(pos, m_List2array.ElementAt(i).ElementAt(1)); m_List1.SetItemText(pos, 1, GetSPNameFromId(m_List2array.ElementAt(i).ElementAt(1))); m_List1.SetItemText(pos, 2, m_List2array.ElementAt(i).ElementAt(2)); pos++; } for (i = 0; i < m_List3array.GetSize(); i++) { if (m_List3array.ElementAt(i).ElementAt(0) != m_taoxiid)continue; m_List1.InsertItem(pos, m_List3array.ElementAt(i).ElementAt(1)); m_List1.SetItemText(pos, 1, GetSPNameFromId(m_List3array.ElementAt(i).ElementAt(1))); m_List1.SetItemText(pos, 2, m_List3array.ElementAt(i).ElementAt(2)); pos++; } } CString ModifyDinDan::GetSPPriceFromId(CString id) { for (int i = 0; i < m_sparray.GetSize(); i++) { if (id == m_sparray.ElementAt(i).ElementAt(0)) return m_sparray.ElementAt(i).ElementAt(4); } return "0"; } CString ModifyDinDan::GetSPPriceFromIdCost(CString id) { for (int i = 0; i < m_sparray.GetSize(); i++) { if (id == m_sparray.ElementAt(i).ElementAt(0)) return m_sparray.ElementAt(i).ElementAt(3); } return "0"; } CString ModifyDinDan::GetSPNameFromId(CString id) { int i = 0; for (i = 0; i < m_sparray.GetSize(); i++) { if (id == m_sparray.ElementAt(i).ElementAt(0)) return m_sparray.ElementAt(i).ElementAt(1); } id.TrimLeft("0"); for (i = 0; i < m_sparray.GetSize(); i++) { if (id == m_sparray.ElementAt(i).ElementAt(0)) return m_sparray.ElementAt(i).ElementAt(1); } return ""; } BOOL ModifyDinDan::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if (0)//pMsg->message==WM_LBUTTONDBLCLK) { {//list1 CPoint pt; CRect rc, rc2; ::GetCursorPos(&pt); m_List1.GetWindowRect(rc2); if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg); pt.x -= rc2.left; pt.y -= rc2.top; POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL)return 1; int iItem = m_List1.GetNextSelectedItem(pos); m_List1.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc); if (rc.PtInRect(pt)) return CDialog::PreTranslateMessage(pMsg); else return 1; /* if(iItem<0) { m_List1.GetHeaderCtrl()->GetItemRect (0, rc); int hei=rc.Height (); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { m_List1.InsertItem(m_List1.GetItemCount (), ""); m_List1Bakarray.SetSize(m_List1.GetItemCount ()); int pos=m_List1.GetItemCount ()-1; m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); } m_List1.GetHeaderCtrl()->GetItemRect (1, rc); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { m_List1.InsertItem(m_List1.GetItemCount (), ""); m_List1Bakarray.SetSize(m_List1.GetItemCount ()); int pos=m_List1.GetItemCount ()-1; m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); } } else { m_List1.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc); int hei=rc.Height (); rc.top +=hei; rc.bottom +=hei; if(rc.PtInRect (pt)) { if(m_List1.GetItemText (iItem, 0).IsEmpty ()&&m_List1.GetItemText (iItem, 1).IsEmpty ()) goto ll; m_List1.InsertItem(m_List1.GetItemCount (), ""); m_List1Bakarray.SetSize(m_List1.GetItemCount ()); int pos=m_List1.GetItemCount ()-1; m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); m_List1Bakarray.ElementAt (pos).Add (""); } POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos) { iItem=m_List1.GetNextSelectedItem(pos); if(m_List1Bakarray.ElementAt (iItem).ElementAt (8).IsEmpty ()==0) { AfxMessageBox("此物品已选片, 不能修改!", MB_ICONSTOP); return 1; } if(m_List1Bakarray.ElementAt (iItem).ElementAt (2)!="" || m_List1Bakarray.ElementAt (iItem).ElementAt (3)!="") { AfxMessageBox("此物品已制作, 不能修改!", MB_ICONSTOP); return 1; } if(m_List1Bakarray.ElementAt (iItem).ElementAt (4)!="未完成" && m_List1Bakarray.ElementAt (iItem).ElementAt (4)!="") { AfxMessageBox("此物品已制作, 不能修改!", MB_ICONSTOP); return 1; } if(m_List1Bakarray.ElementAt (iItem).ElementAt (5)!="未取" && m_List1Bakarray.ElementAt (iItem).ElementAt (5)!="") { AfxMessageBox("此物品已制作, 不能修改!", MB_ICONSTOP); return 1; } } }*/ } } if (pMsg->message == WM_LBUTTONUP) { {//list1 CPoint pt; CRect rc, rc2; ::GetCursorPos(&pt); m_List1.GetWindowRect(rc2); if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg); CalculateCost(); } } return CDialog::PreTranslateMessage(pMsg); } void ModifyDinDan::SetSPName1() { for (int i = 0; i < m_List1.GetItemCount(); i++) { if (GetSPNameFromId(m_List1.GetItemText(i, 1)) != "") m_List1.SetItemText(i, 2, GetSPNameFromId(m_List1.GetItemText(i, 1))); } } void ModifyDinDan::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default if (nIDEvent == 1) { KillTimer(nIDEvent); SetSPName1(); } } void ModifyDinDan::OnBUTsave() { if (IsHasRights2(0) == 0) return; // TODO: Add your control notification handler code here UpdateData(); int pos; CString id = m_id; BOOL bAdd = 0; if (m_name1.IsEmpty() && m_name2.IsEmpty()) { AfxMessageBox("资料不全!", MB_ICONINFORMATION); return; } CString taoxiname; pos = m_combotaoxiname.GetCurSel(); if (pos != -1) { m_combotaoxiname.GetLBText(pos, taoxiname); } else { m_combotaoxiname.GetWindowText(taoxiname); m_taoxiid.Empty(); } CString bm, txtype; pos = m_combobm.GetCurSel(); if (pos != -1) { m_combobm.GetLBText(pos, bm); } CString ren; pos = m_comborenyuan.GetCurSel(); if (pos != -1) { m_comborenyuan.GetLBText(pos, ren); } else { AfxMessageBox("资料不全!", MB_ICONINFORMATION); return; } pos = m_combotype.GetCurSel(); if (pos != -1) { m_combotype.GetLBText(pos, txtype); } else { AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION); return; } if (!CheckDateOK(m_time2))return; if (!CheckDateOK(m_time3))return; if (!CheckDateOK(m_time4))return; if (!CheckDateOK(m_time5))return; CalculateCost(); #ifdef ZHIAI_VERSION CString area; pos=m_comboarea.GetCurSel (); if(pos!=-1) { m_comboarea.GetLBText (pos, area); } m_outside=area; #endif #ifndef NOCALCOST if (atof(m_taoxijiage) < m_cost1) { if (AfxMessageBox("警告:套系价格低于成本, 可能是亏本生意, 是否继续?", MB_YESNO | MB_ICONSTOP) != IDYES)return; } #endif CString m_waiter1, m_waiter2, m_waiter3, m_waiter4, m_waiter5, m_waiter7; CString m_status1, m_status2, m_status3, m_status4, m_status5, m_status6; pos = m_combowaiter1.GetCurSel(); if (pos != -1) { m_combowaiter1.GetLBText(pos, m_waiter1); } pos = m_combowaiter2.GetCurSel(); if (pos != -1) { m_combowaiter2.GetLBText(pos, m_waiter2); } pos = m_combowaiter3.GetCurSel(); if (pos != -1) { m_combowaiter3.GetLBText(pos, m_waiter3); } pos = m_combowaiter4.GetCurSel(); if (pos != -1) { m_combowaiter4.GetLBText(pos, m_waiter4); } pos = m_combowaiter5.GetCurSel(); if (pos != -1) { m_combowaiter5.GetLBText(pos, m_waiter5); } pos = m_combowaiter7.GetCurSel(); if (pos != -1) { m_combowaiter7.GetLBText(pos, m_waiter7); } pos = m_combostatus1.GetCurSel(); if (pos != -1) { m_combostatus1.GetLBText(pos, m_status1); } pos = m_combostatus2.GetCurSel(); if (pos != -1) { m_combostatus2.GetLBText(pos, m_status2); } pos = m_combostatus3.GetCurSel(); if (pos != -1) { m_combostatus3.GetLBText(pos, m_status3); } pos = m_combostatus4.GetCurSel(); if (pos != -1) { m_combostatus4.GetLBText(pos, m_status4); } pos = m_combostatus5.GetCurSel(); if (pos != -1) { m_combostatus5.GetLBText(pos, m_status5); } pos = m_combostatus6.GetCurSel(); if (pos != -1) { m_combostatus6.GetLBText(pos, m_status6); } CString sql, str, str2; CString strRes1, strRes2; ChinesePinYin::GetFirstLetter(m_name1, strRes1); ChinesePinYin::GetFirstLetter(m_name2, strRes2); m_waiter6 = g_user.name; sql.Format("update dindan set name1='%s',name2='%s',taoxiid='%s',taoxiname='%s',taoxizs='%s',time2='%s',time3='%s',time4='%s',time5='%s',waiter1='%s',waiter2='%s',waiter3='%s',waiter4='%s',waiter5='%s',waiter6='%s',waiter7='%s',status='%s',status2='%s',status3='%s',status4='%s',status5='%s',status6='%s',bm='%s',ren='%s',bz='%s',pinyin1='%s',pinyin2='%s',clothescount='%s',clothescount2='%s',outside='%s',outside2='%s',style='%s',taoxijiage='%s',txtype='%s' where id='%s' ", m_name1, m_name2, m_taoxiid, taoxiname, m_zs, m_time2, m_time3, m_time4, m_time5, m_waiter1, m_waiter2, m_waiter3, m_waiter4, m_waiter5, m_waiter6, m_waiter7, m_status1, m_status2, m_status3, m_status4, m_status5, m_status6, bm, ren, FilterBZ(m_bz), strRes1, strRes2, m_clothescount, m_clothescount2, m_outside, m_outside2, m_style, m_taoxijiage, txtype, id); #if JEFF_TEST_ON // 2015-05-30 若取件状态OK,写日志; if ( m_status3 == _T("OK") ) { CString strLog; strLog.Format(_T(" 订单:%s 在预约修改中被设置为取件OK"),id); WriteLog("取件", strLog); } #endif sql += "***update client set name1='" + m_name1 + "',name2='" + m_name2 + "' where id='" + id + "'"; if (!m_time3.IsEmpty()) { CString sql2; sql2.Format("***update dindansp set hqdate='%s' where id='%s' and hqdate is null", m_time3, id); sql += sql2; } g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; CArraysparray; sparray.SetSize(m_List1.GetItemCount() + m_listbox1.GetCount()); int realcount = 0; int i = 0; for ( i = 0; i < m_List1.GetItemCount(); i++) { str = m_List1.GetItemText(i, 1); str.TrimLeft(); str.TrimRight(); str2 = m_List1.GetItemText(i, 2); str2.TrimLeft(); str2.TrimRight(); if (str.IsEmpty() && str2.IsEmpty())continue; sparray.ElementAt(realcount).Add(id); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 0)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 1)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 2)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 3)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 4)); sparray.ElementAt(realcount).Add(m_kindarray.ElementAt(i)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 5)); sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 6)); realcount++; } for (i = 0; i < m_listbox1.GetCount(); i++) { m_listbox1.GetText(i, str); sparray.ElementAt(realcount).Add(id); sparray.ElementAt(realcount).Add(str); realcount++; } sparray.SetSize(realcount); if (realcount == 0) { sparray.SetSize(1); sparray.ElementAt(0).Add(id); } CMemFile memfile; CArchive ar(&memfile, CArchive::store); for (int ii = 0; ii < sparray.GetSize(); ii++) { sparray.ElementAt(ii).Serialize(ar); } ar.Close(); int length = memfile.GetLength(); BYTE *pData = memfile.Detach(); int size = sparray.GetSize(); BYTE *pData2 = new BYTE[length + sizeof(int)]; memcpy(pData2, pData, length); memcpy(pData2 + length, &size, sizeof(int)); delete[]pData; length += sizeof(int); g_nSendCode = 8; g_pMainWnd->ProcessChatMessageRequest2(pData2, length); g_nSendCode = 0; delete[]pData2; if (g_bSendOK == 0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); CDialog::OnOK(); } void ModifyDinDan::OnBUTclose() { // TODO: Add your control notification handler code here CDialog::OnCancel(); } void ModifyDinDan::OnChangeEDITtaoxijiage() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. UpdateData(); CString str; float list3money = 0; m_money1.Format("%f", list3money + atof(m_taoxijiage) - atof(m_discount) + atof(m_payed4)); m_money2.Format("%f", atof(m_payed5)); m_money3.Format("%f", atof(m_money1) - atof(m_money2)); ConvertToPrice(m_money1); ConvertToPrice(m_money2); ConvertToPrice(m_money3); UpdateData(false); // TODO: Add your control notification handler code here } void ModifyDinDan::OnChangeEDITdiscount() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. OnChangeEDITtaoxijiage(); // TODO: Add your control notification handler code here } void ModifyDinDan::OnChangeEDITpayed1() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. OnChangeEDITtaoxijiage(); // TODO: Add your control notification handler code here } void ModifyDinDan::OnDropdownCOMBObm() { // TODO: Add your control notification handler code here if (m_combobm.GetCount() < 2) { g_sendhead.bsql = 0; g_sendhead.code[0] = 3; g_sendhead.tabcount = 1; g_pMainWnd->ProcessChatMessageRequest2(3); if (g_bSendOK == 0)return; DataToArray(&g_List1array); for (int ii = 0; ii < g_List1array.GetSize(); ii++) m_combobm.AddString(g_List1array.ElementAt(ii).ElementAt(0)); } } void ModifyDinDan::OnDropdownCOMBOrenyuan() { // TODO: Add your control notification handler code here if (m_renyuanarray.GetSize() == 0) { for (int ii = 0; ii < g_userarray.GetSize(); ii++) { m_renyuanarray.Add(g_userarray.ElementAt(ii).ElementAt(2)); m_renyuanarray.Add(g_userarray.ElementAt(ii).ElementAt(1)); } } m_comborenyuan.ResetContent(); int pos = m_combobm.GetCurSel(); if (pos == -1) { for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2) { m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1)); } } else { CString str; m_combobm.GetLBText(pos, str); for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2) { if (str == m_renyuanarray.ElementAt(ii)) m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1)); } } } void ModifyDinDan::OnSelchangeCOMBObm() { // TODO: Add your control notification handler code here m_comborenyuan.ResetContent(); m_comborenyuan.SetCurSel(-1); } void ModifyDinDan::ClearCtrl() { m_money1 = _T(""); m_money2 = _T(""); m_money3 = _T(""); m_choosephotomoney = _T(""); m_name1 = _T(""); m_name2 = _T(""); m_taoxiid = _T(""); m_taoxijiage = _T(""); m_zs = _T(""); m_time1 = CTime::GetCurrentTime().Format("%Y-%m-%d"); m_time2 = _T(""); m_time3 = _T(""); m_bz = _T(""); m_discount = _T(""); m_payed1 = _T(""); m_payed2 = _T(""); m_payed3 = _T(""); m_payed4 = _T(""); m_payed5 = _T(""); m_clothescount = _T(""); m_clothescount2 = _T(""); m_outside = _T(""); m_outside2 = _T(""); m_style = _T(""); m_waiter1 = _T(""); m_waiter2 = _T(""); m_waiter3 = _T(""); m_waiter4 = _T(""); m_waiter6 = g_user.name; m_combotaoxiname.SetCurSel(-1); m_combobm.SetCurSel(-1); m_comborenyuan.SetCurSel(-1); UpdateData(false); m_List1.DeleteAllItems(); } void ModifyDinDan::OnBUTclient() { // TODO: Add your control notification handler code here UpdateData(); #ifdef CHILD_VERSION CClientDlg2 dlg; #else CClientDlg dlg; #endif dlg.m_bAdd = 0; dlg.id = m_id; dlg.m_name1 = m_name1; dlg.m_name2 = m_name2; if (dlg.DoModal() != IDOK)return; m_name1 = dlg.m_name1; m_name2 = dlg.m_name2; UpdateData(false); } void ModifyDinDan::OnBUTWaiter() { } void ModifyDinDan::OnButton1() { } void ModifyDinDan::OnBUTprint() { // TODO: Add your control notification handler code here g_pMainWnd->PrintDinDan(m_id); } void ModifyDinDan::OnBUTstyle() { // TODO: Add your control notification handler code here SetStyle dlg; dlg.m_style = m_style; if (dlg.DoModal() == IDOK) m_style = dlg.m_style; } void ModifyDinDan::OnBUTspbox2() { // TODO: Add your control notification handler code here SPBox dlg; if (dlg.DoModal() != IDOK)return; for (int a = 0; a < dlg.m_spidarray.GetSize(); a++) { dlg.m_spid = dlg.m_spidarray.ElementAt(a); dlg.m_spname = dlg.m_spnamearray.ElementAt(a); dlg.m_lb = dlg.m_lbarray.ElementAt(a); int pos = m_List1.GetItemCount(); CString str; if (dlg.m_lb == "婚庆服务") m_kindarray.Add("2"); else m_kindarray.Add("1"); m_List1.InsertItem(pos, ""); m_List1.SetItemText(pos, 1, dlg.m_spid); m_List1.SetItemText(pos, 2, dlg.m_spname); m_List1.SetItemText(pos, 3, GetSPPriceFromId(dlg.m_spid)); m_List1.SetItemText(pos, 4, "1"); m_List1Bakarray.SetSize(m_List1.GetItemCount()); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); m_List1Bakarray.ElementAt(pos).Add(""); } CalculateCost(); } void ModifyDinDan::OnBUTdel3() { // TODO: Add your control notification handler code here POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION); return; } int iItem = m_List1.GetNextSelectedItem(pos); if (m_List1Bakarray.ElementAt(iItem).ElementAt(8).IsEmpty() == 0) { AfxMessageBox("此物品已选片, 不能删除!", MB_ICONSTOP); return; } if (m_List1Bakarray.ElementAt(iItem).ElementAt(2) != "" || m_List1Bakarray.ElementAt(iItem).ElementAt(3) != "") { AfxMessageBox("此物品已制作, 不能删除!", MB_ICONSTOP); return; } if (m_List1Bakarray.ElementAt(iItem).ElementAt(4) != "未完成" && m_List1Bakarray.ElementAt(iItem).ElementAt(4) != "") { AfxMessageBox("此物品已制作, 不能删除!", MB_ICONSTOP); return; } if (m_List1Bakarray.ElementAt(iItem).ElementAt(5) != "未取" && m_List1Bakarray.ElementAt(iItem).ElementAt(5) != "") { AfxMessageBox("此物品已制作, 不能删除!", MB_ICONSTOP); return; } m_List1.DeleteItem(iItem); m_List1Bakarray.RemoveAt(iItem); m_kindarray.RemoveAt(iItem); CalculateCost(); int count = m_List1.GetItemCount(); if (count == 0)return; if (iItem == count) iItem = 0; m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED); } BOOL ModifyDinDan::OnInitDialog() { CDialog::OnInitDialog(); #ifdef NOCALCOST GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE); #endif #ifndef CHILD_VERSION #ifndef ZHIAI_VERSION GetDlgItem(IDC_STATIC10)->SetWindowText("服装套数:"); GetDlgItem(IDC_STATIC11)->SetWindowText("造型:"); GetDlgItem(IDC_STATIC12)->SetWindowText("外景:"); GetDlgItem(IDC_STATIC13)->SetWindowText("内景:"); #endif #endif // 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_BUTsave)->EnableWindow(IsHasRights2new(1)); GetDlgItem(IDC_BUTclient)->EnableWindow(IsHasRights2new(1)); m_combotaoxiname.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combotaoxiname.MoveWindow(rc2); m_combobm.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combobm.MoveWindow(rc2); m_comborenyuan.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_comborenyuan.MoveWindow(rc2); m_combowaiter1.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter1.MoveWindow(rc2); m_combowaiter2.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter2.MoveWindow(rc2); m_combowaiter3.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter3.MoveWindow(rc2); m_combowaiter4.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter4.MoveWindow(rc2); m_combowaiter5.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter5.MoveWindow(rc2); m_combowaiter7.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 400; m_combowaiter7.MoveWindow(rc2); m_combostatus1.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus1.MoveWindow(rc2); m_combotype.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combotype.MoveWindow(rc2); m_combostatus2.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus2.MoveWindow(rc2); m_combostatus3.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus3.MoveWindow(rc2); m_combostatus4.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus4.MoveWindow(rc2); m_combostatus5.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus5.MoveWindow(rc2); m_combostatus6.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combostatus6.MoveWindow(rc2); GetDlgItem(IDC_EDITname1)->GetWindowRect(rc2); SetComboHei(&m_combotaoxiname, rc2.Height()); SetComboHei(&m_combobm, rc2.Height()); SetComboHei(&m_comborenyuan, rc2.Height()); SetComboHei(&m_combowaiter1, rc2.Height()); SetComboHei(&m_combowaiter2, rc2.Height()); SetComboHei(&m_combowaiter3, rc2.Height()); SetComboHei(&m_combowaiter4, rc2.Height()); SetComboHei(&m_combowaiter5, rc2.Height()); SetComboHei(&m_combowaiter7, rc2.Height()); SetComboHei(&m_combostatus1, rc2.Height()); SetComboHei(&m_combotype, rc2.Height()); SetComboHei(&m_combostatus2, rc2.Height()); SetComboHei(&m_combostatus3, rc2.Height()); SetComboHei(&m_combostatus4, rc2.Height()); SetComboHei(&m_combostatus5, rc2.Height()); SetComboHei(&m_combostatus6, rc2.Height()); #ifdef ZHIAI_VERSION SetComboHei(&m_comboarea, rc2.Height ()); GetDlgItem(IDC_EDITOoutside)->GetWindowRect(rc2); GetDlgItem(IDC_EDITOoutside)->ShowWindow(0); ScreenToClient(rc2); m_comboarea.MoveWindow (rc2); m_comboarea.GetWindowRect (rc2); ScreenToClient(rc2); rc2.bottom +=600; m_comboarea.MoveWindow (rc2); #else m_comboarea.ShowWindow(0); #endif m_combotype.AddString("婚纱照"); m_combotype.AddString("写真照"); m_combotype.AddString("宝宝照"); m_combotype.AddString("全家福"); m_combotype.AddString("情侣照"); m_combostatus1.AddString("未拍"); m_combostatus1.AddString("拍照中"); m_combostatus1.AddString("OK"); m_combostatus2.AddString("未选"); m_combostatus2.AddString("OK"); m_combostatus3.AddString("未取"); m_combostatus3.AddString("OK"); m_combostatus4.AddString("未修"); m_combostatus4.AddString("修片中"); m_combostatus4.AddString("OK"); m_combostatus5.AddString("未设计"); m_combostatus5.AddString("设计中"); m_combostatus5.AddString("OK"); m_combostatus6.AddString("未修"); m_combostatus6.AddString("修片中"); m_combostatus6.AddString("OK"); m_List1.InitStyle(); m_List1.m_mode = 1; m_List1.InsertColumn(0, _T("autuid"), LVCFMT_LEFT, 0); m_List1.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 55); m_List1.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 190); m_List1.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 55); m_List1.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 55); m_List1.InsertColumn(5, _T("加急"), LVCFMT_LEFT, 45); m_List1.InsertColumn(6, _T("取件日期"), LVCFMT_LEFT, 90); CString id = m_id; int i; #ifdef ZHIAI_VERSION g_sendhead.bsql=0; CString filter="id='"+id+"';id='"+id+"' and kind<>'4' and kind<>'5';id='"+id+"';;;;"; g_sendhead.code[0]=11; g_sendhead.code[1] = 56; g_sendhead.code[2]=150; g_sendhead.code[3]=4; g_sendhead.code[4]=6; g_sendhead.code[5]=82; g_sendhead.tabcount=6; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return 1; CArraytxarray; CArrayareaarray; DataToArray(&g_List1array, &m_List1Bakarray,&m_List1array, &m_sparray, &txarray, &areaarray); for( i=0; i'4' and kind<>'5';id='" + id + "';;;;"; g_sendhead.code[0] = 11; g_sendhead.code[1] = 56; g_sendhead.code[2] = 150; g_sendhead.code[3] = 4; g_sendhead.code[4] = 6; g_sendhead.tabcount = 5; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return 1; CArraytxarray; DataToArray(&g_List1array, &m_List1Bakarray, &m_List1array, &m_sparray, &txarray); #endif for (i = 0; i < txarray.GetSize(); i++) m_combotaoxiname.AddString(txarray.ElementAt(i).ElementAt(1)); m_combowaiter1.AddString(""); m_combowaiter2.AddString(""); m_combowaiter3.AddString(""); m_combowaiter4.AddString(""); m_combowaiter5.AddString(""); m_combowaiter7.AddString(""); for (i = 0; i < g_userarray.GetSize(); i++) { m_combowaiter1.AddString(g_userarray.ElementAt(i).ElementAt(1)); m_combowaiter2.AddString(g_userarray.ElementAt(i).ElementAt(1)); m_combowaiter3.AddString(g_userarray.ElementAt(i).ElementAt(1)); m_combowaiter4.AddString(g_userarray.ElementAt(i).ElementAt(1)); m_combowaiter5.AddString(g_userarray.ElementAt(i).ElementAt(1)); m_combowaiter7.AddString(g_userarray.ElementAt(i).ElementAt(1)); } for (i = 0; i < m_List1array.GetSize(); i++) { m_listbox1.AddString(m_List1array.ElementAt(i).ElementAt(1)); } ////////////////////////////////// CString taoxiname, bm, ren, txtype; CString m_waiter1, m_waiter2, m_waiter3, m_waiter4, m_waiter5, m_waiter7; CString m_status1, m_status2, m_status3, m_status4, m_status5, m_status6; m_takephotomoney = g_List1array.ElementAt(0).ElementAt(2); m_choosephotomoney = g_List1array.ElementAt(0).ElementAt(3); m_name1 = g_List1array.ElementAt(0).ElementAt(4); m_name2 = g_List1array.ElementAt(0).ElementAt(5); m_taoxiid = g_List1array.ElementAt(0).ElementAt(6); taoxiname = g_List1array.ElementAt(0).ElementAt(7); m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8); m_zs = g_List1array.ElementAt(0).ElementAt(9); m_time1 = g_List1array.ElementAt(0).ElementAt(10); m_time2 = g_List1array.ElementAt(0).ElementAt(11); m_time3 = g_List1array.ElementAt(0).ElementAt(12); bm = g_List1array.ElementAt(0).ElementAt(13); ren = g_List1array.ElementAt(0).ElementAt(14); m_discount = g_List1array.ElementAt(0).ElementAt(15); m_payed1 = g_List1array.ElementAt(0).ElementAt(16); m_payed2 = g_List1array.ElementAt(0).ElementAt(17); m_payed3 = g_List1array.ElementAt(0).ElementAt(18); m_payed4 = g_List1array.ElementAt(0).ElementAt(19); m_payed5 = g_List1array.ElementAt(0).ElementAt(20); m_time4 = g_List1array.ElementAt(0).ElementAt(21); m_time5 = g_List1array.ElementAt(0).ElementAt(22); m_status1 = g_List1array.ElementAt(0).ElementAt(25); m_clothescount = g_List1array.ElementAt(0).ElementAt(26); m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27); m_outside = g_List1array.ElementAt(0).ElementAt(28); m_outside2 = g_List1array.ElementAt(0).ElementAt(29); m_style = g_List1array.ElementAt(0).ElementAt(30); m_status2 = g_List1array.ElementAt(0).ElementAt(32); m_status3 = g_List1array.ElementAt(0).ElementAt(33); m_waiter1 = g_List1array.ElementAt(0).ElementAt(34); m_waiter2 = g_List1array.ElementAt(0).ElementAt(35); m_waiter3 = g_List1array.ElementAt(0).ElementAt(36); m_waiter4 = g_List1array.ElementAt(0).ElementAt(37); m_bz = g_List1array.ElementAt(0).ElementAt(38); m_waiter6 = g_List1array.ElementAt(0).ElementAt(41); m_waiter5 = g_List1array.ElementAt(0).ElementAt(42); m_waiter7 = g_List1array.ElementAt(0).ElementAt(43); m_status4 = g_List1array.ElementAt(0).ElementAt(44); m_status5 = g_List1array.ElementAt(0).ElementAt(45); m_status6 = g_List1array.ElementAt(0).ElementAt(46); txtype = g_List1array.ElementAt(0).ElementAt(52); int pos = m_combotaoxiname.FindString(0, taoxiname); if (pos == -1) { m_combotaoxiname.InsertString(0, taoxiname); m_combotaoxiname.SetCurSel(0); } else m_combotaoxiname.SetCurSel(pos); pos = m_combobm.FindString(0, bm); if (pos == -1) { m_combobm.ResetContent(); m_combobm.InsertString(0, bm); m_combobm.SetCurSel(0); } else m_combobm.SetCurSel(pos); pos = m_comborenyuan.FindString(0, ren); if (pos == -1) { m_comborenyuan.InsertString(0, ren); m_comborenyuan.SetCurSel(0); } else m_comborenyuan.SetCurSel(pos); pos = m_combotype.FindString(0, txtype); if (pos == -1) { m_combotype.InsertString(0, txtype); m_combotype.SetCurSel(0); } else m_combotype.SetCurSel(pos); pos = m_combowaiter1.FindString(0, m_waiter1); if (pos == -1) { m_combowaiter1.InsertString(0, m_waiter1); m_combowaiter1.SetCurSel(0); } else m_combowaiter1.SetCurSel(pos); pos = m_combowaiter2.FindString(0, m_waiter2); if (pos == -1) { m_combowaiter2.InsertString(0, m_waiter2); m_combowaiter2.SetCurSel(0); } else m_combowaiter2.SetCurSel(pos); pos = m_combowaiter3.FindString(0, m_waiter3); if (pos == -1) { m_combowaiter3.InsertString(0, m_waiter3); m_combowaiter3.SetCurSel(0); } else m_combowaiter3.SetCurSel(pos); pos = m_combowaiter4.FindString(0, m_waiter4); if (pos == -1) { m_combowaiter4.InsertString(0, m_waiter4); m_combowaiter4.SetCurSel(0); } else m_combowaiter4.SetCurSel(pos); pos = m_combowaiter5.FindString(0, m_waiter5); if (pos == -1) { m_combowaiter5.InsertString(0, m_waiter5); m_combowaiter5.SetCurSel(0); } else m_combowaiter5.SetCurSel(pos); pos = m_combowaiter7.FindString(0, m_waiter7); if (pos == -1) { m_combowaiter7.InsertString(0, m_waiter7); m_combowaiter7.SetCurSel(0); } else m_combowaiter7.SetCurSel(pos); pos = m_combostatus1.FindString(0, m_status1); if (pos == -1) { m_combostatus1.InsertString(0, m_status1); m_combostatus1.SetCurSel(0); } else m_combostatus1.SetCurSel(pos); pos = m_combostatus2.FindString(0, m_status2); if (pos == -1) { m_combostatus2.InsertString(0, m_status2); m_combostatus2.SetCurSel(0); } else m_combostatus2.SetCurSel(pos); pos = m_combostatus3.FindString(0, m_status3); if (pos == -1) { m_combostatus3.InsertString(0, m_status3); m_combostatus3.SetCurSel(0); } else m_combostatus3.SetCurSel(pos); pos = m_combostatus4.FindString(0, m_status4); if (pos == -1) { m_combostatus4.InsertString(0, m_status4); m_combostatus4.SetCurSel(0); } else m_combostatus4.SetCurSel(pos); pos = m_combostatus5.FindString(0, m_status5); if (pos == -1) { m_combostatus5.InsertString(0, m_status5); m_combostatus5.SetCurSel(0); } else m_combostatus5.SetCurSel(pos); pos = m_combostatus6.FindString(0, m_status6); if (pos == -1) { m_combostatus6.InsertString(0, m_status6); m_combostatus6.SetCurSel(0); } else m_combostatus6.SetCurSel(pos); #ifdef ZHIAI_VERSION pos=m_comboarea.FindString (0, m_outside); if(pos==-1) { m_comboarea.InsertString (0, m_outside); m_comboarea.SetCurSel (0); } else m_comboarea.SetCurSel (pos); #endif UpdateData(false); m_List1.DeleteAllItems(); for (i = 0; i < m_List1Bakarray.GetSize(); i++) { m_List1.InsertItem(i, m_List1Bakarray.ElementAt(i).ElementAt(6)); m_List1.SetItemText(i, 1, m_List1Bakarray.ElementAt(i).ElementAt(7)); m_List1.SetItemText(i, 2, m_List1Bakarray.ElementAt(i).ElementAt(0)); m_List1.SetItemText(i, 3, m_List1Bakarray.ElementAt(i).ElementAt(17)); m_List1.SetItemText(i, 4, m_List1Bakarray.ElementAt(i).ElementAt(1)); m_List1.SetItemText(i, 5, m_List1Bakarray.ElementAt(i).ElementAt(18)); m_List1.SetItemText(i, 6, m_List1Bakarray.ElementAt(i).ElementAt(19)); m_kindarray.Add("1"); } OnChangeEDITtaoxijiage(); CalculateCost(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } //IDC_EDITmoney3 void ModifyDinDan::CalculateCost() { m_cost1 = 0; CString str; float cost2 = 0; int i = 0; for ( i = 0; i < m_List1.GetItemCount(); i++) { cost2 += atof(m_List1.GetItemText(i, 3))*atof(m_List1.GetItemText(i, 4)); } for (i = 0; i < m_List1.GetItemCount(); i++) { m_cost1 += atof(GetSPPriceFromIdCost(m_List1.GetItemText(i, 1)))*atof(m_List1.GetItemText(i, 4)); } // str.Format ("套系包含商品,成本:%0.1f,售价:%0.1f", m_cost1, cost2); str.Format("套系包含商品,总价:%0.1f", cost2); ::ConvertToPrice(str); SetDlgItemText(IDC_STATIC1, str); } void ModifyDinDan::OnBUTaddjd() { // TODO: Add your control notification handler code here SPLBDlg dlg; dlg.m_mode = 2; if (dlg.DoModal() == IDOK) { for (int i = 0; i < dlg.m_array.GetSize(); i++) m_listbox1.AddString(dlg.m_array.ElementAt(i)); } } void ModifyDinDan::OnBUTdeljd() { // TODO: Add your control notification handler code here int pos = m_listbox1.GetCurSel(); if (pos == -1) { AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION); return; } m_listbox1.DeleteString(pos); int count = m_listbox1.GetCount(); if (pos < count) m_listbox1.SetCurSel(pos); else if (count && pos == count) m_listbox1.SetCurSel(0); }