DataOption.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // DataOpt.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "DataOption.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // DataOpt dialog
  13. DataOpt::DataOpt(CWnd* pParent /*=NULL*/)
  14. : CDialog(DataOpt::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(DataOpt)
  17. m_check1 = FALSE;
  18. m_radio1 = 0;
  19. //}}AFX_DATA_INIT
  20. }
  21. void DataOpt::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(DataOpt)
  25. DDX_Control(pDX, IDC_COMBO2, m_combo2);
  26. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  27. DDX_Check(pDX, IDC_CHECK1, m_check1);
  28. DDX_Radio(pDX, IDC_RADIO1, m_radio1);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(DataOpt, CDialog)
  32. //{{AFX_MSG_MAP(DataOpt)
  33. ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  34. ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // DataOpt message handlers
  39. BOOL DataOpt::OnInitDialog()
  40. {
  41. CDialog::OnInitDialog();
  42. // TODO: Add extra initialization here
  43. #ifdef ENTERPRISE_VERSION
  44. for(int i=0; i<g_brancharray.GetSize (); i++)
  45. {
  46. m_combo1.AddString (g_brancharray.ElementAt (i).ElementAt (0));
  47. }
  48. if(g_brancharray.GetSize ()==0)m_combo1.AddString ("本店");
  49. #else
  50. m_combo1.AddString ("本店");
  51. #endif
  52. m_combo1.SetCurSel(0);
  53. for(int i=0; i<g_hisyeararray.GetSize (); i++)
  54. {
  55. m_combo2.AddString (g_hisyeararray.ElementAt (i).ElementAt (0));
  56. }
  57. if(m_combo2.GetCount()>m_year && m_radio1)
  58. m_combo2.SetCurSel(m_year);
  59. return TRUE; // return TRUE unless you set the focus to a control
  60. // EXCEPTION: OCX Property Pages should return FALSE
  61. }
  62. void DataOpt::OnOK()
  63. {
  64. // TODO: Add extra validation here
  65. UpdateData();
  66. if(m_radio1==1)
  67. {
  68. m_year=m_combo2.GetCurSel();
  69. if(m_year==-1)
  70. {
  71. AfxMessageBox("请选中历史年份!", MB_ICONINFORMATION);
  72. return;
  73. }
  74. }
  75. else
  76. m_year=-1;
  77. CDialog::OnOK();
  78. }
  79. void DataOpt::OnRadio1()
  80. {
  81. // TODO: Add your control notification handler code here
  82. m_combo2.SetCurSel(-1);
  83. }
  84. void DataOpt::OnRadio2()
  85. {
  86. // TODO: Add your control notification handler code here
  87. if(m_combo2.GetCount())
  88. {UpdateData();
  89. m_combo2.SetCurSel(0);
  90. m_check1=1;
  91. UpdateData(0);
  92. }
  93. }