'use strict';

var TrialBalanceCtrl = ['$scope', '$location', 'asDateFilter', 'trialBalance', function ($scope, $location, asDate, trialBalance) {
    $scope.info = trialBalance;
    $scope.show = function () {
        $location.path('/TrialBalance/' + asDate($scope.info.Date));
    };
    $('#txtDate').focus();
}];
TrialBalanceCtrl.resolve = {
    trialBalance: ['$route', 'TrialBalance', function ($route, TrialBalance) {
        var date = $route.current.params.date;

        if (angular.isUndefined(date)) {
            return TrialBalance.get({}).$promise;
        } else {
            return TrialBalance.get({date: date}).$promise;
        }
    }]
};