Revision c123e944
Von Tamino Steinert vor 7 Monaten hinzugefügt
SL/DB/Helper/ALL.pm | ||
---|---|---|
use SL::DB::PaymentTerm;
|
||
use SL::DB::PeriodicInvoice;
|
||
use SL::DB::PeriodicInvoicesConfig;
|
||
use SL::DB::PeriodicInvoiceItemsConfig;
|
||
use SL::DB::PriceFactor;
|
||
use SL::DB::Pricegroup;
|
||
use SL::DB::Price;
|
SL/DB/Helper/Mappings.pm | ||
---|---|---|
payment_terms => 'payment_term',
|
||
periodic_invoices => 'periodic_invoice',
|
||
periodic_invoices_configs => 'periodic_invoices_config',
|
||
periodic_invoice_items_configs => 'PeriodicInvoiceItemsConfig',
|
||
prices => 'price',
|
||
price_factors => 'price_factor',
|
||
price_rules => 'price_rule',
|
SL/DB/Manager/PeriodicInvoiceItemsConfig.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::Manager::PeriodicInvoiceItemsConfig;
|
||
|
||
use strict;
|
||
|
||
use parent qw(SL::DB::Helper::Manager);
|
||
|
||
sub object_class { 'SL::DB::PeriodicInvoiceItemsConfig' }
|
||
|
||
__PACKAGE__->make_manager_methods;
|
||
|
||
1;
|
SL/DB/MetaSetup/OrderItem.pm | ||
---|---|---|
__PACKAGE__->meta->table('orderitems');
|
||
|
||
__PACKAGE__->meta->columns(
|
||
active_discount_source => { type => 'text', default => '', not_null => 1 },
|
||
active_price_source => { type => 'text', default => '', not_null => 1 },
|
||
base_qty => { type => 'float', precision => 4, scale => 4 },
|
||
cusordnumber => { type => 'text' },
|
||
description => { type => 'text' },
|
||
discount => { type => 'float', precision => 4, scale => 4 },
|
||
id => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
|
||
itime => { type => 'timestamp', default => 'now()' },
|
||
lastcost => { type => 'numeric', precision => 15, scale => 5 },
|
||
longdescription => { type => 'text' },
|
||
marge_percent => { type => 'numeric', precision => 15, scale => 5 },
|
||
marge_price_factor => { type => 'numeric', default => 1, precision => 15, scale => 5 },
|
||
marge_total => { type => 'numeric', precision => 15, scale => 5 },
|
||
mtime => { type => 'timestamp' },
|
||
optional => { type => 'boolean', default => 'false' },
|
||
orderer_id => { type => 'integer' },
|
||
ordnumber => { type => 'text' },
|
||
parts_id => { type => 'integer' },
|
||
position => { type => 'integer', not_null => 1 },
|
||
price_factor => { type => 'numeric', default => 1, precision => 15, scale => 5 },
|
||
price_factor_id => { type => 'integer' },
|
||
pricegroup_id => { type => 'integer' },
|
||
project_id => { type => 'integer' },
|
||
qty => { type => 'numeric', precision => 25, scale => 5 },
|
||
recurring_billing_invoice_id => { type => 'integer' },
|
||
recurring_billing_mode => { type => 'enum', check_in => [ 'never', 'once', 'always' ], db_type => 'items_recurring_billing_mode', default => 'always', not_null => 1 },
|
||
reqdate => { type => 'date' },
|
||
sellprice => { type => 'numeric', precision => 15, scale => 5 },
|
||
serialnumber => { type => 'text' },
|
||
ship => { type => 'float', precision => 4, scale => 4 },
|
||
subtotal => { type => 'boolean', default => 'false' },
|
||
trans_id => { type => 'integer' },
|
||
transdate => { type => 'text' },
|
||
unit => { type => 'varchar', length => 20 },
|
||
active_discount_source => { type => 'text', default => '', not_null => 1 },
|
||
active_price_source => { type => 'text', default => '', not_null => 1 },
|
||
base_qty => { type => 'float', precision => 4, scale => 4 },
|
||
cusordnumber => { type => 'text' },
|
||
description => { type => 'text' },
|
||
discount => { type => 'float', precision => 4, scale => 4 },
|
||
id => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
|
||
itime => { type => 'timestamp', default => 'now()' },
|
||
lastcost => { type => 'numeric', precision => 15, scale => 5 },
|
||
longdescription => { type => 'text' },
|
||
marge_percent => { type => 'numeric', precision => 15, scale => 5 },
|
||
marge_price_factor => { type => 'numeric', default => 1, precision => 15, scale => 5 },
|
||
marge_total => { type => 'numeric', precision => 15, scale => 5 },
|
||
mtime => { type => 'timestamp' },
|
||
optional => { type => 'boolean', default => 'false' },
|
||
orderer_id => { type => 'integer' },
|
||
ordnumber => { type => 'text' },
|
||
parts_id => { type => 'integer' },
|
||
position => { type => 'integer', not_null => 1 },
|
||
price_factor => { type => 'numeric', default => 1, precision => 15, scale => 5 },
|
||
price_factor_id => { type => 'integer' },
|
||
pricegroup_id => { type => 'integer' },
|
||
project_id => { type => 'integer' },
|
||
qty => { type => 'numeric', precision => 25, scale => 5 },
|
||
reqdate => { type => 'date' },
|
||
sellprice => { type => 'numeric', precision => 15, scale => 5 },
|
||
serialnumber => { type => 'text' },
|
||
ship => { type => 'float', precision => 4, scale => 4 },
|
||
subtotal => { type => 'boolean', default => 'false' },
|
||
trans_id => { type => 'integer' },
|
||
transdate => { type => 'text' },
|
||
unit => { type => 'varchar', length => 20 },
|
||
);
|
||
|
||
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
|
||
... | ... | |
key_columns => { project_id => 'id' },
|
||
},
|
||
|
||
recurring_billing_invoice => {
|
||
class => 'SL::DB::Invoice',
|
||
key_columns => { recurring_billing_invoice_id => 'id' },
|
||
},
|
||
|
||
unit_obj => {
|
||
class => 'SL::DB::Unit',
|
||
key_columns => { unit => 'name' },
|
SL/DB/MetaSetup/PeriodicInvoiceItemsConfig.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::PeriodicInvoiceItemsConfig;
|
||
|
||
use strict;
|
||
|
||
use parent qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->table('periodic_invoice_items_configs');
|
||
|
||
__PACKAGE__->meta->columns(
|
||
end_date => { type => 'date' },
|
||
extend_automatically_by => { type => 'integer' },
|
||
once_invoice_id => { type => 'integer' },
|
||
order_item_id => { type => 'integer', not_null => 1 },
|
||
periodicity => { type => 'varchar', length => 10, not_null => 1 },
|
||
start_date => { type => 'date' },
|
||
terminated => { type => 'boolean' },
|
||
);
|
||
|
||
__PACKAGE__->meta->primary_key_columns([ 'order_item_id' ]);
|
||
|
||
__PACKAGE__->meta->foreign_keys(
|
||
once_invoice => {
|
||
class => 'SL::DB::Invoice',
|
||
key_columns => { once_invoice_id => 'id' },
|
||
},
|
||
|
||
order_item => {
|
||
class => 'SL::DB::OrderItem',
|
||
key_columns => { order_item_id => 'id' },
|
||
rel_type => 'one to one',
|
||
},
|
||
);
|
||
|
||
1;
|
||
;
|
SL/DB/PeriodicInvoiceItemsConfig.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::PeriodicInvoiceItemsConfig;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::PeriodicInvoiceItemsConfig;
|
||
use SL::DB::Manager::PeriodicInvoiceItemsConfig;
|
||
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
sql/Pg-upgrade2/periodic_invoices_items.sql | ||
---|---|---|
-- @tag: periodic_invoices_items
|
||
-- @description: Separate Tabelle für Positionen von Wiederkehrende Rechnungen
|
||
-- @depends: periodic_invoices sales_orders_recurring_billing_mode
|
||
CREATE TABLE periodic_invoice_items_configs (
|
||
order_item_id INTEGER NOT NULL REFERENCES orderitems (id) ON DELETE CASCADE,
|
||
periodicity VARCHAR(10) NOT NULL,
|
||
terminated BOOLEAN,
|
||
start_date DATE,
|
||
end_date DATE,
|
||
extend_automatically_by INTEGER,
|
||
once_invoice_id INTEGER REFERENCES ar (id) ON DELETE SET NULL,
|
||
|
||
PRIMARY KEY (order_item_id)
|
||
);
|
||
|
||
INSERT INTO periodic_invoice_items_configs (
|
||
order_item_id, periodicity, once_invoice_id
|
||
) SELECT id, 'o', recurring_billing_invoice_id
|
||
FROM orderitems
|
||
WHERE recurring_billing_mode = 'once';
|
||
|
||
INSERT INTO periodic_invoice_items_configs (
|
||
order_item_id, periodicity, once_invoice_id
|
||
) SELECT id, 'n', recurring_billing_invoice_id
|
||
FROM orderitems
|
||
WHERE recurring_billing_mode = 'never';
|
||
|
||
INSERT INTO periodic_invoice_items_configs (
|
||
order_item_id, periodicity, once_invoice_id
|
||
) SELECT id, 'p', recurring_billing_invoice_id
|
||
FROM orderitems
|
||
WHERE recurring_billing_mode = 'always' and recurring_billing_invoice_id IS NOT NULL;
|
||
|
||
ALTER TABLE orderitems DROP COLUMN recurring_billing_invoice_id;
|
||
ALTER TABLE orderitems DROP COLUMN recurring_billing_mode;
|
Auch abrufbar als: Unified diff
S:D:PeriodicInvoiceItemsConfig: DB-Tabelle erstellt