Skip to content

Latest commit

 

History

History
114 lines (86 loc) · 1.74 KB

README.md

File metadata and controls

114 lines (86 loc) · 1.74 KB

ClickUp Invoice Generator

Installation

npm install clickup-invoice-generator

Working Example

See example.ts for fully functional example.

Copy .env.example to .env and run generator using

npm start

Quick Start

Create PDF instance

import { PDF } from 'clickup-invoice-generator';

const pdf = await new PDF().init();

Render details

import { renderTopBar, renderHeaders, renderCredentials } from 'clickup-invoice-generator';

renderTopBar({ pdf, invoiceId });

renderHeaders({
  pdf,
  from: {
    name: 'Jane Doe',
    address: '123 Main Street',
    country: 'Czech Republic',
    postalCode: '123',
    ICO: '123',
    DIC: '123',
  },
  to: {
    name: 'John Doe',
    address: '123 Main Street',
    country: 'United States',
    postalCode: '123',
  },
});

renderCredentials({
  pdf,
  credentials: {
    bankName: 'Revolut',
    iban: 'LT123123123',
    bic: '123123',
    variable: '123', // Invoice ID
  },
});

Fetch tasks

import { fetchTasks } from 'clickup-invoice-generator';

const tasks = await fetchTasks({
  clickUp: {
    privateKey: 'xxx',
    teamId: 'xxx',
    userId: 'xxx',
  },
  period: 'this', // 'last' for previous month
});

Render tasks and total

import { renderTasks, renderTotal } from 'clickup-invoice-generator';

const total = renderTasks({
  pdf,
  tasks,
  salary: {
    currency: '$',
    perHour: 40,
  },
});

renderTotal({
  promo: true, // Please use `renderPromo({ pdf })` elsewhere if you set `false` here
  pdf,
  total,
  currency: '$',
});

Save PDF

await pdf.save('invoice.pdf');

UI

  • TBD; only TS script available currently

TODO

  • Remove dotenv