
[dbo].[vCustomerInformation_XLedger]
create view [dbo].[vCustomerInformation_XLedger]
(
CustomerNumber,
CustomerName,
OnHold,
NoCreditFlag,
CreditLimit,
Inactive,
CustomerClass,
[Address],
City,
[State]
)
as
select
CustomerNumber = AccountingCustomer.CustomerNumber,
CustomerName = AccountingCustomer.[Name],
OnHold = case
when AccountingCustomer.OnHold = 1 and AccountingCustomer.Hidden = 1 then 'On Hold, Inactive'
when AccountingCustomer.OnHold = 1 then 'On Hold'
when AccountingCustomer.Hidden = 1 then 'Inactive'
else ''
end,
NoCreditFlag = AccountingCustomer.NoCreditFlag,
CreditLimit = AccountingCustomer.CreditLimit,
Inactive = AccountingCustomer.Hidden,
CustomerClass = AccountingCustomerClass.ClassCode,
[Address] = AccountingCustomerAddress.[Address1],
City = AccountingCustomerAddress.City,
[State] = AccountingCustomerAddress.[State]
from AccountingCustomer
inner join AccountingCustomerAddressType on AccountingCustomerAddressType.TypeName = dbo.GetDefaultAccountingCustomerAddressTypeName()
left outer join AccountingCustomerAddress on AccountingCustomerAddress.AccountingCustomerFid = AccountingCustomer.AccountingCustomerId and
AccountingCustomerAddress.AccountingCustomerAddressTypeFid = AccountingCustomerAddressType.AccountingCustomerAddressTypeId
left outer join AccountingCustomerClass on AccountingCustomerClass.AccountingCustomerClassId = AccountingCustomer.AccountingCustomerClassFid
GO
GRANT SELECT ON [dbo].[vCustomerInformation_XLedger] TO [MssExec]
GRANT INSERT ON [dbo].[vCustomerInformation_XLedger] TO [MssExec]
GRANT DELETE ON [dbo].[vCustomerInformation_XLedger] TO [MssExec]
GRANT UPDATE ON [dbo].[vCustomerInformation_XLedger] TO [MssExec]
GO