123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- // TakeMoney.cpp : implementation file
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "TakeMoney.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // TakeMoney dialog
- TakeMoney::TakeMoney(CWnd* pParent /*=NULL*/)
- : CDialog(TakeMoney::IDD, pParent)
- {
- //{{AFX_DATA_INIT(TakeMoney)
- m_money = _T("");
- m_time1 = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- m_bz = _T("");
- m_id = _T("");
- m_name1 = _T("");
- m_name2 = _T("");
- m_mode=0;
- m_ren2 = _T("");
- //}}AFX_DATA_INIT
- }
- void TakeMoney::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(TakeMoney)
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Control(pDX, IDC_EDIT2, m_editdate1);
- DDX_Control(pDX, IDC_EDIT1, m_editctrl1);
- DDX_Control(pDX, IDC_COMBO1, m_comboren);
- DDX_Text(pDX, IDC_EDIT1, m_money);
- DDX_Text(pDX, IDC_EDIT2, m_time1);
- DDX_Text(pDX, IDC_EDIT3, m_bz);
- DDX_Text(pDX, IDC_EDITid, m_id);
- DDX_Text(pDX, IDC_EDITname1, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITren2, m_ren2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(TakeMoney, CDialog)
- //{{AFX_MSG_MAP(TakeMoney)
- ON_WM_LBUTTONDOWN()
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // TakeMoney message handlers
- BOOL TakeMoney::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- g_sendhead.bsql=0;
- g_sendhead.code[0]=38;
- g_sendhead.tabcount=1;
- CString filter="id='"+m_id+"'";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- DataToArray( &m_List1array);
- if(m_mode==2 || m_mode==3)
- {
- m_comboren.AddString (m_ren);
- m_comboren.SetCurSel (0);
- m_comboren.EnableWindow (0);
- GetDlgItem(IDC_EDIT3)->EnableWindow (0);
- }
- else
- {
- for(int i=0; i<g_userarray.GetSize (); i++)
- m_comboren.AddString (g_userarray.ElementAt (i).ElementAt (1));
- }
- CenterWindow(g_pMainWnd);
- if(m_mode==0)
- SetWindowText("拍照加挑物品");
- else if(m_mode==1)
- SetWindowText("选片加挑物品");
- m_ren2=g_user.name;
- UpdateData(false);
- m_List1.SetHeadings("加挑金额,80;日期,100;录单,70;加挑物品,100" );
- m_List1.LoadColumnInfo (123);
- FillGrid();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void TakeMoney::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- m_bz.TrimLeft ();
- m_money.TrimLeft ();
- if(m_money.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- if(m_bz.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
-
- CString sql,sql2;
- sql.Format ("insert into dindanbukuan2([id],[money],[ren],[date],[bz],[ren2],[kind])\
- values('%s','%s','%s','%s','%s','%s','%d')", m_id,m_money ,m_ren,m_time1 ,m_bz,m_ren2,m_mode+1);
- sql2="$$$"+m_id;
- sql+=sql2;
- sql+=BUKUAN_REF2;
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- GetData();
- // CDialog::OnOK();
- }
- HBRUSH TakeMoney::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
- {
- HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
- // TODO: Change any attributes of the DC here
- if (nCtlColor==CTLCOLOR_STATIC)
- {
- pDC-> SetBkMode(TRANSPARENT); //设置字体背景为透明
- return (HBRUSH)::GetStockObject(NULL_BRUSH); // 设置背景色
- }
- // TODO: Return a different brush if the default is not desired
- return hbr;
- }
- void TakeMoney::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
-
- CDialog::OnLButtonDown(nFlags, point);
- }
- void TakeMoney::GetData()
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=38;
- g_sendhead.tabcount=1;
- CString filter="id='"+m_id+"';";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- DataToArray( &m_List1array);
- FillGrid();
- }
- void TakeMoney::FillGrid()
- {
- m_List1.DeleteAllItems2 ();
- int ii=0;
- m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
- int count=0;
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii=count;
- m_List1.m_LabelCount=ii;
- m_List1.SetItemCountEx (ii);
- }
- BOOL TakeMoney::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- return 1;
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void TakeMoney::OnButton1()
- {
- // TODO: Add your control notification handler code here
- SPBox dlg;
- if(dlg.DoModal ()!=IDOK)return;
- SetDlgItemText(IDC_EDIT3, dlg.m_spname );
- }
|