Google and Bloomberg Exchange Rate fix. Addendum.
[fa-stable.git] / gl / gl_journal.php
index f2defddc161e8c2ab761d1c98de6d11d50f9bf79..34abbedfabb4175acdf4ee1f7307d4ea2f513f15 100644 (file)
@@ -130,8 +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
@@ -142,8 +140,8 @@ function create_cart($type=0, $trans_no=0)
                {
                        $tax_id = $detail['tax_type_id'];
                        $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_group'] = $detail['tax_group_id'];
+                       $tax_info['tax_date'] = sql2date($detail['tran_date']);
+                       //$tax_info['tax_group'] = $detail['tax_group_id'];
 
                }
                if (isset($tax_info['net_amount']))     // guess exempt sales/purchase if any tax has been found
@@ -164,7 +162,6 @@ 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['memo_'] = $cart->memo_;
@@ -239,15 +236,8 @@ if (isset($_POST['Process']))
                set_focus('doc_date');
                $input_error = 1;
        }
-       if (!$Refs->is_valid($_POST['ref'])) 
-       {
-               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'])) 
+       if (!check_reference($_POST['ref'], ST_JOURNAL, $_SESSION['journal_items']->order_id))
        {
-               display_error( _("The entered reference is already in use."));
                set_focus('ref');
                $input_error = 1;
        }
@@ -326,7 +316,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))
                {
@@ -477,7 +467,7 @@ if (tab_closed('tabs', 'gl'))
 {
        $cart = &$_SESSION['journal_items'];
        $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))
        {
@@ -546,10 +536,12 @@ 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');
+                       //tax_groups_list_row(_("Tax group:"), 'tax_group');
                        end_table(1);
 
                        start_table(TABLESTYLE2, "width=60%");