Save/retrieve last document date.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Mar 2009 17:05:09 +0000 (17:05 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Mar 2009 17:05:09 +0000 (17:05 +0000)
29 files changed:
gl/bank_account_reconcile.php
gl/gl_bank.php
gl/gl_journal.php
gl/includes/ui/gl_bank_ui.inc
gl/includes/ui/gl_journal_ui.inc
includes/date_functions.inc
includes/ui/ui_view.inc
inventory/adjustments.php
inventory/includes/item_adjustments_ui.inc
inventory/includes/stock_transfers_ui.inc
inventory/transfers.php
manufacturing/work_order_entry.php
purchasing/includes/ui/grn_ui.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/po_entry_items.php
purchasing/po_receive_items.php
purchasing/supplier_payment.php
sales/credit_note_entry.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/customer_payments.php
sales/includes/cart_class.inc
sales/includes/db/sales_order_db.inc
sales/includes/sales_db.inc
sales/includes/ui/sales_credit_ui.inc
sales/includes/ui/sales_order_ui.inc
sales/sales_order_entry.php

index a195292b04609261587069c5f0e169cdc7a82c8a..f4cfeceb702d257c4d30e6b3f40fceda43f8ffba 100644 (file)
@@ -131,7 +131,7 @@ function change_tpl_flag($reconcile_id)
 }
 
 if (!isset($_POST['reconcile_date'])) { // init page
-       $_POST['reconcile_date'] = Today();
+       $_POST['reconcile_date'] = new_doc_date();
 //     $_POST['bank_date'] = date2sql(Today());
 }
 
@@ -217,7 +217,7 @@ table_header($th);
 start_row();
 
 date_cells("", "reconcile_date", _('Date of bank statement to reconcile'), 
-       null, 0, 0, 0, null, true);
+       get_post('bank_date')=='', 0, 0, 0, null, true);
 
 amount_cells_ex("", "beg_balance", 15);
 
index b9ce988214dfc566395cdd5ae53d12e6f7c15a74..fc6c50e67f0129a5b3a6bbd3525b095b1665e087 100644 (file)
@@ -121,7 +121,7 @@ function handle_new_order($type)
 
        $_SESSION['pay_items'] = new items_cart($type);
 
-       $_POST['date_'] = Today();
+       $_POST['date_'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['date_']))
                $_POST['date_'] = end_fiscalyear();
        $_SESSION['pay_items']->tran_date = $_POST['date_'];
@@ -180,6 +180,7 @@ if (isset($_POST['Process']))
 
        $trans_type = $trans[0];
        $trans_no = $trans[1];
+       new_doc_date($_POST['date_']);
 
        $_SESSION['pay_items']->clear_items();
        unset($_SESSION['pay_items']);
index 8b178118764eff22b60104a75ebdae4570fa0195..5a77bb84e7a433e5defe8e1cf8a125deeb388c92 100644 (file)
@@ -66,7 +66,7 @@ function handle_new_order()
 
     $_SESSION['journal_items'] = new items_cart(systypes::journal_entry());
 
-       $_POST['date_'] = Today();
+       $_POST['date_'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['date_']))
                $_POST['date_'] = end_fiscalyear();
        $_SESSION['journal_items']->tran_date = $_POST['date_'];        
@@ -128,6 +128,7 @@ if (isset($_POST['Process']))
                $_POST['date_'], $_POST['ref'], check_value('Reverse'), $_POST['memo_']);
 
        $_SESSION['journal_items']->clear_items();
+       new_doc_date($_POST['date_']);
        unset($_SESSION['journal_items']);
 
        meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no");
index 561c677ab41e8159531744d89b243fdef7188f3b..3af6202c13506b59a78a13da8c115b19014af405 100644 (file)
@@ -22,7 +22,7 @@ function display_bank_header(&$order)
        
     bank_accounts_list_row( $payment ? _("From:") : _("To:"), 'bank_account', null, true);
 
