3 /* Definition of the purch_order class to hold all the information for a purchase order and delivery
11 var $line_items; /*array of objects of class line_details using the product id as the pointer */
14 var $delivery_address;
19 var $order_no; /*Only used for modification of existing orders otherwise only established when order committed */
24 function purch_order()
26 /*Constructor function initialises a new purchase order object */
27 $this->line_items = array();
28 $this->lines_on_order = $this->order_no = $this->supplier_id = 0;
31 function add_to_order($line_no, $stock_id, $qty, $item_descr, $price, $uom, $req_del_date, $qty_inv, $qty_recd)
33 if ($qty != 0 && isset($qty))
35 $this->line_items[$line_no] = new line_details($line_no, $stock_id, $item_descr, $qty, $price, $uom, $req_del_date, $qty_inv, $qty_recd);
36 $this->lines_on_order++;
42 function update_order_item($line_no, $qty, $price, $req_del_date)
44 $this->line_items[$line_no]->quantity = $qty;
45 $this->line_items[$line_no]->price = $price;
46 $this->line_items[$line_no]->req_del_date = $req_del_date;
47 $this->line_items[$line_no]->price = $price;
50 function remove_from_order($line_no)
52 $this->line_items[$line_no]->Deleted = true;
55 function order_has_items()
57 if (count($this->line_items) > 0)
59 foreach ($this->line_items as $ordered_items)
61 if ($ordered_items->Deleted == false)
70 function clear_items()
72 unset($this->line_items);
73 $this->line_items = array();
75 $this->lines_on_order = 0;
80 function any_already_received()
82 /* Checks if there have been deliveries or invoiced entered against any of the line items */
83 if (count($this->line_items) > 0)
85 foreach ($this->line_items as $ordered_items)
87 if ($ordered_items->qty_received != 0 || $ordered_items->qty_inv != 0)
96 function some_already_received($line_no)
98 /* Checks if there have been deliveries or amounts invoiced against a specific line item */
99 if (count($this->line_items) > 0)
101 if ($this->line_items[$line_no]->qty_received != 0 ||
102 $this->line_items[$line_no]->qty_inv != 0)
109 } /* end of class defintion */
117 Var $item_description;
128 function line_details($line_no, $stock_item, $item_descr, $qty, $prc, $uom, $req_del_date, $qty_inv, $qty_recd)
131 /* Constructor function to add a new LineDetail object with passed params */
132 $this->line_no = $line_no;
133 $this->stock_id = $stock_item;
134 $this->item_description = $item_descr;
135 $this->quantity = $qty;
136 $this->req_del_date = $req_del_date;
139 $this->qty_received = $qty_recd;
140 $this->qty_inv = $qty_inv;
141 $this->receive_qty = 0; /*initialise these last two only */
142 $this->standard_cost =0;
143 $this->Deleted = false;