123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- // TakeMoney3.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "TakeMoney3.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // TakeMoney3 dialog
- TakeMoney3::TakeMoney3(CWnd* pParent /*=NULL*/)
- : CDialog(TakeMoney3::IDD, pParent)
- {
- //{{AFX_DATA_INIT(TakeMoney3)
- m_money = _T("");
- m_time1 = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- m_bz = _T("");
- m_id = _T("");
- m_name1 = _T("");
- m_name2 = _T("");
- m_ren2 = _T("");
- m_money2 = _T("");
- m_ren3 = _T("");
- m_time2 = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- m_bz2 =_T("");
- m_mode=0;
- m_bInit=0;
- m_sum1 = _T("");
- m_sum2 = _T("");
- m_sum3 = _T("");
- //}}AFX_DATA_INIT
- }
- void TakeMoney3::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(TakeMoney3)
- DDX_Control(pDX, IDC_LIST3, m_List2);
- DDX_Control(pDX, IDC_EDIT4, m_editctrl3);
- 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);
- DDX_Text(pDX, IDC_EDIT4, m_money2);
- DDX_Text(pDX, IDC_EDITren3, m_ren3);
- DDX_Text(pDX, IDC_EDIT5, m_time2);
- DDX_Text(pDX, IDC_EDIT6, m_bz2);
- DDX_Text(pDX, IDC_EDITmoney2, m_sum1);
- DDX_Text(pDX, IDC_EDITmoney3, m_sum2);
- DDX_Text(pDX, IDC_EDITmoney5, m_sum3);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(TakeMoney3, CDialog)
- //{{AFX_MSG_MAP(TakeMoney3)
- ON_WM_LBUTTONDOWN()
- ON_BN_CLICKED(IDOK2, OnOk2)
- ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // TakeMoney3 message handlers
- BOOL TakeMoney3::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- g_sendhead.bsql=0;
- g_sendhead.code[0]=27;
- g_sendhead.code[1]=38;
- g_sendhead.code[2]=11;
- g_sendhead.tabcount=3;
- CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if(g_bSendOK==0)return 0;
- CArray<CStringArray, CStringArray>dindanarray;
- DataToArray( &m_List1array,&m_List2array,&dindanarray);
- 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)
- m_bz="拍照补款";
- else if(m_mode==1)
- m_bz="选片补款";
-
- SetWindowText(m_bz+"/加挑物品");
- m_ren2=g_user.name;
- m_ren3=g_user.name;
- CString m_taoxijiage = dindanarray.ElementAt (0).ElementAt (8);
- CString m_payed4 = dindanarray.ElementAt (0).ElementAt (19);
- CString m_payed5 = dindanarray.ElementAt (0).ElementAt (20);
- m_sum1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
- m_sum2.Format ("%f", atof(m_payed5));
- m_sum3.Format ("%f", atof(m_sum1)-atof(m_sum2));
- ConvertToPrice(m_sum1);
- ConvertToPrice(m_sum2);
- ConvertToPrice(m_sum3);
- UpdateData(false);
- m_List1.SetHeadings("金额,60;日期,70;开单人,70;收款人,70;备注,80" );
- m_List1.LoadColumnInfo (115);
- m_List2.SetHeadings("加挑金额,80;日期,100;录单,70;加挑物品,100" );
- m_List2.LoadColumnInfo (123);
- FillGrid();
- m_bInit=1;
- if(m_mode==5)
- {
- SetWindowText("客户付款详情");
- GetDlgItem(IDC_EDIT1)->EnableWindow(0);
- GetDlgItem(IDC_COMBO1)->EnableWindow(0);
- GetDlgItem(IDOK)->EnableWindow(0);
- GetDlgItem(IDC_EDIT4)->EnableWindow(0);
- GetDlgItem(IDC_EDIT6)->EnableWindow(0);
- GetDlgItem(IDOK2)->EnableWindow(0);
- GetDlgItem(IDC_BUTTON1)->EnableWindow(0);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void TakeMoney3::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- if(m_money.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- int pos;
- pos=m_comboren.GetCurSel();
- if(pos==-1)
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- m_comboren.GetLBText (pos, m_ren);
- BOOL bexist1=0;
- BOOL bexist2=0;
- if(bexist1==0)
- {
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- if(m_List1array.ElementAt (i).ElementAt (0)==m_money)
- {
- bexist1=1;
- break;
- }
- }
- }
- if(bexist2==0)
- {
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- if(m_List1array.ElementAt (i).ElementAt (4)==m_bz)
- {
- bexist2=1;
- break;
- }
- }
- }
- if(bexist1 && bexist2)
- {
- if(AfxMessageBox("已有相似的记录, 确认没有重复吗? 是否继续?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
- return;
- }
- CString sql,sql2;
- sql.Format ("insert into dindanbukuan([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_REF;
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- GetData();
- // CDialog::OnOK();
- }
- HBRUSH TakeMoney3::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 TakeMoney3::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CDialog::OnLButtonDown(nFlags, point);
- }
- void TakeMoney3::GetData()
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=27;
- g_sendhead.code[1]=38;
- g_sendhead.code[2]=11;
- g_sendhead.tabcount=3;
- CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if(g_bSendOK==0)return;
- CArray<CStringArray, CStringArray>dindanarray;
- DataToArray( &m_List1array, &m_List2array, &dindanarray);
- FillGrid();
- CString m_taoxijiage = dindanarray.ElementAt (0).ElementAt (8);
- CString m_payed4 = dindanarray.ElementAt (0).ElementAt (19);
- CString m_payed5 = dindanarray.ElementAt (0).ElementAt (20);
- m_sum1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
- m_sum2.Format ("%f", atof(m_payed5));
- m_sum3.Format ("%f", atof(m_sum1)-atof(m_sum2));
- ConvertToPrice(m_sum1);
- ConvertToPrice(m_sum2);
- ConvertToPrice(m_sum3);
- UpdateData(false);
- }
- void TakeMoney3::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);
- {
- m_List2.DeleteAllItems2 ();
- int ii=0;
- m_List2.m_arLabels.SetSize( m_List2array.GetSize (), 1 );
- int count=0;
- for(ii=0; ii<m_List2.m_arLabels.GetSize (); ii++)
- {
- m_List2.m_arLabels.ElementAt (count++).Copy (m_List2array.ElementAt (ii));
- }
- m_List2.m_arLabels.SetSize(count, 1);
- ii=count;
- m_List2.m_LabelCount=ii;
- m_List2.SetItemCountEx (ii);
- }
- }
- BOOL TakeMoney3::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 TakeMoney3::OnOk2()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- m_bz2.TrimLeft ();
- m_money2.TrimLeft ();
- if(m_money2.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- if(m_bz2.IsEmpty ())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
-
- BOOL bexist1=0;
- if(bexist1==0)
- {
- for(int i=0; i<m_List2array.GetSize (); i++)
- {
- if(m_List2array.ElementAt (i).ElementAt (0)==m_money2)
- {
- bexist1=1;
- break;
- }
- }
- }
- if(bexist1)
- {
- if(AfxMessageBox("已有相似的记录, 确认没有重复吗? 是否继续?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)
- return;
- }
- CString sql,sql2;
- sql.Format ("insert into dindanbukuan2([id],[money],[date],[bz],[ren2],[kind])\
- values('%s','%s','%s','%s','%s','%d')", m_id,m_money2 ,m_time1 ,m_bz2,m_ren3,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();
- }
- void TakeMoney3::OnChangeEdit1()
- {
- // 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.
- if(m_bInit==0)return;
- UpdateData();
- SetDlgItemText(IDC_EDIT4, m_money);
- // TODO: Add your control notification handler code here
- }
- void TakeMoney3::OnButton1()
- {
- // TODO: Add your control notification handler code here
- SPBox dlg;
- if(dlg.DoModal ()!=IDOK)return;
- SetDlgItemText(IDC_EDIT6, dlg.m_spname );
- }
- void TakeMoney3::RefreshMoney()
- {
- }
|