Simple Invoices logo
    • CommentAuthorDelphinus
    • CommentTimeMay 24th 2007 edited
     permalink
    Over here in NZ we often have our invoices show eg the following:

    Subtotal: $40 (excl Tax)
    GST : $5 (Our tax - 12.5%)

    Invoice Total: $45 (total incl Tax)

    The subtotal variable didn't seem to be there so I've added the following code to include/sql_queries.php on line 340.

    #invoice sub total excl tax
    $sql ="SELECT SUM(gross_total) AS sub_total, SUM(total) AS total FROM {$tb_prefix}invoice_items WHERE invoice_id =$id";
    $query = mysqlQuery($sql) or die(mysql_error());
    $result = mysql_fetch_array($query);
    //$invoice['total'] = number_format($result['total'],2);
    $invoice['sub_total'] = number_format($result['sub_total'],2);


    Hope I have done that ok, just copied the tax calculation and changed a bit.
    • CommentAuthorjustin
    • CommentTimeMay 25th 2007 edited
     permalink
    Thanks Delphinus,

    did you add this into one of the existing invoice templates or create your own

    Cheers

    Justin
    • CommentAuthorDelphinus
    • CommentTimeMay 25th 2007 edited
     permalink
    That part was just into the include/sql_queries.php file to make the variable available to work with when creating a new template.

    I'm just working on making a clean template now, but needed to do the above first to the sql_queries file.
    • CommentAuthoraplysia
    • CommentTimeMay 25th 2007 edited
     permalink
    Ok, I'll put it on the list for the next release. Perhaps I will change the table a bit. So ev. I have to change the querie a bit.
    • CommentAuthorDelphinus
    • CommentTimeMay 25th 2007 edited
     permalink
    Sounds good. Comments welcome, I'm new to this :)