📄 balancealltalkdlg.cpp
字号:
// balancealltalkDlg.cpp : implementation file
//
#include "stdafx.h"
#include "fee.h"
#include "feeview.h"
#include "feeext.h"
#include "balancealltalkDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CbalancealltalkDlg dialog
CbalancealltalkDlg::CbalancealltalkDlg(CWnd* pParent /*=NULL*/)
: CDialog(CbalancealltalkDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CbalancealltalkDlg)
m_strendday = _T("");
m_strendmonth = _T("");
m_strendyear = _T("");
m_strstartday = _T("");
m_strstartmonth = _T("");
m_strstartyear = _T("");
//}}AFX_DATA_INIT
}
void CbalancealltalkDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CbalancealltalkDlg)
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_strstartday);
DDX_CBString(pDX, IDC_COMBO_STARTMONTH, m_strstartmonth);
DDX_CBString(pDX, IDC_COMBO_STARTYEAR, m_strstartyear);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CbalancealltalkDlg, CDialog)
//{{AFX_MSG_MAP(CbalancealltalkDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CbalancealltalkDlg message handlers
BOOL CbalancealltalkDlg::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 CbalancealltalkDlg::OnOK()
{
UpdateData(TRUE);
if (m_strendday=="")
{
AfxMessageBox("Settlement end date cannot be blank");
return;
}
if (m_strendmonth=="")
{
AfxMessageBox("Settlement end month cannot be blank");
return;
}
if (m_strendyear=="")
{
AfxMessageBox("Settlement end year cannot be blank");
return;
}
if (m_strstartday=="")
{
AfxMessageBox("Settlement start date cannot be blank");
return;
}
if (m_strstartmonth=="")
{
AfxMessageBox("Settlement start month cannot be blank");
return;
}
if (m_strstartyear=="")
{
AfxMessageBox("Settlement start year cannot be blank");
return;
}
long lstartyear,lstartmonth,lstartday;
long lendyear,lendmonth,lendday;
lstartyear=atol(m_strstartyear);
lstartmonth=atol(m_strstartmonth);
lstartday=atol(m_strstartday);
lendyear=atol(m_strendyear);
lendmonth=atol(m_strendmonth);
lendday=atol(m_strendday);
long flag;
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 strSql,strTemp,strTemp1;
strSql.Format("select * from spcrecord where spcEndDate<=#%d-%d-%d# and \
spcEndDate>=#%d-%d-%d#",lendyear,lendmonth,lendday,lstartyear,lstartmonth,lstartday);
unsigned long spcrecordcount,donerecordcount;
HRESULT result;
spcrecordcount=0;
donerecordcount=0;
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
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 strspcTalkStartDate,strspcTalkStartTime,strspcTalkEndDate,strspcTalkEndTime,strspcTalkTime;
TCHAR strcalleddir[50];
long lentemp,n;
unsigned int pos;
CString 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"));
flag=1;
/*
strSql.Format("select * from telephone where telephoneCode='%s'",strspcCallingNum);
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==1)
{
long flofee;
strgetfeedirkind="";
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)
{
strTemp.Format("Fail to find the caller feature table");
}
else
{
/*
long lyuan,ljiao,lfen,lli;
flofee=flofee*10000;
lyuan=(flofee/10000);
ljiao=(flofee-lyuan*10000)/1000;
lfen=(flofee-lyuan*10000-ljiao*1000)/100;
lli=(flofee-lyuan*10000-ljiao*1000-lfen*100)/10;
if (lli>=5)
{
lfen++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -