-
Notifications
You must be signed in to change notification settings - Fork 98
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
ec3b2e8
commit 3a69ccb
Showing
16 changed files
with
155 additions
and
5 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
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
12 changes: 12 additions & 0 deletions
12
server/controllers/stock/reports/stock/lot_barcode/lot_barcode.handlebars
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,12 @@ | ||
{{> head title="LOTS.BARCODE_FOR_LOT" }} | ||
|
||
<!-- body --> | ||
<div class="text-center"> | ||
{{#if metadata.enterprise.settings.enable_barcodes}} | ||
<small>{{ details.inventory_text }} - {{ details.label }}</small><br> | ||
<span>{{> barcode value=barcode}}</span><br> | ||
<small><strong>{{ barcode }}</strong></small> | ||
|
||
<script>JsBarcode('.barcode').init();</script> | ||
{{/if}} | ||
</div> |
51 changes: 51 additions & 0 deletions
51
server/controllers/stock/reports/stock/lot_barcode/lot_barcode.js
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,51 @@ | ||
const { | ||
_, ReportManager, db, identifiers, barcode, LOT_BARCODE_TEMPLATE, | ||
} = require('../../common'); | ||
|
||
/** | ||
* @method lotBarcodeReceipt | ||
* | ||
* @description | ||
* This method displays the lot barcode | ||
* | ||
* GET /receipts/stock/lots/:uuid/barcode | ||
*/ | ||
function lotBarcodeReceipt(req, res, next) { | ||
let report; | ||
const data = {}; | ||
const uuid = db.bid(req.params.uuid); | ||
const options = { | ||
filename : 'LOTS.BARCODE_FOR_LOT', | ||
pageSize : 'A6', | ||
orientation : 'landscape', | ||
}; | ||
const optionReport = _.extend(req.query, options); | ||
|
||
try { | ||
report = new ReportManager(LOT_BARCODE_TEMPLATE, req.session, optionReport); | ||
} catch (e) { | ||
return next(e); | ||
} | ||
|
||
const sql = ` | ||
SELECT BUID(l.uuid) AS uuid, l.label, i.code, i.text AS inventory_text | ||
FROM lot l | ||
JOIN inventory i ON i.uuid = l.inventory_uuid | ||
WHERE l.uuid = ?; | ||
`; | ||
|
||
return db.one(sql, [db.bid(uuid)]) | ||
.then(details => { | ||
const { key } = identifiers.LOT; | ||
data.details = details; | ||
data.barcode = barcode.generate(key, details.uuid); | ||
return report.render(data); | ||
}) | ||
.then((result) => { | ||
res.set(result.headers).send(result.report); | ||
}) | ||
.catch(next) | ||
.done(); | ||
} | ||
|
||
module.exports = lotBarcodeReceipt; |
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