$cart->currency = $header['currency'];
$cart->rate = $header['rate'];
$cart->source_ref = $header['source_ref'];
+ $cart->reconcile_date = $header['reconcile_date'] ? sql2date($header['reconcile_date']) : NULL;
$result = get_gl_trans($type, $trans_no);
while ($detail = db_fetch($taxes))
{
$tax_id = $detail['tax_type_id'];
+ $cart->vat_category = $tax_info['tax_category'] = $detail['vat_category'];
$tax_info['net_amount'][$tax_id] = $detail['net_amount']; // we can two records for the same tax_id, but in this case net_amount is the same
$tax_info['tax_date'] = sql2date($detail['tran_date']);
- //$tax_info['tax_group'] = $detail['tax_group_id'];
+ $tax_info['tax_group'] = $detail['tax_group_id'];
}
if (isset($tax_info['net_amount'])) // guess exempt sales/purchase if any tax has been found
$cart->reference = $Refs->get_next(ST_JOURNAL, null, $cart->tran_date);
}
+ $_POST['reconciled_date'] = $cart->reconcile_date;
$_POST['memo_'] = $cart->memo_;
$_POST['ref'] = $cart->reference;
$_POST['date_'] = $cart->tran_date;
function update_tax_info()
{
+ $_SESSION['journal_items']->vat_category = get_post('tax_category');
+
if (!isset($_SESSION['journal_items']->tax_info) || list_updated('tax_category'))
$_SESSION['journal_items']->tax_info = $_SESSION['journal_items']->collect_tax_info();
}
} else
$cart->tax_info = false;
- $trans_no = write_journal_entries($cart);
- // retain the reconciled status if desired by user
- if (isset($_POST['reconciled'])
- && $_POST['reconciled'] == 1) {
- $sql = "UPDATE ".TB_PREF."bank_trans SET reconciled=".db_escape($_POST['reconciled_date'])
- ." WHERE type=" . ST_JOURNAL . " AND trans_no=".db_escape($trans_no);
+ if (!get_post('reconciled')) // clear reconcilation (if any)
+ $cart->reconcile_date = NULL;
- db_query($sql, "Can't change reconciliation status");
- }
+ $trans_no = write_journal_entries($cart);
$cart->clear_items();
new_doc_date($_POST['date_']);
unset($_SESSION['journal_items']);
+
if($new)
meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no");
else
{
$cart = &$_SESSION['journal_items'];
$cart->tax_info['tax_date'] = $_POST['tax_date'];
- //$cart->tax_info['tax_group'] = $_POST['tax_group'];
+ $cart->tax_info['tax_category'] = $_POST['tax_category'];
+ $cart->tax_info['tax_group'] = $_POST['tax_group'];
$taxes = get_all_tax_types();
while ($tax = db_fetch($taxes))
{
$_POST['memo_'] = $_SESSION['journal_items']->memo_;
} elseif (tab_opened('tabs', 'tax'))
{
+ $_POST['tax_category'] = $_SESSION['journal_items']->vat_category;
+ $_SESSION['journal_items']->collect_tax_info();
+ $_POST['tax_group'] = $_SESSION['journal_items']->tax_info['tax_group'];
set_focus('tax_date');
}
br();
start_table(TABLESTYLE2, "width=40%");
date_row(_("VAT date:"), 'tax_date', '', "colspan='3'");
- //tax_groups_list_row(_("Tax group:"), 'tax_group');
+ tax_groups_list_row(_("Tax group:"), 'tax_group');
+ vat_category_list_row(_("VAT category:"), 'tax_category', null, true, true);
end_table(1);
start_table(TABLESTYLE2, "width=60%");