FinanceForm.cpp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. // FinanceForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "FinanceForm.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ClientDlg.h"
  10. #include "TakeMoney2.h"
  11. #include "TakeMoney3.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. #pragma comment(lib, "Shlwapi.lib")
  18. /////////////////////////////////////////////////////////////////////////////
  19. // FinanceForm
  20. IMPLEMENT_DYNCREATE(FinanceForm, CFormView)
  21. FinanceForm::FinanceForm()
  22. : CFormView(FinanceForm::IDD)
  23. {
  24. //{{AFX_DATA_INIT(FinanceForm)
  25. m_filter = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. FinanceForm::~FinanceForm()
  29. {
  30. }
  31. void FinanceForm::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CFormView::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(FinanceForm)
  35. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  36. DDX_Control(pDX, IDC_LIST2, m_List1);
  37. DDX_Control(pDX, IDC_STATIC1, m_static1);
  38. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(FinanceForm, CFormView)
  42. //{{AFX_MSG_MAP(FinanceForm)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
  48. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  49. ON_BN_CLICKED(IDC_BUTMoney2, OnBUTMoney2)
  50. ON_BN_CLICKED(IDC_BUTmoney3, OnBUTmoney3)
  51. ON_BN_CLICKED(IDC_BUTmoney4, OnBUTmoney4)
  52. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  53. ON_BN_CLICKED(IDC_BTNaddsp2, OnBTNaddsp2)
  54. //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56. /////////////////////////////////////////////////////////////////////////////
  57. // FinanceForm diagnostics
  58. #ifdef _DEBUG
  59. void FinanceForm::AssertValid() const
  60. {
  61. CFormView::AssertValid();
  62. }
  63. void FinanceForm::Dump(CDumpContext& dc) const
  64. {
  65. CFormView::Dump(dc);
  66. }
  67. #endif //_DEBUG
  68. /////////////////////////////////////////////////////////////////////////////
  69. // FinanceForm message handlers
  70. void FinanceForm::OnInitialUpdate()
  71. {
  72. CFormView::OnInitialUpdate();
  73. // TODO: Add your specialized code here and/or call the base class
  74. CMyMdi Mdi;
  75. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  76. // Here we create the outbar control using the splitter as its parent
  77. // and setting its id to the first pane.
  78. CRect rc2;
  79. GetWindowRect(rc2);
  80. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  81. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  82. m_static1.SetFont (&g_titlefont);
  83. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;拍照,100;初修,100;选片,100;精修,100;设计,100;取件,100;预约时间,100;拍照时间,100;选片时间,100;取件时间,100;接单人,100;套系名称,100;套系价格,100;摄影师,100;化妆师,100;初修,100;选片,100;精修,100;设计师,100;录单,100;男宾电话,100;女宾电话,100" );
  84. m_List1.LoadColumnInfo (109);
  85. if(g_bShowOK==0)
  86. {
  87. CString filter="status3='未取'";
  88. g_sendhead.bsql=0;
  89. g_sendhead.code[0]=21;
  90. g_sendhead.tabcount=1;
  91. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  92. }
  93. else
  94. {
  95. g_sendhead.bsql=0;
  96. g_sendhead.code[0]=21;
  97. g_sendhead.tabcount=1;
  98. g_pMainWnd->ProcessChatMessageRequest2(21);if(g_bSendOK==0)return;
  99. }
  100. DataToArray(&m_List1array);
  101. m_combo1.AddString (g_user.name);
  102. for(int i=0; i<g_userarray.GetSize (); i++)
  103. {
  104. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  105. }
  106. FillGrid();
  107. m_combo1.GetWindowRect (rc2);
  108. ScreenToClient(rc2);
  109. rc2.bottom +=200;
  110. m_combo1.MoveWindow (rc2);
  111. GetDlgItem(IDC_BUTmoney)->EnableWindow(IsHasRights2new(16));
  112. GetDlgItem(IDC_BUTMoney2)->EnableWindow(IsHasRights2new(17));
  113. GetDlgItem(IDC_BUTmoney3)->EnableWindow(IsHasRights2new(18));
  114. GetDlgItem(IDC_BUTmoney4)->EnableWindow(IsHasRights2new(19));
  115. GetDlgItem(IDC_BTNaddsp)->EnableWindow(IsHasRights2new(25));
  116. GetDlgItem(IDC_BTNaddsp2)->EnableWindow(IsHasRights2new(26));
  117. }
  118. void FinanceForm::FillGrid()
  119. {
  120. m_List1.DeleteAllItems2 ();
  121. int ii=0;
  122. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  123. int count=0;
  124. if(m_filter.IsEmpty ())
  125. {
  126. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  127. {
  128. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  129. }
  130. }
  131. else
  132. {
  133. int type=GetType(m_filter);
  134. if(type==1)//电话
  135. {
  136. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  137. {
  138. if(m_List1array.ElementAt (ii).ElementAt (23).Find (m_filter)!=-1 || \
  139. m_List1array.ElementAt (ii).ElementAt (24).Find (m_filter)!=-1)
  140. {
  141. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  142. }
  143. }
  144. }
  145. else if(type==2)//拼音
  146. {
  147. m_filter.MakeUpper ();
  148. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  149. {
  150. if(m_List1array.ElementAt (ii).ElementAt (25).Find (m_filter)!=-1 || \
  151. m_List1array.ElementAt (ii).ElementAt (26).Find (m_filter)!=-1)
  152. {
  153. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  154. }
  155. }
  156. }
  157. else
  158. {
  159. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  160. {
  161. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 || \
  162. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  163. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  164. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  165. m_List1array.ElementAt (ii).ElementAt (23).Find (m_filter)!=-1 || \
  166. m_List1array.ElementAt (ii).ElementAt (24).Find (m_filter)!=-1 ||\
  167. m_List1array.ElementAt (ii).ElementAt (25).Find (m_filter)!=-1 || \
  168. m_List1array.ElementAt (ii).ElementAt (26).Find (m_filter)!=-1)
  169. {
  170. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  171. }
  172. }
  173. }
  174. }
  175. m_List1.m_arLabels.SetSize(count, 1);
  176. ii=count;
  177. m_List1.m_LabelCount=ii;
  178. m_List1.SetItemCountEx (ii);
  179. CString str;
  180. str.Format ("单数:%d", ii);
  181. SetDlgItemText(IDC_STATIC2, str);
  182. }
  183. void FinanceForm::OnBUTclose()
  184. {
  185. // TODO: Add your control notification handler code here
  186. GetParent()->SendMessage(WM_CLOSE);
  187. }
  188. void FinanceForm::OnButton1()
  189. {
  190. // TODO: Add your control notification handler code here
  191. UpdateData();
  192. m_filter.TrimLeft ();
  193. m_filter.TrimRight ();
  194. FillGrid();
  195. }
  196. void FinanceForm::OnSelchangeCombo1()
  197. {
  198. // TODO: Add your control notification handler code here
  199. SetTimer(1, 100, NULL);
  200. }
  201. void FinanceForm::OnTimer(UINT nIDEvent)
  202. {
  203. // TODO: Add your message handler code here and/or call default
  204. KillTimer(nIDEvent);
  205. OnButton1();
  206. }
  207. BOOL FinanceForm::PreTranslateMessage(MSG* pMsg)
  208. {
  209. // TODO: Add your specialized code here and/or call the base class
  210. try
  211. {
  212. if(pMsg->message==WM_KEYDOWN)
  213. {
  214. switch (pMsg->wParam)
  215. {
  216. case VK_RETURN:
  217. OnButton1();
  218. return 1;
  219. case 0x43: // copy
  220. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  221. {
  222. GetFocus()->SendMessage(WM_COPY);
  223. return TRUE;
  224. }
  225. break;
  226. case 0x56: //Ctrl + V:
  227. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  228. {
  229. GetFocus()->SendMessage(WM_PASTE);
  230. return TRUE;
  231. }
  232. break;
  233. case 0x58: // cut
  234. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  235. {
  236. GetFocus()->SendMessage(WM_CUT);
  237. return TRUE;
  238. }
  239. break;
  240. case 0x5A: //undo
  241. case 0x59: //redo
  242. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  243. {
  244. GetFocus()->SendMessage(WM_UNDO);
  245. return TRUE;
  246. }
  247. break;
  248. }
  249. }
  250. return CFormView::PreTranslateMessage(pMsg);
  251. }
  252. catch(...)
  253. {
  254. }
  255. }
  256. void FinanceForm::OnBUTprint()
  257. {
  258. // TODO: Add your control notification handler code here
  259. }
  260. void FinanceForm::OnBUTmoney()//预约收款
  261. {
  262. if(IsHasRights2new(16)==0)return;
  263. // TODO: Add your control notification handler code here
  264. // TODO: Add your control notification handler code here
  265. UpdateData();
  266. POSITION pos;
  267. pos=m_List1.GetFirstSelectedItemPosition();
  268. if(pos==NULL)
  269. {
  270. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  271. return;
  272. }
  273. int iItem=m_List1.GetNextSelectedItem(pos);
  274. CString id=m_List1.GetItemText (iItem, 0);
  275. CString ren=m_List1.GetItemText (iItem, 13);
  276. CString str;
  277. TakeMoney2 dlg;
  278. dlg.m_mode =3;
  279. dlg.m_id =id;
  280. dlg.m_ren=ren;
  281. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  282. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  283. if(dlg.DoModal ()!=IDOK)return;
  284. }
  285. void FinanceForm::OnBUTMoney2() //预约补款
  286. {
  287. if(IsHasRights2new(17)==0)return;
  288. // TODO: Add your control notification handler code here
  289. UpdateData();
  290. POSITION pos;
  291. pos=m_List1.GetFirstSelectedItemPosition();
  292. if(pos==NULL)
  293. {
  294. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  295. return;
  296. }
  297. int iItem=m_List1.GetNextSelectedItem(pos);
  298. CString id=m_List1.GetItemText (iItem, 0);
  299. CString ren=m_List1.GetItemText (iItem, 13);
  300. CString str;
  301. TakeMoney2 dlg;
  302. dlg.m_mode =2;
  303. dlg.m_id =id;
  304. dlg.m_ren=ren;
  305. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  306. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  307. if(dlg.DoModal ()!=IDOK)return;
  308. }
  309. void FinanceForm::OnBUTmoney3() //拍照补款
  310. {
  311. if(IsHasRights2new(18)==0)return;
  312. // TODO: Add your control notification handler code here
  313. // TODO: Add your control notification handler code here
  314. UpdateData();
  315. POSITION pos;
  316. pos=m_List1.GetFirstSelectedItemPosition();
  317. if(pos==NULL)
  318. {
  319. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  320. return;
  321. }
  322. int iItem=m_List1.GetNextSelectedItem(pos);
  323. CString id=m_List1.GetItemText (iItem, 0);
  324. CString str;
  325. TakeMoney3 dlg;
  326. dlg.m_mode =0;
  327. dlg.m_id =id;
  328. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  329. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  330. if(dlg.DoModal ()!=IDOK)return;
  331. }
  332. void FinanceForm::OnBUTmoney4() //选片补款
  333. {
  334. if(IsHasRights2new(19)==0)return;
  335. // TODO: Add your control notification handler code here
  336. if(IsHasRights2(11)==0)return;
  337. // TODO: Add your control notification handler code here
  338. UpdateData();
  339. POSITION pos;
  340. pos=m_List1.GetFirstSelectedItemPosition();
  341. if(pos==NULL)
  342. {
  343. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  344. return;
  345. }
  346. int iItem=m_List1.GetNextSelectedItem(pos);
  347. CString id=m_List1.GetItemText (iItem, 0);
  348. CString str;
  349. TakeMoney3 dlg;
  350. dlg.m_mode =1;
  351. dlg.m_id =id;
  352. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  353. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  354. if(dlg.DoModal ()!=IDOK)return;
  355. }
  356. void FinanceForm::OnBTNaddsp()
  357. {
  358. }
  359. void FinanceForm::OnBTNaddsp2()
  360. {
  361. }