From a9ef5cd6f4e00b4f287f113de9f865b6ea439b8e Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sun, 7 Jul 2019 16:24:23 +0200 Subject: [PATCH] Changed purch_order.requisition_no field name to supp_reference, cleanups in purch_order class. --- purchasing/includes/db/po_db.inc | 10 +++---- purchasing/includes/db/supp_trans_db.inc | 2 +- purchasing/includes/db/suppalloc_db.inc | 2 +- purchasing/includes/po_class.inc | 35 +++++++++--------------- reporting/includes/doctext.inc | 2 +- reporting/includes/pdf_report.inc | 2 +- sql/alter2.5.sql | 2 ++ sql/en_US-demo.sql | 2 +- sql/en_US-new.sql | 2 +- 9 files changed, 26 insertions(+), 33 deletions(-) diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index 75da89da..a18083ce 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -71,7 +71,7 @@ function add_po(&$po_obj) /*Insert to purchase order header record */ $sql = "INSERT INTO ".TB_PREF."purch_orders (supplier_id, Comments, ord_date, reference, - requisition_no, into_stock_location, delivery_address, total, tax_included, prep_amount) VALUES("; + supp_reference, into_stock_location, delivery_address, total, tax_included, prep_amount) VALUES("; $sql .= db_escape($po_obj->supplier_id) . "," . db_escape($po_obj->Comments) . ",'" . date2sql($po_obj->tran_date) . "', " . @@ -119,7 +119,7 @@ function update_po(&$po_obj) /*Update the purchase order header with any changes */ $sql = "UPDATE ".TB_PREF."purch_orders SET Comments=" . db_escape($po_obj->Comments) . ", - requisition_no= ". db_escape( $po_obj->supp_ref). ", + supp_reference= ". db_escape( $po_obj->supp_ref). ", into_stock_location=" . db_escape($po_obj->Location). ", ord_date='" . date2sql($po_obj->tran_date) . "', delivery_address=" . db_escape($po_obj->delivery_address).", @@ -188,7 +188,7 @@ function read_po_header($order_no, &$order) $order->tran_date = sql2date($myrow["ord_date"]); $order->Comments = $myrow["comments"]; $order->Location = $myrow["into_stock_location"]; - $order->supp_ref = $myrow["requisition_no"]; + $order->supp_ref = $myrow["supp_reference"]; $order->reference = $myrow["reference"]; $order->delivery_address = $myrow["delivery_address"]; $order->alloc = $myrow["alloc"]; @@ -290,7 +290,7 @@ function get_sql_for_po_search_completed($from, $to, $supplier_id=ALL_TEXT, $loc porder.reference, supplier.supp_name, location.location_name, - porder.requisition_no, + porder.supp_reference, porder.ord_date, supplier.curr_code, Sum(line.unit_price*line.quantity_ordered) AS OrderValue, @@ -352,7 +352,7 @@ function get_sql_for_po_search($from, $to, $supplier_id=ALL_TEXT, $location=ALL_ porder.reference, supplier.supp_name, location.location_name, - porder.requisition_no, + porder.supp_reference, porder.ord_date, supplier.curr_code, Sum(line.unit_price*line.quantity_ordered) AS OrderValue, diff --git a/purchasing/includes/db/supp_trans_db.inc b/purchasing/includes/db/supp_trans_db.inc index 8a2f85a9..33a2164f 100644 --- a/purchasing/includes/db/supp_trans_db.inc +++ b/purchasing/includes/db/supp_trans_db.inc @@ -240,7 +240,7 @@ function get_sql_for_supplier_inquiry($filter, $after_date, $to_date, $supplier_ trans.id as trans_no, trans.reference, supplier.supp_name, - po.requisition_no AS supp_reference, + po.supp_reference, delivery_date as tran_date, '' as due_date, supplier.curr_code, diff --git a/purchasing/includes/db/suppalloc_db.inc b/purchasing/includes/db/suppalloc_db.inc index e8506bb0..3d9ca4c1 100644 --- a/purchasing/includes/db/suppalloc_db.inc +++ b/purchasing/includes/db/suppalloc_db.inc @@ -148,7 +148,7 @@ function get_allocatable_purch_orders($supplier_id = null, $trans_no=null, $type due_dates.date as due_date, supplier.address, amt, - requisition_no as supp_ref + supp_reference as supp_ref FROM ".TB_PREF."purch_orders as porder LEFT JOIN ".TB_PREF."suppliers as supplier ON porder.supplier_id = supplier.supplier_id LEFT JOIN ".TB_PREF."supp_allocations as alloc diff --git a/purchasing/includes/po_class.inc b/purchasing/includes/po_class.inc index 970cce20..22a9bc65 100644 --- a/purchasing/includes/po_class.inc +++ b/purchasing/includes/po_class.inc @@ -16,33 +16,35 @@ class purch_order { var $trans_type; // order/grn/invoice (direct) - var $line_items; - var $curr_code; - var $supp_ref; - var $delivery_address; + var $supplier_id; var $Comments; + var $tran_date; + var $reference; + var $supp_ref; var $Location; - var $supplier_id; + var $delivery_address; + + var $prep_amount = 0; // prepayment required + var $alloc; // sum of payments allocated + var $tax_included; // type of prices + + var $line_items; + var $curr_code; var $supplier_name; - var $tran_date; var $due_date; var $order_no; /*Only used for modification of existing orders otherwise only established when order committed */ var $lines_on_order = 0; var $credit; var $tax_group_id; var $tax_group_array = null; // saves db queries - var $tax_included; // type of prices var $terms; var $ex_rate; var $cash_account; var $dimension, $dimension2; - var $reference; var $tax_overrides = array(); // array of taxes manually inserted during sales invoice entry (direct invoice) - - var $prep_amount = 0; // prepayment required - var $alloc; // sum of payments allocated + var $prepayments = array(); var $fixed_asset = false; @@ -206,8 +208,6 @@ class po_line_details var $price; var $units; var $req_del_date; - var $tax_type; - var $tax_type_name; var $quantity; // this document line quantity var $qty_inv; // quantity already invoiced against this line (all PIs) @@ -236,8 +236,6 @@ class po_line_details $this->req_del_date = $req_del_date; $this->price = $prc; // $this->units = $uom; - $this->tax_type = $item_row["tax_type_id"]; - $this->tax_type_name = $item_row["tax_type_name"]; $this->units = $item_row["units"]; $this->qty_received = $qty_recd; $this->qty_inv = $qty_inv; @@ -246,13 +244,6 @@ class po_line_details $this->qty_ordered = $qty_ordered; } - // Deprecated, use with care. If you need line value as it is calculated in invoice, use taxfree_charge_value below. - function taxfree_charge_price($po) - { - return get_tax_free_price_for_item($this->stock_id, $this->price, - $po->tax_group_id, $po->tax_included, $po->tax_group_array); - } - // // GRN line tax free value. // diff --git a/reporting/includes/doctext.inc b/reporting/includes/doctext.inc index 4b87fa6d..e1bcd635 100644 --- a/reporting/includes/doctext.inc +++ b/reporting/includes/doctext.inc @@ -183,7 +183,7 @@ _("Customer's Reference") => $this->formData['supp_account_no'], _("Sales Person") => $this->formData['contact'], _("Your VAT no.") => $this->formData['tax_id'], - _("Supplier's Reference") => @$this->formData['requisition_no'], + _("Supplier's Reference") => @$this->formData['supp_reference'], _("Order Date") => sql2date($this->formData['document_date']), ); diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 5b468764..4347f3c7 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -398,7 +398,7 @@ class FrontReport extends Cpdf 'DebtorName', 'supp_account_no', 'wo_ref', 'debtor_ref','type', 'trans_no', 'StockItemName', 'tax_id', 'order_', 'delivery_date', 'units_issued', 'due_date', 'required_by', 'payment_terms', 'curr_code', - 'ov_freight', 'ov_gst', 'ov_amount', 'prepaid', 'requisition_no', 'contact'), + 'ov_freight', 'ov_gst', 'ov_amount', 'prepaid', 'supp_reference', 'contact'), 'branch' => array('br_address', 'br_name', 'salesman', 'disable_branch'), 'sales_order' => array('deliver_to', 'delivery_address', 'customer_ref'), 'bankaccount' => array('bank_name', 'bank_account_number', 'payment_service') diff --git a/sql/alter2.5.sql b/sql/alter2.5.sql index 5e7680c2..d5dcea0b 100644 --- a/sql/alter2.5.sql +++ b/sql/alter2.5.sql @@ -1,4 +1,6 @@ # reliable cost change log in stock_moves ALTER TABLE `0_stock_moves` CHANGE COLUMN `standard_cost` `unit_cost` double NOT NULL DEFAULT '0'; ALTER TABLE `0_debtor_trans_details` CHANGE COLUMN `standard_cost` `unit_cost` double NOT NULL DEFAULT '0'; +#naming cleanups +ALTER TABLE `0_purch_orders` CHANGE COLUMN `requisition_no` `supp_reference` tinytext; diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index 3d3ee277..ca9656ba 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -1217,7 +1217,7 @@ CREATE TABLE `0_purch_orders` ( `comments` tinytext, `ord_date` date NOT NULL DEFAULT '0000-00-00', `reference` tinytext NOT NULL, - `requisition_no` tinytext, + `supp_reference` tinytext, `into_stock_location` varchar(5) NOT NULL DEFAULT '', `delivery_address` tinytext NOT NULL, `total` double NOT NULL DEFAULT '0', diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index f597b8fa..6e8d8241 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -984,7 +984,7 @@ CREATE TABLE `0_purch_orders` ( `comments` tinytext, `ord_date` date NOT NULL DEFAULT '0000-00-00', `reference` tinytext NOT NULL, - `requisition_no` tinytext, + `supp_reference` tinytext, `into_stock_location` varchar(5) NOT NULL DEFAULT '', `delivery_address` tinytext NOT NULL, `total` double NOT NULL DEFAULT '0', -- 2.30.2