Dumped on 2006-12-08

# Index of database - phpaga

- public

- billing_methods
- bills
- companies
- companycat
- config
- countries
- currencies
- expenses
- files
- jobcat
- languages
- lineitems
- log
- material
- operationcat
- operations
- personcat
- persons
- productcat
- products
- project_members
- projectcat
- projects
- projects_hourlyrates
- projectstatus
- quotations
- schedtasks
- userconfig
- users
- v_manhours_weekly_perperson
- v_summary_notbilledhours
- v_summary_notbilledhours_bycustomer
- month( date )
- year( date )
- year( timestamp with time zone )
- year( timestamp without time zone )

## Table: billing_methods

billing_methods Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| bmt_id | bigint | PRIMARY KEY
| bmt_description | character varying(250) | NOT NULL
| bmt_filename | character varying(100) | NOT NULL
countries.ctr_id | ctr_id | smallint | NOT NULL
| bmt_status | smallint |

Tables referencing this one via Foreign Key Constraints:

- bills

- quotations

Index - Schema public

## Table: bills

bills Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| bill_id | bigint | PRIMARY KEY DEFAULT nextval(('bills_bill_id_seq'::text)::regclass)
| bill_desc | text |
| bill_number | character varying(10) | NOT NULL
| bill_date | date | NOT NULL
companies.cpn_id | cpn_id | bigint | NOT NULL
| bill_sent | smallint | NOT NULL
| bill_paydate | date |
| bill_startsum | numeric(12,2) | NOT NULL
| bill_endsum | numeric(12,2) | NOT NULL
billing_methods.bmt_id | bmt_id | bigint | NOT NULL
currencies.curr_id | curr_id | smallint | NOT NULL
| bill_footer | character varying(255) |
| bill_payterm | character varying(30) |

Tables referencing this one via Foreign Key Constraints:

- expenses

- lineitems

- material

- operations

Index - Schema public

## Table: companies

companies Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| cpn_id | bigint | PRIMARY KEY DEFAULT nextval(('companies_cpn_id_seq'::text)::regclass)
| cpn_name | character varying(100) | NOT NULL
| cpn_address | character varying(250) |
| cpn_city | character varying(100) |
| cpn_zip | character varying(30) |
| cpn_region | character varying(40) |
countries.ctr_id | ctr_id | integer | NOT NULL
companycat.ccat_id | ccat_id | smallint | NOT NULL
| cpn_taxnr | character varying(30) |
| cpn_url | character varying(200) |
| cpn_phone | character varying(30) |
| cpn_fax | character varying(30) |
| cpn_email | character varying(100) |
| cpn_public | smallint |
| pe_id | bigint | NOT NULL
| cpn_logoname | character varying(250) |
| cpn_bill_footer | character varying(250) |
| cpn_owner_taxnr | character varying(30) |
| cpn_address2 | character varying(250) |
| cpn_defaultpayterm | character varying(30) |

Tables referencing this one via Foreign Key Constraints:

- bills

- persons

- projects

- quotations

Index - Schema public

## Table: companycat

companycat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| ccat_id | smallint | PRIMARY KEY DEFAULT nextval(('companycat_ccat_id_seq'::text)::regclass)
| ccat_title | character varying(30) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- companies

Index - Schema public

## Table: config

config Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| cfg_id | integer | PRIMARY KEY DEFAULT nextval(('config_cfg_id_seq'::text)::regclass)
| cfg_key | character varying(60) | NOT NULL
| cfg_value | character varying(200) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- userconfig

Index - Schema public

## Table: countries

countries Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| ctr_id | bigint | PRIMARY KEY DEFAULT nextval(('countries_ctr_id_seq'::text)::regclass)
| ctr_name | character varying(30) | NOT NULL
| ctr_code | character varying(4) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- billing_methods

- companies

- persons

Index - Schema public

## Table: currencies

currencies Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| curr_id | smallint | PRIMARY KEY DEFAULT nextval(('currencies_curr_id_seq'::text)::regclass)
| curr_name | character varying(15) | NOT NULL
| curr_decimals | smallint | DEFAULT 2

