2015-04-13 11:23:43 +02:00
|
|
|
//pdfmake
|
|
|
|
var dd = {
|
2015-04-13 08:02:33 +02:00
|
|
|
content: [
|
|
|
|
{
|
|
|
|
columns: [
|
2015-04-14 09:21:52 +02:00
|
|
|
[
|
|
|
|
invoice.image?
|
|
|
|
{
|
|
|
|
image: invoice.image,
|
|
|
|
fit: [150, 80]
|
|
|
|
}:""
|
|
|
|
],
|
2015-04-13 08:02:33 +02:00
|
|
|
{
|
2015-04-14 12:23:35 +02:00
|
|
|
stack: accountDetails(account)
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
|
|
|
{
|
2015-04-14 12:23:35 +02:00
|
|
|
stack: accountAddress(account)
|
2015-04-13 08:02:33 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2015-04-14 12:23:35 +02:00
|
|
|
{
|
|
|
|
text:(invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
|
|
|
margin: [8, 16, 8, 16],
|
|
|
|
style: 'primaryColor'
|
|
|
|
},
|
2015-04-13 08:02:33 +02:00
|
|
|
{
|
|
|
|
style: 'tableExample',
|
|
|
|
table: {
|
|
|
|
headerRows: 1,
|
|
|
|
widths: ['auto', 'auto', '*'],
|
|
|
|
body: [
|
2015-04-13 22:21:01 +02:00
|
|
|
[invoice.is_quote ? invoiceLabels.quote_number:invoiceLabels.invoice_number, {style: 'bold', text: invoice.invoice_number}, ""],
|
|
|
|
[invoice.is_quote ? invoiceLabels.quote_date:invoiceLabels.invoice_date, invoice.invoice_date, ""],
|
|
|
|
[invoice.is_quote ? invoiceLabels.total : invoiceLabels.balance_due, formatMoney(invoice.balance_amount, invoice.client.currency_id), ""],
|
2015-04-13 08:02:33 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
hLineWidth: function (i, node) {
|
|
|
|
return (i === 0 || i === node.table.body.length) ? 1 : 0;
|
|
|
|
},
|
|
|
|
vLineWidth: function (i, node) {
|
|
|
|
return 0;//(i === 0 || i === node.table.widths.length) ? 2 : 1;
|
|
|
|
},
|
|
|
|
hLineColor: function (i, node) {
|
2015-04-13 14:37:42 +02:00
|
|
|
return '#D8D8D8';//(i === 0 || i === node.table.body.length) ? 'black' : 'gray';
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
|
|
|
/*vLineColor: function (i, node) {
|
|
|
|
return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray';
|
|
|
|
},*/
|
2015-04-14 12:23:35 +02:00
|
|
|
paddingLeft: function(i, node) { return 8; },
|
|
|
|
paddingRight: function(i, node) { return 8; },
|
|
|
|
paddingTop: function(i, node) { return 4; },
|
|
|
|
paddingBottom: function(i, node) { return 4; }
|
2015-04-13 08:02:33 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'\n',
|
|
|
|
{
|
|
|
|
table: {
|
|
|
|
headerRows: 1,
|
2015-04-13 14:37:42 +02:00
|
|
|
widths: ['auto', '*', 'auto', 'auto', 'auto', 'auto'],
|
|
|
|
body:invoiceLines(invoice),
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
hLineWidth: function (i, node) {
|
|
|
|
return i === 0 ? 0 : 1;
|
|
|
|
},
|
|
|
|
vLineWidth: function (i, node) {
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
hLineColor: function (i, node) {
|
|
|
|
return '#D8D8D8';
|
2015-04-14 12:23:35 +02:00
|
|
|
},
|
|
|
|
paddingLeft: function(i, node) { return 8; },
|
|
|
|
paddingRight: function(i, node) { return 8; },
|
|
|
|
paddingTop: function(i, node) { return 8; },
|
|
|
|
paddingBottom: function(i, node) { return 8; }
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
2015-04-14 09:04:58 +02:00
|
|
|
},
|
2015-04-14 12:42:59 +02:00
|
|
|
'\n',
|
2015-04-13 22:45:09 +02:00
|
|
|
{
|
2015-04-14 12:23:35 +02:00
|
|
|
columns: [
|
|
|
|
notesAndTerms(invoice),
|
|
|
|
{
|
|
|
|
style: 'subtotals',
|
|
|
|
table: {
|
|
|
|
widths: ['*', '*'],
|
|
|
|
body: subtotals(invoice),
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
hLineWidth: function (i, node) {
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
vLineWidth: function (i, node) {
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
paddingLeft: function(i, node) { return 8; },
|
|
|
|
paddingRight: function(i, node) { return 8; },
|
|
|
|
paddingTop: function(i, node) { return 4; },
|
|
|
|
paddingBottom: function(i, node) { return 4; }
|
|
|
|
},
|
|
|
|
}
|
|
|
|
]
|
2015-04-13 22:45:09 +02:00
|
|
|
},
|
2015-04-13 08:02:33 +02:00
|
|
|
],
|
2015-04-14 09:04:58 +02:00
|
|
|
|
|
|
|
footer: function(){
|
|
|
|
f = [{ text:invoice.invoice_footer?invoice.invoice_footer:"", margin: [72, 0]}]
|
|
|
|
if (!invoice.is_pro && logoImages.imageLogo1) {
|
|
|
|
f.push({
|
|
|
|
image: logoImages.imageLogo1,
|
|
|
|
width: 150,
|
|
|
|
margin: [72,0]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return f;
|
2015-04-13 23:39:08 +02:00
|
|
|
},
|
2015-04-14 09:04:58 +02:00
|
|
|
|
2015-04-13 11:23:43 +02:00
|
|
|
defaultStyle: {
|
2015-04-14 12:23:35 +02:00
|
|
|
//font: 'sans'
|
|
|
|
fontSize: 9,
|
|
|
|
margin: [8, 4, 8, 4]
|
2015-04-13 11:23:43 +02:00
|
|
|
},
|
2015-04-13 08:02:33 +02:00
|
|
|
styles: {
|
2015-04-14 12:23:35 +02:00
|
|
|
primaryColor:{
|
|
|
|
color: primaryColor('#299CC2')
|
|
|
|
},
|
|
|
|
accountDetails: {
|
|
|
|
margin: [4, 2, 4, 2],
|
|
|
|
color: '#AAA9A9'
|
|
|
|
},
|
2015-04-13 08:02:33 +02:00
|
|
|
bold: {
|
|
|
|
bold: true
|
2015-04-13 14:37:42 +02:00
|
|
|
},
|
|
|
|
even: {
|
|
|
|
},
|
|
|
|
odd: {
|
|
|
|
fillColor:'#F4F4F4'
|
|
|
|
},
|
2015-04-14 12:23:35 +02:00
|
|
|
productKey: {
|
|
|
|
color:primaryColor('#299CC2')
|
|
|
|
},
|
2015-04-13 14:37:42 +02:00
|
|
|
cost: {
|
|
|
|
alignment: 'right'
|
2015-04-13 22:21:01 +02:00
|
|
|
},
|
|
|
|
quantity: {
|
|
|
|
alignment: 'right'
|
|
|
|
},
|
|
|
|
tax: {
|
|
|
|
alignment: 'right'
|
|
|
|
},
|
|
|
|
lineTotal: {
|
|
|
|
alignment: 'right'
|
2015-04-14 12:23:35 +02:00
|
|
|
},
|
|
|
|
right: {
|
|
|
|
alignment: 'right'
|
|
|
|
},
|
|
|
|
subtotals: {
|
|
|
|
alignment: 'right'
|
|
|
|
},
|
|
|
|
tableHeader: {
|
|
|
|
bold: true
|
2015-04-14 12:42:59 +02:00
|
|
|
},
|
|
|
|
balanceDueLabel: {
|
|
|
|
fontSize: 11
|
|
|
|
},
|
|
|
|
balanceDueValue: {
|
|
|
|
fontSize: 11,
|
|
|
|
color:primaryColor('#299CC2')
|
|
|
|
},
|
|
|
|
notes: {
|
|
|
|
},
|
|
|
|
terms: {
|
|
|
|
|
|
|
|
},
|
|
|
|
termsLabel: {
|
|
|
|
bold: true,
|
|
|
|
fontSize: 10,
|
|
|
|
margin: [0, 10, 0, 4]
|
2015-04-13 08:02:33 +02:00
|
|
|
}
|
2015-04-14 09:04:58 +02:00
|
|
|
},
|
|
|
|
pageMargins: [72, 40, 40, 80]
|
2015-04-13 11:23:43 +02:00
|
|
|
};
|