Proper calculation of due date on template invoices fixed
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 10 Mar 2008 16:02:13 +0000 (16:02 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 10 Mar 2008 16:02:13 +0000 (16:02 +0000)
sales/customer_invoice.php
sales/sales_order_entry.php

index fb726cd01734441a6a3bfc0b4b612ddd2491589b..afbd3513c9e3b205a70278d2a84784763ce3639e 100644 (file)
@@ -107,6 +107,7 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) )
        $dn->src_docs = $dn->trans_no;
        $dn->trans_no = 0;
        $dn->reference = references::get_next(10);
+       $dn->due_date = get_invoice_duedate($dn->customer_id, $dn->document_date);
 
        $_SESSION['Items'] = $dn;
        copy_from_cart();
index 3b1dacb1ad197eb06b25ec06309d9b67ddc446a0..1b204354a7fc05ffeb6bc3957202685ac9c80209 100644 (file)
@@ -355,21 +355,21 @@ function create_cart($type, $trans_no)
        $doc_type = $type;
 
        if($type != 30 && $trans_no != 0) { // this is template
-       $doc_type = 30;
+               $doc_type = 30;
 
-       $doc = new Cart(30, array($trans_no));
-       $doc->trans_type = $type;
-       $doc->trans_no = 0;
+               $doc = new Cart(30, array($trans_no));
+               $doc->trans_type = $type;
+               $doc->trans_no = 0;
 
-       $doc->due_date = $doc->document_date = Today();
-       $doc->reference = references::get_next($doc->trans_type);
-       $doc->Comments='';
-       foreach($doc->line_items as $line_no => $line) {
-               $doc->line_items[$line_no]->qty_done = 0;
-       }
-       $_SESSION['Items'] = $doc;
+               $doc->due_date = $doc->document_date = Today();
+               $doc->reference = references::get_next($doc->trans_type);
+               $doc->Comments='';
+               foreach($doc->line_items as $line_no => $line) {
+                       $doc->line_items[$line_no]->qty_done = 0;
+               }
+               $_SESSION['Items'] = $doc;
        } else
-       $_SESSION['Items'] = new Cart($type,array($trans_no));
+               $_SESSION['Items'] = new Cart($type,array($trans_no));
 
        copy_from_cart();
 }