fetchRow($rs)){ $khuyenmai_amount = $rw['KLT_TIENPHONG'] + $rw['TONGDICHVU'] + $rw['KLT_THUKHAC'] + $rw['KLT_TONGTIENPHONGKHAC'] - $rw['TRATRUOC'] - $rw['KLT_TRUKHAC'] - $rw['KLT_TONGTHANHTOAN']; $dichvu_khac = $rw['THU_DICHVUKS'] + $rw['KLT_THUKHAC'] - $rw['KLT_TRUKHAC'] - $rw['TONGGIAMTRU']; $dichvu_giamtru = $rw['TONGGIAMTRU']; $sum_giamtru += $rw['TONGGIAMTRU']; $tong_tien = $rw['THU_GIATUI'] + $rw['KLT_TIENPHONG'] + $dichvu_khac - $khuyenmai_amount; $songay = intval((strtotime($rw['NGAYTRA']." 00:00:00") - strtotime($rw['NGAYNHAN']." 00:00:00"))/86400); $dichvu_giatui = $rw['THU_GIATUI']; $dichvu_tunhan = $rw['THU_TUNHAN']; $ghichu_tratruoc = ""; if($rw['BC_TRATRUOC']==1){ $dichvu_giatui = $rw['TRATRUOC_GIATUI']; $dichvu_tunhan = $rw['TRATRUOC_DICHVU']; $tratruoc_tienphong = $rw['TRATRUOC_PHONG']; $dichvu_khac = 0; $tong_tien = $dichvu_giatui + $tratruoc_tienphong; }else{ $dichvu_giatui = $dichvu_giatui - $rw['TRATRUOC_GIATUI_DABC']; $dichvu_tunhan = $dichvu_tunhan - $rw['TRATRUOC_DICHVU_DABC']; $tong_tien = $tong_tien - $rw['TRATRUOC_PHONG_DABC'] - $rw['TRATRUOC_GIATUI_DABC']; if($rw['TRATRUOC_GIATUI_DABC']>0 || $rw['TRATRUOC_PHONG_DABC']>0 || $rw['TRATRUOC_GIATUI_DABC']>0){ $sotien_datratruoc = $rw['TRATRUOC_GIATUI_DABC'] + $rw['TRATRUOC_PHONG_DABC'] + $rw['TRATRUOC_DICHVU_DABC']; $ghichu_tratruoc = "
Đã trả trước ".$webhelper->format_vn_number($sotien_datratruoc,0)."
"; } } $sum_giatui += $dichvu_giatui; $sum_thukhac += $dichvu_khac; $sum_tongtien += $tong_tien; $sum_tunhan += $dichvu_tunhan; if($rw['PH_DOAN']!=1 || $dichvu_giatui>0 || $dichvu_khac!=0 || $tong_tien !=0 || $dichvu_tunhan > 0 || $rw['KLT_TRUKHAC']>0){ $count++; ?> fetchRow($rs_tranothangtruoc)){ $khuyenmai_amount = $rw['KLT_TIENPHONG'] + $rw['TONGDICHVU'] + $rw['KLT_THUKHAC'] + $rw['KLT_TONGTIENPHONGKHAC'] - $rw['TRATRUOC'] - $rw['KLT_TRUKHAC'] - $rw['KLT_TONGTHANHTOAN']; $dichvu_khac = $rw['THU_DICHVUKS'] + $rw['KLT_THUKHAC'] - $rw['KLT_TRUKHAC'] - $rw['TONGGIAMTRU']; $dichvu_giamtru = $rw['TONGGIAMTRU']; $sum_giamtru += $rw['TONGGIAMTRU']; $tong_tien = $rw['THU_GIATUI'] + $rw['KLT_TIENPHONG'] + $dichvu_khac - $khuyenmai_amount; $songay = intval((strtotime($rw['NGAYTRA']." 00:00:00") - strtotime($rw['NGAYNHAN']." 00:00:00"))/86400); $dichvu_giatui = $rw['THU_GIATUI']; $dichvu_tunhan = $rw['THU_TUNHAN']; $ghichu_tratruoc = ""; if($rw['BC_TRATRUOC']==1){ $dichvu_giatui = $rw['TRATRUOC_GIATUI']; $dichvu_tunhan = $rw['TRATRUOC_DICHVU']; $tratruoc_tienphong = $rw['TRATRUOC_PHONG']; $dichvu_khac = 0; $tong_tien = $dichvu_giatui + $tratruoc_tienphong; }else{ $dichvu_giatui = $dichvu_giatui - $rw['TRATRUOC_GIATUI_DABC']; $dichvu_tunhan = $dichvu_tunhan - $rw['TRATRUOC_DICHVU_DABC']; $tong_tien = $tong_tien - $rw['TRATRUOC_PHONG_DABC'] - $rw['TRATRUOC_GIATUI_DABC']; if($rw['TRATRUOC_GIATUI_DABC']>0 || $rw['TRATRUOC_PHONG_DABC']>0 || $rw['TRATRUOC_GIATUI_DABC']>0){ $sotien_datratruoc = $rw['TRATRUOC_GIATUI_DABC'] + $rw['TRATRUOC_PHONG_DABC'] + $rw['TRATRUOC_DICHVU_DABC']; $ghichu_tratruoc = "
Đã trả trước ".$webhelper->format_vn_number($sotien_datratruoc,0)."
"; } } $sum_giatui += $dichvu_giatui; $sum_thukhac += $dichvu_khac; $sum_tongtien += $tong_tien; $sum_tunhan += $dichvu_tunhan; if($rw['PH_DOAN']!=1 || $dichvu_giatui>0 || $dichvu_khac!=0 || $tong_tien !=0 || $dichvu_tunhan > 0 || $rw['KLT_TRUKHAC']>0){ $count++; ?> > fetchRow($rs_khachno)){ $khuyenmai_amount = $rw['KLT_TIENPHONG'] + $rw['TONGDICHVU'] + $rw['KLT_THUKHAC'] + $rw['KLT_TONGTIENPHONGKHAC'] - $rw['TRATRUOC'] - $rw['KLT_TRUKHAC'] - $rw['KLT_TONGTHANHTOAN']; $dichvu_khac = $rw['THU_DICHVUKS'] + $rw['KLT_THUKHAC'] - $rw['KLT_TRUKHAC'] - $rw['TONGGIAMTRU']; $dichvu_giamtru = $rw['TONGGIAMTRU']; $sum_giamtru += $rw['TONGGIAMTRU']; $tong_tien = $rw['THU_GIATUI'] + $rw['KLT_TIENPHONG'] + $dichvu_khac - $khuyenmai_amount; $songay = intval((strtotime($rw['NGAYTRA']." 00:00:00") - strtotime($rw['NGAYNHAN']." 00:00:00"))/86400); $dichvu_giatui = $rw['THU_GIATUI']; $dichvu_tunhan = $rw['THU_TUNHAN']; $dichvu_giatui = $dichvu_giatui - $rw['TRATRUOC_GIATUI_DABC']; $dichvu_tunhan = $dichvu_tunhan - $rw['TRATRUOC_DICHVU_DABC']; $tong_tien = $tong_tien - $rw['TRATRUOC_PHONG_DABC'] - $rw['TRATRUOC_GIATUI_DABC']; if($rw['TRATRUOC_GIATUI_DABC']>0 || $rw['TRATRUOC_PHONG_DABC']>0 || $rw['TRATRUOC_GIATUI_DABC']>0){ $sotien_datratruoc = $rw['TRATRUOC_GIATUI_DABC'] + $rw['TRATRUOC_PHONG_DABC'] + $rw['TRATRUOC_DICHVU_DABC']; $ghichu_tratruoc = "
Đã trả trước ".$webhelper->format_vn_number($sotien_datratruoc,0)."
"; }else{ $ghichu_tratruoc = ""; } $sum_giatui += $dichvu_giatui; $sum_thukhac += $dichvu_khac; $sum_tongtien += $tong_tien; $sum_tunhan += $dichvu_tunhan; if($rw['PH_DOAN']!=1 || $dichvu_giatui>0 || $dichvu_khac!=0 || $tong_tien !=0 || $dichvu_tunhan > 0 || $rw['KLT_TRUKHAC']>0){ $count++; ?> fetchRow($rs_khach_con_o)){ if(strtotime($search_ngay_db." ".$thoidiembaocao.":00")>strtotime(date('Y-m-d H:i:s'))){ $thoidiem_out = date('Y-m-d H:i:s'); $thoidiem_text = date('H:i:s d-m-Y'); }else{ $thoidiem_out = $search_ngay_db." ".$thoidiembaocao.":00"; $thoidiem_text = $thoidiembaocao.":00"." ".$search_ngay; } $uutiengio = $rw['KLT_UUTIENGIO']; $slkhach = $rw['KLT_SLKHACH']; $klt_ext_info = $model->get_ext_info($rw); $arrTienPhong = $model->calcTienPhong($rw['KLT_ID'],$rw['KLT_IDPH'],$slkhach,$cachtinhphuthuthemnguoi,$uutiengio,$rw['KLT_THOIDIEMNHANPHONG'],$thoidiem_out,$rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'],$cty_id,$rw['KLT_BAOTRATRE'],$rw['KLT_TINHTUANTHANG'],$klt_ext_info); $khuyenmai_amount = $arrTienPhong['khuyenmai']; $dichvu_khac = $rw['THU_DICHVUKS'] + $rw['KLT_THUKHAC'] - $rw['KLT_TRUKHAC'] - $rw['TONGGIAMTRU']; $dichvu_giamtru = $rw['TONGGIAMTRU']; $sum_giamtru += $rw['TONGGIAMTRU']; $tong_tien = $rw['THU_GIATUI'] + $arrTienPhong['tienphong'] + $dichvu_khac - $khuyenmai_amount; $songay = intval((strtotime($search_ngay_db." 00:00:00") - strtotime($rw['NGAYNHAN']." 00:00:00"))/86400); $dichvu_giatui = $rw['THU_GIATUI']; $dichvu_tunhan = $rw['THU_TUNHAN']; $dichvu_giatui = $dichvu_giatui - $rw['TRATRUOC_GIATUI_DABC']; $dichvu_tunhan = $dichvu_tunhan - $rw['TRATRUOC_DICHVU_DABC']; $tong_tien = $tong_tien - $rw['TRATRUOC_PHONG_DABC'] - $rw['TRATRUOC_GIATUI_DABC']; if($rw['TRATRUOC_GIATUI_DABC']>0 || $rw['TRATRUOC_PHONG_DABC']>0 || $rw['TRATRUOC_GIATUI_DABC']>0){ $sotien_datratruoc = $rw['TRATRUOC_GIATUI_DABC'] + $rw['TRATRUOC_PHONG_DABC'] + $rw['TRATRUOC_DICHVU_DABC']; $ghichu_tratruoc = "
Đã trả trước ".$webhelper->format_vn_number($sotien_datratruoc,0)."
"; }else{ $ghichu_tratruoc = ""; } $sum_giatui += $dichvu_giatui; $sum_thukhac += $dichvu_khac; $sum_tongtien += $tong_tien; $sum_tunhan += $dichvu_tunhan; if($rw['PH_DOAN']!=1 || $dichvu_giatui>0 || $dichvu_khac!=0 || $tong_tien !=0 || $dichvu_tunhan > 0 || $rw['KLT_TRUKHAC']>0){ $count++; ?> strtotime(date('Y-m-d H:i:s'))){ $thoidiem_text = date('H:i:s')." ngày ".date('d-m-Y'); }else{ $thoidiem_text = $thoidiembaocao.":00 ngày ".$search_ngay; } ?> fetchRow($rs_khach_moi)){ if(strtotime($search_ngay_db." ".$thoidiembaocao.":00")>strtotime(date('Y-m-d H:i:s'))){ $thoidiem_out = date('Y-m-d H:i:s'); $thoidiem_text = date('H:i:s d-m-Y'); }else{ $thoidiem_out = $search_ngay_db." ".$thoidiembaocao.":00"; $thoidiem_text = $thoidiembaocao.":00 ".$search_ngay; } $uutiengio = $rw['KLT_UUTIENGIO']; $slkhach = $rw['KLT_SLKHACH']; $klt_ext_info = $model->get_ext_info($rw); $arrTienPhong = $model->calcTienPhong($rw['KLT_ID'],$rw['KLT_IDPH'],$slkhach,$cachtinhphuthuthemnguoi,$uutiengio,$rw['KLT_THOIDIEMNHANPHONG'],$thoidiem_out,$rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'],$cty_id,$rw['KLT_BAOTRATRE'],$rw['KLT_TINHTUANTHANG'],$klt_ext_info); $khuyenmai_amount = $arrTienPhong['khuyenmai']; $dichvu_khac = $rw['THU_DICHVUKS'] + $rw['KLT_THUKHAC'] - $rw['KLT_TRUKHAC'] - $rw['TONGGIAMTRU']; $dichvu_giamtru = $rw['TONGGIAMTRU']; $sum_giamtru += $rw['TONGGIAMTRU']; $tong_tien = $rw['THU_GIATUI'] + $arrTienPhong['tienphong'] + $dichvu_khac - $khuyenmai_amount; $songay = intval((strtotime($search_ngay_db." 00:00:00") - strtotime($rw['NGAYNHAN']." 00:00:00"))/86400); $dichvu_giatui = $rw['THU_GIATUI']; $dichvu_tunhan = $rw['THU_TUNHAN']; $dichvu_giatui = $dichvu_giatui - $rw['TRATRUOC_GIATUI_DABC']; $dichvu_tunhan = $dichvu_tunhan - $rw['TRATRUOC_DICHVU_DABC']; $tong_tien = $tong_tien - $rw['TRATRUOC_PHONG_DABC'] - $rw['TRATRUOC_GIATUI_DABC']; if($rw['TRATRUOC_GIATUI_DABC']>0 || $rw['TRATRUOC_PHONG_DABC']>0 || $rw['TRATRUOC_GIATUI_DABC']>0){ $sotien_datratruoc = $rw['TRATRUOC_GIATUI_DABC'] + $rw['TRATRUOC_PHONG_DABC'] + $rw['TRATRUOC_DICHVU_DABC']; $ghichu_tratruoc = "
Đã trả trước ".$webhelper->format_vn_number($sotien_datratruoc,0)."
"; }else{ $ghichu_tratruoc = ""; } $sum_giatui += $dichvu_giatui; $sum_thukhac += $dichvu_khac; $sum_tongtien += $tong_tien; $sum_tunhan += $dichvu_tunhan; if($rw['PH_DOAN']!=1 || $dichvu_giatui>0 || $dichvu_khac!=0 || $tong_tien !=0 || $dichvu_tunhan > 0 || $rw['KLT_TRUKHAC']>0){ $count++; ?> fetchRow($rschi)){ $count++; $sum_tongtien += $rw['CP_SOTIEN']; ?> > numRows($rs_tamung) ?> fetchRow($rs_tamung)){ $count++; $sum_tongtien_tamung += $rw['TU_SOTIEN']; ?>
(Thời gian báo cáo được tính từ ngày hôm trước đến của ngày báo cáo)    Ngày     
THU NGÀY
# Phòng Vào Ra Ngày Đ.Giá Giặt ủi D.vụ khác Thành tiền Nước Phục vụ Khách hàng Giảm giá Ghi chú
decodeSpecialChar($rw['PH_TEN']);?>
 
format_vn_number($rw['GIAPHONG_NGAY'],0);?> format_vn_number($dichvu_giatui,0);?> format_vn_number($dichvu_khac,0);?> format_vn_number($tong_tien,0);?> format_vn_number($dichvu_tunhan,0);?> format_vn_number($dichvu_giamtru,0);?> decodeSpecialChar($rw['KH_TEN']);?> 100){ echo $webhelper->format_vn_number($rw['KLT_KHUYENMAI'],0); }elseif($rw['KLT_KHUYENMAI']>0){ echo $rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'];};?> Trả nợ"; } if($rw['BC_TRATRUOC']==1){ echo "
Trả trước
"; } if($rw['TENPHONG_THANHTOAN']!=null){ echo "
P.".$rw['TENPHONG_THANHTOAN']." t.toán
"; } echo $ghichu_tratruoc; echo $webhelper->decodeSpecialChar($rw['KLT_GHICHU']); ?>
')"> 
 
              format_vn_number($thu_dichvule,0);?>   Bán lẻ dịch vụ    
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_giatui,0);?> format_vn_number($sum_thukhac,0);?> format_vn_number($sum_tongtien,0);?> format_vn_number($sum_tunhan,0);?> format_vn_number($sum_giamtru,0);?>      
KHÁCH TRẢ NỢ THÁNG TRƯỚC (Trả phòng trước )
# Phòng Vào Ra Ngày Đ.Giá Giặt ủi D.vụ khác Thành tiền Nước Phục vụ Khách hàng Giảm giá Ghi chú
decodeSpecialChar($rw['PH_TEN']);?>
 
format_vn_number($rw['GIAPHONG_NGAY'],0);?> format_vn_number($dichvu_giatui,0);?> format_vn_number($dichvu_khac,0);?> format_vn_number($tong_tien,0);?> format_vn_number($dichvu_tunhan,0);?> format_vn_number($dichvu_giamtru,0);?> decodeSpecialChar($rw['KH_TEN']);?> 100){ echo $webhelper->format_vn_number($rw['KLT_KHUYENMAI'],0); }elseif($rw['KLT_KHUYENMAI']>0){ echo $rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'];};?> Thanh toán trể"; // } if($rw['LOAINO']==2){ echo "
Trả nợ
"; } if($rw['BC_TRATRUOC']==1){ echo "
Trả trước
"; } if($rw['TENPHONG_THANHTOAN']!=null){ echo "
P.".$rw['TENPHONG_THANHTOAN']." t.toán
"; } echo $ghichu_tratruoc; echo $webhelper->decodeSpecialChar($rw['KLT_GHICHU']); ?>
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_giatui,0);?> format_vn_number($sum_thukhac,0);?> format_vn_number($sum_tongtien,0);?> format_vn_number($sum_giamtru,0);?> format_vn_number($sum_tunhan,0);?>      
KHÁCH NỢ NGÀY
# Phòng Vào Ra Ngày Đ.Giá Giặt ủi D.vụ khác Thành tiền Nước Phục vụ Khách hàng Giảm giá Ghi chú
decodeSpecialChar($rw['PH_TEN']);?>
 
format_vn_number($rw['GIAPHONG_NGAY'],0);?> format_vn_number($dichvu_giatui,0);?> format_vn_number($dichvu_khac,0);?> format_vn_number($tong_tien,0);?> format_vn_number($dichvu_tunhan,0);?> format_vn_number($dichvu_giamtru,0);?> decodeSpecialChar($rw['KH_TEN']);?> 100){ echo $webhelper->format_vn_number($rw['KLT_KHUYENMAI'],0); }elseif($rw['KLT_KHUYENMAI']>0){ echo $rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'];};?> Chuyển khoản"; } echo $ghichu_tratruoc; if($rw['PHONG_THANHTOAN']!=null && $rw['PHONG_THANHTOAN']!=""){ echo "
Chuyển vào P.".$rw['PHONG_THANHTOAN']."
"; } echo $webhelper->decodeSpecialChar($rw['KLT_GHICHU']); ?>
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_giatui,0);?> format_vn_number($sum_thukhac,0);?> format_vn_number($sum_tongtien,0);?> format_vn_number($sum_tunhan,0);?> format_vn_number($sum_giamtru,0);?>      
KHÁCH CÒN Ở LẠI NGÀY
# Phòng Vào Ra Ngày Đ.Giá Giặt ủi D.vụ khác Thành tiền Nước Phục vụ Khách hàng Giảm giá Ghi chú
decodeSpecialChar($rw['PH_TEN']);?> format_vn_number($rw['GIAPHONG_NGAY'],0);?> format_vn_number($dichvu_giatui,0);?> format_vn_number($dichvu_khac,0);?> format_vn_number($tong_tien,0);?> format_vn_number($dichvu_tunhan,0);?> format_vn_number($dichvu_giamtru,0);?> decodeSpecialChar($rw['KH_TEN']);?> 100){ echo $webhelper->format_vn_number($rw['KLT_KHUYENMAI'],0); }elseif($rw['KLT_KHUYENMAI']>0){ echo $rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'];};?> decodeSpecialChar($rw['KLT_GHICHU']); ?>
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_giatui,0);?> format_vn_number($sum_thukhac,0);?> format_vn_number($sum_tongtien,0);?> format_vn_number($sum_tunhan,0);?> format_vn_number($sum_giamtru,0);?>      
KHÁCH MỚI NHẬN PHÒNG TRONG NGÀY  (Tính đến )
# Phòng Vào Ra Ngày Đ.Giá Giặt ủi D.vụ khác Thành tiền Nước Phục vụ Khách hàng Giảm giá Ghi chú
decodeSpecialChar($rw['PH_TEN']);?> format_vn_number($rw['GIAPHONG_NGAY'],0);?> format_vn_number($dichvu_giatui,0);?> format_vn_number($dichvu_khac,0);?> format_vn_number($tong_tien,0);?> format_vn_number($dichvu_tunhan,0);?> format_vn_number($dichvu_giamtru,0);?> decodeSpecialChar($rw['KH_TEN']);?> 100){ echo $webhelper->format_vn_number($rw['KLT_KHUYENMAI'],0); }elseif($rw['KLT_KHUYENMAI']>0){ echo $rw['KLT_KHUYENMAI'].$rw['KLT_DVTKHUYENMAI'];};?> decodeSpecialChar($rw['KLT_GHICHU']); ?>
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_giatui,0);?> format_vn_number($sum_thukhac,0);?> format_vn_number($sum_tongtien,0);?> format_vn_number($sum_tunhan,0);?> format_vn_number($sum_giamtru,0);?>      
CHI TRONG NGÀY
# Nội dung Ghi chú Số tiền          
decodeSpecialChar($rw['CP_NOIDUNG']);?> format_vn_number($rw['CP_SOTIEN'],0);?>          
  Không tìm thấy thông tin.
  Tổng cộng format_vn_number($sum_tongtien,0);?>          
TẠM ỨNG LƯƠNG TRONG NGÀY
# Nhân viên Ghi chú Số tiền          
decodeSpecialChar($rw['NV_HOTEN']);?> format_vn_number($rw['TU_SOTIEN'],0);?>          
  Tổng cộng format_vn_number($sum_tongtien_tamung,0);?>