|
From: <dai...@us...> - 2011-02-08 09:20:57
|
Revision: 4486
http://web-erp.svn.sourceforge.net/web-erp/?rev=4486&view=rev
Author: daintree
Date: 2011-02-08 09:20:50 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
PDFQuotation - Ricards multi-line issue on narrative
Modified Paths:
--------------
trunk/PDFGrn.php
trunk/PDFQuotation.php
trunk/Payments.php
trunk/StockLocTransfer.php
trunk/doc/Change.log.html
trunk/includes/PDFQuotationPageHeader.inc
trunk/includes/class.pdf.php
trunk/javascripts/MiscFunctions.js
Modified: trunk/PDFGrn.php
===================================================================
--- trunk/PDFGrn.php 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/PDFGrn.php 2011-02-08 09:20:50 UTC (rev 4486)
@@ -21,20 +21,24 @@
$pdf->addInfo('Title', _('Goods Received Note') );
if ($GRNNo == 'Preview'){
- $myrow['itemcode'] = strpad('', 15,'x');
+ $myrow['itemcode'] = str_pad('', 15,'x');
$myrow['deliverydate'] = '0000-00-00';
- $myrow['itemdescription'] = strpad('', 30,'x');
- $myrow['qtyrecd'] = 99999.99;
- $myrow['supplierid'] = strpad('', 10,'x');
- $myrow['suppliersunit'] = strpad('', 10,'x');
- $myrow['units'] = strpad('', 10,'x');
- $SuppRow['suppname'] = strpad('', 30,'x');
- $SuppRow['address1'] = strpad('', 30,'x');
- $SuppRow['address2'] = strpad('', 30,'x');
- $SuppRow['address3'] = strpad('', 20,'x');
- $SuppRow['address4'] = strpad('', 20,'x');
- $SuppRow['address5'] = strpad('', 10,'x');
- $SuppRow['address6'] = strpad('', 10,'x');
+ $myrow['itemdescription'] = str_pad('', 30,'x');
+ $myrow['qtyrecd'] = 99999999.99;
+ $myrow['decimalplaces'] =2;
+ $myrow['conversionfactor']=1;
+ $myrow['supplierid'] = str_pad('', 10,'x');
+ $myrow['suppliersunit'] = str_pad('', 10,'x');
+ $myrow['units'] = str_pad('', 10,'x');
+
+ $SuppRow['suppname'] = str_pad('', 30,'x');
+ $SuppRow['address1'] = str_pad('', 30,'x');
+ $SuppRow['address2'] = str_pad('', 30,'x');
+ $SuppRow['address3'] = str_pad('', 30,'x');
+ $SuppRow['address4'] = str_pad('', 20,'x');
+ $SuppRow['address5'] = str_pad('', 10,'x');
+ $SuppRow['address6'] = str_pad('', 10,'x');
+ $NoOfGRNs =1;
} else { //NOT PREVIEW
$sql="SELECT grns.itemcode,
@@ -54,8 +58,8 @@
WHERE grnbatch='".$GRNNo."'";
$GRNResult=DB_query($sql, $db);
-
- if(DB_num_rows($GRNResult)>0) { //there are GRNs to print
+ $NoOfGRNs = DB_num_rows($GRNResult);
+ if($NoOfGRNs>0) { //there are GRNs to print
$sql = "SELECT suppliers.suppname,
suppliers.address1,
@@ -71,11 +75,14 @@
$SuppRow = DB_fetch_array($SuppResult);
}
} // get data to print
+if ($NoOfGRNs >0){
include ('includes/PDFGrnHeader.inc'); //head up the page
$YPos=$FormDesign->Data->y;
- while ($myrow = DB_fetch_array($GRNResult)) {
-
+ for ($i=1;$i<=$NoOfGRNs;$i++) {
+ if ($GRNNo!='Preview'){
+ $myrow = DB_fetch_array($GRNResult);
+ }
if (is_numeric($myrow['decimalplaces'])){
$DecimalPlaces=$myrow['decimalplaces'];
} else {
@@ -111,7 +118,7 @@
$pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN
$pdf->__destruct(); //UldisN
} else { //there were not GRNs to print
- $title = _('GRN Error');
+ $title = _('GRN Error');
include('includes/header.inc');
prnMsg(_('There were no GRNs to print'),'warn');
echo '<br><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>';
Modified: trunk/PDFQuotation.php
===================================================================
--- trunk/PDFQuotation.php 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/PDFQuotation.php 2011-02-08 09:20:50 UTC (rev 4486)
@@ -86,7 +86,7 @@
$pdf->addInfo('Subject', _('Quotation') . ' ' . $_GET['QuotationNo']);
$FontSize=12;
$PageNumber = 1;
-$line_height=24;
+$line_height=15;
// $pdf->selectFont('./fonts/Helvetica.afm');
/* Now ... Has the order got any line items still outstanding to be invoiced */
@@ -171,11 +171,11 @@
$LeftOvers = $pdf->addTextWrap(650,$YPos,85,$FontSize,$DisplayTaxAmount,'right');
$LeftOvers = $pdf->addTextWrap(700,$YPos,90,$FontSize,$DisplayTotal,'right');
if (strlen($myrow2['narrative'])>1){
- $YPos -= 10;
- $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,750,10,$myrow2['narrative']);
- if (strlen($LeftOvers>1)){
- $YPos -= 10;
- $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,750,10,$LeftOvers);
+ $YPos -= ($line_height);
+ $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,800,$FontSize,$myrow2['narrative']);
+ if (strlen($LeftOvers) >1){
+ $YPos -= 11;
+ $LeftOvers = $pdf->addTextWrap($XPos+1,$YPos,800,$FontSize,$LeftOvers);
}
}
$QuotationTotal +=$LineTotal;
@@ -186,13 +186,13 @@
$YPos -= ($line_height);
} //end while there are line items to print out
+
if ((strlen($myrow['comments']) >200 AND $YPos-$line_height <= 75)
OR (strlen($myrow['comments']) >1 AND $YPos-$line_height <= 62)
OR $YPos-$line_height <= 50){
- /* We reached the end of the page so finsih off the page and start a newy */
+ /* We reached the end of the page so finish off the page and start a newy */
$PageNumber++;
include ('includes/PDFQuotationPageHeader.inc');
-
} //end if need a new page headed up
$LeftOvers = $pdf->addTextWrap($XPos,$YPos-80,200,10,_('Notes:'));
Modified: trunk/Payments.php
===================================================================
--- trunk/Payments.php 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/Payments.php 2011-02-08 09:20:50 UTC (rev 4486)
@@ -870,12 +870,12 @@
ORDER BY tagref';
$result=DB_query($SQL,$db);
- echo '<option value=0></option';
+ echo '<option value=0></option>';
while ($myrow=DB_fetch_array($result)){
if (isset($_POST['tag']) and $_POST['tag']==$myrow["tagref"]){
- echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'];
+ echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>';
} else {
- echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'];
+ echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>';
}
}
echo '</select></td></tr>';
@@ -884,13 +884,10 @@
/*now set up a GLCode field to select from avaialble GL accounts */
if (isset($_POST['GLManualCode'])) {
echo '<tr><td>' . _('Enter GL Account Manually') . ':</td>
- <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, this.value, GLCode.options,'.
- "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' .
- ' value='. $_POST['GLManualCode'] .' ></td></tr>';
+ <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value='. $_POST['GLManualCode'] .' ></td></tr>';
} else {
echo '<tr><td>' . _('Enter GL Account Manually') . ':</td>
- <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, this.value, GLCode.options,'.
- "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>';
+ <td><input type=Text class="number" Name="GLManualCode" Maxlength=12 size=12 onChange="return inArray(this, GLCode.options,'. "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"></td></tr>';
}
echo '<tr><td>' . _('Select GL Account') . ':</td>
<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">';
Modified: trunk/StockLocTransfer.php
===================================================================
--- trunk/StockLocTransfer.php 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/StockLocTransfer.php 2011-02-08 09:20:50 UTC (rev 4486)
@@ -47,12 +47,12 @@
$ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br>';
}
- // Only if stock exist at this location
+ // Only if stock exists at this location
$result = DB_query("SELECT quantity FROM locstock WHERE stockid='" . $_POST['StockID' . $i] . "' and loccode='".$_POST['FromStockLocation']."'",$db);
$myrow = DB_fetch_row($result);
- if ($myrow[0] <= $_POST['StockQTY' . $i]){
+ if ($myrow[0] < $_POST['StockQTY' . $i]){
$InputError = True;
- $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br>';
+ $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />';
$_POST['LinesCounter'] -= 10;
}
DB_free_result( $result );
Modified: trunk/doc/Change.log.html
===================================================================
--- trunk/doc/Change.log.html 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/doc/Change.log.html 2011-02-08 09:20:50 UTC (rev 4486)
@@ -1,6 +1,9 @@
<p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p
<p></p>
-<p>7/2/11: Phil PDFGrn.php turns out preview is used from the form modification script doh! Over simplificaton reversed to reinstate preview mode<p>
+<p>8/2/11: Phil Fix incorrect layout of narrative on multiple lines of PDFQuotation.php as reported by Ricard Andreu</p>
+<p>8/2/11: Tim/Ricard StockLocTransfer.php can now transfer the same amount as on hand in the location - previously checked to see that the transfer was less than the quantity on hand (when checking for negative stock)</p>
+<p>8/2/11: Tim Payments.php and javascripts/MiscFunctions.js corrections to javascript</p>
+<p>8/2/11: Phil PDFGrn.php turns out preview is used from the form modification script doh! Over simplificaton reversed to reinstate preview mode<p>
<p>6/2/11: Otandeka Removed debug prnMsg in FixedAssetDepreciation</p>
<p>5/2/11: Phil SystemParameters.php new option to AutoAuthorisePO when the user has authority to do so</p>
<p>5/2/11: Phil PO_Items.php fixed non-existant variables on Enter nominal line. Added option to automatically authorise when user is an authoriser as well as a creator</p>
Modified: trunk/includes/PDFQuotationPageHeader.inc
===================================================================
--- trunk/includes/PDFQuotationPageHeader.inc 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/includes/PDFQuotationPageHeader.inc 2011-02-08 09:20:50 UTC (rev 4486)
@@ -14,7 +14,7 @@
$FontSize=18;
$pdf->addText($XPos, 500,$FontSize, _('Quotation'));
$FontSize=14;
-$YPos = 480;
+$YPos = 482;
$pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']);
$FontSize =10;
$pdf->addText($XPos, $YPos-12,$FontSize, $_SESSION['CompanyRecord']['regoffice1']);
@@ -44,7 +44,7 @@
$XPos= 50;
-$YPos += 25;
+$YPos += 12;
/*draw a nice curved corner box around the delivery details */
/*from the top right */
$pdf->partEllipse($XPos+225,$YPos+60,0,90,10,10);
@@ -106,32 +106,28 @@
$LeftOvers = $pdf->addTextWrap(650,$YPos,85,$FontSize, _('Tax Amount'),'right');
$LeftOvers = $pdf->addTextWrap(700,$YPos,90,$FontSize, _('Total'),'right');
-
/*draw a box with nice round corner for entering line items */
/*90 degree arc at top right of box 0 degrees starts a bottom */
-$pdf->partEllipse($Page_Width-$Right_Margin-10, $Bottom_Margin+370,0,90,10,10);
+$pdf->partEllipse($Page_Width-$Right_Margin-10, $Bottom_Margin+350,0,90,10,10);
/*line to the top left */
-$pdf->line($Page_Width-$Right_Margin-10, $Bottom_Margin+380,$Left_Margin+10, $Bottom_Margin+380);
+$pdf->line($Page_Width-$Right_Margin-10, $Bottom_Margin+360,$Left_Margin+10, $Bottom_Margin+360);
/*line under headings to top left */
-$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+355,$Left_Margin, $Bottom_Margin+355);
+$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+335,$Left_Margin, $Bottom_Margin+335);
/*Dow top left corner */
-$pdf->partEllipse($Left_Margin+10, $Bottom_Margin+370,90,180,10,10);
+$pdf->partEllipse($Left_Margin+10, $Bottom_Margin+350,90,180,10,10);
/*Do a line to the bottom left corner */
-$pdf->line($Left_Margin, $Bottom_Margin+370,$Left_Margin, $Bottom_Margin+10);
+$pdf->line($Left_Margin, $Bottom_Margin+350,$Left_Margin, $Bottom_Margin+10);
/*Now do the bottom left corner 180 - 270 coming back west*/
$pdf->partEllipse($Left_Margin+10, $Bottom_Margin+10,180,270,10,10);
/*Now a line to the bottom right */
$pdf->line($Left_Margin+10, $Bottom_Margin,$Page_Width-$Right_Margin-10, $Bottom_Margin);
/*Now do the bottom right corner */
-$pdf->partEllipse($Page_Width-$Right_Margin-10, $Bottom_Margin+10,270,360,10,10);
+$pdf->partEllipse($Page_Width-$Right_Margin-10, $Bottom_Margin+10,270,350,10,10);
/*Finally join up to the top right corner where started */
-$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+10,$Page_Width-$Right_Margin, $Bottom_Margin+370);
+$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+10,$Page_Width-$Right_Margin, $Bottom_Margin+350);
-$YPos -= $line_height;
-
-$FontSize =12;
-
+$YPos -= (2*$line_height);
?>
Modified: trunk/includes/class.pdf.php
===================================================================
--- trunk/includes/class.pdf.php 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/includes/class.pdf.php 2011-02-08 09:20:50 UTC (rev 4486)
@@ -18,311 +18,311 @@
require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');
if (!class_exists('Cpdf', false)) {
-
-class Cpdf extends TCPDF {
-
- public function __construct($DocOrientation='P', $DocUnits='mm', $DocPaper='A4') {
-
- parent::__construct($DocOrientation, $DocUnits, $DocPaper, true, 'utf-8', false);
-
- $this->setuserpdffont();
- }
-
- protected function setuserpdffont() {
-
- if (session_id()=='') {
- session_start();
+
+ class Cpdf extends TCPDF {
+
+ public function __construct($DocOrientation='P', $DocUnits='mm', $DocPaper='A4') {
+
+ parent::__construct($DocOrientation, $DocUnits, $DocPaper, true, 'utf-8', false);
+
+ $this->setuserpdffont();
}
-
- if (isset($_SESSION['PDFLanguage'])) {
-
- $UserPdfLang = $_SESSION['PDFLanguage'];
-
- switch ($UserPdfLang) {
- case 0: $UserPdfFont = 'times'; break;
- case 1: $UserPdfFont = 'javierjp'; break;
- case 2: $UserPdfFont = 'javiergb'; break;
+
+ protected function setuserpdffont() {
+
+ if (session_id()=='') {
+ session_start();
}
-
- } else {
- $UserPdfFont = 'helvetica';
+
+ if (isset($_SESSION['PDFLanguage'])) {
+
+ $UserPdfLang = $_SESSION['PDFLanguage'];
+
+ switch ($UserPdfLang) {
+ case 0: $UserPdfFont = 'times'; break;
+ case 1: $UserPdfFont = 'javierjp'; break;
+ case 2: $UserPdfFont = 'javiergb'; break;
+ }
+
+ } else {
+ $UserPdfFont = 'helvetica';
+ }
+
+ $this->SetFont($UserPdfFont, '', 11);
+ // SetFont($family, $style='', $size=0, $fontfile='')
}
-
- $this->SetFont($UserPdfFont, '', 11);
- // SetFont($family, $style='', $size=0, $fontfile='')
- }
-
-
- function newPage() {
-/* Javier: $this->setPrintHeader(false); This is not a removed call but added in. */
- $this->AddPage();
- }
-
- function line($x1,$y1,$x2,$y2,$style=array()) {
-// Javier FPDF::line($x1, $this->h-$y1, $x2, $this->h-$y2);
-// Javier: width, color and style might be edited
- TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2,$style);
- }
-
- function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0)
- {
-// Javier $text = html_entity_decode($text);
- $this->SetFontSize($size);
- $this->Text($xb, $this->h-$yb, $text);
- }
-
- function addInfo($label, $value) {
- if ($label == 'Creator') {
-
-/* Javier: Some scripts set the creator to be WebERP like this
- $pdf->addInfo('Creator', 'WebERP http://www.weberp.org');
- But the Creator is TCPDF by Nicola Asuni, PDF_CREATOR is defined as 'TCPDF' in tcpdf/config/tcpdfconfig.php
-*/ $this->SetCreator(PDF_CREATOR);
+
+
+ function newPage() {
+ /* Javier: $this->setPrintHeader(false); This is not a removed call but added in. */
+ $this->AddPage();
}
- if ($label == 'Author') {
-/* Javier: Many scripts set the author to be WebERP like this
- $pdf->addInfo('Author', 'WebERP ' . $Version);
- But the Author might be set to be the user or make it constant here.
-*/ $this->SetAuthor( $value );
+
+ function line($x1,$y1,$x2,$y2,$style=array()) {
+ // Javier FPDF::line($x1, $this->h-$y1, $x2, $this->h-$y2);
+ // Javier: width, color and style might be edited
+ TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2,$style);
}
- if ($label == 'Title') {
- $this->SetTitle( $value );
+
+ function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0)
+ {
+ // Javier $text = html_entity_decode($text);
+ $this->SetFontSize($size);
+ $this->Text($xb, $this->h-$yb, $text);
}
- if ($label == 'Subject') {
- $this->SetSubject( $value );
+
+ function addInfo($label, $value) {
+ if ($label == 'Creator') {
+
+ /* Javier: Some scripts set the creator to be WebERP like this
+ $pdf->addInfo('Creator', 'WebERP http://www.weberp.org');
+ But the Creator is TCPDF by Nicola Asuni, PDF_CREATOR is defined as 'TCPDF' in tcpdf/config/tcpdfconfig.php
+ */ $this->SetCreator(PDF_CREATOR);
+ }
+ if ($label == 'Author') {
+ /* Javier: Many scripts set the author to be WebERP like this
+ $pdf->addInfo('Author', 'WebERP ' . $Version);
+ But the Author might be set to be the user or make it constant here.
+ */ $this->SetAuthor( $value );
+ }
+ if ($label == 'Title') {
+ $this->SetTitle( $value );
+ }
+ if ($label == 'Subject') {
+ $this->SetSubject( $value );
+ }
+ if ($label == 'Keywords') {
+ $this->SetKeywords( $value );
+ }
}
- if ($label == 'Keywords') {
- $this->SetKeywords( $value );
+
+
+ function addJpegFromFile($img,$x,$y,$w=0,$h=0){
+ $this->Image($img, $x, $this->h-$y-$h, $w, $h);
}
- }
-
-
- function addJpegFromFile($img,$x,$y,$w=0,$h=0){
- $this->Image($img, $x, $this->h-$y-$h, $w, $h);
- }
-
- /*
- * Next Two functions are adopted from R&OS pdf class
- */
-
- /**
- * draw a part of an ellipse
- */
- function partEllipse($x0,$y0,$astart,$afinish,$r1,$r2=0,$angle=0,$nSeg=8) {
- $this->ellipse($x0,$y0,$r1,$r2,$angle,$nSeg,$astart,$afinish,0);
- }
-
- /**
- * draw an ellipse
- * note that the part and filled ellipse are just special cases of this function
- *
- * draws an ellipse in the current line style
- * centered at $x0,$y0, radii $r1,$r2
- * if $r2 is not set, then a circle is drawn
- * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a
- * pretty crappy shape at 2, as we are approximating with bezier curves.
- */
- function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0,$fill_color=array(),$nc=8) {
-
- if ($r1==0){
- return;
+
+ /*
+ * Next Two functions are adopted from R&OS pdf class
+ */
+
+ /**
+ * draw a part of an ellipse
+ */
+ function partEllipse($x0,$y0,$astart,$afinish,$r1,$r2=0,$angle=0,$nSeg=8) {
+ $this->ellipse($x0,$y0,$r1,$r2,$angle,$nSeg,$astart,$afinish,0);
}
- if ($r2==0){
- $r2=$r1;
+
+ /**
+ * draw an ellipse
+ * note that the part and filled ellipse are just special cases of this function
+ *
+ * draws an ellipse in the current line style
+ * centered at $x0,$y0, radii $r1,$r2
+ * if $r2 is not set, then a circle is drawn
+ * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a
+ * pretty crappy shape at 2, as we are approximating with bezier curves.
+ */
+ function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0,$fill_color=array(),$nc=8) {
+
+ if ($r1==0){
+ return;
+ }
+ if ($r2==0){
+ $r2=$r1;
+ }
+ if ($nSeg<2){
+ $nSeg=2;
+ }
+
+ $astart = deg2rad((float)$astart);
+ $afinish = deg2rad((float)$afinish);
+ $totalAngle =$afinish-$astart;
+
+ $dt = $totalAngle/$nSeg;
+ $dtm = $dt/3;
+
+ if ($angle != 0){
+ $a = -1*deg2rad((float)$angle);
+ $tmp = "\n q ";
+ $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
+ $tmp .= sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' cm';
+ $x0=0;
+ $y0=0;
+ } else {
+ $tmp='';
+ }
+
+ $t1 = $astart;
+ $a0 = $x0+$r1*cos($t1);
+ $b0 = $y0+$r2*sin($t1);
+ $c0 = -$r1*sin($t1);
+ $d0 = $r2*cos($t1);
+
+ $tmp.="\n".sprintf('%.3f',$a0).' '.sprintf('%.3f',$b0).' m ';
+ for ($i=1;$i<=$nSeg;$i++){
+ // draw this bit of the total curve
+ $t1 = $i*$dt+$astart;
+ $a1 = $x0+$r1*cos($t1);
+ $b1 = $y0+$r2*sin($t1);
+ $c1 = -$r1*sin($t1);
+ $d1 = $r2*cos($t1);
+ $tmp.="\n".sprintf('%.3f',($a0+$c0*$dtm)).' '.sprintf('%.3f',($b0+$d0*$dtm));
+ $tmp.= ' '.sprintf('%.3f',($a1-$c1*$dtm)).' '.sprintf('%.3f',($b1-$d1*$dtm)).' '.sprintf('%.3f',$a1).' '.sprintf('%.3f',$b1).' c';
+ $a0=$a1;
+ $b0=$b1;
+ $c0=$c1;
+ $d0=$d1;
+ }
+ if ($fill){
+ //$this->objects[$this->currentContents]['c']
+ $tmp.=' f';
+ } else {
+ if ($close){
+ $tmp.=' s'; // small 's' signifies closing the path as well
+ } else {
+ $tmp.=' S';
+ }
+ }
+ if ($angle !=0) {
+ $tmp .=' Q';
+ }
+ $this->_out($tmp);
}
- if ($nSeg<2){
- $nSeg=2;
+
+ /* Javier:
+ A file's name is needed if we don't want file extension to be .php
+ TCPDF has a different behaviour than FPDF, the recursive scripts needs D.
+ The admin/user may change I to D to force all pdf to be downloaded or open in a desktop app instead the browser plugin, but not vice-versa.
+ The admin/user may change I and D to F to save all pdf in the server for Document Management.
+ */
+
+ function OutputI($DocumentFilename = 'Document.pdf') {
+ if (($DocumentFilename == null) or ($DocumentFilename == '')) {
+ $DocumentFilename = _('Document.pdf');
+ }
+ $this->Output($DocumentFilename,'I');
}
-
- $astart = deg2rad((float)$astart);
- $afinish = deg2rad((float)$afinish);
- $totalAngle =$afinish-$astart;
-
- $dt = $totalAngle/$nSeg;
- $dtm = $dt/3;
-
- if ($angle != 0){
- $a = -1*deg2rad((float)$angle);
- $tmp = "\n q ";
- $tmp .= sprintf('%.3f',cos($a)).' '.sprintf('%.3f',(-1.0*sin($a))).' '.sprintf('%.3f',sin($a)).' '.sprintf('%.3f',cos($a)).' ';
- $tmp .= sprintf('%.3f',$x0).' '.sprintf('%.3f',$y0).' cm';
- $x0=0;
- $y0=0;
- } else {
- $tmp='';
+
+ function OutputD($DocumentFilename = 'Document.pdf') {
+ if (($DocumentFilename == null) or ($DocumentFilename == '')) {
+ $DocumentFilename = _('Document.pdf');
+ }
+ $this->Output($DocumentFilename,'D');
}
-
- $t1 = $astart;
- $a0 = $x0+$r1*cos($t1);
- $b0 = $y0+$r2*sin($t1);
- $c0 = -$r1*sin($t1);
- $d0 = $r2*cos($t1);
-
- $tmp.="\n".sprintf('%.3f',$a0).' '.sprintf('%.3f',$b0).' m ';
- for ($i=1;$i<=$nSeg;$i++){
- // draw this bit of the total curve
- $t1 = $i*$dt+$astart;
- $a1 = $x0+$r1*cos($t1);
- $b1 = $y0+$r2*sin($t1);
- $c1 = -$r1*sin($t1);
- $d1 = $r2*cos($t1);
- $tmp.="\n".sprintf('%.3f',($a0+$c0*$dtm)).' '.sprintf('%.3f',($b0+$d0*$dtm));
- $tmp.= ' '.sprintf('%.3f',($a1-$c1*$dtm)).' '.sprintf('%.3f',($b1-$d1*$dtm)).' '.sprintf('%.3f',$a1).' '.sprintf('%.3f',$b1).' c';
- $a0=$a1;
- $b0=$b1;
- $c0=$c1;
- $d0=$d1;
+
+ function RoundRectangle($XPos, $YPos, $Width, $Height, $Radius) {
+ /*from the top right */
+ $this->partEllipse($XPos+$Width,$YPos,0,90,$Radius,$Radius);
+ /*line to the top left */
+ $this->line($XPos+$Width, $YPos+$Radius,$XPos+$Radius, $YPos+$Radius);
+ /*Do top left corner */
+ $this->partEllipse($XPos+$Radius, $YPos,90,180,$Radius,$Radius);
+ /*Do a line to the bottom left corner */
+ $this->line($XPos+$Radius, $YPos-$Height-$Radius,$XPos+$Width, $YPos-$Height-$Radius);
+ /*Now do the bottom left corner 180 - 270 coming back west*/
+ $this->partEllipse($XPos+$Radius, $YPos-$Height,180,270,$Radius,$Radius);
+ /*Now a line to the bottom right */
+ $this->line($XPos, $YPos-$Height,$XPos, $YPos);
+ /*Now do the bottom right corner */
+ $this->partEllipse($XPos+$Width, $YPos-$Height,270,360,$Radius,$Radius);
+ /*Finally join up to the top right corner where started */
+ $this->line($XPos+$Width+$Radius, $YPos-$Height,$XPos+$Width+$Radius, $YPos);
}
- if ($fill){
- //$this->objects[$this->currentContents]['c']
- $tmp.=' f';
- } else {
- if ($close){
- $tmp.=' s'; // small 's' signifies closing the path as well
- } else {
- $tmp.=' S';
+
+ function Rectangle($XPos, $YPos, $Width, $Height) {
+ $this->line($XPos, $YPos, $XPos+$Width, $YPos);
+ $this->line($XPos+$Width, $YPos, $XPos+$Width, $YPos-$Height);
+ $this->line($XPos+$Width, $YPos-$Height, $XPos, $YPos-$Height);
+ $this->line($XPos, $YPos-$Height, $XPos, $YPos);
}
- }
- if ($angle !=0) {
- $tmp .=' Q';
- }
- $this->_out($tmp);
- }
-
-/* Javier:
- A file's name is needed if we don't want file extension to be .php
- TCPDF has a different behaviour than FPDF, the recursive scripts needs D.
- The admin/user may change I to D to force all pdf to be downloaded or open in a desktop app instead the browser plugin, but not vice-versa.
- The admin/user may change I and D to F to save all pdf in the server for Document Management.
-*/
-
- function OutputI($DocumentFilename = 'Document.pdf') {
- if (($DocumentFilename == null) or ($DocumentFilename == '')) {
- $DocumentFilename = _('Document.pdf');
- }
- $this->Output($DocumentFilename,'I');
- }
-
- function OutputD($DocumentFilename = 'Document.pdf') {
- if (($DocumentFilename == null) or ($DocumentFilename == '')) {
- $DocumentFilename = _('Document.pdf');
- }
- $this->Output($DocumentFilename,'D');
- }
-
- function RoundRectangle($XPos, $YPos, $Width, $Height, $Radius) {
- /*from the top right */
- $this->partEllipse($XPos+$Width,$YPos,0,90,$Radius,$Radius);
- /*line to the top left */
- $this->line($XPos+$Width, $YPos+$Radius,$XPos+$Radius, $YPos+$Radius);
- /*Do top left corner */
- $this->partEllipse($XPos+$Radius, $YPos,90,180,$Radius,$Radius);
- /*Do a line to the bottom left corner */
- $this->line($XPos+$Radius, $YPos-$Height-$Radius,$XPos+$Width, $YPos-$Height-$Radius);
- /*Now do the bottom left corner 180 - 270 coming back west*/
- $this->partEllipse($XPos+$Radius, $YPos-$Height,180,270,$Radius,$Radius);
- /*Now a line to the bottom right */
- $this->line($XPos, $YPos-$Height,$XPos, $YPos);
- /*Now do the bottom right corner */
- $this->partEllipse($XPos+$Width, $YPos-$Height,270,360,$Radius,$Radius);
- /*Finally join up to the top right corner where started */
- $this->line($XPos+$Width+$Radius, $YPos-$Height,$XPos+$Width+$Radius, $YPos);
- }
-
- function Rectangle($XPos, $YPos, $Width, $Height) {
- $this->line($XPos, $YPos, $XPos+$Width, $YPos);
- $this->line($XPos+$Width, $YPos, $XPos+$Width, $YPos-$Height);
- $this->line($XPos+$Width, $YPos-$Height, $XPos, $YPos-$Height);
- $this->line($XPos, $YPos-$Height, $XPos, $YPos);
- }
-
- function addTextWrap($xb, $yb, $w, $h, $txt, $align='J', $border=0, $fill=0) {
-
- //$txt = html_entity_decode($txt);
-
- //some special characters are html encoded
- //this code serves to make them appear human readable in pdf file
- $txt = html_entity_decode($txt, ENT_QUOTES, 'UTF-8');
-
- $this->x = $xb;
- $this->y = $this->h - $yb - $h;
-
- switch($align) {
- case 'right':
- $align = 'R'; break;
- case 'center':
- $align = 'C'; break;
- default:
- $align = 'L';
-
- }
- $this->SetFontSize($h);
- $cw=&$this->CurrentFont['cw'];
- if($w==0) {
- $w=$this->w-$this->rMargin-$this->x;
- }
- $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
- $s=str_replace("\r",'',$txt);
- $s=str_replace("\n",' ',$s);
- $s = trim($s).' ';
- $nb=strlen($s);
- $b=0;
- if ($border) {
- if ($border==1) {
- $border='LTRB';
- $b='LRT';
- $b2='LR';
- } else {
- $b2='';
- if(is_int(strpos($border,'L'))) {
- $b2.='L';
+
+ function addTextWrap($x, $yb, $w, $h, $txt, $align='J', $border=0, $fill=0) {
+
+ //$txt = html_entity_decode($txt);
+
+ //some special characters are html encoded
+ //this code serves to make them appear human readable in pdf file
+ $txt = html_entity_decode($txt, ENT_QUOTES, 'UTF-8');
+
+ $this->x = $x;
+ $this->y = $this->h - $yb - $h;
+
+ switch($align) {
+ case 'right':
+ $align = 'R'; break;
+ case 'center':
+ $align = 'C'; break;
+ default:
+ $align = 'L';
+
+ }
+ $this->SetFontSize($h);
+ $cw=&$this->CurrentFont['cw'];
+ if($w==0) {
+ $w=$this->w-$this->rMargin-$this->x;
+ }
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ $s=str_replace("\r",'',$txt);
+ $s=str_replace("\n",' ',$s);
+ $s = trim($s).' ';
+ $nb=strlen($s);
+ $b=0;
+ if ($border) {
+ if ($border==1) {
+ $border='LTRB';
+ $b='LRT';
+ $b2='LR';
+ } else {
+ $b2='';
+ if(is_int(strpos($border,'L'))) {
+ $b2.='L';
+ }
+ if(is_int(strpos($border,'R'))) {
+ $b2.='R';
+ }
+ $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;
}
- if(is_int(strpos($border,'R'))) {
- $b2.='R';
+ }
+ $sep=-1;
+ $i=0;
+ $l= $ls=0;
+ $ns=0;
+ while($i<$nb) {
+ $c=$s{$i};
+ if($c==' ' AND $i>0) {
+ $sep=$i;
+ $ls=$l;
+ $ns++;
}
- $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;
+ $l += $cw[$i];
+ if($l>$wmax){
+ break;
+ } else {
+ $i++;
+ }
}
- }
- $sep=-1;
- $i=0;
- $l= $ls=0;
- $ns=0;
- while($i<$nb) {
-
- $c=$s{$i};
-
- if($c==' ' AND $i>0) {
- $sep=$i;
- $ls=$l;
- $ns++;
+ if($sep==-1) {
+ if($i==0) {
+ $i++;
+ }
+
+ if(isset($this->ws) and $this->ws>0) {
+ $this->ws=0;
+ $this->_out('0 Tw');
+ }
+ $sep = $i;
+ } else {
+ if($align=='J') {
+ $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
+ $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
+ }
}
- $l+=$cw[$i];
- if($l>$wmax)
- break;
- else
- $i++;
- }
- if($sep==-1) {
- if($i==0) $i++;
-
- if(isset($this->ws) and $this->ws>0) {
- $this->ws=0;
- $this->_out('0 Tw');
- }
- $sep = $i;
- } else {
- if($align=='J') {
- $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
- $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
- }
- }
-
- $this->Cell($w,$h,substr($s,0,$sep),$b,2,$align,$fill);
- $this->x=$this->lMargin;
-
- return substr($s,$sep);
- }
-
-} // end of class
-}
+
+ $this->Cell($w,$h,substr($s,0,$sep),$b,2,$align,$fill);
+ $this->x=$this->lMargin;
+ return substr($s, $sep);
+ } //end function addTextWrap
+
+ } // end of class
+} //end if Cpdf class exists already
?>
\ No newline at end of file
Modified: trunk/javascripts/MiscFunctions.js
===================================================================
--- trunk/javascripts/MiscFunctions.js 2011-02-07 08:51:36 UTC (rev 4485)
+++ trunk/javascripts/MiscFunctions.js 2011-02-08 09:20:50 UTC (rev 4486)
@@ -1,24 +1,37 @@
function defaultControl(c){
-c.select();
-c.focus();
+ c.select();
+ c.focus();
}
function ReloadForm(fB){
-fB.click();
+ fB.click();
}
function rTN(event){
- if (window.event) k=window.event.keyCode;
- else if (event) k=event.which;
- else return true;
+ if (window.event) {
+ k=window.event.keyCode;
+ }
+ else if (event) {
+ k=event.which;
+ } else {
+ return true;
+ }
kC=String.fromCharCode(k);
- if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true;
- else if ((("0123456789.-").indexOf(kC)>-1)) return true;
- else return false;
+ if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) {
+ return true;
+ } else if ((("0123456789.-").indexOf(kC)>-1)) {
+ return true;
+ } else
+ return false;
+ }
}
function assignComboToInput(c,i){
i.value=c.value;
}
function inArray(v,tA,m){
- for (i=0;i<tA.length;i++) if (v==tA[i].value) return true;
+ for (i=0;i<tA.length;i++) {
+ if (v.value==tA[i].value) {
+ return true;
+ }
+ }
alert(m);
return false;
}
@@ -173,7 +186,7 @@
m=parseInt(dA[0],10)-1;
y=parseInt(dA[2],10);
break;
-}
+ }
return new Date(y,m,d);
}
function postDate(mydate,dS){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|