
[dbo].[CustomerInformation_XLedger]
create view [dbo].[CustomerInformation_XLedger]
(
CustomerNumber,
CustomerName,
OnHold,
NoCreditFlag,
CreditLimit,
Inactive,
CustomerClass,
City,
[State],
CustomerId,
CustomerJoinField,
Hold,
TaxExempt
)
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,
City = AccountingCustomerAddress.City,
[State] = AccountingCustomerAddress.[State],
CustomerId = AccountingCustomer.AccountingCustomerId,
CustomerJoinField = AccountingCustomer.AccountingCustomerId,
Hold = AccountingCustomer.OnHold,
TaxExempt = AccountingCustomer.TaxExempt
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 CountryCodeStandard on CountryCodeStandard.CountryCodeStandardID = AccountingCustomerAddress.CountryCodeStandardFID
left outer join AccountingCustomerClass on AccountingCustomerClass.AccountingCustomerClassId = AccountingCustomer.AccountingCustomerClassFid
GO
GRANT SELECT ON [dbo].[CustomerInformation_XLedger] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerInformation_XLedger] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerInformation_XLedger] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerInformation_XLedger] TO [MssExec]
GO