ozmo Posted May 29, 2007 Share Posted May 29, 2007 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 0 Quote Link to comment Share on other sites More sharing options...
PPH Posted May 29, 2007 Share Posted May 29, 2007 Doesn't it wrap long lines? I can understand the usefulness of a larger text entry box for invoice items though. 0 Quote Link to comment Share on other sites More sharing options...
ozmo Posted May 29, 2007 Author Share Posted May 29, 2007 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? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted May 29, 2007 WHMCS CEO Share Posted May 29, 2007 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. 0 Quote Link to comment Share on other sites More sharing options...
ozmo Posted May 29, 2007 Author Share Posted May 29, 2007 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 0 Quote Link to comment Share on other sites More sharing options...
trine Posted May 30, 2007 Share Posted May 30, 2007 ...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} 0 Quote Link to comment Share on other sites More sharing options...
ozmo Posted May 30, 2007 Author Share Posted May 30, 2007 Thanks Trine. Thanks Matt. 0 Quote Link to comment Share on other sites More sharing options...
JofleyUK Posted September 9, 2007 Share Posted September 9, 2007 A multi line invoice screen would be nice, guys U know what uv gotta do! 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted September 15, 2007 Share Posted September 15, 2007 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! 0 Quote Link to comment Share on other sites More sharing options...
isdoo Posted October 25, 2007 Share Posted October 25, 2007 Thanks - however it doesn't seem to work under 3.40 0 Quote Link to comment Share on other sites More sharing options...
frisco Posted January 9, 2008 Share Posted January 9, 2008 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? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.