'use strict';var DEBUG=true;var monthNamesShort=["Jän","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez","Total"];var monthNamesLong=["Jänner","Februar","März","April","Mai","Juni","July","August","September","Oktober","November","Dezember","Total"];var twoBookApp=angular.module('twoBookApp',['twoBookApp.landing','twoBookApp.book-entries','twoBookApp.tiles','twoBookApp.uva','twoBookApp.insert-book-entry','twoBookApp.dashboard','twoBookApp.chart-performance','twoBookApp.chart-performance-cum','twoBookApp.chart-top','twoBookApp.table-performance','twoBookApp.dashboard','twoBookApp.version','ui.bootstrap','ui.router','ui.grid','ui.grid.resizeColumns','ngFileUpload','kendo.directives','bootstrapSwitch',]).config(['$stateProvider','$urlRouterProvider','$httpProvider',function($stateProvider,$urlRouterProvider,$httpProvider){$stateProvider.state('tbo',{abstract:true,url:'',views:{header:{templateUrl:'main-view-parts/header.template.html'},pageHead:{templateUrl:'main-view-parts/page-head.template.html'},content:{template:'
'}}}).state('tbo.home',{url:'/home',views:{content:{templateUrl:'home.html'}}}).state('tbo.dashboard',{url:'/dashboard',data:{pageTitle:'Dashboard'},views:{content:{template:''}}}).state('tbo.book-entries',{url:'/book-entries',data:{pageTitle:'Eingabe'},params:{showUnclearOnly:'false'},views:{content:{template:''}}}).state('tbo.uva',{url:'/uva',data:{pageTitle:'Auswertung zur Umsatzsteuervoranmeldung'},views:{content:{template:''}}}).state('tbo.chart',{abstract:true,url:'/chart',views:{content:{template:''}}}).state('tbo.chart.performance',{url:'/chart-performance',data:{pageTitle:'Einnahmen / Ausgaben'},views:{content:{template:''}}}).state('tbo.chart.performancecum',{url:'/chart-performancecum',data:{pageTitle:'Gewinnentwicklung'},views:{content:{template:''}}}).state('tbo.chart.top-customers',{url:'/top-customers',data:{pageTitle:'Top 10 Kunden'},views:{content:{template:''}}}).state('tbo.chart.top-suppliers',{url:'/top-suppliers',data:{pageTitle:'Top 10 Lieferanten'},views:{content:{template:''}}}).state('tbo.chart.top-incomes',{url:'/top-incomes',data:{pageTitle:'Top 10 Einnahmen'},views:{content:{template:''}}}).state('tbo.chart.top-expenses',{url:'/top-expenses',data:{pageTitle:'Top 10 Ausgaben'},views:{content:{template:''}}}).state('tbo.chart.top-note',{url:'/top-note',data:{pageTitle:'Top 10 Notizen'},views:{content:{template:''}}}).state('tbo.chart.top-info1',{url:'/top-info1',data:{pageTitle:'Top 10 Info1'},views:{content:{template:''}}}).state('tbo.chart.top-info2',{url:'/top-info2',data:{pageTitle:'Top 10 Info2'},views:{content:{template:''}}}).state('landingpage',{url:'/landingpage',views:{content:{template:''}}}).state('logout',{url:'/logout',views:{content:{template:'Logging out ...
',controller:['$state','SessionService',function($state,SessionService){SessionService.logOut();$state.go('landingpage');}]},},});$urlRouterProvider.otherwise('/landingpage');$httpProvider.defaults.useXDomain=true;}]).controller('NavbarController',['$scope','$state','$location','SessionService','$filter',function($scope,$state,$location,SessionService,$filter){var waitCounter=0;$scope.isState=function(state){return $state.includes(state);};$scope.getCurrentBookKeeping=function(){DEBUG&&console.log('ask for current book keeping');SessionService.progressSymbol(true);SessionService.getCurrentBookKeeping().then(function(result){DEBUG&&console.log('promise for current book keeping resolved')
$scope.currentClient={Lea:result.Lea,Name:result.ClientName};$scope.currentBookKeeping={Lea:result.Lea,Year:result.Year,IsGross:result.IsGross};waitCounter--;SessionService.progressSymbol(false);});}
$scope.getBookKeepings=function(){DEBUG&&console.log('ask for bookkeepings');waitCounter++;SessionService.progressSymbol(true);SessionService.getBookKeepings().then(function(result){DEBUG&&console.log('bookkeepings promise resolved')
$scope.bookKeepings=result;waitCounter--;SessionService.progressSymbol(false);});}
$scope.getClients=function(){DEBUG&&console.log('ask for clients');waitCounter++;SessionService.progressSymbol(true);SessionService.getClients().then(function(result){DEBUG&&console.log('clients promise resolved')
$scope.clients=result;waitCounter--;SessionService.progressSymbol(false);});}
$scope.getUserInfo=function(){DEBUG&&console.log('ask for user info');waitCounter++;SessionService.progressSymbol(true);SessionService.getUserInfo().then(function(result){DEBUG&&console.log('user info promise resolved')
$scope.userInfo=result;waitCounter--;SessionService.progressSymbol(false);});}
$scope.changeBookKeeping=function(bookKeeping){SessionService.setCurrentBookKeeping(bookKeeping.Lea,bookKeeping.Year);$scope.getCurrentBookKeeping();}
$scope.changeClient=function(client){$scope.currentBookKeeping=$filter('filter')($scope.bookKeepings,{Lea:client.Lea})[0];$scope.changeBookKeeping($scope.currentBookKeeping);}
$scope.getCurrentBookKeeping();$scope.getBookKeepings();$scope.getClients();}]);twoBookApp.factory('settings',['$rootScope',function($rootScope){var settings={layout:{pageSidebarClosed:false,pageContentWhite:true,pageBodySolid:false,pageAutoScrollOnLoad:1000},medtronicAssetsPath:'./content/metronic/assets',medtronicGlobalPath:'./content/metronic/assets/global',medtronicLayoutPath:'./content/metronic/assets/layouts/layout3',assetsPath:'./assets'};$rootScope.settings=settings;return settings;}]);twoBookApp.run(["$rootScope","settings","$state",function($rootScope,settings,$state){$rootScope.$state=$state;$rootScope.$settings=settings;}]);twoBookApp.filter('getIncomeExpenseById',function(){return function(input,id){if(input===undefined){return null;}
var i=0,len=input.length;for(;i