Ejemplo n.º 1
0
        private void frmOPLog_Load(object sender, System.EventArgs e)
        {
            this.strAppPatch = Application.StartupPath + "\\";
            this.txtDepartment.m_lsvList.Width            = this.txtDepartment.Width;
            this.txtDepartment.m_lsvList.Columns[0].Width = this.txtDepartment.Width;
            this.txtReportDoctor.m_lsvList.Width          = this.txtReportDoctor.Width;


            dtpFrom.Value     = DateTime.Now;
            dtpTo.Value       = DateTime.Now;
            objReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            objReportDocument.Load(strAppPatch + "Report\\rptOPLog.rpt");
            TextObject txtReportTitle = objReportDocument.ReportDefinition.ReportObjects["Text10"] as TextObject;

            txtReportTitle.Text = ((clsCtl_OPLog)this.objController).m_objComInfo.m_strGetHospitalTitle() + "门诊工作日志报表";
            if (this.chkCheckDate.Checked)
            {
                ((TextObject)objReportDocument.ReportDefinition.ReportObjects["TextDate"]).Text = dtpFrom.Value.ToString("yyyy-MM-dd") + " ~ " + dtpTo.Value.ToString("yyyy-MM-dd");
            }
//			this.crystalReportViewer1.ReportSource =objReportDocument;
            if (strDoctorID != "")
            {
                ((clsCtl_OPLog)this.objController).m_mthLogData();
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    ///This method is called by the "Logon" method. It loops through the report tables and applies the connection information to each table.
    /// </summary>
    /// <param name="cr"></param>
    /// <param name="ci"></param>
    /// <returns></returns>
    private bool ApplyLogon(CrystalDecisions.CrystalReports.Engine.ReportDocument cr, CrystalDecisions.Shared.ConnectionInfo ci)
    {
        // This function is called by the "Logon" function
        // It loops through the report tables and applies
        // the connection information to each table.

        // Declare the TableLogOnInfo object and a table object for use later.
        CrystalDecisions.Shared.TableLogOnInfo li;
        // For each table apply connection info.

        foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in cr.Database.Tables)
        {
            li = tbl.LogOnInfo;
            li.ConnectionInfo.ServerName   = ci.ServerName;
            li.ConnectionInfo.DatabaseName = ci.DatabaseName;
            li.ConnectionInfo.UserID       = ci.UserID;
            li.ConnectionInfo.Password     = ci.Password;
            tbl.ApplyLogOnInfo(li);
            tbl.Location = ci.DatabaseName + ".dbo." + tbl.Name;

            // Verify that the logon was successful.
            // If TestConnectivity returns false, correct table locations.
            if (!tbl.TestConnectivity())
            {
                return(false);
            }
        }
        return(true);
    }
Ejemplo n.º 3
0
        private void cmdPrint_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            ADODB.Recordset rs  = default(ADODB.Recordset);
            string          sql = null;

            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = default(CrystalDecisions.CrystalReports.Engine.ReportDocument);
            Report.Load("cryStockItemPrice.rpt");
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rs = modRecordSet.getRS(ref "SELECT * FROM Company");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            rs.Close();
            Report.SetParameterValue("txtFilter", lblHeading.Text);
            Report.SetParameterValue("txtTitle1", "Where Sales Channel = " + cmbChannel.CtlText);

            //Report.Database.SetDataSource(adoPrimaryRS, 3)
            Report.Database.Tables(1).SetDataSource(adoPrimaryRS);
            //Report.VerifyOnEveryPrint = True
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode   = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }
Ejemplo n.º 4
0
        public frmRelBasicos(string pArquivo, string pTitulo)
        {
            InitializeComponent();

            relArquivo = pArquivo;
            relTitulo  = pTitulo;

            this.Text = pTitulo;

            //Objeto com informações de conexão para as tabelas do rpt
            conexaoCrystal              = new CrystalDecisions.Shared.ConnectionInfo();
            conexaoCrystal.ServerName   = @"(local)\SQLEXPRESS";
            conexaoCrystal.UserID       = "sa";
            conexaoCrystal.Password     = "******";
            conexaoCrystal.DatabaseName = "Copa2010";

            //Carregar o arquivo do rpt pArquivo
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            report.Load(Application.StartupPath + @"..\..\..\Relatorios\" + relArquivo);

            //Informe o rpt com as informações de conexão
            CrystalDecisions.Shared.TableLogOnInfo logonInfo = new CrystalDecisions.Shared.TableLogOnInfo();
            logonInfo.ConnectionInfo = conexaoCrystal;

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in report.Database.Tables)
            {
                table.LogOnInfo.ConnectionInfo = conexaoCrystal;
                table.ApplyLogOnInfo(logonInfo);
            }

            //Liga ao Visualizador
            crvRel.ReportSource = report;
        }
Ejemplo n.º 5
0
        private void mmuMailingLabel_Click(object sender, EventArgs e)
        {
            try
            {
                if (System.IO.File.Exists(CurrentUser.ReportPath + "rptCustomerMailingLabel1.rpt"))
                {
                    //dtblCustomer.TableName = "CustomerRegister";
                    //dtblCustomer.WriteXmlSchema(@"D:\report\CustomerRegister.xsd");

                    //DataView DVReport;
                    //DVReport = dtblCustomer.DefaultView;
                    //DVReport.RowFilter = StrFilter;
                    CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                    rptDoc.Load(CurrentUser.ReportPath + "rptCustomerMailingLabel1.rpt");

                    //CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Customer Mailing Label", false, false, false, false, false, false, false, false, false, false, false);

                    Reports.frmReportViewer fRptView = new Reports.frmReportViewer();
                    fRptView.Text = "Customer Mailing Label - [Page Size: A4]";
                    fRptView.crViewer.ReportSource = rptDoc;
                    fRptView.ShowDialog();
                }
                else
                {
                    MessageBox.Show("File is not exist...");
                }
            }

            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("Customer- Mailing Label", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }
Ejemplo n.º 6
0
        private void Report_Modification(CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt)
        {
            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc1 = cryRpt.ReportClientDocument;
            ReportDefController2 reportDef = rptClientDoc1.ReportDefController;

            ReportSectionController reportSectionController = rptClientDoc1.ReportDefController.ReportSectionController;

            CrystalDecisions.ReportAppServer.ReportDefModel.Section newsec;

            int index = reportDef.ReportDefinition.PageHeaderArea.Sections.Count;

            //  CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject objPictureBox = new CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject();
            if (index > 0)
            {
                // reportDef.ReportDefinition.PageHeaderArea.Sections.Add(reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1]);
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];//reportDef.ReportDefinition.PageHeaderArea.Sections[index - 1];
            }
            else
            {
                index  = 0;
                newsec = reportDef.ReportDefinition.PageHeaderArea.Sections[index];
            }

            reportDef.ReportDefinition.PageHeaderArea.Sections.Insert(index, newsec);
            CrystalDecisions.ReportAppServer.ReportDefModel.Section sectionToAddTo = reportDef.ReportDefinition.PageHeaderArea.Sections[index];

            CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat newSectionFormat = sectionToAddTo.Format;
            newSectionFormat.EnableKeepTogether    = false;
            newSectionFormat.EnableSuppress        = false;
            newSectionFormat.EnableUnderlaySection = true;
            reportSectionController.SetProperty(sectionToAddTo, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat);
            reportDef.ReportObjectController.ImportPicture(AppDomain.CurrentDomain.BaseDirectory + @"IMAGE/AccessReportWatermarks1.png", sectionToAddTo, 500, 700);
        }
Ejemplo n.º 7
0
 private void Form1_Load(object sender, EventArgs e)
 {
     CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
     report.Load(@"C:\Users\Willmack\source\repos\WindowsFormsApp1\WindowsFormsApp1\CrystalReport1.rpt");
     crystalReportViewer1.ReportSource = report;
     crystalReportViewer1.Refresh();
 }
