SELECT
  BE.ClientID,
  BE.FinNumber AS AccountCode,
  BE.CompanyRegNumber,
  BE.VATNumber,
  BE.ContractNumber,
  BE.ContractTerm,
  COALESCE(BE.TaxTypeID, 1) AS TaxTypeID,
  BE.PaymentMethod,
  BE.FinCategory,
  U1.FullName AS DebtorClerk,
  BE.EmailAddress,
  BE.BankSortCode,
  BE.BankAccountNumber,
  BE.Postal1,
  BE.Postal2,
  BE.Postal3,
  BE.PostalCode,
  COALESCE(BE.InternalClient, 0) AS InternalClient,
  COALESCE(BE.AdhocAllowed, 1) AS AdhocAllowed,
  COALESCE(BE.ImmediateAdhocInvoices, 1) AS ImmediateAdhocInvoices,
  COALESCE(BE.IndividualAdhocInvoices, 1) AS IndividualAdhocInvoices,
  COALESCE(BE.SingleLineInvoice, 0) AS SingleLineInvoice,
  BE.InvoiceText,
  BE.PayrollRegister,
  BE.PayrollInstance,
  BE.PastelBillingCode
FROM
  taClients AS BE
    LEFT JOIN taFinCategory AS FC ON (FC.FinCategoryID = BE.FinCategory)
    LEFT JOIN taUsers AS U1 ON (U1.UserID = FC.DebtorClerkID)
WHERE
  (BE.ClientID = @nClientID)
