annualfee.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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. {
  197. BOOL bFinded = 0;
  198. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  199. {
  200. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  201. {
  202. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  203. continue;
  204. }
  205. if (m_List1array.ElementAt(ii).ElementAt(12 + nAdd).Find(m_filter) != -1\
  206. || m_List1array.ElementAt(ii).ElementAt(11 + nAdd).Find(m_filter) != -1)
  207. {
  208. bFinded = 1;
  209. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  210. }
  211. else
  212. {
  213. bFinded = 0;
  214. }
  215. }
  216. }
  217. else if (type == 2)//拼音
  218. {
  219. BOOL bFinded = 0;
  220. m_filter.MakeUpper();
  221. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  222. {
  223. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  224. {
  225. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  226. continue;
  227. }
  228. if (m_List1array.ElementAt(ii).ElementAt(13 + nAdd).Find(m_filter) != -1\
  229. || m_List1array.ElementAt(ii).ElementAt(14 + nAdd).Find(m_filter) != -1)
  230. {
  231. bFinded = 1;
  232. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  233. }
  234. else
  235. {
  236. bFinded = 0;
  237. }
  238. }
  239. }
  240. else
  241. {
  242. BOOL bFinded = 0;
  243. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  244. {
  245. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  246. {
  247. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  248. continue;
  249. }
  250. 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\
  251. || m_List1array.ElementAt(ii).ElementAt(12 + nAdd).Find(m_filter) != -1\
  252. || m_List1array.ElementAt(ii).ElementAt(11 + nAdd).Find(m_filter) != -1\
  253. || m_List1array.ElementAt(ii).ElementAt(13 + nAdd).Find(m_filter) != -1\
  254. || m_List1array.ElementAt(ii).ElementAt(14 + nAdd).Find(m_filter) != -1)
  255. {
  256. bFinded = 1;
  257. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  258. }
  259. else
  260. {
  261. bFinded = 0;
  262. }
  263. }
  264. }
  265. }
  266. m_List1.m_arLabels.SetSize(count, 1);
  267. ii = count;
  268. m_List1.m_LabelCount = ii;
  269. m_List1.SetItemCountEx(ii);
  270. CString str;
  271. str.Format("单数:%d", ii);
  272. SetDlgItemText(IDC_STATIC2, str);
  273. if (!g_id.IsEmpty())
  274. {
  275. for (int i = 0; i < m_List1.GetItemCount(); i++)
  276. {
  277. if (g_id == m_List1.GetItemText(i, 0))
  278. {
  279. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  280. m_List1.EnsureVisible(i, FALSE);
  281. break;
  282. }
  283. }
  284. }
  285. }
  286. void annualfee::OnBUTclose()
  287. {
  288. // TODO: Add your control notification handler code here
  289. GetParent()->SendMessage(WM_CLOSE);
  290. }
  291. void annualfee::OnButton1()
  292. {
  293. UpdateData();
  294. m_filter.TrimLeft();
  295. m_filter.TrimRight();
  296. FillGrid();
  297. }
  298. void annualfee::OnSelchangeCombo1()
  299. {
  300. // TODO: Add your control notification handler code here
  301. SetTimer(1, 100, NULL);
  302. }
  303. void annualfee::OnTimer(UINT nIDEvent)
  304. {
  305. // TODO: Add your message handler code here and/or call default
  306. KillTimer(nIDEvent);
  307. OnButton1();
  308. }
  309. BOOL annualfee::PreTranslateMessage(MSG* pMsg)
  310. {
  311. // TODO: Add your specialized code here and/or call the base class
  312. try
  313. {
  314. if (pMsg->message == WM_KEYDOWN)
  315. {
  316. switch (pMsg->wParam)
  317. {
  318. case VK_RETURN:
  319. OnButton1();
  320. return 1;
  321. case 0x43: // copy
  322. if ((GetKeyState(VK_CONTROL) & 0x80))
  323. {
  324. GetFocus()->SendMessage(WM_COPY);
  325. return TRUE;
  326. }
  327. break;
  328. case 0x56: //Ctrl + V:
  329. if ((GetKeyState(VK_CONTROL) & 0x80))
  330. {
  331. GetFocus()->SendMessage(WM_PASTE);
  332. return TRUE;
  333. }
  334. break;
  335. case 0x58: // cut
  336. if ((GetKeyState(VK_CONTROL) & 0x80))
  337. {
  338. GetFocus()->SendMessage(WM_CUT);
  339. return TRUE;
  340. }
  341. break;
  342. case 0x5A: //undo
  343. case 0x59: //redo
  344. if ((GetKeyState(VK_CONTROL) & 0x80))
  345. {
  346. GetFocus()->SendMessage(WM_UNDO);
  347. return TRUE;
  348. }
  349. break;
  350. }
  351. }
  352. /* else if(pMsg->message==WM_LBUTTONDOWN)
  353. {
  354. CPoint pt;
  355. CRect rc,rc2;
  356. ::GetCursorPos (&pt);
  357. m_List1.GetWindowRect (rc2);
  358. pt.x-=rc2.left ;
  359. pt.y-=rc2.top ;
  360. m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
  361. rc.right =rc.left +rc2.Width ();
  362. if(rc.PtInRect (pt))
  363. return 1;
  364. }*/
  365. return MyFormView::PreTranslateMessage(pMsg);
  366. }
  367. catch (...)
  368. {
  369. }
  370. return true;
  371. }
  372. //-----------------------------------------------------------------
  373. // remark by Jeff 2014-12-12
  374. // 函数:GetNo
  375. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  376. // 参数:
  377. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  378. // array:空的数组,用来存放解析后的相片名;
  379. // 返回:
  380. // 注意:更换分隔符造成的问题,在该函数已解决;
  381. //-----------------------------------------------------------------
  382. void annualfee::GetNo(CString str, CStringArray &array)
  383. {
  384. if (!str.IsEmpty())
  385. {
  386. #ifdef USE_SEP_VEB
  387. int pos = str.Find(SEPS_VEB);
  388. #else
  389. int pos = str.Find(",");
  390. #endif
  391. while (pos != -1)
  392. {
  393. array.Add(str.Left(pos));
  394. str = str.Right(str.GetLength() - pos - 1);
  395. #ifdef USE_SEP_VEB
  396. pos = str.Find(SEPS_VEB);
  397. #else
  398. pos = str.Find(",");
  399. #endif
  400. }
  401. array.Add(str);
  402. }
  403. }
  404. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  405. /*{
  406. switch(msg)
  407. {
  408. case BFFM_INITIALIZED:
  409. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  410. break;
  411. case BFFM_SELCHANGED:
  412. {
  413. char szFileName[MAX_PATH];
  414. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  415. SHGetPathFromIDList(pidlCurrent, szFileName);
  416. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  417. }
  418. break;
  419. }
  420. return 0;
  421. }*/
  422. void annualfee::GetSavePath(CString &path)
  423. {
  424. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  425. LPITEMIDLIST pidlDesktop, pidlCurrent;
  426. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  427. == NOERROR)
  428. {
  429. BROWSEINFO bi;
  430. bi.hwndOwner = this->m_hWnd;
  431. bi.pidlRoot = pidlDesktop;
  432. bi.pszDisplayName = lpszDisplayName;
  433. bi.lpszTitle = "\n文档保存的目录:";
  434. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  435. bi.lpfn = BrowseProc;
  436. bi.lParam = 0;
  437. bi.iImage = 0;
  438. pidlCurrent = SHBrowseForFolder(&bi);
  439. SHGetPathFromIDList(pidlCurrent, szFileName);
  440. path = szFileName;
  441. }
  442. }
  443. int annualfee::FindArray(CStringArray *pArray, CString *pStr)
  444. {
  445. for (int i = 0; i < pArray->GetSize(); i++)
  446. {
  447. if (pArray->ElementAt(i) == *pStr)
  448. return i;
  449. }
  450. return -1;
  451. }
  452. void annualfee::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  453. {
  454. // TODO: Add your control notification handler code here
  455. OnBUTmodify();
  456. *pResult = 0;
  457. }
  458. void annualfee::OnRdblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  459. {
  460. // TODO: Add your control notification handler code here
  461. OnBUTmodify2();
  462. *pResult = 0;
  463. }
  464. void annualfee::OnButton2()
  465. {
  466. // TODO: Add your control notification handler code here
  467. UpdateData();
  468. m_filter.TrimLeft();
  469. m_filter.TrimRight();
  470. FillGrid(2);
  471. }
  472. void annualfee::OnButton3()
  473. {
  474. // TODO: Add your control notification handler code here
  475. UpdateData();
  476. m_filter.TrimLeft();
  477. m_filter.TrimRight();
  478. FillGrid(1);
  479. }
  480. void annualfee::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  481. {
  482. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  483. // Take the default processing unless we set this to something else below.
  484. *pResult = 0;
  485. // First thing - check the draw stage. If it's the control's prepaint
  486. // stage, then tell Windows we want messages for every item.
  487. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  488. {
  489. *pResult = CDRF_NOTIFYITEMDRAW;
  490. }
  491. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  492. {
  493. // This is the prepaint stage for an item. Here's where we set the
  494. // item's text color. Our return value will tell Windows to draw the
  495. // item itself, but it will use the new color we set here.
  496. // We'll cycle the colors through red, green, and light blue.
  497. COLORREF crText;
  498. int pos = pLVCD->nmcd.dwItemSpec;
  499. if (pos % 2)
  500. pLVCD->clrTextBk = g_gridcol1;
  501. else
  502. pLVCD->clrTextBk = g_gridcol2;
  503. while (m_List1.m_arLabels.ElementAt(pos).ElementAt(0).IsEmpty())
  504. {
  505. pos--;
  506. if (pos < 1)break;
  507. }
  508. if (atoi(m_List1.m_arLabels.ElementAt(pos).ElementAt(16)) == 0)
  509. crText = RGB(20, 133, 20);
  510. else if (atoi(m_List1.m_arLabels.ElementAt(pos).ElementAt(16)) == 1)
  511. crText = RGB(255, 255, 0);
  512. else
  513. crText = RGB(220, 0, 0);
  514. // Store the color back in the NMLVCUSTOMDRAW struct.
  515. pLVCD->clrText = crText;
  516. // Tell Windows to paint the control itself.
  517. *pResult = CDRF_DODEFAULT;
  518. }
  519. }
  520. void annualfee::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  521. {
  522. // TODO: Add your control notification handler code here
  523. POSITION pos;
  524. pos = m_List1.GetFirstSelectedItemPosition();
  525. if (pos == NULL)
  526. {
  527. m_bz = ""; UpdateData(0);
  528. return;
  529. }
  530. int iItem = m_List1.GetNextSelectedItem(pos);
  531. g_id = m_List1.GetItemText(iItem, 0);
  532. while (g_id == "")
  533. {
  534. iItem--;
  535. g_id = m_List1.GetItemText(iItem, 0);
  536. }
  537. m_bz = m_List1.GetItemText(iItem, 15);
  538. UpdateData(0);
  539. *pResult = 0;
  540. }
  541. void annualfee::HidePrice()
  542. {
  543. }
  544. void annualfee::OnBUTexport()
  545. {
  546. UpdateData();
  547. m_filter.TrimLeft();
  548. m_filter.TrimRight();
  549. FillGrid(3);
  550. }
  551. void annualfee::OnBUTToPhotoPrint()
  552. {
  553. // TODO: Add your control notification handler code here
  554. ListToXLS(&m_List1, "c:\\服务费.xls", 0);
  555. }
  556. void annualfee::GetData()
  557. {
  558. CString filter = "time2<>''";
  559. g_sendhead.bsql = 0;
  560. g_sendhead.code[0] = 228;
  561. g_sendhead.tabcount = 1;
  562. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  563. DataToArray(&m_List1array);
  564. }
  565. void annualfee::OnBUTburncd2()
  566. {
  567. // TODO: Add your control notification handler code here
  568. if (IsHasRights2new(16) == 0)return;
  569. POSITION pos;
  570. pos = m_List1.GetFirstSelectedItemPosition();
  571. if (pos == NULL)
  572. {
  573. AfxMessageBox("请先选中要交费的客人与年度!", MB_ICONINFORMATION);
  574. return;
  575. }
  576. int iItem = m_List1.GetNextSelectedItem(pos);
  577. int iItemBak = iItem;
  578. CString id = m_List1.GetItemText(iItem, 0);
  579. while (id == "")
  580. {
  581. iItem--;
  582. id = m_List1.GetItemText(iItem, 0);
  583. }
  584. for (int i = iItem; i < iItemBak; i++)
  585. {
  586. if (m_List1.GetItemText(i, 7) != "已交")
  587. {
  588. AfxMessageBox("请先交清以往年度!", MB_ICONINFORMATION);
  589. return;
  590. }
  591. }
  592. CString name = m_List1.GetItemText(iItem, 1) + "," + m_List1.GetItemText(iItem, 2);
  593. iItem = iItemBak;
  594. CString year = m_List1.GetItemText(iItem, 5); CString date = m_List1.GetItemText(iItem, 8);
  595. name.TrimLeft(",");
  596. name.TrimRight(",");
  597. name = "客人:" + name;
  598. CString str;
  599. str.Format("%s\r\n年度:%s\r\n确认客人名称与交费年度无误? 是否继续?", name, year);
  600. if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
  601. return;
  602. CString sql;
  603. str.Format("%s\r\n年度:%s\r\n客人年费是否交清?", name, year);
  604. if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
  605. sql.Format("delete from annualfee where [id]='%s' and [date]='%s'", id, date);
  606. else
  607. 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);
  608. g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql);
  609. if (g_bSendOK == 0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  610. GetData(); FillGrid();
  611. }
  612. void annualfee::OnBUTmodify2()
  613. {
  614. // TODO: Add your control notification handler code here
  615. UpdateData();
  616. POSITION pos;
  617. pos = m_List1.GetFirstSelectedItemPosition();
  618. if (pos == NULL)
  619. {
  620. return;
  621. }
  622. int iItem = m_List1.GetNextSelectedItem(pos);
  623. CString id = m_List1.GetItemText(iItem, 0);
  624. while (id == "")
  625. {
  626. iItem--;
  627. id = m_List1.GetItemText(iItem, 0);
  628. }
  629. CString sql;
  630. sql.Format("update dindan set bz='%s' where id='%s'", m_bz, id);
  631. g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql);
  632. if (g_bSendOK == 0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  633. GetData(); FillGrid();
  634. }
  635. void annualfee::OnBUTburncd()
  636. {
  637. // TODO: Add your control notification handler code here
  638. POSITION pos;
  639. pos = m_List1.GetFirstSelectedItemPosition();
  640. if (pos == NULL)
  641. {
  642. return;
  643. }
  644. int iItem = m_List1.GetNextSelectedItem(pos);
  645. CString id = m_List1.GetItemText(iItem, 0);
  646. while (id == "")
  647. {
  648. iItem--;
  649. id = m_List1.GetItemText(iItem, 0);
  650. }
  651. Booking2 dlg;
  652. dlg.m_id = id;
  653. dlg.m_bModify = 1;
  654. if (dlg.DoModal() == IDOK)
  655. {
  656. GetData();
  657. FillGrid();
  658. }
  659. }
  660. void annualfee::OnBUTmodify()
  661. {
  662. // TODO: Add your control notification handler code here
  663. POSITION pos;
  664. pos = m_List1.GetFirstSelectedItemPosition();
  665. if (pos == NULL)
  666. {
  667. return;
  668. }
  669. int iItem = m_List1.GetNextSelectedItem(pos);
  670. CString m_id = m_List1.GetItemText(iItem, 0);
  671. while (m_id == "")
  672. {
  673. iItem--;
  674. m_id = m_List1.GetItemText(iItem, 0);
  675. }
  676. char no[100];
  677. memset(no, 0, 100);
  678. #ifdef VC60
  679. strcpy(no, m_id);
  680. #else
  681. _tcscpy_s(no, 100, m_id);
  682. #endif
  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";
  691. ::DeleteFile(path); // 删除客户端目录下的1.jpg;
  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. }