-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9047bc
commit 3d9b305
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Documentation | ||
|
||
You can see below the API reference of this module. | ||
|
||
### `Invoice(options)` | ||
This is the constructor that creates a new instance containing the needed | ||
methods. | ||
|
||
#### Params | ||
- **Object** `options`: The options for creating the new invoice: | ||
- `config` (Object): | ||
- `template` (String): The HTML root template. | ||
- `data` (Object): | ||
- `currencyBalance` (Object): | ||
- `main` (Number): The main balance. | ||
- `secondary` (Number): The converted main balance. | ||
- `tasks` (Array): An array with the tasks (description of the services you did). | ||
- `invoice` (Object): Information about invoice. | ||
- `seller` (Object): Information about seller. | ||
- `buyer` (Object): Information about buyer. | ||
|
||
### `initTemplates(callback)` | ||
Inits the HTML templates. | ||
|
||
#### Params | ||
- **Function** `callback`: The callback function. | ||
|
||
### `toHtml(output, callback)` | ||
Renders the invoice in HTML format. | ||
|
||
#### Params | ||
- **String** `output`: An optional path to the output file. | ||
- **Function** `callback`: The callback function. | ||
|
||
#### Return | ||
- **Invoice** The `Nodeice` instance. | ||
|
||
### `convertToSecondary(input)` | ||
Converts a currency into another currency according to the currency | ||
balance provided in the options | ||
|
||
#### Params | ||
- **Number** `input`: The number that should be converted | ||
|
||
#### Return | ||
- **Number** The converted input | ||
|
||
### `toPdf(options, callback)` | ||
Renders invoice as pdf | ||
|
||
#### Params | ||
- **Object|String|Stream** `options`: The path the output pdf file, the stream object, or an object containing: | ||
|
||
- `output` (String|Stream): The path to the output file or the stream object. | ||
- `converter` (Object): An object containing custom settings for the [`phantom-html-to-pdf`](https://github.com/pofider/phantom-html-to-pdf). | ||
- **Function** `callback`: The callback function | ||
|
||
#### Return | ||
- **Invoice** The Invoice instance | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters