⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feeview.cpp

📁 VC6.0环境下编写的一个交换机计费程序。
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	_variant_t varport;

	pApp->m_pspcRecordset->Open(_variant_t("spcrecord"),
	_variant_t((IDispatch *)pApp->m_pspcConnection,true), adOpenKeyset,
	adLockOptimistic, adCmdTable);
	if (!pApp->m_pspcRecordset->adoEOF)
	{
		pApp->m_pspcRecordset->MoveLast();
		varport=pApp->m_pspcRecordset->GetCollect("spcIdx");
		if (varport.vt!=VT_NULL)
			stridx =(char*)_bstr_t(varport);
		else 
			stridx="0";
		pApp->m_pspcRecordset->Close();
		showidx=atol(stridx);
		if (showidx!=0)
		{
		//	showidx=20;
			SetTimer(ID_TIEMR_FRONTFEE_WINDOW,20,NULL);
		}
	}
	else
	{
		pApp->m_pspcRecordset->Close();
	}
}


void CFeeView::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	
	CString strSql,strTemp,strTemp1;
	HRESULT result;
	CListCtrl *ctl;
	CString strspcCallingNum,strspcCalledNum,strtime;
	CString strspcTalkStartDate,strspcTalkStartTime,strspcTalkEndDate,strspcTalkEndTime,strspcTalkTime;
	CString strspcCallingName;
	CString strfee;
	long flofee;

	if (nIDEvent==ID_TIEMR_FRONTFEE_WINDOW)
	{
		
		actViewWindow=VIEWREALTIMESHOW;
		if (realtimeShowNum>30)
		{
			RemoveAll();
			realtimeShowNum=0;
			HANDLE  cprocess;
			cprocess=GetCurrentProcess();
			SetProcessWorkingSetSize(cprocess, 0xFFFFFFFF, 0xFFFFFFFF); 
			return;
		}
		strSql.Format("select * from spcrecord where spcIdx=%d ",showidx);
		CFeeApp* pApp=(CFeeApp *)AfxGetApp();
		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)
		{
			_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"));
				
			ctl=&GetListCtrl();
			ctl->InsertItem(0,strspcCallingNum);
			ctl->SetItemText(0,1,strspcCalledNum);
			strtime=strspcTalkEndDate+" "+strspcTalkEndTime;
			ctl->SetItemText(0,2,strtime);
			ctl->SetItemText(0,3,strspcTalkTime);

			strTemp="start settle";
			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++;
					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;
				*/
				strTemp.Format("%d",flofee);
			}
			ctl->SetItemText(0,4,strTemp);
			realtimeShowNum++;
			showidx++;
		}
		pApp->m_pspcRecordset->Close();
	}
	if (nIDEvent==ID_TIEMR_TELEPHONEQUERY_WINDOW)
	{
		showidx=0;
		strSql.Format("select * from telephone");
		CFeeApp* pApp=(CFeeApp *)AfxGetApp();
		pApp->m_pjifeiRecordset->CursorLocation=adUseClientBatch;
		result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
			pApp->m_pjifeiConnection.GetInterfacePtr(),
			adOpenDynamic,adLockOptimistic,adCmdText);
		if (!SUCCEEDED(result))
		{
			AfxMessageBox("can't open telephone table");
		}
		while(!pApp->m_pjifeiRecordset->adoEOF)
		{
			_variant_t varport;
			SetTimer(ID_TIEMR_TELEPHONEQUERY_WINDOW,100,NULL);
		//	Sleep(10);
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneCode"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";	
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneCode"));
			ctl=&GetListCtrl();
			ctl->InsertItem(0,strTemp);
			ctl->SetItemData(0,0);
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneName"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";	
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneName"));
			ctl->SetItemText(0,1,strTemp);
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneAddress"));
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneAddress"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";
			ctl->SetItemText(0,2,strTemp);
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneKind"));
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneKind"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";
			ctl->SetItemText(0,3,strTemp);
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneStatus"));
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneStatus"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";
			ctl->SetItemText(0,4,strTemp);
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneFeeBank"));
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneFeeBank"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";		
			ctl->SetItemText(0,5,strTemp);
			//strTemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneFeeAccount"));
			varport=pApp->m_pjifeiRecordset->GetCollect(_variant_t("telephoneFeeAccount"));
			if (varport.vt!=VT_NULL)
				strTemp =(char*)_bstr_t(varport);
			else 
				strTemp="null";	
			ctl->SetItemText(0,6,strTemp);
			pApp->m_pjifeiRecordset->MoveNext();
		}
		pApp->m_pjifeiRecordset->Close();
		KillTimer(ID_TIEMR_TELEPHONEQUERY_WINDOW); 

	}