Ejemplo n.º 8
0
        private void ReportViewer_Load(object sender, EventArgs e)
        {
            myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            string strDirPath = Application.StartupPath + "/Reports/" + _repName + ".rpt";

            try
            {
                myReportDocument.Load(strDirPath);
            }
            catch
            {
                MessageBox.Show("Нет файла отчета!/n" + strDirPath, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            SetDataReport(_repName);


            // @TODO Заменить на общий датасет DataSetReport
            //if (_repDBProcName == "Rep_GetReportLast")
            //{
            //    SetDataReportLast();
            //}
            //else
            //{
            //    SetDataReport();
            //}
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 病区病人欠费一览表
        /// </summary>
        public void m_mthShowInHospitalDebtLog()
        {
            if (this.m_objViewer.m_txtAREAID_CHR.Tag == null)
            {
                this.m_objViewer.m_txtAREAID_CHR.Tag  = "";
                this.m_objViewer.m_txtAREAID_CHR.Text = "全院";
            }
            this.m_objViewer.Cursor = Cursors.WaitCursor;
            DataTable dtbResult = new DataTable();

            rptInHospitalLog = new ReportDocument();
            rptInHospitalLog.Load(@"Report\rptDebtView.rpt");
            rptInHospitalLog.DataDefinition.FormulaFields["AreaName"].Text     = "'" + this.m_objViewer.m_txtAREAID_CHR.Text.Trim() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["StatDate"].Text     = "'" + this.m_objViewer.m_StatDate.Value.ToShortDateString() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["operatorname"].Text = "'" + this.m_objViewer.LoginInfo.m_strEmpName + "'";
            int type = -1;

            if (this.m_objViewer.radioButton1.Checked)
            {
                type = 1;
            }
            if (this.m_objViewer.radioButton2.Checked)
            {
                type = 0;
            }
            long lngRes = objSvc.m_lngGetPatientDebt(type, (string)this.m_objViewer.m_txtAREAID_CHR.Tag, "", this.m_objViewer.m_StatDate.Value, "", "", out dtbResult);

            if (lngRes > 0)
            {
                rptInHospitalLog.SetDataSource(dtbResult);
                this.m_objViewer.m_ctrvPatientDebtReport.ReportSource = rptInHospitalLog;
            }
            this.m_objViewer.Cursor = Cursors.Default;
        }
Ejemplo n.º 10
0
        public frmReporte(CrystalDecisions.CrystalReports.Engine.ReportDocument crRepDoc)
        {
            InitializeComponent();

            //Configura el reporte
            crvQueja.ReportSource = crRepDoc;
        }
Ejemplo n.º 11
0
        protected void generarrpt(object sender, EventArgs e)
        {
            string select = "SELECT MEMP.MEMP_CODIEMPL,MNIT.MNIT_NOMBRES,MNIT.MNIT_NOMBRE2,MNIT.MNIT_APELLIDOS,MNIT.MNIT_APELLIDO2,MNIT.MNIT_DIGITO,MNIT.MNIT_DIRECCION,MNIT.MNIT_EMAIL,MNIT.MNIT_TELEFONO,MNIT.MNIT_CELULAR, MEMP.MEMP_FECHNACI,PCIU.PCIU_NOMBRE,MNIT.MNIT_NIT,MNIT.MNIT_DIGITO,MEMP.MEMP_NUMELIBRMILI,MEMP.MEMP_CLASELIBRMILI,DBXSCHEMA.TSEXO.TSEX_NOMBRE,YEAR(CURRENT DATE) - YEAR(MEMP.MEMP_FECHNACI),MEMP.MEMP_NUMEHIJOS,MEMP.TRES_VIVIENDA,MEMP.MEMP_FECHINGRESO,MEMP.MEMP_SUELACTU,MEMP.MEMP_SUELANTER,TCON.TCON_NOMBRE,TSUBT.TSUB_NOMBRE, PDEPTO.PDEP_NOMBDPTO,TESTEMP.TEST_NOMBRE,DBXSCHEMA.TFORMAPAGO.TFOR_DESCRIPCION,DBXSCHEMA.PBANCO.PBAN_NOMBRE,MEMP.MEMP_CUENNOMI,DBXSCHEMA.PEPS.PEPS_NOMBEPS,DBXSCHEMA.PARP.PARP_NOMBARP,PFCESA.PFON_NOMBFOND,PFPENS.PFON_NOMBPENS,DBXSCHEMA.TRETEFTE.TEST_DESCRIPCION, MEMP.MEMP_PORCRETE,TSANGRE.TTIP_TIPOSANG ,PCAR.pcar_nombcarg,TCIVIL.test_nombre,MEMP.memp_fecsuelanter,memp_peripago,TPAGO.TPER_DESCP,TFPAGO.tfor_descripcion,MEMP.memp_cuennomi,PFPENS2.pfon_nombpens as pensvol";
            string from   = " FROM DBXSCHEMA.MEMPLEADO MEMP,DBXSCHEMA.MNIT MNIT,DBXSCHEMA.PCIUDAD PCIU,DBXSCHEMA.TSEXO,DBXSCHEMA.TCONTRATONOMINA TCON,DBXSCHEMA.TSUBSIDIOTRANSPORTE TSUBT ,DBXSCHEMA.PDEPARTAMENTOEMPRESA PDEPTO,DBXSCHEMA.TESTADOEMPLEADO TESTEMP, DBXSCHEMA.TFORMAPAGO,DBXSCHEMA.PBANCO,DBXSCHEMA.PEPS,DBXSCHEMA.PARP,DBXSCHEMA.PFONDOPENSION PFPENS,DBXSCHEMA.PFONDOPENSION PFPENS2, DBXSCHEMA.PFONDOCESANTIAS PFCESA,DBXSCHEMA.TRETEFTE,DBXSCHEMA.TTIPOSANGRE TSANGRE,DBXSCHEMA.PCARGOEMPLEADO PCAR,dbxschema.testadocivil TCIVIL,dbxschema.TPERIPAGO TPAGO,DBXSCHEMA.TFORMAPAGO TFPAGO";

            string where = " WHERE MEMP.MEMP_CODIEMPL='" + DDLEMPLEADO.SelectedValue + "' AND PFPENS.pfon_codipens=MEMP.pfon_codipens AND PFPENS2.pfon_codipens=MEMP.pfon_codipensvolu AND TFPAGO.tfor_pago=memp.memp_formpago AND TPAGO.tper_peri=MEMP.memp_peripago AND TCIVIL.test_estacivil=memp.test_estacivil AND MEMP.PCAR_CODICARGO=PCAR.PCAR_CODICARGO AND MEMP.MNIT_NIT=MNIT.MNIT_NIT  and memp.ttip_secuencia= TSANGRE.ttip_secuencia  AND MEMP.PCIU_LUGANACI=PCIU.PCIU_CODIGO  AND MEMP.TSEX_CODIGO=DBXSCHEMA.TSEXO.TSEX_CODIGO AND MEMP.TCON_CONTRATO= TCON.TCON_CONTRATO AND MEMP.TSUB_CODIGO=TSUBT.TSUB_CODIGO AND MEMP.PDEP_CODIDPTO= PDEPTO.PDEP_CODIDPTO AND MEMP.TEST_ESTADO= TESTEMP.TEST_ESTADO AND MEMP.MEMP_FORMPAGO=DBXSCHEMA.TFORMAPAGO.TFOR_PAGO  AND MEMP.PBAN_CODIGO=DBXSCHEMA.PBANCO.PBAN_CODIGO AND MEMP.PEPS_CODIEPS=DBXSCHEMA.PEPS.PEPS_CODIEPS AND MEMP.PARP_CODIARP=DBXSCHEMA.PARP.PARP_CODIARP AND MEMP.PFON_CODICESA=PFCESA.PFON_CODIFOND AND MEMP.MEMP_TESTRETE=DBXSCHEMA.TRETEFTE.TEST_RETE";
            string  nomEmpleado = DBFunctions.SingleData("SELECT NOMBRE FROM VMNIT VM, MEMPLEADO ME WHERE VM.MNIT_NIT = ME.MNIT_NIT AND ME.MEMP_CODIEMPL = '" + DDLEMPLEADO.SelectedValue + "'");
            DataSet ds          = new DataSet();

            DBFunctions.Request(ds, IncludeSchema.NO, select + from + where + ";select cemp_nombre,cemp_nombcome,mnit_nit from dbxschema.cempresa");
            if (ds.Tables[0].Rows.Count > 0)
            {
                ds.WriteXmlSchema(Path.Combine(Request.PhysicalApplicationPath, "schemas/Nomina.InfyConsultas.rpte_ImpHojaVida.xsd"));
                reporte = new ReportDocument();
                reporte.Load(Path.Combine(Request.PhysicalApplicationPath, "rpt/Nomina.InfyConsultas.rpte_ImpHojaVida.rpt"));
                reporte.SetDataSource(ds);
                visor.ReportSource = reporte;
                visor.DataBind();
                reporte.ExportToDisk(ExportFormatType.WordForWindows, Path.Combine(Request.PhysicalApplicationPath, "rptgen/Nomina.InfyConsultas.rpte_ImpHojaVida.doc"));
                Response.Clear();
                Response.ContentType = "application/msword";
                Response.AddHeader("Content-Disposition", "attachment; filename= " + nomEmpleado + ".doc");
                Response.ContentType = "application/msword";
                Response.WriteFile(Path.Combine(Request.PhysicalApplicationPath, "rptgen/Nomina.InfyConsultas.rpte_ImpHojaVida.doc"));
                Response.Flush();
                Response.Close();
            }
            else
            {
                Utils.MostrarAlerta(Response, "Existe un prolema con la consulta, el vendedor no tiene la información completa");
            }
        }
Ejemplo n.º 12
0
        private void loadStockSales()
        {
            ADODB.Recordset rs      = default(ADODB.Recordset);
            ADODB.Recordset rsStock = default(ADODB.Recordset);
            ADODB.Recordset rsGroup = default(ADODB.Recordset);
            string          sql     = null;

            ADODB.Recordset rsData = default(ADODB.Recordset);
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report     = default(CrystalDecisions.CrystalReports.Engine.ReportDocument);
            CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = default(CrystalDecisions.CrystalReports.Engine.ReportDocument);
            Report.Load("crySalesByShrink.rpt");
            ReportNone.Load("cryNoRecords.rpt");

            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rs = modReport.getRSreport(ref "SELECT Report.Report_Heading, aCompany.Company_Name FROM aCompany, Report;");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            Report.SetParameterValue("txtDayEnd", rs.Fields("Report_Heading"));
            rs.Close();
            rs = modReport.getRSreport(ref "SELECT * FROM Link Where LinkID=2 AND Link_SectionID=1");
            if (string.IsNullOrEmpty(rs.Fields("Link_Name").Value))
            {
                Report.ReportDefinition.Sections("Section2").SectionFormat.EnableSuppress = true;
            }
            else
            {
                Report.SetParameterValue("txtFilter", Strings.Replace(rs.Fields("Link_Name").Value, "''", "'"));
            }

            sql = "SELECT aStockItem.StockItemID, aStockItem.StockItem_Name, thejoin.shrink, thejoin.quantity, thejoin.price, thejoin.list, thejoin.actual FROM aStockItem INNER JOIN (SELECT SaleItem.SaleItem_StockItemID AS StockItem, SaleItem.SaleItem_ShrinkQuantity AS shrink, Sum(IIf([SaleItem_Reversal],0-[SaleItem_Quantity],[SaleItem_Quantity])) AS quantity, Sum(([SaleItem_Price]*[SaleItem_Quantity])) AS price, Sum((([SaleItem_ListCost]+[SaleItem_DepositCost])*IIf([SaleItem_Reversal],0-[SaleItem_Quantity],[SaleItem_Quantity]))*(1+[SaleItem_Vat]/100)) AS list, Sum((([SaleItem_ActualCost]+[SaleItem_DepositCost])*IIf([SaleItem_Reversal],0-[SaleItem_Quantity],[SaleItem_Quantity]))*(1+[SaleItem_Vat]/100)) AS actual From SaleItem Where (((SaleItem.SaleItem_DepositType) = 0) And ((SaleItem.SaleItem_Revoke) = 0)) GROUP BY SaleItem.SaleItem_StockItemID, SaleItem.SaleItem_ShrinkQuantity ) AS thejoin ON aStockItem.StockItemID = thejoin.StockItem ";
            sql = sql + rs.Fields("Link_SQL").Value + " ORDER BY aStockItem.StockItem_Name, thejoin.shrink;";


            rs = modReport.getRSreport(ref sql);

            if (rs.BOF | rs.EOF)
            {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode   = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }



            Report.Database.Tables(1).SetDataSource(rs);
            //Report.VerifyOnEveryPrint = True
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode   = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }
Ejemplo n.º 13
0
        /// <summary>
        ///病人出院单统计表
        /// </summary>
        public void m_mthShowBIHLeftStatistics()
        {
            this.m_objViewer.Cursor = Cursors.WaitCursor;
            DataTable dtbResult = new DataTable();

            rptBIHRegisterStatistics = new ReportDocument();
            //rptBIHRegisterStatistics.Load(@"Report\rptLeaveHospital.rpt");
            rptBIHRegisterStatistics.Load(m_strStartPatch + "Report\\rptLeaveHospital.rpt");
            rptBIHRegisterStatistics.DataDefinition.FormulaFields["dtStartTime"].Text = "'" + this.m_objViewer.m_dtpStatDate.Text + "'";
            rptBIHRegisterStatistics.DataDefinition.FormulaFields["dtEndTime"].Text   = "'" + this.m_objViewer.m_dtpEnd.Text + "'";


            //change 2007-4-18
            //long lngRes = objSvc.GetPatientLeftStatistics(DateTime.Parse(m_objViewer.m_dtpStatDate.Text + " 00:00:00"), DateTime.Parse(m_objViewer.m_dtpEnd.Text + " 23:59:59"),  out dtbResult);
            // ---------------------------->
            long lngRes = objSvc.GetPatientLeftStatistics(DateTime.Parse(m_objViewer.m_dtpStatDate.Text + " 00:00:00"), DateTime.Parse(m_objViewer.m_dtpEnd.Text + " 23:59:59"), m_objViewer.m_txtProtectType.Value, out dtbResult);

            // <------------------------------

            if (lngRes > 0)
            {
                this.rptBIHRegisterStatistics.SetDataSource(dtbResult);
                this.m_objViewer.crvBIHRegisterStat.ReportSource = rptBIHRegisterStatistics;
                this.m_objViewer.btnPrintRpt.Enabled             = true;
            }
            this.m_objViewer.Cursor = Cursors.Default;
        }
Ejemplo n.º 14
0
        public ReportDocument GetReportDocument()
        {
            try
            {
                var informe = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                informe.Load("Impresion Factura.rpt");
                informe.SetParameterValue("Nombre", nombre);
                informe.SetParameterValue("Folio", folio);
                informe.SetParameterValue("Año", año);
                informe.SetParameterValue("Mes", mes);
                informe.SetParameterValue("Dia", dia);
                informe.SetParameterValue("Cantidad", cantidad);
                informe.SetParameterValue("Ciudad", ciudad);
                informe.SetParameterValue("Domicilio", domicilio);
                informe.SetParameterValue("IVA", iva);
                informe.SetParameterValue("Lugar", lugar);
                informe.SetParameterValue("PrecioLetra", precioLetra);
                informe.SetParameterValue("PrecioUnitario", precioU);
                informe.SetParameterValue("Previsualizacion", previsualisacion);
                informe.SetParameterValue("Retencion", retencion);
                informe.SetParameterValue("RFC", rfc);
                informe.SetParameterValue("Total", total);
                informe.SetParameterValue("Importe", importe);
                informe.SetParameterValue("Descripcion", descripcion);

                return(informe);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void rptPDFAdjunto(String Reporte, String Nombre, String Referencia, String Importe, String Vigencia, String Concepto, String Observaciones)
        {
            System.Web.UI.Page p = new System.Web.UI.Page();
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            try
            {
                report.Load(p.Server.MapPath("~") + Reporte);
                report.SetParameterValue(0, Nombre);
                report.SetParameterValue(1, Referencia);
                report.SetParameterValue(2, Importe);
                report.SetParameterValue(3, Vigencia);
                report.SetParameterValue(4, Concepto);
                report.SetParameterValue(5, Observaciones);
                report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                string archivo = p.Server.MapPath("~") + "/ArchivoReferencia/Referencia - " + Referencia + ".PDF";
                report.ExportToDisk(ExportFormatType.PortableDocFormat, archivo); // "FichaReferenciada-" + Nombre.Substring(0, 15));
            }
            catch (Exception ex)
            {
                lblMensajeCorreo.Text = ex.Message;
            }
            finally
            {
                //CR_Reportes.ReportSource = report;
                report.Close();
                report.Dispose();
                //CR_Reportes.Dispose();
            }
        }
Ejemplo n.º 16
0
 public void addTrinhKy_OnFormLoad()
 {
     //Ham nay XuanDT them vao
     try {
         //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop
         mv_oRptDoc  = RptDoc;
         mv_oViewDoc = this.crptViewer;
         //ket thuc doan gan bien
         mv_oRptFieldObj = mv_oRptDoc.ReportDefinition.ReportObjects["Field150181"] as FieldObject;
         mv_oNguoiKy     = new cls_SignInfor(mv_oRptDoc.ToString(), "");
         //chkPrint_CheckedChanged(chkPrint, New System.EventArgs)
         if (mv_oNguoiKy._TonTai)
         {
             mv_oNguoiKy.setValueToRPT(ref mv_oRptFieldObj);
             if (mv_bSetContent)
             {
                 mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.gv_sStaffName).Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
             }
             else
             {
                 mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = "";
             }
             mv_oViewDoc.ReportSource = RptDoc;
         }
         else
         {
             mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text);
         }
     }
     catch (Exception ex) {
         mv_oRptText = null;
         //an nut tuy chon di
         this.cmdTrinhKy.Visible = false;
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// 病区病人欠费一览表
        /// </summary>
        public void m_mthShowInHospitalAdviceCharge()
        {
            if (this.m_objViewer.m_txtAREAID_CHR.Tag == null && this.m_objViewer.radioButton3.Checked)
            {
                return;
            }
            if (this.m_objViewer.m_txtPatientName.Text == "")
            {
                MessageBox.Show("先查询病人");
                return;
            }
            this.m_objViewer.Cursor = Cursors.WaitCursor;
            DataTable dtbResult = new DataTable();

            rptInHospitalLog = new ReportDocument();
            rptInHospitalLog.Load(@"Report\rptPatientChargeInAdvice.rpt");
            string groupid = "";

            if (this.m_objViewer.m_cboChargeType.SelectedIndex >= 0)
            {
                if (this.m_objViewer.m_cboChargeType.SelectedIndex == 0)
                {
                    groupid = "";
                }
                else
                {
                    groupid = ((DataTable)this.m_objViewer.m_cboChargeType.Tag).Rows[this.m_objViewer.m_cboChargeType.SelectedIndex - 1]["groupid_chr"].ToString();
                }
            }
            long lngRes = 0;

            if (groupid == "")
            {
                lngRes = objSvc.m_lngGetPatientDebtDetail(this.m_objViewer.m_dtpStatDate.Value, this.m_objViewer.m_dtpEnd.Value, Registerid, out dtbResult);
            }
            else
            {
                string[] types;
                lngRes = objSvc.m_lngGetChargeItemTypesByConfigGroupID("0003", groupid, out types);
                lngRes = objSvc.m_lngGetPatientDebtDetail(types, this.m_objViewer.m_dtpStatDate.Value, this.m_objViewer.m_dtpEnd.Value, Registerid, out dtbResult);
            }
            if (lngRes > 0)
            {
                rptInHospitalLog.SetDataSource(dtbResult);
            }
            else
            {
                return;
            }
            rptInHospitalLog.DataDefinition.FormulaFields["AreaName"].Text     = "'" + this.m_objViewer.m_txtAREAID_CHR.Text.Trim() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["BedNo"].Text        = "'" + this.m_objViewer.m_cboBedNo.Text.Trim() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["InhospitalNo"].Text = "'" + this.m_objViewer.m_txtInpatientNo.Text.Trim() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["Name"].Text         = "'" + this.m_objViewer.m_txtPatientName.Text + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["OperatorName"].Text = "'" + this.m_objViewer.LoginInfo.m_strEmpName + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["Date"].Text         = "'" + this.m_objViewer.m_dtpStatDate.Value.ToShortDateString() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["EndDate"].Text      = "'" + this.m_objViewer.m_dtpEnd.Value.ToShortDateString() + "'";
            rptInHospitalLog.DataDefinition.FormulaFields["ReportName"].Text   = "'" + this.ReportName + "'";
            this.m_objViewer.m_crvPatientCharheDetail.ReportSource             = rptInHospitalLog;
            this.m_objViewer.Cursor = Cursors.Default;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 產生PDF檔案
        /// </summary>
        private void RrintToPDF()
        {
            // 匯出檔名的設定
            string sReportFileName  = @"\rpt\T022_rpt.rpt";
            string sMapPath         = Server.MapPath("");
            string sHost            = Request.Url.Host;
            string sApplicationPath = Request.ApplicationPath;
            string reportID         = DBCenter.GetSystemID();

            string sExportFileName = Server.MapPath("../../") + @"PDF\T022_rpt" + reportID + ".pdf";
            string strPath         = sMapPath + sReportFileName;
            string ReportPath      = "http://" + sHost + sApplicationPath + "/PDF/T022_rpt" + reportID + ".pdf";

            DataSet dsLot = (DataSet)Session["T022View"];

            rptdoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            rptdoc.Load(strPath);
            rptdoc.SetDataSource(dsLot);

            // 設定匯出路徑及檔名
            DiskFileDestinationOptions df = new DiskFileDestinationOptions();

            df.DiskFileName = sExportFileName;
            rptdoc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
            rptdoc.ExportOptions.ExportFormatType      = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
            rptdoc.ExportOptions.DestinationOptions    = df;
            rptdoc.Export();
            rptdoc.Dispose();

            //打開文件
            Response.Write("<script>window.open('" + ReportPath + "','_blank','resizable,scrollbars=no,menubar=no,toolbar=no,location=no,status=no',false);</script> ");

            Response.Write("<script>window.close();</script>");
        }
        private void rptPDF_Ingresos(String Reporte, object[] Parametros, string NombreReporte)
        {
            System.Web.UI.Page p = new System.Web.UI.Page();
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            try
            {
                ConnectionInfo connectionInfo = new ConnectionInfo();
                p = new System.Web.UI.Page();
                report.Load(p.Server.MapPath("~") + "\\" + Reporte);

                for (int i = 0; i <= Parametros.Length - 1; i++)
                {
                    report.SetParameterValue(i, Parametros[i]);
                }

                connectionInfo.ServerName = "dsia";
                connectionInfo.UserID     = "ingresos";
                connectionInfo.Password   = "******";
                SetDBLogonForReport(connectionInfo, report);
                report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, NombreReporte);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                CR_Reportes.ReportSource = report;
                report.Close();
                report.Dispose();
                CR_Reportes.Dispose();
                GC.Collect();
            }
        }
        private void rptPDFReferencia(String Reporte, String Nombre, String Referencia)
        {
            System.Web.UI.Page p = new System.Web.UI.Page();
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            try
            {
                // ConnectionInfo connectionInfo = new ConnectionInfo();
                //string J = System.AppDomain.CurrentDomain.BaseDirectory + Reporte;
                report.Load(p.Server.MapPath("~") + Reporte);
                //report.Load(System.AppDomain.CurrentDomain.BaseDirectory + Reporte);
                report.SetParameterValue(0, Referencia);
                report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "FichaReferenciada-" + Nombre.Substring(0, 15));
            }
            catch (Exception ex)
            {
            }
            finally
            {
                CR_Reportes.ReportSource = report;
                report.Close();
                report.Dispose();
                CR_Reportes.Dispose();
                GC.Collect();
            }
        }
Ejemplo n.º 21
0
        private void cmdLoad_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            ADODB.Recordset rs = default(ADODB.Recordset);
            ADODB.Recordset rsData = default(ADODB.Recordset);
            //Dim Report As New cryItemGroupCompare
            //ReportNone.Load("cryNoRecords.rpt")
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            Report.Load("cryItemGroupCompare.rpt");
            ReportNone.Load("cryNoRecords");
            modReport.cnnDBreport.Execute("DELETE LinkItem.* FROM LinkItem;");
            rs = modReport.getRSreport(ref "SELECT * FROM Link Where LinkID=1 AND Link_SectionID=1");
            modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT 1, DayEndStockItemLnk.DayEndStockItemLnk_DayEndID, DayEndStockItemLnk.DayEndStockItemLnk_QuantitySales FROM DayEndStockItemLnk INNER JOIN aStockItem ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem.StockItemID WHERE " + rs.Fields("Link_SQL").Value + ";");
            rs = modReport.getRSreport(ref "SELECT * FROM Link Where LinkID=2 AND Link_SectionID=1");
            modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT 2, DayEndStockItemLnk.DayEndStockItemLnk_DayEndID, Sum(DayEndStockItemLnk.DayEndStockItemLnk_QuantitySales) AS SumOfDayEndStockItemLnk_QuantitySales FROM DayEndStockItemLnk INNER JOIN aStockItem ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem.StockItemID " + rs.Fields("Link_SQL").Value + " GROUP BY DayEndStockItemLnk.DayEndStockItemLnk_DayEndID;");

            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rs = modReport.getRSreport(ref "SELECT Report.Report_Heading, aCompany.Company_Name FROM aCompany, Report;");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            Report.SetParameterValue("txtDayEnd", rs.Fields("Report_Heading"));
            rs.Close();
            rs = modReport.getRSreport(ref "SELECT Link.* From Link Where (((Link.Link_SectionID) = 1)) ORDER BY Link.Link_SectionID;");
            if (rs.BOF | rs.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }
            rsData = modReport.getRSreport(ref "SELECT LinkItem.*, Format([DayEnd_Date],'ddd dd mmm\", \"yyyy') AS dateName, DayEnd.DayEnd_Date FROM DayEnd INNER JOIN LinkItem ON DayEnd.DayEndID = LinkItem.LinkItem_DayEndID;");
            if (rsData.BOF | rsData.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }

            Report.Database.Tables(1).SetDataSource(rs);
            Report.Database.Tables(2).SetDataSource(rsData);
            //Report.VerifyOnEveryPrint = True
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }
Ejemplo n.º 22
0
        private void cmdPrint_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            ADODB.Recordset rs        = default(ADODB.Recordset);
            ADODB.Recordset rsCompany = default(ADODB.Recordset);
            string          sql       = null;

            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = default(CrystalDecisions.CrystalReports.Engine.ReportDocument);
            update_Renamed();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rsCompany = modRecordSet.getRS(ref "SELECT * FROM Company");
            if (this.chkChannel.CheckState)
            {
                Report.Load("cryPriceList.rpt");

                sql = "SELECT Pricelist.Pricelist_Name, StockItem.StockItem_Name, Max(codCase.CatalogueChannelLnk_Price) AS codCase, Max(codCase.CatalogueChannelLnk_Quantity) AS codQuantity, codSingle.CatalogueChannelLnk_Price AS codSingle, Max(deliveryCase.CatalogueChannelLnk_Quantity) AS delQuantity, Max(deliveryCase.CatalogueChannelLnk_Price) AS delCase, deliverySingle.CatalogueChannelLnk_Price AS delSingle";
                sql = sql + " FROM ShrinkItem INNER JOIN";
                sql = sql + " (CatalogueChannelLnk AS deliverySingle INNER JOIN (CatalogueChannelLnk AS deliveryCase INNER JOIN ((CatalogueChannelLnk AS codCase INNER JOIN (StockItem INNER JOIN (PricelistStockItemLnk INNER JOIN Pricelist ON PricelistStockItemLnk.PricelistStockitemLnk_PricelistID = Pricelist.PricelistID) ON StockItem.StockItemID = PricelistStockItemLnk.PricelistStockitemLnk_StockitemID) ON (codCase.CatalogueChannelLnk_ChannelID = Pricelist.Pricelist_CODChannelID) AND (codCase.CatalogueChannelLnk_StockItemID = StockItem.StockItemID)) INNER JOIN CatalogueChannelLnk AS codSingle ON (StockItem.StockItemID = codSingle.CatalogueChannelLnk_StockItemID) AND (Pricelist.Pricelist_CODChannelID = codSingle.CatalogueChannelLnk_ChannelID)) ON (deliveryCase.CatalogueChannelLnk_StockItemID = StockItem.StockItemID) AND (deliveryCase.CatalogueChannelLnk_ChannelID = Pricelist.Pricelist_DeliveryChannelID)) ON (deliverySingle.CatalogueChannelLnk_ChannelID = Pricelist.Pricelist_DeliveryChannelID)";
                sql = sql + " AND (deliverySingle.CatalogueChannelLnk_StockItemID = StockItem.StockItemID)) ON (ShrinkItem.ShrinkItem_Quantity = codCase.CatalogueChannelLnk_Quantity) AND (ShrinkItem.ShrinkItem_Quantity = deliveryCase.CatalogueChannelLnk_Quantity) AND (ShrinkItem.ShrinkItem_ShrinkID = StockItem.StockItem_ShrinkID)";
                sql = sql + " Where (((codSingle.CatalogueChannelLnk_Quantity) = 1) And ((Pricelist.Pricelist_Disabled) = 0) And ((deliverySingle.CatalogueChannelLnk_Quantity) = 1))";
                sql = sql + " GROUP BY Pricelist.Pricelist_Name, StockItem.StockItem_Name, codSingle.CatalogueChannelLnk_Price, deliverySingle.CatalogueChannelLnk_Price";
                sql = sql + " ORDER BY Pricelist.Pricelist_Name, StockItem.StockItem_Name;";
            }
            else
            {
                Report.Load("cryPriceListSingle.rpt");
                sql = "SELECT Pricelist.Pricelist_Name, StockItem.StockItem_Name, Max(codCase.CatalogueChannelLnk_Price) AS codCase, Max(codCase.CatalogueChannelLnk_Quantity) AS codQuantity, codSingle.CatalogueChannelLnk_Price AS codSingle, StockItem.StockItemID ";
                sql = sql + "FROM ((CatalogueChannelLnk AS codCase INNER JOIN (StockItem INNER JOIN (PricelistStockItemLnk INNER JOIN Pricelist ON PricelistStockItemLnk.PricelistStockitemLnk_PricelistID = Pricelist.PricelistID) ON StockItem.StockItemID = PricelistStockItemLnk.PricelistStockitemLnk_StockitemID) ON (codCase.CatalogueChannelLnk_StockItemID = StockItem.StockItemID) AND (codCase.CatalogueChannelLnk_ChannelID = Pricelist.Pricelist_CODChannelID)) INNER JOIN CatalogueChannelLnk AS codSingle ON (Pricelist.Pricelist_CODChannelID = codSingle.CatalogueChannelLnk_ChannelID) AND (StockItem.StockItemID = codSingle.CatalogueChannelLnk_StockItemID)) INNER JOIN ShrinkItem ON (ShrinkItem.ShrinkItem_Quantity = codCase.CatalogueChannelLnk_Quantity) AND (StockItem.StockItem_ShrinkID = ShrinkItem.ShrinkItem_ShrinkID) ";
                sql = sql + "Where (((codSingle.CatalogueChannelLnk_Quantity) = 1) And ((Pricelist.Pricelist_Disabled) = 0)) GROUP BY Pricelist.Pricelist_Name, StockItem.StockItem_Name, codSingle.CatalogueChannelLnk_Price, StockItem.StockItemID ORDER BY Pricelist.Pricelist_Name, StockItem.StockItem_Name;";
            }


            rs = modRecordSet.getRS(ref sql);
            if (rs.BOF | rs.EOF)
            {
                Interaction.MsgBox("No Price allocated!", MsgBoxStyle.Exclamation, "PRICE LIST");
                return;
            }

            if (this.chkChannel.CheckState)
            {
                Report.SetParameterValue("Text3", cmbCOD.Text);
                Report.SetParameterValue("Text4", cmbDelivery.Text);
            }
            else
            {
                Report.SetParameterValue("Text3", cmbCOD.Text);
            }

            Report.Database.Tables(1).SetDataSource(rs);
            Report.Database.Tables(2).SetDataSource(rsCompany);
            Report.SetParameterValue("txtCompanyName", rsCompany.Fields("Company_Name"));
            My.MyProject.Forms.frmReportShow.Text = "Price List";
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode   = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 按账务期统计
        /// </summary>
        public void m_mthButtonClickToStatistic()
        {
            string p_strPriodId = "";

            clsPeriod_VO[] objPriodItems = this.m_objViewer.m_cboSelPeriod.Tag as clsPeriod_VO[];
            if (this.m_objViewer.m_cboSelPeriod.SelectedItem == null)
            {
                MessageBox.Show("请选择账务期");
                return;
            }
            if (this.m_objViewer.m_cboSelPeriod.Text != "所有财务期的数据")
            {
                p_strPriodId = objPriodItems[this.m_objViewer.m_cboSelPeriod.SelectedIndex - 1].m_strPeriodID;
            }

            DataTable dtbStatistic;
            long      lngRes = 0;

            lngRes = this.m_objManage.m_lngGetStatiticsData(out dtbStatistic, p_strPriodId);
            System.Data.DataColumn dc = new DataColumn("SEQUENCEID");
            dtbStatistic.Columns.Add(dc);
            if (dtbStatistic.Rows.Count != 0)
            {
                for (int j1 = 0; j1 < dtbStatistic.Rows.Count; j1++)
                {
                    dtbStatistic.Rows[j1]["SEQUENCEID"] = j1 + 1;
                }
            }
            if (lngRes < 0)
            {
                return;
            }
            else
            {
                CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                rpt.Load("Report\\CrystalReportHisMedInOrderStaticstic.rpt");
//					HISMedTypeManage.Rpt.CrystalReportHisMedInOrderStaticstic rpt = new HISMedTypeManage.Rpt.CrystalReportHisMedInOrderStaticstic();
                ((TextObject)rpt.ReportDefinition.ReportObjects["Text11"]).Text = this.m_objViewer.m_cboSelPeriod.SelectedText;
                double totalMoney = 0;
                if (dtbStatistic.Rows.Count > 0)
                {
                    for (int i1 = 0; i1 < dtbStatistic.Rows.Count; i1++)
                    {
                        totalMoney += Convert.ToDouble(dtbStatistic.Rows[i1]["TOLMNY_MNY"].ToString().Trim());
                    }

                    //((TextObject)rpt.ReportDefinition.ReportObjects["Text9"]).Text = totalMoney.ToString("######.00");
                }
                else
                {
                    //((TextObject)rpt.ReportDefinition.ReportObjects["Text9"]).Text = "0.00";
                }

                ((TextObject)rpt.ReportDefinition.ReportObjects["Text11"]).Text = this.m_objViewer.m_cboSelPeriod.Text;
                rpt.SetDataSource(dtbStatistic);
                rpt.Refresh();
                this.m_objViewer.m_crystalReportViewer1.ReportSource = rpt;
            }
        }
Ejemplo n.º 24
0
        void CETAK()
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            MASTER.REPORT.FormViewerPRICELIST frm = new MASTER.REPORT.FormViewerPRICELIST(dtPRINTB, 0);

            frm.ShowDialog();
        }
Ejemplo n.º 25
0
        public frmPrinter(DataTable dtDatos, CrystalDecisions.CrystalReports.Engine.ReportDocument oReporte, string cTitulo)
        {
            _Datos = dtDatos;
            _Reporte = oReporte;
            _Titulo = cTitulo;

            InitializeComponent();
        }
Ejemplo n.º 26
0
 public clsControlMedicineProtectReport()
 {
     //
     // TODO: 在此处添加构造函数逻辑
     //
     m_rptRpt  = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
     clsDomain = new clsDcl_ReckoningReport();
 }
Ejemplo n.º 27
0
        public frmPrinter(DataTable dtDatos, CrystalDecisions.CrystalReports.Engine.ReportDocument oReporte, string cTitulo)
        {
            _Datos   = dtDatos;
            _Reporte = oReporte;
            _Titulo  = cTitulo;

            InitializeComponent();
        }
Ejemplo n.º 28
0
    public static void AddReportParameters(CrystalDecisions.CrystalReports.Engine.ReportDocument rpt, DataSet ds, bool CompanyName, string ReportName, bool Address1, bool Address2, bool City, bool phone, bool Email)
    {
        rpt.SetDataSource(ds);

        if (CompanyName == true)
        {
            rpt.SetParameterValue("pCompanyName", CurrentCompany.Name);
        }

        if (ReportName != "")
        {
            rpt.SetParameterValue("pReportName", ReportName);
        }

        if (Address1 == true)
        {
            rpt.SetParameterValue("pAddress1", CurrentCompany.Address1);
        }

        if (Address2 == false)
        {
            rpt.SetParameterValue("pAddress2", CurrentCompany.Address2);
        }

        if (City == true)
        {
            rpt.SetParameterValue("pCity", CurrentCompany.City);
        }

        if (phone == true)
        {
            rpt.SetParameterValue("pPhone", CurrentCompany.Phone);
        }

        if (Email == true)
        {
            rpt.SetParameterValue("pEmail", CurrentCompany.Email);
        }

        //if (State == true)
        //{
        //    rpt.SetParameterValue("pState", "");
        //}
        //if (PinCode == true)
        //{
        //    rpt.SetParameterValue("pPinCode", CurrentCompany.Pincode);
        //}

        //if (Phone2 == true)
        //{
        //    rpt.SetParameterValue("pPhone2", CurrentCompany.Phone2);
        //}
        //if (Fax == true)
        //{
        //    rpt.SetParameterValue("pFax", CurrentCompany.Fax);
        //}
    }
Ejemplo n.º 29
0
 protected void MostrarReporte(string ruta)
 {
     //mostrar el reporte en la pagina.
     reporte = new ReportDocument();
     reporte.Load(Path.Combine(Request.PhysicalApplicationPath, "rpt/" + ruta + ".rpt"));
     reporte.SetDataSource(ds);
     visor.ReportSource = reporte;
     visor.DataBind();
     reporte.ExportToDisk(ExportFormatType.WordForWindows, Path.Combine(Request.PhysicalApplicationPath, "rptgen/" + ruta + ".doc"));
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;
            DataSet dsReport   = new xmlClassWiseStudentAttendTime();
            DataSet ds         = new DataSet();
            string  SearchText = "";

            rpt.FileName = Server.MapPath("rptDeposit.rpt");
            DayCareBAL.FamilyPaymentService proxyPayment = new DayCareBAL.FamilyPaymentService();

            if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"]))
            {
                SearchText += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'";
            }
            if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"]))
            {
                SearchText += " l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'";
            }
            else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"]))
            {
                SearchText += "  l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'";
            }
            string StartDate = string.Empty;
            string EndDate   = string.Empty;

            if (Request.QueryString["StartDate"] != "")
            {
                StartDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy");
            }
            if (Request.QueryString["EndDate"] != "")
            {
                EndDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy");
            }
            CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text14"];
            CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
            CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
            footer.Text          = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
            titleText.Text       = "Deposit Report From " + StartDate + " To " + EndDate;
            titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
            ds = proxyPayment.LoadPaymentDeposits(SearchText, new Guid(Session["CurrentSchoolYearId"].ToString()));
            dsReport.Tables["dtDiposit"].Merge(ds.Tables[0]);
            rpt1.SetDataSource(dsReport.Tables["dtDiposit"]);

            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
Ejemplo n.º 31
0
        public static void sbrEtiTextoLibre(int vNumLin, string[] vLins, bool vLogo, bool vCentra)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            if (vNumLin == 3)
            {
                rpt = new rptEti3L();
            }
            if (vNumLin == 4)
            {
                rpt = new rptEti4L();
            }
            if (vNumLin == 5)
            {
                rpt = new rptEti5L();
            }

            for (int i = 0; i < vNumLin; i++)
            {
                string vInf = "fLin" + (i + 1).ToString();
                rpt.DataDefinition.FormulaFields[vInf].Text = "'" + vLins[i] + "'";
                if (vCentra)
                {
                    rpt.ReportDefinition.ReportObjects["Flin" + (i + 1).ToString() + "1"].ObjectFormat.HorizontalAlignment = CrystalDecisions.Shared.Alignment.HorizontalCenterAlign;
                }
            }


            rpt.ReportDefinition.ReportObjects["Picture1"].ObjectFormat.EnableSuppress = !vLogo;

            if (_Imp)
            {
                Application.DoEvents();
                rpt.PrintOptions.PrinterName = cParamXml.PrintEtiCajaBolsa;
                rpt.PrintToPrinter(1, false, 0, 0);
                Application.DoEvents();
            }
            else
            {
                Application.DoEvents();
                Form frm = new frmVisor();
                frmVisor.orpt = rpt;
                frm.ShowDialog();
                Application.DoEvents();
            }

            Imp = false;
            Application.DoEvents();
            rpt.Close();
            Application.DoEvents();
            rpt.Dispose();
            Application.DoEvents();
        }
Ejemplo n.º 32
0
 private void ShowReport(CrystalDecisions.CrystalReports.Engine.ReportDocument rpt, Boolean isDirectPrint, string strReportTitle = "")
 {
     if (isDirectPrint == true)
     {
         rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
         rpt.PrintToPrinter(1, false, 0, 0);
     }
     else
     {
         //InitialiseParameterLabels(rpt, strReportTitle);
         this.Show();
     }
 }
Ejemplo n.º 33
0
        // private Logger log;
        public frmPrintPreview(string FormTitle, CrystalDecisions.CrystalReports.Engine.ReportDocument RptDoc, bool pv_bSetContent, bool pv_bDisplayPrintButton)
            : base()
        {
            //This call is required by the Windows Form Designer.
            InitializeComponent();
            log = LogManager.GetCurrentClassLogger();
            //Add any initialization after the InitializeComponent() call
            this.Text = FormTitle;
            this.RptDoc = RptDoc;
            cmdTrinhKy.Visible = pv_bSetContent;
            mv_bSetContent = pv_bSetContent;
            this.crptViewer.ShowRefreshButton = false;
            this.crptViewer.ShowPrintButton = pv_bDisplayPrintButton;

            txtCopyPage.LostFocus += new EventHandler(txtSoCopyPage_LostFocus);
            InitializeEvents();

            CauHinh();
        }
Ejemplo n.º 34
0
        private ReportDocument creaReporte(string archivoReporte)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument Rpt1 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            //  ======  Seleccion del reporte
            switch (archivoReporte)
            {
                case "Solicitud":
                    {
                        Rpt1 =  new SOPORTEC.Reportes.Solicitud();
                        break;
                    }
                //case "equipoS":
                //    {
                //        Rpt1 = new Reportes.solicitudes() ;
                //        break;
                //    }
            }
            return Rpt1;
        }
Ejemplo n.º 35
0
 // private Logger log;
  public frmPrintPreview(string FormTitle, CrystalDecisions.CrystalReports.Engine.ReportDocument RptDoc, bool pv_bSetContent,bool pv_bDisplayPrintButton,string TitleReport)
      : base()
  {
      
      //This call is required by the Windows Form Designer.
      InitializeComponent();
      log = LogManager.GetCurrentClassLogger();
      Utility.loadIconToForm(this);
      //Add any initialization after the InitializeComponent() call
      this.Text = FormTitle;
      this.RptDoc = RptDoc;
      this.sTIEUDE = TitleReport;
      
      this.crptViewer.ReportSource = this.RptDoc;
      cmdTrinhKy.Visible = pv_bSetContent;
      mv_bSetContent = pv_bSetContent;
      this.crptViewer.ShowRefreshButton = false;
      this.crptViewer.ShowPrintButton = pv_bDisplayPrintButton;
      InitializeEvents();
      sTIEUDE = new cls_SignInfor().SetTieuDe(RptDoc.ToString(), sTIEUDE);
    
  }
Ejemplo n.º 36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();
            crvReporte.Visible = true;
            string fechainicial = Request.QueryString["fechainicial"].ToString();
            string fechafinal = Request.QueryString["fechafinal"].ToString();
            string idsede = Request.QueryString["idsede"].ToString();
            string idproyecto = Request.QueryString["idproyecto"].ToString();
            string idestado = Request.QueryString["idestado"].ToString();

            ds = objPedidoDAO.ListarReportePedidos(AppUtilidad.stringToDateTime(fechainicial, "DD/MM/YYYY"),
                                                   AppUtilidad.stringToDateTime(fechafinal, "DD/MM/YYYY"),
                                                   Convert.ToInt32(idsede),
                                                   Convert.ToInt32(idproyecto),
                                                   idestado);

            dt = ds.Tables[0];
            CrystalDecisions.CrystalReports.Engine.ReportDocument rDoc;
            rDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            rDoc.Load(Server.MapPath("rptReportePedidos.rpt")); // Your .rpt file path
            rDoc.SetDataSource(dt); //set dataset to the report viewer.
            rDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "Listado");
        }
