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

📄 falcon_jxcview.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	CFont newFont, *pOldFont;
	TEXTMETRIC tm;
	int nHeight, nWidth;

	CString str, strTemp;
	int strlen;

	int x;
	int y = cyPage/20;
	
	int iRowStart = int(cxPage*0.05);
	int iRowEnd   = int(cxPage*0.95);
	int iColEnd	  = int(cyPage*0.95);

//-------------------------------------------------------------------------------------------------
//表头名称
	fontsize = 100*cyPage/3251;  
	newFont.CreateFont(fontsize,0,0,0,FW_NORMAL,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
		                CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"黑体");
	pOldFont = pDC->SelectObject(&newFont);

	pDC->GetTextMetrics(&tm);
	nHeight = tm.tmHeight + tm.tmExternalLeading;
	nWidth = tm.tmAveCharWidth;

	str = m_strBaobiaomingcheng;
	strlen = str.GetLength();
	x = (cxPage-strlen*nWidth)/2;
	pDC->TextOut(x,y, str);
	y += nHeight*3/2;

	pDC->SelectObject(pOldFont);
	newFont.DeleteObject();
	
//--------------------------------------------------------------------------------------------------
//日期&页码
	fontsize = 50*cyPage/3251;
	newFont.CreateFont(fontsize,0,0,0,FW_NORMAL,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
		                CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"宋体");
	pOldFont = pDC->SelectObject(&newFont);

	pDC->GetTextMetrics(&tm);
	nHeight = tm.tmHeight + tm.tmExternalLeading;
	nWidth = tm.tmAveCharWidth;
	
	if (m_strTimeQi != "" && m_strTimeZhi != "")
	{
		str.Format("起止日期: %s - %s",m_strTimeQi,m_strTimeZhi);
		pDC->TextOut(iRowStart,y,str);
	}
	
	str.Format("第%d页/共%d页",pInfo->m_nCurPage,m_iPageNum);
	strlen = str.GetLength();
	pDC->TextOut(iRowEnd-strlen*nWidth,y,str);
	y += nHeight*3/2;	

//------------------------------------------------------------------------------------------
	int i;
	int iTotWidths = 0;
	int iCols = m_iAColWidth.GetSize();
	for (i=0; i<iCols; i++)
	{
		iTotWidths += m_iAColWidth.GetAt(i);
	}

	int iUnit = (iRowEnd - iRowStart)/iTotWidths;
	for (i=0; i<iCols; i++)
	{
		int iTemp = iUnit*m_iAColWidth.GetAt(i);
		m_iAColWidth.SetAt(i,iTemp);
	}
//-------------------------------------------------------------------------------------------
	int iColStart = y;
	int iRowStep  = (iColEnd - 3*nHeight - iColStart )/21;			//行间距

	int iRow;
	int iCol;
	int iEndPageRows;
//表体网格
	x = iRowStart;
	if (pInfo->m_nCurPage != m_iPageNum)	//前m_iPageNum-1页
	{
		for (iRow=0; iRow<22; iRow++)
		{
			pDC->MoveTo(iRowStart, y);		
			pDC->LineTo(iRowEnd, y);
			y += iRowStep;
		}
		for (iCol=0; iCol<iCols; iCol++)
		{
			pDC->MoveTo(x, iColStart);		
			pDC->LineTo(x, iColStart + 21*iRowStep);
//			x += iColStep;
			x += m_iAColWidth.GetAt(iCol);
		}
		pDC->MoveTo(iRowEnd, iColStart);		
		pDC->LineTo(iRowEnd, iColStart + 21*iRowStep);

	}
	else		//最后一页
	{
		iEndPageRows = m_CMSFlexGrid->GetRows() - 20*(m_iPageNum-1);
		for (iRow=0; iRow<=iEndPageRows; iRow++)
		{
			pDC->MoveTo(iRowStart, y);		
			pDC->LineTo(iRowEnd, y);
			y += iRowStep;
		}
		for (iCol=0; iCol<iCols; iCol++)
		{
			pDC->MoveTo(x, iColStart);		
			pDC->LineTo(x, iColStart + iEndPageRows*iRowStep);
			x += m_iAColWidth.GetAt(iCol);
		}
		pDC->MoveTo(iRowEnd, iColStart);		
		pDC->LineTo(iRowEnd, iColStart + iEndPageRows*iRowStep);
	}

