⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 balanceconditiondlg.cpp

📁 VC6.0环境下编写的一个交换机计费程序。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// balanceconditionDlg.cpp : implementation file
//

#include "stdafx.h"
#include "fee.h"
#include "feeext.h"
#include "balanceconditionDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CbalanceconditionDlg dialog


CbalanceconditionDlg::CbalanceconditionDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CbalanceconditionDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CbalanceconditionDlg)
	m_strendday = _T("");
	m_strendmonth = _T("");
	m_strendyear = _T("");
	m_startday = _T("");
	m_startmonth = _T("");
	m_startyear = _T("");
	m_strtelenum = _T("");
	m_strLocalCode = _T("");
	//}}AFX_DATA_INIT
}


void CbalanceconditionDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CbalanceconditionDlg)
	DDX_Control(pDX, IDC_PROGRESS1, m_progress);
	DDX_CBString(pDX, IDC_COMBO_ENDDAY, m_strendday);
	DDX_CBString(pDX, IDC_COMBO_ENDMONTH, m_strendmonth);
	DDX_CBString(pDX, IDC_COMBO_ENDYEAR, m_strendyear);
	DDX_CBString(pDX, IDC_COMBO_STARTDAY, m_startday);
	DDX_CBString(pDX, IDC_COMBO_STARTMONTH, m_startmonth);
	DDX_CBString(pDX, IDC_COMBO_STARTYEAR, m_startyear);
	DDX_Text(pDX, IDC_EDIT_TELENUM, m_strtelenum);
	DDX_Text(pDX, IDC_EDIT_LocalCode, m_strLocalCode);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CbalanceconditionDlg, CDialog)
	//{{AFX_MSG_MAP(CbalanceconditionDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CbalanceconditionDlg message handlers