Ejemplo n.º 37
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        string par_ProgramID = string.Empty;
        string par_LoginUser = string.Empty;

        DropDownList ReasonS = (DropDownList)this.SLP_CodeFileS.FindControl("D1");
        DropDownList ReasonE = (DropDownList)this.SLP_CodeFileE.FindControl("D1");

        string[] fileds ={ "STORE" };
        DataTable Dt = SelectDistinct(dt_Source, fileds);

        #region 前置檢查與參數過濾

        string par_S_PDate = this.SLP_SLPDateRangeOut.StartDate;
        string par_E_PDate = this.SLP_SLPDateRangeOut.EndDate;
        string par_S_ChanNo = this.SLP_StoreChainS.Text + " " + this.SLP_StoreChainS.Name;
        string par_E_ChanNo = this.SLP_StoreChainE.Text + " " + this.SLP_StoreChainE.Name;
        string par_AcceptDate = this.SLP_SLPDate.Text;
        string par_S_Route = this.SLP_RouteS.Text + " " + this.SLP_RouteS.Name;
        string par_E_Route = this.SLP_RouteE.Text + " " + this.SLP_RouteE.Name;
        string par_S_ReasonNo = ReasonS.SelectedValue + " " + ReasonS.SelectedItem.Text;
        string par_E_ReasonNo = ReasonE.SelectedValue + " " + ReasonE.SelectedItem.Text;
        string par_S_Store = this.SLP_StoreS.Text + " " + this.SLP_StoreS.Name;
        string par_E_Store = this.SLP_StoreE.Text + " " + this.SLP_StoreE.Name;
        par_ProgramID = this.PageCode;
        par_LoginUser = Session["UID"].ToString();

        string par_STORE_CNT = Dt.Rows.Count.ToString();

        #endregion

        #region 組合查詢條件至ArrayList

        ArrayList returnList = new ArrayList();

        returnList.Clear();

        report.SetParameterValue("par_S_PDate", par_S_PDate);
        report.SetParameterValue("par_E_PDate", par_E_PDate);
        report.SetParameterValue("par_S_ChanNo", par_S_ChanNo);
        report.SetParameterValue("par_E_ChanNo", par_E_ChanNo);
        report.SetParameterValue("par_AcceptDate", par_AcceptDate);
        report.SetParameterValue("par_S_Route", par_S_Route);
        report.SetParameterValue("par_E_Route", par_E_Route);
        report.SetParameterValue("par_S_ReasonNo", par_S_ReasonNo);
        report.SetParameterValue("par_E_ReasonNo", par_E_ReasonNo);
        report.SetParameterValue("par_S_Store", par_S_Store);
        report.SetParameterValue("par_E_Store", par_E_Store);

        report.SetParameterValue("par_ProgramID", par_ProgramID);
        report.SetParameterValue("par_LoginUser", par_LoginUser);

        report.SetParameterValue("par_STORE_CNT", par_STORE_CNT);

        #endregion

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/vnd.ms-excel";
                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }

    }
