Topic: Line wrapping for long fields

How do I add lien wrapping when printing a long field?

In particular I would like to show the Item description in its full length on Sales orders, invoices, purchase orders, etc., even if the description exceeds the single line space provided.

Ideally I would eve like to have the option to print these documents with the long descritpion.

Any help (or even better updated reports) would be much appreciated.

Re: Line wrapping for long fields

Instead of using the class-member TextCol, you can use TextColLines. This will wrap the column. But you must keep track of the row counter yourself to get a nice layout. Ex.

Before:
$rep->TextCol(0, 1,    $myrow2['stock_id'], -2);
$rep->TextCol(1, 2,    $myrow2['StockDescription'], -2);
$rep->TextCol(2, 3,    $DisplayQty, -2);
$rep->TextCol(3, 4,    $myrow2['units'], -2);
$rep->TextCol(4, 5,    $DisplayPrice, -2);
$rep->TextCol(5, 6,    $DisplayDiscount, -2);
$rep->TextCol(6, 7,    $DisplayNet, -2);
$rep->NewLine(1);
After:
$rep->TextCol(0, 1,    $myrow2['stock_id'], -2);
$row = $rep->row;
$rep->TextColLines(1, 2,    $myrow2['StockDescription'], -2);
$next_row = $rep->row;
$rep->row = $row;
$rep->TextCol(2, 3,    $DisplayQty, -2);
$rep->TextCol(3, 4,    $myrow2['units'], -2);
$rep->TextCol(4, 5,    $DisplayPrice, -2);
$rep->TextCol(5, 6,    $DisplayDiscount, -2);
$rep->TextCol(6, 7,    $DisplayNet, -2);
$rep->row = $next_row;
$rep->NewLine(1);

This will wrap the description nicely.
If you want to use the long description from the stock_master, you have to change the function get_customer_trans_details in the file /sales/includes/db/cust_trans_details_db.inc, line 5. You have to add the field long_description from stock_master table.

/Joe