Tables referencing this one via Foreign Key Constraints:

- bills

- expenses

- quotations

Index - Schema public

## Table: expenses

expenses Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| exp_id | bigint | PRIMARY KEY DEFAULT nextval(('expenses_exp_id_seq'::text)::regclass)
persons.pe_id | pe_id | bigint | NOT NULL
projects.prj_id | prj_id | bigint | NOT NULL
| exp_desc | text | NOT NULL
| exp_sum | numeric(12,2) | NOT NULL
currencies.curr_id | curr_id | smallint | NOT NULL
| exp_sum_foreign | numeric(12,2) |
currencies.curr_id | curr_id_foreign | smallint |
| exp_date | date | NOT NULL
| exp_exchange_rate | numeric(12,5) |
bills.bill_id | bill_id | bigint |

Index - Schema public

## Table: files

files Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| file_id | bigint | PRIMARY KEY DEFAULT nextval(('files_file_id_seq'::text)::regclass)
| file_added | timestamp without time zone | NOT NULL DEFAULT now()
persons.pe_id | pe_id | bigint | NOT NULL
| file_original_name | character varying(500) | NOT NULL
| file_local_name | character varying(100) | NOT NULL
| file_rel_type | integer | NOT NULL
| file_rel_id | bigint | NOT NULL
| file_mimetype | character varying(30) |

Index - Schema public

## Table: jobcat

jobcat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| jcat_id | smallint | PRIMARY KEY DEFAULT nextval(('jobcat_jcat_id_seq'::text)::regclass)
| jcat_title | character varying(30) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- persons

- project_members

Index - Schema public

## Table: languages

languages Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| lng_id | bigint | PRIMARY KEY DEFAULT nextval(('languages_lng_id_seq'::text)::regclass)
| lng_name | character varying(30) | NOT NULL
| lng_code | character varying(4) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- users

Index - Schema public

## Table: lineitems

lineitems Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| lit_id | bigint | PRIMARY KEY DEFAULT nextval(('lineitems_lit_id_seq'::text)::regclass)
bills.bill_id | bill_id | bigint |
quotations.quot_id | quot_id | bigint |
operations.op_id | op_id | bigint |
| lit_prodcode | character varying(18) |
| lit_desc | text |
| lit_qty | character varying(10) |
| lit_netprice | numeric(12,2) |
material.mat_id | mat_id | bigint |

Index - Schema public

## Table: log

log Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| id | integer | PRIMARY KEY
| logtime | timestamp without time zone | NOT NULL
| ident | character(16) | NOT NULL
| priority | integer | NOT NULL
| message | text |

Index - Schema public

## Table: material

material Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| mat_id | bigint | PRIMARY KEY DEFAULT nextval(('material_mat_id_seq'::text)::regclass)
| mat_prodcode | character varying(100) |
products.prod_id | prod_id | bigint |
| mat_name | character varying(100) |
| mat_desc | text |
| mat_qty | integer |
| mat_price | numeric(12,2) | NOT NULL
| curr_id | smallint | NOT NULL
| mat_added | timestamp without time zone | NOT NULL DEFAULT now()
projects.prj_id | prj_id | bigint | NOT NULL
persons.pe_id | pe_id | bigint | NOT NULL
bills.bill_id | bill_id | bigint |

Tables referencing this one via Foreign Key Constraints:

- lineitems

Index - Schema public

## Table: operationcat

operationcat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| opcat_id | bigint | PRIMARY KEY DEFAULT nextval(('operationcat_opcat_id_seq'::text)::regclass)
| opcat_title | character varying(30) | NOT NULL
| opcat_color | character varying(20) |
| opcat_hourlyrate | numeric(12,2) |

Tables referencing this one via Foreign Key Constraints:

- operations

- projects_hourlyrates

- schedtasks

Index - Schema public

## Table: operations

operations Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| op_id | bigint | PRIMARY KEY DEFAULT nextval(('operations_op_id_seq'::text)::regclass)
persons.pe_id | pe_id | bigint | NOT NULL
projects.prj_id | prj_id | bigint | NOT NULL
operationcat.opcat_id | opcat_id | bigint | NOT NULL
| op_desc | text | NOT NULL
| op_timestamp_start | integer |
| op_timestamp_end | integer |
| op_duration | integer | NOT NULL
bills.bill_id | bill_id | bigint |
| op_billabletype | integer |
| op_amount | numeric(12,2) |
schedtasks.sct_id | sct_id | bigint |

Tables referencing this one via Foreign Key Constraints:

- lineitems

Index - Schema public

## Table: personcat

personcat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| pecat_id | smallint | PRIMARY KEY DEFAULT nextval(('personcat_pecat_id_seq'::text)::regclass)
| pecat_title | character varying(30) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- persons

Index - Schema public

## Table: persons

persons Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| pe_id | bigint | PRIMARY KEY DEFAULT nextval(('persons_pe_id_seq'::text)::regclass)
| pe_lastname | character varying(100) | NOT NULL
| pe_firstname | character varying(50) |
| pe_address | character varying(250) |
| pe_city | character varying(100) |
| pe_zip | character varying(30) |
| pe_region | character varying(40) |
countries.ctr_id | ctr_id | integer | NOT NULL
personcat.pecat_id | pecat_id | bigint |
| pe_taxnr | character varying(30) |
| pe_url | character varying(200) |
| pe_phonework | character varying(30) |
| pe_phonemobile | character varying(30) |
| pe_phonehome | character varying(30) |
| pe_fax | character varying(30) |
| pe_email | character varying(100) |
companies.cpn_id | cpn_id | bigint |
jobcat.jcat_id | jcat_id | bigint |
| pe_note | text |
| pe_fotoname | character varying(250) |
| pe_public | smallint |
| pe_pe_id | bigint | NOT NULL
| pe_address2 | character varying(250) |
| pe_hourlyrate | numeric(12,2) |

Tables referencing this one via Foreign Key Constraints:

- expenses

- files

- material

- operations

- project_members

- projects

- projects_hourlyrates

- schedtasks

- users

Index - Schema public

## Table: productcat

productcat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| prcat_id | bigint | PRIMARY KEY DEFAULT nextval(('productcat_prcat_id_seq'::text)::regclass)
| prcat_title | character varying(100) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- products

Index - Schema public

## Table: products

products Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| prod_id | bigint | PRIMARY KEY DEFAULT nextval(('products_prod_id_seq'::text)::regclass)
| prod_code | character varying(18) | NOT NULL
| prod_name | character varying(100) | NOT NULL
| prod_price | numeric(12,2) |
| prod_consumption | numeric(12,4) |
| prod_stock | integer |
productcat.prcat_id | prcat_id | bigint |
| prod_created | timestamp without time zone | NOT NULL DEFAULT now()
| prod_lastmod | timestamp without time zone | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- material

Index - Schema public

## Table: project_members

project_members Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
projects.prj_id | prj_id | bigint | PRIMARY KEY
persons.pe_id | pe_id | bigint | PRIMARY KEY
jobcat.jcat_id | jcat_id | bigint |
| prjmem_added | timestamp without time zone | NOT NULL DEFAULT now()
| prjmem_pe_id | bigint | NOT NULL
| prjmem_hourlyrate | numeric(12,2) |

Index - Schema public

## Table: projectcat

projectcat Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| prjcat_id | smallint | PRIMARY KEY DEFAULT nextval(('projectcat_prjcat_id_seq'::text)::regclass)
| prjcat_title | character varying(30) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- projects

Index - Schema public

## Table: projects

