marioway
asked on
TQuery en Quickreport
Hi
I Have a problem I would likte to have solved ASAP.
I Have 4 databases
A.DB connected to B.DB by Factuurnummer
B.DB connected to C.DB by ArtikelID
D.DB connected to A.DB by factuurnummer
Quickreport: rbPageheader, rbColumnheader, QRGroup groupexpression: ArtikelID , rbDetail, rbSummary, rbPagefooter.
I can get the data from A, B and C in QRGroup and rbDetail, but I cannot get the data from D , this by using a query.
Can this be done, and which bands do I have to use, Datasource - dataset properties of the QR, and the structure of the query
thx
marioway
I Have a problem I would likte to have solved ASAP.
I Have 4 databases
A.DB connected to B.DB by Factuurnummer
B.DB connected to C.DB by ArtikelID
D.DB connected to A.DB by factuurnummer
Quickreport: rbPageheader, rbColumnheader, QRGroup groupexpression: ArtikelID , rbDetail, rbSummary, rbPagefooter.
I can get the data from A, B and C in QRGroup and rbDetail, but I cannot get the data from D , this by using a query.
Can this be done, and which bands do I have to use, Datasource - dataset properties of the QR, and the structure of the query
thx
marioway
I could try to help, but above explanation is not enough for me. If I try to create the tables in my opinion it would be very wrong and slow. So if you can share your tables and/or some Delphi code, i will try to help, otherwise this makes no sense at all ....
I could help on Paradox, InterBase / FireBird or MS Access database ....
ASKER
Hello ,
I'll give you the relevant fields and names of the databases, for an Invoice program I'm writing
A : Factuur.db: factuurnummer1 (string), factuurklant (string), factuurstraat(string),....
B: Factuurartikel.db: factnr (string), omschrijving (string), ArtikelID (integer),...
C: Artikelgebruik.db: ArtikelID (integer), gebruiksaanwijzing (string),...
D: BTWS.db: factuurnummer1 (string), bedragexclbtw (Float), bedraginclusiefbtw (Float), bedragbtw (Float)
What's happening: when I print an invoice, I get the data from these 4 databases
First I want the articles out of the Factuurartikel.db, and for each article the description of it out of the artikelgebruik.db, and then the totals of each TVA % at the bottom of the quickreport (these are in the BTWS.db, which is emptyed bij close the form = temporary database).
Query.text:= SELECT Factuur.Factuurnummer1, Factuur.Factuurnummer2, Factuur.Factuurklant, Factuur.Factuurstraat, Factuur.Factuurhuisnummer, Factuur.Factuurgemeente, Factuur.Factuurpostcode, Factuur.Factuurdatum, Factuur.Bedragbtw6, Factuur.Bedragtotaal, Factuur.Bedragexclbtw6, Factuur.Factuurbtwnummer, Factuur.Bedragbtw21, Factuur.Bedragexclbtw21, Factuur.Btw6, Factuur.Btw21, Factuur.Bedragtotaal6, Factuur.Bedragtotaal21, Factuur.Voldaan, Factuur.Btw0, Factuur.Btw1, Factuur.Btw12, Factuur.Bedragtotaal0, Factuur.Bedragtotaal1, Factuur.Bedragtotaal12, Factuur.Bedragbtw0, Factuur.Bedragbtw1, Factuur.Bedragbtw12, Factuur.Bedragexclbtw0, Factuur.Bedragexclbtw1, Factuur.Bedragexclbtw12, Factuur.Bedragtotaalexclbt w, Factuur.Jaar, Factuur.Kortingpercent, Factuur.KlantID, Factuur.Btwtotaal, Factuurartikel.Nummer, Factuurartikel.Nummer1, Factuurartikel.Omschrijvin g, Factuurartikel.Aantal, Factuurartikel.Code, Factuurartikel.Stukprijs, Factuurartikel.Btw, Factuurartikel.Prijsexclbt w, Factuurartikel.Prijsinclus iefbtw, Factuurartikel.Factnr, Factuurartikel.Datumverkoo p, Factuurartikel.KlantID, Factuurartikel.ArtikelID, Factuurartikel.Artikelgroe pID, Factuurartikel.Eenheidsmaa t, Artikelgebruik.Nummer, Artikelgebruik.ArtikelID, Artikelgebruik.Gebruiksaan wijzing, Artikelgebruik.Ikoon, Artikelgebruik.Artikelgroe pID, Btws.Btw, Btws.Bedragexclbtw, Btws.Bedragbtw, Btws.Bedraginclusiefbtw, Btws.Factuurnummer1
FROM "Factuur.DB" Factuur
INNER JOIN "factuurartikel.DB" Factuurartikel
ON (Factuur.Factuurnummer1 = Factuurartikel.Factnr)
INNER JOIN "BTWS.DB" Btws
ON (Factuur.Factuurnummer1 = Btws.Factuurnummer1)
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
WHERE (Factuur.Factuurnummer1 = :koppel)
// params[0].AsString:= Factuur.Factuurnummer1.Val ue
So, I need to print out: Articles out of het factuurartikel.db, and for each article, the description out of the Artikelgebruik.db
using QRGroup and rbdetail band. Groupexpression: ArtikelID. What I want now is the data for the different TVA% out of the BTWS.db and print this at the bottom of the report once and not for each article.
Hope You have enough information
thx
marioway
I'll give you the relevant fields and names of the databases, for an Invoice program I'm writing
A : Factuur.db: factuurnummer1 (string), factuurklant (string), factuurstraat(string),....
B: Factuurartikel.db: factnr (string), omschrijving (string), ArtikelID (integer),...
C: Artikelgebruik.db: ArtikelID (integer), gebruiksaanwijzing (string),...
D: BTWS.db: factuurnummer1 (string), bedragexclbtw (Float), bedraginclusiefbtw (Float), bedragbtw (Float)
What's happening: when I print an invoice, I get the data from these 4 databases
First I want the articles out of the Factuurartikel.db, and for each article the description of it out of the artikelgebruik.db, and then the totals of each TVA % at the bottom of the quickreport (these are in the BTWS.db, which is emptyed bij close the form = temporary database).
Query.text:= SELECT Factuur.Factuurnummer1, Factuur.Factuurnummer2, Factuur.Factuurklant, Factuur.Factuurstraat, Factuur.Factuurhuisnummer,
FROM "Factuur.DB" Factuur
INNER JOIN "factuurartikel.DB" Factuurartikel
ON (Factuur.Factuurnummer1 = Factuurartikel.Factnr)
INNER JOIN "BTWS.DB" Btws
ON (Factuur.Factuurnummer1 = Btws.Factuurnummer1)
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
WHERE (Factuur.Factuurnummer1 = :koppel)
// params[0].AsString:= Factuur.Factuurnummer1.Val
So, I need to print out: Articles out of het factuurartikel.db, and for each article, the description out of the Artikelgebruik.db
using QRGroup and rbdetail band. Groupexpression: ArtikelID. What I want now is the data for the different TVA% out of the BTWS.db and print this at the bottom of the report once and not for each article.
Hope You have enough information
thx
marioway
ASKER
Hi, I discovered another problem when I use that query: if in BTWS.db more then one record, I get in the quickreport 2 times the articles out of the factuurartikel.db and the Artikelgebruik.db. So I could use 2 query's
Query1: SELECT Factuur.Factuurnummer1, Factuur.Factuurnummer2, Factuur.Factuurklant, Factuur.Factuurstraat, Factuur.Factuurhuisnummer, Factuur.Factuurgemeente, Factuur.Factuurpostcode, Factuur.Factuurdatum, Factuur.Bedragbtw6, Factuur.Bedragtotaal, Factuur.Bedragexclbtw6, Factuur.Factuurbtwnummer, Factuur.Bedragbtw21, Factuur.Bedragexclbtw21, Factuur.Btw6, Factuur.Btw21, Factuur.Bedragtotaal6, Factuur.Bedragtotaal21, Factuur.Voldaan, Factuur.Btw0, Factuur.Btw1, Factuur.Btw12, Factuur.Bedragtotaal0, Factuur.Bedragtotaal1, Factuur.Bedragtotaal12, Factuur.Bedragbtw0, Factuur.Bedragbtw1, Factuur.Bedragbtw12, Factuur.Bedragexclbtw0, Factuur.Bedragexclbtw1, Factuur.Bedragexclbtw12, Factuur.Bedragtotaalexclbt w, Factuur.Jaar, Factuur.Kortingpercent, Factuur.KlantID, Factuur.Btwtotaal, Factuurartikel.Nummer, Factuurartikel.Nummer1, Factuurartikel.Omschrijvin g, Factuurartikel.Aantal, Factuurartikel.Code, Factuurartikel.Stukprijs, Factuurartikel.Btw, Factuurartikel.Prijsexclbt w, Factuurartikel.Prijsinclus iefbtw, Factuurartikel.Factnr, Factuurartikel.Datumverkoo p, Factuurartikel.KlantID, Factuurartikel.ArtikelID, Factuurartikel.Artikelgroe pID, Factuurartikel.Eenheidsmaa t, Artikelgebruik.Nummer, Artikelgebruik.ArtikelID, Artikelgebruik.Gebruiksaan wijzing, Artikelgebruik.Ikoon, Artikelgebruik.Artikelgroe pID
FROM "Factuur.DB" Factuur
INNER JOIN "factuurartikel.DB" Factuurartikel
ON (Factuur.Factuurnummer1 = Factuurartikel.Factnr)
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
WHERE (Factuur.Factuurnummer1 = :koppel)
and Query2: SELECT Factuur.Factuurnummer1, Btws.Factuurnummer1, Btws.Btw, Btws.Bedragexclbtw, Btws.Bedragbtw, Btws.Bedraginclusiefbtw
FROM "Factuur.DB" Factuur, "BTWS.DB" Btws
WHERE (Factuur.Factuurnummer1 = :koppel1)
But I do not know how to get the data from Query2 in the quickreport.
Marioway
Query1: SELECT Factuur.Factuurnummer1, Factuur.Factuurnummer2, Factuur.Factuurklant, Factuur.Factuurstraat, Factuur.Factuurhuisnummer,
FROM "Factuur.DB" Factuur
INNER JOIN "factuurartikel.DB" Factuurartikel
ON (Factuur.Factuurnummer1 = Factuurartikel.Factnr)
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
WHERE (Factuur.Factuurnummer1 = :koppel)
and Query2: SELECT Factuur.Factuurnummer1, Btws.Factuurnummer1, Btws.Btw, Btws.Bedragexclbtw, Btws.Bedragbtw, Btws.Bedraginclusiefbtw
FROM "Factuur.DB" Factuur, "BTWS.DB" Btws
WHERE (Factuur.Factuurnummer1 = :koppel1)
But I do not know how to get the data from Query2 in the quickreport.
Marioway
Could you copy the database files into a directory, then compress that directory with winzip and send the .zip file at
esoftbg_e_e@yahoo.com
This way I will spend less time to create the tables and to fill them with data, if they are not a secret ofcourse ....
esoftbg_e_e@yahoo.com
This way I will spend less time to create the tables and to fill them with data, if they are not a secret ofcourse ....
Thanks
Please send the password for the tables by e-mail
Or remove the passwords from the tables and send unprotected tables again ....
ASKER
Excuse me, I forgot
the password is "correct"
thx
marioway
the password is "correct"
thx
marioway
Ok, thanks
I have an exception:
Table does not exist Artikelgebruik.DB
Table does not exist Artikelgebruik.DB
I am very tired .... I'll be back tomorrow ....
Could you send me the table Artikelgebruik.DB in zip format because :
....
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
....
....
INNER JOIN "Artikelgebruik.DB" Artikelgebruik
ON (Factuurartikel.ArtikelID = Artikelgebruik.ArtikelID)
....
Dear marioway,
please tell me which field into the table factuurartikel.DB contains info about the quantity of the article ?
And which price to be shown by the Invoice Prijsexclbtw or Prijsinclusiefbtw ?
please tell me which field into the table factuurartikel.DB contains info about the quantity of the article ?
And which price to be shown by the Invoice Prijsexclbtw or Prijsinclusiefbtw ?
ASKER
Hi, I 'll try to explain to You what I am doing through the program. It's easier to speak Dutch, then writing in English.
First: selecting an article from an article database --> appending a record to a temp.db ---> aantal = quantity , stukprijs =
price per piece, BTW% = VAT%, Prijsexclusiefbtw = price excl VAT, Prijsinclbtw = Price incl VAT.
After all records are added to the temp.db I run some query's on it, this to select the sum of prices excl VAT, prices incl VAT,
VAT (= incl - excl), and this per percent VAT. The result of each query I add to the BTWS.db. If a query.recordcount > 0 a record is added to BTWS, otherwhise not. So I could have for instance 2 records in BTWS: one for 6 % VAT, one for 12 % VAT. (In Belgium we have 5 different VAT % : 0 - 1 - 6 - 12 - and 21 %). So the results in the BTWS.db should be at the bottom of the Quickreport. After this I use a batchmove to move the data from the temp.db into the factuurartikel.db. The QR looks as follows:
- a pageheader --> data from the factuur.db (factuurnummer1, klantnaam,...)
- a columnheader ( to display what data can be found in the groupheader band)
- a groupheader --> articles sold
- detailband --> data from the artikelgebruik.db (explanation on how to use the article)
- a summary band --> at this moment I use the data out of the factuur.db to put into the QRDBText's --> so for each % VAT
I have a fixed line, printed out, even if no produkt has been sold with that % VAT. So each time 5 lines.
- a pagefooterband (general info )
What I would like is that only the data in the BTWS.db are printed out, instead of always 5 fixed lines (1 per % VAT and the datasource of each QRDBText in the summary band is now coming out of the factuur.db)
Well, I Hope You understand what I mean. It's not easy, I know.
thx alot
Marioway
First: selecting an article from an article database --> appending a record to a temp.db ---> aantal = quantity , stukprijs =
price per piece, BTW% = VAT%, Prijsexclusiefbtw = price excl VAT, Prijsinclbtw = Price incl VAT.
After all records are added to the temp.db I run some query's on it, this to select the sum of prices excl VAT, prices incl VAT,
VAT (= incl - excl), and this per percent VAT. The result of each query I add to the BTWS.db. If a query.recordcount > 0 a record is added to BTWS, otherwhise not. So I could have for instance 2 records in BTWS: one for 6 % VAT, one for 12 % VAT. (In Belgium we have 5 different VAT % : 0 - 1 - 6 - 12 - and 21 %). So the results in the BTWS.db should be at the bottom of the Quickreport. After this I use a batchmove to move the data from the temp.db into the factuurartikel.db. The QR looks as follows:
- a pageheader --> data from the factuur.db (factuurnummer1, klantnaam,...)
- a columnheader ( to display what data can be found in the groupheader band)
- a groupheader --> articles sold
- detailband --> data from the artikelgebruik.db (explanation on how to use the article)
- a summary band --> at this moment I use the data out of the factuur.db to put into the QRDBText's --> so for each % VAT
I have a fixed line, printed out, even if no produkt has been sold with that % VAT. So each time 5 lines.
- a pagefooterband (general info )
What I would like is that only the data in the BTWS.db are printed out, instead of always 5 fixed lines (1 per % VAT and the datasource of each QRDBText in the summary band is now coming out of the factuur.db)
Well, I Hope You understand what I mean. It's not easy, I know.
thx alot
Marioway
I just sent to you a Beta.0 version of the project
It must to be replaced method in the Beta.0 version :
procedure TFormFactuur.FormCreate(Se nder: TObject);
var
S: string;
begin
DB.Connected := False;
S := ExtractFilePath(Applicatio n.ExeName) ;
DB.Params.Values['PATH'] := S;
DB.Connected := True;
qryFactuur.Active := True;
end;
procedure TFormFactuur.FormCreate(Se
var
S: string;
begin
DB.Connected := False;
S := ExtractFilePath(Applicatio
DB.Params.Values['PATH'] := S;
DB.Connected := True;
qryFactuur.Active := True;
end;
I sent to you a Beta.1 version of the project .... No responce from you ....
ASKER
Hi, I've taken a look at the Beta1 you sent me. Still the same problem. I can get ALL the lines at the bottom of the report (in the summary band), but what I really want is that when for instance 2 products are sold , 1 with 6 % VAT, the other 12 % VAT, only these lines should appear in the summary, instead of 0 %, 1 %, 6 %, 12 % and 21 %. These results I get from the BTWS.db (there I put the results from several query's (5 in total) --> select ...sum() from temp.db where btw = 0, then 1, ..., If the query is not empty--> appending result to BTWS.db (which is emptyed at the end, after printing the report). If a query is empty, the result is not appended to BTWS. So most of the time only one or two records are in the BTWS.db, instead of 5. But how can I print out in the summary band only the results out of the BTWS.db instead of printing out every time the 5 VAT % .
Sorry for the delay
Marioway
Sorry for the delay
Marioway
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello, This is a possiblity I already had in mind. BWTS.db is filled at runtime with the results of the query's I run on the temp.db (same structure as the factuurarticle.db). After the Question 'Do you want to save the invoice ?' a Batchmove is performed to load the records from the temp.db into the factuurarticle.db. At the end the temp.db is emptyed. I thought there might be a way to load the results from the BTWS.db into the summary. So for instance: QRDBTEXT1, QRDBTEXT2, QRDBTEXT3, QRDBTEXT4 connectd to the BTWS.db (which is not empty at runtime !).
thx
Marioway
thx
Marioway
ASKER
Hi , I did it the way you last showed me. It looks better now. Thank You very much for your time !
thx
Marioway
thx
Marioway
Hi marioway,
You are welcome !
thx Emil
You are welcome !
thx Emil