ShowHistoryClient.cpp 3.2 KB

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