Last active
September 5, 2018 12:58
-
-
Save padhyakash/0791425a0656b02b52d5d6678f220118 to your computer and use it in GitHub Desktop.
Calculate Total hours for an invoice period
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hourSetting.getTime() | |
.then(function (res) { | |
if (res.status === 200) { | |
$scope.time = res.data; | |
$scope.shortDate = $filter('orderBy')(res.data, 'timestamp'); | |
$scope.min = $scope.shortDate[0].timestamp; | |
$scope.max = $scope.shortDate[$scope.shortDate.length - 1].timestamp; | |
console.log($scope.max); | |
hourSetting.get_cusSetting() | |
.then(function (res) { | |
$scope.invoiceDate = res.data.invoice_day_of_month; | |
}); | |
} | |
}) | |
.catch(function () { | |
$scope.time = []; | |
}); | |
outPut: invoice period = Aug 1 2018 to sept 1 2018 , Total hours = xx hour xx min | |
total hour = total (logged_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log($scope.shortDate); | |
(10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] | |
0: {id: 22, timestamp: "2018-03-03T18:30:00Z", transaction_id: 7893, user_id: 4, logged_time: 122, …} | |
1: {id: 1, timestamp: "2018-06-20T11:15:45Z", transaction_id: 7872, user_id: 4, logged_time: 60, …} | |
2: {id: 21, timestamp: "2018-07-04T18:30:00Z", transaction_id: 7892, user_id: 35, logged_time: 60, …} | |
3: {id: 23, timestamp: "2018-07-04T18:30:00Z", transaction_id: 7894, user_id: 35, logged_time: 60, …} | |
4: {id: 35, timestamp: "2018-07-12T08:07:00Z", transaction_id: 7906, user_id: 4, logged_time: 111, …} | |
5: {id: 46, timestamp: "2018-07-17T00:00:00Z", transaction_id: 7920, user_id: 4, logged_time: 122, …} | |
6: {id: 55, timestamp: "2018-07-17T00:00:00Z", transaction_id: 7930, user_id: 4, logged_time: 1, …} | |
7: {id: 68, timestamp: "2018-07-25T00:00:00Z", transaction_id: 7956, user_id: 4, logged_time: 122, …} | |
8: {id: 65, timestamp: "2018-07-25T18:30:00Z", transaction_id: 7952, user_id: 4, logged_time: 23, …} | |
9: {id: 71, timestamp: "2018-09-04T00:00:00Z", transaction_id: 8024, user_id: 1, logged_time: 138, …} | |
console.log($scope.max); | |
2018-09-04T00:00:00Z | |
console.log($scope.invoiceDate); | |
19 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment