-
Notifications
You must be signed in to change notification settings - Fork 105
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
Showing
11 changed files
with
188 additions
and
26 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
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
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
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
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,54 @@ | ||
{{> head title="INVOICE_REGISTRY.TITLE"}} | ||
|
||
<body> | ||
<div class="container"> | ||
<!-- header --> | ||
<div class="row"> | ||
<div class="col-xs-4"> | ||
<h3 style="margin:2px;">{{model.enterprise.name}} ({{model.enterprise.abbr}})</h3> | ||
<span>{{translate 'FORM.LABELS.PHONE'}}: {{model.enterprise.phone}}</span><br> | ||
<span>{{translate 'FORM.LABELS.EMAIL'}}: {{model.enterprise.email}}</span><br> | ||
</div> | ||
<div class="col-xs-offset-4 col-xs-4 text-right"> | ||
<small>{{model.project.name}} ({{model.project.abbr}})</small> | ||
</div> | ||
</div> | ||
|
||
<!-- body --> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
|
||
<!-- page title --> | ||
<h2 style="margin:15px; font-weight:bold" class="text-center text-uppercase"> | ||
{{translate 'INVOICE_REGISTRY.TITLE'}} | ||
</h2> | ||
|
||
<!-- list of data --> | ||
<table class="table table-condensed table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th>{{translate 'TABLE.COLUMNS.REFERENCE'}}</th> | ||
<th>{{translate 'TABLE.COLUMNS.BILLING_DATE'}}</th> | ||
<th>{{translate 'TABLE.COLUMNS.PATIENT'}}</th> | ||
<th>{{translate 'TABLE.COLUMNS.COST'}}</th> | ||
<th>{{translate 'TABLE.COLUMNS.SERVICE'}}</th> | ||
<th>{{translate 'TABLE.COLUMNS.BY'}}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each model.data}} | ||
<tr> | ||
<td>{{ reference }}</td> | ||
<td>{{ date date }}</td> | ||
<td>{{ patientNames }}</td> | ||
<td>{{ currency cost }}</td> | ||
<td>{{ serviceName }}</td> | ||
<td>{{ createdBy }}</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</body> |
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,42 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const BadRequest = require('../../../lib/errors/BadRequest'); | ||
const supportedRender = { | ||
json : require('../../../lib/renderers/json'), | ||
html : require('../../../lib/renderers/html'), | ||
pdf : require('../../../lib/renderers/pdf') | ||
}; | ||
|
||
const defaultRender = 'pdf'; | ||
const template = path.normalize('./server/controllers/finance/receipts/list.handlebars'); | ||
const receiptOptions = { pageSize : 'A4', orientation: 'landscape' }; | ||
|
||
// export the receipt object | ||
exports.build = build; | ||
|
||
/** | ||
* @function build | ||
* @desc build a report for invoice patient report of metadata | ||
* @param {array} data invoice patient report of metadata | ||
* @return {object} promise | ||
*/ | ||
function build(data, request) { | ||
|
||
|
||
let queryString = request.query; | ||
let renderTarget = (queryString && queryString.renderer) ? queryString.renderer : defaultRender; | ||
let renderer = supportedRender[renderTarget]; | ||
|
||
if (!renderer) { | ||
throw new BadRequest('Render target provided is invalid or not supported by this report '.concat(renderTarget)); | ||
} | ||
|
||
let model = { | ||
enterprise : request.enterprise, | ||
project : request.project, | ||
data : data | ||
}; | ||
|
||
return renderer.render({ model }, template, receiptOptions); | ||
} |
699372b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding print functionality
@jniles