ÿØÿà JFIF ` ` ÿþ
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/erp/ |
Upload File : |
<? include "../../Lib/config.php"; if( ($_COOKIE['MemberLevel'] == $cf['agent_level'] || $_COOKIE['MemberLevel'] == $cf['trade_level']) ) { echo "<script>history.back();</script>"; } include "../include/top.html"; include "_common.html"; //테이블명 $table = "TB_ERP_ALL"; // 정렬 if (!$order_by_s OR ($order_by_s=="regdate desc")) { $order_by_s = "regdate desc"; } list($order_name, $order_type) = explode(" " , $order_by_s); if($order_name && $order_type=="") $order_type = "asc"; // 보여줄 개수 if(!$list_count_s) $list_count_s = 30; // 검색 설정 $sql_where = ""; if($search_box_s=="simple") { // 검색요소 비우기 $search_key_s=""; $search_word_s=""; $mode_period_s=""; $srh_payment_s=""; $order_state_s=""; $srh_pay_stat_s=""; $date_s1=""; $date_s2=""; $period_date_s=""; $period_yy_s=""; $period_mm_s=""; } if ($search_key_s and $search_word_s) { $sql_where .= " and {$search_key_s} like '%{$search_word_s}%' "; // 검색어 $sql_where2 .= " and erp1.{$search_key_s} like '%{$search_word_s}%' "; // 검색어 } if ($mode_period_s) { $sql_where .= " and ( DATE_FORMAT({$mode_period_s},'%Y-%m-%d') >= '{$date_s1}' and DATE_FORMAT({$mode_period_s},'%Y-%m-%d') <= '{$date_s2}' )"; $sql_where2 .= " and ( DATE_FORMAT(erp1.{$mode_period_s},'%Y-%m-%d') >= '{$date_s1}' and DATE_FORMAT(erp1.{$mode_period_s},'%Y-%m-%d') <= '{$date_s2}' )"; } /* if ($srh_payment_s) { $sql_where .= " and srh_payment like '%{$srh_payment_s}%' "; // 결제수단 } */ if ($order_state_s) { $sql_where .= " and state='{$order_state_s}' "; // 예약상태 $sql_where2 .= " and erp1.state='{$order_state_s}' "; // 예약상태 } if ($srh_pay_stat_s) { $sql_where .= " and pay_state='{$srh_pay_stat_s}' "; // 입금 $sql_where2 .= " and erp1.pay_state='{$srh_pay_stat_s}' "; // 입금 } $sql = "select count(*) as totalhap ,SUM(total_price_won) AS sales_gtot , SUM(deposit*hwan) AS pay_gtot, SUM(balance*hwan) AS pre_gtot from TB_ERP_ALL where 1 {$sql_where}"; $row_sum = db_fetch($sql); // 전체 개수 $data_gres = db_fetch("SELECT COUNT(a_idx) AS res_gtot FROM TB_ERP_ALL where 1 {$sql_where} "); $total= $data_gres['res_gtot']; //전체 인원 $data_gres = db_fetch("SELECT SUM(num_adult+num_child) AS total_inwon FROM TB_ERP_ALL where 1 {$sql_where} "); $total_inwon= $data_gres['total_inwon']; // 페이지수 설정 if (!$page) $page = 1; // 페이지 번호 $line = $list_count_s; // 보여줄 갯수 $list = 10; // 블럭 갯수 $total_page = ceil($total / $line); // 총페이지 if ($total == 0) $total_page = 1; // 데이터가 하나도 없으면 총페이지 1 if ($page > $total_page) $page = $total_page; // 페이지가 전체 페이지보다 크면 페이지 번호를 바꿈 $total_list = intval($total_page / $list); if ($total_page % $list == 0) $total_list--; $curr_list = intval($page / $list); if ($page % $list == 0) $curr_list--; $start_page = $curr_list * $list + 1; $prev_list = $start_page - $list; $next_list = $start_page + $list; $olds = $line * ($page - 1); // 정렬 설정 $sql_order=" {$order_by_s} "; // Limit $limit = " $olds , $line "; $sql = "select * from {$table} where 1 {$sql_where} order by {$sql_order} limit {$limit}"; $rs = db_query($sql); //총견적금액 $data_amount = db_fetch("select SUM(total_sell_price) as total_price, SUM(total_sell_price - total_buy_price) as total_profit from TB_ERP_ALL erp1 LEFT JOIN TB_ERP_ESTIMATE esti on(erp1.a_idx=esti.a_idx) where 1 {$sql_where2} "); $total_price= $data_amount['total_price']; $total_profit= $data_amount['total_profit']; $today = date("Y-m-d"); ?> <style> .memoSaveBtn{cursor:pointer;display:none;clear: both;float: right;background: midnightblue;color: #fff;width: 30px;padding: 2px;border-radius: 3px;margin-right: 4px;margin-top: 3px;} </style> <div class="contents_wrap"> <div class="contents_wrap_in"> <div class="title"><strong>견적서 리스트</strong></div> <div class="contents_detail"> <? // 검색폼 require_once("good_res_search.php"); ?> <div id="Content_box"> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="" class="c_top_table" style=" margin-bottom:20px;font-size:14px;margin-top:18px"> <colgroup> <col width="150px" /> <col /> </colgroup> <tbody> <tr class="bot_line" style="height:40px"> <td style="font-size:14px"> <span>검색결과 : <a href="javascript:;" class="c_black_b"><?=number_format($total)?></a> 건 │ 검색인원 : <span class="c_black_b"><?=number_format($total_inwon)?></span> 명 │ 견적금액 : <span class="c_black_b"><?=number_format($total_price)?></span> 원 │ 회사수익 : <span class="c_blue_b"><?=number_format($total_profit)?></span> 원<!--총 입금액 : <?=number_format($row_sum['pay_gtot'])?>원 총 미입금액 : <?=number_format($row_sum['pre_gtot'])?>원)--></span> </td> </tr> </tbody> </table> <!-- 폼 --> <form name="frm_list" id="frm_list" method="post"> <input type="hidden" name="SqlType" value="chg_order_state"> <div class="c_top_sch_wrap"> <p class="c_top_sch_l" style="margin-left:-10px;"> <select class="mt-3 ml10" name="order_state" id="" hname="" required> <option value="">---진행상태선택---</option> <option value="A">견적서발행</option> <option value="B">예약확정</option> <option value="C">INVOICE발행</option> <option value="D">입금완료</option> <option value="E">VOUCHER발행</option> <option value="F">행사완료</option> <option value="G">취소완료</option> </select> <a href="javascript:;" class="Tbtn gray2 ml5 item_chg_order_state">일괄처리</a> <?if($TO_MB['mb_level']==1 || $TO_MB['mb_level']==2) {?> <span class="ml20">선택된 견적을</span> <a href="javascript:;" class="Tbtn gray2 ml5 item_chg_account_customer">삭제</a> <div style="display:inline-block; margin-left:10px;float:left; border:1px solid #cfcfd1; padding:5px; background-color:#FFF;"> <table> <tr> <td width="16" class="goodStateColorA"></td> <td width="65" align="center">견적서발행</td> <td width="16" class="goodStateColorB"></td> <td width="55" align="center">예약확정</td> <td width="16" class="goodStateColorF"></td> <td width="55" align="center">행사완료</td> <td width="16" class="goodStateColorG"></td> <td width="55" align="center">예약취소</td> </tr> </table> </div> <? } ?> </p> <!-- 상품정렬 --> <ul class="c_top_sch_r"> <!--<li><input type="button" class="Table_btn gray" value="예약등록" onclick="to_dialog.iframe('reg_estimate.php','견적서등록','1200','900',true,true,'yes');">--> <li><input type="button" class="Table_btn gray" value="견적서등록" onclick="location.href='reg_estimate.php'"> <li><a href="javascript:;" class="Tbtn" onclick="to_excel('<?=urlencode($sql_where)?>','<?=urlencode($sql_order)?>');" ><img src="../image/btn/ico_excel.gif" alt="엑셀" /> 엑셀저장</a></li> <li class="ml10"> <select name="order_by_s" id="order_by_s"> <option value="regdate desc" <?=($order_by_s=="regdate desc")?"selected":""?>>견적서발행일 ↑</option> <option value="regdate" <?=($order_by_s=="regdate")?"selected":""?>>견적서발행일 ↓</option> <option value="start_date desc" <?=($order_by_s=="start_date desc")?"selected":""?>>행사날짜 ↑</option> <option value="start_date" <?=($order_by_s=="start_date")?"selected":""?>>행사날짜 ↓</option> <option value="total_price_won desc" <?=($order_by_s=="total_price_won desc")?"selected":""?>>견적금액 ↑</option> <option value="total_price_won" <?=($order_by_s=="total_price_won")?"selected":""?>>견적금액 ↓</option> </select> </li> <li> <select name="list_count_s" id="list_count_s" > <option value="30" <?=($list_count_s==30)?"selected":""?>>30개 보기</option> <option value="50" <?=($list_count_s==50)?"selected":""?>>50개 보기</option> <option value="70" <?=($list_count_s==70)?"selected":""?>>70개 보기</option> <option value="100" <?=($list_count_s==100)?"selected":""?>>100개 보기</option> </select> </li> </ul><!-- 상품등록 --> </div> <table border="0" cellspacing="0" cellpadding="0" class="t_list" width="100%"> <colgroup> <col style=" width:35px" /> <col style=" width:35px" /> <col style=" width:85px" /> <col style=" width:70px" /> <col style=" width:110px" /> <col style=" width:80px" /> <col style=" width:45px" /> <col /> <col style=" width:90px" /> <col style=" width:100px" /> <col style=" width:100px" /> <!--<col style=" width:90px" />--> <col style=" width:100px" /> <col style=" width:100px" /> <col style=" width:100px" /> <!--<col style=" width:90px" />--> <col style=" width:80px" /> <col style=" width:200px" /> </colgroup> <thead> <tr> <th><label for="checkall" class="v_none2">선택 체크</label><input type="checkbox" name="checkall" id="checkall" value="" /></th> <th>복사</th> <th> 견적발행일 <a href="#" class="order_icon" order_name="regdate" order_type="<?=$order_type?>"><img src="/toadmin/image/common/icon_sort<?=($order_name=="regdate")?"_".$order_type:""?>.png"></a> </th> <th>진행상태</th> <th>고객명/연락처</th> <th>국적</th> <th>인원</th> <th>행사명</th> <th> 행사날짜 <a href="#" class="order_icon" order_name="start_date" order_type="<?=$order_type?>"><img src="/toadmin/image/common/icon_sort<?=($order_name=="start_date")?"_".$order_type:""?>.png"></a> </th> <th>견적금액</th> <th>지출금액</th> <!--<th>계약금</th>--> <th>미납액</th> <th>회사수익</th> <th>가이드</th> <!--<th><a href="javascript:;" onclick="confirm_save()">확정유무</a></th>--> <th>담당자</th> <th>메모 <input type="button" value="저장" onClick="memo_save('frm_list');" class="Table_btn gray"></th> </tr> </thead> <tbody> <? for($i=0 ; $i < $row = db_fetch_array($rs) ; $i++){ /*if(devCookie()){ p($row); exit; }*/ $inwon = $row['num_adult'] + $row['num_child']; $esti = db_fetch("SELECT * FROM TB_ERP_ESTIMATE where a_idx='{$row[a_idx]}' "); $fee = ceil($esti['total_buy_price'] * ($row['fee_rate'] / 100)); $newdate = date("Y-m-d", strtotime("+3 day", strtotime($row['regdate']))); $row['start_date'] = str_replace("-", ".", $row['start_date']); $row['end_date'] = str_replace("-", ".", $row['end_date']); //$profit = $row['total_price'] - $esti['total_buy_price']; $profit = $esti['total_sell_price'] + $fee - $esti['total_buy_price']; if($profit < 0) { $profit_color = "color:red;"; } else { $profit_color = "color:blue;"; } ?> <tr <?if ( $row['state']=="G" )echo "class='cancel_line'";?>> <td><input type="checkbox" name="res_no_arr[]" class="item_checkbox_res" value="<?=$row['a_idx']?>" /></td> <td><img src="../image/icon/btn_copy.gif" onclick="erp_copy('<?=$row['a_idx']?>')" title="복사" style="cursor:pointer;"/></td><!-- 복사 --> <td><?=$row['regdate']?></td><!-- 견적발행일 --> <td class="erpStateColor<?=$row['state']?>"> <? switch($row['state']){ case "A": $state = "견적서발행"; break; case "B": $state = "예약확정"; break; case "C": $state = "INVOICE발행"; break; case "D": $state = "입금완료"; break; case "E": $state = "VOUCHER발행"; break; case "F": $state = "행사완료"; break; case "G": $state = "취소완료"; break; } echo $state; ?> <!-- <? if($row['balance'] == 0) { ?> <span class="icon_paid">완납</span> <? } else { ?> <span class="icon_unpaid">미납</span> <? } ?> --> </td><!-- 진행상태 --> <td class="listup"><?=$row['res_name']?><br><?=$row['res_phone']?> <span class="visibility_pop"> <div class="visibility_text"> <a href="/toadmin/erp/edit_customer.php?"><i class="xi-reply" style="margin-right:2px;margin-top:-2px;vertical-align:middle;font-size:15px;"></i>고객리스트</a></br> </div> </span> </td><!-- 예약자 --> <td><?=$row['res_nationality']?></td><!-- 국적 --> <td><?=$inwon?></td><!-- 인원 --> <td class="t_title" style="cursor:pointer;" onclick="location.href='edit_estimate.php?a_idx=<?=$row['a_idx']?>'"> <strong class="t_strong"><?=$row['good_name']?></strong> <!--new icon--> <?if($today >= $row['regdate'] && $today <= $newdate) : ?> <img src="../image/new.gif"> <? endif; ?> <?php // if(devCookie()) { $dir = "./upload/".$row['a_idx']."/"; if(is_dir('./upload/')){ if ($dirop2 = opendir('./upload/')) { while (($filerd2 = readdir($dirop2)) != false) { if ($filerd2 == '.' || $filerd2 == '..') { continue; }else{ $fileFolder = explode("_",$filerd2); $fileFolders = $fileFolder[0]; if($row['a_idx'] == $fileFolders){ $fileFolder = $fileFolder; if ($dirop3 = opendir('./upload/'.$filerd2)) { while (($filerd3 = readdir($dirop3)) != false) { if ($filerd3 == '.' || $filerd3 == '..') { continue; } if($filerd3){ echo '<img src="../../image/board/bullet_disk.gif" align="absmiddle" alt="첨부파일">'; break; closedir($dirop3); } } } closedir($dirop3); } } } } closedir($dirop2); } // } ?> </td><!-- 행사명 --> <td><?=$row['start_date']?> ~ <?=$row['end_date']?></td><!-- 행사날짜 --> <td style="text-align:right;padding-right:10px"> ₩ <?=number_format($row['total_price'])?> </td><!-- 견적금액 --> <td style="text-align:right;padding-right:10px"> ₩ <?=number_format($esti['total_buy_price'])?> </td><!-- 지출금액 --> <!--<td style="text-align:right;padding-right:10px" class="txt_r ls-1"><?=$row['currency']?> <?=number_format($row['deposit'])?></td>--> <td style="text-align:right;padding-right:10px" class="txt_r ls-1"> <? if ($row['state'] == 'B') { ?> <span class="c_red">₩ <?=number_format($row['total_price'])?></span> <? } else { ?> 0 <? } ?> </td><!-- 미납금 --> <td style="text-align:right;padding-right:10px;<?=$profit_color?>"> ₩ <?=number_format($profit)?> </td><!--회사수익--> <td> <form> <select name="language" > <option value="none">=== 가이드 ===</option> </select> </form> </td><!-- 가이드 --> <td><?=$row['charger']?></td> <td> <textarea class="gMemoArea" id="erpMemo<?=$row['a_idx']?>" aidx="<?=$row['a_idx']?>" name="g_memo_arr[]" style="width:95%;height:45px"><?=$row['g_memo']?></textarea> <input type="hidden" name="a_idx_arr[]" value="<?=$row['a_idx']?>" /> <p class="memoSaveBtn" id="memoSaveBtn-<?=$row['a_idx']?>" aidx="<?=$row['a_idx']?>">저장</p> </td><!-- 메모 --> </tr> <? } ?> </tbody> </table> </form> <!-- 폼 --> <? echo adm_get_paging($total_page, $page, $list, "?$rhref&page=", ""); ?> </div> </div> </div> </div> <script type="text/javascript"> var res_good_num=''; function reserv_good(g_uid,d_uid) { if ( !confirm('견적을 진행하시겠습니까?') ) return; to_dialog.iframe('good_res_reg.html?g_uid='+g_uid+'&d_uid='+d_uid,'여행상품예약','1200','700',true,true,'yes'); } $(document).ready(function(){ $("#order_by_s").on("change",function(){ var order_by_s = $("#order_by_s").val(); var list_count_s = $("#list_count_s").val(); window.document.location.href='<?=$PHP_SELF?>?<?=$rhref?>&order_by_s='+order_by_s+'&list_count_s='+list_count_s; }); $("#list_count_s").on("change",function(){ var order_by_s = $("#order_by_s").val(); var list_count_s = $("#list_count_s").val(); window.document.location.href='<?=$PHP_SELF?>?<?=$rhref?>&order_by_s='+order_by_s+'&list_count_s='+list_count_s; }); $(".order_icon").on("click",function(){ var order_type = $(this).attr('order_type'); if(order_type == 'desc') { // 반대로 바꿈 order_type = ""; } else { order_type = " desc"; } var order_by_s = $(this).attr('order_name') + order_type; var list_count_s = $("#list_count_s").val(); window.document.location.href='<?=$PHP_SELF?>?<?=$rhref?>&order_by_s='+order_by_s+'&list_count_s='+list_count_s; }); $("#checkall").on("click",function(){ $(".item_checkbox_res").prop("checked",$(this).prop("checked")); }); $(".item_chg_order_state").on("click",function(){ if($(".item_checkbox_res:checked").length==0){ alert('적어도 한개 항목을 선택해 주세요.'); return; } if(!confirm('예약전달 상태를 변경하시겠습니까?')) return; //ajax_post("ajax_proc","good_res_proc.html","frm_list"); var f = document.frm_list; f.SqlType.value = "update_order"; f.action = "res_proc.php"; f.submit(); }); $(".item_chg_account_customer").on("click",function(){ var cnt = parseInt($(".item_checkbox_res:checked").length); if(cnt==0) { alert('적어도 한개 항목을 선택해 주세요.'); return; } if(!confirm('선택된 견적을 삭제하시겠습니까?')) return; var f = document.frm_list; f.SqlType.value = "del_order"; f.action = "res_proc.php"; f.submit(); }); }); //엑셀출력 function to_excel(sql_where,sql_order) { if(!confirm('1,000건이하로 엑셀다운로드됩니다.\n시간이 소요될수 있습니다.\n엑셀파일을 다운로드 하시겠습니까?')) return; document.location.href='res_excel.html?sql_where='+sql_where+'&sql_order='+sql_order; } function memo_save(){ if(confirm('전체 메모를 수정하시겠습니까?')){ document.querySelectorAll('.memoSaveBtn').length; for(i = 0; i < document.getElementsByClassName('memoSaveBtn').length; i++){ if(document.getElementsByClassName('memoSaveBtn')[i].style.display == 'block'){ aidx = document.getElementsByClassName('memoSaveBtn')[i].getAttribute('aidx'); if(parseInt(aidx) > 0 ){ saveMemo(aidx); } } } } } // 메모수정 /*function memo_save() { if (!confirm('메모를 수정하시겠습니까?')) return; document.frm_list.SqlType.value = "memo_ins"; document.frm_list.action = "res_proc.php?s=1<?=$_rhref?>"; document.frm_list.submit(); }*/ // 확정유무수정 function confirm_save() { if (!confirm('수정하시겠습니까?')) return; document.frm_list.SqlType.value = "confirm_ins"; document.frm_list.action = "res_proc.php?s=1<?=$_rhref?>"; document.frm_list.submit(); } // erp copy function erp_copy(a_idx) { var params = "a_idx="+a_idx+"<?=$_rhref?>"; if(!a_idx) return; if (!confirm('복사를 진행하시겠습니까?')) return; ajax_post("","erp_copy.php?"+params); } $('.gMemoArea').focus(function(){ aidx = $(this).attr('aidx'); $('#memoSaveBtn-'+aidx).slideDown(); }); $('.memoSaveBtn').click(function(){ aidx = $(this).attr('aidx'); saveMemo(aidx); }); function saveMemo(aidx) { if (!aidx) { iziToast.show({ timeout: 3000, color: 'red', title: '메모저장오류발생', message: '적용 실패 개발자에게 문의주세요.', }); return false; } gMemoContents = $('#erpMemo' + aidx).val(); // console.log('gMemoContents is ' + gMemoContents); $.ajax({ type: "post", url: "/toadmin/ajaxData/", dataType: 'json', data: {'mode': 'setResErpMemo', aidx, gMemoContents}, async: false, success: function (data) { console.log('data is ' + JSON.stringify(data)); if (data.result == true) { $('#erpMemo' + aidx).val(data.gMemoContents); iziToast.show({ timeout: 1000, color: 'green', title: '메모', message: '저장되었습니다.', }); } else { iziToast.show({ timeout: 10000, color: 'red', title: '메모', message: '저장 실패 - 개발자에게 문의하세요.', }); } }, error: function (a, b, c) { console.log(JSON.stringify(a)); console.log(b); console.log(c); console.log('error'); iziToast.show({ timeout: 10000, color: 'red', title: 'PHP ERROR 관리자 메모', message: '저장 실패 - 개발자에게 문의하세요.', }); } }); // console.log('resSeq is ' + resSeq); $('#memoSaveBtn-'+aidx).slideUp(); } </script> <? include "../include/footer.html" ?>