ShowHistoryClient.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // ShowHistoryClient.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowHistoryClient.h"
  6. #include "Booking2.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // ShowHistoryClient dialog
  14. ShowHistoryClient::ShowHistoryClient(CWnd* pParent /*=NULL*/)
  15. : CDialog(ShowHistoryClient::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(ShowHistoryClient)
  18. // NOTE: the ClassWizard will add member initialization here
  19. m_pos=0;
  20. //}}AFX_DATA_INIT
  21. }
  22. void ShowHistoryClient::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(ShowHistoryClient)
  26. DDX_Control(pDX, IDC_LIST1, m_List1);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(ShowHistoryClient, CDialog)
  30. //{{AFX_MSG_MAP(ShowHistoryClient)
  31. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  32. //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34. /////////////////////////////////////////////////////////////////////////////
  35. // ShowHistoryClient message handlers
  36. BOOL ShowHistoryClient::OnInitDialog()
  37. {
  38. CDialog::OnInitDialog();
  39. // TODO: Add extra initialization here m_poldclientarray g_oldclientarray
  40. CString str;
  41. int pos;
  42. for(int i=0; i<m_poldclientarray->GetSize (); i++)
  43. {
  44. pos=m_poldclientarray->ElementAt(i);
  45. str.Format("客人:%s 单号:%s", g_oldclientarray.ElementAt(pos).ElementAt(1)+g_oldclientarray.ElementAt(pos).ElementAt(2), g_oldclientarray.ElementAt(pos).ElementAt(0));
  46. if(m_List1.GetCount()%2)
  47. m_List1.AddEntry( str , g_gridcol1, m_List1.GetCount());
  48. else
  49. m_List1.AddEntry( str , g_gridcol2, m_List1.GetCount());
  50. #ifdef CHILD_VERSION
  51. m_yearposarray.Add(atoi(g_oldclientarray.ElementAt(pos).ElementAt(12)));
  52. #else
  53. m_yearposarray.Add(atoi(g_oldclientarray.ElementAt(pos).ElementAt(19)));
  54. #endif
  55. }
  56. m_List1.Invalidate ();
  57. return TRUE; // return TRUE unless you set the focus to a control
  58. // EXCEPTION: OCX Property Pages should return FALSE
  59. }
  60. void ShowHistoryClient::OnButton1()
  61. {
  62. // TODO: Add your control notification handler code here
  63. UpdateData();
  64. int pos= m_List1.GetCurSel() ;
  65. if(pos==-1)
  66. {
  67. AfxMessageBox("请先选中您要查看的订单", MB_ICONINFORMATION);return;
  68. }
  69. CString str,id;
  70. m_List1.GetText (pos, str);
  71. id=str.Right(str.GetLength()-str.Find("单号:")-5);
  72. Booking2 dlg;
  73. dlg.m_id = id;
  74. dlg.m_bModify =2;
  75. int g_nYearposTemp=g_nYearpos;
  76. g_nYearpos=m_yearposarray.ElementAt(pos);
  77. dlg.DoModal ();
  78. g_nYearpos=g_nYearposTemp;
  79. }
  80. void ShowHistoryClient::OnOK()
  81. {
  82. // TODO: Add extra validation here
  83. int pos= m_List1.GetCurSel() ;
  84. if(pos==-1)
  85. {
  86. AfxMessageBox("请先选中订单", MB_ICONINFORMATION);return;
  87. }
  88. m_pos=pos;
  89. CDialog::OnOK();
  90. }