ReCharge.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. ReCharge::ReCharge(CWnd* pParent /*=NULL*/): CDialog(ReCharge::IDD, pParent)
  13. {
  14. m_money = _T("");
  15. m_name = _T("");
  16. m_no = _T("");
  17. m_card2no = _T("");
  18. m_money2 = _T("");
  19. m_strRechargeRemark = _T("");
  20. m_bout=m_mode=0;
  21. }
  22. void ReCharge::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. DDX_Control(pDX, IDC_EDIT2, m_editnum2);
  26. DDX_Control(pDX, IDC_EDIT1, m_editnum);
  27. DDX_Text(pDX, IDC_EDIT1, m_money);
  28. DDX_Text(pDX, IDC_EDITname, m_name);
  29. DDX_Text(pDX, IDC_EDITno, m_no);
  30. DDX_Text(pDX, IDC_EDITcard2no, m_card2no);
  31. DDX_Text(pDX, IDC_EDIT2, m_money2);
  32. DDX_Text(pDX, IDC_EDIT3, m_strRechargeRemark);
  33. }
  34. BEGIN_MESSAGE_MAP(ReCharge, CDialog)
  35. END_MESSAGE_MAP()
  36. void ReCharge::OnOK()
  37. {
  38. UpdateData();
  39. if(m_mode==0 && m_bout==0)
  40. {
  41. if( atoi(m_money)<=0 && atoi(m_money2)<=0)
  42. return;
  43. }
  44. else if( atoi(m_money)<=0)
  45. {
  46. return;
  47. }
  48. if(m_bout==0 && m_mode && atoi(m_balance)<atoi(m_money))
  49. {
  50. AfxMessageBox(_T("账号余额不足!"), MB_ICONINFORMATION);
  51. return;
  52. }
  53. if(m_bout) // 提现;m_balance:余额, m_money:提现金额;
  54. {
  55. if( (atoi(m_balance)-atoi(m_money)) <0 )
  56. {
  57. AfxMessageBox(_T("账号余额不足!"), MB_ICONINFORMATION);
  58. return;
  59. }
  60. }
  61. if(m_mode==0 && m_bout==0)
  62. {
  63. SelPayType seltype;
  64. seltype.m_mode=1;
  65. if(seltype.DoModal() != IDOK)
  66. return;
  67. if(seltype.m_radio1==0)
  68. paytype = _T("现金");
  69. else if(seltype.m_radio1==1)
  70. paytype = _T("POS机刷卡");
  71. else if(seltype.m_radio1==4)
  72. paytype = _T("银行转账");
  73. else if(seltype.m_radio1 == 9)
  74. paytype = seltype.m_strCustomPayType;
  75. }
  76. CDialog::OnOK();
  77. }
  78. BOOL ReCharge::OnInitDialog()
  79. {
  80. CDialog::OnInitDialog();
  81. if(m_mode==0)
  82. {
  83. GetDlgItem(IDC_STATIC1)->ShowWindow(0);
  84. GetDlgItem(IDC_EDITcard2no)->ShowWindow(0);
  85. if(m_bout)SetWindowText(_T("主卡提现"));
  86. }
  87. else
  88. {
  89. if(m_bout)
  90. SetWindowText(_T("现金子卡提现"));
  91. else
  92. SetWindowText(_T("现金子卡充值"));
  93. }
  94. if(m_mode || m_bout)
  95. {
  96. GetDlgItem(IDC_STATIC3)->ShowWindow(0);
  97. GetDlgItem(IDC_EDIT2)->ShowWindow(0);
  98. }
  99. if(m_bout)
  100. GetDlgItem(IDC_STATIC2)->SetWindowText(_T("提现金额:"));
  101. return TRUE;
  102. }