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/hatchery_jucha_plan_mody_do.php
<? session_cache_limiter('no-cache, must-revalidate'); session_start(); header("Pragma: no-cache"); header("Cache-Control: no-cache,must-revalidate"); header("Content-Type: text/html; charset=utf-8"); include_once("dbconn.php"); include_once("lib.php"); foreach($_GET as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } foreach($_POST as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } $arr_rst=array(); $rs=RS("select * from hatchery_jucha_plan where no='$no' "); $arr_vv=array(); $arr_vv[0]=${"frm".$no."_mon"}; $arr_vv[1]=${"frm".$no."_tue"}; $arr_vv[2]=${"frm".$no."_wed"}; $arr_vv[3]=${"frm".$no."_thu"}; $arr_vv[4]=${"frm".$no."_fri"}; $arr_vv[5]=${"frm".$no."_sat"}; $arr_vv[6]=${"frm".$no."_sun"}; $gegun=${"frm".$no."_gegun"}; $sum=array_sum($arr_vv); $arr_day=array(); $gendate = new DateTime(); for($n=1;$n<=7;$n++) { $gendate->setISODate($rs[jyear],$rs[jucha],$n); //year , week num , day $arr_day[$n-1]=$gendate->format('Y-m-d'); } //echo $gendate->format('d-m-Y'); //"prints" 26-12-2013 $query="update hatchery_jucha_plan set susu_mon='{$arr_vv[0]}', susu_tue='{$arr_vv[1]}', susu_wed='{$arr_vv[2]}', susu_thu='{$arr_vv[3]}', susu_fri='{$arr_vv[4]}', susu_sat='{$arr_vv[5]}', susu_sun='{$arr_vv[6]}', sum_susu='$sum', susu_mon_jdate='{$arr_day[0]}', susu_tue_jdate='{$arr_day[1]}', susu_wed_jdate='{$arr_day[2]}', susu_thu_jdate='{$arr_day[3]}', susu_fri_jdate='{$arr_day[4]}', susu_sat_jdate='{$arr_day[5]}', susu_sun_jdate='{$arr_day[6]}', gegun_name='$gegun' where no='$no' "; mysql_query($query) or die(mysql_error()); $arr_mody=array(); for($n=1;$n<=7;$n++) { $n2=$n-1; $rs_prev=RS("select * from hatchery_jucha_plan_date where company_no='{$_COOKIE[ucompany_no]}' and hatchery_no='{$rs[hatchery_no]}' and jyear='{$rs[jyear]}' and jucha='{$rs[jucha]}' and jong_type='{$rs[jong_type]}' and breedtype='{$rs[breedtype]}' and gegun_name='{$rs[gegun_name]}' and jdate='{$arr_day[$n2]}' "); if($rs_prev[susu] != $arr_vv[$n2]) { $arr_mody[$n]=date('Y-m-d H:i:s'); mysql_query("insert into hatchery_jucha_plan_date_mody_log set hatchery_jucha_plan_no='$no', jdate='{$arr_day[$n2]}', prev_val='{$rs_prev[susu]}', now_val='{$arr_vv[$n2]}', regdate=now() ") or die(); } else { $arr_mody[$n]=null; } } mysql_query("delete from hatchery_jucha_plan_date where company_no='{$_COOKIE[ucompany_no]}' and hatchery_no='{$rs[hatchery_no]}' and jyear='{$rs[jyear]}' and jucha='{$rs[jucha]}' and jong_type='{$rs[jong_type]}' and breedtype='{$rs[breedtype]}' and gegun_name='{$rs[gegun_name]}' ") or die(); for($n=1;$n<=7;$n++) { $n2=$n-1; $query="insert into hatchery_jucha_plan_date set company_no='{$rs[company_no]}', hatchery_no='{$rs[hatchery_no]}', jdate='{$arr_day[$n2]}', jyear='{$rs[jyear]}', jucha='{$rs[jucha]}', jweekday='$n', susu='{$arr_vv[$n2]}', jong_type='{$rs[jong_type]}', breedtype='{$rs[breedtype]}', gegun_name='$gegun', mod_date=now(), regdate=now() "; mysql_query($query) or die(mysql_error()); } $arr_rst['rst']='1'; echo json_encode($arr_rst); ?>