ShowHisSalary.cpp 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. // ShowHisSalary.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowHisSalary.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // ShowHisSalary dialog
  13. ShowHisSalary::ShowHisSalary(CWnd* pParent /*=NULL*/)
  14. : CDialog(ShowHisSalary::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(ShowHisSalary)
  17. m_filter = _T("");
  18. m_year = atoi(g_date.Mid (0,4));
  19. m_month = atoi(g_date.Mid (5,2));
  20. m_bInit=0;
  21. //}}AFX_DATA_INIT
  22. }
  23. void ShowHisSalary::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(ShowHisSalary)
  27. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  28. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  29. DDX_Control(pDX, IDC_LIST1, m_List1);
  30. DDX_Text(pDX, IDC_EDIT1, m_filter);
  31. DDX_Text(pDX, IDC_EDITyear, m_year);
  32. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  33. DDX_Text(pDX, IDC_EDITmonth, m_month);
  34. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  35. //}}AFX_DATA_MAP
  36. }
  37. BEGIN_MESSAGE_MAP(ShowHisSalary, CDialog)
  38. //{{AFX_MSG_MAP(ShowHisSalary)
  39. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  40. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  41. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  42. ON_BN_CLICKED(IDC_BUTclear1, OnBUTclear1)
  43. ON_BN_CLICKED(IDC_BUTclear2, OnBUTclear2)
  44. ON_BN_CLICKED(IDC_BUTclear3, OnBUTclear3)
  45. ON_BN_CLICKED(IDC_BUTclear4, OnBUTclear4)
  46. ON_BN_CLICKED(IDC_BUTclear5, OnBUTclear5)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // ShowHisSalary message handlers
  51. BOOL ShowHisSalary::OnInitDialog()
  52. {
  53. CDialog::OnInitDialog();
  54. // TODO: Add extra initialization here
  55. if(IsHasRights2new(25)==0)
  56. {
  57. GetDlgItem(IDC_BUTclear1)->EnableWindow(0);
  58. GetDlgItem(IDC_BUTclear2)->EnableWindow(0);
  59. GetDlgItem(IDC_BUTclear3)->EnableWindow(0);
  60. GetDlgItem(IDC_BUTclear4)->EnableWindow(0);
  61. GetDlgItem(IDC_BUTclear5)->EnableWindow(0);
  62. }
  63. #ifdef CHILD_VERSION
  64. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,120;摄影提成,120;化妆提成,120;初修提成,120;精修提成,120;设计提成,100" );
  65. #else
  66. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,120;摄影提成,120;化妆提成,120;初修提成,120;精修提成,120;设计提成,100" );
  67. #endif
  68. m_List1.LoadColumnInfo (140);
  69. m_spinyear.SetRange (1900, 3000);
  70. m_spinmonth.SetRange (1, 12);
  71. m_bInit=1;
  72. GetData();
  73. CRect rc2;
  74. GetWindowRect(rc2);
  75. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  76. GetClientRect(rc2);
  77. rc2.top +=40*g_fscaley;
  78. m_List1.MoveWindow (rc2);
  79. int right=rc2.right-5 ;
  80. GetDlgItem(IDC_BUTclear5)->GetWindowRect(rc2);
  81. int wid=rc2.Width ();
  82. ScreenToClient(rc2);
  83. rc2.left =right-wid*1;
  84. rc2.right =rc2.left +wid;
  85. GetDlgItem(IDC_BUTclear5)->MoveWindow(rc2);
  86. rc2.left =right-wid*2;
  87. rc2.right =rc2.left +wid;
  88. GetDlgItem(IDC_BUTclear4)->MoveWindow(rc2);
  89. rc2.left =right-wid*3;
  90. rc2.right =rc2.left +wid;
  91. GetDlgItem(IDC_BUTclear3)->MoveWindow(rc2);
  92. rc2.left =right-wid*4;
  93. rc2.right =rc2.left +wid;
  94. GetDlgItem(IDC_BUTclear2)->MoveWindow(rc2);
  95. rc2.left =right-wid*5;
  96. rc2.right =rc2.left +wid;
  97. GetDlgItem(IDC_BUTclear1)->MoveWindow(rc2);
  98. return TRUE; // return TRUE unless you set the focus to a control
  99. // EXCEPTION: OCX Property Pages should return FALSE
  100. }
  101. void ShowHisSalary::FillGrid()
  102. {
  103. if(m_bInit==0)return;
  104. UpdateData();
  105. CString strdate;
  106. strdate.Format ("%d-%02d", m_year, m_month);
  107. m_List1.DeleteAllItems2 ();
  108. int ii=0;
  109. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  110. int count=0;
  111. if(m_filter.IsEmpty ())
  112. {
  113. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  114. {
  115. if(m_List1array.ElementAt (ii).ElementAt (3).Find (strdate)!=-1 || \
  116. m_List1array.ElementAt (ii).ElementAt (4).Find (strdate)!=-1 || \
  117. m_List1array.ElementAt (ii).ElementAt (5).Find (strdate)!=-1 || \
  118. m_List1array.ElementAt (ii).ElementAt (6).Find (strdate)!=-1 || \
  119. m_List1array.ElementAt (ii).ElementAt (7).Find (strdate)!=-1 )
  120. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  121. }
  122. }
  123. else
  124. {
  125. int type=GetType(m_filter);
  126. if(type==1)//电话
  127. {
  128. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  129. {
  130. if(m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 || \
  131. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1)
  132. {
  133. if(m_List1array.ElementAt (ii).ElementAt (3).Find (strdate)!=-1 || \
  134. m_List1array.ElementAt (ii).ElementAt (4).Find (strdate)!=-1 || \
  135. m_List1array.ElementAt (ii).ElementAt (5).Find (strdate)!=-1 || \
  136. m_List1array.ElementAt (ii).ElementAt (6).Find (strdate)!=-1 || \
  137. m_List1array.ElementAt (ii).ElementAt (7).Find (strdate)!=-1 )
  138. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  139. }
  140. }
  141. }
  142. else if(type==2)//拼音
  143. {
  144. m_filter.MakeUpper ();
  145. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  146. {
  147. if(m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 || \
  148. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1)
  149. {
  150. if(m_List1array.ElementAt (ii).ElementAt (3).Find (strdate)!=-1 || \
  151. m_List1array.ElementAt (ii).ElementAt (4).Find (strdate)!=-1 || \
  152. m_List1array.ElementAt (ii).ElementAt (5).Find (strdate)!=-1 || \
  153. m_List1array.ElementAt (ii).ElementAt (6).Find (strdate)!=-1 || \
  154. m_List1array.ElementAt (ii).ElementAt (7).Find (strdate)!=-1 )
  155. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  156. }
  157. }
  158. }
  159. else
  160. {
  161. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  162. {
  163. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  164. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  165. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 )
  166. {
  167. if(m_List1array.ElementAt (ii).ElementAt (3).Find (strdate)!=-1 || \
  168. m_List1array.ElementAt (ii).ElementAt (4).Find (strdate)!=-1 || \
  169. m_List1array.ElementAt (ii).ElementAt (5).Find (strdate)!=-1 || \
  170. m_List1array.ElementAt (ii).ElementAt (6).Find (strdate)!=-1 || \
  171. m_List1array.ElementAt (ii).ElementAt (7).Find (strdate)!=-1 )
  172. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  173. }
  174. }
  175. }
  176. }
  177. m_List1.m_arLabels.SetSize(count, 1);
  178. ii=count;
  179. m_List1.m_LabelCount=ii;
  180. m_List1.SetItemCountEx (ii);
  181. }
  182. void ShowHisSalary::OnButton1()
  183. {
  184. // TODO: Add your control notification handler code here
  185. UpdateData();
  186. m_filter.TrimLeft ();
  187. m_filter.TrimRight ();
  188. FillGrid();
  189. }
  190. void ShowHisSalary::OnChangeEDITyear()
  191. {
  192. // TODO: If this is a RICHEDIT control, the control will not
  193. // send this notification unless you override the CDialog::OnInitDialog()
  194. // function and call CRichEditCtrl().SetEventMask()
  195. // with the ENM_CHANGE flag ORed into the mask.
  196. FillGrid();
  197. // TODO: Add your control notification handler code here
  198. }
  199. void ShowHisSalary::OnChangeEDITmonth()
  200. {
  201. // TODO: If this is a RICHEDIT control, the control will not
  202. // send this notification unless you override the CDialog::OnInitDialog()
  203. // function and call CRichEditCtrl().SetEventMask()
  204. // with the ENM_CHANGE flag ORed into the mask.
  205. FillGrid();
  206. // TODO: Add your control notification handler code here
  207. }
  208. void ShowHisSalary::OnBUTclear1()
  209. {
  210. // TODO: Add your control notification handler code here
  211. Clear(1);
  212. }
  213. void ShowHisSalary::OnBUTclear2()
  214. {
  215. // TODO: Add your control notification handler code here
  216. Clear(2);
  217. }
  218. void ShowHisSalary::OnBUTclear3()
  219. {
  220. // TODO: Add your control notification handler code here
  221. Clear(3);
  222. }
  223. void ShowHisSalary::OnBUTclear4()
  224. {
  225. // TODO: Add your control notification handler code here
  226. Clear(4);
  227. }
  228. void ShowHisSalary::OnBUTclear5()
  229. {
  230. // TODO: Add your control notification handler code here
  231. Clear(5);
  232. }
  233. void ShowHisSalary::Clear(int selpos)
  234. {
  235. if(IsHasRights2new(25)==0)return;
  236. POSITION pos;
  237. pos=m_List1.GetFirstSelectedItemPosition();
  238. if(pos==NULL)
  239. {
  240. AfxMessageBox("请先选中您要清除的订单!", MB_ICONINFORMATION);
  241. return;
  242. }
  243. int iItem;
  244. CStringArray array;
  245. while (pos)
  246. {
  247. iItem = m_List1.GetNextSelectedItem(pos);
  248. array.Add (m_List1.GetItemText (iItem, 0));
  249. }
  250. CString sql,temp;
  251. for(int i=0; i<array.GetSize (); i++)
  252. {
  253. if(selpos==1)
  254. temp="***update dindan set [tichenren1]='' where [id]='"+array.ElementAt (i)+"'";
  255. else if(selpos==2)
  256. temp="***update dindan set [tichenren2]='' where [id]='"+array.ElementAt (i)+"'";
  257. else if(selpos==3)
  258. temp="***update dindan set [tichenren3]='' where [id]='"+array.ElementAt (i)+"'";
  259. else if(selpos==4)
  260. temp="***update dindan set [tichenren4]='' where [id]='"+array.ElementAt (i)+"'";
  261. else if(selpos==5)
  262. temp="***update dindan set [tichenren5]='' where [id]='"+array.ElementAt (i)+"'";
  263. sql+=temp;
  264. }
  265. sql.TrimLeft ("***");
  266. g_sendhead.bsql=1;
  267. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  268. AfxMessageBox("清除成功!");
  269. GetData();
  270. }
  271. void ShowHisSalary::GetData()
  272. {
  273. CString filter="[tichenren1]<>'' or [tichenren2]<>'' or [tichenren3]<>'' or [tichenren4]<>'' or [tichenren5]<>''";
  274. g_sendhead.code[0]=86;
  275. g_sendhead.tabcount=1;
  276. g_sendhead.bsql=0;
  277. g_pMainWnd->ProcessChatMessageRequest2(filter);
  278. if(g_bSendOK==0)
  279. {
  280. return;
  281. }
  282. DataToArray(&m_List1array);
  283. FillGrid();
  284. }