feeviewlist.cpp

来自「VC6.0环境下编写的一个交换机计费程序。」· C++ 代码 · 共 1,324 行 · 第 1/3 页

CPP
1,324
字号
		viewColumnNum++;

		ctl->DeleteAllItems();
	}
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	if ((telenum=="" ||telenum=="NULL") && \
		(starttime=="" ||starttime=="NULL")&&\
		(endtime=="" ||endtime=="NULL")&&\
		(talktime==""||talktime=="NULL")&&\
		(talkfee==""||talkfee=="NULL"))
	{
		return;
	}
	strSql.Format("select * from blackSub where blackTalkTime='9999'");
	if (telenum=="all" && starttime=="all" && endtime=="all" && \
		talktime=="all" && talkfee=="all")
	{
		strSql.Format("select * from blackSub");
	}
	else
	{	
		i=0;
		strSql.Format("select * from blackSub  ");
		if (telenum!=""&&telenum!="NULL")
		{
			strtemp.Format("where blackCallingNum='%s'",telenum);
			strSql=strSql+strtemp;
			i=1;
		}
		if (talktime!=""&&talktime!="NULL")
		{
			long ltime;
			ltime=atol(talktime);
			if (i==0)
			{
				strtemp.Format("where blackTalkTime>=%d",ltime);
				i=1;
			}
			else
				strtemp.Format("and blackTalkTime>=%d",ltime);
			strSql=strSql+strtemp;

		}
		if (endtalktime!=""&&endtalktime!="NULL")
		{
			long ltime;
			ltime=atol(endtalktime);
			if (i==0)
			{
				strtemp.Format("where blackTalkTime<=%d",ltime);
				i=1;
			}
			else
				strtemp.Format("  and blackTalkTime<=%d",ltime);
			strSql=strSql+strtemp;

		}
		/*
		if (talkfee!=""&&talkfee!="NULL")
		{
			if (i==0)
			{
				strtemp.Format("where blackTalkFee>=%d",talkfee);
				i=1;
			}
			else
				strtemp.Format("and blackTalkFee>=%d",talkfee);
			strSql=strSql+strtemp;
		}
		if (endtalkfee!=""&&endtalkfee!="NULL")
		{
			if (i==0)
			{
				strtemp.Format("where blackTalkFee<=%d",endtalkfee);
				i=1;
			}
			else
				strtemp.Format("and blackTalkFee<=%d",endtalkfee);
			strSql=strSql+strtemp;
		}
		*/
		if (starttime!=""&&starttime!="NULL")
		{
			COleDateTime ttdate;
			long lyear,lmonth,lday;
			ttdate.ParseDateTime(starttime,VAR_DATEVALUEONLY);
			lyear=ttdate.GetYear();
			lmonth=ttdate.GetMonth();
			lday=ttdate.GetDay();

			long timeflag;
			timeflag=timevalid(lyear,lmonth,lday);
			if (timeflag==1)
			{
				AfxMessageBox("start time set error");
				return;
			}

			if (i==0)
			{
				strtemp.Format("where blackTalkEndDate>=#%d-%d-%d#",lyear,lmonth,lday);
				i=1;
			}
			else
				strtemp.Format("and blackTalkEndDate>=#%d-%d-%d#",lyear,lmonth,lday);
			strSql=strSql+strtemp;
		}
		if (endtime!=""&&endtime!="NULL")
		{
			COleDateTime ttdate;
			long lyear,lmonth,lday;
			ttdate.ParseDateTime(endtime,VAR_DATEVALUEONLY);
			lyear=ttdate.GetYear();
			lmonth=ttdate.GetMonth();
			lday=ttdate.GetDay();

			long timeflag;
			timeflag=timevalid(lyear,lmonth,lday);
			if (timeflag==1)
			{
				AfxMessageBox("end time set error");
				return;
			}

			if (i==0)
			{
				strtemp.Format("where blackTalkEndDate<=#%d-%d-%d#",lyear,lmonth,lday);
				i=1;
			}
			else
				strtemp.Format("and blackTalkEndDate<=#%d-%d-%d#",lyear,lmonth,lday);
			strSql=strSql+strtemp;
		}
	}
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open blackSub table");
	}
	i=0;
	while(!pApp->m_pjifeiRecordset->adoEOF)
	{
		_variant_t varport;
		varport=pApp->m_pjifeiRecordset->GetCollect("blackCallingNum");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("blackCallingNum"));
		ctl->InsertItem(i,strtemp);
		ctl->SetItemData(i,i);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("blackCalledNum"));
		varport=pApp->m_pjifeiRecordset->GetCollect("blackCalledNum");
		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("blackTalkTime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("blackTalkTime");
		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("blackTalkEndDate"));
		varport=pApp->m_pjifeiRecordset->GetCollect("blackTalkEndDate");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";
		ctl->SetItemText(i,3,strtemp);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("blackTalkEndTime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("blackTalkEndTime");
		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("blackReason"));
		varport=pApp->m_pjifeiRecordset->GetCollect("blackReason");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="NULL";
		if (strtemp=="" || strtemp=="NULL")
		{
			strtemp="no settlement";
		}
		ctl->SetItemText(i,5,strtemp);
		
		pApp->m_pjifeiRecordset->MoveNext();
	}
	pApp->m_pjifeiRecordset->Close();
}

