2015-04-13 11:23:43 +02:00
|
|
|
//pdfmake
|
2015-06-03 19:55:48 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
var dd = {
|
|
|
|
content: 'wqy中文wqy',
|
|
|
|
defaultStyle: {
|
|
|
|
font: 'wqy'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
2015-04-13 11:23:43 +02:00
|
|
|
var dd = {
|
2015-05-22 09:22:24 +02:00
|
|
|
content: [
|
2015-04-13 08:02:33 +02:00
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
columns: [
|
2015-04-14 09:21:52 +02:00
|
|
|
[
|
2015-05-22 09:22:24 +02:00
|
|
|
invoice.image?
|
|
|
|
{
|
|
|
|
image: invoice.image,
|
|
|
|
fit: [150, 80]
|
|
|
|
}:""
|
2015-04-14 09:21:52 +02:00
|
|
|
],
|
2015-04-13 08:02:33 +02:00
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
stack: NINJA.accountDetails(account)
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
stack: NINJA.accountAddress(account)
|
2015-04-13 08:02:33 +02:00
|
|
|
}
|
2015-05-22 09:22:24 +02:00
|
|
|
]
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
2015-04-14 12:23:35 +02:00
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
text:(NINJA.getEntityLabel(invoice)).toUpperCase(),
|
|
|
|
margin: [8, 70, 8, 16],
|
|
|
|
style: 'primaryColor',
|
|
|
|
fontSize: NINJA.fontSize + 2
|
2015-04-14 12:23:35 +02:00
|
|
|
},
|
2015-04-13 08:02:33 +02:00
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
table: {
|
|
|
|
headerRows: 1,
|
|
|
|
widths: ['auto', 'auto', '*'],
|
|
|
|
body: [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
table: {
|
|
|
|
body: NINJA.invoiceDetails(invoice),
|
|
|
|
},
|
|
|
|
layout: 'noBorders',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
table: {
|
|
|
|
body: NINJA.clientDetails(invoice),
|
|
|
|
},
|
|
|
|
layout: 'noBorders',
|
|
|
|
},
|
|
|
|
''
|
|
|
|
]
|
|
|
|
]
|
2015-04-13 08:02:33 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
layout: {
|
|
|
|
hLineWidth: function (i, node) {
|
|
|
|
return (i === 0 || i === node.table.body.length) ? .5 : 0;
|
|
|
|
},
|
|
|
|
vLineWidth: function (i, node) {
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
hLineColor: function (i, node) {
|
|
|
|
return '#D8D8D8';
|
|
|
|
},
|
|
|
|
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',
|
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
table: {
|
|
|
|
headerRows: 1,
|
|
|
|
widths: ['15%', '*', 'auto', 'auto', 'auto', 'auto'],
|
|
|
|
body: NINJA.invoiceLines(invoice),
|
2015-04-13 14:37:42 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
layout: {
|
|
|
|
hLineWidth: function (i, node) {
|
|
|
|
return i === 0 ? 0 : .5;
|
|
|
|
},
|
|
|
|
vLineWidth: function (i, node) {
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
hLineColor: function (i, node) {
|
|
|
|
return '#D8D8D8';
|
|
|
|
},
|
|
|
|
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-14 12:23:35 +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-05-22 09:22:24 +02:00
|
|
|
columns: [
|
|
|
|
NINJA.notesAndTerms(invoice),
|
2015-04-14 12:23:35 +02:00
|
|
|
{
|
2015-05-22 09:22:24 +02:00
|
|
|
style: 'subtotals',
|
|
|
|
table: {
|
|
|
|
widths: ['*', '*'],
|
|
|
|
body: NINJA.subtotals(invoice),
|
2015-04-14 12:23:35 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
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-14 12:23:35 +02:00
|
|
|
},
|
|
|
|
}
|
2015-05-22 09:22:24 +02:00
|
|
|
]
|
2015-04-13 22:45:09 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
],
|
2015-04-14 09:04:58 +02:00
|
|
|
|
2015-05-22 09:22:24 +02:00
|
|
|
defaultStyle: {
|
2015-06-03 19:55:48 +02:00
|
|
|
//font: 'arialuni',
|
2015-05-22 09:22:24 +02:00
|
|
|
fontSize: NINJA.fontSize,
|
|
|
|
margin: [8, 4, 8, 4]
|
2015-04-14 12:23:35 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
styles: {
|
|
|
|
primaryColor:{
|
|
|
|
color: NINJA.getPrimaryColor('#299CC2')
|
|
|
|
},
|
|
|
|
accountName: {
|
|
|
|
margin: [4, 2, 4, 2],
|
|
|
|
color: NINJA.getPrimaryColor('#299CC2')
|
|
|
|
},
|
|
|
|
accountDetails: {
|
|
|
|
margin: [4, 2, 4, 2],
|
|
|
|
color: '#AAA9A9'
|
|
|
|
},
|
|
|
|
even: {
|
|
|
|
},
|
|
|
|
odd: {
|
|
|
|
fillColor:'#F4F4F4'
|
|
|
|
},
|
|
|
|
productKey: {
|
|
|
|
color: NINJA.getPrimaryColor('#299CC2')
|
|
|
|
},
|
|
|
|
tableHeader: {
|
|
|
|
bold: true
|
|
|
|
},
|
|
|
|
balanceDueLabel: {
|
|
|
|
fontSize: NINJA.fontSize + 2
|
|
|
|
},
|
|
|
|
balanceDueValue: {
|
|
|
|
fontSize: NINJA.fontSize + 2,
|
|
|
|
color: NINJA.getPrimaryColor('#299CC2')
|
|
|
|
},
|
2015-04-14 12:42:59 +02:00
|
|
|
},
|
2015-05-22 09:22:24 +02:00
|
|
|
pageMargins: [40, 40, 40, 40],
|
2015-04-13 11:23:43 +02:00
|
|
|
};
|