Jump to content

som3body

Member
  • Posts

    2
  • Joined

  • Last visited

About som3body

som3body's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Ok, I have sorted it out myself:lol: If anyone interested, I can share the whole invoicepdf.tpl code.
  2. Hello there. Iam trying to customise the pdf invoice(invoicepdf.tpl). I needed to add more columns like QTY,Price per item(VAT excl),VAT rate etc. This part is ok, but I want to add "if" "else" so if someone vat payer, the price will be calculated without what, and if not different calculation will be applied. My Items part of the code looking like that at the moment # Invoice Items $tblhtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0"> <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;"> <td width="45%"><br>'.$_LANG['invoicesdescription'].'</td> <td width="7%" align="center"><br>QTY (pc.)</td> <td width="14%">Price per item<br>Vat excl.(£)</td> <td width="7%">Vat rate<br>(%)</td> <td width="14%"><br>Vat (£)</td> <td width="">Total VAT incl. (£)</td> </tr> </table>'; foreach ($invoiceitems AS $item) { $vatincluded = number_format (($item['rawamount']),3); $vatexcluded = number_format (($vatincluded/((($taxrate)/100)*6)),3); $vatprice = number_format (round (($vatincluded)-($vatexcluded),3),3); $tblhtml .= '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0"> <tr bgcolor="#fff"> <td width="45%">'.nl2br($item['description']).'<br /></td> <td width="7%" align="center">1</td> <td width="14%">'.$vatexcluded.'</td> <td width="7%" align="center">'.$taxrate.'</td> <td width="14%">'.$vatprice.'</td> <td width="">'.$vatincluded.'</td> </tr> </table>';} I have tryed to add "if ($taxrate > "0"){code} else {the other code} but it just thrown 500 error every time. What have to change is: $vatincluded2 = number_format (((($item['rawamount'])/100)*6),3); $vatexcluded2 = number_format ($vatincluded2,3); $vatprice2 = number_format (round (($vatincluded2)-($vatexcluded2),3),3); This is my first experience with PHP, but after 3 days studying and googling I have done the calculation. But i cant get work the if else. Is there anyone who can help me? Many thanks in advvance. English is not my native language, but i hope its clear, what my problem is.
×
×
  • 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