Topic: how to display report for comment field larger with medium text

FA 2.4.6
PHP 7.2
Centos 7.x

reading: https://frontaccounting.com/punbb/viewtopic.php?id=2932

idea is to have comment larger and get printed in documents
we want to put details for the specification for items in the comments, as the comments will have max char 65,355 this will able break 1 pages (usually do, if we have print documents from excel)

after modification table:
ALTER TABLE `0_comments` MODIFY COLUMN `memo_` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_purch_orders` MODIFY COLUMN `comments` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_sales_orders` MODIFY COLUMN `comments` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_supp_invoice_items` MODIFY COLUMN `memo_` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_stock_master` MODIFY COLUMN `long_description` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_trans_tax_details` MODIFY COLUMN `memo` MEDIUMTEXT DEFAULT NULL;
ALTER TABLE `0_debtor_trans_details` MODIFY COLUMN `description` MEDIUMTEXT DEFAULT NULL;
#ALTER TABLE `0_gl_trans` MODIFY COLUMN `memo_` MEDIUMTEXT DEFAULT NULL;
#ALTER TABLE `0_voided` MODIFY COLUMN `memo_` MEDIUMTEXT DEFAULT NULL;

now comments is larger, but how to fix for the printed report
109 - Print Sales Orders
110 - Print Deliveries - Also handles Packing Lists. | Bin Locations in Packing List
111 - Print Sales Quotations
209 - Print Purchase Orders

for example print PO:
Lines 156 reporting/rep209.php :

                if ($myrow['comments'] != "")
                {
                        $rep->NewLine();
                        $rep->TextColLines(1, 4, $myrow['comments'], -2);
                }

Lines 1092 reporting/includes/pdf_report.inc :
        function TextColLines($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
        {
                $this->row -= $r;
                $this->TextWrapLines($this->cols[$c], $this->cols[$n] - $this->cols[$c] + $corr, $txt, $this->aligns[$c], $border, $fill, $link, $stretch, true);
        }

        function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0, $spacebreak=true)
        {
                $str = explode("\n", $txt);

                for ($i = 0; $i < count($str); $i++)
                {
                        $l = $str[$i];
                        do
                        {
                                $l = $this->TextWrap($c, $this->row , $width, $l, $align, $border, $fill, $link, $stretch, $spacebreak);
                                $this->row -= $this->lineHeight;
                        }
                        while ($l != '');
                }
        }

it this possible to add for NewPage if BottomMargin have reached? just tryout something but cannot get it works
sorry as my PHP skill quite basic, please any assistance will appreciated

2 (edited by ichtus 04/12/2019 08:32:40 am)

Re: how to display report for comment field larger with medium text

this should works,
add line 810 in pdf_report.inc:
                                if ($this->row < $this->bottomMargin + (15 * $this->lineHeight))
                                        $this->NewPage();

full line will be:
        function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0, $spacebreak=true)
        {
                $str = explode("\n", $txt);

                for ($i = 0; $i < count($str); $i++)
                {
                        $l = $str[$i];
                        do
                        {
                                $l = $this->TextWrap($c, $this->row , $width, $l, $align, $border, $fill, $link, $stretch, $spacebreak);
                                $this->row -= $this->lineHeight;
                                if ($this->row < $this->bottomMargin + (15 * $this->lineHeight))
                                        $this->NewPage();
                        }
                        while ($l != '');
                }
        }