//表体内容
	x = iRowStart+nWidth;
	//表项
	for(iCol=0; iCol<iCols; iCol++)
	{
		pDC->TextOut(x,iColStart+nHeight,m_CMSFlexGrid->GetTextMatrix(0,iCol));
		x += m_iAColWidth.GetAt(iCol);
	}
	//明细
	if (pInfo->m_nCurPage != m_iPageNum)
	{
		y = iColStart+nHeight*3;
		for (iRow=1; iRow<=20; iRow++)
		{
			x = iRowStart+nWidth;
			for (iCol=0; iCol<iCols; iCol++)
			{
				pDC->TextOut(x,y,m_CMSFlexGrid->GetTextMatrix((pInfo->m_nCurPage-1)*20+iRow,iCol));
				x += m_iAColWidth.GetAt(iCol);
			}
			y += iRowStep;
		}
	}
	else		//最后一页
	{
		iEndPageRows = m_CMSFlexGrid->GetRows() - 1 - 20*(m_iPageNum-1);
		y = iColStart+nHeight*3;
		for (iRow=1; iRow<=iEndPageRows; iRow++)
		{
			x = iRowStart+nWidth;
			for (iCol=0; iCol<iCols; iCol++)
			{
				pDC->TextOut(x,y,m_CMSFlexGrid->GetTextMatrix((pInfo->m_nCurPage-1)*20+iRow,iCol));
				x += m_iAColWidth.GetAt(iCol);
			}
			y += iRowStep;
		}	
	}
//表尾	
	str.Format("制表日期:%s",m_strZhibiaoriqi);
	pDC->TextOut(iRowStart,y+nHeight,str);
	str.Format("制表人:%s",m_strZhibiaoren);
	strlen = str.GetLength();
	pDC->TextOut(iRowEnd-strlen*nWidth*2,y+nHeight,str);

	pDC->SelectObject(pOldFont);
	newFont.DeleteObject();
	pDC->SetBkMode(oldBkMode);
}


void CFALCON_JXCView::OnSetBasicInfo() 
{
	// TODO: Add your command handler code here
	CDlgBasicInfo dlg;
	if(dlg.DoModal() == IDOK)
	{
		m_sShangchangmingcheng = dlg.m_sShangchangmingcheng;
		m_sShouyinyuan = dlg.m_sShouyinyuan;
	}
}

void CFALCON_JXCView::RptSpdbmx()
{
	OnRptSpdbmx() ;
}

void CFALCON_JXCView::RptSpxsmx()
{
	OnRptSpxsmx() ;
}

void CFALCON_JXCView::RptSpxsph()
{
	OnRptSpxsph() ;
}

void CFALCON_JXCView::RptGhsxsph()
{
	OnRptGhsxsph() ;
}

void CFALCON_JXCView::RptBmxsyj()
{
	OnRptBmxsyj() ;
}

void CFALCON_JXCView::RptYyyxsyj()
{
	OnRptYyyxsyj() ;
}

void CFALCON_JXCView::OnGzd() 
{
	if(GetDocument()->m_sQuanXianArray[7]=="0")
	{
		AfxMessageBox("你没有权限!");
		return ;
	}			
	CDlgGZD dlg;
	dlg.DoModal();
}

void CFALCON_JXCView::OnTuihuochuku() 
{
	if(GetDocument()->m_sQuanXianArray[12]=="0")
	{
		AfxMessageBox("你没有权限!");
		return ;
	}			
	CDlgTuihuo dlg;
	dlg.DoModal();
}

void CFALCON_JXCView::OnXsgzcx() 
{
	// TODO: Add your command handler code here
	if(GetDocument()->m_sQuanXianArray[8]=="0")
	{
		AfxMessageBox("你没有权限!");
		return ;
	}			
	CXsgzcxDlg dlg;
	dlg.DoModal();
}


void CFALCON_JXCView::OnOpenrpt() 
{
	// TODO: Add your command handler code here
	if(m_Preview!=NULL)
	{	
		m_Preview->DestroyWindow();
	    delete m_Preview;
	}
	m_Preview = new CDongTaiReport;
	
	if (m_Preview->GetSafeHwnd() == NULL)
	{
		m_Preview->Create(IDD_DIALOG3,this);
//		m_Preview->ShowWindow(SW_SHOW);
//		CRect rect;
//		GetClientRect(rect);
//		m_Preview->SetWindowPos(&wndTop,0,0,900,650,SWP_DRAWFRAME);
	}
//	m_Preview->Create();

	
}