-    date_row(_("Date:"), 'date_', '', null, 0, 0, 0, null, true);
+    date_row(_("Date:"), 'date_', '', true, 0, 0, 0, null, true);
 
        table_section(2, "33%");
 
index bc68af7cfea564266eaa49dbae75cea035e75977..e769d36fdacb172e0b15fc5d4d73330d8c906137 100644 (file)
@@ -24,7 +24,7 @@ function display_order_header(&$Order)
        table_section(1);
 
        start_row();
-    date_cells(_("Date:"), 'date_');
+    date_cells(_("Date:"), 'date_', '', true);
        ref_cells(_("Reference:"), 'ref', '', references::get_next(0));
        end_row();
 
index c681353109eb44ae7548d706fd3b3d0f3e92c3e5..227a0b3472cdf7eced7cc660ed8e494e55ce67c0 100644 (file)
@@ -141,6 +141,19 @@ function Now()
        else
                return date("H:i");
 }
+//
+//     Retrieve and optionaly set default date for new document.
+//
+function new_doc_date($date=null)
+{
+       if (isset($date))
+               $_SESSION['_default_date'] = $date;
+
+       if (!isset($_SESSION['_default_date']) || !sticky_doc_date())
+               $_SESSION['_default_date'] = Today();
+
+       return $_SESSION['_default_date'];
+}
 
 function is_date_in_fiscalyear($date, $convert=false)
 {
index d1262f1240a6122fe4dbb89f1fffec118f911f61..98af52cc0971042c18765dddfa1def692e97c9ec 100644 (file)
@@ -877,6 +877,8 @@ function CC() {
        $js .= "
       dateField.value = dateString;
          setFocus(dateField.name);
+       if(dateField.getAttribute('aspect')=='cdate')
+      setElementProperty('color', (dateField.value==user.date ? 'black':'red'), dateField);
          if (dateField.className=='searchbox')
                dateField.onblur();
       hide();
index e1ce702444708fbefd5bdfd110cfc6ca3d62f934..5a9f95d6c2dc54005b637a31f7095efaa66b9cd4 100644 (file)
@@ -70,7 +70,7 @@ function handle_new_order()
     session_register("adj_items");
 
     $_SESSION['adj_items'] = new items_cart(systypes::inventory_adjustment());
-       $_POST['AdjDate'] = Today();
+       $_POST['AdjDate'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['AdjDate']))
                $_POST['AdjDate'] = end_fiscalyear();
        $_SESSION['adj_items']->tran_date = $_POST['AdjDate'];  
@@ -134,7 +134,7 @@ if (isset($_POST['Process']) && can_process()){
        $trans_no = add_stock_adjustment($_SESSION['adj_items']->line_items,
                $_POST['StockLocation'], $_POST['AdjDate'],     $_POST['type'], $_POST['Increase'],
                $_POST['ref'], $_POST['memo_']);
-
+       new_doc_date($_POST['AdjDate']);
        $_SESSION['adj_items']->clear_items();
        unset($_SESSION['adj_items']);
 
index 8c115bd3df91034bb7f0760a98f9c7dcc7bf62a9..8812438e47363d5881a078394ef9cd40eb205474 100644 (file)
@@ -36,7 +36,7 @@ function display_order_header(&$order)
 
        table_section(2, "33%");
 
-    date_row(_("Date:"), 'AdjDate');
+    date_row(_("Date:"), 'AdjDate', '', true);
 
        table_section(3, "33%");
 
index 729f8c7ac42c1ce88d46fe0780b241309a3307a5..6f3d307eb5655e7b46e57e3b2ffd5feffcf4c61f 100644 (file)
@@ -39,7 +39,7 @@ function display_order_header(&$order)
 
        ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::location_transfer()));
 
-    date_row(_("Date:"), 'AdjDate');
+    date_row(_("Date:"), 'AdjDate', '', true);
 
        table_section(3, "33%");
 
index b3d91338589ac6fb94e260b8d07e44f89682ae69..b311558928907704ad7dee50c156f11149b90b27 100644 (file)
@@ -68,7 +68,7 @@ function handle_new_order()
     session_register("transfer_items");
 
        $_SESSION['transfer_items'] = new items_cart(systypes::location_transfer());
