Item default tax rate

main
Ashelyn Dawn 5 years ago
parent efdaab13e1
commit 5820734822

@ -46,7 +46,8 @@ create table sos."item" (
item_description text not null, item_description text not null,
item_urlslug citext unique not null, item_urlslug citext unique not null,
item_price_cents integer not null, item_price_cents integer not null,
item_published boolean not null default true item_published boolean not null default true,
item_tax_percent_override numeric(8,6) null
); );
create table sos."cart_item" ( create table sos."cart_item" (
@ -261,3 +262,7 @@ create table sos."item_stockchange_admin" (
stockchange_withdrawal_uuid uuid references sos."admin_withdrawal" (withdrawal_uuid) stockchange_withdrawal_uuid uuid references sos."admin_withdrawal" (withdrawal_uuid)
); );
create table sos."config" (
config_default_tax_percent numeric(8,6) not null default 7.250
);

@ -1,6 +1,12 @@
create or replace view sos.v_item as create or replace view sos.v_item as
select select
"item".*, "item".item_uuid,
"item".item_name,
"item".item_description,
"item".item_urlslug,
"item".item_price_cents,
"item".item_published,
coalesce("item".item_tax_percent_override, "config".config_default_tax_percent) as item_tax_rate,
"image".image_uuid, "image".image_uuid,
"image".image_featured, "image".image_featured,
"image".image_mime_type, "image".image_mime_type,
@ -8,6 +14,7 @@ create or replace view sos.v_item as
"user".user_email as uploader_email, "user".user_email as uploader_email,
coalesce(num_added - num_removed, 0) as item_number_in_stock coalesce(num_added - num_removed, 0) as item_number_in_stock
from sos."item" from sos."item"
left join sos."config" on true
left join sos."image" on item.item_uuid = image.image_item_uuid left join sos."image" on item.item_uuid = image.image_item_uuid
left join sos."user" on image.image_uploader_uuid = "user".user_uuid left join sos."user" on image.image_uploader_uuid = "user".user_uuid
left join left join

Loading…
Cancel
Save