feeviewlist.cpp
来自「VC6.0环境下编写的一个交换机计费程序。」· C++ 代码 · 共 1,324 行 · 第 1/3 页
CPP
1,324 行
if ((atol(strtemp)&0x10)==0x10) //国内长途
ctl->SetItemText(i,9,"YES");
if ((atol(strtemp)&0x20)==0x20) //国际长途
ctl->SetItemText(i,10,"YES");
if ((atol(strtemp)&0x40)==0x40) //特殊
ctl->SetItemText(i,11,"YES");
pApp->m_pjifeiRecordset->MoveNext();
}
pApp->m_pjifeiRecordset->Close();
}
void CFeeView::feeteleQueryList(unsigned int titlemodifyflag,CString feetelenum,CString freepro)
{
CString strSql,strtemp;
unsigned int insertflag;
HRESULT result;
unsigned int i;
CListCtrl *ctl;
ctl=&GetListCtrl();
actViewWindow=VIEWFEETELEQUERY;
if (titlemodifyflag==TRUE)
{
RemoveAll();
i=0;
while(viewColumnNum!=0)
{
ctl->DeleteColumn(0);
viewColumnNum--;
i++;
if (i>100)
{
viewColumnNum=0;
}
}
//set front fee title
ctl->InsertColumn(viewColumnNum,"Called number",LVCFMT_LEFT,120);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Property",LVCFMT_LEFT,80);
viewColumnNum++;
ctl->DeleteAllItems();
}
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
if (feetelenum=="all")
strSql.Format("select * from feefreecalled");
else
{
unsigned int flag;
flag=0;
strtemp=="";
strSql.Format("select * from feefreecalled");
if (feetelenum!="")
{
strtemp.Format(" where callednum='%s'",feetelenum);
flag=1;
strSql=strSql+strtemp;
}
strtemp=="";
if (freepro!="")
{
if (flag==0)
{
strtemp.Format(" where property=%s",freepro);
flag=1;
strSql=strSql+strtemp;
}
else
strtemp.Format(" and property=%s",freepro);
}
}
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open feetele table");
}
i=0;
while(!pApp->m_pjifeiRecordset->adoEOF)
{
insertflag=0;
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("callednum"));
_variant_t varport;
varport=pApp->m_pjifeiRecordset->GetCollect("callednum");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->InsertItem(i,strtemp);
ctl->SetItemData(i,i);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("property"));
varport=pApp->m_pjifeiRecordset->GetCollect("property");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->SetItemText(i,1,strtemp);
pApp->m_pjifeiRecordset->MoveNext();
}
pApp->m_pjifeiRecordset->Close();
}
void CFeeView::MgmtQueryList(unsigned int titlemodifyflag)
{
if (userLoginPower!="2")
{
AfxMessageBox("Authority not high enough");
return;
}
CString strSql,strtemp;
HRESULT result;
unsigned int i;
RemovePreTimer();
RemoveAll();
RemoveAllColumn();
CListCtrl *ctl;
ctl=&GetListCtrl();
actViewWindow=VIEWMGMTQUERY;
if (titlemodifyflag==TRUE)
{
RemoveAll();
i=0;
while(viewColumnNum!=0)
{
ctl->DeleteColumn(0);
viewColumnNum--;
i++;
if (i>100)
{
viewColumnNum=0;
}
}
ctl->DeleteAllItems();
//set front fee title
ctl->InsertColumn(viewColumnNum,"Operator name",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Operator password",LVCFMT_LEFT,120);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Operator right",LVCFMT_LEFT,150);
viewColumnNum++;
actViewWindow=VIEWMGMTQUERY;
}
strSql.Format("select * from loginid");
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open loginid table");
}
i=0;
while(!pApp->m_pjifeiRecordset->adoEOF)
{
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("UserName"));
_variant_t varport;
varport=pApp->m_pjifeiRecordset->GetCollect("UserName");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->InsertItem(i,strtemp);
ctl->SetItemData(i,i);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("UserPwd"));
varport=pApp->m_pjifeiRecordset->GetCollect("UserPwd");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->SetItemText(i,1,strtemp);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("UserPower"));
varport=pApp->m_pjifeiRecordset->GetCollect("UserPower");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
if (strtemp=="1") strtemp="Ordinary";
else if (strtemp=="2") strtemp="Advanced";
ctl->SetItemText(i,2,strtemp);
pApp->m_pjifeiRecordset->MoveNext();
}
pApp->m_pjifeiRecordset->Close();
}
/*
float CFeeView::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 rural")
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";
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 + =
减小字号Ctrl + -
显示快捷键?