Changed purch_order.requisition_no field name to supp_reference, cleanups in purch_or...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 7 Jul 2019 14:24:23 +0000 (16:24 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 19 Aug 2019 10:41:58 +0000 (12:41 +0200)
purchasing/includes/db/po_db.inc
purchasing/includes/db/supp_trans_db.inc
purchasing/includes/db/suppalloc_db.inc
purchasing/includes/po_class.inc
reporting/includes/doctext.inc
reporting/includes/pdf_report.inc
sql/alter2.5.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index 75da89da6eb83c0cf7fb26abe8b09b23437421d0..a18083ce7a02b49230e9d2897256191564cb7b1f 100644 (file)
@@ -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,
index 8a2f85a9701b4acf2117bbf896abe80360f15dba..33a2164f86fa634a8bdfdcdee7bce4ef2755ca1f 100644 (file)
@@ -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, 
index e8506bb04c6ff5101ae788730aa0bb03a861ad7c..3d9ca4c154a1ff2a3504fb44008c74d3baacb9a6 100644 (file)
@@ -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
index 970cce200f72a34a81aa165858084004048bf1d3..22a9bc65b454d48a3a370fe25387f7ae79b14f05 100644 (file)
@@ -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.
        //
index 4b87fa6df229df98b78d41ccfc5c18e7b8276c29..e1bcd635549e5a1434a5e82edbeaa83182dc9e0a 100644 (file)
                                _("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']),
                        );
 
index 5b468764fd2ed194af318adf0836b85840307230..4347f3c7642bfb1af0be5b4bda485d2faaedf616 100644 (file)
@@ -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')
index 5e7680c201dfbaea4263e9dc2bd00538336f7190..d5dcea0bf6a2de36681cfddc313e2913cafe6a92 100644 (file)
@@ -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;
 
index 3d3ee277140483a329f444d0051d508513b5a7cf..ca9656ba81c2fdd011ec28047d1723b5241211a3 100644 (file)
@@ -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',
index f597b8fa19f9abc3f535b9b273537fd5bf5cdab1..6e8d8241a11bfd01562cc997d2ec9ae13bc7274c 100644 (file)
@@ -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',