BOOL CbalanceconditionDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_progress.SetRange(0,100);
	m_progress.SetPos(0);		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CbalanceconditionDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	/*
	CProgressCtrl	m_progress;
	CString	m_strendday;
	CString	m_strendmonth;
	CString	m_strendyear;
	CString	m_startday;
	CString	m_startmonth;
	CString	m_startyear;
	CString	m_strtelenum;	
	*/
	if (m_strtelenum=="")
	{
		AfxMessageBox("Settlement number cannot be blank");
	}
	if (m_strendday=="")
	{
		AfxMessageBox("Settlement end date cannot be blank");
	}
	if (m_strendmonth=="")
	{
		AfxMessageBox("Settlement end month cannot be blank");
	}
	if (m_strendyear=="")
	{
		AfxMessageBox("Settlement end year cannot be blank");
	}
	if (m_startday=="")
	{
		AfxMessageBox("Settlement start date cannot be blank");
	}
	if (m_startmonth=="")
	{
		AfxMessageBox("Settlement start month cannot be blank");
	}
	if (m_startyear=="")
	{
		AfxMessageBox("Settlement start year cannot be blank");
	}
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	
	CString strSql,strTemp,strTemp1;
	HRESULT result;
	long flag;
	flag=0;
	/*
	strSql.Format("select * from telephone where telephoneCode='%s'",m_strtelenum);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	if (!pApp->m_pjifeiRecordset->adoEOF)  //找到被叫局向
	{
		flag=1;
	}
	pApp->m_pjifeiRecordset->Close();
	if (flag==0)
	{
		AfxMessageBox("Calling number not registered");
		return;
	}
	*/
	long lstartyear,lstartmonth,lstartday;
	long lendyear,lendmonth,lendday;

	lstartyear=atol(m_startyear);
	lstartmonth=atol(m_startmonth);
	lstartday=atol(m_startday);
	lendyear=atol(m_strendyear);
	lendmonth=atol(m_strendmonth);
	lendday=atol(m_strendday);

	flag=0;

	if (lstartyear<2000)
		flag=1;
	if (lstartmonth<1||lstartmonth>12)
		flag=1;
	if (lstartday<1||lstartday>31)
		flag=1;
	if (lstartmonth==1||lstartmonth==3||lstartmonth==5||lstartmonth==7||lstartmonth==8||lstartmonth==10||lstartmonth==12)
	{
		if (lstartday>31)
		{
			flag=1;
		}
	}
	if (lstartmonth==4||lstartmonth==6||lstartmonth==9||lstartmonth==11)
	{
		if (lstartday>30)
		{
			flag=1;
		}
	}
	if(lstartmonth==2)
	{
		if ((lstartyear%4)==0)
		{
			if (lstartday>29)
			{
				flag=1;
			}
		}
		else
		{
			if (lstartday>28)
			{
				flag=1;
			}
		}
	}

	if (flag==1)
	{
		AfxMessageBox("timeset error");
		return;
	}
	flag=0;
	if (lendyear<2000)
		flag=1;
	if (lendmonth<1||lendmonth>12)
		flag=1;
	if (lendday<1||lendday>31)
		flag=1;
	if (lendmonth==1||lendmonth==3||lendmonth==5||lendmonth==7||lendmonth==8||lendmonth==10||lendmonth==12)
	{
		if (lendday>31)
		{
			flag=1;
		}
	}
	if (lendmonth==4||lendmonth==6||lendmonth==9||lendmonth==11)
	{
		if (lendday>30)
		{
			flag=1;
		}
	}
	if(lendmonth==2)
	{
		if ((lendyear%4)==0)
		{
			if (lendday>29)
			{
				flag=1;
			}
		}
		else
		{
			if (lendday>28)
			{
				flag=1;
			}
		}
	}

	if (flag==1)
	{
		AfxMessageBox("timeset error");
		return;
	}


	CString strlocalcode,straddlocalcode;
	long ltemplocal;
	long localflag;
	CString strtemplocal;

	strlocalcode=m_strLocalCode;
	localflag=0;
	if (strlocalcode!="")
	{
		localflag=1;
		ltemplocal=atol(m_strtelenum);
		straddlocalcode=strlocalcode;
		strtemplocal.Format("%d",ltemplocal);
		straddlocalcode+=strtemplocal;
	}


	strSql.Format("select * from spcrecord where spcCallingNum='%s' and \
		spcEndDate<=#%d-%d-%d# and 	spcEndDate>=#%d-%d-%d#",\
		m_strtelenum,lendyear,lendmonth,lendday,lstartyear,lstartmonth,lstartday);

	if (localflag==1)
	{
		strtemplocal.Format(" or spcCallingNum='%s'",straddlocalcode);
		strSql+=strtemplocal;
	}

	unsigned long spcrecordcount,donerecordcount;


	spcrecordcount=0;
	donerecordcount=0;
	pApp->m_pspcRecordset->CursorLocation=adUseClientBatch;
	result=pApp->m_pspcRecordset->Open(strSql.AllocSysString(),
		pApp->m_pspcConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open spcrecord table");
	}
	if (!pApp->m_pspcRecordset->adoEOF)
	{
		spcrecordcount=pApp->m_pspcRecordset->GetRecordCount();
	}
	CString strspcCallingNum,strspcCalledNum;
	CString strspcTalkEndDate,strspcTalkEndTime,strspcTalkTime;
	TCHAR strcalleddir[50];
	long lentemp,n;
	unsigned int pos;
	CString strspcTalkStartDate,strspcTalkStartTime,strstarttime,strstartfee,strsteptime,strstepfee,straddfee,strdirkind,strtalkfee;
	unsigned dirflag;
	long  lstarttime,lsteptime,ltalktime;
	float fstartfee,fstepfee,faddfee,ffee;
	n=0;
	n=1;
	while(!pApp->m_pspcRecordset->adoEOF)
	{
		_variant_t varport;
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcCallingNum"));
		if (varport.vt!=VT_NULL)
			strspcCallingNum =(char*)_bstr_t(varport);
		else 
			strspcCallingNum="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcCalledNum"));
		if (varport.vt!=VT_NULL)
			strspcCalledNum =(char*)_bstr_t(varport);
		else 
			strspcCalledNum="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartDate"));
		if (varport.vt!=VT_NULL)
			strspcTalkStartDate =(char*)_bstr_t(varport);
		else 
			strspcTalkStartDate="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkStartTime =(char*)_bstr_t(varport);
		else 
			strspcTalkStartTime="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndDate"));
		if (varport.vt!=VT_NULL)
			strspcTalkEndDate =(char*)_bstr_t(varport);
		else 
			strspcTalkEndDate="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkEndTime =(char*)_bstr_t(varport);
		else 
			strspcTalkEndTime="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcTalkTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkTime =(char*)_bstr_t(varport);
		else 
			strspcTalkTime="null";	
		//strspcCallingNum=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcCallingNum"));
		//strspcCalledNum=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcCalledNum"));
		//strspcTalkStartDate=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartDate"));
		//strspcTalkStartTime=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartTime"));
		//strspcTalkEndDate=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndDate"));
		//strspcTalkEndTime=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndTime"));
		//strspcTalkTime=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcTalkTime"));
		
		long flofee;
//		strgotdirkind="";
		flofee=feepro(strspcCallingNum,strspcCalledNum,strspcTalkStartDate,\
				strspcTalkStartTime,strspcTalkEndDate,strspcTalkEndTime,strspcTalkTime);
		if (flofee==99999)
		{
			strTemp.Format("Fail to find the charging office direction");
		}
		else if (flofee==88888)
		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -