X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fsupp_trans_class.inc;h=99fe1934f7fcf65a183362c7e97fc4be72a53963;hb=7561718ee5113232ce917f63085d272884b0929c;hp=c36fa8163a901813939a40702b16aad18929b6a9;hpb=1431b89949b816de1d9304875bdde655cbdf9cc1;p=fa-stable.git diff --git a/purchasing/includes/supp_trans_class.inc b/purchasing/includes/supp_trans_class.inc index c36fa816..99fe1934 100644 --- a/purchasing/includes/supp_trans_class.inc +++ b/purchasing/includes/supp_trans_class.inc @@ -29,10 +29,12 @@ class supp_trans var $tax_included; var $trans_type; // invoice or credit + var $trans_no; var $Comments; var $tran_date; var $due_date; + var $src_docs = array(); // source invoice for this credit note (if any) var $supp_reference; var $reference; @@ -41,14 +43,35 @@ class supp_trans var $ov_gst; var $gl_codes_counter=0; var $credit = 0; + var $tax_algorithm; + var $stored_algorithm; + var $currency; var $tax_overrides = array(); // array of taxes manually inserted during sales invoice entry - function supp_trans($trans_type) + var $dimension, + $dimension2; + + function supp_trans($trans_type, $trans_no=0) { $this->trans_type = $trans_type; /*Constructor function initialises a new Supplier Transaction object */ - $this->grn_items = array(); - $this->gl_codes = array(); + $this->read($trans_type, $trans_no); + } + + function read($trans_type, $trans_no) + { + $this->trans_type = $trans_type; + $this->trans_no = $trans_no; + $this->grn_items = array(); + $this->gl_codes = array(); + if ($trans_no) { + read_supp_invoice($trans_no, $trans_type, $this); + if ($trans_type == ST_SUPPCREDIT) + { + $this->src_docs = find_src_invoices($trans_no); + } + read_supplier_details_to_trans($this, $this->supplier_id); + } } function add_grn_to_trans($grn_item_id, $po_detail_item, $item_code, $item_description, @@ -58,6 +81,9 @@ class supp_trans $this->grn_items[$grn_item_id] = new grn_item($grn_item_id, $po_detail_item, $item_code, $item_description, $qty_recd, $prev_quantity_inv, $this_quantity_inv, $order_price, $chg_price, $std_cost_unit, $gl_code, $this->tax_included); + + $this->src_docs = find_src_invoices($this); + unset($this->tax_overrides); // cancel tax overrides after cart change return 1; } @@ -119,7 +145,7 @@ class supp_trans if ($tax_group_id == null) $tax_group_id = $this->tax_group_id; $taxes = get_tax_for_items($items, $prices, $shipping_cost, $tax_group_id, - $this->tax_included); + $this->tax_included, null, $this->tax_algorithm); if (isset($this->tax_overrides)) foreach($this->tax_overrides as $id => $value) // add values entered manually @@ -168,7 +194,9 @@ class supp_trans } return $total; } - + // + // Returns transaction total + // function get_items_total() { $total = 0; @@ -262,4 +290,3 @@ class gl_codes } } -?>