-       $_POST['AdjDate'] = Today();
+       $_POST['AdjDate'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['AdjDate']))
                $_POST['AdjDate'] = end_fiscalyear();
        $_SESSION['transfer_items']->tran_date = $_POST['AdjDate'];     
@@ -143,7 +143,7 @@ if (isset($_POST['Process']))
        $trans_no = add_stock_transfer($_SESSION['transfer_items']->line_items,
                $_POST['FromStockLocation'], $_POST['ToStockLocation'],
                $_POST['AdjDate'], $_POST['type'], $_POST['ref'], $_POST['memo_']);
-
+       new_doc_date($_POST['AdjDate']);
        $_SESSION['transfer_items']->clear_items();
        unset($_SESSION['transfer_items']);
 
index bcbfd00add7e8f79054f16aa8a244b72125a213a..a0282ed2e46c75ec1ff21fccee36f79cc2cf99d6 100644 (file)
@@ -100,7 +100,7 @@ function safe_exit()
 //-------------------------------------------------------------------------------------
 if (!isset($_POST['date_']))
 {
-       $_POST['date_'] = Today();
+       $_POST['date_'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['date_']))
                $_POST['date_'] = end_fiscalyear();
 }
@@ -239,7 +239,7 @@ if (isset($_POST['ADD_ITEM']) && can_process())
        $id = add_work_order($_POST['wo_ref'], $_POST['StockLocation'], input_num('quantity'),
                $_POST['stock_id'],  $_POST['type'], $_POST['date_'],
                $_POST['RequDate'], input_num('Costs'), $_POST['memo_']);
-
+       new_doc_date($_POST['date_']);
        meta_forward($_SERVER['PHP_SELF'], "AddedID=$id");
 }
 
@@ -250,7 +250,7 @@ if (isset($_POST['UPDATE_ITEM']) && can_process())
 
        update_work_order($selected_id, $_POST['StockLocation'], input_num('quantity'),
                $_POST['stock_id'],  $_POST['date_'], $_POST['RequDate'], $_POST['memo_']);
-
+       new_doc_date($_POST['date_']);
        meta_forward($_SERVER['PHP_SELF'], "UpdatedID=$selected_id");
 }
 
@@ -382,13 +382,13 @@ if (get_post('type') == wo_types::advanced())
     qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
     if ($_POST['released'])
        label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id'])));
-    date_row(_("Date") . ":", 'date_');
+    date_row(_("Date") . ":", 'date_', '', true);
        date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by());
 }
 else
 {
     qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
-    date_row(_("Date") . ":", 'date_');
+    date_row(_("Date") . ":", 'date_', '', true);
        hidden('RequDate', '');
 
        if (!isset($_POST['Costs']))
index 2fe18c151b4b2de472cc7d26c39ab3b9b5c82fa3..539fc5f38e6bce953635721f7a7b894bf63e120a 100644 (file)
@@ -42,9 +42,9 @@ function display_grn_summary(&$po, $editable=false)
         locations_list_cells(null, "Location", $_POST['Location']);
         
        if (!isset($_POST['DefaultReceivedDate']))
-               $_POST['DefaultReceivedDate'] = Today();
+               $_POST['DefaultReceivedDate'] = new_doc_date();
        
-       date_cells(_("Date Items Received"), 'DefaultReceivedDate', '', null, 0, 0, 0, "class='tableheader2'");    
+       date_cells(_("Date Items Received"), 'DefaultReceivedDate', '', true, 0, 0, 0, "class='tableheader2'");    
         
     } 
     else 
index 14d0288985ac22bb73496c1c72a30b5d6e05167f..d17a676da80ba0c433779f82ff53c580f5ed4b28 100644 (file)
@@ -101,7 +101,7 @@ function invoice_header(&$supp_trans)
 
        table_section(2, "33%");
 
