FinanceForm.cpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. // FinanceForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "FinanceForm.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "TakeMoney3.h"
  11. #include "SelMoneyType.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, MyFormView)
  21. FinanceForm::FinanceForm()
  22. : MyFormView(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. MyFormView::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, MyFormView)
  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. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  55. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  56. //}}AFX_MSG_MAP
  57. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // FinanceForm diagnostics
  61. #ifdef _DEBUG
  62. void FinanceForm::AssertValid() const
  63. {
  64. MyFormView::AssertValid();
  65. }
  66. void FinanceForm::Dump(CDumpContext& dc) const
  67. {
  68. MyFormView::Dump(dc);
  69. }
  70. #endif //_DEBUG
  71. /////////////////////////////////////////////////////////////////////////////
  72. // FinanceForm message handlers
  73. void FinanceForm::OnInitialUpdate()
  74. {
  75. MyFormView::OnInitialUpdate();
  76. // TODO: Add your specialized code here and/or call the base class
  77. CMyMdi Mdi;
  78. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  79. // Here we create the outbar control using the splitter as its parent
  80. // and setting its id to the first pane.
  81. CRect rc2;
  82. GetWindowRect(rc2);
  83. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  84. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  85. m_static1.SetFont (&g_titlefont);
  86. #ifdef CHILD_VERSION
  87. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;是否取件,100;应付,100;前期,100;后期,100;已付,100;欠款,100;门市,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  88. #else
  89. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;是否取件,100;应付,100;前期,100;后期,100;已付,100;欠款,100;门市,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  90. #endif
  91. m_List1.LoadColumnInfo (126);
  92. GetData();
  93. m_combo1.GetWindowRect (rc2);
  94. ScreenToClient(rc2);
  95. rc2.bottom +=200;
  96. m_combo1.MoveWindow (rc2);
  97. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  98. SetComboHei(&m_combo1, rc2.Height ());
  99. GetDlgItem(IDC_BUTmoney)->EnableWindow(IsHasRights2new(16));
  100. GetDlgItem(IDC_BUTMoney2)->EnableWindow(IsHasRights2new(16));
  101. GetDlgItem(IDC_BUTmoney4)->EnableWindow(IsHasRights2new(16));
  102. }
  103. void FinanceForm::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 (13).Find (m_filter)!=-1 || \
  124. m_List1array.ElementAt (ii).ElementAt (12).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 (15).Find (m_filter)!=-1 || \
  136. m_List1array.ElementAt (ii).ElementAt (14).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. {
  146. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  147. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  148. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  149. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1|| \
  150. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1|| \
  151. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  152. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 || \
  153. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1 || \
  154. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  155. m_List1array.ElementAt (ii).ElementAt (13).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. CString str;
  167. str.Format ("单数:%d", ii);
  168. SetDlgItemText(IDC_STATIC2, str);
  169. if(!g_id.IsEmpty ())
  170. {
  171. for(int i=0; i<m_List1.GetItemCount (); i++)
  172. {
  173. if(g_id==m_List1.GetItemText (i, 0))
  174. {
  175. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  176. m_List1.EnsureVisible(i,FALSE);
  177. break;
  178. }
  179. }
  180. }
  181. }
  182. void FinanceForm::OnBUTclose()
  183. {
  184. // TODO: Add your control notification handler code here
  185. GetParent()->SendMessage(WM_CLOSE);
  186. }
  187. void FinanceForm::OnButton1()
  188. {
  189. // TODO: Add your control notification handler code here
  190. UpdateData();
  191. m_filter.TrimLeft ();
  192. m_filter.TrimRight ();
  193. FillGrid();
  194. }
  195. void FinanceForm::OnSelchangeCombo1()
  196. {
  197. // TODO: Add your control notification handler code here
  198. SetTimer(1, 100, NULL);
  199. }
  200. void FinanceForm::OnTimer(UINT nIDEvent)
  201. {
  202. // TODO: Add your message handler code here and/or call default
  203. KillTimer(nIDEvent);
  204. OnButton1();
  205. }
  206. BOOL FinanceForm::PreTranslateMessage(MSG* pMsg)
  207. {
  208. // TODO: Add your specialized code here and/or call the base class
  209. try
  210. {
  211. if(pMsg->message==WM_KEYDOWN)
  212. {
  213. switch (pMsg->wParam)
  214. {
  215. case VK_RETURN:
  216. OnButton1();
  217. return 1;
  218. case 0x43: // copy
  219. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  220. {
  221. GetFocus()->SendMessage(WM_COPY);
  222. return TRUE;
  223. }
  224. break;
  225. case 0x56: //Ctrl + V:
  226. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  227. {
  228. GetFocus()->SendMessage(WM_PASTE);
  229. return TRUE;
  230. }
  231. break;
  232. case 0x58: // cut
  233. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  234. {
  235. GetFocus()->SendMessage(WM_CUT);
  236. return TRUE;
  237. }
  238. break;
  239. case 0x5A: //undo
  240. case 0x59: //redo
  241. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  242. {
  243. GetFocus()->SendMessage(WM_UNDO);
  244. return TRUE;
  245. }
  246. break;
  247. }
  248. }
  249. return MyFormView::PreTranslateMessage(pMsg);
  250. }
  251. catch(...)
  252. {
  253. }
  254. }
  255. void FinanceForm::OnBUTprint()
  256. {
  257. // TODO: Add your control notification handler code here
  258. }
  259. void FinanceForm::OnBUTmoney()//预约收款**
  260. {
  261. if(IsHasRights2new(16)==0)return;
  262. UpdateData();
  263. POSITION pos;
  264. pos=m_List1.GetFirstSelectedItemPosition();
  265. if(pos==NULL)
  266. {
  267. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  268. return;
  269. }
  270. int iItem=m_List1.GetNextSelectedItem(pos);
  271. CString id=m_List1.GetItemText (iItem, 0);
  272. CString ren=m_List1.GetItemText (iItem, 9);
  273. CString str;
  274. TakeMoney2 dlg;
  275. dlg.m_mode =3;
  276. dlg.m_strOrderNumber =id;
  277. dlg.m_ren=ren;
  278. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  279. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  280. dlg.m_phone1 =m_List1.GetItemText (iItem, 12);
  281. dlg.m_phone2 =m_List1.GetItemText (iItem, 13);
  282. dlg.DoModal ();
  283. GetData();
  284. }
  285. void FinanceForm::OnBUTMoney2() //预约补款**
  286. {
  287. if(IsHasRights2new(16)==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, 9);
  300. CString str;
  301. TakeMoney2 dlg;
  302. dlg.m_mode =2;
  303. dlg.m_strOrderNumber =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. dlg.m_phone1 =m_List1.GetItemText (iItem, 12);
  308. dlg.m_phone2 =m_List1.GetItemText (iItem, 13);
  309. dlg.DoModal ();
  310. GetData();
  311. }
  312. void FinanceForm::OnBUTmoney3() //拍照补款
  313. {
  314. /* if(IsHasRights2new(18)==0)return;
  315. // TODO: Add your control notification handler code here
  316. // TODO: Add your control notification handler code here
  317. UpdateData();
  318. POSITION pos;
  319. pos=m_List1.GetFirstSelectedItemPosition();
  320. if(pos==NULL)
  321. {
  322. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  323. return;
  324. }
  325. int iItem=m_List1.GetNextSelectedItem(pos);
  326. CString id=m_List1.GetItemText (iItem, 0);
  327. CString str;
  328. TakeMoney3 dlg;
  329. dlg.m_mode =0;
  330. dlg.m_id =id;
  331. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  332. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  333. if(dlg.DoModal ()!=IDOK)return; */
  334. }
  335. void FinanceForm::OnBUTmoney4() //后期补款**
  336. {
  337. if(IsHasRights2new(16)==0)return;
  338. // TODO: Add your control notification handler code here
  339. // TODO: Add your control notification handler code here
  340. UpdateData();
  341. POSITION pos;
  342. pos=m_List1.GetFirstSelectedItemPosition();
  343. if(pos==NULL)
  344. {
  345. AfxMessageBox("请先选中您要收款的定单!", MB_ICONINFORMATION);
  346. return;
  347. }
  348. int iItem=m_List1.GetNextSelectedItem(pos);
  349. CString id=m_List1.GetItemText (iItem, 0);
  350. CString ren=m_List1.GetItemText (iItem, 9);
  351. CString str;
  352. TakeMoney3 dlg;
  353. dlg.m_mode =1;
  354. dlg.m_strOrderNumber =id;
  355. dlg.m_ren=ren;
  356. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  357. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  358. dlg.m_phone1 =m_List1.GetItemText (iItem, 12);
  359. dlg.m_phone2 =m_List1.GetItemText (iItem, 13);
  360. dlg.DoModal ();
  361. GetData();
  362. }
  363. void FinanceForm::OnBTNaddsp()
  364. {
  365. }
  366. void FinanceForm::OnBTNaddsp2()
  367. {
  368. }
  369. void FinanceForm::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  370. {
  371. // TODO: Add your control notification handler code here
  372. SelMoneyType dlg;
  373. if(dlg.DoModal ()==IDOK)
  374. {
  375. if(dlg.m_type ==0)OnBUTmoney();
  376. else if(dlg.m_type ==1)OnBUTMoney2();
  377. else if(dlg.m_type ==2)OnBUTmoney4();
  378. }
  379. *pResult = 0;
  380. }
  381. void FinanceForm::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  382. {
  383. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  384. // Take the default processing unless we set this to something else below.
  385. *pResult = 0;
  386. // First thing - check the draw stage. If it's the control's prepaint
  387. // stage, then tell Windows we want messages for every item.
  388. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  389. {
  390. *pResult = CDRF_NOTIFYITEMDRAW;
  391. }
  392. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  393. {
  394. // This is the prepaint stage for an item. Here's where we set the
  395. // item's text color. Our return value will tell Windows to draw the
  396. // item itself, but it will use the new color we set here.
  397. // We'll cycle the colors through red, green, and light blue.
  398. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (8)!="0")
  399. pLVCD->clrText = RGB(220,0,0);
  400. else
  401. pLVCD->clrText = RGB(20,133,20);
  402. if(pLVCD->nmcd.dwItemSpec%2)
  403. pLVCD->clrTextBk = g_gridcol1;
  404. else
  405. pLVCD->clrTextBk = g_gridcol2;
  406. // Store the color back in the NMLVCUSTOMDRAW struct.
  407. // Tell Windows to paint the control itself.
  408. *pResult = CDRF_DODEFAULT;
  409. }
  410. }
  411. void FinanceForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  412. {
  413. // TODO: Add your control notification handler code here
  414. POSITION pos;
  415. pos=m_List1.GetFirstSelectedItemPosition();
  416. if(pos==NULL)return;
  417. int iItem=m_List1.GetNextSelectedItem(pos);
  418. g_id = m_List1.GetItemText (iItem, 0);
  419. *pResult = 0;
  420. }
  421. void FinanceForm::GetData()
  422. {
  423. if(g_bShowOK==0)
  424. {
  425. #ifdef LKAY_VERSION
  426. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  427. #else
  428. CString filter="status3='未取'";
  429. #endif
  430. g_sendhead.bsql=0;
  431. g_sendhead.code[0]=62;
  432. g_sendhead.tabcount=1;
  433. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  434. }
  435. else
  436. {
  437. g_sendhead.bsql=0;
  438. g_sendhead.code[0]=62;
  439. g_sendhead.tabcount=1;
  440. #ifdef LKAY_VERSION
  441. CString filter="dindantype<>'意向客户' or dindantype is null";
  442. g_pMainWnd->ProcessChatMessageRequest2(filter);
  443. #else
  444. g_pMainWnd->ProcessChatMessageRequest2(1);
  445. #endif
  446. if(g_bSendOK==0)return;
  447. }
  448. DataToArray(&m_List1array);
  449. FillGrid();
  450. }