📄 feeview.cpp
字号:
if (strtemp1=="International")
{
feeinternational+=atol(strtemp);
feesum+=atol(strtemp);
timeinternational+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timeinternational++;
}
if (strtemp1=="Special")
{
feespecial+=atol(strtemp);
feesum+=atol(strtemp);
timespecial+=((atol(strtemp2))/60);
if (((atol(strtemp2))%60)!=0)
timespecial++;
}
pApp->m_pjifei2Recordset->MoveNext();
}
pApp->m_pjifei2Recordset->Close();
ctl->InsertItem(i,callingnum);
ctl->SetItemData(i,i);
strtemp.Format("%d",feesum);
ctl->SetItemText(i,1,strtemp);
strtemp.Format("%d",feeinterior);
ctl->SetItemText(i,2,strtemp);
strtemp.Format("%d",feelocal);
ctl->SetItemText(i,3,strtemp);
strtemp.Format("%d",feetoll);
ctl->SetItemText(i,4,strtemp);
strtemp.Format("%d",feeinternational);
ctl->SetItemText(i,5,strtemp);
strtemp.Format("%d",feespecial);
ctl->SetItemText(i,6,strtemp);
strtemp.Format("%d",timeinterior);
ctl->SetItemText(i,7,strtemp);
strtemp.Format("%d",timelocal);
ctl->SetItemText(i,8,strtemp);
strtemp.Format("%d",timetoll);
ctl->SetItemText(i,9,strtemp);
strtemp.Format("%d",timeinternational);
ctl->SetItemText(i,10,strtemp);
strtemp.Format("%d",timespecial);
ctl->SetItemText(i,11,strtemp);
i++;
}
}
}
void CFeeView::OnTalkrecordDetail()
{
// TODO: Add your command handler code here
CtalkrecorddetailDlg recorddetailDlg;
int nResponse;
RemoveAll();
RemoveAllColumn();
RemovePreTimer();
actViewWindow=VIEWTALKRECORDDETAILQUERY;
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,"Call duration(s)",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Call end time",LVCFMT_LEFT,150);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Call fee(ks)",LVCFMT_LEFT,100);
viewColumnNum++;
ctl->InsertColumn(viewColumnNum,"Call property",LVCFMT_LEFT,100);
viewColumnNum++;
nResponse=recorddetailDlg.DoModal();
if (nResponse!=IDOK)
{
return;
}
CString telenum;
long lstartyear,lstartmonth,lstartday;
long lendyear,lendmonth,lendday;
CString strlocalcode,straddlocalcode;
long ltemplocal;
long localflag;
CString strtemplocal;
lstartyear=atol(recorddetailDlg.m_strstartyear);
lstartmonth=atol(recorddetailDlg.m_strstartmonth);
lstartday=atol(recorddetailDlg.m_strstartday);
lendyear=atol(recorddetailDlg.m_strendyear);
lendmonth=atol(recorddetailDlg.m_strendmonth);
lendday=atol(recorddetailDlg.m_strendday);
telenum=recorddetailDlg.m_strtelenum;
strlocalcode=recorddetailDlg.m_strLocalCode;
localflag=0;
if (strlocalcode!="")
{
localflag=1;
ltemplocal=atol(telenum);
straddlocalcode=strlocalcode;
strtemplocal.Format("%d",ltemplocal);
straddlocalcode+=strtemplocal;
}
long flag;
flag=0;
flag=availdate(lstartyear,lstartmonth,lstartday);
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
flag=availdate(lendyear,lendmonth,lendday);
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
CString strSql,strtemp,strtemp1;
strSql.Format("select * from balancefee where callingnum='%s' and \
talkenddate<=#%d-%d-%d# and talkenddate>=#%d-%d-%d#",\
telenum,lendyear,lendmonth,lendday,lstartyear,lstartmonth,lstartday);
if (localflag==1)
{
strtemplocal.Format(" or callingnum='%s'",straddlocalcode);
strSql+=strtemplocal;
}
HRESULT result;
unsigned int i;
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 balancefee table");
}
i=0;
while(!pApp->m_pjifeiRecordset->adoEOF)
{
_variant_t varport;
varport=pApp->m_pjifeiRecordset->GetCollect("callingnum");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("callingnum"));
ctl->InsertItem(i,strtemp);
ctl->SetItemData(i,i);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("callednum"));
varport=pApp->m_pjifeiRecordset->GetCollect("callednum");
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("talktime"));
varport=pApp->m_pjifeiRecordset->GetCollect("talktime");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->SetItemText(i,2,strtemp);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("talkenddate"));
//strtemp1=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("talkendtime"));
varport=pApp->m_pjifeiRecordset->GetCollect("talkenddate");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
varport=pApp->m_pjifeiRecordset->GetCollect("talkendtime");
if (varport.vt!=VT_NULL)
strtemp1 =(char*)_bstr_t(varport);
else
strtemp1="null";
strtemp=strtemp+" "+strtemp1;
ctl->SetItemText(i,3,strtemp);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("talkfee"));
varport=pApp->m_pjifeiRecordset->GetCollect("talkfee");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
ctl->SetItemText(i,4,strtemp);
//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("talkkind"));
varport=pApp->m_pjifeiRecordset->GetCollect("talkkind");
if (varport.vt!=VT_NULL)
strtemp =(char*)_bstr_t(varport);
else
strtemp="null";
/*
if (strtemp=="1")
strtemp="Intra-cell rural call";
if (strtemp=="2") //区内市话
strtemp="Intra-cell local call";
if (strtemp=="4") //区间农话
strtemp="Inter-cell rural call";
if (strtemp=="8") //区间市话
strtemp="Inter-cell local call";
if (strtemp=="16") //国内长途
strtemp="Toll";
if (strtemp=="32") //国际长途
strtemp="International call";
if (strtemp=="64") //特殊
strtemp="Special office direction";
*/
ctl->SetItemText(i,5,strtemp);
i++;
pApp->m_pjifeiRecordset->MoveNext();
}
pApp->m_pjifeiRecordset->Close();
}
void CFeeView::OnMdbBackupSpc()
{
// TODO: Add your command handler code here
if (userLoginPower!="2")
{
AfxMessageBox("Authority not high enough");
return;
}
RemoveAll();
RemoveAllColumn();
RemovePreTimer();
HRESULT hr;
SYSTEMTIME CurTime;
CString sYear,sMonth,sDay,sHour,sMinute,sSecond;
GetLocalTime(&CurTime);
sYear.Format("%d",CurTime.wYear);
sMonth.Format("%d",CurTime.wMonth);
if (CurTime.wMonth<10)
sMonth="0"+sMonth;
sDay.Format("%d",CurTime.wDay);
if (CurTime.wDay<10)
sDay="0"+sDay;
sHour.Format("%d",CurTime.wHour);
if (CurTime.wHour<10)
sHour="0"+sHour;
sMinute.Format("%d",CurTime.wMinute);
if (CurTime.wMinute<10)
sMinute="0"+sMinute;
sSecond.Format("%d",CurTime.wSecond);
if (CurTime.wSecond<10)
sSecond="0"+sSecond;
CString cs;
cs="spc";
cs+=sYear+sMonth+sDay+sHour+sMinute+sSecond;
cs="d:\\twdMdbBak\\spcbak\\"+cs+".mdb";
CString strcnn,strtmp;
strcnn="Provider=Microsoft.JET.OLEDB.4.0;";
strtmp.Format("Data source='%s'",cs);
strcnn=strcnn+strtmp;
//CString strcnn(_T("Provider=Microsoft.JET.OLEDB.4.0;Data source =spcbak.mdb"));
ADOX::_CatalogPtr m_pCatalog = NULL;
hr = m_pCatalog.CreateInstance(__uuidof (ADOX::Catalog));
if (FAILED(hr))
{
_com_issue_error(hr);
}
else
{
m_pCatalog->Create(_bstr_t(strcnn)); //Create MDB
}
CString strPath,strPath1,strPath2;
unsigned char flag;
flag=0;
GetModuleFileName(NULL,strPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH);
strPath.ReleaseBuffer();
int nPos;
nPos=strPath.ReverseFind ('\\');
strPath=strPath.Left (nPos-5);
strPath1="d:\\twdfee\\mdb\\spc.mdb";
// strPath2=strPath+cs;
strPath2=cs;
if(CopyFile(strPath1,strPath2,FALSE))
{
flag=1;
}
if (flag==1)
{
AfxMessageBox("Backed up successfully");
}
else
{
AfxMessageBox("Backup failed");
}
}
void CFeeView::OnMdbBackupJifei()
{
// TODO: Add your command handler code here
if (userLoginPower!="2")
{
AfxMessageBox("Authority not high enough");
return;
}
RemoveAll();
RemoveAllColumn();
RemovePreTimer();
HRESULT hr;
SYSTEMTIME CurTime;
CString sYear,sMonth,sDay,sHour,sMinute,sSecond;
GetLocalTime(&CurTime);
sYear.Format("%d",CurTime.wYear);
sMonth.Format("%d",CurTime.wMonth);
if (CurTime.wMonth<10)
sMonth="0"+sMonth;
sDay.Format("%d",CurTime.wDay);
if (CurTime.wDay<10)
sDay="0"+sDay;
sHour.Format("%d",CurTime.wHour);
if (CurTime.wHour<10)
sHour="0"+sHour;
sMinute.Format("%d",CurTime.wMinute);
if (CurTime.wMinute<10)
sMinute="0"+sMinute;
sSecond.Format("%d",CurTime.wSecond);
if (CurTime.wSecond<10)
sSecond="0"+sSecond;
CString cs;
cs="jifei";
cs+=sYear+sMonth+sDay+sHour+sMinute+sSecond;
cs="d:\\twdMdbBak\\jifeibak\\"+cs+".mdb";
CString strcnn,strtmp;
strcnn="Provider=Microsoft.JET.OLEDB.4.0;";
strtmp.Format("Data source='%s'",cs);
strcnn=strcnn+strtmp;
//CString strcnn(_T("Provider=Microsoft.JET.OLEDB.4.0;Data source =spcbak.mdb"));
ADOX::_CatalogPtr m_pCatalog = NULL;
hr = m_pCatalog.CreateInstance(__uuidof (ADOX::Catalog));
if (FAILED(hr))
{
_com_issue_error(hr);
}
else
{
m_pCatalog->Create(_bstr_t(strcnn)); //Create MDB
}
CString strPath,strPath1,strPath2;
unsigned char flag;
flag=0;
GetModuleFileName(NULL,strPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH);
strPath.ReleaseBuffer();
int nPos;
nPos=strPath.ReverseFind ('\\');
strPath=strPath.Left (nPos-5);
strPath1="d:\\twdfee\\mdb\\jifei.mdb";
//strPath2=strPath+cs;
strPath2=cs;
if(CopyFile(strPath1,strPath2,FALSE))
{
flag=1;
}
if (flag==1)
{
AfxMessageBox("Backed up successfully");
}
else
{
AfxMessageBox("Backup failed");
}
}
void CFeeView::OnMdbRetriveSpc()
{
// TODO: Add your command handler code here
if (userLoginPower!="2")
{
AfxMessageBox("Authority not high enough");
return;
}
RemoveAll();
RemoveAllColumn();
RemovePreTimer();
CFileDialog filedialog(TRUE);
int nResponse;
filedialog.m_ofn.lpstrInitialDir="d:\\twdMdbBak\\spcbak\\";
nResponse=filedialog.DoModal();
if (nResponse!=IDOK)
{
return;
}
CString strsourcepathname;
strsourcepathname=filedialog.GetPathName();
CString strPath,strdespathname;
GetModuleFileName(NULL,strPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH);
strPath.ReleaseBuffer();
int nPos;
nPos=strPath.ReverseFind ('\\');
strPath=strPath.Left (nPos-5);
strdespathname="d:\\twdfee\\mdb\\spc.mdb";
if (strsourcepathname==strdespathname)
{
AfxMessageBox("The source file and the target one are the same");
return;
}
CString strtemp;
strtemp=strsourcepathname;
int pos;
while(strtemp.Find("\\")!=-1)
{
pos=strtemp.Find("\\");
strtemp.Delete(0,pos+1);
}
CString strtemp1;
strtemp1=strtemp.Left(3);
if (strtemp1!="spc")
{
AfxMessageBox("Restoration source file is wrong");
return;
}
pos=strtemp.Find(".");
if (pos==-1)
{
AfxMessageBox("Restoration source file is wrong");
return;
}
strtemp.Delete(0,pos+1);
if (strtemp!="mdb")
{
AfxMessageBox("Restoration source file is wrong");
return;
}
if(CopyFile(strsourcepathname,strdespathname,FALSE))
{
MessageBox("Restoration finished!");
}
}
void CFeeView::OnMdbRetriveJifei()
{
// TODO: Add your command handler code here
if (userLoginPower!="2")
{
AfxMessageBox("Authority not high enough");
return;
}
RemoveAll();
RemoveAll
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -