1.8.2 • Published 7 months ago

invoice_processor v1.8.2

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Invoice Parser

Parses through a folder system of invoices on a vendor basis. Creates an array of invoice objects that the caller can then work with.

Currently Implemented Vendor Invoices

Sobeys West

Future Vendor Invoices:

  • CTG
  • Modern Houseware
  • Symak Sales
  • Tree of Life
  • UNFI

Details

package is run with the invoiceParser.parseInvoicesInDir(inputPath, vendors) function aftwards, can access data via invoices object:

/**
 * type {[]}
 */
const invoices = invoiceParser.invoices;

then, you can grab items and metadata within each invoice

const invoice = invoices[0];
/**
 * @type {invoiceNo: {string}, invoiceDate: {string, yyyy-mm-dd format}, vendor: {string}}
 */
const metaData = invoice.metaData;
/**
 * @type {[InvoiceItem]}
 */
const items = invoice.items;

Usage

ES6

import {InvoiceParser} from 'invoice_processor';

const invoiceParser = new InvoiceParser();
const vendors = ['sobeys', 'ctg'];
const inputPath = 'demo/in'
await invoiceParser.parseInvoicesInDir(inputPath, vendors);

/// all parsed invoices:
invoiceParser.parsedInvoices.forEach((parsedInvoice) => {
    console.log(`${JSON.stringify(parsedInvoice.metaData)}`);
    console.log(`${JSON.stringify(parsedInvoice.items)}`);
});

Folder System Example

  • demo/
    • in/
      • sobeys/
        • inv1.pdf
        • inv2.pdf
      • ctg/
        • inv55123.pdf
      • modern/
        • (empty)

after being run, these invoices are moved to out folder:

  • demo/
    • out/
      • sobeys/
        • inv1.pdf
        • inv2.pdf
      • ctg/
        • inv55123.pdf
      • modern/
        • (empty)
1.8.2

7 months ago

1.8.1

7 months ago

1.7.0

7 months ago

1.6.2

7 months ago

1.6.1

7 months ago

1.6.0

7 months ago

1.5.0

7 months ago

1.4.0

7 months ago

1.3.0

8 months ago

1.2.1

8 months ago

1.2.0

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago