{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/comments/127611473","pull_request_review_id":50215333,"id":127611473,"diff_hunk":"@@ -0,0 +1,205 @@\n+var Router = require('restify-router').Router;\n+var db = require(\"../../../../db\");\n+var ProductionOrderManager = require(\"dl-module\").managers.sales.ProductionOrderManager;\n+var resultFormatter = require(\"../../../../result-formatter\");\n+var passport = require('../../../../passports/jwt-passport');\n+const apiVersion = '1.0.0';\n+\n+function getRouter() {\n+    var router = new Router();\n+    router.get(\"/\", passport, function (request, response, next) {\n+        db.get().then(db => {\n+            var manager = new ProductionOrderManager(db, request.user);\n+\n+            var query = request.queryInfo;\n+            query.accept =request.headers.accept;\n+            // if(!query.page){\n+            //     query.page=1;\n+            // }if(!query.size){\n+            //     query.size=20;\n+            // }\n+            manager.getSalesMonthlyReport(query)\n+                .then(docs => {\n+                    var dateFormat = \"DD MMM YYYY\";\n+                    var locale = 'id';\n+                    var moment = require('moment');\n+                    moment.locale(locale);\n+                    if ((request.headers.accept || '').toString().indexOf(\"application/xls\") < 0) {\n+                        for (var a in docs.data) {\n+                            docs.data[a]._createdDate = moment(new Date(docs.data[a]._createdDate)).format(dateFormat);\n+                            docs.data[a].deliveryDate = moment(new Date(docs.data[a].deliveryDate)).format(dateFormat);\n+                        }\n+                        \n+                        var result = resultFormatter.ok(apiVersion, 200, docs.data);\n+                        delete docs.data;\n+                        result.info = docs;\n+                        response.send(200, result);\n+                    } else {\n+                        var index = 0;\n+                        var data = [];\n+                        for (var order of docs.data) {\n+                            index++;\n+                            var item = {};\n+                            // var firstname = \"\";\n+                            // var lastname = \"\";\n+                            // if (order.firstname) firstname = order.firstname;\n+                            // if (order.lastname) lastname = order.lastname;\n+                            item[\"No\"] = index;\n+                            item[\"Sales\"] = order._id.sales;\n+                            item[\"Januari\"] = order.jan;\n+                            item[\"Februari\"] = order.feb;\n+                            item[\"Maret\"] = order.mar;\n+                            item[\"April\"] = order.apr;\n+                            item[\"Mei\"] = order.mei;\n+                            item[\"Juni\"] = order.jun;\n+                            item[\"Juli\"] = order.jul;\n+                            item[\"Agustus\"] = order.agu;","path":"src/routers/v1/sales/reports/sales-monthly-report-router.js","position":56,"original_position":56,"commit_id":"a8ca32331a4a17a5442ea10f1015d0b72e9e2277","original_commit_id":"a8ca32331a4a17a5442ea10f1015d0b72e9e2277","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars4.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"['Agustus'] is better written in dot notation.","created_at":"2017-07-16T16:56:30Z","updated_at":"2017-07-16T16:56:31Z","html_url":"https://github.com/danliris/dl-production-webapi/pull/111#discussion_r127611473","pull_request_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/comments/127611473"},"html":{"href":"https://github.com/danliris/dl-production-webapi/pull/111#discussion_r127611473"},"pull_request":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111","id":130758029,"html_url":"https://github.com/danliris/dl-production-webapi/pull/111","diff_url":"https://github.com/danliris/dl-production-webapi/pull/111.diff","patch_url":"https://github.com/danliris/dl-production-webapi/pull/111.patch","issue_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/111","number":111,"state":"open","locked":false,"title":"Merge Uat ke Master 16 July 2017","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars4.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-16T16:56:02Z","updated_at":"2017-07-16T16:56:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a122c2e6ceb9a4f5f489d8610880efdcb1d38ea","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111/commits","review_comments_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111/comments","review_comment_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/111/comments","statuses_url":"https://api.github.com/repos/danliris/dl-production-webapi/statuses/a8ca32331a4a17a5442ea10f1015d0b72e9e2277","head":{"label":"danliris:uat","ref":"uat","sha":"a8ca32331a4a17a5442ea10f1015d0b72e9e2277","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars4.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":74094794,"name":"dl-production-webapi","full_name":"danliris/dl-production-webapi","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars4.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/dl-production-webapi","description":"Dan Liris production RESTful api","fork":false,"url":"https://api.github.com/repos/danliris/dl-production-webapi","forks_url":"https://api.github.com/repos/danliris/dl-production-webapi/forks","keys_url":"https://api.github.com/repos/danliris/dl-production-webapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/dl-production-webapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/dl-production-webapi/teams","hooks_url":"https://api.github.com/repos/danliris/dl-production-webapi/hooks","issue_events_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/dl-production-webapi/events","assignees_url":"https://api.github.com/repos/danliris/dl-production-webapi/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/dl-production-webapi/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/dl-production-webapi/tags","blobs_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/dl-production-webapi/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/dl-production-webapi/languages","stargazers_url":"https://api.github.com/repos/danliris/dl-production-webapi/stargazers","contributors_url":"https://api.github.com/repos/danliris/dl-production-webapi/contributors","subscribers_url":"https://api.github.com/repos/danliris/dl-production-webapi/subscribers","subscription_url":"https://api.github.com/repos/danliris/dl-production-webapi/subscription","commits_url":"https://api.github.com/repos/danliris/dl-production-webapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/dl-production-webapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/dl-production-webapi/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/dl-production-webapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/dl-production-webapi/merges","archive_url":"https://api.github.com/repos/danliris/dl-production-webapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/dl-production-webapi/downloads","issues_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/dl-production-webapi/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/dl-production-webapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/dl-production-webapi/labels{/name}","releases_url":"https://api.github.com/repos/danliris/dl-production-webapi/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/dl-production-webapi/deployments","created_at":"2016-11-18T04:19:28Z","updated_at":"2016-12-27T07:33:41Z","pushed_at":"2017-07-16T16:56:02Z","git_url":"git://github.com/danliris/dl-production-webapi.git","ssh_url":"git@github.com:danliris/dl-production-webapi.git","clone_url":"https://github.com/danliris/dl-production-webapi.git","svn_url":"https://github.com/danliris/dl-production-webapi","homepage":null,"size":378,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":1,"forks":18,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"danliris:master","ref":"master","sha":"fa80ffda059c1069d027bbb4ffd526ab29f711a2","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars4.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":74094794,"name":"dl-production-webapi","full_name":"danliris/dl-production-webapi","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars4.githubusercontent.com/u/20855729?v=4","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/dl-production-webapi","description":"Dan Liris production RESTful api","fork":false,"url":"https://api.github.com/repos/danliris/dl-production-webapi","forks_url":"https://api.github.com/repos/danliris/dl-production-webapi/forks","keys_url":"https://api.github.com/repos/danliris/dl-production-webapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/dl-production-webapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/dl-production-webapi/teams","hooks_url":"https://api.github.com/repos/danliris/dl-production-webapi/hooks","issue_events_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/dl-production-webapi/events","assignees_url":"https://api.github.com/repos/danliris/dl-production-webapi/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/dl-production-webapi/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/dl-production-webapi/tags","blobs_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/dl-production-webapi/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/dl-production-webapi/languages","stargazers_url":"https://api.github.com/repos/danliris/dl-production-webapi/stargazers","contributors_url":"https://api.github.com/repos/danliris/dl-production-webapi/contributors","subscribers_url":"https://api.github.com/repos/danliris/dl-production-webapi/subscribers","subscription_url":"https://api.github.com/repos/danliris/dl-production-webapi/subscription","commits_url":"https://api.github.com/repos/danliris/dl-production-webapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/dl-production-webapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/dl-production-webapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/dl-production-webapi/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/dl-production-webapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/dl-production-webapi/merges","archive_url":"https://api.github.com/repos/danliris/dl-production-webapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/dl-production-webapi/downloads","issues_url":"https://api.github.com/repos/danliris/dl-production-webapi/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/dl-production-webapi/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/dl-production-webapi/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/dl-production-webapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/dl-production-webapi/labels{/name}","releases_url":"https://api.github.com/repos/danliris/dl-production-webapi/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/dl-production-webapi/deployments","created_at":"2016-11-18T04:19:28Z","updated_at":"2016-12-27T07:33:41Z","pushed_at":"2017-07-16T16:56:02Z","git_url":"git://github.com/danliris/dl-production-webapi.git","ssh_url":"git@github.com:danliris/dl-production-webapi.git","clone_url":"https://github.com/danliris/dl-production-webapi.git","svn_url":"https://github.com/danliris/dl-production-webapi","homepage":null,"size":378,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":1,"forks":18,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111"},"html":{"href":"https://github.com/danliris/dl-production-webapi/pull/111"},"issue":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/issues/111"},"comments":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/dl-production-webapi/statuses/a8ca32331a4a17a5442ea10f1015d0b72e9e2277"}}}}
{"actor":{"display_login":"houndci-bot"}}