Ejemplo n.º 38
0
        private void cmdLoad_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            string sql = null;
            ADODB.Connection lConn = default(ADODB.Connection);
            ADODB.Recordset rs = default(ADODB.Recordset);
            ADODB.Recordset rsPurchase = default(ADODB.Recordset);
            ADODB.Recordset rsSales = default(ADODB.Recordset);
            ADODB.Recordset rsStock = default(ADODB.Recordset);
            ADODB.Recordset rsCompany = default(ADODB.Recordset);
            //Dim Report As New cryIncomeExpense
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            Report.Load("cryIncomeExpense.rpt");
            //UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            if (cmbMonthEnd.SelectedIndex) {
                lConn = modRecordSet.openConnectionInstance(ref "month" + gMonth - cmbMonthEnd.SelectedIndex + ".mdb");
                if (lConn == null)
                    return;
                rsStock = new ADODB.Recordset();
                rsStock.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
                sql = "SELECT DayEndStockItemLnk.DayEndStockItemLnk_DayEndID, Sum([DayEndStockItemLnk_Quantity]*[DayEndStockItemLnk_ListCost]-[DayEndStockItemLnk_QuantitySales]*[DayEndStockItemLnk_ListCost]-[DayEndStockItemLnk_QuantityShrink]*[DayEndStockItemLnk_ListCost]+[DayEndStockItemLnk_QuantityGRV]*[DayEndStockItemLnk_ListCost]) AS total, Sum([DayEndStockItemLnk_Quantity]*[DayEndStockItemLnk_ListCost]) AS opening, Sum([DayEndStockItemLnk_QuantitySales]*[DayEndStockItemLnk_ListCost]) AS sales, Sum([DayEndStockItemLnk_QuantityShrink]*[DayEndStockItemLnk_ListCost]) AS shrink, Sum([DayEndStockItemLnk_QuantityGRV]*[DayEndStockItemLnk_ListCost]) AS grv From DayEndStockItemLnk GROUP BY DayEndStockItemLnk.DayEndStockItemLnk_DayEndID;";

                rsStock.Open(sql, lConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic);
                rsSales = new ADODB.Recordset();
                rsSales.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
                //UPGRADE_WARNING: Couldn't resolve default property of object sql. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                sql = "SELECT [M_DayEnd].[DayEndID], [M_DayEnd].[DayEnd_Date], Sum([Declaration].[Declaration_Total]) AS SumOfSale_Total FROM Declaration INNER JOIN M_DayEnd ON [Declaration].[Declaration_DayEndID]=[M_DayEnd].[DayEndID] GROUP BY [M_DayEnd].[DayEndID], [M_DayEnd].[DayEnd_Date];";

                rsSales.Open(sql, lConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic);
            } else {

                modApplication.modUpdate = 3;

                modApplication.updateStockMovement();

                sql = "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, Sum(Declaration.Declaration_Total) AS SumOfSale_Total FROM Company, Declaration INNER JOIN DayEnd ON Declaration.Declaration_DayEndID = DayEnd.DayEndID Where (((DayEnd.DayEndID) <> [Company]![Company_DayEndID])) GROUP BY DayEnd.DayEndID, DayEnd.DayEnd_Date Union SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, Sum([SaleItem_Price]*[SaleItem_Quantity]) AS SumOfSale_Total FROM Consignment AS Consignment_1 RIGHT JOIN (Consignment RIGHT JOIN ((Sale INNER JOIN (Company INNER JOIN DayEnd ON Company.Company_DayEndID = DayEnd.DayEndID) ON Sale.Sale_DayEndID = DayEnd.DayEndID) INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleItem_SaleID) ON Consignment.Consignment_SaleID = Sale.SaleID) ON Consignment_1.Consignment_ReversalSaleID = Sale.SaleID Where (((SaleItem.SaleItem_Revoke) = 0)) GROUP BY Consignment.ConsignmentID, Consignment_1.ConsignmentID, DayEnd.DayEndID, DayEnd.DayEnd_Date  ";
                sql = sql + "HAVING (((Consignment.ConsignmentID) Is Null) AND ((Consignment_1.ConsignmentID) Is Null));";
                rsSales = modRecordSet.getRS(ref sql);

                rsStock = modRecordSet.getRS(ref "SELECT DayEndStockItemLnk.DayEndStockItemLnk_DayEndID, Sum([DayEndStockItemLnk_Quantity]*[DayEndStockItemLnk_ListCost]-[DayEndStockItemLnk_QuantitySales]*[DayEndStockItemLnk_ListCost]-[DayEndStockItemLnk_QuantityShrink]*[DayEndStockItemLnk_ListCost]+[DayEndStockItemLnk_QuantityGRV]*[DayEndStockItemLnk_ListCost]) AS total, Sum([DayEndStockItemLnk_Quantity]*[DayEndStockItemLnk_ListCost]) AS opening, Sum([DayEndStockItemLnk_QuantitySales]*[DayEndStockItemLnk_ListCost]) AS sales, Sum([DayEndStockItemLnk_QuantityShrink]*[DayEndStockItemLnk_ListCost]) AS shrink, Sum([DayEndStockItemLnk_QuantityGRV]*[DayEndStockItemLnk_ListCost]) AS grv From DayEndStockItemLnk GROUP BY DayEndStockItemLnk.DayEndStockItemLnk_DayEndID;");

            }

            rsPurchase = modRecordSet.getRS(ref "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, Sum(grvPosted.GRV_InvoiceInclusive) AS SumOfGRV_InvoiceInclusive, ([MonthEnd_BudgetSales]/[MonthEnd_Days]) AS saleBudget, ([MonthEnd_BudgetPurchases]/[MonthEnd_Days]) AS purchaseBudget FROM [SELECT GRV.* From GRV WHERE (((GRV.GRV_GRVStatusID)=3))]. AS grvPosted RIGHT JOIN (DayEnd INNER JOIN MonthEnd ON DayEnd.DayEnd_MonthEndID = MonthEnd.MonthEndID) ON grvPosted.GRV_DayEndID = DayEnd.DayEndID Where (((MonthEnd.MonthEndID) = " + gMonth - cmbMonthEnd.SelectedIndex + ")) GROUP BY DayEnd.DayEndID, DayEnd.DayEnd_Date, ([MonthEnd_BudgetSales]/[MonthEnd_Days]), ([MonthEnd_BudgetPurchases]/[MonthEnd_Days]);");

            rsCompany = modRecordSet.getRS(ref "SELECT MonthEnd.* From MonthEnd WHERE (((MonthEnd.MonthEndID)=" + gMonth - cmbMonthEnd.SelectedIndex + "));");

            rs = modRecordSet.getRS(ref "SELECT * FROM Company");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            rs.Close();
            //ReportNone.Load("cryNoRecords.rpt")
            CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            ReportNone.Load("cryNoRecords.rpt");
            if (rsPurchase.BOF | rsPurchase.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }
            //Report.Database.SetDataSource(rs)
            Report.Database.Tables(1).SetDataSource(rsPurchase);
            Report.Database.Tables(2).SetDataSource(rsSales);
            Report.Database.Tables(3).SetDataSource(rsStock);
            Report.Database.Tables(4).SetDataSource(rsCompany);
            //UPGRADE_WARNING: Couldn't resolve default property of object Report.VerifyOnEveryPrint. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            //Report.VerifyOnEveryPrint = True
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();

            if (lConn == null) {
            } else {
                lConn.Close();
            }
        }
Ejemplo n.º 39
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);


        string par_ProgramID = string.Empty;
        string par_LoginUser = string.Empty;

        #region 前置檢查與參數過濾

        string par_S_PDate = this.SLP_SLPDateRange.StartDate;
        string par_E_PDate = this.SLP_SLPDateRange.EndDate;
        string par_BatchNo = this.txtBatchNo.Text;
        string par_ChanNo = this.SLP_StoreChain.Text + " " + this.SLP_StoreChain.Name;
        string par_ChanSourceNo = this.txtChanSourceNo.Text;
        string par_S_SignDate = this.SLP_SignDate.StartDate;
        string par_E_SignDate = this.SLP_SignDate.EndDate;
        string par_Item = this.SLP_SKU.Text + " " + this.SLP_SKU.Name;
        string par_Period = this.SLP_ItemPeriod.Text + " " + this.SLP_ItemPeriod.Name;
        string par_ItemMap = this.txtItemMap.Text;

        par_ProgramID = this.PageCode;
        par_LoginUser = Session["UID"].ToString();
        #endregion


        #region 組合查詢條件至ArrayList

        ArrayList returnList = new ArrayList();

        returnList.Clear();

        report.SetParameterValue("par_S_PDate", par_S_PDate);
        report.SetParameterValue("par_E_PDate", par_E_PDate);
        report.SetParameterValue("par_BatchNo", par_BatchNo);
        report.SetParameterValue("par_ChanNo", par_ChanNo);
        report.SetParameterValue("par_ChanSourceNo", par_ChanSourceNo);
        report.SetParameterValue("par_S_SignDate", par_S_SignDate);
        report.SetParameterValue("par_E_SignDate", par_E_SignDate);
        report.SetParameterValue("par_Item", par_Item);
        report.SetParameterValue("par_Period", par_Period);
        report.SetParameterValue("par_ItemMap", par_ItemMap);

        report.SetParameterValue("par_ProgramID", par_ProgramID);
        report.SetParameterValue("par_LoginUser", par_LoginUser);
        #endregion

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  

                Response.ContentType = "application/vnd.ms-excel";

                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":
                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }

    }
