IncomeInput2.cpp 19 KB

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