set_designer_name(); $this->set_invoice_id(); } } function set_designer_name() { if(!isset($this->data)) { return false; } $D = new Designer($this->data['designer_id']); $this->designer_name = $D->data['name']; // designer object not updated yet } function get_designer_name() { return($this->designer_name); } function set_invoice_id() { if(!isset($this->data)) { return false; } if(!$this->invoice_id = Database::ado_get_one("SELECT invoice_id FROM invoice_shipments WHERE shipment_id='".$this->data['id']."'")) { $this->invoice_id = 0; } } function get_invoice_id() { return($this->invoice_id); } function set_items_RS() { // sets $this->items_amount and returns the items RS $sel = "SELECT a.*, b.id as item_id, b.style_number, b.name, b.price, c.item_color_id, c.size_id FROM inventory_shipment_items a, inventory_items b, inventory_item_breakdown c WHERE a.item_id=b.id AND a.item_breakdown_id=c.id AND a.shipment_id=".$this->data['id']." ORDER BY a.id"; $this->items_RS = Database::ado_execute_query($sel); } function set_items_amount() { $this->items_amount = 0; if(!isset($this->items_RS)) { $this->set_items_RS(); } while($row = $this->items_RS->FetchRow()) { $this->items_amount += $row['quantity'] * $row['unit_cost']; } } function get_items_amount() { if(!isset($this->items_amount)) { $this->set_items_amount(); } return($this->items_amount); } function get_items_html() { // also sets $this->items_amount since loops thru rs $this->items_amount = 0; $html = ' '; if(!isset($this->items_RS)) { $this->set_items_RS(); } while($row = $this->items_RS->FetchRow()) { $amount = $row['quantity'] * $row['unit_cost']; $this->items_amount += $amount; if(!$color = Database::ado_get_one("SELECT color FROM ".Config::$db_tables['inventory_item_colors']." WHERE id=".$row['item_color_id'])) { $color = ''; } if(!$size = Database::ado_get_one("SELECT size FROM ".Config::$db_tables['inventory_sizes']." WHERE id=".$row['size_id'])) { $size = ''; } $html .= ' '; } $html .= '
Style # Item Name Color Size Quantity Retail Cost Amount
'.$row['style_number'].' '.$row['name'].' '.$color.' '.$size.' '.$row['quantity'].' $'.number_format($row['price'],2).' $'.number_format($row['unit_cost'],2).' $'.number_format($amount,2).'
'; return($html); } } ?>