import { Component, OnInit } from '@angular/core';
import { FrameRequest } from '../../../../../shared/frame/frame-request';
import { AppComponent } from '../../../../../app.component';

@Component({
  selector: 'app-factory-statis-report',
  templateUrl: './factory-statis-report.component.html',
  styleUrls: ['./factory-statis-report.component.scss']
})
export class FactoryStatisReportComponent implements OnInit {
  
  BMH_URL = "kw/kwLayoutDetail/exportBmhDbf.htm";
  COURSE_URL = "kw/kwLayoutDetail/exportCourseDbf.htm";
  UNIT_URL = "kw/kwLayoutDetail/exportUnitDbf.htm";
  CITY_URL = "kw/kwLayoutDetail/exportCityDbf.htm";
  EXAMTIME_URL =  "kw/kwLayoutDetail/exportExamTime.htm";
  SJD_URL =  "kw/kwLayoutDetail/exportSjdDbf.htm";
 
  
  YEAR_CODE_URL = "pl/plExamTime/list.htm";

  constructor() { }

  public query = {
    exam_time_id: 0
  };

  ngOnInit() {
  }

  printPaperPdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/printpaperpdf.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("2-自学考试印卷统计表pdf导出成功");
    });
  }

  exportFunc() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/disttotalxls.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("3-自学考试试卷分发总清单xls导出成功");
    });
  }

  exportFuncForUnit() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/disttotalxlsForUnit.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("3-自学考试试卷分发总清单(分考点)xls导出成功");
    });
  }
  

  exportExamAreaBagSum() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/kwLayoutExamAreaBagSum/exportExamAreaBagSumXls.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("4-自考笔迹信息采集卡印刷数量和分发表xls导出成功");
    });
  }

  exportOpenCoursePdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }

    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/opencoursepdf.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("8-考试开考课程表pdf导出成功");
    });
  }


  examCourseSectionPdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/timeperiodpdf.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("9-自学考试时段科目表pdf导出成功");
    });
  }

  timeComparePdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/timecomparepdf.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("9-自学考试时段科目表pdf导出成功");
    });
  }
  
  exportCourseBagSum(filename,file_name,isAreaAllExp,is_net_mark) {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/kwLayoutCourseBagSum/exportPdf.htm", {exam_time_id:this.query.exam_time_id,file_name:file_name,isAreaAllExp:isAreaAllExp,is_net_mark:is_net_mark}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg(filename+"导出成功");
    });
  }

  distPaperPdf() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/distpaperpdf.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("15-自学考试考区分卷表pdf导出成功");
    });
  }

  distPaperPdfForUnit() {
    if (!this.query.exam_time_id) {
      AppComponent.alert({ title: "信息提示", text: "请选择批次!" })
      return;
    }
    AppComponent.GobalComponent.setLoading(true);
    FrameRequest.download("kw/nomal/distPaperPdfForUnit.htm", {exam_time_id:this.query.exam_time_id,isFactory:'1'}, () => {
      AppComponent.GobalComponent.setLoading(false);
      AppComponent.GobalComponent.successMsg("15-自学考试考区分卷表pdf导出成功");
    });
  }
  
}
