403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/hkosl.com/innoutstorage/webadmin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hkosl.com/innoutstorage/webadmin/output_payment.php
<?php
	require_once('check_login.php');

	if (empty($_GET["payment_id"]) || (int)$_GET["payment_id"] <= 0 || empty($_SESSION["_payment_type"])) {
		echo "<script>alert('請選擇正確的付款記錄。'); history.back();</script>";
		exit;
	}

	/**
	 * PHPExcel
	 *
	 * Copyright (C) 2006 - 2014 PHPExcel
	 *
	 * This library is free software; you can redistribute it and/or
	 * modify it under the terms of the GNU Lesser General Public
	 * License as published by the Free Software Foundation; either
	 * version 2.1 of the License, or (at your option) any later version.
	 *
	 * This library is distributed in the hope that it will be useful,
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	 * Lesser General Public License for more details.
	 *
	 * You should have received a copy of the GNU Lesser General Public
	 * License along with this library; if not, write to the Free Software
	 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
	 *
	 * @category   PHPExcel
	 * @package    PHPExcel
	 * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
	 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
	 * @version    1.8.0, 2014-03-02
	 */

	/** Error reporting */
	/*error_reporting(E_ALL);
	ini_set('display_errors', TRUE);
	ini_set('display_startup_errors', TRUE);*/
	date_default_timezone_set('Asia/Hong_Kong');

	ini_set('apc.cache_by_default', 0);

	if (PHP_SAPI == 'cli')
		die('This example should only be run from a Web Browser');

	/** Include PHPExcel */
	require_once dirname(__FILE__) . '/PHPExcel_1.8.0/Classes/PHPExcel.php';

	$reader   = PHPExcel_IOFactory::createReader('Excel5'); // 讀取舊版 excel 檔案
	$PHPExcel = $reader->load("../webadmin/PHPExcel_1.8.0/payment_template2.xls"); // 檔案名稱
	$sheet    = $PHPExcel->getSheet(0); // 讀取第一個工作表(編號從 0 開始)

	// Set Orientation, size and scaling
	$PHPExcel->setActiveSheetIndex(0);
	$PHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
	$PHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
	$PHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
	$PHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
	$PHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);

	$payment_info   = get_payment_by_id((int)$_GET["payment_id"]);
	$paymethod_info = get_master_type_code("PAYMENT_METHOD", $payment_info["paymethod"]);

	$customer_info = get_customer($payment_info["customer_id"]);

	$docdate = new DateTime($payment_info["docdate"]);
	// Add some data
	if ($_SESSION["_payment_type"] == "DEPOSIT") {
		$sheet->setCellValue('A3', "按金付款收據");
	} else if ($_SESSION["_payment_type"] == "DEPOSIT") {
		$sheet->setCellValue('A3', "正式收據");
	}

	$sheet
		->setCellValue('H4', $customer_info["code"])
		->setCellValue('H5', $customer_info["customer_name"])
		->setCellValue('H6', rsa_crypt($customer_info["address"], 2))
		->setCellValue('AY4', $payment_info["code"])
		->setCellValue('AY5', $paymethod_info["name_tc"])
		->setCellValue('AY6', $docdate->format("Y-m-d"))
		->setCellValue('AZ13', numberformat($payment_info["amount"]));

	$sheet->getStyle('H6')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);

	$payment_dtl_info = get_payment_dtl((int)$_GET["payment_id"]);

	if (!empty($payment_dtl_info)) {
		foreach ($payment_dtl_info as $dtl) {
			$type_info = get_master_type_code("PAYMENT_TYPE", $dtl["payable_type"]);

			if ($dtl["payable_type"] == "DEPOSIT") {
				$payable_info = get_deposit($dtl["payable_id"]);
				$payable_code = $payable_info["deposit_code"];
			} else {
				$payable_info = get_invoice($dtl["payable_id"]);
				$payable_code = $payable_info["invoice_code"];
			}

			$sheet->setCellValue('H4', $customer_info["code"]);

			$sheet->insertNewRowBefore(11, 2);
			$sheet->getStyle('AZ11')->getNumberFormat()->setFormatCode('0.00');
			$sheet->mergeCells('AZ11:BE11');
			$sheet->getStyle("AZ11:BE11")->getFont()->setBold(false);

			$sheet
				->setCellValue('A11', $type_info["name_tc"] . " (編號: " . $payable_code . ")")
				->setCellValue('AZ11', numberformat($payable_info["amount"]))
				->getStyle("A11")->getFont()->setBold(false);;

			$order_info      = get_order($payable_info["order_id"]);
			$order_room_info = get_order_room($order_info["id"]);

			//$sheet->setCellValue('B12', "合約編號: " . $order_info["code"]);

			$order_room_list = "";

			foreach ($order_room_info as $order_room) {
				$room_info        = get_room($order_room["room_id"]);
				$master_room_info = get_master_room($room_info["master_room_id"]);
				$order_room_list  = $room_info["code"] . " (" . $master_room_info["length"] . "'x" . $master_room_info["width"] . "'x" . $master_room_info["height"] . "')";

				$sheet->setCellValue('B12', "合約編號: " . $order_info["code"] . ", 租用單位: " . $order_room_list);
			}

			$sheet->getStyle("B12")->getFont()->setBold(false);
		}
	}

// Redirect output to a client’s web browser (Excel5)
	header('Content-Type: application/vnd.ms-excel');
	header('Content-Disposition: attachment;filename="Payment_' . $payment_info["code"] . '.xls"');
	header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
	header('Cache-Control: max-age=1');

// If you're serving to IE over SSL, then the following may be needed
	header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
	header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
	header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
	header('Pragma: public'); // HTTP/1.0

	$objWriter = PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel5');
	$objWriter->save('php://output');
	exit;



Youez - 2016 - github.com/yon3zu
LinuXploit