annualfee.cpp 19 KB

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