void CFALCON_JXCView::OnUserAdmin() 
{
	// TODO: Add your command handler code here
	m_QuanXian.Create(IDD_QuanXian_Table,this);
	m_QuanXian.ShowWindow(SW_SHOW);
//		CRect rect;
//		GetClientRect(rect);
	m_QuanXian.SetWindowPos(&wndTop,0,0,900,650,SWP_DRAWFRAME);	
}

void CFALCON_JXCView::Quotationform()
{
	OnQuotationform();
}

void CFALCON_JXCView::OnUpdateQuotationform(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
//	AfxMessageBox(GetDocument()->m_sQuanXianArray[2]);
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[2]));
}

void CFALCON_JXCView::OnUpdateSkpjYdxs(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[3]));
}

void CFALCON_JXCView::OnUpdateUserAdmin(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	if(GetDocument()->m_sQuanXianArray[0]!="管理员")
	pCmdUI->Enable(0);
	else
	pCmdUI->Enable(1);
}

void CFALCON_JXCView::OnUpdateZcxsShhy(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[4]));
}

void CFALCON_JXCView::OnUpdateDiaobodan(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[5]));


}

void CFALCON_JXCView::OnUpdateZcxsSqwk(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[6]));


}

void CFALCON_JXCView::OnUpdateGzd(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[7]));
	
}

void CFALCON_JXCView::OnUpdateXsgzcx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[8]));

}

void CFALCON_JXCView::OnUpdateSkpj(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[3]));
}

void CFALCON_JXCView::OnUpdateRuku(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[9]));
	
}

void CFALCON_JXCView::OnUpdateHpys(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[10]));
	
}

void CFALCON_JXCView::OnUpdateXiaoshoudiaobochuku(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[11]));

}

void CFALCON_JXCView::OnUpdateTuihuochuku(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[12]));
}

void CFALCON_JXCView::OnUpdateSpjbzl(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[13]));

}

void CFALCON_JXCView::OnUpdateGysjbzl(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[14]));
}

void CFALCON_JXCView::OnUpdateRptSpjhmx(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[15]));
}

void CFALCON_JXCView::OnUpdateRptSpdbmx(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[16]));
	
}

void CFALCON_JXCView::OnUpdateRptSpxsmx(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[17]));
	
}

void CFALCON_JXCView::OnUpdateRptSpxsph(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[18]));
}

void CFALCON_JXCView::OnUpdateRptGhsxsph(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[19]));
	
}

void CFALCON_JXCView::OnUpdateRptBmxsyj(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[20]));
}

void CFALCON_JXCView::OnUpdateRptYyyxsyj(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[21]));
}

void CFALCON_JXCView::OnUpdateRptSpzx(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[22]));
	
}

void CFALCON_JXCView::OnUpdateRptSpkcpd(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(atoi(GetDocument()->m_sQuanXianArray[23]));
}

void CFALCON_JXCView::OnSetZhixiao() 
{
	// TODO: Add your command handler code here
	CDlgZhixiaoSet dlg;
	dlg.DoModal();
}

void CFALCON_JXCView::OnDuoShoug() 
{
	// TODO: Add your command handler code here
	if (m_iPrtItem != -1)
	{
		AfxMessageBox("请先关闭其它子窗口!");
		return;
	}

	if (dlgSgdh != NULL)
		delete dlgSgdh;
	
	dlgSgdh = new CRptDlgSpsgdh(this);
	if (dlgSgdh->GetSafeHwnd() == NULL)
	{
		dlgSgdh->Create();
		m_iPrtItem = 1;
	}
}

void CFALCON_JXCView::OnDuoZhid() 
{
	// TODO: Add your command handler code here
	if (m_iPrtItem != -1)
	{
		AfxMessageBox("请先关闭其它子窗口!");
		return;
	}

	if (dlgSgzddh != NULL)
		delete dlgSgdh;
	
	dlgSgzddh = new CRptDlgSpzddh(this);
	if (dlgSgzddh->GetSafeHwnd() == NULL)
	{
		dlgSgzddh->Create();
		m_iPrtItem = 1;
	}
}

void CFALCON_JXCView::OnDuoHuiz() 
{
	// TODO: Add your command handler code here
	
	if (m_iPrtItem != -1)
	{
		AfxMessageBox("请先关闭其它子窗口!");
		return;
	}

	if (dlgSpdhhz != NULL)
		delete dlgSpdhhz;
	
	dlgSpdhhz = new CRptDlgSpdhhz(this);
	if (dlgSpdhhz->GetSafeHwnd() == NULL)
	{
		dlgSpdhhz->Create();
		m_iPrtItem = 1;
	}
}

⌨️ 快捷键说明

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