-       date_row(_("Date") . ":", 'tran_date', '', null, 0, 0, 0, "", true);
+       date_row(_("Date") . ":", 'tran_date', '', true, 0, 0, 0, "", true);
        if (isset($_POST['_tran_date_changed'])) {
                $Ajax->activate('_ex_rate');
                $supp_trans->tran_date = $_POST['tran_date'];
index 2b3d639b5d81404ddf11cfde01ab1753d9366061..336b8a6e154fe2ae888726c49a971e574d419d7f 100644 (file)
@@ -40,7 +40,7 @@ function create_new_po()
        session_register("PO");
 
        $_SESSION['PO'] = new purch_order;
-       $_POST['OrderDate'] = Today();
+       $_POST['OrderDate'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['OrderDate']))
                $_POST['OrderDate'] = end_fiscalyear();
        $_SESSION['PO']->orig_order_date = $_POST['OrderDate'];
@@ -109,7 +109,7 @@ function display_po_header(&$order)
        //      if (!is_date_in_fiscalyear($_POST['OrderDate']))
        //              $_POST['OrderDate'] = end_fiscalyear();
        //}
-       date_row(_("Order Date:"), 'OrderDate', '', $_POST['OrderDate'], 0, 0, 0, null, true);
+       date_row(_("Order Date:"), 'OrderDate', '', true, 0, 0, 0, null, true);
        if (isset($_POST['_OrderDate_changed'])) {
                $Ajax->activate('_ex_rate');
        }
index c17dccaa760e154cfcccfe5ac39cbd91e060f31f..2ab43bb791dd1a752fa6239751f67f640df99d63 100644 (file)
@@ -340,7 +340,7 @@ function handle_commit_order()
                        
                        /*its a new order to be inserted */
                        $order_no = add_po($_SESSION['PO']);
-                        
+                       new_doc_date($_SESSION['PO']->orig_order_date); 
                        unset($_SESSION['PO']);
                         
                meta_forward($_SERVER['PHP_SELF'], "AddedID=$order_no");        
@@ -387,7 +387,7 @@ if (isset($_GET['ModifyOrderNumber']) && $_GET['ModifyOrderNumber'] != "")
 
        /*read in all the selected order into the Items cart  */
        read_po($_SESSION['PO']->order_no, $_SESSION['PO']);
-
+       
        copy_from_cart();
 }
 
index 7b50b4da6083e259a1847ed5da9c747bf2456fc0..4029dfc1c64f4a4e1f4eaea43f6187e2ff8e40fb 100644 (file)
@@ -248,6 +248,7 @@ function process_receive_po()
        $grn = add_grn($_SESSION['PO'], $_POST['DefaultReceivedDate'],
                $_POST['ref'], $_POST['Location']);
 
+       new_doc_date($_POST['DefaultReceivedDate']);
        unset($_SESSION['PO']->line_items);
        unset($_SESSION['PO']);
 
@@ -280,7 +281,7 @@ if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived']))
                        $_POST[$line->line_no] = number_format2(0, get_qty_dec($line->stock_id));
 
                if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "")
-                       $_POST['DefaultReceivedDate'] = Today();
+                       $_POST['DefaultReceivedDate'] = new_doc_date();
 
                $_SESSION['PO']->line_items[$line->line_no]->receive_qty = input_num($line->line_no);
 
index df057e28cfe0ee2a9116f3b5a155514088e8f975..30cd4bb6b2d8c6dbd91ec718a8c7cb77337c3ef4 100644 (file)
@@ -79,7 +79,7 @@ function display_controls()
                $_POST['supplier_id'] = get_global_supplier(false);
        if (!isset($_POST['DatePaid']))
        {
-               $_POST['DatePaid'] = Today();
+               $_POST['DatePaid'] = new_doc_date();
                if (!is_date_in_fiscalyear($_POST['DatePaid']))
                        $_POST['DatePaid'] = end_fiscalyear();
        }               
@@ -95,7 +95,7 @@ function display_controls()
        amount_row(_("Amount of Payment:"), 'amount');
        amount_row(_("Amount of Discount:"), 'discount');
 
