mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
commit
c6584e0a6c
@ -567,6 +567,11 @@
|
|||||||
invoice.imageLogoWidth1 =120;
|
invoice.imageLogoWidth1 =120;
|
||||||
invoice.imageLogoHeight1 = 40
|
invoice.imageLogoHeight1 = 40
|
||||||
|
|
||||||
|
invoice.imageLogo2 = "{{ HTML::image_data('images/report_logo2.jpg') }}";
|
||||||
|
invoice.imageLogoWidth2 =325/2;
|
||||||
|
invoice.imageLogoHeight2 = 81/2;
|
||||||
|
|
||||||
|
|
||||||
return invoice;
|
return invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
public/images/report_logo2.jpg
Normal file
BIN
public/images/report_logo2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -12,16 +12,12 @@ var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
|
|||||||
|
|
||||||
function generatePDF(invoice, checkMath) {
|
function generatePDF(invoice, checkMath) {
|
||||||
|
|
||||||
|
|
||||||
//console.log ('DESIGN:'+invoice.invoice_design_id);
|
|
||||||
|
|
||||||
report_id=invoice.invoice_design_id;
|
report_id=invoice.invoice_design_id;
|
||||||
|
|
||||||
doc= GetPdf(invoice,checkMath,report_id);
|
doc= GetPdf(invoice,checkMath,report_id);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Handle converting variables in the invoices (ie, MONTH+1) */
|
/* Handle converting variables in the invoices (ie, MONTH+1) */
|
||||||
function processVariables(str) {
|
function processVariables(str) {
|
||||||
if (!str) return '';
|
if (!str) return '';
|
||||||
@ -533,13 +529,14 @@ $.fn.datepicker.defaults.autoclose = true;
|
|||||||
$.fn.datepicker.defaults.todayHighlight = true;
|
$.fn.datepicker.defaults.todayHighlight = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
|
|
||||||
function GetPdf(invoice,checkMath,report_id){
|
function GetPdf(invoice,checkMath,report_id){
|
||||||
|
|
||||||
|
|
||||||
if (report_id==1) return GetReportTemplate1(invoice,checkMath);
|
if (report_id==1) return GetReportTemplate1(invoice,checkMath);
|
||||||
//if (report_id==2) return GetReportTemplate1(invoice,checkMath);
|
if (report_id==2) return GetReportTemplate2(invoice,checkMath);
|
||||||
//if (report_id==3) return GetReportTemplate1(invoice,checkMath);
|
//if (report_id==3) return GetReportTemplate1(invoice,checkMath);
|
||||||
|
|
||||||
|
|
||||||
@ -551,7 +548,7 @@ function GetPdf(invoice,checkMath,report_id){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function GetReportTemplate1 (invoice,checkMath)
|
function GetReportTemplate2 (invoice,checkMath)
|
||||||
{
|
{
|
||||||
var doc=false;
|
var doc=false;
|
||||||
|
|
||||||
@ -644,14 +641,34 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")
|
||||||
|
@param unit Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in"
|
||||||
|
@param format One of 'a3', 'a4' (Default),'a5' ,'letter' ,'legal'
|
||||||
|
@returns {jsPDF}
|
||||||
|
*/
|
||||||
|
var doc = new jsPDF('portrait', 'pt','a4');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Set PDF properities
|
||||||
|
doc.setProperties({
|
||||||
|
title: '',
|
||||||
|
subject: 'Report',
|
||||||
|
author: 'Ninja',
|
||||||
|
keywords: 'pdf, javascript,geenerated',
|
||||||
|
creator: 'Ninja'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var doc = new jsPDF('p', 'pt');
|
|
||||||
|
|
||||||
//set default style for report
|
//set default style for report
|
||||||
doc.setFont('Helvetica','');
|
doc.setFont('Helvetica','');
|
||||||
doc.setFontSize(7);
|
doc.setFontSize(7);
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
//Print header on document
|
//Print header on document
|
||||||
//for now we will put static header
|
//for now we will put static header
|
||||||
@ -684,7 +701,7 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
var dueDateX = headerRight - (doc.getStringUnitWidth(dueDate) * doc.internal.getFontSize());
|
var dueDateX = headerRight - (doc.getStringUnitWidth(dueDate) * doc.internal.getFontSize());
|
||||||
var poNumberX = headerRight - (doc.getStringUnitWidth(invoice.po_number) * doc.internal.getFontSize());
|
var poNumberX = headerRight - (doc.getStringUnitWidth(invoice.po_number) * doc.internal.getFontSize());
|
||||||
|
|
||||||
// doc.setFontType("normal");
|
|
||||||
|
|
||||||
var y = accountTop;
|
var y = accountTop;
|
||||||
var left = marginLeft;
|
var left = marginLeft;
|
||||||
@ -699,9 +716,9 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetPdfColor('GrayText',doc);
|
SetPdfColor('GrayText',doc);
|
||||||
doc.setFontSize(6);
|
doc.setFontSize(7);
|
||||||
|
|
||||||
//TODO:NOT AVAILEABLE FROM DATAMOEL
|
//TODO:NOT AVAILEABLE FROM DATAMODEL
|
||||||
//account.email='email N/A';
|
//account.email='email N/A';
|
||||||
if (account.email) {
|
if (account.email) {
|
||||||
y += rowHeight;
|
y += rowHeight;
|
||||||
@ -712,7 +729,7 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
//console.log('account.email NOT DEFINED !');
|
//console.log('account.email NOT DEFINED !');
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:NOT AVAILEABLE FROM DATAMOEL
|
//TODO:NOT AVAILEABLE FROM DATAMODEL
|
||||||
//account.phone='phone N/A';
|
//account.phone='phone N/A';
|
||||||
if (account.phone) {
|
if (account.phone) {
|
||||||
y += rowHeight;
|
y += rowHeight;
|
||||||
@ -748,32 +765,17 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
doc.text(left, y, account.country.name);
|
doc.text(left, y, account.country.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------Publish Client Details block--------------------------------------------
|
//-----------------------------Publish Client Details block--------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
var y = accountTop;
|
var y = accountTop;
|
||||||
var left = marginLeft;
|
var left = marginLeft;
|
||||||
|
|
||||||
var headerY = headerTop;
|
var headerY = headerTop;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SetPdfColor('LightBlue',doc);
|
SetPdfColor('LightBlue',doc);
|
||||||
doc.setFontSize(8);
|
doc.setFontSize('11');
|
||||||
|
|
||||||
//doc.setFontType("bold");
|
|
||||||
|
|
||||||
doc.text(50, headerTop, 'Invoice');
|
doc.text(50, headerTop, 'Invoice');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SetPdfColor('GrayLogo',doc); //set black color
|
SetPdfColor('GrayLogo',doc); //set black color
|
||||||
y=130;
|
y=130;
|
||||||
doc.line(30, y, 560, y); // horizontal line
|
doc.line(30, y, 560, y); // horizontal line
|
||||||
@ -794,19 +796,12 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
|
|
||||||
SetPdfColor('Black',doc); //set black color
|
SetPdfColor('Black',doc); //set black color
|
||||||
|
|
||||||
doc.setFontSize(6);
|
doc.setFontSize(7);
|
||||||
doc.text(marginLeft1, line1, 'Invoice Number');
|
doc.text(marginLeft1, line1, 'Invoice Number');
|
||||||
doc.text(marginLeft1, line2, 'Invoice date');
|
doc.text(marginLeft1, line2, 'Invoice date');
|
||||||
doc.text(marginLeft1, line3, 'Amount Due');
|
doc.text(marginLeft1, line3, 'Amount Due');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// invoiceNumber='12345'
|
|
||||||
// invoiceDate='12345'
|
|
||||||
//invoiceAmount='12345'
|
|
||||||
|
|
||||||
doc.setFontType("bold");
|
doc.setFontType("bold");
|
||||||
doc.text(marginLeft2, line1, invoiceNumber);
|
doc.text(marginLeft2, line1, invoiceNumber);
|
||||||
doc.setFontType("normal");
|
doc.setFontType("normal");
|
||||||
@ -845,7 +840,6 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
doc.text(marginLeft3, line21, ClientCompanyAddress1);
|
doc.text(marginLeft3, line21, ClientCompanyAddress1);
|
||||||
doc.text(marginLeft3, line22, ClientCompanyAddress2);
|
doc.text(marginLeft3, line22, ClientCompanyAddress2);
|
||||||
|
|
||||||
|
|
||||||
doc.text(marginLeft3, line3, ClientCompanyEmail);
|
doc.text(marginLeft3, line3, ClientCompanyEmail);
|
||||||
doc.text(marginLeft3, line31, ClientCompanyPhone);
|
doc.text(marginLeft3, line31, ClientCompanyPhone);
|
||||||
|
|
||||||
@ -854,7 +848,6 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
y=195;
|
y=195;
|
||||||
doc.line(30, y, 560, y); // horizontal line
|
doc.line(30, y, 560, y); // horizontal line
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------Publishing Table--------------------------------------------------
|
//--------------------------------Publishing Table--------------------------------------------------
|
||||||
GlobalY=y+30;
|
GlobalY=y+30;
|
||||||
|
|
||||||
@ -878,18 +871,14 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
qtyRight -= 40;
|
qtyRight -= 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var costX = unitCostRight - (doc.getStringUnitWidth('Unit Cost') * doc.internal.getFontSize());
|
var costX = unitCostRight - (doc.getStringUnitWidth('Unit Cost') * doc.internal.getFontSize());
|
||||||
var qtyX = qtyRight - (doc.getStringUnitWidth('Quantity') * doc.internal.getFontSize());
|
var qtyX = qtyRight - (doc.getStringUnitWidth('Quantity') * doc.internal.getFontSize());
|
||||||
var taxX = taxRight - (doc.getStringUnitWidth('Tax') * doc.internal.getFontSize());
|
var taxX = taxRight - (doc.getStringUnitWidth('Tax') * doc.internal.getFontSize());
|
||||||
var totalX = lineTotalRight - (doc.getStringUnitWidth('Line Total') * doc.internal.getFontSize());
|
var totalX = lineTotalRight - (doc.getStringUnitWidth('Line Total') * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tableTop=GlobalY;//redefine this to dynamic value
|
tableTop=GlobalY;//redefine this to dynamic value
|
||||||
|
|
||||||
doc.setFontSize(9);
|
doc.setFontSize(10);
|
||||||
|
|
||||||
doc.text(tableLeft, tableTop, 'Item');
|
doc.text(tableLeft, tableTop, 'Item');
|
||||||
doc.text(descriptionLeft, tableTop, 'Description');
|
doc.text(descriptionLeft, tableTop, 'Description');
|
||||||
@ -906,14 +895,12 @@ function GetReportTemplate1 (invoice,checkMath)
|
|||||||
doc.setFontSize(7);
|
doc.setFontSize(7);
|
||||||
|
|
||||||
/* line items */
|
/* line items */
|
||||||
//doc.setFontType("normal");
|
|
||||||
var line = 1;
|
var line = 1;
|
||||||
var total = 0;
|
var total = 0;
|
||||||
var shownItem = false;
|
var shownItem = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GlobalY=GlobalY+14; //padding from top
|
GlobalY=GlobalY+14; //padding from top
|
||||||
|
|
||||||
var FontSize=7;
|
var FontSize=7;
|
||||||
@ -965,13 +952,6 @@ GlobalY=GlobalY+14; //padding from top
|
|||||||
var totalX = lineTotalRight - (doc.getStringUnitWidth(lineTotal) * doc.internal.getFontSize());
|
var totalX = lineTotalRight - (doc.getStringUnitWidth(lineTotal) * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
length=doc.splitTextToSize(item.notes, 200).length;
|
length=doc.splitTextToSize(item.notes, 200).length;
|
||||||
var h=length*FontSize;
|
var h=length*FontSize;
|
||||||
|
|
||||||
@ -1049,40 +1029,6 @@ GlobalY=GlobalY+14; //padding from top
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
if (line > MaxLinesPerPage) {
|
|
||||||
line = 0;
|
|
||||||
|
|
||||||
tableTop = 40;
|
|
||||||
GlobalY=tableTop;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var MaxLinesPerPage=70;
|
|
||||||
|
|
||||||
doc.addPage();
|
|
||||||
if (invoice.imageLogo1)
|
|
||||||
{
|
|
||||||
pageHeight=820;
|
|
||||||
var left = headerRight ;
|
|
||||||
y=pageHeight-invoice.imageLogoHeight1;
|
|
||||||
|
|
||||||
|
|
||||||
var left = headerRight - invoice.imageLogoWidth1;
|
|
||||||
doc.addImage(invoice.imageLogo1, 'JPEG', left, y, invoice.imageLogoWidth1, invoice.imageLogoHeight1);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1100,6 +1046,23 @@ GlobalY=GlobalY+14; //padding from top
|
|||||||
doc.setFontType("bold");
|
doc.setFontType("bold");
|
||||||
MsgRightAlign=400;
|
MsgRightAlign=400;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GlobalY=x;
|
||||||
|
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.setDrawColor(200,200,200);
|
||||||
|
doc.setFillColor(251,251,251);
|
||||||
|
var x1 = tableLeft-tablePadding*2 ;
|
||||||
|
var y1 = GlobalY-FontSize-tablePadding;
|
||||||
|
var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5;
|
||||||
|
var h2 = doc.internal.getFontSize()*3+tablePadding*2;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Msg='Total';
|
Msg='Total';
|
||||||
var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
|
var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
|
||||||
doc.text(TmpMsgX, x, Msg);
|
doc.text(TmpMsgX, x, Msg);
|
||||||
@ -1160,6 +1123,619 @@ GlobalY=GlobalY+14; //padding from top
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function GetReportTemplate1 (invoice,checkMath)
|
||||||
|
{
|
||||||
|
var doc=false;
|
||||||
|
|
||||||
|
var GlobalY=0;//Y position of line at current page
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var client = invoice.client;
|
||||||
|
var account = invoice.account;
|
||||||
|
|
||||||
|
|
||||||
|
var currencyId = client.currency_id;
|
||||||
|
var invoiceNumber = invoice.invoice_number;
|
||||||
|
var invoiceDate = invoice.invoice_date ? invoice.invoice_date : '';
|
||||||
|
var dueDate = invoice.due_date ? invoice.due_date : '';
|
||||||
|
|
||||||
|
var paid_to_date=client.paid_to_date;
|
||||||
|
|
||||||
|
var headerRight = 150;
|
||||||
|
var accountTop = 30;
|
||||||
|
var marginLeft = 180;
|
||||||
|
var rowHeight = 10;
|
||||||
|
var headerTop = 125; //height of HEADER //should be dynamic !
|
||||||
|
|
||||||
|
|
||||||
|
var descriptionLeft = 162;
|
||||||
|
var unitCostRight = 410;
|
||||||
|
var qtyRight = 480;
|
||||||
|
var taxRight = 480;
|
||||||
|
var lineTotalRight = 550;
|
||||||
|
var tableLeft = 50;
|
||||||
|
|
||||||
|
|
||||||
|
//var tableTop = 240+100;
|
||||||
|
|
||||||
|
//var tableRowHeight = 18;
|
||||||
|
var tablePadding = 6;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------ move to functions !
|
||||||
|
var total = 0;
|
||||||
|
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||||
|
var item = invoice.invoice_items[i];
|
||||||
|
var tax = 0;
|
||||||
|
if (item.tax && parseFloat(item.tax.rate)) {
|
||||||
|
tax = parseFloat(item.tax.rate);
|
||||||
|
} else if (item.tax_rate && parseFloat(item.tax_rate)) {
|
||||||
|
tax = parseFloat(item.tax_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
||||||
|
if (tax) {
|
||||||
|
lineTotal += lineTotal * tax / 100;
|
||||||
|
}
|
||||||
|
if (lineTotal) {
|
||||||
|
total += lineTotal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invoice.discount > 0) {
|
||||||
|
|
||||||
|
var discount = total * (invoice.discount/100);
|
||||||
|
total -= discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tax = 0;
|
||||||
|
if (invoice.tax && parseFloat(invoice.tax.rate)) {
|
||||||
|
tax = parseFloat(invoice.tax.rate);
|
||||||
|
} else if (invoice.tax_rate && parseFloat(invoice.tax_rate)) {
|
||||||
|
tax = parseFloat(invoice.tax_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tax) {
|
||||||
|
var tax = total * (tax/100);
|
||||||
|
total = parseFloat(total) + parseFloat(tax);
|
||||||
|
}
|
||||||
|
|
||||||
|
total = formatMoney(total - (invoice.amount - invoice.balance), currencyId);
|
||||||
|
|
||||||
|
var balance = formatMoney(total, currencyId);
|
||||||
|
|
||||||
|
/*
|
||||||
|
@param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")
|
||||||
|
@param unit Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in"
|
||||||
|
@param format One of 'a3', 'a4' (Default),'a5' ,'letter' ,'legal'
|
||||||
|
@returns {jsPDF}
|
||||||
|
*/
|
||||||
|
var doc = new jsPDF('portrait', 'pt','a4');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Set PDF properities
|
||||||
|
doc.setProperties({
|
||||||
|
title: '',
|
||||||
|
subject: 'Report',
|
||||||
|
author: 'Ninja',
|
||||||
|
keywords: 'pdf, javascript,geenerated',
|
||||||
|
creator: 'Ninja'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//set default style for report
|
||||||
|
doc.setFont('Helvetica','');
|
||||||
|
doc.setFontSize(7);
|
||||||
|
|
||||||
|
doc.setLineWidth(0.5);
|
||||||
|
|
||||||
|
doc.setFillColor( 46,43,43);
|
||||||
|
doc.setFillColor( 46,43,43);
|
||||||
|
|
||||||
|
var x1 =0;
|
||||||
|
|
||||||
|
var y1 = 0;
|
||||||
|
|
||||||
|
var w2 = 595;
|
||||||
|
var h2 = 100;// doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
if (invoice.image)
|
||||||
|
{
|
||||||
|
var left = headerRight - invoice.imageWidth;
|
||||||
|
doc.addImage(invoice.image, 'JPEG', left, 30, invoice.imageWidth, invoice.imageHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
Report2AddFooter (invoice,doc);
|
||||||
|
|
||||||
|
var invoiceNumberX = headerRight - (doc.getStringUnitWidth(invoiceNumber, false) * doc.internal.getFontSize());
|
||||||
|
var invoiceDateX = headerRight - (doc.getStringUnitWidth(invoiceDate) * doc.internal.getFontSize());
|
||||||
|
var dueDateX = headerRight - (doc.getStringUnitWidth(dueDate) * doc.internal.getFontSize());
|
||||||
|
var poNumberX = headerRight - (doc.getStringUnitWidth(invoice.po_number) * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var y = accountTop;
|
||||||
|
var left = marginLeft;
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontSize(7);
|
||||||
|
SetPdfColor('White',doc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//TODO:NOT AVAILEABLE FROM DATAMODEL
|
||||||
|
//account.email='email N/A';
|
||||||
|
if (account.email) {
|
||||||
|
y += rowHeight;
|
||||||
|
doc.text(left, y, account.email);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//console.log('account.email NOT DEFINED !');
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO:NOT AVAILEABLE FROM DATAMODEL
|
||||||
|
if (account.phone) {
|
||||||
|
y += rowHeight;
|
||||||
|
doc.text(left, y, account.phone);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//console.log('account.phone NOT DEFINED !');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var HeaderMarginThirdColumn=70;
|
||||||
|
|
||||||
|
//second column
|
||||||
|
doc.setFontType("bold");
|
||||||
|
var MaxWidth=594;
|
||||||
|
|
||||||
|
var LineOne= account.name;
|
||||||
|
|
||||||
|
var AlignLine = MaxWidth-30- (doc.getStringUnitWidth(LineOne) * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
if (account.name) {
|
||||||
|
|
||||||
|
y += rowHeight;
|
||||||
|
doc.text(AlignLine, y, LineOne);
|
||||||
|
}
|
||||||
|
|
||||||
|
y += rowHeight;
|
||||||
|
|
||||||
|
doc.setFontType("normal");
|
||||||
|
|
||||||
|
|
||||||
|
var LineTwo= account.address1+' '+account.address2+account.city+' '+account.country.name;
|
||||||
|
|
||||||
|
var AlignLine = MaxWidth-30- (doc.getStringUnitWidth(LineTwo) * doc.internal.getFontSize());
|
||||||
|
y += rowHeight;
|
||||||
|
doc.text(AlignLine, y, LineTwo);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------Publish Client Details block--------------------------------------------
|
||||||
|
|
||||||
|
var y = accountTop;
|
||||||
|
var left = marginLeft;
|
||||||
|
|
||||||
|
var headerY = headerTop;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('GrayLogo',doc); //set black color
|
||||||
|
|
||||||
|
|
||||||
|
var line1=headerTop+16;
|
||||||
|
var line2=headerTop+16*2;
|
||||||
|
var line21=headerTop+16*1.6;
|
||||||
|
var line22=headerTop+16*2.2;
|
||||||
|
|
||||||
|
var line3=headerTop+16*3;
|
||||||
|
var line31=headerTop+16*3.6;
|
||||||
|
|
||||||
|
var marginLeft1=50;
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('Black',doc); //set black color
|
||||||
|
|
||||||
|
doc.setFontSize(7);
|
||||||
|
|
||||||
|
|
||||||
|
ClientCompanyName=client.name;
|
||||||
|
ClientCompanyEmail='';//client.email;//'22222222';
|
||||||
|
ClientCompanyPhone=client.work_phone;
|
||||||
|
|
||||||
|
ClientCompanyAddress1=client.address1;
|
||||||
|
ClientCompanyAddress2=client.address2+' '+client.postal_code;
|
||||||
|
|
||||||
|
if(client)
|
||||||
|
{
|
||||||
|
ClientCompanyName=getClientDisplayName(client);
|
||||||
|
ClientCompanyPhone=client.work_phone;
|
||||||
|
ClientCompanyEmail=client.contacts[0].email;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//show left column
|
||||||
|
SetPdfColor('Black',doc); //set black color
|
||||||
|
doc.setFontType("normal");
|
||||||
|
|
||||||
|
|
||||||
|
//publish filled box
|
||||||
|
doc.setDrawColor(200,200,200);
|
||||||
|
doc.setFillColor(54,164,152);
|
||||||
|
|
||||||
|
GlobalY=190;
|
||||||
|
doc.setLineWidth(0.5);
|
||||||
|
|
||||||
|
var BlockLenght=220;
|
||||||
|
var x1 =595-BlockLenght;
|
||||||
|
var y1 = GlobalY-12;
|
||||||
|
var w2 = BlockLenght;
|
||||||
|
var h2 = 90;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('SomeGreen',doc);
|
||||||
|
doc.setFontSize('14');
|
||||||
|
doc.setFontType("bold");
|
||||||
|
doc.text(50, GlobalY, 'YOUR INVOICE');
|
||||||
|
|
||||||
|
|
||||||
|
var z=GlobalY;
|
||||||
|
z=z+30;
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('Black',doc);
|
||||||
|
|
||||||
|
if (ClientCompanyName)
|
||||||
|
{
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("bold");
|
||||||
|
doc.text(marginLeft1, z, ClientCompanyName);
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClientCompanyAddress1)
|
||||||
|
{
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft1, z, ClientCompanyAddress1);
|
||||||
|
z=z+15;////z=z+doc.internal.getFontSize();
|
||||||
|
}
|
||||||
|
if (ClientCompanyAddress2)
|
||||||
|
{
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft1, z, ClientCompanyAddress2);
|
||||||
|
z=z+15;////z=z+doc.internal.getFontSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClientCompanyEmail)
|
||||||
|
{
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft1, z, ClientCompanyEmail);
|
||||||
|
z=z+15;///z=z+doc.internal.getFontSize();
|
||||||
|
}
|
||||||
|
if (ClientCompanyPhone)
|
||||||
|
{
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft1, z, ClientCompanyPhone);
|
||||||
|
z=z+15;////z=z+doc.internal.getFontSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
marginLeft2=395;
|
||||||
|
|
||||||
|
//publish left side information
|
||||||
|
|
||||||
|
SetPdfColor('White',doc);
|
||||||
|
z=GlobalY+15;
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft2, z,'Invoice Number');
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft2, z,'Invoice date');
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft2, z,'Due Date');
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
|
||||||
|
marginLeft3=marginLeft2+65;
|
||||||
|
|
||||||
|
z=GlobalY+15;
|
||||||
|
|
||||||
|
|
||||||
|
var invoiceNumber = invoice.invoice_number;
|
||||||
|
var invoiceDate = invoice.invoice_date ? invoice.invoice_date : '';
|
||||||
|
var dueDate = invoice.due_date ? invoice.due_date : '';
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontSize('7');
|
||||||
|
doc.setFontType("bold");
|
||||||
|
doc.text(marginLeft3, z,invoiceNumber);
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft3, z,invoiceDate);
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
doc.setFontSize('8');
|
||||||
|
doc.setFontType("normal");
|
||||||
|
doc.text(marginLeft3, z,dueDate);
|
||||||
|
z=z+15;//doc.internal.getFontSize();
|
||||||
|
|
||||||
|
y=z+60;
|
||||||
|
//--------------------------------Publishing Table--------------------------------------------------
|
||||||
|
GlobalY=y+30;
|
||||||
|
GlobalY=GlobalY+70;//y+30;
|
||||||
|
SetPdfColor('Black',doc);
|
||||||
|
doc.setFontSize(7);
|
||||||
|
var hasTaxes = false;
|
||||||
|
for (var i=0; i<invoice.invoice_items.length; i++)
|
||||||
|
{
|
||||||
|
var item = invoice.invoice_items[i];
|
||||||
|
if ((item.tax && item.tax.rate > 0) || (item.tax_rate && parseFloat(item.tax_rate) > 0)) {
|
||||||
|
hasTaxes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasTaxes)
|
||||||
|
{
|
||||||
|
descriptionLeft -= 20;
|
||||||
|
unitCostRight -= 40;
|
||||||
|
qtyRight -= 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
var costX = unitCostRight - (doc.getStringUnitWidth('Unit Cost') * doc.internal.getFontSize());
|
||||||
|
var qtyX = qtyRight - (doc.getStringUnitWidth('Quantity') * doc.internal.getFontSize());
|
||||||
|
var taxX = taxRight - (doc.getStringUnitWidth('Tax') * doc.internal.getFontSize());
|
||||||
|
var totalX = lineTotalRight - (doc.getStringUnitWidth('Line Total') * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
tableTop=GlobalY;//redefine this to dynamic value
|
||||||
|
|
||||||
|
doc.setFontSize(12);
|
||||||
|
doc.setFontType("bold");
|
||||||
|
|
||||||
|
doc.text(tableLeft, tableTop, 'Item');
|
||||||
|
doc.text(descriptionLeft, tableTop, 'Description');
|
||||||
|
doc.text(costX, tableTop, 'Unit Cost');
|
||||||
|
doc.text(qtyX, tableTop, 'Quantity');
|
||||||
|
doc.text(totalX, tableTop, 'Line Total');
|
||||||
|
|
||||||
|
if (hasTaxes)
|
||||||
|
{
|
||||||
|
doc.text(taxX, tableTop, 'Tax');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontSize(7);
|
||||||
|
|
||||||
|
/* line items */
|
||||||
|
|
||||||
|
var line = 1;
|
||||||
|
var total = 0;
|
||||||
|
var shownItem = false;
|
||||||
|
|
||||||
|
|
||||||
|
GlobalY=GlobalY+24; //padding from top
|
||||||
|
|
||||||
|
var FontSize=7;
|
||||||
|
doc.setFontSize(FontSize);
|
||||||
|
doc.setFontType("normal");
|
||||||
|
|
||||||
|
var MaxLinesPerPage=40;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||||
|
|
||||||
|
var item = invoice.invoice_items[i];
|
||||||
|
|
||||||
|
|
||||||
|
var cost = formatMoney(item.cost, currencyId, true);
|
||||||
|
var qty = NINJA.parseFloat(item.qty) ? NINJA.parseFloat(item.qty) + '' : '';
|
||||||
|
var notes = item.notes;
|
||||||
|
var productKey = item.product_key;
|
||||||
|
var tax = 0;
|
||||||
|
if (item.tax && parseFloat(item.tax.rate)) {
|
||||||
|
tax = parseFloat(item.tax.rate);
|
||||||
|
} else if (item.tax_rate && parseFloat(item.tax_rate)) {
|
||||||
|
tax = parseFloat(item.tax_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show at most one blank line
|
||||||
|
if (shownItem && (!cost || cost == '0.00') && !qty && !notes && !productKey) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
shownItem = true;
|
||||||
|
|
||||||
|
// process date variables
|
||||||
|
notes = processVariables(notes);
|
||||||
|
productKey = processVariables(productKey);
|
||||||
|
|
||||||
|
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
||||||
|
if (tax) {
|
||||||
|
lineTotal += lineTotal * tax / 100;
|
||||||
|
}
|
||||||
|
if (lineTotal) {
|
||||||
|
total += lineTotal;
|
||||||
|
}
|
||||||
|
lineTotal = formatMoney(lineTotal, currencyId, true);
|
||||||
|
|
||||||
|
var costX = unitCostRight - (doc.getStringUnitWidth(cost) * doc.internal.getFontSize());
|
||||||
|
var qtyX = qtyRight - (doc.getStringUnitWidth(qty) * doc.internal.getFontSize());
|
||||||
|
var taxX = taxRight - (doc.getStringUnitWidth(tax+'%') * doc.internal.getFontSize());
|
||||||
|
var totalX = lineTotalRight - (doc.getStringUnitWidth(lineTotal) * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
|
||||||
|
length=doc.splitTextToSize(item.notes, 200).length;
|
||||||
|
var h=length*FontSize;
|
||||||
|
MaxGlobalY=750;
|
||||||
|
if (h+GlobalY > MaxGlobalY) {
|
||||||
|
|
||||||
|
tableTop = 40;
|
||||||
|
GlobalY=tableTop;
|
||||||
|
|
||||||
|
doc.addPage();
|
||||||
|
Report2AddFooter(invoice,doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((i%2)===0){
|
||||||
|
doc.setLineWidth(0.5);
|
||||||
|
doc.setDrawColor(240,240,240);
|
||||||
|
doc.setFillColor(240,240,240);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var x1 = tableLeft-tablePadding ;
|
||||||
|
var y1 = GlobalY-FontSize;
|
||||||
|
var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5;
|
||||||
|
var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
doc.setLineWidth(0.5);
|
||||||
|
doc.setDrawColor(251,251,251);
|
||||||
|
doc.setFillColor(251,251,251);
|
||||||
|
|
||||||
|
|
||||||
|
var x1 = tableLeft-tablePadding ;
|
||||||
|
var y1 = GlobalY-FontSize;
|
||||||
|
var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5;
|
||||||
|
var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
}
|
||||||
|
|
||||||
|
x=GlobalY;
|
||||||
|
|
||||||
|
GlobalY=GlobalY+h+tablePadding*2;
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('SomeGreen',doc);
|
||||||
|
doc.text(tableLeft, x, productKey);
|
||||||
|
|
||||||
|
SetPdfColor('Black',doc);
|
||||||
|
doc.text(descriptionLeft, x, notes);
|
||||||
|
|
||||||
|
doc.text(costX, x, cost);
|
||||||
|
doc.text(qtyX, x, qty);
|
||||||
|
doc.text(totalX, x, lineTotal);
|
||||||
|
|
||||||
|
if (tax) {
|
||||||
|
doc.text(taxX, x, tax+'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
line=line+length;
|
||||||
|
}
|
||||||
|
//-------------------------------Publishing Document balance------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
x += 16+50;
|
||||||
|
|
||||||
|
doc.setFontType("bold");
|
||||||
|
MsgRightAlign=400;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GlobalY=x;
|
||||||
|
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
|
||||||
|
doc.setDrawColor(251,251,251);
|
||||||
|
doc.setFillColor(251,251,251);
|
||||||
|
var x1 = tableLeft-tablePadding*2 ;
|
||||||
|
var y1 = GlobalY-FontSize-tablePadding;
|
||||||
|
var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5;
|
||||||
|
var h2 = doc.internal.getFontSize()*3+tablePadding*2;
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
|
||||||
|
|
||||||
|
Msg='Total';
|
||||||
|
var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
|
||||||
|
doc.text(TmpMsgX, x, Msg);
|
||||||
|
|
||||||
|
doc.setFontType("normal");
|
||||||
|
AmountText = formatMoney(total , currencyId);
|
||||||
|
headerLeft=headerRight+400;
|
||||||
|
var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize());
|
||||||
|
doc.text(AmountX, x, AmountText);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
x += doc.internal.getFontSize()*2;
|
||||||
|
|
||||||
|
Msg='Amount Payed';
|
||||||
|
var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
|
||||||
|
doc.text(TmpMsgX, x, Msg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AmountText = formatMoney(paid_to_date , currencyId);
|
||||||
|
headerLeft=headerRight+400;
|
||||||
|
var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize());
|
||||||
|
doc.text(AmountX, x, AmountText);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
doc.setFontType("bold");
|
||||||
|
|
||||||
|
doc.setFontSize(12);
|
||||||
|
x += doc.internal.getFontSize()*4;
|
||||||
|
Msg='Amount Due';
|
||||||
|
var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
doc.text(TmpMsgX, x, Msg);
|
||||||
|
|
||||||
|
|
||||||
|
SetPdfColor('LightBlue',doc);
|
||||||
|
AmountText = formatMoney(balance , currencyId);
|
||||||
|
headerLeft=headerRight+400;
|
||||||
|
var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize());
|
||||||
|
doc.text(AmountX, x, AmountText);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function SetPdfColor(color,doc)
|
function SetPdfColor(color,doc)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1168,16 +1744,47 @@ function SetPdfColor(color,doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (color=='Black') {
|
if (color=='Black') {
|
||||||
return doc.setTextColor(0,0,0);//select color black
|
return doc.setTextColor(46,43,43);//select color black
|
||||||
}
|
}
|
||||||
if (color=='GrayLogo') {
|
if (color=='GrayLogo') {
|
||||||
return doc.setTextColor(207,209, 210);//select color Custom Report GRAY
|
//return doc.setTextColor(207,209, 210);//select color Custom Report GRAY
|
||||||
|
return doc.setTextColor(207,241, 241);//select color Custom Report GRAY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (color=='GrayBackground') {
|
||||||
|
//return doc.setTextColor(207,209, 210);//select color Custom Report GRAY
|
||||||
|
return doc.setTextColor(251,251, 251);//select color Custom Report GRAY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (color=='GrayText') {
|
if (color=='GrayText') {
|
||||||
return doc.setTextColor(161,160,160);//select color Custom Report GRAY Colour
|
return doc.setTextColor(161,160,160);//select color Custom Report GRAY Colour
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (color=='White') {
|
||||||
|
return doc.setTextColor(255,255,255);//select color Custom Report GRAY Colour
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (color=='SomeGreen') {
|
||||||
|
return doc.setTextColor(54,164,152);//select color Custom Report GRAY Colour
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (color=='LightGrayReport2-gray') {
|
||||||
|
return doc.setTextColor(240,240,240);//select color Custom Report GRAY Colour
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color=='LightGrayReport2-white') {
|
||||||
|
return doc.setTextColor(251,251,251);//select color Custom Report GRAY Colour
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alert('color is not defined');
|
alert('color is not defined');
|
||||||
return false;
|
return false;
|
||||||
@ -1188,10 +1795,49 @@ function SetPdfColor(color,doc)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function Report1AddFooter (doc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function Report2AddFooter (invoice,doc)
|
||||||
|
{
|
||||||
|
|
||||||
|
doc.setLineWidth(0.5);
|
||||||
|
doc.setDrawColor(41,37,37);
|
||||||
|
doc.setFillColor(41,37,37);
|
||||||
|
|
||||||
|
|
||||||
|
// return doc.setTextColor(240,240,240);//select color Custom Report GRAY Colour
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var x1 = 0;//tableLeft-tablePadding ;
|
||||||
|
|
||||||
|
var y1 = 750;
|
||||||
|
|
||||||
|
var w2 = 596;
|
||||||
|
var h2 = 94;//doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
doc.rect(x1, y1, w2, h2, 'FD');
|
||||||
|
|
||||||
|
|
||||||
|
if (invoice.imageLogo2)
|
||||||
|
{
|
||||||
|
pageHeight=820;
|
||||||
|
var left = 250;//headerRight ;
|
||||||
|
y=pageHeight-invoice.imageLogoHeight2;
|
||||||
|
var headerRight=350;
|
||||||
|
|
||||||
|
var left = headerRight - invoice.imageLogoWidth2;
|
||||||
|
doc.addImage(invoice.imageLogo2, 'JPEG', left, y, invoice.imageLogoWidth2, invoice.imageLogoHeight2);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user