
[dbo].[MssWebGetAccountingVendorGridItems]
create procedure dbo.MssWebGetAccountingVendorGridItems
@inVendorName varchar(128) = null,
@inVendorNumber varchar(128) = null,
@inIncludeInactiveAndOnHold bit = null,
@inPageNumber int,
@inPageSize int
as
begin
set nocount on;
declare @offset int = @inPageNumber * @inPageSize;
select
Id = AccountingVendor.AccountingVendorId,
VendorName = AccountingVendor.Name,
VendorNumber = AccountingVendor.VendorNumber,
City = AccountingVendorAddress.City,
State = AccountingVendorAddress.State,
Zip = dbo.FormatPostalCode(AccountingVendorAddress.PostalCode),
Address1 = AccountingVendorAddress.Address1,
Address2 = AccountingVendorAddress.Address2,
Address3 = AccountingVendorAddress.Address3,
VendorClass = AccountingVendorClass.ClassCode,
Status = AccountingVendor.Status,
OnHold = AccountingVendor.OnHold
from AccountingVendor
left outer join AccountingVendorAddressType on
AccountingVendorAddressType.TypeName = dbo.GetDefaultAccountingVendorAddressTypeName()
left outer join AccountingVendorAddress
on AccountingVendorAddress.AccountingVendorFid = AccountingVendor.AccountingVendorId
and AccountingVendorAddress.AccountingVendorAddressTypeFid = AccountingVendorAddressType.AccountingVendorAddressTypeId
left outer join AccountingVendorClass on
AccountingVendorClass.AccountingVendorClassId = AccountingVendor.AccountingVendorClassFid
where
(@inVendorName is null or AccountingVendor.Name like @inVendorName + '%') and
(@inVendorNumber is null or AccountingVendor.VendorNumber like @inVendorNumber + '%') and
(
(@inIncludeInactiveAndOnHold = 1)
or
(AccountingVendor.Status <> 'Inactive' and AccountingVendor.OnHold <> 1)
)
order by
AccountingVendor.Name asc,
AccountingVendor.VendorNumber asc
offset @offset rows
fetch next @inPageSize rows only;
end
GO
GRANT EXECUTE ON [dbo].[MssWebGetAccountingVendorGridItems] TO [MssExec]
GO