mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:47:32 -05:00 
			
		
		
		
	footer added
This commit is contained in:
		
							parent
							
								
									3d96f51790
								
							
						
					
					
						commit
						8921eb0e9b
					
				@ -23,16 +23,12 @@ function notesAndTerms(invoice)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function invoiceLines(invoice) {
 | 
					function invoiceLines(invoice) {
 | 
				
			||||||
  var grid = 
 | 
					  var grid = 
 | 
				
			||||||
  [[{text: invoiceLabels.item, style: 'tableHeader'}, 
 | 
					          [[{text: invoiceLabels.item, style: 'tableHeader'}, 
 | 
				
			||||||
            {text: invoiceLabels.description, style: 'tableHeader'}, 
 | 
					            {text: invoiceLabels.description, style: 'tableHeader'}, 
 | 
				
			||||||
            {text: invoiceLabels.unit_cost, style: 'tableHeader'}, 
 | 
					            {text: invoiceLabels.unit_cost, style: 'tableHeader'}, 
 | 
				
			||||||
            {text: invoiceLabels.quantity, style: 'tableHeader'}, 
 | 
					            {text: invoiceLabels.quantity, style: 'tableHeader'}, 
 | 
				
			||||||
            {text: invoice.has_taxes?invoiceLabels.tax:'', style: 'tableHeader'}, 
 | 
					            {text: invoice.has_taxes?invoiceLabels.tax:'', style: 'tableHeader'}, 
 | 
				
			||||||
            {text: invoiceLabels.line_total, 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 total = 0;
 | 
				
			||||||
  var shownItem = false;
 | 
					  var shownItem = false;
 | 
				
			||||||
  var currencyId = invoice && invoice.client ? invoice.client.currency_id : 1;
 | 
					  var currencyId = invoice && invoice.client ? invoice.client.currency_id : 1;
 | 
				
			||||||
@ -84,71 +80,6 @@ function invoiceLines(invoice) {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    grid.push(row);
 | 
					    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;
 | 
					  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;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -99,6 +99,9 @@ var dd = {
 | 
				
			|||||||
     ]
 | 
					     ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
 | 
					  footer:function(){
 | 
				
			||||||
 | 
					    return invoice.invoice_footer?invoice.invoice_footer:"";
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  defaultStyle: {
 | 
					  defaultStyle: {
 | 
				
			||||||
    font: 'sans'
 | 
					    font: 'sans'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user