'use strict' angular.module('EPAYSLIP').controller('ShowPaySlip', ['$scope', '$http', 'EpayslipCtrl', function($scope, $http, EpayslipCtrl){ $scope.headerepay = {}; $scope.bodyepay= []; $scope.footer = {}; $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() }; $scope.alertbox = { tha: 'หมายเหตุ บริษัทถือว่าข้อความในเอกสารฉบับนี้เป็นความลับ ห้ามเปิดเผยให้ผู้อื่นทราบโดยเด็ดขาด', eng: 'Please use this e-letter as the payroll or other income payment slip. The infomation is confidential. please do not reveal it to anyone.', getString : function(){ if (getLang() == 'tha'){ return this.tha; }else{ return this.eng; } } } if ($('input[name="authen"]').val() == '1'){ EpayslipCtrl.manageEpaySlip.query($scope.paramlist) .$promise.then(function(data){ $scope.headerepay = data.header; $scope.bodyepay = data.body; $scope.generateFooter(); console.log($scope.headerepay); }); } $scope.generateFooter = function(){ $scope.footer = { title: { tha : 'เรียน ท่านผู้เกี่ยวข้อง', eng: 'To whom it may concern,', getString: function(){ if (getLang() == 'tha'){ return this.tha; }else{ return this.eng; } } }, body: { tha: 'เอกสารฉบับนี้เป็นเอกสารสำคัญ มีลายเซนต์ผู้มีอำนาจลงนามจากระบบอิเลคทรอนิคส์ ออกโดย บริษัท '+$scope.headerepay.mbranch.tdesc+' ซึ่งสามารถใช้แทนหนังสือรับรอง การทำงานและหนังสือรับรองเงินเดือนได้ ', eng: 'This is certify that document is electronically issued with the authorized, person\'s signature by '+$scope.headerepay.mbranch.tdesc+' The document can be used as a reference for employment status and salary verification.', getString: function(){ if (getLang() == 'tha'){ return this.tha; }else{ return this.eng; } } } }; } $scope.generateDate = function(){ var nowdate = new Date(); setCalendarLang(getLang()); return nowdate.getDate()+" "+getMonthFullName(nowdate.getMonth()+1)+" "+nowdate.getFullYear(); } }]);