-    date_row(_("Date Paid") . ":", 'DatePaid', '', null, 0, 0, 0, null, true);
+    date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true);
 
        table_section(2);
        //echo "</table>";
@@ -218,7 +218,7 @@ function handle_add_payment()
        $payment_id = add_supp_payment($_POST['supplier_id'], $_POST['DatePaid'],
                $_POST['bank_account'], input_num('amount'), input_num('discount'), 
                $_POST['ref'], $_POST['memo_'], $rate);
-
+       new_doc_date($_POST['DatePaid']);
        //unset($_POST['supplier_id']);
        unset($_POST['bank_account']);
        unset($_POST['DatePaid']);
index a33f3407152cea083d6ce715a8e272897bbb326e..f27bf8f0ad8617c4c9f9f81bbb6b58179253c707 100644 (file)
@@ -180,6 +180,7 @@ if (isset($_POST['ProcessCredit']) && can_process()) {
        }
        copy_to_cn();
        $credit_no = $_SESSION['Items']->write($_POST['WriteOffGLCode']);
+       new_doc_date($_SESSION['Items']->document_date);
        processing_end();
        meta_forward($_SERVER['PHP_SELF'], "AddedID=$credit_no");
 
index 2d13e54729cb5eb2b2969803c9eae4867cc5518f..70f244fa7449146faa293aa2f0de1ec46b55d1c5 100644 (file)
@@ -126,7 +126,7 @@ if (isset($_GET['InvoiceNumber']) && $_GET['InvoiceNumber'] > 0) {
     $ci->src_docs = $ci->trans_no;
     $ci->src_date = $ci->document_date;
     $ci->trans_no = 0;
-    $ci->document_date = Today();
+    $ci->document_date = new_doc_date();
     $ci->reference = references::get_next(11);
 
     for ($line_no=0; $line_no<count($ci->line_items); $line_no++) {
@@ -207,6 +207,7 @@ if (isset($_POST['ProcessCredit']) && can_process()) {
                $_POST['WriteOffGLCode'] = 0;
 
        copy_to_cart();
+       if ($new_credit) new_doc_date($_SESSION['Items']->document_date);
     $credit_no = $_SESSION['Items']->write($_POST['WriteOffGLCode']);
 
        processing_end();
@@ -273,7 +274,7 @@ function display_credit_items()
 
     label_row(_("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'");
 
-    date_row(_("Credit Note Date"), 'CreditDate', '', null, 0, 0, 0, "class='tableheader2'");
+    date_row(_("Credit Note Date"), 'CreditDate', '', $_SESSION['Items']->trans_no==0, 0, 0, 0, "class='tableheader2'");
 
     end_table();
 
index f779333832f128c5133626e7b5820be25bf07224..9d710729de24b5d2e7d2fff09f6ae783d4f38247 100644 (file)
@@ -96,7 +96,7 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
        $ord->order_no = key($ord->trans_no);
        $ord->trans_no = 0;
        $ord->reference = references::get_next(13);
-       $ord->document_date = Today();
+       $ord->document_date = new_doc_date();
        $_SESSION['Items'] = $ord;
        copy_from_cart();
 
@@ -293,6 +293,7 @@ if (isset($_POST['process_delivery']) && check_data() && check_qoh()) {
        $newdelivery = ($dn->trans_no == 0);
 
        copy_to_cart();
+       if ($new_delivery) new_doc_date($dn->document_date);
        $delivery_no = $dn->write($bo_policy);
 
        processing_end();
@@ -350,12 +351,12 @@ shippers_list_cells(null, 'ship_via', $_POST['ship_via']);
 
 // set this up here cuz it's used to calc qoh
 if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
-       $_POST['DispatchDate'] = Today();
+       $_POST['DispatchDate'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
                $_POST['DispatchDate'] = end_fiscalyear();
        }
 }
-date_cells(_("Date"), 'DispatchDate', '', $_POST['DispatchDate'], 0, 0, 0, "class='tableheader2'");
+date_cells(_("Date"), 'DispatchDate', '', $_SESSION['Items']->trans_no==0, 0, 0, 0, "class='tableheader2'");
 end_row();
 
 end_table();
@@ -367,7 +368,7 @@ start_table("$table_style width=90%");
 if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->customer_id, $_POST['DispatchDate']);
 }
-date_row(_("Invoice Dead-line"), 'due_date', '', $_POST['due_date'], 0, 0, 0, "class='tableheader2'");
+date_row(_("Invoice Dead-line"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'");
 end_table();
 
 echo "</td></tr>";
index 6c43ef2273931246b1b5b5ff3a795411d59d96bd..b0bdbd65539ae9fc88ee269cad73b620dca8c241 100644 (file)
@@ -298,6 +298,7 @@ if (isset($_POST['process_invoice']) && check_data()) {
 
        $newinvoice=  $_SESSION['Items']->trans_no == 0;
        copy_to_cart();
+       if ($new_invoice) new_doc_date($_SESSION['Items']->document_date);
        $invoice_no = $_SESSION['Items']->write();
 
        processing_end();
@@ -367,19 +368,20 @@ label_cell(_("Shipping Company"), "class='tableheader2'");
 shippers_list_cells(null, 'ship_via', $_POST['ship_via']);
 
 if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) {
-       $_POST['InvoiceDate'] = Today();
+       $_POST['InvoiceDate'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) {
                $_POST['InvoiceDate'] = end_fiscalyear();
        }
 }
 
-date_cells(_("Date"), 'InvoiceDate', '', $_POST['InvoiceDate'], 0, 0, 0, "class='tableheader2'", true);
+date_cells(_("Date"), 'InvoiceDate', '', $_SESSION['Items']->trans_no == 0, 
+       0, 0, 0, "class='tableheader2'", true);
 
 if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->customer_id, $_POST['InvoiceDate']);
 }
 
-date_cells(_("Due Date"), 'due_date', '', $_POST['due_date'], 0, 0, 0, "class='tableheader2'");
+date_cells(_("Due Date"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'");
 
 end_row();
 end_table();
index 4f232a9adb6476a8e4b13a77bd700f6bfb4e3cdb..cd7d7dc3e0bba54de307af84327a0e9a52c0ec36 100644 (file)
@@ -148,6 +148,8 @@ if (isset($_POST['AddPaymentItem'])) {
        else
                $rate = input_num('_ex_rate');
 
+       new_doc_date($_POST['DateBanked']);
+
        $payment_no = write_customer_payment(0, $_POST['customer_id'], $_POST['BranchID'],
                $_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'],
                input_num('amount'), input_num('discount'), $_POST['memo_'], $rate);
@@ -185,7 +187,7 @@ function display_item_form()
        if (!isset($_POST['customer_id']))
                $_POST['customer_id'] = get_global_customer(false);
        if (!isset($_POST['DateBanked'])) {
-               $_POST['DateBanked'] = Today();
+               $_POST['DateBanked'] = new_doc_date();
                if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
                        $_POST['DateBanked'] = end_fiscalyear();
                }
@@ -212,7 +214,7 @@ function display_item_form()
 
                label_row(_("Customer prompt payment discount :"), $display_discount_percent);
 
-               date_row(_("Date of Deposit:"), 'DateBanked','',null, 0, 0, 0, null, true);
+               date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
 
                table_section(2);
 
index 286ada110dfad40eee5c2133c843f1e84eb6111d..f388b54cac18e438ba4c17d63eb5db614642814c 100644 (file)
@@ -151,7 +151,7 @@ class cart
                                  $this->customer_id = get_global_customer();
                                else
                                  $this->customer_id = '';
-                               $this->document_date = Today();
+                               $this->document_date =  new_doc_date();
                                if (!is_date_in_fiscalyear($this->document_date))
                                        $this->document_date = end_fiscalyear();
                                $this->reference = references::get_next($this->trans_type);
index 7d650280ce158610607cb2afe31da4ef94bd6667..ef66b0b7d72166792bb172c49be19cbe4d26fa46 100644 (file)
@@ -434,7 +434,7 @@ function get_invoice_duedate($debtorno, $invdate)
 {
        if (!is_date($invdate))
        {
-               return Today();
+               return new_doc_date();
        }
        $sql = "SELECT ".TB_PREF."debtors_master.debtor_no, ".TB_PREF."debtors_master.payment_terms, ".TB_PREF."payment_terms.* FROM ".TB_PREF."debtors_master,
                ".TB_PREF."payment_terms WHERE ".TB_PREF."debtors_master.payment_terms = ".TB_PREF."payment_terms.terms_indicator AND
index 4a74694089528e89bbdebf7b460b8d3b6640db21..0533babe01964d8ea8314413332c49f0c312d3a2 100644 (file)
@@ -60,7 +60,7 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d
 function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=null)
 {
        if ($date == null)
-           $date = Today();
+           $date = new_doc_date();
 
        if ($factor === null) 
        {
index d27fd0a90ebd6a64d0c210077c5edd6fc7c43083..dba384df59a9661e9275d80fa41eb8da459c21d8 100644 (file)
@@ -120,7 +120,7 @@ function display_credit_header(&$order)
        if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
                $_POST['OrderDate'] = $order->document_date;
 
-       date_row(_("Date:"), 'OrderDate', '', null, 0, 0, 0, null, true);
+       date_row(_("Date:"), 'OrderDate', '', $order->trans_no==0, 0, 0, 0, null, true);
        if (isset($_POST['_OrderDate_changed'])) {
                if (!is_company_currency($order->customer_currency) 
                        && (get_base_sales_type()>0)) {
index 28b079cd3ff3192a8a2a15cd07e1ef44237ab970..6665f468cf631d1384609d55c8a7bbafdc6edc08 100644 (file)
@@ -375,8 +375,8 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
                        $_POST['OrderDate'] = $order->document_date;
 
-               date_row($date_text, 'OrderDate',
-                 _('Date of order receive'), null, 0, 0, 0, null, true);
+               date_row($date_text, 'OrderDate', _('Date of order receive'),
+                       $order->trans_no==0, 0, 0, 0, null, true);
                if (isset($_POST['_OrderDate_changed'])) {
                        if (!is_company_currency($order->customer_currency) 
                                && (get_base_sales_type()>0)) {
@@ -553,10 +553,9 @@ function display_delivery_details(&$order)
                        false, true);
                if (list_updated('Location'))
                        check_qoh($order);
-
+//             $_POST['delivery_date'] = get_post('delivery_date', $order->due_date);
                date_row($delname, 'delivery_date',
-                       $order->trans_type==30 ?  _('Enter requested day of delivery') : '', 
-                       $order->due_date, 0, 0, 0);
+                       $order->trans_type==30 ?  _('Enter requested day of delivery') : '');
                text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40,
                        _('Additional identifier for delivery e.g. name of receiving person'));
 
index fcec49da05b23651aa0c842fcecb72ef31a39dea..c63e0f2fc745ddad56426ce053f6ab812c67b0de 100644 (file)
@@ -307,7 +307,7 @@ if (isset($_POST['ProcessOrder']) && can_process()) {
        }
        $trans_no = key($_SESSION['Items']->trans_no);
        $trans_type = $_SESSION['Items']->trans_type;
-
+       new_doc_date($_SESSION['Items']->document_date);
        processing_end();
        if ($modified) {
                meta_forward($_SERVER['PHP_SELF'], "UpdatedID=$trans_no");
@@ -445,7 +445,7 @@ function create_cart($type, $trans_no)
                $doc = new Cart(30, array($trans_no));
                $doc->trans_type = $type;
                $doc->trans_no = 0;
-               $doc->document_date = Today(); // 2006-06-15. Added so Invoices and Deliveries get current day
+               $doc->document_date = new_doc_date();
                if ($type == 10) {
                        $doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date);
                        $doc->pos = user_pos();