本文整理汇总了PHP中Shineisp_Commons_Utilities::getFirstFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Shineisp_Commons_Utilities::getFirstFile方法的具体用法?PHP Shineisp_Commons_Utilities::getFirstFile怎么用?PHP Shineisp_Commons_Utilities::getFirstFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shineisp_Commons_Utilities
的用法示例。
在下文中一共展示了Shineisp_Commons_Utilities::getFirstFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrintPDF
//.........这里部分代码省略.........
$orderinfo['company']['fax'] = $order[0]['Isp']['fax'];
$orderinfo['company']['website'] = $order[0]['Isp']['website'];
$orderinfo['company']['email'] = $order[0]['Isp']['email'];
$orderinfo['company']['slogan'] = $order[0]['Isp']['slogan'];
$orderinfo['company']['custom1'] = $order[0]['Isp']['custom1'];
$orderinfo['company']['custom2'] = $order[0]['Isp']['custom2'];
$orderinfo['company']['custom3'] = $order[0]['Isp']['custom3'];
$orderinfo['subtotal'] = $currency->toCurrency($order[0]['total'], array('currency' => Settings::findbyParam('currency')));
$orderinfo['grandtotal'] = $currency->toCurrency($order[0]['grandtotal'], array('currency' => Settings::findbyParam('currency')));
$orderinfo['vat'] = $currency->toCurrency($order[0]['vat'], array('currency' => Settings::findbyParam('currency')));
$orderinfo['delivery'] = 0;
if ($order[0]['status_id'] == Statuses::id("tobepaid", "orders")) {
// To be payed
$orderinfo['ribbon']['text'] = $translator->translate("To be Paid");
$orderinfo['ribbon']['color'] = "#D60000";
} elseif ($order[0]['status_id'] == Statuses::id("paid", "orders")) {
// Paid
$orderinfo['ribbon']['text'] = $translator->translate("Paid");
$orderinfo['ribbon']['color'] = "#009926";
} elseif ($order[0]['status_id'] == Statuses::id("complete", "orders")) {
// Complete
$orderinfo['ribbon']['text'] = $translator->translate("Complete");
$orderinfo['ribbon']['color'] = "#009926";
} else {
$orderinfo['ribbon']['text'] = $translator->translate(Statuses::getLabel($order[0]['status_id']));
$orderinfo['ribbon']['color'] = "#FFCC33";
}
$database['records'] = $orderinfo;
foreach ($order[0]['OrdersItems'] as $item) {
$billingCycle = BillingCycle::getAllinfo($item['billing_cycle_id']);
if (!empty($billingCycle)) {
if (!empty($billingCycle['months']) && empty($item['tld_id'])) {
$price = $item['price'] * $billingCycle['months'] + $item['setupfee'];
} else {
$price = $item['price'] + $item['setupfee'];
}
} else {
$price = $item['price'] * $item['quantity'] + $item['setupfee'];
}
$rowtotal = $price + $item['vat'];
$item['price'] = $currency->toCurrency($item['price'], array('currency' => Settings::findbyParam('currency')));
$item['setupfee'] = $currency->toCurrency($item['setupfee'], array('currency' => Settings::findbyParam('currency')));
$rowtotal = $currency->toCurrency($rowtotal, array('currency' => Settings::findbyParam('currency')));
if (!empty($item['discount'])) {
$item['discount'] = $item['discount'] . "%";
}
if (!empty($billingCycle['name']) && empty($item['tld_id'])) {
$item['date_end'] = Shineisp_Commons_Utilities::formatDateOut($item['date_end']);
$billingCycleName = $billingCycle['name'];
$item['description'] .= "<br/><br/> - " . $translator->translate('Expiring date') . ": " . $item['date_end'];
} else {
$billingCycleName = "-";
}
// var_dump($item);
$database['records']['items'][] = array($item['Products']['sku'], $item['description'], $item['quantity'], $billingCycleName, $item['price'], $item['discount'], $item['setupfee'], $rowtotal);
}
// var_dump($database['records']);
// die;
// Sanitize some fields
$database['records']['invoice_number'] = !empty($database['records']['invoice_number']) ? $database['records']['invoice_number'] : "";
$database['records']['formatted_number'] = !empty($invoice['formatted_number']) ? $invoice['formatted_number'] : $database['records']['invoice_number'];
$database['records']['payment_description'] = !empty($database['records']['payment_description']) ? $database['records']['payment_description'] : "";
$database['records']['payment_mode'] = !empty($database['records']['payment_mode']) ? $database['records']['payment_mode'] : "";
$database['records']['payment_date'] = !empty($database['records']['payment_date']) ? $database['records']['payment_date'] : "";
$database['records']['totalPayments'] = count($database['records']['payments']);
// QRCode Image
$code['order'] = $database['records']['order_number'];
$code['customer'] = $database['records']['customer']['customer_id'];
$jcode = base64_encode(json_encode($code));
$database['records']['qrcode_url'] = $_SERVER['HTTP_HOST'] . "/index/qrcode/q/" . $jcode;
$database['records']['skip_barcode'] = 1;
if (!empty($database['records']['invoice_number'])) {
$database['records']['barcode'] = $database['records']['invoice_number'];
$database['records']['skip_barcode'] = 0;
}
if (isset($order[0])) {
// Create the path structure
if (!is_dir(PUBLIC_PATH . $invoicePath)) {
mkdir(PUBLIC_PATH . $invoicePath, 0700, true);
}
// Template name
$templateName = Settings::findByParam('invoice_template');
if (empty($templateName)) {
$templateName = Shineisp_Commons_Utilities::getFirstFile(PUBLIC_PATH . '/skins/commons/invoices', '/\\.phtml$/');
}
$invoiceview = new Shineisp_Invoice();
$invoiceview->assign('header', $database['header']);
$invoiceview->assign('columns', $database['columns']);
$invoiceview->assign('data', $database['records']);
$html = $invoiceview->render($templateName);
$html2pdf = new HTML2PDF('P', 'A4', 'it', true, 'UTF-8', array(4, 4, 4, 1));
$html2pdf->WriteHTML($html);
$html2pdf->Output(PUBLIC_PATH . $filename, "F");
// Execute a custom event
self::events()->trigger('invoices_pdf_created', "Invoices", array('order' => $order, 'invoice' => $invoice, 'file' => $filename));
return PUBLIC_PATH . $filename;
}
}
return false;
}