Ejemplo n.º 40
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
     //
     // report
     //
     this.report.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
     this.report.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;
     this.report.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Upper;
     this.report.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Default;
 }
Ejemplo n.º 41
0
        /// ////////////////////////////////////////////////////////////////////////
        /// EVENTS
        ///
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //--- Security check
            if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"]))
            {
                Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
            }

            //--- Validate query string
            if ((Request.QueryString["target_report"] == null) || (Request.QueryString["format"] == null))
            {
                Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in viewer.aspx");
            }

            //--- Initialize
            bool empty = false;
            LFSRecordForReportsGateway lfsRecordForReportsGateway = new LFSRecordForReportsGateway();

            //--- Get report data
            #region Get report data
            switch (Request.QueryString["target_report"])
            {
                //--- CXIRemovedReport
                case "CXIRemovedReport":
                    TDSCXIRemovedReport dataSet = lfsRecordForReportsGateway.GetCXIRemovedReportByCompanyId(Convert.ToInt32(Session["companyID"]));
                    if (dataSet.CXIRemovedReport.Rows.Count > 0)
                    {
                        report = new rCXIRemovedReport();
                        report.SetDataSource(dataSet);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- ReadyForLining
                case "ReadyForLining":
                    TDSReadyForLining tdsReadyForLining = lfsRecordForReportsGateway.GetReadyForLiningByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsReadyForLining.ReadyForLining.Rows.Count > 0)
                    {
                        report = new rReadyForLining();
                        report.SetDataSource(tdsReadyForLining);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- ToBePrepped
                case "ToBePrepped":
                    TDSToBePrepped tdsToBePrepped = lfsRecordForReportsGateway.GetToBePreppedByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsToBePrepped.ToBePrepped.Rows.Count > 0)
                    {
                        report = new rToBePrepped();
                        report.SetDataSource(tdsToBePrepped);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- ToBeMeasured
                case "ToBeMeasured":
                    TDSToBeMeasured tdsToBeMeasured = lfsRecordForReportsGateway.GetToBeMeasuredByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsToBeMeasured.ToBeMeasured.Rows.Count > 0)
                    {
                        report = new rToBeMeasured();
                        report.SetDataSource(tdsToBeMeasured);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- LiningCompleted
                case "LiningCompleted":
                    TDSLiningCompleted tdsLiningCompleted = lfsRecordForReportsGateway.GetLiningCompletedByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]), Convert.ToDateTime(Request.QueryString["start_date"]), Convert.ToDateTime(Request.QueryString["end_date"]));
                    if (tdsLiningCompleted.LiningCompleted.Rows.Count > 0)
                    {
                        report = new rLiningCompleted();
                        report.SetDataSource(tdsLiningCompleted);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OverviewReport
                case "OverviewReport":
                    TDSOverviewReport tdsOverviewReport = lfsRecordForReportsGateway.GetOverviewReportByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOverviewReport.OverviewReport.Rows.Count > 0)
                    {
                        report = new rOverviewReport();
                        report.SetDataSource(tdsOverviewReport);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- RehabAssessmentAreas
                case "RehabAssessmentAreas":
                    TDSRehabAssessmentAreas tdsRehabAssessmentAreas = lfsRecordForReportsGateway.GetRehabAssessmentAreasByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsRehabAssessmentAreas.RehabAssessmentAreas.Rows.Count > 0)
                    {
                        report = new rRehabAssessmentAreas();
                        report.SetDataSource(tdsRehabAssessmentAreas);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- AllOutstandingIssues
                case "AllOutstandingIssues":
                    TDSAllOutstandingIssues tdsAllOutstandingIssues = lfsRecordForReportsGateway.GetAllOutstandingIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsAllOutstandingIssues.AllOutstandingIssues.Rows.Count > 0)
                    {
                        report = new rAllOutstandingIssues();
                        report.SetDataSource(tdsAllOutstandingIssues);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OutstandingClientIssues
                case "OutstandingClientIssues":
                    TDSOutstandingClientIssues tdsOutstandingClientIssues = lfsRecordForReportsGateway.GetOutstandingClientIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOutstandingClientIssues.OutstandingClientIssues.Rows.Count > 0)
                    {
                        report = new rOutstandingClientIssues();
                        report.SetDataSource(tdsOutstandingClientIssues);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OutstandingLFSIssues
                case "OutstandingLFSIssues":
                    TDSOutstandingLFSIssues tdsOutstandingLFSIssues = lfsRecordForReportsGateway.GetOutstandingLFSIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOutstandingLFSIssues.OutstandingLFSIssues.Rows.Count > 0)
                    {
                        report = new rOutstandingLFSIssues();
                        report.SetDataSource(tdsOutstandingLFSIssues);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OutstandingInvestigationIssues
                case "OutstandingInvestigationIssues":
                    TDSOutstandingInvestigationIssues tdsOutstandingInvestigationIssues = lfsRecordForReportsGateway.GetOutstandingInvestigacionIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOutstandingInvestigationIssues.OutstandingInvestigationUssue.Rows.Count > 0)
                    {
                        report = new  rOutstandingInvestigationIssues();
                        report.SetDataSource(tdsOutstandingInvestigationIssues);
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OutstandingSalesIssues
                case "OutstandingSalesIssues":
                    TDSOutstandingSalesIssues tdsOutstandingSalesIssues = lfsRecordForReportsGateway.GetOutstandingSalesIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOutstandingSalesIssues.OutstandingSalesIssues.Rows.Count > 0)
                    {
                        report = new rOutstandingSalesIssues();
                        report.SetDataSource(tdsOutstandingSalesIssues);
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- ClientInvestigationIssuesCityCopy
                case "ClientInvestigationIssuesCityCopy":
                    TDSClientInvestigationIssuesCityCopy tdsClientInvestigationIssuesCityCopy = lfsRecordForReportsGateway.GetClientInvestigationIssuesCityCopyByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsClientInvestigationIssuesCityCopy.ClientInvestigationIssuesCityCopy.Rows.Count > 0)
                    {
                        report = new  rClientInvestigationIssuesCityCopy();
                        report.SetDataSource(tdsClientInvestigationIssuesCityCopy);
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- PointLinerReport
                case "PointLinerReport":
                    TDSPointLinerReport tdsPointLinerReport = lfsRecordForReportsGateway.GetPointLinerReportByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsPointLinerReport.PointLinerReport.Rows.Count > 0)
                    {
                        report = new rPointLinerReport();
                        report.SetDataSource(tdsPointLinerReport);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- PointLinerScopeSheet
                case "PointLinerScopeSheet":
                    TDSPointLinerScopeSheet tdsPointLinerScopeSheet = lfsRecordForReportsGateway.GetPointLinerScopeSheetByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsPointLinerScopeSheet.PointLinerScopeSheet.Rows.Count > 0)
                    {
                        report = new rPointLinerScopeSheet();
                        report.SetDataSource(tdsPointLinerScopeSheet);

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- OutstandingPointRepairs
                case "OutstandingPointRepairsReport":
                    TDSOutstandingPointRepairs tdsOutstandingPointRepairs = lfsRecordForReportsGateway.GetOutstandingPointRepairsCompanyIdCompaniesId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsOutstandingPointRepairs.OutstandingPointRepairs.Rows.Count > 0)
                    {
                        //--- Report creation and data binding
                        report = new rOutstandingPointRepairs();
                        report.SetDataSource(tdsOutstandingPointRepairs);
                        //--- Format control
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        //--- Report format
                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- M1ReportByClient
                case "M1ReportByClient":
                    TDSM1ReportByClient tdsM1ReportByClient;
                    if ((Request.QueryString["id"] != "0") && (Request.QueryString["companies"] == "0") && (Request.QueryString["date"] == "0"))
                    {
                        tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByID(Convert.ToInt32(Session["companyID"]), Request.QueryString["id"]);
                    }
                    else if ((Request.QueryString["id"] == "0") && (Convert.ToInt32(Request.QueryString["companies"]) != 0) && (Request.QueryString["date"] == "0"))
                    {
                        tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByCompanies(Convert.ToInt32(Session["companyID"]), Convert.ToInt32(Request.QueryString["companies"]));
                    }
                    else
                    {
                        tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByDate(Convert.ToInt32(Session["companyID"]), Request.QueryString["date"]);
                    }

                    if (tdsM1ReportByClient.M1ReportByClient.Rows.Count > 0)
                    {
                        report = new rM1ReportByClient();
                        report.SetDataSource(tdsM1ReportByClient);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- M2ReportByID
                case "M2ReportByID":
                    TDSM2ReportByID tdsM2ReportByID;
                    if ((Request.QueryString["id"] != "0") && (Request.QueryString["companies"] == "0") && (Request.QueryString["date"] == "0"))
                    {
                        tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdById(Convert.ToInt32(Session["companyID"]), Request.QueryString["id"]);
                    }
                    else if ((Request.QueryString["id"] == "0") && (Convert.ToInt32(Request.QueryString["companies"]) != 0) && (Request.QueryString["date"] == "0"))
                    {
                        tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdByCompanies(Convert.ToInt32(Session["companyID"]), Convert.ToInt32(Request.QueryString["companies"]));
                    }
                    else
                    {
                        tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdByDate(Convert.ToInt32(Session["companyID"]), Request.QueryString["date"]);
                    }

                    if (tdsM2ReportByID.LFS_MASTER_AREA.Rows.Count > 0)
                    {
                        report = new rM2ReportByID();
                        report.SetDataSource(tdsM2ReportByID);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- WorkAhead
                case "WorkAhead":
                    TDSWorkAhead tdsWorkAhead = lfsRecordForReportsGateway.GetWorkAheadByCompanyId(Convert.ToInt32(Session["companyID"]));
                    if (tdsWorkAhead.WorkAhead1.Rows.Count > 0)
                    {
                        report = new rWorkAhead();
                        report.SetDataSource(tdsWorkAhead);
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- JLinerOverviewReport
                case "JLinerOverviewReport":
                    TDSJLinerOverviewReport tdsJLinerOverviewReport = lfsRecordForReportsGateway.GetJLinerOverviewReportByCompanyIDCompaniesID(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsJLinerOverviewReport.JLinerOverviewReport.Rows.Count > 0)
                    {
                        //---Report creation and data binding
                        if (Convert.ToBoolean(Session["sgLFS_APP_ADMIN"]))
                        {
                            report = new rJLinerOverviewReport();
                        }
                        else
                        {
                            report = new rJLinerOverviewReportSimple();
                        }
                        report.SetDataSource(tdsJLinerOverviewReport);
                        //---Format control
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        //---Report format
                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- JLinersReadyToLine
                case "JLinersReadyToLine":
                    TDSJLinersReadyToLine tdsJLinersReadyToLine = lfsRecordForReportsGateway.GetJLinersReadyToLineByCompanyIDCompaniesID(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]));
                    if (tdsJLinersReadyToLine.JLinersReadyToLine.Rows.Count > 0)
                    {
                        //---Report creation and data binding
                        report = new rJLinersReadyToLine();
                        report.SetDataSource(tdsJLinersReadyToLine);
                        //---Format control
                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false;
                            ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true;
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }
                        //---Report format
                        report.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                        report.PrintOptions.PaperSize = PaperSize.PaperLegal;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;

                //--- JLinersToBuild
                case "JLinersToBuild":
                    TDSJLinersToBuild tdsJLinersToBuild = lfsRecordForReportsGateway.GetJLinersToBuildByCompanyId(Convert.ToInt32(Session["companyID"]));
                    if (tdsJLinersToBuild.JLinersToBuild.Rows.Count > 0)
                    {
                        report = new rJLinersToBuild();
                        report.SetDataSource(tdsJLinersToBuild);

                        if (Request.QueryString["format"] == "pdf")
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false;
                        }
                        else
                        {
                            ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true;
                        }

                        report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                        report.PrintOptions.PaperSize = PaperSize.PaperLetter;
                    }
                    else
                    {
                        empty = true;
                    }
                    break;
            }
            #endregion

            if (!empty)
            {
                //--- Configure report

                //--- ... Disk options
                string physicalApplicationPath = Request.PhysicalApplicationPath;
                if (Request.PhysicalApplicationPath.Substring(Request.PhysicalApplicationPath.Length-1, 1) != "\\")
                {
                    physicalApplicationPath += "\\";
                }

                string fName = "";
                switch (Request.QueryString["format"])
                {
                    case "pdf":
                        fName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".pdf";
                        Session["fName"] = fName;
                        break;

                    case "excel":
                        fName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".xls";
                        Session["fName"] = fName;
                        break;

                    case "word":
                        break;
                }

                DiskFileDestinationOptions diskOptions = new DiskFileDestinationOptions();
                diskOptions.DiskFileName = fName;

                //--- ... Export options
                report.ExportOptions.DestinationOptions = diskOptions;
                report.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

                switch (Request.QueryString["format"])
                {
                    case "pdf":
                        report.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                        break;

                    case "excel":
                        ExcelFormatOptions excelOptions = new ExcelFormatOptions();
                        excelOptions.ExcelUseConstantColumnWidth = false;
                        excelOptions.ExcelTabHasColumnHeadings = false;

                        report.ExportOptions.ExportFormatType = ExportFormatType.Excel;
                        report.ExportOptions.FormatOptions = excelOptions;
                        break;

                    case "word":
                        break;
                }

                //--- Export report
                try
                {
                    report.Export();
                }
                catch(Exception ex)
                {
                    Response.Redirect("./../error_page.aspx?error=" + ex.Message);
                }

                //--- Preview report
                Response.Redirect("viewer2.aspx?target_report=" + Request.QueryString["target_report"] + "&format=" + Request.QueryString["format"], true);
            }
            else
            {
                Response.Write("<br>         No records found for your report.");
            }
        }
Ejemplo n.º 42
0
    /// <summary>
    /// 顯示報表
    /// </summary>
    private void ShowReport(DataSet ds)
    {
        #region 利用CrystalReport列印報表

        //使用者名稱
        DataTable dt1 = new DataTable();
        dt1 = (DataTable)Session["UserInfo"];
        string Login_Name = dt1.Rows[0]["Name"].ToString();
        string strFileName = "";

        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        ReportDocument SubReport = new ReportDocument();

        report.Load(Server.MapPath("./REPORT/CAA271/CAA27R01.rpt"));
        strFileName = HttpUtility.UrlEncode("結帳與開立憑證檢核表.PDF", System.Text.Encoding.UTF8);

        SubReport = report.OpenSubreport("CAA27R01_1");
        SubReport.SetDataSource(ds);

        report.SetDataSource(ds);

        report.SetParameterValue("par_Program_ID", "CAA27R01");
        report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);

        System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        byte[] bytesPDF = new byte[streamPDF.Length];
        streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
        streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

        //export file  
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("content-disposition", "attachment;filename=" + strFileName);//pdf檔名  
        Response.ContentType = "application/pdf";
        Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
        Response.Flush();
        Response.Close();
        report.Close();
        #endregion
    }
