ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/admin.adimi/code/management/service/ |
<?php $service_id = (isset($CORE->input['service_id']) && $CORE->input['service_id']>0) ? $CORE->input['service_id'] : 0; $service_event_id = (isset($CORE->input['service_event_id']) && $CORE->input['service_event_id']>0) ? $CORE->input['service_event_id'] : 0; if($service_id==0 or $service_event_id==0){ exit('service_id,service_event_id need to >0'); } $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_service WHERE service_id='$service_id' ")); $row_check_event = $DB->fetch_row($DB->query("SELECT * FROM tb_service_event WHERE service_event_id='$service_event_id' ")); if($row_check_event['service_event_donvigiahan']=='thang'){//gia han theo thang $time_now = time(); $so_thang = ceil(($time_now - strtotime($row_check_event['service_event_begin']))/(30*24*60*60)); for($i=1;$i<=$so_thang;$i++){ $ngay_tao = strtotime($row_check_event['service_event_begin'])+($i*(30*24*60*60)) - $row_check_event['service_event_thoigianthanhtoan']*24*60*60; $txt_ngay_tao = date('Y-m-d h:i:s',$ngay_tao); $ngay_gia_han = strtotime($row_check_event['service_event_begin'])+($i*(30*24*60*60)); $txt_ngay_gia_han = date('Y-m-d h:i:s',$ngay_gia_han); $so_luong = ($row_check_event['service_event_soluong']<=1)? 1 : $row_check_event['service_event_soluong']; $tong_tien = $so_luong*$row_check_event['service_event_dongia']; $tong_tien = $tong_tien - ($tong_tien*($row_check_event['service_event_discount']/100)); $tong_tien = $tong_tien + ($tong_tien*($row_check_event['service_event_tax']/100)); $arr_insert = array('hoa_don_code'=>'','service_id'=>$service_id,'service_event_id'=>$service_event_id,'so_tien'=>$row_check_event['service_event_dongia'],'so_luong'=>$so_luong,'tong_tien'=>$tong_tien, 'thue'=>$row_check_event['service_event_tax'],'giam_gia'=>$row_check_event['service_event_discount'],'ngay_tao'=>$txt_ngay_tao,'ngay_gia_han'=>$txt_ngay_gia_han,'phuong_thuc_thanh_toan'=>'CK','tinh_trang'=>'chua_thanh_toan','time_post'=>date('Y-m-d h:i:s'),'user_post'=>$ob_user->user_name,'time_update'=>date('Y-m-d h:i:s'),'user_update'=>$ob_user->user_name); $row_check_hoadon = $DB->fetch_row($DB->query("SELECT * FROM tb_service_event_hoadon WHERE service_id='$service_id' AND service_event_id='$service_event_id' AND so_tien='".$row_check_event['service_event_dongia']."' AND ngay_tao='$txt_ngay_tao' AND ngay_gia_han='$txt_ngay_gia_han' ")); if(!$row_check_hoadon){ $id_hoa_don = $DB->do_insert('tb_service_event_hoadon',$arr_insert); $txt_code='HD'.$id_hoa_don; $DB->query("UPDATE tb_service_event_hoadon SET hoa_don_code='$txt_code' WHERE hoa_don_id='$id_hoa_don' "); } } $print->refresh('?act=management&code=service&type=post&type2=post_service_event&id='.$service_id.'&service_event_id='.$service_event_id); }else{//gia han theo nam $ngay_tao = strtotime($row_check_event['service_event_begin']) + $row_check_event['service_event_thoigianthanhtoan']*24*60*60; $txt_ngay_tao = date('Y-m-d h:i:s',$ngay_tao); //$ngay_gia_han = strtotime($row_check_event['service_event_end']); $ngay_gia_han = $ngay_tao + ($row_check_event['service_event_thoigianthanhtoan']*24*60*60); $txt_ngay_gia_han = date('Y-m-d h:i:s',$ngay_gia_han); $so_luong = ($row_check_event['service_event_soluong']<=1)? 1 : $row_check_event['service_event_soluong']; $tong_tien = $so_luong*$row_check_event['service_event_dongia']; $tong_tien = $tong_tien - ($tong_tien*($row_check_event['service_event_discount']/100)); $tong_tien = $tong_tien + ($tong_tien*($row_check_event['service_event_tax']/100)); $arr_insert = array('hoa_don_code'=>'','service_id'=>$service_id,'service_event_id'=>$service_event_id,'so_tien'=>$row_check_event['service_event_dongia'],'so_luong'=>$so_luong,'tong_tien'=>$tong_tien, 'thue'=>$row_check_event['service_event_tax'],'giam_gia'=>$row_check_event['service_event_discount'],'ngay_tao'=>$txt_ngay_tao,'ngay_gia_han'=>$txt_ngay_gia_han,'phuong_thuc_thanh_toan'=>'CK','tinh_trang'=>'chua_thanh_toan','time_post'=>date('Y-m-d h:i:s'),'user_post'=>$ob_user->user_name,'time_update'=>date('Y-m-d h:i:s'),'user_update'=>$ob_user->user_name); $row_check_hoadon = $DB->fetch_row($DB->query("SELECT * FROM tb_service_event_hoadon WHERE service_id='$service_id' AND service_event_id='$service_event_id' AND so_tien='".$row_check_event['service_event_dongia']."' AND ngay_tao='$txt_ngay_tao' AND ngay_gia_han='$txt_ngay_gia_han' ")); if(!$row_check_hoadon){ $id_hoa_don = $DB->do_insert('tb_service_event_hoadon',$arr_insert); $txt_code='HD'.$id_hoa_don; $DB->query("UPDATE tb_service_event_hoadon SET hoa_don_code='$txt_code' WHERE hoa_don_id='$id_hoa_don' "); } $print->refresh('?act=management&code=service&type=post&type2=post_service_event&id='.$service_id.'&service_event_id='.$service_event_id); } ?>