1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Fix 'balance due' PDF styling

This commit is contained in:
Hillel Coren 2017-05-14 17:18:30 +03:00
parent 661028b4e7
commit 587acbe098
13 changed files with 87 additions and 87 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -595,8 +595,8 @@ NINJA.invoiceDocuments = function(invoice) {
NINJA.statementSubtotals = function(invoice) NINJA.statementSubtotals = function(invoice)
{ {
var data = [[ var data = [[
{ text: invoiceLabels.balance_due, style: ['subtotalsLabel', 'balanceDueLabel'] }, { text: invoiceLabels.balance_due, style: ['subtotalsLabel', 'subtotalsBalanceDueLabel'] },
{ text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['subtotals', 'balanceDue'] } { text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['subtotals', 'subtotalsBalanceDue'] }
]]; ]];
return NINJA.prepareDataPairs(data, 'subtotals'); return NINJA.prepareDataPairs(data, 'subtotals');
@ -662,16 +662,16 @@ NINJA.subtotals = function(invoice, hideBalance)
if (!hideBalance || isPartial) { if (!hideBalance || isPartial) {
data.push([ data.push([
{ text: invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['subtotalsLabel', isPartial ? '' : 'balanceDueLabel'] }, { text: invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['subtotalsLabel', isPartial ? '' : 'subtotalsBalanceDueLabel'] },
{ text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['subtotals', isPartial ? '' : 'balanceDue'] } { text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['subtotals', isPartial ? '' : 'subtotalsBalanceDue'] }
]); ]);
} }
if (!hideBalance) { if (!hideBalance) {
if (isPartial) { if (isPartial) {
data.push([ data.push([
{ text: invoiceLabels.partial_due, style: ['subtotalsLabel', 'balanceDueLabel'] }, { text: invoiceLabels.partial_due, style: ['subtotalsLabel', 'subtotalsBalanceDueLabel'] },
{ text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['subtotals', 'balanceDue'] } { text: formatMoneyInvoice(invoice.balance_amount, invoice), style: ['subtotals', 'subtotalsBalanceDue'] }
]); ]);
} }
} }
@ -682,8 +682,8 @@ NINJA.subtotals = function(invoice, hideBalance)
NINJA.subtotalsBalance = function(invoice) { NINJA.subtotalsBalance = function(invoice) {
var isPartial = NINJA.parseFloat(invoice.partial); var isPartial = NINJA.parseFloat(invoice.partial);
return [[ return [[
{text: isPartial ? invoiceLabels.partial_due : (invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due), style:['subtotalsLabel', 'balanceDueLabel']}, {text: isPartial ? invoiceLabels.partial_due : (invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due), style:['subtotalsLabel', 'subtotalsBalanceDueLabel']},
{text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['subtotals', 'balanceDue']} {text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['subtotals', 'subtotalsBalanceDue']}
]]; ]];
} }

View File

@ -171,11 +171,11 @@
"productKey": { "productKey": {
"color": "$primaryColor:#36a498" "color": "$primaryColor:#36a498"
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"bold": true "bold": true
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#36a498", "color": "$primaryColor:#36a498",
"bold": true "bold": true

View File

@ -1,7 +1,7 @@
{ {
"content": [ "content": [
{ {
"columns": "columns":
[ [
{ {
"image": "$accountLogo", "image": "$accountLogo",
@ -16,7 +16,7 @@
"width": 150, "width": 150,
"stack": "$accountAddress" "stack": "$accountAddress"
} }
] ]
}, },
{ {
"columns": [ "columns": [
@ -29,12 +29,12 @@
"margin": [0, 20, 0, 0] "margin": [0, 20, 0, 0]
}, },
{ {
"canvas": [{ "type": "rect", "x": 20, "y": 0, "w": 174, "h": "$invoiceDetailsHeight","r":10, "lineWidth": 1,"color":"$primaryColor:#eb792d"}], "canvas": [{ "type": "rect", "x": 20, "y": 0, "w": 174, "h": "$invoiceDetailsHeight","r":10, "lineWidth": 1,"color":"$primaryColor:#eb792d"}],
"width":36, "width":36,
"margin":[200,25,0,0] "margin":[200,25,0,0]
}, },
{ {
"table": { "table": {
"widths": [64, 70], "widths": [64, 70],
"body": "$invoiceDetails" "body": "$invoiceDetails"
}, },
@ -56,12 +56,12 @@
"vLineWidth": "$notFirst:.5", "vLineWidth": "$notFirst:.5",
"hLineColor": "#FFFFFF", "hLineColor": "#FFFFFF",
"vLineColor": "#FFFFFF", "vLineColor": "#FFFFFF",
"paddingLeft": "$amount:8", "paddingLeft": "$amount:8",
"paddingRight": "$amount:8", "paddingRight": "$amount:8",
"paddingTop": "$amount:12", "paddingTop": "$amount:12",
"paddingBottom": "$amount:12" "paddingBottom": "$amount:12"
} }
}, },
{ {
"columns": [ "columns": [
"$notesAndTerms", "$notesAndTerms",
@ -130,7 +130,7 @@
} }
], ],
"margin": [40, -20, 40, 0] "margin": [40, -20, 40, 0]
}, },
"defaultStyle": { "defaultStyle": {
"fontSize": "$fontSize", "fontSize": "$fontSize",
"margin": [8, 4, 8, 4] "margin": [8, 4, 8, 4]
@ -159,12 +159,12 @@
"productKey": { "productKey": {
"bold": true "bold": true
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "#ffffff", "color": "#ffffff",
"bold": true "bold": true
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"bold": true, "bold": true,
"color":"#ffffff", "color":"#ffffff",
@ -189,7 +189,7 @@
}, },
"lineTotalTableHeader": { "lineTotalTableHeader": {
"alignment": "right" "alignment": "right"
}, },
"issuedTo": { "issuedTo": {
"margin": [0,2,0,1], "margin": [0,2,0,1],
"bold": true, "bold": true,
@ -221,11 +221,11 @@
}, },
"subtotals": { "subtotals": {
"alignment": "right" "alignment": "right"
}, },
"subtotalsBalance": { "subtotalsBalance": {
"alignment": "right", "alignment": "right",
"margin": [0, -25, 0, 0] "margin": [0, -25, 0, 0]
}, },
"termsLabel": { "termsLabel": {
"bold": true, "bold": true,
"margin": [0, 0, 0, 4] "margin": [0, 0, 0, 4]
@ -243,4 +243,4 @@
} }
}, },
"pageMargins": [40, 40, 40, 40] "pageMargins": [40, 40, 40, 40]
} }

View File

@ -144,10 +144,10 @@
"color": "$primaryColor:#37a3c6", "color": "$primaryColor:#37a3c6",
"bold": true "bold": true
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLarger" "fontSize": "$fontSizeLarger"
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLarger", "fontSize": "$fontSizeLarger",
"color": "$primaryColor:#37a3c6" "color": "$primaryColor:#37a3c6"
}, },

View File

@ -1,6 +1,6 @@
{ {
"content": [ "content": [
{ {
"columns": [ "columns": [
{ {
"stack": "$clientDetails" "stack": "$clientDetails"
@ -21,7 +21,7 @@
}, },
{ {
"columns": [ "columns": [
{"text": {"text":
[ [
{"text": "$entityTypeUC", "style": "header1"}, {"text": "$entityTypeUC", "style": "header1"},
{"text": "#", "style": "header2"}, {"text": "#", "style": "header2"},
@ -31,7 +31,7 @@
}, },
{ {
"width":200, "width":200,
"table": { "table": {
"body": "$invoiceDetails" "body": "$invoiceDetails"
}, },
"layout": "noBorders", "layout": "noBorders",
@ -52,12 +52,12 @@
"hLineWidth": "$none", "hLineWidth": "$none",
"vLineWidth": "$none", "vLineWidth": "$none",
"hLineColor": "$primaryColor:#E8E8E8", "hLineColor": "$primaryColor:#E8E8E8",
"paddingLeft": "$amount:8", "paddingLeft": "$amount:8",
"paddingRight": "$amount:8", "paddingRight": "$amount:8",
"paddingTop": "$amount:8", "paddingTop": "$amount:8",
"paddingBottom": "$amount:8" "paddingBottom": "$amount:8"
} }
}, },
{ {
"columns": [ "columns": [
"$notesAndTerms", "$notesAndTerms",
@ -70,10 +70,10 @@
"layout": { "layout": {
"hLineWidth": "$none", "hLineWidth": "$none",
"vLineWidth": "$none", "vLineWidth": "$none",
"paddingLeft": "$amount:34", "paddingLeft": "$amount:34",
"paddingRight": "$amount:8", "paddingRight": "$amount:8",
"paddingTop": "$amount:4", "paddingTop": "$amount:4",
"paddingBottom": "$amount:4" "paddingBottom": "$amount:4"
} }
} }
] ]
@ -84,11 +84,11 @@
}, },
{ {
"text": "$balanceDueLabel", "text": "$balanceDueLabel",
"style": "balanceDueLabel" "style": "subtotalsBalanceDueLabel"
}, },
{ {
"text": "$balanceDue", "text": "$balanceDue",
"style": "balanceDue" "style": "subtotalsBalanceDue"
}, },
{ {
"stack": [ "stack": [
@ -131,11 +131,11 @@
"productKey": { "productKey": {
"bold": true "bold": true
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"margin": [320,20,0,0] "margin": [320,20,0,0]
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#AE1E54", "color": "$primaryColor:#AE1E54",
"bold": true, "bold": true,
@ -165,7 +165,7 @@
}, },
"lineTotalTableHeader": { "lineTotalTableHeader": {
"alignment": "right" "alignment": "right"
}, },
"clientName": { "clientName": {
"bold": true "bold": true
}, },
@ -173,19 +173,19 @@
"margin": [0,2,0,1] "margin": [0,2,0,1]
}, },
"header1": { "header1": {
"bold": true, "bold": true,
"margin": [0, 30, 0, 16], "margin": [0, 30, 0, 16],
"fontSize": 46 "fontSize": 46
}, },
"header2": { "header2": {
"margin": [0, 30, 0, 16], "margin": [0, 30, 0, 16],
"fontSize": 46, "fontSize": 46,
"italics": true, "italics": true,
"color": "$primaryColor:#AE1E54" "color": "$primaryColor:#AE1E54"
}, },
"invoiceLineItemsTable": { "invoiceLineItemsTable": {
"margin": [0, 4, 0, 16] "margin": [0, 4, 0, 16]
}, },
"cost": { "cost": {
"alignment": "right" "alignment": "right"
}, },
@ -200,7 +200,7 @@
}, },
"subtotals": { "subtotals": {
"alignment": "right" "alignment": "right"
}, },
"termsLabel": { "termsLabel": {
"bold": true, "bold": true,
"margin": [0, 0, 0, 4] "margin": [0, 0, 0, 4]
@ -218,4 +218,4 @@
} }
}, },
"pageMargins": [40, 40, 40, 40] "pageMargins": [40, 40, 40, 40]
} }

View File

@ -13,7 +13,7 @@
{ {
"width": 120, "width": 120,
"stack": [ "stack": [
{"text": "$invoiceToLabel", "style": "header", "margin": [0, 0, 0, 6]}, {"text": "$invoiceToLabel", "style": "header", "margin": [0, 0, 0, 6]},
"$clientDetails" "$clientDetails"
] ]
}, },
@ -33,15 +33,15 @@
}, },
{ {
"stack": [ "stack": [
{"text": "$detailsLabel", "style": "header", "margin": [0, 0, 0, 6]}, {"text": "$detailsLabel", "style": "header", "margin": [0, 0, 0, 6]},
{ {
"width":180, "width":180,
"table": { "table": {
"body": "$invoiceDetails" "body": "$invoiceDetails"
}, },
"layout": "noBorders" "layout": "noBorders"
} }
] ]
}], }],
"margin": [0, 20, 0, 0] "margin": [0, 20, 0, 0]
}, },
@ -55,12 +55,12 @@
"layout": { "layout": {
"hLineWidth": "$notFirst:.5", "hLineWidth": "$notFirst:.5",
"vLineWidth": "$none", "vLineWidth": "$none",
"paddingLeft": "$amount:8", "paddingLeft": "$amount:8",
"paddingRight": "$amount:8", "paddingRight": "$amount:8",
"paddingTop": "$amount:12", "paddingTop": "$amount:12",
"paddingBottom": "$amount:12" "paddingBottom": "$amount:12"
} }
}, },
{ {
"columns": [ "columns": [
"$notesAndTerms", "$notesAndTerms",
@ -73,10 +73,10 @@
"layout": { "layout": {
"hLineWidth": "$none", "hLineWidth": "$none",
"vLineWidth": "$none", "vLineWidth": "$none",
"paddingLeft": "$amount:34", "paddingLeft": "$amount:34",
"paddingRight": "$amount:8", "paddingRight": "$amount:8",
"paddingTop": "$amount:4", "paddingTop": "$amount:4",
"paddingBottom": "$amount:4" "paddingBottom": "$amount:4"
} }
} }
] ]
@ -86,11 +86,11 @@
}, },
{ {
"text": "$balanceDueLabel", "text": "$balanceDueLabel",
"style": "balanceDueLabel" "style": "subtotalsBalanceDueLabel"
}, },
{ {
"text": "$balanceDue", "text": "$balanceDue",
"style": "balanceDue" "style": "subtotalsBalanceDue"
}, },
{ {
"canvas": [{ "type": "line", "x1": 270, "y1": 20, "x2": 515, "y2": 20, "lineWidth": 1,"dash": { "length": 2 }}] "canvas": [{ "type": "line", "x1": 270, "y1": 20, "x2": 515, "y2": 20, "lineWidth": 1,"dash": { "length": 2 }}]
@ -100,7 +100,7 @@
"$invoiceDocuments" "$invoiceDocuments"
], ],
"style": "invoiceDocuments" "style": "invoiceDocuments"
}], }],
"footer": [ "footer": [
{ {
"columns": [ "columns": [
@ -136,22 +136,22 @@
}, },
"odd": { "odd": {
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#5a7b61", "color": "$primaryColor:#5a7b61",
"margin": [320,20,0,0] "margin": [320,20,0,0]
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#5a7b61", "color": "$primaryColor:#5a7b61",
"style": true, "style": true,
"margin":[0,-14,8,0], "margin":[0,-14,8,0],
"alignment":"right" "alignment":"right"
}, },
"invoiceDetailBalanceDue": { "invoiceDetailBalanceDue": {
"color": "$primaryColor:#5a7b61", "color": "$primaryColor:#5a7b61",
"bold": true "bold": true
}, },
"header": { "header": {
"fontSize": 14, "fontSize": 14,
"bold": true "bold": true
@ -172,7 +172,7 @@
}, },
"lineTotalTableHeader": { "lineTotalTableHeader": {
"alignment": "right" "alignment": "right"
}, },
"invoiceLineItemsTable": { "invoiceLineItemsTable": {
"margin": [0, 40, 0, 16] "margin": [0, 40, 0, 16]
}, },
@ -190,7 +190,7 @@
}, },
"subtotals": { "subtotals": {
"alignment": "right" "alignment": "right"
}, },
"termsLabel": { "termsLabel": {
"bold": true, "bold": true,
"margin": [0, 0, 0, 4] "margin": [0, 0, 0, 4]

View File

@ -140,11 +140,11 @@
"clientName": { "clientName": {
"bold": true "bold": true
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"bold": true "bold": true
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#bc9f2b", "color": "$primaryColor:#bc9f2b",
"bold": true "bold": true

View File

@ -75,13 +75,13 @@
}, },
{ {
"text": "$balanceDueLabel", "text": "$balanceDueLabel",
"style": "balanceDueLabel", "style": "subtotalsBalanceDueLabel",
"margin": [0, 16, 0, 0], "margin": [0, 16, 0, 0],
"width": 370 "width": 370
}, },
{ {
"text": "$balanceDue", "text": "$balanceDue",
"style": "balanceDue", "style": "subtotalsBalanceDue",
"margin": [0, 16, 8, 0] "margin": [0, 16, 8, 0]
} }
] ]
@ -202,13 +202,13 @@
"lineTotalTableHeader": { "lineTotalTableHeader": {
"alignment": "right" "alignment": "right"
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color":"#FFFFFF", "color":"#FFFFFF",
"alignment":"right", "alignment":"right",
"bold": true "bold": true
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color":"#FFFFFF", "color":"#FFFFFF",
"bold": true, "bold": true,

View File

@ -142,10 +142,10 @@
"bold": true, "bold": true,
"fontSize": "$fontSizeLarger" "fontSize": "$fontSizeLarger"
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest" "fontSize": "$fontSizeLargest"
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color": "$primaryColor:#cd5138" "color": "$primaryColor:#cd5138"
}, },

View File

@ -157,10 +157,10 @@
"invoiceDetailBalanceDue": { "invoiceDetailBalanceDue": {
"fillColor": "#e6e6e6" "fillColor": "#e6e6e6"
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fillColor": "#e6e6e6" "fillColor": "#e6e6e6"
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fillColor": "#e6e6e6" "fillColor": "#e6e6e6"
}, },
"header": { "header": {

View File

@ -201,12 +201,12 @@
"lineTotalTableHeader": { "lineTotalTableHeader": {
"alignment": "right" "alignment": "right"
}, },
"balanceDueLabel": { "subtotalsBalanceDueLabel": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"color":"#FFFFFF", "color":"#FFFFFF",
"bold": true "bold": true
}, },
"balanceDue": { "subtotalsBalanceDue": {
"fontSize": "$fontSizeLargest", "fontSize": "$fontSizeLargest",
"bold": true, "bold": true,
"color":"#FFFFFF", "color":"#FFFFFF",