AgentManager/DLG_TJVipInt.cpp
2025-01-22 15:45:17 +08:00

119 lines
2.7 KiB
C++
Raw Blame History

// DLG_TJVipInt.cpp : implementation file
//
#include "stdafx.h"
#include "smsmanager.h"
#include "DLG_TJVipInt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DLG_TJVipInt dialog
DLG_TJVipInt::DLG_TJVipInt(CWnd* pParent /*=NULL*/)
: CDialog(DLG_TJVipInt::IDD, pParent)
{
//{{AFX_DATA_INIT(DLG_TJVipInt)
m_strPrice = _T("");
m_strPriceOne = _T("0.10");
m_strSMSCount = _T("");
m_strPresent = _T("");
m_strPriceOne2 = _T("");
m_strVipInt = _T("");
//}}AFX_DATA_INIT
m_pMainFrame = (CMainFrame*)pParent;
}
void DLG_TJVipInt::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DLG_TJVipInt)
DDX_Text(pDX, IDC_USER_PAYMODIFY_PRICE, m_strPrice);
DDX_Text(pDX, IDC_USER_PAYMODIFY_PRICEONE, m_strPriceOne);
DDX_Text(pDX, IDC_USER_PAYMODIFY_SMSCOUNT, m_strSMSCount);
DDX_Text(pDX, IDC_USER_PAYMODIFY_PRESEND, m_strPresent);
DDX_Text(pDX, IDC_USER_PAYMODIFY_PRICEONE2, m_strPriceOne2);
DDX_Text(pDX, IDC_USER_PAYMODIFY_VIPINT, m_strVipInt);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DLG_TJVipInt, CDialog)
//{{AFX_MSG_MAP(DLG_TJVipInt)
ON_EN_CHANGE(IDC_USER_PAYMODIFY_PRICE, OnChangeUserPaymodifyPrice)
ON_EN_CHANGE(IDC_USER_PAYMODIFY_PRICEONE, OnChangeUserPaymodifyPriceone)
ON_EN_CHANGE(IDC_USER_PAYMODIFY_PRESEND, OnChangeUserPaymodifyPresend)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLG_TJVipInt message handlers
void DLG_TJVipInt::OnChangeUserPaymodifyPrice()
{
ResetSMSUsed();
}
void DLG_TJVipInt::OnChangeUserPaymodifyPriceone()
{
ResetSMSUsed();
}
void DLG_TJVipInt::OnChangeUserPaymodifyPresend()
{
ResetSMSUsed();
}
void DLG_TJVipInt::ResetSMSUsed()
{
this->UpdateData( true );
long lSMSCount=0;
long lPresent = 0;
double fPrice = _tstof( m_strPrice );
double fPriceOne = _tstof( m_strPriceOne );
if ( fPriceOne <= 0 )
{
lSMSCount = 0;
}
else
{
lPresent = _ttol( m_strPresent );
double l = fPrice/fPriceOne;
long a = long(l+0.5f);
if ( l< 0 )
a = long(l-0.5f);
lSMSCount = (long)a + lPresent;
}
m_strSMSCount.Format( _T("%d") , lSMSCount );
float fPriceOne2 = fPrice/(float)lSMSCount;
m_strPriceOne2.Format( _T("%.4f") , fPriceOne2 );
//m_lCommend_Vipint = (long)(((fPriceOne2*100.0f-6.0f)/20.0f)*m_Pay.fPrice + 0.5f);
long lVipInt = (long)(((fPriceOne2*100.0f-6.0f)/20.0f)*fPrice + 0.5f);
m_strVipInt.Format( _T("%d") , lVipInt );
if ( lVipInt<300 && fPrice>=1000.0f )
{
lVipInt = 300;
m_strVipInt.Format( _T("%d [<5B><><EFBFBD><EFBFBD>]") , lVipInt );
}
this->UpdateData( false );
}
void DLG_TJVipInt::OnOK()
{
CDialog::OnOK();
}