📄 balancealltalkdlg.cpp
字号:
if (lfen>=10)
{
lfen=0;
ljiao++;
if (ljiao>=10)
{
ljiao=0;
lyuan++;
}
}
}
strTemp.Format("%d.",lyuan);
strTemp1.Format("%d",ljiao);
strTemp=strTemp+strTemp1;
strTemp1.Format("%d",lfen);
strTemp=strTemp+strTemp1;
*/
COleDateTime ttdate,ttime;
long lyear,lmonth,lday,lhour,lminute,lsecond;
ttdate.ParseDateTime(strspcTalkEndDate,VAR_DATEVALUEONLY);
ttime.ParseDateTime(strspcTalkEndTime,VAR_TIMEVALUEONLY);
lyear=ttdate.GetYear();
lmonth=ttdate.GetMonth();
lday=ttdate.GetDay();
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
strSql.Format("select * from balancefee where callingnum='%s' and \
callednum='%s' and talktime=%d and talkenddate=#%d-%d-%d# and \
talkendtime=#%d:%d:%d#",strspcCallingNum,strspcCalledNum,atol(strspcTalkTime),\
lyear,lmonth,lday,lhour,lminute,lsecond);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!pApp->m_pjifeiRecordset->adoEOF) //找到主叫特征表
{
}
else
{
pApp->m_pjifeiRecordset->AddNew();
}
pApp->m_pjifeiRecordset->PutCollect("callingnum",_variant_t(strspcCallingNum));
pApp->m_pjifeiRecordset->PutCollect("callednum",_variant_t(strspcCalledNum));
pApp->m_pjifeiRecordset->PutCollect("talktime",_variant_t(strspcTalkTime));
pApp->m_pjifeiRecordset->PutCollect("talkenddate",_variant_t(strspcTalkEndDate));
pApp->m_pjifeiRecordset->PutCollect("talkendtime",_variant_t(strspcTalkEndTime));
pApp->m_pjifeiRecordset->PutCollect("talkfee",_variant_t(flofee));
pApp->m_pjifeiRecordset->PutCollect("talkkind",_variant_t(strgetfeedirkind));
pApp->m_pjifeiRecordset->Update();
pApp->m_pjifeiRecordset->Close();
}
}
donerecordcount++;
pos=((donerecordcount*100)/spcrecordcount);
m_progress.SetPos(pos);
pApp->m_pspcRecordset->MoveNext();
}
pApp->m_pspcRecordset->Close();
AfxMessageBox("Settlement finished");
CDialog::OnOK();
}
void CbalancealltalkDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
/*
float CbalancealltalkDlg::feepro(CString strcallingnum,CString strcallednum,CString strcallstartdate,\
CString strcallstarttime,CString strcallenddate,CString strcallendtime,\
CString strtalktime)
{
unsigned n;
int lentemp,dirflag,ltmp,ltmp1;
unsigned long lchip,i;
float chipper[72000];
CString strfee,strfeestarttime,strfeestartfee,strfeesteptime;
CString strfeestepfee,strfeedirkind,strfeeaddfee;
CString strdirkind;
CString strSql,strTemp;
TCHAR strcalleddir[50];
CString strstartper,strstepper,straddper;
HRESULT result;
lentemp=strlen(strcallednum);
dirflag=0;
strdirkind="";
lchip=0;
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
for(n=0;n<lentemp;n++)
{
lstrcpyn(strcalleddir,strcallednum,n+2);
strSql.Format("select * from feedirection where feedirection='%s'",strcalleddir);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open feedirection table");
}
if (!pApp->m_pjifeiRecordset->adoEOF) //找到被叫局向
{
strfeestarttime=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestarttime"));
strfeestartfee=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestartfee"));
strfeesteptime=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feesteptime"));
strfeestepfee=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestepfee"));
strfeeaddfee=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feeaddfee"));
strfeedirkind=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedirectionkind"));
if (strfeedirkind=="Intra-cell rura")
strfeedirkind="1";
if (strfeedirkind=="Intra-cell local")
strfeedirkind="2";
if (strfeedirkind=="Inter-cell rural")
strfeedirkind="4";
if (strfeedirkind=="Inter-cell local")
strfeedirkind="8";
if (strfeedirkind=="Toll")
strfeedirkind="16";
if (strfeedirkind=="International")
strfeedirkind="32";
if (strfeedirkind=="Special")
strfeedirkind="64";
strgotdirkind=strfeedirkind;
n=lentemp+1;
if (atol(strtalktime)>atol(strfeestarttime))
{
ltmp=atol(strtalktime)-atol(strfeestarttime);
ltmp1=atol(strfeesteptime);
lchip=ltmp/ltmp1;
if ((ltmp%ltmp1)!=0)
lchip++;
}
for(i=0;i<(lchip+1);i++)
{
chipper[i]=1;
}
dirflag=1;
}
pApp->m_pjifeiRecordset->Close();
}
if (dirflag==0)
{
return (9.9999);
}
else
{
dirflag=0;
strSql.Format("select * from feetele where feetelenum='%s'",strcallingnum);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!pApp->m_pjifeiRecordset->adoEOF) //找到主叫特征表
{
strstartper=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestartper"));
strstepper=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestepper"));
straddper=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feeaddper"));
dirflag=1;
}
pApp->m_pjifeiRecordset->Close();
}
if (dirflag==0)
{
return (8.8888);
}
else
{
strSql.Format("select * from feetimechange");
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
while (!pApp->m_pjifeiRecordset->adoEOF) //找到优惠时段
{
COleDateTime ttime,ttdate;
long lchangestarttime,lchangeendtime;
long lspcstarttime,lspcendtime,ltime,lday;
long lhour,lminute,lsecond;
CString strchangeper,strchangestartdate;
CString strchangeenddate,strchangekind;
CString strdaychangestarttime,strdaychangeendtime;
long ldirkind,lchangekind;
strchangekind=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feetimechangekind"));
ldirkind=atol(strfeedirkind);
lchangekind=atol(strchangekind);
strchangeper=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feetimechangedecper"));
strchangestartdate=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feetimechangestartdate"));
strchangeenddate=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feetimechangeenddate"));
strdaychangestarttime=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedaychangestarttime"));
strdaychangeendtime=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedaychangeendtime"));
if ((ldirkind&lchangekind)!=0)
{
//只有优惠时段。
if ((strchangestartdate=="1970-1-1")&&\
(strchangeenddate=="1970-1-1"))
{
ttime.ParseDateTime(strdaychangestarttime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lchangestarttime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strdaychangeendtime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lchangeendtime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strcallstarttime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lspcstarttime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strcallendtime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lspcendtime=lhour*3600+lminute*60+lsecond;
ltime=lspcstarttime;
for(i=0;i<lchip;i++)
{
if ((ltime>=lchangestarttime)&&
(ltime<=lchangeendtime))
{
float flotmp;
flotmp=atol(strchangeper)*0.01;
chipper[i]=chipper[i]*(1-flotmp);
}
if (i==0)
ltime=ltime+atol(strfeestarttime);
else
ltime=ltime+atol(strfeesteptime);
if (ltime>3600*24)
{
ltime=0;
}
}
}
//有优惠日期和优惠时段
else
{
double lchangestartday,lchangeendday;
double lspcstartday,lspcendday;
//以2006-1-1为相对起点进行计算
strTemp="2006-1-1";
COleDateTime ttdate1;
ttdate1.ParseDateTime(strTemp,VAR_DATEVALUEONLY);
ttdate.ParseDateTime(strchangestartdate,VAR_DATEVALUEONLY);
lchangestartday=difftime(ttdate, ttdate1);
ttdate.ParseDateTime(strchangeenddate,VAR_DATEVALUEONLY);
lchangeendday=difftime(ttdate, ttdate1);
ttdate.ParseDateTime(strcallstartdate,VAR_DATEVALUEONLY);
lspcstartday=difftime(ttdate, ttdate1);
ttdate.ParseDateTime(strcallstartdate,VAR_DATEVALUEONLY);
lspcendday=difftime(ttdate, ttdate1);
ttime.ParseDateTime(strdaychangestarttime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lchangestarttime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strdaychangeendtime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lchangeendtime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strcallstarttime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lspcstarttime=lhour*3600+lminute*60+lsecond;
ttime.ParseDateTime(strcallendtime,VAR_TIMEVALUEONLY);
lhour=ttime.GetHour();
lminute=ttime.GetMinute();
lsecond=ttime.GetSecond();
lspcendtime=lhour*3600+lminute*60+lsecond;
ltime=lspcstarttime;
lday=lspcstartday;
for(i=0;i<lchip;i++)
{
if ((lday>=lchangestartday)&&
(lday<=lchangeendday))
{
if ((ltime>=lchangestarttime)&&
(ltime<=lchangeendtime))
{
float flotmp;
flotmp=atol(strchangeper)*0.01;
chipper[i]=chipper[i]*(1-flotmp);
}
if (i==0)
ltime=ltime+atol(strfeestarttime);
else
ltime=ltime+atol(strfeesteptime);
if (ltime>3600*24)
{
lday++;
ltime=0;
}
}
}
}
}
pApp->m_pjifeiRecordset->MoveNext();
}
pApp->m_pjifeiRecordset->Close();
}
float flotalkfee;
flotalkfee=0;
for(i=0;i<lchip;i++)
{
if (i==0)
{
flotalkfee=flotalkfee+chipper[i]*(atol(strstartper)*0.01)*atof(strfeestartfee);
}
else
flotalkfee=flotalkfee+chipper[i]*(atol(strstepper)*0.01)*atof(strfeestepfee);
}
flotalkfee=flotalkfee+(atol(straddper)*0.01)*atof(strfeeaddfee);
return(flotalkfee);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -