ReCharge.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // ReCharge.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ReCharge.h"
  6. #include "SelPayType.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // ReCharge dialog
  14. ReCharge::ReCharge(CWnd* pParent /*=NULL*/)
  15. : CDialog(ReCharge::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(ReCharge)
  18. m_money = _T("");
  19. m_name = _T("");
  20. m_no = _T("");
  21. m_card2no = _T("");
  22. m_money2 = _T("");
  23. //}}AFX_DATA_INIT
  24. m_bout=m_mode=0;
  25. }
  26. void ReCharge::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(ReCharge)
  30. DDX_Control(pDX, IDC_EDIT2, m_editnum2);
  31. DDX_Control(pDX, IDC_EDIT1, m_editnum);
  32. DDX_Text(pDX, IDC_EDIT1, m_money);
  33. DDX_Text(pDX, IDC_EDITname, m_name);
  34. DDX_Text(pDX, IDC_EDITno, m_no);
  35. DDX_Text(pDX, IDC_EDITcard2no, m_card2no);
  36. DDX_Text(pDX, IDC_EDIT2, m_money2);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(ReCharge, CDialog)
  40. //{{AFX_MSG_MAP(ReCharge)
  41. //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43. /////////////////////////////////////////////////////////////////////////////
  44. // ReCharge message handlers
  45. void ReCharge::OnOK()
  46. {
  47. // TODO: Add extra validation here
  48. UpdateData();
  49. if(m_mode==0 && m_bout==0)
  50. {
  51. if( atoi(m_money)<=0 && atoi(m_money2)<=0)
  52. return;
  53. }
  54. else if( atoi(m_money)<=0)
  55. return;
  56. if(m_bout==0 && m_mode && atoi(m_balance)<atoi(m_money))
  57. {
  58. AfxMessageBox("账号余额不足!", MB_ICONINFORMATION);
  59. return;
  60. }
  61. if(m_bout) // 提现;m_balance:余额, m_money:提现金额;
  62. {
  63. if( (atoi(m_balance)-atoi(m_money)) <0 )
  64. {
  65. AfxMessageBox("账号余额不足!", MB_ICONINFORMATION);
  66. return;
  67. }
  68. }
  69. if(m_mode==0 && m_bout==0)
  70. {
  71. SelPayType seltype;
  72. seltype.m_mode=1;
  73. if(seltype.DoModal ()!=IDOK)return;
  74. if(seltype.m_radio1==0)
  75. paytype="现金";
  76. else if(seltype.m_radio1==1)
  77. paytype="POS机刷卡";
  78. else if(seltype.m_radio1==4)
  79. paytype="银行转账";
  80. }
  81. CDialog::OnOK();
  82. }
  83. BOOL ReCharge::OnInitDialog()
  84. {
  85. CDialog::OnInitDialog();
  86. // TODO: Add extra initialization here
  87. if(m_mode==0)
  88. {
  89. GetDlgItem(IDC_STATIC1)->ShowWindow(0);
  90. GetDlgItem(IDC_EDITcard2no)->ShowWindow(0);
  91. if(m_bout)SetWindowText("主卡提现");
  92. }
  93. else
  94. {
  95. if(m_bout)
  96. SetWindowText("现金子卡提现");
  97. else
  98. SetWindowText("现金子卡充值");
  99. }
  100. if(m_mode || m_bout)
  101. {
  102. GetDlgItem(IDC_STATIC3)->ShowWindow(0);
  103. GetDlgItem(IDC_EDIT2)->ShowWindow(0);
  104. }
  105. if(m_bout)
  106. GetDlgItem(IDC_STATIC2)->SetWindowText("提现金额:");
  107. return TRUE; // return TRUE unless you set the focus to a control
  108. // EXCEPTION: OCX Property Pages should return FALSE
  109. }