109 lines
3.0 KiB
C++
109 lines
3.0 KiB
C++
// ReportViewerDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "sp.h"
|
|
#include "ReportViewerDlg.h"
|
|
|
|
|
|
// CReportViewerDlg dialog
|
|
|
|
IMPLEMENT_DYNAMIC(CReportViewerDlg, CDialog)
|
|
CReportViewerDlg::CReportViewerDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CReportViewerDlg::IDD, pParent)
|
|
{
|
|
m_Report=NULL;
|
|
m_SubReport=NULL;
|
|
}
|
|
|
|
CReportViewerDlg::~CReportViewerDlg()
|
|
{
|
|
}
|
|
|
|
void CReportViewerDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_CRVIEWER1, crv);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CReportViewerDlg, CDialog)
|
|
ON_COMMAND(ID_PRINTSETUP, OnPrintsetup)
|
|
ON_COMMAND(ID_CLOSETHISSCREEN250, OnClosethisscreen250)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CReportViewerDlg message handlers
|
|
|
|
BOOL CReportViewerDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
CWaitCursor cw;
|
|
crv.put_DisplayTabs(FALSE);
|
|
crv.put_EnableExportButton(TRUE);
|
|
crv.put_EnableRefreshButton(FALSE);
|
|
//===================================================
|
|
// SET WINDOW SIZE TO MATCH WORK AREA
|
|
ShowWindow(SW_SHOWMAXIMIZED);
|
|
CRect workarea;
|
|
SystemParametersInfo(SPI_GETWORKAREA,0,&workarea,0);
|
|
SetWindowPos(NULL,workarea.left,workarea.top,workarea.Width(),workarea.Height(),SWP_NOZORDER);
|
|
//===================================================
|
|
LayoutControls();
|
|
ASSERT(m_Report!=NULL);
|
|
//m_Viewer.SetEnableToolbar(TRUE);
|
|
//m_Viewer.SetEnableAnimationCtrl(TRUE);
|
|
//m_Viewer.SetDisplayBorder(FALSE);
|
|
//AfxMessageBox("View");
|
|
|
|
crv.put_ReportSource(m_Report);
|
|
//m_Viewer.SetReportSource(m_Report);
|
|
|
|
crv.ViewReport();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CReportViewerDlg::LayoutControls(void)
|
|
{
|
|
int nLeft,nTop,nWidth,nHeight;
|
|
CRect rectCtl1,rectCtl2,rectDlg;
|
|
GetClientRect(rectDlg);//client area needed for movewindow
|
|
//get client screen coordinates
|
|
nLeft=rectDlg.left;
|
|
nTop=rectDlg.top;
|
|
nWidth=rectDlg.Width();
|
|
nHeight=rectDlg.Height();
|
|
|
|
//REPORT PREVIEW CONTROL
|
|
crv.GetWindowRect(rectCtl1);//windowrect is based on whole screen
|
|
// m_lblBrief.GetWindowRect(rectCtl2);//based on upper left corner of screen not client area
|
|
// ScreenToClient(rectCtl2);//convert whole screen co-ords to client area
|
|
nHeight=(rectDlg.bottom)-10;//calculate height
|
|
crv.MoveWindow(rectDlg.left,rectDlg.top+10,rectDlg.Width(),nHeight-10,TRUE);
|
|
|
|
|
|
}
|
|
|
|
void CReportViewerDlg::OnPrintsetup()
|
|
{
|
|
m_Report->PrinterSetup(0);
|
|
/*CString crPrinterName=(LPCTSTR) m_Report->GetPrinterName();
|
|
CString crDriverName=(LPCTSTR) m_Report->GetDriverName();
|
|
CString crPortName=(LPCTSTR) m_Report->GetPortName();
|
|
CRPaperOrientation crPaperOrientation=m_Report->GetPaperOrientation();
|
|
CRPaperSize crPaperSize=m_Report->GetPaperSize();
|
|
CRPaperSource crPaperSource=m_Report->GetPaperSource();
|
|
CRPrinterDuplexType crDuplexType=m_Report->GetPrinterDuplex();
|
|
|
|
long lPaperSize=(long)m_Report->GetPaperSize();
|
|
m_Report->PaperSize=(CRPaperSize)lPaperSize;
|
|
*/
|
|
crv.ViewReport();
|
|
}
|
|
|
|
void CReportViewerDlg::OnClosethisscreen250()
|
|
{
|
|
OnOK();
|
|
}
|