docparse-supplier-nge
Version:
process ngrid electric utility bill data for use in the docparse system
23 lines (22 loc) • 720 B
JavaScript
/**
* Cost Supply text looks like
"...
Billing Period Jul 13, 2011 to Jul 21, 2011 Number of days in period 8
Basic Service Variable 0.0722 x 45600 kWh 3,292.32
Total Supply Services $ 11,414.00
..."
*/
var num = require('num');
module.exports = function(data, cb) {
var toPay = num(data.costDelivery).add(data.costSupply).add(data.costOther.total);
if (data.costOtherSupply) {
if (data.costOtherSupply.costs.length > 0) {
return cb('cost other supply not yet implemented');
}
}
// if (data.compData) {
// var compData = data.compData;
// toPay = toPay.add(compData.costSupply).add(compData.add
// }
cb(null, toPay.toString());
};