Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
ltms.eemo.co.kr
/
public_html
/
super
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/ltms.eemo.co.kr/public_html/super/depletion_list2.php
<? include_once("inc_header.php"); $on_menu="farm_manager"; $on_sub_menu="farm_manager_".$_GET[jong_type]; $arr_jongtype=array("1"=>"육계","2"=>"삼계","3"=>"오리","4"=>"토종닭"); if(!$sel_date) {$sel_date=date('Y-m-d');} $tabActive = 7; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?=$_TITLE?></title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="font-awesome/css/font-awesome.css" rel="stylesheet"> <link href="css/plugins/iCheck/custom.css" rel="stylesheet"> <link href="css/plugins/chosen/bootstrap-chosen.css" rel="stylesheet"> <link href="css/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet"> <link href="css/plugins/colorpicker/bootstrap-colorpicker.min.css" rel="stylesheet"> <link href="css/plugins/cropper/cropper.min.css" rel="stylesheet"> <link href="css/plugins/switchery/switchery.css" rel="stylesheet"> <link href="css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet"> <link href="css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet"> <link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet"> <link href="css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet"> <link href="css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet"> <link href="css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet"> <link href="css/plugins/clockpicker/clockpicker.css" rel="stylesheet"> <link href="css/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet"> <link href="css/plugins/select2/select2.min.css" rel="stylesheet"> <link href="css/plugins/touchspin/jquery.bootstrap-touchspin.min.css" rel="stylesheet"> <link href="css/plugins/dualListbox/bootstrap-duallistbox.min.css" rel="stylesheet"> <link href="css/plugins/footable/footable.core.css" rel="stylesheet"> <link href="css/plugins/dataTables/datatables.min.css" rel="stylesheet"> <link href="css/animate.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet"> </head> <style> .table tbody tr td{ vertical-align: middle; } .table thead tr th{ vertical-align: middle; } </style> <body class="pace-done mini-navbar"> <div id="wrapper"> <? include_once("inc_sidemenu.php"); ?> <div id="page-wrapper" class="gray-bg"> <? include_once("inc_top.php"); include_once("inc_top_submenu.php"); include_once("inc_now_position.php"); include_once("navigation.php"); ?> <div class="card mt-3 animated fadeInRight"> <div class="card-body"> <div class="tabs-container"> <? // tab 메뉴 include_once("inc_ship.php"); ?> <div class="tab-content"> <div role="tabpanel" id="tab-1" class="tab-pane active show"> <div class="panel-body"> <!-- <form name='frm_search' method='get'> <table class="table"> <tr style="border-top: hidden;"> <td> <div class="row mt-2 ml-2"> <div class="form-group row" id="data_1"> <label class="col-sm-4 col-form-label font-bold">출하일 선택</label> <div class="input-group date col-sm-8"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span><input type="text" class="form-control" name='sel_date' id='sel_date' value="<?=$sel_date?>" onchange="this.form.submit()" autocomplete="off" placeholder="출하일자"> </div> </div> <div class="col-sm-4 m-b-xs"> </div> </div> </td> </tr> </table> <input type='hidden' name='pbreedtype' value="<?=$pbreedtype?>"> <input type='hidden' name='jong_type' value="<?=$jong_type?>"> </form> --> <!-- <table class="table table-bordered text-center mb-5"> <thead> <tr> <th>구분</th> <th>1.00~1.09</th> <th>1.10~1.19</th> <th>1.20~1.29</th> <th>1.30~1.39</th> <th>1.40~1.49</th> <th>1.50~1.59</th> <th>1.60~1.69</th> <th>1.70~1.79</th> <th>1.80~1.89</th> <th>합계</th> </tr> </thead> <tbody> <? $today_week = date("w",strtotime($sel_date)); $today_jucha = date("W",strtotime($sel_date)); $today_year = date("Y",strtotime($sel_date)); $arr_yo=array("0"=>"sun","1"=>"mon","2"=>"tue","3"=>"wed","4"=>"thu","5"=>"fri","6"=>"sat"); $db_col="susu_".$arr_yo[$today_week]; //echo "select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1000 and weight < 1100 and jyear='$today_year' and jucha='$today_jucha' "; $rs_1=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1000 and weight < 1100 and jyear='$today_year' and jucha='$today_jucha' "); $rs_2=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1100 and weight < 1200 and jyear='$today_year' and jucha='$today_jucha' "); $rs_3=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1200 and weight < 1300 and jyear='$today_year' and jucha='$today_jucha' "); $rs_4=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1300 and weight < 1400 and jyear='$today_year' and jucha='$today_jucha' "); $rs_5=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1400 and weight < 1500 and jyear='$today_year' and jucha='$today_jucha' "); $rs_6=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1500 and weight < 1600 and jyear='$today_year' and jucha='$today_jucha' "); $rs_7=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1600 and weight < 1700 and jyear='$today_year' and jucha='$today_jucha' "); $rs_8=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1700 and weight < 1800 and jyear='$today_year' and jucha='$today_jucha' "); $rs_9=RS("select sum( $db_col ) as cnt from doge_yejun_plan where company_no='{$_COOKIE[ucompany_no]}' and breedtype='$pbreedtype' and jong_type='$jong_type' and weight >= 1800 and weight < 1900 and jyear='$today_year' and jucha='$today_jucha' "); ?> <tr> <td>도계계획</td> <td id='dd_1' ddv_1='<?=$rs_1[cnt]?>'><?=number_format($rs_1[cnt])?></td> <td id='dd_2' ddv_2='<?=$rs_2[cnt]?>'><?=number_format($rs_2[cnt])?></td> <td id='dd_3' ddv_3='<?=$rs_3[cnt]?>'><?=number_format($rs_3[cnt])?></td> <td id='dd_4' ddv_4='<?=$rs_4[cnt]?>'><?=number_format($rs_4[cnt])?></td> <td id='dd_5' ddv_5='<?=$rs_5[cnt]?>'><?=number_format($rs_5[cnt])?></td> <td id='dd_6' ddv_6='<?=$rs_6[cnt]?>'><?=number_format($rs_6[cnt])?></td> <td id='dd_7' ddv_7='<?=$rs_7[cnt]?>'><?=number_format($rs_7[cnt])?></td> <td id='dd_8' ddv_8='<?=$rs_8[cnt]?>'><?=number_format($rs_8[cnt])?></td> <td id='dd_9' ddv_9='<?=$rs_9[cnt]?>'><?=number_format($rs_9[cnt])?></td> <td id='dd_10' ddv_10='<?=($rs_1[cnt]+$rs_2[cnt]+$rs_3[cnt]+$rs_4[cnt]+$rs_5[cnt]+$rs_6[cnt]+$rs_7[cnt]+$rs_8[cnt]+$rs_9[cnt])?>'><?=number_format($rs_1[cnt]+$rs_2[cnt]+$rs_3[cnt]+$rs_4[cnt]+$rs_5[cnt]+$rs_6[cnt]+$rs_7[cnt]+$rs_8[cnt]+$rs_9[cnt])?></td> </tr> <tr> <td>출하계획</td> <td id='dv_1'>0</td> <td id='dv_2'>0</td> <td id='dv_3'>0</td> <td id='dv_4'>0</td> <td id='dv_5'>0</td> <td id='dv_6'>0</td> <td id='dv_7'>0</td> <td id='dv_8'>0</td> <td id='dv_9'>0</td> <td id='dv_10'>0</td> </tr> </tbody> <tfoot style="background-color: #F5F5F6;" class="font-bold"> <tr> <td>필요수량</td> <td id='dt_1'>0</td> <td id='dt_2'>0</td> <td id='dt_3'>0</td> <td id='dt_4'>0</td> <td id='dt_5'>0</td> <td id='dt_6'>0</td> <td id='dt_7'>0</td> <td id='dt_8'>0</td> <td id='dt_9'>0</td> <td id='dt_10'>0</td> </tr> </tfoot> </table> <hr> --> <? $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); $bl_view=false; while($rs=mysql_fetch_array($result)) { $rs_parts=RS("select * from farm_contract_parts where contract_no='{$rs[no]}' order by no desc limit 0,1 "); $rs_ok=RS("select * from farm_chulha_plan where parts_no='{$rs_parts[no]}' and (is_confirm='-1' or is_ltman_ok='-1') "); if($rs_ok[no]) { $bl_view=true; } } if($bl_view==true) { ?> <table class="table table-bordered text-center mt-0 mb-4"> <thead> <tr> <th rowspan="2" class='bg-danger'>순번</th> <th colspan="3" class='bg-danger'>기본사항</th> <th colspan="8" class='bg-danger'>거절 축사별</th> <th colspan="3" class='bg-danger'>합계</th> <th rowspan="2" class='bg-danger'>확인</th> </tr> <tr> <th class='bg-danger'>농가명</th> <th class='bg-danger'>지역</th> <th class='bg-danger'>거리</th> <th class='bg-danger'>축사</th> <th class='bg-danger'>출하일자</th> <th class='bg-danger'>일령</th> <th class='bg-danger'>출하수수</th> <th class='bg-danger'>총중량</th> <th class='bg-danger'>평체</th> <th class='bg-danger'>담당자거절</th> <th class='bg-danger'>농가거절</th> <th class='bg-danger'>출하수수</th> <th class='bg-danger'>총중량</th> <th class='bg-danger'>평체</th> </tr> </thead> <tbody> <? $rs_company=RS("select * from contractor_company where no='{$_COOKIE[ucompany_no]}' "); $arr_dist=array(); $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); while($rs=mysql_fetch_array($result)) { $rs_farm=RS("select * from farm where no='{$rs[farm_no]}' "); $dist=getDistanceBetweenPoints($rs_farm[lat],$rs_farm[lon],$rs_company[lat],$rs_company[lng]); $arr_dist[$rs[no]]=$dist; } asort($arr_dist); $arr_seq_contract_no=array(); foreach($arr_dist as $ak => $av) { $arr_seq_contract_no[]=$ak; } $str_seq_contract_no=implode(",",$arr_seq_contract_no); if($str_seq_contract_no) { $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' ORDER BY FIELD(no, $str_seq_contract_no ) "); } else { $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); } $ttt_ipchu_susu=0; $ttt_now_susu=0; $ttt_chul_su=0; $ttt_chul_remain_su=0; $n=1; while($rs=mysql_fetch_array($result)) { $rs_parts=RS("select * from farm_contract_parts where contract_no='{$rs[no]}' order by no desc limit 0,1 "); $rs_farm_mem=RS("select * from member where farm_no='{$rs[farm_no]}' and mtype='1' "); //echo "select a.*, b.dong_name from farm_chulha_plan a, farm_dong_info b where a.parts_no='{$rs_parts[no]}' and a.jdate='$sel_date' and a.is_confirm='1' and a.dong_no=b.no order by b.dong_name asc <br>"; $result_plan_ok=mysql_query("select a.*, b.dong_name from farm_chulha_plan a, farm_dong_info b where a.parts_no='{$rs_parts[no]}' and (a.is_confirm='-1' or a.is_ltman_ok='-1') and a.dong_no=b.no order by CAST(b.dong_name AS DECIMAL(10,2)) asc ") or die(); $rowspan=mysql_num_rows($result_plan_ok); if(mysql_num_rows($result_plan_ok)) { $rs_farm=RS("select * from farm where no='{$rs_parts[farm_no]}' "); $rs_plan_ok=mysql_fetch_array($result_plan_ok); $rs_ipchu_date=RS("select min(jdate) as vdate from farm_ipchu_confirm_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' "); $sdate = new DateTime($rs_ipchu_date[vdate]); $edate = new DateTime($rs_plan_ok[jdate]); $diff = date_diff($sdate, $edate); $rs_sum_dong_weight=RS("select max(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and jdate <= '{$rs_plan_ok[jdate]}' "); $rs_sum_susu=RS("select sum(chul_su) as cnt from farm_chulha_plan where parts_no='{$rs_parts[no]}' "); $rs_sum_weight=RS("select avg(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' "); $is_ltms_auth=RS("select * from farm_chulha_plan where parts_no='{$rs_parts[no]}' "); $rs_dote=RS("select * from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and weight > 0 order by weight desc limit 0,1 "); //$arr_chul_weight[$rs_dote[weight]]=$arr_chul_weight[$rs_dote[weight]]+$rs_chulha[chul_su]; //echo $rs_dote[weight]."=".$arr_chul_weight[$rs_dote[weight]]."+".$rs_chulha[chul_su]."<br>"; //평균체중구하기 $sum_chul_su=0; $arr_weight=array(); $result_weight_dong=mysql_query("select * from farm_chulha_plan where parts_no='{$rs_parts[no]}' and (is_confirm='1' or is_ltman_ok='-1') ") or die(); while($rs_wdong=mysql_fetch_array($result_weight_dong)) { $rs_max_dong_weight=RS("select max(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_wdong[dong_no]}' "); $arr_weight[]=$rs_max_dong_weight[cnt]; $sum_chul_su+=$rs_wdong[chul_su]; } if(count($arr_weight) > 0) { $avg_weight=floor(array_sum($arr_weight)/count($arr_weight)); } //--평균체중구하기 ?> <tr > <td rowspan="<?=$rowspan?>"><?=$n?></td> <td rowspan="<?=$rowspan?>" onclick="javascript:list_view('<?=$rs[no]?>');" style="cursor: pointer;"><?=$rs_farm[farm_name]?></td> <td rowspan="<?=$rowspan?>" onclick="javascript:list_view('<?=$rs[no]?>');" style="cursor: pointer;"><?=$rs_farm[sido]?>/<?=$rs_farm[sigungu]?></td> <td rowspan="<?=$rowspan?>"><?=sprintf("%.1f",$arr_dist[$rs[no]]/1000)?>Km</td> <td><?=$rs_plan_ok[dong_name]?></td> <td><?=$rs_plan_ok[jdate]?></td> <td><?=($diff->days+1)?></td> <td><?=number_format($rs_plan_ok[chul_su])?></td> <td><?=number_format(($rs_sum_dong_weight[cnt]*$rs_plan_ok[chul_su])/1000)?>kg</td> <td><?=sprintf("%.2f",($rs_sum_dong_weight[cnt])/1000)?>kg</td> <td> <?if($rs_plan_ok[is_ltman_ok]==-1) { //echo "<i class='fa fa-dot-circle-o text-danger'></i>"; ?><i class="fa fa-info-circle fa-2x" onclick="fn_r_sau('<?=$rs_plan_ok[is_ltman_reject_sau]?>')"></i><? }?> </td> <td> <?if($rs_plan_ok[is_confirm]==-1) { //echo "<i class='fa fa-dot-circle-o text-danger'></i>"; ?><i class="fa fa-info-circle fa-2x" onclick="fn_r_sau('<?=$rs_plan_ok[is_reject_sau]?>')"></i><? }?> </td> <td rowspan="<?=$rowspan?>"><?=number_format($sum_chul_su)?></td> <td rowspan="<?=$rowspan?>"><?=number_format(($avg_weight*$sum_chul_su)/1000)?>kg</td> <td rowspan="<?=$rowspan?>"><?=sprintf("%.2f",($avg_weight/1000))?>kg</td> <td rowspan="<?=$rowspan?>"> <? if($is_ltms_auth[is_ltms_auth]==0) { ?> <button class="btn btn-white text-dark" type="button" onclick="fn_reject_submit('<?=$rs_parts[no]?>','<?=$rs_farm[farm_name]?>')"><i class="fa fa-check"></i> <span class="bold text-dark">확인</span></button> <? } else { ?><span class="text-success"><?=str_replace(" ","<br>",$is_ltms_auth[is_ltms_auth_date])?> 에 확인</span><? } ?> </td> </tr> <? while($rs_plan_ok=mysql_fetch_array($result_plan_ok)) { $rs_ipchu_date=RS("select min(jdate) as vdate from farm_ipchu_confirm_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' "); $sdate = new DateTime($rs_ipchu_date[vdate]); $edate = new DateTime($rs_plan_ok[jdate]); $diff = date_diff($sdate, $edate); $rs_sum_dong_weight=RS("select weight as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and jdate <= '{$rs_plan_ok[jdate]}' "); ?> <tr> <td><?=$rs_plan_ok[dong_name]?></td> <td><?=$rs_plan_ok[jdate]?></td> <td><?=($diff->days+1)?></td> <td><?=number_format($rs_plan_ok[chul_su])?></td> <td><?=number_format(($rs_sum_dong_weight[cnt]*$rs_plan_ok[chul_su])/1000)?>kg</td> <td><?=sprintf("%.2f",($rs_sum_dong_weight[cnt])/1000)?>kg</td> <td> <?if($rs_plan_ok[is_ltman_ok]==-1) { //echo "<i class='fa fa-dot-circle-o text-danger'></i>"; ?><i class="fa fa-info-circle fa-2x" onclick="fn_r_sau('<?=$rs_plan_ok[is_ltman_reject_sau]?>')"></i><? }?> </td> <td> <?if($rs_plan_ok[is_confirm]==-1) { //echo "<i class='fa fa-dot-circle-o text-danger'></i>"; ?><i class="fa fa-info-circle fa-2x" onclick="fn_r_sau('<?=$rs_plan_ok[is_reject_sau]?>')"></i><? }?> </td> </tr> <?}?> <tr id="list_view_ex<?=$rs[no]?>" style="display: none; background-color: #F5F5F6;"> <td colspan="16"> <table class="table text-center" style="border: hidden; background-color: #F5F5F6;"> <colgroup> <col width="35%"> <col width="20%"> <col width="10%"> <col width=""> </colgroup> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">농가명 : </td> <td class="text-left" style="border: hidden;"><?=$rs_farm[farm_name]?></td> <td class="text-right font-bold" style="border: hidden;">연락처 : </td> <td class="text-left" style="border: hidden;"><?=add_hyphen($rs_farm_mem[cel])?></td> </tr> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">주소 : </td> <td class="text-left" style="border: hidden;"><?=$rs_farm[addr]?> <?=$rs_farm[addr2]?></td> <td class="text-right font-bold" style="border: hidden;">급지 : </td> <td class="text-left" style="border: hidden;">급지</td> </tr> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">계근소 : </td> <td class="text-left" style="border: hidden;"></td> <td class="text-right font-bold" style="border: hidden;">계근소연락처 : </td> <td class="text-left" style="border: hidden;"></td> </tr> </table> </td> </tr> <?$n++;}}?> </tbody> </table> <?}?> <table class="table table-bordered text-center mt-0 mb-4"> <thead> <tr> <th rowspan="2">순번</th> <th colspan="3">기본사항</th> <th colspan="6">축사별</th> <th colspan="3">합계</th> <th rowspan="2">확인</th> </tr> <tr> <th>농가명</th> <th>지역</th> <th>거리</th> <th>축사</th> <th>출하일자</th> <th>일령</th> <th>출하수수</th> <th>총중량</th> <th>평체</th> <th>출하수수</th> <th>총중량</th> <th>평체</th> </tr> </thead> <tbody> <? $arr_chul_weight=array(); $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); while($rs=mysql_fetch_array($result)) { $rs_parts=RS("select * from farm_contract_parts where contract_no='{$rs[no]}' order by no desc limit 0,1 "); $result_cdong=mysql_query("select * from farm_contract_dong where farm_contract_no='{$rs[no]}' ") or die(); while($rs_cdong=mysql_fetch_array($result_cdong)) { $rs_dote=RS("select * from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_cdong[farm_dong_info_no]}' and weight > 0 order by weight desc limit 0,1 "); $arr_chul_weight[$rs_dote[weight]]=$arr_chul_weight[$rs_dote[weight]]+$rs_chulha[chul_su]; } } $rs_company=RS("select * from contractor_company where no='{$_COOKIE[ucompany_no]}' "); $arr_dist=array(); $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); while($rs=mysql_fetch_array($result)) { $rs_farm=RS("select * from farm where no='{$rs[farm_no]}' "); $dist=getDistanceBetweenPoints($rs_farm[lat],$rs_farm[lon],$rs_company[lat],$rs_company[lng]); $arr_dist[$rs[no]]=$dist; } asort($arr_dist); $arr_seq_contract_no=array(); foreach($arr_dist as $ak => $av) { $arr_seq_contract_no[]=$ak; } $str_seq_contract_no=implode(",",$arr_seq_contract_no); if($str_seq_contract_no) { $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' ORDER BY FIELD(no, $str_seq_contract_no ) "); } else { $result=mysql_query("select * from farm_contract where contractor_company_no = '{$_COOKIE[ucompany_no]}' and breed_type='{$arr_jongtype[$jong_type]}' and gps_type='$pbreedtype' and chulha_status >= '3' "); } $ttt_ipchu_susu=0; $ttt_now_susu=0; $ttt_chul_su=0; $ttt_chul_remain_su=0; $n=1; while($rs=mysql_fetch_array($result)) { $rs_parts=RS("select * from farm_contract_parts where contract_no='{$rs[no]}' order by no desc limit 0,1 "); $rs_farm_mem=RS("select * from member where farm_no='{$rs[farm_no]}' and mtype='1' "); //echo "select a.*, b.dong_name from farm_chulha_plan a, farm_dong_info b where a.parts_no='{$rs_parts[no]}' and a.jdate='$sel_date' and a.is_confirm='1' and a.dong_no=b.no order by b.dong_name asc <br>"; $result_plan_ok=mysql_query("select a.*, b.dong_name from farm_chulha_plan a, farm_dong_info b where a.parts_no='{$rs_parts[no]}' and a.is_confirm='1' and a.dong_no=b.no order by CAST(b.dong_name AS DECIMAL(10,2)) asc ") or die(); $rowspan=mysql_num_rows($result_plan_ok); if(mysql_num_rows($result_plan_ok)) { $rs_farm=RS("select * from farm where no='{$rs_parts[farm_no]}' "); $rs_plan_ok=mysql_fetch_array($result_plan_ok); $rs_ipchu_date=RS("select min(jdate) as vdate from farm_ipchu_confirm_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' "); $sdate = new DateTime($rs_ipchu_date[vdate]); $edate = new DateTime($rs_plan_ok[jdate]); $diff = date_diff($sdate, $edate); $rs_sum_dong_weight=RS("select max(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and jdate <= '{$rs_plan_ok[jdate]}' "); $rs_sum_susu=RS("select sum(chul_su) as cnt from farm_chulha_plan where parts_no='{$rs_parts[no]}' "); $rs_sum_weight=RS("select avg(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' "); $is_ltms_auth=RS("select * from farm_chulha_plan where parts_no='{$rs_parts[no]}' "); $rs_dote=RS("select * from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and weight > 0 order by weight desc limit 0,1 "); //$arr_chul_weight[$rs_dote[weight]]=$arr_chul_weight[$rs_dote[weight]]+$rs_chulha[chul_su]; //echo $rs_dote[weight]."=".$arr_chul_weight[$rs_dote[weight]]."+".$rs_chulha[chul_su]."<br>"; //평균체중구하기 $sum_chul_su=0; $arr_weight=array(); $result_weight_dong=mysql_query("select * from farm_chulha_plan where parts_no='{$rs_parts[no]}' and is_confirm='1' ") or die(); while($rs_wdong=mysql_fetch_array($result_weight_dong)) { $rs_max_dong_weight=RS("select max(weight) as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_wdong[dong_no]}' "); $arr_weight[]=$rs_max_dong_weight[cnt]; $sum_chul_su+=$rs_wdong[chul_su]; } if(count($arr_weight) > 0) { $avg_weight=floor(array_sum($arr_weight)/count($arr_weight)); } //--평균체중구하기 ?> <tr onclick="javascript:list_view('<?=$rs[no]?>');" style="cursor: pointer;"> <td rowspan="<?=$rowspan?>"><?=$n?></td> <td rowspan="<?=$rowspan?>"><?=$rs_farm[farm_name]?></td> <td rowspan="<?=$rowspan?>"><?=$rs_farm[sido]?>/<?=$rs_farm[sigungu]?></td> <td rowspan="<?=$rowspan?>"><?=sprintf("%.1f",$arr_dist[$rs[no]]/1000)?>Km</td> <td><?=$rs_plan_ok[dong_name]?></td> <td><?=$rs_plan_ok[jdate]?></td> <td><?=($diff->days+1)?></td> <td><?=number_format($rs_plan_ok[chul_su])?></td> <td><?=number_format(($rs_sum_dong_weight[cnt]*$rs_plan_ok[chul_su])/1000)?>kg</td> <td><?=sprintf("%.2f",($rs_sum_dong_weight[cnt])/1000)?>kg</td> <td rowspan="<?=$rowspan?>"><?=number_format($sum_chul_su)?></td> <td rowspan="<?=$rowspan?>"><?=number_format(($avg_weight*$sum_chul_su)/1000)?>kg</td> <td rowspan="<?=$rowspan?>"><?=sprintf("%.2f",($avg_weight/1000))?>kg</td> <td rowspan="<?=$rowspan?>"> <? if($is_ltms_auth[is_ltms_auth]==0) { ?> <button class="btn btn-white text-dark" type="button" onclick="fn_ok_submit('<?=$rs_parts[no]?>','<?=$sel_date?>')"><i class="fa fa-check"></i> <span class="bold text-dark">확인</span></button> <? } else { ?><span class="text-success"><?=str_replace(" ","<br>",$is_ltms_auth[is_ltms_auth_date])?> 에 확정</span><? } ?> </td> </tr> <? while($rs_plan_ok=mysql_fetch_array($result_plan_ok)) { $rs_ipchu_date=RS("select min(jdate) as vdate from farm_ipchu_confirm_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' "); $sdate = new DateTime($rs_ipchu_date[vdate]); $edate = new DateTime($rs_plan_ok[jdate]); $diff = date_diff($sdate, $edate); $rs_sum_dong_weight=RS("select weight as cnt from farm_dote_input_log where parts_no='{$rs_parts[no]}' and dong_no='{$rs_plan_ok[dong_no]}' and jdate <= '{$rs_plan_ok[jdate]}' "); ?> <tr> <td><?=$rs_plan_ok[dong_name]?></td> <td><?=$rs_plan_ok[jdate]?></td> <td><?=($diff->days+1)?></td> <td><?=number_format($rs_plan_ok[chul_su])?></td> <td><?=number_format(($rs_sum_dong_weight[cnt]*$rs_plan_ok[chul_su])/1000)?>kg</td> <td><?=sprintf("%.2f",($rs_sum_dong_weight[cnt])/1000)?>kg</td> </tr> <?}?> <tr id="list_view_ex<?=$rs[no]?>" style="display: none; background-color: #F5F5F6;"> <td colspan="14"> <table class="table text-center" style="border: hidden; background-color: #F5F5F6;"> <colgroup> <col width="35%"> <col width="20%"> <col width="10%"> <col width=""> </colgroup> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">농가명 : </td> <td class="text-left" style="border: hidden;"><?=$rs_farm[farm_name]?></td> <td class="text-right font-bold" style="border: hidden;">연락처 : </td> <td class="text-left" style="border: hidden;"><?=add_hyphen($rs_farm_mem[cel])?></td> </tr> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">주소 : </td> <td class="text-left" style="border: hidden;"><?=$rs_farm[addr]?> <?=$rs_farm[addr2]?></td> <td class="text-right font-bold" style="border: hidden;">급지 : </td> <td class="text-left" style="border: hidden;">급지</td> </tr> <tr style="border: hidden;"> <td class="text-right font-bold" style="border: hidden;">계근소 : </td> <td class="text-left" style="border: hidden;"></td> <td class="text-right font-bold" style="border: hidden;">계근소연락처 : </td> <td class="text-left" style="border: hidden;"></td> </tr> </table> </td> </tr> <?$n++;}}?> <? $arr_tale_weight=array(); foreach($arr_chul_weight as $ak => $av) { if($ak && $av > 0) { if($ak >= 1000 && $ak < 1100) { $arr_tale_weight[1]=$av; } else if($ak >= 1100 && $ak < 1200) { $arr_tale_weight[2]=$av; } else if($ak >= 1200 && $ak < 1300) { $arr_tale_weight[3]=$av; } else if($ak >= 1300 && $ak < 1400) { $arr_tale_weight[4]=$av; } else if($ak >= 1400 && $ak < 1500) { $arr_tale_weight[5]=$av; } else if($ak >= 1500 && $ak < 1600) { $arr_tale_weight[6]=$av; } else if($ak >= 1600 && $ak < 1700) { $arr_tale_weight[7]=$av; } else if($ak >= 1700 && $ak < 1800) { $arr_tale_weight[8]=$av; } else if($ak >= 1800 && $ak < 1900) { $arr_tale_weight[9]=$av; } } //echo $ak."=>".$av."<br>"; } $arr_tale_weight[10]=array_sum($arr_tale_weight); ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <? include_once("inc_footer.php"); ?> </div> </div> <!-- Mainly scripts --> <script src="js/jquery-3.1.1.min.js"></script> <script src="js/popper.min.js"></script> <script src="js/bootstrap.js"></script> <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <!-- Peity --> <script src="js/plugins/peity/jquery.peity.min.js"></script> <!-- Custom and plugin javascript --> <script src="js/inspinia.js"></script> <script src="js/plugins/pace/pace.min.js"></script> <!-- iCheck --> <script src="js/plugins/iCheck/icheck.min.js"></script> <!-- Peity --> <script src="js/demo/peity-demo.js"></script> <script src="css/messagebox.js"></script> <script src="js/bootbox.js"></script> <!-- Data picker --> <script src="js/plugins/datapicker/bootstrap-datepicker.js"></script> <script src="js/jquery.number.js"></script> </body> </html> <script> $('#data_1 .input-group.date').datepicker({ todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true, language: "kr" }); $(document).ready(function(){ $('.i-checks').iCheck({ checkboxClass: 'icheckbox_square-green', radioClass: 'iradio_square-green', }); $('#sel_date').datepicker({ keyboardNavigation: false, forceParse: false, autoclose: true, format: 'yyyy-mm-dd', }); <? for($n=1;$n<=10;$n++) { ?>$('#dv_<?=$n?>').html("<?=number_format($arr_tale_weight[$n])?>");<? } ?> for(var n=1;n<=10;n++) { var vv=$('#dd_'+n).attr("ddv_"+n); var vv2=$('#dv_'+n).text(); vv2=vv2.replace(",",""); $('#dt_'+n).text( $.number(parseInt(vv)-parseInt(vv2)) ); } }); function list_view(no){ var status = $("#list_view_ex"+no).css("display"); if(status == "none"){ $("#list_view_ex"+no).css('display',''); }else{ $("#list_view_ex"+no).css('display','none'); } } function fn_ok_submit(parts_no,jdate) { if(confirm('정말로 확인처리하시겠습니까?')) { var par="parts_no="+parts_no+"&jdate="+jdate; $.post( "chulha_whakjung_auth_do.php?"+par, function( res ) { var json=eval("("+res+")"); if(json.rst=='1') { window.location.reload(true); } else { } }); } } function fn_reject_submit(parts_no,farm_no) { if(confirm('정말로 거절 확인 처리하시겠습니까?')) { var par="parts_no="+parts_no; $.post( "chulha_reject_auth_do.php?"+par, function( res ) { var json=eval("("+res+")"); if(json.rst=='1') { window.location.reload(true); } else { } }); } } function fn_r_sau(msg) { bootbox.alert({ message: msg, backdrop: true }); } </script>