//	CListView::OnTimer(nIDEvent);
}

void CFeeView::OnRealtimeshowEnd() 
{
	// TODO: Add your command handler code here
	RemoveAll();
	RemoveAllColumn();
//	actViewWindow&=0xFE;
	KillTimer(ID_TIEMR_FRONTFEE_WINDOW); 
	
}

void CFeeView::teleList(CPoint point) 
{
	CListCtrl *ctl;
	ctl=&GetListCtrl();
	int nHitItem=ctl->HitTest(point,NULL);
	if (nHitItem<0)
	{
		return;
	}
	CtelephoneListDlg	  telelistDlg;
	telelistDlg.m_strtelelistaddress=ctl->GetItemText(nHitItem,2);
	telelistDlg.m_strtelelistbank=ctl->GetItemText(nHitItem,5);
	telelistDlg.m_strtelelistbankaccount=ctl->GetItemText(nHitItem,6);
	telelistDlg.m_strtelelistkind=ctl->GetItemText(nHitItem,3);
	telelistDlg.m_strtelelistname=ctl->GetItemText(nHitItem,1);
	telelistDlg.m_strtelelistnum=ctl->GetItemText(nHitItem,0);
	telelistDlg.m_strteleliststatus=ctl->GetItemText(nHitItem,4);
	int nResponse;	
	telelistcmd=0;
	nResponse=telelistDlg.DoModal();
	if (nResponse==IDCANCEL)
	{
		return;
	}
	TelePhoneQueryList(TRUE,telequeryconditionname,telequeryconditionadr,\
		telequeryconditionnum,telequeyconditionkind,telequeryconditionstatus,\
		telequeryconditionbank,telequeryconditonbankaccount);
}

void CFeeView::OnTelephoneAdd() 
{
	// TODO: Add your command handler code here
	CString strtemp;
	RemovePreTimer();
	CtelephoneAddDlg	teleAddDlg;
	int nResponse;	
	nResponse=teleAddDlg.DoModal();
	if (nResponse!=IDOK)
	{
		return;
	}
	strtemp=teleAddDlg.m_straddtelenum;
	TelePhoneQueryList(TRUE,"NULL","NULL",strtemp,"NULL","NULL","NULL","NULL");

	CFeeView::OnTelephoneAdd();
}

void CFeeView::OnTelequeryAll() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	telequeryconditionnum="all";
	TelePhoneQueryList(TRUE,"NULL","NULL","all","NULL","NULL","NULL","NULL");
}

void CFeeView::OnTelequeryCondition() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	CtelephoneQueryDlg	  telequeryDlg;
	int nResponse;	
	nResponse=telequeryDlg.DoModal();
	if (nResponse!=IDOK)
	{
		return;
	}
	telequeryconditionname=telequeryDlg.m_strtelequeryname;
	telequeryconditionadr=telequeryDlg.m_strtelequeryaddress;
	telequeryconditionnum=telequeryDlg.m_strtelequerynum;
	telequeyconditionkind=telequeryDlg.m_strtelequerykind;
	telequeryconditionstatus=telequeryDlg.m_strtelequerystatus;
	telequeryconditionbank=telequeryDlg.m_strtelequerybank;
	telequeryconditonbankaccount=telequeryDlg.m_strtelequerybankaccount;
	
	TelePhoneQueryList(TRUE,telequeryconditionname,telequeryconditionadr,\
		telequeryconditionnum,telequeyconditionkind,telequeryconditionstatus,\
		telequeryconditionbank,telequeryconditonbankaccount);
	
}

