IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Saving Report with Report Date in Name, FYI
Bill Sutton
post May 23 2019, 09:28 AM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 26-April 19
Member No.: 65756



Not sure if anyone is interested, but I wrote the following code, so that when you save a report to PDF, Excel, etc, you get a report Name like

Weekly Department Item Summary from 3-10-2019 to 3-16-2019.pdf

Just thought someone might be trying to do the same thing.

I suggested to FastReports that they add pre and post parameters, so you could pass a Save to Directory, and a Date or Department name into the FileName.

This is working well for me, so far.

Dim rptdir, outdir, mdate, mDate2 As String
Dim FileToCopy, NewCopy As String
Dim FReport As FastReport.Report
Me.Hide()
rptdir = SysInfo.GlbRptDir
outdir = SysInfo.GlbOutDir

FileToCopy = rptdir.ToString & "WeeklyDepartmentItemSummary.frx"
mdate = mToDateStr.Replace("/", "-")
mdate2 = mFromDateStr.Replace("/", "-")
NewCopy = outdir.ToString & "Weekly Department Item Summary from " & mDate2 & " to " & mdate & ".frx"

If System.IO.File.Exists(FileToCopy) = True Then
System.IO.File.Copy(FileToCopy, NewCopy)
End If

Me.Hide()

FReport = New FastReport.Report
Dim reportName As String = NewCopy
FReport.Load(reportName)
FReport.RegisterData(dsWeekDeptItemSummary)
FReport.SetParameterValue("prmConn", SysInfo.GlbConnString)
FReport.SetParameterValue("prmStoreNumber", SysInfo.GlbStoreNumber)
FReport.SetParameterValue("prmFromDate", mFromDateStr)
FReport.SetParameterValue("prmToDate", mToDateStr)
FReport.Prepare()
FReport.ShowPrepared()
Me.Show()
System.IO.File.Delete(NewCopy)


Bill Sutton
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Time is now: 25th June 2019 - 01:46 PM