View: dbo.AR_Transaction_View
View definition
`-- This view surfaces all rows and columns from the AR table table. In addition, it provides two amount -- fields summed from each transaction�s distributions. This view is the read source for the AR transaction entity. CREATE VIEW dbo.AR_Transaction_View AS SELECT art.gl_transaction_KEY , art.customer_KEY , art.ar_transaction_type_KEY , art.transaction_status_KEY , art.transaction_date , art.reference_number , art.reference_number_sortable , art.message , art.payment_discount_amount_original , art.payment_discount_amount , art.payment_discount_amount_override , art.payment_term_KEY , art.due_date , art.purchase_order_number , art.purchase_order_number_sortable , art.gl_account_KEY , art.payment_discount_expiration_date , art.payment_discount__gl_account_KEY , art.shipping__contact_address_type_KEY , art.shipping_date , art.shipping_salutation , art.shipping_name -- Force the calculated amount to be a decimal(17,2) column. , CAST(arti.tax_adjusted_amount AS DECIMAL(17,2)) AS amount , CAST(arti.cost_amount AS DECIMAL(17,2)) AS cost_amount , art.printed , art.generated_by__transaction_template_KEY --the ar_receivable_transaction_KEY is ONLY used for filtering purposes. The gl_transaction_KEY is still the --the key/column used for identifiying records in this view. , art.gl_transaction_KEY as ar_receivable_transaction_KEY , art.created_date FROM dbo.AR_Transaction AS art INNER JOIN dbo.AR_Transaction_Item_Rollup_View AS arti --WITH (NOEXPAND) ON art.gl_transaction_KEY = arti.gl_transaction_KEY`