/** * function addingRecordDefaultSettings * * Creates an array of settings associative arrays for use by the system when * a new report record is added that references the file containing this class * * @retrun array of settings. Each setting should itself be * an associative array containing the following * name: name of the setting * defaultvalue: default value for setting * type: (string, int, real, bool) type for value of setting * required: (0,1) whether the setting is required or not * description: brief description for what this setting is used for. */ function addingRecordDefaultSettings() { $settings = parent::addingRecordDefaultSettings(); for ($i = 0; $i < count($settings); $i++) { switch ($settings[$i]["name"]) { case "reportTitle": $settings[$i]["defaultValue"] = "Quote"; } //endswitch } //end foreach return $settings; }
/** * generates a PDF invoice */ public static function generatePDF($ipn_id) { $path = self::get_invoice_path($ipn_id); if (file_exists($path)) { @unlink($path); } $options = self::get_paypal_options(); $payment_details = self::get_payment_details(array('ipn_id' => $ipn_id)); require_once dirname(__FILE__) . '/lib/invoicePDF.php'; $pdf = new invoicePDF($options, $path, $payment_details); $pdf->save(); }
| | +-------------------------------------------------------------------------+ */ /** * PROCESSING * ============================================================================= */ if (!isset($noOutput)) { //IE needs caching to be set to private in order to display PDFS session_cache_limiter('private'); //set encoding to latin1 (fpdf doesnt like utf8) $sqlEncoding = "latin1"; require_once "../../../include/session.php"; include "modules/bms/report/invoices_pdf_class.php"; checkForReportArguments(); $report = new invoicePDF($db, $_GET["rid"], $_GET["tid"], 'P', 'in', 'Letter'); $report->setupFromPrintScreen(); $report->generate(); $filename = "Invoice"; if ($report->count === 1) { if ($report->invoicerecord["company"]) { $filename .= "_" . $report->invoicerecord["company"]; } $filename .= "_" . $report->invoicerecord["id"]; } elseif ((int) $report->count) { $filename .= "_Multiple"; } $filename .= ".pdf"; $report->output('screen', $filename); } //end if
function email_invoice($useUuid = false) { if (DEMO_ENABLED == "true") { return "Functionality disabled in demo."; } $this->db->setEncoding("latin1"); global $phpbmsSession, $sqlEncoding; $sqlEncoding = 'latin1'; $phpbmsSession->loadSettings('latin1'); require_once "report/report_class.php"; include "modules/bms/report/invoices_pdf_class.php"; $processed = 0; foreach ($this->idsArray as $id) { $report = new invoicePDF($this->db, 'rpt:44b21461-6e67-c284-0ccf-36ab1af47c9b', 'tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883', 'P', 'in', 'Letter'); if (!$useUuid) { $report->generate("invoices.id = " . $id); } else { $report->generate("invoices.uuid = " . $id); } if ($report->output("email")) { $processed++; } } //end foreach $this->db->setEncoding(); $phpbmsSession->loadSettings(); $count = count($this->idsArray); $message = $processed . " of " . $count . " invoice PDF"; if ($count !== 1) { $message .= "s"; } $message .= " e-mailed to client."; return $message; }