flexbiz-server 12.7.1 → 12.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (884) hide show
  1. package/package.json +5 -5
  2. package/server/app.js +23 -348
  3. package/server/cluster.js +1 -5
  4. package/server/models/account.js +7 -0
  5. package/server/models/actionLog.js +2 -0
  6. package/server/models/afflink.js +2 -0
  7. package/server/models/aimemory.js +1 -0
  8. package/server/models/app.js +16 -0
  9. package/server/models/approve.js +95 -0
  10. package/server/models/assabcihandler.js +35 -0
  11. package/server/models/assbank.js +19 -0
  12. package/server/models/assbooking.js +4 -0
  13. package/server/models/assbuy.js +3 -0
  14. package/server/models/asscashwithdraw.js +4 -0
  15. package/server/models/assfindhash.js +2 -0
  16. package/server/models/assinvestment.js +13 -0
  17. package/server/models/assissue.js +2 -0
  18. package/server/models/asskey.js +15 -0
  19. package/server/models/assneedtobuy.js +6 -0
  20. package/server/models/assperiod.js +7 -0
  21. package/server/models/assproduct.js +13 -0
  22. package/server/models/assprofitsharing.js +4 -0
  23. package/server/models/assreceiver.js +2 -0
  24. package/server/models/assrequest.js +10 -0
  25. package/server/models/asssell.js +7 -0
  26. package/server/models/asstransaction.js +3 -0
  27. package/server/models/asstransfer.js +4 -0
  28. package/server/models/assuser_identity.js +4 -0
  29. package/server/models/asswithdraw.js +4 -0
  30. package/server/models/attend.js +2 -0
  31. package/server/models/banggiaban.js +8 -0
  32. package/server/models/bangtinhluong.js +6 -0
  33. package/server/models/base.js +1 -0
  34. package/server/models/bg1.js +9 -0
  35. package/server/models/bg2.js +10 -0
  36. package/server/models/cache.js +3 -0
  37. package/server/models/cacheDataReport.js +2 -0
  38. package/server/models/cacheSessionReport.js +5 -0
  39. package/server/models/calllog.js +4 -0
  40. package/server/models/cart.js +5 -0
  41. package/server/models/cddiem.js +2 -0
  42. package/server/models/cddt.js +3 -0
  43. package/server/models/cdkh.js +5 -0
  44. package/server/models/cdkhtheongay.js +5 -0
  45. package/server/models/cdnphep.js +2 -0
  46. package/server/models/cdtk.js +3 -0
  47. package/server/models/cdtktheongay.js +3 -0
  48. package/server/models/cdvt.js +5 -0
  49. package/server/models/cdvtnpp.js +6 -0
  50. package/server/models/cdvttheongay.js +5 -0
  51. package/server/models/chamcong.js +7 -0
  52. package/server/models/chat_message.js +2 -0
  53. package/server/models/chat_session.js +2 -0
  54. package/server/models/checkin.js +4 -0
  55. package/server/models/checkinactivity.js +3 -0
  56. package/server/models/checkinkpi.js +4 -0
  57. package/server/models/checkinlocation.js +2 -0
  58. package/server/models/chitietluongds.js +12 -0
  59. package/server/models/chitieukpi.js +3 -0
  60. package/server/models/chudethaoluan.js +3 -0
  61. package/server/models/ckgtluong.js +2 -0
  62. package/server/models/colleague.js +2 -0
  63. package/server/models/comment.js +4 -0
  64. package/server/models/congdoansx.js +4 -0
  65. package/server/models/congtacvien.js +4 -0
  66. package/server/models/congthuctinhgiaban.js +8 -0
  67. package/server/models/consultant.js +4 -0
  68. package/server/models/contract.js +6 -0
  69. package/server/models/counter.js +2 -0
  70. package/server/models/csluongtheods.js +3 -0
  71. package/server/models/csphucap.js +2 -0
  72. package/server/models/ctds.js +5 -0
  73. package/server/models/ctds2.js +7 -0
  74. package/server/models/currency.js +3 -0
  75. package/server/models/custom_report.js +1 -0
  76. package/server/models/customer.js +31 -0
  77. package/server/models/customer_care.js +2 -0
  78. package/server/models/data_list_config.js +7 -0
  79. package/server/models/databanle.js +8 -0
  80. package/server/models/datlich.js +4 -0
  81. package/server/models/deal.js +2 -0
  82. package/server/models/dh2.js +20 -0
  83. package/server/models/diagram.js +2 -0
  84. package/server/models/dinhmucsx.js +8 -0
  85. package/server/models/dkhoc.js +6 -0
  86. package/server/models/dknphep.js +2 -0
  87. package/server/models/dmban.js +4 -0
  88. package/server/models/dmbp.js +12 -0
  89. package/server/models/dmca.js +2 -0
  90. package/server/models/dmchietkhau.js +8 -0
  91. package/server/models/dmchietkhauhd.js +19 -0
  92. package/server/models/dmchinhanh.js +2 -0
  93. package/server/models/dmcpmh.js +2 -0
  94. package/server/models/dmdiemthuong.js +3 -0
  95. package/server/models/dmdoi.js +4 -0
  96. package/server/models/dmdoituongdanhgia.js +2 -0
  97. package/server/models/dmdt.js +8 -0
  98. package/server/models/dmdvt.js +3 -0
  99. package/server/models/dmgiaban.js +9 -0
  100. package/server/models/dmgiamua.js +5 -0
  101. package/server/models/dmgiathitruong.js +5 -0
  102. package/server/models/dmgiathitruong_ngay.js +2 -0
  103. package/server/models/dmgiathitruong_theodoi.js +2 -0
  104. package/server/models/dmhoahonghd.js +8 -0
  105. package/server/models/dmhoahongnpp.js +8 -0
  106. package/server/models/dmkc.js +3 -0
  107. package/server/models/dmkho.js +7 -0
  108. package/server/models/dmkhuyenmai.js +9 -0
  109. package/server/models/dmkhuyenmaihd.js +11 -0
  110. package/server/models/dmletet.js +2 -0
  111. package/server/models/dmlo.js +4 -0
  112. package/server/models/dmloaicong.js +4 -0
  113. package/server/models/dmloaitask.js +2 -0
  114. package/server/models/dmloaits.js +2 -0
  115. package/server/models/dmnckkm.js +4 -0
  116. package/server/models/dmnghiepvu.js +4 -0
  117. package/server/models/dmnguonvon.js +2 -0
  118. package/server/models/dmnhnv.js +4 -0
  119. package/server/models/dmnv.js +17 -0
  120. package/server/models/dmnvt.js +10 -0
  121. package/server/models/dmphi.js +3 -0
  122. package/server/models/dmqct.js +3 -0
  123. package/server/models/dmqddvt.js +3 -0
  124. package/server/models/dmtanggiamts.js +3 -0
  125. package/server/models/dmto.js +4 -0
  126. package/server/models/dmtt.js +6 -0
  127. package/server/models/dmvt.js +17 -0
  128. package/server/models/dmyt.js +4 -0
  129. package/server/models/dn0.js +13 -0
  130. package/server/models/dnm.js +11 -0
  131. package/server/models/dokho.js +2 -0
  132. package/server/models/domain.js +2 -0
  133. package/server/models/dvcs.js +3 -0
  134. package/server/models/ecomcategories.js +3 -0
  135. package/server/models/ecomcategories_cty.js +3 -0
  136. package/server/models/ecomproductlines.js +2 -0
  137. package/server/models/ecompromotion_flashsales.js +2 -0
  138. package/server/models/ecompromotion_freeships.js +2 -0
  139. package/server/models/email.js +2 -0
  140. package/server/models/endpoint.js +1 -0
  141. package/server/models/events.js +3 -0
  142. package/server/models/evoucher.js +5 -0
  143. package/server/models/experiencejourney.js +2 -0
  144. package/server/models/experiencejourneydata.js +4 -0
  145. package/server/models/experiencejourneypersona.js +3 -0
  146. package/server/models/experiencejourneystage.js +2 -0
  147. package/server/models/exportexceltemplate.js +2 -0
  148. package/server/models/fbconversation.js +15 -0
  149. package/server/models/fbmessage.js +2 -0
  150. package/server/models/fbpage.js +2 -0
  151. package/server/models/fbpost.js +2 -0
  152. package/server/models/fieldright.js +2 -0
  153. package/server/models/fifo_dk.js +2 -0
  154. package/server/models/fifo_lot.js +3 -0
  155. package/server/models/fifo_trace.js +4 -0
  156. package/server/models/file.js +4 -0
  157. package/server/models/filechunk.js +2 -0
  158. package/server/models/financialroadmap.js +3 -0
  159. package/server/models/flow.js +2 -0
  160. package/server/models/flowdata.js +3 -0
  161. package/server/models/flowpending.js +2 -0
  162. package/server/models/folder.js +4 -0
  163. package/server/models/follow.js +2 -0
  164. package/server/models/forminfo.js +5 -0
  165. package/server/models/giaoca.js +4 -0
  166. package/server/models/giatb.js +3 -0
  167. package/server/models/group.js +9 -0
  168. package/server/models/gt_ctgt.js +4 -0
  169. package/server/models/gt_hspb.js +3 -0
  170. package/server/models/gt_sltk.js +3 -0
  171. package/server/models/gt_thcppstk.js +3 -0
  172. package/server/models/hanmucton.js +4 -0
  173. package/server/models/hd1.js +11 -0
  174. package/server/models/hd2.js +26 -0
  175. package/server/models/hd3.js +17 -0
  176. package/server/models/hd4.js +13 -0
  177. package/server/models/hd7.js +17 -0
  178. package/server/models/hd8.js +12 -0
  179. package/server/models/hde.js +11 -0
  180. package/server/models/hmcn.js +3 -0
  181. package/server/models/hmcnct.js +2 -0
  182. package/server/models/hspbts.js +4 -0
  183. package/server/models/htl.js +13 -0
  184. package/server/models/importexceltemplate.js +2 -0
  185. package/server/models/introducebonus.js +4 -0
  186. package/server/models/introducecode.js +3 -0
  187. package/server/models/introducer.js +4 -0
  188. package/server/models/kbbtpb.js +7 -0
  189. package/server/models/kbmPttct.js +4 -0
  190. package/server/models/kbmTkgtgt.js +5 -0
  191. package/server/models/kbm_bcdkt_old.js +4 -0
  192. package/server/models/kbm_kqhdkd_old.js +3 -0
  193. package/server/models/kbm_lcttgt_old.js +5 -0
  194. package/server/models/kbm_lctttt_old.js +4 -0
  195. package/server/models/kbm_pttct_old.js +4 -0
  196. package/server/models/kbm_tkgtgt_old.js +5 -0
  197. package/server/models/kbmbcdkt.js +4 -0
  198. package/server/models/kbmbcqt.js +4 -0
  199. package/server/models/kbmkqhdkd.js +3 -0
  200. package/server/models/kbmlcttgt.js +6 -0
  201. package/server/models/kbmlctttt.js +4 -0
  202. package/server/models/kbmtmbctc.js +4 -0
  203. package/server/models/kehoachdtcp.js +3 -0
  204. package/server/models/kehoachmh.js +8 -0
  205. package/server/models/keyresult.js +7 -0
  206. package/server/models/khunghangthanhvien.js +3 -0
  207. package/server/models/label.js +2 -0
  208. package/server/models/labelinfo.js +2 -0
  209. package/server/models/lenhcapphat.js +8 -0
  210. package/server/models/lenhsx.js +8 -0
  211. package/server/models/lienhe.js +4 -0
  212. package/server/models/like_module.js +2 -0
  213. package/server/models/link.js +2 -0
  214. package/server/models/listinfo.js +1365 -0
  215. package/server/models/loaidiem.js +2 -0
  216. package/server/models/lock.js +2 -0
  217. package/server/models/log.js +8 -0
  218. package/server/models/mailaccount.js +3 -0
  219. package/server/models/mailgroup.js +3 -0
  220. package/server/models/mailreceived.js +2 -0
  221. package/server/models/mailsent.js +2 -0
  222. package/server/models/mailtemplate.js +2 -0
  223. package/server/models/maudanhgia.js +2 -0
  224. package/server/models/menuinfo.js +2 -0
  225. package/server/models/message.js +8 -0
  226. package/server/models/message2.js +4 -0
  227. package/server/models/message2setting.js +3 -0
  228. package/server/models/moduleinfo.js +4 -0
  229. package/server/models/momo.js +18 -0
  230. package/server/models/news.js +3 -0
  231. package/server/models/newsfeed.js +4 -0
  232. package/server/models/note.js +2 -0
  233. package/server/models/notification.js +8 -0
  234. package/server/models/okr.js +4 -0
  235. package/server/models/okrdiagram.js +3 -0
  236. package/server/models/onepay.js +24 -0
  237. package/server/models/opportunity.js +4 -0
  238. package/server/models/options.js +2 -0
  239. package/server/models/originimportid.js +1 -0
  240. package/server/models/otp.js +1 -0
  241. package/server/models/parameter.js +2 -0
  242. package/server/models/participant.js +21 -0
  243. package/server/models/partner.js +1 -0
  244. package/server/models/payload.js +1 -0
  245. package/server/models/pbl.js +16 -0
  246. package/server/models/pc0.js +13 -0
  247. package/server/models/pc1.js +14 -0
  248. package/server/models/pc2.js +13 -0
  249. package/server/models/pc3.js +13 -0
  250. package/server/models/pc5.js +8 -0
  251. package/server/models/pc6.js +14 -0
  252. package/server/models/pcl.js +6 -0
  253. package/server/models/pdn.js +9 -0
  254. package/server/models/pdx.js +9 -0
  255. package/server/models/pgh.js +5 -0
  256. package/server/models/phieudanhgia.js +3 -0
  257. package/server/models/pht.js +8 -0
  258. package/server/models/phucap.js +4 -0
  259. package/server/models/pkc.js +6 -0
  260. package/server/models/pkh.js +6 -0
  261. package/server/models/pkk.js +10 -0
  262. package/server/models/pkt.js +12 -0
  263. package/server/models/pn1.js +18 -0
  264. package/server/models/pn2.js +12 -0
  265. package/server/models/pn3.js +13 -0
  266. package/server/models/pn5.js +14 -0
  267. package/server/models/pn6.js +14 -0
  268. package/server/models/pn9.js +17 -0
  269. package/server/models/pnc.js +9 -0
  270. package/server/models/pnh.js +11 -0
  271. package/server/models/pnk.js +10 -0
  272. package/server/models/po1.js +19 -0
  273. package/server/models/ppb.js +6 -0
  274. package/server/models/productcode.js +2 -0
  275. package/server/models/profile.js +4 -0
  276. package/server/models/pt1.js +12 -0
  277. package/server/models/pt5.js +8 -0
  278. package/server/models/ptl.js +5 -0
  279. package/server/models/ptthanhtoan.js +6 -0
  280. package/server/models/purchase_contract.js +17 -0
  281. package/server/models/pxc.js +9 -0
  282. package/server/models/pxh.js +11 -0
  283. package/server/models/pxk.js +9 -0
  284. package/server/models/qts.js +14 -0
  285. package/server/models/qts_dieuchinh.js +3 -0
  286. package/server/models/qts_dieuchuyen.js +4 -0
  287. package/server/models/quanhuyen.js +2 -0
  288. package/server/models/reason.js +2 -0
  289. package/server/models/receivedinvoice.js +2 -0
  290. package/server/models/reportinfo.js +5 -0
  291. package/server/models/right.js +4 -0
  292. package/server/models/rpt.js +2 -0
  293. package/server/models/rptform.js +3 -0
  294. package/server/models/rptobject.js +2 -0
  295. package/server/models/sale_contract.js +9 -0
  296. package/server/models/schedule.js +18 -0
  297. package/server/models/schedule_log.js +2 -0
  298. package/server/models/shipbook.js +12 -0
  299. package/server/models/shortcut.js +2 -0
  300. package/server/models/smsaccount.js +10 -0
  301. package/server/models/smssend.js +2 -0
  302. package/server/models/so1.js +22 -0
  303. package/server/models/so5.js +15 -0
  304. package/server/models/so9.js +19 -0
  305. package/server/models/socai.js +28 -0
  306. package/server/models/socainpp.js +18 -0
  307. package/server/models/socaitc.js +6 -0
  308. package/server/models/socaitmp.js +16 -0
  309. package/server/models/socaitt.js +4 -0
  310. package/server/models/sodiemthuong.js +4 -0
  311. package/server/models/sokho.js +27 -0
  312. package/server/models/sokhocapphat.js +18 -0
  313. package/server/models/sokhokhongton.js +19 -0
  314. package/server/models/sokhonpp.js +19 -0
  315. package/server/models/sokhotc.js +8 -0
  316. package/server/models/sokhott.js +18 -0
  317. package/server/models/sophanbokh.js +3 -0
  318. package/server/models/sosanxuat.js +5 -0
  319. package/server/models/sotinhkh.js +2 -0
  320. package/server/models/spdd_ck.js +3 -0
  321. package/server/models/spdd_dk.js +3 -0
  322. package/server/models/step.js +2 -0
  323. package/server/models/strategicdiagram.js +3 -0
  324. package/server/models/strategicgoal.js +4 -0
  325. package/server/models/strategickpi.js +6 -0
  326. package/server/models/strategicobjective.js +5 -0
  327. package/server/models/strategicplan.js +5 -0
  328. package/server/models/subscribe.js +2 -0
  329. package/server/models/support.js +2 -0
  330. package/server/models/synctime.js +2 -0
  331. package/server/models/sys_job_queue_book_keeping.js +2 -0
  332. package/server/models/sysconfig.js +2 -0
  333. package/server/models/sysgroup.js +2 -0
  334. package/server/models/tableinfo.js +3 -0
  335. package/server/models/task.js +9 -0
  336. package/server/models/tc.js +2 -0
  337. package/server/models/tdttco.js +9 -0
  338. package/server/models/tdttco_tt.js +5 -0
  339. package/server/models/tdttno.js +9 -0
  340. package/server/models/tdttno_tt.js +5 -0
  341. package/server/models/templaterpt.js +2 -0
  342. package/server/models/templatestore.js +3 -0
  343. package/server/models/templatevoucher.js +3 -0
  344. package/server/models/tinhthanh.js +2 -0
  345. package/server/models/tokens.js +3 -0
  346. package/server/models/tontucthoi.js +9 -0
  347. package/server/models/trangthai.js +4 -0
  348. package/server/models/trangthaiapp.js +4 -0
  349. package/server/models/transaction.js +16 -0
  350. package/server/models/trialinfo.js +2 -0
  351. package/server/models/user.js +40 -0
  352. package/server/models/usergroup.js +7 -0
  353. package/server/models/vanchuyen.js +12 -0
  354. package/server/models/vat.js +3 -0
  355. package/server/models/vatra.js +6 -0
  356. package/server/models/vatvao.js +6 -0
  357. package/server/models/versioninfo.js +2 -0
  358. package/server/models/vietqrbanks.js +2 -0
  359. package/server/models/vsocai.js +6 -0
  360. package/server/models/wallet.js +8 -0
  361. package/server/models/warranty.js +3 -0
  362. package/server/models/warrantyclaim.js +2 -0
  363. package/server/models/warrantypolicy.js +1 -0
  364. package/server/models/workflow.js +4 -0
  365. package/server/models/xaphuong.js +2 -0
  366. package/server/models/xhd.js +10 -0
  367. package/server/models/ytdd_ck.js +4 -0
  368. package/server/models/ytdd_dk.js +4 -0
  369. package/server/models/zalo.js +17 -0
  370. package/server/modules/lists/bg-cddiem.js +6 -0
  371. package/server/modules/lists/bg-cddt.js +7 -0
  372. package/server/modules/lists/bg-cdkh.js +11 -0
  373. package/server/modules/lists/bg-cdnphep.js +6 -0
  374. package/server/modules/lists/bg-cdtk.js +9 -0
  375. package/server/modules/lists/bg-cdvt.js +8 -0
  376. package/server/modules/lists/bg-cdvtnpp.js +8 -0
  377. package/server/modules/lists/bg-fifo_dk.js +8 -0
  378. package/server/modules/lists/ls-account.js +4 -0
  379. package/server/modules/lists/ls-afflink.js +3 -0
  380. package/server/modules/lists/ls-approve.js +5 -0
  381. package/server/modules/lists/ls-assabcihandler.js +3 -0
  382. package/server/modules/lists/ls-assbank.js +3 -0
  383. package/server/modules/lists/ls-assbooking.js +20 -0
  384. package/server/modules/lists/ls-assbuy.js +8 -0
  385. package/server/modules/lists/ls-asscashwithdraw.js +8 -0
  386. package/server/modules/lists/ls-assinvestment.js +31 -0
  387. package/server/modules/lists/ls-assissue.js +3 -0
  388. package/server/modules/lists/ls-asskey.js +41 -0
  389. package/server/modules/lists/ls-assneedtobuy.js +10 -0
  390. package/server/modules/lists/ls-assperiod.js +19 -0
  391. package/server/modules/lists/ls-assproduct.js +9 -0
  392. package/server/modules/lists/ls-assprofitsharing.js +8 -0
  393. package/server/modules/lists/ls-assreceiver.js +3 -0
  394. package/server/modules/lists/ls-assrequest.js +4 -0
  395. package/server/modules/lists/ls-asssell.js +13 -0
  396. package/server/modules/lists/ls-asstransaction.js +3 -0
  397. package/server/modules/lists/ls-asstransfer.js +3 -0
  398. package/server/modules/lists/ls-assuser_identity.js +1 -0
  399. package/server/modules/lists/ls-asswithdraw.js +12 -0
  400. package/server/modules/lists/ls-bangtinhluong.js +2 -0
  401. package/server/modules/lists/ls-calllog.js +4 -0
  402. package/server/modules/lists/ls-cart.js +14 -0
  403. package/server/modules/lists/ls-chamcong.js +3 -0
  404. package/server/modules/lists/ls-chat_session.js +5 -0
  405. package/server/modules/lists/ls-checkin.js +24 -0
  406. package/server/modules/lists/ls-checkinactivity.js +8 -0
  407. package/server/modules/lists/ls-checkinkpi.js +3 -0
  408. package/server/modules/lists/ls-checkinlocation.js +1 -0
  409. package/server/modules/lists/ls-chitietluongds.js +4 -0
  410. package/server/modules/lists/ls-chitieukpi.js +1 -0
  411. package/server/modules/lists/ls-chudethaoluan.js +1 -0
  412. package/server/modules/lists/ls-ckgtluong.js +1 -0
  413. package/server/modules/lists/ls-comment.js +9 -0
  414. package/server/modules/lists/ls-congdoansx.js +3 -0
  415. package/server/modules/lists/ls-congtacvien.js +5 -0
  416. package/server/modules/lists/ls-consultant.js +2 -0
  417. package/server/modules/lists/ls-contract.js +7 -0
  418. package/server/modules/lists/ls-csluongtheods.js +1 -0
  419. package/server/modules/lists/ls-csphucap.js +1 -0
  420. package/server/modules/lists/ls-ctds.js +4 -0
  421. package/server/modules/lists/ls-ctds2.js +4 -0
  422. package/server/modules/lists/ls-currency.js +1 -0
  423. package/server/modules/lists/ls-customer.js +22 -0
  424. package/server/modules/lists/ls-customer_care.js +1 -0
  425. package/server/modules/lists/ls-datlich.js +9 -0
  426. package/server/modules/lists/ls-dckhauhaots.js +3 -0
  427. package/server/modules/lists/ls-deal.js +3 -0
  428. package/server/modules/lists/ls-diagram.js +1 -0
  429. package/server/modules/lists/ls-dkhoc.js +6 -0
  430. package/server/modules/lists/ls-dknphep.js +1 -0
  431. package/server/modules/lists/ls-dmban.js +4 -0
  432. package/server/modules/lists/ls-dmbp.js +7 -0
  433. package/server/modules/lists/ls-dmca.js +1 -0
  434. package/server/modules/lists/ls-dmchietkhau.js +19 -0
  435. package/server/modules/lists/ls-dmchietkhauhd.js +4 -0
  436. package/server/modules/lists/ls-dmchinhanh.js +1 -0
  437. package/server/modules/lists/ls-dmchucvu.js +2 -0
  438. package/server/modules/lists/ls-dmcpmh.js +1 -0
  439. package/server/modules/lists/ls-dmdiemthuong.js +4 -0
  440. package/server/modules/lists/ls-dmdoi.js +4 -0
  441. package/server/modules/lists/ls-dmdoituongdanhgia.js +1 -0
  442. package/server/modules/lists/ls-dmdt.js +11 -0
  443. package/server/modules/lists/ls-dmdvt.js +2 -0
  444. package/server/modules/lists/ls-dmgiaban.js +4 -0
  445. package/server/modules/lists/ls-dmgiamua.js +4 -0
  446. package/server/modules/lists/ls-dmgiathitruong.js +15 -0
  447. package/server/modules/lists/ls-dmgiathitruong_ngay.js +2 -0
  448. package/server/modules/lists/ls-dmgiathitruong_theodoi.js +1 -0
  449. package/server/modules/lists/ls-dmhoahonghd.js +1 -0
  450. package/server/modules/lists/ls-dmhoahongnpp.js +1 -0
  451. package/server/modules/lists/ls-dmkc.js +3 -0
  452. package/server/modules/lists/ls-dmkho.js +7 -0
  453. package/server/modules/lists/ls-dmkhuyenmai.js +5 -0
  454. package/server/modules/lists/ls-dmkhuyenmaihd.js +3 -0
  455. package/server/modules/lists/ls-dmletet.js +1 -0
  456. package/server/modules/lists/ls-dmlo.js +1 -0
  457. package/server/modules/lists/ls-dmloaicong.js +1 -0
  458. package/server/modules/lists/ls-dmloaits.js +1 -0
  459. package/server/modules/lists/ls-dmnckkm.js +7 -0
  460. package/server/modules/lists/ls-dmnghiepvu.js +1 -0
  461. package/server/modules/lists/ls-dmnguonvon.js +1 -0
  462. package/server/modules/lists/ls-dmnhnv.js +6 -0
  463. package/server/modules/lists/ls-dmnhtask.js +5 -0
  464. package/server/modules/lists/ls-dmnkh.js +6 -0
  465. package/server/modules/lists/ls-dmntt.js +6 -0
  466. package/server/modules/lists/ls-dmnv.js +14 -0
  467. package/server/modules/lists/ls-dmnvt.js +7 -0
  468. package/server/modules/lists/ls-dmphi.js +6 -0
  469. package/server/modules/lists/ls-dmqct.js +2 -0
  470. package/server/modules/lists/ls-dmqddvt.js +3 -0
  471. package/server/modules/lists/ls-dmtanggiamts.js +1 -0
  472. package/server/modules/lists/ls-dmto.js +5 -0
  473. package/server/modules/lists/ls-dmtt.js +7 -0
  474. package/server/modules/lists/ls-dmvt.js +52 -0
  475. package/server/modules/lists/ls-dmyt.js +1 -0
  476. package/server/modules/lists/ls-dokho.js +1 -0
  477. package/server/modules/lists/ls-dvcs.js +1 -0
  478. package/server/modules/lists/ls-ecomcategories.js +5 -0
  479. package/server/modules/lists/ls-ecomcategories_cty.js +5 -0
  480. package/server/modules/lists/ls-email.js +4 -0
  481. package/server/modules/lists/ls-events.js +3 -0
  482. package/server/modules/lists/ls-evoucher.js +3 -0
  483. package/server/modules/lists/ls-experiencejourney.js +1 -0
  484. package/server/modules/lists/ls-experiencejourneydata.js +3 -0
  485. package/server/modules/lists/ls-experiencejourneypersona.js +4 -0
  486. package/server/modules/lists/ls-experiencejourneystage.js +1 -0
  487. package/server/modules/lists/ls-fbconversation.js +2 -0
  488. package/server/modules/lists/ls-fbmessage.js +2 -0
  489. package/server/modules/lists/ls-fbpage.js +11 -0
  490. package/server/modules/lists/ls-fbpost.js +2 -0
  491. package/server/modules/lists/ls-file.js +38 -0
  492. package/server/modules/lists/ls-financialroadmap.js +3 -0
  493. package/server/modules/lists/ls-flow.js +6 -0
  494. package/server/modules/lists/ls-flowdata.js +1 -0
  495. package/server/modules/lists/ls-flowpending.js +3 -0
  496. package/server/modules/lists/ls-folder.js +1 -0
  497. package/server/modules/lists/ls-forminfo.js +1 -0
  498. package/server/modules/lists/ls-giaoca.js +5 -0
  499. package/server/modules/lists/ls-group.js +5 -0
  500. package/server/modules/lists/ls-hmcn.js +2 -0
  501. package/server/modules/lists/ls-hspbts.js +3 -0
  502. package/server/modules/lists/ls-introducebonus.js +4 -0
  503. package/server/modules/lists/ls-introducecode.js +10 -0
  504. package/server/modules/lists/ls-introducer.js +21 -0
  505. package/server/modules/lists/ls-kbm-bcdkt.js +1 -0
  506. package/server/modules/lists/ls-kbm-bcqt.js +5 -0
  507. package/server/modules/lists/ls-kbm-kqhdkd.js +1 -0
  508. package/server/modules/lists/ls-kbm-lcttgt.js +1 -0
  509. package/server/modules/lists/ls-kbm-lctttt.js +1 -0
  510. package/server/modules/lists/ls-kbm-pttct.js +3 -0
  511. package/server/modules/lists/ls-kbm-tkgtgt.js +3 -0
  512. package/server/modules/lists/ls-kbm-tmbctc.js +3 -0
  513. package/server/modules/lists/ls-kehoachdtcp.js +4 -0
  514. package/server/modules/lists/ls-keyresult.js +7 -0
  515. package/server/modules/lists/ls-khunghangthanhvien.js +1 -0
  516. package/server/modules/lists/ls-label.js +1 -0
  517. package/server/modules/lists/ls-lienhe.js +4 -0
  518. package/server/modules/lists/ls-like-module.js +1 -0
  519. package/server/modules/lists/ls-link.js +1 -0
  520. package/server/modules/lists/ls-loaidiem.js +1 -0
  521. package/server/modules/lists/ls-lock.js +1 -0
  522. package/server/modules/lists/ls-log.js +3 -0
  523. package/server/modules/lists/ls-mailaccount.js +5 -0
  524. package/server/modules/lists/ls-mailreceived.js +5 -0
  525. package/server/modules/lists/ls-mailsent.js +4 -0
  526. package/server/modules/lists/ls-mailtemplate.js +4 -0
  527. package/server/modules/lists/ls-maudanhgia.js +3 -0
  528. package/server/modules/lists/ls-message2.js +8 -0
  529. package/server/modules/lists/ls-message2setting.js +5 -0
  530. package/server/modules/lists/ls-news.js +7 -0
  531. package/server/modules/lists/ls-newsfeed.js +4 -0
  532. package/server/modules/lists/ls-note.js +6 -0
  533. package/server/modules/lists/ls-okr.js +5 -0
  534. package/server/modules/lists/ls-okrdiagram.js +1 -0
  535. package/server/modules/lists/ls-opportunity.js +5 -0
  536. package/server/modules/lists/ls-options.js +4 -0
  537. package/server/modules/lists/ls-parameter.js +3 -0
  538. package/server/modules/lists/ls-participant.js +12 -0
  539. package/server/modules/lists/ls-phieudanhgia.js +7 -0
  540. package/server/modules/lists/ls-phucap.js +2 -0
  541. package/server/modules/lists/ls-productcode.js +9 -0
  542. package/server/modules/lists/ls-profile.js +1 -0
  543. package/server/modules/lists/ls-ptthanhtoan.js +3 -0
  544. package/server/modules/lists/ls-qts-dieuchinh.js +2 -0
  545. package/server/modules/lists/ls-qts-dieuchuyen.js +8 -0
  546. package/server/modules/lists/ls-reason.js +1 -0
  547. package/server/modules/lists/ls-rpt.js +5 -0
  548. package/server/modules/lists/ls-rptform.js +3 -0
  549. package/server/modules/lists/ls-shortcut.js +1 -0
  550. package/server/modules/lists/ls-smsaccount.js +1 -0
  551. package/server/modules/lists/ls-smssend.js +3 -0
  552. package/server/modules/lists/ls-sosanxuat.js +4 -0
  553. package/server/modules/lists/ls-step.js +1 -0
  554. package/server/modules/lists/ls-strategicdiagram.js +1 -0
  555. package/server/modules/lists/ls-strategicgoal.js +3 -0
  556. package/server/modules/lists/ls-strategickpi.js +7 -0
  557. package/server/modules/lists/ls-strategicobjective.js +3 -0
  558. package/server/modules/lists/ls-strategicplan.js +6 -0
  559. package/server/modules/lists/ls-support.js +3 -0
  560. package/server/modules/lists/ls-task.js +28 -0
  561. package/server/modules/lists/ls-tc.js +1 -0
  562. package/server/modules/lists/ls-templaterpt.js +5 -0
  563. package/server/modules/lists/ls-templatevoucher.js +1 -0
  564. package/server/modules/lists/ls-tontucthoi.js +3 -0
  565. package/server/modules/lists/ls-trangthaiapp.js +3 -0
  566. package/server/modules/lists/ls-transaction.js +4 -0
  567. package/server/modules/lists/ls-usergroup.js +7 -0
  568. package/server/modules/lists/ls-vat.js +1 -0
  569. package/server/modules/lists/ls-vatra.js +5 -0
  570. package/server/modules/lists/ls-vatvao.js +6 -0
  571. package/server/modules/lists/ls-warranty.js +3 -0
  572. package/server/modules/lists/ls-workflow.js +1 -0
  573. package/server/modules/lists/ls_hanmucton.js +3 -0
  574. package/server/modules/lists/ls_hspb.js +4 -0
  575. package/server/modules/lists/ls_spdd_ck.js +3 -0
  576. package/server/modules/lists/ls_spdd_dk.js +3 -0
  577. package/server/modules/lists/ls_ytdd_ck.js +4 -0
  578. package/server/modules/lists/ls_ytdd_dk.js +4 -0
  579. package/server/modules/lists/sys-attend.js +4 -0
  580. package/server/modules/lists/sys-follow.js +4 -0
  581. package/server/modules/lists/sys-right.js +2 -0
  582. package/server/modules/public/app.js +4 -0
  583. package/server/modules/public/approve.js +37 -0
  584. package/server/modules/public/callin.js +7 -0
  585. package/server/modules/public/comment.js +5 -0
  586. package/server/modules/public/dmnvt.js +4 -0
  587. package/server/modules/public/dmvt.js +9 -0
  588. package/server/modules/public/file.js +11 -0
  589. package/server/modules/public/forminfo.js +1 -0
  590. package/server/modules/public/group.js +4 -0
  591. package/server/modules/public/introducecode.js +1 -0
  592. package/server/modules/public/listinfo.js +1 -0
  593. package/server/modules/public/media-webhook.js +1 -0
  594. package/server/modules/public/partner.js +1 -0
  595. package/server/modules/public/paymentCallback.js +32 -0
  596. package/server/modules/public/province.js +1 -0
  597. package/server/modules/public/ptthanhtoan.js +4 -0
  598. package/server/modules/public/subscribe.js +30 -0
  599. package/server/modules/public/support.js +3 -0
  600. package/server/modules/public/tableinfo.js +1 -0
  601. package/server/modules/public/trialinfo.js +4 -0
  602. package/server/modules/public/versioninfo.js +1 -0
  603. package/server/modules/reports/calc-tinhgiafifo.js +8 -0
  604. package/server/modules/reports/calc-tinhgiatb.js +7 -0
  605. package/server/modules/reports/calc-tinhgiathanh.js +7 -0
  606. package/server/modules/reports/calc-tinhkhauhaots.js +3 -0
  607. package/server/modules/reports/calc-tinhluong.js +68 -0
  608. package/server/modules/reports/rp-analyzedata.js +6 -0
  609. package/server/modules/reports/rp-assbonus.js +4 -0
  610. package/server/modules/reports/rp-assinterest.js +8 -0
  611. package/server/modules/reports/rp-assproductowners.js +3 -0
  612. package/server/modules/reports/rp-asssupply.js +1 -0
  613. package/server/modules/reports/rp-asstransferlog.js +10 -0
  614. package/server/modules/reports/rp-backup.js +4 -0
  615. package/server/modules/reports/rp-banggiatb.js +3 -0
  616. package/server/modules/reports/rp-bangtinhkhauhao.js +6 -0
  617. package/server/modules/reports/rp-baoCaoFifoKy.js +1 -0
  618. package/server/modules/reports/rp-baocaokhachhang.js +6 -0
  619. package/server/modules/reports/rp-bcdkt.js +11 -0
  620. package/server/modules/reports/rp-bcintroducebonus.js +4 -0
  621. package/server/modules/reports/rp-bckhtiemnang.js +3 -0
  622. package/server/modules/reports/rp-bcqt.js +85 -0
  623. package/server/modules/reports/rp-bkchamcong.js +5 -0
  624. package/server/modules/reports/rp-bkct.js +13 -0
  625. package/server/modules/reports/rp-bkshipbook.js +8 -0
  626. package/server/modules/reports/rp-bkvanchuyen.js +8 -0
  627. package/server/modules/reports/rp-bkvatra.js +7 -0
  628. package/server/modules/reports/rp-bkvatvao.js +7 -0
  629. package/server/modules/reports/rp-capnhatsocaitc.js +4 -0
  630. package/server/modules/reports/rp-cdpsdiem.js +4 -0
  631. package/server/modules/reports/rp-cdpsdt.js +5 -0
  632. package/server/modules/reports/rp-cdpskh.js +8 -0
  633. package/server/modules/reports/rp-cdpsnphep.js +3 -0
  634. package/server/modules/reports/rp-cdpstk.js +4 -0
  635. package/server/modules/reports/rp-chitietchitientheohoadon.js +12 -0
  636. package/server/modules/reports/rp-chitiettaisan.js +13 -0
  637. package/server/modules/reports/rp-chitietthutientheohoadon.js +13 -0
  638. package/server/modules/reports/rp-ckcn.js +3 -0
  639. package/server/modules/reports/rp-ckdiem.js +2 -0
  640. package/server/modules/reports/rp-cktk.js +3 -0
  641. package/server/modules/reports/rp-ckvt.js +10 -0
  642. package/server/modules/reports/rp-ckvttheokho.js +4 -0
  643. package/server/modules/reports/rp-ckvttheotg.js +4 -0
  644. package/server/modules/reports/rp-ckvttt.js +3 -0
  645. package/server/modules/reports/rp-congnophaithutheotuoino.js +3 -0
  646. package/server/modules/reports/rp-congnophaitratheotuoino.js +3 -0
  647. package/server/modules/reports/rp-congnosapthu.js +4 -0
  648. package/server/modules/reports/rp-congnosaptra.js +4 -0
  649. package/server/modules/reports/rp-congviectheobp.js +9 -0
  650. package/server/modules/reports/rp-congviectheodt.js +8 -0
  651. package/server/modules/reports/rp-congviectheokh.js +8 -0
  652. package/server/modules/reports/rp-congviectheonv.js +9 -0
  653. package/server/modules/reports/rp-congviectheotimeline.js +6 -0
  654. package/server/modules/reports/rp-ctbanle.js +15 -0
  655. package/server/modules/reports/rp-ctbanle2.js +20 -0
  656. package/server/modules/reports/rp-ctbanlectv.js +20 -0
  657. package/server/modules/reports/rp-ctbanlenpp.js +24 -0
  658. package/server/modules/reports/rp-ctdanhgianhanvien.js +8 -0
  659. package/server/modules/reports/rp-cthangbanbitralai.js +4 -0
  660. package/server/modules/reports/rp-ctmuahang.js +7 -0
  661. package/server/modules/reports/rp-cttralaihang.js +4 -0
  662. package/server/modules/reports/rp-databanle.js +10 -0
  663. package/server/modules/reports/rp-diemthuong.js +2 -0
  664. package/server/modules/reports/rp-dkcn.js +3 -0
  665. package/server/modules/reports/rp-dktk.js +2 -0
  666. package/server/modules/reports/rp-dsnhanviencm.js +9 -0
  667. package/server/modules/reports/rp-dsnhanvientb.js +9 -0
  668. package/server/modules/reports/rp-dtbanlekempk.js +12 -0
  669. package/server/modules/reports/rp-dtbanletheoct.js +22 -0
  670. package/server/modules/reports/rp-dtbanletheoctkempk.js +25 -0
  671. package/server/modules/reports/rp-dtbanletheokh.js +17 -0
  672. package/server/modules/reports/rp-dtbanletheokhnpp.js +19 -0
  673. package/server/modules/reports/rp-dtbanletheokho.js +15 -0
  674. package/server/modules/reports/rp-dtbanletheonam.js +3 -0
  675. package/server/modules/reports/rp-dtbanletheongay.js +1 -0
  676. package/server/modules/reports/rp-dtbanletheonpp.js +23 -0
  677. package/server/modules/reports/rp-dtbanletheonv.js +19 -0
  678. package/server/modules/reports/rp-dtbanletheoquy.js +3 -0
  679. package/server/modules/reports/rp-dtbanletheosp.js +9 -0
  680. package/server/modules/reports/rp-dtbanletheospnpp.js +6 -0
  681. package/server/modules/reports/rp-dtbanletheothang.js +3 -0
  682. package/server/modules/reports/rp-dtbanletheothungan.js +12 -0
  683. package/server/modules/reports/rp-dtbanletheovt.js +2 -0
  684. package/server/modules/reports/rp-dtbanletheovtnpp.js +2 -0
  685. package/server/modules/reports/rp-dutoanthuchitheodt.js +4 -0
  686. package/server/modules/reports/rp-getPXC2PNC.js +8 -0
  687. package/server/modules/reports/rp-getariseofaccountsbymonth.js +4 -0
  688. package/server/modules/reports/rp-getbtpb.js +6 -0
  689. package/server/modules/reports/rp-getcashbycashier.js +7 -0
  690. package/server/modules/reports/rp-getcschietkhau.js +5 -0
  691. package/server/modules/reports/rp-getdinhmuc4lenhcp.js +7 -0
  692. package/server/modules/reports/rp-getdinhmuc4pxk.js +9 -0
  693. package/server/modules/reports/rp-getdk4pht.js +8 -0
  694. package/server/modules/reports/rp-getdk4pkc.js +10 -0
  695. package/server/modules/reports/rp-getdttheoca.js +5 -0
  696. package/server/modules/reports/rp-getinvoice2pay.js +4 -0
  697. package/server/modules/reports/rp-getinvoice2receive.js +4 -0
  698. package/server/modules/reports/rp-getinvoice2return.js +5 -0
  699. package/server/modules/reports/rp-getinvoice2return_bl.js +6 -0
  700. package/server/modules/reports/rp-getkehoachmh4lenhcp.js +4 -0
  701. package/server/modules/reports/rp-getkhauhao.js +7 -0
  702. package/server/modules/reports/rp-getluong.js +8 -0
  703. package/server/modules/reports/rp-getluongchuyen.js +5 -0
  704. package/server/modules/reports/rp-getpn2fee.js +5 -0
  705. package/server/modules/reports/rp-getpn2return.js +5 -0
  706. package/server/modules/reports/rp-getthanhpham4pnk.js +7 -0
  707. package/server/modules/reports/rp-getvc2xhd.js +11 -0
  708. package/server/modules/reports/rp-gt_cpnvltt.js +6 -0
  709. package/server/modules/reports/rp-hangbanbitralai.js +5 -0
  710. package/server/modules/reports/rp-hangthanhvien.js +3 -0
  711. package/server/modules/reports/rp-hoadonbanhangtheohantt.js +5 -0
  712. package/server/modules/reports/rp-hoadonmuahangtheohantt.js +5 -0
  713. package/server/modules/reports/rp-hoahong.js +15 -0
  714. package/server/modules/reports/rp-kcsns.js +19 -0
  715. package/server/modules/reports/rp-kgchamcong.js +1 -0
  716. package/server/modules/reports/rp-khoaso.js +11 -0
  717. package/server/modules/reports/rp-kiemtrasocaitcvssocai.js +6 -0
  718. package/server/modules/reports/rp-kqdanhgianhanvien.js +5 -0
  719. package/server/modules/reports/rp-kqhdkd.js +1 -0
  720. package/server/modules/reports/rp-lcttgt.js +16 -0
  721. package/server/modules/reports/rp-lctttt.js +11 -0
  722. package/server/modules/reports/rp-linkslist.js +4 -0
  723. package/server/modules/reports/rp-phanbochitienchohoadon.js +11 -0
  724. package/server/modules/reports/rp-phanbothutienchohoadon.js +11 -0
  725. package/server/modules/reports/rp-ptbitralai.js +7 -0
  726. package/server/modules/reports/rp-ptcttct.js +24 -0
  727. package/server/modules/reports/rp-ptdonhang.js +8 -0
  728. package/server/modules/reports/rp-pttct.js +52 -0
  729. package/server/modules/reports/rp-pttctkho.js +32 -0
  730. package/server/modules/reports/rp-pttctkho2.js +29 -0
  731. package/server/modules/reports/rp-referredusers.js +5 -0
  732. package/server/modules/reports/rp-sctbhxh.js +4 -0
  733. package/server/modules/reports/rp-sctcnkh.js +11 -0
  734. package/server/modules/reports/rp-sctdiem.js +3 -0
  735. package/server/modules/reports/rp-sctdt.js +7 -0
  736. package/server/modules/reports/rp-sctdtcp.js +11 -0
  737. package/server/modules/reports/rp-sctluong.js +6 -0
  738. package/server/modules/reports/rp-sctthuetncn.js +4 -0
  739. package/server/modules/reports/rp-scttk.js +9 -0
  740. package/server/modules/reports/rp-sctvt.js +5 -0
  741. package/server/modules/reports/rp-sctvt_sl.js +5 -0
  742. package/server/modules/reports/rp-sctvtnpp.js +6 -0
  743. package/server/modules/reports/rp-sctvttt.js +5 -0
  744. package/server/modules/reports/rp-search.js +4 -0
  745. package/server/modules/reports/rp-socai.js +6 -0
  746. package/server/modules/reports/rp-socaitk.js +1 -0
  747. package/server/modules/reports/rp-sochut.js +7 -0
  748. package/server/modules/reports/rp-sokho.js +7 -0
  749. package/server/modules/reports/rp-sokhott.js +5 -0
  750. package/server/modules/reports/rp-sonkbh.js +5 -0
  751. package/server/modules/reports/rp-sonkc.js +6 -0
  752. package/server/modules/reports/rp-sonkct.js +5 -0
  753. package/server/modules/reports/rp-sonkmh.js +5 -0
  754. package/server/modules/reports/rp-sonktt.js +5 -0
  755. package/server/modules/reports/rp-soquy.js +11 -0
  756. package/server/modules/reports/rp-sosanhkhvatt.js +13 -0
  757. package/server/modules/reports/rp-sosanhkhvatt2.js +5 -0
  758. package/server/modules/reports/rp-sotaisan.js +13 -0
  759. package/server/modules/reports/rp-sotiengui.js +7 -0
  760. package/server/modules/reports/rp-taodinhmuctudkhoc.js +5 -0
  761. package/server/modules/reports/rp-thbanhangkempk.js +28 -0
  762. package/server/modules/reports/rp-thdanhgianhanvien.js +9 -0
  763. package/server/modules/reports/rp-thgt.js +6 -0
  764. package/server/modules/reports/rp-thnxt.js +11 -0
  765. package/server/modules/reports/rp-thnxt_sl.js +9 -0
  766. package/server/modules/reports/rp-thnxtnpp.js +10 -0
  767. package/server/modules/reports/rp-thnxttt.js +9 -0
  768. package/server/modules/reports/rp-tkbanhangtheogioithieu.js +9 -0
  769. package/server/modules/reports/rp-tkgioithieukh.js +4 -0
  770. package/server/modules/reports/rp-tkgtgt.js +76 -0
  771. package/server/modules/reports/rp-tkgtgt_old.js +7 -0
  772. package/server/modules/reports/rp-tmbctc.js +20 -0
  773. package/server/modules/reports/rp-tonghopbanhang.js +6 -0
  774. package/server/modules/reports/rp-tonghopmuahang.js +5 -0
  775. package/server/modules/reports/rp-tonghoptralaihang.js +5 -0
  776. package/server/modules/reports/rp-tongquanbanle.js +20 -0
  777. package/server/modules/reports/rp-tongquanbds.js +3 -0
  778. package/server/modules/reports/rp-tongquancongty.js +6 -0
  779. package/server/modules/reports/rp-tongquanctvnpp.js +12 -0
  780. package/server/modules/reports/rp-tongquannvbh.js +14 -0
  781. package/server/modules/reports/rp-tongquannvnpp.js +5 -0
  782. package/server/modules/reports/rp-uoctinhnvl.js +11 -0
  783. package/server/modules/reports/rp-wallet.js +3 -0
  784. package/server/modules/reports/rpt-tkdiemtichluy.js +9 -0
  785. package/server/modules/systems/sys-app.js +34 -0
  786. package/server/modules/systems/sys-colleague.js +11 -0
  787. package/server/modules/systems/sys-data_list_config.js +1 -0
  788. package/server/modules/systems/sys-domain.js +1 -0
  789. package/server/modules/systems/sys-ecomproductlines.js +1 -0
  790. package/server/modules/systems/sys-exportexceltemplate.js +1 -0
  791. package/server/modules/systems/sys-fieldright.js +1 -0
  792. package/server/modules/systems/sys-importexceltemplate.js +1 -0
  793. package/server/modules/systems/sys-labelinfo.js +4 -0
  794. package/server/modules/systems/sys-listinfo.js +10 -0
  795. package/server/modules/systems/sys-menuinfo.js +4 -0
  796. package/server/modules/systems/sys-message.js +14 -0
  797. package/server/modules/systems/sys-moduleinfo.js +4 -0
  798. package/server/modules/systems/sys-notification.js +8 -0
  799. package/server/modules/systems/sys-quanhuyen.js +1 -0
  800. package/server/modules/systems/sys-reportinfo.js +5 -0
  801. package/server/modules/systems/sys-rptobject.js +1 -0
  802. package/server/modules/systems/sys-schedule.js +10 -0
  803. package/server/modules/systems/sys-sysconfig.js +1 -0
  804. package/server/modules/systems/sys-sysgroup.js +1 -0
  805. package/server/modules/systems/sys-tableinfo.js +1 -0
  806. package/server/modules/systems/sys-templatestore.js +5 -0
  807. package/server/modules/systems/sys-tinhthanh.js +1 -0
  808. package/server/modules/systems/sys-token.js +3 -0
  809. package/server/modules/systems/sys-trangthai.js +3 -0
  810. package/server/modules/systems/sys-trialinfo.js +1 -0
  811. package/server/modules/systems/sys-user.js +45 -0
  812. package/server/modules/systems/sys-users.js +10 -0
  813. package/server/modules/systems/sys-versioninfo.js +1 -0
  814. package/server/modules/systems/sys-vietqrbanks.js +1 -0
  815. package/server/modules/systems/sys-xaphuong.js +1 -0
  816. package/server/modules/vouchers/vo-banggiaban.js +8 -0
  817. package/server/modules/vouchers/vo-bc1.js +34 -0
  818. package/server/modules/vouchers/vo-bc5.js +15 -0
  819. package/server/modules/vouchers/vo-bg1.js +10 -0
  820. package/server/modules/vouchers/vo-bg2.js +12 -0
  821. package/server/modules/vouchers/vo-bn1.js +36 -0
  822. package/server/modules/vouchers/vo-bn5.js +15 -0
  823. package/server/modules/vouchers/vo-dh2.js +35 -0
  824. package/server/modules/vouchers/vo-dinhmucsx.js +6 -0
  825. package/server/modules/vouchers/vo-dkb.js +21 -0
  826. package/server/modules/vouchers/vo-dn0.js +9 -0
  827. package/server/modules/vouchers/vo-dnm.js +20 -0
  828. package/server/modules/vouchers/vo-hd1.js +37 -0
  829. package/server/modules/vouchers/vo-hd2.js +108 -0
  830. package/server/modules/vouchers/vo-hd3.js +38 -0
  831. package/server/modules/vouchers/vo-hd4.js +13 -0
  832. package/server/modules/vouchers/vo-hd7.js +29 -0
  833. package/server/modules/vouchers/vo-hd8.js +29 -0
  834. package/server/modules/vouchers/vo-hde.js +39 -0
  835. package/server/modules/vouchers/vo-htl.js +11 -0
  836. package/server/modules/vouchers/vo-kbbtpb.js +6 -0
  837. package/server/modules/vouchers/vo-kehoachmh.js +11 -0
  838. package/server/modules/vouchers/vo-lenhcapphat.js +9 -0
  839. package/server/modules/vouchers/vo-lenhsx.js +12 -0
  840. package/server/modules/vouchers/vo-pbl.js +94 -0
  841. package/server/modules/vouchers/vo-pc0.js +14 -0
  842. package/server/modules/vouchers/vo-pc1.js +31 -0
  843. package/server/modules/vouchers/vo-pc2.js +25 -0
  844. package/server/modules/vouchers/vo-pc3.js +14 -0
  845. package/server/modules/vouchers/vo-pc5.js +15 -0
  846. package/server/modules/vouchers/vo-pc6.js +19 -0
  847. package/server/modules/vouchers/vo-pcl.js +7 -0
  848. package/server/modules/vouchers/vo-pdn.js +11 -0
  849. package/server/modules/vouchers/vo-pdx.js +9 -0
  850. package/server/modules/vouchers/vo-pgh.js +16 -0
  851. package/server/modules/vouchers/vo-pht.js +6 -0
  852. package/server/modules/vouchers/vo-pkc.js +5 -0
  853. package/server/modules/vouchers/vo-pkh.js +9 -0
  854. package/server/modules/vouchers/vo-pkk.js +12 -0
  855. package/server/modules/vouchers/vo-pkt.js +12 -0
  856. package/server/modules/vouchers/vo-pn1.js +30 -0
  857. package/server/modules/vouchers/vo-pn2.js +17 -0
  858. package/server/modules/vouchers/vo-pn3.js +18 -0
  859. package/server/modules/vouchers/vo-pn5.js +18 -0
  860. package/server/modules/vouchers/vo-pn6.js +18 -0
  861. package/server/modules/vouchers/vo-pn9.js +23 -0
  862. package/server/modules/vouchers/vo-pnc.js +19 -0
  863. package/server/modules/vouchers/vo-pnh.js +17 -0
  864. package/server/modules/vouchers/vo-pnk.js +14 -0
  865. package/server/modules/vouchers/vo-pnknpp.js +12 -0
  866. package/server/modules/vouchers/vo-po1.js +14 -0
  867. package/server/modules/vouchers/vo-ppb.js +8 -0
  868. package/server/modules/vouchers/vo-pt1.js +20 -0
  869. package/server/modules/vouchers/vo-pt5.js +15 -0
  870. package/server/modules/vouchers/vo-ptl.js +8 -0
  871. package/server/modules/vouchers/vo-purchase_contract.js +9 -0
  872. package/server/modules/vouchers/vo-pxc.js +24 -0
  873. package/server/modules/vouchers/vo-pxh.js +18 -0
  874. package/server/modules/vouchers/vo-pxk.js +15 -0
  875. package/server/modules/vouchers/vo-pxknpp.js +14 -0
  876. package/server/modules/vouchers/vo-qts.js +12 -0
  877. package/server/modules/vouchers/vo-sale_contract.js +11 -0
  878. package/server/modules/vouchers/vo-shipbook.js +17 -0
  879. package/server/modules/vouchers/vo-so1.js +125 -0
  880. package/server/modules/vouchers/vo-so5.js +57 -0
  881. package/server/modules/vouchers/vo-so7.js +97 -0
  882. package/server/modules/vouchers/vo-so9.js +119 -0
  883. package/server/modules/vouchers/vo-vanchuyen.js +14 -0
  884. package/server/modules/vouchers/vo-xhd.js +33 -0
