📄 feequery.cpp
字号:
{
feetoll+=atol(strtemp);
feesum+=atol(strtemp);
timetoll+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetoll++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="International" &&binternational==TRUE)
{
feeinternational+=atol(strtemp);
feesum+=atol(strtemp);
timeinternational+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timeinternational++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="Special"&&bspecial == TRUE )
{
feespecial+=atol(strtemp);
feesum+=atol(strtemp);
timespecial+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timespecial++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
pApp->m_pjifei2Recordset->MoveNext();
}
pApp->m_pjifei2Recordset->Close();
ctl->InsertItem(i,callingnum);
ctl->SetItemData(i,i);
if (binterior == TRUE)
{
strtemp.Format("%d",feeinterior);
ctl->SetItemText(i,Interiorfeecol,strtemp);
}
if(blocal==TRUE)
{
strtemp.Format("%d",feelocal);
ctl->SetItemText(i,localfeecol,strtemp);
}
if (btoll == TRUE)
{
strtemp.Format("%d",feetoll);
ctl->SetItemText(i,tollfeecol,strtemp);
}
if (binternational==TRUE)
{
strtemp.Format("%d",feeinternational);
ctl->SetItemText(i,Internationalfeecol,strtemp);
}
if(bspecial == TRUE)
{
strtemp.Format("%d",feespecial);
ctl->SetItemText(i,specfeecol,strtemp);
}
strtemp.Format("%d",feesum);
ctl->SetItemText(i,totalfeecol,strtemp);
if (binterior == TRUE)
{
strtemp.Format("%d",timeinterior);
ctl->SetItemText(i,Interiortimecol,strtemp);
}
if(blocal==TRUE)
{
strtemp.Format("%d",timelocal);
ctl->SetItemText(i,localtimecol,strtemp);
}
if (btoll == TRUE)
{
strtemp.Format("%d",timetoll);
ctl->SetItemText(i,tolltimecol,strtemp);
}
if (binternational==TRUE)
{
strtemp.Format("%d",timeinternational);
ctl->SetItemText(i,Internationaltimecol,strtemp);
}
if(bspecial == TRUE)
{
strtemp.Format("%d",timespecial);
ctl->SetItemText(i,spectimecol,strtemp);
}
strtemp.Format("%d",timetotal);
ctl->SetItemText(i,totaltimecol,strtemp);
}
}
}
else
{
for(i=0;i<querycallingnum;i++)
{
callingnum=querycalling[i];
strSql.Format("select * from balancefee where callingnum='%s'", callingnum);
localcodeflag=0;
straddlocal="";
if (strlocalcode!="")
{
localcodeflag=1;
ltemp=atol(callingnum);
straddlocal=strlocalcode;
straddlocal+=callingnum;
}
if (localcodeflag==1)
{
strtemp.Format(" or CallingNum='%s'",straddlocal);
strSql+=strtemp;
}
if (startdateflag==2)
{
strtemp.Format(" and talkenddate>=#%d-%d-%d#",lstartyear,lstartmonth,lstartday);
strSql+=strtemp;
}
if (enddateflag==2)
{
strtemp.Format(" and talkenddate<=#%d-%d-%d#",lendyear,lendmonth,lendday);
strSql+=strtemp;
}
result=pApp->m_pjifei2Recordset->Open(strSql.AllocSysString(),
pApp->m_pjifei2Connection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open balancefee table");
}
long feesum;
long feeinterior,feelocal,feetoll;
long feeinternational,feespecial;
long flotemp;
feesum=0;
feeinterior=0; feelocal=0;
feetoll=0; feeinternational=0;
feespecial=0;
long timeinterior,timelocal,timetoll;
long timeinternational,timespecial;
long timetemp,timetotal;
timeinterior=0; timelocal=0;
timetoll=0; timeinternational=0;
timespecial=0,timetotal=0;
while(!pApp->m_pjifei2Recordset->adoEOF)
{
// strtemp=(char*)(_bstr_t)pApp->m_pjifei2Recordset->GetCollect(_variant_t("talkfee"));
// strtemp1=(char*)(_bstr_t)pApp->m_pjifei2Recordset->GetCollect(_variant_t("talkkind"));
// strtemp2=(char*)(_bstr_t)pApp->m_pjifei2Recordset->GetCollect(_variant_t("talktime"));
_variant_t varport;
varport=pApp->m_pjifei2Recordset->GetCollect("talkfee");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
varport=pApp->m_pjifei2Recordset->GetCollect("talkkind");
if (varport.vt!=VT_NULL)
strtemp1 =(char*)_bstr_t(varport);
else
strtemp1="null";
varport=pApp->m_pjifei2Recordset->GetCollect("talktime");
if (varport.vt!=VT_NULL)
strtemp2 =(char*)_bstr_t(varport);
else
strtemp2="null";
if ((atol(strtemp))==0)
{
pApp->m_pjifei2Recordset->MoveNext();
continue;
}
if (strtemp1=="interior" && binterior == TRUE)
{
feeinterior+=atol(strtemp);
feesum+=atol(strtemp);
timeinterior+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timeinterior++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="local" && blocal==TRUE)
{
feelocal+=atol(strtemp);
feesum+=atol(strtemp);
timelocal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timelocal++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="Toll" && btoll == TRUE)
{
feetoll+=atol(strtemp);
feesum+=atol(strtemp);
timetoll+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetoll++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="International" &&binternational==TRUE)
{
feeinternational+=atol(strtemp);
feesum+=atol(strtemp);
timeinternational+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timeinternational++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
if (strtemp1=="Special"&&bspecial == TRUE )
{
feespecial+=atol(strtemp);
feesum+=atol(strtemp);
timespecial+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timespecial++;
timetotal+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timetotal++;
}
pApp->m_pjifei2Recordset->MoveNext();
}
pApp->m_pjifei2Recordset->Close();
ctl->InsertItem(i,callingnum);
ctl->SetItemData(i,i);
if (binterior == TRUE)
{
strtemp.Format("%d",feeinterior);
ctl->SetItemText(i,Interiorfeecol,strtemp);
}
if(blocal==TRUE)
{
strtemp.Format("%d",feelocal);
ctl->SetItemText(i,localfeecol,strtemp);
}
if (btoll == TRUE)
{
strtemp.Format("%d",feetoll);
ctl->SetItemText(i,tollfeecol,strtemp);
}
if (binternational==TRUE)
{
strtemp.Format("%d",feeinternational);
ctl->SetItemText(i,Internationalfeecol,strtemp);
}
if(bspecial == TRUE)
{
strtemp.Format("%d",feespecial);
ctl->SetItemText(i,specfeecol,strtemp);
}
strtemp.Format("%d",feesum);
ctl->SetItemText(i,totalfeecol,strtemp);
if (binterior == TRUE)
{
strtemp.Format("%d",timeinterior);
ctl->SetItemText(i,Interiortimecol,strtemp);
}
if(blocal==TRUE)
{
strtemp.Format("%d",timelocal);
ctl->SetItemText(i,localtimecol,strtemp);
}
if (btoll == TRUE)
{
strtemp.Format("%d",timetoll);
ctl->SetItemText(i,tolltimecol,strtemp);
}
if (binternational==TRUE)
{
strtemp.Format("%d",timeinternational);
ctl->SetItemText(i,Internationaltimecol,strtemp);
}
if(bspecial == TRUE)
{
strtemp.Format("%d",timespecial);
ctl->SetItemText(i,spectimecol,strtemp);
}
strtemp.Format("%d",timetotal);
ctl->SetItemText(i,totaltimecol,strtemp);
}
}
}
void CFeeView::OnReportQueryAfterSet()
{
// TODO: Add your command handler code here
CrecordDlg recorddetailDlg;
RemovePreTimer();
int nResponse;
nResponse=recorddetailDlg.DoModal();
if (nResponse!=IDOK)
{
return;
}
RemoveAll();
RemoveAllColumn();
RemovePreTimer();
actViewWindow=VIEWTALKREPORTCDRQUERY;
long propertyflag;
CListCtrl *ctl;
ctl=&GetListCtrl();
ctl->InsertColumn(viewColumnNum,"Calling number",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Called number",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Start date",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Start time",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"End date",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"End time",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Call duration(s)",LVCFMT_LEFT,100);
viewColumnNum++;
CString strSql,strtemp,strtemp1,strtemp2;
CString querycalling[10000];
CString callingcondition[100];
CString strlocalcode;
int querycallingnum,conditionnum;
HRESULT result;
long i,j,ltemp,ltemp1,ltemp2;
int pos;
long localcodeflag;
CString straddlocal;
strlocalcode="";
querycallingnum=0;
conditionnum=0;
strtemp=recorddetailDlg.m_strinputnum;
strlocalcode=recorddetailDlg.m_strLocalCode;
if (strtemp!="")
{
//if (strtemp.Find("-")!=-1)
while (strtemp.Find("&")!=-1)
{
pos=strtemp.Find("&");
strtemp1=strtemp.Left(pos);
strtemp.Delete(0,pos+1);
callingcondition[conditionnum]=strtemp1;
conditionnum++;
if (conditionnum>100)
{
AfxMessageBox("condition too large");
return;
}
}
if (strtemp!="")
{
callingcondition[conditionnum]=strtemp;
conditionnum++;
if (conditionnum>100)
{
AfxMessageBox("condition too large");
return;
}
}
}
for(i=0;i<conditionnum;i++)
{
if ((callingcondition[i].Find("-"))==-1)
{
ltemp=atol(callingcondition[i]);
if (querycallingnum>10000)
{
AfxMessageBox("telenum too large");
return;
}
querycalling[querycallingnum].Format("%d",ltemp);
//querycalling[querycallingnum]=callingcondition[i];
querycallingnum++;
}
else
{
pos=callingcondition[i].Find("-");
strtemp1=callingcondition[i].Left(pos);
ltemp1=atol(strtemp1);
callingcondition[i].Delete(0,pos+1);
strtemp2=callingcondition[i];
ltemp2=atol(strtemp2);
if (ltemp2<ltemp1)
{
AfxMessageBox("telenum input error");
return;
}
if ((querycallingnum+(ltemp2-ltemp1)+1)>10000)
{
AfxMessageBox("telenum range too large");
return;
}
for(j=ltemp1;j<=ltemp2;j++)
{
querycalling[querycallingnum].Format("%d",j);
querycallingnum++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -