UNPKG

@accounter/server

Version:
42 lines 1.42 kB
import { DocumentType } from '../../../shared/enums.js'; export function isInvoice(type) { return (type === DocumentType.Invoice || type === DocumentType.CreditInvoice || type === DocumentType.InvoiceReceipt); } export function isReceipt(type) { return type === DocumentType.Receipt || type === DocumentType.InvoiceReceipt; } export function isAccountingDocument(type) { switch (type) { case DocumentType.Invoice: case DocumentType.CreditInvoice: case DocumentType.Receipt: case DocumentType.InvoiceReceipt: case DocumentType.Proforma: return true; default: return false; } } export function getDocumentNameFromType(documentType) { switch (documentType) { case DocumentType.Invoice: return 'Tax Invoice'; case DocumentType.Proforma: return 'Proforma Invoice'; case DocumentType.InvoiceReceipt: return 'Invoice / Receipt'; case DocumentType.CreditInvoice: return 'Credit Note'; case DocumentType.Receipt: return 'Receipt'; case DocumentType.Other: return 'Misc Document'; case DocumentType.Unprocessed: return 'Unprocessed Document'; default: throw new Error(`Unsupported document type: ${documentType}`); } } //# sourceMappingURL=common.helper.js.map