annualfee.cpp 18 KB

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