~katiekitty/+junk/solidstate

« back to all changes in this revision

Viewing changes to solidstate/trunk/widgets/.svn/text-base/InvoiceItemTableWidget.class.php.svn-base

  • Committer: root
  • Date: 2010-01-13 07:44:31 UTC
  • Revision ID: root@ds3-vamp.cs-monitor.cz.cc-20100113074431-kt8ceoeznpjg22x7
Reviving the project

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * InvoiceItemTableWidget.class.php
 
4
 *
 
5
 * This file contains the definition of the InvoiceItemTableWidget class.  
 
6
 *
 
7
 * @package SolidWorks
 
8
 * @author John Diamond <jdiamond@solid-state.org>
 
9
 * @copyright John Diamond <jdiamond@solid-state.org>
 
10
 * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
 
11
 */
 
12
 
 
13
/**
 
14
 * InvoiceItemTableWidget
 
15
 *
 
16
 * @package SolidWorks
 
17
 * @author John Diamond <jdiamond@solid-state.org>
 
18
 */
 
19
class InvoiceItemTableWidget extends TableWidget
 
20
{
 
21
  /**
 
22
   * @var integer Invoice ID
 
23
   */
 
24
  private $invoiceID = null;
 
25
 
 
26
  /**
 
27
   * Initialize the Table
 
28
   *
 
29
   * @param array $params Parameters from the {form_table} tag
 
30
   */
 
31
  public function init( $params ) 
 
32
  { 
 
33
    parent::init( $params );
 
34
 
 
35
    // Build an InvoiceItem filter
 
36
    $where = isset( $this->invoiceID ) ? 
 
37
      sprintf( "invoiceid='%d'", $this->invoiceID ) : null;
 
38
 
 
39
    // Load the InvoiceItem Table
 
40
    try
 
41
      {
 
42
        // Build the table
 
43
        $items = load_array_InvoiceItemDBO( $where );
 
44
        foreach( $items as $dbo )
 
45
          {
 
46
            // Put the row into the table
 
47
            $this->data[] = 
 
48
              array( "id" => $dbo->getID(),
 
49
                     "text" => $dbo->getText(),
 
50
                     "unitamount" => $dbo->getUnitAmount(),
 
51
                     "quantity" => $dbo->getQuantity(),
 
52
                     "amount" => $dbo->getAmount() );
 
53
          }
 
54
      }
 
55
    catch( DBNoRowsFoundException $e ) {}
 
56
  }
 
57
 
 
58
  /**
 
59
   * Set Invoice ID
 
60
   *
 
61
   * @param integer $id Invoice ID
 
62
   */
 
63
  public function setInvoiceID( $id ) { $this->invoiceID = $id; }
 
64
}
 
 
b'\\ No newline at end of file'