View: dbo.Payable_Payment_Application_Full_View
View definition
`CREATE VIEW dbo.Payable_Payment_Application_Full_View AS ( SELECT PPA.gl_transaction_KEY, PPA.payable_transaction_KEY, PPA.payment__gl_transaction_KEY, PPA.application_date, PPA.paid_amount, PPA.discount_taken_amount, ISNULL(LEFT( (PPA.payment__reference_number + CASE WHEN PPA.payment__reference_number = N'' then N'' else N'-' end + ISNULL(MAPPO.reference_number_suffix, N'PMTAPP')) collate Latin1_General_CI_AS , 16), N'') AS reference_number, ISNULL(LEFT(dbo.sf_Generate_Sortable_Reference_Number( PPA.payment__reference_number + CASE WHEN PPA.payment__reference_number = N'' then N'' else N'-' end + ISNULL(MAPPO.reference_number_suffix, N'PMTAPP')) collate Latin1_General_CI_AS , 80), N'') AS reference_number_sortable, ISNULL(LEFT( (PPA.description + CASE WHEN PPA.description = N'' then N'' else N' - ' end + N'Payment Application') collate Latin1_General_CI_AS , 120), N'') AS description, PPA.origin__accounting_application_KEY, PPA.data_origin_KEY, J.client_KEY, GLT.gl_period_KEY, GLT.journal_KEY FROM dbo.Payable_Payment_Application_View PPA -- Grab the client key. INNER JOIN dbo.GL_Transaction GLT ON PPA.gl_transaction_KEY = GLT.gl_transaction_KEY INNER JOIN dbo.Journal J ON GLT.journal_KEY = J.journal_KEY -- Grab the client's payment application reference number suffix. If not set yet, use default ''. LEFT JOIN dbo.Manage_AP_Payment_Option MAPPO ON J.client_KEY = MAPPO.client_KEY )`