SELECT
ser.heCode AS DOCSERIES,
ser.heShortcut AS DOCSERIESSHORTCUT,
ser.heName AS DOCSERIESNAME,
typ.heCode AS DOCTYPE,
typ.heName AS DOCTYPENAME,
acc.heCode AS ACCTMP,
acc.heName AS ACCTPMNAME,
cmp.heName AS CMP
FROM heDocSeries AS ser
INNER JOIN heFinDocTypes AS typ
ON typ.heID = ser.heDocTypeID
LEFT JOIN heAccountingTemplates AS acc
ON acc.heID = typ.heAtmpID
LEFT JOIN heCompanies AS cmp
ON ser.heCompID = cmp.heID