@@ -0,0 +1,23 @@
1
+ const databanle=require("../../libs/databanlenpp"),dmkho=global.getModel("dmkho"),async=require("async"),controller=require("../../controllers/controllerRPT"),permission=require("../../libs/permission");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheonpp",async function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition$$.id_app};let $ma_kho$$;var $condition_kh_cust_custs_ma_khos$$=await global.getModel("customer").findOne({id_app:$condition$$.id_app,of_user:$req$$.user.email}).lean();
3
+ $condition_kh_cust_custs_ma_khos$$&&$condition_kh_cust_custs_ma_khos$$.ma_kho_npp?$ma_kho$$=$condition_kh_cust_custs_ma_khos$$.ma_kho_npp:$condition$$.ma_kho&&($ma_kho$$=$condition$$.ma_kho);if($req$$.user.current_app_info.appAdmin)$ma_kho$$&&($query$$.$and||($query$$.$and=[]),$query$$.$and.push({$or:[{ma_kho:$ma_kho$$},{"details.ma_kho":$ma_kho$$}]}));else if($condition_kh_cust_custs_ma_khos$$=await new Promise($resolve$$=>{permission.getRightByItem($condition$$.id_app,global.getModel("dmkho"),$req$$.user.email,
4
+ async function($e_khos$$,$_condition$$,$admin$$){if($admin$$)return $resolve$$(null);$_condition$$.id_app=$condition$$.id_app;$ma_kho$$&&($_condition$$.ma_kho=$ma_kho$$);$e_khos$$=await global.getModel("dmkho").find($_condition$$,{ma_kho:1}).lean();$resolve$$($e_khos$$.map($k$$=>$k$$.ma_kho))})}))$query$$.$and||($query$$.$and=[]),$query$$.$and.push({$or:[{ma_kho:{$in:$condition_kh_cust_custs_ma_khos$$}},{"details.ma_kho":{$in:$condition_kh_cust_custs_ma_khos$$}}]});$query$$.ngay_ct={$gte:$condition$$.tu_ngay,
5
+ $lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.user_nv&&($query$$.user_nv=$condition$$.user_nv);$condition$$.user_ctv&&($query$$.user_ctv=$condition$$.user_ctv);$condition$$.user&&($query$$.$or?($query$$.$and||($query$$.$and=[]),$query$$.$and.push({$or:[{user_nv:$condition$$.user},{user_ctv:$condition$$.user}]})):$query$$.$or=[{user_nv:$condition$$.user},{user_ctv:$condition$$.user}]);$condition$$.tinh_thanh&&($query$$.tinh_thanh=$condition$$.tinh_thanh);
6
+ if($condition$$.ma_kh)$query$$.ma_kh=$condition$$.ma_kh;else{$condition_kh_cust_custs_ma_khos$$={};if($condition$$.nh_kh){var $nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition$$.id_app,$condition$$.nh_kh,{status:!0});$condition_kh_cust_custs_ma_khos$$.nh_kh={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$}}$condition$$.nh_kh2&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition$$.id_app,$condition$$.nh_kh2,
7
+ {status:!0}),$condition_kh_cust_custs_ma_khos$$.nh_kh2={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition$$.nh_kh3&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition$$.id_app,$condition$$.nh_kh3,{status:!0}),$condition_kh_cust_custs_ma_khos$$.nh_kh3={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition$$.nh_kh4&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition$$.id_app,$condition$$.nh_kh4,
8
+ {status:!0}),$condition_kh_cust_custs_ma_khos$$.nh_kh4={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition$$.nh_kh5&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition$$.id_app,$condition$$.nh_kh5,{status:!0}),$condition_kh_cust_custs_ma_khos$$.nh_kh5={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});Object.keys($condition_kh_cust_custs_ma_khos$$).length>0&&($condition_kh_cust_custs_ma_khos$$.id_app=$condition$$.id_app,$condition_kh_cust_custs_ma_khos$$=
9
+ await global.getModel("customer").find($condition_kh_cust_custs_ma_khos$$,{ma_kh:1}).lean(),$query$$.ma_kh={$in:$condition_kh_cust_custs_ma_khos$$.map($c$$=>$c$$.ma_kh)})}$condition$$.ma_ct&&($query$$.ma_ct=$condition$$.ma_ct);$condition$$.user_hoa_hong&&($query$$.$or?($query$$.$and||($query$$.$and=[]),$query$$.$and.push({$or:[{user_nv:$condition$$.user_hoa_hong},{user_ctv:$condition$$.user_hoa_hong},{user_ctv2:$condition$$.user_hoa_hong},{user_kho:$condition$$.user_hoa_hong},{user_gt:$condition$$.user_hoa_hong},
10
+ {user_ql:$condition$$.user_hoa_hong},{"details.user_nv":$condition$$.user_hoa_hong},{"details.user_ctv":$condition$$.user_hoa_hong},{"details.user_ctv2":$condition$$.user_hoa_hong},{"details.user_kho":$condition$$.user_hoa_hong},{"details.user_gt":$condition$$.user_hoa_hong},{"details.user_ql":$condition$$.user_hoa_hong}]})):$query$$.$or=[{user_nv:$condition$$.user_hoa_hong},{user_ctv:$condition$$.user_hoa_hong},{user_ctv2:$condition$$.user_hoa_hong},{user_kho:$condition$$.user_hoa_hong},{user_gt:$condition$$.user_hoa_hong},
11
+ {user_ql:$condition$$.user_hoa_hong},{"details.user_nv":$condition$$.user_hoa_hong},{"details.user_ctv":$condition$$.user_hoa_hong},{"details.user_ctv2":$condition$$.user_hoa_hong},{"details.user_kho":$condition$$.user_hoa_hong},{"details.user_gt":$condition$$.user_hoa_hong},{"details.user_ql":$condition$$.user_hoa_hong}]);databanle($query$$,function($error$$,$rs$$,$ptthanhtoans$$){if($error$$)return $callback$$($error$$);const $thanh_toan$$=$ptthanhtoans$$.map($pt$$=>({name:$pt$$.ma,value:$pt$$.ma,
12
+ ma:$pt$$.ma,ten:$pt$$.ten}));async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_sl_xuat=$r$$.details.csum("sl_xuat");$r$$.t_tien_hang=$r$$.details.csum("tien_hang");$r$$.t_tien_hang_ct=$r$$.details.csum("tien_hang_ct");$r$$.t_thue=$r$$.details.csum("tien_thue");$r$$.t_tien_ck=$r$$.details.csum("tien_ck");$r$$.t_tien_cp=$r$$.details.csum("tien_cp");$r$$.t_tien=$r$$.details.csum("tien");$r$$.tien_ck_hd=$r$$.tien_ck_hd||0;$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat");$r$$.t_tien_hoa_hong=$r$$.details.csum("tien_hoa_hong");
13
+ $r$$.t_tien_hoa_hong_gt=$r$$.details.csum("tien_hoa_hong_gt");$r$$.t_tien_hoa_hong_ctv=$r$$.details.csum("tien_hoa_hong_ctv");$r$$.t_tien_hoa_hong_ql=$r$$.details.csum("tien_hoa_hong_ql");$r$$.tien_freeship=$r$$.tien_freeship||0;$r$$.tien_phi_vc=$r$$.tien_phi_vc||0;$r$$.details_tl?($r$$.t_tien_tl=$r$$.details_tl.csum("tien_hang_ct")-$r$$.details_tl.csum("tien_ck"),$r$$.t_tien_thue_tl=$r$$.details_tl.csum("tien_thue"),$r$$.t_tien_nhap=$r$$.details_tl.csum("tien_nhap"),$r$$.t_sl_nhap=$r$$.details_tl.csum("sl_nhap"),
14
+ $r$$.t_tien_hoa_hong-=$r$$.details_tl.csum("tien_hoa_hong"),$r$$.t_tien_hoa_hong_gt-=$r$$.details_tl.csum("tien_hoa_hong_gt"),$r$$.t_tien_hoa_hong_ctv-=$r$$.details_tl.csum("tien_hoa_hong_ctv"),$r$$.t_tien_hoa_hong_ql-=$r$$.details_tl.csum("tien_hoa_hong_ql")):($r$$.t_tien_tl=0,$r$$.t_sl_nhap=0,$r$$.t_tien_nhap=0);$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);let $groupBy$$=$condition$$.group_by||["ma_kho"];typeof $groupBy$$=="string"&&($groupBy$$=[$groupBy$$]);
15
+ $rs$$.groupBy($groupBy$$,[{name:"t_sl_xuat",value:"t_sl_xuat"},{name:"t_tien_hang",value:"t_tien_hang"},{name:"t_tien_hang_ct",value:"t_tien_hang_ct"},{name:"t_thue",value:"t_thue"},{name:"t_tien_cp",value:"t_tien_cp"},{name:"t_tien_ck",value:"t_tien_ck"},{name:"t_tien",value:"t_tien"},{name:"tien_ck_hd",value:"tien_ck_hd"},{name:"tien_freeship",value:"tien_freeship"},{name:"tien_phi_vc",value:"tien_phi_vc"},{name:"tien_evoucher",value:"tien_evoucher"},{name:"tien_thu",value:"tien_thu"},{name:"tien_thu2",
16
+ value:"tien_thu2"},{name:"tien_paymentByPoints",value:"tien_paymentByPoints"},{name:"t_tien_xuat",value:"t_tien_xuat"},{name:"t_sl_nhap",value:"t_sl_nhap"},{name:"t_tien_tl",value:"t_tien_tl"},{name:"t_tien_thue_tl",value:"t_tien_thue_tl"},{name:"t_tien_nhap",value:"t_tien_nhap"},{name:"phai_tra",value:"phai_tra"},{name:"t_tien_hoa_hong",value:"t_tien_hoa_hong"},{name:"t_tien_hoa_hong_gt",value:"t_tien_hoa_hong_gt"},{name:"t_tien_hoa_hong_ctv",value:"t_tien_hoa_hong_ctv"},{name:"t_tien_hoa_hong_ql",
17
+ value:"t_tien_hoa_hong_ql"},...$thanh_toan$$],async function($description_field_error$$,$report$$){if($description_field_error$$)return $callback$$($description_field_error$$);let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=$i$$;$r$$.bold=!1;$r$$.t_phai_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.t_thue||0)+($r$$.tien_phi_vc||0)-($r$$.tien_freeship||0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.tien_phi_vc||0)-($r$$.tien_freeship||
18
+ 0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu_thuan=$r$$.t_doanh_thu-$r$$.t_tien_tl;$r$$.t_lai=$r$$.t_doanh_thu-$r$$.t_tien_xuat-($r$$.t_tien_tl-$r$$.t_tien_nhap);$r$$.t_tien_thu=$thanh_toan$$.map($pt$$=>$r$$[$pt$$.ma]||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$r$$.t_tien_paymentByPoints=$r$$.tien_paymentByPoints||0;$i$$++});await $report$$.filter($r$$=>$r$$.user_nv).asyncJoinModel2(null,global.getModel("user"),[{where:{user_nv:"email"},fields:{name_user_nv:"name"}}]);await $report$$.filter($r$$=>
19
+ $r$$.user_ctv).asyncJoinModel2(null,global.getModel("user"),[{where:{user_ctv:"email"},fields:{name_user_ctv:"name"}}]);await $report$$.filter($r$$=>$r$$.ma_kho).asyncJoinModel2($condition$$.id_app,dmkho,[{where:"ma_kho",fields:["ten_kho"]}]);$description_field_error$$=$groupBy$$[0];switch($description_field_error$$){case "ma_kho":$description_field_error$$="ten_kho";break;case "user_nv":$description_field_error$$="name_user_nv";break;case "user_ctv":$description_field_error$$="name_user_ctv"}const $tong_cong$$=
20
+ {[$description_field_error$$]:"T\u1ed5ng c\u1ed9ng",t_sl_xuat:$report$$.csum("t_sl_xuat"),t_tien_hang:$report$$.csum("t_tien_hang"),t_tien_hang_ct:$report$$.csum("t_tien_hang_ct"),t_thue:$report$$.csum("t_thue"),t_tien_cp:$report$$.csum("t_tien_cp"),t_tien_ck:$report$$.csum("t_tien_ck"),t_tien:$report$$.csum("t_tien"),tien_ck_hd:$report$$.csum("tien_ck_hd"),tien_phi_vc:$report$$.csum("tien_phi_vc"),tien_freeship:$report$$.csum("tien_freeship"),t_tien_xuat:$report$$.csum("t_tien_xuat"),t_phai_thu:$report$$.csum("t_phai_thu"),
21
+ t_doanh_thu:$report$$.csum("t_doanh_thu"),t_sl_nhap:$report$$.csum("t_sl_nhap"),t_tien_nhap:$report$$.csum("t_tien_nhap"),t_tien_tl:$report$$.csum("t_tien_tl"),t_tien_thue_tl:$report$$.csum("t_tien_thue_tl"),t_doanh_thu_thuan:$report$$.csum("t_doanh_thu_thuan"),tien_evoucher:$report$$.csum("tien_evoucher"),tien_thu:$report$$.csum("tien_thu"),tien_thu2:$report$$.csum("tien_thu2"),t_tien_thu:$report$$.csum("t_tien_thu"),phai_tra:$report$$.csum("phai_tra"),t_tien_paymentByPoints:$report$$.csum("tien_paymentByPoints"),
22
+ t_lai:$report$$.csum("t_lai"),t_tien_hoa_hong:$report$$.csum("t_tien_hoa_hong"),t_tien_hoa_hong_gt:$report$$.csum("t_tien_hoa_hong_gt"),t_tien_hoa_hong_ctv:$report$$.csum("t_tien_hoa_hong_ctv"),t_tien_hoa_hong_ql:$report$$.csum("t_tien_hoa_hong_ql"),bold:!0};$thanh_toan$$.forEach($pt$$=>{$pt$$.tong_cong=$tong_cong$$[$pt$$.ma]=$report$$.csum($pt$$.ma)});$report$$.push($tong_cong$$);$report$$.forEach($r$$=>{$r$$.t_tien_phai_tl=$r$$.t_tien_tl+$r$$.t_tien_thue_tl});$callback$$(null,{data:$report$$,thanh_toan:$thanh_toan$$.filter($t$$=>
23
+ $t$$.tong_cong)})})})})})};
@@ -0,0 +1,19 @@
1
+ const databanle=require("../../libs/databanle"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheonv",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.tu_ngay||!$condition_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition_req$$.id_app};$query$$.ngay_ct={$gte:$condition_req$$.tu_ngay,$lte:$condition_req$$.den_ngay};$condition_req$$.ma_dvcs&&($query$$.ma_dvcs=$condition_req$$.ma_dvcs);
3
+ $condition_req$$.ma_nv&&($query$$.ma_nv=$condition_req$$.ma_nv);$condition_req$$.ma_kho&&($query$$.$or=[{ma_kho:$condition_req$$.ma_kho},{"details.ma_kho":$condition_req$$.ma_kho}]);$condition_req$$.user_hoa_hong&&($query$$.$or?$query$$.$and=[{$or:[{user_nv:$condition_req$$.user_hoa_hong},{user_ctv:$condition_req$$.user_hoa_hong},{user_ctv2:$condition_req$$.user_hoa_hong},{user_kho:$condition_req$$.user_hoa_hong},{user_gt:$condition_req$$.user_hoa_hong},{user_ql:$condition_req$$.user_hoa_hong},{"details.user_nv":$condition_req$$.user_hoa_hong},
4
+ {"details.user_ctv":$condition_req$$.user_hoa_hong},{"details.user_ctv2":$condition_req$$.user_hoa_hong},{"details.user_kho":$condition_req$$.user_hoa_hong},{"details.user_gt":$condition_req$$.user_hoa_hong},{"details.user_ql":$condition_req$$.user_hoa_hong}]}]:$query$$.$or=[{user_nv:$condition_req$$.user_hoa_hong},{user_ctv:$condition_req$$.user_hoa_hong},{user_ctv2:$condition_req$$.user_hoa_hong},{user_kho:$condition_req$$.user_hoa_hong},{user_gt:$condition_req$$.user_hoa_hong},{user_ql:$condition_req$$.user_hoa_hong},
5
+ {"details.user_nv":$condition_req$$.user_hoa_hong},{"details.user_ctv":$condition_req$$.user_hoa_hong},{"details.user_ctv2":$condition_req$$.user_hoa_hong},{"details.user_kho":$condition_req$$.user_hoa_hong},{"details.user_gt":$condition_req$$.user_hoa_hong},{"details.user_ql":$condition_req$$.user_hoa_hong}]);if($condition_req$$.ma_kh)$query$$.ma_kh=$condition_req$$.ma_kh;else{var $condition_kh_custs$$={};if($condition_req$$.nh_kh){var $nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition_req$$.id_app,
6
+ $condition_req$$.nh_kh,{status:!0});$condition_kh_custs$$.nh_kh={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$}}$condition_req$$.nh_kh2&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition_req$$.id_app,$condition_req$$.nh_kh2,{status:!0}),$condition_kh_custs$$.nh_kh2={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition_req$$.nh_kh3&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition_req$$.id_app,
7
+ $condition_req$$.nh_kh3,{status:!0}),$condition_kh_custs$$.nh_kh3={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition_req$$.nh_kh4&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition_req$$.id_app,$condition_req$$.nh_kh4,{status:!0}),$condition_kh_custs$$.nh_kh4={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});$condition_req$$.nh_kh5&&($nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$=await global.getModel("group").getAllChildrenGroup($condition_req$$.id_app,
8
+ $condition_req$$.nh_kh5,{status:!0}),$condition_kh_custs$$.nh_kh5={$in:$nh_khs_nh_khs2_nh_khs3_nh_khs4_nh_khs5$$});Object.keys($condition_kh_custs$$).length>0&&($condition_kh_custs$$.id_app=$condition_req$$.id_app,$condition_kh_custs$$=await global.getModel("customer").find($condition_kh_custs$$,{ma_kh:1}).lean(),$query$$.ma_kh={$in:$condition_kh_custs$$.map($c$$=>$c$$.ma_kh)})}$condition_req$$.cashier&&($query$$.cashier=$condition_req$$.cashier);$condition_req$$.ma_ct&&($query$$.ma_ct=$condition_req$$.ma_ct);
9
+ databanle($query$$,function($error$$,$rs$$,$ptthanhtoans$$){if($error$$)return $callback$$($error$$);$rs$$=$rs$$.filter($r$$=>$r$$.ma_nv);const $thanh_toan$$=$ptthanhtoans$$.map($pt$$=>({name:$pt$$.ma,value:$pt$$.ma,ma:$pt$$.ma,ten:$pt$$.ten}));async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_sl_xuat=$r$$.details.csum("sl_xuat");$r$$.t_tien_hang=$r$$.details.csum("tien_hang");$r$$.t_tien_hang_ct=$r$$.details.csum("tien_hang_ct");$r$$.t_thue=$r$$.details.csum("tien_thue");$r$$.t_tien_ck=$r$$.details.csum("tien_ck");
10
+ $r$$.t_tien=$r$$.details.csum("tien");$r$$.t_tien_cp=$r$$.details.csum("tien_cp");$r$$.tien_freeship=$r$$.tien_freeship||0;$r$$.tien_phi_vc=$r$$.tien_phi_vc||0;$r$$.tien_ck_hd=$r$$.tien_ck_hd?$r$$.tien_ck_hd:0;$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat");$r$$.t_tien_hoa_hong=$r$$.details.csum("tien_hoa_hong");$r$$.t_tien_hoa_hong_gt=$r$$.details.csum("tien_hoa_hong_gt");$r$$.t_tien_hoa_hong_ctv=$r$$.details.csum("tien_hoa_hong_ctv");$r$$.t_tien_hoa_hong_ql=$r$$.details.csum("tien_hoa_hong_ql");
11
+ $r$$.details_tl?($r$$.t_tien_tl=$r$$.details_tl.csum("tien_hang_ct")-$r$$.details_tl.csum("tien_ck"),$r$$.t_tien_thue_tl=$r$$.details_tl.csum("tien_thue"),$r$$.t_tien_nhap=$r$$.details_tl.csum("tien_nhap"),$r$$.t_sl_nhap=$r$$.details_tl.csum("sl_nhap"),$r$$.t_tien_hoa_hong-=$r$$.details_tl.csum("tien_hoa_hong"),$r$$.t_tien_hoa_hong_gt-=$r$$.details_tl.csum("tien_hoa_hong_gt"),$r$$.t_tien_hoa_hong_ctv-=$r$$.details_tl.csum("tien_hoa_hong_ctv"),$r$$.t_tien_hoa_hong_ql-=$r$$.details_tl.csum("tien_hoa_hong_ql")):
12
+ ($r$$.t_tien_tl=0,$r$$.t_tien_thue_tl=0,$r$$.t_sl_nhap=0,$r$$.t_tien_nhap=0);$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);$rs$$.groupBy("ma_nv",[{name:"t_sl_xuat",value:"t_sl_xuat"},{name:"t_tien_hang",value:"t_tien_hang"},{name:"t_tien_hang_ct",value:"t_tien_hang_ct"},{name:"t_thue",value:"t_thue"},{name:"t_tien_cp",value:"t_tien_cp"},{name:"t_tien_ck",value:"t_tien_ck"},{name:"t_tien",value:"t_tien"},{name:"tien_ck_hd",value:"tien_ck_hd"},{name:"tien_freeship",
13
+ value:"tien_freeship"},{name:"tien_phi_vc",value:"tien_phi_vc"},{name:"tien_evoucher",value:"tien_evoucher"},{name:"tien_thu",value:"tien_thu"},{name:"tien_thu2",value:"tien_thu2"},{name:"tien_paymentByPoints",value:"tien_paymentByPoints"},{name:"t_tien_xuat",value:"t_tien_xuat"},{name:"t_sl_nhap",value:"t_sl_nhap"},{name:"t_tien_tl",value:"t_tien_tl"},{name:"t_tien_thue_tl",value:"t_tien_thue_tl"},{name:"t_tien_nhap",value:"t_tien_nhap"},{name:"phai_tra",value:"phai_tra"},{name:"t_tien_hoa_hong",
14
+ value:"t_tien_hoa_hong"},{name:"t_tien_hoa_hong_gt",value:"t_tien_hoa_hong_gt"},{name:"t_tien_hoa_hong_ctv",value:"t_tien_hoa_hong_ctv"},{name:"t_tien_hoa_hong_ql",value:"t_tien_hoa_hong_ql"},...$thanh_toan$$],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.ma_nv});let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=$i$$;$r$$.bold=!1;$r$$.t_phai_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.t_thue||0)+($r$$.tien_phi_vc||
15
+ 0)-($r$$.tien_freeship||0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.tien_phi_vc||0)-($r$$.tien_freeship||0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu_thuan=$r$$.t_doanh_thu-$r$$.t_tien_tl;$r$$.t_lai=$r$$.t_doanh_thu-$r$$.t_tien_xuat-($r$$.t_tien_tl-$r$$.t_tien_nhap)-($r$$.t_tien_cp||0);$r$$.t_tien_thu=$thanh_toan$$.map($pt$$=>$r$$[$pt$$.ma]||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$r$$.t_tien_paymentByPoints=$r$$.tien_paymentByPoints||
16
+ 0;$i$$++});$report$$.joinModel2(null,"dmnv",[{where:"ma_nv",fields:["ten_nv"]}],function(){const $tong_cong$$={name:"T\u1ed5ng c\u1ed9ng",t_sl_xuat:$report$$.csum("t_sl_xuat"),t_tien_hang:$report$$.csum("t_tien_hang"),t_tien_hang_ct:$report$$.csum("t_tien_hang_ct"),t_thue:$report$$.csum("t_thue"),t_tien_cp:$report$$.csum("t_tien_cp"),t_tien_ck:$report$$.csum("t_tien_ck"),t_tien:$report$$.csum("t_tien"),tien_ck_hd:$report$$.csum("tien_ck_hd"),tien_phi_vc:$report$$.csum("tien_phi_vc"),tien_freeship:$report$$.csum("tien_freeship"),
17
+ t_tien_xuat:$report$$.csum("t_tien_xuat"),t_phai_thu:$report$$.csum("t_phai_thu"),t_doanh_thu:$report$$.csum("t_doanh_thu"),t_sl_nhap:$report$$.csum("t_sl_nhap"),t_tien_tl:$report$$.csum("t_tien_tl"),t_tien_thue_tl:$report$$.csum("t_tien_thue_tl"),t_tien_nhap:$report$$.csum("t_tien_nhap"),t_doanh_thu_thuan:$report$$.csum("t_doanh_thu_thuan"),tien_evoucher:$report$$.csum("tien_evoucher"),tien_thu:$report$$.csum("tien_thu"),tien_thu2:$report$$.csum("tien_thu2"),t_tien_thu:$report$$.csum("t_tien_thu"),
18
+ phai_tra:$report$$.csum("phai_tra"),t_tien_paymentByPoints:$report$$.csum("tien_paymentByPoints"),t_lai:$report$$.csum("t_lai"),t_tien_hoa_hong:$report$$.csum("t_tien_hoa_hong"),t_tien_hoa_hong_gt:$report$$.csum("t_tien_hoa_hong_gt"),t_tien_hoa_hong_ctv:$report$$.csum("t_tien_hoa_hong_ctv"),t_tien_hoa_hong_ql:$report$$.csum("t_tien_hoa_hong_ql"),bold:!0};$thanh_toan$$.forEach($pt$$=>{$pt$$.tong_cong=$tong_cong$$[$pt$$.ma]=$report$$.csum($pt$$.ma)});$report$$.push($tong_cong$$);$report$$.forEach($r$$=>
19
+ {$r$$.t_tien_phai_tl=$r$$.t_tien_tl+$r$$.t_tien_thue_tl});$callback$$(null,{data:$report$$,thanh_toan:$thanh_toan$$.filter($t$$=>$t$$.tong_cong)})})})})})})};
@@ -0,0 +1,3 @@
1
+ const databanletheongay=require("../../libs/databanletheongay"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheoquy",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.nam)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 n\u0103m (nam)");$condition_req$$.group_by="quy";const $tu_ngay$$=moment(new Date(Number($condition_req$$.nam),5,15)).startOf("year").toDate(),$den_ngay$$=moment(new Date(Number($condition_req$$.nam),5,15)).endOf("year").toDate();$condition_req$$.tu_ngay=
3
+ $tu_ngay$$;$condition_req$$.den_ngay=$den_ngay$$;databanletheongay($condition_req$$,$callback$$)})};
@@ -0,0 +1,9 @@
1
+ const dtbanletheosp=require("../../libs/dtbanletheosp"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheosp",async function($req$$,$callback$$){const $condition$$=$req$$.query;try{let $report$$=await dtbanletheosp($condition$$);await $report$$.asyncJoinModel2($condition$$.id_app,"dmvt",{where:"ma_vt",fields:["ma_nvt","ma_nvt2","ma_nvt3","ma_nvt4"]});await $report$$.filter($r$$=>$r$$.ma_kh).asyncJoinModel2($condition$$.id_app,"customer",{where:{ma_kh:"ma_kh"},fields:["nh_kh"]});let $group_by$$=$req$$.query.group_by;$group_by$$&&(typeof $group_by$$==
3
+ "string"&&($group_by$$=[$group_by$$]),$report$$=await $report$$.asyncGroupBy($group_by$$,"sl_xuat sl_nhap sl_xuat_qd sl_nhap_qd sl_xuat_qd_bc sl_nhap_qd_bc tien_hang_nt tien_hang_ct_nt tien_hang tien_hang_ct tien_cp tien_cp_nt tien_ck_nt tien_ck tien_thue tien_thue_nt tien tien_nt tt tt_nt tien_xuat_tmp tien_xuat tien_nhap loi_nhuan_tmp loi_nhuan tien_hoa_hong tien_hoa_hong_gt tien_hoa_hong_ctv tien_hoa_hong_ql t_hoa_hong".split(" ")));await $report$$.filter($r$$=>$r$$.ma_vt).asyncJoinModel2($condition$$.id_app,
4
+ "dmvt",{where:"ma_vt",fields:["ten_vt","ma_nvt","ma_nvt2","ma_nvt3","ma_nvt4"]});await $report$$.filter($r$$=>$r$$.ma_nvt).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt:"_id"},fields:["ten_nvt"]});await $report$$.filter($r$$=>$r$$.ma_nvt2).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt2:"_id"},fields:[{ten_nvt2:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_nvt3).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt3:"_id"},fields:[{ten_nvt3:"ten_nvt"}]});await $report$$.filter($r$$=>
5
+ $r$$.ma_nvt4).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt4:"_id"},fields:[{ten_nvt4:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_kh).asyncJoinModel2($condition$$.id_app,"customer",{where:{ma_kh:"ma_kh"},fields:["ten_kh","nh_kh"]});await $report$$.filter($r$$=>$r$$.nh_kh).asyncJoinModel2($condition$$.id_app,"group",{where:{nh_kh:"_id"},fields:[{ten_nh_kh:"group_name"}]});await $report$$.filter($r$$=>$r$$.ma_bp).asyncJoinModel2($condition$$.id_app,"dmbp",{where:{ma_bp:"ma_bp"},
6
+ fields:[{ten_bp:"ten_bp"}]});const $tong_cong$$={[$group_by$$?$group_by$$[0]:"ten_vt"]:"T\u1ed5ng c\u1ed9ng",sl_xuat:$report$$.csum("sl_xuat",{sysorder:5}),sl_nhap:$report$$.csum("sl_nhap",{sysorder:5}),sl_xuat_qd:$report$$.csum("sl_xuat_qd",{sysorder:5}),sl_nhap_qd:$report$$.csum("sl_nhap_qd",{sysorder:5}),sl_xuat_qd_bc:$report$$.csum("sl_xuat_qd_bc",{sysorder:5}),sl_nhap_qd_bc:$report$$.csum("sl_nhap_qd_bc",{sysorder:5}),tien_hang_nt:$report$$.csum("tien_hang_nt",{sysorder:5}),tien_hang_ct_nt:$report$$.csum("tien_hang_ct_nt",
7
+ {sysorder:5}),tien_hang:$report$$.csum("tien_hang",{sysorder:5}),tien_hang_ct:$report$$.csum("tien_hang_ct",{sysorder:5}),tien_cp:$report$$.csum("tien_cp",{sysorder:5}),tien_cp_nt:$report$$.csum("tien_cp_nt",{sysorder:5}),tien_ck_nt:$report$$.csum("tien_ck_nt",{sysorder:5}),tien_ck:$report$$.csum("tien_ck",{sysorder:5}),tien_thue:$report$$.csum("tien_thue",{sysorder:5}),tien_thue_nt:$report$$.csum("tien_thue_nt",{sysorder:5}),tien:$report$$.csum("tien",{sysorder:5}),tien_nt:$report$$.csum("tien_nt",
8
+ {sysorder:5}),tt:$report$$.csum("tt",{sysorder:5}),tt_nt:$report$$.csum("tt_nt",{sysorder:5}),tien_xuat_tmp:$report$$.csum("tien_xuat_tmp",{sysorder:5}),tien_xuat:$report$$.csum("tien_xuat",{sysorder:5}),tien_nhap:$report$$.csum("tien_nhap",{sysorder:5}),loi_nhuan_tmp:$report$$.csum("loi_nhuan_tmp",{sysorder:5}),loi_nhuan:$report$$.csum("loi_nhuan",{sysorder:5}),tien_hoa_hong:$report$$.csum("tien_hoa_hong",{sysorder:5}),tien_hoa_hong_gt:$report$$.csum("tien_hoa_hong_gt",{sysorder:5}),tien_hoa_hong_ctv:$report$$.csum("tien_hoa_hong_ctv",
9
+ {sysorder:5}),tien_hoa_hong_ql:$report$$.csum("tien_hoa_hong_ql",{sysorder:5}),t_hoa_hong:$report$$.csum("t_hoa_hong",{sysorder:5}),bold:!0};$report$$.push($tong_cong$$);$callback$$(null,$report$$)}catch($e$$){$callback$$($e$$)}})};
@@ -0,0 +1,6 @@
1
+ const dtbanletheosp=require("../../libs/dtbanletheospnpp"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheospnpp",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;try{let $report$$=await dtbanletheosp($condition_req$$);await $report$$.asyncJoinModel2($condition_req$$.id_app,"dmvt",{where:"ma_vt",fields:["ten_vt","ma_nvt","ma_nvt2","ma_nvt3","ma_nvt4"]});await $report$$.filter($r$$=>$r$$.ma_nvt).asyncJoinModel2($condition_req$$.id_app,"dmnvt",{where:{ma_nvt:"_id"},fields:["ten_nvt"]});await $report$$.filter($r$$=>
3
+ $r$$.ma_nvt2).asyncJoinModel2($condition_req$$.id_app,"dmnvt",{where:{ma_nvt2:"_id"},fields:[{ten_nvt2:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_nvt3).asyncJoinModel2($condition_req$$.id_app,"dmnvt",{where:{ma_nvt3:"_id"},fields:[{ten_nvt3:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_nvt4).asyncJoinModel2($condition_req$$.id_app,"dmnvt",{where:{ma_nvt4:"_id"},fields:[{ten_nvt4:"ten_nvt"}]});const $tong_cong$$={ten_vt:"T\u1ed5ng c\u1ed9ng",sl_xuat:$report$$.csum("sl_xuat"),sl_nhap:$report$$.csum("sl_nhap"),
4
+ sl_xuat_qd:$report$$.csum("sl_xuat_qd"),sl_nhap_qd:$report$$.csum("sl_nhap_qd"),tien_hang_nt:$report$$.csum("tien_hang_nt"),tien_hang_ct_nt:$report$$.csum("tien_hang_ct_nt"),tien_hang:$report$$.csum("tien_hang"),tien_hang_ct:$report$$.csum("tien_hang_ct"),tien_cp:$report$$.csum("tien_cp"),tien_cp_nt:$report$$.csum("tien_cp_nt"),tien_ck_nt:$report$$.csum("tien_ck_nt"),tien_ck:$report$$.csum("tien_ck"),tien_thue:$report$$.csum("tien_thue"),tien_thue_nt:$report$$.csum("tien_thue_nt"),tien:$report$$.csum("tien"),
5
+ tien_nt:$report$$.csum("tien_nt"),tt:$report$$.csum("tt"),tt_nt:$report$$.csum("tt_nt"),tien_xuat_tmp:$report$$.csum("tien_xuat_tmp"),tien_xuat:$report$$.csum("tien_xuat"),tien_nhap:$report$$.csum("tien_nhap"),loi_nhuan_tmp:$report$$.csum("loi_nhuan_tmp"),tien_hoa_hong:$report$$.csum("tien_hoa_hong"),tien_hoa_hong_gt:$report$$.csum("tien_hoa_hong_gt"),tien_hoa_hong_ctv:$report$$.csum("tien_hoa_hong_ctv"),tien_hoa_hong_ql:$report$$.csum("tien_hoa_hong_ql"),t_hoa_hong:$report$$.csum("t_hoa_hong"),bold:!0};
6
+ $report$$.push($tong_cong$$);$callback$$(null,$report$$)}catch($e$$){$callback$$($e$$)}})};
@@ -0,0 +1,3 @@
1
+ const databanletheongay=require("../../libs/databanletheongay"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheothang",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.nam)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 n\u0103m (nam)");$condition_req$$.group_by="thang";const $tu_ngay$$=moment(new Date(Number($condition_req$$.nam),5,15)).startOf("year").toDate(),$den_ngay$$=moment(new Date(Number($condition_req$$.nam),5,15)).endOf("year").toDate();$condition_req$$.tu_ngay=
3
+ $tu_ngay$$;$condition_req$$.den_ngay=$den_ngay$$;databanletheongay($condition_req$$,$callback$$)})};
@@ -0,0 +1,12 @@
1
+ const databanle=require("../../libs/databanle"),User=global.getModel("user"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheothungan",function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.tu_ngay||!$condition_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition_req$$.id_app};$query$$.ngay_ct={$gte:$condition_req$$.tu_ngay,$lte:$condition_req$$.den_ngay};$condition_req$$.ma_dvcs&&($query$$.ma_dvcs=$condition_req$$.ma_dvcs);
3
+ $condition_req$$.user_created&&($query$$.user_created=$condition_req$$.user_created);$condition_req$$.cashier&&($query$$.cashier=$condition_req$$.cashier);$condition_req$$.ma_kho&&($query$$.$or=[{ma_kho:$condition_req$$.ma_kho},{"details.ma_kho":$condition_req$$.ma_kho}]);$condition_req$$.ma_ct&&($query$$.ma_ct=$condition_req$$.ma_ct);databanle($query$$,function($error$$,$rs$$,$ptthanhtoans$$){if($error$$)return $callback$$($error$$);const $thanh_toan$$=$ptthanhtoans$$.map($pt$$=>({name:$pt$$.ma,
4
+ value:$pt$$.ma,ma:$pt$$.ma,ten:$pt$$.ten}));async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.cashier=$r$$.cashier||$r$$.user_created;$r$$.t_sl_xuat=$r$$.details.csum("sl_xuat");$r$$.t_tien_hang=$r$$.details.csum("tien_hang");$r$$.t_tien_hang_ct=$r$$.details.csum("tien_hang_ct");$r$$.t_thue=$r$$.details.csum("tien_thue");$r$$.t_tien_ck=$r$$.details.csum("tien_ck");$r$$.t_tien=$r$$.details.csum("tien");$r$$.t_tien_cp=$r$$.details.csum("tien_cp");$r$$.tien_freeship=$r$$.tien_freeship||0;$r$$.tien_phi_vc=
5
+ $r$$.tien_phi_vc||0;$r$$.tien_ck_hd=$r$$.tien_ck_hd?$r$$.tien_ck_hd:0;$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat");$r$$.details_tl?($r$$.t_tien_tl=$r$$.details_tl.csum("tien_hang_ct")-$r$$.details_tl.csum("tien_ck"),$r$$.t_tien_thue_tl=$r$$.details_tl.csum("tien_thue"),$r$$.t_tien_nhap=$r$$.details_tl.csum("tien_nhap"),$r$$.t_sl_nhap=$r$$.details_tl.csum("sl_nhap")):($r$$.t_tien_tl=0,$r$$.t_sl_nhap=0,$r$$.t_tien_nhap=0);$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);
6
+ $rs$$.groupBy("cashier",[{name:"t_sl_xuat",value:"t_sl_xuat"},{name:"t_tien_hang",value:"t_tien_hang"},{name:"t_tien_hang_ct",value:"t_tien_hang_ct"},{name:"t_thue",value:"t_thue"},{name:"t_tien_cp",value:"t_tien_cp"},{name:"t_tien_ck",value:"t_tien_ck"},{name:"t_tien",value:"t_tien"},{name:"tien_ck_hd",value:"tien_ck_hd"},{name:"tien_freeship",value:"tien_freeship"},{name:"tien_phi_vc",value:"tien_phi_vc"},{name:"tien_evoucher",value:"tien_evoucher"},{name:"tien_thu",value:"tien_thu"},{name:"tien_thu2",
7
+ value:"tien_thu2"},{name:"tien_paymentByPoints",value:"tien_paymentByPoints"},{name:"t_tien_xuat",value:"t_tien_xuat"},{name:"t_sl_nhap",value:"t_sl_nhap"},{name:"t_tien_tl",value:"t_tien_tl"},{name:"t_tien_thue_tl",value:"t_tien_thue_tl"},{name:"t_tien_nhap",value:"t_tien_nhap"},{name:"phai_tra",value:"phai_tra"},...$thanh_toan$$],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.user_created});let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=
8
+ $i$$;$r$$.bold=!1;$r$$.t_phai_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.t_thue||0)+($r$$.tien_phi_vc||0)-($r$$.tien_freeship||0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu=$r$$.t_tien_hang_ct-($r$$.t_tien_ck||0)+($r$$.tien_phi_vc||0)-($r$$.tien_freeship||0)-($r$$.tien_ck_hd||0)-($r$$.tien_evoucher||0);$r$$.t_doanh_thu_thuan=$r$$.t_doanh_thu-$r$$.t_tien_tl;$r$$.t_lai=$r$$.t_doanh_thu-$r$$.t_tien_xuat-($r$$.t_tien_tl-$r$$.t_tien_nhap);$r$$.t_tien_thu=$thanh_toan$$.map($pt$$=>
9
+ $r$$[$pt$$.ma]||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$r$$.t_tien_paymentByPoints=$r$$.tien_paymentByPoints||0;$i$$++});$report$$.joinModel(null,User,[{akey:"cashier",bkey:"email",fields:[{name:"name",value:"name"}]}],function(){const $tong_cong$$={name:"T\u1ed5ng c\u1ed9ng",t_sl_xuat:$report$$.csum("t_sl_xuat"),t_tien_hang:$report$$.csum("t_tien_hang"),t_tien_hang_ct:$report$$.csum("t_tien_hang_ct"),t_thue:$report$$.csum("t_thue"),t_tien_cp:$report$$.csum("t_tien_cp"),t_tien_ck:$report$$.csum("t_tien_ck"),
10
+ t_tien:$report$$.csum("t_tien"),tien_ck_hd:$report$$.csum("tien_ck_hd"),tien_phi_vc:$report$$.csum("tien_phi_vc"),tien_freeship:$report$$.csum("tien_freeship"),t_tien_xuat:$report$$.csum("t_tien_xuat"),t_phai_thu:$report$$.csum("t_phai_thu"),t_doanh_thu:$report$$.csum("t_doanh_thu"),t_sl_nhap:$report$$.csum("t_sl_nhap"),t_tien_tl:$report$$.csum("t_tien_tl"),t_tien_thue_tl:$report$$.csum("t_tien_thue_tl"),t_tien_nhap:$report$$.csum("t_tien_nhap"),t_doanh_thu_thuan:$report$$.csum("t_doanh_thu_thuan"),
11
+ tien_evoucher:$report$$.csum("tien_evoucher"),tien_thu:$report$$.csum("tien_thu"),tien_thu2:$report$$.csum("tien_thu2"),t_tien_thu:$report$$.csum("t_tien_thu"),phai_tra:$report$$.csum("phai_tra"),t_tien_paymentByPoints:$report$$.csum("tien_paymentByPoints"),t_lai:$report$$.csum("t_lai"),bold:!0};$thanh_toan$$.forEach($pt$$=>{$pt$$.tong_cong=$tong_cong$$[$pt$$.ma]=$report$$.csum($pt$$.ma)});$report$$.push($tong_cong$$);$report$$.forEach($r$$=>{$r$$.t_tien_phai_tl=$r$$.t_tien_tl+$r$$.t_tien_thue_tl});
12
+ $callback$$(null,{data:$report$$,thanh_toan:$thanh_toan$$.filter($t$$=>$t$$.tong_cong)})})})})})})};
@@ -0,0 +1,2 @@
1
+ const dtbanletheosp=require("../../libs/dtbanletheosp"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheovt",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.tu_ngay||!$condition_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");try{let $report$$=await dtbanletheosp($condition_req$$);await $report$$.asyncJoinModel2($condition_req$$.id_app,"dmvt",{where:"ma_vt",fields:"ten_vt"});$callback$$(null,$report$$)}catch($e$$){$callback$$($e$$)}})};
@@ -0,0 +1,2 @@
1
+ const dtbanletheosp=require("../../libs/dtbanletheospnpp"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dtbanletheovtnpp",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.tu_ngay||!$condition_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");try{let $report$$=await dtbanletheosp($condition_req$$);await $report$$.asyncJoinModel2($condition_req$$.id_app,"dmvt",{where:"ma_vt",fields:"ten_vt"});$callback$$(null,$report$$)}catch($e$$){$callback$$($e$$)}})};
@@ -0,0 +1,4 @@
1
+ var Customer=global.getModel("customer"),purchase_contract=global.getModel("purchase_contract"),sale_contract=global.getModel("sale_contract"),shipbook=global.getModel("shipbook"),dmdt=global.getModel("dmdt");const async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"dutoanthuchitheodt",function($req$$,$callback$$){if(!$req$$.query.tu_ngay||!$req$$.query.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 tu_ngay, den_ngay");var $id_app$$=$req$$.query.id_app,$query$$={};$query$$.id_app=$id_app$$;$query$$.ngay_ct={$gte:$req$$.query.tu_ngay,$lte:$req$$.query.den_ngay};$req$$.query.ma_dt&&($query$$.ma_dt=$req$$.query.ma_dt);$req$$.query.ma_kh&&($query$$.ma_kh=$req$$.query.ma_kh);
3
+ purchase_contract.find($query$$).lean().exec(($e$$,$purchase$$)=>{if($e$$)return $callback$$($e$$);async.series({sale:$callback$$=>{$purchase$$.joinModel2($id_app$$,sale_contract,{where:{ma_dt:"ma_dt"},fields:{dot_thanh_toan_sale:"dot_thanh_toan",ma_kh_sale:"ma_kh",ty_gia_sale:"ty_gia",ma_nt_sale:"ma_nt"}},()=>{$callback$$()})},dt:$callback$$=>{$purchase$$.joinModel2($id_app$$,dmdt,{where:{ma_dt:"ma_dt"},fields:["ten_dt"]},()=>{$callback$$()})},shipbook:$callback$$=>{$purchase$$.joinModel2($id_app$$,
4
+ shipbook,{where:{ma_dt:"ma_dt"},fields:["ngay_tau_di","ngay_tau_den"]},()=>{$callback$$()})}},$e$$=>{if($e$$)return $callback$$($e$$);$purchase$$.joinModel2($id_app$$,Customer,[{where:{ma_kh_sale:"ma_kh"},fields:{ten_kh_sale:"ten_kh"}},{where:{ma_kh:"ma_kh"},fields:{ten_kh:"ten_kh"}}],()=>{$callback$$(null,$purchase$$)})})})})};
@@ -0,0 +1,8 @@
1
+ const pxc=global.getModel("pxc"),dmvt=global.getModel("dmvt"),dvcs=global.getModel("dvcs"),dmkho=global.getModel("dmkho"),account=global.getModel("account"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getpxc4pnc",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.id_app||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:id_app,ma_kh,tu_ngay,den_ngay");async.series({pxc:$callback$$=>{let $query$$={};$query$$.$or=[{id_pn:null},{id_pn:$condition$$.id_ct}];$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,
3
+ $lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);$condition$$.ma_kho_n&&($query$$.ma_kho_n=$condition$$.ma_kho_n);$condition$$.ma_kho_x&&($query$$.ma_kho_x=$condition$$.ma_kho_x);pxc.find($query$$).lean().exec(($error$$,$rs$$)=>{if($error$$)return Logger.info($error$$),$callback$$($error$$);$rs$$.forEach($r$$=>{$r$$.id_px=$r$$._id.toString();$r$$.ma_ct="PNC"});$callback$$(null,$rs$$)})}},function($error$$,
4
+ $results$$){if($error$$)return $callback$$($error$$);let $items$$=$results$$.pxc,$id_app$$=$condition$$.id_app;async.parallel({dv:function($callback$$){$items$$.joinModel($id_app$$,dvcs,[{akey:"ma_dvcs",bkey:"_id",fields:[{name:"ten_dvcs",value:"ten_dvcs"}]}],function(){$callback$$()})},t_tien:function($callback$$){$items$$.forEach(function($r$$){$r$$.details&&($r$$.t_sl=$r$$.details.csum("sl_xuat"),$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat"),$r$$.t_tien_xuat_nt=$r$$.details.csum("tien_xuat_nt"))});
5
+ $callback$$()},ma_kho_x:$callback$$=>{$items$$.joinModel2($id_app$$,dmkho,[{where:{ma_kho_x:"ma_kho"},fields:[{name:"ten_kho_x",value:"ten_kho"},{name:"kho_dc_x",value:"kho_dc"}]}],function(){$callback$$()})},ma_kho_n:$callback$$=>{$items$$.joinModel2($id_app$$,dmkho,[{where:{ma_kho_n:"ma_kho"},fields:[{name:"ten_kho_n",value:"ten_kho"},{name:"kho_dc_n",value:"kho_dc"}]}],function(){$callback$$()})},details_tk:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel($id_app$$,
6
+ account,[{akey:"tk_vt",bkey:"tk",fields:[{name:"ten_tk_vt",value:"ten_tk"}]},{akey:"tk_du",bkey:"tk",fields:[{name:"ten_tk_du",value:"ten_tk"}]}],function(){$callback1$$()})},function(){$callback$$()})},details_vt:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel($id_app$$,dmvt,[{akey:"ma_vt",bkey:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"}]}],function(){$callback1$$()})},function(){$callback$$()})},details_kho_n:function($callback$$){async.mapLimit($items$$,
7
+ 20,function($r$$,$callback1$$){$r$$.details.joinModel($id_app$$,dmkho,[{akey:"ma_kho_n",bkey:"ma_kho",fields:[{name:"ten_kho_n",value:"ten_kho"},{name:"kho_dc_n",value:"kho_dc"}]}],function(){$callback1$$()})},function(){$callback$$()})},details_kho_x:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel($id_app$$,dmkho,[{akey:"ma_kho_x",bkey:"ma_kho",fields:[{name:"ten_kho_x",value:"ten_kho"},{name:"kho_dc_x",value:"kho_dc"}]}],function(){$callback1$$()})},
8
+ function(){$callback$$()})}},function(){$callback$$(null,$items$$)})})},{cache:!1})};
@@ -0,0 +1,4 @@
1
+ var pstk=require("../../libs/pstk");const controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getariseofaccountsbymonth",function($ds_tk_req$$,$callback$$){var $condition_query$$=$ds_tk_req$$.query;if(!$condition_query$$.nam|!$condition_query$$.thang||!$condition_query$$.id_app||!$condition_query$$.tks)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:id_app,nam,thang,tks");$ds_tk_req$$=$condition_query$$.tks.split(",");var $nam_ngay_cuoi_thang$$=$condition_query$$.nam,$thang$$=Number($condition_query$$.thang),
3
+ $ngay_dau_thang$$=new Date($nam_ngay_cuoi_thang$$,$thang$$,1);$nam_ngay_cuoi_thang$$=new Date($nam_ngay_cuoi_thang$$,$thang$$+1,0);$condition_query$$={id_app:$condition_query$$.id_app};var $qtks$$=[];$ds_tk_req$$.forEach(function($tk$$){$qtks$$.push({tk:{$regex:"^"+$tk$$,$options:"i"}})});$qtks$$.length>0&&($condition_query$$.$or=$qtks$$);$condition_query$$.ngay_ct={$gte:$ngay_dau_thang$$,$lte:$nam_ngay_cuoi_thang$$};pstk($condition_query$$,function($error$$,$results$$){if($error$$)return $callback$$($error$$);
4
+ $callback$$(null,$results$$)})})};
@@ -0,0 +1,6 @@
1
+ const socai=global.getModel("socai"),kbbtpb=global.getModel("kbbtpb"),cktk=require("../../libs/cktk"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"getbtpb",function($query_kb_req$$,$callback$$){const $condition$$=$query_kb_req$$.query;$query_kb_req$$={id_app:$condition$$.id_app,status:!0,$and:[{$or:[{hieu_luc_tu:{$exists:!1}},{hieu_luc_tu:{$lte:moment($condition$$.ngay_ct).startOf("date").toDate()}}]},{$or:[{hieu_luc_den:{$exists:!1}},{hieu_luc_den:{$gte:moment($condition$$.ngay_ct).endOf("date").toDate()}}]}]};kbbtpb.find($query_kb_req$$).sort({stt:1}).lean().then(function($kcs$$){async.mapSeries($kcs$$,
3
+ function($k$$,$callback$$){var $q_tk$$=$k$$.tk_co;$k$$.tien=0;$k$$.tien_da_phan_bo=0;$k$$.so_ky_phan_bo||($k$$.so_ky_phan_bo=1);$k$$.tien_can_phan_bo?($k$$.tien=Math.roundBy($k$$.tien_can_phan_bo/$k$$.so_ky_phan_bo,0),$q_tk$$={id_kbbtpb:$k$$._id.toString(),id_app:$condition$$.id_app},$condition$$.id_ct&&($q_tk$$.id_ct={$ne:$condition$$.id_ct}),socai.find($q_tk$$).lean().exec(function($e$$,$rs$$){$rs$$&&($k$$.tien_da_phan_bo=$rs$$.csum("tien"));$k$$.tien_da_phan_bo+$k$$.tien>$k$$.tien_can_phan_bo&&
4
+ ($k$$.tien=$k$$.tien_can_phan_bo-$k$$.tien_da_phan_bo);$callback$$(null)})):($k$$.tien_can_phan_bo=0,$k$$.so_ky_phan_bo=1,cktk({tk:$q_tk$$,ngay:new Date($condition$$.ngay_ct),id_app:$condition$$.id_app,ex_id_ct:$condition$$.id_ct},function($e$$,$rs$$){$rs$$&&$rs$$.forEach(function($r$$){$k$$.tien_can_phan_bo+=$r$$.du_no00});$k$$.tien=Math.roundBy($k$$.tien_can_phan_bo/$k$$.so_ky_phan_bo,0);$callback$$(null)}))},function($e$$){$kcs$$=underscore.filter($kcs$$,function($k$$){return $k$$.tien>0});$kcs$$.forEach($k$$=>
5
+ {$k$$.details.forEach(function($detail$$){$detail$$.he_so||($detail$$.he_so=1)});const $total_he_so$$=$k$$.details.map($d$$=>$d$$.he_so||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$k$$.details.forEach(function($detail$$){$detail$$.id_kbbtpb=$k$$._id.toString();delete $detail$$._id;$detail$$.tk_co=$k$$.tk_co;$detail$$.dien_giai=$k$$.dien_giai;$detail$$.tien=$detail$$.tien_nt=Math.roundBy($detail$$.he_so/$total_he_so$$*$k$$.tien)});delete $k$$._id});return $callback$$($e$$,$kcs$$.map($k$$=>$k$$.details).reduce(($a$$,
6
+ $b$$)=>$a$$.concat($b$$),[]).filter($d$$=>$d$$.tien))})}).catch($error$$=>{$callback$$($error$$)})},{cache:!1})};
@@ -0,0 +1,7 @@
1
+ const databanle=require("../../libs/databanle"),giaoca=global.getModel("giaoca"),ptthanhtoan=global.getModel("ptthanhtoan"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getcashbycashier",function($req$$,$callback$$){let $condition$$=$req$$.query;$condition$$.thoi_gian_tu&&($condition$$.tu_ngay=new Date($condition$$.thoi_gian_tu));$condition$$.thoi_gian_den&&($condition$$.den_ngay=new Date($condition$$.thoi_gian_den));if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");let $id_app$$=$req$$.user.current_id_app,
3
+ $query$$={id_app:$id_app$$};$query$$.payment_time={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$query$$.ma_kho=$condition$$.ma_kho;$condition$$.ma_ca&&($query$$.ma_ca=$condition$$.ma_ca);$query$$.cashier=$req$$.user.email;databanle($query$$,function($error$$,$details$$){if($error$$)return $callback$$($error$$);async.mapLimit($details$$,20,($r$$,$callback$$)=>{(async()=>{var $_pttt__pttt2$$=await ptthanhtoan.findOne({id_app:$id_app$$,_id:$r$$.pt_thanh_toan});let $t_tien_thu$$=0;$_pttt__pttt2$$&&
4
+ $_pttt__pttt2$$.loai_tien!=="TIEN"||($t_tien_thu$$=$r$$.tien_thu||0);$r$$.pt_thanh_toan2&&$r$$.tien_thu2&&(($_pttt__pttt2$$=await ptthanhtoan.findOne({id_app:$id_app$$,_id:$r$$.pt_thanh_toan2}))&&$_pttt__pttt2$$.loai_tien!=="TIEN"||($t_tien_thu$$+=$r$$.tien_thu2));$r$$.t_sl_xuat=$r$$.details.csum("sl_xuat");$r$$.t_tien=$r$$.details.csum("tien_hang");$r$$.t_tien_ck=$r$$.details.csum("tien_ck");$r$$.tien_ck_hd=$r$$.tien_ck_hd||0;$r$$.tien_evoucher=$r$$.tien_evoucher||0;$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat");
5
+ $r$$.t_tien_hang=$r$$.t_tien-$r$$.t_tien_ck-$r$$.tien_ck_hd-$r$$.tien_evoucher;$r$$.t_tien_thu=$t_tien_thu$$;$callback$$(null,$r$$)})()},function($error$$,$details$$){if($error$$)return $callback$$($error$$);let $tien_hang$$=$details$$.csum("t_tien_hang"),$tien_thu$$=$details$$.csum("t_tien_thu"),$phai_tra$$=$details$$.csum("phai_tra"),$tien_thu_net$$=$tien_thu$$-$phai_tra$$;$query$$={id_app:$id_app$$};$query$$.tu_ngay=$condition$$.tu_ngay;$query$$.den_ngay=$condition$$.den_ngay;$query$$.ma_kho=$condition$$.ma_kho;
6
+ $condition$$.ma_ca&&($query$$.ma_ca=$condition$$.ma_ca);$query$$.nhan_vien=$req$$.user.email;giaoca.find($query$$).lean().exec(async($da_giao_e$$,$query_nhan_rs_tien_ket$$)=>{if($da_giao_e$$)return $callback$$($da_giao_e$$);$da_giao_e$$=$query_nhan_rs_tien_ket$$.csum("tien_giao");$query_nhan_rs_tien_ket$$={id_app:$id_app$$};$query_nhan_rs_tien_ket$$.ma_kho=$condition$$.ma_kho;$query_nhan_rs_tien_ket$$.nhan_vien_nhan=$req$$.user.email;$query_nhan_rs_tien_ket$$.tu_ngay=$condition$$.tu_ngay;$query_nhan_rs_tien_ket$$.den_ngay=
7
+ $condition$$.den_ngay;$condition$$.ma_ca&&($query_nhan_rs_tien_ket$$.ma_ca=$condition$$.ma_ca);$query_nhan_rs_tien_ket$$=(await giaoca.find({query_nhan:$query_nhan_rs_tien_ket$$}).lean()).map($r$$=>$r$$.tien_giao||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$callback$$(null,{tien_ket:$query_nhan_rs_tien_ket$$,tien_hang:$tien_hang$$,tien_thu:$tien_thu$$,phai_tra:$phai_tra$$,tien_thu_net:$tien_thu_net$$,da_giao:$da_giao_e$$,details:$details$$})})})})},{cache:!1})};
@@ -0,0 +1,5 @@
1
+ const dmchietkhau=global.getModel("dmchietkhau"),controller=require("../../controllers/controllerRPT"),moment=require("moment"),dmvt=global.getModel("dmvt");
2
+ module.exports=function($router$$){new controller($router$$,"getcschietkhau",function($query_req$$,$callback$$){const $condition$$=$query_req$$.query;if(!$condition$$.ma_vt)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: ma_vt");$condition$$.id_app=$query_req$$.user.current_id_app;$query_req$$={ma_vt:$condition$$.ma_vt,id_app:$condition$$.id_app,status:!0};$condition$$.nh_kh&&($query_req$$.nh_kh={$or:[{$eq:null},{$eq:$condition$$.nh_kh}]});$condition$$.ma_kh&&($query_req$$.ma_kh=
3
+ {$or:[{$eq:null},{$eq:$condition$$.ma_kh}]});$condition$$.ma_kho&&($query_req$$.ma_kho={$or:[{$eq:null},{$eq:$condition$$.ma_kho}]});if($condition$$.ngay_ct)try{$condition$$.ngay_ct=new Date($condition$$.ngay_ct)}catch($e$$){return $callback$$($e$$.message)}else $condition$$.ngay_ct=new Date;let $hieu_luc_tu$$;var $hieu_luc_den_tu_ngay$$=moment($condition$$.ngay_ct).startOf("date").toDate();$hieu_luc_tu$$={$lte:moment($condition$$.ngay_ct).endOf("date").toDate()};$hieu_luc_den_tu_ngay$$={$gte:$hieu_luc_den_tu_ngay$$};
4
+ $query_req$$.hieu_luc_tu=$hieu_luc_tu$$;$query_req$$.hieu_luc_den=$hieu_luc_den_tu_ngay$$;let $query_ck$$=Object.assign({},$query_req$$);dmvt.findOne({ma_vt:$condition$$.ma_vt,id_app:$condition$$.id_app}).lean().exec(($e$$,$vt$$)=>{if($e$$||!$vt$$)return $callback$$($e$$||$condition$$.ma_vt+" is not exists");dmchietkhau.find($query_ck$$).populate("dmvt").exec(($_q_e$$,$rs$$)=>{if($_q_e$$)return $callback$$($_q_e$$);if($rs$$.length>0)return $callback$$(null,$rs$$.map($r$$=>$r$$.toJSON()));$_q_e$$=
5
+ Object.assign({},$query_ck$$);$_q_e$$.ma_vt={$in:["",null,void 0]};$_q_e$$.ma_nvt={$in:["",null,void 0,$vt$$.ma_nvt]};dmchietkhau.find($_q_e$$).populate("dmvt").exec(($e$$,$chietkhau$$)=>{if($e$$)return $callback$$($e$$);$callback$$(null,$chietkhau$$.map($c$$=>$c$$.toJSON()))})})})},{cache:!1})};
@@ -0,0 +1,7 @@
1
+ const lenhsx=global.getModel("lenhsx"),dinhmucsx=global.getModel("dinhmucsx"),dmvt=global.getModel("dmvt"),dmdvt=global.getModel("dmdvt"),dmdt=global.getModel("dmdt"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"getdinhmuc4lenhcp",async($req$$,$callback$$)=>{try{const $condition$$=$req$$.query;if(!$condition$$.id_lenhsx||!global.mongoose.Types.ObjectId.isValid($condition$$.id_lenhsx))return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:id_lenhsx");let $lsx$$=await lenhsx.findOne({id_app:$condition$$.id_app,_id:$condition$$.id_lenhsx}).lean();if(!$lsx$$)return $callback$$("L\u1ec7nh s\u1ea3n xu\u1ea5t n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i");
3
+ let $sx$$=await $lsx$$.details.asyncGroupBy("ma_sp ma_dvt_sp ma_tt1_sp ma_tt2_sp ma_tt3_sp id_dinhmucsx".split(" "),["sl_sx"]),$vts$$=await Promise.all($sx$$.map($sp$$=>(async()=>{let $query_dinhmuc$$={id_app:$condition$$.id_app,ma_sp:$sp$$.ma_sp};if($sp$$.id_dinhmucsx){if(!global.mongoose.Types.ObjectId.isValid($sp$$.id_dinhmucsx))return[];$query_dinhmuc$$._id=$sp$$.id_dinhmucsx}else $query_dinhmuc$$.hieu_luc_tu_ngay={$lte:moment($lsx$$.ngay_ct).startOf("date").toDate()},$query_dinhmuc$$.hieu_luc_den_ngay=
4
+ {$gte:moment($lsx$$.ngay_ct).endOf("date").toDate()};let $dinhmuc$$=await dinhmucsx.findOne($query_dinhmuc$$).lean();return $dinhmuc$$?$dinhmuc$$.details.map($detail$$=>{delete $detail$$._id;$detail$$.sl_dinh_muc/=$dinhmuc$$.so_luong||1;$detail$$.so_luong=$sp$$.sl_sx*$detail$$.sl_dinh_muc*(1+($detail$$.ty_le_hao_hut||0)/100);$detail$$.gia_von=$detail$$.gia_von_nt=0;$detail$$.tien_xuat=$detail$$.tien_xuat_nt=0;$detail$$.ma_sp=$sp$$.ma_sp;$detail$$.ma_dvt_sp=$sp$$.ma_dvt_sp;$detail$$.ma_tt1_sp=$sp$$.ma_tt1_sp;
5
+ $detail$$.ma_tt2_sp=$sp$$.ma_tt2_sp;$detail$$.ma_tt3_sp=$sp$$.ma_tt3_sp;$detail$$.id_dinhmucsx=$dinhmuc$$._id.toString();return $detail$$}):[]})()));$vts$$=$vts$$.reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$vts$$=await $vts$$.asyncGroupBy("ma_vt ma_dvt ma_dt ma_kh ma_sp ma_dvt_sp ma_tt1_sp ma_tt2_sp ma_tt3_sp id_dinhmucsx ma_bp".split(" "),["so_luong","tien_xuat","tien_xuat_nt"]);await $vts$$.asyncJoinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:["ten_vt","tk_vt",{tk_du:"tk_gv"}]});await $vts$$.asyncJoinModel2($condition$$.id_app,
6
+ dmvt,{where:{ma_sp:"ma_vt"},fields:{ten_sp:"ten_vt"}});await $vts$$.filter($r$$=>$r$$.ma_dvt).asyncJoinModel2($condition$$.id_app,dmdvt,{where:"ma_dvt",fields:"ten_dvt"});await $vts$$.filter($r$$=>$r$$.ma_dt).asyncJoinModel2($condition$$.id_app,dmdt,{where:"ma_dt",fields:"ten_dt"});await $vts$$.filter($r$$=>$r$$.ma_bp).asyncJoinModel2($condition$$.id_app,global.getModel("dmbp"),{where:"ma_bp",fields:"ten_bp"});$callback$$(null,$vts$$)}catch($e$$){Logger.error("[getdinhmuc4lenhcp]",$e$$),$callback$$({error:$e$$.message||
7
+ $e$$.error||$e$$})}})};
@@ -0,0 +1,9 @@
1
+ const sokho=global.getModel("sokho"),sokhokhongton=global.getModel("sokhokhongton"),dinhmucsx=global.getModel("dinhmucsx"),dmvt=global.getModel("dmvt"),dmdvt=global.getModel("dmdvt"),dmdt=global.getModel("dmdt"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"getdinhmuc4pxk",async($req_sokho_phat_sinh_vts$$,$callback$$)=>{const $condition$$=$req_sokho_phat_sinh_vts$$.query;if(!$condition$$.ma_ct||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:ma_ct,tu_ngay,den_ngay");var $query_sokho_phat_sinh_khong_ton$$={id_app:$condition$$.id_app,ngay_ct:{$gte:moment($condition$$.tu_ngay).startOf("date").toDate(),$lte:moment($condition$$.den_ngay).endOf("date").toDate()},
3
+ ma_ct:{$in:$condition$$.ma_ct.toUpperCase().split(",")}};$condition$$.ma_vt&&($query_sokho_phat_sinh_khong_ton$$.ma_vt=$condition$$.ma_vt);$condition$$.ma_dt&&($query_sokho_phat_sinh_khong_ton$$.ma_dt=$condition$$.ma_dt);$condition$$.ma_hd&&($query_sokho_phat_sinh_khong_ton$$.ma_hd=$condition$$.ma_hd);$condition$$.ma_kh&&($query_sokho_phat_sinh_khong_ton$$.ma_kh=$condition$$.ma_kh);$condition$$.ma_kho&&($query_sokho_phat_sinh_khong_ton$$.ma_kho=$condition$$.ma_kho);$req_sokho_phat_sinh_vts$$=await sokho.find($query_sokho_phat_sinh_khong_ton$$).lean();
4
+ $query_sokho_phat_sinh_khong_ton$$=await sokhokhongton.find($query_sokho_phat_sinh_khong_ton$$).lean();$req_sokho_phat_sinh_vts$$=$req_sokho_phat_sinh_vts$$.concat($query_sokho_phat_sinh_khong_ton$$);$req_sokho_phat_sinh_vts$$=await $req_sokho_phat_sinh_vts$$.asyncGroupBy(["ma_vt","ngay_ct"],["sl_xuat","sl_nhap"]);$req_sokho_phat_sinh_vts$$=await Promise.all($req_sokho_phat_sinh_vts$$.map($sp$$=>(async()=>{var $detail_xk_query_dinhmuc$$={id_app:$condition$$.id_app,ma_sp:$sp$$.ma_vt};let $ngay_ct$$=
5
+ $sp$$.ngay_ct;$detail_xk_query_dinhmuc$$.hieu_luc_tu_ngay={$lte:moment($ngay_ct$$).startOf("date").toDate()};$detail_xk_query_dinhmuc$$.hieu_luc_den_ngay={$gte:moment($ngay_ct$$).endOf("date").toDate()};let $dinhmuc$$=await dinhmucsx.findOne($detail_xk_query_dinhmuc$$).sort({hieu_luc_tu_ngay:-1}).lean();if(!$dinhmuc$$)return[];$detail_xk_query_dinhmuc$$=$dinhmuc$$.details.map($detail$$=>{delete $detail$$._id;$detail$$.sl_dinh_muc=$detail$$.sl_dinh_muc*(1+($detail$$.ty_le_hao_hut||0)/100)/($dinhmuc$$.so_luong||
6
+ 1);$detail$$.sl_xuat=$detail$$.sl_dinh_muc*($sp$$.sl_xuat||$sp$$.sl_nhap);$detail$$.gia_von=$detail$$.gia_von_nt=0;$detail$$.tien_xuat=$detail$$.tien_xuat_nt=0;$detail$$.ma_sp=$dinhmuc$$.ma_sp;$detail$$.id_dinhmucsx=$dinhmuc$$._id.toString();return $detail$$});const $da_xk$$=await sokho.find({id_app:$condition$$.id_app,ma_ct:"PXK",ngay_ct:{$gte:moment($condition$$.tu_ngay).startOf("date").toDate(),$lte:moment($condition$$.den_ngay).endOf("date").toDate()},ma_sp:$dinhmuc$$.ma_sp,id_dinhmucsx:$dinhmuc$$._id.toString()}).lean();
7
+ $detail_xk_query_dinhmuc$$.forEach($detail$$=>{const $sl_da_xuat_nvt$$=$da_xk$$.filter($d$$=>$d$$.ma_vt===$detail$$.ma_vt).map($d$$=>$d$$.sl_xuat).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$detail$$.sl_xuat=Math.max(0,$detail$$.sl_xuat-$sl_da_xuat_nvt$$)});return $detail_xk_query_dinhmuc$$})()));$req_sokho_phat_sinh_vts$$=$req_sokho_phat_sinh_vts$$.reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$req_sokho_phat_sinh_vts$$=await $req_sokho_phat_sinh_vts$$.asyncGroupBy("ma_vt ma_dvt ma_dt ma_kh ma_sp id_dinhmucsx ma_bp".split(" "),
8
+ ["sl_xuat","tien_xuat","tien_xuat_nt"]);await $req_sokho_phat_sinh_vts$$.asyncJoinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:["ten_vt","tk_vt",{tk_du:"tk_gv"}]});await $req_sokho_phat_sinh_vts$$.filter($r$$=>$r$$.ma_sp).asyncJoinModel2($condition$$.id_app,dmvt,{where:{ma_sp:"ma_vt"},fields:{ten_sp:"ten_vt"}});await $req_sokho_phat_sinh_vts$$.filter($r$$=>$r$$.ma_dvt).asyncJoinModel2($condition$$.id_app,dmdvt,{where:"ma_dvt",fields:"ten_dvt"});await $req_sokho_phat_sinh_vts$$.filter($r$$=>
9
+ $r$$.ma_dt).asyncJoinModel2($condition$$.id_app,dmdt,{where:"ma_dt",fields:"ten_dt"});await $req_sokho_phat_sinh_vts$$.filter($r$$=>$r$$.ma_bp).asyncJoinModel2($condition$$.id_app,global.getModel("dmbp"),{where:"ma_bp",fields:"ten_bp"});$callback$$(null,$req_sokho_phat_sinh_vts$$)})};
@@ -0,0 +1,8 @@
1
+ const dmtk=global.getModel("account"),dmkh=global.getModel("customer"),socaitmp=global.getModel("socaitmp"),socai=global.getModel("socai"),ptthanhtoan=global.getModel("ptthanhtoan"),moment=require("moment"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getdk4pht",async function($query_req_tu_ngay$$,$callback$$){const $condition$$=$query_req_tu_ngay$$.query;$condition$$.thang&&$condition$$.nam&&($condition$$.tu_ngay=moment([$condition$$.nam,Number($condition$$.thang),1]).startOf("month").toDate(),$condition$$.den_ngay=moment($condition$$.tu_ngay).toDate());if(!$condition$$.tu_ngay||!$condition$$.den_ngay||!$condition$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: tu_ngay,den_ngay,id_app");
3
+ $query_req_tu_ngay$$=moment($condition$$.tu_ngay).startOf("date").toDate();var $da_lay_den_ngay_query_da_post$$=moment($condition$$.den_ngay).endOf("date").toDate();$query_req_tu_ngay$$={id_app:$condition$$.id_app,ngay_ct:{$gte:$query_req_tu_ngay$$,$lte:$da_lay_den_ngay_query_da_post$$}};$condition$$.ma_ct&&($query_req_tu_ngay$$.ma_ct=$condition$$.ma_ct);$condition$$.ma_dvcs&&($query_req_tu_ngay$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.ma_kho&&($query_req_tu_ngay$$.ma_kho=$condition$$.ma_kho);
4
+ $condition$$.ma_bp&&($query_req_tu_ngay$$.ma_bp=$condition$$.ma_bp);$condition$$.ma_dt&&($query_req_tu_ngay$$.ma_dt=$condition$$.ma_dt);$condition$$.ma_kh&&($query_req_tu_ngay$$.$or=[{ma_kh_no:$condition$$.ma_kh},{ma_kh_co:$condition$$.ma_kh}]);$condition$$.pt_thanh_toan&&($query_req_tu_ngay$$.pt_thanh_toan=$condition$$.pt_thanh_toan);$da_lay_den_ngay_query_da_post$$={...$query_req_tu_ngay$$,ma_ct:"PHT"};delete $da_lay_den_ngay_query_da_post$$.ngay_ct;$da_lay_den_ngay_query_da_post$$=(await socai.find($da_lay_den_ngay_query_da_post$$,
5
+ {id_ct_goc:1}).lean()).map($d$$=>$d$$.id_ct_goc);$query_req_tu_ngay$$.id_ct={$nin:$da_lay_den_ngay_query_da_post$$};socaitmp.find($query_req_tu_ngay$$).sort({stt:1}).lean().exec(function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$.forEach(function($r$$,$i$$){$r$$.line=$i$$+1;$r$$.id_ct_goc=$r$$.id_ct;$r$$.ma_ct_goc=$r$$.ma_ct;$r$$.so_ct_goc=$r$$.so_ct;$r$$.ngay_ct_goc=$r$$.ngay_ct;$r$$.pt_thanh_toan_goc=$r$$.pt_thanh_toan;delete $r$$.id_ct;delete $r$$.ma_ct});async.parallel({details_tk:function($callback$$){$report$$.joinModel2($condition$$.id_app,
6
+ dmtk,[{where:{tk_no:"tk"},fields:{ten_tk_no:"ten_tk"}},{where:{tk_co:"tk"},fields:{ten_tk_co:"ten_tk"}}],function(){$callback$$()})},details_customer:function($callback$$){$report$$.filter($r$$=>$r$$.ma_kh_co||$r$$.ma_kh_co).joinModel2($condition$$.id_app,dmkh,[{where:{ma_kh_no:"ma_kh"},fields:[{ten_kh_no:"ten_kh"}]},{where:{ma_kh_co:"ma_kh"},fields:{ten_kh_co:"ten_kh"}}],function(){$callback$$()})},details_ptthanhtoan:function($callback$$){$report$$.filter($r$$=>$r$$.pt_thanh_toan_goc).joinModel2($condition$$.id_app,
7
+ ptthanhtoan,[{where:{pt_thanh_toan_goc:"_id"},fields:[{ten_pt_thanh_toan_goc:"ten"}]}],function(){$callback$$()})},details_ctgoc:function($callback$$){async.mapLimit($report$$.filter($r$$=>$r$$.id_ct_goc&&$r$$.ma_ct_goc),20,async $item$$=>{try{let $ctgoc$$=await global.getModel($item$$.ma_ct_goc.toLowerCase()).findOne({_id:$item$$.id_ct_goc}).lean();$item$$.ctgoc=$ctgoc$$}catch($e$$){Logger.error($e$$)}return $item$$},()=>{$callback$$()})}},function(){$report$$.forEach($r$$=>{delete $r$$._id});$callback$$(null,
8
+ $report$$)})})},{cache:!1})};
@@ -0,0 +1,10 @@
1
+ const vsocai=require("../../libs/vsocai"),dmkh=global.getModel("customer"),dmkc=global.getModel("dmkc"),moment=require("moment"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getdk4pkc",function($req$$,$callback$$){const $condition$$=$req$$.query;let $ngay_dau_thang$$,$ngay_cuoi_thang$$;$condition$$.tu_ngay&&$condition$$.den_ngay?($ngay_dau_thang$$=moment($condition$$.tu_ngay).startOf("date").toDate(),$ngay_cuoi_thang$$=moment($condition$$.den_ngay).startOf("date").toDate()):$condition$$.thang&&$condition$$.nam&&($condition$$.thang=Number($condition$$.thang),$condition$$.nam=Number($condition$$.nam),$ngay_dau_thang$$=
3
+ moment([$condition$$.nam,$condition$$.thang,1]).startOf("month").toDate(),$ngay_cuoi_thang$$=moment($ngay_dau_thang$$).endOf("month").toDate());if(!$ngay_dau_thang$$||!$ngay_cuoi_thang$$)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 t\u1eeb ng\u00e0y-\u0111\u1ebfn ng\u00e0y");let $report$$=[];dmkc.find({status:!0,id_app:$condition$$.id_app}).sort({stt:1}).lean().then(function($kcs$$){async.mapSeries($kcs$$,function($kc$$,$callback$$){const $tk$$=$kc$$.tk_chuyen,$query$$=
4
+ {tk:{$regex:"^"+$tk$$,$options:"i"},id_app:$condition$$.id_app};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.id_ct&&($query$$.id_ct={$ne:$condition$$.id_ct});$query$$.ngay_ct={$gte:$ngay_dau_thang$$,$lte:$ngay_cuoi_thang$$};vsocai.find($query$$,function($error$$,$data_socai$$){if($error$$)return $callback$$($error$$);$report$$.forEach(function($r$$){$r$$.tk_no.indexOf($tk$$)==0&&$data_socai$$.push({...$r$$,tk:$r$$.tk_no,ps_no_nt:$r$$.tien_nt,ps_no:$r$$.tien,ps_co_nt:0,
5
+ ps_co:0});$r$$.tk_co.indexOf($tk$$)==0&&$data_socai$$.push({...$r$$,tk:$r$$.tk_co,ps_co_nt:$r$$.tien_nt,ps_co:$r$$.tien,ps_no_nt:0,ps_no:0})});$error$$=["tk"];$kc$$.not_nt_yn!==!0?$error$$.push("ma_nt"):$data_socai$$.forEach($r$$=>{$r$$.ps_no_nt=$r$$.ps_no;$r$$.ps_co_nt=$r$$.ps_co});$kc$$.kho_yn&&$error$$.push("ma_kho");$kc$$.kh_yn&&$error$$.push("ma_kh");$kc$$.phi_yn&&$error$$.push("ma_phi");$kc$$.dt_yn&&$error$$.push("ma_dt");$kc$$.bp_yn&&$error$$.push("ma_bp");$kc$$.sp_yn&&$error$$.push("ma_sp");
6
+ $kc$$.hd_yn&&$error$$.push("ma_hd");$data_socai$$.groupBy($error$$,["ps_no_nt","ps_co_nt","ps_no","ps_co"],($e$$,$groups$$)=>{const $kqs$$=[];$groups$$.forEach($kq$$=>{$kq$$.ma_kh_no=$kq$$.ma_kh;$kq$$.ma_kh_co=$kq$$.ma_kh;if($kc$$.loai_kc=="1"){var $tien_tien$$=$kq$$.ps_no-$kq$$.ps_co;$kq$$.tien_nt=$kq$$.ps_no_nt-$kq$$.ps_co_nt;$kq$$.tien=$tien_tien$$;$kq$$.tk_no=$kc$$.tk_nhan;$kq$$.tk_co=$kq$$.tk}else $tien_tien$$=$kq$$.ps_co-$kq$$.ps_no,$kq$$.tien_nt=$kq$$.ps_co_nt-$kq$$.ps_no_nt,$kq$$.tien=$tien_tien$$,
7
+ $kq$$.tk_no=$kq$$.tk,$kq$$.tk_co=$kc$$.tk_nhan;if($kc$$.chi_kc_gt_duong||$kq$$.tk_no.indexOf("421")==0||$kq$$.tk_co.indexOf("421")==0)$kq$$.tien_nt=$kq$$.tien_nt>0?$kq$$.tien_nt:0,$kq$$.tien=$kq$$.tien>0?$kq$$.tien:0;$kq$$.ma_nt=="VND"?($kq$$.tien_nt=$kq$$.tien,$kq$$.ty_gia=1):$kq$$.ty_gia=$kq$$.tien_nt?Math.roundBy($kq$$.tien/$kq$$.tien_nt,0):1;$kq$$.tien_nt===0&&$kq$$.tien===0||$kqs$$.push($kq$$)});$kqs$$.forEach($kq$$=>{delete $kq$$.tk;$report$$.push($kq$$)})});$callback$$(null)})},function($error$$){if($error$$)return $callback$$($error$$);
8
+ $report$$=underscore.filter($report$$,function($r$$){return $r$$.tien_nt!==0||$r$$.tien!==0});$report$$.forEach(function($r$$,$i$$){$r$$.line=$i$$+1});async.parallel({details_bp:function($callback$$){$report$$.filter($r$$=>$r$$.ma_bp).joinModel2($condition$$.id_app,"dmbp",[{where:{ma_bp:"ma_bp"},fields:{ten_bp:"ten_bp"}}],function(){$callback$$()})},details_kho:function($callback$$){$report$$.filter($r$$=>$r$$.ma_kho).joinModel2($condition$$.id_app,"dmkho",[{where:{ma_kho:"ma_kho"},fields:{ten_kho:"ten_kho"}}],
9
+ function(){$callback$$()})},details_dt:function($callback$$){$report$$.filter($r$$=>$r$$.ma_dt).joinModel2($condition$$.id_app,"dmdt",[{where:{ma_dt:"ma_dt"},fields:{ten_dt:"ten_dt"}}],function(){$callback$$()})},details_customer:function($callback$$){$report$$.filter($r$$=>$r$$.ma_kh_no||$r$$.ma_kh_co).joinModel2($condition$$.id_app,dmkh,[{where:{ma_kh_no:"ma_kh"},fields:[{ten_kh_no:"ten_kh"}]},{where:{ma_kh_co:"ma_kh"},fields:{ten_kh_co:"ten_kh"}}],function(){$callback$$()})}},function(){$report$$.forEach($r$$=>
10
+ {delete $r$$._id});$callback$$(null,$report$$)})})}).catch($error$$=>{$callback$$($error$$)})},{cache:!1})};
@@ -0,0 +1,5 @@
1
+ const databanle=require("../../libs/databanle"),giaoca=global.getModel("giaoca"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getdttheoca",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");let $query$$={id_app:$condition$$.id_app};$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$query$$.ma_kho=$condition$$.ma_kho;$condition$$.ma_ca&&($query$$.ma_ca=$condition$$.ma_ca);$query$$.user_created=
3
+ $condition$$.nhan_vien;databanle($query$$,function($error$$,$rs$$){if($error$$)return $callback$$($error$$);async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_sl_xuat=$r$$.details.csum("sl_xuat");$r$$.t_tien=$r$$.details.csum("tien");$r$$.t_tien_ck=$r$$.details.csum("tien_ck");$r$$.tien_ck_hd=$r$$.tien_ck_hd||0;$r$$.tien_evoucher=$r$$.tien_evoucher||0;$r$$.t_tien_xuat=$r$$.details.csum("tien_xuat");$r$$.t_tien_hang=$r$$.t_tien-$r$$.t_tien_ck-$r$$.tien_ck_hd-$r$$.tien_evoucher;$callback$$(null,
4
+ $r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);let $tien_hang$$=$rs$$.csum("t_tien_hang");$query$$={id_app:$condition$$.id_app};$query$$.tu_ngay=$condition$$.tu_ngay;$query$$.den_ngay=$condition$$.den_ngay;$query$$.ma_kho=$condition$$.ma_kho;$condition$$.ma_ca&&($query$$.ma_ca=$condition$$.ma_ca);$query$$.nhan_vien=$condition$$.nhan_vien;giaoca.find($query$$).lean().exec(($da_giao_e$$,$rs$$)=>{if($da_giao_e$$)return $callback$$($da_giao_e$$);$da_giao_e$$=$rs$$.csum("tien_giao");
5
+ $callback$$(null,{tien_hang:$tien_hang$$,da_giao:$da_giao_e$$})})})})},{cache:!1})};
@@ -0,0 +1,4 @@
1
+ const tdttco=global.getModel("tdttco"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getinvoice2pay",function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.ma_kh||!$condition_req$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: ma_kh,id_app");$condition_req$$.tat_toan=!1;tdttco.getBalance($condition_req$$).then($invoices_results$$=>{$invoices_results$$=$invoices_results$$.filter($r$$=>$r$$.con_lai_nt>0).map($invoice$$=>{let $t_invoice$$=
3
+ {sel:!1,id_tdtt:$invoice$$._id,line:$invoice$$.line,id_hd:$invoice$$.id_ct,so_hd:$invoice$$.so_hd||$invoice$$.so_ct,ngay_hd:$invoice$$.ngay_hd||$invoice$$.ngay_ct,tien_hd_nt:$invoice$$.tien_nt};$t_invoice$$.ma_nt_hd=$invoice$$.ma_nt;$t_invoice$$.ty_gia_hd=$invoice$$.ty_gia;$t_invoice$$.ma_kh=$invoice$$.ma_kh;$t_invoice$$.ma_kho=$invoice$$.ma_kho;$t_invoice$$.dien_giai=$invoice$$.dien_giai;$t_invoice$$.tien_nt=0;$t_invoice$$.tien=0;$t_invoice$$.thanh_toan_qd=0;$t_invoice$$.tk_no=$invoice$$.tk_co;$t_invoice$$.da_thanh_toan_nt=
4
+ $invoice$$.da_thanh_toan_nt;$t_invoice$$.da_thanh_toan=$invoice$$.da_thanh_toan;$t_invoice$$.con_lai_nt=$invoice$$.con_lai_nt;$t_invoice$$.con_lai=$invoice$$.con_lai;return $t_invoice$$});$callback$$(null,$invoices_results$$)}).catch($error$$=>{$callback$$($error$$)})},{cache:!1})};
@@ -0,0 +1,4 @@
1
+ const tdttno=global.getModel("tdttno"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getinvoice2receive",function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;if(!$condition_req$$.ma_kh||!$condition_req$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: ma_kh,id_app");$condition_req$$.tat_toan=!1;tdttno.getBalance($condition_req$$).then($invoices_results$$=>{$invoices_results$$=$invoices_results$$.filter($r$$=>$r$$.con_lai_nt>0).map($invoice$$=>{let $t_invoice$$=
3
+ {sel:!1,id_tdtt:$invoice$$._id,line:$invoice$$.line,id_hd:$invoice$$.id_ct,so_hd:$invoice$$.so_hd||$invoice$$.so_ct,ngay_hd:$invoice$$.ngay_hd||$invoice$$.ngay_ct,tien_hd_nt:$invoice$$.tien_nt};$t_invoice$$.ma_nt_hd=$invoice$$.ma_nt;$t_invoice$$.ty_gia_hd=$invoice$$.ty_gia;$t_invoice$$.ma_kh=$invoice$$.ma_kh;$t_invoice$$.ma_kho=$invoice$$.ma_kho;$t_invoice$$.dien_giai=$invoice$$.dien_giai;$t_invoice$$.tien_nt=0;$t_invoice$$.tien=0;$t_invoice$$.thanh_toan_qd=0;$t_invoice$$.tk_co=$invoice$$.tk_no;$t_invoice$$.da_thanh_toan_nt=
4
+ $invoice$$.da_thanh_toan_nt;$t_invoice$$.da_thanh_toan=$invoice$$.da_thanh_toan;$t_invoice$$.con_lai_nt=$invoice$$.con_lai_nt;$t_invoice$$.con_lai=$invoice$$.con_lai;return $t_invoice$$});$callback$$(null,$invoices_results$$)}).catch($error$$=>{$callback$$($error$$)})},{cache:!1})};
@@ -0,0 +1,5 @@
1
+ const hd2=global.getModel("hd2"),dmvt=global.getModel("dmvt"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getinvoice2return",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.id_app||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:id_app,ma_kh,tu_ngay,den_ngay");async.series({invoices:function($callback$$){let $query$$={};$condition$$.ma_kh&&($query$$.ma_kh=$condition$$.ma_kh);$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct=
3
+ {$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);$condition$$.so_hd&&($query$$.so_hd=$condition$$.so_hd);hd2.find($query$$).lean().exec(function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);const $invoices$$=$results$$.invoices;async.mapLimit($invoices$$,20,
4
+ function($invoice$$,$callback$$){const $ds$$=[];for(let $i$$=0;$i$$<$invoice$$.details.length;$i$$++){const $detail$$=$invoice$$.details[$i$$];$detail$$.sl_nhap=$detail$$.sl_xuat;$detail$$.tien_nhap_nt=$detail$$.tien_xuat_nt;$detail$$.tien_nhap=$detail$$.tien_xuat;$detail$$.id_hd=$invoice$$._id.toString();$detail$$.so_ct=$invoice$$.so_ct;$detail$$.ngay_ct=$invoice$$.ngay_ct;$detail$$.so_hd=$invoice$$.so_hd;$detail$$.ngay_hd=$invoice$$.ngay_hd;$detail$$.ma_ct=$invoice$$.ma_ct;$detail$$.sel=!1;$ds$$.push($detail$$)}$invoice$$.details=
5
+ $ds$$;$invoice$$.sel=!1;$ds$$.joinModel($condition$$.id_app,dmvt,[{akey:"ma_vt",bkey:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"},{name:"tk_tl",value:"tk_tl"}]}],function(){$callback$$(null,$invoice$$)})},function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$invoices$$)})})},{cache:!1})};
@@ -0,0 +1,6 @@
1
+ const pbl=global.getModel("pbl"),so1=global.getModel("so1"),dmvt=global.getModel("dmvt"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getinvoice2return_bl",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.id_app||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:id_app,ma_kh,tu_ngay,den_ngay");async.parallel({pbl:$callback$$=>{let $query$$={};$condition$$.ma_kh&&($query$$.ma_kh=$condition$$.ma_kh);$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,
3
+ $lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);pbl.find($query$$).lean().exec(function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})},so1:$callback$$=>{let $query$$={};$condition$$.ma_kh&&($query$$.ma_kh=$condition$$.ma_kh);$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=
4
+ $condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);so1.find($query$$).lean().exec(function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);var $invoices$$=$results$$.pbl.concat($results$$.so1);async.mapLimit($invoices$$,20,function($invoice$$,$callback$$){var $ds$$=[];for(let $i$$=0;$i$$<$invoice$$.details.length;$i$$++){var $detail$$=$invoice$$.details[$i$$];
5
+ $detail$$.sl_nhap=$detail$$.sl_xuat;$detail$$.tien_nhap_nt=$detail$$.tien_xuat_nt;$detail$$.tien_nhap=$detail$$.tien_xuat;$detail$$.id_hd=$invoice$$._id.toString();$detail$$.so_ct=$invoice$$.so_ct;$detail$$.ngay_ct=$invoice$$.ngay_ct;$detail$$.so_hd=$invoice$$.so_hd;$detail$$.ngay_hd=$invoice$$.ngay_hd;$detail$$.ma_ct=$invoice$$.ma_ct;$detail$$.sel=!1;$ds$$.push($detail$$)}$invoice$$.details=$ds$$;$invoice$$.sel=!1;$ds$$.joinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"},
6
+ {name:"tk_tl",value:"tk_tl"}]},function(){$callback$$(null,$invoice$$)})},function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$invoices$$)})})},{cache:!1})};
@@ -0,0 +1,4 @@
1
+ const kehoachmh=global.getModel("kehoachmh"),dmvt=global.getModel("dmvt"),congdoansx=global.getModel("congdoansx"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getkehoachmh4lenhcp",function($req$$,$callback$$){const $condition$$=$req$$.query;async.series({kehoachmh:function($callback$$){let $query$$={id_app:$condition$$.id_app,ngay_ct:{$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay}};$condition$$.id_lenhsx&&($query$$.id_lenhsx=$condition$$.id_lenhsx);$condition$$.id_contract&&($query$$.id_contract=$condition$$.id_contract);$condition$$.so_ct&&($query$$.so_ct={$regex:$query$$.so_ct,$options:"i"});
3
+ kehoachmh.find($query$$).lean().exec(($e$$,$khmhs$$)=>{if($e$$)return $callback$$($e$$.message);$khmhs$$.forEach($khmh$$=>{$khmh$$.details.forEach($d$$=>{$d$$.so_luong=$d$$.sl_ke_hoach})});async.parallel({ten_vt_sp:$callback$$=>{async.mapLimit($khmhs$$,20,$khmh$$=>{$khmh$$.details.joinModel2($condition$$.id_app,dmvt,[{where:"ma_vt",fields:"ten_vt"},{where:{ma_sp:"ma_vt"},fields:{ten_sp:"ten_vt"}}],()=>{$callback$$()})},()=>{$callback$$()})},congdoan:$callback$$=>{async.mapLimit($khmhs$$,20,$khmh$$=>
4
+ {$khmh$$.details.joinModel2($condition$$.id_app,congdoansx,[{where:{ma_cong_doan:"ma_cong_doan"},fields:{ten_cong_doan:"ten_cong_doan"}}],()=>{$callback$$()})},()=>{$callback$$()})}},()=>{$callback$$(null,$khmhs$$)})})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$.kehoachmh)})})};
@@ -0,0 +1,7 @@
1
+ const dmtk=global.getModel("account"),dmbp=global.getModel("dmbp"),qts=global.getModel("qts"),sotinhkh=global.getModel("sotinhkh"),phanbokh=require("../../libs/phanbokh"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getkhauhao",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.nam||!$condition$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: nam,id_app");$condition$$.thang||($condition$$.thang=0);if($condition$$.thang>11)return $callback$$("Tham s\u1ed1 th\u00e1ng kh\u00f4ng h\u1ee3p l\u1ec7");sotinhkh.find({id_app:$condition$$.id_app,thang:Number($condition$$.thang)+1,nam:$condition$$.nam}).lean().then(async function($khauhaos$$){await $khauhaos$$.filter($r$$=>
3
+ $r$$.ma_tang_giam_ts).asyncJoinModel2($condition$$.id_app,"dmtanggiamts",{where:"ma_tang_giam_ts",fields:{kieu_dc:"kieu"}});$khauhaos$$.forEach($r$$=>{$r$$.kieu_dc=="2"&&($r$$.nguyen_gia=0-$r$$.nguyen_gia,$r$$.gia_tri_da_kh=0-$r$$.gia_tri_da_kh,$r$$.gia_tri_con_lai=0-$r$$.gia_tri_con_lai,$r$$.gia_tri_kh_ky=0-$r$$.gia_tri_kh_ky)});$khauhaos$$=await $khauhaos$$.asyncGroupBy("id_app nam thang ngay_dau_thang ngay_cuoi_thang so_ngay_kh sua_kh id_ts tk_cp tk_kh ma_kho ma_bp ma_phi ma_dt".split(" "),["gia_tri_kh_ky"]);
4
+ $khauhaos$$.joinModel2($condition$$.id_app,qts,[{where:{id_ts:"_id"},fields:[{tk_kh_goc:"tk_kh"},{tk_cp_goc:"tk_cp"},{ma_bp_goc:"ma_bp"},{ma_kho_goc:"ma_kho"},{ma_phi_goc:"ma_phi"},{ma_dt_goc:"ma_dt"},"ten_ts","so_the_ts"]}],function(){async.mapLimit($khauhaos$$,20,function($khauhao$$,$callback$$){phanbokh($khauhao$$,function($error$$,$kqpb$$){if($error$$)return Logger.info($error$$),$callback$$($error$$);$callback$$(null,$kqpb$$)})},function($error$$,$kqpbs$$){$kqpbs$$=$kqpbs$$.reduce(($a$$,$b$$)=>
5
+ $a$$.concat($b$$),[]);if($error$$)return $callback$$($error$$);let $report$$=$kqpbs$$.filter($r$$=>!!$r$$).map(($r$$,$i$$)=>{$r$$.line=$i$$;$r$$.tk_no=$r$$.tk_cp||$r$$.tk_cp_goc;$r$$.tk_co=$r$$.tk_kh||$r$$.tk_kh_goc;$r$$.ma_kho=$r$$.ma_kho||$r$$.ma_kho_goc;$r$$.ma_bp=$r$$.ma_bp||$r$$.ma_bp_goc;$r$$.ma_phi=$r$$.ma_phi||$r$$.ma_phi_goc;$r$$.ma_dt=$r$$.ma_dt||$r$$.ma_dt_goc;$r$$.tien_nt=$r$$.gia_tri_kh_ky;$r$$.tien=$r$$.tien_nt;return $r$$});async.parallel({tk:function($callback$$){$report$$.joinModel2($condition$$.id_app,
6
+ dmtk,[{where:{tk_no:"tk"},fields:[{name:"ten_tk_no",value:"ten_tk"}]},{akey:"tk_co",bkey:"tk",fields:[{name:"ten_tk_co",value:"ten_tk"}]}],function($r$$){$callback$$(null,$r$$)})},bp:function($callback$$){$report$$.joinModel2($condition$$.id_app,dmbp,[{where:"ma_bp",fields:[{name:"ten_bp",value:"ten_bp"}]}],function($r$$){$callback$$(null,$r$$)})},ts:function($callback$$){$report$$.joinModel2($condition$$.id_app,qts,[{where:{id_ts:"_id"},fields:[{name:"ten_ts",value:"ten_ts"},{name:"so_the_ts",value:"so_the_ts"}]}],
7
+ function($r$$){$callback$$(null,$r$$)})}},function(){$report$$.forEach($r$$=>{delete $r$$._id});$callback$$(null,$report$$)})})})}).catch($error$$=>{$callback$$($error$$)})},{cache:!1})};
@@ -0,0 +1,8 @@
1
+ const dmbp=global.getModel("dmbp"),bangtinhluong=global.getModel("bangtinhluong"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getluong",function($req$$,$callback$$){const $condition$$=$req$$.query,$groupBy$$=$condition$$.groupBy||$condition$$.groupby||$condition$$.group_by||"tk_no tk_co ma_nv ma_bp ten_bp ma_phi ma_kho dien_giai".split(" ");if(!$condition$$.thang||!$condition$$.nam||!$condition$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: thang,nam,id_app");bangtinhluong.find({id_app:$condition$$.id_app,thang:Number($condition$$.thang),
3
+ nam:Number($condition$$.nam)}).lean().then(async function($luongs$$){$luongs$$.joinModel2($condition$$.id_app,dmbp,[{where:{ma_bp:"ma_bp"},fields:["tk_cp_luong","tk_pt_nv","tk_thue_tncn","ma_phi","ten_bp"]}],async function(){var $cpluong_report$$=$luongs$$.filter($luong$$=>$luong$$.luong_thang).map($_luong_luong$$=>{$_luong_luong$$={...$_luong_luong$$};$_luong_luong$$.tk_no=$_luong_luong$$.tk_cp_luong;$_luong_luong$$.tk_co=$_luong_luong$$.tk_pt_nv;$_luong_luong$$.tien_nt=$_luong_luong$$.tien=Math.roundBy($_luong_luong$$.tong_thu_nhap);
4
+ $_luong_luong$$.dien_giai="Chi ph\u00ed l\u01b0\u01a1ng";return $_luong_luong$$});const $ttncn$$=$luongs$$.filter($luong$$=>$luong$$.ttncn_tong_thue).map($_luong$jscomp$1_luong$$=>{$_luong$jscomp$1_luong$$={...$_luong$jscomp$1_luong$$};$_luong$jscomp$1_luong$$.tk_no=$_luong$jscomp$1_luong$$.tk_pt_nv;$_luong$jscomp$1_luong$$.tk_co=$_luong$jscomp$1_luong$$.tk_thue_tncn||"3335";$_luong$jscomp$1_luong$$.tien_nt=$_luong$jscomp$1_luong$$.tien=$_luong$jscomp$1_luong$$.ttncn_tong_thue;$_luong$jscomp$1_luong$$.dien_giai=
5
+ "Kh\u1ea5u tr\u1eeb thu\u1ebf thu nh\u1eadp c\u00e1 nh\u00e2n";return $_luong$jscomp$1_luong$$});let $trich_theo_luong$$=$luongs$$.map($_luong$$=>{let $luong$$={...$_luong$$};$_luong$$=$luong$$.giam_tru||[];let $ht$$;$ht$$=$_luong$$.filter($gt$$=>$gt$$.cty).map($_gt_gt$$=>{$_gt_gt$$={...$_gt_gt$$};$_gt_gt$$.tk_no=$luong$$.tk_cp_luong;$_gt_gt$$.tk_co=$_gt_gt$$.tk;$_gt_gt$$.dien_giai=$_gt_gt$$.dien_giai||$_gt_gt$$.ten_giam_tru;$_gt_gt$$.tien_nt=$_gt_gt$$.tien=$_gt_gt$$.cty;$_gt_gt$$.ma_phi=$luong$$.ma_phi;
6
+ $_gt_gt$$.ma_bp=$luong$$.ma_bp;$_gt_gt$$.ten_bp=$luong$$.ten_bp;$_gt_gt$$.ma_nv=$luong$$.ma_nv;$_gt_gt$$.ma_kho=$luong$$.ma_kho;return $_gt_gt$$});return $ht$$=[...$ht$$,...$_luong$$.filter($gt$$=>$gt$$.nv).map($_gt$jscomp$1_gt$$=>{$_gt$jscomp$1_gt$$={...$_gt$jscomp$1_gt$$};$_gt$jscomp$1_gt$$.tk_no=$luong$$.tk_pt_nv;$_gt$jscomp$1_gt$$.tk_co=$_gt$jscomp$1_gt$$.tk;$_gt$jscomp$1_gt$$.tien_nt=$_gt$jscomp$1_gt$$.tien=$_gt$jscomp$1_gt$$.nv;$_gt$jscomp$1_gt$$.dien_giai=$_gt$jscomp$1_gt$$.dien_giai||$_gt$jscomp$1_gt$$.ten_giam_tru;
7
+ $_gt$jscomp$1_gt$$.ma_phi=$luong$$.ma_phi;$_gt$jscomp$1_gt$$.ma_bp=$luong$$.ma_bp;$_gt$jscomp$1_gt$$.ten_bp=$luong$$.ten_bp;$_gt$jscomp$1_gt$$.ma_nv=$luong$$.ma_nv;$_gt$jscomp$1_gt$$.ma_kho=$luong$$.ma_kho;return $_gt$jscomp$1_gt$$})]}).reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$cpluong_report$$=[...$cpluong_report$$,...$trich_theo_luong$$,...$ttncn$$];$cpluong_report$$=await $cpluong_report$$.asyncGroupBy($groupBy$$,["tien","tien_nt"]);$cpluong_report$$=$cpluong_report$$.map(($r$$,$i$$)=>{$r$$.line=
8
+ $i$$;return $r$$});$callback$$(null,$cpluong_report$$)})}).catch($error$$=>{$callback$$($error$$)})})};
@@ -0,0 +1,5 @@
1
+ const dmbp=global.getModel("dmbp"),dmnv=global.getModel("dmnv"),customer=global.getModel("customer"),bangtinhluong=global.getModel("bangtinhluong"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getluongchuyen",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.thang||!$condition$$.nam||!$condition$$.id_app)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: thang,nam,id_app");bangtinhluong.find({id_app:$condition$$.id_app,thang:Number($condition$$.thang),nam:Number($condition$$.nam)}).lean().then(function($luongs$$){$luongs$$.joinModel2($condition$$.id_app,dmbp,[{where:{ma_bp:"ma_bp"},
3
+ fields:["tk_cp_luong","tk_pt_nv","tk_thue_tncn","ma_phi","ten_bp"]}],async function(){const $cpluong$$=$luongs$$.filter($luong$$=>$luong$$.luong_thang).map($_luong_luong$$=>{$_luong_luong$$={...$_luong_luong$$};$_luong_luong$$.tk_no=$_luong_luong$$.tk_pt_nv;$_luong_luong$$.tien_nt=$_luong_luong$$.tien=Math.roundBy($_luong_luong$$.tong_luong);return $_luong_luong$$});let $report$$=[...$cpluong$$];$report$$=await $report$$.asyncGroupBy("tk_no ma_nv ma_bp ten_bp ma_phi ma_kho dien_giai".split(" "),["tien",
4
+ "tien_nt"]);await $report$$.asyncJoinModel2($condition$$.id_app,dmnv,{where:"ma_nv",fields:["ten_nv","so_tk_ngan_hang","ten_chu_tk_ngan_hang","phat_hanh_boi_ngan_hang"]});$report$$=$report$$.map(($r$$,$i$$)=>{$r$$.line=$i$$;$r$$.ma_kh=$r$$.ma_kh||$r$$.ma_nv;$condition$$.ty_le&&$condition$$.dot&&($r$$.tien_nt=$r$$.tien=Math.roundBy($r$$.tien_nt*$condition$$.ty_le/100),$r$$.dot=$condition$$.dot,$r$$.ty_le=$condition$$.ty_le);$r$$.bang_luong=$cpluong$$.filter($c$$=>$c$$.ma_nv==$r$$.ma_nv&&$c$$.ma_bp==
5
+ $r$$.ma_bp);return $r$$});await $report$$.asyncJoinModel2($condition$$.id_app,customer,{where:"ma_kh",fields:["ten_kh"]});$report$$.forEach($r$$=>{$r$$.ten_kh||delete $r$$.ma_kh});$callback$$(null,$report$$)})}).catch($error$$=>{$callback$$($error$$)})})};
@@ -0,0 +1,5 @@
1
+ const pn1=global.getModel("pn1"),pn9=global.getModel("pn9"),dmvt=global.getModel("dmvt"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getpn2fee",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");async.parallel({invoices:function($callback$$){const $query$$={};$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=
3
+ $condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);pn1.find($query$$).lean().exec(function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})},nhap_khau:function($callback$$){const $query$$={};$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);pn9.find($query$$).lean().exec(function($error$$,
4
+ $results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);const $invoices$$=$results$$.invoices;$results$$.nhap_khau.forEach(function($p$$){$invoices$$.push($p$$)});async.mapLimit($invoices$$,20,function($invoice$$,$callback$$){const $ds$$=[];for(let $i$$=0;$i$$<$invoice$$.details.length;$i$$++){const $detail$$=$invoice$$.details[$i$$];$detail$$.id_hd=$invoice$$._id.toString();$detail$$.so_ct=$invoice$$.so_ct;
5
+ $detail$$.ngay_ct=$invoice$$.ngay_ct;$detail$$.ma_ct=$invoice$$.ma_ct;$detail$$.tien_phi_nt=0;$detail$$.tien_phi=0;$detail$$.sel=!1;$ds$$.push($detail$$)}$invoice$$.details=$ds$$;$invoice$$.sel=!1;$ds$$.joinModel($condition$$.id_app,dmvt,[{akey:"ma_vt",bkey:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"}]}],function(){$callback$$(null,$invoice$$)})},function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$invoices$$)})})})};
@@ -0,0 +1,5 @@
1
+ const pn1=global.getModel("pn1"),dmvt=global.getModel("dmvt"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getpn2return",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.ma_kh||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:ma_kh,tu_ngay,den_ngay");async.series({invoices:function($callback$$){const $query$$={ma_kh:$condition$$.ma_kh};$query$$.id_app=$condition$$.id_app;$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};
3
+ $condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);pn1.find($query$$).lean().exec(function($error$$,$results$$){if($error$$)return $callback$$($error$$);$callback$$(null,$results$$)})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);const $invoices$$=$results$$.invoices;async.mapLimit($invoices$$,20,function($invoice$$,$callback$$){const $ds$$=[];for(let $i$$=0;$i$$<$invoice$$.details.length;$i$$++){const $detail$$=
4
+ $invoice$$.details[$i$$];$detail$$.sl_xuat=$detail$$.sl_nhap;$detail$$.tien_xuat_nt=$detail$$.tien_hang_nt-$detail$$.tien_ck_nt;$detail$$.tien_xuat=$detail$$.tien_hang-$detail$$.tien_ck;$detail$$.id_hd=$invoice$$._id.toString();$detail$$.so_ct=$invoice$$.so_ct;$detail$$.ngay_ct=$invoice$$.ngay_ct;$detail$$.ma_ct=$invoice$$.ma_ct;$detail$$.sel=!1;$ds$$.push($detail$$)}$invoice$$.details=$ds$$;$invoice$$.sel=!1;$ds$$.joinModel($condition$$.id_app,dmvt,[{akey:"ma_vt",bkey:"ma_vt",fields:[{name:"ten_vt",
5
+ value:"ten_vt"}]}],function(){$callback$$(null,$invoice$$)})},function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$invoices$$)})})})};
@@ -0,0 +1,7 @@
1
+ const sokho=global.getModel("sokho"),dmvt=global.getModel("dmvt"),dmdvt=global.getModel("dmdvt"),dmdt=global.getModel("dmdt"),dinhmucsx=global.getModel("dinhmucsx"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"getthanhpham4pnk",async($query_req_sokho_phat_sinh_vts$$,$callback$$)=>{const $condition$$=$query_req_sokho_phat_sinh_vts$$.query;if(!$condition$$.ma_ct||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:ma_ct,tu_ngay,den_ngay");$query_req_sokho_phat_sinh_vts$$={id_app:$condition$$.id_app,ngay_ct:{$gte:moment($condition$$.tu_ngay).startOf("date").toDate(),
3
+ $lte:moment($condition$$.den_ngay).endOf("date").toDate()},ma_ct:{$in:$condition$$.ma_ct.toUpperCase().split(",")}};$condition$$.ma_vt&&($query_req_sokho_phat_sinh_vts$$.ma_vt=$condition$$.ma_vt);$condition$$.ma_dt&&($query_req_sokho_phat_sinh_vts$$.ma_dt=$condition$$.ma_dt);$condition$$.ma_hd&&($query_req_sokho_phat_sinh_vts$$.ma_hd=$condition$$.ma_hd);$condition$$.ma_kh&&($query_req_sokho_phat_sinh_vts$$.ma_kh=$condition$$.ma_kh);$condition$$.ma_kho&&($query_req_sokho_phat_sinh_vts$$.ma_kho=$condition$$.ma_kho);
4
+ $query_req_sokho_phat_sinh_vts$$=await sokho.find($query_req_sokho_phat_sinh_vts$$).lean();$condition$$.chi_sp_co_dm?($query_req_sokho_phat_sinh_vts$$=await $query_req_sokho_phat_sinh_vts$$.asyncGroupBy(["ma_vt","ma_dvt","ngay_ct"],[{name:"sl_nhap",value:"sl_xuat"}]),$query_req_sokho_phat_sinh_vts$$=(await Promise.all($query_req_sokho_phat_sinh_vts$$.map($sp$$=>(async()=>{let $query_dinhmuc$$={id_app:$condition$$.id_app,ma_sp:$sp$$.ma_vt},$ngay_ct$$=$sp$$.ngay_ct;$query_dinhmuc$$.hieu_luc_tu_ngay=
5
+ {$lte:moment($ngay_ct$$).startOf("date").toDate()};$query_dinhmuc$$.hieu_luc_den_ngay={$gte:moment($ngay_ct$$).endOf("date").toDate()};return await dinhmucsx.findOne($query_dinhmuc$$,{_id:1}).sort({hieu_luc_tu_ngay:-1}).lean()?$sp$$:null})()))).filter($r$$=>$r$$),$query_req_sokho_phat_sinh_vts$$=await $query_req_sokho_phat_sinh_vts$$.asyncGroupBy(["ma_vt","ma_dvt"],["sl_nhap"])):$query_req_sokho_phat_sinh_vts$$=await $query_req_sokho_phat_sinh_vts$$.asyncGroupBy(["ma_vt","ma_dvt","ngay_ct"],[{name:"sl_nhap",
6
+ value:"sl_xuat"}]);await $query_req_sokho_phat_sinh_vts$$.asyncJoinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:["ten_vt","tk_vt","ma_lvt",{tk_du:"tk_gv"}]});$query_req_sokho_phat_sinh_vts$$=$query_req_sokho_phat_sinh_vts$$.filter($v$$=>$v$$.ma_lvt=="TP");await $query_req_sokho_phat_sinh_vts$$.filter($r$$=>$r$$.ma_dvt).asyncJoinModel2($condition$$.id_app,dmdvt,{where:"ma_dvt",fields:"ten_dvt"});await $query_req_sokho_phat_sinh_vts$$.filter($r$$=>$r$$.ma_dt).asyncJoinModel2($condition$$.id_app,
7
+ dmdt,{where:"ma_dt",fields:"ten_dt"});$callback$$(null,$query_req_sokho_phat_sinh_vts$$)})};
@@ -0,0 +1,11 @@
1
+ const Pbl=global.getModel("pbl"),So1=global.getModel("so1"),Trangthai=global.getModel("trangthai"),xhd=global.getModel("xhd"),dmvt=global.getModel("dmvt"),vat=global.getModel("vat"),async=require("async"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"getvc2xhd",async function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.ma_thue||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:ma_thue,tu_ngay,den_ngay");let $_vat$$=await vat.findOne({id_app:$condition$$.id_app,ma_thue:$condition$$.ma_thue});if(!$_vat$$)return $callback$$("M\u00e3 thu\u1ebf kh\u00f4ng t\u1ed3n t\u1ea1i");const $trang_thais$$=
3
+ await Trangthai.find({ma_ct:{$in:["PBL","SO1"]},post:!0},{ma_trang_thai:1,ma_ct:1});async.parallel({pbl:function($callback$$){const $query$$={id_app:$condition$$.id_app,trang_thai:{$in:$trang_thais$$.filter($r$$=>$r$$.ma_ct=="PBL").map($a$$=>$a$$.ma_trang_thai)}};$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);$condition$$.ma_kh&&($query$$.ma_kh=$condition$$.ma_kh);
4
+ $condition$$.ma_ct&&($query$$.ma_ct=$condition$$.ma_ct);Pbl.find($query$$).lean().exec(function($error$$,$pbls$$){if($error$$)return $callback$$($error$$);async.mapLimit($pbls$$,20,($pbl$$,$callback$$)=>{$pbl$$.details.joinModel2($condition$$.id_app,xhd,{where:$item$$=>({details:{$elemMatch:{id_ct:$pbl$$._id,ma_vt:$item$$.ma_vt}}}),fields:[{id_xhd:"_id"}]},()=>{$pbl$$.details=$pbl$$.details.filter($d$$=>!$d$$.id_xhd);$pbl$$.details.joinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:["ten_vt",
5
+ "ma_thue"]},()=>{$pbl$$.details=$pbl$$.details.filter($detail$$=>$detail$$.ma_thue===$_vat$$.ma_thue).map($detail$$=>{let $_detail$$={...$detail$$,sel:!1};$_detail$$.id_ct=$pbl$$._id.toString();$_detail$$.code_ct="PBL";$_detail$$.so_ct=$pbl$$.so_ct;$_detail$$.ngay_ct=$pbl$$.ngay_ct;$_detail$$.thue_suat=$_vat$$.thue_suat;$_detail$$.sl_xuat=$_detail$$.sl_xuat||1;$_detail$$.tt_nt=$_detail$$.tt=$_detail$$.tien;$_detail$$.tien_nt=$_detail$$.tien=$_detail$$.tt/(1+$_detail$$.thue_suat/100);$_detail$$.gia_ban_nt=
6
+ $_detail$$.gia_ban=Math.roundBy($_detail$$.tien_nt/$_detail$$.sl_xuat);$_detail$$.tien_hang_nt=$_detail$$.tien_hang=Math.roundBy($_detail$$.gia_ban_nt*$detail$$.sl_xuat);$_detail$$.ty_le_ck=0;$_detail$$.tien_ck=$_detail$$.tien_ck_nt=0;$_detail$$.tien_nt=$_detail$$.tien=$_detail$$.tien_hang_nt-$_detail$$.tien_ck_nt;$_detail$$.tien_thue_nt=$_detail$$.tien_thue=Math.roundBy($_detail$$.tien_nt*$_detail$$.thue_suat/100);return $_detail$$});$callback$$()})})},()=>{$callback$$(null,$pbls$$.filter($p$$=>
7
+ $p$$.details.length>0))})})},so1:function($callback$$){const $query$$={id_app:$condition$$.id_app,trang_thai:{$in:$trang_thais$$.filter($r$$=>$r$$.ma_ct=="SO1").map($a$$=>$a$$.ma_trang_thai)}};$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.so_ct&&($query$$.so_ct=$condition$$.so_ct);$condition$$.ma_kh&&($query$$.ma_kh=$condition$$.ma_kh);$condition$$.ma_ct&&($query$$.ma_ct=$condition$$.ma_ct);So1.find($query$$).lean().exec(function($error$$,
8
+ $so1s$$){if($error$$)return $callback$$($error$$);async.mapLimit($so1s$$,20,($so1$$,$callback$$)=>{$so1$$.details.joinModel2($condition$$.id_app,xhd,{where:$item$$=>({details:{$elemMatch:{id_ct:$so1$$._id,ma_vt:$item$$.ma_vt}}}),fields:[{id_xhd:"_id"}]},()=>{$so1$$.details=$so1$$.details.filter($d$$=>!$d$$.id_xhd);$so1$$.details.joinModel2($condition$$.id_app,dmvt,{where:"ma_vt",fields:["ten_vt","ma_thue"]},()=>{$so1$$.details=$so1$$.details.filter($detail$$=>$detail$$.ma_thue===$_vat$$.ma_thue).map($detail$$=>
9
+ {let $_detail$$={...$detail$$,sel:!1};$_detail$$.id_ct=$so1$$._id.toString();$_detail$$.code_ct="SO1";$_detail$$.so_ct=$so1$$.so_ct;$_detail$$.ngay_ct=$so1$$.ngay_ct;$_detail$$.thue_suat=$_vat$$.thue_suat;$_detail$$.sl_xuat=$_detail$$.sl_xuat||1;$_detail$$.tt_nt=$_detail$$.tt=$_detail$$.tien;$_detail$$.tien_nt=$_detail$$.tien=$_detail$$.tt/(1+$_detail$$.thue_suat/100);$_detail$$.gia_ban_nt=$_detail$$.gia_ban=Math.roundBy($_detail$$.tien_nt/$_detail$$.sl_xuat);$_detail$$.tien_hang_nt=$_detail$$.tien_hang=
10
+ Math.roundBy($_detail$$.gia_ban_nt*$detail$$.sl_xuat);$_detail$$.ty_le_ck=0;$_detail$$.tien_ck=$_detail$$.tien_ck_nt=0;$_detail$$.tien_nt=$_detail$$.tien=$_detail$$.tien_hang_nt-$_detail$$.tien_ck_nt;$_detail$$.tien_thue_nt=$_detail$$.tien_thue=Math.roundBy($_detail$$.tien_nt*$_detail$$.thue_suat/100);return $_detail$$});$callback$$()})})},()=>{$callback$$(null,$so1s$$.filter($p$$=>$p$$.details.length>0))})})}},function($error$$,$results$$){if($error$$)return $callback$$($error$$);$error$$=$results$$.pbl.map($r$$=>
11
+ $r$$.details).reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$callback$$(null,$error$$)})})};
@@ -0,0 +1,6 @@
1
+ const sokho=global.getModel("sokho"),dmvt=global.getModel("dmvt"),dmkho=global.getModel("dmkho"),dmbp=global.getModel("dmbp"),controller=require("../../controllers/controllerRPT"),async=require("async"),moment=require("moment");
2
+ module.exports=function($router$$){new controller($router$$,"gt_cpnvltt",function($query_req$$,$callback$$){$query_req$$=$query_req$$.query;let $id_app$$=$query_req$$.id_app,$condition$$={id_app:$id_app$$,nxt:2};$condition$$.ngay_ct={$gte:$query_req$$.tu_ngay,$lte:$query_req$$.den_ngay};$query_req$$.id_ct&&($condition$$.id_ct=$query_req$$.id_ct);$query_req$$.ma_vt&&($condition$$.ma_vt=$query_req$$.ma_vt);$condition$$.ma_sp=$query_req$$.ma_sp?$query_req$$.ma_sp:{$nin:[null,""]};$query_req$$.ma_ct&&
3
+ ($condition$$.ma_ct=$query_req$$.ma_ct.toUpperCase());$query_req$$.ma_kho&&($condition$$.ma_kho=$query_req$$.ma_kho);$query_req$$.ma_kh&&($condition$$.ma_kh=$query_req$$.ma_kh);$query_req$$.ma_nv&&($condition$$.ma_nv=$query_req$$.ma_nv);$query_req$$.tk_vt&&($condition$$.tk_vt={$regex:"^"+$query_req$$.tk_vt,$options:"i"});$query_req$$.tk_gv&&($condition$$.tk_gv={$regex:"^"+$query_req$$.tk_gv,$options:"i"});$query_req$$.tk_dt&&($condition$$.tk_dt={$regex:"^"+$query_req$$.tk_dt,$options:"i"});sokho.find($condition$$).sort({ngay_ct:1,
4
+ so_ct:1}).lean().exec(async($error$$,$report$$)=>{if($error$$)return $callback$$($error$$);$report$$.forEach($r$$=>{$r$$.sysorder=5;$r$$.bold=!1});$error$$=await $report$$.asyncGroupBy("id_ct so_ct ngay_ct ma_kho ma_bp ma_sp ma_tt1_sp".split(" "),["sl_xuat","sl_xuat_qd","tien_xuat","sl_sp"]);$error$$.forEach($r$$=>{$r$$.sysorder=1;$r$$.bold=!0;$r$$.ma_vt=$r$$.ma_sp;$r$$.ma_tt1=$r$$.ma_tt1_sp;$r$$.sl_xuat_qd=$r$$.sl_sp});$report$$=$report$$.concat($error$$);async.series({vt:$callback$$=>{$report$$.filter($r$$=>
5
+ $r$$.ma_vt).joinModel2($id_app$$,dmvt,[{where:"ma_vt",fields:["ten_vt","ma_dvt"]}],function(){$callback$$()})},kho:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_kho).joinModel2($id_app$$,dmkho,[{where:"ma_kho",fields:"ten_kho"}],function(){$callback$$()})},bp:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_bp).joinModel2($id_app$$,dmbp,[{where:"ma_bp",fields:"ten_bp"}],function(){$callback$$()})}},()=>{$report$$=$report$$.sort(($a$$,$b$$)=>{let $a_ngay_ct$$=moment($a$$.ngay_ct).format("YYYY-MM-DD"),$b_ngay_ct$$=
6
+ moment($b$$.ngay_ct).format("YYYY-MM-DD");return $a_ngay_ct$$<$b_ngay_ct$$?-1:$a_ngay_ct$$>$b_ngay_ct$$?1:$a$$.id_ct<$b$$.id_ct?-1:$a$$.id_ct>$b$$.id_ct?1:$a$$.ma_sp<$b$$.ma_sp?-1:$a$$.ma_sp>$b$$.ma_sp?1:$a$$.ma_tt1_sp<$b$$.ma_tt1_sp?-1:$a$$.ma_tt1_sp>$b$$.ma_tt1_sp?1:$a$$.sysorder<$b$$.sysorder?-1:$a$$.sysorder>$b$$.sysorder?1:0});$callback$$(null,$report$$)})})})};
@@ -0,0 +1,5 @@
1
+ const sokho=global.getModel("sokho"),dmvt=global.getModel("dmvt"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"hangbanbitralai",function($query_req$$,$callback$$){let $condition$$=$query_req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");$query_req$$={id_app:$condition$$.id_app,nxt:1,ma_ct:{$in:["HD3","HD7"]}};$query_req$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query_req$$.ma_dvcs={$regex:$condition$$.ma_dvcs,
3
+ $options:"i"});$condition$$.ma_vt&&($query_req$$.ma_vt={$regex:$condition$$.ma_vt,$options:"i"});$condition$$.ma_kho&&($query_req$$.ma_kho={$regex:$condition$$.ma_kho,$options:"i"});sokho.find($query_req$$).lean().then(function($rs$$){$rs$$.groupBy("ma_vt",[{name:"sl_nhap",value:"sl_nhap"},{name:"tien",value:"tien"},{name:"tien_ck",value:"tien_ck"},{name:"tien_nhap",value:"tien_nhap"}],function($error$$,$rs$$){if($error$$)return Logger.info($error$$),$callback$$($error$$);const $report$$=underscore.sortBy($rs$$,
4
+ function($r$$){return $r$$.ma_vt});let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=$i$$;$r$$.bold=!1;$r$$.doanh_thu=$r$$.tien-$r$$.tien_ck;$r$$.lai=$r$$.doanh_thu-$r$$.tien_nhap;$i$$++});$report$$.joinModel($condition$$.id_app,dmvt,[{akey:"ma_vt",bkey:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"},{name:"ma_dvt",value:"ma_dvt"}]}],function(){$report$$.push({ten_vt:"T\u1ed5ng c\u1ed9ng",sl_nhap:$report$$.csum("sl_nhap"),tien:$report$$.csum("tien"),tien_ck:$report$$.csum("tien_ck"),doanh_thu:$report$$.csum("doanh_thu"),
5
+ tien_nhap:$report$$.csum("tien_nhap"),lai:$report$$.csum("lai"),bold:!0});$callback$$(null,$report$$)})})}).catch($e$$=>{$callback$$($e$$)})})};
@@ -0,0 +1,3 @@
1
+ const databanle=require("../../libs/databanle"),khunghangthanhvien=global.getModel("khunghangthanhvien"),customer=global.getModel("customer"),controller=require("../../controllers/controllerRPT");
2
+ module.exports=function($router$$){new controller($router$$,"hangthanhvien",async function($req$$,$callback$$){const $condition$$=$req$$.query;let $query$$={id_app:$condition$$.id_app};$query$$.ma_kh=$condition$$.ma_kh;$query$$.ma_kh||($query$$.ma_kh=(await customer.findOne({of_user:$condition$$.user||$req$$.user.email})||{}).ma_kh);databanle($query$$,async function($error$$,$rs$$){if($error$$)return $callback$$($error$$);$error$$=$rs$$.map($r$$=>{$r$$.t_tien_hang=$r$$.details.csum("tien_hang");$r$$.t_tien_ck=
3
+ $r$$.details.csum("tien_ck");$r$$.tien_ck_hd=$r$$.tien_ck_hd?$r$$.tien_ck_hd:0;$r$$.t_tien_tl=$r$$.details_tl?$r$$.details_tl.csum("tien"):0;return $r$$.t_tien_hang-$r$$.t_tien_ck-$r$$.tien_ck_hd-$r$$.t_tien_tl}).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$error$$=await khunghangthanhvien.findOne({id_app:$condition$$.id_app,doanh_thu_tu:{$lte:$error$$},$or:[{doanh_thu_den:{$gt:$error$$}},{doanh_thu_den:null},{doanh_thu_den:0}]}).lean();$callback$$(null,$error$$)})})};
@@ -0,0 +1,5 @@
1
+ const Customer=global.getModel("customer"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),tuoinophaithu=require("../../libs/tuoinophaithu"),permission=require("../../libs/permission");
2
+ module.exports=function($router$$){new controller($router$$,"hoadonbanhangtheohantt",async function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$req$$.user.current_app_info.appAdmin){let $ma_khs$$=await new Promise($resolve$$=>{permission.getRightByItem($req$$.user.current_id_app,global.getModel("customer"),$req$$.user.email,async function($e_khs$$,$_condition$$,$admin$$){if($admin$$)return $resolve$$(null);$_condition$$.id_app=$condition$$.id_app;$condition$$.ma_kh&&($_condition$$.ma_kh=
3
+ $condition$$.ma_kh);$condition$$.nh_kh&&($_condition$$.nh_kh=$condition$$.nh_kh);$condition$$.phu_trach&&($_condition$$.phu_trach=$condition$$.phu_trach);$e_khs$$=await global.getModel("customer").find($_condition$$,{ma_kh:1}).lean();$resolve$$($e_khs$$.map($k$$=>$k$$.ma_kh))})});$condition$$.ma_kh={$in:$ma_khs$$};delete $condition$$.nh_kh;delete $condition$$.phu_trach}tuoinophaithu($condition$$,async($error$$,$report$$)=>{if($error$$)return $callback$$($error$$);await $report$$.asyncJoinModel2($condition$$.id_app,
4
+ Customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"id_kh",value:"_id"},{name:"nh_kh",value:"nh_kh"},{name:"phu_trach",value:"phu_trach"}]}]);await $report$$.filter($r$$=>$r$$.ma_nv).asyncJoinModel2($condition$$.id_app,"dmnv",[{where:"ma_nv",fields:[{name:"ten_nv",value:"ten_nv"}]}]);await $report$$.filter($r$$=>$r$$.phu_trach).asyncJoinModel2($condition$$.id_app,"participant",{where:{phu_trach:"email"},fields:{ten_phu_trach:"name"}});await $report$$.filter($r$$=>$r$$.ma_dt).asyncJoinModel2($condition$$.id_app,
5
+ "dmdt",{where:{ma_dt:"ma_dt"},fields:{ten_dt:"ten_dt"}});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.id_hd+$r$$.sysorder});$callback$$(null,$report$$)})})};
@@ -0,0 +1,5 @@
1
+ const Customer=global.getModel("customer"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),tuoinophaitra=require("../../libs/tuoinophaitra"),permission=require("../../libs/permission");
2
+ module.exports=function($router$$){new controller($router$$,"hoadonmuahangtheohantt",async function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.id_app||!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1: tu_ngay,den_ngay,id_app");if(!$req$$.user.current_app_info.appAdmin){let $ma_khs$$=await new Promise($resolve$$=>{permission.getRightByItem($req$$.user.current_id_app,global.getModel("customer"),$req$$.user.email,
3
+ async function($e_khs$$,$_condition$$,$admin$$){if($admin$$)return $resolve$$(null);$_condition$$.id_app=$condition$$.id_app;$condition$$.ma_kh&&($_condition$$.ma_kh=$condition$$.ma_kh);$condition$$.nh_kh&&($_condition$$.nh_kh=$condition$$.nh_kh);$condition$$.phu_trach&&($_condition$$.phu_trach=$condition$$.phu_trach);$e_khs$$=await global.getModel("customer").find($_condition$$,{ma_kh:1}).lean();$resolve$$($e_khs$$.map($k$$=>$k$$.ma_kh))})});$condition$$.ma_kh={$in:$ma_khs$$};delete $condition$$.nh_kh;
4
+ delete $condition$$.phu_trach}tuoinophaitra($condition$$,async($error$$,$report$$)=>{if($error$$)return $callback$$($error$$);await $report$$.asyncJoinModel2($condition$$.id_app,Customer,[{akey:"ma_kh",bkey:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"id_kh",value:"_id"},{name:"phu_trach",value:"phu_trach"}]}]);await $report$$.filter($r$$=>$r$$.ma_nv).asyncJoinModel2($condition$$.id_app,"dmnv",[{where:"ma_nv",fields:[{name:"ten_nv",value:"ten_nv"}]}]);await $report$$.filter($r$$=>$r$$.phu_trach).asyncJoinModel2($condition$$.id_app,
5
+ "participant",{where:{phu_trach:"email"},fields:{ten_phu_trach:"name"}});await $report$$.filter($r$$=>$r$$.ma_dt).asyncJoinModel2($condition$$.id_app,"dmdt",{where:{ma_dt:"ma_dt"},fields:{ten_dt:"ten_dt"}});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.id_hd+$r$$.sysorder});$callback$$(null,$report$$)})})};
@@ -0,0 +1,15 @@
1
+ const databanle=require("../../libs/databanle"),databanlenpp=require("../../libs/databanlenpp"),async=require("async"),moment=require("moment"),{kpistatus}=require("../../libs/kpistatus"),controller=require("../../controllers/controllerRPT"),_=require("lodash");
2
+ module.exports=function($router$$){new controller($router$$,"hoahong",async function($m_m$$,$callback$$){const $condition$$=$m_m$$.query;$condition$$.tu_ngay||($m_m$$=moment(),$condition$$.nam&&$m_m$$.set("year",Number($condition$$.nam)),$condition$$.thang?($m_m$$.set("month",Number($condition$$.thang)-1),$condition$$.tu_ngay=$m_m$$.startOf("month").toDate()):$condition$$.tu_ngay=$m_m$$.startOf("year").toDate());$condition$$.den_ngay||($m_m$$=moment(),$condition$$.nam&&$m_m$$.set("year",Number($condition$$.nam)),
3
+ $condition$$.thang?($m_m$$.set("month",Number($condition$$.thang)-1),$condition$$.den_ngay=$m_m$$.endOf("month").toDate()):$condition$$.den_ngay=$m_m$$.endOf("year").toDate());const $query$$={id_app:$condition$$.id_app};$query$$.ngay_ct={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.ma_dvcs&&($query$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.ma_kho&&($query$$.ma_kho=$condition$$.ma_kho);$condition$$.ma_ct&&($query$$.ma_ct=$condition$$.ma_ct);$condition$$.user_hoa_hong&&($query$$.$or=
4
+ [{user_nv:$condition$$.user_hoa_hong},{user_ctv:$condition$$.user_hoa_hong},{user_ctv2:$condition$$.user_hoa_hong},{user_kho:$condition$$.user_hoa_hong},{user_gt:$condition$$.user_hoa_hong},{user_ql:$condition$$.user_hoa_hong},{"details.user_nv":$condition$$.user_hoa_hong},{"details.user_ctv":$condition$$.user_hoa_hong},{"details.user_ctv2":$condition$$.user_hoa_hong},{"details.user_kho":$condition$$.user_hoa_hong},{"details.user_gt":$condition$$.user_hoa_hong},{"details.user_ql":$condition$$.user_hoa_hong}]);
5
+ $condition$$.ma_nv=$condition$$.ma_nv||$condition$$.user_hoa_hong;async.parallel({cty:$cb$$=>{databanle($query$$,function($error$$,$rs$$){$cb$$($error$$,$rs$$)})},npp:$cb$$=>{databanlenpp($query$$,function($error$$,$rs$$){$cb$$($error$$,$rs$$)})},kpi:$cb$$=>{let $_condition$$=_.cloneDeep($condition$$);$_condition$$.tu_thang=(new Date($_condition$$.tu_ngay)).getMonth()+1;$_condition$$.tu_nam=(new Date($_condition$$.tu_ngay)).getFullYear();$_condition$$.den_thang=(new Date($_condition$$.den_ngay)).getMonth()+
6
+ 1;$_condition$$.den_nam=(new Date($_condition$$.den_ngay)).getFullYear();if($_condition$$.tu_nam!=$_condition$$.den_nam)return $cb$$("\u0110i\u1ec1u ki\u1ec7n t\u1eeb ng\u00e0y-\u0111\u1ebfn ng\u00e0y kh\u00f4ng h\u1ee3p l\u1ec7");$_condition$$.nam=$_condition$$.den_nam;$_condition$$.ct_theo||($_condition$$.ct_theo="thang");kpistatus($_condition$$).then(async $data_rs$$=>{$data_rs$$=$data_rs$$.rows.filter($r$$=>$r$$.ma_nv);$data_rs$$.forEach($r$$=>{$r$$.t_tien_hoa_hong_kpi=$r$$.t_tien_hoa_hong||0});
7
+ await $data_rs$$.asyncJoinModel2($_condition$$.id_app,"dmnv",{where:"ma_nv",fields:[{user_hoa_hong:"user"}]});$cb$$(null,$data_rs$$)}).catch($e$$=>{$cb$$($e$$)})}},($datagop_error$$,$rs$$)=>{if($datagop_error$$)return $callback$$($datagop_error$$);$datagop_error$$=$rs$$.cty.concat($rs$$.npp);let $kpi$$=$rs$$.kpi;async.mapLimit($datagop_error$$,20,function($r$$,$callback$$){$r$$.t_tien_hoa_hong=$r$$.details.csum("tien_hoa_hong");$r$$.t_tien_hoa_hong_gt=$r$$.details.csum("tien_hoa_hong_gt");$r$$.t_tien_hoa_hong_ctv=
8
+ $r$$.details.csum("tien_hoa_hong_ctv");$r$$.t_tien_hoa_hong_ctv2=$r$$.details.csum("tien_hoa_hong_ctv2");$r$$.t_tien_hoa_hong_ql=$r$$.details.csum("tien_hoa_hong_ql");$r$$.t_tien_hoa_hong_kho=$r$$.details.csum("tien_hoa_hong_kho");$r$$.thang=(new Date($r$$.ngay_ct)).getMonth()+1;$r$$.nam=(new Date($r$$.ngay_ct)).getFullYear();$condition$$.chi_hien_chua_post_sokho?global.getModel("sokho").find({id_ct:$r$$._id}).lean().then($rs$$=>{$r$$.t_sl_xuat_kho=$rs$$.map($r$$=>$r$$.sl_xuat).reduce(($a$$,$b$$)=>
9
+ $a$$+$b$$,0);$callback$$(null,$r$$)}):$callback$$(null,$r$$)},function($data$jscomp$1_error$$,$rs$$){if($data$jscomp$1_error$$)return $callback$$($data$jscomp$1_error$$);$condition$$.chi_hien_chua_post_sokho&&($rs$$=$rs$$.filter($r$$=>!$r$$.t_sl_xuat_kho));let $data_orgin$$=[...$rs$$];$rs$$.filter($r$$=>$r$$.details_tl).forEach($tl$$=>{$tl$$.details_tl.forEach($r$$=>{$r$$.t_tien_hoa_hong=0-$r$$.tien_hoa_hong;$r$$.t_tien_hoa_hong_ql=0-$r$$.tien_hoa_hong_ql;$r$$.t_tien_hoa_hong_ctv=0-$r$$.tien_hoa_hong_ctv;
10
+ $r$$.t_tien_hoa_hong_ctv2=0-($r$$.tien_hoa_hong_ctv2||0);$r$$.t_tien_hoa_hong_gt=0-$r$$.tien_hoa_hong_gt;$r$$.t_tien_hoa_hong_kho=0-$r$$.tien_hoa_hong_kho;$r$$.thang=(new Date($tl$$.ngay_ct)).getMonth()+1;$r$$.nam=(new Date($tl$$.ngay_ct)).getFullYear();$data_orgin$$.push($r$$)})});$data$jscomp$1_error$$=$data_orgin$$.map($r$$=>{let $_r$$=[];$r$$.user_nv&&$r$$.t_tien_hoa_hong&&$_r$$.push({user_hoa_hong:$r$$.user_nv,t_tien_hoa_hong:$r$$.t_tien_hoa_hong,thang:$r$$.thang,nam:$r$$.nam});$r$$.user_ql&&
11
+ $r$$.t_tien_hoa_hong_ql&&$_r$$.push({user_hoa_hong:$r$$.user_ql,t_tien_hoa_hong:$r$$.t_tien_hoa_hong_ql,thang:$r$$.thang,nam:$r$$.nam});$r$$.user_ctv&&$r$$.t_tien_hoa_hong_ctv&&$_r$$.push({user_hoa_hong:$r$$.user_ctv,t_tien_hoa_hong:$r$$.t_tien_hoa_hong_ctv,thang:$r$$.thang,nam:$r$$.nam});$r$$.user_ctv2&&$r$$.t_tien_hoa_hong_ctv2&&$_r$$.push({user_hoa_hong:$r$$.user_ctv2,t_tien_hoa_hong:$r$$.t_tien_hoa_hong_ctv2,thang:$r$$.thang,nam:$r$$.nam});$r$$.user_kho&&$r$$.t_tien_hoa_hong_kho&&$_r$$.push({user_hoa_hong:$r$$.user_kho,
12
+ t_tien_hoa_hong:$r$$.t_tien_hoa_hong_kho,thang:$r$$.thang,nam:$r$$.nam});$r$$.user_gt&&$r$$.t_tien_hoa_hong_gt&&$_r$$.push({user_hoa_hong:$r$$.user_gt,t_tien_hoa_hong_gt:$r$$.t_tien_hoa_hong_gt,thang:$r$$.thang,nam:$r$$.nam});return $_r$$}).reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$data$jscomp$1_error$$=[...$data$jscomp$1_error$$,...$kpi$$];$condition$$.user_hoa_hong&&($data$jscomp$1_error$$=$data$jscomp$1_error$$.filter($r$$=>$r$$.user_hoa_hong==$condition$$.user_hoa_hong));$data$jscomp$1_error$$=
13
+ $data$jscomp$1_error$$.filter($r$$=>$r$$.t_tien_hoa_hong||$r$$.t_tien_hoa_hong_gt||$r$$.t_tien_hoa_hong_kpi);$data$jscomp$1_error$$.groupBy(["thang","nam","user_hoa_hong"],[{name:"t_tien_hoa_hong",value:"t_tien_hoa_hong"},{name:"t_tien_hoa_hong",value:"t_tien_hoa_hong"},{name:"t_tien_hoa_hong_gt",value:"t_tien_hoa_hong_gt"},{name:"t_tien_hoa_hong_kpi",value:"t_tien_hoa_hong_kpi"}],async function($error$$,$report$$){if($error$$)return $callback$$($error$$);await $report$$.asyncJoinModel2($condition$$.id_app,
14
+ "participant",{where:{user_hoa_hong:"email"},fields:{ten_user_hoa_hong:"name"}});$report$$=$report$$.sort(($a$$,$b$$)=>$a$$.nam*12+$a$$.thang-($b$$.nam*12+$b$$.thang));$report$$.forEach(function($r$$,$i$$){$r$$.stt=$i$$+1;$r$$.bold=!1;$r$$.t_cong=$r$$.t_tien_hoa_hong+$r$$.t_tien_hoa_hong_gt+$r$$.t_tien_hoa_hong_kpi});$error$$=$report$$.csum("t_tien_hoa_hong");let $t_tien_hoa_hong_gt$$=$report$$.csum("t_tien_hoa_hong_gt"),$t_tien_hoa_hong_kpi$$=$report$$.csum("t_tien_hoa_hong_kpi");$report$$.push({nam:"T\u1ed5ng c\u1ed9ng",
15
+ t_tien_hoa_hong:$error$$,t_tien_hoa_hong_gt:$t_tien_hoa_hong_gt$$,t_tien_hoa_hong_kpi:$t_tien_hoa_hong_kpi$$,t_cong:$error$$+$t_tien_hoa_hong_gt$$+$t_tien_hoa_hong_kpi$$,bold:!0});$callback$$(null,$report$$)})})})})};