Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-05-2007, 07:34 PM
js js is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Default Crystal Reports with SWFkit (and FreeReport)

hi there ;D

i want to create a program for a shop of garment.
i that program i will use Access database

please tell me how can i print the SALE REPORT, PURCHASE REPORT , TOTAL USERS AND BALACESHEET etc.

how to connect or use the crystal reports with swfkit
???
thankx
Reply With Quote
  #2 (permalink)  
Old 08-06-2007, 05:29 PM
js js is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Default Re:Crystal Reports with SWFkit

any one

is it possible or not
Reply With Quote
  #3 (permalink)  
Old 08-07-2007, 08:57 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Crystal Reports with SWFkit

Yes, you can use crystal reports in swfkit. But you must first apply the following patch for swfkit pro before you can do that, because the current version of swfkit pro cannot handle IUnknown interface properly.

http://www.swfkit.com/download/swfkit/propatch.zip

To apply the patch, you must unpack the downloaded zip file into the data sub folder of the directory that swfkit pro has been installed into. The typical path is c:\program files\swfkit pro 3\data

To use crystal reports in swfkit, please follow the following steps

1) create a crystal report by using the report designer

2) embed the crystal report viewer acitvex control in your main movie, or a form.

Code:
// first creates a crystal report viewer in the main movie
var viewer = createControl("CRViewer9.CRViewer", 0, 0, 800, 540);
3) create a crystal report object, and set data source for it
Code:
// creates a crystal report application object and opens the report template
var rapp = new ActiveXObject("CrystalRuntime.Application");
var report = rapp.openReport(getAdditionalFile("Report1.rpt"));

// prepares data source for the crystal report object
var conn_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + getAdditionalFile("student.mdb");
var conn = new ActiveXObject("ADODB.Connection");
conn.open(conn_string);

var record = new ActiveXObject("ADODB.Recordset");
record.Open("select id,name,age,sex,score from student", conn, 1, 2);

// sets data source for the crystal report
report.database.setDataSource(record);
report.readRecords();
4) preview the report in the report viewer
Code:
report.reportTitle = "My sample report";

// previews the crystal report
viewer.activex.reportSource = report;
viewer.activex.displayToolbar = false;
viewer.activex.displayGroupTree = false;
viewer.activex.viewReport();
5) distribute your project
You must distribute the crystal report viewer activex control (crviewer9.dll) and the crtstal report runtime activex component(craxdrt9.dll) with your final exe file. As the two dlls are activex components, you must register them in your exe file. For more details about activex registering, please read the following tutorial
http://www.swfkit.com/swfkit/doc/manual/node28.html

The following is the sample for using Crystal reports in swfkit. Before you can try it, you must have crsystal report 9 or above installed, as it does not include the crystal report runtime dlls.
http://www.swfkit.com/swfkit/samples...ort_sample.zip
Reply With Quote
  #4 (permalink)  
Old 08-07-2007, 09:44 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Crystal Reports with SWFkit

You can also use the FreeReport component to build reports in swfkit

The freereport component can be downloaded from our [u=http://www.swfkit.com/swfkit/download.html]download[/u] page. And the following is a freereport sample.
http://www.swfkit.com/swfkit/samples...ort_sample.zip

To use freereport in swfkit, please follow the following steps

1) use the "designer.exe" in the "freereport_sample.zip" to design a report. To get help of designing reports, please download documentation from the FreeReport site

As the FreeReport component is designed for Delphi, it uses VCL datasets to provide data for the report bands such as master data band, detail data band, etc. However, in swfkit there is no VCL datasets. To provide data for the report bands, we add abstract datasets for the FreeReport component. For instance, if you have added a "master data" band onto your report, it will show a dialog box, which contains a list of datasets, from "dataset0" to "dataset19". You can choose one of them, say "dataset0", as the data provider for the band. And you must specify different dataset for different band. After adding bands, you can add text field onto the band. If the text is not enclosed by "[]", it is static. Whereas if it enclosed by "[]", it is a variable name, and the "onGetValue" event handler will called by the FreeReport componet to set the value of the variable. For instance, on the "master data" band, we can add [id], [name], [age], [sex], [score] variables. And in the ffish script, we can handle the "onGetValue" event, and read data from database to set the values of the variables.

2) create a FreeReport component
Code:
var fr = new ActiveXObject("frObj.frReportObj");
3) prepares data for the FreeReport component
Code:
// prepares data source for the report
var conn_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + getAdditionalFile("student.mdb");
var conn = new ActiveXObject("ADODB.Connection");
conn.open(conn_string);

var record = new ActiveXObject("ADODB.Recordset");
record.Open("select id,name,age,sex,score from student", conn, 1, 2);
4) feed data to the FreeReport component by handling events
Code:
var pageCount = 1;

fr.onProgress = function (n) {
pageCount = n;
}

fr.onGetValue = function (name, out) {
trace(name);
switch (name) {
case "caption":
out.value = "My sample";
break;
case "PAGE#":
out.value = pageCount.toString();
break;
default:
// database fields, such as id, name, age, sex, score
out.value = record.fields[name].value.toString();
trace(out.value);
}
}


fr.onFirst = function (index) {
if (index == 0) {
record.moveFirst();
}
}

fr.onNext = function (index) {
if (index == 0) {
record.moveNext();
}
}

fr.onCheckEOF = function (index, eof) {
if (index == 0) {
eof.value = record.eof;
}
}
When the FreeReport component renders a band, it first fires the "onFirst" event to tell you that it needs data. The "index" parameter is the index of the dataset for the band. For instance, if "dataset0" for the "master data" band, the index will be 0. And then it fires the "onGetValue" event to get data for the variables on the band. After getting data, it fires the "onNext" event to tell you to prepare the next record. At last it fires the onCheckEOF event to see whether it reaches the end of the record set.

5) preview or print the report
Code:
fr.LoadFromFile(getAdditionalFile("Report1.frf"));
fr.title = "My sample report";
fr.prepareReport();
fr.showReport();
FreeReport component methods, properties and events:

// shows the report design window
function DesignReport();

ModalPreview: Boolean

// shows progress when preparing report
ShowProgress: Boolean

// title of the report
Title: String

// prepares report
function PrepareReport(): Boolean


function EditPreparedReport(PageIndex: Number)

// exports the prepared report to a disk file
// filter can be "htm", "rtf", "txt" or "csv"
function ExportTo(Filter: String; FileName: String);

// loads a report template
function LoadFromFile(FileName: String)

// loads a saved prepared report
function LoadPreparedReport(FileName: String)

// prints a prepared report
// pagenumbers can be in format "", "1-100", or "1-"
function PrintPreparedReport(PageNumbers: String; Copies: I4)

// saves a prepared report to a disk file
function SavePreparedReport(FileName: String)

// saves the report to a disk file
function SaveToFile(FileName: String)

// shows a prepared report
function ShowPreparedReport()

// shows a report
function ShowReport()

// print setup
function PrintSetup()
Reply With Quote
  #5 (permalink)  
Old 12-08-2007, 02:49 PM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default Re: Crystal Reports with SWFkit (and FreeReport)

Can somebody submit a sample with freereport where data is grouped (muliple bands?)

for example:

Category 1
item1
details ..
item2
details ..
item3
details ..
item4
details ..

Category 2
item5
details ..
item6
details ..

Category 3
item7
details ..
item8
details ..




I can't seem to find how to do that.
It works with crystal reports, but i 'ld rather use freereport


Reply With Quote
  #6 (permalink)  
Old 07-07-2010, 02:18 AM
Junior Member
 
Join Date: Jul 2010
Posts: 1
Default

Can somebody submit a sample with freereport where data is grouped (muliple bands?)

for example:

Category 1
item1
details ..
item2
details ..
item3
details ..
item4
details ..

Category 2
item5
details ..
item6
details ..

Category 3
item7
details ..
item8
details ..



i have some background in ths
__________________
[URL="http://www.ustvshow.info"]watch movie online streaming[/URL]
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:31 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.