Hello again Adam,
First of all :
Concerning "SaleTransHist" report, you don't see company fields because the link from and to this table are NULL : the link exists, it is referenced in both SaleInv and Company tables, but has no value on either sides.
Not clear on this one.
Here is a "graphical" explanation of what I meant :
The relationships between SaleInv and Company :
As you can see each table is linked to the other one, but, if you look into the tables :
id_company is linked but empty (NULL) and
it is the same for id_SaleInv on the Company table : linked but empty (NULL)
What is the consequence ?
Look at the previous query I posted, there is at least one "AND", meaning all the conditions must be fulfilled. As a consequence, you don't return anything because there is nothing to return.
WORKAROUND :
To solve that problem, and removed the links between SaleInv and Company, and linked customers with Company (assuming ONE Company can be linked with MANY customers) - that's my example, but you'll build your own with the same idea.
Here is how it looks now :
And the sample data I put into customers to link them with company (again, just my example) :
Now you can query the whole table system, get your data and put them into the report with :
SELECT
Company.coLogo,
Company.coName,
SaleInv.invDate,
SaleInv.invCode,
SaleInv.subTotal,
SaleInv.taxTotal,
SaleInv.grossTotal,
SaleInv.discount,
SaleInv.delivery,
SaleInv.InvTotal,
Customer.name,
Customer.surname,
Customer.street,
Customer.city,
SaleProduct.name,
SaleInvItem.Qty,
SaleInvItem.unitPrice,
SaleInvItem.netPrice,
SaleInvItem.taxAmt,
SaleInvItem.totalAmt
FROM
SaleInv
INNER JOIN Customer ON Customer.id = SaleInv.id_Customer,
SaleProduct
INNER JOIN SaleInvItem ON SaleInvItem.id_SaleInv = SaleInv.id
AND SaleProduct.id = SaleInvItem.id_SaleProduct
INNER JOIN Company ON Customer.id_Company = Company.id
All the data you wanted are in a Dataset, now, how do I format the report to get the logo image ?
Simple steps :
You logo is in the dataset
but it's an image blobed into the database so add a master data band like this
set company name field like this
now add an image (not the coLogo) as shown below and click OK (green check mark)
:
Finally, with the image selected in the report set :
1- DataSet = Report
2- DataField = coLogo
like this
If you don't set the DataSet first, you won't be able to select the DataField
Now let's preview your report :
Yes, it's ugly like that, but it works. Just arrange the size of your fields, the filters you want, add the other ones, organize them as you wish and you have your report.
Example of very small page work :
And end result on the report :
Project attached
Hope it helps
Cheers
Mathias
Post's attachments ReportTest.zip 386.91 kb, 580 downloads since 2017-01-16
I'm a very good housekeeper !
Each time I get a divorce, I keep the house
Zaza Gabor