ReCharge.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 == 2)
  72. paytype = _T("储值卡扣款");
  73. else if( seltype.m_radio1 == 3)
  74. paytype = _T("积分兑换");
  75. else if( seltype.m_radio1 == 4)
  76. paytype = _T("银行转账");
  77. else if( seltype.m_radio1 == 5)
  78. paytype = _T("代金券");
  79. else if( seltype.m_radio1 == 6)
  80. paytype = _T("支付宝");
  81. else if( seltype.m_radio1 == 7)
  82. paytype = _T("财付通");
  83. else if( seltype.m_radio1 == 8)
  84. paytype = _T("微信支付");
  85. else if(seltype.m_radio1 == 9)
  86. paytype = seltype.m_strCustomPayType;
  87. }
  88. CDialog::OnOK();
  89. }
  90. BOOL ReCharge::OnInitDialog()
  91. {
  92. CDialog::OnInitDialog();
  93. if(m_mode==0)
  94. {
  95. GetDlgItem(IDC_STATIC1)->ShowWindow(0);
  96. GetDlgItem(IDC_EDITcard2no)->ShowWindow(0);
  97. if(m_bout)SetWindowText(_T("主卡提现"));
  98. }
  99. else
  100. {
  101. if(m_bout)
  102. SetWindowText(_T("现金子卡提现"));
  103. else
  104. SetWindowText(_T("现金子卡充值"));
  105. }
  106. if(m_mode || m_bout)
  107. {
  108. GetDlgItem(IDC_STATIC3)->ShowWindow(0);
  109. GetDlgItem(IDC_EDIT2)->ShowWindow(0);
  110. }
  111. if(m_bout)
  112. GetDlgItem(IDC_STATIC2)->SetWindowText(_T("提现金额:"));
  113. return TRUE;
  114. }