/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { parent::init($params); // Build an InvoiceItem filter $where = isset($this->invoiceID) ? sprintf("invoiceid='%d'", $this->invoiceID) : null; // Load the InvoiceItem Table try { // Build the table $items = load_array_InvoiceItemDBO($where); foreach ($items as $dbo) { // Put the row into the table $this->data[] = array("id" => $dbo->getID(), "text" => $dbo->getText(), "unitamount" => $dbo->getUnitAmount(), "quantity" => $dbo->getQuantity(), "amount" => $dbo->getAmount()); } } catch (DBNoRowsFoundException $e) { } }
/** * Set Invoice ID * * @param integer $id Invoice ID */ function setID($id) { $this->id = $id; // Load any line-items for this Invoice try { $this->invoiceitemdbo_array = load_array_InvoiceItemDBO("invoiceid=" . intval($id)); } catch (DBNoRowsFoundException $e) { $this->invoiceitemdbo_array = array(); } // Load any payments for this Invoice try { $this->paymentdbo_array = load_array_PaymentDBO("invoiceid=" . intval($id)); } catch (DBNoRowsFoundException $e) { $this->paymentdbo_array = array(); } }