View: core.sales_tax_detail_scrud_view
Schema | core |
Materialized View Name | sales_tax_detail_scrud_view |
Owner | postgres |
Tablespace | DEFAULT |
Description | |
CREATE OR REPLACE VIEW core.sales_tax_detail_scrud_view
AS
SELECT sales_tax_details.sales_tax_detail_id,
((sales_taxes.sales_tax_code::text || ' ('::text) || sales_taxes.sales_tax_name::text) || ')'::text AS sales_tax,
((sales_tax_types.sales_tax_type_code::text || ' ('::text) || sales_tax_types.sales_tax_type_name::text) || ')'::text AS sales_tax_type,
sales_tax_details.priority,
sales_tax_details.sales_tax_detail_code,
sales_tax_details.sales_tax_detail_name,
sales_tax_details.based_on_shipping_address,
sales_tax_details.check_nexus,
sales_tax_details.applied_on_shipping_charge,
((state_sales_taxes.state_sales_tax_code::text || ' ('::text) || state_sales_taxes.state_sales_tax_name::text) || ')'::text AS state_sales_tax,
((county_sales_taxes.county_sales_tax_code::text || ' ('::text) || county_sales_taxes.county_sales_tax_name::text) || ')'::text AS county_sales_tax,
((tax_rate_types.tax_rate_type_code::text || '('::text) || tax_rate_types.tax_rate_type_name::text) || ')'::text AS tax_rate_type,
sales_tax_details.rate,
((reporting_tax_authority.tax_authority_code::text || ' ('::text) || reporting_tax_authority.tax_authority_name::text) || ')'::text AS reporting_tax_authority,
((collecting_tax_authority.tax_authority_code::text || ' ('::text) || collecting_tax_authority.tax_authority_name::text) || ')'::text AS collecting_tax_authority,
((collecting_account.account_number::text || ' ('::text) || collecting_account.account_name::text) || ')'::text AS collecting_account,
((use_tax_collecting_account.account_number::text || ' ('::text) || use_tax_collecting_account.account_name::text) || ')'::text AS use_tax_collecting_account,
((rounding_methods.rounding_method_code::text || '('::text) || rounding_methods.rounding_method_name::text) || ')'::text AS rounding_method,
sales_tax_details.rounding_decimal_places
FROM core.sales_tax_details
JOIN core.sales_taxes ON sales_tax_details.sales_tax_id = sales_taxes.sales_tax_id
JOIN core.sales_tax_types ON sales_tax_details.sales_tax_type_id = sales_tax_types.sales_tax_type_id
LEFT JOIN core.state_sales_taxes ON sales_tax_details.state_sales_tax_id = state_sales_taxes.state_sales_tax_id
LEFT JOIN core.county_sales_taxes ON sales_tax_details.county_sales_tax_id = county_sales_taxes.county_sales_tax_id
JOIN core.tax_rate_types ON sales_tax_details.tax_rate_type_code::text = tax_rate_types.tax_rate_type_code::text
JOIN core.tax_authorities reporting_tax_authority ON sales_tax_details.reporting_tax_authority_id = reporting_tax_authority.tax_authority_id
JOIN core.tax_authorities collecting_tax_authority ON sales_tax_details.collecting_tax_authority_id = collecting_tax_authority.tax_authority_id
JOIN core.accounts collecting_account ON sales_tax_details.collecting_account_id = collecting_account.account_id
LEFT JOIN core.accounts use_tax_collecting_account ON sales_tax_details.use_tax_collecting_account_id = use_tax_collecting_account.account_id
LEFT JOIN core.rounding_methods ON sales_tax_details.rounding_method_code::text = rounding_methods.rounding_method_code::text;