Changeset 673
- Timestamp:
- 11/04/09 12:11:05 (3 years ago)
- Location:
- trunk/phpbms
- Files:
-
- 16 modified
-
fpdf/fpdf.php (modified) (2 diffs)
-
include/common_functions.php (modified) (1 diff)
-
modules/base/report/notes_summary.php (modified) (2 diffs)
-
modules/bms/report/aritems_clientstatement.php (modified) (1 diff)
-
modules/bms/report/clients_folderlabels.php (modified) (1 diff)
-
modules/bms/report/clients_mailinglabels.php (modified) (1 diff)
-
modules/bms/report/clients_notesummary.php (modified) (2 diffs)
-
modules/bms/report/clients_shippinglabels.php (modified) (1 diff)
-
modules/bms/report/invoices_pdfinvoice.php (modified) (1 diff)
-
modules/bms/report/invoices_pdfpackinglist.php (modified) (7 diffs)
-
modules/bms/report/invoices_pdfquote.php (modified) (3 diffs)
-
modules/bms/report/invoices_pdfworkorder.php (modified) (5 diffs)
-
modules/bms/report/invoices_pdf_class.php (modified) (4 diffs)
-
modules/bms/report/invoices_shippinglabels.php (modified) (1 diff)
-
modules/bms/report/receipts_pdf.php (modified) (4 diffs)
-
report/general_labels.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/fpdf/fpdf.php
r205 r673 1163 1163 } 1164 1164 $mqr=get_magic_quotes_runtime(); 1165 set_magic_quotes_runtime(0);1165 @set_magic_quotes_runtime(0); 1166 1166 foreach($this->FontFiles as $file=>$info) 1167 1167 { … … 1201 1201 $this->_out('endobj'); 1202 1202 } 1203 set_magic_quotes_runtime($mqr);1203 @set_magic_quotes_runtime($mqr); 1204 1204 foreach($this->fonts as $k=>$font) 1205 1205 { -
trunk/phpbms/include/common_functions.php
r669 r673 1124 1124 1125 1125 1126 /* 1127 * function cleanFilename 1128 * @param $string 1129 * @return string $string with only alpha-numeric characters, periods (.), 1130 * dashes (-), and underscores (_) 1131 */ 1132 1133 function cleanFilename($string) { 1134 1135 $pattern = "/[^\w\d\.\-\_]/"; 1136 $string = preg_replace($pattern, "", $string); 1137 1138 return $string; 1139 1140 }//end function --cleanFilename-- 1141 1142 1126 1143 1127 1144 function htmlFormat($string,$quotes=false){ -
trunk/phpbms/modules/base/report/notes_summary.php
r643 r673 86 86 $pdf->SetY($topmargin+.43+.1); 87 87 $pdf->SetLineWidth(.01); 88 89 $filename = "Notes_Summary"; 90 91 $thisCount = $db->numRows($thequery); 88 92 while($therecord=$db->fetchArray($thequery)) { 93 89 94 $pdf->SetFont("Arial","",9); 90 95 $pdf->SetX($leftmargin+.125); … … 104 109 $pdf->Line($leftmargin+.25,$pdf->GetY(),$paperwidth-$rightmargin-.25,$pdf->GetY()); 105 110 $pdf->SetY($pdf->GetY()+.25); 111 112 $thisId = $therecord["id"]; 113 106 114 }// end fetch_array while loop 115 116 if($thisCount === 1) 117 $filename .= "_".$thisId; 118 elseif((int)$thisCount) 119 $filename .= "_Multiple"; 107 120 108 $pdf->Output(); 121 $filename = cleanFilename($filename); 122 $filename .= ".pdf"; 123 124 $pdf->Output($filename, 'D'); 109 125 exit(); 110 126 ?> -
trunk/phpbms/modules/bms/report/aritems_clientstatement.php
r611 r673 481 481 function output($to = "screen"){ 482 482 483 $this->pdf->Output(); 483 $filename = 'Client_Statement_'.date('Ymd').'.pdf'; 484 $filename = cleanFilename($filename); 485 $this->pdf->output($filename, 'D'); 484 486 485 487 }//end method -
trunk/phpbms/modules/bms/report/clients_folderlabels.php
r605 r673 87 87 return $pdf; 88 88 } 89 $filename = 'Folderlabels_Clients'; 89 90 90 91 require("report/general_labels.php"); -
trunk/phpbms/modules/bms/report/clients_mailinglabels.php
r605 r673 93 93 return $pdf; 94 94 } 95 $filename = 'Mailinglabels_Clients'; 95 96 96 97 require("../../../report/general_labels.php"); -
trunk/phpbms/modules/bms/report/clients_notesummary.php
r605 r673 91 91 92 92 $pdf->SetY($topmargin+.43+.1); 93 $filename = "Client_Notes"; 93 94 95 $thisCount = $db->numRows($clientquery); 94 96 while($clientrecord=$db->fetchArray($clientquery)) { 97 98 $theName = $clientRecord["thename"]; 99 95 100 $querystatement = " 96 101 SELECT … … 165 170 } 166 171 167 $pdf->Output(); 172 if($thisCount == 1){ 173 if($thename) 174 $filename .= '_'.$thename; 175 }elseif($thisCount) 176 $filename .= "_Multiple"; 177 178 $filename = str_replace(" ", "_", $filename); 179 $filename = cleanFilename($filename); 180 $filename .= ".pdf"; 181 182 $pdf->Output($filename, "D"); 168 183 exit(); 169 184 ?> -
trunk/phpbms/modules/bms/report/clients_shippinglabels.php
r605 r673 98 98 } 99 99 100 $filename = 'Shippinglabels_Clients'; 100 101 require("../../../report/general_labels.php"); 101 102 ?> -
trunk/phpbms/modules/bms/report/invoices_pdfinvoice.php
r353 r673 46 46 47 47 //set encoding to latin1 (fpdf doesnt like utf8) 48 $sqlEncoding = "latin1"; 48 $sqlEncoding = "latin1"; 49 49 require_once("../../../include/session.php"); 50 50 51 51 include("modules/bms/report/invoices_pdf_class.php"); 52 52 53 53 $report = new invoicePDF($db, 'P', 'in', 'Letter'); 54 54 $report->setupFromPrintScreen(); 55 55 $report->generate(); 56 $report->output();57 56 57 $filename = "Invoice"; 58 if($report->count === 1){ 59 60 if($report->invoicerecord["company"]) 61 $filename .= "_".$report->invoicerecord["company"]; 62 63 $filename .= "_".$report->invoicerecord["id"]; 64 65 }elseif((int)$report->count) 66 $filename .= "_Multiple"; 67 68 $filename .= ".pdf"; 69 $report->output('screen', $filename); 70 58 71 }//end if 59 72 -
trunk/phpbms/modules/bms/report/invoices_pdfpackinglist.php
r363 r673 39 39 40 40 if(!isset($_SESSION["userinfo"]["id"])){ 41 41 42 42 //IE needs caching to be set to private in order to display PDFS 43 43 session_cache_limiter('private'); 44 44 45 45 //set encoding to latin1 (fpdf doesnt like utf8) 46 $sqlEncoding = "latin1"; 46 $sqlEncoding = "latin1"; 47 47 require_once("../../../include/session.php"); 48 48 49 49 }//end if 50 50 51 51 if(!class_exists("invoicePDF")) 52 52 include("invoices_pdf_class.php"); 53 53 54 54 class packinglistPDF extends invoicePDF{ 55 55 56 56 var $title = "Packing List"; 57 57 var $showShipNameInShipTo = false; 58 58 59 59 function packinglistPDF($db, $orientation='P', $unit='mm', $format='Letter'){ 60 60 61 61 $this->invoicePDF($db, $orientation, $unit, $format); 62 63 }//end method 64 62 63 }//end method 64 65 65 66 66 function initialize(){ … … 68 68 69 69 $pdf = &$this->pdf; 70 70 71 71 $topinfo = array(); 72 72 $topinfo[] = new pdfColumn("Order ID", "id", 0.75); 73 73 $topinfo[] = new pdfColumn("Order Date", "orderdate", 1, "date"); 74 74 $topinfo[] = new pdfColumn("Client PO", "ponumber", 0); 75 75 76 76 $size = 0; 77 77 foreach($topinfo as $column) 78 78 $size += $column->size; 79 79 80 80 $topinfo[2]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 81 81 82 $this->topinfo = $topinfo; 83 82 $this->topinfo = $topinfo; 83 84 84 $lineitems = array(); 85 85 $lineitems[] = new pdfColumn("Product / (Part Number)", "parts", 0); … … 89 89 $lineitems[] = new pdfColumn("Qty", "quantity", 0.5, "real","R"); 90 90 $lineitems[] = new pdfColumn("Weight Ext.", "extended", 0.75, "real", "R"); 91 91 92 92 $size = 0; 93 93 foreach($lineitems as $column) 94 94 $size += $column->size; 95 95 96 96 $lineitems[0]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 97 97 98 98 $this->lineitems = $lineitems; 99 99 100 100 $totalsinfo = array(); 101 101 $totalsinfo[] = new pdfColumn("Shipping Method", "shippingname", 0); … … 103 103 $totalsinfo[] = new pdfColumn("Total Weight", "totalweight", 1, "real", "R"); 104 104 $totalsinfo[] = new pdfColumn("Shipping", "shipping", 1, "currency", "R"); 105 105 106 106 $size = 0; 107 107 foreach($totalsinfo as $column) 108 108 $size += $column->size; 109 109 110 110 $totalsinfo[0]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 111 111 … … 114 114 }//end method 115 115 116 116 117 117 function _addNotes(){ 118 118 119 119 $pdf = &$this->pdf; 120 120 121 121 $height = 1; 122 122 $nextPos = $pdf->GetY() + $height + 0.125; 123 123 124 124 $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 125 125 $pdf->setStyle("header"); 126 126 $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); 127 127 128 128 $pdf->setStyle("normal"); 129 129 $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); 130 130 $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); 131 131 132 132 $pdf->SetXY($pdf->leftmargin, $nextPos); 133 134 }//end method 135 136 133 134 }//end method 135 136 137 137 function _getLineItems(){ 138 138 139 139 $querystatement = " 140 140 SELECT … … 154 154 155 155 $queryresult = $this->db->query($querystatement); 156 156 157 157 //determine estimated total boxes 158 158 $this->invoicerecord["estimatedboxes"] = 0; 159 159 while($therecord = $this->db->fetchArray($queryresult)){ 160 160 161 161 if($therecord["isprepackaged"]) 162 162 $this->invoicerecord["estimatedboxes"] += $therecord["quantity"]; 163 163 else 164 164 $this->invoicerecord["estimatedboxes"] += $therecord["quantity"] * $therecord["packagesperitem"]; 165 165 166 166 }//endwhile 167 167 168 168 $this->db->seek($queryresult, 0); 169 169 170 170 return $queryresult; 171 172 }//end method 173 171 172 }//end method 173 174 174 function _addTotals(){ 175 175 176 176 $pdf = &$this->pdf; 177 177 178 178 $height = .5; 179 179 $nextPos = $pdf->GetY() + $height + 0.125; 180 180 181 181 $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 182 182 183 183 $pdf->setStyle("header"); 184 184 foreach($this->totalsinfo as $column) 185 185 $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); 186 186 187 187 $pdf->setStyle("normal"); 188 188 $pdf->SetFont("Arial", "B", 10); 189 189 $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); 190 190 191 191 foreach($this->totalsinfo as $column){ 192 192 193 193 if($column->format != "") 194 194 $value = formatVariable($this->invoicerecord[$column->fieldname], $column->format); 195 195 else 196 $value = $this->invoicerecord[$column->fieldname]; 197 196 $value = $this->invoicerecord[$column->fieldname]; 197 198 198 $pdf->Cell($column->size, 0.18, $value, $pdf->borderDebug, 0, $column->align); 199 199 200 200 }//end foreach 201 201 202 202 }//end method 203 203 … … 208 208 //============================================================================= 209 209 if(!isset($noOutput)){ 210 210 211 211 $report = new packinglistPDF($db, 'P', 'in', 'Letter'); 212 212 213 213 $report->setupFromPrintScreen(); 214 214 $report->generate(); 215 $ report->output();215 $filename = "Packing_List"; 216 216 217 if($report->count === 1){ 218 219 if($report->invoicerecord["company"]) 220 $filename .= "_".$report->invoicerecord["company"]; 221 222 $filename .= "_".$report->invoicerecord["id"]; 223 224 }elseif((int)$report->count) 225 $filename .= "_Multiple"; 226 227 $report->output('screen', $filename); 228 217 229 }//end if 218 230 ?> -
trunk/phpbms/modules/bms/report/invoices_pdfquote.php
r353 r673 43 43 44 44 //set encoding to latin1 (fpdf doesnt like utf8) 45 $sqlEncoding = "latin1"; 45 $sqlEncoding = "latin1"; 46 46 require_once("../../../include/session.php"); 47 47 … … 58 58 59 59 $this->invoicePDF($db, $orientation, $unit, $format); 60 60 61 61 }//end method 62 62 63 63 function initialize(){ 64 64 parent::initialize(); 65 65 66 66 unset($this->totalsinfo[5]); 67 67 68 68 }//end method 69 69 … … 73 73 //============================================================================= 74 74 if(!isset($noOutput)){ 75 75 76 76 $report = new quotePDF($db, 'P', 'in', 'Letter'); 77 77 $report->showShipNameInShipTo = false; 78 78 79 79 $report->setupFromPrintScreen(); 80 80 $report->generate(); 81 $report->output();82 81 82 $filename = "Quote"; 83 if($report->count === 1){ 84 85 if($report->invoicerecord["company"]) 86 $filename .= "_".$report->invoicerecord["company"]; 87 88 $filename .= "_".$report->invoicerecord["id"]; 89 90 }elseif((int)$report->count) 91 $filename .= "_Multiple"; 92 93 $filename .= ".pdf"; 94 95 $report->output('screen', $filename); 96 83 97 }//end if 84 98 -
trunk/phpbms/modules/bms/report/invoices_pdfworkorder.php
r354 r673 38 38 */ 39 39 if(!isset($_SESSION["userinfo"]["id"])){ 40 40 41 41 //IE needs caching to be set to private in order to display PDFS 42 42 session_cache_limiter('private'); 43 43 44 44 //set encoding to latin1 (fpdf doesnt like utf8) 45 $sqlEncoding = "latin1"; 45 $sqlEncoding = "latin1"; 46 46 require_once("../../../include/session.php"); 47 47 48 48 }//end if 49 49 50 50 if(!class_exists("invoicePDF")) 51 51 include("invoices_pdf_class.php"); 52 52 53 53 class workorderPDF extends invoicePDF{ 54 54 55 55 var $title = "Work Order"; 56 56 var $lineitemBoxHeight = 3.75; 57 57 58 58 function workorderPDF($db, $orientation='P', $unit='mm', $format='Letter'){ 59 59 60 60 $this->invoicePDF($db, $orientation, $unit, $format); 61 61 62 62 }//end method 63 64 63 64 65 65 function _addNotes(){ 66 66 67 67 $pdf = &$this->pdf; 68 68 69 69 $height = 1; 70 70 $nextPos = $pdf->GetY() + $height + 0.125; 71 71 72 72 $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 73 73 $pdf->setStyle("header"); 74 74 $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); 75 75 76 76 $pdf->setStyle("normal"); 77 77 $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); 78 78 $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); 79 79 80 80 $pdf->SetXY($pdf->leftmargin, $nextPos); 81 81 82 82 }//end method 83 83 84 84 function _addPaymentDetails(){ 85 85 … … 90 90 91 91 switch($this->invoicerecord["paymenttype"]){ 92 92 93 93 case "draft": 94 94 $columns[0]->size = 1.5; … … 102 102 $columns[] = new pdfColumn("Exp.", "ccexpiration", 1); 103 103 $columns[] = new pdfColumn("Verification/Pin", "ccverification", 1); 104 break; 105 104 break; 105 106 106 }//end switch 107 107 108 108 $size = 0; 109 109 foreach($columns as $column) 110 110 $size += $column->size; 111 111 112 112 $i = count($columns) -1; 113 113 114 114 $columns[$i]->size += $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 115 115 116 116 $height = 0.5; 117 117 $nextPos = $pdf->GetY() + $height + 0.125; 118 118 119 119 $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 120 120 121 121 $pdf->setStyle("header"); 122 122 123 123 foreach($columns as $column) 124 124 $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); 125 125 126 126 $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); 127 127 128 128 $pdf->setStyle("normal"); 129 129 $pdf->SetFont("Arial", "B", 10); … … 132 132 133 133 }//end method 134 134 135 135 }//end class 136 136 … … 139 139 //============================================================================= 140 140 if(!isset($noOutput)){ 141 141 142 142 $report = new workorderPDF($db, 'P', 'in', 'Letter'); 143 143 144 144 $report->setupFromPrintScreen(); 145 145 $report->generate(); 146 $report->output(); 146 $filename = 'Work_Order'; 147 if($report->count === 1){ 148 149 if($report->invoicerecord["company"]) 150 $filename .= "_".$report->invoicerecord["company"]; 151 152 $filename .= "_".$report->invoicerecord["id"]; 153 154 }elseif((int)$report->count) 155 $filename .= "_Multiple"; 147 156 157 $filename .= ".pdf"; 158 $report->output('screen', $filename); 159 148 160 }//end if 149 161 -
trunk/phpbms/modules/bms/report/invoices_pdf_class.php
r633 r673 46 46 var $showShipNameInShipTo = true; 47 47 var $lineitemBoxHeight = 4.25; 48 49 /** 50 * $count 51 * @var int The number of invoice records being displayed 52 */ 53 var $count; 48 54 49 55 function invoicePDF($db, $orientation='P', $unit='mm', $format='Letter'){ … … 171 177 $queryresult = $this->db->query($querystatement); 172 178 173 if($this->db->numRows($queryresult) == 0){ 174 179 $this->count = $this->db->numRows($queryresult); 180 if($this->count == 0){ 181 175 182 $this->_showNoRecords(); 176 183 exit; … … 505 512 products.partnumber 506 513 FROM 507 lineitems LEFT JOIN products ON lineitems.productid = products. id514 lineitems LEFT JOIN products ON lineitems.productid = products.uuid 508 515 WHERE 509 516 lineitems.invoiceid ='".((int) $this->invoicerecord["id"])."' … … 609 616 610 617 case "screen": 611 $this->pdf->Output(); 618 $userinfo = cleanFilename((string)$userinfo); 619 $this->pdf->Output($userinfo, 'D'); 612 620 break; 613 621 -
trunk/phpbms/modules/bms/report/invoices_shippinglabels.php
r611 r673 111 111 return $pdf; 112 112 } 113 113 $filename = 'Shippinglabels_invoice'; 114 114 session_cache_limiter('private'); 115 115 require_once("../../../include/session.php"); -
trunk/phpbms/modules/bms/report/receipts_pdf.php
r633 r673 53 53 var $title = "Receipt"; 54 54 var $lineitemBoxHeight = 4.25; 55 /** 56 * $count 57 * @var int The number of invoice records being displayed 58 */ 59 var $count; 55 60 56 61 function receiptPDF($db, $orientation='P', $unit='mm', $format='Letter'){ … … 177 182 $queryresult = $this->db->query($querystatement); 178 183 179 if($this->db->numRows($queryresult) == 0){ 184 185 $this->count = $this->db->numRows($queryresult); 186 if($this->count == 0){ 180 187 181 188 $this->_showNoRecords(); … … 632 639 633 640 case "screen": 634 $this->pdf->Output(); 641 $userinfo = cleanFilename((string)$userinfo); 642 $this->pdf->Output($userinfo, 'D'); 635 643 break; 636 644 … … 703 711 $report->setupFromPrintScreen(); 704 712 $report->generate(); 705 $report->output(); 713 714 $filename = 'Receipts_'; 715 if($report->count === 1){ 716 717 if($report->invoicerecord["company"]) 718 $filename .= "_".$report->invoicerecord["company"]; 719 720 $filename .= "_".$report->invoicerecord["id"]; 721 722 }elseif((int)$report->count) 723 $filename .= "_Multiple"; 724 725 $filename .= ".pdf"; 726 $report->output('screen', $filename); 706 727 707 728 }//end if -
trunk/phpbms/report/general_labels.php
r643 r673 97 97 } 98 98 99 $thisCount = $db->numRows($thequery); 99 100 while($therecord=$db->fetchArray($thequery)) { 100 101 … … 116 117 $they+=$labelheight; 117 118 $rowcount++; 119 120 $company = $therecord["company"]; 121 118 122 }// end fetch_array while loop 119 123 120 $pdf->Output(); 124 if($thisCount === 1){ 125 if($company) 126 $filename .= "_".$company; 127 }elseif((int)$thisCount) 128 $filename .= "_Multiple"; 129 130 131 $filename = cleanFilename($filename); 132 $filename .= ".pdf"; 133 $pdf->Output($filename, 'D'); 121 134 exit(); 122 135 } else { … … 139 152 <p align="right"> 140 153 <input name="command" type="submit" class="Buttons" id="print" value="print" /> 141 <input name="cancel" type="button" class="Buttons" id="cancel" value="can el" onclick="window.close();" />154 <input name="cancel" type="button" class="Buttons" id="cancel" value="cancel" onclick="window.close();" /> 142 155 </p> 143 156 </div>