projects Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| prj_id | bigint | PRIMARY KEY DEFAULT nextval(('projects_prj_id_seq'::text)::regclass)
| prj_title | character varying(200) | NOT NULL
| prj_desc | text |
| prj_startdate | date |
| prj_estimatedend | date |
| prj_enddate | date |
projectstatus.prjstat_id | prj_status | smallint | NOT NULL
companies.cpn_id | cpn_id | bigint | NOT NULL
projectcat.prjcat_id | prjcat_id | smallint | NOT NULL
| pe_id | bigint | NOT NULL
companies.cpn_id | cpn_id_issuebill | bigint |
projects.prj_id | prj_prj_id | bigint |
| prj_deadline | date |
| prj_planned_manhours | integer |
| prj_planned_cost_manhours | numeric(12,2) |
| prj_planned_cost_material | numeric(12,2) |
| prj_billabletype | integer |
| prj_priority | smallint |
quotations.quot_id | quot_id | bigint |
persons.pe_id | prj_manager_pe_id | bigint |

Tables referencing this one via Foreign Key Constraints:

- expenses

- material

- operations

- project_members

- projects

- projects_hourlyrates

- schedtasks

Index - Schema public

## Table: projects_hourlyrates

projects_hourlyrates Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| phr_id | bigint | PRIMARY KEY DEFAULT nextval(('projects_hourlyrates_phr_id_seq'::text)::regclass)
| phr_lastmod | timestamp without time zone | NOT NULL DEFAULT now()
persons.pe_id | pe_id_lastmod | bigint | NOT NULL
projects.prj_id | prj_id | bigint | NOT NULL
persons.pe_id | pe_id | bigint |
operationcat.opcat_id | opcat_id | bigint | NOT NULL
| phr_hourlyrate | numeric(12,2) | NOT NULL

Index - Schema public

## Table: projectstatus

projectstatus Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| prjstat_id | smallint | PRIMARY KEY DEFAULT nextval(('projectstatus_prjstat_id_seq'::text)::regclass)
| prjstat_title | character varying(15) | NOT NULL

Tables referencing this one via Foreign Key Constraints:

- projects

Index - Schema public

## Table: quotations

quotations Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| quot_id | bigint | PRIMARY KEY DEFAULT nextval(('quotations_quot_id_seq'::text)::regclass)
| quot_desc | text |
| quot_number | character varying(10) | NOT NULL
| quot_date | date | NOT NULL
companies.cpn_id | cpn_id | bigint | NOT NULL
| quot_sent | smallint | NOT NULL
| quot_startsum | numeric(12,2) | NOT NULL
| quot_endsum | numeric(12,2) | NOT NULL
billing_methods.bmt_id | bmt_id | bigint | NOT NULL
currencies.curr_id | curr_id | smallint | NOT NULL
| quot_footer | character varying(255) |
| quot_payterm | character varying(30) |

Tables referencing this one via Foreign Key Constraints:

- lineitems

- projects

Index - Schema public

## Table: schedtasks

schedtasks Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| sct_id | bigint | PRIMARY KEY DEFAULT nextval(('schedtasks_sct_id_seq'::text)::regclass)
| sct_added | timestamp without time zone | NOT NULL DEFAULT now()
persons.pe_id | pe_id_createdby | bigint | NOT NULL
persons.pe_id | pe_id_assignedto | bigint | NOT NULL
projects.prj_id | prj_id | bigint | NOT NULL
operationcat.opcat_id | opcat_id | bigint |
| sct_title | character varying(250) | NOT NULL
| sct_desc | text |
| sct_target_start | timestamp without time zone |
| sct_target_end | timestamp without time zone |
| sct_target_duration | integer |
| sct_target_manhours | integer |
| sct_budget_cost_manhours | numeric(12,2) |
| sct_budget_cost_material | numeric(12,2) |
| sct_budget_cost_expenses | numeric(12,2) |
schedtasks.sct_id | sct_sct_id | bigint |

Tables referencing this one via Foreign Key Constraints:

- operations

- schedtasks

Index - Schema public

## Table: userconfig

userconfig Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
config.cfg_id | cfg_id | integer | PRIMARY KEY
users.usr_id | usr_id | bigint | PRIMARY KEY
| cfg_value | character varying(200) | NOT NULL

Index - Schema public

## Table: users

users Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| usr_id | bigint | PRIMARY KEY DEFAULT nextval(('users_usr_id_seq'::text)::regclass)
persons.pe_id | pe_id | bigint | NOT NULL
languages.lng_id | lng_id | smallint | NOT NULL
| usr_login | character varying(15) | NOT NULL
| usr_passwd | character varying(50) | NOT NULL
| usr_priv | smallint | NOT NULL DEFAULT (0)::smallint
| usr_pe_id | bigint | NOT NULL
| usr_skin | character varying(20) |
| usr_perm | character varying(250) |

Tables referencing this one via Foreign Key Constraints:

- userconfig

Index - Schema public

## View: v_manhours_weekly_perperson

v_manhours_weekly_perperson Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| pe_lastname | character varying(100) |
| pe_firstname | character varying(50) |
| mhrs_date | text |
| mhrs_duration | bigint |

    SELECT p.pe_lastname
    , p.pe_firstname
    , to_char
    (
         (
               (o.op_timestamp_start)::abstime
         )::timestamp without time zone
         ,'YYYY iw'::text
    ) AS mhrs_date
    , (sum
         (o.op_duration) / 60
    ) AS mhrs_duration
    FROM (operations o
    LEFT JOIN persons p
        ON (
               (p.pe_id = o.pe_id)
         )
    )
    GROUP BY o.pe_id
    , p.pe_lastname
    , p.pe_firstname
    , to_char
    (
         (
               (o.op_timestamp_start)::abstime
         )::timestamp without time zone
         ,'YYYY iw'::text
    );

Index - Schema public

## View: v_summary_notbilledhours

v_summary_notbilledhours Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| cpn_id | bigint |
| cpn_name | character varying(100) |
| prj_id | bigint |
| prj_title | character varying(200) |
| prj_duration | bigint |
| prj_amount | double precision |
| op_min_start | text |
| op_max_end | text |

    SELECT p.cpn_id
    , c.cpn_name
    , p.prj_id
    , p.prj_title
    , sum
    (o.op_duration) AS prj_duration
    , sum
    (
         (
               (CASE WHEN
                     (ph.phr_hourlyrate IS NOT NULL) THEN ph.phr_hourlyrate ELSE CASE WHEN
                     (pm.prjmem_hourlyrate IS NOT NULL) THEN pm.prjmem_hourlyrate ELSE phn.phr_hourlyrate END END
               )::double precision *
               (
                     (o.op_duration)::double precision /
                     (60)::double precision
               )
         )
    ) AS prj_amount
    , to_char
    (
         (
               (min
                     (o.op_timestamp_start)
               )::abstime
         )::timestamp with time zone
         ,'yyyy-mm-dd hh:mi'::text
    ) AS op_min_start
    , to_char
    (
         (
               (max
                     (o.op_timestamp_end)
               )::abstime
         )::timestamp with time zone
         ,'yyyy-mm-dd hh:mi'::text
    ) AS op_max_end
    FROM (
         (
               (
                     (
                           (projects p
                         LEFT JOIN operations o
                                ON (
                                       (o.prj_id = p.prj_id)
                                 )
                           )
                   LEFT JOIN project_members pm
                          ON (
                                 (
                                       (pm.prj_id = o.prj_id)
                                     AND (pm.pe_id = o.pe_id)
                                 )
                           )
                     )
             LEFT JOIN companies c
                    ON (
                           (c.cpn_id = p.cpn_id)
                     )
               )
       LEFT JOIN projects_hourlyrates ph
              ON (
                     (
                           (
                                 (ph.opcat_id = o.opcat_id)
                               AND (ph.prj_id = o.prj_id)
                           )
                         AND (ph.pe_id = o.pe_id)
                     )
               )
         )
    LEFT JOIN projects_hourlyrates phn
        ON (
               (
                     (
                           (phn.opcat_id = o.opcat_id)
                         AND (phn.prj_id = o.prj_id)
                     )
                   AND (phn.pe_id IS NULL)
               )
         )
    )
    WHERE (
         (
               (
                     (p.prj_billabletype IS NULL)
                    OR (p.prj_billabletype = 0)
               )
             AND (
                     (o.bill_id IS NULL)
                    OR (o.bill_id = 0)
               )
         )
       AND (
               (o.op_billabletype IS NULL)
              OR (o.op_billabletype = 0)
         )
    )
    GROUP BY p.cpn_id
    , c.cpn_name
    , p.prj_id
    , p.prj_title
    ORDER BY c.cpn_name
    , p.prj_title;

Index - Schema public

## View: v_summary_notbilledhours_bycustomer

v_summary_notbilledhours_bycustomer Structure
F-Key | Name | Type | Description
--- | --- | --- | ---
| cpn_id | bigint |
| cpn_name | character varying(100) |
| prj_duration | bigint |
| prj_amount | double precision |
| op_min_start | text |
| op_max_end | text |

    SELECT p.cpn_id
    , c.cpn_name
    , sum
    (o.op_duration) AS prj_duration
    , sum
    (
         (
               (CASE WHEN
                     (ph.phr_hourlyrate IS NOT NULL) THEN ph.phr_hourlyrate ELSE CASE WHEN
                     (pm.prjmem_hourlyrate IS NOT NULL) THEN pm.prjmem_hourlyrate ELSE phn.phr_hourlyrate END END
               )::double precision *
               (
                     (o.op_duration)::double precision /
                     (60)::double precision
               )
         )
    ) AS prj_amount
    , to_char
    (
         (
               (min
                     (o.op_timestamp_start)
               )::abstime
         )::timestamp with time zone
         ,'yyyy-mm-dd hh:mi'::text
    ) AS op_min_start
    , to_char
    (
         (
               (max
                     (o.op_timestamp_end)
               )::abstime
         )::timestamp with time zone
         ,'yyyy-mm-dd hh:mi'::text
    ) AS op_max_end
    FROM (
         (
               (
                     (
                           (projects p
                         LEFT JOIN operations o
                                ON (
                                       (o.prj_id = p.prj_id)
                                 )
                           )
                   LEFT JOIN project_members pm
                          ON (
                                 (
                                       (pm.prj_id = o.prj_id)
                                     AND (pm.pe_id = o.pe_id)
                                 )
                           )
                     )
             LEFT JOIN companies c
                    ON (
                           (c.cpn_id = p.cpn_id)
                     )
               )
       LEFT JOIN projects_hourlyrates ph
              ON (
                     (
                           (
                                 (ph.opcat_id = o.opcat_id)
                               AND (ph.prj_id = o.prj_id)
                           )
                         AND (ph.pe_id = o.pe_id)
                     )
               )
         )
    LEFT JOIN projects_hourlyrates phn
        ON (
               (
                     (
                           (phn.opcat_id = o.opcat_id)
                         AND (phn.prj_id = o.prj_id)
                     )
                   AND (phn.pe_id IS NULL)
               )
         )
    )
    WHERE (
         (
               (
                     (p.prj_billabletype IS NULL)
                    OR (p.prj_billabletype = 0)
               )
             AND (
                     (o.bill_id IS NULL)
                    OR (o.bill_id = 0)
               )
         )
       AND (
               (o.op_billabletype IS NULL)
              OR (o.op_billabletype = 0)
         )
    )
    GROUP BY p.cpn_id
    , c.cpn_name
    ORDER BY c.cpn_name;

Index - Schema public

## Function: month( date )

### Returns: double precision

### Language: SQL

    SELECT EXTRACT(MONTH FROM $1);

## Function: year( date )

### Returns: double precision

### Language: SQL

    SELECT EXTRACT(YEAR FROM $1);

## Function: year( timestamp with time zone )

### Returns: integer

### Language: PLPGSQL

      BEGIN
       RETURN date_part('year', $1);
      END;

## Function: year( timestamp without time zone )

### Returns: integer

### Language: PLPGSQL

      BEGIN
       RETURN date_part('year', $1);
      END;

Generated by PostgreSQL Autodoc

W3C HTML 4.01 Strict