void CFeeView::OnTelephonemenuDandM(void) 
{
	CListCtrl *ctl;
	CString strSql,strTemp;
	ctl=&GetListCtrl();
	POSITION pos=ctl->GetFirstSelectedItemPosition();
	if (pos==NULL)
	{
		AfxMessageBox("Please select one record");
		return;
	}
	int m_CurUser=ctl->GetNextSelectedItem(pos);
	CtelephoneListDlg	  telelistDlg;
	telelistDlg.m_strtelelistaddress=ctl->GetItemText(m_CurUser,2);
	telelistDlg.m_strtelelistbank=ctl->GetItemText(m_CurUser,5);
	telelistDlg.m_strtelelistbankaccount=ctl->GetItemText(m_CurUser,6);
	telelistDlg.m_strtelelistkind=ctl->GetItemText(m_CurUser,3);
	telelistDlg.m_strtelelistname=ctl->GetItemText(m_CurUser,1);
	telelistDlg.m_strtelelistnum=ctl->GetItemText(m_CurUser,0);
	telelistDlg.m_strteleliststatus=ctl->GetItemText(m_CurUser,4);
	int nResponse;	
	telelistcmd=0;
	nResponse=telelistDlg.DoModal();
	if (nResponse==IDCANCEL)
	{
		return;
	}
	TelePhoneQueryList(TRUE,telequeryconditionname,telequeryconditionadr,\
		telequeryconditionnum,telequeyconditionkind,telequeryconditionstatus,\
		telequeryconditionbank,telequeryconditonbankaccount);
	return;
}
void CFeeView::OnTelephoneDelete() 
{
	// TODO: Add your command handler code here
	OnTelephonemenuDandM();
}

void CFeeView::OnTelephoneModify() 
{
	// TODO: Add your command handler code here
	OnTelephonemenuDandM();
}



void CFeeView::lineList(CPoint point) 
{
	CListCtrl *ctl;
	ctl=&GetListCtrl();
	int nHitItem=ctl->HitTest(point,NULL);
	if (nHitItem<0)
	{
		return;
	}
	ClineListDlg	  linelistDlg;
	linelistDlg.m_strlinelistlineroom=ctl->GetItemText(nHitItem,0);
	linelistDlg.m_strlinelistlineroomkind=ctl->GetItemText(nHitItem,1);
	linelistDlg.m_strlinelistoutlayoutline=ctl->GetItemText(nHitItem,2);
	linelistDlg.m_strlinelistoutlayoutcolumn=ctl->GetItemText(nHitItem,3);
	linelistDlg.m_strlinelistinlayoutline=ctl->GetItemText(nHitItem,4);
	linelistDlg.m_strlinelistinlayoutcolumn=ctl->GetItemText(nHitItem,5);
	linelistDlg.m_strlinelistlinetelephone=ctl->GetItemText(nHitItem,6);
	int nResponse;	
	telelistcmd=0;
	nResponse=linelistDlg.DoModal();
	if (nResponse==IDCANCEL)
	{
		return;
	}
	lineQueryList(TRUE,linequerycondition_outLayoutLine,\
				linequerycondition_outLayoutColumn,\
				linequerycondition_inLayoutLine,\
				linequerycondition_inLayoutColumn,\
				linequerycondition_lineroom,\
				linequerycondition_lineroomKind,\
				linequerycondition_lineteleNum);

}



void CFeeView::OnLinequeryMac() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	linequerycondition_outLayoutLine="NULL";
	linequerycondition_outLayoutColumn="NULL";
	linequerycondition_inLayoutLine="NULL";
	linequerycondition_inLayoutColumn="NULL";
	linequerycondition_lineroom="all";
	linequerycondition_lineroomKind="mac";
	linequerycondition_lineteleNum="NULL";

	lineQueryList(TRUE,"NULL","NULL","NULL","NULL","all","mac","NULL");
}

void CFeeView::OnLinequerySub() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	linequerycondition_outLayoutLine="NULL";
	linequerycondition_outLayoutColumn="NULL";
	linequerycondition_inLayoutLine="NULL";
	linequerycondition_inLayoutColumn="NULL";
	linequerycondition_lineroom="all";
	linequerycondition_lineroomKind="sub";
	linequerycondition_lineteleNum="NULL";

	lineQueryList(TRUE,"NULL","NULL","NULL","NULL","all","sub","NULL");
	
}

void CFeeView::OnLinequeryAll() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	linequerycondition_outLayoutLine="NULL";
	linequerycondition_outLayoutColumn="NULL";
	linequerycondition_inLayoutLine="NULL";
	linequerycondition_inLayoutColumn="NULL";
	linequerycondition_lineroom="all";
	linequerycondition_lineroomKind="all";
	linequerycondition_lineteleNum="NULL";

	lineQueryList(TRUE,"NULL","NULL","NULL","NULL","all","all","NULL");
	
}

void CFeeView::OnLinequeryCondition() 
{
	// TODO: Add your command handler code here
	RemovePreTimer();
	ClineQueryDlg	  linequeryDlg;
	int nResponse;	
	nResponse=linequeryDlg.DoModal();
	if (nResponse!=IDOK)
	{
		return;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -