Topic: Rep107 - Remove Article Code from Invoice (v2.4.x)

I recently upgrade from v2.3 to v2.4
As my business mainly supplies services, I used to remove the Article Codes column from the invoices (rep107). The codes are not much of use in my case and this leaves more white space to enter an appropriate description.

I've noticed the rep107 template changed quite a lot between v2.3 and v2.4.
I've got my adjustment working, but I think there is a better way of doing it, which preserves the '$c++, $c' instead of fiddling around with column numbers.

My work around;
Original (Lines 162-180)

                $c=0;
                $rep->TextCol($c++, $c,    $myrow2['stock_id'], -2);
                $oldrow = $rep->row;
                $rep->TextColLines($c++, $c, $myrow2['StockDescription'], -2);
                $newrow = $rep->row;
                $rep->row = $oldrow;
                if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount())
                {
                    $rep->TextCol($c++, $c,    $DisplayQty, -2);
                    $rep->TextCol($c++, $c,    $myrow2['units'], -2);
                    $rep->TextCol($c++, $c,    $DisplayPrice, -2);
                    $rep->TextCol($c++, $c,    $DisplayDiscount, -2);
                    $rep->TextCol($c++, $c,    $DisplayNet, -2);
                }
                $rep->row = $newrow;
                //$rep->NewLine(1);
                if ($rep->row < $summary_start_row)
                    $rep->NewPage();
            }

Modified (Lines 162-180)

                $c=0;
                //$rep->TextCol($c++, $c,    $myrow2['stock_id'], -2);
                $oldrow = $rep->row;
                $rep->TextColLines(0, 2, $myrow2['StockDescription'], -2);
                $newrow = $rep->row;
                $rep->row = $oldrow;
                if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !$SysPrefs->no_zero_lines_amount())
                {
                    $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 = $newrow;
                //$rep->NewLine(1);
                if ($rep->row < $summary_start_row)
                    $rep->NewPage();
            }

Anyone?

2 (edited by sledge 02/01/2020 04:05:40 pm)

Re: Rep107 - Remove Article Code from Invoice (v2.4.x)

For the record, to fix the headers I modify file "../reporting/includes/header2.inc"

Original (Lines 182-189)

        // Line headers
        $this->row = $iline5 - $this->lineHeight - 1;
        $this->Font('bold');
        $count = count($this->headers);
        $this->cols[$count] = $right - 3;
        for ($i = 0; $i < $count; $i++)
            $this->TextCol($i, $i + 1, $this->headers[$i], -2);
        $this->Font();

Modified - add line 185 (Lines 182-190)

        // Line headers
        $this->row = $iline5 - $this->lineHeight - 1;
        $this->Font('bold');
        $this->headers = array(_("Item Description"),'', _("Quantity"),_("Unit"), _("Price"), _("Discount %"), _("Total"));
        $count = count($this->headers);
        $this->cols[$count] = $right - 3;
        for ($i = 0; $i < $count; $i++)
            $this->TextCol($i, $i + 1, $this->headers[$i], -2);
        $this->Font();

I agree that modifying file "../reporting/includes/doctext.inc" would be preferable, but that has a lot of consequences for a many other reports.

Re: Rep107 - Remove Article Code from Invoice (v2.4.x)

Hello Sledge,

This modification is nice. but there is a problem. I did this modification in header.inc, it affected the Receipt header, Delivery header and other Reports. Cant it be done in Just rep107.php so it is on just the Invoice only?

thanks

Popsicles12

Re: Rep107 - Remove Article Code from Invoice (v2.4.x)

1. You can make a copy of header2.inc file (say header107.inc), now do all the changes sledge did on that file
2. Create a new function in reporting/includes/pdf_report.inc (say function Header107() ), include the above header107.inc e.g given below

    function Header107()
    {
        global $dflt_lang; // FIXME should be passed as params

        $this->SetLang(@$this->formData['rep_lang'] ? $this->formData['rep_lang'] : $dflt_lang);
        $doctype = $this->formData['doctype'];
        $header2type = true;

        $lang = user_language();
        $this->SetLang(@$this->formData['rep_lang'] ? $this->formData['rep_lang']
            : ( $lang ? $lang : $dflt_lang));

         // leave layout files names without path to enable including
         // modified versions from company/x/reporting directory
        include("includes/doctext.inc");
        include("includes/header107.inc");

        $this->row = $temp;
    }

3. Now rename SetHeaderType on line 141 for calling Header107 function in rep107.php
            $rep->SetHeaderType('Header107');
4. Now this will make a custom header for specific for invoice pdf.