all the code of this *.ts file
import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular/’;
import { ManHinhTheoDoiTinhHinhPage } from ‘…/man-hinh-theo-doi-tinh-hinh/man-hinh-theo-doi-tinh-hinh’;
import { HomePage, chiTietHoSo } from ‘…/home/home’;
import { ManHinhTraCuuPage } from ‘…/man-hinh-tra-cuu/man-hinh-tra-cuu’;
import { ThongKeNguoiDungPage } from ‘…/thong-ke-nguoi-dung/thong-ke-nguoi-dung’;
import {ThongKePhongBanPage} from ‘…/thong-ke-phong-ban/thong-ke-phong-ban’;
import {ThongKeLinhVucPage} from ‘…/thong-ke-linh-vuc/thong-ke-linh-vuc’;
import {BieuDoThongKePage} from ‘…/bieu-do-thong-ke/bieu-do-thong-ke’;
import { Http } from ‘@angular/http’;
import {ToastController } from ‘ionic-angular/’;
import { NativeStorage } from ‘@ionic-native/native-storage’;
import { GlobalProvider } from ‘…/…/providers/global/global’;
import { DanhSachDenHanCanGiaiQuyetCuaNhanVienPage } from ‘…/danh-sach-den-han-can-giai-quyet-cua-nhan-vien/danh-sach-den-han-can-giai-quyet-cua-nhan-vien’;
@IonicPage()
@Component({
selector: ‘page-man-hinh-chinh’,
templateUrl: ‘man-hinh-chinh.html’,
})
export class ManHinhChinhPage {
private NgayHienTai = new Date();
private month = this.NgayHienTai.getMonth() + 1;
private year = this.NgayHienTai.getFullYear();
private day = this.NgayHienTai.getDate();
public danhSachHoSoChuaGiaiQuyet_Url = this.GlobalProvider.HOST_API_URL +"/api/HoSoChuaGiaiQuyetNguoiDungThangNamBatKy?";
public danhSachHoSoChuaGiaiQuyetThangHienTai:chiTietHoSo[ ] ;
public danhSachHoSoChuaGiaiQuyetThangTruoc:chiTietHoSo[ ] ;
public Email:string;
private soBanNganhID:string = ‘16’;
constructor(private GlobalProvider:GlobalProvider,private NativeStorage:NativeStorage,private toast:ToastController,private http:Http,public navCtrl: NavController, public navParams: NavParams) {
this.loadDanhSachHoSoChuaGiaiQuyetThangHienTai();
this.loadDanhSachHoSoChuaGiaiQuyetThangTruoc();
// this.danhSachHoSoChuaGiaiQuyetThangHienTai = this.navParams.get(‘danhSachHoSoChuaGiaiQuyetThangHienTai_Send’);
// this.danhSachHoSoChuaGiaiQuyetThangTruoc = this.navParams.get(‘danhSachHoSoChuaGiaiQuyetThangTruoc_Send’);
}
ionViewDidEnter(){
if(this.GlobalProvider.KIEM_TRA_THONG_BAO_DAY){
this.testHam();
this.GlobalProvider.KIEM_TRA_THONG_BAO_DAY = false;
}
}
ionViewDidLoad() {
console.log(‘ionViewDidLoad ManHinhChinhPage’);
console.log(this.GlobalProvider.MaNhanVien);
// this.Email = this.navParams.get(‘EmailSend’);
}
// hàm này dùng để cho nút test trên giao diện xóa ngay sau khi sử dụng xong
testHam() {
this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_1 = 0;
this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_2 = 0;
// duyệt hết danh sách hồ sơ của nhân viên đó trong tháng hiện tại
this.danhSachHoSoChuaGiaiQuyetThangHienTai.forEach(element => {
var NgayHenTraHs = new Date(element.NgayHenTra);
console.log(this.tinhSoNgay(NgayHenTraHs,this.NgayHienTai));
if(this.NgayHienTai < NgayHenTraHs ){// kiểm tra xem cái ngày trả có vượt qua ngày hiện tại chưa
if(this.tinhSoNgay(NgayHenTraHs,this.NgayHienTai)<=5){ // kiểm tra điều kiện ngày trả từ thời gian hiện tại đến ngày trả là 5 ngày
this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_1=+1;
}
}
});
// duyệt hết danh sách hồ sơ của nhân viên đó trong tháng trước
this.danhSachHoSoChuaGiaiQuyetThangTruoc.forEach( data => {
var NgayHenTraHs = new Date(data.NgayHenTra);
console.log(this.tinhSoNgay(NgayHenTraHs,this.NgayHienTai));
if(this.NgayHienTai < NgayHenTraHs ){// kiểm tra xem cái ngày trả có vượt qua ngày hiện tại chưa
if(this.tinhSoNgay(NgayHenTraHs,this.NgayHienTai)<=5){// kiểm tra điều kiện ngày trả từ thời gian hiện tại đến ngày trả là 5 ngày
this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_2=+1;
}
}
});
// thông báo số lượng hồ sơ đã trễ hạn
if(this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_1 != 0 || this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_2 !=0 ){
this.toast.create({
message: (this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_1 + this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_2) + Hồ sơ đến hạn cần xử lý
,
duration: 5000,
position: ‘top’,
closeButtonText: “OK”,
showCloseButton: true
}).present();
}else {
this.toast.create({
message: ‘Không có hồ sơ nào đến hạn’,
duration: 5000,
position: ‘top’,
closeButtonText: “OK”,
showCloseButton: true
}).present();
}
}
truyenDuLieu(){
if(this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_1 != 0 || this.GlobalProvider.demSoLuongHosoTreCuaNhanVien_2 !=0 ){
// sau khi thông báo thì truyền danh sách qua màn hình hiển thị ngay tại đây
this.navCtrl.push(DanhSachDenHanCanGiaiQuyetCuaNhanVienPage,{
danhSachHoSoChuaGiaiQuyetThangHienTai_Send: this.danhSachHoSoChuaGiaiQuyetThangHienTai,
danhSachHoSoChuaGiaiQuyetThangTruoc_Send: this.danhSachHoSoChuaGiaiQuyetThangTruoc
});
}else{
this.toast.create({
message: ‘Không có hồ sơ nào đến hạn’,
duration: 3000,
position: ‘bottom’
}).present();
}
}
tinhSoNgay(ngayBatDau:Date,NgayKetThuc:Date):number{
var timeDiff = Math.abs(ngayBatDau.getTime() - NgayKetThuc.getTime());
var dayDifference = Math.ceil(timeDiff / (1000 * 3600 * 24));
return dayDifference;
}
// Load danh sách hồ sơ chưa giải quyết 2 tháng gần nhất !
loadDanhSachHoSoChuaGiaiQuyetThangHienTai(){
return this.http.get(this.danhSachHoSoChuaGiaiQuyet_Url+“thangBaoCao=”+this.month+"&namBaoCao="+ this.year +"&nguoidungID="+this.GlobalProvider.MaNhanVien+"&sobannganhID="+this.soBanNganhID)
//return this.http.get(this.GlobalProvider.HOST_API_URL +’/api/HoSoChuaGiaiQuyetNguoiDungThangNamBatKy/BaoCaoHoSoChuaGiaiQuyetNguoiDungThangNamBatKy?thangBaoCao=4&namBaoCao=2015&nguoidungID=778&sobannganhID=16’)
.subscribe(
Data =>{
this.danhSachHoSoChuaGiaiQuyetThangHienTai = Data.json();
console.log(this.danhSachHoSoChuaGiaiQuyetThangHienTai);
},err => {
console.log(‘Lỗi = >’+ err);
});
}
loadDanhSachHoSoChuaGiaiQuyetThangTruoc(){
return this.http.get(this.danhSachHoSoChuaGiaiQuyet_Url+“thangBaoCao=”+this.month +"&namBaoCao="+this.year+"&nguoidungID="+this.GlobalProvider.MaNhanVien+"&sobannganhID="+this.soBanNganhID)
//return this.http.get(this.GlobalProvider.HOST_API_URL +’/api/HoSoChuaGiaiQuyetNguoiDungThangNamBatKy/BaoCaoHoSoChuaGiaiQuyetNguoiDungThangNamBatKy?thangBaoCao=4&namBaoCao=2015&nguoidungID=778&sobannganhID=16’)
.subscribe(
Data =>{
this.danhSachHoSoChuaGiaiQuyetThangTruoc = Data.json();
console.log(this.danhSachHoSoChuaGiaiQuyetThangTruoc);
},err => {
console.log(‘Lỗi = >’+ err);
});
}
goManHinhTheoDoiTinhHinh():void{this.navCtrl.push(ManHinhTheoDoiTinhHinhPage);}
goManHinhNguoiDung(){this.navCtrl.push(ThongKeNguoiDungPage);}
goManHinhPhongBan(){this.navCtrl.push(ThongKePhongBanPage);}
goManHinhLinhVuc(){this.navCtrl.push(ThongKeLinhVucPage);}
goManHinhTraCuu(): void {this.navCtrl.push(ManHinhTraCuuPage);}
goManHinhBieuDo(){this.navCtrl.push(BieuDoThongKePage);}
dangXuat():void {this.navCtrl.push(HomePage);}
}
please help me Sir !
Can you teamview in my computer?