IncomeInput4.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. // IncomeInput4.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "IncomeInput4.h"
  6. #include "MyMdi.H"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // IncomeInput4
  14. IMPLEMENT_DYNCREATE(IncomeInput4, MyFormView)
  15. IncomeInput4::IncomeInput4()
  16. : MyFormView(IncomeInput4::IDD)
  17. {
  18. //{{AFX_DATA_INIT(IncomeInput4)
  19. m_filter = _T("");
  20. //}}AFX_DATA_INIT
  21. }
  22. IncomeInput4::~IncomeInput4()
  23. {
  24. }
  25. void IncomeInput4::DoDataExchange(CDataExchange* pDX)
  26. {
  27. MyFormView::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(IncomeInput4)
  29. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  30. DDX_Control(pDX, IDC_LIST2, m_List1);
  31. DDX_Control(pDX, IDC_STATIC1, m_static1);
  32. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(IncomeInput4, MyFormView)
  36. //{{AFX_MSG_MAP(IncomeInput4)
  37. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  38. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  39. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  40. ON_WM_TIMER()
  41. //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43. /////////////////////////////////////////////////////////////////////////////
  44. // IncomeInput4 diagnostics
  45. #ifdef _DEBUG
  46. void IncomeInput4::AssertValid() const
  47. {
  48. MyFormView::AssertValid();
  49. }
  50. void IncomeInput4::Dump(CDumpContext& dc) const
  51. {
  52. MyFormView::Dump(dc);
  53. }
  54. #endif //_DEBUG
  55. /////////////////////////////////////////////////////////////////////////////
  56. // IncomeInput4 message handlers
  57. void IncomeInput4::OnInitialUpdate()
  58. {
  59. MyFormView::OnInitialUpdate();
  60. // TODO: Add your specialized code here and/or call the base class
  61. CMyMdi Mdi;
  62. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  63. // Here we create the outbar control using the splitter as its parent
  64. // and setting its id to the first pane.
  65. CRect rc2;
  66. GetWindowRect(rc2);
  67. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  68. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  69. m_static1.SetFont (&g_titlefont);
  70. m_List1.SetHeadings("id,0;相关人员,100;奖罚类别,100;奖罚金额, 100;是否执行, 100;日期,100;经手人,100;备注,100" );
  71. m_List1.LoadColumnInfo (143);
  72. GetData();
  73. m_combo1.AddString (g_user.name);
  74. m_combo1.AddString ("奖励");
  75. m_combo1.AddString ("惩罚");
  76. m_combo1.AddString ("未执行");
  77. m_combo1.AddString ("已执行");
  78. for(int i=0; i<g_AryStaff.GetSize (); i++)
  79. {
  80. m_combo1.AddString (DAL::GetStaffName(i));
  81. }
  82. m_combo1.GetWindowRect (rc2);
  83. ScreenToClient(rc2);
  84. rc2.bottom +=200;
  85. m_combo1.MoveWindow (rc2);
  86. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  87. SetComboHei(&m_combo1, rc2.Height ());
  88. }
  89. void IncomeInput4::FillGrid()
  90. {
  91. m_List1.DeleteAllItems2 ();
  92. int ii=0;
  93. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  94. int count=0;
  95. if(m_filter.IsEmpty ())
  96. {
  97. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  98. {
  99. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  100. }
  101. }
  102. else
  103. {
  104. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  105. {
  106. if(m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 ||m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 )
  107. {
  108. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  109. }
  110. }
  111. }
  112. m_List1.m_arLabels.SetSize(count, 1);
  113. ii=count;
  114. m_List1.m_LabelCount=ii;
  115. m_List1.SetItemCountEx (ii);
  116. CString str;
  117. str.Format ("单数:%d", ii);
  118. SetDlgItemText(IDC_STATIC2, str);
  119. }
  120. void IncomeInput4::OnBUTclose()
  121. {
  122. // TODO: Add your control notification handler code here
  123. GetParent()->SendMessage(WM_CLOSE);
  124. }
  125. void IncomeInput4::GetData()
  126. {
  127. g_sendhead.bsql=0;
  128. g_sendhead.code[0]=88;
  129. g_sendhead.tabcount=1;
  130. g_pMainWnd->ProcessChatMessageRequest2(1);
  131. if(g_bSendOK==0)
  132. {
  133. return;
  134. }
  135. DataToArray(&m_List1array);
  136. FillGrid();
  137. }
  138. BOOL IncomeInput4::PreTranslateMessage(MSG* pMsg)
  139. {
  140. // TODO: Add your specialized code here and/or call the base class
  141. try
  142. {
  143. if(pMsg->message==WM_KEYDOWN)
  144. {
  145. switch (pMsg->wParam)
  146. {
  147. case 0x43: // copy
  148. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  149. {
  150. GetFocus()->SendMessage(WM_COPY);
  151. return TRUE;
  152. }
  153. break;
  154. case 0x56: //Ctrl + V:
  155. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  156. {
  157. GetFocus()->SendMessage(WM_PASTE);
  158. return TRUE;
  159. }
  160. break;
  161. case 0x58: // cut
  162. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  163. {
  164. GetFocus()->SendMessage(WM_CUT);
  165. return TRUE;
  166. }
  167. break;
  168. case 0x5A: //undo
  169. case 0x59: //redo
  170. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  171. {
  172. GetFocus()->SendMessage(WM_UNDO);
  173. return TRUE;
  174. }
  175. break;
  176. }
  177. }
  178. return MyFormView::PreTranslateMessage(pMsg);
  179. }
  180. catch(...)
  181. {
  182. }
  183. }
  184. void IncomeInput4::OnButton1()
  185. {
  186. // TODO: Add your control notification handler code here
  187. UpdateData();
  188. m_filter.TrimLeft ();
  189. m_filter.TrimRight ();
  190. FillGrid();
  191. }
  192. void IncomeInput4::OnSelchangeCombo1()
  193. {
  194. // TODO: Add your control notification handler code here
  195. SetTimer(1, 100, NULL);
  196. }
  197. void IncomeInput4::OnTimer(UINT nIDEvent)
  198. {
  199. // TODO: Add your message handler code here and/or call default
  200. KillTimer(nIDEvent);
  201. OnButton1();
  202. }