Hi,
I try to generate invoice from Master/Detail Tables.
I know how to generate data from Master Table, but I don't know how to generate record from Detail Table.
Have someone any example? Or Can someone help me?
Thank you,
Andrea.
Hi,
I try to generate invoice from Master/Detail Tables.
I know how to generate data from Master Table, but I don't know how to generate record from Detail Table.
Have someone any example? Or Can someone help me?
Thank you,
Andrea.
You can create a custom file with your layout and write the content to pdf.
So you can use ew_Execute or ew_ExecuteScalar to load the corresponding data from the database.
Read help file topic: "Server Events and Client Scripts" -> "Some Global Functions" for more information.
In add item part, use Conn()->Execute() to retrieve records and loop it.
For example:
$rs = Conn()->Execute("SELECT * FROM <Detail TAble> WHERE <Condition>");
while (!$rs->EOF) {
// add the detail record to your PDF
$rs->MoveNext();
}
Read help file topic: "Server Events and Client Scripts" -> "Some Global Functions".
Hi arbei,
I insert this code like your suggest:
/* Adding Items in table */
$rs = Conn()->Execute("SELECT * OrdersMaster INNER JOIN OrdersDetail ON OrdersMaster.OrderId = OrdersDetail.OrderId");
while (!$rs->EOF) {
//$invoice->addItem($GET["ItemCode"],$GET["Description"],$GET["Quantity"],$GET["Price"]$GET["Quantity"]22/100,$GET["Price"],0,$_GET["NetTotal"]);
$rs->MoveNext();
}
But I received the error : "Uncaught Error: Call to a member function Execute() on boolean. Stack Trace: #0 (main).
I use sql server like database.
Can you help me please?
Thank you so much,
Andrea.
Fakiro82 wrote:
But I received the error : "Uncaught Error: Call to a member function Execute() on boolean. Stack Trace: #0 (main).
Make sure you have already enabled "Include common files" from your Custom File setup. Please read "Custom Files" topic from PHPMaker Help menu for more info and example.
now I include common files and it work.
Now, when I generate Invoice.pdf, all fields ($GET["ItemCode"],$GET["Description"],etc...) in my code:
$invoice->addItem($GET["ItemCode"],$GET["Description"],$GET["Quantity"],$GET["Price"]$GET["Quantity"]22/100,$GET["Price"],0,$_GET["NetTotal"]);
are blank.
But if I substitute $GET["ItemCode"] with "TEST" it's ok. I think that the problem is in $GET["ItemCode"] or query. Can you help me please?
Thank you so much.
Andrea.