Improved Customer and Supplier Balances Report. Option to choose last column as balance.
[fa-stable.git] / sales / includes / cart_class.inc
index 40fb2a3f2fef9bf9798e92440b23cf2d76280467..4b01809feba94a838edcec70a395ef0c93241c61 100644 (file)
@@ -104,6 +104,9 @@ class cart
 
                $this->trans_type = $type;
                $this->reference = $Refs->get_next($this->trans_type);
+               if ($type == ST_CUSTCREDIT)
+                   $this->src_date = $this->document_date;
+
                $this->document_date = new_doc_date();
 
                for($line_no = 0; $line_no < count($this->line_items); $line_no++) {
@@ -124,9 +127,6 @@ class cart
                        $this->due_date = get_invoice_duedate($this->payment, $this->document_date);
                }
 
-               if ($type == ST_CUSTCREDIT)
-                   $this->src_date = $this->document_date;
-
                $this->src_docs = $this->trans_no;
                $this->trans_no = 0;
        }
@@ -253,6 +253,8 @@ class cart
                        $ref = $this->reference;
                        $date = $this->document_date;
                        $due_date = $this->due_date;
+                       $dimension_id = $this->dimension_id;
+                       $dimension2_id = $this->dimension2_id;
                        $this->trans_type = get_parent_type($this->trans_type);
 
                        $this->reference = 'auto'; 
@@ -263,6 +265,8 @@ class cart
                        $this->document_date = $date;
                        $this->reference = $ref;
                        $this->due_date = $due_date;
+                       $this->dimension_id = $dimension_id;
+                       $this->dimension2_id = $dimension2_id;
                }
                $this->reference = @html_entity_decode($this->reference, ENT_QUOTES);
                $this->Comments = @html_entity_decode($this->Comments, ENT_QUOTES);