Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Print button doesn't give a Report

admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Print button doesn't give a Report

Unread post by admin »

Jeroen,

It seems your SQL statment isn't correct.

To find out where your problem is put it together bit by bit one inner join at a time and you will soon find your problem.

Steven
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Print button doesn't give a Report

Unread post by Eppo »

Hi There,

When I use only this code:

Code: Select all

    $sql = "


    CREATE TABLE #dataTable# SELECT * FROM aankopen ";

    nuRunQuery($sql);
I get all the registrated items from table aankopen among each other in a print of PDF. (Yes it works)
But the only thing I want to print is an Invoice of the selected item with the connected name and adres.

How do I do that?

I use version v2.8.1-12.12.19-Build554
I'm stil working as global admin
I started with this version from de windows installer uwamp (downloaded in the begining of februari).
I've tested in IE firefox en Chrome also on other computers inside my network
Stil in de sample Financial module non of the print options works. Even the demo on https://www.nubuilder.net/demo.php I can not make a invoice.

Is there something wong with my computer?

Thanks for helping me out!

Jeroen
johan
Posts: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

Re: Print button doesn't give a Report

Unread post by johan »

Jeroen,

Something like this :




Code: Select all

 $sql = "


    CREATE TABLE #dataTable# SELECT * FROM aankopen 
left join klanten on koop_klant_id = klanten_id
where koop_id = '#recordID#' 
";
 nuRunQuery($sql);
To make sure your sql is correct first paste this part in phpMyadmin

Code: Select all

CREATE TABLE #dataTable# SELECT * FROM aankopen 
left join klanten on koop_klant_id = klanten_id
where koop_id = 1 
replace 1 by an existing id of table aankopen.

Succes
Johan
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Print button doesn't give a Report

Unread post by Eppo »

Thanks Johan,

You helped me out 1 stap further.

Code: Select all

$sql = " 
CREATE TABLE #dataTable# SELECT * FROM aankopen
WHERE aankopen_id = '#recordID#'
";
    nuRunQuery($sql);
This code wil give me 1 invoice from the item I selected. YES!! Thanks.

Only when I put in the line in nuBuilder

Code: Select all

left join klanten on koop_klanten_id = klanten_id
it stil give me the error Page. (yes I changes koop_klant_id into koop_klanten_id, following the documentation on http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs )

When I put this line in PHPmyAdmin

Code: Select all

SELECT * FROM aankopen
LEFT JOIN klanten ON koop_klanten_id = klanten_id
it gives no errors.

I even tryed al the join possibilitys Inner left en Right but it doesn't work.

In the table aankopen (purchase) there is aankopen_id the record ID en koop_klanten_id is the customer ID wich is the same with the connected customer in field klanten_id in the table klanten.

Thanks for helping me out!

Jeroen
johan
Posts: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

Re: Print button doesn't give a Report

Unread post by johan »

Jeroen,


If this code

Code: Select all

SELECT * FROM aankopen
LEFT JOIN klanten ON koop_klanten_id = klanten_id
doesn't give any errors in phpMyadmin i think the problem is in the where part.

Code: Select all

WHERE aankopen_id = '#recordID#'
aankopen_id has to be the primary key of your form where the printbutton is on. You can check it out in the sql of your form.

Maybe you have to change the * (select all) in a select of the fields you need. p.ex

Code: Select all

select naam, voornaam, ... from aankopen ... 


Johan
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Print button doesn't give a Report

Unread post by Eppo »

Johan,

Code: Select all

SELECT * FROM aankopen
LEFT JOIN klanten ON koop_klanten_id = klanten_id
WHERE aankopen_id = '15162d7f2a23b3'
This works great in phpMyadmin, so I assume that the where part isn't a problem.
aankopen_id is the primary Key.

I've also tryed to name every field I need, but the result is the same..
Error
An error has occurred while running this query. Please contact technical support and quote error reference: d51e8aa.

The following information is only provided for users logged on as globeadmin.
SQL

CREATE TABLE ___nu15165d2d51ac87___ SELECT klant_fam, klant_voor, klant_tussen, klant_naam, klant_straat, klant_huis, klant_post, klant_plaats, koop_merk, koop_prod, koop_prodgr, koop_prijs, koop_datum FROM aankopen INNER JOIN klanten ON koop_klanten_id = klanten_id WHERE aankopen_id = '15162e00901fbb'
Transaction

No Transaction.
Error

0:
URL

http://


The only way it wil work at this moment on my computer is copy the information from klanten to aankopen when I select a customer and use only the information from aankopen. But when someones adres changes I have to reconnect all product with that customer otherwise the information wil not be the same.

Thanks for thinking with me.

Jeroen
johan
Posts: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

Re: Print button doesn't give a Report

Unread post by johan »

Jeroen,



You get 1 result when you put this in PhpMyadmin?

Code: Select all

SELECT klant_fam, klant_voor, klant_tussen, klant_naam, klant_straat, klant_huis, klant_post, klant_plaats, koop_merk, koop_prod, koop_prodgr, koop_prijs, koop_datum FROM aankopen INNER JOIN klanten ON koop_klanten_id = klanten_id WHERE aankopen_id = '15162e00901fbb'
In that case the sql seems ok to me. Personal, I would prefair left join.

Somethings to test :

If, in PhpMyadmin, you get 1 row result with the code above, try to use that exact code in nubuilder. This supose to give the selected invoice.
or you could try to make a new report with this sql and only 1 field in my report.

succes,
Johan
Eppo
Posts: 29
Joined: Mon Jan 14, 2013 3:49 pm
Location: The Netherlands, Leiden

Re: Print button doesn't give a Report

Unread post by Eppo »

Super thanks! Johan!

It works! I thought I had already tried this one, but if I did, I did it wrong.

Thank you verry Much!

Now I can start working on the layout.

Again Thanks!

Jeroen.
johan
Posts: 392
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium

Re: Print button doesn't give a Report

Unread post by johan »

OK
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Print button doesn't give a Report

Unread post by admin »

.
Locked