void CFeeView::feedirectionQueryList(unsigned int titlemodifyflag)
{
	CString strSql,strtemp;
	HRESULT result;
	unsigned int i;
	CListCtrl *ctl;
	ctl=&GetListCtrl();
	actViewWindow=VIEWFEEDIRECTIONQUERY;	
	
	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,"Charging office direction",LVCFMT_LEFT,100);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Office direction property",LVCFMT_LEFT,150);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Charging start duration",LVCFMT_LEFT,150);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Charging start fee",LVCFMT_LEFT,150);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Charging step duration",LVCFMT_LEFT,150);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Charging step fee",LVCFMT_LEFT,150);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Additional fee",LVCFMT_LEFT,150);
		viewColumnNum++;

		actViewWindow=VIEWFEEDIRECTIONQUERY;	
		ctl->DeleteAllItems();
	}

	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("select * from feedirection");
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	
	i=0;
	while(!pApp->m_pjifeiRecordset->adoEOF)
	{
		_variant_t varport;
		varport=pApp->m_pjifeiRecordset->GetCollect("feedirection");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedirection"));
		ctl->InsertItem(i,strtemp);
		ctl->SetItemData(i,i);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedirectionkind"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feedirectionkind");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";	
			/*
		if (strtemp=="1")
			strtemp="Intra-cell rural";
		if (strtemp=="2")
			strtemp="Intra-cell local";
		if (strtemp=="4")
			strtemp="Inter-cell rural";
		if (strtemp=="8")
			strtemp="Inter-cell local";
		if (strtemp=="16")
			strtemp="Toll";
		if (strtemp=="32")
			strtemp="International";
		if (strtemp=="64")
			strtemp="Special";
			*/
		ctl->SetItemText(i,1,strtemp);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feestarttime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feestarttime");
		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("feestartfee"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feestartfee");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";	
		ctl->SetItemText(i,3,strtemp);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feesteptime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feesteptime");
		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("feestepfee"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feestepfee");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";	
		ctl->SetItemText(i,5,strtemp);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feeaddfee"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feeaddfee");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";	
		ctl->SetItemText(i,6,strtemp);
		pApp->m_pjifeiRecordset->MoveNext();
	}
	pApp->m_pjifeiRecordset->Close();
}

void CFeeView::feetimechangeQueryList(unsigned int titlemodifyflag)
{
	CString strSql,strtemp;
	unsigned int insertflag;
	HRESULT result;
	unsigned int i;
	CListCtrl *ctl;
	ctl=&GetListCtrl();
	actViewWindow=VIEWFEETIMECHANGEQUERY;	
	
	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,"Preferential margin",LVCFMT_LEFT,80);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Start date",LVCFMT_LEFT,100);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"End date",LVCFMT_LEFT,100);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Start time",LVCFMT_LEFT,100);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"End time",LVCFMT_LEFT,100);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Intra-cell rural",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Intra-cell local",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Inter-cell rural",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Inter-cell local",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Toll",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"International",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->InsertColumn(viewColumnNum,"Special direction",LVCFMT_LEFT,130);
		viewColumnNum++;
		ctl->DeleteAllItems();
	}

	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("select * from feetimechange");
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open feetimechange table");
	}
	i=0;
	while(!pApp->m_pjifeiRecordset->adoEOF)
	{
		insertflag=0;
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feetimechangedecper"));
		_variant_t varport;
		varport=pApp->m_pjifeiRecordset->GetCollect("feetimechangedecper");
		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("feetimechangestartdate"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feetimechangestartdate");
		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("feetimechangeenddate"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feetimechangeenddate");
		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("feedaychangestarttime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feedaychangestarttime");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";				
		ctl->SetItemText(i,3,strtemp);
		//strtemp=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("feedaychangeendtime"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feedaychangeendtime");
		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("feetimechangekind"));
		varport=pApp->m_pjifeiRecordset->GetCollect("feetimechangekind");
		if (varport.vt!=VT_NULL)
			strtemp =(char*)_bstr_t(varport);
		else 
			strtemp="null";				
		if ((atol(strtemp)&1)==1) //区内农话
			ctl->SetItemText(i,5,"YES");
		if ((atol(strtemp)&2)==2) //区内市话
			ctl->SetItemText(i,6,"YES");
		if ((atol(strtemp)&4)==4) //区间农话
			ctl->SetItemText(i,7,"YES");
		if ((atol(strtemp)&8)==8) //区间市话
			ctl->SetItemText(i,8,"YES");

⌨️ 快捷键说明

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