annualfee.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. // annualfee.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "annualfee.h"
  6. #include "MyMdi.H"
  7. #include "Booking2.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. #pragma comment(lib, "Shlwapi.lib")
  14. /////////////////////////////////////////////////////////////////////////////
  15. // annualfee
  16. IMPLEMENT_DYNCREATE(annualfee, MyFormView)
  17. annualfee::annualfee()
  18. : MyFormView(annualfee::IDD)
  19. {
  20. //{{AFX_DATA_INIT(annualfee)
  21. m_filter = _T("");
  22. m_bz = _T("");
  23. //}}AFX_DATA_INIT
  24. }
  25. annualfee::~annualfee()
  26. {
  27. }
  28. void annualfee::DoDataExchange(CDataExchange* pDX)
  29. {
  30. MyFormView::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(annualfee)
  32. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  33. DDX_Control(pDX, IDC_LIST2, m_List1);
  34. DDX_Control(pDX, IDC_STATIC1, m_static1);
  35. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  36. DDX_Text(pDX, IDC_EDIT1, m_bz);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(annualfee, MyFormView)
  40. //{{AFX_MSG_MAP(annualfee)
  41. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  42. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  43. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  44. ON_WM_TIMER()
  45. ON_BN_CLICKED(IDC_BUTmodify, OnBUTmodify)
  46. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  47. ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
  48. ON_BN_CLICKED(IDC_BUTmodify2, OnBUTmodify2)
  49. ON_NOTIFY(NM_RDBLCLK, IDC_LIST2, OnRdblclkList2)
  50. ON_BN_CLICKED(IDC_BUTToPhotoPrint, OnBUTToPhotoPrint)
  51. ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
  52. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  53. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  54. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  55. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  56. //}}AFX_MSG_MAP
  57. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // annualfee diagnostics
  61. #ifdef _DEBUG
  62. void annualfee::AssertValid() const
  63. {
  64. MyFormView::AssertValid();
  65. }
  66. void annualfee::Dump(CDumpContext& dc) const
  67. {
  68. MyFormView::Dump(dc);
  69. }
  70. #endif //_DEBUG
  71. /////////////////////////////////////////////////////////////////////////////
  72. // annualfee message handlers
  73. void annualfee::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. int idarray[]={IDC_BUTburncd2,IDC_BUTToPhotoPrint,IDC_BUTclose};
  86. int idcount=3;
  87. int btnwid;
  88. CRect prerc;
  89. int a = 0;
  90. for(a=idcount-2; a>=0; a--)
  91. {
  92. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  93. ScreenToClient(prerc);
  94. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  95. ScreenToClient(rc2);
  96. btnwid=rc2.Width ();
  97. rc2.right =prerc.left ;
  98. rc2.left =rc2.right -btnwid;
  99. GetDlgItem(idarray[a])->MoveWindow (rc2);
  100. }
  101. int idarray2[]={IDC_BUTTON1,IDC_BUTTON2,IDC_BUTTON3,IDC_BUTexport,IDC_BUTToPhotoPrint};
  102. idcount=3;
  103. for( a=1; a<idcount; a++)
  104. {
  105. GetDlgItem(idarray2[a-1])->GetWindowRect (prerc);
  106. ScreenToClient(prerc);
  107. GetDlgItem(idarray2[a])->GetWindowRect (rc2);
  108. ScreenToClient(rc2);
  109. btnwid=rc2.Width ();
  110. rc2.left =prerc.right ;
  111. rc2.right =rc2.left +btnwid;
  112. GetDlgItem(idarray2[a])->MoveWindow (rc2);
  113. }
  114. m_static1.SetFont (&g_titlefont);
  115. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;定单日期,100;接单人,100;年度,100;应交日期,100;是否交费,100;交费日期,100;收款人,100;合同,100;男宾电话,100;女宾电话,100" );
  116. m_List1.LoadColumnInfo (302);
  117. m_List1.m_bSortSupport=0;
  118. GetData();
  119. for(int i=0; i<g_userarray.GetSize (); i++)
  120. {
  121. m_combo1.AddString (g_userarray.ElementAt (i).ElementAt (1) );
  122. }
  123. FillGrid();
  124. m_combo1.GetWindowRect (rc2);
  125. ScreenToClient(rc2);
  126. rc2.bottom +=200;
  127. m_combo1.MoveWindow (rc2);
  128. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  129. SetComboHei(&m_combo1, rc2.Height ());
  130. GetDlgItem(IDC_BUTburncd2)->EnableWindow(IsHasRights2new(16));
  131. GetDlgItem(IDC_BUTmodify2)->EnableWindow(IsHasRights2new(16));
  132. }
  133. void annualfee::FillGrid(BOOL bStatus)
  134. {
  135. m_List1.DeleteAllItems2 ();
  136. int ii=0;
  137. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  138. int count=0;
  139. if(m_filter.IsEmpty ()||bStatus)
  140. {
  141. if(bStatus==1)
  142. {
  143. BOOL bFinded=0;
  144. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  145. {
  146. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  147. {
  148. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  149. continue;
  150. }
  151. if(m_List1array.ElementAt (ii).ElementAt (16)=="1" )
  152. {
  153. bFinded=1;
  154. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  155. }
  156. else
  157. {
  158. bFinded=0;
  159. }
  160. }
  161. }
  162. else if(bStatus==2)
  163. {
  164. BOOL bFinded=0;
  165. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  166. {
  167. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  168. {
  169. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  170. continue;
  171. }
  172. if(m_List1array.ElementAt (ii).ElementAt (16)=="2" )
  173. {
  174. bFinded=1;
  175. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  176. }
  177. else
  178. {
  179. bFinded=0;
  180. }
  181. }
  182. }
  183. else
  184. {
  185. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  186. {
  187. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  188. }
  189. }
  190. }
  191. else
  192. {
  193. int nAdd=0;
  194. int type=GetType(m_filter);
  195. if(type==1)//电话
  196. {BOOL bFinded=0;
  197. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  198. {
  199. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  200. {
  201. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  202. continue;
  203. }
  204. if(m_List1array.ElementAt (ii).ElementAt (12+nAdd).Find (m_filter)!=-1\
  205. || m_List1array.ElementAt (ii).ElementAt (11+nAdd).Find (m_filter)!=-1 )
  206. {
  207. bFinded=1;
  208. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  209. }
  210. else
  211. {
  212. bFinded=0;
  213. }
  214. }
  215. }
  216. else if(type==2)//拼音
  217. {BOOL bFinded=0;
  218. m_filter.MakeUpper ();
  219. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  220. {
  221. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  222. {
  223. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  224. continue;
  225. }
  226. if(m_List1array.ElementAt (ii).ElementAt (13+nAdd).Find (m_filter)!=-1\
  227. || m_List1array.ElementAt (ii).ElementAt (14+nAdd).Find (m_filter)!=-1 )
  228. {
  229. bFinded=1;
  230. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  231. }
  232. else
  233. {
  234. bFinded=0;
  235. }
  236. }
  237. }
  238. else
  239. {
  240. BOOL bFinded=0;
  241. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  242. {
  243. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  244. {
  245. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  246. continue;
  247. }
  248. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||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 (4).Find (m_filter)!=-1\
  249. || m_List1array.ElementAt (ii).ElementAt (12+nAdd).Find (m_filter)!=-1\
  250. || m_List1array.ElementAt (ii).ElementAt (11+nAdd).Find (m_filter)!=-1\
  251. || m_List1array.ElementAt (ii).ElementAt (13+nAdd).Find (m_filter)!=-1\
  252. || m_List1array.ElementAt (ii).ElementAt (14+nAdd).Find (m_filter)!=-1 )
  253. {
  254. bFinded=1;
  255. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  256. }
  257. else
  258. {
  259. bFinded=0;
  260. }
  261. }
  262. }
  263. }
  264. m_List1.m_arLabels.SetSize(count, 1);
  265. ii=count;
  266. m_List1.m_LabelCount=ii;
  267. m_List1.SetItemCountEx (ii);
  268. CString str;
  269. str.Format ("单数:%d", ii);
  270. SetDlgItemText(IDC_STATIC2, str);
  271. if(!g_id.IsEmpty ())
  272. {
  273. for(int i=0; i<m_List1.GetItemCount (); i++)
  274. {
  275. if(g_id==m_List1.GetItemText (i, 0))
  276. {
  277. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  278. m_List1.EnsureVisible(i,FALSE);
  279. break;
  280. }
  281. }
  282. }
  283. }
  284. void annualfee::OnBUTclose()
  285. {
  286. // TODO: Add your control notification handler code here
  287. GetParent()->SendMessage(WM_CLOSE);
  288. }
  289. void annualfee::OnButton1()
  290. {
  291. // TODO: Add your control notification handler code here
  292. /* CString oldid="";
  293. BOOL bOK=1;
  294. CString str;
  295. for(int i=0; i<m_List1.GetItemCount (); i++)
  296. {
  297. if(!m_List1.GetItemText (i, 0).IsEmpty ())
  298. {
  299. if(oldid!=m_List1.GetItemText (i, 0))
  300. {
  301. if(bOK && i>0)
  302. {
  303. CString sql;
  304. sql= "update dindan set status3='OK' where id='"+oldid+"'";
  305. g_sendhead.bsql=1;
  306. g_pMainWnd->ProcessChatMessageRequest2(sql);
  307. str+=oldid;
  308. }
  309. bOK=1;
  310. oldid=m_List1.GetItemText (i, 0);
  311. }
  312. }
  313. if(m_List1.GetItemText (i, 11)!="OK")
  314. bOK=0;
  315. }
  316. MessageBox(str);*/
  317. UpdateData();
  318. m_filter.TrimLeft ();
  319. m_filter.TrimRight ();
  320. FillGrid();
  321. }
  322. void annualfee::OnSelchangeCombo1()
  323. {
  324. // TODO: Add your control notification handler code here
  325. SetTimer(1, 100, NULL);
  326. }
  327. void annualfee::OnTimer(UINT nIDEvent)
  328. {
  329. // TODO: Add your message handler code here and/or call default
  330. KillTimer(nIDEvent);
  331. OnButton1();
  332. }
  333. BOOL annualfee::PreTranslateMessage(MSG* pMsg)
  334. {
  335. // TODO: Add your specialized code here and/or call the base class
  336. try
  337. {
  338. if(pMsg->message==WM_KEYDOWN)
  339. {
  340. switch (pMsg->wParam)
  341. {
  342. case VK_RETURN:
  343. OnButton1();
  344. return 1;
  345. case 0x43: // copy
  346. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  347. {
  348. GetFocus()->SendMessage(WM_COPY);
  349. return TRUE;
  350. }
  351. break;
  352. case 0x56: //Ctrl + V:
  353. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  354. {
  355. GetFocus()->SendMessage(WM_PASTE);
  356. return TRUE;
  357. }
  358. break;
  359. case 0x58: // cut
  360. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  361. {
  362. GetFocus()->SendMessage(WM_CUT);
  363. return TRUE;
  364. }
  365. break;
  366. case 0x5A: //undo
  367. case 0x59: //redo
  368. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  369. {
  370. GetFocus()->SendMessage(WM_UNDO);
  371. return TRUE;
  372. }
  373. break;
  374. }
  375. }
  376. /* else if(pMsg->message==WM_LBUTTONDOWN)
  377. {
  378. CPoint pt;
  379. CRect rc,rc2;
  380. ::GetCursorPos (&pt);
  381. m_List1.GetWindowRect (rc2);
  382. pt.x-=rc2.left ;
  383. pt.y-=rc2.top ;
  384. m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
  385. rc.right =rc.left +rc2.Width ();
  386. if(rc.PtInRect (pt))
  387. return 1;
  388. }*/
  389. return MyFormView::PreTranslateMessage(pMsg);
  390. }
  391. catch(...)
  392. {
  393. }
  394. }
  395. void annualfee::GetNo(CString str, CStringArray &array)
  396. {
  397. if(!str.IsEmpty ())
  398. {
  399. int pos=str.Find (",");
  400. while(pos!=-1)
  401. {
  402. array.Add (str.Left (pos));
  403. str=str.Right (str.GetLength ()-pos-1);
  404. pos=str.Find (",");
  405. }
  406. array.Add(str);
  407. }
  408. }
  409. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  410. /*{
  411. switch(msg)
  412. {
  413. case BFFM_INITIALIZED:
  414. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  415. break;
  416. case BFFM_SELCHANGED:
  417. {
  418. char szFileName[MAX_PATH];
  419. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  420. SHGetPathFromIDList(pidlCurrent, szFileName);
  421. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  422. }
  423. break;
  424. }
  425. return 0;
  426. }*/
  427. void annualfee::GetSavePath(CString &path)
  428. {
  429. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  430. LPITEMIDLIST pidlDesktop, pidlCurrent;
  431. if(SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  432. == NOERROR)
  433. {
  434. BROWSEINFO bi;
  435. bi.hwndOwner = this->m_hWnd;
  436. bi.pidlRoot = pidlDesktop;
  437. bi.pszDisplayName = lpszDisplayName;
  438. bi.lpszTitle = "\n文档保存的目录:";
  439. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS ;
  440. bi.lpfn = BrowseProc;
  441. bi.lParam = 0;
  442. bi.iImage = 0;
  443. pidlCurrent = SHBrowseForFolder(&bi);
  444. SHGetPathFromIDList(pidlCurrent, szFileName);
  445. path = szFileName;
  446. }
  447. }
  448. int annualfee::FindArray(CStringArray *pArray, CString *pStr)
  449. {
  450. for(int i=0; i<pArray->GetSize (); i++)
  451. {
  452. if(pArray->ElementAt (i)==*pStr)
  453. return i;
  454. }
  455. return -1;
  456. }
  457. void annualfee::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  458. {
  459. // TODO: Add your control notification handler code here
  460. OnBUTmodify();
  461. *pResult = 0;
  462. }
  463. void annualfee::OnRdblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  464. {
  465. // TODO: Add your control notification handler code here
  466. OnBUTmodify2();
  467. *pResult = 0;
  468. }
  469. void annualfee::OnButton2()
  470. {
  471. // TODO: Add your control notification handler code here
  472. UpdateData();
  473. m_filter.TrimLeft ();
  474. m_filter.TrimRight ();
  475. FillGrid(2);
  476. }
  477. void annualfee::OnButton3()
  478. {
  479. // TODO: Add your control notification handler code here
  480. UpdateData();
  481. m_filter.TrimLeft ();
  482. m_filter.TrimRight ();
  483. FillGrid(1);
  484. }
  485. void annualfee::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  486. {
  487. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  488. // Take the default processing unless we set this to something else below.
  489. *pResult = 0;
  490. // First thing - check the draw stage. If it's the control's prepaint
  491. // stage, then tell Windows we want messages for every item.
  492. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  493. {
  494. *pResult = CDRF_NOTIFYITEMDRAW;
  495. }
  496. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  497. {
  498. // This is the prepaint stage for an item. Here's where we set the
  499. // item's text color. Our return value will tell Windows to draw the
  500. // item itself, but it will use the new color we set here.
  501. // We'll cycle the colors through red, green, and light blue.
  502. COLORREF crText;
  503. int pos=pLVCD->nmcd.dwItemSpec;
  504. if(pos%2)
  505. pLVCD->clrTextBk = g_gridcol1;
  506. else
  507. pLVCD->clrTextBk = g_gridcol2;
  508. while(m_List1.m_arLabels.ElementAt (pos).ElementAt (0).IsEmpty ())
  509. {
  510. pos--;
  511. if(pos<1)break;
  512. }
  513. if(atoi(m_List1.m_arLabels.ElementAt (pos).ElementAt (16))==0)
  514. crText = RGB(20,133,20);
  515. else if(atoi(m_List1.m_arLabels.ElementAt (pos).ElementAt (16))==1)
  516. crText = RGB(255,255,0);
  517. else
  518. crText = RGB(220,0,0);
  519. // Store the color back in the NMLVCUSTOMDRAW struct.
  520. pLVCD->clrText = crText;
  521. // Tell Windows to paint the control itself.
  522. *pResult = CDRF_DODEFAULT;
  523. }
  524. }
  525. void annualfee::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  526. {
  527. // TODO: Add your control notification handler code here
  528. POSITION pos;
  529. pos=m_List1.GetFirstSelectedItemPosition();
  530. if(pos==NULL)
  531. {
  532. m_bz="";UpdateData(0);
  533. return;
  534. }
  535. int iItem=m_List1.GetNextSelectedItem(pos);
  536. g_id=m_List1.GetItemText (iItem, 0);
  537. while(g_id=="")
  538. {
  539. iItem--;
  540. g_id=m_List1.GetItemText (iItem, 0);
  541. }
  542. m_bz=m_List1.GetItemText (iItem, 15);
  543. UpdateData(0);
  544. *pResult = 0;
  545. }
  546. void annualfee::HidePrice()
  547. {
  548. }
  549. void annualfee::OnBUTexport()
  550. {
  551. UpdateData();
  552. m_filter.TrimLeft ();
  553. m_filter.TrimRight ();
  554. FillGrid(3);
  555. }
  556. void annualfee::OnBUTToPhotoPrint()
  557. {
  558. // TODO: Add your control notification handler code here
  559. ListToXLS(&m_List1, "c:\\服务费.xls", 0);
  560. }
  561. void annualfee::GetData()
  562. {
  563. CString filter="time2<>''";
  564. g_sendhead.bsql=0;
  565. g_sendhead.code[0]=228;
  566. g_sendhead.tabcount=1;
  567. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  568. DataToArray(&m_List1array);
  569. }
  570. void annualfee::OnBUTburncd2()
  571. {
  572. // TODO: Add your control notification handler code here
  573. if(IsHasRights2new(16)==0)return;
  574. POSITION pos;
  575. pos=m_List1.GetFirstSelectedItemPosition();
  576. if(pos==NULL)
  577. {
  578. AfxMessageBox("请先选中要交费的客人与年度!", MB_ICONINFORMATION);
  579. return;
  580. }
  581. int iItem=m_List1.GetNextSelectedItem(pos);
  582. int iItemBak=iItem;
  583. CString id=m_List1.GetItemText (iItem, 0);
  584. while(id=="")
  585. {
  586. iItem--;
  587. id=m_List1.GetItemText (iItem, 0);
  588. }
  589. for(int i=iItem; i<iItemBak; i++)
  590. {
  591. if(m_List1.GetItemText (i, 7)!="已交")
  592. {
  593. AfxMessageBox("请先交清以往年度!", MB_ICONINFORMATION);
  594. return;
  595. }
  596. }
  597. CString name=m_List1.GetItemText (iItem, 1)+","+m_List1.GetItemText (iItem, 2);
  598. iItem=iItemBak;
  599. CString year=m_List1.GetItemText (iItem, 5); CString date=m_List1.GetItemText (iItem, 8);
  600. name.TrimLeft (",");
  601. name.TrimRight (",");
  602. name="客人:"+name;
  603. CString str;
  604. str.Format ("%s\r\n年度:%s\r\n确认客人名称与交费年度无误? 是否继续?", name, year);
  605. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  606. return;
  607. CString sql;
  608. str.Format ("%s\r\n年度:%s\r\n客人年费是否交清?", name, year);
  609. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  610. sql.Format("delete from annualfee where [id]='%s' and [date]='%s'",id, date);
  611. else
  612. sql.Format("delete from annualfee where [id]='%s' and [date]='%s'***insert into annualfee([id],[year],[date],[clerk])values('%s','%s','%s','%s')",id, date, id, year, g_date, g_user.name);
  613. g_sendhead.bsql=1;g_pMainWnd->ProcessChatMessageRequest2(sql);
  614. if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  615. GetData();FillGrid();
  616. }
  617. void annualfee::OnBUTmodify2()
  618. {
  619. // TODO: Add your control notification handler code here
  620. UpdateData();
  621. POSITION pos;
  622. pos=m_List1.GetFirstSelectedItemPosition();
  623. if(pos==NULL)
  624. {
  625. return;
  626. }
  627. int iItem=m_List1.GetNextSelectedItem(pos);
  628. CString id=m_List1.GetItemText (iItem, 0);
  629. while(id=="")
  630. {
  631. iItem--;
  632. id=m_List1.GetItemText (iItem, 0);
  633. }
  634. CString sql;
  635. sql.Format("update dindan set bz='%s' where id='%s'", m_bz, id);
  636. g_sendhead.bsql=1;g_pMainWnd->ProcessChatMessageRequest2(sql);
  637. if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  638. GetData();FillGrid();
  639. }
  640. void annualfee::OnBUTburncd()
  641. {
  642. // TODO: Add your control notification handler code here
  643. POSITION pos;
  644. pos=m_List1.GetFirstSelectedItemPosition();
  645. if(pos==NULL)
  646. {
  647. return;
  648. }
  649. int iItem=m_List1.GetNextSelectedItem(pos);
  650. CString id=m_List1.GetItemText (iItem, 0);
  651. while(id=="")
  652. {
  653. iItem--;
  654. id=m_List1.GetItemText (iItem, 0);
  655. }
  656. Booking2 dlg;
  657. dlg.m_id = id;
  658. dlg.m_bModify =1;
  659. if(dlg.DoModal ()==IDOK)
  660. {
  661. GetData();
  662. FillGrid();
  663. }
  664. }
  665. void annualfee::OnBUTmodify()
  666. {
  667. // TODO: Add your control notification handler code here
  668. POSITION pos;
  669. pos=m_List1.GetFirstSelectedItemPosition();
  670. if(pos==NULL)
  671. {
  672. return;
  673. }
  674. int iItem=m_List1.GetNextSelectedItem(pos);
  675. CString m_id=m_List1.GetItemText (iItem, 0);
  676. while(m_id=="")
  677. {
  678. iItem--;
  679. m_id=m_List1.GetItemText (iItem, 0);
  680. }
  681. char no[100];
  682. memset(no, 0, 100);
  683. strcpy(no, m_id);
  684. g_nSendCode=38;
  685. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)no, 100);
  686. g_nSendCode=0;
  687. if(g_bSendOK==0)
  688. {
  689. return;
  690. }
  691. CString path=g_mainpath+"\\1.jpg"; ::DeleteFile(path);
  692. CFile fp;
  693. fp.Open(path, CFile::modeCreate|CFile::modeWrite);
  694. fp.Write(g_pData, g_nLeng);
  695. fp.Close();
  696. ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWMAXIMIZED);
  697. }