TakeControlForm.cpp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. // TakeControlForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "TakeControlForm.h"
  6. #include "MyMdi.H"
  7. #include "TakeControlDlg.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // TakeControlForm
  15. IMPLEMENT_DYNCREATE(TakeControlForm, CFormView)
  16. TakeControlForm::TakeControlForm()
  17. : CFormView(TakeControlForm::IDD)
  18. {
  19. //{{AFX_DATA_INIT(TakeControlForm)
  20. m_filter = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. TakeControlForm::~TakeControlForm()
  24. {
  25. }
  26. void TakeControlForm::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CFormView::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(TakeControlForm)
  30. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  31. DDX_Control(pDX, IDC_LIST2, m_List1);
  32. DDX_Control(pDX, IDC_STATIC1, m_static1);
  33. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  34. //}}AFX_DATA_MAP
  35. }
  36. BEGIN_MESSAGE_MAP(TakeControlForm, CFormView)
  37. //{{AFX_MSG_MAP(TakeControlForm)
  38. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  39. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  40. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  41. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  42. ON_WM_TIMER()
  43. ON_BN_CLICKED(IDC_BUTmodify, OnBUTmodify)
  44. //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46. /////////////////////////////////////////////////////////////////////////////
  47. // TakeControlForm diagnostics
  48. #ifdef _DEBUG
  49. void TakeControlForm::AssertValid() const
  50. {
  51. CFormView::AssertValid();
  52. }
  53. void TakeControlForm::Dump(CDumpContext& dc) const
  54. {
  55. CFormView::Dump(dc);
  56. }
  57. #endif //_DEBUG
  58. /////////////////////////////////////////////////////////////////////////////
  59. // TakeControlForm message handlers
  60. void TakeControlForm::OnInitialUpdate()
  61. {
  62. CFormView::OnInitialUpdate();
  63. // TODO: Add your specialized code here and/or call the base class
  64. CMyMdi Mdi;
  65. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  66. // Here we create the outbar control using the splitter as its parent
  67. // and setting its id to the first pane.
  68. CRect rc2;
  69. GetWindowRect(rc2);
  70. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  71. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  72. m_static1.SetFont (&g_titlefont);
  73. m_List1.SetHeadings("拍摄日期,100;拍摄时间,100;订单号,100;男宾姓名,100;女宾姓名,100;男宾电话,100;女宾电话,100;套系名称,100;摄影师,100;化妆师,100;门市,100" );
  74. m_List1.LoadColumnInfo (113);
  75. if(g_bShowOK==0)
  76. {
  77. CString filter="status3='未取'";
  78. g_sendhead.bsql=0;
  79. g_sendhead.code[0]=53;
  80. g_sendhead.tabcount=1;
  81. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  82. }
  83. else
  84. {
  85. g_sendhead.bsql=0;
  86. g_sendhead.code[0]=53;
  87. g_sendhead.tabcount=1;
  88. g_pMainWnd->ProcessChatMessageRequest2(53);if(g_bSendOK==0)return;
  89. }
  90. DataToArray(&m_List1array);
  91. m_combo1.AddString (g_user.name);
  92. for(int i=0; i<g_userarray.GetSize (); i++)
  93. {
  94. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  95. }
  96. FillGrid();
  97. m_combo1.GetWindowRect (rc2);
  98. ScreenToClient(rc2);
  99. rc2.bottom +=200;
  100. m_combo1.MoveWindow (rc2);
  101. GetDlgItem(IDC_BUTmodify)->EnableWindow(IsHasRights2new(2));
  102. }
  103. void TakeControlForm::FillGrid()
  104. {
  105. m_List1.DeleteAllItems2 ();
  106. int ii=0;
  107. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  108. int count=0;
  109. if(m_filter.IsEmpty ())
  110. {
  111. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  112. {
  113. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  114. }
  115. }
  116. else
  117. {
  118. int type=GetType(m_filter);
  119. if(type==1)//电话
  120. {
  121. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  122. {
  123. if(m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1 || \
  124. m_List1array.ElementAt (ii).ElementAt (6).Find (m_filter)!=-1)
  125. {
  126. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  127. }
  128. }
  129. }
  130. else if(type==2)//拼音
  131. {
  132. m_filter.MakeUpper ();
  133. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  134. {
  135. if(m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1 || \
  136. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1)
  137. {
  138. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  139. }
  140. }
  141. }
  142. else
  143. {
  144. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  145. {//0,2,3,4,5,6,7,8,9,10
  146. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 || \
  147. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 ||\
  148. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 ||\
  149. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 ||\
  150. m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1 ||\
  151. m_List1array.ElementAt (ii).ElementAt (6).Find (m_filter)!=-1 ||\
  152. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1 ||\
  153. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 ||\
  154. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 ||\
  155. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1)
  156. {
  157. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  158. }
  159. }
  160. }
  161. }
  162. m_List1.m_arLabels.SetSize(count, 1);
  163. ii=count;
  164. m_List1.m_LabelCount=ii;
  165. m_List1.SetItemCountEx (ii);
  166. }
  167. void TakeControlForm::OnBUTclose()
  168. {
  169. // TODO: Add your control notification handler code here
  170. GetParent()->SendMessage(WM_CLOSE);
  171. }
  172. void TakeControlForm::OnButton1()
  173. {
  174. // TODO: Add your control notification handler code here
  175. UpdateData();
  176. m_filter.TrimLeft ();
  177. m_filter.TrimRight ();
  178. FillGrid();
  179. }
  180. void TakeControlForm::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  181. {
  182. // TODO: Add your control notification handler code here
  183. OnBUTmodify();
  184. *pResult = 0;
  185. }
  186. void TakeControlForm::OnSelchangeCombo1()
  187. {
  188. // TODO: Add your control notification handler code here
  189. SetTimer(1, 100, NULL);
  190. }
  191. void TakeControlForm::OnTimer(UINT nIDEvent)
  192. {
  193. // TODO: Add your message handler code here and/or call default
  194. KillTimer(nIDEvent);
  195. OnButton1();
  196. }
  197. void TakeControlForm::OnBUTmodify()
  198. {
  199. // TODO: Add your control notification handler code here
  200. if(IsHasRights2new(2)==0)return;
  201. POSITION pos;
  202. pos=m_List1.GetFirstSelectedItemPosition();
  203. if(pos==NULL)
  204. {
  205. return;
  206. }
  207. int iItem=m_List1.GetNextSelectedItem(pos);
  208. CString id=m_List1.GetItemText (iItem, 2);
  209. TakeControlDlg dlg;
  210. dlg.id =id;
  211. if(dlg.DoModal ()==IDOK)
  212. {
  213. for(int i=0; i<m_List1array.GetSize (); i++)
  214. {
  215. if(dlg.id==m_List1array.ElementAt (i).ElementAt (2))
  216. {
  217. m_List1array.ElementAt (i).SetAt (0, dlg.m_time2 );
  218. m_List1array.ElementAt (i).SetAt (1, dlg.m_taketime );
  219. m_List1array.ElementAt (i).SetAt (8, dlg.m_waiter1 );
  220. m_List1array.ElementAt (i).SetAt (9, dlg.m_waiter2 );
  221. FillGrid();
  222. break;
  223. }
  224. }
  225. }
  226. }
  227. BOOL TakeControlForm::PreTranslateMessage(MSG* pMsg)
  228. {
  229. // TODO: Add your specialized code here and/or call the base class
  230. try
  231. {
  232. if(pMsg->message==WM_KEYDOWN)
  233. {
  234. switch (pMsg->wParam)
  235. {
  236. case VK_RETURN:
  237. OnButton1();
  238. return 1;
  239. case 0x43: // copy
  240. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  241. {
  242. GetFocus()->SendMessage(WM_COPY);
  243. return TRUE;
  244. }
  245. break;
  246. case 0x56: //Ctrl + V:
  247. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  248. {
  249. GetFocus()->SendMessage(WM_PASTE);
  250. return TRUE;
  251. }
  252. break;
  253. case 0x58: // cut
  254. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  255. {
  256. GetFocus()->SendMessage(WM_CUT);
  257. return TRUE;
  258. }
  259. break;
  260. case 0x5A: //undo
  261. case 0x59: //redo
  262. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  263. {
  264. GetFocus()->SendMessage(WM_UNDO);
  265. return TRUE;
  266. }
  267. break;
  268. }
  269. }
  270. return CFormView::PreTranslateMessage(pMsg);
  271. }
  272. catch(...)
  273. {
  274. }
  275. }