[Vtigercrm-commits] [vtiger-commits] r9998 - in /vtigercrm/branches/5.0.3: include/fpdf/ include/fpdf/templates/ modules/Invoice/ modules/Invoice/pdf_templates/ modules/PurchaseOrder/ modules/PurchaseOrder/pdf_templates/ modules/Quotes/ modules/Quotes/pdf_templates/ modules/SalesOrder/ modules/SalesOrder/pdf_templates/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed Dec 27 10:43:59 EST 2006
Author: richie
Date: Wed Dec 27 08:43:45 2006
New Revision: 9998
Log:
* Modified to configure easily ie., change the bottom and top pixels and number of products easily to avoid the description wrap
Added:
vtigercrm/branches/5.0.3/include/fpdf/pdfconfig.php
Modified:
vtigercrm/branches/5.0.3/include/fpdf/templates/body.php
vtigercrm/branches/5.0.3/modules/Invoice/CreatePDF.php
vtigercrm/branches/5.0.3/modules/Invoice/pdf_templates/footer.php
vtigercrm/branches/5.0.3/modules/PurchaseOrder/CreatePDF.php
vtigercrm/branches/5.0.3/modules/PurchaseOrder/pdf_templates/footer.php
vtigercrm/branches/5.0.3/modules/Quotes/CreatePDF.php
vtigercrm/branches/5.0.3/modules/Quotes/pdf_templates/footer.php
vtigercrm/branches/5.0.3/modules/SalesOrder/CreateSOPDF.php
vtigercrm/branches/5.0.3/modules/SalesOrder/pdf_templates/footer.php
Modified: vtigercrm/branches/5.0.3/include/fpdf/templates/body.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/fpdf/templates/body.php (original)
+++ vtigercrm/branches/5.0.3/include/fpdf/templates/body.php Wed Dec 27 08:43:45 2006
@@ -6,10 +6,10 @@
$waterMarkRotate=array("45","50","180");
$pdf->watermark( $status, $waterMarkPositions, $waterMarkRotate );
-$bottom="130";
-$top="80";
+include("include/fpdf/pdfconfig.php");
+
// blow a bubble around the table
-$Bubble=array("10",$top,"170","$bottom");
+$Bubble=array("10",$body_top,"170","$bottom");
$pdf->tableWrapper($Bubble);
/* ************ Begin Table Setup ********************** */
@@ -19,7 +19,9 @@
// correctly
$prodTable=array("10","60");
-if($focus->column_fields["hdnTaxType"] == "individual") {
+//if taxtype is individual
+if($focus->column_fields["hdnTaxType"] == "individual")
+{
$colsAlign["Product Name"] = "L";
$colsAlign["Description"] = "L";
$colsAlign["Qty"] = "R";
@@ -35,7 +37,10 @@
$cols["Discount"] = "15";
$cols["Tax"] = "20";
$cols["Total"] = "25";
-} else {
+}
+else
+{
+ //if taxtype is group
$colsAlign["Product Name"] = "L";
$colsAlign["Description"] = "L";
$colsAlign["Qty"] = "R";
@@ -61,8 +66,9 @@
/* ************* Begin Product Population *************** */
$ppad=3;
-$y = $top+10;
-for($i=0;$i<count($product_name);$i++) {
+$y = $body_top+10;
+for($i=0;$i<count($product_name);$i++)
+{
$size = $pdf->addProductLine( $y, $line[$i] );
$y += $size+$ppad;
}
@@ -73,17 +79,20 @@
/* ************* Begin Totals ************************** */
$t=$bottom+56;
$pad=6;
-for($i=0;$i<count($total);$i++) {
+for($i=0;$i<count($total);$i++)
+{
$size = $pdf->addProductLine( $t, $total[$i], $total[$i] );
$t += $pad;
}
-
-if($focus->column_fields["hdnTaxType"] != "individual") {
+//Set the x and y positions to place the NetTotal, Discount, S&H charge
+//if taxtype is not individual ie., group tax
+if($focus->column_fields["hdnTaxType"] != "individual")
+{
$lineData=array("105",$bottom+37,"94");
$pdf->drawLine($lineData);
$data= $app_strings['LBL_NET_TOTAL'].": ".$price_subtotal."";
- $pdf->SetXY( 105 , 168 );
+ $pdf->SetXY( 105 , ($nettotal_y+(0*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
@@ -95,29 +104,32 @@
$data= $app_strings['LBL_DISCOUNT'].": $final_price_discount_percent ".$price_discount."";
else
$data= $app_strings['LBL_DISCOUNT'].": ".$price_discount."";
- $pdf->SetXY( 105 , 174 );
+ $pdf->SetXY( 105 , ($nettotal_y+(1*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
$lineData=array("105",$bottom+49,"94");
$pdf->drawLine($lineData);
$data= $app_strings['LBL_TAX'].": ($group_total_tax_percent %) ".$price_salestax."";
- $pdf->SetXY( 105 , 180 );
+ $pdf->SetXY( 105 , ($nettotal_y+(2*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
$lineData=array("105",$bottom+55,"94");
$pdf->drawLine($lineData);
$data = $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGES'].": ".$price_shipping;
- $pdf->SetXY( 105 , 186 );
+ $pdf->SetXY( 105 , ($nettotal_y+(3*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
-} else {
+}
+else
+{
+ //if taxtype is individual
$lineData=array("105",$bottom+43,"94");
$pdf->drawLine($lineData);
$data= $app_strings['LBL_NET_TOTAL'].": ".$price_subtotal."";
- $pdf->SetXY( 105 , 174 );
+ $pdf->SetXY( 105 , ($nettotal_y+(1*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
@@ -130,36 +142,37 @@
else
$data= $app_strings['LBL_DISCOUNT'].": ".$price_discount."";
- $pdf->SetXY( 105 , 180 );
+ $pdf->SetXY( 105 , ($nettotal_y+(2*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
$lineData=array("105",$bottom+55,"94");
$pdf->drawLine($lineData);
$data = $app_strings['LBL_SHIPPING_AND_HANDLING_CHARGES'].": ".$price_shipping;
- $pdf->SetXY( 105 , 186 );
+ $pdf->SetXY( 105 , ($nettotal_y+(3*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
}
+//Set the x and y positions to place the S&H Tax, Adjustment and Grand Total
$lineData=array("105",$bottom+61,"94");
$pdf->drawLine($lineData);
$data = $app_strings['LBL_TAX_FOR_SHIPPING_AND_HANDLING'].": ($sh_tax_percent %) ".$price_shipping_tax;
-$pdf->SetXY( 105 , 192 );
+$pdf->SetXY( 105 , ($nettotal_y+(4*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
$lineData=array("105",$bottom+67,"94");
$pdf->drawLine($lineData);
$data = $app_strings['LBL_ADJUSTMENT'].": ".$price_adjustment;
-$pdf->SetXY( 105 , 198 );
+$pdf->SetXY( 105 , ($nettotal_y+(5*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
$lineData=array("105",$bottom+73,"94");
$pdf->drawLine($lineData);
$data = $app_strings['LBL_GRAND_TOTAL'].":(in $currency_symbol) ".$price_total;
-$pdf->SetXY( 105 , 204 );
+$pdf->SetXY( 105 , ($nettotal_y+(6*$next_y)) );
$pdf->SetFont( "Helvetica", "", 10);
$pdf->MultiCell(110, 4, $data);
Modified: vtigercrm/branches/5.0.3/modules/Invoice/CreatePDF.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Invoice/CreatePDF.php (original)
+++ vtigercrm/branches/5.0.3/modules/Invoice/CreatePDF.php Wed Dec 27 08:43:45 2006
@@ -11,17 +11,17 @@
require_once('include/fpdf/pdf.php');
+require_once('include/fpdf/pdfconfig.php');
require_once('modules/Invoice/Invoice.php');
require_once('include/database/PearDatabase.php');
-global $adb,$app_strings,$products_per_page,$focus;
+global $adb,$app_strings,$focus;
$sql="select currency_symbol from vtiger_currency_info";
$result = $adb->query($sql);
$currency_symbol = $adb->query_result($result,0,'currency_symbol');
// would you like and end page? 1 for yes 0 for no
$endpage="1";
-$products_per_page="6";
$id = $_REQUEST['record'];
@@ -215,7 +215,14 @@
$pdf->AddPage();
include("pdf_templates/header.php");
include("include/fpdf/templates/body.php");
- include("pdf_templates/footer.php");
+
+ //if bottom > 145 then we skip the Description and T&C in every page and display only in lastpage
+ //if you want to display the description and T&C in each page then set the display_desc_tc='true' and bottom <= 145 in pdfconfig.php
+ if($display_desc_tc == 'true')
+ if($bottom <= 145)
+ {
+ include("pdf_templates/footer.php");
+ }
$page_num++;
Modified: vtigercrm/branches/5.0.3/modules/Invoice/pdf_templates/footer.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Invoice/pdf_templates/footer.php (original)
+++ vtigercrm/branches/5.0.3/modules/Invoice/pdf_templates/footer.php Wed Dec 27 08:43:45 2006
@@ -12,8 +12,6 @@
define('USD',"$");
define('EURO', chr(128) );
-
-$top="215";
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
Modified: vtigercrm/branches/5.0.3/modules/PurchaseOrder/CreatePDF.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/PurchaseOrder/CreatePDF.php (original)
+++ vtigercrm/branches/5.0.3/modules/PurchaseOrder/CreatePDF.php Wed Dec 27 08:43:45 2006
@@ -10,6 +10,7 @@
********************************************************************************/
require('include/fpdf/pdf.php');
+require_once('include/fpdf/pdfconfig.php');
require_once('modules/PurchaseOrder/PurchaseOrder.php');
require_once('include/database/PearDatabase.php');
@@ -21,8 +22,6 @@
// would you like and end page? 1 for yes 0 for no
$endpage="1";
-global $products_per_page;
-$products_per_page="6";
$id = $_REQUEST['record'];
//retreiving the vtiger_invoice info
@@ -217,7 +216,14 @@
$pdf->AddPage();
include("pdf_templates/header.php");
include("include/fpdf/templates/body.php");
- include("pdf_templates/footer.php");
+
+ //if bottom > 145 then we skip the Description and T&C in every page and display only in lastpage
+ //if you want to display the description and T&C in each page then set the display_desc_tc='true' and bottom <= 145 in pdfconfig.php
+ if($display_desc_tc == 'true')
+ if($bottom <= 145)
+ {
+ include("pdf_templates/footer.php");
+ }
$page_num++;
Modified: vtigercrm/branches/5.0.3/modules/PurchaseOrder/pdf_templates/footer.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/PurchaseOrder/pdf_templates/footer.php (original)
+++ vtigercrm/branches/5.0.3/modules/PurchaseOrder/pdf_templates/footer.php Wed Dec 27 08:43:45 2006
@@ -12,8 +12,6 @@
define('USD',"$");
define('EURO', chr(128) );
-
-$top="215";
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
Modified: vtigercrm/branches/5.0.3/modules/Quotes/CreatePDF.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Quotes/CreatePDF.php (original)
+++ vtigercrm/branches/5.0.3/modules/Quotes/CreatePDF.php Wed Dec 27 08:43:45 2006
@@ -11,6 +11,7 @@
require_once('include/fpdf/pdf.php');
+require_once('include/fpdf/pdfconfig.php');
require_once('modules/Quotes/Quotes.php');
require_once('include/database/PearDatabase.php');
@@ -22,8 +23,6 @@
// would you like and end page? 1 for yes 0 for no
$endpage="1";
-global $products_per_page;
-$products_per_page="6";
$focus = new Quotes();
$focus->retrieve_entity_info($_REQUEST['record'],"Quotes");
@@ -218,7 +217,14 @@
$pdf->AddPage();
include("pdf_templates/header.php");
include("include/fpdf/templates/body.php");
- include("pdf_templates/footer.php");
+
+ //if bottom > 145 then we skip the Description and T&C in every page and display only in lastpage
+ //if you want to display the description and T&C in each page then set the display_desc_tc='true' and bottom <= 145 in pdfconfig.php
+ if($display_desc_tc == 'true')
+ if($bottom <= 145)
+ {
+ include("pdf_templates/footer.php");
+ }
$page_num++;
Modified: vtigercrm/branches/5.0.3/modules/Quotes/pdf_templates/footer.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Quotes/pdf_templates/footer.php (original)
+++ vtigercrm/branches/5.0.3/modules/Quotes/pdf_templates/footer.php Wed Dec 27 08:43:45 2006
@@ -9,9 +9,6 @@
*
********************************************************************************/
-
-
-$top="215";
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
Modified: vtigercrm/branches/5.0.3/modules/SalesOrder/CreateSOPDF.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/SalesOrder/CreateSOPDF.php (original)
+++ vtigercrm/branches/5.0.3/modules/SalesOrder/CreateSOPDF.php Wed Dec 27 08:43:45 2006
@@ -11,10 +11,11 @@
require('include/fpdf/pdf.php');
+require_once('include/fpdf/pdfconfig.php');
require_once('modules/SalesOrder/SalesOrder.php');
require_once('include/database/PearDatabase.php');
-global $adb,$app_strings,$products_per_page;
+global $adb,$app_strings;
$sql="select currency_symbol from vtiger_currency_info";
$result = $adb->query($sql);
@@ -22,7 +23,6 @@
// would you like and end page? 1 for yes 0 for no
$endpage="1";
-$products_per_page="6";
$id = $_REQUEST['record'];
//retreiving the vtiger_invoice info
@@ -216,7 +216,14 @@
$pdf->AddPage();
include("pdf_templates/header.php");
include("include/fpdf/templates/body.php");
- include("pdf_templates/footer.php");
+
+ //if bottom > 145 then we skip the Description and T&C in every page and display only in lastpage
+ //if you want to display the description and T&C in each page then set the display_desc_tc='true' and bottom <= 145 in pdfconfig.php
+ if($display_desc_tc == 'true')
+ if($bottom <= 145)
+ {
+ include("pdf_templates/footer.php");
+ }
$page_num++;
Modified: vtigercrm/branches/5.0.3/modules/SalesOrder/pdf_templates/footer.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/SalesOrder/pdf_templates/footer.php (original)
+++ vtigercrm/branches/5.0.3/modules/SalesOrder/pdf_templates/footer.php Wed Dec 27 08:43:45 2006
@@ -12,8 +12,6 @@
define('USD',"$");
define('EURO', chr(128) );
-
-$top="215";
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
More information about the vtigercrm-commits
mailing list