You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.4 KiB
JavaScript

//TODO: per-item discounts
var express = require('express')
var app = express()
var testData =
{
number: 247,
date: "1st May 2016",
dateDue: "28th May 2016",
myDetails: "Alfie Pates\n1 Address Way\nTestville, AB12 3CD" + "\n" + "01234 567 890",
customerAddress: "ACME Customer Inc.\nCustomer Building\n14 Customer Street\nPaymenow, FF22 2FF",
careOf: "Caroline Accounting",
items: [
{
name: "test item one",
rate: "£100.00",
quantity: "1",
subtotal: "£100.00"
},
{
name: "test item two",
category: "test category",
rate: "£5.00",
quantity: "1",
subtotal: "£10.00"
},
{
name: "test hourly item",
category: "hourly items",
rate: "£15.00",
rateSuffix: "/hr",
quantity: "8",
quantitySuffix: "hrs",
subtotal: "£120.00"
},
{
name: "test item with comment",
comment: "here is a long test comment with some newlines. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex\n ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat \n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
rate: "£1.50",
quantity: "1",
subtotal: "£1.50"
}
],
// subtotal before discounts, £231.50
discounts: [
{
percentage: "10%",
amount: "-£23.15"
}
],
subtotal: "£208.35",
taxes: [
{
name: "VAT",
rate: "20%",
amount: "£250.02"
}
],
shipping: [
{
name: "Royal Mail First Class",
amount: "£4.00"
}
],
payments: [
{
type: "Cash",
amount: "-£50.02",
}
],
balanceDue: "£200.00",
comments: "Here's a test\nmulti-line\ncomment!",
terms: "Payment due within 28 days from date of invoice."
};
app.set('view engine', 'jade');
app.use('/static', express.static('static'));
app.get('/', function(req, res) {
res.render('invoice', testData);
});
app.listen(3000, function() {
console.log('Listening on Port 3000!')
});