IncomeInput2.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. // IncomeInput2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "IncomeInput2.h"
  6. #include "MyMdi.H"
  7. #include "SPLBDlg.h"
  8. #include "AddIncome.h"
  9. #include "Singleincomemoney.h"
  10. #include "SearchFilter4.h"
  11. #include "SendMsgDlg.h"
  12. #include "Other2SaleChart.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // IncomeInput2 IDC_COMBO4
  20. IMPLEMENT_DYNCREATE(IncomeInput2, MyFormView)
  21. IncomeInput2::IncomeInput2()
  22. : MyFormView(IncomeInput2::IDD)
  23. {
  24. //{{AFX_DATA_INIT(IncomeInput2)
  25. m_bz = _T("");
  26. m_date = g_date;
  27. m_money = _T("");
  28. m_name = _T("");
  29. m_renyuan1 = _T("");
  30. m_renyuan2 = g_user.name;
  31. m_year = atoi(g_date.Mid(0, 4));
  32. m_month = atoi(g_date.Mid(5, 2));
  33. m_day = atoi(g_date.Mid(8, 2));
  34. m_filter = _T("");
  35. m_bInit = 0;
  36. //}}AFX_DATA_INIT
  37. }
  38. IncomeInput2::~IncomeInput2()
  39. {
  40. }
  41. void IncomeInput2::DoDataExchange(CDataExchange* pDX)
  42. {
  43. MyFormView::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(IncomeInput2)
  45. DDX_Control(pDX, IDC_BUTTON5, m_btn);
  46. DDX_Control(pDX, IDC_COMBO7, m_combo1);
  47. DDX_Control(pDX, IDC_COMBO4, m_combobz);
  48. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  49. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  50. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  51. DDX_Control(pDX, IDC_COMBO2, m_comboren);
  52. DDX_Control(pDX, IDC_EDITmoney, m_editctrl1);
  53. DDX_Control(pDX, IDC_LIST2, m_List1);
  54. DDX_Control(pDX, IDC_STATIC1, m_static1);
  55. DDX_Text(pDX, IDC_EDITbz, m_bz);
  56. DDV_MaxChars(pDX, m_bz, 1000);
  57. DDX_Text(pDX, IDC_EDITdate, m_date);
  58. DDX_Text(pDX, IDC_EDITmoney, m_money);
  59. DDX_Text(pDX, IDC_EDITname, m_name);
  60. DDX_Text(pDX, IDC_EDITrenyuan1, m_renyuan1);
  61. DDX_Text(pDX, IDC_EDITrenyuan2, m_renyuan2);
  62. DDX_Text(pDX, IDC_EDITyear, m_year);
  63. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  64. DDX_Text(pDX, IDC_EDITmonth, m_month);
  65. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  66. DDX_Text(pDX, IDC_EDITday, m_day);
  67. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  68. DDX_CBString(pDX, IDC_COMBO7, m_filter);
  69. //}}AFX_DATA_MAP
  70. }
  71. BEGIN_MESSAGE_MAP(IncomeInput2, MyFormView)
  72. //{{AFX_MSG_MAP(IncomeInput2)
  73. ON_BN_CLICKED(IDC_BUTsave, OnBUTsave)
  74. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  75. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  76. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  77. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  78. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  79. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  80. ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
  81. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  82. ON_BN_CLICKED(IDC_BUTsave2, OnBUTsave2)
  83. ON_BN_CLICKED(IDC_BUTpay, OnBUTpay)
  84. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  85. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  86. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  87. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  88. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  89. //}}AFX_MSG_MAP
  90. END_MESSAGE_MAP()
  91. /////////////////////////////////////////////////////////////////////////////
  92. // IncomeInput2 diagnostics
  93. #ifdef _DEBUG
  94. void IncomeInput2::AssertValid() const
  95. {
  96. MyFormView::AssertValid();
  97. }
  98. void IncomeInput2::Dump(CDumpContext& dc) const
  99. {
  100. MyFormView::Dump(dc);
  101. }
  102. #endif //_DEBUG
  103. /////////////////////////////////////////////////////////////////////////////
  104. // IncomeInput2 message handlers
  105. void IncomeInput2::OnInitialUpdate()
  106. {
  107. MyFormView::OnInitialUpdate();
  108. // TODO: Add your specialized code here and/or call the base class
  109. CMyMdi Mdi;
  110. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  111. if (IsHasRights2new(49) == 0)
  112. {
  113. GetDlgItem(IDC_BUTTON1)->EnableWindow(0);
  114. }
  115. m_btn.SetIcon(IDI_ICONchart);
  116. m_btn.DrawTransparent();
  117. // Here we create the outbar control using the splitter as its parent
  118. // and setting its id to the first pane.
  119. CRect rc2;
  120. GetWindowRect(rc2);
  121. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  122. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  123. int idarray[] = { IDC_BUTsave, IDC_BUTpay, IDC_BUTsave2, IDC_BUTdel, IDC_BUTprint, IDC_BUTclose };
  124. int idcount = 6;
  125. int btnwid;
  126. CRect prerc;
  127. for (int a = idcount - 2; a >= 0; a--)
  128. {
  129. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  130. ScreenToClient(prerc);
  131. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  132. ScreenToClient(rc2);
  133. btnwid = rc2.Width();
  134. rc2.right = prerc.left;
  135. rc2.left = rc2.right - btnwid;
  136. GetDlgItem(idarray[a])->MoveWindow(rc2);
  137. }
  138. m_comboren.RefDroppedWidth();
  139. GetDlgItem(IDC_BUTdel)->EnableWindow(IsHasRights2new(58));
  140. GetDlgItem(IDC_BUTsave2)->EnableWindow(IsHasRights2new(66));
  141. m_static1.SetFont(&g_titlefont);
  142. m_List1.SetHeadings("编号,100;客人,100;手机,100;项目名称, 100;应付, 100;已付,100;欠款,100;经手人,100;开单人,100;日期, 100;二销类别,100;备注,100;数量,100");
  143. m_List1.LoadColumnInfo(141);
  144. m_comboren.GetWindowRect(rc2);
  145. ScreenToClient(rc2);
  146. rc2.bottom += 400;
  147. m_comboren.MoveWindow(rc2);
  148. m_combobz.GetWindowRect(rc2);
  149. ScreenToClient(rc2);
  150. rc2.bottom += 400;
  151. m_combobz.MoveWindow(rc2);
  152. m_combo1.GetWindowRect(rc2);
  153. ScreenToClient(rc2);
  154. rc2.bottom += 200;
  155. m_combo1.MoveWindow(rc2);
  156. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  157. SetComboHei(&m_combo1, rc2.Height());
  158. for (int i = 0; i < g_userarray.GetSize(); i++)
  159. m_comboren.AddString(g_userarray.ElementAt(i).ElementAt(1));
  160. m_bInit = 1;
  161. GetData();
  162. }
  163. void IncomeInput2::FillGrid()
  164. {
  165. if (g_bSearchFilter)
  166. {
  167. m_List1.DeleteAllItems2();
  168. int ii = 0;
  169. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  170. int count = 0;
  171. {
  172. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  173. {
  174. if (g_filterdate1 != "")
  175. {
  176. if (m_List1array.ElementAt(ii).ElementAt(9) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(9) > g_filterdate2)
  177. continue;
  178. }
  179. if (g_waiter1 != "")
  180. {
  181. if (m_List1array.ElementAt(ii).ElementAt(3) != g_waiter1)
  182. continue;
  183. }
  184. if (g_waiter2 != "")
  185. {
  186. if (m_List1array.ElementAt(ii).ElementAt(8) != g_waiter2)
  187. continue;
  188. }
  189. if (g_waiter3 != "")
  190. {
  191. if (m_List1array.ElementAt(ii).ElementAt(10) != g_waiter3)
  192. continue;
  193. }
  194. if (g_waiter4 != "" || g_waiter4 != "全部")
  195. {
  196. if (g_waiter4 == "欠款")
  197. {
  198. if (atoi(m_List1array.ElementAt(ii).ElementAt(6)) == 0)
  199. continue;
  200. }
  201. else if (g_waiter4 == "付清")
  202. {
  203. if (atoi(m_List1array.ElementAt(ii).ElementAt(6)))
  204. continue;
  205. }
  206. }
  207. if (1)
  208. {
  209. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  210. }
  211. }
  212. }
  213. m_List1.m_arLabels.SetSize(count, 1);
  214. ii = count;
  215. m_List1.m_LabelCount = ii;
  216. m_List1.SetItemCountEx(ii);
  217. CString str;
  218. str.Format("单数:%d", ii);
  219. SetDlgItemText(IDC_STATIC2, str);
  220. }
  221. else
  222. {
  223. m_List1.DeleteAllItems2();
  224. int ii = 0;
  225. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  226. int count = 0;
  227. if (m_filter.IsEmpty())
  228. {
  229. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  230. {
  231. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  232. }
  233. }
  234. else
  235. {
  236. int type = GetType(m_filter);
  237. if (type == 1)//电话
  238. {
  239. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  240. {
  241. if (m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
  242. {
  243. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  244. }
  245. }
  246. }
  247. else if (type == 2)//拼音
  248. {
  249. m_filter.MakeUpper();
  250. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  251. {
  252. if (m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  253. {
  254. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  255. }
  256. }
  257. }
  258. else
  259. {
  260. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  261. {
  262. 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\
  263. || m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1\
  264. || m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1\
  265. || m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1\
  266. || m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1\
  267. || m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1\
  268. || m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1\
  269. || m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  270. {
  271. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  272. }
  273. }
  274. }
  275. }
  276. m_List1.m_arLabels.SetSize(count, 1);
  277. ii = count;
  278. m_List1.m_LabelCount = ii;
  279. m_List1.SetItemCountEx(ii);
  280. CString str;
  281. str.Format("单数:%d", ii);
  282. SetDlgItemText(IDC_STATIC2, str);
  283. }
  284. }
  285. void IncomeInput2::OnBUTclose()
  286. {
  287. // TODO: Add your control notification handler code here
  288. GetParent()->SendMessage(WM_CLOSE);
  289. }
  290. void IncomeInput2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  291. {
  292. // TODO: Add your control notification handler code here
  293. // ListSelChange();
  294. *pResult = 0;
  295. }
  296. void IncomeInput2::ListSelChange()
  297. {
  298. /* POSITION pos;
  299. pos=m_List1.GetFirstSelectedItemPosition();
  300. if(pos==NULL)
  301. {
  302. ClearCtrl();
  303. return;
  304. }
  305. int iItem=m_List1.GetNextSelectedItem(pos);
  306. CString id=m_List1.GetItemText (iItem, 0);
  307. for(int ii=0; ii<m_List1array.GetSize (); ii++)
  308. {
  309. if(m_List1array.ElementAt (ii).ElementAt (0)==id)
  310. {
  311. m_renyuan1 = m_List1array.ElementAt (ii).ElementAt (4);
  312. m_name = m_List1array.ElementAt (ii).ElementAt (1);
  313. m_money = m_List1array.ElementAt (ii).ElementAt (2);
  314. CString ren=m_List1array.ElementAt (ii).ElementAt (6);
  315. m_date = m_List1array.ElementAt (ii).ElementAt (3);
  316. m_renyuan2 = m_List1array.ElementAt (ii).ElementAt (5);
  317. m_bz = m_List1array.ElementAt (ii).ElementAt (7);
  318. if(m_comboren.FindString (0, ren)==-1)
  319. m_comboren.AddString (ren);
  320. m_comboren.SetCurSel (m_comboren.FindString (0, ren));
  321. CString sale2type=m_List1array.ElementAt (ii).ElementAt (8);
  322. if(m_combobz.FindString (0, sale2type)==-1)
  323. m_combobz.AddString (sale2type);
  324. m_combobz.SetCurSel (m_combobz.FindString (0, sale2type));
  325. UpdateData(false);
  326. break;
  327. }
  328. }
  329. GetDlgItem(IDC_BUTsave)->EnableWindow(0);*/
  330. }
  331. void IncomeInput2::OnBUTdel() // 删除按钮;
  332. {
  333. // 判断是否有"收款删除"权限;
  334. if (IsHasRights2new(58) == 0)return;
  335. POSITION pos;
  336. pos = m_List1.GetFirstSelectedItemPosition();
  337. if (pos == NULL)
  338. {
  339. return;
  340. }
  341. if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  342. int iItem = m_List1.GetNextSelectedItem(pos);
  343. CString id = m_List1.GetItemText(iItem, 0);
  344. CString bz = m_List1.GetItemText(iItem, 1);
  345. CString money = m_List1.GetItemText(iItem, 2);
  346. CString date = m_List1.GetItemText(iItem, 3);
  347. CString sql;
  348. sql.Format("delete from singleincome where id=%d***delete from singleincomemoney where id='%s' ", atoi(id), id);
  349. sql += SGLIN_REF;
  350. g_sendhead.bsql = 1;
  351. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  352. GetData();
  353. CString str;
  354. str = "删除散客消费";
  355. str += "客人:";
  356. str += bz;
  357. str += " 金额:";
  358. str += money;
  359. str += " 项目:";
  360. str += date;
  361. WriteLog(_T("散客消费"), str);
  362. }
  363. void IncomeInput2::GetData()
  364. {
  365. if (m_bInit == 0)return;
  366. m_spinyear.EnableWindow(0);
  367. m_spinmonth.EnableWindow(0);
  368. m_spinday.EnableWindow(0);
  369. UpdateData();
  370. CString sql, strdate;
  371. // strdate.Format ("%04d-%02d-%02d", m_year, m_month, m_day);
  372. sql.Format("sale2type<>'';;");
  373. if (m_combobz.GetCount())
  374. {
  375. g_sendhead.bsql = 0;
  376. g_sendhead.code[0] = 196;
  377. g_sendhead.tabcount = 1;
  378. g_pMainWnd->ProcessChatMessageRequest2(sql);
  379. if (g_bSendOK == 0)
  380. {
  381. m_spinyear.EnableWindow(1);
  382. m_spinmonth.EnableWindow(1);
  383. m_spinday.EnableWindow(1);
  384. return;
  385. }
  386. DataToArray(&m_List1array);
  387. }
  388. else
  389. {
  390. g_sendhead.bsql = 0;
  391. g_sendhead.code[0] = 196;
  392. g_sendhead.code[1] = 160;
  393. g_sendhead.code[2] = 195;
  394. g_sendhead.tabcount = 3;
  395. g_pMainWnd->ProcessChatMessageRequest2(sql);
  396. if (g_bSendOK == 0)
  397. {
  398. m_spinyear.EnableWindow(1);
  399. m_spinmonth.EnableWindow(1);
  400. m_spinday.EnableWindow(1);
  401. return;
  402. }
  403. DataToArray(&m_List1array, &expendtypearray, &itemarray);
  404. for (int i = 0; i < expendtypearray.GetSize(); i++)
  405. {
  406. m_combobz.AddString(expendtypearray.ElementAt(i).ElementAt(0));
  407. }
  408. m_combobz.AddString("摄影二销");
  409. #ifndef CHILD_VERSION
  410. m_combobz.AddString("化妆二销");
  411. #else
  412. m_combobz.AddString("引导二销");
  413. #endif
  414. m_combobz.AddString("选片二销");
  415. }
  416. HideCustomerPhone();
  417. FillGrid();
  418. // m_date=strdate;
  419. UpdateData(false);
  420. m_spinyear.EnableWindow(1);
  421. m_spinmonth.EnableWindow(1);
  422. m_spinday.EnableWindow(1);
  423. }
  424. void IncomeInput2::ClearCtrl()
  425. {
  426. UpdateData();
  427. CString strdate;
  428. strdate.Format("%04d-%02d-%02d", m_year, m_month, m_day);
  429. m_date = strdate;
  430. m_bz = _T("");
  431. m_money = _T("");
  432. m_name = _T("");
  433. m_renyuan1 = _T("");
  434. m_renyuan2 = g_user.name;
  435. m_comboren.SetCurSel(-1);
  436. m_combobz.SetCurSel(-1);
  437. UpdateData(false);
  438. GetDlgItem(IDC_BUTsave)->EnableWindow(1);
  439. }
  440. void IncomeInput2::OnChangeEDITyear()
  441. {
  442. // TODO: If this is a RICHEDIT control, the control will not
  443. // send this notification unless you override the MyFormView::OnInitDialog()
  444. // function and call CRichEditCtrl().SetEventMask()
  445. // with the ENM_CHANGE flag ORed into the mask.
  446. GetData();
  447. // TODO: Add your control notification handler code here
  448. }
  449. void IncomeInput2::OnChangeEDITmonth()
  450. {
  451. // TODO: If this is a RICHEDIT control, the control will not
  452. // send this notification unless you override the MyFormView::OnInitDialog()
  453. // function and call CRichEditCtrl().SetEventMask()
  454. // with the ENM_CHANGE flag ORed into the mask.
  455. GetData();
  456. // TODO: Add your control notification handler code here
  457. }
  458. void IncomeInput2::OnChangeEDITday()
  459. {
  460. // TODO: If this is a RICHEDIT control, the control will not
  461. // send this notification unless you override the MyFormView::OnInitDialog()
  462. // function and call CRichEditCtrl().SetEventMask()
  463. // with the ENM_CHANGE flag ORed into the mask.
  464. GetData();
  465. // TODO: Add your control notification handler code here
  466. }
  467. BOOL IncomeInput2::PreTranslateMessage(MSG* pMsg)
  468. {
  469. // TODO: Add your specialized code here and/or call the base class
  470. try
  471. {
  472. if (pMsg->message == WM_KEYDOWN)
  473. {
  474. switch (pMsg->wParam)
  475. {
  476. case VK_RETURN:
  477. OnButton2();
  478. return 1;
  479. case 0x43: // copy
  480. if ((GetKeyState(VK_CONTROL) & 0x80))
  481. {
  482. GetFocus()->SendMessage(WM_COPY);
  483. return TRUE;
  484. }
  485. break;
  486. case 0x56: //Ctrl + V:
  487. if ((GetKeyState(VK_CONTROL) & 0x80))
  488. {
  489. GetFocus()->SendMessage(WM_PASTE);
  490. return TRUE;
  491. }
  492. break;
  493. case 0x58: // cut
  494. if ((GetKeyState(VK_CONTROL) & 0x80))
  495. {
  496. GetFocus()->SendMessage(WM_CUT);
  497. return TRUE;
  498. }
  499. break;
  500. case 0x5A: //undo
  501. case 0x59: //redo
  502. if ((GetKeyState(VK_CONTROL) & 0x80))
  503. {
  504. GetFocus()->SendMessage(WM_UNDO);
  505. return TRUE;
  506. }
  507. break;
  508. }
  509. }
  510. return MyFormView::PreTranslateMessage(pMsg);
  511. }
  512. catch (...)
  513. {
  514. }
  515. }
  516. void IncomeInput2::OnBUTprint()
  517. {
  518. // TODO: Add your control notification handler code here
  519. POSITION pos;
  520. pos = m_List1.GetFirstSelectedItemPosition();
  521. if (pos == NULL)
  522. {
  523. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  524. return;
  525. }
  526. int iItem;
  527. CStringArray array;
  528. while (pos)
  529. {
  530. iItem = m_List1.GetNextSelectedItem(pos);
  531. if (!m_List1.GetItemText(iItem, 2).IsEmpty())
  532. array.Add(m_List1.GetItemText(iItem, 2));
  533. }
  534. SendMsgDlg dlg;
  535. dlg.m_mode = 1;
  536. dlg.m_pArray = &array;
  537. dlg.DoModal();
  538. }
  539. void IncomeInput2::OnButton1()
  540. {
  541. // TODO: Add your control notification handler code here
  542. }
  543. void IncomeInput2::OnBUTsave() // 录入按钮;
  544. {
  545. // TODO: Add your control notification handler code here
  546. if (g_nYearpos != -1)
  547. {
  548. AfxMessageBox("当前为历史数据查看状态,不能更改历史数据!", MB_ICONSTOP);
  549. return;
  550. }
  551. AddIncome dlg;
  552. dlg.expendtypearray = &expendtypearray;
  553. dlg.itemarray = &itemarray;
  554. if (dlg.DoModal() == IDOK)
  555. {
  556. GetData();
  557. }
  558. }
  559. void IncomeInput2::OnBUTsave2() // 修改按钮;
  560. {
  561. // 判断是否有"散客消费修改"权限;
  562. if (IsHasRights2new(66) == 0){
  563. return;
  564. }
  565. POSITION pos;
  566. pos = m_List1.GetFirstSelectedItemPosition();
  567. if (pos == NULL)
  568. {
  569. return;
  570. }
  571. int iItem = m_List1.GetNextSelectedItem(pos);
  572. AddIncome dlg;
  573. dlg.m_id = m_List1.GetItemText(iItem, 0);
  574. dlg.m_renyuan1 = m_List1.GetItemText(iItem, 1);
  575. dlg.m_phone = m_List1.GetItemText(iItem, 2);
  576. dlg.m_name = m_List1.GetItemText(iItem, 3);
  577. dlg.m_money = m_List1.GetItemText(iItem, 4);
  578. dlg.m_renyuan3 = m_List1.GetItemText(iItem, 8);
  579. dlg.m_sale2type = m_List1.GetItemText(iItem, 10);
  580. dlg.m_bz = m_List1.GetItemText(iItem, 11);
  581. dlg.m_count = m_List1.GetItemText(iItem, 12);
  582. dlg.m_renyuan2 = m_List1.GetItemText(iItem, 7);
  583. dlg.m_date = m_List1.GetItemText(iItem, 9);
  584. dlg.expendtypearray = &expendtypearray;
  585. dlg.itemarray = &itemarray;
  586. if (dlg.DoModal() == IDOK)
  587. {
  588. GetData();
  589. CString str;
  590. str = "修改散客消费:";
  591. str += "客人";
  592. str += dlg.m_renyuan1;
  593. str += " 项目:";
  594. str += dlg.m_name;
  595. str += " 金额:";
  596. str += dlg.m_money;
  597. str += " 数量:";
  598. str += dlg.m_count;
  599. WriteLog(_T("散客消费"), str);
  600. }
  601. }
  602. void IncomeInput2::OnButton2() // 查询按钮;
  603. {
  604. // TODO: Add your control notification handler code here
  605. UpdateData();
  606. m_filter.TrimLeft();
  607. m_filter.TrimRight();
  608. FillGrid();
  609. }
  610. void IncomeInput2::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  611. {
  612. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  613. // Take the default processing unless we set this to something else below.
  614. *pResult = 0;
  615. // First thing - check the draw stage. If it's the control's prepaint
  616. // stage, then tell Windows we want messages for every item.
  617. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  618. {
  619. *pResult = CDRF_NOTIFYITEMDRAW;
  620. }
  621. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  622. {
  623. // This is the prepaint stage for an item. Here's where we set the
  624. // item's text color. Our return value will tell Windows to draw the
  625. // item itself, but it will use the new color we set here.
  626. // We'll cycle the colors through red, green, and light blue.
  627. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6) == "")
  628. {
  629. }
  630. else if (atoi(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)) != 0)
  631. pLVCD->clrText = RGB(220, 0, 0);
  632. else
  633. pLVCD->clrText = RGB(20, 133, 20);
  634. if (pLVCD->nmcd.dwItemSpec % 2)
  635. pLVCD->clrTextBk = g_gridcol1;
  636. else
  637. pLVCD->clrTextBk = g_gridcol2;
  638. // Store the color back in the NMLVCUSTOMDRAW struct.
  639. // Tell Windows to paint the control itself.
  640. *pResult = CDRF_DODEFAULT;
  641. }
  642. }
  643. void IncomeInput2::OnBUTpay() // 收款按钮;
  644. {
  645. // TODO: Add your control notification handler code here
  646. POSITION pos;
  647. pos = m_List1.GetFirstSelectedItemPosition();
  648. if (pos == NULL)
  649. {
  650. return;
  651. }
  652. int iItem = m_List1.GetNextSelectedItem(pos);
  653. Singleincomemoney dlg;
  654. dlg.m_id = m_List1.GetItemText(iItem, 0);
  655. dlg.m_name = m_List1.GetItemText(iItem, 1);
  656. dlg.m_phone = m_List1.GetItemText(iItem, 2);
  657. dlg.m_sitem = m_List1.GetItemText(iItem, 3);
  658. dlg.m_money1 = m_List1.GetItemText(iItem, 4);
  659. dlg.m_money2 = m_List1.GetItemText(iItem, 5);
  660. dlg.m_money3 = m_List1.GetItemText(iItem, 6);
  661. dlg.m_ren = m_List1.GetItemText(iItem, 8);
  662. dlg.m_bz = m_List1.GetItemText(iItem, 11);
  663. dlg.DoModal(); GetData();
  664. }
  665. void IncomeInput2::OnButton4() // 条件查询;
  666. {
  667. // TODO: Add your control notification handler code here
  668. SearchFilter4 dlg;
  669. if (dlg.DoModal() == IDOK)
  670. {
  671. FillGrid();
  672. }
  673. g_bSearchFilter = 0;
  674. }
  675. void IncomeInput2::OnButton5()
  676. {
  677. // TODO: Add your control notification handler code here
  678. Other2SaleChart dlg;
  679. dlg.DoModal();
  680. }
  681. void IncomeInput2::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  682. {
  683. // TODO: Add your control notification handler code here
  684. OnBUTsave2();
  685. *pResult = 0;
  686. }
  687. /************************************************************************/
  688. /* 函数:[10/24/2016 IT];
  689. /* 描述:;
  690. /* 参数:;
  691. /* [IN] :;
  692. /* [OUT] :;
  693. /* [IN/OUT] :;
  694. /* 返回:void;
  695. /* 注意:;
  696. /* 示例:;
  697. /*
  698. /* 修改:;
  699. /* 日期:;
  700. /* 内容:;
  701. /************************************************************************/
  702. void IncomeInput2::HideCustomerPhone() // 隐藏顾客联系电话;
  703. {
  704. return;
  705. if (IsHasRights2new(31))
  706. return;
  707. for (int i = 0; i < m_List1array.GetSize(); i++)
  708. {
  709. m_List1array.ElementAt(i).SetAt(2, "***");
  710. }
  711. }