public void ShowGenericRpt()
        {
            try
            {
                bool isValid = true;

                string strReportName = System.Web.HttpContext.Current.Session["ReportName"].ToString();    // Setting ReportName

                if (string.IsNullOrEmpty(strReportName))
                {
                    isValid = false;
                }

                if (isValid)
                {
                    ReportDocument rd = new ReportDocument();
                    string strRptPath = System.Web.HttpContext.Current.Server.MapPath("~/") + "Report//" + strReportName;
                    rd.Load(strRptPath);
                    rd.VerifyDatabase();
                    rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport");
                    // Clear all sessions value
                    Session["ReportName"] = null;
                }
                else
                {
                    Response.Write("<H2>Nothing Found; No Report name found</H2>");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public ReportDocument GetSalesCenterListByActivationStatus(string sortedBy, string sortingOrder, string isActive, LumexDBPlayer db)
        {
            try
            {
                LumexSessionManager.Add("rptName", "Sales_Center_List");
                ReportDocument reportDocument = new ReportDocument();

                db.AddParameters("@SortedBy", sortedBy.Trim());
                db.AddParameters("@SortingOrder", sortingOrder.Trim());
                db.AddParameters("@IsActive", isActive.Trim());

                if (isActive == "All")
                {
                    reportDocument.Load(reportPath + "GET_SALES_CENTERS.rpt");
                }
                else
                {
                    reportDocument.Load(reportPath + "GET_SALES_CENTERS_BY_ACTIVATION_STATUS.rpt");
                }

                reportDocument.SetDataSource(db.ExecuteDataTable("REPORT_GET_SALES_CENTERS_BY_ACTIVATION_STATUS", true));

                return reportDocument;
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable _dtCabeceraOper = null;
                DataTable _dtDetalleOper = null;
                _dtCabeceraOper = (DataTable)Session["dtCabeceraOperacion"];
                _dtDetalleOper = g_dtDetOperacion;
                if (_dtDetalleOper != null && _dtCabeceraOper != null)
                {
                    if (_dtDetalleOper.Rows.Count != 0)
                    {
                        ReportDocument rpt = new ReportDocument();
                        rpt.Load(Server.MapPath("rpt/crFactura.rpt"));
                        rpt.FileName = Server.MapPath("rpt/crFactura.rpt");
                        rpt.SetDataSource(_dtCabeceraOper);
                        rpt.Subreports[0].SetDataSource(_dtDetalleOper);

                        CrystalReportViewer1.ReportSource = rpt;
                        CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void Reporte_de_Gastos_de_Inversión_Load(object sender, EventArgs e)
 {
     //Diseño de la ventana
     this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(228)))), ((int)(((byte)(196)))));
     this.Icon = global::Sistema_Shajobe.Properties.Resources.Caja_ICO;
     //REPORTE CRISTAL REPORT
     //PRIMER PARAMETRO
     ReportDocument reporte = new ReportDocument();
     ParameterField parametro = new ParameterField();
     ParameterFields parametros = new ParameterFields();
     ParameterDiscreteValue discretos = new ParameterDiscreteValue();
     parametro.Name = "@Apartir";
     discretos.Value = Convert.ToDateTime(_Apartir);
     parametro.CurrentValues.Add(discretos);
     parametros.Add(parametro);
     //SEGUNDO PARAMETRO
     ParameterField parametro1 = new ParameterField();
     ParameterDiscreteValue discretos1 = new ParameterDiscreteValue();
     parametro1.Name = "@Hasta";
     discretos1.Value = Convert.ToDateTime(_Hasta);
     parametro1.CurrentValues.Add(discretos1);
     parametros.Add(parametro1);
     crystalReportViewer1.ParameterFieldInfo = parametros;
     crystalReportViewer1.ReportSource = RGastosInventario1;
 }
Exemplo n.º 5
0
        private void ToTable(DataTable tb, ReportDocument report)
        {
            if (report != null)
            {
                for (int i = 0; i < report.ReportDefinition.ReportObjects.Count; i++)
                {
                    DataRow row = tb.NewRow();
                    row["REPORTNAME"] = report.Name;
                    row["NAME"] = report.ReportDefinition.ReportObjects[i].Name;
                    row["LEFT"] = report.ReportDefinition.ReportObjects[i].Left;
                    row["TOP"] = report.ReportDefinition.ReportObjects[i].Top;
                    row["HEIGHT"] = report.ReportDefinition.ReportObjects[i].Height;
                    row["WIDTH"] = report.ReportDefinition.ReportObjects[i].Width;

                    tb.Rows.Add(row);
                }

                if (report.IsSubreport == false && report.Subreports != null)
                {
                    for (int i = 0; i < report.Subreports.Count; i++)
                    {
                        ToTable(tb, report.Subreports[i]);
                    }
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ReportDocument rd;
                rd = new ReportDocument();
            rd.Load(@"C:\Users\PLABON\Documents\Visual Studio 2013\Projects\SalesAndInventorySystem\SalesAndInventorySystemUI\Report\a.rpt");
            List<PersonType> company = companyGateway.GetCompanies();
            var companyX = company.Select(x => new {x.ID, x.Name});
            rd.SetDataSource(companyX);
            crystalReportViewer1.ReportSource = rd;

            crystalReportViewer1.Refresh();
                int a = 10;
            if (File.Exists(@"D:\" + "AAAA" + a  +".pdf"))
                File.Delete(@"D:\" + a++ + ".pdf");
            rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"D:\" + a + ".pdf");

            }
            catch (Exception)
            {

                throw;
            }
        }
Exemplo n.º 7
0
 private void frminhoadon_Load(object sender, EventArgs e)
 {
     DataTable ds = hdbus.getHoaDon(KHAIBAO.mabenhnhan, KHAIBAO.ngaykham);
     ds.TableName = "HoaDon";
     DataTable dt2 = ctkbus.getDonThuoc(KHAIBAO.mabenhnhan + KHAIBAO.ngaykham);
     dt2.TableName = "DonThuoc";
     DataTable dt3 = cdbus.getCachDung();
     dt3.TableName = "CachDung";
     DataTable dt4 = ltbus.getLoaiThuoc();
     dt4.TableName = "LoaiThuoc";
     DataTable dt5 = dvbus.getDonVi();
     dt5.TableName = "DonVi";
     DataSet dts = new DataSet();
     dts.Tables.Add(ds);
     dts.Tables.Add(dt2);
     dts.Tables.Add(dt3);
     dts.Tables.Add(dt4);
     dts.Tables.Add(dt5);
     if (float.Parse(ds.Rows[0]["TienThuoc"].ToString()) == 0)
     {
         ReportDocument report = new ReportDocument();
         report.Load("..\\..\\inhoadon1.rpt");
         report.SetDataSource(dts);
         crystalReportViewer.ReportSource = report;
         inhoadon1 dt = new inhoadon1();
     }
     else
     {
         ReportDocument report = new ReportDocument();
         report.Load("..\\..\\inhoadon.rpt");
         report.SetDataSource(dts);
         crystalReportViewer.ReportSource = report;
         inhoadon dt = new inhoadon();
     }
 }
Exemplo n.º 8
0
		private void GenerateWord()
		{
            ReportDocument rpt = new ReportDocument();
            rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt"));

			ExportOptions exportop = new ExportOptions();
			DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
			
			string strPath = Server.MapPath(@"\retailplus\temp\");

			string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".doc";
			if (System.IO.File.Exists(strPath + strFileName))
				System.IO.File.Delete(strPath + strFileName);

			dest.DiskFileName = strPath + strFileName;

			exportop = rpt.ExportOptions;
	
			SetDataSource(rpt);

			exportop.DestinationOptions = dest;
			exportop.ExportDestinationType = ExportDestinationType.DiskFile;
			exportop.ExportFormatType = ExportFormatType.WordForWindows;
			rpt.Export();   rpt.Close();    rpt.Dispose();
			
			fraViewer.Attributes.Add("src","/retailplus/temp/" + strFileName);
		}
Exemplo n.º 9
0
 static void InitializeLanguage(ReportDocument reportDocument)
 {
     var language = GetCurrentLanguage();
     reportDocument.ReportClientDocument.PreferredViewingLocaleID = language;
     reportDocument.ReportClientDocument.LocaleID = language;
     reportDocument.ReportClientDocument.ProductLocaleID = language;
 }
Exemplo n.º 10
0
        public frmReporteTurnosMedico(ReportDocument rd)
        {
            InitializeComponent();

            crvForm.ReportSource = rd;

        }
Exemplo n.º 11
0
    /// <summary>
    /// 產生報表
    /// </summary>
    private void ConfigureCrystalReports()
    {
        try
        {
            string strDate = Session[string.Format("{0}QueryDateRange", Request["TimeStamp"].ToString())].ToString();
            if (strDate == "~") strDate = "";
            string strTime = Session[string.Format("{0}QueryTimeRange", Request["TimeStamp"].ToString())].ToString();
            if (strTime == "~") strTime = "";
            customerReport = new ReportDocument();

            //取得報表格式檔RPT
            customerReport.Load(Server.MapPath("ITM061R.rpt"));
            customerReport.SetDataSource((DataTable)Session[string.Format("{0}ITM061", Request["TimeStamp"].ToString())]);
            ParameterFields par1 = new ParameterFields();
            AddParameter("ProgramName", PageProgramName, par1);
            ParameterFields par2 = new ParameterFields();
            AddParameter("UserName", Session["UID"].ToString(), par2);
            ParameterFields par3 = new ParameterFields();
            AddParameter("QueryDateRange", strDate, par3);
            ParameterFields par4 = new ParameterFields();
            AddParameter("QueryTime", strTime, par4);
            CRV1.ParameterFieldInfo.Add(par1[0]);
            CRV1.ParameterFieldInfo.Add(par2[0]);
            CRV1.ParameterFieldInfo.Add(par3[0]);
            CRV1.ParameterFieldInfo.Add(par4[0]);
            CRV1.ReportSource = customerReport;
        }
        catch (Exception ex)
        {
            lblErrorMessage.Text = ex.Message;
        }
    }//ConfigureCrystalReports
        private void CriaPDF()
        {
            Hashtable hashtable = (Hashtable)Session["HashAgendaMontadaPublicada"];

            DSCabecalhoAgendaMontadaPublicada cabecalho = new DSCabecalhoAgendaMontadaPublicada();
            cabecalho.Tables.Add((DataTable)hashtable["cabecalho"]);

            DSRelatorioAgendaMontadaPublicada dados = new DSRelatorioAgendaMontadaPublicada();
            dados.Tables.Add((DataTable)hashtable["dados"]);

            ReportDocument repDoc = new ReportDocument();

            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_AgendaMontadaPublicada.rpt"));
            repDoc.SetDataSource(dados.Tables[1]);
            repDoc.Subreports["CrystalReportViewer_CabecalhoAgendaMontadaPublicada.rpt"].SetDataSource(cabecalho.Tables[1]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "applicattion/octect-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=RelatorioDeAgendasMontadasPublicadas.pdf");
            Response.AddHeader("Content-Length", s.Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();

            Session.Remove("HashAgendaMontadaPublicada");
        }
Exemplo n.º 13
0
 /// <summary>
 /// Erzeugt aus einer CrystalReportsDatei oder einem PDF einen PDF Stream und sendet ihn an den Client
 /// </summary>
 /// <param name="pin_ReportVorlage">Pfad der Vorlage</param>
 /// <param name="pin_ReportAuswahl">reportspezifische Daten</param>
 /// <returns>Stream der ein PDF enthält</returns>
 public Stream ErzeugeReport(string pin_ReportVorlage, string pin_ReportAuswahl)
 {
     if (pin_ReportVorlage.Substring(pin_ReportVorlage.LastIndexOf(".") + 1) == "pdf")
     {
         // Umwandeln des PDF Vordrucks in einen Stream
         FileStream Report = new FileStream(Directory.GetCurrentDirectory() + pin_ReportVorlage, System.IO.FileMode.Open, System.IO.FileAccess.Read);
         byte[] Buffer = new byte[(int)Report.Length];
         Report.Read(Buffer, 0, (int)Report.Length);
         Report.Close();
         // Versenden der Daten als MemoryStream
         System.Windows.Forms.MessageBox.Show("Schicke Raus !!");
         return new MemoryStream(Buffer, 0, Buffer.Length);
     }
     else
     {
         // Erstellen eines Reports
         ReportDocument Report = new ReportDocument();
         // Lade Reportvorlage
         Report.Load(Directory.GetCurrentDirectory() + pin_ReportVorlage);
         // Besondere SELECT Anfrage auf den Datensatz anwenden
         if (pin_ReportAuswahl != String.Empty)
             Report.DataDefinition.RecordSelectionFormula = pin_ReportAuswahl;
         // muss als Stream übertragen werden, da ReportDocuments nicht Serializable sind
         return Report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
     }
 }
Exemplo n.º 14
0
        private void ExportarEXCEL(ReportDocument rep)
        {
            String ruta_exportacion;

            ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
            //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];

            ExportOptions exportOpts = new ExportOptions();
            DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

            exportOpts = rep.ExportOptions;
            exportOpts.ExportFormatType = ExportFormatType.Excel;

            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
            diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".xls";
            exportOpts.DestinationOptions = diskOpts;

            rep.Export();

            Response.ClearContent();
            Response.ClearHeaders();

            Response.AddHeader ("Content-Disposition", "attachment;filename=Morosidad.xls");
            Response.ContentType = "application/vnd.ms-excel";
            Response.WriteFile(diskOpts.DiskFileName.ToString());
            Response.Flush();
            Response.Close();
            System.IO.File.Delete(diskOpts.DiskFileName.ToString());
        }
        public ActionResult ExportReport()
        {
            List<Investment> allInvestment = new List<Investment>();

            using (efarmingEntities dc = new efarmingEntities())
            {
                allInvestment = dc.Investments.ToList();
            }

            ReportDocument rd = new ReportDocument();
            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "rpt_InvestmentList.rpt"));
            rd.SetDataSource(allInvestment);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return File(stream, "application/pdf", "InvestmentList.pdf");
            }
            catch (Exception)
            {

                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = Session["uname"].ToString();
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(Server.MapPath("SoldProduct.rpt"));

            /*    ParameterFieldDefinitions PFDS;
                ParameterFieldDefinition PFD;
                ParameterValues PVS = new ParameterValues();
                ParameterDiscreteValue PDV = new ParameterDiscreteValue();
                PVS.Clear();
                PDV.Value = "";
                PFDS = cryRpt.DataDefinition.ParameterFields;
                PFD = PFDS["@sDate"];
                PVS = PFD.CurrentValues;
                //
                PVS.Add(PDV);
                PFD.ApplyCurrentValues(PVS);

                PDV.Value = "";
                PFDS = cryRpt.DataDefinition.ParameterFields;
                PFD = PFDS["@eDate"];
                PVS = PFD.CurrentValues;
                //PVS.Clear();
                PVS.Add(PDV);
                PFD.ApplyCurrentValues(PVS);*/

            cryRpt.SetDatabaseLogon("sa", "123", "server", "auction");
            CrystalReportViewer1.ReportSource = cryRpt;
            CrystalReportViewer1.RefreshReport();
        }
Exemplo n.º 17
0
        private void LoadReportFile(string rptName, string procName, string rptTitle, Dictionary<string, string> paraValues, Dictionary<string, string> procValues)
        {
            try
            {
                string rptPath = Server.MapPath("/ReportPages/" + rptName);

                _rptDoc = new ReportDocument();
                _rptDoc.Load(rptPath);
                _rptDoc.SummaryInfo.ReportTitle = rptTitle;
                _rptDoc.SetDataSource(ExcuteQuery(procName, procValues));
                if (paraValues.Count > 0)
                    foreach (KeyValuePair<string, string> par in paraValues)
                    {
                        ParameterDiscreteValue pValue = new ParameterDiscreteValue();
                        pValue.Value = par.Value;
                        ParameterFieldDefinition pDef = _rptDoc.DataDefinition.ParameterFields[par.Key];
                        pDef.CurrentValues.Clear();
                        pDef.CurrentValues.Add(pValue);
                        pDef.ApplyCurrentValues(pDef.CurrentValues);

                    }
                crystalReportViewer.ReportSource = _rptDoc;
            }
            catch (Exception e)
            {
                label.Text = "Report Error: " + e.Message;
            }
            finally
            {
                GC.Collect();
            }
        }
Exemplo n.º 18
0
        private void frmReamMoneyPrint_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;

            ReamMoney reamMoney = new ReamMoney();
            reamMoney = reamMoneyService.getReamMoneyByID(rid);

            List<ReamMoneyReport> reamMoneyReports = new List<ReamMoneyReport>();
            ReamMoneyReport reamMoneyReport = new ReamMoneyReport();
            Person p = new Person();
            p = personService.getPersonBypsnCode(reamMoney.person.psnCode);

            reamMoneyReport.fullName = p.psnPreFix + " " + p.psnName + " " + p.psnLastName;
            reamMoneyReport.amount =Convert.ToString(reamMoney.amount);
            reamMoneyReport.reamDate = reamMoney.reamdate;

            reamMoneyReports.Add(reamMoneyReport);

            ReportDocument rp = new ReportDocument();
            string path = Application.StartupPath + @"\report\rptReamMoney.rpt";
            rp.Load(path);
            rp.SetDataSource(reamMoneyReports);

            PV.ReportSource = rp;
        }
Exemplo n.º 19
0
    protected void GenerateReport()
    {
        System.Console.Beep();

                //Create report document
                ReportDocument crystalReport = new ReportDocument();

                if (txtStart.Text != "" && txtEnd.Text != "" )
                {

                        //Load crystal report made in design view
                        crystalReport.Load(Server.MapPath("Reports/Notifications.rpt"));

                        //Set DataBase Login Info
                        crystalReport.SetDatabaseLogon("root", "123", @"localhost", "nsis");

                        //Provide parameter values
                        crystalReport.SetParameterValue("start", txtStart.Text.ToString());
                        crystalReport.SetParameterValue("end", txtEnd.Text.ToString());

                        //Set Report in to Report Viewer
                        crvReportViewer.ReportSource = crystalReport;

            }
            else
            {
               // lblError.ForeColor = Color.Red;
               // lblError.Text = "Please Provide Valid Details";
            }
    }
Exemplo n.º 20
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            int DoctorID;
            DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString());
            ReportDocument reportDocument = new ReportDocument();
            ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            string ReportPath = ConfigurationManager.AppSettings["ReportPath"];

            paramField.Name = "@DoctorID";

            paramDiscreteValue.Value = DoctorID;
            reportDocument.Load(ReportPath + "Report\\DoctorCrystalReport.rpt");

            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
            //connectionInfo.UserID = "wms";
            //connectionInfo.Password = "******";
            connectionInfo.IntegratedSecurity = true;
            SetDBLogonForReport(connectionInfo, reportDocument);

            reportDocument.SetParameterValue("@DoctorID", DoctorID);
            DoctorCrystalRpt.ReportSource = reportDocument;

            DoctorCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
        }
Exemplo n.º 21
0
        //结帐查询
        public static ReportDocument LoadReport(string rptfilename, string sql, string tablename)
        {
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
            SqlDataAdapter dbDA = new SqlDataAdapter();
            DataSet dataSet = new DataSet();
            conn.ConnectionString = rms_var.ConnStr;

            try
            {
                SqlCommand selectCMD = new SqlCommand(sql, conn);
                selectCMD.CommandTimeout = 30;
                dbDA.SelectCommand = selectCMD;
                conn.Open();
                dbDA.Fill(dataSet, tablename);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }

            ReportDocument cr_doc;
            cr_doc = new ReportDocument();
            cr_doc.Load(rptfilename);

            cr_doc.SetDataSource(dataSet);

            return cr_doc;
        }
Exemplo n.º 22
0
 private void cboYear_SelectedIndexChanged(object sender, EventArgs e)
 {
      try
      {
          string RepPath;
          DataSet dataset = new DataSet();
          ReportDocument RepDoc = new ReportDocument();                 
          RepPath = @"D:\Project\Industrial College\Project1\Source23\Source22\Source21\Pazhohesh\Pazhohesh\Main\CrsThesis1.rpt";                 
          RepDoc.Load(RepPath);                    
          objDataAdapter.SelectCommand = new SqlCommand();
          SqlConnection objConnection = new SqlConnection("Data Source=User-PC;Initial Catalog=ResearchProje1;Integrated Security=True");
          objDataAdapter.SelectCommand.Connection = objConnection;
          DataTable objGozaresh = new DataTable();
          objGozaresh.Clear();
          objDataAdapter.SelectCommand.Parameters.AddWithValue("@DeliveryDate" , cboYear.Text + "%");
          objDataAdapter.SelectCommand.CommandText = "Select * from VwThesisGozaresh1 where DeliveryDate Like @DeliveryDate";
          objDataAdapter.Fill(objGozaresh);
          RepDoc.SetDataSource(objGozaresh);
          crystalReportViewer1.ReportSource = RepDoc;
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.ToString());
      }
 }
        private void CustomerTransactionReportForm_Load(object sender, EventArgs e)
        {
            ReportDocument cryRpt;

            using (Devart.Data.SQLite.SQLiteConnection myConn = new Devart.Data.SQLite.SQLiteConnection(myConfig.connstr))
            {
                using (SQLiteCommand myCmd = new SQLiteCommand(sqlcmd, myConn))
                {
                    myConn.Open();
                    using (SQLiteDataReader myReader = myCmd.ExecuteReader())
                    {
                        dataSet2.customer_trans.Load(myReader);
                        myConn.Close();
                    }
                }
            }

            this.customerTableAdapter1.Fill(this.dataSet2.customer);
            this.configurationTableAdapter1.Fill(this.dataSet2.configuration);

            CustomerTransactionReport rpt = new CustomerTransactionReport();
            rpt.SetDataSource(this.dataSet2);

            cryRpt = new ReportDocument();
            cryRpt.Load(rpt.FileName.ToString());
            cryRpt.SetDataSource(this.dataSet2);
            cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, ReportFolder.reportFolderName + @"\CustomerTransactions.pdf");
        }
Exemplo n.º 24
0
        public void setParameters(ReportDocument Rpt)
        {
            if (HttpContext.Current.Request.QueryString["StartDate"] != null && HttpContext.Current.Request.QueryString["EndDate"] != null)
            {
                ParameterFields paramFields = new ParameterFields();
                ParameterField StartDay, EndDay;
                ParameterDiscreteValue dcStartDay, dcEndDay;
                StartDay = new ParameterField();
                StartDay.ParameterFieldName = "@FromDate";
                dcStartDay = new ParameterDiscreteValue();
                dcStartDay.Value = Request.QueryString["StartDate"].ToString();

                EndDay = new ParameterField();
                EndDay.ParameterFieldName = "@ToDate";
                dcEndDay = new ParameterDiscreteValue();
                dcEndDay.Value = Request.QueryString["EndDate"].ToString();

                StartDay.CurrentValues.Add(dcStartDay);
                EndDay.CurrentValues.Add(dcEndDay);
                paramFields.Add(StartDay);
                paramFields.Add(EndDay);

                AdminActivityCRViewer.ParameterFieldInfo = paramFields;
                AdminActivityCRViewer.ReportSource = Rpt;
                AdminActivityCRViewer.DataBind();
            }
        }
 private void FrmProjectReportViewer_Load(object sender, EventArgs e)
 {
     try
     {
         if (FrmFlagProject.ProjectFlag == 0)
         {
             lblProjectFlag.Text = "لیست طرح های پژوهشی در دست اجرا در سال" + " " + FrmFlagProject.year;
         }
         else if (FrmFlagProject.ProjectFlag == 1)
         {
             lblProjectFlag.Text = "لیست طرح های پژوهشی پایان یافته در سال" + " " + FrmFlagProject.year;
         }
         DataSet dataset = new DataSet();
         ReportDocument RepDoc = new ReportDocument();
         string dir = Environment.CurrentDirectory;
         dir = dir + "\\CrtMainProject.rpt";
         RepDoc.Load(dir);
         RepDoc.SetDataSource(FrmFlagProject.objTbl);
         crystalReportViewer1.ReportSource = RepDoc;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 26
0
        protected void CriaPDF()
        {
            Hashtable hash = (Hashtable)Session["HashVagasDisponivel"];

            //CrystalReportViewer_AgendaPrestador.DisplayToolbar = true;
            //CrystalReportViewer_AgendaPrestador.EnableDatabaseLogonPrompt = false;

            DSRelatorioVagasDisponivel conteudo = new DSRelatorioVagasDisponivel();
            conteudo.Tables.Add((DataTable)hash["corpo"]);

            ReportDocument repDoc = new ReportDocument();
            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_VagasDisponivel.rpt"));
            repDoc.SetDataSource(conteudo.Tables[1]);

            //repDoc.Database.Tables["CabecalhoAgendaPrestador"].SetDataSource((DataTable)hash["cabecalho"]);
            //repDoc.Database.Tables["RelatorioAgendaPrestador"].SetDataSource((DataTable)hash["corpo"]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "applicattion/octect-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=RelatorioVagasDisponivel.pdf");
            Response.AddHeader("Content-Length", s.Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();
        }
        public void Exportar(string key)
        {
            try
            {
                ReportDocument objRpt = new ReportDocument();
                DataSet ds = (DataSet)this.GetDataReport(key);

                string reportPath = "C:\\Reportes\\CRTejTicket_rpt.rpt";
                objRpt.Load(reportPath);

                ExportOptions crExportOptions = new ExportOptions();

                objRpt.SetDataSource(ds.Tables[0]);
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString();
                saveFileDialog.Filter = "Document (*.pdf)|*.PDF";
                saveFileDialog.FilterIndex = 1;
                saveFileDialog.FileName = "Etiqueta.pdf";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    objRpt.ExportToDisk(ExportFormatType.PortableDocFormat, saveFileDialog.FileName); ;
                }

                crExportOptions = objRpt.ExportOptions;
                objRpt.Export();

            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
        private void btnGerar_Click(object sender, EventArgs e)
        {
            ReportDocument crDocument = new ReportDocument();
            crDocument.Load(Application.StartupPath + @"\..\..\RelLocalizacaoProcesso.rpt");

            if (rbSemFiltro.Checked)
            {
                crDocument.SetDataSource(new RelProcesso(new Banco()).semfiltro());
            }
            else if (ckbNome.Checked && !ckbSituacao.Checked)
            {
                crDocument.SetDataSource(new RelProcesso(new Banco()).porNome(ttbNome.Text));
            }
            else if (!ckbNome.Checked && ckbSituacao.Checked)
            {
                //if(cbbSituacao.SelectedText == "Em Pasta")
                //    crDocument.SetDataSource(new RelProcesso(new Banco()).emPasta()));
                //else
                //    crDocument.SetDataSource(new RelProcesso(new Banco()).arquivado()));
            }
            else if (ckbNome.Checked && ckbSituacao.Checked)
            {

            }

            frmVisualizador f = new frmVisualizador();
            f.carregar(crDocument);
            f.ShowDialog();
        }
Exemplo n.º 29
0
        public RptDefinitionWriter(string filename)
        {
            Report = new ReportDocument();
            Report.Load(filename, OpenReportMethod.OpenReportByTempCopy);

            Trace.WriteLine("Loaded report");
        }
Exemplo n.º 30
0
        private void ExportarPDF(ReportDocument rep)
        {
            String ruta_exportacion;

            ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
            //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];

            ExportOptions exportOpts = new ExportOptions();
            DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

            exportOpts = rep.ExportOptions;
            exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
            diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf";
            exportOpts.DestinationOptions = diskOpts;

            rep.Export();

            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";
            Response.WriteFile(diskOpts.DiskFileName.ToString());
            Response.Flush();
            Response.Close();
            System.IO.File.Delete(diskOpts.DiskFileName.ToString());
        }
Exemplo n.º 31
0
        protected void LoadSalesProcessReports()
        {
            string approvalstatus  = "N";
            string vID             = "";
            string vpartyID        = "";
            string vProductGroupID = "";
            string vproduct        = "";
            string vareaID         = "";
            string vCategoryID     = "";
            string rdbtnvalue      = rbtnlist.SelectedValue;
            string rptfile         = "";

            if ((ddlNumber.SelectedValue != "0") || (ddlNumber.SelectedIndex != 0))
            {
                vID = ddlNumber.SelectedValue;
            }
            if (!string.IsNullOrEmpty(ddlArea.SelectedValue) || (ddlArea.SelectedIndex != 0))
            {
                vareaID = ddlArea.SelectedValue;
            }
            if (!string.IsNullOrEmpty(HIDDealerID.Value))
            {
                vpartyID = HIDDealerID.Value;
            }
            if (!string.IsNullOrEmpty(ddlProductGroup.SelectedValue) || (ddlProductGroup.SelectedIndex != 0))
            {
                vProductGroupID = ddlProductGroup.SelectedValue;
            }
            if (!string.IsNullOrEmpty(chkCategory.SelectedValue) || (chkCategory.SelectedIndex != 0))
            {
                vCategoryID = SelectedString(chkCategory);
            }
            if (!string.IsNullOrEmpty(ddlProductName.SelectedValue) || (ddlProductName.SelectedIndex != 0))
            {
                vproduct = ddlProductName.SelectedValue;
            }
            if (rdbtnvalue == "ApprovedInvoice" || rdbtnvalue == "ApprovedOrder")
            {
                approvalstatus = "Y";
            }

            //DataSet ds = new DataSet();
            if (rdbtnvalue == "Order" || rdbtnvalue == "ApprovedOrder")
            {
                if (vID == "" && vpartyID == "")
                {
                    rptfile = "AllOrderDetailsReport.rpt";
                }
                else
                {
                    rptfile = "OrderDetailsReport.rpt";
                }
                try
                {
                    String    query = "EXEC Get_Order_details_Report '" + vID + "','" + vareaID + "','" + vpartyID + "','" + vCategoryID + "','" + approvalstatus + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            else if (rdbtnvalue == "Invoice" || rdbtnvalue == "ApprovedInvoice")
            {
                if (vID == "" && vpartyID == "")
                {
                    rptfile = "AllInvoiceDetailsReport.rpt";
                }
                else
                {
                    rptfile = "InvoiceDetailsReport.rpt";
                }
                try
                {
                    String    query = "EXEC Get_Invoice_details_Report '" + vID + "','" + vareaID + "','" + vpartyID + "','" + vCategoryID + "','" + approvalstatus + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            else if (rdbtnvalue == "AllInvoice")
            {
                rptfile = "AllInvoiceDetailsReportAll.rpt";

                try
                {
                    String    query = "EXEC Get_Invoice_details_Report_all";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }

            else if (rdbtnvalue == "DeliverdNew")
            {
                if (vpartyID == "")
                {
                    rptfile = "DeliveryDetailsReport_New.rpt";
                }
                else
                {
                    rptfile = "DealerWiseDeliveryReport_New.rpt";
                }


                try
                {
                    String    query = "EXEC Get_Delivery_details_Report_New '" + vpartyID + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            else if (rdbtnvalue == "SellReturn")
            {
                rptfile = "SellReturn.rpt";
                try
                {
                    String    query = "EXEC getReturn_report '" + vpartyID + "','" + vProductGroupID + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }


            else if (rdbtnvalue == "SalesSummaryNew")
            {
                rptfile = "SalesSummaryReport_New.rpt";

                try
                {
                    String    query = "EXEC Get_Sales_details_Report_New '" + vID + "','" + vareaID + "','" + vpartyID + "','" + vCategoryID + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            //else if (rdbtnvalue == "ProductWiseSalesSummary")
            //{

            //    rptfile = "ProductWiseSalesSummaryReport.rpt";

            //    try
            //    {
            //        String query = "EXEC Get_Sales_Summary_Report '" + vareaID + "','" + vpartyID + "','" + vCategoryID + "','" + vproduct + "','" + vFromDate + "','" + vToDate + "'";
            //        DataTable dt = new DataTable();
            //        dt = dba.GetDataTable(query);
            //        if (dt != null)
            //        {
            //            ShowReportViewer(dt, rptfile);

            //        }
            //        else
            //        {
            //            pnlRpt.Visible = false;
            //        }
            //    }
            //    catch (Exception ex)
            //    { throw ex; }
            //}
            else if (rdbtnvalue == "ProductWiseSalesSummaryNew")
            {
                rptfile = "ProductWiseSalesSummaryReport.rpt";

                try
                {
                    String    query = "EXEC Get_Sales_Summary_Report_New '" + vareaID + "','" + vpartyID + "','" + vCategoryID + "','" + vproduct + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            //else if (rdbtnvalue == "DealerWiseSalesSummary")
            //{

            //    rptfile = "DealerWiseSalesSummaryReport.rpt";

            //    try
            //    {
            //        String query = "EXEC Get_Dealer_Sales_Summary_Report '" + vareaID + "','" + vpartyID + "'";
            //        String queryInvoice = "EXEC Get_Invoice_details_Report '','','','','Y','',''";
            //        String queryPayment = "EXEC Get_MoneyReceipt_details_Report '','','','',''";
            //        DataTable dt = new DataTable();
            //        dt = dba.GetDataTable(query);
            //        DataTable dt1 = new DataTable();
            //        dt1 = dba.GetDataTable(queryInvoice);
            //        DataTable dt2 = new DataTable();
            //        dt2 = dba.GetDataTable(queryPayment);
            //        if (dt != null)
            //        {
            //            pnlRpt.Visible = true;
            //            ReportDocument rdoc = new ReportDocument();
            //            rdoc.Load(Server.MapPath(rptfile));
            //           // rdoc.Subreports[0].SetDataSource(dt1);
            //            rdoc.Subreports[0].SetDataSource(dt1);
            //          //  rdoc.Subreports[1].SetDataSource(dt2);
            //            rdoc.SetDataSource(dt);
            //            CrystalReportViewer1.ReportSource = rdoc;
            //            Session["RPT"] = rdoc;
            //            CrystalReportViewer1.HasToggleGroupTreeButton = false;
            //            CrystalReportViewer1.HasToggleParameterPanelButton = false;
            //            CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
            //            CrystalReportViewer1.HasDrilldownTabs = true;
            //            CrystalReportViewer1.HasPrintButton = true;
            //            // CrystalReportViewer1.EnableDatabaseLogonPrompt = false;
            //            CrystalReportViewer1.DataBind();
            //        }
            //        else
            //        {
            //            pnlRpt.Visible = false;

            //        }
            //    }
            //    catch (Exception ex)
            //    { throw ex; }
            //}

            else if (rdbtnvalue == "DealerWiseSalesSummary")
            {
                rptfile = "DealerWiseSalesSummaryReport.rpt";

                try
                {
                    String    query        = "EXEC Get_Dealer_Sales_Summary_Report '" + vareaID + "','" + vpartyID + "'";
                    String    queryInvoice = "EXEC Get_Invoice_details_Report '','','','','Y','',''";
                    String    queryPayment = "EXEC Get_MoneyReceipt_details_Report '','','','',''";
                    DataTable dt           = new DataTable();
                    dt = dba.GetDataTable(query);
                    DataTable dt1 = new DataTable();
                    dt1 = dba.GetDataTable(queryInvoice);
                    DataTable dt2 = new DataTable();
                    dt2 = dba.GetDataTable(queryPayment);
                    if (dt != null)
                    {
                        pnlRpt.Visible = true;
                        ReportDocument rdoc = new ReportDocument();
                        rdoc.Load(Server.MapPath(rptfile));
                        // rdoc.Subreports[0].SetDataSource(dt1);
                        rdoc.Subreports[0].SetDataSource(dt1);
                        rdoc.Subreports[1].SetDataSource(dt2);
                        rdoc.SetDataSource(dt);
                        CrystalReportViewer1.ReportSource = rdoc;
                        Session["RPT"] = rdoc;
                        CrystalReportViewer1.HasToggleGroupTreeButton      = false;
                        CrystalReportViewer1.HasToggleParameterPanelButton = false;
                        CrystalReportViewer1.ToolPanelView    = ToolPanelViewType.None;
                        CrystalReportViewer1.HasDrilldownTabs = true;
                        CrystalReportViewer1.HasPrintButton   = true;
                        // CrystalReportViewer1.EnableDatabaseLogonPrompt = false;
                        CrystalReportViewer1.DataBind();
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }

            else if (rdbtnvalue == "MoneyReceipt")
            {
                // rptfile = "AllMoneyReceiptDetailsReport.rpt";
                if (vID == "" && vpartyID == "")
                {
                    rptfile = "Reports/AllMoneyReceiptDetailsReport.rpt";
                }
                else
                {
                    rptfile = "Reports/DealerWiseMoneyReceipt.rpt";
                }
                try
                {
                    String    query = "EXEC Get_MoneyReceipt_details_Report '" + vID + "','" + vareaID + "','" + vpartyID + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }

            else if (rdbtnvalue == "DealerWiseAccountStatement")
            {
                if (!string.IsNullOrEmpty(vpartyID))

                {
                    rptfile = "AccountStatementsByDealer.rpt";

                    try
                    {
                        String    query = "EXEC Get_AccountSatatment_Report_ByDealer '" + vpartyID + "','" + vFromDate + "','" + vToDate + "'";
                        DataTable dt    = new DataTable();
                        dt = dba.GetDataTable(query);
                        if (dt != null)
                        {
                            ShowReportViewer(dt, rptfile);
                        }
                        else
                        {
                            pnlRpt.Visible = false;
                        }
                    }
                    catch (Exception ex)
                    { throw ex; }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "Save", "alert('Please select Dealer and then try again...');", true);
                }
            }
            else if (rdbtnvalue == "AreaWiseAccountStatement")
            {
                if (!string.IsNullOrEmpty(vareaID))
                {
                    rptfile = "AccountStatementsByArea.rpt";
                }
                else
                {
                    rptfile = "AccountStatementsByAreaAll.rpt";
                }


                try
                {
                    String    query = "EXEC Get_AccountSatatment_Report_ByArea '" + vareaID + "','" + vFromDate + "','" + vToDate + "'";
                    DataTable dt    = new DataTable();
                    dt = dba.GetDataTable(query);
                    if (dt != null)
                    {
                        ShowReportViewer(dt, rptfile);
                    }
                    else
                    {
                        pnlRpt.Visible = false;
                    }
                }
                catch (Exception ex)
                { throw ex; }
            }
            else if (rdbtnvalue == "DealerWiseProductGroupAccountStatement")
            {
                if (!string.IsNullOrEmpty(vpartyID) && !string.IsNullOrEmpty(vProductGroupID))

                {
                    rptfile = "AccountStatementsByProductGroup.rpt";
                    try
                    {
                        String    query = "EXEC Get_AccountSatatment_Report_ByProductGroupID '" + vpartyID + "','" + vProductGroupID + "','" + vFromDate + "','" + vToDate + "'";
                        DataTable dt    = new DataTable();
                        dt = dba.GetDataTable(query);
                        if (dt != null)
                        {
                            ShowReportViewer(dt, rptfile);
                        }
                        else
                        {
                            pnlRpt.Visible = false;
                        }
                    }
                    catch (Exception ex)
                    { throw ex; }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "Save", "alert('Please select Dealer and Product Group then try again...');", true);
                }
            }
        }
Exemplo n.º 32
0
 private string ExportarPDF()
 {
     try
     {
         DsReporteControlRedespacho ds = new DsReporteControlRedespacho();
         if (Session["DsReporte"] != null)
         {
             ds = (DsReporteControlRedespacho)Session["DsReporte"];
         }
         if (ds.Datos.Count > 0)
         {
             DsReporteControlRedespacho.VisualizarRow dr = ds.Visualizar.NewVisualizarRow();
             if (chkFlete.Checked)
             {
                 dr.Flete = 1;
             }
             else
             {
                 dr.Flete = 0;
             }
             if (chkRetiro.Checked)
             {
                 dr.Retiro = 1;
             }
             else
             {
                 dr.Retiro = 0;
             }
             if (chkEntrega.Checked)
             {
                 dr.Entrega = 1;
             }
             else
             {
                 dr.Entrega = 0;
             }
             if (chkSeguro.Checked)
             {
                 dr.Seguro = 1;
             }
             else
             {
                 dr.Seguro = 0;
             }
             if (chkIva.Checked)
             {
                 dr.Iva = 1;
             }
             else
             {
                 dr.Iva = 0;
             }
             if (chkTotal.Checked)
             {
                 dr.Total = 1;
             }
             else
             {
                 dr.Total = 0;
             }
             if (chkConvenio.Checked)
             {
                 dr.Convenio = 1;
             }
             else
             {
                 dr.Convenio = 0;
             }
             if (chkDiferencia.Checked)
             {
                 dr.Diferencia = 1;
             }
             else
             {
                 dr.Diferencia = 0;
             }
             dr.FletC      = "Flete Factura";
             dr.FletF      = "Flete Guía";
             dr.RetC       = "Retiro Factura";
             dr.RetF       = "Retiro Guía";
             dr.EntC       = "Entrega Factura";
             dr.EntF       = "Entrega Guía";
             dr.SegC       = "Seguro Factura";
             dr.SegF       = "Seguro Guía";
             dr.IvC        = "Iva Factura";
             dr.IvF        = "Iva Guía";
             dr.ImpTotalC  = "Total Factura";
             dr.ImpTotalF  = "Total Guía";
             dr.TarifaCon  = "Importe Convenio";
             dr.ImporteDif = "Diferencia";
             ds.Visualizar.AddVisualizarRow(dr);
             ReportDocument             oRD = new ReportDocument();
             ExportOptions              oExO;
             DiskFileDestinationOptions oExDo = new DiskFileDestinationOptions();
             string nombArchi  = "ReporteControlRedespacho.pdf";
             string sNombrePDF = Server.MapPath(".") + "/ReportesPDF/" + nombArchi;
             if (System.IO.File.Exists(sNombrePDF))
             {
                 System.IO.File.Delete(sNombrePDF);
             }
             oRD.Load(Server.MapPath("." + "/Reportes/ReporteControlRedespacho.rpt"));
             oRD.SetDataSource(ds);                    //cotizacionesDS
             oExDo.DiskFileName = sNombrePDF;
             oExO = oRD.ExportOptions;
             oExO.ExportDestinationType = ExportDestinationType.DiskFile;
             oExO.ExportFormatType      = ExportFormatType.PortableDocFormat;
             oExO.DestinationOptions    = oExDo;
             oRD.Export();
             oRD.Close();
             oRD.Dispose();
             return(nombArchi);
         }
         else
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["ReportData"] != null)
            {
                string rptFullPath = Server.MapPath(@"..\Reports\RptFiles\MD_Prio_cost\rptIntersectMaintenancePriority.rpt");


                DataTable      dt  = (DataTable)Session["ReportData"];
                ReportDocument rpt = new ReportDocument();

                rpt.Load(rptFullPath);
                rpt.SetDataSource(dt);

                Session.Remove("ReportData");

                Stream memStream;
                Response.Buffer = false;
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();

                if (Request.QueryString["type"] == "x")
                {
                    ExcelFormatOptions excelOptions = new ExcelFormatOptions();
                    excelOptions.ExcelUseConstantColumnWidth = false;
                    rpt.ExportOptions.FormatOptions          = excelOptions;

                    memStream            = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord);
                    Response.ContentType = "application/vnd.ms-excel";
                }
                else if (Request.QueryString["type"] == "w")
                {
                    memStream            = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows);
                    Response.ContentType = "application/doc";
                }
                else
                {
                    memStream            = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                    Response.ContentType = "application/pdf";
                    //memStream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows);
                    //Response.ContentType = "application/msword";
                }


                byte[] ArryStream = new byte[memStream.Length + 1];
                memStream.Read(ArryStream, 0, System.Convert.ToInt32(memStream.Length));
                Response.BinaryWrite(ArryStream);
                Response.End();

                memStream.Flush();
                memStream.Close();
                memStream.Dispose();
                rpt.Close();
                rpt.Dispose();
                GC.Collect();
            }
            else
            {
                Response.Redirect("IntersectMaintenancePriorities.aspx", false);
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            Session["ReportData"] = null;
        }
    }
        //public ActionResult ProjectCompletionReport(int Id)
        //{

        //    ReportDocument rd = new ReportDocument();
        //    rd.Load(Path.Combine(Server.MapPath("~/Reports"), "ProjectCompletion.rpt"));

        //    DataSet ds = new DataSet();
        //    ds.Tables.Add("Head");

        //    //-------HEAD
        //    ds.Tables["Head"].Columns.Add("ProjectCompletionRefNo");
        //    ds.Tables["Head"].Columns.Add("ProjectCompletionDate");
        //    ds.Tables["Head"].Columns.Add("ProjectName");
        //    ds.Tables["Head"].Columns.Add("SaleOrderRefNo");
        //    ds.Tables["Head"].Columns.Add("SaleOrderDate");
        //    ds.Tables["Head"].Columns.Add("CustomerName");

        //    ds.Tables["Head"].Columns.Add("ChillerTemperature");
        //    ds.Tables["Head"].Columns.Add("ChillerDimension");
        //    ds.Tables["Head"].Columns.Add("ChillerCondensingUnit");
        //    ds.Tables["Head"].Columns.Add("ChillerEvaporator");
        //    ds.Tables["Head"].Columns.Add("ChillerRefrigerant");
        //    ds.Tables["Head"].Columns.Add("ChillerQuantity");

        //    ds.Tables["Head"].Columns.Add("RoomDetails");
        //    ds.Tables["Head"].Columns.Add("FreezerTemperature");
        //    ds.Tables["Head"].Columns.Add("FreezerDimension");
        //    ds.Tables["Head"].Columns.Add("FreezerCondensingUnit");
        //    ds.Tables["Head"].Columns.Add("FreezerEvaporator");
        //    ds.Tables["Head"].Columns.Add("FreezerRefrigerant");
        //    ds.Tables["Head"].Columns.Add("FreezerQuantity");

        //    //Organization
        //    ds.Tables["Head"].Columns.Add("DoorNo");
        //    ds.Tables["Head"].Columns.Add("Street");
        //    ds.Tables["Head"].Columns.Add("State");
        //    ds.Tables["Head"].Columns.Add("Country");
        //    ds.Tables["Head"].Columns.Add("Phone");
        //    ds.Tables["Head"].Columns.Add("Fax");
        //    ds.Tables["Head"].Columns.Add("Email");
        //    ds.Tables["Head"].Columns.Add("ContactPerson");
        //    ds.Tables["Head"].Columns.Add("Zip");
        //    ds.Tables["Head"].Columns.Add("OrganizationName");
        //    ds.Tables["Head"].Columns.Add("Image1");
        //    ds.Tables["Head"].Columns.Add("CreatedUser");
        //    ds.Tables["Head"].Columns.Add("CreateSignature");
        //    ds.Tables["Head"].Columns.Add("CreatedDes");
        //    ds.Tables["Head"].Columns.Add("SerialNo");

        //    ProjectCompletionRepository repo = new ProjectCompletionRepository();
        //    var Head = repo.GetProjectCompletionHD(Id, OrganizationId);

        //    DataRow dr = ds.Tables["Head"].NewRow();
        //    dr["ProjectCompletionRefNo"] = Head.ProjectCompletionRefNo;
        //    dr["ProjectCompletionDate"] = Head.ProjectCompletionDate.ToString("dd-MMM-yyyy");
        //    dr["ProjectName"] = Head.ProjectName;
        //    dr["SaleOrderRefNo"] = Head.SaleOrderRefNo;
        //    dr["SaleOrderDate"] = Head.SaleOrderDate;
        //    dr["CustomerName"] = Head.CustomerName;

        //    dr["ChillerTemperature"] = Head.ChillerTemperature;
        //    dr["ChillerDimension"] = Head.ChillerDimension;
        //    dr["ChillerCondensingUnit"] = Head.ChillerDimension;
        //    dr["ChillerEvaporator"] = Head.ChillerEvaporator;
        //    dr["ChillerRefrigerant"] = Head.ChillerRefrigerant;
        //    dr["ChillerQuantity"] = Head.ChillerQuantity;

        //    dr["RoomDetails"] = Head.RoomDetails;
        //    dr["FreezerTemperature"] = Head.FreezerTemperature;
        //    dr["FreezerDimension"] = Head.FreezerDimension;
        //    dr["FreezerCondensingUnit"] = Head.FreezerCondensingUnit;
        //    dr["FreezerEvaporator"] = Head.FreezerEvaporator;
        //    dr["FreezerRefrigerant"] = Head.FreezerRefrigerant;
        //    dr["FreezerQuantity"] = Head.FreezerQuantity;

        //    dr["DoorNo"] = Head.DoorNo;
        //    dr["Street"] = Head.Street;
        //    dr["State"] = Head.State;
        //    dr["Country"] = Head.CountryName;
        //    dr["Phone"] = Head.Phone;
        //    dr["Fax"] = Head.Fax;
        //    dr["Email"] = Head.Email;
        //    dr["ContactPerson"] = Head.ContactPerson;
        //    dr["Zip"] = Head.Zip;
        //    dr["OrganizationName"] = Head.OrganizationName;
        //    dr["Image1"] = Server.MapPath("~/App_images/") + Head.Image1;
        //    dr["CreatedUser"] = Head.CreatedUser;
        //    dr["CreateSignature"] = Server.MapPath("~/App_Images/") + Head.CreatedUsersig;
        //    dr["CreatedDes"] = Head.CreatedDes;
        //    dr["SerialNo"] = Head.CreatedDes;
        //    ds.Tables["Head"].Rows.Add(dr);


        //    ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "ProjectCompletion.xml"), XmlWriteMode.WriteSchema);

        //    rd.SetDataSource(ds);

        //    Response.Buffer = false;
        //    Response.ClearContent();
        //    Response.ClearHeaders();


        //    try
        //    {
        //        Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        //        stream.Seek(0, SeekOrigin.Begin);
        //        return File(stream, "application/pdf");
        //    }
        //    catch (Exception ex)
        //    {
        //        throw;
        //    }
        //}

        public ActionResult ProjectCompletionReport(int Id)
        {
            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "ProjectCommissioning.rpt"));

            DataSet ds = new DataSet();

            ds.Tables.Add("Head");
            ds.Tables.Add("Item");

            //-------HEAD
            ds.Tables["Head"].Columns.Add("ProjectCompletionRefNo");
            ds.Tables["Head"].Columns.Add("ProjectCompletionDate");
            ds.Tables["Head"].Columns.Add("ProjectName");
            ds.Tables["Head"].Columns.Add("SaleOrderRefNo");
            ds.Tables["Head"].Columns.Add("SaleOrderDate");
            ds.Tables["Head"].Columns.Add("CustomerName");

            ds.Tables["Head"].Columns.Add("ChillerTemperature");
            ds.Tables["Head"].Columns.Add("ChillerDimension");
            ds.Tables["Head"].Columns.Add("ChillerCondensingUnit");
            ds.Tables["Head"].Columns.Add("ChillerEvaporator");
            ds.Tables["Head"].Columns.Add("ChillerRefrigerant");
            ds.Tables["Head"].Columns.Add("ChillerQuantity");


            //Organization
            ds.Tables["Head"].Columns.Add("DoorNo");
            ds.Tables["Head"].Columns.Add("Street");
            ds.Tables["Head"].Columns.Add("State");
            ds.Tables["Head"].Columns.Add("Country");
            ds.Tables["Head"].Columns.Add("Phone");
            ds.Tables["Head"].Columns.Add("Fax");
            ds.Tables["Head"].Columns.Add("Email");
            ds.Tables["Head"].Columns.Add("ContactPerson");
            ds.Tables["Head"].Columns.Add("Zip");
            ds.Tables["Head"].Columns.Add("OrganizationName");
            ds.Tables["Head"].Columns.Add("Image1");
            ds.Tables["Head"].Columns.Add("CreatedUser");
            ds.Tables["Head"].Columns.Add("CreateSignature");
            ds.Tables["Head"].Columns.Add("CreatedDes");

            //-------DT
            ds.Tables["Item"].Columns.Add("RoomDetails");
            ds.Tables["Item"].Columns.Add("FreezerTemperature");
            ds.Tables["Item"].Columns.Add("FreezerDimension");
            ds.Tables["Item"].Columns.Add("FreezerCondensingUnit");
            ds.Tables["Item"].Columns.Add("FreezerEvaporator");
            ds.Tables["Item"].Columns.Add("FreezerRefrigerant");
            ds.Tables["Item"].Columns.Add("FreezerQuantity");
            ds.Tables["Item"].Columns.Add("SerialNo");


            ProjectCompletionRepository repo = new ProjectCompletionRepository();
            var Head = repo.GetProjectCompletionHD(Id, OrganizationId);

            DataRow dr = ds.Tables["Head"].NewRow();

            dr["ProjectCompletionRefNo"] = Head.ProjectCompletionRefNo;
            dr["ProjectCompletionDate"]  = Head.ProjectCompletionDate.ToString("dd-MMM-yyyy");
            dr["ProjectName"]            = Head.ProjectName;
            dr["SaleOrderRefNo"]         = Head.SaleOrderRefNo;
            dr["SaleOrderDate"]          = Head.SaleOrderDate;
            dr["CustomerName"]           = Head.CustomerName;

            dr["ChillerTemperature"]    = Head.ChillerTemperature;
            dr["ChillerDimension"]      = Head.ChillerDimension;
            dr["ChillerCondensingUnit"] = Head.ChillerDimension;
            dr["ChillerEvaporator"]     = Head.ChillerEvaporator;
            dr["ChillerRefrigerant"]    = Head.ChillerRefrigerant;
            dr["ChillerQuantity"]       = Head.ChillerQuantity;

            dr["DoorNo"]           = Head.DoorNo;
            dr["Street"]           = Head.Street;
            dr["State"]            = Head.State;
            dr["Country"]          = Head.CountryName;
            dr["Phone"]            = Head.Phone;
            dr["Fax"]              = Head.Fax;
            dr["Email"]            = Head.Email;
            dr["ContactPerson"]    = Head.ContactPerson;
            dr["Zip"]              = Head.Zip;
            dr["OrganizationName"] = Head.OrganizationName;
            dr["Image1"]           = Server.MapPath("~/App_images/") + Head.Image1;
            dr["CreatedUser"]      = Head.CreatedUser;
            dr["CreateSignature"]  = Server.MapPath("~/App_Images/") + Head.CreatedUsersig;
            dr["CreatedDes"]       = Head.CreatedDes;
            ds.Tables["Head"].Rows.Add(dr);

            ProjectCompletionRepository repo1 = new ProjectCompletionRepository();
            var Items = repo1.GetProjectCompletionDT(Id, OrganizationId);

            foreach (var item in Items)
            {
                DataRow dri = ds.Tables["Item"].NewRow();
                dri["RoomDetails"]           = item.RoomDetails;
                dri["FreezerTemperature"]    = item.FreezerTemperature;
                dri["FreezerDimension"]      = item.FreezerDimension;
                dri["FreezerCondensingUnit"] = item.FreezerCondensingUnit;
                dri["FreezerEvaporator"]     = item.FreezerEvaporator;
                dri["FreezerRefrigerant"]    = item.FreezerRefrigerant;
                dri["FreezerQuantity"]       = item.FreezerQuantity;
                dri["SerialNo"] = item.SerialNo;
                ds.Tables["Item"].Rows.Add(dri);
            }

            ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "ProjectCommissioning.xml"), XmlWriteMode.WriteSchema);

            rd.SetDataSource(ds);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder sbFilter             = new StringBuilder();
        string        strPortfolioAsOnDate = "";
        string        fundCodes            = "";

        //string companyCodes = "";
        //string percentageCheck = "";

        if (Session["UserID"] == null)
        {
            Session.RemoveAll();
            Response.Redirect("../../Default.aspx");
        }
        else
        {
            strPortfolioAsOnDate = (string)Session["PortfolioAsOnDate"];
            fundCodes            = (string)Session["fundCodes"];
        }
        DataTable     dtReprtSource = new DataTable();
        StringBuilder sbMst         = new StringBuilder();
        StringBuilder sbfilter      = new StringBuilder();

        strSQL = "select u.f_cd, u.fund_name,u.bal_dt_ctrl,u.TOTAL_COMPANY_PROFIT,u.TOTAL_SHARE_PROFIT,u.TOTAL_COST_PROFIT,u.TOTAL_MARKET_PRICE_PROFIT,u.PROFIT,u.tp_PROFIT," +
                 " v.TOTAL_COMPANY_LOSS,v.TOTAL_SHARE_LOSS,v.TOTAL_COST_LOSS,v.TOTAL_MARKET_PRICE_LOSS,v.LOSS,v.tp_LOSS from " +
                 "(select p.f_cd , f.f_name fund_name,TO_CHAR(bal_dt_ctrl,'dd-MON-yyyy')bal_dt_ctrl,COUNT(p.COMP_CD)TOTAL_COMPANY_PROFIT, sum(trunc(p.tot_nos)) TOTAL_SHARE_PROFIT," +
                 "sum(p.tcst_aft_com) TOTAL_COST_PROFIT, sum(p.tot_nos * c.adc_rt) TOTAL_MARKET_PRICE_PROFIT, sum(p.tot_nos * c.adc_rt) - sum(p.tcst_aft_com)PROFIT," +
                 "decode(sum(trunc(p.tot_nos)), 0, 'noneed', 'PROFIT') tp_PROFIT from pfolio_bk p, comp c, fund f " +
                 " where p.bal_dt_ctrl ='" + strPortfolioAsOnDate.ToString() + "' and f.F_CD IN(" + fundCodes + ") and f.f_cd not in(3,5,18) and p.comp_cd = c.comp_cd " +
                 " and(round(p.adc_rt, 2) - trunc(p.tcst_aft_com / tot_nos, 2)) * trunc(tot_nos) >= 0 and p.f_cd = f.f_cd " +
                 " group by p.f_cd, bal_dt_ctrl,f.f_name)u," +
                 " (select p.f_cd ,f.f_name,TO_CHAR(bal_dt_ctrl,'dd-MON-yyyy')bal_dt_ctrl,COUNT(p.COMP_CD) TOTAL_COMPANY_LOSS, sum(trunc(p.tot_nos)) TOTAL_SHARE_LOSS, sum(p.tcst_aft_com) TOTAL_COST_LOSS," +
                 " sum(p.tot_nos * c.adc_rt) TOTAL_MARKET_PRICE_LOSS, sum(p.tot_nos * c.adc_rt) - sum(p.tcst_aft_com) LOSS," +
                 " decode(sum(trunc(p.tot_nos)), 0, 'noneed', 'LOSS') tp_LOSS" +
                 " from  pfolio_bk p, comp c ,fund f where p.bal_dt_ctrl ='" + strPortfolioAsOnDate.ToString() + "' and f.F_CD IN(" + fundCodes + ") and f.f_cd not in(3,5,18)" +
                 " and p.comp_cd = c.comp_cd and(round(p.adc_rt, 2) - trunc(p.tcst_aft_com / tot_nos, 2)) * trunc(tot_nos) < 0 " +
                 " and p.f_cd = f.f_cd group by p.f_cd, bal_dt_ctrl, f.f_name)v" +
                 " where u.f_cd=v.f_cd order by u.f_cd";

        //strSQL = "select p.f_cd , f.f_name fund_name,bal_dt_ctrl,COUNT(p.COMP_CD)TOTAL_COMPANY, sum(trunc(p.tot_nos)) TOTAL_SHARE," +
        //           "sum(p.tcst_aft_com) TOTAL_COST, sum(p.tot_nos * c.adc_rt) TOTAL_MARKET_PRICE, sum(p.tot_nos * c.adc_rt) - sum(p.tcst_aft_com)  EROSION," +
        //           "decode(sum(trunc(p.tot_nos)), 0, 'noneed', 'PROFIT') tp from pfolio_bk p, comp c, fund f " +
        //           " where p.bal_dt_ctrl ='" + strPortfolioAsOnDate.ToString() + "' and f.F_CD IN(" + fundCodes + ") and f.f_cd not in(3,5,18) and p.comp_cd = c.comp_cd " +
        //           " and(round(p.adc_rt, 2) - trunc(p.tcst_aft_com / tot_nos, 2)) * trunc(tot_nos) >= 0 and p.f_cd = f.f_cd " +
        //           " group by p.f_cd, bal_dt_ctrl,f.f_name " +
        //           " union" +
        //           " select p.f_cd ,f.f_name,bal_dt_ctrl,COUNT(p.COMP_CD) TOTAL_COMPANY, sum(trunc(p.tot_nos)) TOTAL_SHARE, sum(p.tcst_aft_com) TOTAL_COST," +
        //           " sum(p.tot_nos * c.adc_rt) TOTAL_MARKET_PRICE, sum(p.tot_nos * c.adc_rt) - sum(p.tcst_aft_com) EROSION," +
        //           " decode(sum(trunc(p.tot_nos)), 0, 'noneed', 'LOSS') tp" +
        //           " from  pfolio_bk p, comp c ,fund f where p.bal_dt_ctrl ='" + strPortfolioAsOnDate.ToString() + "' and f.F_CD IN(" + fundCodes + ") and f.f_cd not in(3,5,18)" +
        //           " and p.comp_cd = c.comp_cd and(round(p.adc_rt, 2) - trunc(p.tcst_aft_com / tot_nos, 2)) * trunc(tot_nos) < 0 " +
        //           " and p.f_cd = f.f_cd group by p.f_cd, bal_dt_ctrl, f.f_name order by(9) desc";


        dtReprtSource           = commonGatewayObj.Select(strSQL);
        dtReprtSource.TableName = "MarketValiationWithProfitLoss";
        // dtReprtSource.WriteXmlSchema(@"E:\amclpmfs\UI\ReportViewer\Report\xsdMarketValuationWithProfitLoss.xsd");
        if (dtReprtSource.Rows.Count > 0)
        {
            string Path = Server.MapPath("Report/crptMarketValuationWithProfitLossReport.rpt");
            rdoc.Load(Path);
            rdoc.SetDataSource(dtReprtSource);
            CRV_MarketValiationWithProfitLossReportViewer.ReportSource = rdoc;
            //rdoc.SetParameterValue("prmtransactionDate", tranDate);
            rdoc = ReportFactory.GetReport(rdoc.GetType());
        }
        else
        {
            Response.Write("No Data Found");
        }
    }
Exemplo n.º 36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            try
            {
                string         mExportFileName = string.Empty;
                DataTable      dt          = GetPrintData(id);
                ReportDocument rptdoc_head = new ReportDocument();

                if (dt.Rows.Count > 0)
                {
                    // 蹲郎砞﹚
                    rptdoc_head.Load(Server.MapPath("") + @"\rpt\FixedAassetsInfo.rpt");
                    mExportFileName = ConfigurationSettings.AppSettings["reportPath"] + "PrintBarcodeHead_" + "_" + Session.SessionID + ".pdf";

                    rptdoc_head.SetDataSource(dt);

                    // 砞﹚蹲隔畖の郎
                    DiskFileDestinationOptions df = new DiskFileDestinationOptions();
                    df.DiskFileName = mExportFileName;
                    rptdoc_head.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
                    rptdoc_head.ExportOptions.ExportFormatType      = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
                    rptdoc_head.ExportOptions.DestinationOptions    = df;
                    string strIP      = Request.ServerVariables["LOCAL_ADDR"].ToString();
                    string ReportPath = "http://" + strIP + Request.ApplicationPath + "Print/pdf/PrintBarcodeHead_" + "_" + Session.SessionID + ".pdf";
                    //诀嘿
                    string strPrinter = "";

                    try
                    {
                        rptdoc_head.PrintOptions.PrinterName = strPrinter;
                        rptdoc_head.PrintToPrinter(1, true, 0, 0);
                        rptdoc_head.Dispose();
                        Response.Write("<script>window.close();</script>");
                    }
                    catch
                    {
                        rptdoc_head.Export();
                        rptdoc_head.Dispose();
                        Response.Write("<script>window.open('" + ReportPath + "','_blank','resizable,scrollbars=no,menubar=no,toolbar=no,location=no,status=no',false);</script> ");
                    }
                }



                #region 
                DateTime dtTime = DateTime.Now;
                dtTime = dtTime.AddHours(-1);
                DirectoryInfo di = new DirectoryInfo(ConfigurationSettings.AppSettings["reportPath"]);
                if (di != null)
                {
                    foreach (FileSystemInfo fsi in di.GetFiles())
                    {
                        if (fsi.CreationTime < dtTime)
                        {
                            fsi.Delete();
                        }
                    }
                }
                #endregion
            }
            catch (Exception E)
            {
                throw E;
            }
        }
        public void GenerateReport(string parameter)
        {
            try
            {
                ReportDocument objReport1 = new ReportDocument();

                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();

                TableLogOnInfo ConInfo = new TableLogOnInfo();

                ConnectionInfo crConnectionInfo = new ConnectionInfo();

                Tables CrTables;

                ParameterFieldDefinitions crParameterFieldDefinitions;

                ParameterFieldDefinition crParameterFieldDefinition;

                ParameterValues crParameterValues = new ParameterValues();

                ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

                if (File.Exists(_path + _reportName_Outside))
                {
                    objReport1.Load(_path + _reportName_Outside);
                }
                else
                {
                    objReport1.Load(ClsConfig.LotCardPCSReportPath_Trial + _reportName_Outside);
                }

                crParameterDiscreteValue.Value = parameter;
                crParameterFieldDefinitions    = objReport1.DataDefinition.ParameterFields;
                crParameterFieldDefinition     = crParameterFieldDefinitions["@LotCardGroupNo"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                string sUserID       = ClsConfig.ReportUser;
                string sPassword     = ClsConfig.ReportPassword_BarcodeDB;
                string sServerName   = ClsConfig.ReportServer_BarcodeDB;
                string sDatabaseName = ClsConfig.ReportDatabase_BarcodeDB;


                crConnectionInfo.ServerName   = sServerName;
                crConnectionInfo.DatabaseName = sDatabaseName;
                crConnectionInfo.UserID       = sUserID;
                crConnectionInfo.Password     = sPassword;

                CrTables = objReport1.Database.Tables;

                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    ConInfo = CrTable.LogOnInfo;
                    ConInfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(ConInfo);
                }

                docA = objReport1;

                reportViewer.ViewerCore.ReportSource = docA;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }