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.
- package/package.json +5 -5
- package/server/app.js +23 -348
- package/server/cluster.js +1 -5
- package/server/models/account.js +7 -0
- package/server/models/actionLog.js +2 -0
- package/server/models/afflink.js +2 -0
- package/server/models/aimemory.js +1 -0
- package/server/models/app.js +16 -0
- package/server/models/approve.js +95 -0
- package/server/models/assabcihandler.js +35 -0
- package/server/models/assbank.js +19 -0
- package/server/models/assbooking.js +4 -0
- package/server/models/assbuy.js +3 -0
- package/server/models/asscashwithdraw.js +4 -0
- package/server/models/assfindhash.js +2 -0
- package/server/models/assinvestment.js +13 -0
- package/server/models/assissue.js +2 -0
- package/server/models/asskey.js +15 -0
- package/server/models/assneedtobuy.js +6 -0
- package/server/models/assperiod.js +7 -0
- package/server/models/assproduct.js +13 -0
- package/server/models/assprofitsharing.js +4 -0
- package/server/models/assreceiver.js +2 -0
- package/server/models/assrequest.js +10 -0
- package/server/models/asssell.js +7 -0
- package/server/models/asstransaction.js +3 -0
- package/server/models/asstransfer.js +4 -0
- package/server/models/assuser_identity.js +4 -0
- package/server/models/asswithdraw.js +4 -0
- package/server/models/attend.js +2 -0
- package/server/models/banggiaban.js +8 -0
- package/server/models/bangtinhluong.js +6 -0
- package/server/models/base.js +1 -0
- package/server/models/bg1.js +9 -0
- package/server/models/bg2.js +10 -0
- package/server/models/cache.js +3 -0
- package/server/models/cacheDataReport.js +2 -0
- package/server/models/cacheSessionReport.js +5 -0
- package/server/models/calllog.js +4 -0
- package/server/models/cart.js +5 -0
- package/server/models/cddiem.js +2 -0
- package/server/models/cddt.js +3 -0
- package/server/models/cdkh.js +5 -0
- package/server/models/cdkhtheongay.js +5 -0
- package/server/models/cdnphep.js +2 -0
- package/server/models/cdtk.js +3 -0
- package/server/models/cdtktheongay.js +3 -0
- package/server/models/cdvt.js +5 -0
- package/server/models/cdvtnpp.js +6 -0
- package/server/models/cdvttheongay.js +5 -0
- package/server/models/chamcong.js +7 -0
- package/server/models/chat_message.js +2 -0
- package/server/models/chat_session.js +2 -0
- package/server/models/checkin.js +4 -0
- package/server/models/checkinactivity.js +3 -0
- package/server/models/checkinkpi.js +4 -0
- package/server/models/checkinlocation.js +2 -0
- package/server/models/chitietluongds.js +12 -0
- package/server/models/chitieukpi.js +3 -0
- package/server/models/chudethaoluan.js +3 -0
- package/server/models/ckgtluong.js +2 -0
- package/server/models/colleague.js +2 -0
- package/server/models/comment.js +4 -0
- package/server/models/congdoansx.js +4 -0
- package/server/models/congtacvien.js +4 -0
- package/server/models/congthuctinhgiaban.js +8 -0
- package/server/models/consultant.js +4 -0
- package/server/models/contract.js +6 -0
- package/server/models/counter.js +2 -0
- package/server/models/csluongtheods.js +3 -0
- package/server/models/csphucap.js +2 -0
- package/server/models/ctds.js +5 -0
- package/server/models/ctds2.js +7 -0
- package/server/models/currency.js +3 -0
- package/server/models/custom_report.js +1 -0
- package/server/models/customer.js +31 -0
- package/server/models/customer_care.js +2 -0
- package/server/models/data_list_config.js +7 -0
- package/server/models/databanle.js +8 -0
- package/server/models/datlich.js +4 -0
- package/server/models/deal.js +2 -0
- package/server/models/dh2.js +20 -0
- package/server/models/diagram.js +2 -0
- package/server/models/dinhmucsx.js +8 -0
- package/server/models/dkhoc.js +6 -0
- package/server/models/dknphep.js +2 -0
- package/server/models/dmban.js +4 -0
- package/server/models/dmbp.js +12 -0
- package/server/models/dmca.js +2 -0
- package/server/models/dmchietkhau.js +8 -0
- package/server/models/dmchietkhauhd.js +19 -0
- package/server/models/dmchinhanh.js +2 -0
- package/server/models/dmcpmh.js +2 -0
- package/server/models/dmdiemthuong.js +3 -0
- package/server/models/dmdoi.js +4 -0
- package/server/models/dmdoituongdanhgia.js +2 -0
- package/server/models/dmdt.js +8 -0
- package/server/models/dmdvt.js +3 -0
- package/server/models/dmgiaban.js +9 -0
- package/server/models/dmgiamua.js +5 -0
- package/server/models/dmgiathitruong.js +5 -0
- package/server/models/dmgiathitruong_ngay.js +2 -0
- package/server/models/dmgiathitruong_theodoi.js +2 -0
- package/server/models/dmhoahonghd.js +8 -0
- package/server/models/dmhoahongnpp.js +8 -0
- package/server/models/dmkc.js +3 -0
- package/server/models/dmkho.js +7 -0
- package/server/models/dmkhuyenmai.js +9 -0
- package/server/models/dmkhuyenmaihd.js +11 -0
- package/server/models/dmletet.js +2 -0
- package/server/models/dmlo.js +4 -0
- package/server/models/dmloaicong.js +4 -0
- package/server/models/dmloaitask.js +2 -0
- package/server/models/dmloaits.js +2 -0
- package/server/models/dmnckkm.js +4 -0
- package/server/models/dmnghiepvu.js +4 -0
- package/server/models/dmnguonvon.js +2 -0
- package/server/models/dmnhnv.js +4 -0
- package/server/models/dmnv.js +17 -0
- package/server/models/dmnvt.js +10 -0
- package/server/models/dmphi.js +3 -0
- package/server/models/dmqct.js +3 -0
- package/server/models/dmqddvt.js +3 -0
- package/server/models/dmtanggiamts.js +3 -0
- package/server/models/dmto.js +4 -0
- package/server/models/dmtt.js +6 -0
- package/server/models/dmvt.js +17 -0
- package/server/models/dmyt.js +4 -0
- package/server/models/dn0.js +13 -0
- package/server/models/dnm.js +11 -0
- package/server/models/dokho.js +2 -0
- package/server/models/domain.js +2 -0
- package/server/models/dvcs.js +3 -0
- package/server/models/ecomcategories.js +3 -0
- package/server/models/ecomcategories_cty.js +3 -0
- package/server/models/ecomproductlines.js +2 -0
- package/server/models/ecompromotion_flashsales.js +2 -0
- package/server/models/ecompromotion_freeships.js +2 -0
- package/server/models/email.js +2 -0
- package/server/models/endpoint.js +1 -0
- package/server/models/events.js +3 -0
- package/server/models/evoucher.js +5 -0
- package/server/models/experiencejourney.js +2 -0
- package/server/models/experiencejourneydata.js +4 -0
- package/server/models/experiencejourneypersona.js +3 -0
- package/server/models/experiencejourneystage.js +2 -0
- package/server/models/exportexceltemplate.js +2 -0
- package/server/models/fbconversation.js +15 -0
- package/server/models/fbmessage.js +2 -0
- package/server/models/fbpage.js +2 -0
- package/server/models/fbpost.js +2 -0
- package/server/models/fieldright.js +2 -0
- package/server/models/fifo_dk.js +2 -0
- package/server/models/fifo_lot.js +3 -0
- package/server/models/fifo_trace.js +4 -0
- package/server/models/file.js +4 -0
- package/server/models/filechunk.js +2 -0
- package/server/models/financialroadmap.js +3 -0
- package/server/models/flow.js +2 -0
- package/server/models/flowdata.js +3 -0
- package/server/models/flowpending.js +2 -0
- package/server/models/folder.js +4 -0
- package/server/models/follow.js +2 -0
- package/server/models/forminfo.js +5 -0
- package/server/models/giaoca.js +4 -0
- package/server/models/giatb.js +3 -0
- package/server/models/group.js +9 -0
- package/server/models/gt_ctgt.js +4 -0
- package/server/models/gt_hspb.js +3 -0
- package/server/models/gt_sltk.js +3 -0
- package/server/models/gt_thcppstk.js +3 -0
- package/server/models/hanmucton.js +4 -0
- package/server/models/hd1.js +11 -0
- package/server/models/hd2.js +26 -0
- package/server/models/hd3.js +17 -0
- package/server/models/hd4.js +13 -0
- package/server/models/hd7.js +17 -0
- package/server/models/hd8.js +12 -0
- package/server/models/hde.js +11 -0
- package/server/models/hmcn.js +3 -0
- package/server/models/hmcnct.js +2 -0
- package/server/models/hspbts.js +4 -0
- package/server/models/htl.js +13 -0
- package/server/models/importexceltemplate.js +2 -0
- package/server/models/introducebonus.js +4 -0
- package/server/models/introducecode.js +3 -0
- package/server/models/introducer.js +4 -0
- package/server/models/kbbtpb.js +7 -0
- package/server/models/kbmPttct.js +4 -0
- package/server/models/kbmTkgtgt.js +5 -0
- package/server/models/kbm_bcdkt_old.js +4 -0
- package/server/models/kbm_kqhdkd_old.js +3 -0
- package/server/models/kbm_lcttgt_old.js +5 -0
- package/server/models/kbm_lctttt_old.js +4 -0
- package/server/models/kbm_pttct_old.js +4 -0
- package/server/models/kbm_tkgtgt_old.js +5 -0
- package/server/models/kbmbcdkt.js +4 -0
- package/server/models/kbmbcqt.js +4 -0
- package/server/models/kbmkqhdkd.js +3 -0
- package/server/models/kbmlcttgt.js +6 -0
- package/server/models/kbmlctttt.js +4 -0
- package/server/models/kbmtmbctc.js +4 -0
- package/server/models/kehoachdtcp.js +3 -0
- package/server/models/kehoachmh.js +8 -0
- package/server/models/keyresult.js +7 -0
- package/server/models/khunghangthanhvien.js +3 -0
- package/server/models/label.js +2 -0
- package/server/models/labelinfo.js +2 -0
- package/server/models/lenhcapphat.js +8 -0
- package/server/models/lenhsx.js +8 -0
- package/server/models/lienhe.js +4 -0
- package/server/models/like_module.js +2 -0
- package/server/models/link.js +2 -0
- package/server/models/listinfo.js +1365 -0
- package/server/models/loaidiem.js +2 -0
- package/server/models/lock.js +2 -0
- package/server/models/log.js +8 -0
- package/server/models/mailaccount.js +3 -0
- package/server/models/mailgroup.js +3 -0
- package/server/models/mailreceived.js +2 -0
- package/server/models/mailsent.js +2 -0
- package/server/models/mailtemplate.js +2 -0
- package/server/models/maudanhgia.js +2 -0
- package/server/models/menuinfo.js +2 -0
- package/server/models/message.js +8 -0
- package/server/models/message2.js +4 -0
- package/server/models/message2setting.js +3 -0
- package/server/models/moduleinfo.js +4 -0
- package/server/models/momo.js +18 -0
- package/server/models/news.js +3 -0
- package/server/models/newsfeed.js +4 -0
- package/server/models/note.js +2 -0
- package/server/models/notification.js +8 -0
- package/server/models/okr.js +4 -0
- package/server/models/okrdiagram.js +3 -0
- package/server/models/onepay.js +24 -0
- package/server/models/opportunity.js +4 -0
- package/server/models/options.js +2 -0
- package/server/models/originimportid.js +1 -0
- package/server/models/otp.js +1 -0
- package/server/models/parameter.js +2 -0
- package/server/models/participant.js +21 -0
- package/server/models/partner.js +1 -0
- package/server/models/payload.js +1 -0
- package/server/models/pbl.js +16 -0
- package/server/models/pc0.js +13 -0
- package/server/models/pc1.js +14 -0
- package/server/models/pc2.js +13 -0
- package/server/models/pc3.js +13 -0
- package/server/models/pc5.js +8 -0
- package/server/models/pc6.js +14 -0
- package/server/models/pcl.js +6 -0
- package/server/models/pdn.js +9 -0
- package/server/models/pdx.js +9 -0
- package/server/models/pgh.js +5 -0
- package/server/models/phieudanhgia.js +3 -0
- package/server/models/pht.js +8 -0
- package/server/models/phucap.js +4 -0
- package/server/models/pkc.js +6 -0
- package/server/models/pkh.js +6 -0
- package/server/models/pkk.js +10 -0
- package/server/models/pkt.js +12 -0
- package/server/models/pn1.js +18 -0
- package/server/models/pn2.js +12 -0
- package/server/models/pn3.js +13 -0
- package/server/models/pn5.js +14 -0
- package/server/models/pn6.js +14 -0
- package/server/models/pn9.js +17 -0
- package/server/models/pnc.js +9 -0
- package/server/models/pnh.js +11 -0
- package/server/models/pnk.js +10 -0
- package/server/models/po1.js +19 -0
- package/server/models/ppb.js +6 -0
- package/server/models/productcode.js +2 -0
- package/server/models/profile.js +4 -0
- package/server/models/pt1.js +12 -0
- package/server/models/pt5.js +8 -0
- package/server/models/ptl.js +5 -0
- package/server/models/ptthanhtoan.js +6 -0
- package/server/models/purchase_contract.js +17 -0
- package/server/models/pxc.js +9 -0
- package/server/models/pxh.js +11 -0
- package/server/models/pxk.js +9 -0
- package/server/models/qts.js +14 -0
- package/server/models/qts_dieuchinh.js +3 -0
- package/server/models/qts_dieuchuyen.js +4 -0
- package/server/models/quanhuyen.js +2 -0
- package/server/models/reason.js +2 -0
- package/server/models/receivedinvoice.js +2 -0
- package/server/models/reportinfo.js +5 -0
- package/server/models/right.js +4 -0
- package/server/models/rpt.js +2 -0
- package/server/models/rptform.js +3 -0
- package/server/models/rptobject.js +2 -0
- package/server/models/sale_contract.js +9 -0
- package/server/models/schedule.js +18 -0
- package/server/models/schedule_log.js +2 -0
- package/server/models/shipbook.js +12 -0
- package/server/models/shortcut.js +2 -0
- package/server/models/smsaccount.js +10 -0
- package/server/models/smssend.js +2 -0
- package/server/models/so1.js +22 -0
- package/server/models/so5.js +15 -0
- package/server/models/so9.js +19 -0
- package/server/models/socai.js +28 -0
- package/server/models/socainpp.js +18 -0
- package/server/models/socaitc.js +6 -0
- package/server/models/socaitmp.js +16 -0
- package/server/models/socaitt.js +4 -0
- package/server/models/sodiemthuong.js +4 -0
- package/server/models/sokho.js +27 -0
- package/server/models/sokhocapphat.js +18 -0
- package/server/models/sokhokhongton.js +19 -0
- package/server/models/sokhonpp.js +19 -0
- package/server/models/sokhotc.js +8 -0
- package/server/models/sokhott.js +18 -0
- package/server/models/sophanbokh.js +3 -0
- package/server/models/sosanxuat.js +5 -0
- package/server/models/sotinhkh.js +2 -0
- package/server/models/spdd_ck.js +3 -0
- package/server/models/spdd_dk.js +3 -0
- package/server/models/step.js +2 -0
- package/server/models/strategicdiagram.js +3 -0
- package/server/models/strategicgoal.js +4 -0
- package/server/models/strategickpi.js +6 -0
- package/server/models/strategicobjective.js +5 -0
- package/server/models/strategicplan.js +5 -0
- package/server/models/subscribe.js +2 -0
- package/server/models/support.js +2 -0
- package/server/models/synctime.js +2 -0
- package/server/models/sys_job_queue_book_keeping.js +2 -0
- package/server/models/sysconfig.js +2 -0
- package/server/models/sysgroup.js +2 -0
- package/server/models/tableinfo.js +3 -0
- package/server/models/task.js +9 -0
- package/server/models/tc.js +2 -0
- package/server/models/tdttco.js +9 -0
- package/server/models/tdttco_tt.js +5 -0
- package/server/models/tdttno.js +9 -0
- package/server/models/tdttno_tt.js +5 -0
- package/server/models/templaterpt.js +2 -0
- package/server/models/templatestore.js +3 -0
- package/server/models/templatevoucher.js +3 -0
- package/server/models/tinhthanh.js +2 -0
- package/server/models/tokens.js +3 -0
- package/server/models/tontucthoi.js +9 -0
- package/server/models/trangthai.js +4 -0
- package/server/models/trangthaiapp.js +4 -0
- package/server/models/transaction.js +16 -0
- package/server/models/trialinfo.js +2 -0
- package/server/models/user.js +40 -0
- package/server/models/usergroup.js +7 -0
- package/server/models/vanchuyen.js +12 -0
- package/server/models/vat.js +3 -0
- package/server/models/vatra.js +6 -0
- package/server/models/vatvao.js +6 -0
- package/server/models/versioninfo.js +2 -0
- package/server/models/vietqrbanks.js +2 -0
- package/server/models/vsocai.js +6 -0
- package/server/models/wallet.js +8 -0
- package/server/models/warranty.js +3 -0
- package/server/models/warrantyclaim.js +2 -0
- package/server/models/warrantypolicy.js +1 -0
- package/server/models/workflow.js +4 -0
- package/server/models/xaphuong.js +2 -0
- package/server/models/xhd.js +10 -0
- package/server/models/ytdd_ck.js +4 -0
- package/server/models/ytdd_dk.js +4 -0
- package/server/models/zalo.js +17 -0
- package/server/modules/lists/bg-cddiem.js +6 -0
- package/server/modules/lists/bg-cddt.js +7 -0
- package/server/modules/lists/bg-cdkh.js +11 -0
- package/server/modules/lists/bg-cdnphep.js +6 -0
- package/server/modules/lists/bg-cdtk.js +9 -0
- package/server/modules/lists/bg-cdvt.js +8 -0
- package/server/modules/lists/bg-cdvtnpp.js +8 -0
- package/server/modules/lists/bg-fifo_dk.js +8 -0
- package/server/modules/lists/ls-account.js +4 -0
- package/server/modules/lists/ls-afflink.js +3 -0
- package/server/modules/lists/ls-approve.js +5 -0
- package/server/modules/lists/ls-assabcihandler.js +3 -0
- package/server/modules/lists/ls-assbank.js +3 -0
- package/server/modules/lists/ls-assbooking.js +20 -0
- package/server/modules/lists/ls-assbuy.js +8 -0
- package/server/modules/lists/ls-asscashwithdraw.js +8 -0
- package/server/modules/lists/ls-assinvestment.js +31 -0
- package/server/modules/lists/ls-assissue.js +3 -0
- package/server/modules/lists/ls-asskey.js +41 -0
- package/server/modules/lists/ls-assneedtobuy.js +10 -0
- package/server/modules/lists/ls-assperiod.js +19 -0
- package/server/modules/lists/ls-assproduct.js +9 -0
- package/server/modules/lists/ls-assprofitsharing.js +8 -0
- package/server/modules/lists/ls-assreceiver.js +3 -0
- package/server/modules/lists/ls-assrequest.js +4 -0
- package/server/modules/lists/ls-asssell.js +13 -0
- package/server/modules/lists/ls-asstransaction.js +3 -0
- package/server/modules/lists/ls-asstransfer.js +3 -0
- package/server/modules/lists/ls-assuser_identity.js +1 -0
- package/server/modules/lists/ls-asswithdraw.js +12 -0
- package/server/modules/lists/ls-bangtinhluong.js +2 -0
- package/server/modules/lists/ls-calllog.js +4 -0
- package/server/modules/lists/ls-cart.js +14 -0
- package/server/modules/lists/ls-chamcong.js +3 -0
- package/server/modules/lists/ls-chat_session.js +5 -0
- package/server/modules/lists/ls-checkin.js +24 -0
- package/server/modules/lists/ls-checkinactivity.js +8 -0
- package/server/modules/lists/ls-checkinkpi.js +3 -0
- package/server/modules/lists/ls-checkinlocation.js +1 -0
- package/server/modules/lists/ls-chitietluongds.js +4 -0
- package/server/modules/lists/ls-chitieukpi.js +1 -0
- package/server/modules/lists/ls-chudethaoluan.js +1 -0
- package/server/modules/lists/ls-ckgtluong.js +1 -0
- package/server/modules/lists/ls-comment.js +9 -0
- package/server/modules/lists/ls-congdoansx.js +3 -0
- package/server/modules/lists/ls-congtacvien.js +5 -0
- package/server/modules/lists/ls-consultant.js +2 -0
- package/server/modules/lists/ls-contract.js +7 -0
- package/server/modules/lists/ls-csluongtheods.js +1 -0
- package/server/modules/lists/ls-csphucap.js +1 -0
- package/server/modules/lists/ls-ctds.js +4 -0
- package/server/modules/lists/ls-ctds2.js +4 -0
- package/server/modules/lists/ls-currency.js +1 -0
- package/server/modules/lists/ls-customer.js +22 -0
- package/server/modules/lists/ls-customer_care.js +1 -0
- package/server/modules/lists/ls-datlich.js +9 -0
- package/server/modules/lists/ls-dckhauhaots.js +3 -0
- package/server/modules/lists/ls-deal.js +3 -0
- package/server/modules/lists/ls-diagram.js +1 -0
- package/server/modules/lists/ls-dkhoc.js +6 -0
- package/server/modules/lists/ls-dknphep.js +1 -0
- package/server/modules/lists/ls-dmban.js +4 -0
- package/server/modules/lists/ls-dmbp.js +7 -0
- package/server/modules/lists/ls-dmca.js +1 -0
- package/server/modules/lists/ls-dmchietkhau.js +19 -0
- package/server/modules/lists/ls-dmchietkhauhd.js +4 -0
- package/server/modules/lists/ls-dmchinhanh.js +1 -0
- package/server/modules/lists/ls-dmchucvu.js +2 -0
- package/server/modules/lists/ls-dmcpmh.js +1 -0
- package/server/modules/lists/ls-dmdiemthuong.js +4 -0
- package/server/modules/lists/ls-dmdoi.js +4 -0
- package/server/modules/lists/ls-dmdoituongdanhgia.js +1 -0
- package/server/modules/lists/ls-dmdt.js +11 -0
- package/server/modules/lists/ls-dmdvt.js +2 -0
- package/server/modules/lists/ls-dmgiaban.js +4 -0
- package/server/modules/lists/ls-dmgiamua.js +4 -0
- package/server/modules/lists/ls-dmgiathitruong.js +15 -0
- package/server/modules/lists/ls-dmgiathitruong_ngay.js +2 -0
- package/server/modules/lists/ls-dmgiathitruong_theodoi.js +1 -0
- package/server/modules/lists/ls-dmhoahonghd.js +1 -0
- package/server/modules/lists/ls-dmhoahongnpp.js +1 -0
- package/server/modules/lists/ls-dmkc.js +3 -0
- package/server/modules/lists/ls-dmkho.js +7 -0
- package/server/modules/lists/ls-dmkhuyenmai.js +5 -0
- package/server/modules/lists/ls-dmkhuyenmaihd.js +3 -0
- package/server/modules/lists/ls-dmletet.js +1 -0
- package/server/modules/lists/ls-dmlo.js +1 -0
- package/server/modules/lists/ls-dmloaicong.js +1 -0
- package/server/modules/lists/ls-dmloaits.js +1 -0
- package/server/modules/lists/ls-dmnckkm.js +7 -0
- package/server/modules/lists/ls-dmnghiepvu.js +1 -0
- package/server/modules/lists/ls-dmnguonvon.js +1 -0
- package/server/modules/lists/ls-dmnhnv.js +6 -0
- package/server/modules/lists/ls-dmnhtask.js +5 -0
- package/server/modules/lists/ls-dmnkh.js +6 -0
- package/server/modules/lists/ls-dmntt.js +6 -0
- package/server/modules/lists/ls-dmnv.js +14 -0
- package/server/modules/lists/ls-dmnvt.js +7 -0
- package/server/modules/lists/ls-dmphi.js +6 -0
- package/server/modules/lists/ls-dmqct.js +2 -0
- package/server/modules/lists/ls-dmqddvt.js +3 -0
- package/server/modules/lists/ls-dmtanggiamts.js +1 -0
- package/server/modules/lists/ls-dmto.js +5 -0
- package/server/modules/lists/ls-dmtt.js +7 -0
- package/server/modules/lists/ls-dmvt.js +52 -0
- package/server/modules/lists/ls-dmyt.js +1 -0
- package/server/modules/lists/ls-dokho.js +1 -0
- package/server/modules/lists/ls-dvcs.js +1 -0
- package/server/modules/lists/ls-ecomcategories.js +5 -0
- package/server/modules/lists/ls-ecomcategories_cty.js +5 -0
- package/server/modules/lists/ls-email.js +4 -0
- package/server/modules/lists/ls-events.js +3 -0
- package/server/modules/lists/ls-evoucher.js +3 -0
- package/server/modules/lists/ls-experiencejourney.js +1 -0
- package/server/modules/lists/ls-experiencejourneydata.js +3 -0
- package/server/modules/lists/ls-experiencejourneypersona.js +4 -0
- package/server/modules/lists/ls-experiencejourneystage.js +1 -0
- package/server/modules/lists/ls-fbconversation.js +2 -0
- package/server/modules/lists/ls-fbmessage.js +2 -0
- package/server/modules/lists/ls-fbpage.js +11 -0
- package/server/modules/lists/ls-fbpost.js +2 -0
- package/server/modules/lists/ls-file.js +38 -0
- package/server/modules/lists/ls-financialroadmap.js +3 -0
- package/server/modules/lists/ls-flow.js +6 -0
- package/server/modules/lists/ls-flowdata.js +1 -0
- package/server/modules/lists/ls-flowpending.js +3 -0
- package/server/modules/lists/ls-folder.js +1 -0
- package/server/modules/lists/ls-forminfo.js +1 -0
- package/server/modules/lists/ls-giaoca.js +5 -0
- package/server/modules/lists/ls-group.js +5 -0
- package/server/modules/lists/ls-hmcn.js +2 -0
- package/server/modules/lists/ls-hspbts.js +3 -0
- package/server/modules/lists/ls-introducebonus.js +4 -0
- package/server/modules/lists/ls-introducecode.js +10 -0
- package/server/modules/lists/ls-introducer.js +21 -0
- package/server/modules/lists/ls-kbm-bcdkt.js +1 -0
- package/server/modules/lists/ls-kbm-bcqt.js +5 -0
- package/server/modules/lists/ls-kbm-kqhdkd.js +1 -0
- package/server/modules/lists/ls-kbm-lcttgt.js +1 -0
- package/server/modules/lists/ls-kbm-lctttt.js +1 -0
- package/server/modules/lists/ls-kbm-pttct.js +3 -0
- package/server/modules/lists/ls-kbm-tkgtgt.js +3 -0
- package/server/modules/lists/ls-kbm-tmbctc.js +3 -0
- package/server/modules/lists/ls-kehoachdtcp.js +4 -0
- package/server/modules/lists/ls-keyresult.js +7 -0
- package/server/modules/lists/ls-khunghangthanhvien.js +1 -0
- package/server/modules/lists/ls-label.js +1 -0
- package/server/modules/lists/ls-lienhe.js +4 -0
- package/server/modules/lists/ls-like-module.js +1 -0
- package/server/modules/lists/ls-link.js +1 -0
- package/server/modules/lists/ls-loaidiem.js +1 -0
- package/server/modules/lists/ls-lock.js +1 -0
- package/server/modules/lists/ls-log.js +3 -0
- package/server/modules/lists/ls-mailaccount.js +5 -0
- package/server/modules/lists/ls-mailreceived.js +5 -0
- package/server/modules/lists/ls-mailsent.js +4 -0
- package/server/modules/lists/ls-mailtemplate.js +4 -0
- package/server/modules/lists/ls-maudanhgia.js +3 -0
- package/server/modules/lists/ls-message2.js +8 -0
- package/server/modules/lists/ls-message2setting.js +5 -0
- package/server/modules/lists/ls-news.js +7 -0
- package/server/modules/lists/ls-newsfeed.js +4 -0
- package/server/modules/lists/ls-note.js +6 -0
- package/server/modules/lists/ls-okr.js +5 -0
- package/server/modules/lists/ls-okrdiagram.js +1 -0
- package/server/modules/lists/ls-opportunity.js +5 -0
- package/server/modules/lists/ls-options.js +4 -0
- package/server/modules/lists/ls-parameter.js +3 -0
- package/server/modules/lists/ls-participant.js +12 -0
- package/server/modules/lists/ls-phieudanhgia.js +7 -0
- package/server/modules/lists/ls-phucap.js +2 -0
- package/server/modules/lists/ls-productcode.js +9 -0
- package/server/modules/lists/ls-profile.js +1 -0
- package/server/modules/lists/ls-ptthanhtoan.js +3 -0
- package/server/modules/lists/ls-qts-dieuchinh.js +2 -0
- package/server/modules/lists/ls-qts-dieuchuyen.js +8 -0
- package/server/modules/lists/ls-reason.js +1 -0
- package/server/modules/lists/ls-rpt.js +5 -0
- package/server/modules/lists/ls-rptform.js +3 -0
- package/server/modules/lists/ls-shortcut.js +1 -0
- package/server/modules/lists/ls-smsaccount.js +1 -0
- package/server/modules/lists/ls-smssend.js +3 -0
- package/server/modules/lists/ls-sosanxuat.js +4 -0
- package/server/modules/lists/ls-step.js +1 -0
- package/server/modules/lists/ls-strategicdiagram.js +1 -0
- package/server/modules/lists/ls-strategicgoal.js +3 -0
- package/server/modules/lists/ls-strategickpi.js +7 -0
- package/server/modules/lists/ls-strategicobjective.js +3 -0
- package/server/modules/lists/ls-strategicplan.js +6 -0
- package/server/modules/lists/ls-support.js +3 -0
- package/server/modules/lists/ls-task.js +28 -0
- package/server/modules/lists/ls-tc.js +1 -0
- package/server/modules/lists/ls-templaterpt.js +5 -0
- package/server/modules/lists/ls-templatevoucher.js +1 -0
- package/server/modules/lists/ls-tontucthoi.js +3 -0
- package/server/modules/lists/ls-trangthaiapp.js +3 -0
- package/server/modules/lists/ls-transaction.js +4 -0
- package/server/modules/lists/ls-usergroup.js +7 -0
- package/server/modules/lists/ls-vat.js +1 -0
- package/server/modules/lists/ls-vatra.js +5 -0
- package/server/modules/lists/ls-vatvao.js +6 -0
- package/server/modules/lists/ls-warranty.js +3 -0
- package/server/modules/lists/ls-workflow.js +1 -0
- package/server/modules/lists/ls_hanmucton.js +3 -0
- package/server/modules/lists/ls_hspb.js +4 -0
- package/server/modules/lists/ls_spdd_ck.js +3 -0
- package/server/modules/lists/ls_spdd_dk.js +3 -0
- package/server/modules/lists/ls_ytdd_ck.js +4 -0
- package/server/modules/lists/ls_ytdd_dk.js +4 -0
- package/server/modules/lists/sys-attend.js +4 -0
- package/server/modules/lists/sys-follow.js +4 -0
- package/server/modules/lists/sys-right.js +2 -0
- package/server/modules/public/app.js +4 -0
- package/server/modules/public/approve.js +37 -0
- package/server/modules/public/callin.js +7 -0
- package/server/modules/public/comment.js +5 -0
- package/server/modules/public/dmnvt.js +4 -0
- package/server/modules/public/dmvt.js +9 -0
- package/server/modules/public/file.js +11 -0
- package/server/modules/public/forminfo.js +1 -0
- package/server/modules/public/group.js +4 -0
- package/server/modules/public/introducecode.js +1 -0
- package/server/modules/public/listinfo.js +1 -0
- package/server/modules/public/media-webhook.js +1 -0
- package/server/modules/public/partner.js +1 -0
- package/server/modules/public/paymentCallback.js +32 -0
- package/server/modules/public/province.js +1 -0
- package/server/modules/public/ptthanhtoan.js +4 -0
- package/server/modules/public/subscribe.js +30 -0
- package/server/modules/public/support.js +3 -0
- package/server/modules/public/tableinfo.js +1 -0
- package/server/modules/public/trialinfo.js +4 -0
- package/server/modules/public/versioninfo.js +1 -0
- package/server/modules/reports/calc-tinhgiafifo.js +8 -0
- package/server/modules/reports/calc-tinhgiatb.js +7 -0
- package/server/modules/reports/calc-tinhgiathanh.js +7 -0
- package/server/modules/reports/calc-tinhkhauhaots.js +3 -0
- package/server/modules/reports/calc-tinhluong.js +68 -0
- package/server/modules/reports/rp-analyzedata.js +6 -0
- package/server/modules/reports/rp-assbonus.js +4 -0
- package/server/modules/reports/rp-assinterest.js +8 -0
- package/server/modules/reports/rp-assproductowners.js +3 -0
- package/server/modules/reports/rp-asssupply.js +1 -0
- package/server/modules/reports/rp-asstransferlog.js +10 -0
- package/server/modules/reports/rp-backup.js +4 -0
- package/server/modules/reports/rp-banggiatb.js +3 -0
- package/server/modules/reports/rp-bangtinhkhauhao.js +6 -0
- package/server/modules/reports/rp-baoCaoFifoKy.js +1 -0
- package/server/modules/reports/rp-baocaokhachhang.js +6 -0
- package/server/modules/reports/rp-bcdkt.js +11 -0
- package/server/modules/reports/rp-bcintroducebonus.js +4 -0
- package/server/modules/reports/rp-bckhtiemnang.js +3 -0
- package/server/modules/reports/rp-bcqt.js +85 -0
- package/server/modules/reports/rp-bkchamcong.js +5 -0
- package/server/modules/reports/rp-bkct.js +13 -0
- package/server/modules/reports/rp-bkshipbook.js +8 -0
- package/server/modules/reports/rp-bkvanchuyen.js +8 -0
- package/server/modules/reports/rp-bkvatra.js +7 -0
- package/server/modules/reports/rp-bkvatvao.js +7 -0
- package/server/modules/reports/rp-capnhatsocaitc.js +4 -0
- package/server/modules/reports/rp-cdpsdiem.js +4 -0
- package/server/modules/reports/rp-cdpsdt.js +5 -0
- package/server/modules/reports/rp-cdpskh.js +8 -0
- package/server/modules/reports/rp-cdpsnphep.js +3 -0
- package/server/modules/reports/rp-cdpstk.js +4 -0
- package/server/modules/reports/rp-chitietchitientheohoadon.js +12 -0
- package/server/modules/reports/rp-chitiettaisan.js +13 -0
- package/server/modules/reports/rp-chitietthutientheohoadon.js +13 -0
- package/server/modules/reports/rp-ckcn.js +3 -0
- package/server/modules/reports/rp-ckdiem.js +2 -0
- package/server/modules/reports/rp-cktk.js +3 -0
- package/server/modules/reports/rp-ckvt.js +10 -0
- package/server/modules/reports/rp-ckvttheokho.js +4 -0
- package/server/modules/reports/rp-ckvttheotg.js +4 -0
- package/server/modules/reports/rp-ckvttt.js +3 -0
- package/server/modules/reports/rp-congnophaithutheotuoino.js +3 -0
- package/server/modules/reports/rp-congnophaitratheotuoino.js +3 -0
- package/server/modules/reports/rp-congnosapthu.js +4 -0
- package/server/modules/reports/rp-congnosaptra.js +4 -0
- package/server/modules/reports/rp-congviectheobp.js +9 -0
- package/server/modules/reports/rp-congviectheodt.js +8 -0
- package/server/modules/reports/rp-congviectheokh.js +8 -0
- package/server/modules/reports/rp-congviectheonv.js +9 -0
- package/server/modules/reports/rp-congviectheotimeline.js +6 -0
- package/server/modules/reports/rp-ctbanle.js +15 -0
- package/server/modules/reports/rp-ctbanle2.js +20 -0
- package/server/modules/reports/rp-ctbanlectv.js +20 -0
- package/server/modules/reports/rp-ctbanlenpp.js +24 -0
- package/server/modules/reports/rp-ctdanhgianhanvien.js +8 -0
- package/server/modules/reports/rp-cthangbanbitralai.js +4 -0
- package/server/modules/reports/rp-ctmuahang.js +7 -0
- package/server/modules/reports/rp-cttralaihang.js +4 -0
- package/server/modules/reports/rp-databanle.js +10 -0
- package/server/modules/reports/rp-diemthuong.js +2 -0
- package/server/modules/reports/rp-dkcn.js +3 -0
- package/server/modules/reports/rp-dktk.js +2 -0
- package/server/modules/reports/rp-dsnhanviencm.js +9 -0
- package/server/modules/reports/rp-dsnhanvientb.js +9 -0
- package/server/modules/reports/rp-dtbanlekempk.js +12 -0
- package/server/modules/reports/rp-dtbanletheoct.js +22 -0
- package/server/modules/reports/rp-dtbanletheoctkempk.js +25 -0
- package/server/modules/reports/rp-dtbanletheokh.js +17 -0
- package/server/modules/reports/rp-dtbanletheokhnpp.js +19 -0
- package/server/modules/reports/rp-dtbanletheokho.js +15 -0
- package/server/modules/reports/rp-dtbanletheonam.js +3 -0
- package/server/modules/reports/rp-dtbanletheongay.js +1 -0
- package/server/modules/reports/rp-dtbanletheonpp.js +23 -0
- package/server/modules/reports/rp-dtbanletheonv.js +19 -0
- package/server/modules/reports/rp-dtbanletheoquy.js +3 -0
- package/server/modules/reports/rp-dtbanletheosp.js +9 -0
- package/server/modules/reports/rp-dtbanletheospnpp.js +6 -0
- package/server/modules/reports/rp-dtbanletheothang.js +3 -0
- package/server/modules/reports/rp-dtbanletheothungan.js +12 -0
- package/server/modules/reports/rp-dtbanletheovt.js +2 -0
- package/server/modules/reports/rp-dtbanletheovtnpp.js +2 -0
- package/server/modules/reports/rp-dutoanthuchitheodt.js +4 -0
- package/server/modules/reports/rp-getPXC2PNC.js +8 -0
- package/server/modules/reports/rp-getariseofaccountsbymonth.js +4 -0
- package/server/modules/reports/rp-getbtpb.js +6 -0
- package/server/modules/reports/rp-getcashbycashier.js +7 -0
- package/server/modules/reports/rp-getcschietkhau.js +5 -0
- package/server/modules/reports/rp-getdinhmuc4lenhcp.js +7 -0
- package/server/modules/reports/rp-getdinhmuc4pxk.js +9 -0
- package/server/modules/reports/rp-getdk4pht.js +8 -0
- package/server/modules/reports/rp-getdk4pkc.js +10 -0
- package/server/modules/reports/rp-getdttheoca.js +5 -0
- package/server/modules/reports/rp-getinvoice2pay.js +4 -0
- package/server/modules/reports/rp-getinvoice2receive.js +4 -0
- package/server/modules/reports/rp-getinvoice2return.js +5 -0
- package/server/modules/reports/rp-getinvoice2return_bl.js +6 -0
- package/server/modules/reports/rp-getkehoachmh4lenhcp.js +4 -0
- package/server/modules/reports/rp-getkhauhao.js +7 -0
- package/server/modules/reports/rp-getluong.js +8 -0
- package/server/modules/reports/rp-getluongchuyen.js +5 -0
- package/server/modules/reports/rp-getpn2fee.js +5 -0
- package/server/modules/reports/rp-getpn2return.js +5 -0
- package/server/modules/reports/rp-getthanhpham4pnk.js +7 -0
- package/server/modules/reports/rp-getvc2xhd.js +11 -0
- package/server/modules/reports/rp-gt_cpnvltt.js +6 -0
- package/server/modules/reports/rp-hangbanbitralai.js +5 -0
- package/server/modules/reports/rp-hangthanhvien.js +3 -0
- package/server/modules/reports/rp-hoadonbanhangtheohantt.js +5 -0
- package/server/modules/reports/rp-hoadonmuahangtheohantt.js +5 -0
- package/server/modules/reports/rp-hoahong.js +15 -0
- package/server/modules/reports/rp-kcsns.js +19 -0
- package/server/modules/reports/rp-kgchamcong.js +1 -0
- package/server/modules/reports/rp-khoaso.js +11 -0
- package/server/modules/reports/rp-kiemtrasocaitcvssocai.js +6 -0
- package/server/modules/reports/rp-kqdanhgianhanvien.js +5 -0
- package/server/modules/reports/rp-kqhdkd.js +1 -0
- package/server/modules/reports/rp-lcttgt.js +16 -0
- package/server/modules/reports/rp-lctttt.js +11 -0
- package/server/modules/reports/rp-linkslist.js +4 -0
- package/server/modules/reports/rp-phanbochitienchohoadon.js +11 -0
- package/server/modules/reports/rp-phanbothutienchohoadon.js +11 -0
- package/server/modules/reports/rp-ptbitralai.js +7 -0
- package/server/modules/reports/rp-ptcttct.js +24 -0
- package/server/modules/reports/rp-ptdonhang.js +8 -0
- package/server/modules/reports/rp-pttct.js +52 -0
- package/server/modules/reports/rp-pttctkho.js +32 -0
- package/server/modules/reports/rp-pttctkho2.js +29 -0
- package/server/modules/reports/rp-referredusers.js +5 -0
- package/server/modules/reports/rp-sctbhxh.js +4 -0
- package/server/modules/reports/rp-sctcnkh.js +11 -0
- package/server/modules/reports/rp-sctdiem.js +3 -0
- package/server/modules/reports/rp-sctdt.js +7 -0
- package/server/modules/reports/rp-sctdtcp.js +11 -0
- package/server/modules/reports/rp-sctluong.js +6 -0
- package/server/modules/reports/rp-sctthuetncn.js +4 -0
- package/server/modules/reports/rp-scttk.js +9 -0
- package/server/modules/reports/rp-sctvt.js +5 -0
- package/server/modules/reports/rp-sctvt_sl.js +5 -0
- package/server/modules/reports/rp-sctvtnpp.js +6 -0
- package/server/modules/reports/rp-sctvttt.js +5 -0
- package/server/modules/reports/rp-search.js +4 -0
- package/server/modules/reports/rp-socai.js +6 -0
- package/server/modules/reports/rp-socaitk.js +1 -0
- package/server/modules/reports/rp-sochut.js +7 -0
- package/server/modules/reports/rp-sokho.js +7 -0
- package/server/modules/reports/rp-sokhott.js +5 -0
- package/server/modules/reports/rp-sonkbh.js +5 -0
- package/server/modules/reports/rp-sonkc.js +6 -0
- package/server/modules/reports/rp-sonkct.js +5 -0
- package/server/modules/reports/rp-sonkmh.js +5 -0
- package/server/modules/reports/rp-sonktt.js +5 -0
- package/server/modules/reports/rp-soquy.js +11 -0
- package/server/modules/reports/rp-sosanhkhvatt.js +13 -0
- package/server/modules/reports/rp-sosanhkhvatt2.js +5 -0
- package/server/modules/reports/rp-sotaisan.js +13 -0
- package/server/modules/reports/rp-sotiengui.js +7 -0
- package/server/modules/reports/rp-taodinhmuctudkhoc.js +5 -0
- package/server/modules/reports/rp-thbanhangkempk.js +28 -0
- package/server/modules/reports/rp-thdanhgianhanvien.js +9 -0
- package/server/modules/reports/rp-thgt.js +6 -0
- package/server/modules/reports/rp-thnxt.js +11 -0
- package/server/modules/reports/rp-thnxt_sl.js +9 -0
- package/server/modules/reports/rp-thnxtnpp.js +10 -0
- package/server/modules/reports/rp-thnxttt.js +9 -0
- package/server/modules/reports/rp-tkbanhangtheogioithieu.js +9 -0
- package/server/modules/reports/rp-tkgioithieukh.js +4 -0
- package/server/modules/reports/rp-tkgtgt.js +76 -0
- package/server/modules/reports/rp-tkgtgt_old.js +7 -0
- package/server/modules/reports/rp-tmbctc.js +20 -0
- package/server/modules/reports/rp-tonghopbanhang.js +6 -0
- package/server/modules/reports/rp-tonghopmuahang.js +5 -0
- package/server/modules/reports/rp-tonghoptralaihang.js +5 -0
- package/server/modules/reports/rp-tongquanbanle.js +20 -0
- package/server/modules/reports/rp-tongquanbds.js +3 -0
- package/server/modules/reports/rp-tongquancongty.js +6 -0
- package/server/modules/reports/rp-tongquanctvnpp.js +12 -0
- package/server/modules/reports/rp-tongquannvbh.js +14 -0
- package/server/modules/reports/rp-tongquannvnpp.js +5 -0
- package/server/modules/reports/rp-uoctinhnvl.js +11 -0
- package/server/modules/reports/rp-wallet.js +3 -0
- package/server/modules/reports/rpt-tkdiemtichluy.js +9 -0
- package/server/modules/systems/sys-app.js +34 -0
- package/server/modules/systems/sys-colleague.js +11 -0
- package/server/modules/systems/sys-data_list_config.js +1 -0
- package/server/modules/systems/sys-domain.js +1 -0
- package/server/modules/systems/sys-ecomproductlines.js +1 -0
- package/server/modules/systems/sys-exportexceltemplate.js +1 -0
- package/server/modules/systems/sys-fieldright.js +1 -0
- package/server/modules/systems/sys-importexceltemplate.js +1 -0
- package/server/modules/systems/sys-labelinfo.js +4 -0
- package/server/modules/systems/sys-listinfo.js +10 -0
- package/server/modules/systems/sys-menuinfo.js +4 -0
- package/server/modules/systems/sys-message.js +14 -0
- package/server/modules/systems/sys-moduleinfo.js +4 -0
- package/server/modules/systems/sys-notification.js +8 -0
- package/server/modules/systems/sys-quanhuyen.js +1 -0
- package/server/modules/systems/sys-reportinfo.js +5 -0
- package/server/modules/systems/sys-rptobject.js +1 -0
- package/server/modules/systems/sys-schedule.js +10 -0
- package/server/modules/systems/sys-sysconfig.js +1 -0
- package/server/modules/systems/sys-sysgroup.js +1 -0
- package/server/modules/systems/sys-tableinfo.js +1 -0
- package/server/modules/systems/sys-templatestore.js +5 -0
- package/server/modules/systems/sys-tinhthanh.js +1 -0
- package/server/modules/systems/sys-token.js +3 -0
- package/server/modules/systems/sys-trangthai.js +3 -0
- package/server/modules/systems/sys-trialinfo.js +1 -0
- package/server/modules/systems/sys-user.js +45 -0
- package/server/modules/systems/sys-users.js +10 -0
- package/server/modules/systems/sys-versioninfo.js +1 -0
- package/server/modules/systems/sys-vietqrbanks.js +1 -0
- package/server/modules/systems/sys-xaphuong.js +1 -0
- package/server/modules/vouchers/vo-banggiaban.js +8 -0
- package/server/modules/vouchers/vo-bc1.js +34 -0
- package/server/modules/vouchers/vo-bc5.js +15 -0
- package/server/modules/vouchers/vo-bg1.js +10 -0
- package/server/modules/vouchers/vo-bg2.js +12 -0
- package/server/modules/vouchers/vo-bn1.js +36 -0
- package/server/modules/vouchers/vo-bn5.js +15 -0
- package/server/modules/vouchers/vo-dh2.js +35 -0
- package/server/modules/vouchers/vo-dinhmucsx.js +6 -0
- package/server/modules/vouchers/vo-dkb.js +21 -0
- package/server/modules/vouchers/vo-dn0.js +9 -0
- package/server/modules/vouchers/vo-dnm.js +20 -0
- package/server/modules/vouchers/vo-hd1.js +37 -0
- package/server/modules/vouchers/vo-hd2.js +108 -0
- package/server/modules/vouchers/vo-hd3.js +38 -0
- package/server/modules/vouchers/vo-hd4.js +13 -0
- package/server/modules/vouchers/vo-hd7.js +29 -0
- package/server/modules/vouchers/vo-hd8.js +29 -0
- package/server/modules/vouchers/vo-hde.js +39 -0
- package/server/modules/vouchers/vo-htl.js +11 -0
- package/server/modules/vouchers/vo-kbbtpb.js +6 -0
- package/server/modules/vouchers/vo-kehoachmh.js +11 -0
- package/server/modules/vouchers/vo-lenhcapphat.js +9 -0
- package/server/modules/vouchers/vo-lenhsx.js +12 -0
- package/server/modules/vouchers/vo-pbl.js +94 -0
- package/server/modules/vouchers/vo-pc0.js +14 -0
- package/server/modules/vouchers/vo-pc1.js +31 -0
- package/server/modules/vouchers/vo-pc2.js +25 -0
- package/server/modules/vouchers/vo-pc3.js +14 -0
- package/server/modules/vouchers/vo-pc5.js +15 -0
- package/server/modules/vouchers/vo-pc6.js +19 -0
- package/server/modules/vouchers/vo-pcl.js +7 -0
- package/server/modules/vouchers/vo-pdn.js +11 -0
- package/server/modules/vouchers/vo-pdx.js +9 -0
- package/server/modules/vouchers/vo-pgh.js +16 -0
- package/server/modules/vouchers/vo-pht.js +6 -0
- package/server/modules/vouchers/vo-pkc.js +5 -0
- package/server/modules/vouchers/vo-pkh.js +9 -0
- package/server/modules/vouchers/vo-pkk.js +12 -0
- package/server/modules/vouchers/vo-pkt.js +12 -0
- package/server/modules/vouchers/vo-pn1.js +30 -0
- package/server/modules/vouchers/vo-pn2.js +17 -0
- package/server/modules/vouchers/vo-pn3.js +18 -0
- package/server/modules/vouchers/vo-pn5.js +18 -0
- package/server/modules/vouchers/vo-pn6.js +18 -0
- package/server/modules/vouchers/vo-pn9.js +23 -0
- package/server/modules/vouchers/vo-pnc.js +19 -0
- package/server/modules/vouchers/vo-pnh.js +17 -0
- package/server/modules/vouchers/vo-pnk.js +14 -0
- package/server/modules/vouchers/vo-pnknpp.js +12 -0
- package/server/modules/vouchers/vo-po1.js +14 -0
- package/server/modules/vouchers/vo-ppb.js +8 -0
- package/server/modules/vouchers/vo-pt1.js +20 -0
- package/server/modules/vouchers/vo-pt5.js +15 -0
- package/server/modules/vouchers/vo-ptl.js +8 -0
- package/server/modules/vouchers/vo-purchase_contract.js +9 -0
- package/server/modules/vouchers/vo-pxc.js +24 -0
- package/server/modules/vouchers/vo-pxh.js +18 -0
- package/server/modules/vouchers/vo-pxk.js +15 -0
- package/server/modules/vouchers/vo-pxknpp.js +14 -0
- package/server/modules/vouchers/vo-qts.js +12 -0
- package/server/modules/vouchers/vo-sale_contract.js +11 -0
- package/server/modules/vouchers/vo-shipbook.js +17 -0
- package/server/modules/vouchers/vo-so1.js +125 -0
- package/server/modules/vouchers/vo-so5.js +57 -0
- package/server/modules/vouchers/vo-so7.js +97 -0
- package/server/modules/vouchers/vo-so9.js +119 -0
- package/server/modules/vouchers/vo-vanchuyen.js +14 -0
- package/server/modules/vouchers/vo-xhd.js +33 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const listinfo=global.getModel("listinfo");module.exports=function($router$$){$router$$.route("/listinfo").get(($req$$,$res$$)=>{listinfo.find({status:!0}).lean().then($rs$$=>{$res$$.send($rs$$)}).catch($e$$=>{$res$$.status(400).send({message:$e$$.message})})})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports=function($router$$){$router$$.route("/media-webhook").post(function($req$$,$res$$){Logger.info("media event",$req$$.body);$res$$.status(200).send("OK")})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const Partner=global.getModel("partner");module.exports=function($router$$){$router$$.route("/partner").get(function($req$$,$res$$){(new Partner({nguoi_cap:$req$$.query.nguoi_cap,body:$req$$.query.body})).save(function($e$$){$e$$?$res$$.status(400).send("Kh\u00f4ng th\u1ec3 c\u1ea5p quy\u1ec1n s\u1eed d\u1ee5ng cho ch\u01b0\u01a1ng tr\u00ecnh n\u00e0y."):$res$$.send("OK")})})};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports=function($router$$){$router$$.route("/:id_app/:service/:id_transaction/verify").get(async($req$$,$res$$)=>{let $id_app$$=$req$$.params.id_app,$id_transaction$$=$req$$.params.id_transaction,$service$$=$req$$.params.service;try{let $data_check$$=$req$$.query,$results$$=await global.getModel($service$$).verifyReturnUrl($id_app$$,$id_transaction$$,$data_check$$);$res$$.send($results$$)}catch($e$$){Logger.error($e$$),$res$$.status(400).send({error:$e$$.message})}});$router$$.route("/:id_app/:service/:id_transaction/callback").get(async($_url_req$$,
|
|
2
|
+
$res$$)=>{let $id_app$$=$_url_req$$.params.id_app,$id_transaction$$=$_url_req$$.params.id_transaction,$service$$=$_url_req$$.params.service;try{let $data_check$$=$_url_req$$.query,$results$$=await global.getModel($service$$).verifyReturnUrl($id_app$$,$id_transaction$$,$data_check$$),$direct_url$$;if($direct_url$$=$results$$.isSuccess?$results$$.result_url:$results$$.error_url||$results$$.result_url){$_url_req$$="";delete $results$$.result_url;delete $results$$.return_url;for(let $key$$ in $results$$)$_url_req$$=
|
|
3
|
+
$_url_req$$?`${$_url_req$$}&${$key$$}=${encodeURIComponent($results$$[$key$$])}`:`${$key$$}=${encodeURIComponent($results$$[$key$$])}`;$_url_req$$=`${$direct_url$$}?${$_url_req$$}`;Logger.info("redirect to result page",$_url_req$$);try{$res$$.redirect($_url_req$$)}catch($e$$){Logger.error($e$$),$res$$.status(400).send({error:$e$$.message||$e$$.error||$e$$,url:$_url_req$$})}}else{let $msg$$=$results$$.message,$color$$;$results$$.isSuccess?($msg$$=$results$$.message||"Your transaction was successful",
|
|
4
|
+
$color$$="blue"):($color$$="red",$msg$$=$msg$$||"Your transaction was not success");$res$$.send(`<html>
|
|
5
|
+
<head>
|
|
6
|
+
<title>${$results$$.isSuccess?"success":"error"}</title>
|
|
7
|
+
<meta charset="utf-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div style="margin-left:auto;margin-right:auto;text-align:center">
|
|
12
|
+
<h3 style="color:${$color$$}">${$msg$$}</h3>
|
|
13
|
+
</div>
|
|
14
|
+
</body>
|
|
15
|
+
</html>`)}}catch($e$$){Logger.error($e$$),$res$$.status(400).send({error:$e$$.message||$e$$.error||$e$$})}});$router$$.route("/:id_app/:service/notify").post(async($req$$,$res$$)=>{let $id_app$$=$req$$.params.id_app,$body_receiver$$=$req$$.body;global.getModel($req$$.params.service).handleNotify($id_app$$,$body_receiver$$,($e$$,$rs$$)=>{if($e$$)return $res$$.status(400).send($e$$);$res$$.status(204).send($rs$$)})});$router$$.route("/:id_app/:service/query/:id_ct").get(async($req$jscomp$3_serviceModel$$,
|
|
16
|
+
$res$$)=>{let $id_app$$=$req$jscomp$3_serviceModel$$.params.id_app,$id_ct$$=$req$jscomp$3_serviceModel$$.params.id_ct;$req$jscomp$3_serviceModel$$=global.getModel($req$jscomp$3_serviceModel$$.params.service);if($req$jscomp$3_serviceModel$$.queryTransaction)try{let $rs$$=await $req$jscomp$3_serviceModel$$.queryTransaction($id_app$$,$id_ct$$);$res$$.send($rs$$)}catch($e$$){$res$$.status(400).send({error:$e$$.message||$e$$.error||$e$$})}else $res$$.status(400).send({error:"Service n\u00e0y kh\u00f4ng h\u1ed7 tr\u1ee3 truy v\u1ea5n giao d\u1ecbch"})});
|
|
17
|
+
$router$$.route("/payment/again").get(async($req$$,$res$$)=>{try{let $results$$=$req$$.query,$msg$$=$results$$.message,$color$$;$results$$.isSuccess?($msg$$=$results$$.message||"Your transaction was successful",$color$$="blue"):$color$$="red";let $html$$=`<html>
|
|
18
|
+
<head>
|
|
19
|
+
<title>${$results$$.isSuccess?"success":"error"}</title>
|
|
20
|
+
<meta charset="utf-8">
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
22
|
+
<script>
|
|
23
|
+
window.postMessage('${JSON.stringify($results$$)}', "*");
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<div style="margin-left:auto;margin-right:auto;text-align:center">
|
|
29
|
+
<h3 style="color:${$color$$}">${$msg$$}</h3>
|
|
30
|
+
</div>
|
|
31
|
+
</body>
|
|
32
|
+
</html>`;$res$$.send($html$$)}catch($e$$){$res$$.status(400).send($e$$.message)}})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const tinhthanh=global.getModel("tinhthanh");module.exports=function($router$$){$router$$.route("/province").get(function($req$$,$res$$){tinhthanh.find({}).lean().then($rs$$=>{$res$$.send($rs$$.map($r$$=>$r$$.ten_tinh_thanh))}).catch($e$$=>{$res$$.status(400).send({message:$e$$.message})})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var ptthanhtoan=global.getModel("ptthanhtoan");
|
|
2
|
+
module.exports=function($router$$){$router$$.route("/ptthanhtoan").get(function($req_sort$$,$res$$){var $id_app_query$$=$req_sort$$.query.id_app,$condition_fields_page$$=$req_sort$$.query.fields;let $gfields$$={};$condition_fields_page$$&&$condition_fields_page$$.split(",").forEach(function($f$$){$f$$!="_id"&&($gfields$$[$f$$]=1)});$condition_fields_page$$={};if($req_sort$$.query.q)$condition_fields_page$$=JSON.parse($req_sort$$.query.q);else{var $k_limit$$=$req_sort$$.query.k;$k_limit$$&&($condition_fields_page$$.$or=
|
|
3
|
+
[],$condition_fields_page$$.$or.push({ma_vt:{$regex:$k_limit$$,$options:"i"}}),$condition_fields_page$$.$or.push({ten_vt:{$regex:$k_limit$$,$options:"i"}}))}$condition_fields_page$$.id_app=$id_app_query$$;$id_app_query$$=ptthanhtoan.find($condition_fields_page$$,$gfields$$);$condition_fields_page$$=$req_sort$$.query.page;$k_limit$$=$req_sort$$.query.limit;$condition_fields_page$$?($k_limit$$||=20,$id_app_query$$.skip((Number($condition_fields_page$$)-1)*$k_limit$$).limit($k_limit$$)):$k_limit$$&&
|
|
4
|
+
$id_app_query$$.limit($k_limit$$);if($req_sort$$=$req_sort$$.query.sort){var $gsort$$={};$req_sort$$.split(",").forEach(function($f$$){$f$$!="_id"&&($gsort$$[$f$$]=1)});$id_app_query$$.sort($gsort$$)}$id_app_query$$.lean().then(function($result$$){$res$$.send($result$$)}).catch($e$$=>{$res$$.status(400).send({message:$e$$.message})})})};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const subscribe=global.getModel("subscribe"),utils=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){$router$$.route("/subscribe").post(function($req$$,$res$$){const $body$$=$req$$.body;if(!$body$$)return $res$$.status(411).send("Kh\u00f4ng c\u00f3 d\u1eef li\u1ec7u");subscribe.findOne({email:$body$$.email},function($e$$,$rs$$){if($rs$$)return $res$$.status(400).send("Email n\u00e0y \u0111\u00e3 \u0111\u01b0\u1ee3c \u0111\u0103ng k\u00fd");(new subscribe($body$$)).save(function($error$$){if($error$$)return $res$$.status(400).send("Kh\u00f4ng th\u1ec3 \u0111\u0103ng k\u00fd\n"+$error$$);
|
|
3
|
+
$res$$.send("B\u1ea1n \u0111\u00e3 \u0111\u0103ng k\u00fd th\u00e0nh c\u00f4ng")})})});$router$$.route("/unsubscribe/:encrypted").get(async function($req$$,$res$$){try{let $data$$=utils.decrypt($req$$.params.encrypted),{id_app:$id_app$$,email:$email$$}=$data$$;if(!$id_app$$||!$email$$||!global.mongoose.Types.ObjectId.isValid($id_app$$))return $res$$.status(400).send("Link is not valid");let $appInfo$$=await global.getModel("app").findOne({_id:$id_app$$}).lean()||{};subscribe.findOneAndUpdate({email:$email$$,
|
|
4
|
+
id_app:$id_app$$},{unsubcribe:!0},{new:!0,upsert:!0},function($e$$){if($e$$)return $res$$.status(400).send($e$$.message||$e$$.error||$e$$);$res$$.send(`
|
|
5
|
+
<html>
|
|
6
|
+
<title>${$appInfo$$.name||"unsubscribe"}</title>
|
|
7
|
+
<head>
|
|
8
|
+
</head>
|
|
9
|
+
<body style="background-color:#eeeeee">
|
|
10
|
+
<div style="
|
|
11
|
+
width: 600px;
|
|
12
|
+
margin: 0 auto 10px auto;
|
|
13
|
+
text-align: left;"
|
|
14
|
+
>
|
|
15
|
+
<div style="
|
|
16
|
+
line-height: 150%;
|
|
17
|
+
font-family: Helvetica;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
color: #333333;
|
|
20
|
+
padding: 20px;
|
|
21
|
+
border-radius: 6px;
|
|
22
|
+
background-color: #ffffff;"
|
|
23
|
+
>
|
|
24
|
+
<h3>H\u1ee7y \u0111\u0103ng k\u00fd th\u00e0nh c\u00f4ng</h3>
|
|
25
|
+
<p>B\u1ea1n s\u1ebd kh\u00f4ng c\u00f2n nh\u1eadn \u0111\u01b0\u1ee3c email ti\u1ebfp th\u1ecb t\u1eeb danh s\u00e1ch n\u00e0y.</p>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
30
|
+
`)})}catch($e$$){return $res$$.status(400).send($e$$.message||$e$$.error||$e$$)}})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var message=global.getModel("message");const async=require("async");
|
|
2
|
+
module.exports=function($router$$){$router$$.route("/support/:guest").post(function($req$$,$res$$){let $body$$=$req$$.body,$guest$$=$req$$.params.guest,$content$$=$body$$.content,$title$$=$body$$.title;if(!$content$$)return $res$$.status(400).send("B\u1ea1n ch\u01b0a nh\u1eadp n\u1ed9i dung tin nh\u1eafn");async.mapLimit(configs.supportUsers,20,($user$$,$callback$$)=>{message.createMessage($guest$$,$user$$,$title$$,$content$$,($e$$,$rs$$)=>{$callback$$($e$$,$rs$$)})},($e$$,$rs$$)=>{if($e$$)return $res$$.status(400).send($e$$);
|
|
3
|
+
$res$$.send($rs$$)})})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const tableinfo=global.getModel("tableinfo");module.exports=function($router$$){$router$$.route("/tableinfo/:code").get(function($code$$,$res$$){$code$$=$code$$.params.code.toUpperCase();tableinfo.findOne({code:$code$$}).lean().exec(($e$$,$rs$$)=>{if($e$$)return $res$$.status(400).send($e$$);$res$$.send($rs$$)})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const trialinfo=global.getModel("trialinfo");
|
|
2
|
+
module.exports=function($router$$){$router$$.route("/trialinfo/:ls").get(function($req$$,$res$$){const $ls$$=$req$$.params.ls.toUpperCase();trialinfo.findOne({db_key:$ls$$},function($days_e$$,$rs$$){if($days_e$$)return $res$$.status(400).send($days_e$$);if($rs$$){$days_e$$=((new Date).getTime()-$rs$$.date_created.getTime())/864E5;let $update$$=0;$req$$.query.cty_name&&($rs$$.cty_name=$req$$.query.cty_name,$update$$=1);$req$$.query.address&&($rs$$.address=$req$$.query.address,$update$$=1);$req$$.query.phone&&
|
|
3
|
+
($rs$$.phone=$req$$.query.phone,$update$$=1);$update$$&&$rs$$.save(function(){});return $days_e$$<=$rs$$.trial_days?$res$$.send({db_key:$ls$$,trial_rg:!0,status:!0,msg:"Ok"}):$res$$.send({db_key:$ls$$,trial_rg:!0,status:!1,msg:"H\u1ebft h\u1ea1n d\u00f9ng th\u1eed"})}if($req$$.query.cty_name&&!$req$$.query.update)(new trialinfo({db_key:$ls$$,cty_name:$req$$.query.cty_name,address:$req$$.query.address,phone:$req$$.query.phone,app:$req$$.query.app,version:$req$$.query.version})).save(function($e$$){return $e$$?
|
|
4
|
+
$res$$.status(400).send($e$$):$res$$.send({db_key:$ls$$,trial_rg:!0,status:!0,msg:"Ok"})});else return $res$$.send({db_key:$ls$$,trial_rg:!1,status:!1,msg:"Ch\u01b0a \u0111ang k\u00fd d\u00f9ng th\u1eed"})})})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const versioninfo=global.getModel("versioninfo");module.exports=function($router$$){$router$$.route("/versioninfo").get(function($req$$,$res$$){let $condition$$={};$req$$.query.q&&($condition$$=JSON.parse($req$$.query.q));$condition$$.status=!0;versioninfo.find($condition$$).lean().exec(function($error$$,$result$$){if($error$$)return $res$$.status(400).send($error$$);$res$$.send($result$$)})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const tinhgiafifo=require("../../libs/tinhgiafifo"),controller=require("../../controllers/controllerRPT"),_Notification=global.getModel("notification"),async=require("async"),utils=require("../../libs/utils"),{getCurrentSession}=require("../../libs/sessionContext");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"tinhgiafifo",async function($req$$,$callback$$){const $query$$=$req$$.query,$email$$=$req$$.user.email,$id_app$$=$query$$.id_app;if(!$query$$.nam||!$query$$.tu_thang||!$query$$.den_thang)return Logger.error("[Calc-tinhgiafifo]","Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang"),_Notification.createNotification($email$$,$email$$,"Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang",
|
|
3
|
+
"Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang",null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$("Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang");var $ds_kho_error$$=require("moment"),$ngay_ks_tu_ngay$$=$ds_kho_error$$([Number($query$$.nam),Number($query$$.tu_thang)-1,1]).startOf("month").toDate();
|
|
4
|
+
if($ngay_ks_tu_ngay$$=await utils.isBookLocked({id_app:$req$$.user.current_id_app,ngay_ct:$ngay_ks_tu_ngay$$}))return $ds_kho_error$$=`Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. \u0110\u00e3 kh\u00f3a s\u1ed5 \u0111\u1ebfn ng\u00e0y ${$ds_kho_error$$($ngay_ks_tu_ngay$$).format("DD/MM/YYYY")}`,Logger.error("[Calc-tinhgiafifo]",$ds_kho_error$$),_Notification.createNotification($email$$,$email$$,$ds_kho_error$$,$ds_kho_error$$,null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$($ds_kho_error$$);
|
|
5
|
+
$ds_kho_error$$=[];$query$$.tinh_theo_kho&&!$query$$.ma_kho?($ds_kho_error$$={id_app:$id_app$$,status:!0},$ds_kho_error$$=(await global.getModel("dmkho").find($ds_kho_error$$,{ma_kho:1}).sort({stt:1}).lean()).map($r$$=>$r$$.ma_kho)):$ds_kho_error$$=[$query$$.ma_kho];Logger.info(`\u2705 [Calc-tinhgiafifo] T\u00ednh gi\u00e1 trung b\u00ecnh, sessionID=${getCurrentSession()?._debugId}`);async.mapSeries($ds_kho_error$$,($ma_kho$$,$callback$$)=>{const $zquery$$=Object.assign({},$query$$);$zquery$$.ma_kho=
|
|
6
|
+
$ma_kho$$;tinhgiafifo($zquery$$,function($error$$){$error$$&&Logger.error("[Calc-tinhgiafifo] L\u1ed7i t\u00ednh gia trung b\u00ecnh:",$error$$.message||$error$$.error||$error$$,$zquery$$);$callback$$($error$$)})},$error$$=>{$error$$?(Logger.error("[Calc-tinhgiafifo] L\u1ed7i khi t\u00ednh gi\u00e1 trung b\u00ecnh",$error$$.message||$error$$.error||$error$$),_Notification.createNotification($email$$,$email$$,$error$$.message||$error$$,$error$$.message||$error$$,null,{id_app:$id_app$$},!0,$req$$.access_token,
|
|
7
|
+
!0),$callback$$($error$$)):(console.info("[Calc-tinhgiafifo] \u0110\u00e3 t\u00ednh xong gi\u00e1 trung b\u00ecnh. Th\u00f4ng b\u00e1o t\u1edbi",$email$$),_Notification.createNotification($email$$,$email$$,"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 nh\u1eadp tr\u01b0\u1edbc xu\u1ea5t tr\u01b0\u1edbc xong","Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 nh\u1eadp tr\u01b0\u1edbc xu\u1ea5t tr\u01b0\u1edbc xong",null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$(null))})},
|
|
8
|
+
{stream:!1,useSession:!0,cache:!1,queue:!0,timeout:18E6,waiting_message:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111ang th\u1ef1c hi\u1ec7n. B\u1ea1n c\u00f3 th\u1ec3 chuy\u1ec3n sang trang kh\u00e1c \u0111\u1ec3 l\u00e0m vi\u1ec7c. Khi ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c hi\u1ec7n xong s\u1ebd g\u1eedi th\u00f4ng b\u00e1o cho b\u1ea1n."})};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const tinhgiatb=require("../../libs/tinhgiatb"),controller=require("../../controllers/controllerRPT"),_Notification=global.getModel("notification"),async=require("async"),utils=require("../../libs/utils"),{getCurrentSession}=require("../../libs/sessionContext");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"tinhgiatb",async function($req$$,$callback$$){const $query$$=$req$$.query,$email$$=$req$$.user.email,$id_app$$=$query$$.id_app;if(!$query$$.nam||!$query$$.tu_thang||!$query$$.den_thang)return Logger.error("[Calc-tinhgiatb]","Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang"),_Notification.createNotification($email$$,$email$$,"Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang",
|
|
3
|
+
"Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang",null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$("Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,tu_thang,den_thang");var $ds_kho_error$$=require("moment"),$ngay_ks_tu_ngay$$=$ds_kho_error$$([Number($query$$.nam),Number($query$$.tu_thang)-1,1]).startOf("month").toDate();
|
|
4
|
+
if($ngay_ks_tu_ngay$$=await utils.isBookLocked({id_app:$req$$.user.current_id_app,ngay_ct:$ngay_ks_tu_ngay$$}))return $ds_kho_error$$=`Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 trung b\u00ecnh. \u0110\u00e3 kh\u00f3a s\u1ed5 \u0111\u1ebfn ng\u00e0y ${$ds_kho_error$$($ngay_ks_tu_ngay$$).format("DD/MM/YYYY")}`,Logger.error("[Calc-tinhgiatb]",$ds_kho_error$$),_Notification.createNotification($email$$,$email$$,$ds_kho_error$$,$ds_kho_error$$,null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$($ds_kho_error$$);
|
|
5
|
+
$ds_kho_error$$=[];$query$$.tinh_theo_kho&&!$query$$.ma_kho?($ds_kho_error$$={id_app:$id_app$$,status:!0},$ds_kho_error$$=(await global.getModel("dmkho").find($ds_kho_error$$,{ma_kho:1}).sort({stt:1}).lean()).map($r$$=>$r$$.ma_kho)):$ds_kho_error$$=[$query$$.ma_kho];Logger.info(`\u2705 [Calc-tinhgiatb] T\u00ednh gi\u00e1 trung b\u00ecnh, sessionID=${getCurrentSession()?._debugId}`);async.mapSeries($ds_kho_error$$,($ma_kho$$,$callback$$)=>{const $zquery$$=Object.assign({},$query$$);$zquery$$.ma_kho=
|
|
6
|
+
$ma_kho$$;tinhgiatb($zquery$$,function($error$$){$error$$&&Logger.error("[Calc-tinhgiatb] L\u1ed7i t\u00ednh gia trung b\u00ecnh:",$error$$.message||$error$$.error||$error$$,$zquery$$);$callback$$($error$$)})},$error$$=>{$error$$?(Logger.error("[Calc-tinhgiatb] L\u1ed7i khi t\u00ednh gi\u00e1 trung b\u00ecnh",$error$$.message||$error$$.error||$error$$),_Notification.createNotification($email$$,$email$$,$error$$.message||$error$$,$error$$.message||$error$$,null,{id_app:$id_app$$},!0,$req$$.access_token,
|
|
7
|
+
!0),$callback$$($error$$)):(console.info("[Calc-tinhgiatb] \u0110\u00e3 t\u00ednh xong gi\u00e1 trung b\u00ecnh. Th\u00f4ng b\u00e1o t\u1edbi",$email$$),_Notification.createNotification($email$$,$email$$,"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 trung b\u00ecnh xong","Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 trung b\u00ecnh xong",null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$(null))})},{stream:!1,useSession:!0,cache:!1,queue:!0,timeout:18E6,waiting_message:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111ang th\u1ef1c hi\u1ec7n. B\u1ea1n c\u00f3 th\u1ec3 chuy\u1ec3n sang trang kh\u00e1c \u0111\u1ec3 l\u00e0m vi\u1ec7c. Khi ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c hi\u1ec7n xong s\u1ebd g\u1eedi th\u00f4ng b\u00e1o cho b\u1ea1n."})};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const _Notification=global.getModel("notification"),controller=require("../../controllers/controllerRPT"),tinhGt=require("../../libs/tinhGt"),async=require("async"),utils=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"tinhgiathanh",async function($req$$,$callback$$){const $condition$$=$req$$.query;$condition$$.nam=Number($condition$$.nam);$condition$$.thang=Number($condition$$.thang);const $email$$=$req$$.user.email,$id_app$$=$condition$$.id_app;if(!$condition$$.nam||!$condition$$.thang)return _Notification.createNotification($email$$,$email$$,"Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,thang","Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,thang",
|
|
3
|
+
null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,thang");var $dsbp_error$$=require("moment"),$bpcon_ngay_ks_tu_ngay$$=$dsbp_error$$([Number($condition$$.nam),Number($condition$$.thang)-1,1]).startOf("month").toDate();if($bpcon_ngay_ks_tu_ngay$$=await utils.isBookLocked({id_app:$req$$.user.current_id_app,ngay_ct:$bpcon_ngay_ks_tu_ngay$$}))return $dsbp_error$$=`Kh\u00f4ng th\u1ec3 t\u00ednh gi\u00e1 th\u00e0nh. \u0110\u00e3 kh\u00f3a s\u1ed5 \u0111\u1ebfn ng\u00e0y ${$dsbp_error$$($bpcon_ngay_ks_tu_ngay$$).format("DD/MM/YYYY")}`,
|
|
4
|
+
_Notification.createNotification($email$$,$email$$,$dsbp_error$$,$dsbp_error$$,null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$($dsbp_error$$);$dsbp_error$$=[];$condition$$.tinh_theo_cong_doan?($dsbp_error$$={id_app:$condition$$.id_app,la_cong_doan_sx:!0,status:!0},$condition$$.ma_bp&&($bpcon_ngay_ks_tu_ngay$$=await global.getModel("dmbp").getChilrenByMaBP($condition$$.id_app,$condition$$.ma_bp),$bpcon_ngay_ks_tu_ngay$$.push($condition$$.ma_bp),$dsbp_error$$.ma_bp={$in:$bpcon_ngay_ks_tu_ngay$$}),
|
|
5
|
+
$dsbp_error$$=(await global.getModel("dmbp").find($dsbp_error$$).sort({stt:1}).lean()).map($r$$=>$r$$.ma_bp)):$dsbp_error$$=[$condition$$.ma_bp];async.mapSeries($dsbp_error$$,($bp$$,$callback$$)=>{tinhGt({...$condition$$,ma_bp:$bp$$},($e$$,$ctgt$$)=>{if($e$$)return $callback$$($e$$);$callback$$(null,$ctgt$$)})},async $e$$=>{$e$$?(Logger.info("\u26a0\ufe0f[tinhgiatb] Th\u00f4ng b\u00e1o l\u1ed7i t\u1edbi ng\u01b0\u1eddi t\u00ednh"),_Notification.createNotification($email$$,$email$$,$e$$.message||$e$$.error||
|
|
6
|
+
$e$$,$e$$.message||$e$$.error||$e$$,null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$($e$$)):(Logger.info("\u26a0\ufe0f[tinhgiatb] Th\u00f4ng b\u00e1o k\u1ebft qu\u1ea3 t\u1edbi ng\u01b0\u1eddi t\u00ednh"),_Notification.createNotification($email$$,$email$$,"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 th\u00e0nh xong","Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 t\u00ednh gi\u00e1 th\u00e0nh xong",null,{id_app:$id_app$$},!0,$req$$.access_token,!0),$callback$$(null))})},{stream:!1,
|
|
7
|
+
useSession:!0,cache:!1,queue:!0,timeout:18E6,waiting_message:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111ang th\u1ef1c hi\u1ec7n. B\u1ea1n c\u00f3 th\u1ec3 chuy\u1ec3n sang trang kh\u00e1c \u0111\u1ec3 l\u00e0m vi\u1ec7c. Khi ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c hi\u1ec7n xong s\u1ebd g\u1eedi th\u00f4ng b\u00e1o cho b\u1ea1n."})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const tinhkhauhaots=require("../../libs/tinhkhauhaots"),qts=global.getModel("qts"),controller=require("../../controllers/controllerRPT"),moment=require("moment"),utils=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"tinhkhauhaots",async function($ngay_ks_req$$,$callback$$){const $condition$$=$ngay_ks_req$$.query;if(!$condition$$.nam||!$condition$$.thang)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,thang");const $id_app$$=$condition$$.id_app;let $tu_ngay$$=moment([Number($condition$$.nam),Number($condition$$.thang)-1,1]).startOf("month").toDate();if($ngay_ks_req$$=await utils.isBookLocked({id_app:$ngay_ks_req$$.user.current_id_app,
|
|
3
|
+
ngay_ct:$tu_ngay$$}))return $callback$$(`\u0110\u00e3 kh\u00f3a s\u1ed5 \u0111\u1ebfn ng\u00e0y ${moment($ngay_ks_req$$).format("DD/MM/YYYY")}`);tinhkhauhaots($condition$$,function($error$$,$results$$){if($error$$)return $callback$$($error$$);$results$$.joinModel($id_app$$,qts,[{akey:"id_ts",bkey:"_id",fields:[{name:"so_the_ts",value:"so_the_ts"},{name:"ten_ts",value:"ten_ts"}]}],function(){$callback$$(null,$results$$)})})},{stream:!1,useSession:!0,cache:!1,queue:!0,timeout:18E6})};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const chamcong=global.getModel("chamcong"),dmnv=global.getModel("dmnv"),dmbp=global.getModel("dmbp"),phucap=global.getModel("phucap"),dmloaicong=global.getModel("dmloaicong"),ckgtluong=global.getModel("ckgtluong"),bangtinhluong=global.getModel("bangtinhluong"),dmletet=global.getModel("dmletet"),App=global.getModel("app"),controller=require("../../controllers/controllerRPT"),moment=require("moment"),async=require("async"),_=require("lodash"),utils=require("../../libs/utils"),generateVirtualTimekeepingForVIP=
|
|
2
|
+
($nv$$,$condition$$)=>({ma_nv:$nv$$.ma_nv,ma_bp:$nv$$.ma_bp,loai_don_gia_ngay_cong:"luong_ngay_cong",ngay_cong:$condition$$.so_ngay_lam_mot_thang,sl_cong:1,ngay_phep:0,ngay_khong_phep:0,ngay_khong_luong:0,ngay_tang_ca:0,so_ngay_tinh_phu_cap:0,so_luong_ngay_tang_ca_mien_thue:0,is_virtual_vip:!0}),bac_tinh_thue=[{thu_nhap_chiu_thue_toi_da:5E6,thue_suat:5},{thu_nhap_chiu_thue_toi_da:1E7,thue_suat:10},{thu_nhap_chiu_thue_toi_da:18E6,thue_suat:15},{thu_nhap_chiu_thue_toi_da:32E6,thue_suat:20},{thu_nhap_chiu_thue_toi_da:52E6,
|
|
3
|
+
thue_suat:25},{thu_nhap_chiu_thue_toi_da:8E7,thue_suat:30},{thue_suat:35}],tinhThueTNCV=$tong_thu_nhap_chiu_thue$$=>{let $i$$=0;const $thue_tncn$$=_.cloneDeep(bac_tinh_thue);let $thu_nha_da_chiu_thue$$=0;for(var $thu_nhap_chiu_thue_thu_nhap_con_lai$$=$tong_thu_nhap_chiu_thue$$;$i$$<$thue_tncn$$.length;){let $bac$$=$thue_tncn$$[$i$$];$thu_nhap_chiu_thue_thu_nhap_con_lai$$=$bac$$.thu_nhap_chiu_thue_toi_da?Math.min($bac$$.thu_nhap_chiu_thue_toi_da-$thu_nha_da_chiu_thue$$,$thu_nhap_chiu_thue_thu_nhap_con_lai$$):
|
|
4
|
+
$thu_nhap_chiu_thue_thu_nhap_con_lai$$;if($thu_nhap_chiu_thue_thu_nhap_con_lai$$<=0)break;$bac$$.thu_nhap_chiu_thue=$thu_nhap_chiu_thue_thu_nhap_con_lai$$;$bac$$.tien_thue=Math.roundBy($thu_nhap_chiu_thue_thu_nhap_con_lai$$*$bac$$.thue_suat/100);$thu_nha_da_chiu_thue$$+=$thu_nhap_chiu_thue_thu_nhap_con_lai$$;$thu_nhap_chiu_thue_thu_nhap_con_lai$$=$tong_thu_nhap_chiu_thue$$-$thu_nha_da_chiu_thue$$;$i$$+=1}return $thue_tncn$$},mergeTimekeepingFragments=($fragments$$,$condition$$)=>{const {loai_luong:$loai_luong$$,
|
|
5
|
+
so_ngay_lam_mot_thang:$so_ngay_lam_mot_thang$$}=$condition$$;let $nvs_merged_map$$={};$fragments$$.forEach($frag$$=>{$frag$$.ngay_bat_dau_lam&&($frag$$.ngay_bat_dau_lam=moment($frag$$.ngay_bat_dau_lam).startOf("date").toDate());$frag$$.ngay_nghi_viec&&($frag$$.ngay_nghi_viec=moment($frag$$.ngay_nghi_viec).endOf("date").toDate());if($frag$$.tinh_luong&&(!$frag$$.ngay_bat_dau_lam||$frag$$.ngay_bat_dau_lam.getTime()<=$condition$$.den_ngay.getTime())&&(!$frag$$.ngay_nghi_viec||$frag$$.ngay_nghi_viec.getTime()>
|
|
6
|
+
$condition$$.tu_ngay.getTime())){var $luong_co_ban_target$$=$frag$$.luong_co_ban||0;if($frag$$.is_virtual_holiday){var $don_gia_ngay$$=$frag$$[$frag$$.loai_don_gia_ngay_cong]||Math.roundBy($luong_co_ban_target$$/$so_ngay_lam_mot_thang$$);var $ten_don_gia$$=`Ngh\u1ec9 L\u1ec5/T\u1ebft: ${$frag$$.ten_le||"C\u00f3 h\u01b0\u1edfng l\u01b0\u01a1ng"}`}else $loai_luong$$==1?($luong_co_ban_target$$=$frag$$.luong_thu_viec||0,$don_gia_ngay$$=$frag$$[$frag$$.loai_don_gia_ngay_cong]||Math.roundBy($luong_co_ban_target$$/
|
|
7
|
+
$so_ngay_lam_mot_thang$$),$ten_don_gia$$=`L\u01b0\u01a1ng th\u1eed vi\u1ec7c (${$frag$$.loai_don_gia_ngay_cong})`):($don_gia_ngay$$=$frag$$[$frag$$.loai_don_gia_ngay_cong]||Math.roundBy($luong_co_ban_target$$/$so_ngay_lam_mot_thang$$),$ten_don_gia$$=`L\u01b0\u01a1ng ch\u00ednh th\u1ee9c (${$frag$$.loai_don_gia_ngay_cong})`);var $tien_cong$$=Math.roundBy($don_gia_ngay$$*$frag$$.ngay_cong),$tien_phep$$=Math.roundBy($don_gia_ngay$$*$frag$$.ngay_phep),$tien_tang_ca$$=Math.roundBy($don_gia_ngay$$*$frag$$.ngay_tang_ca);
|
|
8
|
+
$nvs_merged_map$$[$frag$$.ma_nv]||($nvs_merged_map$$[$frag$$.ma_nv]=_.cloneDeep($frag$$),Object.assign($nvs_merged_map$$[$frag$$.ma_nv],{ngay_phep:0,ngay_khong_phep:0,ngay_tang_ca:0,tong_ngay_khong_luong:0,tong_ngay_cong_tinh_luong:0,so_ngay_tinh_phu_cap:0,so_luong_ngay_tang_ca_mien_thue:0,ct_luong_tg:[],luong_theo_ngay_cong:0,tong_tien_luong_tg:0,tru_luong:0,luong_phep:0,luong_tang_ca:0,don_gia_binh_quan_chuan:Math.roundBy($luong_co_ban_target$$/$so_ngay_lam_mot_thang$$)}));$luong_co_ban_target$$=
|
|
9
|
+
$nvs_merged_map$$[$frag$$.ma_nv];$luong_co_ban_target$$.ngay_phep+=$frag$$.ngay_phep;$luong_co_ban_target$$.ngay_khong_phep+=$frag$$.ngay_khong_phep||0;$luong_co_ban_target$$.ngay_tang_ca+=$frag$$.ngay_tang_ca;$luong_co_ban_target$$.tong_ngay_cong_tinh_luong+=$frag$$.ngay_cong+$frag$$.ngay_phep;$luong_co_ban_target$$.so_luong_ngay_tang_ca_mien_thue+=$frag$$.so_luong_ngay_tang_ca_mien_thue;$luong_co_ban_target$$.so_ngay_tinh_phu_cap+=$frag$$.so_ngay_tinh_phu_cap;$frag$$.ngay_cong>0&&$luong_co_ban_target$$.ct_luong_tg.push({loai:"NC",
|
|
10
|
+
dien_giai:`${$ten_don_gia$$}`,so_luong:$frag$$.ngay_cong,don_gia:$don_gia_ngay$$,thanh_tien:$tien_cong$$});$frag$$.ngay_phep>0&&$luong_co_ban_target$$.ct_luong_tg.push({loai:"NP",dien_giai:`L\u01b0\u01a1ng ngh\u1ec9 ph\u00e9p theo m\u1ee9c ${$ten_don_gia$$}`,so_luong:$frag$$.ngay_phep,don_gia:$don_gia_ngay$$,thanh_tien:$tien_phep$$});$frag$$.ngay_tang_ca>0&&$luong_co_ban_target$$.ct_luong_tg.push({loai:"TC",dien_giai:`L\u01b0\u01a1ng t\u0103ng ca (quy \u0111\u1ed5i) theo m\u1ee9c ${$ten_don_gia$$}`,
|
|
11
|
+
so_luong:$frag$$.ngay_tang_ca,don_gia:$don_gia_ngay$$,thanh_tien:$tien_tang_ca$$});$luong_co_ban_target$$[`${$frag$$.loai_don_gia_ngay_cong}`]=$tien_cong$$+$tien_tang_ca$$+$tien_phep$$;$luong_co_ban_target$$.luong_theo_ngay_cong+=$tien_cong$$;$luong_co_ban_target$$.luong_tang_ca+=$tien_tang_ca$$;$luong_co_ban_target$$.luong_phep+=$tien_phep$$;$luong_co_ban_target$$.tong_ngay_khong_luong=$so_ngay_lam_mot_thang$$-$luong_co_ban_target$$.tong_ngay_cong_tinh_luong;$luong_co_ban_target$$.tong_tien_luong_tg+=
|
|
12
|
+
$luong_co_ban_target$$[`${$frag$$.loai_don_gia_ngay_cong}`]}});return Object.values($nvs_merged_map$$)},calculateTimeBasedSalary=async($nv$$,$condition$$)=>{let {tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$,loai_luong:$loai_luong$$,so_ngay_lam_mot_thang:$so_ngay_lam_mot_thang$$}=$condition$$;$nv$$.tinh_luong_theo_ngay||($nv$$.tinh_luong_theo_ngay=moment($tu_ngay$$).startOf("month").toDate().getTime()<moment($tu_ngay$$).startOf("date").toDate().getTime()||$nv$$.ngay_bat_dau_lam&&$nv$$.ngay_bat_dau_lam.getTime()>
|
|
13
|
+
$tu_ngay$$.getTime()||$nv$$.ngay_nghi_viec&&$nv$$.ngay_nghi_viec.getTime()<$den_ngay$$.getTime());$nv$$.so_ngay_lam_mot_thang=$so_ngay_lam_mot_thang$$;$condition$$=$nv$$.luong_bhxh;$loai_luong$$==1?($nv$$.thu_viec=!0,$nv$$.luong_co_ban=$nv$$.luong_thu_viec,$condition$$=0):($nv$$.thu_viec=!1,$nv$$.thu_viec_den_ngay&&(new Date($nv$$.thu_viec_den_ngay)).getTime()>=moment($den_ngay$$).startOf("month").toDate().getTime()&&($condition$$=0));if($nv$$.cham_cong)if($nv$$.tinh_luong_theo_ngay)$nv$$.tru_luong=
|
|
14
|
+
0,$nv$$.luong_binh_quan_ngay=$nv$$.tong_ngay_cong_tinh_luong?Math.roundBy($nv$$.luong_theo_ngay_cong/$nv$$.tong_ngay_cong_tinh_luong):0,$nv$$.luong_thang=$nv$$.tong_tien_luong_tg;else{$nv$$.ct_luong_tg=$nv$$.ct_luong_tg.filter($c$$=>$c$$.loai!="TC");$nv$$.ct_luong_tg.push({loai:"LCB",dien_giai:"L\u01b0\u01a1ng c\u01a1 b\u1ea3n th\u00e1ng",so_luong:1,don_gia:$nv$$.luong_co_ban,thanh_tien:$nv$$.luong_co_ban});let $tien_tang_ca$$=$nv$$.luong_tang_ca,$tien_tru$$=Math.roundBy($nv$$.don_gia_binh_quan_chuan*
|
|
15
|
+
$nv$$.tong_ngay_khong_luong);$tien_tru$$>0&&$nv$$.ct_luong_tg.push({loai:"TRU",dien_giai:"Tr\u1eeb l\u01b0\u01a1ng ngh\u1ec9",so_luong:$nv$$.tong_ngay_khong_luong,don_gia:-$nv$$.don_gia_binh_quan_chuan,thanh_tien:-$tien_tru$$});$nv$$.luong_binh_quan_ngay=$nv$$.don_gia_binh_quan_chuan;$nv$$.tru_luong=$tien_tru$$;$nv$$.luong_thang=$nv$$.luong_co_ban+$tien_tang_ca$$-$tien_tru$$}else $nv$$.luong_thang=$nv$$.luong_co_ban,$nv$$.ct_luong_tg=[{loai:"LCB",dien_giai:"L\u01b0\u01a1ng c\u1ee9ng (kh\u00f4ng ch\u1ea5m c\u00f4ng)",
|
|
16
|
+
so_luong:1,don_gia:$nv$$.luong_co_ban,thanh_tien:$nv$$.luong_co_ban}];$nv$$.luong_bhxh_calculator=$condition$$;return $nv$$},calculateSalesBasedSalary=async($nv$$,$condition$$,$data_tinh_luong_ds_storage$$)=>{let {id_app:$id_app$$,tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$}=$condition$$,$id_used$$=[];var $csluongtheods_query_luong_sl$$={id_app:$id_app$$,status:!0,$or:[{ds_nv:$nv$$.ma_nv},{ds_bp:$nv$$.ma_bp}]};$csluongtheods_query_luong_sl$$=await global.getModel("csluongtheods").find($csluongtheods_query_luong_sl$$).lean();
|
|
17
|
+
$csluongtheods_query_luong_sl$$.sort(($a$$,$b$$)=>{const $getPriorityScore$$=$cs$$=>{let $score$$=0;Array.isArray($cs$$.ds_ma_kh)&&$cs$$.ds_ma_kh.length>0&&($score$$+=1E4);$cs$$.nh_kh3&&($score$$+=5E3);$cs$$.nh_kh2&&($score$$+=4E3);$cs$$.nh_kh&&($score$$+=3E3);Array.isArray($cs$$.ds_ma_vt)&&$cs$$.ds_ma_vt.length>0&&($score$$+=1E3);$cs$$.ma_nvt3&&($score$$+=500);$cs$$.ma_nvt2&&($score$$+=400);$cs$$.ma_nvt&&($score$$+=300);Array.isArray($cs$$.ds_loai_phuong_tien)&&$cs$$.ds_loai_phuong_tien.length>0&&
|
|
18
|
+
($score$$+=100);return $score$$};return $getPriorityScore$$($b$$)-$getPriorityScore$$($a$$)});for(let $csluong$$ of $csluongtheods_query_luong_sl$$){var $data_sokho_ds_ct_query_san_luong$$=($csluong$$.ds_ma_ct||[]).filter($c$$=>$c$$).map($c$$=>$c$$.toUpperCase());$data_sokho_ds_ct_query_san_luong$$={id_app:$id_app$$,ngay_ct:{$gte:$tu_ngay$$,$lte:$den_ngay$$},$or:[{[$csluong$$.doi_tuong_nhan_vien]:$nv$$.ma_nv},{phu_xe:$nv$$.ma_nv}],ma_ct:{$in:$data_sokho_ds_ct_query_san_luong$$}};$csluong$$.cv_kho||
|
|
19
|
+
($data_sokho_ds_ct_query_san_luong$$._id={$nin:$id_used$$});if($csluong$$.ds_ma_vt?.length>0)$data_sokho_ds_ct_query_san_luong$$.ma_vt={$in:$csluong$$.ds_ma_vt};else if($csluong$$.ma_nvt||$csluong$$.ma_nvt2||$csluong$$.ma_nvt3){var $ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$={id_app:$id_app$$};$csluong$$.ma_nvt&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.ma_nvt=$csluong$$.ma_nvt);$csluong$$.ma_nvt2&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.ma_nvt2=$csluong$$.ma_nvt2);$csluong$$.ma_nvt3&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.ma_nvt3=
|
|
20
|
+
$csluong$$.ma_nvt3);$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=(await global.getModel("dmvt").find($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$,{ma_vt:1}).lean()).map($v$$=>$v$$.ma_vt);$data_sokho_ds_ct_query_san_luong$$.ma_vt={$in:$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$}}if($csluong$$.ds_ma_kh?.length>0)$data_sokho_ds_ct_query_san_luong$$.ma_kh=$csluong$$.loai_tru_kh?{$nin:$csluong$$.ds_ma_kh}:{$in:$csluong$$.ds_ma_kh};else if($csluong$$.nh_kh||$csluong$$.nh_kh2||$csluong$$.nh_kh3)$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=
|
|
21
|
+
{id_app:$id_app$$},$csluong$$.nh_kh&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.nh_kh=$csluong$$.nh_kh),$csluong$$.nh_kh2&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.nh_kh2=$csluong$$.nh_kh2),$csluong$$.nh_kh3&&($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$.nh_kh3=$csluong$$.nh_kh3),$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=(await global.getModel("customer").find($ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$,{ma_kh:1}).lean()).map($v$$=>$v$$.ma_kh),$data_sokho_ds_ct_query_san_luong$$.ma_kh={$in:$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$};
|
|
22
|
+
$csluong$$.ds_loai_phuong_tien?.length>0&&($data_sokho_ds_ct_query_san_luong$$.loai_phuong_tien={$in:$csluong$$.ds_loai_phuong_tien});$data_sokho_ds_ct_query_san_luong$$=await global.getModel("sokho").find($data_sokho_ds_ct_query_san_luong$$).lean();$csluong$$.ma_dvt_ds?await $data_sokho_ds_ct_query_san_luong$$.asyncJoinModel2($id_app$$,"dmqddvt",{where:$item$$=>({ma_vt:$item$$.ma_vt,ma_dvt:$csluong$$.ma_dvt_ds}),setFields:($item$$,$he_so_qd_ref$$)=>{$he_so_qd_ref$$&&$he_so_qd_ref$$.tu?($item$$.ma_dvt_bc=
|
|
23
|
+
$csluong$$.ma_dvt_ds,$he_so_qd_ref$$=$he_so_qd_ref$$.mau/$he_so_qd_ref$$.tu,$item$$.sl_xuat_qd_bc=$he_so_qd_ref$$*($item$$.sl_xuat_qd||0),$item$$.sl_nhap_qd_bc=$he_so_qd_ref$$*($item$$.sl_nhap_qd||0)):($item$$.sl_xuat_qd_bc=$item$$.sl_xuat_qd,$item$$.sl_nhap_qd_bc=$item$$.sl_nhap_qd)}}):$data_sokho_ds_ct_query_san_luong$$.forEach($item$$=>{$item$$.sl_xuat_qd_bc=$item$$.sl_xuat;$item$$.sl_nhap_qd_bc=$item$$.sl_nhap});$csluong$$.cv_kho||($id_used$$=[...$id_used$$,...$data_sokho_ds_ct_query_san_luong$$.map($d$$=>
|
|
24
|
+
$d$$._id.toString())]);$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=0;if($csluong$$.tinh_theo_tong_ds){let $tong_doanh_so_quydoi$$=$data_sokho_ds_ct_query_san_luong$$.map($s$$=>{var $cong_thuc_sl_goc$$=$s$$[$csluong$$.field_sl]||0;let $ty_le_phu$$=$csluong$$.ty_le_nv_phu_giup||0;let $dien_giai$$;if($s$$.phu_xe&&$s$$.phu_xe.trim()!==""&&$s$$.phu_xe!==$s$$[$csluong$$.doi_tuong_nhan_vien]){var $ds_thuc_phan_phu_xe$$=Math.roundBy($cong_thuc_sl_goc$$*$ty_le_phu$$/100);$s$$.phu_xe==$nv$$.ma_nv?($dien_giai$$=
|
|
25
|
+
"Ph\u1ee5 xe",$cong_thuc_sl_goc$$=`${$cong_thuc_sl_goc$$} * ${$ty_le_phu$$}%`):($ds_thuc_phan_phu_xe$$=$cong_thuc_sl_goc$$-$ds_thuc_phan_phu_xe$$,$dien_giai$$="L\u00e1i ch\u00ednh",$cong_thuc_sl_goc$$=`${$cong_thuc_sl_goc$$} - (${$cong_thuc_sl_goc$$} * ${$ty_le_phu$$}%)`)}else $ds_thuc_phan_phu_xe$$=$cong_thuc_sl_goc$$,$dien_giai$$="L\u00e1i ch\u00ednh (100%)",$cong_thuc_sl_goc$$=`${$cong_thuc_sl_goc$$}`;$s$$.ma_nv=$nv$$.ma_nv;$s$$.dien_giai_luong=$dien_giai$$;$s$$.cong_thuc_doanh_so=$cong_thuc_sl_goc$$;
|
|
26
|
+
return $s$$.doanh_so_quydoi=$ds_thuc_phan_phu_xe$$}).reduce(($a$$,$b$$)=>$a$$+$b$$,0),$dinh_muc$$=$csluong$$.ds_yeu_cau||1,$don_gia$$=$csluong$$.don_gia_luong||0;$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=Math.roundBy(Math.trunc($tong_doanh_so_quydoi$$/$dinh_muc$$)*$don_gia$$,0);$data_tinh_luong_ds_storage$$&&($data_tinh_luong_ds_storage$$.push({id_app:$condition$$.id_app,thang:$condition$$.thang,nam:$condition$$.nam,ma_nv:$nv$$.ma_nv,ngay_ct:$condition$$.den_ngay,so_ct:"TONG_HOP",id_cs_luong:$csluong$$._id.toString(),
|
|
27
|
+
ten_cs_luong:$csluong$$.ten_cs,dien_giai_luong:`T\u1ed5ng h\u1ee3p l\u01b0\u01a1ng theo DS (Ch\u00ednh s\u00e1ch: ${$csluong$$.ten_cs||"..."})`,cong_thuc:`(${$tong_doanh_so_quydoi$$} / ${$dinh_muc$$}) * ${$don_gia$$}`,doanh_so:$tong_doanh_so_quydoi$$,luong_theo_ds:$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$}),$data_tinh_luong_ds_storage$$.push(...$data_sokho_ds_ct_query_san_luong$$.map($s$$=>({...$s$$,id_app:$condition$$.id_app,thang:$condition$$.thang,nam:$condition$$.nam,luong_theo_ds:0,ghi_chu:"Chi ti\u1ebft th\u00e0nh ph\u1ea7n c\u1ee7a l\u01b0\u01a1ng t\u1ed5ng h\u1ee3p"}))))}else $ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$=
|
|
28
|
+
$data_sokho_ds_ct_query_san_luong$$.map($s$$=>{let $sl_goc$$=$s$$[$csluong$$.field_sl]||0,$ty_le_phu$$=$s$$.phu_xe?$csluong$$.ty_le_nv_phu_giup||0:0,$dinh_muc$$=$csluong$$.ds_yeu_cau||1,$don_gia$$=$csluong$$.don_gia_luong||0,$luong_goc$$=Math.trunc($sl_goc$$/$dinh_muc$$)*$don_gia$$;let $dien_giai$$,$cong_thuc$$;$csluong$$.nh_kh3=="696afe74baac18c80216d7df"&&Logger.warn(JSON.stringify({don_gia:$don_gia$$,luong_goc:$luong_goc$$}));if($s$$.phu_xe&&$s$$.phu_xe.trim()!==""&&$s$$.phu_xe!==$s$$[$csluong$$.doi_tuong_nhan_vien]){var $luong_thuc_nhan_tien_phu_xe$$=
|
|
29
|
+
Math.roundBy($luong_goc$$*$ty_le_phu$$/100);$s$$.phu_xe==$nv$$.ma_nv?($dien_giai$$=`Ph\u1ee5 xe (${$ty_le_phu$$}%)`,$cong_thuc$$=`(${$sl_goc$$}/${$dinh_muc$$}*${$don_gia$$}) * ${$ty_le_phu$$}%`):($luong_thuc_nhan_tien_phu_xe$$=$luong_goc$$-$luong_thuc_nhan_tien_phu_xe$$,$dien_giai$$=`L\u00e1i ch\u00ednh (${$ty_le_phu$$}%)`,$cong_thuc$$=`(${$sl_goc$$}/${$dinh_muc$$}*${$don_gia$$}) - Ph\u1ee5 xe`)}else $luong_thuc_nhan_tien_phu_xe$$=$luong_goc$$,$dien_giai$$="L\u00e1i ch\u00ednh (100%)",$cong_thuc$$=
|
|
30
|
+
`${$sl_goc$$}/${$dinh_muc$$} * ${$don_gia$$}`;$s$$.ma_nv=$nv$$.ma_nv;$s$$.id_app=$condition$$.id_app;$s$$.thang=$condition$$.thang;$s$$.nam=$condition$$.nam;$s$$.luong_theo_ds=$luong_thuc_nhan_tien_phu_xe$$;$s$$.luong_goc=$luong_goc$$;$s$$.dien_giai_luong=$dien_giai$$;$s$$.id_cs_luong=$csluong$$._id.toString();$s$$.ten_cs_luong=$csluong$$.ten_cs;$s$$.cong_thuc=$cong_thuc$$;$s$$.doanh_so=$sl_goc$$;$s$$.ds_yeu_cau=$dinh_muc$$;$s$$.don_gia_luong=$don_gia$$;$s$$.ty_le_nv_phu_giup=$ty_le_phu$$;delete $s$$._id;
|
|
31
|
+
delete $s$$.__v;$data_tinh_luong_ds_storage$$&&$data_tinh_luong_ds_storage$$.push($s$$);return $luong_thuc_nhan_tien_phu_xe$$}).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$csluong$$.luong=$ds_ma_kh_ds_ma_vt_luong_theo_ds_q_q$$}$nv$$.ct_luong_theo_ds=$csluongtheods_query_luong_sl$$.filter($c$$=>$c$$.luong);$nv$$.luong_theo_ds=$nv$$.ct_luong_theo_ds.map($d$$=>$d$$.luong).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$nv$$.luong_thang=Number($nv$$.luong_thang||0)+Number($nv$$.luong_theo_ds)},calculateInsurance=($nv$$,$condition$jscomp$4_tu_ngay$$,
|
|
32
|
+
$cac_khoan_giam_tru$$)=>{if($nv$$.thu_viec||$nv$$.luong_ctv)$nv$$.gt_bhxh=0,$nv$$.cty_bhxh=0,$nv$$.gt_bhyt=0,$nv$$.cty_bhyt=0,$nv$$.gt_bhtn=0,$nv$$.cty_bhtn=0,$nv$$.gt_kpcd=0,$nv$$.cty_kpcd=0,$nv$$.giam_tru=[],$nv$$.tong_bao_hiem_nv=0,$nv$$.tong_bao_hiem_cty=0;else{({tu_ngay:$condition$jscomp$4_tu_ngay$$}=$condition$jscomp$4_tu_ngay$$);var $luong_bhxh$$=$nv$$.luong_bhxh_calculator;$nv$$.gt_bhxh=0;$nv$$.cty_bhxh=0;$nv$$.gt_bhyt=0;$nv$$.cty_bhyt=0;$nv$$.gt_bhtn=0;$nv$$.cty_bhtn=0;$nv$$.gt_kpcd=0;$nv$$.cty_kpcd=
|
|
33
|
+
0;var $giam_tru$$=[];if(!$nv$$.ngay_tinh_bhxh||moment($nv$$.ngay_tinh_bhxh).startOf("date").toDate().getTime()<=$condition$jscomp$4_tu_ngay$$.getTime())$giam_tru$$=_.cloneDeep($cac_khoan_giam_tru$$).filter($gt$$=>(!$gt$$.ma_nv||$gt$$.ma_nv==0||$gt$$.ma_nv.indexOf($nv$$.ma_nv)>=0)&&(!$gt$$.ma_bp||$gt$$.ma_bp.length==0||$gt$$.ma_bp.indexOf($nv$$.ma_bp)>=0)),$giam_tru$$.forEach($gt$$=>{let $userVal$$=0,$companyVal$$=0;const $calc$$=$typeInfo$$=>{$typeInfo$$&&($userVal$$=Math.roundBy($gt$$.ty_le_nv*$luong_bhxh$$/
|
|
34
|
+
100),$companyVal$$=Math.roundBy($gt$$.ty_le_cty*$luong_bhxh$$/100))};$gt$$.kieu_trich=="BHXH"?($calc$$($nv$$.bhxh),$nv$$.gt_bhxh+=$userVal$$,$nv$$.cty_bhxh+=$companyVal$$):$gt$$.kieu_trich=="BHYT"?($calc$$($nv$$.bhyt),$nv$$.gt_bhyt+=$userVal$$,$nv$$.cty_bhyt+=$companyVal$$):$gt$$.kieu_trich=="BHTN"?($calc$$($nv$$.bhtn),$nv$$.gt_bhtn+=$userVal$$,$nv$$.cty_bhtn+=$companyVal$$):$gt$$.kieu_trich=="KPCD"?($userVal$$=Math.roundBy($gt$$.ty_le_nv*$luong_bhxh$$/100),$companyVal$$=Math.roundBy($gt$$.ty_le_cty*
|
|
35
|
+
$luong_bhxh$$/100),$nv$$.gt_kpcd+=$userVal$$,$nv$$.cty_kpcd+=$companyVal$$):($gt$$.nv=$gt$$.ty_le_nv?Math.roundBy($gt$$.ty_le_nv*$luong_bhxh$$/100):$gt$$.nv||0,$gt$$.cty=$gt$$.ty_le_cty?Math.roundBy($gt$$.ty_le_cty*$luong_bhxh$$/100):$gt$$.cty||0);["BHXH","BHYT","BHTN","KPCD"].includes($gt$$.kieu_trich)&&($gt$$.nv=$userVal$$,$gt$$.cty=$companyVal$$)});$nv$$.giam_tru=$giam_tru$$;$nv$$.tong_bao_hiem_nv=$giam_tru$$.map($g$$=>$g$$.nv).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$nv$$.tong_bao_hiem_cty=$giam_tru$$.map($g$$=>
|
|
36
|
+
$g$$.cty).reduce(($a$$,$b$$)=>$a$$+$b$$,0)}},calculateAllowances=async($nv$$,$condition$$,$csphucap_processed_phu_cap$$)=>{let {id_app:$id_app$$,thang:$thang$$,nam:$nam$$,tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$,tyGiaMap:$tyGiaMap$$,so_ngay_lam_mot_thang:$so_ngay_lam_mot_thang$$}=$condition$$;const $getTyGia$$=$ma_ma_nt$$=>{if(!$ma_ma_nt$$)return 1;$ma_ma_nt$$=$ma_ma_nt$$.toUpperCase();return $tyGiaMap$$[$ma_ma_nt$$]||1};let $phu_cap_mot_lan$$=[];if(!$condition$$.cac_khoan_phu_cap?.length){$phu_cap_mot_lan$$=
|
|
37
|
+
await phucap.find({id_app:$id_app$$,thang:$thang$$,nam:$nam$$,ma_nv:{$in:["",null,void 0,$nv$$.ma_nv]},ma_bp:{$in:["",null,void 0,$nv$$.ma_bp]}}).lean();$phu_cap_mot_lan$$.forEach($p$$=>{$p$$.dvt="month";let $ty_gia$$=$getTyGia$$($p$$.ma_nt);$p$$.tien_pc=Math.roundBy(($p$$.tien||0)*$ty_gia$$);$p$$.max_mien_thue&&($p$$.max_mien_thue=Math.roundBy($p$$.max_mien_thue*$ty_gia$$))});var $phu_cap_mot_lan_them_query_san_luong$$={id_app:$id_app$$,ma_nv:$nv$$.ma_nv,nxt:2,ma_ct:{$in:["HD2","PBL","SO1"]},ngay_ct:{$gte:$tu_ngay$$,
|
|
38
|
+
$lte:$den_ngay$$}};$phu_cap_mot_lan_them_query_san_luong$$=await global.getModel("sokho").find($phu_cap_mot_lan_them_query_san_luong$$).lean();$phu_cap_mot_lan_them_query_san_luong$$=await $phu_cap_mot_lan_them_query_san_luong$$.asyncGroupBy(["ma_vt"],["sl_xuat"]);await $phu_cap_mot_lan_them_query_san_luong$$.asyncJoinModel2($id_app$$,"dmvt",{where:"ma_vt",fields:["ten_phu_cap_them","ten_vt","luong_tho_theo_ds","ds_yeu_cau"]});$phu_cap_mot_lan_them_query_san_luong$$=$phu_cap_mot_lan_them_query_san_luong$$.filter($d$$=>
|
|
39
|
+
$d$$.luong_tho_theo_ds&&$d$$.ds_yeu_cau&&$d$$.sl_xuat>=$d$$.ds_yeu_cau);$phu_cap_mot_lan_them_query_san_luong$$=$phu_cap_mot_lan_them_query_san_luong$$.map($sl$$=>{let $pc$$={kieu:"2",id_app:$id_app$$,thang:$thang$$,nam:$nam$$,ma_nv:$nv$$.ma_nv,ten_phu_cap:$sl$$.ten_phu_cap_them||$sl$$.ten_vt,dvt:"month"};$pc$$.sl_xuat=$sl$$.sl_xuat;$pc$$.ds_yeu_cau=$sl$$.ds_yeu_cau;$pc$$.tien_pc=$pc$$.tien=Math.trunc($sl$$.sl_xuat/$sl$$.ds_yeu_cau)*$sl$$.luong_tho_theo_ds;return $pc$$});$phu_cap_mot_lan$$=[...$phu_cap_mot_lan$$,
|
|
40
|
+
...$phu_cap_mot_lan_them_query_san_luong$$]}$nv$$.cac_khoan_phat=$phu_cap_mot_lan$$.filter($r$$=>$r$$.tien<0);$nv$$.tien_phat=$nv$$.cac_khoan_phat.map($r$$=>$r$$.tien_pc).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$csphucap_processed_phu_cap$$=[...($nv$$.phu_cap||[]),...($nv$$.phu_cap_theo_bp||[]),...($csphucap_processed_phu_cap$$?.phu_cap||[])].filter($p$$=>$p$$.tu_ngay&&(new Date($p$$.tu_ngay)).getTime()>$den_ngay$$.getTime()||$p$$.den_ngay&&(new Date($p$$.den_ngay)).getTime()<$tu_ngay$$.getTime()?!1:!0).map($r$$=>
|
|
41
|
+
{var $max_mien_thue_vnd_ty_gia$$=$getTyGia$$($r$$.ma_nt);let $tien_pc$$=Math.roundBy(($r$$.tien||0)*$max_mien_thue_vnd_ty_gia$$),$max_phu_cap_vnd$$=$r$$.max_phu_cap?Math.roundBy($r$$.max_phu_cap*$max_mien_thue_vnd_ty_gia$$):0;$max_mien_thue_vnd_ty_gia$$=$r$$.max_mien_thue?Math.roundBy($r$$.max_mien_thue*$max_mien_thue_vnd_ty_gia$$):0;if($r$$.dvt=="date")$tien_pc$$=Math.roundBy($tien_pc$$*$nv$$.so_ngay_tinh_phu_cap);else if($r$$.dvt=="year"){$tien_pc$$=Math.roundBy($tien_pc$$/12);var $da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$=
|
|
42
|
+
$nv$$.tong_ngay_khong_luong;$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$>0&&($da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$=Math.roundBy($tien_pc$$/($so_ngay_lam_mot_thang$$||26)*$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$),$tien_pc$$=Math.max(0,$tien_pc$$-$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$))}else $r$$.dvt!="month"&&$r$$.dvt||($da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$=
|
|
43
|
+
$nv$$.tong_ngay_khong_luong,$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$>0&&($da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$=Math.roundBy($tien_pc$$/($so_ngay_lam_mot_thang$$||26)*$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$),$tien_pc$$=Math.max(0,$tien_pc$$-$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$)));$max_phu_cap_vnd$$>0&&($da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$=
|
|
44
|
+
($condition$$.cac_khoan_phu_cap||[]).filter($p$$=>$p$$.line==$r$$.line).map($r$$=>$r$$.tien_pc||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0),$tien_pc$$=Math.min($tien_pc$$,$max_phu_cap_vnd$$-$da_phu_cap_so_ngay_tru_so_ngay_tru$jscomp$1_tien_tru_pc_tien_tru_pc$$));$r$$.tien_pc=$tien_pc$$;$r$$.max_mien_thue&&($r$$.max_mien_thue=$max_mien_thue_vnd_ty_gia$$);return $r$$});$nv$$.cac_khoan_phu_cap=[...$csphucap_processed_phu_cap$$,...$phu_cap_mot_lan$$.filter($r$$=>$r$$.tien>0)];$nv$$.tien_phu_cap=$nv$$.cac_khoan_phu_cap.map($r$$=>
|
|
45
|
+
$r$$.tien_pc).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$nv$$.tong_phu_cap=$nv$$.tien_phu_cap+$nv$$.tien_phat},calculateTax=($nv$$,$condition$$)=>{var $phu_cap_mien_thue_tien_thue$$=$nv$$.cac_khoan_phu_cap.filter($p$$=>!$p$$.khong_mien_thue&&$p$$.tien_pc>0).map($r$$=>{let $tien_pc$$=$r$$.tien_pc;if($r$$.max_mien_thue>0){let $da_phu_cap$$=($condition$$.cac_khoan_phu_cap_mien_thue||[]).filter($p$$=>$p$$.line==$r$$.line).map($r$$=>$r$$.tien_pc||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$tien_pc$$=Math.min($tien_pc$$,
|
|
46
|
+
$r$$.max_mien_thue-$da_phu_cap$$)}$r$$.tien_pc=$tien_pc$$;return $r$$});$nv$$.thu_viec||$nv$$.luong_ctv?($phu_cap_mien_thue_tien_thue$$=[],$nv$$.ttncn_gt_phu_thuoc=0,$nv$$.ttncn_gt_tu_thien=0,$nv$$.ttncn_gt_ban_than=0):($nv$$.ttncn_gt_phu_thuoc=Math.roundBy(($nv$$.ttncn_so_nguoi_phu_thuoc||0)*($nv$$.ttncn_muc_gt_phu_thuoc||0)),$nv$$.ttncn_gt_tu_thien=0,$nv$$.ttncn_gt_ban_than=Math.roundBy(($nv$$.ttncn_so_thang_gt_ban_than||1)*($nv$$.ttncn_muc_gt_ban_than||0)));$nv$$.cac_khoan_phu_cap_mien_thue=$phu_cap_mien_thue_tien_thue$$;
|
|
47
|
+
$nv$$.tong_phu_cap_mien_thue=$phu_cap_mien_thue_tien_thue$$.map($r$$=>$r$$.tien_pc).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$nv$$.tong_thu_nhap=$nv$$.luong_thang+$nv$$.tong_phu_cap;$nv$$.luong_tang_ca_mien_thue=Math.roundBy($nv$$.don_gia_binh_quan_chuan*$nv$$.so_luong_ngay_tang_ca_mien_thue);$nv$$.ttncn_tong_thu_nhap_mien_thue=$nv$$.luong_tang_ca_mien_thue+$nv$$.tong_phu_cap_mien_thue;$nv$$.ttncn_tong_giam_tru=$nv$$.ttncn_gt_phu_thuoc+$nv$$.ttncn_gt_tu_thien+$nv$$.tong_bao_hiem_nv+$nv$$.ttncn_gt_ban_than;
|
|
48
|
+
$nv$$.ttncn_thu_nhap_chiu_thue=Math.max($nv$$.tong_thu_nhap-$nv$$.ttncn_tong_thu_nhap_mien_thue-$nv$$.ttncn_tong_giam_tru,0);$nv$$.khong_tinh_thue_tncn?$nv$$.ttncn_thue_theo_bac=[{thue_suat:0,tien_thue:0}]:$nv$$.thu_viec||$nv$$.luong_ctv?$nv$$.ttncn_thu_nhap_chiu_thue>=2E6?($phu_cap_mien_thue_tien_thue$$=Math.roundBy($nv$$.ttncn_thu_nhap_chiu_thue*10/100),$nv$$.ttncn_thue_theo_bac=[{thue_suat:10,tien_thue:$phu_cap_mien_thue_tien_thue$$}]):$nv$$.ttncn_thue_theo_bac=[{thue_suat:0,tien_thue:0}]:$nv$$.ttncn_thue_theo_bac=
|
|
49
|
+
tinhThueTNCV($nv$$.ttncn_thu_nhap_chiu_thue);$nv$$.ttncn_tong_thue=$nv$$.ttncn_thue_theo_bac.map($b$$=>$b$$.tien_thue||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$nv$$.tong_luong=$nv$$.tong_thu_nhap-$nv$$.tong_bao_hiem_nv-$nv$$.ttncn_tong_thue;$nv$$.id_app=$condition$$.id_app;$nv$$.thang=$condition$$.thang;$nv$$.nam=$condition$$.nam;$nv$$.loai_luong=$condition$$.loai_luong},tinhluong=async($condition$$,$callback$$)=>{let {tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$,id_app:$id_app$$,ma_nv:$ma_nv$$,nv:$nv$$}=
|
|
50
|
+
$condition$$;const $data_tinh_luong_ds$$=[];var $congs_nv_congs_nvs_fragments_virtual_frag$$=await chamcong.find({ma_nv:$ma_nv$$,id_app:$id_app$$,ngay:{$gte:$tu_ngay$$,$lte:$den_ngay$$}}).lean();if($nv$$.cham_cong){var $danh_sach_le_tet_nvs_ready_to_calc$$=await dmletet.find({id_app:$id_app$$}).lean();if($danh_sach_le_tet_nvs_ready_to_calc$$.length>0){let $date$$=new Date($tu_ngay$$),$endDate$$=new Date($den_ngay$$),$startWorkTs$$=$nv$$.ngay_bat_dau_lam?moment($nv$$.ngay_bat_dau_lam).startOf("day").toDate().getTime():
|
|
51
|
+
0,$endWorkTs$$=$nv$$.ngay_nghi_viec?moment($nv$$.ngay_nghi_viec).endOf("day").toDate().getTime():Infinity;for(;$date$$.getTime()<=$endDate$$.getTime();){let $currentDay$$=$date$$.getDate(),$currentMonth$$=$date$$.getMonth()+1,$isHoliday$$=$danh_sach_le_tet_nvs_ready_to_calc$$.find($le$$=>$le$$.ngay==$currentDay$$&&$le$$.thang==$currentMonth$$);if($isHoliday$$&&$isHoliday$$.ma_loai_cong){let $checkTs$$=moment($date$$).startOf("day").toDate().getTime();$checkTs$$>=$startWorkTs$$&&$checkTs$$<=$endWorkTs$$&&
|
|
52
|
+
($congs_nv_congs_nvs_fragments_virtual_frag$$.find($c$$=>moment($c$$.ngay).format("YYYY-MM-DD")===moment($date$$).format("YYYY-MM-DD"))||$congs_nv_congs_nvs_fragments_virtual_frag$$.push({id_app:$id_app$$,ma_nv:$ma_nv$$,ma_bp:$nv$$.ma_bp,ngay:new Date($date$$),ma_loai_cong:$isHoliday$$.ma_loai_cong,loai_don_gia_ngay_cong:"luong_ngay_cong",sl_cong:1,is_virtual_holiday:!0,ten_le:$isHoliday$$.ten_le}))}$date$$.setDate($date$$.getDate()+1)}}}await $congs_nv_congs_nvs_fragments_virtual_frag$$.filter($c$$=>
|
|
53
|
+
!$c$$.ma_bp).asyncJoinModel2($id_app$$,dmnv,[{where:{ma_nv:"ma_nv"},fields:["ma_bp"]}]);await $congs_nv_congs_nvs_fragments_virtual_frag$$.asyncJoinModel2($id_app$$,dmloaicong,[{where:{ma_loai_cong:"ma_loai_cong"},fields:"ngay_cong ngay_phep ngay_khong_phep ngay_khong_luong la_cong_lam_them tinh_phu_cap loai_don_gia_ngay_cong".split(" ")}]);$congs_nv_congs_nvs_fragments_virtual_frag$$.forEach($c$$=>{$c$$.loai_don_gia_ngay_cong&&$c$$.loai_don_gia_ngay_cong!="default"||($c$$.loai_don_gia_ngay_cong=
|
|
54
|
+
"luong_ngay_cong");$c$$.so_ngay_tinh_phu_cap=$c$$.tinh_phu_cap?Math.min($c$$.ngay_cong||0,1):0;$c$$.la_cong_lam_them&&($c$$.ngay_tang_ca=$c$$.ngay_cong,$c$$.ngay_cong=0,$c$$.so_luong_ngay_tang_ca_mien_thue=Math.max($c$$.ngay_tang_ca-1,0));$c$$.sl_cong=$c$$.sl_cong||1;"ngay_cong ngay_phep ngay_khong_phep ngay_khong_luong ngay_tang_ca so_ngay_tinh_phu_cap so_luong_ngay_tang_ca_mien_thue".split(" ").forEach($k$$=>$c$$[$k$$]*=$c$$.sl_cong)});$danh_sach_le_tet_nvs_ready_to_calc$$=[];$nv$$.cham_cong?($congs_nv_congs_nvs_fragments_virtual_frag$$=
|
|
55
|
+
$congs_nv_congs_nvs_fragments_virtual_frag$$.filter($c$$=>$c$$.ma_nv===$ma_nv$$),$danh_sach_le_tet_nvs_ready_to_calc$$=[...$danh_sach_le_tet_nvs_ready_to_calc$$,...$congs_nv_congs_nvs_fragments_virtual_frag$$]):($congs_nv_congs_nvs_fragments_virtual_frag$$=generateVirtualTimekeepingForVIP($nv$$,$condition$$),Object.assign($congs_nv_congs_nvs_fragments_virtual_frag$$,$nv$$),$danh_sach_le_tet_nvs_ready_to_calc$$.push($congs_nv_congs_nvs_fragments_virtual_frag$$));$congs_nv_congs_nvs_fragments_virtual_frag$$=
|
|
56
|
+
await $danh_sach_le_tet_nvs_ready_to_calc$$.asyncGroupBy(["ma_nv","ma_bp","loai_don_gia_ngay_cong"],"ngay_cong ngay_phep ngay_khong_phep ngay_khong_luong ngay_tang_ca so_ngay_tinh_phu_cap so_luong_ngay_tang_ca_mien_thue".split(" "));await $congs_nv_congs_nvs_fragments_virtual_frag$$.asyncJoinModel2($id_app$$,dmnv,[{where:{ma_nv:"ma_nv"},fields:"ten_nv ma_kho luong_ngay_cong luong_ngay_cong2 luong_ngay_cong3 luong_co_ban luong_thu_viec thu_viec_den_ngay ngay_bat_dau_lam ngay_nghi_viec luong_bhxh phu_cap cham_cong tinh_luong bhxh bhyt bhtn ttncn_so_nguoi_phu_thuoc ttncn_muc_gt_phu_thuoc ttncn_so_thang_gt_ban_than ttncn_muc_gt_ban_than luong_ctv".split(" ")}]);
|
|
57
|
+
let $nvs$$=mergeTimekeepingFragments($congs_nv_congs_nvs_fragments_virtual_frag$$,$condition$$);await $nvs$$.asyncJoinModel2($id_app$$,dmbp,[{where:{ma_bp:"ma_bp"},fields:["ten_bp","tinh_luong_theo_ngay",{phu_cap_theo_bp:"phu_cap"}]}]);let $cac_khoan_giam_tru$$=await ckgtluong.find({id_app:$id_app$$,status:!0}).lean(),$tyGiaMap$$={VND:1};(await global.getModel("currency").find({id_app:$id_app$$}).lean()).forEach($c$$=>{$c$$.ma_nt&&$c$$.ty_gia&&($tyGiaMap$$[$c$$.ma_nt.toUpperCase()]=Number($c$$.ty_gia))});
|
|
58
|
+
$condition$$.tyGiaMap=$tyGiaMap$$;async.mapLimit($nvs$$,20,async $nv$$=>{try{await calculateTimeBasedSalary($nv$$,$condition$$);await calculateSalesBasedSalary($nv$$,$condition$$,$data_tinh_luong_ds$$);calculateInsurance($nv$$,$condition$$,$cac_khoan_giam_tru$$);const $csphucap$$=await global.getModel("csphucap").findOne({id_app:$id_app$$,status:!0,$or:[{ds_nv:$nv$$.ma_nv},{ds_bp:$nv$$.ma_bp}]}).lean();await calculateAllowances($nv$$,$condition$$,$csphucap$$);calculateTax($nv$$,$condition$$);return null}catch($err$$){return $err$$}},
|
|
59
|
+
async $e$$=>{if($e$$)return $callback$$($e$$);try{await bangtinhluong.create($nvs$$);if($data_tinh_luong_ds$$.length>0){const $chitietluongds$$=$data_tinh_luong_ds$$.filter($d$$=>$d$$.luong_theo_ds);await global.getModel("chitietluongds").create($chitietluongds$$)}$callback$$(null,$nvs$$)}catch($e$$){$callback$$($e$$.message)}})};
|
|
60
|
+
module.exports=function($router$$){new controller($router$$,"tinhluong",async($nhanvien_req$$,$callback$$)=>{let $thang$$=Number($nhanvien_req$$.query.thang),$nam$$=Number($nhanvien_req$$.query.nam),$id_app$$=$nhanvien_req$$.query.id_app;if(!$thang$$||!$nam$$)return $callback$$("T\u00ednh n\u0103ng n\u00e0y y\u00eau c\u1ea7u hai tham s\u1ed1 thang v\u00e0 nam");if($thang$$<1||$thang$$>12||$nam$$<1E3||$nam$$>3E3)return $callback$$("Tham s\u1ed1 thang ho\u1eb7c nam kh\u00f4ng ph\u00f9 h\u1ee3p");const $tu_ngay$$=
|
|
61
|
+
moment(new Date($nam$$,$thang$$-1,1)).startOf("month").toDate(),$den_ngay$$=moment($tu_ngay$$).endOf("month").toDate();var $appInfo_query$$=await App.findOne({_id:$id_app$$});if(!$appInfo_query$$)return $callback$$("C\u00f4ng ty n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i");let $ngay_ks$$=await utils.isBookLocked({id_app:$id_app$$,ngay_ct:$tu_ngay$$});if($ngay_ks$$)return $callback$$(`\u0110\u00e3 kh\u00f3a s\u1ed5 \u0111\u1ebfn ng\u00e0y ${moment($ngay_ks$$).format("DD/MM/YYYY")}`);const $main_condition$$=
|
|
62
|
+
{tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$,id_app:$id_app$$,thang:$thang$$,nam:$nam$$,so_ngay_lam_mot_thang:$nhanvien_req$$.query.so_ngay_lam_mot_thang||$appInfo_query$$.so_ngay_lam_mot_thang||24,ma_bp:$nhanvien_req$$.query.ma_bp};$appInfo_query$$={id_app:$nhanvien_req$$.query.id_app,tinh_luong:!0,$or:[{ngay_nghi_viec:{$exists:!1}},{ngay_nghi_viec:null},{ngay_nghi_viec:{$gt:$tu_ngay$$}}]};$nhanvien_req$$.query.ma_nv&&($appInfo_query$$.ma_nv=$nhanvien_req$$.query.ma_nv);$main_condition$$.ma_bp&&($appInfo_query$$.ma_bp=
|
|
63
|
+
$main_condition$$.ma_bp);$nhanvien_req$$=await dmnv.find($appInfo_query$$).lean();$appInfo_query$$={};$appInfo_query$$.id_app=$id_app$$;$appInfo_query$$.thang=$thang$$;$appInfo_query$$.nam=$nam$$;$appInfo_query$$.ma_nv={$in:$nhanvien_req$$.map($n$$=>$n$$.ma_nv)};$main_condition$$.ma_bp&&($appInfo_query$$.ma_bp=$main_condition$$.ma_bp);Logger.debug("[tinhluong] xo\u00e1 d\u1eef li\u1ec7u c\u0169",$appInfo_query$$);await bangtinhluong.deleteMany($appInfo_query$$);await global.getModel("chitietluongds").deleteMany($appInfo_query$$);
|
|
64
|
+
async.mapLimit($nhanvien_req$$,20,($nv$$,$callback$$)=>{let $cac_khoan_phu_cap$$=[],$cac_khoan_phu_cap_mien_thue$$=[];async.series({tv:$callback$$=>{if(!$nv$$.thu_viec_den_ngay)return $callback$$(null,[]);var $condition$$=moment($nv$$.thu_viec_den_ngay).endOf("date").toDate();if($condition$$.getTime()<$tu_ngay$$.getTime())return $callback$$(null,[]);$condition$$.getTime()>$den_ngay$$.getTime()&&($condition$$=$den_ngay$$);$condition$$={...$main_condition$$,ma_nv:$nv$$.ma_nv,ma_bp:$main_condition$$.ma_bp,
|
|
65
|
+
loai_luong:1,nam:$nam$$,thang:$thang$$,tu_ngay:$tu_ngay$$,den_ngay:$condition$$,nv:$nv$$};Logger.info("[tinhluong] t\u00ednh l\u01b0\u01a1ng th\u1eed vi\u1ec7c nh\u00e2n vi\u00ean",$nv$$.ten_nv);tinhluong($condition$$,($error$$,$rs$$)=>{$rs$$&&($cac_khoan_phu_cap$$=$rs$$.map($r$$=>$r$$.cac_khoan_phu_cap||[]).reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]),$cac_khoan_phu_cap_mien_thue$$=$rs$$.map($r$$=>$r$$.cac_khoan_phu_cap_mien_thue||[]).reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]));$callback$$($error$$,
|
|
66
|
+
$rs$$)})},ct:$callback$$=>{let $tinh_luong_tu_ngay$$;$nv$$.thu_viec_den_ngay?($tinh_luong_tu_ngay$$=moment($nv$$.thu_viec_den_ngay).startOf("date").toDate(),$tinh_luong_tu_ngay$$.setDate($tinh_luong_tu_ngay$$.getDate()+1),$tinh_luong_tu_ngay$$.getTime()<$tu_ngay$$.getTime()&&($tinh_luong_tu_ngay$$=$tu_ngay$$)):$tinh_luong_tu_ngay$$=$tu_ngay$$;if($tinh_luong_tu_ngay$$.getTime()>$den_ngay$$.getTime())return $callback$$(null,[]);Logger.info("[tinhluong] t\u00ednh l\u01b0\u01a1ng ch\u00ednh th\u1ee9c nh\u00e2n vi\u00ean",
|
|
67
|
+
$nv$$.ten_nv);tinhluong({...$main_condition$$,ma_nv:$nv$$.ma_nv,ma_bp:$main_condition$$.ma_bp,loai_luong:2,tu_ngay:$tinh_luong_tu_ngay$$,den_ngay:$den_ngay$$,cac_khoan_phu_cap:$cac_khoan_phu_cap$$,cac_khoan_phu_cap_mien_thue:$cac_khoan_phu_cap_mien_thue$$,nv:$nv$$},$callback$$)}},($e$$,$rs$$)=>{if($e$$)return $callback$$($e$$);$rs$$=$rs$$.tv.concat($rs$$.ct);$callback$$(null,$rs$$)})},($e$$,$rs$$)=>{if($e$$)return $callback$$($e$$);$callback$$(null,$rs$$.reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]))})},
|
|
68
|
+
{stream:!1,useSession:!0,cache:!1,queue:!0,timeout:18E6})};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const crypto=require("crypto"),cdpstk=require("../../libs/cdpstk"),{setCacheReport,getCacheReport}=require("../../libs/redis-cache"),{analyzeData}=require("../../libs/utils"),Account=global.getModel("account"),underscore=require("underscore"),moment=require("moment"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"analyzedata",async function($req$$,$callback$$){const $query$$=$req$$.query,$id_app$$=$query$$.id_app,$question$$=$query$$.cau_hoi;if(!$query$$.tu_ngay||!$query$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1 tu_ngay,den_ngay");if($query$$.id_conv){var $conversationHistory_pt$$=await getCacheReport($req$$.user.email,$id_app$$,"analyzedata",null,null,null,$query$$.id_conv);if($conversationHistory_pt$$&&
|
|
3
|
+
$conversationHistory_pt$$.data&&$conversationHistory_pt$$.data.length>1)return $conversationHistory_pt$$=await analyzeData(null,$question$$,$conversationHistory_pt$$.data),await setCacheReport($req$$.user.email,$id_app$$,"analyzedata",$conversationHistory_pt$$.conversationHistory,$query$$.id_conv),$callback$$(null,{reply:$conversationHistory_pt$$.reply,question:$conversationHistory_pt$$.question,id_conv:$query$$.id_conv})}$query$$.bac_tk=0;Logger.info("\u0110ang t\u00ednh b\u1ea3ng c\u00e2n \u0111\u1ed1i ph\u00e1t sinh t\u00e0i kho\u1ea3n...");
|
|
4
|
+
cdpstk($query$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$.joinModel2($id_app$$,Account,[{where:"tk",fields:["ten_tk","tk_me","loai_tk"]}],async function($report$$){$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.tk});try{let $datas$$=[],$bang_cdpstk$$=$report$$.filter($r$$=>$r$$.loai_tk==0).map($r$$=>({tai_khoan:$r$$.tk,ten_tai_khoan:$r$$.ten_tk,du_dau_ky:{no:$r$$.dk_no,co:$r$$.dk_co},phat_sinh:{no:$r$$.ps_no,co:$r$$.ps_co},du_cuoi_ky:{no:$r$$.ck_no,
|
|
5
|
+
co:$r$$.ck_co}}));$datas$$.push({title:`D\u1eef li\u1ec7u b\u1ea3ng c\u00e2n \u0111\u1ed1i ph\u00e1t sinh t\u00e0i kho\u1ea3n t\u1eeb ng\u00e0y ${moment($query$$.tu_ngay).format("DD/MM/YYYY")} \u0111\u1ebfn ng\u00e0y ${moment($query$$.den_ngay).format("DD/MM/YYYY")}`,data:$bang_cdpstk$$});let $pt$$=await analyzeData($datas$$,$question$$),$id_conv$$=`conversationHistory-${$id_app$$}-${moment($query$$.tu_ngay).format("YYYYMMDD")}-${moment($query$$.den_ngay).format("YYYYMMDD")}-${crypto.randomBytes(20).toString("hex")}`;
|
|
6
|
+
await setCacheReport($req$$.user.email,$id_app$$,"analyzedata",$pt$$.conversationHistory,$id_conv$$);$callback$$(null,{reply:$pt$$.reply,question:$pt$$.question,id_conv:$id_conv$$})}catch($e$$){$callback$$({error:$e$$.message||$e$$.error||$e$$})}})})},{cache:!1,resHandler:async($req$$,$result$$,$res$$)=>{const {error:$error$$,data:$data$$}=$result$$;if($error$$)return $res$$.status(400).send($error$$);$res$$.send($data$$)}})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),assbonus=require("../../libs/assbonus"),moment=require("moment"),async=require("async");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"assbonus",async function($req$$,$callback$$){const $condition$$=$req$$.query;$condition$$.den_ngay=moment($condition$$.den_ngay).endOf("date").toDate();$callback$$(null,null,"begin");if($condition$$.tu_ngay&&$condition$$.den_ngay){let $report$$=[],$ngay$$=new Date($condition$$.tu_ngay);async.forever($next$$=>{$callback$$(null,null,"running");let $query$$={...$condition$$};delete $query$$.tu_ngay;delete $query$$.den_ngay;$query$$.nam=$ngay$$.getFullYear();
|
|
3
|
+
$query$$.thang=$ngay$$.getMonth()+1;$query$$.ngay=$ngay$$.getDate();assbonus($query$$,($e$$,$rs$$)=>{if($e$$)return $next$$($e$$);$report$$=[...$report$$,...$rs$$];$ngay$$.setDate($ngay$$.getDate()+1);if($ngay$$>$condition$$.den_ngay)return $next$$(-1);$next$$()},$log$$=>{$callback$$(null,null,$log$$)})},$e$$=>{if($e$$&&$e$$!=-1)return $callback$$($e$$);$report$$.push({memo:"T\u1ed5ng c\u1ed9ng",bold:!0,amount:$report$$.map($r$$=>$r$$.amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0)});$callback$$(null,$report$$,
|
|
4
|
+
"data");$callback$$(null,null,"end")})}else assbonus($condition$$,($e$$,$report$$)=>{if($e$$)return $callback$$($e$$);$report$$.push({memo:"T\u1ed5ng c\u1ed9ng",bold:!0,amount:$report$$.map($r$$=>$r$$.amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0)});$callback$$(null,$report$$,"data");$callback$$(null,null,"end")},$log$$=>{$callback$$(null,null,$log$$)})},{stream:!0})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"assinterest",async function($query_req_rs$$,$callback$$){const $condition$$=$query_req_rs$$.query;$query_req_rs$$={id_app:$condition$$.id_app,event:{$regex:"BONUS",$options:"i"}};$condition$$.token&&($query_req_rs$$["data.token"]=$condition$$.token);$condition$$.introduce_code&&($query_req_rs$$["data.introduce_code"]=$condition$$.introduce_code);$condition$$.id_product&&($query_req_rs$$["data.id_product"]=$condition$$.id_product);$condition$$.id_period&&
|
|
3
|
+
($query_req_rs$$["data.id_period"]=$condition$$.id_period);$condition$$.wallet_address&&($query_req_rs$$.$or=[{"data.from_address":$condition$$.wallet_address},{"data.to_address":$condition$$.wallet_address}]);if($condition$$.nam){let $ngay$$=moment().set("years",Number($condition$$.nam));$query_req_rs$$.date_created={$gte:$ngay$$.startOf("year").toDate(),$lte:$ngay$$.endOf("year").toDate()};Number($condition$$.quy)&&($ngay$$.set("quarters",Number($condition$$.quy)),$query_req_rs$$.date_created={$gte:$ngay$$.startOf("quarter").toDate(),
|
|
4
|
+
$lte:$ngay$$.endOf("quarter").toDate()});Number($condition$$.thang)&&($ngay$$.set("months",Number($condition$$.thang)-1),$query_req_rs$$.date_created={$gte:$ngay$$.startOf("month").toDate(),$lte:$ngay$$.endOf("month").toDate()});$condition$$.ngay&&($ngay$$.set("days",Number($condition$$.ngay)),$query_req_rs$$.date_created={$gte:$ngay$$.startOf("date").toDate(),$lte:$ngay$$.endOf("date").toDate()})}else $condition$$.tu_ngay&&($query_req_rs$$.date_created={$gte:$condition$$.tu_ngay}),$condition$$.den_ngay&&
|
|
5
|
+
($query_req_rs$$.date_created=$query_req_rs$$.date_created||{},$query_req_rs$$.date_created.$lte=$condition$$.den_ngay);$query_req_rs$$=await global.getModel("asstransaction").find($query_req_rs$$).sort({date_created:1}).lean();$query_req_rs$$.forEach($r$$=>{$r$$.receiver=($r$$.data||{}).to_address;$r$$.amount=($r$$.data||{}).amount||0;$r$$.tokenAmount=$r$$.amount});$condition$$.wallet_address&&($query_req_rs$$=$query_req_rs$$.filter($r$$=>$r$$.receiver==$condition$$.wallet_address));await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,
|
|
6
|
+
"asskey",{where:{receiver:"address"},fields:["username"]});$condition$$.username&&($query_req_rs$$=$query_req_rs$$.filter($r$$=>$r$$.username===$condition$$.username));await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"assproduct",{where:{idProduct:"id"},fields:"ten_san_pham"});await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"assperiod",{where:{idPeriod:"id"},fields:["ten_ky_han","lai_suat_cam_ket","lai_suat_truoc_han","lai_suat_thoi_gian_con_lai","lai_suat_tang_them_so_huu_token"]});
|
|
7
|
+
await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"assinvestment",{where:{tokenName:"token"},fields:[{user_investor:"user_created",wallet_investor:"creator",gia:"gia"}]});await $query_req_rs$$.asyncJoinModel2(null,"user",{where:{username:"email"},fields:["name"]});await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"customer",{where:{username:"of_user"},fields:["ma_kh","ten_kh"]});$query_req_rs$$.forEach($r$$=>{$r$$.date=$r$$.date_created;$r$$.bold=!1;$r$$.tokenValue=($r$$.gia||1)*$r$$.tokenAmount});
|
|
8
|
+
$query_req_rs$$.push({memo:"T\u1ed5ng c\u1ed9ng",bold:!0,amount:$query_req_rs$$.map($r$$=>$r$$.amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0)});$callback$$(null,$query_req_rs$$)},{stream:!1})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const assproduct=global.getModel("assproduct"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"assproductowners",async function($condition_query_req$$,$callback$$){$condition_query_req$$=$condition_query_req$$.query;$condition_query_req$$={id_app:$condition_query_req$$.id_app,id_product:$condition_query_req$$.id_product,id_period:$condition_query_req$$.id_period};try{let $owners$$=await assproduct.getOwners($condition_query_req$$);$owners$$=$owners$$.filter($r$$=>$r$$.id_product);await $owners$$.asyncJoinModel2($condition_query_req$$.id_app,
|
|
3
|
+
"assproduct",{where:{id_product:"id"},fields:["ten_san_pham"]});await $owners$$.asyncJoinModel2($condition_query_req$$.id_app,"assperiod",{where:{id_period:"id"},fields:["ten_ky_han"]});$callback$$(null,$owners$$)}catch($e$$){$callback$$($e$$)}},{stream:!1})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const assbank=global.getModel("assbank"),controller=require("../../controllers/controllerRPT");module.exports=function($router$$){new controller($router$$,"asssupply",async function($req_supply$$,$callback$$){$req_supply$$=await (await assbank.find({id_app:$req_supply$$.user.current_id_app}).lean()).asyncGroupBy(["denom"],["amount"]);$callback$$(null,$req_supply$$)})};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"asstransferlog",async function($query_req_rs$$,$callback$$){const $condition$$=$query_req_rs$$.query;$query_req_rs$$={id_app:$condition$$.id_app};if($condition$$.username){var $keys_ngay$$=(await global.getModel("asskey").find({id_app:$condition$$.id_app,username:$condition$$.username}).lean()).map($r$$=>$r$$.address);$query_req_rs$$.$or=[{"data.from_address":{$in:$keys_ngay$$}},{"data.to_address":{$in:$keys_ngay$$}}]}$condition$$.nam?($keys_ngay$$=
|
|
3
|
+
moment().set("years",Number($condition$$.nam)),$query_req_rs$$.date_created={$gte:$keys_ngay$$.startOf("year").toDate(),$lte:$keys_ngay$$.endOf("year").toDate()},Number($condition$$.quy)&&($keys_ngay$$.set("quarters",Number($condition$$.quy)),$query_req_rs$$.date_created={$gte:$keys_ngay$$.startOf("quarter").toDate(),$lte:$keys_ngay$$.endOf("quarter").toDate()}),Number($condition$$.thang)&&($keys_ngay$$.set("months",Number($condition$$.thang)-1),$query_req_rs$$.date_created={$gte:$keys_ngay$$.startOf("month").toDate(),
|
|
4
|
+
$lte:$keys_ngay$$.endOf("month").toDate()}),$condition$$.ngay&&($keys_ngay$$.set("days",Number($condition$$.ngay)),$query_req_rs$$.date_created={$gte:$keys_ngay$$.startOf("date").toDate(),$lte:$keys_ngay$$.endOf("date").toDate()})):($condition$$.tu_ngay&&($query_req_rs$$.date_created={$gte:$condition$$.tu_ngay}),$condition$$.den_ngay&&($query_req_rs$$.date_created=$query_req_rs$$.date_created||{},$query_req_rs$$.date_created.$lte=$condition$$.den_ngay));$query_req_rs$$=await global.getModel("asstransaction").find($query_req_rs$$).sort({date_created:-1}).lean();
|
|
5
|
+
$query_req_rs$$.forEach($r$$=>{if($r$$.data){for(let $k$$ in $r$$.data)$r$$[$k$$]=$r$$.data[$k$$];$r$$.receiver=$r$$.data.to_address;$r$$.sender=$r$$.data.from_address}});$query_req_rs$$=$query_req_rs$$.filter($r$$=>$r$$.receiver||$r$$.sender);await $query_req_rs$$.filter($r$$=>$r$$.id_product).asyncJoinModel2($condition$$.id_app,"assproduct",{where:{id_product:"id"},fields:"ten_san_pham"});await $query_req_rs$$.filter($r$$=>$r$$.id_period).asyncJoinModel2($condition$$.id_app,"assperiod",{where:{id_period:"id"},
|
|
6
|
+
fields:["ten_ky_han","lai_suat_cam_ket","lai_suat_truoc_han","lai_suat_thoi_gian_con_lai","lai_suat_tang_them_so_huu_token"]});await $query_req_rs$$.filter($r$$=>$r$$.token).asyncJoinModel2($condition$$.id_app,"assinvestment",{where:{token:"token"},setFields:($item$$,$ref$$)=>{$item$$.user_investor=$ref$$.user_created;$item$$.wallet_investor=$ref$$.creator;$item$$.value=($item$$.amount||0)*$ref$$.gia}});await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"asskey",{where:{receiver:"address"},
|
|
7
|
+
fields:[{username_receiver:"username"}]});await $query_req_rs$$.asyncJoinModel2(null,"user",{where:{username_receiver:"email"},fields:[{name_receiver:"name"}]});await $query_req_rs$$.asyncJoinModel2($condition$$.id_app,"asskey",{where:{sender:"address"},fields:[{username_sender:"username"}]});await $query_req_rs$$.asyncJoinModel2(null,"user",{where:{username_sender:"email"},fields:[{name_sender:"name"}]});let $report$$=[];$query_req_rs$$.forEach($_r2_r$$=>{$_r2_r$$.ngay=$_r2_r$$.date_created;if($_r2_r$$.sender&&
|
|
8
|
+
(!$condition$$.username||$_r2_r$$.username_sender==$condition$$.username)){let $_r$$={...$_r2_r$$,bold:!1};$_r$$.amount=Number($_r$$.amount||0);$_r$$.tokenAmount=Number($_r$$.amount||0);$_r$$.tokenValue=Number($_r$$.value);$_r$$.address=$_r$$.sender;$_r$$.received_amount=0;$_r$$.sent_amount=$_r$$.amount;$report$$.push($_r$$)}!$_r2_r$$.receiver||$condition$$.username&&$_r2_r$$.username_receiver!=$condition$$.username||($_r2_r$$={...$_r2_r$$,bold:!1},$_r2_r$$.amount=Number($_r2_r$$.amount||0),$_r2_r$$.tokenAmount=
|
|
9
|
+
Number($_r2_r$$.amount||0),$_r2_r$$.tokenValue=Number($_r2_r$$.value),$_r2_r$$.address=$_r2_r$$.receiver,$_r2_r$$.received_amount=$_r2_r$$.amount,$_r2_r$$.sent_amount=0,$report$$.push($_r2_r$$))});$report$$.push({memo:"T\u1ed5ng c\u1ed9ng",bold:!0,amount:$report$$.map($r$$=>$r$$.amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0),received_amount:$report$$.map($r$$=>$r$$.received_amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0),sent_amount:$report$$.map($r$$=>$r$$.sent_amount).reduce(($a$$,$b$$)=>$a$$+$b$$,0)});$callback$$(null,
|
|
10
|
+
$report$$)})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const path=require("path"),permission=require("../../libs/permission"),controller=require("../../controllers/controllerRPT"),StaticPool=require("../../libs/WorkerStaticPool");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"backup",async function($req$$,$callback$$){let $email$$=$req$$.user.email,$id_app$$=$req$$.user.current_id_app;permission.isAdmin($id_app$$,$email$$,function($backupWorkerFile_e$$,$admin$$){if(!$admin$$)return $callback$$({error:"Ch\u1ec9 admin m\u1edbi c\u00f3 quy\u1ec1n backup d\u1eef li\u1ec7u c\u1ee7a c\u00f4ng ty"});global.backupPool||($backupWorkerFile_e$$=path.dirname(path.dirname(__dirname))+"/workers/backupApp.js",global.backupPool=
|
|
3
|
+
new StaticPool($backupWorkerFile_e$$,0,1));global.getModel("log").create({id_app:$id_app$$,id_func:"app",action:"BACKUP",data:{dateFrom:$req$$.query.dateFrom||$req$$.query.tu_ngay,dateTo:$req$$.query.dateTo||$req$$.query.den_ngay,backup_app_info:$req$$.user.current_app_info}},$req$$.user.email,$req$$.user_agent,$req$$);global.backupPool.exec({id:$id_app$$,user:$email$$,dateFrom:$req$$.query.dateFrom,dateTo:$req$$.query.dateTo,backup_app_info:$req$$.user.current_app_info,dirPath:$req$$.query.dir,configs:{database:global.configs.database}},
|
|
4
|
+
$response$$=>{if($response$$.error)return $callback$$($response$$.error);$callback$$(null,[{backup_file:$response$$.file}])})})},{stream:!1})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const giatb=global.getModel("giatb"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"banggiatb",async function($query_req$$,$callback$$){$query_req$$=$query_req$$.query;if(!$query_req$$.nam||!$query_req$$.thang)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: nam,thang");const $condition$$={id_app:$query_req$$.id_app,nam:$query_req$$.nam,thang:$query_req$$.thang};$query_req$$.ma_vt&&($condition$$.ma_vt=$query_req$$.ma_vt);$query_req$$.ma_kho&&($condition$$.ma_kho=$query_req$$.ma_kho);
|
|
3
|
+
try{let $report$$=await giatb.find($condition$$).lean();await $report$$.asyncJoinModel2($condition$$.id_app,"dmvt",{where:{ma_vt:"ma_vt"},fields:["ten_vt","ma_dvt"]});await $report$$.asyncJoinModel2($condition$$.id_app,"dmkho",{where:{ma_kho:"ma_kho"},fields:["ten_kho"]});$callback$$(null,$report$$)}catch($e$$){$callback$$({error:$e$$.message||$e$$.error||$e$$})}},{stream:!1})};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const async=require("async"),qts=global.getModel("qts"),sotinhkh=global.getModel("sotinhkh"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bangtinhkhauhao",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.nam||!$condition$$.thang)return $callback$$("Ch\u1ee9c n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: n\u0103m(nam), th\u00e1ng(thang)");const $id_app$$=$condition$$.id_app,$query$$={id_app:$id_app$$,nam:$condition$$.nam};$query$$.thang=$condition$$.thang;async.series({id_tss:function($callback$$){const $q_ts$$={id_app:$id_app$$};
|
|
3
|
+
$condition$$.ma_bp&&($q_ts$$.ma_bp=$condition$$.ma_bp);$condition$$.ma_kho&&($q_ts$$.ma_bp=$condition$$.ma_kho);$condition$$.ma_loai_ts&&($q_ts$$.ma_loai_ts=$condition$$.ma_loai_ts);$condition$$.ma_gd&&($q_ts$$.ma_gd=$condition$$.ma_gd);$condition$$.id_ts&&($q_ts$$.id_ts=$condition$$.id_ts);qts.find($q_ts$$).lean().then(function($rs$$){$callback$$(null,$rs$$)}).catch($e$$=>{$callback$$($e$$)})}},function($e$$,$rs$$){if($e$$)return $callback$$($e$$);const $dsts$$=[];$rs$$.id_tss.forEach(function($r$$){$dsts$$.push($r$$._id.toString())});
|
|
4
|
+
$rs$$.id_tss&&($query$$.id_ts={$in:$dsts$$});sotinhkh.find($query$$).lean().then(async function($rs$$){await $rs$$.filter($r$$=>$r$$.ma_tang_giam_ts).asyncJoinModel2($id_app$$,"dmtanggiamts",{where:"ma_tang_giam_ts",fields:{kieu_dc:"kieu"}});$rs$$.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)});$rs$$.groupBy("id_ts",["nguyen_gia","gia_tri_da_kh","gia_tri_con_lai",
|
|
5
|
+
"gia_tri_kh_ky"],function($e$$,$report$$){if($e$$)return $callback$$($e$$);$report$$.joinModel2($id_app$$,qts,[{where:{id_ts:"_id"},fields:["ma_ct","ten_ts","so_the_ts","so_ky_kh"],setFields:($item$$,$data$$)=>{for(let $key$$ in $data$$)$item$$[`ts_${$key$$}`]=$data$$[$key$$]}}],function(){$report$$.push({bold:!0,ten_ts:"T\u1ed5ng c\u1ed9ng",so_the_ts:"",nguyen_gia:$report$$.csum("nguyen_gia"),gia_tri_da_kh:$report$$.csum("gia_tri_da_kh"),gia_tri_con_lai:$report$$.csum("gia_tri_con_lai"),gia_tri_kh_ky:$report$$.csum("gia_tri_kh_ky")});
|
|
6
|
+
$callback$$(null,$report$$)})})}).catch($e$$=>{$callback$$($e$$)})})})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const fifo_trace_query=require("../../libs/fifo_trace_query"),controller=require("../../controllers/controllerRPT");module.exports=function($router$$){new controller($router$$,"baocaofifoky",async function($req$$,$callback$$){fifo_trace_query.baoCaoFifoKy($req$$.query,($e$$,$report$$)=>{if($e$$)return $callback$$($e$$.message||$e$$.error||$e$$);$callback$$(null,$report$$)})})};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const customer=global.getModel("customer"),User=global.getModel("user"),sokho=global.getModel("sokho"),async=require("async"),controller=require("../../controllers/controllerRPT"),dmvt=global.getModel("dmvt");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"baocaokhachhang",function($req$$,$callback$$){const $condition$$=$req$$.query,$query$$={id_app:$condition$$.id_app};$condition$$.tu_ngay&&($query$$.date_created={$gte:$condition$$.tu_ngay});$condition$$.den_ngay&&($query$$.date_created?$query$$.date_created.$lte=$condition$$.den_ngay:$query$$.date_created={$lte:$condition$$.den_ngay});$condition$$.ma_kh&&($query$$.ma_kh={$regex:$condition$$.ma_kh,$options:"i"});$condition$$.ten_kh&&!$condition$$.ma_kh&&
|
|
3
|
+
($query$$.ten_kh={$regex:$condition$$.ten_kh,$options:"i"});$condition$$.dia_chi&&!$condition$$.ma_kh&&($query$$.dia_chi={$regex:$condition$$.dia_chi,$options:"i"});$condition$$.tinh_thanh&&$condition$$.tinh_thanh!="null"&&!$condition$$.ma_kh&&($query$$.tinh_thanh={$regex:$condition$$.tinh_thanh,$options:"i"});$condition$$.nh_kh&&!$condition$$.ma_kh&&($query$$.nh_kh={$regex:$condition$$.nh_kh,$options:"i"});$condition$$.phu_trach&&$condition$$.phu_trach!="null"&&!$condition$$.ma_kh&&($query$$.phu_trach=
|
|
4
|
+
{$regex:$condition$$.phu_trach,$options:"i"});async.series({find_product:function($callback$$){$condition$$.ma_vt&&!$condition$$.ma_kh?sokho.find({id_app:$condition$$.id_app,ma_vt:$condition$$.ma_vt},{ma_kh:1}).lean().exec(function($e_ma_khs$$,$khs$$){if($e_ma_khs$$)return $callback$$($e_ma_khs$$);$e_ma_khs$$=$khs$$.map($k$$=>$k$$.ma_kh);$query$$.ma_kh={$in:$e_ma_khs$$};$callback$$(null)}):$callback$$(null)},find_product_group:function($callback$$){$condition$$.ma_vt||!$condition$$.ma_nvt||$condition$$.ma_kh?
|
|
5
|
+
$callback$$(null):dmvt.find({id_app:$condition$$.id_app,ma_nvt:$condition$$.ma_nvt},{_id:1}).lean().exec(function($e$$,$nvts$$){if($e$$)return $callback$$($e$$);$e$$=$nvts$$.map($n$$=>$n$$._id);sokho.find({id_app:$condition$$.id_app,ma_vt:{$in:$e$$}},{ma_kh:1}).lean().exec(function($e$jscomp$2_ma_khs$$,$khs$$){if($e$jscomp$2_ma_khs$$)return $callback$$($e$jscomp$2_ma_khs$$);$e$jscomp$2_ma_khs$$=$khs$$.map($k$$=>$k$$.ma_kh);$query$$.ma_kh={$in:$e$jscomp$2_ma_khs$$};$callback$$(null)})})}},function($e$$){if($e$$)return $callback$$($e$$);
|
|
6
|
+
customer.find($query$$).lean().exec(function($e$$,$items$$){if($e$$)return $callback$$($e$$);$items$$.joinModel(null,User,[{where:{email:"phu_trach"},fields:[{name:"ten_phu_trach",value:"name"}]}],function(){$callback$$(null,$items$$)})})})})};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const dktk=require("../../libs/dktk"),cktk=require("../../libs/cktk"),{calcGrid}=require("../../libs/utils"),kbmbcdkt=global.getModel("kbmbcdkt"),async=require("async"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bcdkt",function($kbm_query_req$$,$callback$$){const $query$$=$kbm_query_req$$.query;if(!$query$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 den_ngay");$query$$.tu_ngay||($query$$.tu_ngay=moment($query$$.den_ngay).startOf("year").toDate());$query$$.ma_dvcs||($query$$.ma_dvcs="");let $report$$;$kbm_query_req$$={id_app:$query$$.id_app};$kbm_query_req$$.id_rptform=$query$$.id_rptform?$query$$.id_rptform:
|
|
3
|
+
{$in:[void 0,null,""]};kbmbcdkt.find($kbm_query_req$$).sort({stt:1}).lean().then(function($kbm$$){$report$$=$kbm$$;async.map($report$$,function($r$$,$c1$$){setImmediate(()=>{$r$$.cach_tinh=="1"||$r$$.ngoai_bang===!0?$c1$$(null,$r$$):$r$$.cach_tinh=="2"?async.parallel({dn:function($callback$$){if(!$r$$.tk)return $r$$.so_dn=0,$r$$.so_dn_nt=0,$callback$$(null,$r$$);let $condition$$={...$query$$};$condition$$.ngay=$query$$.tu_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=
|
|
4
|
+
!1;$condition$$.tk=$r$$.tk;dktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$.phan_loai=="1"?($r$$.so_dn=$result$$.csum("du_no00")-$result$$.csum("du_co00"),$r$$.so_dn_nt=$result$$.csum("du_no_nt00")-$result$$.csum("du_co_nt00")):($r$$.so_dn=$result$$.csum("du_co00")-$result$$.csum("du_no00"),$r$$.so_dn_nt=$result$$.csum("du_co_nt00")-$result$$.csum("du_no_nt00"));$r$$.so_dn<0&&$r$$.khong_am&&($r$$.so_dn=0);$r$$.so_dn_nt<0&&$r$$.khong_am&&($r$$.so_dn_nt=0);
|
|
5
|
+
$callback$$(null,$r$$)})},ck:function($callback$$){if(!$r$$.tk)return $r$$.so_ck=0,$r$$.so_ck_nt=0,$callback$$(null,$r$$);let $condition$$={...$query$$};$condition$$.ngay=$query$$.den_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=!1;$condition$$.tk=$r$$.tk;cktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$.phan_loai=="1"?($r$$.so_ck=$result$$.csum("du_no00")-$result$$.csum("du_co00"),$r$$.so_ck_nt=$result$$.csum("du_no_nt00")-
|
|
6
|
+
$result$$.csum("du_co_nt00")):($r$$.so_ck=$result$$.csum("du_co00")-$result$$.csum("du_no00"),$r$$.so_ck_nt=$result$$.csum("du_co_nt00")-$result$$.csum("du_no_nt00"));$r$$.so_ck<0&&$r$$.khong_am&&($r$$.so_ck=0);$r$$.so_ck_nt<0&&$r$$.khong_am&&($r$$.so_ck_nt=0);$callback$$(null,$r$$)})}},function($error$$){if($error$$)return $c1$$($error$$);$c1$$(null,$r$$)}):$r$$.cach_tinh=="3"?async.parallel({dn:function($callback$$){if(!$r$$.tk)return $r$$.so_dn=0,$r$$.so_dn_nt=0,$callback$$(null,$r$$);let $condition$$=
|
|
7
|
+
{...$query$$};$condition$$.ngay=$query$$.tu_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;dktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$.so_dn=$result$$.csum("du_no00");$r$$.so_dn_nt=$result$$.csum("du_no_nt00");$r$$.so_dn<0&&$r$$.khong_am&&($r$$.so_dn=0);$r$$.so_dn_nt<0&&$r$$.khong_am&&($r$$.so_dn_nt=0);$callback$$(null,$r$$)})},ck:function($callback$$){if(!$r$$.tk)return $r$$.so_ck=
|
|
8
|
+
0,$r$$.so_ck_nt=0,$callback$$(null,$r$$);let $condition$$={...$query$$};$condition$$.ngay=$query$$.den_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;cktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$.so_ck=$result$$.csum("du_no00");$r$$.so_ck_nt=$result$$.csum("du_no_nt00");$r$$.so_ck<0&&$r$$.khong_am&&($r$$.so_ck=0);$r$$.so_ck_nt<0&&$r$$.khong_am&&($r$$.so_ck_nt=0);$callback$$(null,
|
|
9
|
+
$r$$)})}},function($error$$){if($error$$)return $c1$$($error$$);$c1$$(null,$r$$)}):async.parallel({dn:function($callback$$){if(!$r$$.tk)return $r$$.so_dn=0,$r$$.so_dn_nt=0,$callback$$(null,$r$$);let $condition$$={...$query$$};$condition$$.ngay=$query$$.tu_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;dktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$r$$.so_dn=$result$$.csum("du_co00");
|
|
10
|
+
$r$$.so_dn_nt=$result$$.csum("du_co_nt00");$r$$.so_dn<0&&$r$$.khong_am&&($r$$.so_dn=0);$r$$.so_dn_nt<0&&$r$$.khong_am&&($r$$.so_dn_nt=0);$callback$$(null,$r$$)})},ck:function($callback$$){if(!$r$$.tk)return $r$$.so_ck=0,$r$$.so_ck_nt=0,$callback$$(null,$r$$);let $condition$$={...$query$$};$condition$$.ngay=$query$$.den_ngay;delete $condition$$.tu_ngay;delete $condition$$.den_ngay;$condition$$.bu_tru=$r$$.bu_tru_cong_no;$condition$$.tk=$r$$.tk;cktk($condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);
|
|
11
|
+
$r$$.so_ck=$result$$.csum("du_co00");$r$$.so_ck_nt=$result$$.csum("du_co_nt00");$r$$.so_ck<0&&$r$$.khong_am&&($r$$.so_ck=0);$r$$.so_ck_nt<0&&$r$$.khong_am&&($r$$.so_ck_nt=0);$callback$$(null,$r$$)})}},function($error$$){if($error$$)return $c1$$($error$$);$c1$$(null,$r$$)})})},function(){calcGrid($report$$,"so_dn,so_dn_nt,so_ck,so_ck_nt",function($rs$$){$callback$$(null,$rs$$)})})}).catch($error$$=>{$callback$$($error$$)})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const introducebonus=global.getModel("introducebonus"),User=global.getModel("user"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bcintroducebonus",function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;const $query$$={id_app:$condition_req$$.id_app};$condition_req$$.user_received&&($query$$.user_received=$condition_req$$.user_received);$condition_req$$.tu_ngay&&($query$$.ngay_ct={$gte:$condition_req$$.tu_ngay});$condition_req$$.den_ngay&&($query$$.ngay_ct?$query$$.ngay_ct.$lte=$condition_req$$.den_ngay:$query$$.ngay_ct={$lte:$condition_req$$.den_ngay});
|
|
3
|
+
$condition_req$$.type&&($query$$.type=$condition_req$$.type);introducebonus.find($query$$).lean().exec(async($e$$,$rs$$)=>{if($e$$)return $callback$$($e$$);await $rs$$.asyncJoinModel2(null,User,{where:{user_received:"email"},fields:{user_received_name:"name"}});$rs$$.forEach($r$$=>{switch($r$$.type){case "1":$r$$.type_name="Thu nh\u1eadp t\u1eeb gi\u1edbi thi\u1ec7u ng\u01b0\u1eddi s\u1eed d\u1ee5ng";break;case "2":$r$$.type_name="Thu nh\u1eadp khi s\u1eed d\u1ee5ng m\u00e3 gi\u1edbi thi\u1ec7u \u0111\u1ec3 \u0111\u0103ng k\u00fd";
|
|
4
|
+
break;case "3":$r$$.type_name="Thu nh\u1eadp t\u1eeb giao d\u1ecbch c\u1ee7a ng\u01b0\u1eddi \u0111\u01b0\u1ee3c gi\u1edbi thi\u1ec7u"}});$callback$$(null,$rs$$)})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const Customer=global.getModel("customer"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bckhtiemnang",async function($req$$,$callback$$){let $condition$$={id_app:$req$$.user.current_id_app,trang_thai:"0"};$req$$.query.nh_kh&&($condition$$.nh_kh=$req$$.query.nh_kh);$req$$.query.nh_kh2&&($condition$$.nh_kh2=$req$$.query.nh_kh2);$req$$.query.nh_kh3&&($condition$$.nh_kh3=$req$$.query.nh_kh3);$req$$.query.nh_kh4&&($condition$$.nh_kh4=$req$$.query.nh_kh4);$req$$.query.nh_kh5&&($condition$$.nh_kh5=$req$$.query.nh_kh5);$req$$.query.ma_nganh_hang&&
|
|
3
|
+
($condition$$.ma_nganh_hang=$req$$.query.ma_nganh_hang);$req$$.query.phu_trach&&($condition$$.phu_trach=$req$$.query.phu_trach);try{if($req$$.query.thoi_gian_chua_tuong_tac){let $ngay_tuong_tac$$=moment().add(Number($req$$.query.thoi_gian_chua_tuong_tac),"days").startOf("startOf").toDate();$condition$$.ngay_tuong_tac_gan_nhat={$lte:$ngay_tuong_tac$$}}let $custs$$=await Customer.find($condition$$).lean();$callback$$(null,$custs$$)}catch($e$$){$callback$$($e$$.message||$e$$.error||$e$$)}})};
|