X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fgl_journal.php;h=465fa0a5511c02390bba114d8a60ebd719e54fd1;hb=64f24ae3a63762d18b1ab6408263ec6ca1e14fb2;hp=f2defddc161e8c2ab761d1c98de6d11d50f9bf79;hpb=3b431d909abc53e4a4d712cbafa39ca556409d0e;p=fa-stable.git diff --git a/gl/gl_journal.php b/gl/gl_journal.php index f2defddc..465fa0a5 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -116,6 +116,7 @@ function create_cart($type=0, $trans_no=0) $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); @@ -129,9 +130,6 @@ function create_cart($type=0, $trans_no=0) } $cart->memo_ = get_comments_string($type, $trans_no); $cart->reference = $header['reference']; - - $_POST['ref_original'] = $cart->reference; // Store for comparison when updating - // update net_amounts from tax register // retrieve tax details @@ -141,8 +139,9 @@ function create_cart($type=0, $trans_no=0) 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['effective_date']); + $tax_info['tax_date'] = sql2date($detail['tran_date']); $tax_info['tax_group'] = $detail['tax_group_id']; } @@ -164,9 +163,9 @@ function create_cart($type=0, $trans_no=0) if (!is_date_in_fiscalyear($cart->tran_date)) $cart->tran_date = end_fiscalyear(); $cart->reference = $Refs->get_next(ST_JOURNAL, null, $cart->tran_date); - $_POST['ref_original'] = -1; } + $_POST['reconciled_date'] = $cart->reconcile_date; $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; @@ -183,6 +182,8 @@ function create_cart($type=0, $trans_no=0) 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(); @@ -239,15 +240,8 @@ if (isset($_POST['Process'])) set_focus('doc_date'); $input_error = 1; } - if (!$Refs->is_valid($_POST['ref'])) + if (!check_reference($_POST['ref'], ST_JOURNAL, $_SESSION['journal_items']->order_id)) { - display_error( _("You must enter a reference.")); - set_focus('ref'); - $input_error = 1; - } - elseif (($_POST['ref'] != $_POST['ref_original']) && $Refs->exists(ST_JOURNAL,$_POST['ref'])) - { - display_error( _("The entered reference is already in use.")); set_focus('ref'); $input_error = 1; } @@ -326,7 +320,7 @@ if (isset($_POST['Process'])) { // complete tax register data $cart->tax_info['tax_date'] = $_POST['tax_date']; - $cart->tax_info['tax_group'] = $_POST['tax_group']; + //$cart->tax_info['tax_group'] = $_POST['tax_group']; $taxes = get_all_tax_types(); while ($tax = db_fetch($taxes)) { @@ -336,11 +330,16 @@ if (isset($_POST['Process'])) } } else $cart->tax_info = false; + + if (!get_post('reconciled')) // clear reconcilation (if any) + $cart->reconcile_date = NULL; + $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 @@ -477,6 +476,7 @@ if (tab_closed('tabs', 'gl')) { $cart = &$_SESSION['journal_items']; $cart->tax_info['tax_date'] = $_POST['tax_date']; + $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)) @@ -491,6 +491,9 @@ if (tab_opened('tabs', 'gl')) $_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'); } @@ -546,10 +549,13 @@ tabbed_content_start('tabs', array( case 'tax': update_tax_info(); + br(); display_heading(_("Tax register record")); + br(); start_table(TABLESTYLE2, "width=40%"); date_row(_("VAT date:"), 'tax_date', '', "colspan='3'"); 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%");