From c17b8ed40f555d095af8ad8b9216c31053a01b54 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 9 Mar 2014 03:23:05 +0200 Subject: [PATCH 1/5] fix --- public/js/script.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 560f79fdbc..f05fc89047 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1082,33 +1082,54 @@ function GetReportTemplate1 (invoice,checkMath) var left = marginLeft; - doc.setFontSize(7); + + + doc.setFontSize(9); + + var MaxLen=0; + + SetPdfColor('LightBlue',doc); if (account.name) { y += rowHeight; doc.text(left, y, account.name); + + + + + test=(doc.getStringUnitWidth(account.name) * doc.internal.getFontSize()); + if (MaxLen Date: Sun, 9 Mar 2014 03:26:26 +0200 Subject: [PATCH 2/5] fix --- public/js/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index f05fc89047..aba3b41c81 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1192,7 +1192,7 @@ function GetReportTemplate1 (invoice,checkMath) GlobalY=line1; SetPdfColor('Black',doc); //set black color - doc.setFontSize(7); + doc.setFontSize(9); @@ -1329,7 +1329,7 @@ y2=GlobalY; SetPdfColor('Black',doc); - doc.setFontSize(7); + doc.setFontSize(9); var hasTaxes = false; for (var i=0; i Date: Sun, 9 Mar 2014 03:43:50 +0200 Subject: [PATCH 3/5] fix --- public/js/script.js | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index aba3b41c81..343957ecad 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -956,8 +956,8 @@ function GetReportTemplate1 (invoice,checkMath) var headerRight = 150; var accountTop = 30; var marginLeft = 180; - var rowHeight = 10; - var headerTop = 125; //height of HEADER //should be dynamic ! + var rowHeight = 16; + var headerTop = 120; //height of HEADER //should be dynamic ! var descriptionLeft = 162; @@ -1041,7 +1041,7 @@ function GetReportTemplate1 (invoice,checkMath) //set default style for report doc.setFont('Helvetica',''); - doc.setFontSize(7); + doc.setFontSize(9); //---------------------------------------------------------------------------------------------------- @@ -1129,7 +1129,7 @@ function GetReportTemplate1 (invoice,checkMath) - var HeaderMarginThirdColumn=MaxLen+30;//should be dynamic and dependent on 1st image and 2nd column width + var HeaderMarginThirdColumn=MaxLen+30; var y = accountTop; var left = marginLeft+HeaderMarginThirdColumn; @@ -1164,7 +1164,7 @@ function GetReportTemplate1 (invoice,checkMath) doc.text(50, headerTop, 'INVOICE'); - y=130; + y=128; doc.setDrawColor(220,220,220); @@ -1172,7 +1172,7 @@ function GetReportTemplate1 (invoice,checkMath) - var line1=headerTop+16; + var line1=headerTop+16*1.4; var line2=headerTop+16*2; var line21=headerTop+16*1.6; var line22=headerTop+16*2.2; @@ -1180,9 +1180,9 @@ function GetReportTemplate1 (invoice,checkMath) var line3=headerTop+16*3; var line31=headerTop+16*3.6; - var marginLeft1=50; - var marginLeft2=120; - var marginLeft3=180; + var marginLeft1=60; + var marginLeft2=140; + var marginLeft3=200; @@ -1274,10 +1274,15 @@ function GetReportTemplate1 (invoice,checkMath) SetPdfColor('Black',doc); //set black color doc.setFontType("bold"); + + if(ClientCompanyName) + { + doc.text(marginLeft3, GlobalY, ClientCompanyName); doc.setFontType("normal"); - GlobalY=GlobalY+16; + GlobalY=GlobalY+15; + } if(client) { @@ -1288,18 +1293,28 @@ function GetReportTemplate1 (invoice,checkMath) } + if (ClientCompanyAddress1!='') { doc.text(marginLeft3, GlobalY, ClientCompanyAddress1); - GlobalY=GlobalY+8; + GlobalY=GlobalY+15; + } + if (ClientCompanyAddress2!='') { doc.text(marginLeft3, GlobalY, ClientCompanyAddress2); - GlobalY=GlobalY+16; + GlobalY=GlobalY+15; + } + + if ( ClientCompanyEmail!='') { doc.text(marginLeft3, GlobalY, ClientCompanyEmail); - GlobalY=GlobalY+8; + GlobalY=GlobalY+15; + + } + + if (ClientCompanyPhone) { doc.text(marginLeft3, GlobalY, ClientCompanyPhone); - GlobalY=GlobalY+16; - + GlobalY=GlobalY+15; + } From 1f7f331a804702648f3ecf1f033e02daabf60712 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 9 Mar 2014 03:45:17 +0200 Subject: [PATCH 4/5] fix --- public/js/script.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 343957ecad..2852e19839 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1280,7 +1280,7 @@ function GetReportTemplate1 (invoice,checkMath) doc.text(marginLeft3, GlobalY, ClientCompanyName); doc.setFontType("normal"); - GlobalY=GlobalY+15; + GlobalY=GlobalY+16; } @@ -1295,25 +1295,25 @@ function GetReportTemplate1 (invoice,checkMath) if (ClientCompanyAddress1!='') { doc.text(marginLeft3, GlobalY, ClientCompanyAddress1); - GlobalY=GlobalY+15; + GlobalY=GlobalY+16; } if (ClientCompanyAddress2!='') { doc.text(marginLeft3, GlobalY, ClientCompanyAddress2); - GlobalY=GlobalY+15; + GlobalY=GlobalY+16; } if ( ClientCompanyEmail!='') { doc.text(marginLeft3, GlobalY, ClientCompanyEmail); - GlobalY=GlobalY+15; + GlobalY=GlobalY+16; } if (ClientCompanyPhone) { doc.text(marginLeft3, GlobalY, ClientCompanyPhone); - GlobalY=GlobalY+15; + GlobalY=GlobalY+16; } From 04e7b05d03984def4911869b594ad24b69823563 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 9 Mar 2014 04:06:00 +0200 Subject: [PATCH 5/5] fix terms and notes --- public/js/script.js | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 2852e19839..47c4e16f10 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1637,15 +1637,39 @@ y2=GlobalY; + //put terms and notes on free little block + lengthTerms=doc.splitTextToSize( terms, 200).length; + lengthNotes=doc.splitTextToSize( public_notes, 200).length; - - if (terms ) + if (lengthTerms<4) { + SetPdfColor('Black',doc); + doc.text(40, GlobalY, terms); + GlobalY=GlobalY+h; + + + } + + if (lengthNotes<4) + { GlobalY=GlobalY+48; + + SetPdfColor('Black',doc); + doc.text(40, GlobalY, public_notes); + GlobalY=GlobalY+h; + + } + GlobalY=GlobalY+100; + if (lengthTerms>3) + if (terms ) + { + + //GlobalY=GlobalY+100; + length=doc.splitTextToSize( terms, 200).length; - FontSize=10; + FontSize=9; var h=length*FontSize; //check do we need to go to next page @@ -1658,20 +1682,24 @@ y2=GlobalY; SetPdfColor('Black',doc); doc.text(40, GlobalY, terms); GlobalY=GlobalY+h; - + GlobalY=GlobalY+20; } + + + if (lengthNotes>3) if (public_notes ) { - //GlobalY=GlobalY+100; + length=doc.splitTextToSize( public_notes, 200).length; - FontSize=10; + FontSize=9; var h=length*FontSize; //check do we need to go to next page MinHeight=700; if (GlobalY+h > MinHeight) { GlobalY=Report1AddNewPage(invoice,account,doc); + GlobalY=GlobalY+20; } SetPdfColor('Black',doc);