From 8921eb0e9b60b27a3f84c667b7dc7de97a4b894d Mon Sep 17 00:00:00 2001 From: sigitas Date: Tue, 14 Apr 2015 00:39:08 +0300 Subject: [PATCH] footer added --- public/js/pdf.pdfmake.js | 71 +----------------------------------- public/js/templates/clean.js | 3 ++ 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index c675b1dffd49..431e61bc4730 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -23,16 +23,12 @@ function notesAndTerms(invoice) function invoiceLines(invoice) { var grid = - [[{text: invoiceLabels.item, style: 'tableHeader'}, + [[{text: invoiceLabels.item, style: 'tableHeader'}, {text: invoiceLabels.description, style: 'tableHeader'}, {text: invoiceLabels.unit_cost, style: 'tableHeader'}, {text: invoiceLabels.quantity, style: 'tableHeader'}, {text: invoice.has_taxes?invoiceLabels.tax:'', style: 'tableHeader'}, {text: invoiceLabels.line_total, style: 'tableHeader'}]]; - //grid.push(['Sample value 1', 'Sample value 2', 'Sample value 3', 'Sample value 2', invoice.has_taxes?'Sample value 2':'','Sample value 3']); - //grid.push(['Sample value 1', 'Sample value 2', 'Sample value 3', 'Sample value 2', invoice.has_taxes?'Sample value 2':'','Sample value 3']); - - var line = 1; var total = 0; var shownItem = false; var currencyId = invoice && invoice.client ? invoice.client.currency_id : 1; @@ -84,71 +80,6 @@ function invoiceLines(invoice) { grid.push(row); } -/* - y = tableTop + (line * layout.tableRowHeight) + (3 * layout.tablePadding); - - if (invoice.invoice_design_id == 8) { - doc.setDrawColor(30, 30, 30); - doc.setLineWidth(0.5); - - var topX = tableTop - 14; - doc.line(layout.marginLeft - 10, topX, layout.marginLeft - 10, y); - doc.line(layout.descriptionLeft - 8, topX, layout.descriptionLeft - 8, y); - doc.line(layout.unitCostRight - 55, topX, layout.unitCostRight - 55, y); - doc.line(layout.qtyRight - 50, topX, layout.qtyRight - 50, y); - if (invoice.has_taxes) { - doc.line(layout.taxRight - 28, topX, layout.taxRight - 28, y); - } - doc.line(totalX - 25, topX, totalX - 25, y + 90); - doc.line(totalX + 45, topX, totalX + 45, y + 90); - } - - var cutoff = 700; - if (invoice.terms) { - cutoff -= 50; - } - if (invoice.public_notes) { - cutoff -= 50; - } - - if (y > cutoff) { - doc.addPage(); - return layout.marginLeft; - } -*/ return grid; } - -/* - var doc = new jsPDF('portrait', 'pt', 'a4'); - - //doc.getStringUnitWidth = function(param) { console.log('getStringUnitWidth: %s', param); return 0}; - - //Set PDF properities - doc.setProperties({ - title: 'Invoice ' + invoice.invoice_number, - subject: '', - author: 'InvoiceNinja.com', - keywords: 'pdf, invoice', - creator: 'InvoiceNinja.com' - }); - - //set default style for report - doc.setFont('Helvetica',''); - - eval(javascript); - - // add footer - if (invoice.invoice_footer) { - doc.setFontType('normal'); - doc.setFontSize('8'); - SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc); - var top = doc.internal.pageSize.height - layout.marginLeft; - var numLines = invoice.invoice_footer.split("\n").length - 1; - doc.text(layout.marginLeft, top - (numLines * 8), invoice.invoice_footer); - } - - return doc; - } - */ diff --git a/public/js/templates/clean.js b/public/js/templates/clean.js index abb0c75e81f8..1ec00ab0a7a8 100644 --- a/public/js/templates/clean.js +++ b/public/js/templates/clean.js @@ -99,6 +99,9 @@ var dd = { ] }, ], + footer:function(){ + return invoice.invoice_footer?invoice.invoice_footer:""; + }, defaultStyle: { font: 'sans' },