Jump to content

Invoice description field


ozmo

Recommended Posts

When manually creating invoices for various services I require the use of multiple line entries to describe the service provided etc.

 

The one thing I don't like however is how every line entry produces a $0 amount as well.

 

Is there any way to make the description text field a multiple line field? Or Is there any way to eliminate the extra $ amount fields?

 

Cheers,

 

Rob

Link to comment
Share on other sites

Doesn't it wrap long lines? I can understand the usefulness of a larger text entry box for invoice items though.

 

Yes it does wrap but looks very ugly. e.g.

 

Wrapped:

Design for project X (5hrs) Development for project X (25hrs) Maintenance for project X (10hrs) Aditional services for project X (45hrs) Extra services performed on project X (2hrs)

 

Unwrapped:

Design for project X (5hrs)

Development for project X (25hrs)

Maintenance for project X (10hrs)

Aditional services for project X (45hrs)

Extra services performed on project X (2hrs)

 

I see that adding html within the description works fine when viewing the online "Printable Version" but the PDF displays the code as well as the description itself. hmmmm......

 

I did also try adding various PHP functions within the field but it just broke the form :(

 

Any other ideas?

Link to comment
Share on other sites

You could always edit the pdfconfig.php file and put an if statement in so that if the amount is zero, don't display the zero in the amount column.

 

I can see that by adding an if statement would work for the PDF but then the amount would still be visable within the Printable Version would it not?

 

Would it be possible to make the description field a multi line field in the next release? Is there any reason not to?

 

Thanks,

 

Rob

Link to comment
Share on other sites

...but then the amount would still be visable within the Printable Version would it not?

 

in the printable (viewinvoice) template you would simply replace:

 

{$currencysymbol}{$invoiceitem.amount} {$currency}

 

with

 

{if $invoiceitem.amount > 0}{$currencysymbol}{$invoiceitem.amount} {$currency}{else}{/if}

Link to comment
Share on other sites

  • 3 months later...
You could always edit the pdfconfig.php file and put an if statement in so that if the amount is zero, don't display the zero in the amount column.

 

Two changes for the pdfconfig.php file are below - the first is to display the amount as blank if it's 0 as described. The second change changes the invoice status displayed to "Now Due" if it was "Unpaid", and displays it in red instead of grey. (I think red was intended but fpdf has a bug here where it displays in light grey if you leave out the supposedly optional green and blue parameters to SetTextColor.)

 

*** Orig/pdfconfig.php.release330       2007-08-17 13:07:46.000000000 +1000
--- pdfconfig.php       2007-09-15 15:53:31.000000000 +1000
***************
*** 51,65 ****
 $pdf->SetFont('Arial','',10);

 foreach ($invoiceitems AS $item) {
       if (strlen($item["description"])>85) {
               $pdf->Cell(148,6,substr($item["description"],0,85),1);
!               $pdf->Cell(40,6,$currencysymbol.$item["amount"],1,0,'C');
               $pdf->Ln();
               $pdf->Cell(148,6,substr($item["description"],85),1);
               $pdf->Cell(40,6,"",1,0,'C');
       } else {
               $pdf->Cell(148,6,$item["description"],1);
!               $pdf->Cell(40,6,$currencysymbol.$item["amount"],1,0,'C');
       }
       $pdf->Ln();
 }
--- 51,70 ----
 $pdf->SetFont('Arial','',10);

 foreach ($invoiceitems AS $item) {
+       if ($item["amount"] != 0)
+           $amount = $currencysymbol . $item["amount"];
+       else
+           $amount = "";
       if (strlen($item["description"])>85) {
               $pdf->Cell(148,6,substr($item["description"],0,85),1);
!               // $pdf->Cell(40,6,$currencysymbol.$item["amount"],1,0,'C');
!               $pdf->Cell(40,6,$amount,1,0,'C');
               $pdf->Ln();
               $pdf->Cell(148,6,substr($item["description"],85),1);
               $pdf->Cell(40,6,"",1,0,'C');
       } else {
               $pdf->Cell(148,6,$item["description"],1);
!               $pdf->Cell(40,6,$amount,1,0,'C');
       }
       $pdf->Ln();
 }
***************
*** 96,103 ****
 } else {
       $pdf->SetXY(120,80);
 }
 $pdf->SetFont('Arial','B',40);
! $pdf->SetTextColor(245);
 $pdf->Write(5,strtoupper($status));
--- 101,116 ----
 } else {
       $pdf->SetXY(120,80);
 }
+ if ($status == "Unpaid")
+     $status = "Now Due";
+ $r = 245; $g = $b = 0;  // red
+ if ($status == "Paid")
+ {
+     $r = $b = 0; $g = 255; // green
+ }
 $pdf->SetFont('Arial','B',40);
! $pdf->SetTextColor($r, $g, $b);
! // $pdf->SetTextColor(245, 0, 0); // this displayed grey
 $pdf->Write(5,strtoupper($status));

Code is tested and works. (Note that the diff -c "!" change marks may display a line above the changed line.) Hope this helps someone!

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Any fix on this in sight?

 

Current version wraps the first line, and the second line just runs off the page on the pdf if it is longer than 2 lines.

 

Until a fix is available, I can live with manually entering multiple lines using the above conditional to blank out the zeros, but we have dozens of manual invoices a month that require multiple lines, and it sure would be nice to have word wrap!

 

Is there a patch I could add to wrap lines that exceed 2 lines?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated