Table openpetra_trunk.public.a_ar_discount
defines a discount that depends on other conditions or can just be assigned to an invoice or article

Generated by
SchemaSpy
Legend: SourceForge.net
Primary key columns
Columns with indexes
Implied relationships
Excluded column relationships
< n > number of related tables
 
Column Type Size Nulls Auto Default Children Parents Comments
a_ar_discount_code_c varchar 100
a_ar_default_discount.a_ar_discount_code_c ar_default_discount_fk2 R
a_ar_discount_per_category.a_ar_discount_code_c ar_discount_per_category_fk2 R
a_ar_invoice_detail_discount.a_ar_discount_code_c a_ar_invoice_detail_discount_fk2 R
a_ar_invoice_discount.a_ar_discount_code_c a_ar_invoice_discount_fk2 R
code that identifies the discount
a_ar_date_valid_from_d date 13
a_ar_default_discount.a_ar_date_valid_from_d ar_default_discount_fk2 R
a_ar_discount_per_category.a_ar_date_valid_from_d ar_discount_per_category_fk2 R
a_ar_invoice_detail_discount.a_ar_discount_date_valid_from_d a_ar_invoice_detail_discount_fk2 R
a_ar_invoice_discount.a_ar_discount_date_valid_from_d a_ar_invoice_discount_fk2 R
date from which this discount is valid
a_ar_adhoc_l bool 1  √  true this discount has only be created on the fly and should not be reusable elsewhere
a_active_l bool 1  √  true flag that prevents this discount from being used, to avoid too long lists in comboboxes etc
a_ar_discount_percentage_n numeric 5,2  √  0 discount percentage; can be negative for expensive rooms etc
a_ar_discount_absolute_n numeric 24,10  √  null the absolute discount that is substracted from the article price; can be negative as well
a_ar_absolute_amount_n numeric 24,10  √  null the absolute amount that is charged if this discount applies; e.g. 3 books for 5 Pound
a_currency_code_c varchar 16
a_currency.a_currency_code_c ar_discount_fk1 R
the currency in which the absolute discount or amount is given
a_ar_number_of_items_i int4 10  √  null this discount applies for this number of items that are bought at the same time
a_ar_minimum_number_of_items_i int4 10  √  null this discount applies for all of the items if at least this number of items is bought at the same time
a_ar_number_of_nights_i int4 10  √  null this discount applies for this number of nights that the individual or group stays; this is needed because 100 people staying for one night do cost more than 50 people staying for 2 nights
a_ar_minimum_number_of_nights_i int4 10  √  null this discount applies for all of the nights if the individual or group stays at least for the given amount of nights; this is needed because 100 people staying for one night do cost more than 50 people staying for 2 nights
a_ar_whole_room_l bool 1  √  null this discount applies when a whole room is booked rather than just a bed
a_ar_children_l bool 1  √  null this discount applies for a children (e.g. meals)
a_ar_early_booking_days_i int4 10  √  null this discount applies when the booking has been done so many days before the stay (using ph_booking.ph_confirmed_d and ph_in_d)
a_ar_early_payment_days_i int4 10  √  null this discount applies when the payment has been received within the given number of days after the invoice has been charged
a_ar_article_code_c varchar 100  √  null
a_ar_article.a_ar_article_code_c ar_discount_fk3 R
this discount applies if the article code matches
p_partner_type_code_c varchar 20  √  null
p_type.p_type_code_c ar_discount_fk2 R
this discounts applies to partners of this type
s_date_created_d date 13  √  ('now'::text)::date
s_created_by_c varchar 20  √  null
s_user.s_user_id_c a_ar_discount_fkcr R
s_date_modified_d date 13  √  null
s_modified_by_c varchar 20  √  null
s_user.s_user_id_c a_ar_discount_fkmd R
s_modification_id_c varchar 150  √  null

Table contained 0 rows at Do Nov 10 18:00 MEZ 2011

Indexes:
Column(s) Type Sort Constraint Name
a_ar_discount_code_c + a_ar_date_valid_from_d Primary key Asc/Asc ar_discount_pk
s_created_by_c Performance Asc inx_a_ar_discount_fkcr_key1
s_modified_by_c Performance Asc inx_a_ar_discount_fkmd_key2
a_currency_code_c Performance Asc inx_ar_discount_fk1_key3
p_partner_type_code_c Performance Asc inx_ar_discount_fk2_key4
a_ar_article_code_c Performance Asc inx_ar_discount_fk3_key5
a_ar_discount_code_c + a_ar_date_valid_from_d Must be unique Asc/Asc inx_ar_discount_pk0

Close relationships  within of separation: