|
|||
|
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 |
|
|||
|
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);
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();
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(); 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 |
|
|||
|
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");
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);
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;
}
}
5) preview or print the report Code:
fr.LoadFromFile(getAdditionalFile("Report1.frf"));
fr.title = "My sample report";
fr.prepareReport();
fr.showReport();
// 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() |
|
|||
|
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 |
|
|||
|
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] |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|