From 7fc457883c19bfbcce283d3717ed8a943ade3825 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Thu, 27 Feb 2014 08:57:59 +0200 Subject: [PATCH 01/30] report 3-3 --- app/views/invoices/edit.blade.php | 4 + public/images/report_logo3.jpg | Bin 0 -> 31804 bytes public/js/script.js | 673 +++++++++++++++++++++++++++++- 3 files changed, 671 insertions(+), 6 deletions(-) create mode 100644 public/images/report_logo3.jpg diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index b28396570d5c..471d01543e7a 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -571,6 +571,10 @@ invoice.imageLogoWidth2 =325/2; invoice.imageLogoHeight2 = 81/2; + invoice.imageLogo3 = "{{ HTML::image_data('images/report_logo3.jpg') }}"; + invoice.imageLogoWidth3 =325/2; + invoice.imageLogoHeight3 = 81/2; + return invoice; } diff --git a/public/images/report_logo3.jpg b/public/images/report_logo3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8696d0535fa2c89da2c8877239466683a47f9edc GIT binary patch literal 31804 zcmbrlWmFx((k{Glf&_PWcbAR326uN4wy~hW-8Dc6Zo%2OySr^9c<|s3ALl*mzU!{< z@2&YUJzY~Z-D|q5tNN*aUwQunKv$5FmjOUQK>_4GF2MU6087%%%FM&clHAMA!TKx06`U_iYO07w8(0BD&1@B#ma z;1OWq5I=oX{)hch4+HoQ|Nn3SaPSB)u!zu5pWfF1C@>$==rHI2095jW*OQ*xy8Baf zv0vZzX^?1O7hC^ss$%g^a}KV#M_c?*rGNjc0{|7UdG*AZRBQ+)zCXM^?yc3bLsCgF zTVYIQ!2c1i!osE?qsN3WB0zh)NElC7bR;)OSxWvdU9QS-<$skxFE`HK`>$L?oM#kM zS?M0V0|L9VyTI;rDbadNaPXn^BbJn{8Z3}D6S?6=e+DMTQPth5?}7g-|K9?U@v@9N zpFx#_4*CC&^M5^});JV`Hn^&X-GrgSdRL3f+lZY74OI@A_`d-o|EFWH*$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y%9+SXI0;ScpS!AmH-6qqGoVIAhWSI30v89NE@O zehV^ayEv2M(fOlKgJ}U@(>?qb-jOb-Uuct%AV}WYAovb5j7ALW9thalb?@llupwvD za-_@KC#sEz`{TvH`wEg*DjEmKK9r7k*>iIUg4eSPJJ}4IGw)EgZ{BtsAQ=yrB0B4t zemWZ5DP>_Js_Xo<8pp06W~vhAd08k?Rfz$}DpQXV6nxaLuvLJ|$FiZS6C%TdQ{W%3Jvcz#V9Bhok%eO@R}2IMhT~oZX-oNOdDwifItpB{ z&pB#;rkl$!KtDXky6<6-?i(!On}`4V>(dG?3Ph{yh$>W6sHnHC3b8MZWFmYc5(s(& zK4Qge@B9ppev0LXHS;(slVL|n99ez+DdG0`m6^k@3;>$IctoUBYsCCuE@ zJYlFZeehynVj^cQIY`8D6RPeTMw*~}z8Lx+Cy_!84UNfkFw%=qs5(4vX%?3XF4i~B zPZ>zrtwLIi$Rar_Su#bj6rP87rAmx&240E^Szl$}y2%O+PO#_%==OEs3UBn@f#y;~ zm3R;^xCu4$w^`ZXQv 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); + + doc.setDrawColor(242,101,34); + doc.setFillColor(242,101,34); + + + 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); + } + + Report3AddFooter (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 ? 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 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 MaxGlobalY) { + + tableTop = 40; + GlobalY=tableTop; + + doc.addPage(); + Report3AddFooter(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) { @@ -1829,7 +2448,7 @@ function Report2AddFooter (invoice,doc) pageHeight=820; var left = 250;//headerRight ; y=pageHeight-invoice.imageLogoHeight2; - var headerRight=350; + var headerRight=370; var left = headerRight - invoice.imageLogoWidth2; doc.addImage(invoice.imageLogo2, 'JPEG', left, y, invoice.imageLogoWidth2, invoice.imageLogoHeight2); @@ -1841,3 +2460,45 @@ function Report2AddFooter (invoice,doc) } +function Report3AddFooter (invoice,doc) +{ + + doc.setLineWidth(0.5); +// doc.setDrawColor(41,37,37); +// doc.setFillColor(41,37,37); + doc.setDrawColor(242,101,34); + doc.setFillColor(242,101,34); + + // 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.imageLogo3) + { + pageHeight=820; + var left = 250;//headerRight ; + y=pageHeight-invoice.imageLogoHeight3; + var headerRight=370; + + var left = headerRight - invoice.imageLogoWidth3; + doc.addImage(invoice.imageLogo3, 'JPEG', left, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); + + + } + + + +} From 63af55922150726357b7c44d7287272c541e6a07 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Thu, 27 Feb 2014 09:06:19 +0200 Subject: [PATCH 02/30] report 3-3 --- public/js/script.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 2c8daba67bca..0624024e4c70 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2215,7 +2215,7 @@ function GetReportTemplate3 (invoice,checkMath) length=doc.splitTextToSize(item.notes, 200).length; var h=length*FontSize; - MaxGlobalY=750; + MaxGlobalY=730; if (h+GlobalY > MaxGlobalY) { tableTop = 40; @@ -2412,12 +2412,6 @@ function SetPdfColor(color,doc) - - -function Report1AddFooter (doc) -{ -} - function Report2AddFooter (invoice,doc) { @@ -2464,8 +2458,6 @@ function Report3AddFooter (invoice,doc) { doc.setLineWidth(0.5); -// doc.setDrawColor(41,37,37); -// doc.setFillColor(41,37,37); doc.setDrawColor(242,101,34); doc.setFillColor(242,101,34); From fe9249beb7f495f7662e929cfeebdf16fdfc5f33 Mon Sep 17 00:00:00 2001 From: Razi KAntorp Date: Thu, 27 Feb 2014 12:42:23 +0100 Subject: [PATCH 03/30] Dasboard table headers, golobal button change. --- app/views/accounts/details.blade.php | 2 +- app/views/accounts/notifications.blade.php | 2 +- app/views/accounts/payments.blade.php | 2 +- app/views/clients/edit.blade.php | 4 +--- app/views/credits/edit.blade.php | 7 +++---- app/views/dashboard.blade.php | 4 ++-- app/views/payments/edit.blade.php | 6 +++--- public/css/style.css | 2 ++ 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index a82dedcdf656..bf3ac60d4b02 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -75,7 +75,7 @@
- {{ Button::lg_primary_submit('Save')->append_with_icon('floppy-disk') }} + {{ Button::lg_success_submit('Save')->append_with_icon('floppy-disk') }}
{{ Former::close() }} diff --git a/app/views/accounts/notifications.blade.php b/app/views/accounts/notifications.blade.php index 1759187d446c..4a0e8a41be79 100755 --- a/app/views/accounts/notifications.blade.php +++ b/app/views/accounts/notifications.blade.php @@ -18,7 +18,7 @@ {{ Former::textarea('invoice_terms')->label('Set default invoice terms') }} {{ Former::textarea('email_footer')->label('Set default email signature') }} - {{ Former::actions( Button::lg_primary_submit('Save')->append_with_icon('floppy-disk') ) }} + {{ Former::actions( Button::lg_success_submit('Save')->append_with_icon('floppy-disk') ) }} {{ Former::close() }} @stop \ No newline at end of file diff --git a/app/views/accounts/payments.blade.php b/app/views/accounts/payments.blade.php index 9075f9034579..ce8a149d8507 100755 --- a/app/views/accounts/payments.blade.php +++ b/app/views/accounts/payments.blade.php @@ -45,7 +45,7 @@ @endforeach - {{ Former::actions( Button::lg_primary_submit('Save')->append_with_icon('floppy-disk') ) }} + {{ Former::actions( Button::lg_success_submit('Save')->append_with_icon('floppy-disk') ) }} {{ Former::close() }} diff --git a/app/views/clients/edit.blade.php b/app/views/clients/edit.blade.php index e59b79d8b44a..84fab15a0758 100755 --- a/app/views/clients/edit.blade.php +++ b/app/views/clients/edit.blade.php @@ -148,10 +148,8 @@ - -
- {{ Button::lg_primary_submit('Save')->append_with_icon('floppy-disk') }} + {{ Button::lg_primary_submit_success('Save')->append_with_icon('floppy-disk') }} {{ Button::lg_default_link('clients/' . ($client ? $client->public_id : ''), 'Cancel')->append_with_icon('remove-circle'); }}
diff --git a/app/views/credits/edit.blade.php b/app/views/credits/edit.blade.php index b55a2038b191..047f792dfd68 100755 --- a/app/views/credits/edit.blade.php +++ b/app/views/credits/edit.blade.php @@ -28,10 +28,9 @@ - -
- {{ Button::lg_primary_submit('Save') }}  |  - {{ link_to('credits/' . ($credit ? $credit->public_id : ''), 'Cancel') }} +
+ {{ Button::lg_primary_submit_success('Save')->append_with_icon('floppy-disk') }} + {{ Button::lg_default_link('credits/' . ($credit ? $credit->public_id : ''), 'Cancel')->append_with_icon('remove-circle'); }}
{{ Former::close() }} diff --git a/app/views/dashboard.blade.php b/app/views/dashboard.blade.php index b23c040375fc..eaa27672e9a1 100644 --- a/app/views/dashboard.blade.php +++ b/app/views/dashboard.blade.php @@ -98,8 +98,8 @@
-
-
+
+

Upcoming invoices

diff --git a/app/views/payments/edit.blade.php b/app/views/payments/edit.blade.php index e8f446fed65e..580e48ff3000 100755 --- a/app/views/payments/edit.blade.php +++ b/app/views/payments/edit.blade.php @@ -32,9 +32,9 @@
-
- {{ Button::lg_primary_submit_success('Save') }}  |  - {{ link_to('payments/' . ($payment ? $payment->public_id : ''), 'Cancel') }} +
+ {{ Button::lg_primary_submit_success('Save')->append_with_icon('floppy-disk') }} + {{ Button::lg_default_link('payments/' . ($payment ? $payment->public_id : ''), 'Cancel')->append_with_icon('remove-circle'); }}
{{ Former::close() }} diff --git a/public/css/style.css b/public/css/style.css index fc5937eb2a90..7a20ed55d472 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -448,6 +448,8 @@ background-clip: padding-box; } .panel-body {padding: 25px;} +.dashboard .panel-heading { margin: -1px; } + .dashboard .panel-body {padding: 0;} .dashboard .table-striped>tbody>tr>td, .table-striped>tbody>tr>th { background-color: #fbfbfb;} From 0209454e91922593d05d92c22249738445b49bd6 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 27 Feb 2014 16:10:16 +0200 Subject: [PATCH 04/30] changed report names --- public/js/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 0624024e4c70..f18e1df1be7b 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -535,9 +535,9 @@ $.fn.datepicker.defaults.todayHighlight = true; function GetPdf(invoice,checkMath,report_id){ - if (report_id==2) return GetReportTemplate1(invoice,checkMath); - if (report_id==3) return GetReportTemplate2(invoice,checkMath); - if (report_id==1) return GetReportTemplate3(invoice,checkMath); + if (report_id==1) return GetReportTemplate1(invoice,checkMath); + if (report_id==2) return GetReportTemplate2(invoice,checkMath); + if (report_id==3) return GetReportTemplate3(invoice,checkMath); alert('report template not implemented yet'); From e6cbb8ba3fd74090d4153e9a7223f804c3b0409f Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 02:35:01 +0200 Subject: [PATCH 05/30] report 3-3 --- public/js/script.js | 357 +++++++++++++++++++++++++------------------- 1 file changed, 200 insertions(+), 157 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index f18e1df1be7b..78382f97177b 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1,4 +1,4 @@ -// http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser +GetReportTemplate3// http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+ var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; @@ -535,9 +535,9 @@ $.fn.datepicker.defaults.todayHighlight = true; function GetPdf(invoice,checkMath,report_id){ - if (report_id==1) return GetReportTemplate1(invoice,checkMath); + if (report_id==1) return GetReportTemplate3(invoice,checkMath); if (report_id==2) return GetReportTemplate2(invoice,checkMath); - if (report_id==3) return GetReportTemplate3(invoice,checkMath); + if (report_id==3) return GetReportTemplate1(invoice,checkMath); alert('report template not implemented yet'); @@ -1737,6 +1737,154 @@ function GetReportTemplate2 (invoice,checkMath) + + + +function SetPdfColor(color,doc) +{ + + if (color=='LightBlue') { + return doc.setTextColor(41,156, 194); + } + + if (color=='Black') { + return doc.setTextColor(46,43,43);//select color black + } + if (color=='GrayLogo') { + //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') { + 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'); + return false; + +} + + + +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=370; + + var left = headerRight - invoice.imageLogoWidth2; + doc.addImage(invoice.imageLogo2, 'JPEG', left, y, invoice.imageLogoWidth2, invoice.imageLogoHeight2); + + + } + + + +} + +function Report3AddFooter (invoice,doc) +{ + + doc.setLineWidth(0.5); + doc.setDrawColor(242,101,34); + doc.setFillColor(242,101,34); + + // 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.imageLogo3) + { + pageHeight=820; + var left = 250;//headerRight ; + y=pageHeight-invoice.imageLogoHeight3; + var headerRight=370; + + var left = headerRight - invoice.imageLogoWidth3; + doc.addImage(invoice.imageLogo3, 'JPEG', left, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); + + + } + + + +} + + + + + + function GetReportTemplate3 (invoice,checkMath) { var doc=false; @@ -1858,7 +2006,7 @@ function GetReportTemplate3 (invoice,checkMath) var y1 = 0; var w2 = 595; - var h2 = 100;// doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = 140;// doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; doc.rect(x1, y1, w2, h2, 'FD'); @@ -1868,10 +2016,12 @@ function GetReportTemplate3 (invoice,checkMath) //---------------------------------------------------------------------------------------------------- if (invoice.image) - { - var left = headerRight - invoice.imageWidth; - doc.addImage(invoice.image, 'JPEG', left, 30, invoice.imageWidth, invoice.imageHeight); - } + { + + y=170; + var left = headerRight - invoice.imageWidth; + doc.addImage(invoice.image, 'JPEG', left, y, invoice.imageWidth, invoice.imageHeight); + } Report3AddFooter (invoice,doc); @@ -1925,10 +2075,19 @@ function GetReportTemplate3 (invoice,checkMath) if (account.name) { - y += rowHeight; - doc.text(AlignLine, y, LineOne); + //SetPdfColor('SomeGreen',doc); + doc.setFontSize('36'); + doc.setFontType("bold"); + doc.text(40,50, LineOne); + + doc.setFontType("normal"); + doc.setFontSize('7'); } + + + /* + y += rowHeight; doc.setFontType("normal"); @@ -1939,7 +2098,7 @@ function GetReportTemplate3 (invoice,checkMath) var AlignLine = MaxWidth-30- (doc.getStringUnitWidth(LineTwo) * doc.internal.getFontSize()); y += rowHeight; doc.text(AlignLine, y, LineTwo); - +*/ //-----------------------------Publish Client Details block-------------------------------------------- @@ -2059,12 +2218,22 @@ function GetReportTemplate3 (invoice,checkMath) } + + + + + + + + + + marginLeft2=395; //publish left side information SetPdfColor('White',doc); - z=GlobalY+15; + z=30;//GlobalY+15; doc.setFontSize('8'); doc.setFontType("normal"); @@ -2079,13 +2248,19 @@ function GetReportTemplate3 (invoice,checkMath) doc.setFontSize('8'); doc.setFontType("normal"); - doc.text(marginLeft2, z,'Due Date'); + doc.text(marginLeft2, z,'Payment Date'); + z=z+15;//doc.internal.getFontSize(); + + + doc.setFontSize('8'); + doc.setFontType("normal"); + doc.text(marginLeft2, z,'Amount Due'); z=z+15;//doc.internal.getFontSize(); marginLeft3=marginLeft2+65; - z=GlobalY+15; + z=30;//GlobalY+15; var invoiceNumber = invoice.invoice_number; @@ -2109,6 +2284,17 @@ function GetReportTemplate3 (invoice,checkMath) doc.text(marginLeft3, z,dueDate); z=z+15;//doc.internal.getFontSize(); + + + doc.setFontSize('8'); + doc.setFontType("normal"); + doc.text(marginLeft3, z,total); + z=z+15;//doc.internal.getFontSize(); + + + + + y=z+60; //--------------------------------Publishing Table-------------------------------------------------- GlobalY=y+30; @@ -2351,146 +2537,3 @@ function GetReportTemplate3 (invoice,checkMath) return doc; } - - - - -function SetPdfColor(color,doc) -{ - - if (color=='LightBlue') { - return doc.setTextColor(41,156, 194); - } - - if (color=='Black') { - return doc.setTextColor(46,43,43);//select color black - } - if (color=='GrayLogo') { - //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') { - 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'); - return false; - -} - - - -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=370; - - var left = headerRight - invoice.imageLogoWidth2; - doc.addImage(invoice.imageLogo2, 'JPEG', left, y, invoice.imageLogoWidth2, invoice.imageLogoHeight2); - - - } - - - -} - -function Report3AddFooter (invoice,doc) -{ - - doc.setLineWidth(0.5); - doc.setDrawColor(242,101,34); - doc.setFillColor(242,101,34); - - // 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.imageLogo3) - { - pageHeight=820; - var left = 250;//headerRight ; - y=pageHeight-invoice.imageLogoHeight3; - var headerRight=370; - - var left = headerRight - invoice.imageLogoWidth3; - doc.addImage(invoice.imageLogo3, 'JPEG', left, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); - - - } - - - -} From 3aef6a249067325079385542f1828d9a29273f5e Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 03:33:48 +0200 Subject: [PATCH 06/30] report 3-3 --- public/js/script.js | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 78382f97177b..3a7ee54b2aa5 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2120,7 +2120,7 @@ function GetReportTemplate3 (invoice,checkMath) var line3=headerTop+16*3; var line31=headerTop+16*3.6; - var marginLeft1=50; + var marginLeft1=394; SetPdfColor('Black',doc); //set black color @@ -2149,29 +2149,28 @@ function GetReportTemplate3 (invoice,checkMath) //publish filled box - doc.setDrawColor(200,200,200); - doc.setFillColor(54,164,152); +// 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'); + //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'); - - +// SetPdfColor('SomeGreen',doc); +// doc.setFontSize('14'); +// doc.setFontType("bold"); +// doc.text(50, GlobalY, 'YOUR INVOICE'); +// +// var z=GlobalY; - z=z+30; +// z=z+30; SetPdfColor('Black',doc); @@ -2297,7 +2296,7 @@ function GetReportTemplate3 (invoice,checkMath) y=z+60; //--------------------------------Publishing Table-------------------------------------------------- - GlobalY=y+30; + GlobalY=y+130; GlobalY=GlobalY+70;//y+30; SetPdfColor('Black',doc); doc.setFontSize(7); From f545a92b8acfbff40474c03f4bbd0778d5bd2fa3 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 03:38:44 +0200 Subject: [PATCH 07/30] report 3-3 --- 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 3a7ee54b2aa5..eaa2708980cd 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1720,7 +1720,7 @@ function GetReportTemplate2 (invoice,checkMath) doc.text(TmpMsgX, x, Msg); - SetPdfColor('LightBlue',doc); + //SetPdfColor('LightBlue',doc); AmountText = formatMoney(balance , currencyId); headerLeft=headerRight+400; var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); @@ -1866,12 +1866,12 @@ function Report3AddFooter (invoice,doc) if (invoice.imageLogo3) { pageHeight=820; - var left = 250;//headerRight ; + // var left = 25;//250;//headerRight ; y=pageHeight-invoice.imageLogoHeight3; - var headerRight=370; + //var headerRight=370; - var left = headerRight - invoice.imageLogoWidth3; - doc.addImage(invoice.imageLogo3, 'JPEG', left, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); + //var left = headerRight - invoice.imageLogoWidth3; + doc.addImage(invoice.imageLogo3, 'JPEG', 40, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); } From 1fbb6afaf7f44fefece83bb28a01b100941aa1c1 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 04:02:19 +0200 Subject: [PATCH 08/30] report 3-3 --- public/js/script.js | 75 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index eaa2708980cd..14bb4b07da8a 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1839,7 +1839,7 @@ function Report2AddFooter (invoice,doc) } -function Report3AddFooter (invoice,doc) +function Report3AddFooter (invoice,account,doc) { doc.setLineWidth(0.5); @@ -1878,6 +1878,73 @@ function Report3AddFooter (invoice,doc) + + + + + var LineOne= account.name; + + MaxWidth=440; + var AlignLine = MaxWidth-30- (doc.getStringUnitWidth(LineOne) * doc.internal.getFontSize()); + + if (account.name) { + + y =780; + + doc.setFontSize(12); + //doc.setFontType("normal"); + doc.setFontType("bold"); + SetPdfColor('White',doc); + + + doc.text(AlignLine, y, LineOne); + + doc.setFontSize(7); + } + + +var y =780; + + var AlignLine2=AlignLine+110; + if (account.address1) { + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + doc.text(AlignLine2, y,account.address1); + doc.setFontSize(7); + + y=y+18; + } + + + + if (account.address2) { + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + doc.text(AlignLine2, y,account.address2); + doc.setFontSize(7); + + y=y+18; + } + + + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + + + var LineTwo= account.city+' '+(account.country ? account.country.name : ''); + + doc.text(AlignLine2, y,LineTwo); + doc.setFontSize(7); + + + + } @@ -2023,7 +2090,7 @@ function GetReportTemplate3 (invoice,checkMath) doc.addImage(invoice.image, 'JPEG', left, y, invoice.imageWidth, invoice.imageHeight); } - Report3AddFooter (invoice,doc); + Report3AddFooter (invoice,account,doc); var invoiceNumberX = headerRight - (doc.getStringUnitWidth(invoiceNumber, false) * doc.internal.getFontSize()); var invoiceDateX = headerRight - (doc.getStringUnitWidth(invoiceDate) * doc.internal.getFontSize()); @@ -2407,7 +2474,7 @@ function GetReportTemplate3 (invoice,checkMath) GlobalY=tableTop; doc.addPage(); - Report3AddFooter(invoice,doc); + Report3AddFooter(invoice,account,doc); } if ((i%2)===0){ @@ -2523,7 +2590,7 @@ function GetReportTemplate3 (invoice,checkMath) doc.text(TmpMsgX, x, Msg); - SetPdfColor('LightBlue',doc); + // SetPdfColor('LightBlue',doc); AmountText = formatMoney(balance , currencyId); headerLeft=headerRight+400; var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); From 83e842d215141a6bdeca9c298f93dbd810a1f337 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 04:04:42 +0200 Subject: [PATCH 09/30] report 3-3 --- public/js/script.js | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 14bb4b07da8a..ea44e925011d 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2214,30 +2214,10 @@ function GetReportTemplate3 (invoice,checkMath) 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); @@ -2290,10 +2270,6 @@ function GetReportTemplate3 (invoice,checkMath) - - - - marginLeft2=395; //publish left side information @@ -2509,7 +2485,7 @@ function GetReportTemplate3 (invoice,checkMath) GlobalY=GlobalY+h+tablePadding*2; - SetPdfColor('SomeGreen',doc); +// SetPdfColor('SomeGreen',doc); doc.text(tableLeft, x, productKey); SetPdfColor('Black',doc); @@ -2590,7 +2566,7 @@ function GetReportTemplate3 (invoice,checkMath) doc.text(TmpMsgX, x, Msg); - // SetPdfColor('LightBlue',doc); + AmountText = formatMoney(balance , currencyId); headerLeft=headerRight+400; var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); From eb749878c0b62f9b88207565a759f1657d6c7407 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 04:21:53 +0200 Subject: [PATCH 10/30] report 3-3 --- public/js/script.js | 85 ++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index ea44e925011d..4e4239c66303 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2453,32 +2453,19 @@ function GetReportTemplate3 (invoice,checkMath) Report3AddFooter(invoice,account,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); + doc.setDrawColor(0,0,0); // draw red lines + doc.setLineWidth(0.1); + + var x1 = tableLeft-tablePadding ; + var y1 = GlobalY-FontSize; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + doc.line(x1, y1,x1+w2, y1); // horizontal line + - 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; @@ -2502,6 +2489,15 @@ function GetReportTemplate3 (invoice,checkMath) line=line+length; } + +//------------------------------ + + var x1 = tableLeft-tablePadding ; + var y1 = GlobalY-FontSize; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + doc.line(x1, y1,x1+w2, y1); // horizontal line + + //-------------------------------Publishing Document balance------------------------------------------ @@ -2514,15 +2510,15 @@ function GetReportTemplate3 (invoice,checkMath) 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'); +// 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'; @@ -2554,8 +2550,33 @@ function GetReportTemplate3 (invoice,checkMath) - doc.setFontType("bold"); + + + + + + doc.setLineWidth(0.3); + + doc.setDrawColor(63,60,60); + doc.setFillColor(63,60,60); + var x1 = tableLeft-tablePadding*2 ; + var y1 = x+ doc.internal.getFontSize()*4; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + var h2 = doc.internal.getFontSize()*3+tablePadding*2; + doc.rect(x1, y1, w2, h2, 'FD'); + + + + + + + + + + + doc.setFontType("bold"); + SetPdfColor('White',doc); doc.setFontSize(12); x += doc.internal.getFontSize()*4; Msg='Amount Due'; @@ -2566,7 +2587,7 @@ function GetReportTemplate3 (invoice,checkMath) doc.text(TmpMsgX, x, Msg); - + doc.setFontType("normal"); AmountText = formatMoney(balance , currencyId); headerLeft=headerRight+400; var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); From f13e42f34f41005be2415f93cdbab5b586e7d8ae Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 04:28:51 +0200 Subject: [PATCH 11/30] report 3-3 --- public/js/script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/js/script.js b/public/js/script.js index 4e4239c66303..d1c9140bfdbc 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2473,11 +2473,16 @@ function GetReportTemplate3 (invoice,checkMath) // SetPdfColor('SomeGreen',doc); + + doc.setFontType("bold"); doc.text(tableLeft, x, productKey); + doc.setFontType("normal"); SetPdfColor('Black',doc); doc.text(descriptionLeft, x, notes); + + doc.text(costX, x, cost); doc.text(qtyX, x, qty); doc.text(totalX, x, lineTotal); From 28a2eece85a23e2416c460e388374e8e0e0d9c02 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 05:13:12 +0200 Subject: [PATCH 12/30] report 3-3 --- public/js/script.js | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index d1c9140bfdbc..3752ed333229 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2214,7 +2214,7 @@ function GetReportTemplate3 (invoice,checkMath) SetPdfColor('Black',doc); //set black color doc.setFontType("normal"); - GlobalY=190; + GlobalY=170; var z=GlobalY; @@ -2359,16 +2359,56 @@ function GetReportTemplate3 (invoice,checkMath) 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()); + var totalX = lineTotalRight - (doc.getStringUnitWidth('Line Total') * doc.internal.getFontSize()) -15; tableTop=GlobalY;//redefine this to dynamic value + doc.setFontSize(12); doc.setFontType("bold"); + + + + + + + + + + doc.setLineWidth(0.3); + + doc.setDrawColor(63,60,60); + doc.setFillColor(63,60,60); + var x1 = tableLeft-tablePadding*2+5 ; + var y1 = GlobalY-doc.internal.getFontSize()-15; + var w2 = 515+tablePadding*2-3;//lineTotalRight-tablePadding*5; + var h2 = doc.internal.getFontSize()+15*2; + doc.rect(x1, y1, w2, h2, 'FD'); + + + SetPdfColor('White',doc); + + + doc.text(tableLeft, tableTop, 'Item'); doc.text(descriptionLeft, tableTop, 'Description'); doc.text(costX, tableTop, 'Unit Cost'); From 12aac27b95c0fdbfb3bdb0c80ef20682db79d37e Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 05:16:15 +0200 Subject: [PATCH 13/30] report 3-3 --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index 3752ed333229..3baa19ff9394 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2420,7 +2420,7 @@ function GetReportTemplate3 (invoice,checkMath) doc.text(taxX, tableTop, 'Tax'); } - + SetPdfColor('Black',doc); doc.setFontSize(7); /* line items */ From fbfd9c324cdaa4137df0c2024808dbc56b80e5be Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 05:19:14 +0200 Subject: [PATCH 14/30] report 3-3 --- 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 3baa19ff9394..461c3b195f0a 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2340,7 +2340,7 @@ function GetReportTemplate3 (invoice,checkMath) y=z+60; //--------------------------------Publishing Table-------------------------------------------------- GlobalY=y+130; - GlobalY=GlobalY+70;//y+30; + GlobalY=GlobalY+30;//y+30; SetPdfColor('Black',doc); doc.setFontSize(7); var hasTaxes = false; @@ -2494,8 +2494,8 @@ function GetReportTemplate3 (invoice,checkMath) } - - +if (i!=0) +{ doc.setDrawColor(0,0,0); // draw red lines doc.setLineWidth(0.1); @@ -2503,7 +2503,7 @@ function GetReportTemplate3 (invoice,checkMath) var y1 = GlobalY-FontSize; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; doc.line(x1, y1,x1+w2, y1); // horizontal line - +} From 9432fd16e68ae3978969cb47ef10a9ddc14cceac Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 05:46:41 +0200 Subject: [PATCH 15/30] report 3-3 --- public/js/script.js | 130 ++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 461c3b195f0a..a03e145e979e 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2059,25 +2059,10 @@ function GetReportTemplate3 (invoice,checkMath) doc.setFont('Helvetica',''); doc.setFontSize(7); - doc.setLineWidth(0.5); - - //doc.setFillColor( 46,43,43); - //doc.setFillColor( 46,43,43); - - doc.setDrawColor(242,101,34); - doc.setFillColor(242,101,34); - - - var x1 =0; - - var y1 = 0; - - var w2 = 595; - var h2 = 140;// doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; - doc.rect(x1, y1, w2, h2, 'FD'); + Report3AddHeader (invoice,account,doc); @@ -2132,41 +2117,9 @@ function GetReportTemplate3 (invoice,checkMath) 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) { - - //SetPdfColor('SomeGreen',doc); - doc.setFontSize('36'); - doc.setFontType("bold"); - doc.text(40,50, LineOne); - - doc.setFontType("normal"); - doc.setFontSize('7'); - } - /* - - y += rowHeight; - - doc.setFontType("normal"); - - - var LineTwo= account.address1+' '+account.address2+account.city+' '+(account.country ? 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; @@ -2484,17 +2437,23 @@ function GetReportTemplate3 (invoice,checkMath) length=doc.splitTextToSize(item.notes, 200).length; var h=length*FontSize; MaxGlobalY=730; + + + if (h+GlobalY > MaxGlobalY) { - tableTop = 40; + tableTop = 180; GlobalY=tableTop; doc.addPage(); + Report3AddHeader(invoice,account,doc); Report3AddFooter(invoice,account,doc); + NewPageFlag=1; } + else NewPageFlag=0; -if (i!=0) +if (i!=0&NewPageFlag==0) { doc.setDrawColor(0,0,0); // draw red lines doc.setLineWidth(0.1); @@ -2535,12 +2494,17 @@ if (i!=0) line=line+length; } -//------------------------------ - var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; - var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - doc.line(x1, y1,x1+w2, y1); // horizontal line + if (GlobalY>600) + { + GlobalY=150; + x=150; + doc.addPage(); + Report3AddHeader(invoice,account,doc); + Report3AddFooter(invoice,account,doc); + } + + //-------------------------------Publishing Document balance------------------------------------------ @@ -2555,17 +2519,8 @@ if (i!=0) 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'); - + SetPdfColor('Black',doc); Msg='Total'; var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); doc.text(TmpMsgX, x, Msg); @@ -2645,3 +2600,48 @@ if (i!=0) return doc; } + + + + +function Report3AddHeader (invoice,account,doc) +{ + doc.setLineWidth(0.5); + + //doc.setFillColor( 46,43,43); + //doc.setFillColor( 46,43,43); + + doc.setDrawColor(242,101,34); + doc.setFillColor(242,101,34); + + + var x1 =0; + + var y1 = 0; + + var w2 = 595; + var h2 = 140; + doc.rect(x1, y1, w2, h2, 'FD'); + + SetPdfColor('White',doc); + //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) { + + //SetPdfColor('SomeGreen',doc); + doc.setFontSize('36'); + doc.setFontType("bold"); + doc.text(40,50, LineOne); + + doc.setFontType("normal"); + doc.setFontSize('7'); + } + + +} \ No newline at end of file From a11d6958af2452e5376ffec2a2062c8ddab41eb3 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 05:49:59 +0200 Subject: [PATCH 16/30] report 3-3 --- public/js/script.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/js/script.js b/public/js/script.js index a03e145e979e..b205782da870 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2505,6 +2505,22 @@ if (i!=0&NewPageFlag==0) } + else + + { + + //put line separator + + doc.setDrawColor(0,0,0); // draw red lines + doc.setLineWidth(0.1); + + var x1 = tableLeft-tablePadding ; + var y1 = GlobalY-FontSize; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + doc.line(x1, y1,x1+w2, y1); // horizontal line + + } + //-------------------------------Publishing Document balance------------------------------------------ From acaba0635b940d809479085de9e5bad382fe7fbf Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 06:19:00 +0200 Subject: [PATCH 17/30] report 3-3 --- public/js/script.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index b205782da870..7e4026fc0ae5 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1989,7 +1989,7 @@ function GetReportTemplate3 (invoice,checkMath) //var tableTop = 240+100; //var tableRowHeight = 18; - var tablePadding = 6; + var tablePadding = 14; @@ -2461,7 +2461,7 @@ if (i!=0&NewPageFlag==0) var x1 = tableLeft-tablePadding ; var y1 = GlobalY-FontSize; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - doc.line(x1, y1,x1+w2, y1); // horizontal line + doc.line(x1, y1-10,x1+w2, y1-10); // horizontal line } @@ -2491,6 +2491,7 @@ if (i!=0&NewPageFlag==0) } + line=line+length; } From f647d78065c3efda53d0d6a4a2680f3472d7285c Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 06:20:23 +0200 Subject: [PATCH 18/30] report 3-3 --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index 7e4026fc0ae5..331e6be10cf0 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2383,7 +2383,7 @@ function GetReportTemplate3 (invoice,checkMath) var shownItem = false; - GlobalY=GlobalY+24; //padding from top + GlobalY=GlobalY+24+10; //padding from top var FontSize=7; doc.setFontSize(FontSize); From 0db59a9c9dfc3f7377843a4cc7fda14685cb491f Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 06:33:29 +0200 Subject: [PATCH 19/30] report 3-3 --- 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 331e6be10cf0..13e4a666631e 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -535,9 +535,9 @@ $.fn.datepicker.defaults.todayHighlight = true; function GetPdf(invoice,checkMath,report_id){ - if (report_id==1) return GetReportTemplate3(invoice,checkMath); + if (report_id==1) 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 GetReportTemplate3(invoice,checkMath); alert('report template not implemented yet'); @@ -592,7 +592,7 @@ function GetReportTemplate1 (invoice,checkMath) var tableTop = 240+100; var tableRowHeight = 18; - var tablePadding = 6; + var tablePadding = 14; @@ -992,10 +992,10 @@ function GetReportTemplate1 (invoice,checkMath) var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; + var y1 = GlobalY-FontSize-5; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = doc.internal.getFontSize()*length+length*1.1+10;//+h;//+tablePadding; From 2fcdb0c28b2de8adb88f1ff3a4cc254098e98497 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 06:39:07 +0200 Subject: [PATCH 20/30] report 3-3 --- public/js/script.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 13e4a666631e..362a37188122 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1160,7 +1160,7 @@ function GetReportTemplate2 (invoice,checkMath) //var tableTop = 240+100; //var tableRowHeight = 18; - var tablePadding = 6; + var tablePadding = 14; @@ -1597,7 +1597,7 @@ function GetReportTemplate2 (invoice,checkMath) length=doc.splitTextToSize(item.notes, 200).length; var h=length*FontSize; - MaxGlobalY=750; + MaxGlobalY=740; if (h+GlobalY > MaxGlobalY) { tableTop = 40; @@ -1615,9 +1615,9 @@ function GetReportTemplate2 (invoice,checkMath) var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; + var y1 = GlobalY-FontSize-5; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = doc.internal.getFontSize()*length+length*1.1+10;//+h;//+tablePadding; doc.rect(x1, y1, w2, h2, 'FD'); } else @@ -1628,9 +1628,9 @@ function GetReportTemplate2 (invoice,checkMath) var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; + var y1 = GlobalY-FontSize-5; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = doc.internal.getFontSize()*length+length*1.1+10;//+h;//+tablePadding; doc.rect(x1, y1, w2, h2, 'FD'); } From cbc4f4655828e69e6f51b55c67ca083fc4c6bfe5 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Sun, 2 Mar 2014 06:57:00 +0200 Subject: [PATCH 21/30] report 3-3 --- public/js/script.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 362a37188122..bf45c85d7797 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1,4 +1,4 @@ -GetReportTemplate3// http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser +// http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+ var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; @@ -1053,7 +1053,7 @@ function GetReportTemplate1 (invoice,checkMath) doc.setLineWidth(0.3); doc.setDrawColor(200,200,200); doc.setFillColor(251,251,251); - var x1 = tableLeft-tablePadding*2 ; + var x1 = tableLeft-tablePadding*2+14 ; var y1 = GlobalY-FontSize-tablePadding; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; var h2 = doc.internal.getFontSize()*3+tablePadding*2; @@ -1553,7 +1553,6 @@ function GetReportTemplate2 (invoice,checkMath) var MaxLinesPerPage=40; - for (var i=0; i Date: Sun, 2 Mar 2014 06:57:48 +0200 Subject: [PATCH 22/30] report 3-3 --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index bf45c85d7797..c0ec47b29cbd 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2576,7 +2576,7 @@ if (i!=0&NewPageFlag==0) doc.setDrawColor(63,60,60); doc.setFillColor(63,60,60); - var x1 = tableLeft-tablePadding*2 ; + var x1 = tableLeft-tablePadding*2 +14; var y1 = x+ doc.internal.getFontSize()*4; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; var h2 = doc.internal.getFontSize()*3+tablePadding*2; From 39774ccaaf7f263310fd072be78ec5508a4188bf Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 2 Mar 2014 08:30:30 +0200 Subject: [PATCH 23/30] merging changes --- public/js/script.js | 2011 +++++++++++++++++++++++-------------------- 1 file changed, 1089 insertions(+), 922 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index f18e1df1be7b..5e806765ffea 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -20,10 +20,10 @@ function generatePDF(invoice, checkMath) { /* Handle converting variables in the invoices (ie, MONTH+1) */ function processVariables(str) { - if (!str) return ''; - var variables = ['MONTH','QUARTER','YEAR']; - for (var i=0; i<'span6'p>>", - //"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", - "sPaginationType": "bootstrap", - //"bProcessing": true, - //"iDisplayLength": 50, - "bInfo": true, - "oLanguage": { - //"sLengthMenu": "_MENU_ records per page" - "sLengthMenu": "_MENU_", - "sSearch": "" - } - //"sScrollY": "500px", + "sDom": "t<'row-fluid'<'span6'i><'span6'p>>", + //"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", + "sPaginationType": "bootstrap", + //"bProcessing": true, + //"iDisplayLength": 50, + "bInfo": true, + "oLanguage": { + //"sLengthMenu": "_MENU_ records per page" + "sLengthMenu": "_MENU_", + "sSearch": "" + } + //"sScrollY": "500px", } ); /* Default class modification */ $.extend( $.fn.dataTableExt.oStdClasses, { - "sWrapper": "dataTables_wrapper form-inline" + "sWrapper": "dataTables_wrapper form-inline" } ); /* API method to get paging information */ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) { - return { - "iStart": oSettings._iDisplayStart, - "iEnd": oSettings.fnDisplayEnd(), - "iLength": oSettings._iDisplayLength, - "iTotal": oSettings.fnRecordsTotal(), - "iFilteredTotal": oSettings.fnRecordsDisplay(), - "iPage": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), - "iTotalPages": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) - }; + return { + "iStart": oSettings._iDisplayStart, + "iEnd": oSettings.fnDisplayEnd(), + "iLength": oSettings._iDisplayLength, + "iTotal": oSettings.fnRecordsTotal(), + "iFilteredTotal": oSettings.fnRecordsDisplay(), + "iPage": oSettings._iDisplayLength === -1 ? + 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), + "iTotalPages": oSettings._iDisplayLength === -1 ? + 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) + }; }; /* Bootstrap style pagination control */ $.extend( $.fn.dataTableExt.oPagination, { - "bootstrap": { - "fnInit": function( oSettings, nPaging, fnDraw ) { - var oLang = oSettings.oLanguage.oPaginate; - var fnClickHandler = function ( e ) { - e.preventDefault(); - if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { - fnDraw( oSettings ); - } - }; + "bootstrap": { + "fnInit": function( oSettings, nPaging, fnDraw ) { + var oLang = oSettings.oLanguage.oPaginate; + var fnClickHandler = function ( e ) { + e.preventDefault(); + if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { + fnDraw( oSettings ); + } + }; - $(nPaging).addClass('pagination').append( - '
    '+ - ''+ - ''+ - '
' - ); - var els = $('a', nPaging); - $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); - $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); - }, + $(nPaging).addClass('pagination').append( + '
    '+ + ''+ + ''+ + '
' + ); + var els = $('a', nPaging); + $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); + $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); + }, - "fnUpdate": function ( oSettings, fnDraw ) { - var iListLength = 5; - var oPaging = oSettings.oInstance.fnPagingInfo(); - var an = oSettings.aanFeatures.p; - var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2); + "fnUpdate": function ( oSettings, fnDraw ) { + var iListLength = 5; + var oPaging = oSettings.oInstance.fnPagingInfo(); + var an = oSettings.aanFeatures.p; + var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2); - if ( oPaging.iTotalPages < iListLength) { - iStart = 1; - iEnd = oPaging.iTotalPages; - } - else if ( oPaging.iPage <= iHalf ) { - iStart = 1; - iEnd = iListLength; - } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) { - iStart = oPaging.iTotalPages - iListLength + 1; - iEnd = oPaging.iTotalPages; - } else { - iStart = oPaging.iPage - iHalf + 1; - iEnd = iStart + iListLength - 1; - } + if ( oPaging.iTotalPages < iListLength) { + iStart = 1; + iEnd = oPaging.iTotalPages; + } + else if ( oPaging.iPage <= iHalf ) { + iStart = 1; + iEnd = iListLength; + } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) { + iStart = oPaging.iTotalPages - iListLength + 1; + iEnd = oPaging.iTotalPages; + } else { + iStart = oPaging.iPage - iHalf + 1; + iEnd = iStart + iListLength - 1; + } - for ( i=0, ien=an.length ; i'+j+'') - .insertBefore( $('li:last', an[i])[0] ) - .bind('click', function (e) { - e.preventDefault(); - oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; - fnDraw( oSettings ); - } ); - } + // Add the new list items and their event handlers + for ( j=iStart ; j<=iEnd ; j++ ) { + sClass = (j==oPaging.iPage+1) ? 'class="active"' : ''; + $('
  • '+j+'
  • ') + .insertBefore( $('li:last', an[i])[0] ) + .bind('click', function (e) { + e.preventDefault(); + oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; + fnDraw( oSettings ); + } ); + } - // Add / remove disabled classes from the static elements - if ( oPaging.iPage === 0 ) { - $('li:first', an[i]).addClass('disabled'); - } else { - $('li:first', an[i]).removeClass('disabled'); - } + // Add / remove disabled classes from the static elements + if ( oPaging.iPage === 0 ) { + $('li:first', an[i]).addClass('disabled'); + } else { + $('li:first', an[i]).removeClass('disabled'); + } - if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { - $('li:last', an[i]).addClass('disabled'); - } else { - $('li:last', an[i]).removeClass('disabled'); - } - } - } - } + if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { + $('li:last', an[i]).addClass('disabled'); + } else { + $('li:last', an[i]).removeClass('disabled'); + } + } + } + } } ); @@ -211,47 +211,47 @@ $.extend( $.fn.dataTableExt.oPagination, { * Required TableTools 2.1+ */ if ( $.fn.DataTable.TableTools ) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend( true, $.fn.DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info modal" - }, - "select": { - "row": "active" - } - } ); + // Set the classes that TableTools uses to something suitable for Bootstrap + $.extend( true, $.fn.DataTable.TableTools.classes, { + "container": "DTTT btn-group", + "buttons": { + "normal": "btn", + "disabled": "disabled" + }, + "collection": { + "container": "DTTT_dropdown dropdown-menu", + "buttons": { + "normal": "", + "disabled": "disabled" + } + }, + "print": { + "info": "DTTT_print_info modal" + }, + "select": { + "row": "active" + } + } ); - // Have the collection use a bootstrap compatible dropdown - $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - } ); + // Have the collection use a bootstrap compatible dropdown + $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { + "collection": { + "container": "ul", + "button": "li", + "liner": "a" + } + } ); } /* $(document).ready(function() { - $('#example').dataTable( { - "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", - "sPaginationType": "bootstrap", - "oLanguage": { - "sLengthMenu": "_MENU_ records per page" - } - } ); + $('#example').dataTable( { + "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", + "sPaginationType": "bootstrap", + "oLanguage": { + "sLengthMenu": "_MENU_ records per page" + } + } ); } ); */ @@ -278,45 +278,45 @@ $(function() { function enableHoverClick($combobox, $entityId, url) { - /* - $combobox.mouseleave(function() { - $combobox.css('text-decoration','none'); - }).on('mouseenter', function(e) { - setAsLink($combobox, $combobox.closest('.combobox-container').hasClass('combobox-selected')); - }).on('focusout mouseleave', function(e) { - setAsLink($combobox, false); - }).on('click', function() { - var clientId = $entityId.val(); - if ($(combobox).closest('.combobox-container').hasClass('combobox-selected')) { - if (parseInt(clientId) > 0) { - window.open(url + '/' + clientId, '_blank'); - } else { - $('#myModal').modal('show'); - } - }; - }); + /* + $combobox.mouseleave(function() { + $combobox.css('text-decoration','none'); + }).on('mouseenter', function(e) { + setAsLink($combobox, $combobox.closest('.combobox-container').hasClass('combobox-selected')); + }).on('focusout mouseleave', function(e) { + setAsLink($combobox, false); + }).on('click', function() { + var clientId = $entityId.val(); + if ($(combobox).closest('.combobox-container').hasClass('combobox-selected')) { + if (parseInt(clientId) > 0) { + window.open(url + '/' + clientId, '_blank'); + } else { + $('#myModal').modal('show'); + } + }; + }); */ } function setAsLink($input, enable) { - if (enable) { - $input.css('text-decoration','underline'); - $input.css('cursor','pointer'); - } else { - $input.css('text-decoration','none'); - $input.css('cursor','text'); - } + if (enable) { + $input.css('text-decoration','underline'); + $input.css('cursor','pointer'); + } else { + $input.css('text-decoration','none'); + $input.css('cursor','text'); + } } function setComboboxValue($combobox, id, name) { - $combobox.find('input').val(id); - $combobox.find('input.form-control').val(name); - if (id && name) { - $combobox.find('select').combobox('setSelected'); - $combobox.find('.combobox-container').addClass('combobox-selected'); - } else { - $combobox.find('.combobox-container').removeClass('combobox-selected'); - } + $combobox.find('input').val(id); + $combobox.find('input.form-control').val(name); + if (id && name) { + $combobox.find('select').combobox('setSelected'); + $combobox.find('.combobox-container').addClass('combobox-selected'); + } else { + $combobox.find('.combobox-container').removeClass('combobox-selected'); + } } @@ -346,24 +346,24 @@ ko.bindingHandlers.dropdown = { /* ko.utils.registerEventHandler(element, "change", function () { - console.log("change: %s", $(element).val()); - var - valueAccessor($(element).val()); + console.log("change: %s", $(element).val()); + var + valueAccessor($(element).val()); //$(element).combobox('refresh'); }); - */ + */ }, - update: function (element, valueAccessor) { - var value = ko.utils.unwrapObservable(valueAccessor()); - var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : value ? value : false; - //console.log("combo-update: %s", id); - if (id) { - $(element).val(id); - $(element).combobox('refresh'); - } else { - $(element).combobox('clearTarget'); - $(element).combobox('clearElement'); - } + update: function (element, valueAccessor) { + var value = ko.utils.unwrapObservable(valueAccessor()); + var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : value ? value : false; + //console.log("combo-update: %s", id); + if (id) { + $(element).val(id); + $(element).combobox('refresh'); + } else { + $(element).combobox('clearTarget'); + $(element).combobox('clearElement'); + } } }; @@ -373,11 +373,11 @@ ko.bindingHandlers.datePicker = { var value = ko.utils.unwrapObservable(valueAccessor()); if (value) $(element).datepicker('update', value); $(element).change(function() { - var value = valueAccessor(); + var value = valueAccessor(); value($(element).val()); }) }, - update: function (element, valueAccessor) { + update: function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); if (value) $(element).datepicker('update', value); } @@ -386,14 +386,14 @@ ko.bindingHandlers.datePicker = { function wordWrapText(value, width) { - if (!width) width = 200; - var doc = new jsPDF('p', 'pt'); - doc.setFont('Helvetica',''); - doc.setFontSize(10); + if (!width) width = 200; + var doc = new jsPDF('p', 'pt'); + doc.setFont('Helvetica',''); + doc.setFontSize(10); - var lines = value.split("\n"); + var lines = value.split("\n"); for (var i = 0; i < lines.length; i++) { - var numLines = doc.splitTextToSize(lines[i], width).length; + var numLines = doc.splitTextToSize(lines[i], width).length; if (numLines <= 1) continue; var j = 0; space = lines[i].length; while (j++ < lines[i].length) { @@ -406,9 +406,9 @@ function wordWrapText(value, width) var newValue = (lines.join("\n")).trim(); if (value == newValue) { - return newValue; + return newValue; } else { - return wordWrapText(newValue, width); + return wordWrapText(newValue, width); } } @@ -416,105 +416,105 @@ function wordWrapText(value, width) function getClientDisplayName(client) { - var contact = client.contacts[0]; - if (client.name) { - return client.name; - } else if (contact.first_name || contact.last_name) { - return contact.first_name + ' ' + contact.last_name; - } else { - return contact.email; - } + var contact = client.contacts[0]; + if (client.name) { + return client.name; + } else if (contact.first_name || contact.last_name) { + return contact.first_name + ' ' + contact.last_name; + } else { + return contact.email; + } } function populateInvoiceComboboxes(clientId, invoiceId) { - var clientMap = {}; - var invoiceMap = {}; - var invoicesForClientMap = {}; - var $clientSelect = $('select#client'); - - for (var i=0; i MaxGlobalY) { tableTop = 40; @@ -1615,9 +1614,9 @@ function GetReportTemplate2 (invoice,checkMath) var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; + var y1 = GlobalY-FontSize-5; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = doc.internal.getFontSize()*length+length*1.1+10;//+h;//+tablePadding; doc.rect(x1, y1, w2, h2, 'FD'); } else @@ -1628,9 +1627,9 @@ function GetReportTemplate2 (invoice,checkMath) var x1 = tableLeft-tablePadding ; - var y1 = GlobalY-FontSize; + var y1 = GlobalY-FontSize-5; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*length+length*1.1;//+h;//+tablePadding; + var h2 = doc.internal.getFontSize()*length+length*1.1+10;//+h;//+tablePadding; doc.rect(x1, y1, w2, h2, 'FD'); } @@ -1672,7 +1671,7 @@ function GetReportTemplate2 (invoice,checkMath) doc.setDrawColor(251,251,251); doc.setFillColor(251,251,251); - var x1 = tableLeft-tablePadding*2 ; + var x1 = tableLeft-tablePadding*2 +14; var y1 = GlobalY-FontSize-tablePadding; var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; var h2 = doc.internal.getFontSize()*3+tablePadding*2; @@ -1720,7 +1719,7 @@ function GetReportTemplate2 (invoice,checkMath) doc.text(TmpMsgX, x, Msg); - SetPdfColor('LightBlue',doc); + //SetPdfColor('LightBlue',doc); AmountText = formatMoney(balance , currencyId); headerLeft=headerRight+400; var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); @@ -1737,621 +1736,6 @@ function GetReportTemplate2 (invoice,checkMath) -function GetReportTemplate3 (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 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); - - doc.setDrawColor(242,101,34); - doc.setFillColor(242,101,34); - - - 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); - } - - Report3AddFooter (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 ? 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 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 MaxGlobalY) { - - tableTop = 40; - GlobalY=tableTop; - - doc.addPage(); - Report3AddFooter(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; -} - @@ -2454,7 +1838,7 @@ function Report2AddFooter (invoice,doc) } -function Report3AddFooter (invoice,doc) +function Report3AddFooter (invoice,account,doc) { doc.setLineWidth(0.5); @@ -2481,16 +1865,799 @@ function Report3AddFooter (invoice,doc) if (invoice.imageLogo3) { pageHeight=820; - var left = 250;//headerRight ; + // var left = 25;//250;//headerRight ; y=pageHeight-invoice.imageLogoHeight3; - var headerRight=370; + //var headerRight=370; - var left = headerRight - invoice.imageLogoWidth3; - doc.addImage(invoice.imageLogo3, 'JPEG', left, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); + //var left = headerRight - invoice.imageLogoWidth3; + doc.addImage(invoice.imageLogo3, 'JPEG', 40, y, invoice.imageLogoWidth3, invoice.imageLogoHeight3); } + + + + + var LineOne= account.name; + + MaxWidth=440; + var AlignLine = MaxWidth-30- (doc.getStringUnitWidth(LineOne) * doc.internal.getFontSize()); + + if (account.name) { + + y =780; + + doc.setFontSize(12); + //doc.setFontType("normal"); + doc.setFontType("bold"); + SetPdfColor('White',doc); + + + doc.text(AlignLine, y, LineOne); + + doc.setFontSize(7); + } + + +var y =780; + + var AlignLine2=AlignLine+110; + if (account.address1) { + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + doc.text(AlignLine2, y,account.address1); + doc.setFontSize(7); + + y=y+18; + } + + + + if (account.address2) { + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + doc.text(AlignLine2, y,account.address2); + doc.setFontSize(7); + + y=y+18; + } + + + + doc.setFontSize(12); + doc.setFontType("normal"); + SetPdfColor('White',doc); + + + var LineTwo= account.city+' '+(account.country ? account.country.name : ''); + + doc.text(AlignLine2, y,LineTwo); + doc.setFontSize(7); + + + + } + + + + + + +function GetReportTemplate3 (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 = 14; + + + +//------------------------------ move to functions ! + var total = 0; + for (var i=0; i 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); + + + + + Report3AddHeader (invoice,account,doc); + + + +//---------------------------------------------------------------------------------------------------- + if (invoice.image) + { + + y=170; + var left = headerRight - invoice.imageWidth; + doc.addImage(invoice.image, 'JPEG', left, y, invoice.imageWidth, invoice.imageHeight); + } + + Report3AddFooter (invoice,account,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; + + + + +//-----------------------------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=394; + + + 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"); + + GlobalY=170; + + var z=GlobalY; + + + + 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=30;//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,'Payment Date'); + z=z+15;//doc.internal.getFontSize(); + + + doc.setFontSize('8'); + doc.setFontType("normal"); + doc.text(marginLeft2, z,'Amount Due'); + z=z+15;//doc.internal.getFontSize(); + + + marginLeft3=marginLeft2+65; + + z=30;//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(); + + + + doc.setFontSize('8'); + doc.setFontType("normal"); + doc.text(marginLeft3, z,total); + z=z+15;//doc.internal.getFontSize(); + + + + + + y=z+60; +//--------------------------------Publishing Table-------------------------------------------------- + GlobalY=y+130; + GlobalY=GlobalY+30;//y+30; + SetPdfColor('Black',doc); + doc.setFontSize(7); + var hasTaxes = false; + for (var i=0; i 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()) -15; + + tableTop=GlobalY;//redefine this to dynamic value + + + doc.setFontSize(12); + doc.setFontType("bold"); + + + + + + + + + + + doc.setLineWidth(0.3); + + doc.setDrawColor(63,60,60); + doc.setFillColor(63,60,60); + var x1 = tableLeft-tablePadding*2+5 ; + var y1 = GlobalY-doc.internal.getFontSize()-15; + var w2 = 515+tablePadding*2-3;//lineTotalRight-tablePadding*5; + var h2 = doc.internal.getFontSize()+15*2; + doc.rect(x1, y1, w2, h2, 'FD'); + + + SetPdfColor('White',doc); + + + + 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'); + } + + SetPdfColor('Black',doc); + doc.setFontSize(7); + + /* line items */ + + var line = 1; + var total = 0; + var shownItem = false; + + + GlobalY=GlobalY+24+10; //padding from top + + var FontSize=7; + doc.setFontSize(FontSize); + doc.setFontType("normal"); + + var MaxLinesPerPage=40; + + + + for (var i=0; i MaxGlobalY) { + + tableTop = 180; + GlobalY=tableTop; + + doc.addPage(); + Report3AddHeader(invoice,account,doc); + Report3AddFooter(invoice,account,doc); + NewPageFlag=1; + } + else NewPageFlag=0; + + +if (i!=0&NewPageFlag==0) +{ + doc.setDrawColor(0,0,0); // draw red lines + doc.setLineWidth(0.1); + + var x1 = tableLeft-tablePadding ; + var y1 = GlobalY-FontSize; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + doc.line(x1, y1-10,x1+w2, y1-10); // horizontal line +} + + + + x=GlobalY; + + GlobalY=GlobalY+h+tablePadding*2; + + +// SetPdfColor('SomeGreen',doc); + + doc.setFontType("bold"); + doc.text(tableLeft, x, productKey); + + doc.setFontType("normal"); + 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; + } + + + if (GlobalY>600) + { + GlobalY=150; + x=150; + doc.addPage(); + Report3AddHeader(invoice,account,doc); + Report3AddFooter(invoice,account,doc); + } + + + else + + { + + //put line separator + + doc.setDrawColor(0,0,0); // draw red lines + doc.setLineWidth(0.1); + + var x1 = tableLeft-tablePadding ; + var y1 = GlobalY-FontSize; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + doc.line(x1, y1,x1+w2, y1); // horizontal line + + } + + + +//-------------------------------Publishing Document balance------------------------------------------ + + + x += 16+50; + + doc.setFontType("bold"); + MsgRightAlign=400; + + + + GlobalY=x; + + + SetPdfColor('Black',doc); + 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.setLineWidth(0.3); + + doc.setDrawColor(63,60,60); + doc.setFillColor(63,60,60); + var x1 = tableLeft-tablePadding*2 +14; + var y1 = x+ doc.internal.getFontSize()*4; + var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; + var h2 = doc.internal.getFontSize()*3+tablePadding*2; + doc.rect(x1, y1, w2, h2, 'FD'); + + + + + + + + + + + doc.setFontType("bold"); + SetPdfColor('White',doc); + 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); + + + doc.setFontType("normal"); + AmountText = formatMoney(balance , currencyId); + headerLeft=headerRight+400; + var AmountX = headerLeft - (doc.getStringUnitWidth(AmountText) * doc.internal.getFontSize()); + doc.text(AmountX, x, AmountText); + + + + + + + return doc; +} + + + + +function Report3AddHeader (invoice,account,doc) +{ + doc.setLineWidth(0.5); + + //doc.setFillColor( 46,43,43); + //doc.setFillColor( 46,43,43); + + doc.setDrawColor(242,101,34); + doc.setFillColor(242,101,34); + + + var x1 =0; + + var y1 = 0; + + var w2 = 595; + var h2 = 140; + doc.rect(x1, y1, w2, h2, 'FD'); + + SetPdfColor('White',doc); + //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) { + + //SetPdfColor('SomeGreen',doc); + doc.setFontSize('36'); + doc.setFontType("bold"); + doc.text(40,50, LineOne); + + doc.setFontType("normal"); + doc.setFontSize('7'); + } + + +} \ No newline at end of file From cfa06662f8454bfcfcd12dea86924ad45e48939c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 2 Mar 2014 08:44:33 +0200 Subject: [PATCH 24/30] merging conflicts --- public/js/script.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 24a64d50e8dd..5e806765ffea 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2570,20 +2570,6 @@ if (i!=0&NewPageFlag==0) -<<<<<<< HEAD - - - doc.setLineWidth(0.3); - - doc.setDrawColor(63,60,60); - doc.setFillColor(63,60,60); - var x1 = tableLeft-tablePadding*2 +14; - var y1 = x+ doc.internal.getFontSize()*4; - var w2 = 510+tablePadding*2;//lineTotalRight-tablePadding*5; - var h2 = doc.internal.getFontSize()*3+tablePadding*2; - doc.rect(x1, y1, w2, h2, 'FD'); -======= ->>>>>>> 39774ccaaf7f263310fd072be78ec5508a4188bf doc.setLineWidth(0.3); @@ -2602,12 +2588,9 @@ if (i!=0&NewPageFlag==0) -<<<<<<< HEAD -======= ->>>>>>> 39774ccaaf7f263310fd072be78ec5508a4188bf doc.setFontType("bold"); SetPdfColor('White',doc); doc.setFontSize(12); From 6f87769077a3d21b8f5338db2aaa6aae2aadacec Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 3 Mar 2014 20:26:45 +0200 Subject: [PATCH 25/30] bug fixes --- app/controllers/AccountController.php | 4 ++- ...2014_03_03_155556_add_phone_to_account.php | 36 +++++++++++++++++++ app/views/accounts/details.blade.php | 2 ++ app/views/invoices/edit.blade.php | 4 +-- public/css/style.css | 4 +-- public/js/script.js | 7 ++-- 6 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 app/database/migrations/2014_03_03_155556_add_phone_to_account.php diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 93db77a26903..9199cb3a95ac 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -498,12 +498,14 @@ class AccountController extends \BaseController { { $account = Account::findOrFail(Auth::user()->account_id); $account->name = trim(Input::get('name')); + $account->work_email = trim(Input::get('work_email')); + $account->work_phone = trim(Input::get('work_phone')); $account->address1 = trim(Input::get('address1')); $account->address2 = trim(Input::get('address2')); $account->city = trim(Input::get('city')); $account->state = trim(Input::get('state')); $account->postal_code = trim(Input::get('postal_code')); - $account->country_id = Input::get('country_id') ? Input::get('country_id') : null; + $account->country_id = Input::get('country_id') ? Input::get('country_id') : null; $account->size_id = Input::get('size_id') ? Input::get('size_id') : null; $account->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null; $account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null; diff --git a/app/database/migrations/2014_03_03_155556_add_phone_to_account.php b/app/database/migrations/2014_03_03_155556_add_phone_to_account.php new file mode 100644 index 000000000000..1de12fb34e3b --- /dev/null +++ b/app/database/migrations/2014_03_03_155556_add_phone_to_account.php @@ -0,0 +1,36 @@ +string('work_phone'); + $table->string('work_email'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('accounts', function($table) + { + $table->dropColumn('work_phone'); + $table->dropColumn('work_email'); + }); + } + +} \ No newline at end of file diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index bf3ac60d4b02..839e718ae54f 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -27,6 +27,8 @@ {{ Former::legend('Details') }} {{ Former::text('name') }} + {{ Former::text('work_email')->label('Email') }} + {{ Former::text('work_phone')->label('Phone') }} {{ Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp('Supported: JPEG, GIF and PNG. Recommnded size: 120px width, 80px height') }} @if (file_exists($account->getLogoPath())) diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index 471d01543e7a..f4ea5e0b6868 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -1397,7 +1397,7 @@ } $('.word-wrap').each(function(index, input) { - $(input).height($(input).val().split('\n').length * 22); + $(input).height($(input).val().split('\n').length * 20); }); } @@ -1468,7 +1468,7 @@ if (!model.invoice().discount()) model.invoice().discount(''); ko.applyBindings(model); - + onItemChange(); diff --git a/public/css/style.css b/public/css/style.css index 7a20ed55d472..c0e226bae36c 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -53,7 +53,7 @@ margin-bottom: 0; padding-top: 10px; } textarea.form-control { -height: auto !important; +/*height: auto !important;*/ } /*tables*/ table.dataTable { border-radius: 3px; border-collapse: collapse; @@ -73,7 +73,7 @@ th:last-child { tr {border: none;} th {border-left: 1px solid #d26b26; } .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td { -vertical-align: middle; +vertical-align: top; border-top: none; border-bottom: 1px solid #dfe0e1; } diff --git a/public/js/script.js b/public/js/script.js index 5e806765ffea..64775f08adae 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -569,8 +569,7 @@ function GetReportTemplate1 (invoice,checkMath) 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 paid_to_date = invoice.amount - invoice.balance; @@ -1140,7 +1139,7 @@ function GetReportTemplate2 (invoice,checkMath) 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 paid_to_date = invoice.amount - invoice.balance; var headerRight = 150; var accountTop = 30; @@ -1968,7 +1967,7 @@ function GetReportTemplate3 (invoice,checkMath) 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 paid_to_date = invoice.amount - invoice.balance; var headerRight = 150; var accountTop = 30; From c87a58c3c54fc29dcde9811856fc20c34b878b03 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 3 Mar 2014 20:30:56 +0200 Subject: [PATCH 26/30] bug fixes --- public/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/css/style.css b/public/css/style.css index c0e226bae36c..4720cf0c2e40 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -54,6 +54,7 @@ padding-top: 10px; } textarea.form-control { /*height: auto !important;*/ +min-height: 38px; } /*tables*/ table.dataTable { border-radius: 3px; border-collapse: collapse; From a6fac4f90012d7d3b6aec82a8fab63345c170ad1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 3 Mar 2014 20:31:29 +0200 Subject: [PATCH 27/30] bug fixes --- public/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/style.css b/public/css/style.css index 4720cf0c2e40..3a8481632091 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -54,7 +54,7 @@ padding-top: 10px; } textarea.form-control { /*height: auto !important;*/ -min-height: 38px; +min-height: 40px; } /*tables*/ table.dataTable { border-radius: 3px; border-collapse: collapse; From 2f207f8a7ff8878b305b6d8f204fa820c5fc9f02 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Mon, 3 Mar 2014 16:04:33 +0200 Subject: [PATCH 28/30] report fixes --- public/js/script.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 64775f08adae..7bca0f3125b4 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -797,8 +797,8 @@ function GetReportTemplate1 (invoice,checkMath) doc.setFontSize(7); doc.text(marginLeft1, line1, 'Invoice Number'); - doc.text(marginLeft1, line2, 'Invoice date'); - doc.text(marginLeft1, line3, 'Amount Due'); + doc.text(marginLeft1, line2, 'Invoice Date'); + doc.text(marginLeft1, line3, 'Balance Due'); doc.setFontType("bold"); @@ -986,7 +986,7 @@ function GetReportTemplate1 (invoice,checkMath) if ((i%2)===0){ doc.setLineWidth(0.5); - doc.setDrawColor(200,200,200); + doc.setDrawColor(230,230,230); doc.setFillColor(230,230,230); var x1 = tableLeft-tablePadding ; @@ -1050,7 +1050,7 @@ function GetReportTemplate1 (invoice,checkMath) GlobalY=x; doc.setLineWidth(0.3); - doc.setDrawColor(200,200,200); + doc.setDrawColor(251,251,251); doc.setFillColor(251,251,251); var x1 = tableLeft-tablePadding*2+14 ; var y1 = GlobalY-FontSize-tablePadding; @@ -1062,7 +1062,7 @@ function GetReportTemplate1 (invoice,checkMath) - Msg='Total'; + Msg='Subtotal'; var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); doc.text(TmpMsgX, x, Msg); @@ -1080,7 +1080,7 @@ function GetReportTemplate1 (invoice,checkMath) x += doc.internal.getFontSize()*2; //doc.text(footerLeft, x, ''); - Msg='Amount Payed'; + Msg='Paid to Date'; var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); doc.text(TmpMsgX, x, Msg); @@ -1099,7 +1099,7 @@ function GetReportTemplate1 (invoice,checkMath) doc.setFontSize(10); x += doc.internal.getFontSize()*4; //doc.text(footerLeft, x, ''); - Msg='Amount Due'; + Msg='Balance Due'; var TmpMsgX = MsgRightAlign-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); From 31377eb2267fb8e7c1581a9cd7193592539139db Mon Sep 17 00:00:00 2001 From: alltheworld Date: Mon, 3 Mar 2014 17:49:10 +0200 Subject: [PATCH 29/30] report fixes --- public/js/script.js | 50 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 7bca0f3125b4..f4485157b84d 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -900,7 +900,7 @@ function GetReportTemplate1 (invoice,checkMath) var shownItem = false; - GlobalY=GlobalY+14; //padding from top + GlobalY=GlobalY+14+10; //padding from top var FontSize=7; doc.setFontSize(FontSize); @@ -1034,8 +1034,20 @@ function GetReportTemplate1 (invoice,checkMath) + + + //-------------------------------Publishing Document balance------------------------------------------ +//check do we need to go to next page + MinHeight=700; + + if (GlobalY > MinHeight) { + + + GlobalY=Report1AddNewPage(invoice,account,doc); + } + @@ -1047,19 +1059,22 @@ function GetReportTemplate1 (invoice,checkMath) - GlobalY=x; + // GlobalY=x; + + GlobalY=GlobalY+25; doc.setLineWidth(0.3); doc.setDrawColor(251,251,251); doc.setFillColor(251,251,251); var x1 = tableLeft-tablePadding*2+14 ; 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'); - + x=y1+FontSize+tablePadding; Msg='Subtotal'; @@ -1122,6 +1137,19 @@ function GetReportTemplate1 (invoice,checkMath) } + + + + + + + + + + + + + function GetReportTemplate2 (invoice,checkMath) { var doc=false; @@ -1794,7 +1822,6 @@ function SetPdfColor(color,doc) } - function Report2AddFooter (invoice,doc) { @@ -2659,4 +2686,19 @@ function Report3AddHeader (invoice,account,doc) } +} + + +function Report1AddNewPage(invoice,account,doc) +{ + //alert(1); + doc.addPage(); + + GlobalY = 40; + return GlobalY; +} + +function Report1AddFooter(invoice,account,doc) +{ + alert(2); } \ No newline at end of file From da2ad78db43670d7a2ad912f63f337bc137a0d06 Mon Sep 17 00:00:00 2001 From: alltheworld Date: Mon, 3 Mar 2014 21:18:31 +0200 Subject: [PATCH 30/30] report fixes --- public/js/script.js | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index f4485157b84d..15f444966d4d 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -960,14 +960,16 @@ function GetReportTemplate1 (invoice,checkMath) if (h+GlobalY > MaxGlobalY) { - tableTop = 40; - GlobalY=tableTop; + //tableTop = 40; + //GlobalY=tableTop; //var MaxLinesPerPage=70; + GlobalY=Report1AddNewPage(invoice,account,doc); + /* doc.addPage(); if (invoice.imageLogo1) { @@ -980,7 +982,7 @@ function GetReportTemplate1 (invoice,checkMath) doc.addImage(invoice.imageLogo1, 'JPEG', left, y, invoice.imageLogoWidth1, invoice.imageLogoHeight1); - } + }*/ } @@ -2649,18 +2651,12 @@ if (i!=0&NewPageFlag==0) function Report3AddHeader (invoice,account,doc) { doc.setLineWidth(0.5); - //doc.setFillColor( 46,43,43); //doc.setFillColor( 46,43,43); - doc.setDrawColor(242,101,34); doc.setFillColor(242,101,34); - - var x1 =0; - var y1 = 0; - var w2 = 595; var h2 = 140; doc.rect(x1, y1, w2, h2, 'FD'); @@ -2669,11 +2665,8 @@ function Report3AddHeader (invoice,account,doc) //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) { //SetPdfColor('SomeGreen',doc); @@ -2691,14 +2684,16 @@ function Report3AddHeader (invoice,account,doc) function Report1AddNewPage(invoice,account,doc) { - //alert(1); doc.addPage(); + if (invoice.imageLogo1) + { + pageHeight=820; + y=pageHeight-invoice.imageLogoHeight1; + var left = 20;//headerRight - invoice.imageLogoWidth1; + doc.addImage(invoice.imageLogo1, 'JPEG', left, y, invoice.imageLogoWidth1, invoice.imageLogoHeight1); + + } GlobalY = 40; return GlobalY; } - -function Report1AddFooter(invoice,account,doc) -{ - alert(2); -} \ No newline at end of file