X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fcart_class.inc;h=062d9bad732a49529f6b417d2af54dce4e625a9f;hb=9a98bb3bc7a94f1a8e47f8dab45a87c8b4212080;hp=f7a41567a4fc45d341e32fe650caa090fc5ca67e;hpb=e20b945e0b934d1b7b036e3fed4f27cce13cc691;p=fa-stable.git diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index f7a41567..062d9bad 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -64,7 +64,9 @@ class cart var $tax_group_array = null; // saves db queries var $price_factor; // ditto for price calculations - var $pos; // user assigned POS (contains cash accont number/name) + var $pos; // user assigned POS + var $cash_account; + var $account_name; var $cash_discount; // not used as of FA 2.1 var $dimension_id; var $dimension2_id; @@ -75,8 +77,8 @@ class cart //------------------------------------------------------------------------- // // $trans_no==0 => open new/direct document - // $trans_no!=0 && $prep_child==false => update with parent constarints for reedition - // $trans_no!=0 && $prep_child==true => prepare for child doc entry + // $trans_no!=0 && $no_edit==false => update with parent constarints for reedition + // $trans_no!=0 && $no_edit==true => read only: for view, or later child doc entry // function Cart($type, $trans_no=0, $prep_child=false) { /*Constructor function initialises a new shopping cart */ @@ -145,7 +147,7 @@ class cart // that child line_items contains subset of parent lines in _the_same_ order ! while (($line_no < count($this->line_items)) && ($srcline = db_fetch($srcdetails))) { $line = &$this->line_items[$line_no]; - $src_docs[] = $srcline['trans_type']==ST_SALESORDER ? $srcline['order_no'] : $srcline['debtor_trans_no']; + $src_docs[] = $src_type == ST_SALESORDER ? $srcline['order_no'] : $srcline['debtor_trans_no']; if ($srcline['id'] == $line->src_id) { if ($this->trans_type == ST_SALESINVOICE) $line->src_no = $srcline['debtor_trans_no']; @@ -153,7 +155,6 @@ class cart $line->quantity += $srcline['quantity'] - ($src_type==ST_SALESORDER ? $srcline['qty_sent'] : $srcline['qty_done']); // add free qty on src doc $line_no++; - break; } } @@ -242,12 +243,13 @@ class cart // Writing new/modified sales document to database. // Makes parent documents for direct delivery/invoice by recurent call. // $policy - 0 or 1: writeoff/return for IV, back order/cancel for DN - function write($policy=0) { + function write($policy=0) { begin_transaction(); // prevents partial database changes in case of direct delivery/invoice if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) { // this is direct document - first add parent $ref = $this->reference; $date = $this->document_date; + $due_date = $this->due_date; $this->trans_type = get_parent_type($this->trans_type); $this->reference = 'auto'; @@ -257,6 +259,7 @@ class cart $this->read($this->trans_type, $trans_no, true); $this->document_date = $date; $this->reference = $ref; + $this->due_date = $due_date; } $this->reference = @html_entity_decode($this->reference, ENT_QUOTES); $this->Comments = @html_entity_decode($this->Comments, ENT_QUOTES); @@ -481,12 +484,12 @@ class cart function get_shipping_tax() { - $tax_items = get_shipping_tax_as_array(); + $tax_items = get_shipping_tax_as_array($this->tax_group_id); $tax_rate = 0; if ($tax_items != null) { foreach ($tax_items as $item_tax) { $index = $item_tax['tax_type_id']; - if (isset($this->tax_group_array[$index])) { + if (isset($this->tax_group_array[$index]['rate'])) { $tax_rate += $item_tax['rate']; } }