'use strict'

angular.module('EPAYSLIP').controller('ShowPaySlip', ['$scope', '$http', 'EpayslipCtrl', function($scope, $http, EpayslipCtrl){
 	$scope.headerepay = {};
 	$scope.bodyepay= [];
 	$scope.paramlist = {
    gettype: 'showpayslip',
    prgcode: $('input[name="prgcode"]').val(),
    period: $('input[name="period"]').val(),
    months: $('input[name="months"]').val(),
    years: $('input[name="years"]').val(),
    round: $('input[name="round"]').val(),
    salatype: $('input[name="salatype"]').val()
 	};

 	if ($('input[name="authen"]').val() == '1'){
    EpayslipCtrl.manageEpaySlip.query($scope.paramlist).$promise.then(function(data){
     	$scope.headerepay = data.header;
     	$scope.bodyepay = data.body;
     	console.log(data);
    });
 	}

 	$scope.generateDate = function(){
    var nowdate = new Date();
    setCalendarLang(getLang());

    return nowdate.getDate()+" "+getMonthFullName(nowdate.getMonth()+1)+" "+nowdate.getFullYear();
 	}
	$scope.alertbox = {
    tha: '** เงินเดือนถือเป็นความลับระหว่างพนักงานกับสำนักงานฯ ห้ามเปิดเผยกับผู้ใด',
    eng: '** เงินเดือนถือเป็นความลับระหว่างพนักงานกับสำนักงานฯ ห้ามเปิดเผยกับผู้ใด', // ** The infomation is confidential. please do not reveal it to anyone.
    getString : function(){
       if (getLang() == 'tha'){
          return this.tha;
       }else{
          return this.eng;
       }
    }
  }
	$scope.alertbox2 = {
    tha: 'เอกสารนี้เป็นต้นฉบับบจริงที่ออกโดยสำนักงานการบินพลเรือนแห่งประเทศไทย สามารถใช้ทำธุรกรรมได้',
    eng: 'เอกสารนี้เป็นต้นฉบับบจริงที่ออกโดยสำนักงานการบินพลเรือนแห่งประเทศไทย สามารถใช้ทำธุรกรรมได้',
    getString : function(){
       if (getLang() == 'tha'){
          return this.tha;
       }else{
          return this.eng;
       }
    }
  }
}]);