View: dbo.GL_Transaction_Detail__Payroll_Check_Tax_Item_Expense__View | |||
View definition | |||
-- SUMMARY -- This view produces ledger entries that debit the payroll check tax item expense accounts. CREATE VIEW dbo.GL_Transaction_Detail__Payroll_Check_Tax_Item_Expense__View AS select pctid.payroll_check_tax_item_distribution_KEY , pcti.bank_transaction_KEY , bt.checkbook_KEY , tj.client_KEY , pctid.expense__gl_account_KEY as gl_account_KEY , 1 /* Debit */ as gl_balance_effect_KEY , glt.gl_period_KEY , pctid.amount as gl_transaction_amount , bt.transaction_date as gl_transaction_date , bt.description as gl_transaction_description , pcti.description as gl_transaction_detail_description , glt.gl_transaction_KEY , bt.reference_number as gl_transaction_reference_number , bt.reference_number_sortable as gl_transaction_reference_number_sortable , CAST(11 AS TINYINT) AS gl_transaction_source_expression_KEY -- GLTransactionSourceExpression.PayrollCheckTaxItemExpense , 2 as gl_transaction_source_KEY -- GLTransactionSource.BankTransaction , bt.bank_transaction_type_KEY as gl_transaction_type_KEY , 0 as is_activity_journal_entry , 101 /* Regular */ as journal_entry_type_KEY , glt.journal_KEY , 1 as source_was_a_distribution , bt.transaction_status_KEY , cti.sequence_number from dbo.Payroll_Check_Tax_Item AS pcti inner join dbo.Client_Tax_Item AS cti on pcti.client_tax_item_KEY = cti.client_tax_item_KEY inner join dbo.Bank_Transaction as bt on pcti.bank_transaction_KEY = bt.bank_transaction_KEY inner join dbo.Tax_Jurisdiction as tj on cti.tax_jurisdiction_KEY = tj.tax_jurisdiction_KEY inner join dbo.Client as c on tj.client_KEY = c.client_KEY inner join dbo.GL_Transaction_N_Bank_Transaction as nbt on pcti.bank_transaction_KEY = nbt.bank_transaction_KEY inner join dbo.GL_Transaction as glt on nbt.gl_transaction_KEY = glt.gl_transaction_KEY inner join dbo.Payroll_Check_Tax_Item_Distribution AS pctid on pcti.payroll_check_tax_item_KEY = pctid.payroll_check_tax_item_KEY where bt.bank_transaction_type_KEY = 5 and cti.client_tax_item_type_KEY = 2 /* Employer */ and bt.transaction_status_KEY in (1 /* Live */, 5 /* Unprinted */, 3 /* Voided */, 9 /* ImpoundMemo */, 14 /*ImpoundMemoDeleted*/, 15 /*ImpoundMemoVoided*/) and (bt.data_origin_KEY != 2 -- Payroll Check that came from a CSA client with the TBS or c.csa_client_had_tbs_or_gl_module_marked = 0) -- or GL module marked do not affect accounting. ; | |||