Ejemplo n.º 43
0
    private void ShowReport(DataTable dt, string type)
    {
        try
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            report.Load(Server.MapPath("./REPORT/VAM121/VAM12" + type + "R.rpt"));
            report.SetDataSource(dt);

            DataTable dt1 = new DataTable();
            dt1 = (DataTable)Session["UserInfo"];
            string Login_Name = dt1.Rows[0]["Name"].ToString();

            //CrystalReport Parameter 參數設定
            string Program_ID = string.Empty;
            string LoginUser = string.Empty;

            string strParFDate = string.Empty;
            string strParFSType = string.Empty;
            string strParFTaxType = string.Empty;

            Program_ID = this.PageCode.Substring(0, 5) + "R0" + type;
            LoginUser = Session["UID"].ToString();

            //report.SetParameterValue("par_Program_ID", Program_ID);
            //report.SetParameterValue("par_LoginUser", LoginUser);
            //report.SetParameterValue("par_LoginName", Login_Name);

            System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            byte[] bytesPDF = new byte[streamPDF.Length];
            streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
            streamPDF.Seek(0, System.IO.SeekOrigin.Begin);
            //Export File  
            Response.ClearContent();
            Response.ClearHeaders();
            string rpt_name = string.Empty;
            rpt_name = "進項憑證明細表_折讓單套表.PDF";
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(rpt_name, System.Text.Encoding.UTF8));//匯出檔名  
            Response.ContentType = "application/pdf";
            Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);

            Response.Flush();
            Response.Close();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Ejemplo n.º 44
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        string s_par_Reqno = string.Empty;
        string s_par_Rolecode = string.Empty;
        string s_par_UserID = string.Empty;
        string s_par_UseName = string.Empty;
        string s_par_Signdate = string.Empty;
        string s_par_ReqLevel = string.Empty;
        string s_par_ReqType = string.Empty;
        string s_par_ReqStatus = string.Empty;
        string s_par_SysDesc = string.Empty;
        string s_par_WantDate = string.Empty;
        string s_par_ReqGist = string.Empty;
        string s_par_ReqDesc = string.Empty;

        s_par_Reqno = dt_Source.Rows[0]["REQ_NO"].ToString();
        s_par_Rolecode = dt_Source.Rows[0]["ROLECODE"].ToString();
        s_par_UseName = dt_Source.Rows[0]["USER_NAME"].ToString();
        if (dt_Source.Rows[0]["SIGN_DATE"].ToString() != "")
        {
            s_par_Signdate = DateTime.Parse(dt_Source.Rows[0]["SIGN_DATE"].ToString()).ToString("yyyy/MM/dd");
        }
        s_par_ReqLevel = dt_Source.Rows[0]["REQ_LEVEL"].ToString();
        s_par_ReqType = dt_Source.Rows[0]["REQ_TYPE"].ToString();
        s_par_ReqStatus = dt_Source.Rows[0]["REQ_STATUS"].ToString();
        s_par_SysDesc = dt_Source.Rows[0]["SYSDESC"].ToString();
        if (dt_Source.Rows[0]["WANT_DATE"].ToString() != "")
        {
            s_par_WantDate = DateTime.Parse(dt_Source.Rows[0]["WANT_DATE"].ToString()).ToString("yyyy/MM/dd");
        }
        s_par_ReqGist = dt_Source.Rows[0]["REQ_GIST"].ToString();
        s_par_ReqDesc = dt_Source.Rows[0]["REQ_DESC"].ToString();

        report.SetParameterValue("par_Reqno", s_par_Reqno);
        report.SetParameterValue("par_Rolecode", s_par_Rolecode);
        report.SetParameterValue("par_UseName", s_par_UseName);
        report.SetParameterValue("par_Signdate", s_par_Signdate);
        report.SetParameterValue("par_ReqLevel", s_par_ReqLevel);
        report.SetParameterValue("par_ReqType", s_par_ReqType);
        report.SetParameterValue("par_ReqStatus", s_par_ReqStatus);
        report.SetParameterValue("par_SysDesc", s_par_SysDesc);
        report.SetParameterValue("par_WantDate", s_par_WantDate);
        report.SetParameterValue("par_ReqGist", s_par_ReqGist);
        report.SetParameterValue("par_ReqDesc", s_par_ReqDesc);

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":
                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  

                Response.ContentType = "application/vnd.ms-excel";

                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":
                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();

                break;
            default:
                break;
        }
    }
Ejemplo n.º 45
0
    private void ShowReport(DataTable dt,string V_FORM_TYPE,DateTime D_START_DATE,DateTime D_END_DATE,String V_ADJ_IN_DESC,String V_ADJ_OUT_DESC)
    {
        #region 利用CrystalReport列印報表

        //使用者名稱
        DataTable dt1 = new DataTable();
        dt1 = (DataTable)Session["UserInfo"];
        string Login_Name = dt1.Rows[0]["Name"].ToString();

        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(Server.MapPath("./REPORT/PSS031/PSS031R01.rpt"));
        report.SetDataSource(dt);
        report.SetParameterValue("par_Program_ID", "PSS031R");
        report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);
        report.SetParameterValue("par_YEAR_MONTH", this.SLP_YearMonth1.Text.Trim());

        if (rblRptType.Items[0].Selected)
            report.SetParameterValue("par_TYPE", "差異");
        else
            report.SetParameterValue("par_TYPE", "全部");

        if (this.SLP_SKU_B.Text.Trim() == "" && this.SLP_SKU_E.Text.Trim() == "")
        {
            report.SetParameterValue("par_ITEM", "全部");
        }
        else
        {
            report.SetParameterValue("par_ITEM", this.SLP_SKU_B.Text.Trim() + "~" + this.SLP_SKU_E.Text.Trim());
        }

        if (this.SLP_ItemPeriod_B.Text.Trim() == "" && this.SLP_ItemPeriod_E.Text.Trim() == "")
        {
            report.SetParameterValue("par_PERIOD", "全部");
        }
        else
        {
            report.SetParameterValue("par_PERIOD", this.SLP_ItemPeriod_B.Text.Trim() + "~" + this.SLP_ItemPeriod_E.Text.Trim());
        }

        if (this.slp_TAX_TYPE.Text.Trim() == "" )
        {
            report.SetParameterValue("par_TAX_TYPE", "全部");
        }
        else if (this.slp_TAX_TYPE.Text.Trim() == "0")
        {
            report.SetParameterValue("par_TAX_TYPE", "應稅");
        }
        else if (this.slp_TAX_TYPE.Text.Trim() == "1")
        {
            report.SetParameterValue("par_TAX_TYPE", "免稅");
        }
        else if (this.slp_TAX_TYPE.Text.Trim() == "2")
        {
            report.SetParameterValue("par_TAX_TYPE", "零稅");
        }

        report.SetParameterValue("par_START_DATE", D_START_DATE);

        report.SetParameterValue("par_END_DATE", D_END_DATE);

        report.SetParameterValue("par_ADJ_IN_DESC", V_ADJ_IN_DESC);

        report.SetParameterValue("par_ADJ_OUT_DESC", V_ADJ_OUT_DESC);
        
       
        
        //檔案匯出
        if (V_FORM_TYPE == "XLS")
        {
            System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
            byte[] bytesXLS = new byte[streamXLS.Length];
            streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
            streamXLS.Seek(0, System.IO.SeekOrigin.Begin);
            //Export File  
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("進銷存差異明細表.XLS", System.Text.Encoding.UTF8));//匯出檔名  
            Response.ContentType = "application/xls";
            Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
            Response.Flush();
            Response.Close();
        }
        else
        {
            System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            byte[] bytesPDF = new byte[streamPDF.Length];
            streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
            streamPDF.Seek(0, System.IO.SeekOrigin.Begin);
            //Export File  
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("進銷存差異明細表.PDF", System.Text.Encoding.UTF8));//匯出檔名  
            Response.ContentType = "application/pdf";
            Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
            Response.Flush();
            Response.Close();
        }
        report.Close();
        #endregion
    }
Ejemplo n.º 46
0
    // show報表
    private void ShowReport(DataTable Dt)
    {
        try
        {
            string strFileName = "";
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            report.Load(Server.MapPath("./REPORT/PUR09/CRPUR09R01.rpt"));
            strFileName = HttpUtility.UrlEncode("每日出貨品項維護.PDF", System.Text.Encoding.UTF8);

            report.SetDataSource(Dt);

            string Login_Name = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();
            report.SetParameterValue("par_Program_ID", "PUR09");
            report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);
            report.SetParameterValue("par_StAcceptDate", this.txtPLAN_ACCEPT_DATE.Text);
            report.SetParameterValue("par_PickBatch", this.txtPICK_BATCH.Text);

            System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            byte[] bytesPDF = new byte[streamPDF.Length];
            streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
            streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

            //export file  
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + strFileName);//pdf檔名  
            Response.ContentType = "application/pdf";
            Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
            Response.Flush();
            Response.Close();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Ejemplo n.º 47
0
        private void loadValue()
        {
            ADODB.Recordset rs = default(ADODB.Recordset);
            ADODB.Recordset rsData = default(ADODB.Recordset);
            //Dim Report As New cryItemItemCompareValue
            //ReportNone.Load("cryNoRecords.rpt")
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            Report.Load("cryItemItemCompareValue.rpt");
            ReportNone.Load("cryNoRecords.rpt");
            modReport.cnnDBreport.Execute("DELETE LinkItem.* FROM LinkItem;");
            rs = modReport.getRSreport(ref "SELECT * FROM Link Where Link_SectionID=3");
            while (!(rs.EOF)) {
                if (!string.IsNullOrEmpty(rs.Fields("Link_SQL").Value)) {
                    modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT " + rs.Fields("LinkID").Value + ", Sale.Sale_DayEndID, Sum([SaleItem_Quantity]*[SaleItem_Price]) FROM (SaleItem INNER JOIN aStockItem ON SaleItem.SaleItem_StockItemID = aStockItem.StockItemID) INNER JOIN Sale ON SaleItem.SaleItem_SaleID = Sale.SaleID Where " + rs.Fields("Link_SQL").Value + " GROUP BY Sale.Sale_DayEndID;");
                }
                rs.moveNext();
            }

            modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT theJoin.LinkID, theJoin.DayEndID, 0 FROM LinkItem RIGHT JOIN [SELECT Link.LinkID, DayEnd.DayEndID From Link, DayEnd WHERE (((Link.Link_SQL)<>'') AND ((Link.Link_SectionID)=3))]. AS theJoin ON (LinkItem.LinkItem_DayEndID = theJoin.DayEndID) AND (LinkItem.LinkItem_LinkID = theJoin.LinkID) WHERE (((LinkItem.LinkItem_LinkID) Is Null));");
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rs = modReport.getRSreport(ref "SELECT Report.Report_Heading, aCompany.Company_Name FROM aCompany, Report;");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            Report.SetParameterValue("txtDayEnd", rs.Fields("Report_Heading"));
            rs.Close();
            rs = modReport.getRSreport(ref "SELECT [Link].[LinkID], [Link].[Link_Name], Sum([LinkItem].[LinkItem_Value]) AS SumOfLinkItem_Value FROM Link INNER JOIN LinkItem ON [Link].[LinkID]=[LinkItem].[LinkItem_LinkID] WHERE ((([Link].[Link_SQL])<>'') And (([Link].[Link_SectionID])=3)) GROUP BY [Link].[LinkID], [Link].[Link_Name] ORDER BY [Link].[LinkID];");

            if (rs.BOF | rs.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }
            rsData = modReport.getRSreport(ref "SELECT LinkItem.*, Format([DayEnd_Date],'yyyy mm dd ddd') AS dateName, DayEnd.DayEnd_Date FROM DayEnd INNER JOIN LinkItem ON DayEnd.DayEndID = LinkItem.LinkItem_DayEndID ORDER BY DayEnd.DayEnd_Date;");
            if (rsData.BOF | rsData.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }

            Report.Database.Tables(1).SetDataSource(rs);
            Report.Database.Tables(2).SetDataSource(rsData);
            System.Windows.Forms.Application.DoEvents();
            //Report.VerifyOnEveryPrint = True
            System.Windows.Forms.Application.DoEvents();
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }
Ejemplo n.º 48
0
        private void GenerarCodigoBarras(string code)
        {
            if (code != null)
            {
                string codigo = code + CodigoBarrasCalculoDelDigitoVerificador(code);
                Code39 c39 = new Code39();
                MemoryStream ms = new MemoryStream();
                c39.FontFamilyName = "Free 3 of 9";
                c39.FontFileName = "Facturacion\\Electronica\\Reportes\\FREE3OF9.TTF";
                c39.FontSize = 30;
                c39.ShowCodeString = true;
                System.Drawing.Bitmap objBitmap = c39.GenerateBarcode(codigo);
                objBitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

                codigobarrasRpt = facturaRpt.OpenSubreport("CodigoBarra.rpt");

                CrearTabla();

                DataRow dr = this.dsImages.Tables["images"].NewRow();
                dr["path"] = "ninguno";
                dr["image"] = ms.ToArray();
                this.dsImages.Tables["images"].Rows.Add(dr);

                codigobarrasRpt.SetDataSource(this.dsImages);
                ms.Close();
                ms = null;
            }
        }
Ejemplo n.º 49
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        string par_ProgramID = string.Empty;
        string par_LoginUser = string.Empty;

        #region 前置檢查與參數過濾

        string par_S_Vendor = this.SLP_VendorBaseS.Text + " " + this.SLP_VendorBaseS.Name;
        string par_E_Vendor = this.SLP_VendorBaseE.Text + " " + this.SLP_VendorBaseE.Name;
        string par_S_PMA = this.SLP_PMAS.Text + " " + this.SLP_PMAS.Name;
        string par_E_PMA = this.SLP_PMAE.Text + " " + this.SLP_PMAE.Name;
        string par_S_RootNo = this.SLP_RootNoS.Text + " " + this.SLP_RootNoS.Name;
        string par_E_RootNo = this.SLP_RootNoE.Text + " " + this.SLP_RootNoE.Name;

        string par_S_LocateNo = this.SLP_SimpleLocateSec1.Text1 + " " + this.SLP_SimpleLocateSec1.Name;
        string par_E_LocateNo = this.SLP_SimpleLocateSec2.Text1 + " " + this.SLP_SimpleLocateSec2.Name;
        string par_S_LocateSec = SLP_SimpleLocateSec1.Text2.Trim() != "" ? this.SLP_SimpleLocateSec1.Text1 + SLP_SimpleLocateSec1.Text2 : "";
        string par_E_LocateSec = SLP_SimpleLocateSec2.Text2.Trim() != "" ? this.SLP_SimpleLocateSec2.Text1 + SLP_SimpleLocateSec2.Text2 : "";

        string par_Item = this.SLP_SKU.Text + " " + this.SLP_SKU.Name;
        string par_Period = this.SLP_ItemPeriod.Text + " " + this.SLP_ItemPeriod.Name;

        par_ProgramID = this.PageCode;
        par_LoginUser = Session["UID"].ToString();
        #endregion

        #region 組合查詢條件至ArrayList

        ArrayList returnList = new ArrayList();

        returnList.Clear();

        report.SetParameterValue("par_S_Vendor", par_S_Vendor);
        report.SetParameterValue("par_E_Vendor", par_E_Vendor);
        report.SetParameterValue("par_S_PMA", par_S_PMA);
        report.SetParameterValue("par_E_PMA", par_E_PMA);
        report.SetParameterValue("par_S_RootNo", par_S_RootNo);
        report.SetParameterValue("par_E_RootNo", par_E_RootNo);

        report.SetParameterValue("par_S_LocateNo", par_S_LocateNo);
        report.SetParameterValue("par_E_LocateNo", par_E_LocateNo);
        report.SetParameterValue("par_S_LocateSec", par_S_LocateSec);
        report.SetParameterValue("par_E_LocateSec", par_E_LocateSec);

        report.SetParameterValue("par_Item", par_Item);
        report.SetParameterValue("par_Period", par_Period);

        report.SetParameterValue("par_ProgramID", par_ProgramID);
        report.SetParameterValue("par_LoginUser", par_LoginUser);
        #endregion

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  

                Response.ContentType = "application/vnd.ms-excel";

                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }

    }
Ejemplo n.º 50
0
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);



        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  


                Response.ContentType = "application/vnd.ms-excel";


                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                string s_par_Program_ID = string.Empty;
                string s_par_LoginUser = string.Empty;

                s_par_Program_ID = this.PageCode;
                s_par_LoginUser = Session["UID"].ToString();


                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }

    }
Ejemplo n.º 51
0
    //Crystal Report 直接輸出 PDF 檔
    private void ExportReport(DataTable dt)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(Server.MapPath("./REPORT/CGR021R01.rpt"));
        report.SetDataSource(dt);

        //CrystalReport Parameter 參數設定
        string Program_ID = string.Empty;
        string LoginUser = string.Empty;

        Program_ID = this.PageCode.Substring(0, 5) + "R01";
        LoginUser = Session["UID"].ToString();

        report.SetParameterValue("par_Program_ID", this.PageCode);
        report.SetParameterValue("par_LoginUser", LoginUser);

        //檔案匯出
        System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        byte[] bytesPDF = new byte[streamPDF.Length];
        streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
        streamPDF.Seek(0, System.IO.SeekOrigin.Begin);
        //Export File  
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("退貨結轉檢核異常報表.PDF", System.Text.Encoding.UTF8));//匯出檔名  
        Response.ContentType = "application/pdf";
        Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
        Response.Flush();
        Response.Close();

        report.Close();
    }
Ejemplo n.º 52
0
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  


                Response.ContentType = "application/vnd.ms-excel;charset='utf-8'";


                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                //string s_par_Program_ID = this.PageCode;
                string Login_Name = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();

                string s_par_Program_ID = "MKT10";
                string s_par_LoginUser = Session["UID"].ToString() + Login_Name;
                string s_par_Busdate = SLP_MDC_START_DATE.StartDate + " ~ " + SLP_MDC_START_DATE.EndDate;
                string s_par_Z_O = SLP_Z_O_S.Text + "   " + SLP_Z_O_S.Name + " ~ " + SLP_Z_O_E.Text + "   " + SLP_Z_O_E.Name;
                string s_par_Chan_No = SLP_CHAIN_S.Text + "   " + SLP_CHAIN_S.Name + " ~ " + SLP_CHAIN_E.Text + "   " + SLP_CHAIN_E.Name;

                report.SetParameterValue("par_Program_ID", s_par_Program_ID);
                report.SetParameterValue("par_LoginUser", s_par_LoginUser);
                report.SetParameterValue("par_Busdate", s_par_Busdate);
                report.SetParameterValue("par_Z_O", s_par_Z_O);
                report.SetParameterValue("par_Chan_No", s_par_Chan_No);

                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }
    }
Ejemplo n.º 53
0
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);

        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":
                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/vnd.ms-excel;charset='utf-8'";
                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":
                //string s_par_Program_ID = this.PageCode;
                string Login_Name = ((DataTable)Session["UserInfo"]).Rows[0]["Name"].ToString();
                string s_par_Program_ID = "MKT11";
                string s_par_LoginUser = Session["UID"].ToString() + " "  + Login_Name;
                string s_par_Vendor = SLP_Vendor.Text + " " + SLP_Vendor.Name;
                string s_par_RootNo = SLP_RootNo_S.Text + " " + SLP_RootNo_S.Name +" ~ " + SLP_RootNo_E.Text + " " + SLP_RootNo_E.Name;
                string s_par_PMA = SLP_PMA_S.Text + " " + SLP_PMA_S.Name + " ~ " + SLP_PMA_E.Text + " " + SLP_PMA_E.Name;
                string s_par_Category = SLP_Category_S.Text + " " + SLP_Category_S.Name + " ~ " + SLP_Category_E.Text + " " + SLP_Category_E.Name;
                string s_par_SortOut = SLP_SortOut_S.Text + " " + SLP_SortOut_S.Name + " ~ " + SLP_SortOut_E.Text + " " + SLP_SortOut_E.Name;
                string s_par_Item = SLP_SKU.Text + " " + SLP_SKU.Name;
                string s_par_Period = SLP_ItemPeriod.Text;
                string s_par_PeriodCount = SLP_SLPNumber.Text;
                string s_par_Order ="";

                if ( ddl_Order.SelectedValue=="1"){
                    s_par_Order = "期別降冪";
                }
                else if ( ddl_Order.SelectedValue=="2"){
                    s_par_Order = "期別升冪";
                }
               
                report.SetParameterValue("par_Program_ID", s_par_Program_ID);
                report.SetParameterValue("par_LoginUser", s_par_LoginUser);
                report.SetParameterValue("par_Vendor", s_par_Vendor);
                report.SetParameterValue("par_RootNo", s_par_RootNo);
                report.SetParameterValue("par_PMA", s_par_PMA);
                report.SetParameterValue("par_Category", s_par_Category);
                report.SetParameterValue("par_SortOut", s_par_SortOut);
                report.SetParameterValue("par_Item", s_par_Item);
                report.SetParameterValue("par_Period", s_par_Period);
                report.SetParameterValue("par_PeriodCount", s_par_PeriodCount);
                report.SetParameterValue("par_Order", s_par_Order);

                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:
                break;
        }
    }
Ejemplo n.º 54
0
        public void addTrinhKy_OnFormLoad()
        {
            //Ham nay XuanDT them vao
            try
            {
                //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop
                mv_oRptDoc = RptDoc;
                mv_oViewDoc = this.crptViewer;
                //ket thuc doan gan bien

                mv_oRptFieldObj = GetTrinhky(RptDoc.ParameterFields);
              //  if (mv_oRptFieldObj == null) return;
                mv_oNguoiKy = new cls_SignInfor(string.IsNullOrEmpty(crptTrinhKyName) ? mv_oRptDoc.ToString() : crptTrinhKyName, "");
                //chkPrint_CheckedChanged(chkPrint, New System.EventArgs)
                if (mv_oNguoiKy._TonTai)
                {
                    SetParamAgain(RptDoc.ParameterFields);
                    //if (mv_bSetContent)
                    //{

                    //    mv_oRptDoc.ReportDefinition.ReportObjects["txtTrinhky"]..Text = mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.gv_strTenNhanvien);

                    //}
                    //else
                    //{
                    //    mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = "";
                    //}

                }
                else
                {
                    SetParamAgain(RptDoc.ParameterFields);
                    if (string.IsNullOrEmpty(crptTrinhKyName))
                        mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), "");
                    else
                    {
                        mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", crptTrinhKyName, "");
                    }

                }
                mv_oViewDoc.ReportSource = RptDoc;
            }
            catch (Exception ex)
            {
                mv_oRptText = null;
                //an nut tuy chon di
                log.Error("Loi trong qua trinh load thong tin trih ky={0}", ex);
                this.cmdTrinhKy.Visible = false;
            }
        }
Ejemplo n.º 55
0
    private void ShowReportA(DataTable dtA, DataTable dtB, string V_FORM_TYPE, string V_RPT)
    {
        #region 利用CrystalReport列印報表

        //匯出檔案名稱
        string FileName = "";

        //使用者名稱
        DataTable dt1 = new DataTable();
        dt1 = (DataTable)Session["UserInfo"];
        string Login_Name = dt1.Rows[0]["Name"].ToString();

        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        report.Load(Server.MapPath("./REPORT/VAM121/" + V_RPT + "01.rpt"));

        DataSet ds = new DataSet();
        dtA.TableName = "VAM122_R1";
        ds.Tables.Add(dtA.Copy());
        dtB.TableName = "VAM122_R2";
        ds.Tables.Add(dtB.Copy());

        report.SetDataSource(ds);
        if (V_RPT == "VAM121R")
        {
            FileName = "進項憑證明細表(發票)";
            report.SetParameterValue("par_Program_ID", V_RPT);


            report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);

            if (this.SLP_SLPDateRange.StartDate.ToString() == "" && this.SLP_SLPDateRange.EndDate.ToString() == "")
                report.SetParameterValue("par_Source_date", "全部");
            else
                report.SetParameterValue("par_Source_date", this.SLP_SLPDateRange.StartDate.ToString() + "-" + this.SLP_SLPDateRange.EndDate.ToString());

            if (this.SLP_SLPDateRange1.StartDate.ToString() == "" && this.SLP_SLPDateRange1.EndDate.ToString() == "")
                report.SetParameterValue("par_Keyin_date", "全部");
            else
                report.SetParameterValue("par_Keyin_date", this.SLP_SLPDateRange1.StartDate.ToString() + "-" + this.SLP_SLPDateRange1.EndDate.ToString());


            if (this.SLP_VendorBase1.Text.Trim() == "" && this.SLP_VendorBase2.Text.Trim() == "")
            {
                report.SetParameterValue("par_Vandor", "全部");

            }
            else
            {
                report.SetParameterValue("par_Vandor", this.SLP_VendorBase1.Text.Trim() + "-" + this.SLP_VendorBase2.Text.Trim());

            }

            if (((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text == "ALL")
                report.SetParameterValue("par_Tax_Type", "全部");
            else
                report.SetParameterValue("par_Tax_Type", ((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text);

        }
        else if (V_RPT == "VAM122R")
        {

            FileName = "進項憑證明細表(折讓)";
            report.SetParameterValue("par_Program_ID_B", V_RPT);

            report.SetParameterValue("par_LoginUser_B", Session["UID"].ToString() + Login_Name);

            if (this.SLP_SLPDateRange.StartDate.ToString() == "" && this.SLP_SLPDateRange.EndDate.ToString() == "")
                report.SetParameterValue("par_Source_date_B", "全部");
            else
                report.SetParameterValue("par_Source_date_B", this.SLP_SLPDateRange.StartDate.ToString() + "-" + this.SLP_SLPDateRange.EndDate.ToString());

            if (this.SLP_SLPDateRange1.StartDate.ToString() == "" && this.SLP_SLPDateRange1.EndDate.ToString() == "")
                report.SetParameterValue("par_Keyin_date_B", "全部");
            else
                report.SetParameterValue("par_Keyin_date_B", this.SLP_SLPDateRange1.StartDate.ToString() + "-" + this.SLP_SLPDateRange1.EndDate.ToString());


            if (this.SLP_VendorBase1.Text.Trim() == "" && this.SLP_VendorBase2.Text.Trim() == "")
            {

                report.SetParameterValue("par_Vandor_B", "全部");
            }
            else
            {

                report.SetParameterValue("par_Vandor_B", this.SLP_VendorBase1.Text.Trim() + "-" + this.SLP_VendorBase2.Text.Trim());
            }

            if (((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text == "ALL")
                report.SetParameterValue("par_Tax_Type_B", "全部");
            else
                report.SetParameterValue("par_Tax_Type_B", ((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text);
            //report.SetParameterValue("par_Tax_Type_B", ((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text);
        }
        else if (V_RPT == "VAM123R")
        {
            FileName = "進項憑證明細表(發票與折讓)";
            report.SetParameterValue("par_Program_ID", V_RPT);
            report.SetParameterValue("par_Program_ID_B", V_RPT);

            report.SetParameterValue("par_LoginUser", Session["UID"].ToString() + Login_Name);
            report.SetParameterValue("par_LoginUser_B", Session["UID"].ToString() + Login_Name);

            if (this.SLP_SLPDateRange.StartDate.ToString() == "" && this.SLP_SLPDateRange.EndDate.ToString() == "")
            {
                report.SetParameterValue("par_Source_date", "全部");
                report.SetParameterValue("par_Source_date_B", "全部");
            }
            else
            {
                report.SetParameterValue("par_Source_date", this.SLP_SLPDateRange.StartDate.ToString() + "-" + this.SLP_SLPDateRange.EndDate.ToString());
                report.SetParameterValue("par_Source_date_B", this.SLP_SLPDateRange.StartDate.ToString() + "-" + this.SLP_SLPDateRange.EndDate.ToString());
            }

            if (this.SLP_SLPDateRange1.StartDate.ToString() == "" && this.SLP_SLPDateRange1.EndDate.ToString() == "")
            {
                report.SetParameterValue("par_Keyin_date", "全部");
                report.SetParameterValue("par_Keyin_date_B", "全部");
            }
            else
            {
                report.SetParameterValue("par_Keyin_date", this.SLP_SLPDateRange1.StartDate.ToString() + "-" + this.SLP_SLPDateRange1.EndDate.ToString());
                report.SetParameterValue("par_Keyin_date_B", this.SLP_SLPDateRange1.StartDate.ToString() + "-" + this.SLP_SLPDateRange1.EndDate.ToString());
            }


            if (this.SLP_VendorBase1.Text.Trim() == "" && this.SLP_VendorBase2.Text.Trim() == "")
            {
                report.SetParameterValue("par_Vandor", "全部");
                report.SetParameterValue("par_Vandor_B", "全部");
            }
            else
            {
                report.SetParameterValue("par_Vandor", this.SLP_VendorBase1.Text.Trim() + "-" + this.SLP_VendorBase2.Text.Trim());
                report.SetParameterValue("par_Vandor_B", this.SLP_VendorBase1.Text.Trim() + "-" + this.SLP_VendorBase2.Text.Trim());
            }

            if (((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text == "ALL")
            {
                report.SetParameterValue("par_Tax_Type", "全部");
                report.SetParameterValue("par_Tax_Type_B", "全部");
            }
            else
            {
                report.SetParameterValue("par_Tax_Type", ((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text);
                report.SetParameterValue("par_Tax_Type_B", ((DropDownList)this.SLP_EnumBase.FindControl("D1")).SelectedItem.Text);
            }

        }




        //檔案匯出
        if (V_FORM_TYPE == "XLS")
        {
            System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
            byte[] bytesXLS = new byte[streamXLS.Length];
            streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
            streamXLS.Seek(0, System.IO.SeekOrigin.Begin);
            //Export File  
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName + ".XLS", System.Text.Encoding.UTF8));//匯出檔名  
            Response.ContentType = "application/xls";
            Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
            Response.Flush();
            Response.Close();
        }
        else
        {
            System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            byte[] bytesPDF = new byte[streamPDF.Length];
            streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
            streamPDF.Seek(0, System.IO.SeekOrigin.Begin);
            //Export File  
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName + ".PDF", System.Text.Encoding.UTF8));//匯出檔名  
            Response.ContentType = "application/pdf";
            Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
            Response.Flush();
            Response.Close();
        }
        report.Close();
        #endregion
    }
Ejemplo n.º 56
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);


        string par_ChanNo = string.Empty;
        string par_Store = string.Empty;

        #region 前置檢查與參數過濾

        par_ChanNo = Server.UrlDecode(Request.QueryString["Chan"].ToString());
        par_Store = Server.UrlDecode(Request.QueryString["Store"].ToString());
        #endregion


        #region 組合查詢條件至ArrayList

        ArrayList returnList = new ArrayList();

        returnList.Clear();

        report.SetParameterValue("ChanNo", par_ChanNo);
        report.SetParameterValue("Store", par_Store);

        #endregion


        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  


                Response.ContentType = "application/vnd.ms-excel";


                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();
                report.Close();
                break;
            case "PDF":


                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                report.Close();

                break;
            default:

                break;
        }

    }
Ejemplo n.º 57
0
    /// <summary>
    /// 利用 CrystalReport 列印 Excel 報表
    /// </summary>
    /// <param name="s_FileName">Excel報表的檔名</param>
    /// <param name="s_rptFilePath">rpt檔的路徑</param>
    /// <param name="dt_Source">要列印的資料</param>
    /// /// <param name="reportFormatType">檔案型態</param>
    private void LoadCrystalReport(string s_FileName, string s_rptFilePath, DataTable dt_Source, string reportFormatType)
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        report.Load(s_rptFilePath);
        report.SetDataSource(dt_Source);




        //判斷輸出檔案型態
        switch (reportFormatType)
        {
            case "EXCEL":

                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  


                Response.ContentType = "application/vnd.ms-excel";


                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
                Response.Flush();
                Response.Close();

                break;
            case "PDF":

                string s_par_Program_ID = string.Empty;
                string s_par_LoginUser = string.Empty;
                string s_par_Trans = string.Empty;
                string s_par_TruckNo = string.Empty;


                s_par_Program_ID = this.PageCode;
                s_par_LoginUser = Session["UID"].ToString();


                s_par_Trans = this.SLP_TRANS_NO_S.Text + " " + ((DropDownList)SLP_TRANS_NO_S.FindControl("D1")).SelectedItem.Text + " ~ " +
                              this.SLP_TRANS_NO_E.Text + " " + ((DropDownList)SLP_TRANS_NO_E.FindControl("D1")).SelectedItem.Text;

                s_par_TruckNo = this.TRUCK_NO_S.Text + " ~ " + this.TRUCK_NO_E.Text;

                report.SetParameterValue("par_Program_ID", s_par_Program_ID);
                report.SetParameterValue("par_LoginUser", s_par_LoginUser);
                report.SetParameterValue("par_Trans", s_par_Trans);
                report.SetParameterValue("par_TruckNo", s_par_TruckNo);

 
                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);

                //export file  
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("content-disposition", "attachment;filename=" + s_FileName);//excel檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
                Response.Flush();
                Response.Close();
                break;
            default:

                break;
        }
        report.Close();
    }
Ejemplo n.º 58
0
        private void ProcesarComprobante(out CrystalDecisions.CrystalReports.Engine.ReportDocument ReporteDocumento, eFact_Entidades.Lote Lote, int Renglon)
        {
            try
            {
                //Cursor = System.Windows.Forms.Cursors.WaitCursor;
                facturaRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                //facturaRpt.Load("Facturacion\\Electronica\\Reportes\\Factura.rpt");

                ////Crear un lote de un solo comprobante, para la impresion o exportacion del pdf.
                //eFact_Entidades.Lote LoteConUnSoloComprobante = new eFact_Entidades.Lote();
                //LoteConUnSoloComprobante.CuitVendedor = Lote.CuitVendedor;
                //LoteConUnSoloComprobante.FechaAlta = Lote.FechaAlta;
                //LoteConUnSoloComprobante.FechaEnvio = Lote.FechaEnvio;
                //LoteConUnSoloComprobante.IdLote = Lote.IdLote;
                //LoteConUnSoloComprobante.IdOp = Lote.IdOp;
                //LoteConUnSoloComprobante.LoteXml = Lote.LoteXml;
                //LoteConUnSoloComprobante.LoteXmlIF = Lote.LoteXmlIF;
                //LoteConUnSoloComprobante.NumeroEnvio = Lote.NumeroEnvio;
                //LoteConUnSoloComprobante.NumeroLote = Lote.NumeroLote;
                //LoteConUnSoloComprobante.PuntoVenta = Lote.PuntoVenta;
                //LoteConUnSoloComprobante.CantidadRegistros = 1;
                //LoteConUnSoloComprobante.Comprobantes.Add(Lote.Comprobantes[Renglon]);
                //LoteConUnSoloComprobante.WF = Lote.WF;
                //FeaEntidades.InterFacturas.lote_comprobantes lc = new FeaEntidades.InterFacturas.lote_comprobantes();
                //eFact_RN.Lote.DeserializarLc(out lc, LoteConUnSoloComprobante, true);
                ////Entidad para reporte crystal. Al desserializar se pierden los descuentos de la entidad original.
                //FeaEntidades.Reporte.lote_comprobantes lcReporte = new FeaEntidades.Reporte.lote_comprobantes();
                //eFact_RN.Lote.DeserializarLc(out lcReporte, LoteConUnSoloComprobante);
                //for (int i = 0; i < lc.comprobante.Length; i++)
                //{
                //    if (i == 0)
                //    {
                //        lc.comprobante[i] = lc.comprobante[Renglon];
                //        lcReporte.comprobante[i] = lcReporte.comprobante[Renglon];
                //        for (int l = 0; l < lc.comprobante[i].detalle.linea.Length; l++)
                //        {
                //            if (lc.comprobante[i].detalle.linea[l].lineaDescuentos != null)
                //            {
                //                lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos = new FeaEntidades.Reporte.lineaDescuentos[lc.comprobante[i].detalle.linea[l].lineaDescuentos.Length];
                //                for (int d = 0; d < lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos.Length; d++)
                //                {
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d] = new FeaEntidades.Reporte.lineaDescuentos();
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].descripcion_descuento = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].descripcion_descuento;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento_moneda_origen = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento_moneda_origen;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento_moneda_origenSpecified = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento_moneda_origenSpecified;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].importe_descuento_moneda_origenSpecified = true;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].porcentaje_descuento = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].porcentaje_descuento;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].porcentaje_descuentoSpecified = lc.comprobante[i].detalle.linea[l].lineaDescuentos[d].porcentaje_descuentoSpecified;
                //                    lcReporte.comprobante[i].detalle.linea[l].lineaDescuentos[d].porcentaje_descuentoSpecified = true;
                //                }
                //            }
                //            else
                //            {
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos = new FeaEntidades.Reporte.lineaDescuentos[1];
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0] = new FeaEntidades.Reporte.lineaDescuentos();
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].descripcion_descuento = "";
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].importe_descuento = 0;
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].porcentaje_descuento = 0;
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].porcentaje_descuentoSpecified = true;
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].importe_descuento_moneda_origen = 0;
                //                lcReporte.comprobante[0].detalle.linea[l].lineaDescuentos[0].importe_descuento_moneda_origenSpecified = true;
                //            }
                //        }
                //    }
                //    else
                //    {
                //        lc.comprobante[i] = null;
                //        lcReporte.comprobante[i] = null;
                //    }
                //}
                
                //AsignarCamposOpcionales(lcReporte);
                //ReemplarResumenImportesMonedaExtranjera(lcReporte);
                //DataSet ds = new DataSet();
                //XmlSerializer objXS = new XmlSerializer(lcReporte.GetType());
                //StringWriter objSW = new StringWriter();
                //objXS.Serialize(objSW, lcReporte);
                //StringReader objSR = new StringReader(objSW.ToString());
                //ds.ReadXml(objSR);
                
                //string pxsd = string.Format("{0}\\Facturacion\\Electronica\\Reportes\\lote_comprobantes.xsd",System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
                //System.IO.File.Copy(pxsd, @System.IO.Path.GetTempPath() + "lote_comprobantes.xsd", true);
                
                //string imagen = string.Format("{0}\\Facturacion\\Electronica\\Reportes\\Imagen.xsd",System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
                //System.IO.File.Copy(imagen, @System.IO.Path.GetTempPath() + "Imagen.xsd", true);

                //facturaRpt.SetDataSource(ds);

                //facturaRpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;
                //facturaRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;

                //IncrustarLogo();
                //GenerarCodigoBarras(lcReporte.cabecera_lote.cuit_vendedor + lcReporte.comprobante[0].cabecera.informacion_comprobante.tipo_de_comprobante.ToString("00") + lcReporte.comprobante[0].cabecera.informacion_comprobante.punto_de_venta.ToString("0000") + lcReporte.comprobante[0].cabecera.informacion_comprobante.cae + lcReporte.comprobante[0].cabecera.informacion_comprobante.fecha_vencimiento_cae);
                //AsignarParametros(lcReporte.comprobante[0].resumen.importe_total_factura);

                ReporteDocumento = facturaRpt;
            }
            catch (Exception ex)
            {
                ReporteDocumento = null;
                //MessageBox.Show(ex.Message, "Problemas al procesar el comprobante", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                throw new Microsoft.ApplicationBlocks.ExceptionManagement.Reporte.ProblemasProcesando(ex);
            }
            finally
            {
                Cursor = System.Windows.Forms.Cursors.Default;
            }
        }
