OK so another approach to this 0VAT reporting problem
(I haven't coded PHP much - most in RT robotics using C. - also I'm very new to frontaccounting so very much finding out how it works. The code below is more a concept and would need to be tidied etc --But constructive feedback from those who know would be great) I'm also snowed under with other work so don't have much time to spend on this - but would really like to get it sorted as it's holding my accounts back.
Use of SESSION variable just for OVAT gl entry.
By adding the code below in includes/ui/ui_view.inc
display_quick_entries()
switch (strtolower($qe_line['action'])) {
case "=": // post current base amount to GL account
$part = $base;
break;
case "a": // post amount to GL account and reduce base
//Hack fix for 0VAT reporting
if ($qe_line['dest_id']==2206)
{
$_SESSION['zero_tax_net_amount']= $base;
}
I can transfer the net amount associated with gl 0VAT QE input straight into the trans_tax_details table. This is where the standard tax report gets its data from.
(The 2206 relates to my 0VAT gl_account this could be set in the config file as 0VAT account for tax reporing purposes)
The modification to the function below in includes/db/gl_db_trans.inc deals with the data insertion to the table.
function add_trans_tax_details($trans_type, $trans_no, $tax_id, $rate, $included,
$amount, $net_amount, $ex_rate, $tran_date, $memo)
{
//Hack fix for 0VAT reporting
if ($_SESSION['zero_tax_net_amount'] != 0)
$net_amount = $_SESSION['zero_tax_net_amount'];
$sql = "INSERT INTO ".TB_PREF."trans_tax_details
(trans_type, trans_no, tran_date, tax_type_id, rate, ex_rate,
included_in_price, net_amount, amount, memo)
VALUES (".db_escape($trans_type)."," . db_escape($trans_no).",'"
.date2sql($tran_date)."',".db_escape($tax_id).","
.db_escape($rate).",".db_escape($ex_rate).",".($included ? 1:0).","
.db_escape($net_amount).","
.db_escape($amount).",".db_escape($memo).")";
//Hack fix for 0VAT reporting
if ($_SESSION['zero_tax_net_amount'] != 0)
$_SESSION['zero_tax_net_amount']=0;
db_query($sql, "Cannot save trans tax details");
}
Currently by using quick entry I can get proper tax reporting by just using this code - no other modification. This can be extended to gl payment /deposit by similar code to the first snippet and appropriate insertion in the payment /deposit areas.
I wish to keep my FA system in line with the official development so ask for advice and thoughts as to any reason this will not work or is a bad idea.
Does this make any sense. Any comments please and thanks in advance.