123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- // ShowHisSalary.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "ShowHisSalary.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // ShowHisSalary dialog
- ShowHisSalary::ShowHisSalary(CWnd* pParent /*=NULL*/)
- : CDialog(ShowHisSalary::IDD, pParent)
- {
- //{{AFX_DATA_INIT(ShowHisSalary)
- m_filter = _T("");
- m_year = atoi(g_date.Mid(0, 4));
- m_month = atoi(g_date.Mid(5, 2));
- m_bInit = 0;
- //}}AFX_DATA_INIT
- }
- void ShowHisSalary::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(ShowHisSalary)
- DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
- DDX_Control(pDX, IDC_SPIN1, m_spinyear);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDIT1, m_filter);
- DDX_Text(pDX, IDC_EDITyear, m_year);
- DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
- DDX_Text(pDX, IDC_EDITmonth, m_month);
- DDV_MinMaxUInt(pDX, m_month, 1, 12);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(ShowHisSalary, CDialog)
- //{{AFX_MSG_MAP(ShowHisSalary)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
- ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
- ON_BN_CLICKED(IDC_BUTclear1, OnBUTclear1)
- ON_BN_CLICKED(IDC_BUTclear2, OnBUTclear2)
- ON_BN_CLICKED(IDC_BUTclear3, OnBUTclear3)
- ON_BN_CLICKED(IDC_BUTclear4, OnBUTclear4)
- ON_BN_CLICKED(IDC_BUTclear5, OnBUTclear5)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // ShowHisSalary message handlers
- BOOL ShowHisSalary::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- if (IsHasRights2new(25) == 0)
- {
- GetDlgItem(IDC_BUTclear1)->EnableWindow(0);
- GetDlgItem(IDC_BUTclear2)->EnableWindow(0);
- GetDlgItem(IDC_BUTclear3)->EnableWindow(0);
- GetDlgItem(IDC_BUTclear4)->EnableWindow(0);
- GetDlgItem(IDC_BUTclear5)->EnableWindow(0);
- }
- #ifdef CHILD_VERSION
- m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,120;摄影提成,120;化妆提成,120;初修提成,120;精修提成,120;设计提成,100");
- #else
- m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,120;摄影提成,120;化妆提成,120;初修提成,120;精修提成,120;设计提成,100" );
- #endif
- m_List1.LoadColumnInfo(140);
- m_spinyear.SetRange(1900, 3000);
- m_spinmonth.SetRange(1, 12);
- m_bInit = 1;
- GetData();
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
- GetClientRect(rc2);
- rc2.top += 40 * g_fscaley;
- m_List1.MoveWindow(rc2);
- int right = rc2.right - 5;
- GetDlgItem(IDC_BUTclear5)->GetWindowRect(rc2);
- int wid = rc2.Width();
- ScreenToClient(rc2);
- rc2.left = right - wid * 1;
- rc2.right = rc2.left + wid;
- GetDlgItem(IDC_BUTclear5)->MoveWindow(rc2);
- rc2.left = right - wid * 2;
- rc2.right = rc2.left + wid;
- GetDlgItem(IDC_BUTclear4)->MoveWindow(rc2);
- rc2.left = right - wid * 3;
- rc2.right = rc2.left + wid;
- GetDlgItem(IDC_BUTclear3)->MoveWindow(rc2);
- rc2.left = right - wid * 4;
- rc2.right = rc2.left + wid;
- GetDlgItem(IDC_BUTclear2)->MoveWindow(rc2);
- rc2.left = right - wid * 5;
- rc2.right = rc2.left + wid;
- GetDlgItem(IDC_BUTclear1)->MoveWindow(rc2);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void ShowHisSalary::FillGrid()
- {
- if (m_bInit == 0)return;
- UpdateData();
- CString strdate;
- strdate.Format("%d-%02d", m_year, m_month);
- m_List1.DeleteAllItems2();
- int ii = 0;
- m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
- int count = 0;
- if (m_filter.IsEmpty())
- {
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (m_List1array.ElementAt(ii).ElementAt(3).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(4).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(5).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(6).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(7).Find(strdate) != -1)
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- else
- {
- int type = GetType(m_filter);
- if (type == 1)//电话
- {
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1)
- {
- if (m_List1array.ElementAt(ii).ElementAt(3).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(4).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(5).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(6).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(7).Find(strdate) != -1)
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else if (type == 2)//拼音
- {
- m_filter.MakeUpper();
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1)
- {
- if (m_List1array.ElementAt(ii).ElementAt(3).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(4).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(5).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(6).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(7).Find(strdate) != -1)
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
- {
- if (m_List1array.ElementAt(ii).ElementAt(3).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(4).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(5).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(6).Find(strdate) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(7).Find(strdate) != -1)
- 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);
- }
- void ShowHisSalary::OnButton1()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid();
- }
- void ShowHisSalary::OnChangeEDITyear()
- {
- // 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.
- FillGrid();
- // TODO: Add your control notification handler code here
- }
- void ShowHisSalary::OnChangeEDITmonth()
- {
- // 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.
- FillGrid();
- // TODO: Add your control notification handler code here
- }
- void ShowHisSalary::OnBUTclear1()
- {
- // TODO: Add your control notification handler code here
- Clear(1);
- }
- void ShowHisSalary::OnBUTclear2()
- {
- // TODO: Add your control notification handler code here
- Clear(2);
- }
- void ShowHisSalary::OnBUTclear3()
- {
- // TODO: Add your control notification handler code here
- Clear(3);
- }
- void ShowHisSalary::OnBUTclear4()
- {
- // TODO: Add your control notification handler code here
- Clear(4);
- }
- void ShowHisSalary::OnBUTclear5()
- {
- // TODO: Add your control notification handler code here
- Clear(5);
- }
- void ShowHisSalary::Clear(int selpos)
- {
- if (IsHasRights2new(25) == 0)return;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要清除的订单!", MB_ICONINFORMATION);
- return;
- }
- int iItem;
- CStringArray array;
- while (pos)
- {
- iItem = m_List1.GetNextSelectedItem(pos);
- array.Add(m_List1.GetItemText(iItem, 0));
- }
- CString sql, temp;
- for (int i = 0; i < array.GetSize(); i++)
- {
- if (selpos == 1)
- temp = "***update dindan set [tichenren1]='' where [id]='" + array.ElementAt(i) + "'";
- else if (selpos == 2)
- temp = "***update dindan set [tichenren2]='' where [id]='" + array.ElementAt(i) + "'";
- else if (selpos == 3)
- temp = "***update dindan set [tichenren3]='' where [id]='" + array.ElementAt(i) + "'";
- else if (selpos == 4)
- temp = "***update dindan set [tichenren4]='' where [id]='" + array.ElementAt(i) + "'";
- else if (selpos == 5)
- temp = "***update dindan set [tichenren5]='' where [id]='" + array.ElementAt(i) + "'";
- sql += temp;
- }
- sql.TrimLeft("***");
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- AfxMessageBox("清除成功!");
- GetData();
- }
- void ShowHisSalary::GetData()
- {
- CString filter = "[tichenren1]<>'' or [tichenren2]<>'' or [tichenren3]<>'' or [tichenren4]<>'' or [tichenren5]<>''";
- g_sendhead.code[0] = 86;
- g_sendhead.tabcount = 1;
- g_sendhead.bsql = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)
- {
- return;
- }
- DataToArray(&m_List1array);
- FillGrid();
- }
|