| 39 | | if(!isset($_SESSION["userinfo"]["id"])){ |
| 40 | | |
| 41 | | //IE needs caching to be set to private in order to display PDFS |
| 42 | | session_cache_limiter('private'); |
| 43 | | |
| 44 | | //set encoding to latin1 (fpdf doesnt like utf8) |
| 45 | | $sqlEncoding = "latin1"; |
| 46 | | require_once("../../../include/session.php"); |
| 47 | | |
| 48 | | }//end if |
| 49 | | |
| 50 | | if(!class_exists("invoicePDF")) |
| 51 | | include("invoices_pdf_class.php"); |
| 52 | | |
| 53 | | class workorderPDF extends invoicePDF{ |
| 54 | | |
| 55 | | var $title = "Work Order"; |
| 56 | | var $lineitemBoxHeight = 3.75; |
| 57 | | |
| 58 | | function workorderPDF($db, $orientation='P', $unit='mm', $format='Letter'){ |
| 59 | | |
| 60 | | $this->invoicePDF($db, $orientation, $unit, $format); |
| 61 | | |
| 62 | | }//end method |
| 63 | | |
| 64 | | |
| 65 | | function _addNotes(){ |
| 66 | | |
| 67 | | $pdf = &$this->pdf; |
| 68 | | |
| 69 | | $height = 1; |
| 70 | | $nextPos = $pdf->GetY() + $height + 0.125; |
| 71 | | |
| 72 | | $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); |
| 73 | | $pdf->setStyle("header"); |
| 74 | | $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); |
| 75 | | |
| 76 | | $pdf->setStyle("normal"); |
| 77 | | $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); |
| 78 | | $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); |
| 79 | | |
| 80 | | $pdf->SetXY($pdf->leftmargin, $nextPos); |
| 81 | | |
| 82 | | }//end method |
| 83 | | |
| 84 | | function _addPaymentDetails(){ |
| 85 | | |
| 86 | | $pdf = &$this->pdf; |
| 87 | | |
| 88 | | $columns = array(); |
| 89 | | $columns[] = new pdfColumn("Payment Method", "paymentname", 0); |
| 90 | | |
| 91 | | switch($this->invoicerecord["paymenttype"]){ |
| 92 | | |
| 93 | | case "draft": |
| 94 | | $columns[0]->size = 1.5; |
| 95 | | $columns[] = new pdfColumn("Check Number", "checkno", 1); |
| 96 | | $columns[] = new pdfColumn("Bank Name", "bankname", 2); |
| 97 | | break; |
| 98 | | |
| 99 | | case "charge": |
| 100 | | $columns[0]->size = 1.5; |
| 101 | | $columns[] = new pdfColumn("Number", "ccnumber", 1.5); |
| 102 | | $columns[] = new pdfColumn("Exp.", "ccexpiration", 1); |
| 103 | | $columns[] = new pdfColumn("Verification/Pin", "ccverification", 1); |
| 104 | | break; |
| 105 | | |
| 106 | | }//end switch |
| 107 | | |
| 108 | | $size = 0; |
| 109 | | foreach($columns as $column) |
| 110 | | $size += $column->size; |
| 111 | | |
| 112 | | $i = count($columns) -1; |
| 113 | | |
| 114 | | $columns[$i]->size += $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; |
| 115 | | |
| 116 | | $height = 0.5; |
| 117 | | $nextPos = $pdf->GetY() + $height + 0.125; |
| 118 | | |
| 119 | | $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); |
| 120 | | |
| 121 | | $pdf->setStyle("header"); |
| 122 | | |
| 123 | | foreach($columns as $column) |
| 124 | | $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); |
| 125 | | |
| 126 | | $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); |
| 127 | | |
| 128 | | $pdf->setStyle("normal"); |
| 129 | | $pdf->SetFont("Arial", "B", 10); |
| 130 | | foreach($columns as $column) |
| 131 | | $pdf->Cell($column->size, 0.18, $this->invoicerecord[$column->fieldname], $pdf->borderDebug, 0, $column->align); |
| 132 | | |
| 133 | | }//end method |
| 134 | | |
| 135 | | }//end class |
| 136 | | |
| 137 | | |
| 138 | | //PROCESSING |
| 139 | | //============================================================================= |
| | 39 | if(!class_exists("invoicePDF")) |
| | 40 | include("invoices_pdf_class.php"); |
| | 41 | |
| | 42 | class workorderPDF extends invoicePDF{ |
| | 43 | |
| | 44 | var $lineitemBoxHeight = 3.75; |
| | 45 | |
| | 46 | |
| | 47 | function workorderPDF($db, $reportUUID, $tabledefUUID, $orientation='P', $unit='mm', $format='Letter'){ |
| | 48 | |
| | 49 | $this->invoicePDF($db, $reportUUID, $tabledefUUID, $orientation, $unit, $format); |
| | 50 | |
| | 51 | }//end method |
| | 52 | |
| | 53 | |
| | 54 | /** |
| | 55 | * function checkForDefaultSettings |
| | 56 | * |
| | 57 | * Checks to make sure loaded report Settings exist and are correct |
| | 58 | */ |
| | 59 | function checkForDefaultSettings(){ |
| | 60 | |
| | 61 | if(!isset($this->settings["reportTitle"])) |
| | 62 | $this->settings["reportTitle"] = "Work Order"; |
| | 63 | |
| | 64 | parent::checkForDefaultSettings(); |
| | 65 | |
| | 66 | }//end function checkForDefaultSettings |
| | 67 | |
| | 68 | |
| | 69 | function _addNotes(){ |
| | 70 | |
| | 71 | $pdf = &$this->pdf; |
| | 72 | |
| | 73 | $height = 1; |
| | 74 | $nextPos = $pdf->GetY() + $height + 0.125; |
| | 75 | |
| | 76 | if(!$this->settings["templateFormatting"]){ |
| | 77 | |
| | 78 | $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); |
| | 79 | $pdf->setStyle("header"); |
| | 80 | $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); |
| | 81 | |
| | 82 | }else |
| | 83 | $pdf->SetY($pdf->GetY() + 0.18); |
| | 84 | |
| | 85 | $pdf->setStyle("normal"); |
| | 86 | $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); |
| | 87 | $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); |
| | 88 | |
| | 89 | $pdf->SetXY($pdf->leftmargin, $nextPos); |
| | 90 | |
| | 91 | }//end method |
| | 92 | |
| | 93 | function _addPaymentDetails(){ |
| | 94 | |
| | 95 | $pdf = &$this->pdf; |
| | 96 | |
| | 97 | $columns = array(); |
| | 98 | $columns[] = new pdfColumn("Payment Method", "paymentname", 0); |
| | 99 | |
| | 100 | switch($this->invoicerecord["paymenttype"]){ |
| | 101 | |
| | 102 | case "draft": |
| | 103 | $columns[0]->size = 1.5; |
| | 104 | $columns[] = new pdfColumn("Check Number", "checkno", 1); |
| | 105 | $columns[] = new pdfColumn("Bank Name", "bankname", 2); |
| | 106 | break; |
| | 107 | |
| | 108 | case "charge": |
| | 109 | $columns[0]->size = 1.5; |
| | 110 | $columns[] = new pdfColumn("Number", "ccnumber", 1.5); |
| | 111 | $columns[] = new pdfColumn("Exp.", "ccexpiration", 1); |
| | 112 | $columns[] = new pdfColumn("Verification/Pin", "ccverification", 1); |
| | 113 | break; |
| | 114 | |
| | 115 | }//end switch |
| | 116 | |
| | 117 | $size = 0; |
| | 118 | foreach($columns as $column) |
| | 119 | $size += $column->size; |
| | 120 | |
| | 121 | $i = count($columns) -1; |
| | 122 | |
| | 123 | $columns[$i]->size += $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; |
| | 124 | |
| | 125 | $height = 0.5; |
| | 126 | $nextPos = $pdf->GetY() + $height + 0.125; |
| | 127 | |
| | 128 | if(!$this->settings["templateFormatting"]){ |
| | 129 | |
| | 130 | $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); |
| | 131 | |
| | 132 | $pdf->setStyle("header"); |
| | 133 | |
| | 134 | foreach($columns as $column) |
| | 135 | $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); |
| | 136 | |
| | 137 | }//endif |
| | 138 | |
| | 139 | $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); |
| | 140 | |
| | 141 | $pdf->setStyle("normal"); |
| | 142 | $pdf->SetFont("Arial", "B", 10); |
| | 143 | foreach($columns as $column) |
| | 144 | $pdf->Cell($column->size, 0.18, $this->invoicerecord[$column->fieldname], $pdf->borderDebug, 0, $column->align); |
| | 145 | |
| | 146 | }//end method |
| | 147 | |
| | 148 | /** |
| | 149 | * function addingRecordDefaultSettings |
| | 150 | * |
| | 151 | * Creates an array of settings associative arrays for use by the system when |
| | 152 | * a new report record is added that references the file containing this class |
| | 153 | * |
| | 154 | * @retrun array of settings. Each setting should itself be |
| | 155 | * an associative array containing the following |
| | 156 | * name: name of the setting |
| | 157 | * defaultvalue: default value for setting |
| | 158 | * type: (string, int, real, bool) type for value of setting |
| | 159 | * required: (0,1) whether the setting is required or not |
| | 160 | * description: brief description for what this setting is used for. |
| | 161 | */ |
| | 162 | function addingRecordDefaultSettings(){ |
| | 163 | |
| | 164 | $settings = parent::addingRecordDefaultSettings(); |
| | 165 | |
| | 166 | for($i=0; $i< count($settings); $i++){ |
| | 167 | |
| | 168 | switch($settings[$i]["name"]){ |
| | 169 | |
| | 170 | case "reportTitle": |
| | 171 | $settings[$i]["defaultValue"] = "Work Order"; |
| | 172 | |
| | 173 | }//endswitch |
| | 174 | |
| | 175 | }//end foreach |
| | 176 | |
| | 177 | return $settings; |
| | 178 | |
| | 179 | }//endfunction addingRecordDefaultSettings |
| | 180 | |
| | 181 | }//end class |
| | 182 | |
| | 183 | |
| | 184 | /** |
| | 185 | * PROCESSING |
| | 186 | * ============================================================================= |
| | 187 | */ |