IncomeInput2.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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. m_static1.SetFont(&g_titlefont);
  141. m_List1.SetHeadings("编号,100;客人,100;手机,100;项目名称, 100;应付, 100;已付,100;欠款,100;经手人,100;开单人,100;日期, 100;二销类别,100;备注,100;数量,100");
  142. m_List1.LoadColumnInfo(141);
  143. m_comboren.GetWindowRect(rc2);
  144. ScreenToClient(rc2);
  145. rc2.bottom += 400;
  146. m_comboren.MoveWindow(rc2);
  147. m_combobz.GetWindowRect(rc2);
  148. ScreenToClient(rc2);
  149. rc2.bottom += 400;
  150. m_combobz.MoveWindow(rc2);
  151. m_combo1.GetWindowRect(rc2);
  152. ScreenToClient(rc2);
  153. rc2.bottom += 200;
  154. m_combo1.MoveWindow(rc2);
  155. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  156. SetComboHei(&m_combo1, rc2.Height());
  157. for (int i = 0; i < g_userarray.GetSize(); i++)
  158. m_comboren.AddString(g_userarray.ElementAt(i).ElementAt(1));
  159. m_bInit = 1;
  160. GetData();
  161. }
  162. void IncomeInput2::FillGrid()
  163. {
  164. if (g_bSearchFilter)
  165. {
  166. m_List1.DeleteAllItems2();
  167. int ii = 0;
  168. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  169. int count = 0;
  170. {
  171. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  172. {
  173. if (g_filterdate1 != "")
  174. {
  175. if (m_List1array.ElementAt(ii).ElementAt(9) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(9) > g_filterdate2)
  176. continue;
  177. }
  178. if (g_waiter1 != "")
  179. {
  180. if (m_List1array.ElementAt(ii).ElementAt(3) != g_waiter1)
  181. continue;
  182. }
  183. if (g_waiter2 != "")
  184. {
  185. if (m_List1array.ElementAt(ii).ElementAt(8) != g_waiter2)
  186. continue;
  187. }
  188. if (g_waiter3 != "")
  189. {
  190. if (m_List1array.ElementAt(ii).ElementAt(10) != g_waiter3)
  191. continue;
  192. }
  193. if (g_waiter4 != "" || g_waiter4 != "全部")
  194. {
  195. if (g_waiter4 == "欠款")
  196. {
  197. if (atoi(m_List1array.ElementAt(ii).ElementAt(6)) == 0)
  198. continue;
  199. }
  200. else if (g_waiter4 == "付清")
  201. {
  202. if (atoi(m_List1array.ElementAt(ii).ElementAt(6)))
  203. continue;
  204. }
  205. }
  206. if (1)
  207. {
  208. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  209. }
  210. }
  211. }
  212. m_List1.m_arLabels.SetSize(count, 1);
  213. ii = count;
  214. m_List1.m_LabelCount = ii;
  215. m_List1.SetItemCountEx(ii);
  216. CString str;
  217. str.Format("单数:%d", ii);
  218. SetDlgItemText(IDC_STATIC2, str);
  219. }
  220. else
  221. {
  222. m_List1.DeleteAllItems2();
  223. int ii = 0;
  224. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  225. int count = 0;
  226. if (m_filter.IsEmpty())
  227. {
  228. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  229. {
  230. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  231. }
  232. }
  233. else
  234. {
  235. int type = GetType(m_filter);
  236. if (type == 1)//电话
  237. {
  238. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  239. {
  240. if (m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1)
  241. {
  242. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  243. }
  244. }
  245. }
  246. else if (type == 2)//拼音
  247. {
  248. m_filter.MakeUpper();
  249. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  250. {
  251. if (m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  252. {
  253. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  254. }
  255. }
  256. }
  257. else
  258. {
  259. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  260. {
  261. 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\
  262. || m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1\
  263. || m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1\
  264. || m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1\
  265. || m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1\
  266. || m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1\
  267. || m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1\
  268. || m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  269. {
  270. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  271. }
  272. }
  273. }
  274. }
  275. m_List1.m_arLabels.SetSize(count, 1);
  276. ii = count;
  277. m_List1.m_LabelCount = ii;
  278. m_List1.SetItemCountEx(ii);
  279. CString str;
  280. str.Format("单数:%d", ii);
  281. SetDlgItemText(IDC_STATIC2, str);
  282. }
  283. }
  284. void IncomeInput2::OnBUTclose()
  285. {
  286. // TODO: Add your control notification handler code here
  287. GetParent()->SendMessage(WM_CLOSE);
  288. }
  289. void IncomeInput2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  290. {
  291. // TODO: Add your control notification handler code here
  292. // ListSelChange();
  293. *pResult = 0;
  294. }
  295. void IncomeInput2::ListSelChange()
  296. {
  297. /* POSITION pos;
  298. pos=m_List1.GetFirstSelectedItemPosition();
  299. if(pos==NULL)
  300. {
  301. ClearCtrl();
  302. return;
  303. }
  304. int iItem=m_List1.GetNextSelectedItem(pos);
  305. CString id=m_List1.GetItemText (iItem, 0);
  306. for(int ii=0; ii<m_List1array.GetSize (); ii++)
  307. {
  308. if(m_List1array.ElementAt (ii).ElementAt (0)==id)
  309. {
  310. m_renyuan1 = m_List1array.ElementAt (ii).ElementAt (4);
  311. m_name = m_List1array.ElementAt (ii).ElementAt (1);
  312. m_money = m_List1array.ElementAt (ii).ElementAt (2);
  313. CString ren=m_List1array.ElementAt (ii).ElementAt (6);
  314. m_date = m_List1array.ElementAt (ii).ElementAt (3);
  315. m_renyuan2 = m_List1array.ElementAt (ii).ElementAt (5);
  316. m_bz = m_List1array.ElementAt (ii).ElementAt (7);
  317. if(m_comboren.FindString (0, ren)==-1)
  318. m_comboren.AddString (ren);
  319. m_comboren.SetCurSel (m_comboren.FindString (0, ren));
  320. CString sale2type=m_List1array.ElementAt (ii).ElementAt (8);
  321. if(m_combobz.FindString (0, sale2type)==-1)
  322. m_combobz.AddString (sale2type);
  323. m_combobz.SetCurSel (m_combobz.FindString (0, sale2type));
  324. UpdateData(false);
  325. break;
  326. }
  327. }
  328. GetDlgItem(IDC_BUTsave)->EnableWindow(0);*/
  329. }
  330. void IncomeInput2::OnBUTdel() // 删除按钮;
  331. {
  332. // TODO: Add your control notification handler code here
  333. if (IsHasRights2new(58) == 0)return;
  334. POSITION pos;
  335. pos = m_List1.GetFirstSelectedItemPosition();
  336. if (pos == NULL)
  337. {
  338. return;
  339. }
  340. if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  341. int iItem = m_List1.GetNextSelectedItem(pos);
  342. CString id = m_List1.GetItemText(iItem, 0);
  343. CString bz = m_List1.GetItemText(iItem, 1);
  344. CString money = m_List1.GetItemText(iItem, 2);
  345. CString date = m_List1.GetItemText(iItem, 3);
  346. CString sql;
  347. sql.Format("delete from singleincome where id=%d***delete from singleincomemoney where id='%s' ", atoi(id), id);
  348. sql += SGLIN_REF;
  349. g_sendhead.bsql = 1;
  350. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  351. GetData();
  352. CString str;
  353. str = "删除其它二销";
  354. str += bz;
  355. str += "金额:";
  356. str += money;
  357. str += "日期:";
  358. str += date;
  359. WriteLog(_T("其它二销"), str);
  360. }
  361. void IncomeInput2::GetData()
  362. {
  363. if (m_bInit == 0)return;
  364. m_spinyear.EnableWindow(0);
  365. m_spinmonth.EnableWindow(0);
  366. m_spinday.EnableWindow(0);
  367. UpdateData();
  368. CString sql, strdate;
  369. // strdate.Format ("%04d-%02d-%02d", m_year, m_month, m_day);
  370. sql.Format("sale2type<>'';;");
  371. if (m_combobz.GetCount())
  372. {
  373. g_sendhead.bsql = 0;
  374. g_sendhead.code[0] = 196;
  375. g_sendhead.tabcount = 1;
  376. g_pMainWnd->ProcessChatMessageRequest2(sql);
  377. if (g_bSendOK == 0)
  378. {
  379. m_spinyear.EnableWindow(1);
  380. m_spinmonth.EnableWindow(1);
  381. m_spinday.EnableWindow(1);
  382. return;
  383. }
  384. DataToArray(&m_List1array);
  385. }
  386. else
  387. {
  388. g_sendhead.bsql = 0;
  389. g_sendhead.code[0] = 196;
  390. g_sendhead.code[1] = 160;
  391. g_sendhead.code[2] = 195;
  392. g_sendhead.tabcount = 3;
  393. g_pMainWnd->ProcessChatMessageRequest2(sql);
  394. if (g_bSendOK == 0)
  395. {
  396. m_spinyear.EnableWindow(1);
  397. m_spinmonth.EnableWindow(1);
  398. m_spinday.EnableWindow(1);
  399. return;
  400. }
  401. DataToArray(&m_List1array, &expendtypearray, &itemarray);
  402. for (int i = 0; i < expendtypearray.GetSize(); i++)
  403. {
  404. m_combobz.AddString(expendtypearray.ElementAt(i).ElementAt(0));
  405. }
  406. m_combobz.AddString("摄影二销");
  407. #ifndef CHILD_VERSION
  408. m_combobz.AddString("化妆二销");
  409. #else
  410. m_combobz.AddString("引导二销");
  411. #endif
  412. m_combobz.AddString("选片二销");
  413. }
  414. FillGrid();
  415. // m_date=strdate;
  416. UpdateData(false);
  417. m_spinyear.EnableWindow(1);
  418. m_spinmonth.EnableWindow(1);
  419. m_spinday.EnableWindow(1);
  420. }
  421. void IncomeInput2::ClearCtrl()
  422. {
  423. UpdateData();
  424. CString strdate;
  425. strdate.Format("%04d-%02d-%02d", m_year, m_month, m_day);
  426. m_date = strdate;
  427. m_bz = _T("");
  428. m_money = _T("");
  429. m_name = _T("");
  430. m_renyuan1 = _T("");
  431. m_renyuan2 = g_user.name;
  432. m_comboren.SetCurSel(-1);
  433. m_combobz.SetCurSel(-1);
  434. UpdateData(false);
  435. GetDlgItem(IDC_BUTsave)->EnableWindow(1);
  436. }
  437. void IncomeInput2::OnChangeEDITyear()
  438. {
  439. // TODO: If this is a RICHEDIT control, the control will not
  440. // send this notification unless you override the MyFormView::OnInitDialog()
  441. // function and call CRichEditCtrl().SetEventMask()
  442. // with the ENM_CHANGE flag ORed into the mask.
  443. GetData();
  444. // TODO: Add your control notification handler code here
  445. }
  446. void IncomeInput2::OnChangeEDITmonth()
  447. {
  448. // TODO: If this is a RICHEDIT control, the control will not
  449. // send this notification unless you override the MyFormView::OnInitDialog()
  450. // function and call CRichEditCtrl().SetEventMask()
  451. // with the ENM_CHANGE flag ORed into the mask.
  452. GetData();
  453. // TODO: Add your control notification handler code here
  454. }
  455. void IncomeInput2::OnChangeEDITday()
  456. {
  457. // TODO: If this is a RICHEDIT control, the control will not
  458. // send this notification unless you override the MyFormView::OnInitDialog()
  459. // function and call CRichEditCtrl().SetEventMask()
  460. // with the ENM_CHANGE flag ORed into the mask.
  461. GetData();
  462. // TODO: Add your control notification handler code here
  463. }
  464. BOOL IncomeInput2::PreTranslateMessage(MSG* pMsg)
  465. {
  466. // TODO: Add your specialized code here and/or call the base class
  467. try
  468. {
  469. if (pMsg->message == WM_KEYDOWN)
  470. {
  471. switch (pMsg->wParam)
  472. {
  473. case VK_RETURN:
  474. OnButton2();
  475. return 1;
  476. case 0x43: // copy
  477. if ((GetKeyState(VK_CONTROL) & 0x80))
  478. {
  479. GetFocus()->SendMessage(WM_COPY);
  480. return TRUE;
  481. }
  482. break;
  483. case 0x56: //Ctrl + V:
  484. if ((GetKeyState(VK_CONTROL) & 0x80))
  485. {
  486. GetFocus()->SendMessage(WM_PASTE);
  487. return TRUE;
  488. }
  489. break;
  490. case 0x58: // cut
  491. if ((GetKeyState(VK_CONTROL) & 0x80))
  492. {
  493. GetFocus()->SendMessage(WM_CUT);
  494. return TRUE;
  495. }
  496. break;
  497. case 0x5A: //undo
  498. case 0x59: //redo
  499. if ((GetKeyState(VK_CONTROL) & 0x80))
  500. {
  501. GetFocus()->SendMessage(WM_UNDO);
  502. return TRUE;
  503. }
  504. break;
  505. }
  506. }
  507. return MyFormView::PreTranslateMessage(pMsg);
  508. }
  509. catch (...)
  510. {
  511. }
  512. }
  513. void IncomeInput2::OnBUTprint()
  514. {
  515. // TODO: Add your control notification handler code here
  516. POSITION pos;
  517. pos = m_List1.GetFirstSelectedItemPosition();
  518. if (pos == NULL)
  519. {
  520. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  521. return;
  522. }
  523. int iItem;
  524. CStringArray array;
  525. while (pos)
  526. {
  527. iItem = m_List1.GetNextSelectedItem(pos);
  528. if (!m_List1.GetItemText(iItem, 2).IsEmpty())
  529. array.Add(m_List1.GetItemText(iItem, 2));
  530. }
  531. SendMsgDlg dlg;
  532. dlg.m_mode = 1;
  533. dlg.m_pArray = &array;
  534. dlg.DoModal();
  535. }
  536. void IncomeInput2::OnButton1()
  537. {
  538. // TODO: Add your control notification handler code here
  539. }
  540. void IncomeInput2::OnBUTsave() // 录入按钮;
  541. {
  542. // TODO: Add your control notification handler code here
  543. if (g_nYearpos != -1)
  544. {
  545. AfxMessageBox("当前为历史数据查看状态,不能更改历史数据!", MB_ICONSTOP);
  546. return;
  547. }
  548. AddIncome dlg;
  549. dlg.expendtypearray = &expendtypearray;
  550. dlg.itemarray = &itemarray;
  551. if (dlg.DoModal() == IDOK)
  552. {
  553. GetData();
  554. }
  555. }
  556. void IncomeInput2::OnBUTsave2() // 修改按钮;
  557. {
  558. // TODO: Add your control notification handler code here
  559. POSITION pos;
  560. pos = m_List1.GetFirstSelectedItemPosition();
  561. if (pos == NULL)
  562. {
  563. return;
  564. }
  565. int iItem = m_List1.GetNextSelectedItem(pos);
  566. AddIncome dlg;
  567. dlg.m_id = m_List1.GetItemText(iItem, 0);
  568. dlg.m_renyuan1 = m_List1.GetItemText(iItem, 1);
  569. dlg.m_phone = m_List1.GetItemText(iItem, 2);
  570. dlg.m_name = m_List1.GetItemText(iItem, 3);
  571. dlg.m_money = m_List1.GetItemText(iItem, 4);
  572. dlg.m_renyuan3 = m_List1.GetItemText(iItem, 8);
  573. dlg.m_sale2type = m_List1.GetItemText(iItem, 10);
  574. dlg.m_bz = m_List1.GetItemText(iItem, 11);
  575. dlg.m_count = m_List1.GetItemText(iItem, 12);
  576. dlg.m_renyuan2 = m_List1.GetItemText(iItem, 7);
  577. dlg.m_date = m_List1.GetItemText(iItem, 9);
  578. dlg.expendtypearray = &expendtypearray;
  579. dlg.itemarray = &itemarray;
  580. if (dlg.DoModal() == IDOK)
  581. {
  582. GetData();
  583. }
  584. }
  585. void IncomeInput2::OnButton2() // 查询按钮;
  586. {
  587. // TODO: Add your control notification handler code here
  588. UpdateData();
  589. m_filter.TrimLeft();
  590. m_filter.TrimRight();
  591. FillGrid();
  592. }
  593. void IncomeInput2::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
  594. {
  595. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
  596. // Take the default processing unless we set this to something else below.
  597. *pResult = 0;
  598. // First thing - check the draw stage. If it's the control's prepaint
  599. // stage, then tell Windows we want messages for every item.
  600. if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
  601. {
  602. *pResult = CDRF_NOTIFYITEMDRAW;
  603. }
  604. else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
  605. {
  606. // This is the prepaint stage for an item. Here's where we set the
  607. // item's text color. Our return value will tell Windows to draw the
  608. // item itself, but it will use the new color we set here.
  609. // We'll cycle the colors through red, green, and light blue.
  610. if (m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6) == "")
  611. {
  612. }
  613. else if (atoi(m_List1.m_arLabels.ElementAt(pLVCD->nmcd.dwItemSpec).ElementAt(6)) != 0)
  614. pLVCD->clrText = RGB(220, 0, 0);
  615. else
  616. pLVCD->clrText = RGB(20, 133, 20);
  617. if (pLVCD->nmcd.dwItemSpec % 2)
  618. pLVCD->clrTextBk = g_gridcol1;
  619. else
  620. pLVCD->clrTextBk = g_gridcol2;
  621. // Store the color back in the NMLVCUSTOMDRAW struct.
  622. // Tell Windows to paint the control itself.
  623. *pResult = CDRF_DODEFAULT;
  624. }
  625. }
  626. void IncomeInput2::OnBUTpay() // 收款按钮;
  627. {
  628. // TODO: Add your control notification handler code here
  629. POSITION pos;
  630. pos = m_List1.GetFirstSelectedItemPosition();
  631. if (pos == NULL)
  632. {
  633. return;
  634. }
  635. int iItem = m_List1.GetNextSelectedItem(pos);
  636. Singleincomemoney dlg;
  637. dlg.m_id = m_List1.GetItemText(iItem, 0);
  638. dlg.m_name = m_List1.GetItemText(iItem, 1);
  639. dlg.m_phone = m_List1.GetItemText(iItem, 2);
  640. dlg.m_sitem = m_List1.GetItemText(iItem, 3);
  641. dlg.m_money1 = m_List1.GetItemText(iItem, 4);
  642. dlg.m_money2 = m_List1.GetItemText(iItem, 5);
  643. dlg.m_money3 = m_List1.GetItemText(iItem, 6);
  644. dlg.m_ren = m_List1.GetItemText(iItem, 8);
  645. dlg.m_bz = m_List1.GetItemText(iItem, 11);
  646. dlg.DoModal(); GetData();
  647. }
  648. void IncomeInput2::OnButton4() // 条件查询;
  649. {
  650. // TODO: Add your control notification handler code here
  651. SearchFilter4 dlg;
  652. if (dlg.DoModal() == IDOK)
  653. {
  654. FillGrid();
  655. }
  656. g_bSearchFilter = 0;
  657. }
  658. void IncomeInput2::OnButton5()
  659. {
  660. // TODO: Add your control notification handler code here
  661. Other2SaleChart dlg;
  662. dlg.DoModal();
  663. }
  664. void IncomeInput2::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  665. {
  666. // TODO: Add your control notification handler code here
  667. OnBUTsave2();
  668. *pResult = 0;
  669. }