Ejemplo n.º 59
0
    /// <summary>
    /// 產生報表
    /// </summary>
    /// <param name="dt">DataTable資料</param>
    /// <param name="exp_type">產生PDF或Excel</param>
    private void ShowReport(DataTable dt, string exp_type)
    {
        try
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

            report.Load(Server.MapPath("./REPORT/VAM111/VAM11R.rpt"));
            report.SetDataSource(dt);

            DataTable dt1 = new DataTable();
            dt1 = (DataTable)Session["UserInfo"];
            string Login_Name = dt1.Rows[0]["Name"].ToString();

            //CrystalReport Parameter 參數設定
            string Program_ID = string.Empty;
            string LoginUser = string.Empty;

            string strParFDate = string.Empty;
            string strParFSType = string.Empty;
            string strParFTaxType = string.Empty;

            Program_ID = this.PageCode + "R";
            LoginUser = Session["UID"].ToString();

            string V_REPORT_TYPE = ""; //資料選擇
            if (rdoType1.Checked) V_REPORT_TYPE = "全部";
            if (rdoType2.Checked) V_REPORT_TYPE = "廠商進貨";
            if (rdoType3.Checked) V_REPORT_TYPE = "廠商退貨";
            report.SetParameterValue("par_Program_ID", Program_ID);
            report.SetParameterValue("par_LoginUser", LoginUser);
            report.SetParameterValue("par_LoginName", Login_Name);
            string inDate = (SLP_SLPDateRange.StartDate + ((SLP_SLPDateRange.StartDate.Length == 0 && SLP_SLPDateRange.EndDate.Length == 0) ? "" : "~") + SLP_SLPDateRange.EndDate);
            if (inDate == "") inDate = "全部";
            report.SetParameterValue("par_Date", "進/退貨日期:" + inDate);

            //string vendor1 = ((TextBox)((ASP.vdm_slp_slp_vendorbase_ascx)SLP_VendorBase1).FindControl("TextBoxName")).Text;
            string vendor1 = GetVendorName(SLP_VendorBase1.Text.Trim());
            //string vendor2 = ((TextBox)((ASP.vdm_slp_slp_vendorbase_ascx)SLP_VendorBase2).FindControl("TextBoxName")).Text;
            string vendor2 = GetVendorName(SLP_VendorBase2.Text.Trim());

            if (SLP_VendorBase1.Text.Trim().Length != 0 && vendor1 == "") vendor1 = Page.Request.Form[((TextBox)((ASP.vdm_slp_slp_vendorbase_ascx)SLP_VendorBase1).FindControl("TextBoxName")).UniqueID];

            if (SLP_VendorBase2.Text.Trim().Length != 0 && vendor2 == "") vendor2 = Page.Request.Form[((TextBox)((ASP.vdm_slp_slp_vendorbase_ascx)SLP_VendorBase2).FindControl("TextBoxName")).UniqueID];

            string vendor = (SLP_VendorBase1.Text + vendor1 + ((SLP_VendorBase1.Text.Trim().Length == 0 && SLP_VendorBase2.Text.Trim().Length == 0) ? "" : "~") + SLP_VendorBase2.Text + vendor2);
            if (SLP_VendorBase1.Text.Trim().Length == 0 && SLP_VendorBase2.Text.Trim().Length == 0) vendor = "全部";
            report.SetParameterValue("par_Vendor", "供應商:" + vendor);
            report.SetParameterValue("par_Tax", "課稅別:" + ((DropDownList)SLP_EnumBase.FindControl("D1")).SelectedItem.Text);
            report.SetParameterValue("par_Type", "資料選擇:" + V_REPORT_TYPE);

            //檔案匯出
            if (exp_type == "btnExport")
            {
                System.IO.Stream streamXLS = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
                byte[] bytesXLS = new byte[streamXLS.Length];
                streamXLS.Read(bytesXLS, 0, bytesXLS.Length);
                streamXLS.Seek(0, System.IO.SeekOrigin.Begin);
                //Export File  
                Response.ClearContent();
                Response.ClearHeaders();
                string rpt_name = "供應商暫估貨款明細表.xls";
                Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(rpt_name, System.Text.Encoding.UTF8));//匯出檔名  
                Response.ContentType = "application/vnd.ms-excel";
                Response.OutputStream.Write(bytesXLS, 0, bytesXLS.Length);
            }
            else
            {
                System.IO.Stream streamPDF = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                byte[] bytesPDF = new byte[streamPDF.Length];
                streamPDF.Read(bytesPDF, 0, bytesPDF.Length);
                streamPDF.Seek(0, System.IO.SeekOrigin.Begin);
                //Export File  
                Response.ClearContent();
                Response.ClearHeaders();
                string rpt_name = "供應商暫估貨款明細表.PDF";
                Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(rpt_name, System.Text.Encoding.UTF8));//匯出檔名  
                Response.ContentType = "application/pdf";
                Response.OutputStream.Write(bytesPDF, 0, bytesPDF.Length);
            }
            Response.Flush();
            Response.Close();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Ejemplo n.º 60
0
        private void loadQTY()
        {
            ADODB.Recordset rs = default(ADODB.Recordset);
            ADODB.Recordset rsData = default(ADODB.Recordset);
            //Dim Report As New cryItemItemCompareQty
            //ReportNone.Load("cryNoRecords.rpt")
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            CrystalDecisions.CrystalReports.Engine.ReportDocument ReportNone = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            Report.Load("cryItemItemCompareQty.rpt");
            ReportNone.Load("cryNoRecords.rpt");
            modReport.cnnDBreport.Execute("DELETE LinkItem.* FROM LinkItem;");
            rs = modReport.getRSreport(ref "SELECT * FROM Link Where Link_SectionID=3");
            while (!(rs.EOF)) {
                if (!string.IsNullOrEmpty(rs.Fields("Link_SQL").Value)) {
                    modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT " + rs.Fields("LinkID").Value + ", DayEndStockItemLnk.DayEndStockItemLnk_DayEndID, DayEndStockItemLnk.DayEndStockItemLnk_QuantitySales FROM DayEndStockItemLnk INNER JOIN aStockItem ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem.StockItemID WHERE " + rs.Fields("Link_SQL").Value + ";");
                }
                rs.moveNext();
            }

            modReport.cnnDBreport.Execute("INSERT INTO LinkItem ( LinkItem_LinkID, LinkItem_DayEndID, LinkItem_Value ) SELECT theJoin.LinkID, theJoin.DayEndID, 0 FROM LinkItem RIGHT JOIN [SELECT Link.LinkID, DayEnd.DayEndID From Link, DayEnd WHERE (((Link.Link_SQL)<>'') AND ((Link.Link_SectionID)=3))]. AS theJoin ON (LinkItem.LinkItem_DayEndID = theJoin.DayEndID) AND (LinkItem.LinkItem_LinkID = theJoin.LinkID) WHERE (((LinkItem.LinkItem_LinkID) Is Null));");
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            rs = modReport.getRSreport(ref "SELECT Report.Report_Heading, aCompany.Company_Name FROM aCompany, Report;");
            Report.SetParameterValue("txtCompanyName", rs.Fields("Company_Name"));
            Report.SetParameterValue("txtDayEnd", rs.Fields("Report_Heading"));
            rs.Close();
            rs = modReport.getRSreport(ref "SELECT [Link].[LinkID], [Link].[Link_Name], Sum([LinkItem].[LinkItem_Value]) AS SumOfLinkItem_Value FROM Link INNER JOIN LinkItem ON [Link].[LinkID]=[LinkItem].[LinkItem_LinkID] WHERE ((([Link].[Link_SQL])<>'') And (([Link].[Link_SectionID])=3)) GROUP BY [Link].[LinkID], [Link].[Link_Name] ORDER BY [Link].[LinkID];");

            if (rs.BOF | rs.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }
            rsData = modReport.getRSreport(ref "SELECT LinkItem.*, Format([DayEnd_Date],'yyyy mm dd ddd') AS dateName, DayEnd.DayEnd_Date FROM DayEnd INNER JOIN LinkItem ON DayEnd.DayEndID = LinkItem.LinkItem_DayEndID ORDER BY DayEnd.DayEnd_Date;");
            if (rsData.BOF | rsData.EOF) {
                ReportNone.SetParameterValue("txtCompanyName", Report.ParameterFields("txtCompanyName").ToString);
                ReportNone.SetParameterValue("txtTitle", Report.ParameterFields("txtTitle").ToString);
                My.MyProject.Forms.frmReportShow.Text = ReportNone.ParameterFields("txtTitle").ToString;
                My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = ReportNone;
                My.MyProject.Forms.frmReportShow.mReport = ReportNone;
                My.MyProject.Forms.frmReportShow.sMode = "0";
                My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
                //UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                My.MyProject.Forms.frmReportShow.ShowDialog();
                return;
            }

            Report.Database.Tables(1).SetDataSource(rs);
            Report.Database.Tables(2).SetDataSource(rsData);
            System.Windows.Forms.Application.DoEvents();
            //Report.VerifyOnEveryPrint = True
            System.Windows.Forms.Application.DoEvents();
            My.MyProject.Forms.frmReportShow.Text = Report.ParameterFields("txtTitle").ToString;
            My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report;
            My.MyProject.Forms.frmReportShow.mReport = Report;
            My.MyProject.Forms.frmReportShow.sMode = "0";
            My.MyProject.Forms.frmReportShow.CRViewer1.Refresh();
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            My.MyProject.Forms.frmReportShow.ShowDialog();
        }