annualfee.cpp 18 KB

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