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,85 @@
|
|
|
1
|
+
const cktk=require("../../libs/cktk"),dktk=require("../../libs/dktk"),rptform=global.getModel("rptform"),async=require("async"),_=require("lodash"),utils=require("../../libs/utils"),controller=require("../../controllers/controllerRPT"),moment=require("moment"),numeral=require("numeral"),{evalute}=require("../../libs/utils"),ctds=global.getModel("ctds"),{getCodeChildren}=require("../../libs/utils");
|
|
2
|
+
function exec($cong_thuc_func_string$$,$sandbox$$){$cong_thuc_func_string$$=$cong_thuc_func_string$$.split("undefined").join("0").split("null").join("0");$cong_thuc_func_string$$=($cong_thuc_func_string$$||"").indexOf("return ")<0?`return ${$cong_thuc_func_string$$}`:$cong_thuc_func_string$$;return utils.evalute($cong_thuc_func_string$$,$sandbox$$)}
|
|
3
|
+
const getRegString=function($arrayTk$$){return $arrayTk$$?$arrayTk$$.reg():null},calc4cell=async($req$$,$row_socai$$,$cell$$,$query_tk_co_tk_no$$,$callback$$)=>{if(!$cell$$)return $callback$$(null,{value:0,value_nt:0,cong_thuc:""});var $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$;$cell$$.ma_phi&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$=await getCodeChildren(global.getModel("dmphi"),$query_tk_co_tk_no$$.id_app,$cell$$.ma_phi,"ma_phi","ma_phi_me"));
|
|
4
|
+
switch($cell$$.cach_tinh){case "1":$cell$$.value_string="";$callback$$(null,$cell$$);break;case "9":$cell$$.cong_thuc="";$cell$$.value_string="";utils.getInfoFromQuery($query_tk_co_tk_no$$,$cell$$.query,($e$$,$rs$$)=>{if($e$$)return $callback$$(null,$cell$$);_.isNumber($rs$$)?$cell$$.value=$rs$$:$cell$$.value_string=$rs$$;$callback$$(null,$cell$$)});break;case "99":$cell$$.cong_thuc="";$cell$$.value_string="";if(!$cell$$.script||$cell$$.script.indexOf("async ")>=0)return $callback$$(null,$cell$$);
|
|
5
|
+
let $func_string$$=`return (async ()=>{
|
|
6
|
+
try{
|
|
7
|
+
${$cell$$.script}
|
|
8
|
+
}catch(e){
|
|
9
|
+
return {error:e}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
})`;utils.evalute($func_string$$,{row:$row_socai$$,moment,condition:$query_tk_co_tk_no$$,user:$req$$.user,_,utils,cell:$cell$$})().then($rs$$=>{if($rs$$){if($rs$$.error)return Logger.error($rs$$.error,$func_string$$),$callback$$(null,$cell$$);_.isNumber($rs$$)?$cell$$.value=$rs$$:$cell$$.value_string=$rs$$}$callback$$(null,$cell$$)}).catch($e$$=>{Logger.error($e$$,$func_string$$);return $callback$$($e$$.message||$e$$.error||$e$$,$cell$$)});break;case "2":$cell$$.cong_thuc="";$cell$$.value_string=
|
|
13
|
+
"";var $condition_dieu_kien_khac$$={ngay_ct:{$gte:$query_tk_co_tk_no$$.tu_ngay,$lte:$query_tk_co_tk_no$$.den_ngay},id_app:$query_tk_co_tk_no$$.id_app};$query_tk_co_tk_no$$.ma_dvcs&&($condition_dieu_kien_khac$$.ma_dvcs=$query_tk_co_tk_no$$.ma_dvcs);$query_tk_co_tk_no$$.ma_bp&&($condition_dieu_kien_khac$$.ma_bp=$query_tk_co_tk_no$$.ma_bp);$query_tk_co_tk_no$$.ma_hd&&($condition_dieu_kien_khac$$.ma_hd=$query_tk_co_tk_no$$.ma_hd);$query_tk_co_tk_no$$.ma_dt&&($condition_dieu_kien_khac$$.ma_dt=$query_tk_co_tk_no$$.ma_dt);
|
|
14
|
+
$query_tk_co_tk_no$$.ma_sp&&($condition_dieu_kien_khac$$.ma_sp=$query_tk_co_tk_no$$.ma_sp);$query_tk_co_tk_no$$.ma_nv&&($condition_dieu_kien_khac$$.ma_nv=$query_tk_co_tk_no$$.ma_nv);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$&&($condition_dieu_kien_khac$$.ma_phi=$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$);$cell$$.ma_kh&&($condition_dieu_kien_khac$$.$or=[{ma_kh_no:$cell$$.ma_kh},{ma_kh_co:$cell$$.ma_kh}]);if($query_tk_co_tk_no$$=getRegString($cell$$.tk_no))$condition_dieu_kien_khac$$.tk_no=
|
|
15
|
+
$cell$$.giam_tru_no?{$not:new RegExp($query_tk_co_tk_no$$)}:{$regex:$query_tk_co_tk_no$$,$options:"i"};if($query_tk_co_tk_no$$=getRegString($cell$$.tk_co))$condition_dieu_kien_khac$$.tk_co=$cell$$.giam_tru_co&&$query_tk_co_tk_no$$?{$not:new RegExp($query_tk_co_tk_no$$)}:{$regex:$query_tk_co_tk_no$$,$options:"i"};if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac);var $condition$$=evalute($cell$$.dieu_kien_khac,{condition:$condition_dieu_kien_khac$$,
|
|
16
|
+
moment,row:$row_socai$$,cell:$cell$$});$condition_dieu_kien_khac$$={...$condition_dieu_kien_khac$$,...$condition$$}}catch($e$$){return $callback$$($e$$.toString())}$cell$$.ma_kho||$cell$$.ma_kh?($cell$$.ma_kho&&($condition_dieu_kien_khac$$.ma_kho=$cell$$.ma_kho),$row_socai$$=global.getModel("socaitc")):$row_socai$$=global.getModel("socaitt");try{utils.groupByCondition($row_socai$$,$condition_dieu_kien_khac$$,["id_ct","so_ct","ngay_ct"],{sum:["tien","tien_nt"]}).then($rs$$=>{$cell$$.value=$rs$$.csum("tien");
|
|
17
|
+
$cell$$.value_nt=$rs$$.csum("tien_nt");$cell$$.details=$rs$$;$callback$$(null,$cell$$)}).catch($error$$=>{$callback$$($error$$)})}catch($e$$){$callback$$($e$$)}break;case "3":$cell$$.cong_thuc="";$cell$$.value_string="";$condition$$=$query_tk_co_tk_no$$.tu_ngay.getFullYear()*12+$query_tk_co_tk_no$$.tu_ngay.getMonth();var $den_nam_thang_dieu_kien_khac$$=$query_tk_co_tk_no$$.den_ngay.getFullYear()*12+$query_tk_co_tk_no$$.den_ngay.getMonth();$condition$$={id_app:$query_tk_co_tk_no$$.id_app,tu_nam_thang:$condition$$,
|
|
18
|
+
den_nam_thang:$den_nam_thang_dieu_kien_khac$$};$query_tk_co_tk_no$$.ma_dvcs&&($condition$$.ma_dvcs=$query_tk_co_tk_no$$.ma_dvcs);$query_tk_co_tk_no$$.ma_bp&&($condition$$.ma_bp=$query_tk_co_tk_no$$.ma_bp);$query_tk_co_tk_no$$.ma_hd&&($condition$$.ma_hd=$query_tk_co_tk_no$$.ma_hd);$query_tk_co_tk_no$$.ma_dt&&($condition$$.ma_dt=$query_tk_co_tk_no$$.ma_dt);$query_tk_co_tk_no$$.ma_sp&&($condition$$.ma_sp=$query_tk_co_tk_no$$.ma_sp);$query_tk_co_tk_no$$.ma_nv&&($condition$$.ma_nv=$query_tk_co_tk_no$$.ma_nv);
|
|
19
|
+
$cell$$.ma_phi&&($condition$$.ma_phi=$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$);$cell$$.ma_kho&&($condition$$.ma_kho=$cell$$.ma_kho);$cell$$.ma_kh&&($condition$$.ma_kh=$cell$$.ma_kh);if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac),$condition_dieu_kien_khac$$=evalute($cell$$.dieu_kien_khac,{condition:$condition$$,moment,row:$row_socai$$,cell:$cell$$}),$condition$$={...$condition$$,...$condition_dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}try{utils.sumByCondition(ctds,
|
|
20
|
+
["chi_tieu"],$condition$$).then($rs$$=>{$cell$$.value_nt=$cell$$.value=$rs$$.chi_tieu;$callback$$(null,$cell$$)}).catch($e$$=>{$callback$$($e$$)})}catch($e$$){$callback$$($e$$)}break;case "5":$cell$$.cong_thuc="";$cell$$.value_string="";$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$query_tk_co_tk_no$$};$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.tu_ngay);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.bu_tru=
|
|
21
|
+
$cell$$.bu_tru_cong_no;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tk=$cell$$.tk;$cell$$.ma_kh&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ma_kh=$cell$$.ma_kh);if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac);$den_nam_thang_dieu_kien_khac$$=evalute($cell$$.dieu_kien_khac,{condition:$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,moment,row:$row_socai$$,
|
|
22
|
+
cell:$cell$$});if($den_nam_thang_dieu_kien_khac$$.ngay&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setDate($den_nam_thang_dieu_kien_khac$$.ngay),$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()))return $callback$$(null,{value:0,value_nt:0});if($den_nam_thang_dieu_kien_khac$$.thang){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth($den_nam_thang_dieu_kien_khac$$.thang-
|
|
23
|
+
1);let $ngay_dau_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("month").toDate(),$ngay_cuoi_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("month").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_dau_thang$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
24
|
+
new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_thang$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<
|
|
25
|
+
$ngay_dau_thang$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($den_nam_thang_dieu_kien_khac$$.quy){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth(3*($den_nam_thang_dieu_kien_khac$$.quy-1));let $ngay_dau_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("quarter").toDate(),$ngay_cuoi_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("quarter").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
26
|
+
new Date($ngay_dau_quy$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());
|
|
27
|
+
if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_quy$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_quy$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($den_nam_thang_dieu_kien_khac$$.nam){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setYear($den_nam_thang_dieu_kien_khac$$.nam);let $ngay_dau_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("year").toDate(),
|
|
28
|
+
$ngay_cuoi_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("year").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_dau_nam$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>
|
|
29
|
+
$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_nam$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_nam$$.getTime())return $callback$$(null,{value:0,value_nt:0})}delete $den_nam_thang_dieu_kien_khac$$.ngay;delete $den_nam_thang_dieu_kien_khac$$.quy;
|
|
30
|
+
delete $den_nam_thang_dieu_kien_khac$$.thang;delete $den_nam_thang_dieu_kien_khac$$.nam;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,...$den_nam_thang_dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tu_ngay;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.den_ngay;dktk($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,
|
|
31
|
+
function($error$$,$result$$){if($error$$)return $callback$$($error$$);$cell$$.value=$result$$.csum("du_no00");$cell$$.value_nt=$result$$.csum("du_no_nt00");$cell$$.value<0&&$cell$$.khong_am&&($cell$$.value=0);$cell$$.value_nt<0&&$cell$$.khong_am&&($cell$$.value_nt=0);$callback$$(null,$cell$$)});break;case "6":$cell$$.cong_thuc="";$cell$$.value_string="";$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$query_tk_co_tk_no$$};$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
32
|
+
new Date($query_tk_co_tk_no$$.tu_ngay);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.bu_tru=$cell$$.bu_tru_cong_no;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tk=$cell$$.tk;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tu_ngay;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.den_ngay;$cell$$.ma_kh&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ma_kh=$cell$$.ma_kh);
|
|
33
|
+
if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac);let $dieu_kien_khac$$=evalute($cell$$.dieu_kien_khac,{condition:$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,moment,row:$row_socai$$,cell:$cell$$});if($dieu_kien_khac$$.ngay&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setDate($dieu_kien_khac$$.ngay),$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>
|
|
34
|
+
$query_tk_co_tk_no$$.den_ngay.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()))return $callback$$(null,{value:0,value_nt:0});if($dieu_kien_khac$$.thang){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth($dieu_kien_khac$$.thang-1);let $ngay_dau_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("month").toDate(),$ngay_cuoi_thang$$=
|
|
35
|
+
moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("month").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_dau_thang$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>
|
|
36
|
+
$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_thang$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_thang$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.quy){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth(($dieu_kien_khac$$.quy-
|
|
37
|
+
1)*3);let $ngay_dau_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("quarter").toDate(),$ngay_cuoi_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("quarter").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_dau_quy$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
38
|
+
new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_quy$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<
|
|
39
|
+
$ngay_dau_quy$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.nam){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setYear($dieu_kien_khac$$.nam);let $ngay_dau_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("year").toDate(),$ngay_cuoi_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("year").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
40
|
+
new Date($ngay_dau_nam$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.tu_ngay));$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.den_ngay).startOf("date").toDate());
|
|
41
|
+
if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_nam$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_nam$$.getTime())return $callback$$(null,{value:0,value_nt:0})}delete $dieu_kien_khac$$.ngay;delete $dieu_kien_khac$$.thang;delete $dieu_kien_khac$$.quy;delete $dieu_kien_khac$$.nam;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,
|
|
42
|
+
...$dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}dktk($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$cell$$.value=$result$$.csum("du_co00");$cell$$.value_nt=$result$$.csum("du_co_nt00");$cell$$.value<0&&$cell$$.khong_am&&($cell$$.value=0);$cell$$.value_nt<0&&$cell$$.khong_am&&($cell$$.value_nt=0);$callback$$(null,$cell$$)});break;case "7":$cell$$.cong_thuc="";$cell$$.value_string="";
|
|
43
|
+
$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$query_tk_co_tk_no$$};$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.bu_tru=$cell$$.bu_tru_cong_no;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tk=$cell$$.tk;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tu_ngay;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.den_ngay;
|
|
44
|
+
$cell$$.ma_kh&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ma_kh=$cell$$.ma_kh);if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac);let $dieu_kien_khac$$=evalute($cell$$.dieu_kien_khac,{condition:$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,moment,row:$row_socai$$,cell:$cell$$});if($dieu_kien_khac$$.ngay&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setDate($dieu_kien_khac$$.ngay),
|
|
45
|
+
$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()))return $callback$$(null,{value:0,value_nt:0});if($dieu_kien_khac$$.thang){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth($dieu_kien_khac$$.thang-1);let $ngay_dau_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("month").toDate(),
|
|
46
|
+
$ngay_cuoi_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("month").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_cuoi_thang$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>
|
|
47
|
+
$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_thang$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_thang$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.quy){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth(($dieu_kien_khac$$.quy-
|
|
48
|
+
1)*3);let $ngay_dau_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("quarter").toDate(),$ngay_cuoi_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("quarter").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_cuoi_quy$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
49
|
+
moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_quy$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<
|
|
50
|
+
$ngay_dau_quy$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.nam){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setYear($dieu_kien_khac$$.nam);let $ngay_dau_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("year").toDate(),$ngay_cuoi_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("year").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
51
|
+
new Date($ngay_cuoi_nam$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));
|
|
52
|
+
if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_nam$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_nam$$.getTime())return $callback$$(null,{value:0,value_nt:0})}delete $dieu_kien_khac$$.ngay;delete $dieu_kien_khac$$.thang;delete $dieu_kien_khac$$.quy;delete $dieu_kien_khac$$.nam;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,
|
|
53
|
+
...$dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}cktk($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$cell$$.value=$result$$.csum("du_no00");$cell$$.value_nt=$result$$.csum("du_no_nt00");$cell$$.value<0&&$cell$$.khong_am&&($cell$$.value=0);$cell$$.value_nt<0&&$cell$$.khong_am&&($cell$$.value_nt=0);$callback$$(null,$cell$$)});break;case "8":$cell$$.cong_thuc="";$cell$$.value_string="";
|
|
54
|
+
$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$query_tk_co_tk_no$$};$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.bu_tru=$cell$$.bu_tru_cong_no;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tk=$cell$$.tk;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.tu_ngay;delete $condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.den_ngay;
|
|
55
|
+
$cell$$.ma_kh&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ma_kh=$cell$$.ma_kh);if($cell$$.dieu_kien_khac)try{$cell$$.dieu_kien_khac.indexOf("return")<0&&($cell$$.dieu_kien_khac="return "+$cell$$.dieu_kien_khac);let $dieu_kien_khac$$=evalute($cell$$.dieu_kien_khac,{condition:$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,moment,row:$row_socai$$,cell:$cell$$});if($dieu_kien_khac$$.ngay&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setDate($dieu_kien_khac$$.ngay),
|
|
56
|
+
$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()))return $callback$$(null,{value:0,value_nt:0});if($dieu_kien_khac$$.thang){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth($dieu_kien_khac$$.thang);let $ngay_dau_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("month").toDate(),
|
|
57
|
+
$ngay_cuoi_thang$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("month").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_cuoi_thang$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>
|
|
58
|
+
$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_thang$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_thang$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.quy){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setMonth(($dieu_kien_khac$$.quy-
|
|
59
|
+
1)*3);let $ngay_dau_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("quarter").toDate(),$ngay_cuoi_quy$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("quarter").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($ngay_cuoi_quy$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
60
|
+
moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_quy$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<
|
|
61
|
+
$ngay_dau_quy$$.getTime())return $callback$$(null,{value:0,value_nt:0})}if($dieu_kien_khac$$.nam){$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.setYear($dieu_kien_khac$$.nam);let $ngay_dau_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).startOf("year").toDate(),$ngay_cuoi_nam$$=moment($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay).endOf("year").toDate();$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=
|
|
62
|
+
new Date($ngay_cuoi_nam$$);$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$query_tk_co_tk_no$$.tu_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=moment($query_tk_co_tk_no$$.tu_ngay).endOf("date").toDate());$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$query_tk_co_tk_no$$.den_ngay.getTime()&&($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay=new Date($query_tk_co_tk_no$$.den_ngay));
|
|
63
|
+
if($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()>$ngay_cuoi_nam$$.getTime()||$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$.ngay.getTime()<$ngay_dau_nam$$.getTime())return $callback$$(null,{value:0,value_nt:0})}delete $dieu_kien_khac$$.ngay;delete $dieu_kien_khac$$.thang;delete $dieu_kien_khac$$.quy;delete $dieu_kien_khac$$.nam;$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$={...$condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,
|
|
64
|
+
...$dieu_kien_khac$$}}catch($e$$){return $callback$$($e$$.toString())}cktk($condition$jscomp$2_condition$jscomp$3_condition$jscomp$4_condition$$,function($error$$,$result$$){if($error$$)return $callback$$($error$$);$cell$$.value=$result$$.csum("du_co00");$cell$$.value_nt=$result$$.csum("du_co_nt00");$cell$$.value<0&&$cell$$.khong_am&&($cell$$.value=0);$cell$$.value_nt<0&&$cell$$.khong_am&&($cell$$.value_nt=0);$callback$$(null,$cell$$)});break;default:$cell$$.cong_thuc="",$callback$$(null,$cell$$)}};
|
|
65
|
+
module.exports=function($router$$){new controller($router$$,"bcqt",async function($req$$,$callback$$){let $query$$=$req$$.query;if(!$query$$.den_ngay||!$query$$.tu_ngay||!$query$$.id_rptform&&!$query$$.form_code)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u tham s\u1ed1 t\u1eeb ng\u00e0y(tu_ngay), \u0111\u1ebfn ng\u00e0y(den_ngay), id m\u1eabu b\u00e1o c\u00e1o");if(!global.mongoose.Types.ObjectId.isValid($query$$.id_rptform))return $callback$$("M\u1eabu b\u00e1o c\u00e1o n\u00e0y kh\u00f4ng c\u00f3 gi\u00e1 tr\u1ecb");
|
|
66
|
+
if($query$$.ma_bp){var $bps_dts_phis$$=await getCodeChildren(global.getModel("dmbp"),$query$$.id_app,$query$$.ma_bp,"ma_bp","ma_bp_me");$query$$.ma_bp={$in:$bps_dts_phis$$}}$query$$.ma_phi&&($bps_dts_phis$$=await getCodeChildren(global.getModel("dmphi"),$query$$.id_app,$query$$.ma_phi,"ma_phi","ma_phi_me"),$query$$.ma_phi={$in:$bps_dts_phis$$});$query$$.ma_dt&&($bps_dts_phis$$=await getCodeChildren(global.getModel("dmdt"),$query$$.id_app,$query$$.ma_dt,"ma_dt","ma_dt_me"),$query$$.ma_dt={$in:$bps_dts_phis$$});
|
|
67
|
+
$bps_dts_phis$$={id_app:$query$$.id_app};$query$$.id_rptform?$bps_dts_phis$$._id=$query$$.id_rptform:$bps_dts_phis$$.form_code=$query$$.form_code;const $_rptform$$=await rptform.findOne($bps_dts_phis$$).lean();if(!$_rptform$$)return $callback$$("M\u1eabu b\u00e1o c\u00e1o kh\u00f4ng t\u1ed3n t\u1ea1i");$query$$.tu_ngay=moment(new Date($query$$.tu_ngay)).startOf("date").toDate();$query$$.den_ngay=moment(new Date($query$$.den_ngay)).endOf("date").toDate();$query$$.tu_ngay_kt?$query$$.tu_ngay_kt=moment(new Date($query$$.tu_ngay_kt)).startOf("date").toDate():
|
|
68
|
+
($query$$.tu_ngay_kt=new Date($query$$.tu_ngay),$query$$.tu_ngay_kt.setYear($query$$.tu_ngay_kt.getFullYear()-1));$query$$.den_ngay_kt?$query$$.den_ngay_kt=moment(new Date($query$$.den_ngay_kt)).endOf("date").toDate():($query$$.den_ngay_kt=new Date($query$$.den_ngay),$query$$.den_ngay_kt.setYear($query$$.den_ngay_kt.getFullYear()-1));let $kbm$$=$_rptform$$.report||[];$kbm$$&&$kbm$$.length!==0||(Logger.warn("[bcqt] s\u1eed dung c\u00e1ch khai b\u00e1o ki\u1ec3u c\u0169"),$kbm$$=await global.getModel("kbmbcqt").find({id_rptform:$_rptform$$._id.toString(),
|
|
69
|
+
id_app:$query$$.id_app}).sort({stt:1}).lean());const $columns$$={},$cells$$={};let $report$$=[];try{await new Promise(($resolve$$,$reject$$)=>{async.map($kbm$$,async $row$$=>{if($row$$.ref_model&&$row$$.ref_code_field){let $row_origin$$;$row$$.hide_origin_row||($row_origin$$={..._.cloneDeep($row$$),bold:!0},$report$$.push($row_origin$$));let $fields$$={[$row$$.ref_code_field]:1};$row$$.ref_label_field&&($fields$$[$row$$.ref_label_field]=1);$row$$.ref_fields&&$row$$.ref_fields.split(",").forEach($f$$=>
|
|
70
|
+
{$fields$$[$f$$]=1});let $_condition$$={};if($row$$.ref_condition){let $ref_condition$$=$row$$.ref_condition;$row$$.ref_condition.indexOf("return ")<0&&($ref_condition$$="return "+$ref_condition$$);try{$_condition$$=evalute($ref_condition$$,{moment,row:$row$$})}catch($e$$){Logger.error("error ref_condition of bcqt",$e$$,$ref_condition$$)}}(await global.getModel($row$$.ref_model).find({id_app:$query$$.id_app,...$_condition$$},$fields$$).lean()).forEach(($ref_r$$,$index$$)=>{let $_row$$={..._.cloneDeep($row$$),
|
|
71
|
+
...$ref_r$$,ma_so:`${$row$$.ma_so}:${$ref_r$$[$row$$.ref_code_field]}`.toUpperCase(),title:$ref_r$$[$row$$.ref_label_field||$row$$.ref_code_field]||$row$$.title,stt:`${$row$$.stt}.${$index$$+1}`,ma_so_goc:$row$$.ma_so};$_row$$.details&&$_row$$.details.forEach($c$$=>{$c$$.cong_thuc&&($c$$.cong_thuc=$c$$.cong_thuc.split(`["${$_row$$.ma_so_goc}"]`).join(`["${$_row$$.ma_so}"]`))});$report$$.push($_row$$)});$row_origin$$&&($row_origin$$.details||[]).forEach($detail$$=>{$detail$$.cach_tinh="1";$detail$$.script=
|
|
72
|
+
"";$detail$$.query="";$detail$$.cong_thuc=$report$$.filter($r$$=>$r$$.ma_so_goc===$row_origin$$.ma_so).map($r$$=>`c["${$r$$.ma_so}"]["${$detail$$.ma_so}"]`).join("+")})}else $report$$.push($row$$)},$e$$=>{if($e$$)return $reject$$($e$$);$resolve$$()})})}catch($e$$){$callback$$($e$$)}async.map($report$$,($r$$,$callback$$)=>{async.map($r$$.details||[],($cell$$,$callback$$)=>{const $_q$$={...$query$$};$cell$$.thoi_gian=="1"&&($_q$$.tu_ngay=$_q$$.tu_ngay_kt,$_q$$.den_ngay=$_q$$.den_ngay_kt);const $col_ma_so$$=
|
|
73
|
+
$cell$$.ma_so,$col_value$$=`${$col_ma_so$$}_value`,$col_value_nt$$=`${$col_ma_so$$}_value_nt`,$col_cong_thuc$$=`cong_thuc_${$col_ma_so$$}_value`,$col_cong_thuc_nt$$=`cong_thuc_${$col_ma_so$$}_value_nt`;calc4cell($req$$,$r$$,$cell$$,$_q$$,($e$$,$rs$$)=>{if($e$$)return $callback$$($e$$);$columns$$[$col_ma_so$$]={field:$col_value$$,header:$cell$$.title,stt:$cell$$.stt,title:$cell$$.title,data_type:$cell$$.data_type,ma_so:$cell$$.ma_so,col_value:$col_value$$,col_value_nt:$col_value_nt$$,col_cong_thuc:$col_cong_thuc$$,
|
|
74
|
+
col_cong_thuc_nt:$col_cong_thuc_nt$$};$r$$[$col_value$$]=$rs$$.value_string||$rs$$.value;$r$$[$col_value_nt$$]=$rs$$.value_string||$rs$$.value_nt;$r$$[$col_cong_thuc$$]=$rs$$.cong_thuc;$r$$[$col_cong_thuc_nt$$]=$rs$$.cong_thuc;$r$$[$col_ma_so$$]=$cells$$[`c["${$r$$.ma_so}"]["${$col_ma_so$$}"]`]={type:$rs$$.value_string===$r$$[$col_value$$]?"String":"Number",value:$r$$[$col_value$$],cong_thuc:$r$$[$col_cong_thuc$$]};$callback$$()})},($e$$,$rs$$)=>{delete $r$$.details;$callback$$($e$$,$rs$$)})},function($error$$){if($error$$)return $callback$$($error$$);
|
|
75
|
+
const $key_cells$$=Object.keys($cells$$),$cells_value$$=Object.values($cells$$);let $cell_need_calc$$=$cells_value$$.filter($cell$$=>$cell$$.cong_thuc);async.whilst(function($cb$$){$cb$$(null,$cell_need_calc$$.length>0)},function($callback$$){setImmediate(()=>{try{$cell_need_calc$$.forEach($cell$$=>{let $cong_thuc$$=$cell$$.cong_thuc||"";$key_cells$$.filter($key$$=>$cong_thuc$$.indexOf($key$$)>=0).forEach($key_cell$$=>{$cong_thuc$$=$cong_thuc$$.split($key_cell$$).join(`(${$cells$$[$key_cell$$].cong_thuc||
|
|
76
|
+
$cells$$[$key_cell$$].value})`);if($cong_thuc$$.indexOf("[")<0){try{$cell$$.value=exec($cong_thuc$$,{report:$report$$})}catch($e$$){Logger.error($e$$,$cong_thuc$$),$cell$$.value=0}$cell$$.cong_thuc=""}})});let $current_cell_need_calc$$=_.cloneDeep($cell_need_calc$$),$_cell_need_calc$$=$cells_value$$.filter($cell$$=>$cell$$.cong_thuc);$cell_need_calc$$=$_cell_need_calc$$.length>0&&_.isEqual($_cell_need_calc$$,$current_cell_need_calc$$)?[]:$_cell_need_calc$$;$callback$$()}catch($e$$){$callback$$($e$$)}})},
|
|
77
|
+
async $err_func_string$$=>{if($err_func_string$$)return $callback$$($err_func_string$$);let $obj_rows$$={};$report$$.forEach($row$$=>{($row$$.details||[]).forEach($c$$=>{$row$$[$c$$.ma_so]=($row$$[$c$$.ma_so]||{}).value});$obj_rows$$[$row$$.ma_so]=$row$$});$cells_value$$.forEach($cell$$=>{if($cell$$.cong_thuc){try{$cell$$.value=exec($cell$$.cong_thuc,{report:$report$$,c:$obj_rows$$})}catch($e$$){Logger.error($e$$,$cell$$.cong_thuc),$cell$$.value=0}$cell$$.cong_thuc=""}});if($_rptform$$.handle_data_expression_server){if($_rptform$$.handle_data_expression_server.indexOf("async ")>=
|
|
78
|
+
0)return $callback$$("async function is not allow");$err_func_string$$=`return (async ()=>{
|
|
79
|
+
try{
|
|
80
|
+
${$_rptform$$.handle_data_expression_server}
|
|
81
|
+
}catch(e){
|
|
82
|
+
return {error:e}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
})`;try{let $rs$$=await evalute($err_func_string$$,{data:$report$$,moment,numeral,condition:$req$$.query})();if($rs$$){if($rs$$.error)return Logger.error($rs$$.error,$err_func_string$$),$callback$$($rs$$.error.message||$rs$$.error);$report$$=$rs$$}}catch($e$$){return Logger.error($e$$,$err_func_string$$),$callback$$($e$$.message||$e$$)}}$callback$$(null,{data:$report$$.filter($r$$=>$r$$.print),columns:Object.values($columns$$).sort(($a$$,$b$$)=>$a$$.stt-$b$$.stt)})})})})};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const chamcong=global.getModel("chamcong"),controller=require("../../controllers/controllerRPT"),async=require("async"),permission=require("../../libs/permission");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bkchamcong",function($req$$,$callback$$){let $id_apps$$=$req$$.query.id_apps;$req$$.query.id_apps&&$req$$.query.id_apps.length!=0||($id_apps$$=[$req$$.query.id_app]);async.map($id_apps$$,($id_app$$,$callback$$)=>{permission.hasRight($id_app$$,$req$$.user.email,"chamcong","view",async function($error$$,$permission$$){if(!$permission$$)return $callback$$(`B\u1ea1n kh\u00f4ng c\u00f3 quy\u1ec1n v\u1edbi c\u00f4ng ty c\u00f3 id '${$id_app$$}'`);
|
|
3
|
+
$error$$={};$error$$.id_app=$id_app$$;$error$$.ngay={$gte:$req$$.query.tu_ngay,$lte:$req$$.query.den_ngay};$req$$.query.ma_nv&&($error$$.ma_nv=$req$$.query.ma_nv);$req$$.query.ma_bp&&($error$$.ma_bp=$req$$.query.ma_bp);chamcong.find($error$$).lean().then(async $congs$$=>{await $congs$$.asyncJoinModel2($id_app$$,"dmloaicong",[{where:{ma_loai_cong:"ma_loai_cong"},fields:["ten_loai_cong","color"]}]);await $congs$$.asyncJoinModel2($id_app$$,global.getModel("dmnv"),[{where:{ma_nv:"ma_nv"},fields:["ten_nv"]}]);
|
|
4
|
+
await $congs$$.asyncJoinModel2($id_app$$,global.getModel("dmbp"),[{where:{ma_bp:"ma_bp"},fields:["ten_bp"]}]);await $congs$$.filter($r$$=>$r$$.ma_kh).asyncJoinModel2($id_app$$,global.getModel("customer"),[{where:{ma_kh:"ma_kh"},fields:["ten_kh"]}]);$callback$$(null,$congs$$)}).catch($e$$=>{$callback$$($e$$)})})},async($e$$,$rs$$)=>{if($e$$)return $callback$$($e$$);$e$$=$rs$$.reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);await $e$$.asyncJoinModel2(null,global.getModel("app"),[{where:{id_app:"_id"},fields:[{ten_cong_ty:"name"}]}]);
|
|
5
|
+
$callback$$(null,$e$$)})})};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const Account=global.getModel("account"),Customer=global.getModel("customer"),contract=global.getModel("contract"),dmphi=global.getModel("dmphi"),dmdt=global.getModel("dmdt"),dmnv=global.getModel("dmnv"),dmvt=global.getModel("dmvt"),dmbp=global.getModel("dmbp"),group=global.getModel("group"),Socai=global.getModel("socai"),Lenhsx=global.getModel("lenhsx"),underscore=require("underscore"),async=require("async"),controller=require("../../controllers/controllerRPT"),{getCodeChildren}=require("../../libs/utils"),
|
|
2
|
+
moment=require("moment");
|
|
3
|
+
module.exports=function($router$$){new controller($router$$,"bkct",async function($req$$,$callback$$){const $query$$={};$query$$.id_app=$req$$.query.id_app;if($req$$.query.q){var $no_phis_phis$jscomp$1_phis$$=JSON.parse($req$$.query.q);underscore.extend($query$$,$no_phis_phis$jscomp$1_phis$$)}else{$query$$.$and=[];$req$$.query.tu_ngay&&$query$$.$and.push({ngay_ct:{$gte:$req$$.query.tu_ngay}});$req$$.query.den_ngay&&$query$$.$and.push({ngay_ct:{$lte:$req$$.query.den_ngay}});$req$$.query.dien_giai&&
|
|
4
|
+
($query$$.dien_giai={$regex:$req$$.query.dien_giai,$options:"i"});$req$$.query.so_ct&&($query$$.so_ct={$regex:$req$$.query.so_ct,$options:"i"});$req$$.query.ma_kh&&($query$$.$and.push({$or:[{ma_kh_no:$req$$.query.ma_kh}]}),$query$$.$and.push({$or:[{ma_kh_co:$req$$.query.ma_kh}]}));$req$$.query.ma_hd&&($query$$.ma_hd=$req$$.query.ma_hd);$req$$.query.ma_dt&&($query$$.ma_dt=$req$$.query.ma_dt);$req$$.query.ma_phi&&($no_phis_phis$jscomp$1_phis$$=await getCodeChildren(dmphi,$req$$.query.id_app,$req$$.query.ma_phi,
|
|
5
|
+
"ma_phi","ma_phi_me"),$query$$.ma_phi={$in:$no_phis_phis$jscomp$1_phis$$});$req$$.query.ma_dt&&($no_phis_phis$jscomp$1_phis$$=await getCodeChildren(dmdt,$req$$.query.id_app,$req$$.query.ma_dt,"ma_dt","ma_dt_me"),$query$$.ma_dt={$in:$no_phis_phis$jscomp$1_phis$$});$req$$.query.ma_bp&&($no_phis_phis$jscomp$1_phis$$=await getCodeChildren(dmbp,$req$$.query.id_app,$req$$.query.ma_bp,"ma_bp","ma_bp_me"),$query$$.ma_bp={$in:$no_phis_phis$jscomp$1_phis$$});$req$$.query.ma_nv&&($query$$.ma_nv=$req$$.query.ma_nv);
|
|
6
|
+
$req$$.query.ma_dvcs&&mongoose.Types.ObjectId.isValid($req$$.query.ma_dvcs)&&($query$$.ma_dvcs=$req$$.query.ma_dvcs);$req$$.query.id_lenhsx&&mongoose.Types.ObjectId.isValid($req$$.query.id_lenhsx)&&($query$$.id_lenhsx=$req$$.query.id_lenhsx);$req$$.query.ma_kho&&($query$$.ma_kho=$req$$.query.ma_kho);if($req$$.query.tk){$no_phis_phis$jscomp$1_phis$$={tk_no:{$regex:"^"+$req$$.query.tk,$options:"i"}};let $co$$={tk_co:{$regex:"^"+$req$$.query.tk,$options:"i"}};$req$$.query.tk_du&&($no_phis_phis$jscomp$1_phis$$.tk_co=
|
|
7
|
+
{$regex:"^"+$req$$.query.tk_du,$options:"i"},$co$$.tk_no={$regex:"^"+$req$$.query.tk_du,$options:"i"});$query$$.$and||($query$$.$and=[]);$query$$.$and.push({$or:[$no_phis_phis$jscomp$1_phis$$,$co$$]})}$query$$.$and.length===0&&delete $query$$.$and}Socai.find($query$$).lean().then(function($rp$$){$rp$$.groupBy("id_app ma_dvcs id_ct ma_ct ma_gd ngay_ct so_ct ngay_hd so_hd tk_no tk_co ma_kh_no ma_kh_co ma_nt ty_gia dien_giai ma_bp id_lenhsx ma_phi ma_hd ma_dt ma_nv ma_sp ma_vt ma_cp".split(" "),["tien",
|
|
8
|
+
"tien_nt"],($e$$,$rp$$)=>{$rp$$.forEach(function($r$$){$r$$.systotal=0});async.parallel([function($callback$$){$rp$$.joinModel2($req$$.query.id_app,Account,[{where:{tk_no:"tk"},fields:[{name:"ten_tk_no",value:"ten_tk"}]},{where:{tk_co:"tk"},fields:[{name:"ten_tk_co",value:"ten_tk"}]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_kh_no).joinModel2($req$$.query.id_app,Customer,[{where:{ma_kh_no:"ma_kh"},fields:[{name:"ten_kh_no",value:"ten_kh"},{name:"nh_kh_no",value:"nh_kh"}]}],
|
|
9
|
+
function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_kh_co).joinModel2($req$$.query.id_app,Customer,[{where:{ma_kh_co:"ma_kh"},fields:[{name:"ten_kh_co",value:"ten_kh"},{name:"nh_kh_co",value:"nh_kh"}]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_hd).joinModel2($req$$.query.id_app,contract,[{where:{ma_hd:"so_hd"},fields:[{name:"ten_hd",value:"ten_hd"}]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_dt).joinModel2($req$$.query.id_app,
|
|
10
|
+
dmdt,[{where:"ma_dt",fields:["ten_dt"]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_phi).joinModel2($req$$.query.id_app,dmphi,[{where:"ma_phi",fields:["ten_phi"]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_nv).joinModel2($req$$.query.id_app,dmnv,[{where:"ma_nv",fields:["ten_nv"]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_vt).joinModel2($req$$.query.id_app,dmvt,[{where:"ma_vt",fields:["ten_vt"]}],
|
|
11
|
+
function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.ma_sp).joinModel2($req$$.query.id_app,dmvt,[{where:{ma_sp:"ma_vt"},fields:[{ten_sp:"ten_vt"}]}],function(){$callback$$()})},function($callback$$){$rp$$.filter($r$$=>$r$$.id_lenhsx).joinModel2($req$$.query.id_app,Lenhsx,[{where:{id_lenhsx:"_id"},fields:[{so_lenhsx:"so_ct"}]}],function(){$callback$$()})},function($callback$$){async.map($rp$$.filter($r$$=>$r$$.ma_ct),($item$$,$cb$$)=>{global.getModel($item$$.ma_ct.toLowerCase()).findOne({_id:$item$$.id_ct},
|
|
12
|
+
{_id:1}).then($rs$$=>{$item$$.id_ct_goc=$rs$$?$rs$$._id:void 0;$cb$$()}).catch(()=>{$cb$$()})},()=>{$callback$$()})}],function($error$$){if($req$$.query.co_ct_goc==0||$req$$.query.co_ct_goc=="false")$rp$$=$rp$$.filter($r$$=>!$r$$.id_ct_goc);if($req$$.query.co_ct_goc==1||$req$$.query.co_ct_goc=="true")$rp$$=$rp$$.filter($r$$=>$r$$.id_ct_goc);$rp$$.filter($r$$=>$r$$.nh_kh_no||$r$$.nh_kh_co).joinModel2($req$$.query.id_app,group,[{where:{nh_kh_no:"_id"},fields:[{name:"ten_nh_kh_no",value:"group_name"}]},
|
|
13
|
+
{where:{nh_kh_co:"_id"},fields:[{name:"ten_nh_kh_co",value:"group_name"}]}],function(){$rp$$=underscore.sortBy($rp$$,function($r$$){return($r$$.ngay_ct?moment($r$$.ngay_ct).format("YYYYMMDD"):"0")+$r$$.ma_ct+$r$$.so_ct});const $rt$$={dien_giai:"T\u1ed5ng c\u1ed9ng",tien:$rp$$.csum("tien"),tien_nt:$rp$$.csum("tien_nt"),systotal:1,bold:!0};$rp$$.push($rt$$);$callback$$($error$$,$rp$$)})})})}).catch($error$$=>{$callback$$($error$$)})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const Customer=global.getModel("customer"),contract=global.getModel("contract"),dmphi=global.getModel("dmphi"),dmdt=global.getModel("dmdt"),dmnv=global.getModel("dmnv"),dmvt=global.getModel("dmvt"),Shipbook=global.getModel("shipbook"),underscore=require("underscore"),async=require("async"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bkshipbook",function($req$$,$callback$$){const $query$$={};$query$$.id_app=$req$$.query.id_app;if($req$$.query.q){const $q$$=JSON.parse($req$$.query.q);underscore.extend($query$$,$q$$)}else $query$$.$and=[],$req$$.query.tu_ngay&&$query$$.$and.push({ngay_ct:{$gte:$req$$.query.tu_ngay}}),$req$$.query.den_ngay&&$query$$.$and.push({ngay_ct:{$lte:$req$$.query.den_ngay}}),$req$$.query.dien_giai&&($query$$.dien_giai={$regex:$req$$.query.dien_giai,
|
|
3
|
+
$options:"i"}),$req$$.query.so_ct&&($query$$.so_ct={$regex:$req$$.query.so_ct,$options:"i"}),$req$$.query.ma_phi&&($query$$.ma_phi=$req$$.query.ma_phi),$req$$.query.ma_kh&&($query$$.ma_kh=$req$$.query.ma_kh),$req$$.query.ma_hd&&($query$$.ma_hd=$req$$.query.ma_hd),$req$$.query.ma_dt&&($query$$.ma_dt=$req$$.query.ma_dt),$req$$.query.ma_nv&&($query$$.ma_nv=$req$$.query.ma_nv),$req$$.query.ma_dvcs&&($query$$.ma_dvcs=$req$$.query.ma_dvcs);Shipbook.find($query$$).lean().exec(function($error$$,$rp$$){if($error$$)return $callback$$($error$$);
|
|
4
|
+
async.series([function($callback$$){$rp$$.joinModel($req$$.query.id_app,Customer,[{akey:"ma_kh",bkey:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"nh_kh",value:"nh_kh"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,contract,[{akey:"ma_hd",bkey:"so_hd",fields:[{name:"ten_hd",value:"ten_hd"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmdt,[{akey:"ma_dt",bkey:"ma_dt",fields:[{name:"ten_dt",value:"ten_dt"}]}],
|
|
5
|
+
function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmphi,[{akey:"ma_phi",bkey:"ma_phi",fields:[{name:"ten_phi",value:"ten_phi"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmnv,[{akey:"ma_nv",bkey:"ma_nv",fields:[{name:"ten_nv",value:"ten_nv"}]}],function(){$callback$$()})}],function($error$$){let $report$$=[];$rp$$.forEach($r$$=>{let $m$$=JSON.parse(JSON.stringify($r$$));$r$$.details.forEach($d$$=>{$d$$.master=$m$$;$d$$.exfields_detail||
|
|
6
|
+
($d$$.exfields_detail={});$d$$.tien_phi_nt=$d$$.exfields_detail.tien_phi_nt||0;$d$$.tien_phi=$d$$.exfields_detail.tien_phi||0;$d$$.tien_phi_khac_nt=$d$$.exfields_detail.tien_phi_khac_nt||0;$d$$.tien_phi_khac=$d$$.exfields_detail.tien_phi_khac||0;$d$$.tong_cong_nt=($d$$.tien_nt||0)+$d$$.tien_phi_nt+$d$$.tien_phi_khac_nt;$d$$.tong_cong=($d$$.tien||0)+$d$$.tien_phi+$d$$.tien_phi_khac;$d$$.bold=!1;$d$$.systotal=0;$report$$.push($d$$)})});$report$$.joinModel($req$$.query.id_app,dmvt,[{akey:"ma_vt",bkey:"ma_vt",
|
|
7
|
+
fields:[{name:"ten_vt",value:"ten_vt"}]}],function(){$report$$=underscore.sortBy($report$$,function($r$$){return($r$$.master.ngay_ct?moment($r$$.master.ngay_ct).format("YYYYMMDD"):"0")+$r$$.master.ma_ct+$r$$.master.so_ct});var $rt$$={ten_vt:"T\u1ed5ng c\u1ed9ng",so_luong:$report$$.csum("so_luong"),tien_nt:$report$$.csum("tien_nt"),tien:$report$$.csum("tien"),tien_phi_nt:$report$$.csum("tien_phi_nt"),tien_phi:$report$$.csum("tien_phi"),tien_phi_khac_nt:$report$$.csum("tien_phi_khac_nt"),tien_phi_khac:$report$$.csum("tien_phi_khac"),
|
|
8
|
+
tong_cong_nt:$report$$.csum("tong_cong_nt"),tong_cong:$report$$.csum("tong_cong"),systotal:1,bold:!0};$report$$.push($rt$$);$callback$$($error$$,$report$$)})})})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const Customer=global.getModel("customer"),contract=global.getModel("contract"),dmphi=global.getModel("dmphi"),dmdt=global.getModel("dmdt"),dmnv=global.getModel("dmnv"),dmvt=global.getModel("dmvt"),Shipbook=global.getModel("vanchuyen"),underscore=require("underscore"),async=require("async"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bkvanchuyen",function($req$$,$callback$$){const $query$$={};$query$$.id_app=$req$$.query.id_app;if($req$$.query.q){const $q$$=JSON.parse($req$$.query.q);underscore.extend($query$$,$q$$)}else $query$$.$and=[],$req$$.query.tu_ngay&&$query$$.$and.push({ngay_ct:{$gte:$req$$.query.tu_ngay}}),$req$$.query.den_ngay&&$query$$.$and.push({ngay_ct:{$lte:$req$$.query.den_ngay}}),$req$$.query.dien_giai&&($query$$.dien_giai={$regex:$req$$.query.dien_giai,
|
|
3
|
+
$options:"i"}),$req$$.query.so_ct&&($query$$.so_ct={$regex:$req$$.query.so_ct,$options:"i"}),$req$$.query.ma_phi&&($query$$.ma_phi=$req$$.query.ma_phi),$req$$.query.ma_kh&&($query$$.ma_kh=$req$$.query.ma_kh),$req$$.query.ma_hd&&($query$$.ma_hd=$req$$.query.ma_hd),$req$$.query.ma_dt&&($query$$.ma_dt=$req$$.query.ma_dt),$req$$.query.ma_nv&&($query$$.ma_nv=$req$$.query.ma_nv),$req$$.query.ma_dvcs&&($query$$.ma_dvcs=$req$$.query.ma_dvcs);Shipbook.find($query$$).lean().exec(function($error$$,$rp$$){if($error$$)return $callback$$($error$$);
|
|
4
|
+
async.series([function($callback$$){$rp$$.joinModel($req$$.query.id_app,Customer,[{akey:"ma_kh",bkey:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"nh_kh",value:"nh_kh"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,contract,[{akey:"ma_hd",bkey:"so_hd",fields:[{name:"ten_hd",value:"ten_hd"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmdt,[{akey:"ma_dt",bkey:"ma_dt",fields:[{name:"ten_dt",value:"ten_dt"}]}],
|
|
5
|
+
function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmphi,[{akey:"ma_phi",bkey:"ma_phi",fields:[{name:"ten_phi",value:"ten_phi"}]}],function(){$callback$$()})},function($callback$$){$rp$$.joinModel($req$$.query.id_app,dmnv,[{akey:"ma_nv",bkey:"ma_nv",fields:[{name:"ten_nv",value:"ten_nv"}]}],function(){$callback$$()})}],function($error$$){let $report$$=[];$rp$$.forEach($r$$=>{let $m$$=JSON.parse(JSON.stringify($r$$));$r$$.details.forEach($d$$=>{$d$$.exfields_detail||
|
|
6
|
+
($d$$.exfields_detail={});$d$$.master=$m$$;$d$$.tien_phi_nt=$d$$.exfields_detail.tien_phi_nt||0;$d$$.tien_phi=$d$$.exfields_detail.tien_phi||0;$d$$.tien_phi_khac_nt=$d$$.exfields_detail.tien_phi_khac_nt||0;$d$$.tien_phi_khac=$d$$.exfields_detail.tien_phi_khac||0;$d$$.tong_cong_nt=($d$$.tien_nt||0)+$d$$.tien_phi_nt+$d$$.tien_phi_khac_nt;$d$$.tong_cong=($d$$.tien||0)+$d$$.tien_phi+$d$$.tien_phi_khac;$d$$.bold=!1;$d$$.systotal=0;$report$$.push($d$$)})});$report$$.joinModel($req$$.query.id_app,dmvt,[{akey:"ma_vt",
|
|
7
|
+
bkey:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"}]}],function(){$report$$=underscore.sortBy($report$$,function($r$$){return($r$$.master.ngay_ct?moment($r$$.master.ngay_ct).format("YYYYMMDD"):"0")+$r$$.master.ma_ct+$r$$.master.so_ct});const $rt$$={ten_vt:"T\u1ed5ng c\u1ed9ng",so_luong:$report$$.csum("so_luong"),tien_nt:$report$$.csum("tien_nt"),tien:$report$$.csum("tien"),tien_phi_nt:$report$$.csum("tien_phi_nt"),tien_phi:$report$$.csum("tien_phi"),tien_phi_khac_nt:$report$$.csum("tien_phi_khac_nt"),
|
|
8
|
+
tien_phi_khac:$report$$.csum("tien_phi_khac"),tong_cong_nt:$report$$.csum("tong_cong_nt"),tong_cong:$report$$.csum("tong_cong"),systotal:1,bold:!0};$report$$.push($rt$$);$callback$$($error$$,$report$$)})})})})};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const vatra=global.getModel("vatra"),dmvat=global.getModel("vat"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bkvatra",function($query_req$$,$callback$$){const $condition$$=$query_req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y c\u1ea7n c\u00e1c tham s\u1ed1 sau:id_app,tu_ngay,den_ngay");$query_req$$={id_app:$condition$$.id_app,ngay_ct:{$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay}};$condition$$.ma_dvcs&&($query_req$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.ma_thue&&($query_req$$.ma_thue=
|
|
3
|
+
$condition$$.ma_thue);let $sort$$="ngay_hd";$condition$$.sort&&($sort$$=$condition$$.sort);vatra.find($query_req$$).lean().then(function($rows$$){$rows$$.forEach($r$$=>{$r$$.t_tien=$r$$.t_tien_nt*($r$$.ty_gia||1);$r$$.t_thue=$r$$.t_thue_nt*($r$$.ty_gia||1);$r$$.t_hd=$r$$.t_tien+$r$$.t_thue;$r$$.t_hd_nt=$r$$.t_tien_nt+$r$$.t_thue_nt});dmvat.find({status:!0,id_app:$condition$$.id_app}).sort({ten_thue:1}).lean().then(function($tcs$$){async.map($tcs$$,function($tc$$,$callback$$){let $vat_tc1$$=underscore.filter($rows$$,
|
|
4
|
+
function($r$$){return $r$$.ma_thue==$tc$$.ma_thue});$vat_tc1$$=underscore.sortBy($vat_tc1$$,function($v$$){return $v$$[$sort$$]});for(var $stt_t_tien_nt$$=0;$stt_t_tien_nt$$<$vat_tc1$$.length;$stt_t_tien_nt$$++)$vat_tc1$$[$stt_t_tien_nt$$].sysorder=5,$vat_tc1$$[$stt_t_tien_nt$$].bold=!1,$vat_tc1$$[$stt_t_tien_nt$$].stt=$stt_t_tien_nt$$+1,$vat_tc1$$[$stt_t_tien_nt$$].ten_thue=$tc$$.ten_thue;$vat_tc1$$.length===0&&$vat_tc1$$.push({ma_thue:$tc$$.ma_thue,ten_thue:$tc$$.ten_thue,stt:1,sysorder:5,t_tien_nt:0,
|
|
5
|
+
t_tien:0,t_thue_nt:0,t_thue:0});$vat_tc1$$.push({ma_thue:$tc$$.ma_thue,ten_thue:$tc$$.ten_thue,stt:$tc$$.ten_thue,sysorder:1,bold:!0});$stt_t_tien_nt$$=$vat_tc1$$.csum("t_tien_nt");const $t_tien$$=$vat_tc1$$.csum("t_tien"),$t_thue_nt$$=$vat_tc1$$.csum("t_thue_nt"),$t_thue$$=$vat_tc1$$.csum("t_thue");$vat_tc1$$.push({ma_thue:$tc$$.ma_thue,ten_thue:$tc$$.ten_thue,stt:"T\u1ed5ng c\u1ed9ng",sysorder:7,bold:!0,t_tien_nt:$stt_t_tien_nt$$,t_tien:$t_tien$$,t_thue_nt:$t_thue_nt$$,t_thue:$t_thue$$,t_hd_nt:$t_thue_nt$$+
|
|
6
|
+
$stt_t_tien_nt$$,t_hd:$t_thue$$+$t_tien$$});$callback$$(null,$vat_tc1$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);let $report$$=[];$rs$$.forEach(function($rows$$){$rows$$.forEach(function($r$$){$report$$.push($r$$)})});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.ten_thue+$r$$.sysorder.toString()+"0000000000000000".substring(0,16-$r$$.stt.toString().length)+$r$$.stt.toString()});$callback$$(null,$report$$)})}).catch($error$$=>{$callback$$($error$$)})}).catch($error$$=>
|
|
7
|
+
{$callback$$($error$$)})},{onExport:function($app$$,$next$$){$app$$.nam=$app$$.tu_ngay.getFullYear();$app$$.thang=$app$$.tu_ngay.getMonth()+1;$app$$.tong_tien_nt=0;$app$$.tong_thue_nt=0;$app$$.tong_tien=0;$app$$.tong_thue=0;$app$$.detail.forEach(function($r$$){$r$$.t_tien_nt&&$r$$.sysorder==5&&($app$$.tong_tien_nt+=$r$$.t_tien_nt,$app$$.tong_tien+=$r$$.t_tien);$r$$.t_thue_nt&&$r$$.sysorder==5&&($app$$.tong_thue_nt+=$r$$.t_thue_nt,$app$$.tong_thue+=$r$$.t_thue)});$next$$()}})};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const vatvao=global.getModel("vatvao"),dmtc=global.getModel("tc"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"bkvatvao",function($query_req$$,$callback$$){const $condition$$=$query_req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y c\u1ea7n c\u00e1c tham s\u1ed1 sau:id_app,tu_ngay,den_ngay");$query_req$$={id_app:$condition$$.id_app,ngay_ct:{$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay}};$condition$$.ma_dvcs&&($query_req$$.ma_dvcs=$condition$$.ma_dvcs);$condition$$.ma_thue&&($query_req$$.ma_thue=
|
|
3
|
+
$condition$$.ma_thue);let $sort$$="ngay_hd";$condition$$.sort&&($sort$$=$condition$$.sort);vatvao.find($query_req$$).lean().then(function($rows$$){$rows$$.forEach($r$$=>{$r$$.t_tien=$r$$.t_tien_nt*($r$$.ty_gia||1);$r$$.t_thue=$r$$.t_thue_nt*($r$$.ty_gia||1);$r$$.t_hd=$r$$.t_tien+$r$$.t_thue;$r$$.t_hd_nt=$r$$.t_tien_nt+$r$$.t_thue_nt});dmtc.find({status:!0,id_app:$condition$$.id_app}).sort({ma_tc:1}).lean().then(function($tcs$$){async.map($tcs$$,function($tc$$,$callback$$){let $vat_tc1$$=underscore.filter($rows$$,
|
|
4
|
+
function($r$$){return $r$$.ma_tc==$tc$$.ma_tc});$vat_tc1$$=underscore.sortBy($vat_tc1$$,function($v$$){return $v$$[$sort$$]});for(var $stt_t_tien_nt$$=0;$stt_t_tien_nt$$<$vat_tc1$$.length;$stt_t_tien_nt$$++)$vat_tc1$$[$stt_t_tien_nt$$].sysorder=5,$vat_tc1$$[$stt_t_tien_nt$$].bold=!1,$vat_tc1$$[$stt_t_tien_nt$$].stt=$stt_t_tien_nt$$+1;$vat_tc1$$.length===0&&$vat_tc1$$.push({ma_tc:$tc$$.ma_tc,stt:1,sysorder:5,t_tien_nt:0,t_tien:0,t_thue_nt:0,t_thue:0});$vat_tc1$$.push({ma_tc:$tc$$.ma_tc,stt:$tc$$.ma_tc.toString()+
|
|
5
|
+
". "+$tc$$.ten_tc,sysorder:1,bold:!0});$stt_t_tien_nt$$=$vat_tc1$$.csum("t_tien_nt");const $t_tien$$=$vat_tc1$$.csum("t_tien"),$t_thue_nt$$=$vat_tc1$$.csum("t_thue_nt"),$t_thue$$=$vat_tc1$$.csum("t_thue");$vat_tc1$$.push({ma_tc:$tc$$.ma_tc,stt:"T\u1ed5ng c\u1ed9ng",sysorder:7,bold:!0,t_tien_nt:$stt_t_tien_nt$$,t_tien:$t_tien$$,t_thue_nt:$t_thue_nt$$,t_thue:$t_thue$$,t_hd:$t_tien$$+$t_thue$$,t_hd_nt:$stt_t_tien_nt$$+$t_thue_nt$$});$callback$$(null,$vat_tc1$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);
|
|
6
|
+
let $report$$=[];$rs$$.forEach(function($rows$$){$rows$$.forEach(function($r$$){$report$$.push($r$$)})});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.ma_tc+$r$$.sysorder.toString()+"0000000000000000".substring(0,16-$r$$.stt.toString().length)+$r$$.stt.toString()});$callback$$(null,$report$$)})}).catch($error$$=>{$callback$$($error$$)})}).catch($e$$=>{$callback$$($e$$)})},{onExport:function($app$$,$next$$){$app$$.nam=$app$$.tu_ngay.getFullYear();$app$$.thang=$app$$.tu_ngay.getMonth()+
|
|
7
|
+
1;$app$$.tong_tien_nt=0;$app$$.tong_thue_nt=0;$app$$.tong_tien=0;$app$$.tong_thue=0;$app$$.detail.forEach(function($r$$){$r$$.t_tien_nt&&$r$$.sysorder==5&&($app$$.tong_tien_nt+=$r$$.t_tien_nt,$app$$.tong_tien+=$r$$.t_tien);$r$$.t_thue_nt&&$r$$.sysorder==5&&($app$$.tong_thue_nt+=$r$$.t_thue_nt,$app$$.tong_thue+=$r$$.t_thue)});$next$$()}})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),{createSocaiTC,createSokhoTC}=require("../../libs/utils"),_Notification=global.getModel("notification"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"capnhatsocaitc",async function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y c\u1ea7n c\u00e1c tham s\u1ed1 sau:tu_ngay,den_ngay");const $email$$=$req$$.user.email;try{let $sc$$=await createSocaiTC($condition$$.id_app,$condition$$.tu_ngay,$condition$$.den_ngay),$sk$$=await createSokhoTC($condition$$.id_app,$condition$$.tu_ngay,$condition$$.den_ngay),
|
|
3
|
+
$message$$=`Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 c\u1eadp nh\u1eadt s\u1ed5 s\u00e1ch t\u1eeb ng\u00e0y ${moment($condition$$.tu_ngay).format("DD/MM/YYYY")} \u0111\u1ebfn ng\u00e0y ${moment($condition$$.den_ngay).format("DD/MM/YYYY")}`;_Notification.createNotification($email$$,$email$$,$message$$,$message$$,null,{id_app:$condition$$.id_app},!0,$req$$.access_token,!0);$callback$$(null,{sc:$sc$$,sk:$sk$$})}catch($error$$){_Notification.createNotification($email$$,$email$$,$error$$.message||$error$$,
|
|
4
|
+
$error$$.message||$error$$,null,{id_app:$condition$$.id_app},!0,$req$$.access_token,!0),$callback$$({error:$error$$.message||$error$$.error||$error$$})}},{cache:!1,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,4 @@
|
|
|
1
|
+
const cdpsdiem=require("../../libs/cdpsdiem"),User=global.getModel("user"),Customer=global.getModel("customer"),controller=require("../../controllers/controllerRPT"),async=require("async");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cdpsdiem",function($req$$,$callback$$){let $query$$=$req$$.query,$id_app$$=$req$$.query.id_app;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");cdpsdiem($query$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);async.series({email:$callback$$=>{$report$$.joinModel2(null,User,{where:{email:"email"},fields:"name"},()=>{$callback$$()})},
|
|
3
|
+
kh:$callback$$=>{$report$$.joinModel2($id_app$$,Customer,{where:{email:"of_user"},fields:["ten_kh","ma_kh"]},()=>{$callback$$()})}},()=>{$report$$.forEach($r$$=>{$r$$.name||$r$$.email.toLowerCase()!==$id_app$$.toLowerCase()||($r$$.name="C\u00f4ng ty")});let $total$$={email:"",name:"T\u1ed5ng c\u1ed9ng",ton_dau:$report$$.csum("ton_dau"),sl_nhap:$report$$.csum("sl_nhap"),sl_xuat:$report$$.csum("sl_xuat"),ton_cuoi:$report$$.csum("ton_cuoi"),systotal:1,bold:!0};$report$$.push($total$$);$callback$$(null,
|
|
4
|
+
$report$$)})})},{stream:!1})};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const cdpsdt=require("../../libs/cdpsdt"),permission=require("../../libs/permission"),dmdt=global.getModel("dmdt"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),{getCodeChildren}=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cdpsdt",async function($req$$,$callback$$){const $query$$=$req$$.query;if(!$query$$.tk||!$query$$.tu_ngay||!$query$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1 tk, tu_ngay,den_ngay");const $id_app$$=$query$$.id_app;if($req$$.user.current_app_info.appAdmin)$query$$.ma_dt&&($query$$.ma_dt={$in:await getCodeChildren(dmdt,$query$$.id_app,$query$$.ma_dt,"ma_dt","ma_dt_me")});else{let $ma_dts$$=
|
|
3
|
+
await new Promise($resolve$$=>{permission.getRightByItem($req$$.user.current_id_app,global.getModel("dmdt"),$req$$.user.email,async function($e_khs$$,$_condition$$,$admin$$){if($admin$$)return $resolve$$(null);$_condition$$.id_app=$query$$.id_app;$query$$.ma_dt&&($_condition$$.ma_dt={$in:await getCodeChildren(dmdt,$query$$.id_app,$query$$.ma_dt,"ma_dt","ma_dt_me")});$query$$.nh_kh&&($_condition$$.nh_kh=$query$$.nh_kh);$query$$.phu_trach&&($_condition$$.phu_trach=$query$$.phu_trach);$e_khs$$=await global.getModel("dmdt").find($_condition$$,
|
|
4
|
+
{ma_dt:1}).lean();$resolve$$($e_khs$$.map($k$$=>$k$$.ma_dt))})});$query$$.ma_dt={$in:$ma_dts$$};delete $query$$.nh_kh;delete $query$$.phu_trach}cdpsdt($query$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$.joinModel2($id_app$$,dmdt,[{where:"ma_dt",fields:["ten_dt"]}],function($report$$){$report$$.forEach(function($r$$){$r$$.ma_dt||($r$$.ma_dt=void 0)});$report$$.push({ma_dt:"",ten_dt:"T\u1ed5ng c\u1ed9ng",dk_no:$report$$.csum("dk_no"),dk_co:$report$$.csum("dk_co"),
|
|
5
|
+
ps_no:$report$$.csum("ps_no"),ps_co:$report$$.csum("ps_co"),ck_no:$report$$.csum("ck_no"),ck_co:$report$$.csum("ck_co"),dk_no_nt:$report$$.csum("dk_no_nt"),dk_co_nt:$report$$.csum("dk_co_nt"),ps_no_nt:$report$$.csum("ps_no_nt"),ps_co_nt:$report$$.csum("ps_co_nt"),ck_no_nt:$report$$.csum("ck_no_nt"),ck_co_nt:$report$$.csum("ck_co_nt"),systotal:1,bold:!0});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.ma_dt});$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const cdpskh=require("../../libs/cdpskh"),permission=require("../../libs/permission"),Customer=global.getModel("customer"),dmkho=global.getModel("dmkho"),dmbp=global.getModel("dmbp"),dmnv=global.getModel("dmnv"),contract=global.getModel("contract"),dmdt=global.getModel("dmdt"),dmphi=global.getModel("dmphi"),underscore=require("underscore"),async=require("async"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cdpskh",async function($req$$,$callback$$){const $query$$=$req$$.query;if(!$query$$.tk||!$query$$.tu_ngay||!$query$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1 tk, tu_ngay,den_ngay");var $groupBy_ma_khs$$=$query$$.groupBy||$query$$.groupby||$query$$.group_by;if($groupBy_ma_khs$$&&!underscore.isArray($groupBy_ma_khs$$)&&$groupBy_ma_khs$$.toString().indexOf("[")>=0)try{$groupBy_ma_khs$$=
|
|
3
|
+
JSON.parse($groupBy_ma_khs$$)}catch($e$$){Logger.error("cdpskh",$e$$.message,$groupBy_ma_khs$$)}$query$$.groupBy=$groupBy_ma_khs$$||["tk","ma_kh"];const $id_app$$=$query$$.id_app;$req$$.user.current_app_info.appAdmin||($groupBy_ma_khs$$=await new Promise($resolve$$=>{permission.getRightByItem($req$$.user.current_id_app,global.getModel("customer"),$req$$.user.email,async function($e$$,$_condition$$,$admin$$){if($admin$$)return $resolve$$(null);$_condition$$.id_app=$query$$.id_app;$query$$.ma_kh&&($_condition$$.ma_kh=
|
|
4
|
+
$query$$.ma_kh);$query$$.nh_kh&&($_condition$$.nh_kh=$query$$.nh_kh);$query$$.phu_trach&&($_condition$$.phu_trach=$query$$.phu_trach);$e$$=await global.getModel("customer").find($_condition$$,{ma_kh:1}).lean();$resolve$$($e$$.map($k$$=>$k$$.ma_kh))})}),$query$$.ma_kh={$in:$groupBy_ma_khs$$},delete $query$$.nh_kh,delete $query$$.phu_trach);cdpskh($query$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);async.parallel({cust:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_kh).joinModel2($id_app$$,
|
|
5
|
+
Customer,{where:"ma_kh",fields:["ten_kh","dia_chi","dien_thoai","email","so_ngay_duoc_no"]},()=>{$callback$$()})},kho:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_kho).joinModel2($id_app$$,dmkho,{where:"ma_kho",fields:"ten_kho"},()=>{$callback$$()})},bp:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_bp).joinModel2($id_app$$,dmbp,{where:"ma_bp",fields:"ten_bp"},()=>{$callback$$()})},nv:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_nv).joinModel2($id_app$$,dmnv,{where:"ma_nv",fields:"ten_nv"},()=>{$callback$$()})},
|
|
6
|
+
dmdt:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_dt).joinModel2($id_app$$,dmdt,{where:"ma_dt",fields:"ten_dt"},()=>{$callback$$()})},dmphi:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_phi).joinModel2($id_app$$,dmphi,{where:"ma_phi",fields:"ten_phi"},()=>{$callback$$()})},contract:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_hd).joinModel2($id_app$$,contract,{where:{ma_hd:"so_hd"},fields:"ten_hd"},()=>{$callback$$()})}},()=>{$report$$=underscore.sortBy($report$$,function($r$$){return($r$$.ma_kh||
|
|
7
|
+
"")+($r$$.ma_kho||"")+($r$$.ma_bp||"")+($r$$.ma_nv||"")+($r$$.ma_dt||"")+($r$$.ma_hd||"")});$report$$.push({ten_kh:"T\u1ed5ng c\u1ed9ng",dk_no:$report$$.csum("dk_no"),dk_co:$report$$.csum("dk_co"),ps_no:$report$$.csum("ps_no"),ps_co:$report$$.csum("ps_co"),ck_no:$report$$.csum("ck_no"),ck_co:$report$$.csum("ck_co"),dk_no_nt:$report$$.csum("dk_no_nt"),dk_co_nt:$report$$.csum("dk_co_nt"),ps_no_nt:$report$$.csum("ps_no_nt"),ps_co_nt:$report$$.csum("ps_co_nt"),ck_no_nt:$report$$.csum("ck_no_nt"),ck_co_nt:$report$$.csum("ck_co_nt"),
|
|
8
|
+
systotal:1,bold:!0});$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const cdpsnphep=require("../../libs/cdpsnphep"),User=global.getModel("user"),controller=require("../../controllers/controllerRPT"),async=require("async");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cdpsnphep",function($query_req$$,$callback$$){$query_req$$=$query_req$$.query;if(!$query_req$$.tu_ngay||!$query_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: tu_ngay,den_ngay");cdpsnphep($query_req$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);async.series({email:$callback$$=>{$report$$.joinModel2(null,User,{where:{email:"email"},fields:"name"},()=>{$callback$$()})}},
|
|
3
|
+
()=>{let $total$$={email:"",name:"T\u1ed5ng c\u1ed9ng",ton_dau:$report$$.csum("ton_dau"),so_ngay_phep:$report$$.csum("so_ngay_phep"),so_ngay_nghi:$report$$.csum("so_ngay_nghi"),ton_cuoi:$report$$.csum("ton_cuoi"),systotal:1,bold:!0};$report$$.push($total$$);$callback$$(null,$report$$)})})},{stream:!1})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const cdpstk=require("../../libs/cdpstk"),Account=global.getModel("account"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cdpstk",function($query_req$$,$callback$$){$query_req$$=$query_req$$.query;if(!$query_req$$.tu_ngay||!$query_req$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1 tu_ngay,den_ngay");const $id_app$$=$query_req$$.id_app;cdpstk($query_req$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$.joinModel2($id_app$$,Account,[{where:"tk",fields:["ten_tk","ten_tk2"]}],function($report$$){$report$$.push({tk:"T\u1ed5ng c\u1ed9ng",
|
|
3
|
+
dk_no:$report$$.csum("dk_no",{bac_tk:1}),dk_co:$report$$.csum("dk_co",{bac_tk:1}),ps_no:$report$$.csum("ps_no",{bac_tk:1}),ps_co:$report$$.csum("ps_co",{bac_tk:1}),ck_no:$report$$.csum("ck_no",{bac_tk:1}),ck_co:$report$$.csum("ck_co",{bac_tk:1}),dk_no_nt:$report$$.csum("dk_no_nt",{bac_tk:1}),dk_co_nt:$report$$.csum("dk_co_nt",{bac_tk:1}),ps_no_nt:$report$$.csum("ps_no_nt",{bac_tk:1}),ps_co_nt:$report$$.csum("ps_co_nt",{bac_tk:1}),ck_no_nt:$report$$.csum("ck_no_nt",{bac_tk:1}),ck_co_nt:$report$$.csum("ck_co_nt",
|
|
4
|
+
{bac_tk:1}),systotal:1,bold:!0});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.tk});$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const tdttco=global.getModel("tdttco"),tdttco_tt=global.getModel("tdttco_tt"),Customer=global.getModel("customer"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router_rpt$$){$router_rpt$$=new controller($router_rpt$$,"chitietchitientheohoadon",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;$condition_req$$.den_ngay&&($condition_req$$.den_ngay=moment().endOf("date").toDate());var $query_tdttcos$$={id_app:$condition_req$$.id_app};$condition_req$$.id_ct?$query_tdttcos$$.id_ct=$condition_req$$.id_ct:($query_tdttcos$$.ngay_ct={$lte:$condition_req$$.den_ngay},$condition_req$$.tu_ngay&&($query_tdttcos$$.ngay_ct.$gte=
|
|
3
|
+
$condition_req$$.tu_ngay),$condition_req$$.so_ct&&($query_tdttcos$$.so_ct=$condition_req$$.so_ct),$condition_req$$.so_hd&&($query_tdttcos$$.so_hd=$condition_req$$.so_hd));$condition_req$$.ma_kh&&($query_tdttcos$$.ma_kh=$condition_req$$.ma_kh);$query_tdttcos$$=await tdttco.find($query_tdttcos$$).lean();const $invoices$$=[];for(let $i$$=0;$i$$<$query_tdttcos$$.length;$i$$++){const $invoice$$=$query_tdttcos$$[$i$$];$invoice$$.line=$i$$;$invoices$$.push($invoice$$)}let $report$$=[];await Promise.all($invoices$$.map($invoice$$=>
|
|
4
|
+
(async()=>{const $t_invoice$$={id_app:$invoice$$.id_app,sysorder:1,bold:!0,id_ct:$invoice$$.id_ct,ma_ct:$invoice$$.ma_ct,id_hd:$invoice$$.id_ct,so_ct:$invoice$$.so_ct,ngay_ct:$invoice$$.ngay_ct,so_hd:$invoice$$.so_hd,ngay_hd:$invoice$$.ngay_hd,tien_hd_nt:$invoice$$.tien_nt};$t_invoice$$.ma_nt_hd=$invoice$$.ma_nt;$t_invoice$$.ty_gia_hd=$invoice$$.ty_gia;$t_invoice$$.ma_kh=$invoice$$.ma_kh;$t_invoice$$.ma_dt=$invoice$$.ma_dt;$t_invoice$$.ma_nv=$invoice$$.ma_nv;$t_invoice$$.dien_giai=$invoice$$.dien_giai;
|
|
5
|
+
$t_invoice$$.tien_nt=0;$t_invoice$$.tien=0;$t_invoice$$.da_thanh_toan_nt=0;$t_invoice$$.con_lai_nt=0;$t_invoice$$.thanh_toan_qd=0;$t_invoice$$.tk_co=$invoice$$.tk_no;$t_invoice$$.han_tt=$invoice$$.han_tt;$t_invoice$$.han_tt&&($t_invoice$$.han_tt_den_ngay=new Date($t_invoice$$.ngay_hd||$t_invoice$$.ngay_ct),$t_invoice$$.han_tt_den_ngay.setDate($t_invoice$$.han_tt_den_ngay.getDate()+$t_invoice$$.han_tt));$t_invoice$$._id=$invoice$$._id;$t_invoice$$.tat_toan=$invoice$$.tat_toan;$report$$.push($t_invoice$$);
|
|
6
|
+
let $da_thanh_toan_nt$$=0;(await tdttco_tt.find({id_tdtt:$invoice$$._id,id_app:$invoice$$.id_app}).sort({ngay_ct:1}).lean()).forEach(function($invoice_tt$$){$da_thanh_toan_nt$$+=$invoice_tt$$.thanh_toan_qd;$invoice_tt$$.da_thanh_toan_nt=$invoice_tt$$.thanh_toan_qd;$invoice_tt$$.tien_hd_nt=0;$invoice_tt$$.con_lai_nt=0;$invoice_tt$$.sysorder=5;$invoice_tt$$.bold=!1;$report$$.push($invoice_tt$$)});$t_invoice$$.da_thanh_toan_nt=$da_thanh_toan_nt$$;$t_invoice$$.con_lai_nt=$t_invoice$$.tien_hd_nt-$t_invoice$$.da_thanh_toan_nt;
|
|
7
|
+
$t_invoice$$.con_lai_nt<=0&&($t_invoice$$.tat_toan=!0);$t_invoice$$.con_phai_tt_nt=$t_invoice$$.tat_toan?0:$t_invoice$$.con_lai_nt})()));$report$$.asyncJoinModel2($condition_req$$.id_app,Customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"id_kh",value:"_id"}]}]);await $report$$.filter($r$$=>!$r$$.listinfo_code&&$r$$.ma_ct&&$r$$.id_ct).asyncJoinModel2($condition_req$$.id_app,$item$$=>$item$$.ma_ct.toLowerCase(),{where:{id_ct:"id_ct"},fields:["listinfo_code"]});$report$$=underscore.sortBy($report$$,
|
|
8
|
+
function($r$$){return $r$$.id_hd+$r$$.sysorder});$callback$$(null,$report$$)},{cache_time:60});$router_rpt$$.createRoute("tattoan/:id_tdtt",async($req$$,$next$$)=>{const $id_tdtt$$=$req$$.params.id_tdtt;if(!global.mongoose.Types.ObjectId.isValid($id_tdtt$$))return $next$$({error:"id theo d\u00f5i thanh to\u00e1n kh\u00f4ng h\u1ee3p l\u1ec7"});if(!$req$$.user.appAdmin)return $next$$({error:"Ch\u1ec9 ng\u01b0\u1eddi qu\u1ea3n tr\u1ecb m\u1edbi c\u00f3 quy\u1ec1n th\u1ef1c hi\u1ec7n t\u00e1c v\u1ee5 n\u00e0y"});
|
|
9
|
+
try{const $hd$$=await tdttco.findOne({_id:$id_tdtt$$}).lean();if(!$hd$$)return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i"});if($hd$$.tat_toan)return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea5t to\u00e1n"});await tdttco.updateOne({_id:$id_tdtt$$},{tat_toan:!0});await global.getModel("cache").deleteMany({user:$req$$.user.email,id_app:$req$$.user.current_id_app,key:"chitietchitientheohoadon"}).catch($e$$=>{Logger.error("error delete cache data",
|
|
10
|
+
$e$$)});$next$$(null,{result:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 th\u1ef1c hi\u1ec7n xong"})}catch($e$$){$next$$({error:$e$$.message||$e$$.error||$e$$})}});$router_rpt$$.createRoute("botattoan/:id_tdtt",async($req$$,$next$$)=>{const $id_tdtt$$=$req$$.params.id_tdtt;if(!global.mongoose.Types.ObjectId.isValid($id_tdtt$$))return $next$$({error:"id theo d\u00f5i thanh to\u00e1n kh\u00f4ng h\u1ee3p l\u1ec7"});if(!$req$$.user.appAdmin)return $next$$({error:"Ch\u1ec9 ng\u01b0\u1eddi qu\u1ea3n tr\u1ecb m\u1edbi c\u00f3 quy\u1ec1n th\u1ef1c hi\u1ec7n t\u00e1c v\u1ee5 n\u00e0y"});
|
|
11
|
+
try{if(!await tdttco.findOne({_id:$id_tdtt$$}).lean())return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i"});await tdttco.updateOne({_id:$id_tdtt$$},{tat_toan:!1});await global.getModel("cache").deleteMany({user:$req$$.user.email,id_app:$req$$.user.current_id_app,key:"chitietchitientheohoadon"}).catch($e$$=>{Logger.error("error delete cache data",$e$$)});$next$$(null,{result:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 th\u1ef1c hi\u1ec7n xong"})}catch($e$$){$next$$({error:$e$$.message||
|
|
12
|
+
$e$$.error||$e$$})}})};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const async=require("async"),qts=global.getModel("qts"),qts_dieuchinh=global.getModel("qts_dieuchinh"),sotinhkh=global.getModel("sotinhkh"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"chitiettaisan",function($req$$,$callback$$){let $condition$$=$req$$.query;$condition$$.nam=$condition$$.nam?Number($condition$$.nam):(new Date).getFullYear();$condition$$.thang=$condition$$.thang?Number($condition$$.thang):(new Date).getMonth()+1;let $id_app$$=$condition$$.id_app,$ngay_cuoi_thang$$,$ngay_dau_thang$$,$toi_ky$$;$ngay_cuoi_thang$$=$condition$$.den_ngay?moment($condition$$.den_ngay).endOf("date").toDate():moment(new Date($condition$$.nam,
|
|
3
|
+
$condition$$.thang-1,15)).endOf("month").toDate();$toi_ky$$=$ngay_cuoi_thang$$.getMonth()+1;$ngay_dau_thang$$=moment(new Date($condition$$.nam,$condition$$.thang-1,15)).startOf("month").toDate();async.series({id_tss:function($callback$$){let $q_ts$$={id_app:$id_app$$};$q_ts$$.ngay_tang={$lte:$ngay_cuoi_thang$$};$q_ts$$.$or=[{ngay_giam:null}];if($condition$$.tu_ngay){let $tu_ngay$$=moment($condition$$.tu_ngay).startOf("date").toDate();$q_ts$$.ngay_tang.$gte=moment($condition$$.tu_ngay).startOf("date").toDate();
|
|
4
|
+
$q_ts$$.$or.ngay_giam={$gte:$tu_ngay$$}}else $q_ts$$.$or.ngay_giam={$gte:$ngay_dau_thang$$};$condition$$.ma_kho&&($q_ts$$.ma_kho=$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().exec(function($e$$,$rs$$){if($e$$)return $callback$$($e$$);$callback$$(null,$rs$$)})}},function($e$$,$rs$$){if($e$$)return $callback$$($e$$);const $ts$$=
|
|
5
|
+
$rs$$.id_tss,$dsts$$=$ts$$.map($r$$=>$r$$._id.toString());async.series({khauhao_nt:function($callback$$){sotinhkh.find({id_app:$id_app$$,nam:{$lte:$condition$$.nam-1},id_ts:{$in:$dsts$$}}).lean().exec(async function($e$$,$kh$$){if($e$$)return $callback$$($e$$);await $kh$$.filter($r$$=>$r$$.ma_tang_giam_ts).asyncJoinModel2($id_app$$,"dmtanggiamts",{where:"ma_tang_giam_ts",fields:{kieu_dc:"kieu"}});$kh$$.forEach($r$$=>{$r$$.kieu_dc=="2"&&($r$$.nguyen_gia=0-$r$$.nguyen_gia,$r$$.gia_tri_da_kh=0-$r$$.gia_tri_da_kh,
|
|
6
|
+
$r$$.gia_tri_con_lai=0-$r$$.gia_tri_con_lai,$r$$.gia_tri_kh_ky=0-$r$$.gia_tri_kh_ky)});$kh$$.groupBy("id_ts",["gia_tri_kh_ky"],function($e$$,$rs$$){if($e$$)return $callback$$($e$$);$rs$$||=[];$callback$$(null,$rs$$)})})},khauhao_nn:function($callback$$){sotinhkh.find({id_app:$id_app$$,nam:$condition$$.nam,thang:{$lte:$toi_ky$$},id_ts:{$in:$dsts$$}}).lean().exec(async function($e$$,$kh$$){if($e$$)return $callback$$($e$$);await $kh$$.filter($r$$=>$r$$.ma_tang_giam_ts).asyncJoinModel2($id_app$$,"dmtanggiamts",
|
|
7
|
+
{where:"ma_tang_giam_ts",fields:{kieu_dc:"kieu"}});$kh$$.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)});$kh$$.groupBy("id_ts",["gia_tri_kh_ky"],function($e$$,$rs$$){if($e$$)return $callback$$($e$$);$rs$$||=[];$callback$$(null,$rs$$)})})},nguyengia:function($callback$$){const $q$$={id_ts:{$in:$dsts$$}};$q$$.$or=[{nam:{$lt:$condition$$.nam}},{nam:$condition$$.nam,
|
|
8
|
+
ky:{$lte:$toi_ky$$}}];qts_dieuchinh.find($q$$).lean().exec(async function($e$$,$rs$$){if($e$$)return $callback$$($e$$);await $rs$$.asyncJoinModel2($id_app$$,"dmtanggiamts",{where:"ma_tang_giam_ts",fields:{kieu_dc:"kieu"}});$ts$$.forEach(function($ts$$){let $nguyen_gia_dc$$=$rs$$.filter($r$$=>$r$$.id_ts==$ts$$._id.toString()).map($r$$=>$r$$.kieu_dc=="2"?0-$r$$.nguyen_gia:$r$$.nguyen_gia).reduce(($a$$,$b$$)=>$a$$+$b$$,0),$gia_tri_da_kh_dc$$=$rs$$.filter($r$$=>$r$$.id_ts==$ts$$._id.toString()).map($r$$=>
|
|
9
|
+
$r$$.kieu_dc=="2"?0-$r$$.gia_tri_da_kh:$r$$.gia_tri_da_kh).reduce(($a$$,$b$$)=>$a$$+$b$$,0),$gia_tri_con_lai_dc$$=$rs$$.filter($r$$=>$r$$.id_ts==$ts$$._id.toString()).map($r$$=>$r$$.kieu_dc=="2"?0-$r$$.gia_tri_con_lai:$r$$.gia_tri_con_lai).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$ts$$.nguyen_gia=$ts$$.details.csum("nguyen_gia")+$nguyen_gia_dc$$;$ts$$.gia_tri_da_kh=$ts$$.details.csum("gia_tri_da_kh")+$gia_tri_da_kh_dc$$;$ts$$.gia_tri_con_lai=$ts$$.details.csum("gia_tri_con_lai")+$gia_tri_con_lai_dc$$});$callback$$(null,
|
|
10
|
+
$ts$$)})}},async function($e$$,$rs$$){if($e$$)return $callback$$($e$$);let $stt$$=1;$ts$$.forEach(function($r$$){$r$$.gia_tri_kh_nam_nay=$rs$$.khauhao_nn.csum("gia_tri_kh_ky",{id_ts:$r$$._id.toString()});$r$$.gia_tri_kh_nam_truoc=$r$$.gia_tri_da_kh+$rs$$.khauhao_nt.csum("gia_tri_kh_ky",{id_ts:$r$$._id.toString()});$r$$.gia_tri_kh_luy_ke=$r$$.gia_tri_kh_nam_nay+$r$$.gia_tri_kh_nam_truoc;$r$$.gia_tri_con_lai=$r$$.nguyen_gia-$r$$.gia_tri_kh_luy_ke;$r$$.gia_tri_kh_ky=$r$$.so_ky_kh?$r$$.nguyen_gia/$r$$.so_ky_kh:
|
|
11
|
+
0;$r$$.stt=$stt$$;$stt$$+=1});async.mapLimit($ts$$,20,($t$$,$callback$$)=>{setImmediate(async()=>{let $bpsd$$;try{$bpsd$$=await qts.bophansudung($condition$$.id_app,$t$$._id.toString(),$ngay_cuoi_thang$$)}catch($e$$){$bpsd$$=[{ma_bp:$t$$.ma_bp,so_luong:$t$$.so_luong||1}]}$bpsd$$=$bpsd$$.map($bp$$=>{let $he_so$$=$bp$$.so_luong/($t$$.so_luong||1);$bp$$={...$t$$,...$bp$$};$bp$$.nguyen_gia*=$he_so$$;$bp$$.gia_tri_kh_nam_nay*=$he_so$$;$bp$$.gia_tri_kh_nam_truoc*=$he_so$$;$bp$$.gia_tri_da_kh*=$he_so$$;
|
|
12
|
+
$bp$$.gia_tri_kh_luy_ke*=$he_so$$;$bp$$.gia_tri_con_lai*=$he_so$$;return $bp$$});$callback$$(null,$bpsd$$)})},async($e$$,$rs$$)=>{$e$$=$rs$$.reduce(($a$$,$b$$)=>$a$$.concat($b$$),[]);$condition$$.ma_bp&&($e$$=$e$$.filter($r$$=>$r$$.ma_bp.toUpperCase()==$condition$$.ma_bp.toUpperCase()));await $e$$.filter($t$$=>$t$$.ma_bp).asyncJoinModel2($condition$$.id_app,"dmbp",{where:"ma_bp",fields:"ten_bp"});await $e$$.filter($t$$=>$t$$.ma_nv).asyncJoinModel2($condition$$.id_app,"dmnv",{where:"ma_nv",fields:"ten_nv"});
|
|
13
|
+
$rs$$={bold:!0,ten_ts:"T\u1ed5ng c\u1ed9ng",nguyen_gia:$ts$$.csum("nguyen_gia"),gia_tri_kh_nam_nay:$ts$$.csum("gia_tri_kh_nam_nay"),gia_tri_kh_nam_truoc:$ts$$.csum("gia_tri_kh_nam_truoc"),gia_tri_da_kh:$ts$$.csum("gia_tri_da_kh"),gia_tri_kh_luy_ke:$ts$$.csum("gia_tri_kh_luy_ke"),gia_tri_con_lai:$ts$$.csum("gia_tri_con_lai")};$callback$$(null,$e$$.concat($rs$$))})})})})};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const tdttno=global.getModel("tdttno"),tdttno_tt=global.getModel("tdttno_tt"),Customer=global.getModel("customer"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router_rpt$$){$router_rpt$$=new controller($router_rpt$$,"chitietthutientheohoadon",async function($condition_req$$,$callback$$){$condition_req$$=$condition_req$$.query;$condition_req$$.den_ngay&&($condition_req$$.den_ngay=moment().endOf("date").toDate());var $query_tdttnos$$={id_app:$condition_req$$.id_app};$condition_req$$.id_ct?$query_tdttnos$$.id_ct=$condition_req$$.id_ct:($query_tdttnos$$.ngay_ct={$lte:$condition_req$$.den_ngay},$condition_req$$.tu_ngay&&($query_tdttnos$$.ngay_ct.$gte=
|
|
3
|
+
$condition_req$$.tu_ngay),$condition_req$$.ma_dvcs&&($query_tdttnos$$.ma_dvcs=$condition_req$$.ma_dvcs),$condition_req$$.so_ct&&($query_tdttnos$$.so_ct=$condition_req$$.so_ct),$condition_req$$.so_hd&&($query_tdttnos$$.so_hd=$condition_req$$.so_hd));$condition_req$$.ma_kh&&($query_tdttnos$$.ma_kh=$condition_req$$.ma_kh);$query_tdttnos$$=await tdttno.find($query_tdttnos$$).lean();const $invoices$$=[];for(let $i$$=0;$i$$<$query_tdttnos$$.length;$i$$++){const $invoice$$=$query_tdttnos$$[$i$$];$invoice$$.line=
|
|
4
|
+
$i$$;$invoices$$.push($invoice$$)}let $report$$=[];await Promise.all($invoices$$.map($invoice$$=>(async()=>{const $t_invoice$$={id_app:$invoice$$.id_app,sysorder:1,bold:!0,id_ct:$invoice$$.id_ct,ma_ct:$invoice$$.ma_ct,id_hd:$invoice$$.id_ct,so_ct:$invoice$$.so_ct,ngay_ct:$invoice$$.ngay_ct,so_hd:$invoice$$.so_hd,ngay_hd:$invoice$$.ngay_hd,tien_hd_nt:$invoice$$.tien_nt,listinfo_code:$invoice$$.listinfo_code};$t_invoice$$.ma_nt_hd=$invoice$$.ma_nt;$t_invoice$$.ty_gia_hd=$invoice$$.ty_gia;$t_invoice$$.ma_kh=
|
|
5
|
+
$invoice$$.ma_kh;$t_invoice$$.ma_dt=$invoice$$.ma_dt;$t_invoice$$.ma_nv=$invoice$$.ma_nv;$t_invoice$$.dien_giai=$invoice$$.dien_giai;$t_invoice$$.tien_nt=0;$t_invoice$$.tien=0;$t_invoice$$.da_thanh_toan_nt=0;$t_invoice$$.con_lai_nt=0;$t_invoice$$.thanh_toan_qd=0;$t_invoice$$.tk_co=$invoice$$.tk_no;$t_invoice$$.han_tt=$invoice$$.han_tt;$t_invoice$$.han_tt&&($t_invoice$$.han_tt_den_ngay=new Date($t_invoice$$.ngay_hd||$t_invoice$$.ngay_ct),$t_invoice$$.han_tt_den_ngay.setDate($t_invoice$$.han_tt_den_ngay.getDate()+
|
|
6
|
+
$t_invoice$$.han_tt));$t_invoice$$._id=$invoice$$._id;$t_invoice$$.tat_toan=$invoice$$.tat_toan;$report$$.push($t_invoice$$);let $da_thanh_toan_nt$$=0;(await tdttno_tt.find({id_tdtt:$invoice$$._id,id_app:$invoice$$.id_app}).sort({ngay_ct:1}).lean()).forEach(function($invoice_tt$$){$da_thanh_toan_nt$$+=$invoice_tt$$.thanh_toan_qd;$invoice_tt$$.da_thanh_toan_nt=$invoice_tt$$.thanh_toan_qd;$invoice_tt$$.tien_hd_nt=0;$invoice_tt$$.con_lai_nt=0;$invoice_tt$$.sysorder=5;$invoice_tt$$.bold=!1;$report$$.push($invoice_tt$$)});
|
|
7
|
+
$t_invoice$$.da_thanh_toan_nt=$da_thanh_toan_nt$$;$t_invoice$$.con_lai_nt=$t_invoice$$.tien_hd_nt-$t_invoice$$.da_thanh_toan_nt;$t_invoice$$.con_lai_nt<=0&&($t_invoice$$.tat_toan=!0);$t_invoice$$.con_phai_tt_nt=$t_invoice$$.tat_toan?0:$t_invoice$$.con_lai_nt})()));await $report$$.asyncJoinModel2($condition_req$$.id_app,Customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{phu_trach:"phu_trach"},{name:"id_kh",value:"_id"}]}]);await $report$$.filter($r$$=>$r$$.phu_trach).asyncJoinModel2($condition_req$$.id_app,
|
|
8
|
+
"participant",{where:{phu_trach:"email"},fields:{ten_phu_trach:"name"}});await $report$$.filter($r$$=>$r$$.ma_dt).asyncJoinModel2($condition_req$$.id_app,"dmdt",{where:{ma_dt:"ma_dt"},fields:{ten_dt:"ten_dt"}});await $report$$.filter($r$$=>$r$$.ma_nv).asyncJoinModel2($condition_req$$.id_app,"dmnv",[{where:"ma_nv",fields:[{name:"ten_nv",value:"ten_nv"}]}]);await $report$$.filter($r$$=>!$r$$.listinfo_code&&$r$$.ma_ct&&$r$$.id_ct).asyncJoinModel2($condition_req$$.id_app,$item$$=>$item$$.ma_ct.toLowerCase(),
|
|
9
|
+
{where:{id_ct:"_id"},fields:["listinfo_code"]});$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.id_hd+$r$$.sysorder});$callback$$(null,$report$$)});$router_rpt$$.createRoute("tattoan/:id_tdtt",async($req$$,$next$$)=>{const $id_tdtt$$=$req$$.params.id_tdtt;if(!global.mongoose.Types.ObjectId.isValid($id_tdtt$$))return $next$$({error:"id theo d\u00f5i thanh to\u00e1n kh\u00f4ng h\u1ee3p l\u1ec7"});if(!$req$$.user.appAdmin)return $next$$({error:"Ch\u1ec9 ng\u01b0\u1eddi qu\u1ea3n tr\u1ecb m\u1edbi c\u00f3 quy\u1ec1n th\u1ef1c hi\u1ec7n t\u00e1c v\u1ee5 n\u00e0y"});
|
|
10
|
+
try{const $hd$$=await tdttno.findOne({_id:$id_tdtt$$,id_app:$req$$.user.current_id_app}).lean();if(!$hd$$)return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i"});if($hd$$.tat_toan)return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea5t to\u00e1n"});await tdttno.updateOne({_id:$id_tdtt$$},{tat_toan:!0});await global.getModel("cache").deleteMany({user:$req$$.user.email,id_app:$req$$.user.current_id_app,key:"chitietthutientheohoadon"}).catch($e$$=>
|
|
11
|
+
{Logger.error("error delete cache data",$e$$)});$next$$(null,{result:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 th\u1ef1c hi\u1ec7n xong"})}catch($e$$){$next$$({error:$e$$.message||$e$$.error||$e$$})}});$router_rpt$$.createRoute("botattoan/:id_tdtt",async($req$$,$next$$)=>{const $id_tdtt$$=$req$$.params.id_tdtt;if(!global.mongoose.Types.ObjectId.isValid($id_tdtt$$))return $next$$({error:"id theo d\u00f5i thanh to\u00e1n kh\u00f4ng h\u1ee3p l\u1ec7"});if(!$req$$.user.appAdmin)return $next$$({error:"Ch\u1ec9 ng\u01b0\u1eddi qu\u1ea3n tr\u1ecb m\u1edbi c\u00f3 quy\u1ec1n th\u1ef1c hi\u1ec7n t\u00e1c v\u1ee5 n\u00e0y"});
|
|
12
|
+
try{if(!await tdttno.findOne({_id:$id_tdtt$$,id_app:$req$$.user.current_id_app}).lean())return $next$$({error:"Ho\u00e1 \u0111\u01a1n n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i"});await tdttno.updateOne({_id:$id_tdtt$$},{tat_toan:!1});await global.getModel("cache").deleteMany({user:$req$$.user.email,id_app:$req$$.user.current_id_app,key:"chitietthutientheohoadon"}).catch($e$$=>{Logger.error("error delete cache data",$e$$)});$next$$(null,{result:"Ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00e3 th\u1ef1c hi\u1ec7n xong"})}catch($e$$){$next$$({error:$e$$.message||
|
|
13
|
+
$e$$.error||$e$$})}})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const ckcustaccs=require("../../libs/ckcn"),Customer=global.getModel("customer"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckcn",function($req$$,$callback$$){const $condition$$=$req$$.query;$condition$$.ngay||($condition$$.ngay=new Date);ckcustaccs($condition$$,async function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.tk});await $report$$.asyncJoinModel2($condition$$.id_app,Customer,{where:"ma_kh",fields:["ten_kh","nh_kh"]});await $report$$.filter($r$$=>$r$$.nh_kh).asyncJoinModel2($condition$$.id_app,
|
|
3
|
+
"group",{where:{nh_kh:"_id"},fields:{ten_nh_kh:"group_name"}});await $report$$.filter($r$$=>$r$$.ma_kho).joinModel2($condition$$.id_app,"dmkho",{where:"ma_kho",fields:["ten_kho"]});$callback$$(null,$report$$)})})};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const ckdiem=require("../../libs/ckdiem"),User=global.getModel("user"),async=require("async"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckdiem",function($req$$,$callback$$){ckdiem($req$$.query,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.ton00);async.series([function($callback$$){$report$$.joinModel2(null,User,[{where:{email:"email"},fields:["name"]}],function($results$$){$callback$$(null,$results$$)})}],function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const ckacc=require("../../libs/cktk"),Account=global.getModel("account"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"cktk",function($bu_tru_req$$,$callback$$){const $condition$$=$bu_tru_req$$.query;($bu_tru_req$$=$condition$$.bu_tru)||($bu_tru_req$$=!1);$condition$$.ngay||($condition$$.ngay=new Date);ckacc($condition$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=underscore.sortBy($report$$,function($r$$){return $r$$.tk});$report$$.joinModel($condition$$.id_app,Account,[{akey:"tk",bkey:"tk",fields:[{name:"ten_tk",value:"ten_tk"}]}],
|
|
3
|
+
function($results$$){$callback$$(null,$results$$)})})})};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const ckvt=require("../../libs/ckvt"),getGiaBan=require("../../libs/getGiaban"),Dmvt=global.getModel("dmvt"),Dmkho=global.getModel("dmkho"),async=require("async"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckvt",async function($_queryvt_req_vts$$,$callback$$){const $condition$$=$_queryvt_req_vts$$.query;if(!$condition$$.ma_vt&&($condition$$.ma_kh||$condition$$.ma_ncc||$condition$$.ma_nvt||$condition$$.ma_nvt2||$condition$$.ma_nvt3||$condition$$.ma_nvt4)){$_queryvt_req_vts$$={id_app:$condition$$.id_app};if($condition$$.ma_ncc||$condition$$.ma_kh)$_queryvt_req_vts$$.ma_ncc=$condition$$.ma_ncc||$condition$$.ma_kh;$condition$$.ma_nvt&&$condition$$.ma_nvt.length>
|
|
3
|
+
0&&($_queryvt_req_vts$$.ma_nvt=$condition$$.ma_nvt);$condition$$.ma_nvt2&&$condition$$.ma_nvt2.length>0&&($_queryvt_req_vts$$.ma_nvt2=$condition$$.ma_nvt2);$condition$$.ma_nvt3&&$condition$$.ma_nvt3.length>0&&($_queryvt_req_vts$$.ma_nvt3=$condition$$.ma_nvt3);$condition$$.ma_nvt4&&$condition$$.ma_nvt4.length>0&&($_queryvt_req_vts$$.ma_nvt4=$condition$$.ma_nvt4);$_queryvt_req_vts$$=await Dmvt.find($_queryvt_req_vts$$,{ma_vt:1}).lean();$condition$$.ma_vt=$_queryvt_req_vts$$.map($v$$=>$v$$.ma_vt)}ckvt($condition$$,
|
|
4
|
+
function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.ton00||$r$$.du00);const $id_app$$=$condition$$.id_app;async.parallel({vt:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_vt).joinModel2($id_app$$,Dmvt,{where:"ma_vt",fields:"ten_vt tg_tk tk_vt ma_ncc ma_dvt ma_nvt ma_vt2 ma_vt3 ma_vt4".split(" "),setFields:($a$$,$b$$)=>{if($b$$.picture){let $p$$=$b$$.picture.split(".");$a$$.picture_thumb=$b$$.picture+".thumb."+$p$$[$p$$.length-1]}else $a$$.picture=
|
|
5
|
+
"/getfile/others/noimage.png",$a$$.picture_thumb="/getfile/others/noimage.png"}},()=>{$callback$$()})},kho:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_kho).joinModel2($id_app$$,Dmkho,{where:"ma_kho",fields:["ten_kho","la_kho_online"]},()=>{$callback$$()})},tt1:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_vt&&$r$$.ma_tt1).joinModel2($id_app$$,global.getModel("dmtt"),{where:$item$$=>({ma_vt:$item$$.ma_vt,ma_tt:$item$$.ma_tt1,loai_tt:"1"}),fields:{barcode1:"ma_tt2"}},()=>{$callback$$()})},tt2:$callback$$=>
|
|
6
|
+
{$report$$.filter($r$$=>$r$$.ma_vt&&$r$$.ma_tt2).joinModel2($id_app$$,global.getModel("dmtt"),{where:$item$$=>({ma_vt:$item$$.ma_vt,ma_tt:$item$$.ma_tt2,loai_tt:"2"}),fields:{barcode2:"ma_tt2"}},()=>{$callback$$()})},tt3:$callback$$=>{$report$$.filter($r$$=>$r$$.ma_vt&&$r$$.ma_tt3).joinModel2($id_app$$,global.getModel("dmtt"),{where:$item$$=>({ma_vt:$item$$.ma_vt,ma_tt:$item$$.ma_tt3,loai_tt:"3"}),fields:{barcode3:"ma_tt2"}},()=>{$callback$$()})},gb:function($callback$$){async.mapLimit($report$$,
|
|
7
|
+
20,($item$$,$callback$$)=>{const $condition_giaban$$={ma_vt:$item$$.ma_vt,id_app:$condition$$.id_app};$item$$.ma_kho&&($condition_giaban$$.ma_kho=$item$$.ma_kho);$item$$.ma_tt1&&($condition_giaban$$.ma_tt1=$item$$.ma_tt1);$item$$.ma_tt2&&($condition_giaban$$.ma_tt2=$item$$.ma_tt2);$item$$.ma_tt3&&($condition_giaban$$.ma_tt3=$item$$.ma_tt3);getGiaBan($condition_giaban$$,($e$$,$gia$$)=>{if($e$$)return Logger.error("error when get gia_ban on dmvt",$e$$,$condition_giaban$$),$callback$$();$gia$$?($item$$.gia_ban_le=
|
|
8
|
+
$gia$$.gia_ban_le||0,$item$$.doanh_thu_du_tinh=($item$$.gia_ban_le||0)*($item$$.ton00||0)):($item$$.gia_ban_le=0,$item$$.doanh_thu_du_tinh=0);$callback$$(null)})},()=>{$callback$$()})}},async function($error$$){if($error$$)return $callback$$($error$$);$error$$=$condition$$.ngay;!$error$$&&$condition$$.den_ngay&&($error$$=$condition$$.den_ngay);$error$$=moment($error$$).endOf("date").toDate();!($error$$.getTime()>=moment().endOf("date").toDate())||$condition$$.ma_kho||$condition$$.ma_lo||$condition$$.han_sd||
|
|
9
|
+
$condition$$.ma_tt1||$condition$$.ma_tt2||$condition$$.ma_tt3||$condition$$.id_ct||$condition$$.ma_dvcs||(await $report$$.filter($r$$=>$r$$.ma_vt&&$r$$.la_kho_online).asyncGroupBy(["ma_vt"],["ton00"])).forEach(async $sk$$=>{let $vt$$=await global.getModel("dmvt").findOne({id_app:$condition$$.id_app,ma_vt:$sk$$.ma_vt});$vt$$&&($vt$$.ton_kho_online_hien_tai=$sk$$.ton00,$vt$$.save($e$$=>{$e$$&&Logger.error($e$$)}))});$report$$.forEach($r$$=>{$r$$.barcode=$r$$.barcode1||$r$$.barcode2||$r$$.barcode3||
|
|
10
|
+
$r$$.ma_vt2});$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const ckvt=require("../../libs/ckvt"),Dmvt=global.getModel("dmvt"),Dmkho=global.getModel("dmkho"),async=require("async"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckvttheokho",function($req$$,$callback$$){const $condition$$=$req$$.query;$condition$$.groupBy=["ma_kho","ma_vt"];async.series([$vcallback$$=>{$callback$$(null,null,"begin");ckvt($condition$$,function($error$$,$report$$){if($error$$)return $vcallback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.ton00||$r$$.du00);Logger.info("begin join model...");$callback$$(null,null,"running");async.series([function($callback$$){$report$$.joinModel2($condition$$.id_app,
|
|
3
|
+
Dmvt,[{where:{ma_vt:"ma_vt"},fields:["ten_vt","ma_dvt","tk_vt"]}],function($results$$){$callback$$(null,$results$$)})},function($callback$$){$report$$.joinModel2($condition$$.id_app,Dmkho,[{where:{ma_kho:"ma_kho"},fields:["ten_kho"]}],function($results$$){$callback$$(null,$results$$)})}],function($error$$){if($error$$)return $vcallback$$($error$$);$callback$$(null,null,"running");Logger.info("begin pivot by stock...");$report$$.pivot(["ma_vt","ten_vt"],"ten_kho",["ton00","du00"],($e$$,$rs$$)=>{if($e$$)return $vcallback$$($e$$,
|
|
4
|
+
$rs$$);$callback$$(null,$rs$$,"data");$vcallback$$($e$$)},null,$log$$=>{Logger.info($log$$);$callback$$(null,null,"running")})})})}],$e$$=>{if($e$$)return Logger.info("Error",$e$$),$callback$$($e$$);$callback$$(null,null,"end")})},{stream:!0})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const ckvt=require("../../libs/ckvt"),Dmvt=global.getModel("dmvt"),Dmkho=global.getModel("dmkho"),Sokho=global.getModel("sokho"),async=require("async"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckvttheotg",function($req$$,$callback$$){const $condition$$=$req$$.query;ckvt($condition$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.ton00||$r$$.du00);async.parallel([function($callback$$){$report$$.joinModel2($condition$$.id_app,Dmvt,[{where:{ma_vt:"ma_vt"},fields:["ten_vt","ma_dvt","tk_vt"]}],function($results$$){$callback$$(null,$results$$)})},function($callback$$){$report$$.filter($r$$=>
|
|
3
|
+
$r$$.ma_kho).joinModel2($condition$$.id_app,Dmkho,[{where:{ma_kho:"ma_kho"},fields:["ten_kho"]}],function($results$$){$callback$$(null,$results$$)})},function($callback$$){async.mapLimit($report$$,20,async $vt$$=>{var $latest_import_query$$={ma_vt:$vt$$.ma_vt,id_app:$condition$$.id_app,ma_ct:"PN1"};$vt$$.ma_kho&&($latest_import_query$$.ma_kho=$vt$$.ma_kho);$vt$$.ma_tt1&&($latest_import_query$$.ma_tt1=$vt$$.ma_tt1);$vt$$.ma_tt2&&($latest_import_query$$.ma_tt2=$vt$$.ma_tt2);$vt$$.ma_tt3&&($latest_import_query$$.ma_tt3=
|
|
4
|
+
$vt$$.ma_tt3);$vt$$.ma_lo&&($latest_import_query$$.ma_lo=$vt$$.ma_lo);if($latest_import_query$$=await Sokho.findOne($latest_import_query$$).sort({ngay_ct:-1}).lean())$vt$$.thoi_gian_ton_kho=Math.roundBy(((new Date).getTime()-(new Date($latest_import_query$$.ngay_ct)).getTime())/864E5)},$e$$=>{$callback$$($e$$)})}],function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const ckvttt=require("../../libs/ckvttt"),Dmvt=global.getModel("dmvt"),Dmkho=global.getModel("dmkho"),async=require("async"),controller=require("../../controllers/controllerRPT");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"ckvttt",function($req$$,$callback$$){const $condition$$=$req$$.query;ckvttt($condition$$,function($error$$,$report$$){if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.ton00||$r$$.du00);async.series([function($callback$$){$report$$.joinModel2($condition$$.id_app,Dmvt,[{where:{ma_vt:"ma_vt"},fields:["ten_vt","ma_dvt","tk_vt"]}],function($results$$){$callback$$(null,$results$$)})},function($callback$$){$report$$.joinModel2($condition$$.id_app,
|
|
3
|
+
Dmkho,[{where:{ma_kho:"ma_kho"},fields:["ten_kho"]}],function($results$$){$callback$$(null,$results$$)})}],function($error$$){if($error$$)return $callback$$($error$$);$callback$$(null,$report$$)})})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const Customer=global.getModel("customer"),controller=require("../../controllers/controllerRPT"),tuoinophaithu=require("../../libs/tuoinophaithu"),{groupBy}=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congnophaithutheotuoino",function($req$$,$callback$$){const $condition$$=$req$$.query;delete $condition$$.tu_ngay;$condition$$.tat_toan={$in:[null,!1]};tuoinophaithu($condition$$,async($error$$,$report$$)=>{if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.con_lai_nt>0);$error$$=$req$$.query.groupby||$req$$.query.group_by||"ma_kh";Array.isArray($error$$)||($error$$=$error$$.split(","));let $data$$=await groupBy($report$$,
|
|
3
|
+
$error$$,["tien_hd_nt","da_thanh_toan_nt","con_lai_nt"]);$data$$.filter($d$$=>$d$$.ma_kh).joinModel2($condition$$.id_app,Customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"id_kh",value:"_id"},{name:"nh_kh",value:"nh_kh"},{name:"phu_trach",value:"phu_trach"}]}],function(){$callback$$(null,$data$$)})})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const Customer=global.getModel("customer"),controller=require("../../controllers/controllerRPT"),tuoinophaitra=require("../../libs/tuoinophaitra"),{groupBy}=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congnophaitratheotuoino",function($req$$,$callback$$){const $condition$$=$req$$.query;delete $condition$$.tu_ngay;$condition$$.tat_toan={$in:[null,!1]};let $groupby$$=$req$$.query.groupby||$req$$.query.group_by||["ma_kh"];Array.isArray($groupby$$)||($groupby$$=$groupby$$.split(","));tuoinophaitra($condition$$,async($error$$,$report$$)=>{if($error$$)return $callback$$($error$$);$report$$=$report$$.filter($r$$=>$r$$.con_lai_nt>0);let $data$$=
|
|
3
|
+
await groupBy($report$$,$groupby$$,["tien_hd_nt","da_thanh_toan_nt","con_lai_nt"]);$data$$.filter($r$$=>$r$$.ma_kh).joinModel2($condition$$.id_app,Customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"},{name:"id_kh",value:"_id"},{name:"nh_kh",value:"nh_kh"},{name:"phu_trach",value:"phu_trach"}]}],function(){$callback$$(null,$data$$)})})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),tuoinophaithu=require("../../libs/tuoinophaithu"),{groupBy}=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congnosapthu",function($req$$,$callback$$){const $condition$$=$req$$.query;delete $condition$$.tu_ngay;$condition$$.tat_toan={$in:[null,!1]};tuoinophaithu($condition$$,async($data_error$$,$con_lai_nt_report$$)=>{if($data_error$$)return $callback$$($data_error$$);$con_lai_nt_report$$=$con_lai_nt_report$$.filter($r$$=>$r$$.con_lai_nt>0);let $khoang_tgs$$=$req$$.query.khoang_tg;$khoang_tgs$$&&=$khoang_tgs$$.split(",");$khoang_tgs$$&&$khoang_tgs$$.length!=
|
|
3
|
+
0||($khoang_tgs$$=[0,5,10,15,20,25,30]);$con_lai_nt_report$$.forEach($row$$=>{let $khoang_tg$$=$khoang_tgs$$.find($tg$$=>$row$$.so_ngay_trong_han<=$tg$$);$khoang_tg$$==void 0&&($khoang_tg$$="Tr\u00ean "+$khoang_tgs$$[$khoang_tgs$$.length-1]);$row$$.khoang_tg=$khoang_tg$$.toString()});$data_error$$=await groupBy($con_lai_nt_report$$,["khoang_tg"],["con_lai_nt"]);$con_lai_nt_report$$=$con_lai_nt_report$$.map($d$$=>$d$$.con_lai_nt).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$data_error$$.push({bold:!0,khoang_tg:"T\u1ed5ng c\u1ed9ng",
|
|
4
|
+
con_lai_nt:$con_lai_nt_report$$});$callback$$(null,$data_error$$)})})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const controller=require("../../controllers/controllerRPT"),tuoinophaitra=require("../../libs/tuoinophaitra"),{groupBy}=require("../../libs/utils");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congnosaptra",function($req$$,$callback$$){const $condition$$=$req$$.query;delete $condition$$.tu_ngay;$condition$$.tat_toan={$in:[null,!1]};tuoinophaitra($condition$$,async($data_error$$,$con_lai_nt_report$$)=>{if($data_error$$)return $callback$$($data_error$$);$con_lai_nt_report$$=$con_lai_nt_report$$.filter($r$$=>$r$$.con_lai_nt>0);let $khoang_tgs$$=$req$$.query.khoang_tg;$khoang_tgs$$&&=$khoang_tgs$$.split(",");$khoang_tgs$$&&$khoang_tgs$$.length!=
|
|
3
|
+
0||($khoang_tgs$$=[0,5,10,15,20,25,30]);$con_lai_nt_report$$.forEach($row$$=>{let $khoang_tg$$=$khoang_tgs$$.find($tg$$=>$row$$.so_ngay_trong_han<=$tg$$);$khoang_tg$$==void 0&&($khoang_tg$$="Tr\u00ean "+$khoang_tgs$$[$khoang_tgs$$.length-1]);$row$$.khoang_tg=$khoang_tg$$.toString()});$data_error$$=await groupBy($con_lai_nt_report$$,["khoang_tg"],["con_lai_nt"]);$con_lai_nt_report$$=$con_lai_nt_report$$.map($d$$=>$d$$.con_lai_nt).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$data_error$$.push({bold:!0,khoang_tg:"T\u1ed5ng c\u1ed9ng",
|
|
4
|
+
con_lai_nt:$con_lai_nt_report$$});$callback$$(null,$data_error$$)})})};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const task=global.getModel("task"),dmbp=global.getModel("dmbp"),async=require("async"),underscore=require("underscore"),dmloaitask=global.getModel("dmloaitask"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congviectheobp",async($req$$,$callback$$)=>{const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition$$.id_app};$condition$$.tu_ngay=moment(new Date($condition$$.tu_ngay)).startOf("date").toDate();$condition$$.den_ngay=moment(new Date($condition$$.den_ngay)).endOf("date").toDate();
|
|
3
|
+
$query$$.start_date={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};if($condition$$.id_bp)try{let $_ch$$=await dmbp.getChilren($condition$$.id_app,$condition$$.id_bp);$_ch$$.push($condition$$.id_bp);$query$$.id_bp={$in:$_ch$$}}catch($e$$){Logger.info($e$$)}else $query$$.id_bp={$ne:""};$condition$$.phu_trach&&($query$$.phu_trach=$condition$$.phu_trach);$condition$$.id_dt&&($query$$.id_dt=$condition$$.id_dt);$condition$$.id_kh&&($query$$.id_kh=$condition$$.id_kh);$condition$$.nh_cv&&($query$$.nh_cv=
|
|
4
|
+
$condition$$.nh_cv);const $now$$=new Date;task.find($query$$).lean().exec(async function($error$$,$rs$$){if($error$$)return Logger.info($error$$,$query$$),$callback$$($error$$);await $rs$$.filter($item$$=>$item$$.ma_loai_cv).asyncJoinModel2($req$$.user.current_id_app,dmloaitask,{where:"ma_loai_cv",fields:["ten_loai_cv","he_so"]});async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_so_luong=1;$r$$.chua_thuc_hien=$r$$.progress=="0"?1:0;$r$$.dang_thuc_hien=$r$$.progress=="1"?1:0;$r$$.kiem_tra=
|
|
5
|
+
$r$$.progress=="2"?1:0;$r$$.hoan_thanh=$r$$.progress=="3"?1:0;$r$$.tam_dung=$r$$.progress=="4"?1:0;$r$$.cho=$r$$.progress=="5"?1:0;$r$$.cham_tien_do=0;$r$$.diem=0;$r$$.complete_hour=task.calcCompleteHours($r$$);$r$$.he_so=$r$$.he_so===void 0?1:$r$$.he_so;$r$$.ngay=moment($r$$.start_date).date();$r$$.thang=(new Date($r$$.start_date)).getMonth()+1;$r$$.quy=moment($r$$.start_date).quarter();$r$$.nam=(new Date($r$$.start_date)).getFullYear();$r$$.due_date&&($r$$.finished_date?$r$$.finished_date.getTime()>
|
|
6
|
+
$r$$.due_date.getTime()&&($r$$.cham_tien_do=1):$now$$.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1));$r$$.diem=($r$$.diem_du_tinh||0)*$r$$.he_so*($r$$.percent||0)/100;$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);$error$$=["id_bp"];$condition$$.groupby&&($error$$=[...(new Set([...$error$$,...$condition$$.groupby.split(",")]))]);$rs$$.groupBy($error$$,[{name:"t_so_luong",value:"t_so_luong"},{name:"chua_thuc_hien",value:"chua_thuc_hien"},{name:"dang_thuc_hien",
|
|
7
|
+
value:"dang_thuc_hien"},{name:"kiem_tra",value:"kiem_tra"},{name:"hoan_thanh",value:"hoan_thanh"},{name:"tam_dung",value:"tam_dung"},{name:"cho",value:"cho"},{name:"cham_tien_do",value:"cham_tien_do"},{name:"diem",value:"diem"},{name:"complete_hour",value:"complete_hour"}],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.id_bp});$report$$.forEach(function($r$$,$i$$){$r$$.stt=$i$$+1;$r$$.bold=!1});$report$$.joinModel2($condition$$.id_app,
|
|
8
|
+
dmbp,{where:{id_bp:"_id"},fields:["ma_bp","ten_bp"]},function(){$report$$.push({ten_bp:"T\u1ed5ng c\u1ed9ng",t_so_luong:$report$$.csum("t_so_luong"),chua_thuc_hien:$report$$.csum("chua_thuc_hien"),dang_thuc_hien:$report$$.csum("dang_thuc_hien"),kiem_tra:$report$$.csum("kiem_tra"),hoan_thanh:$report$$.csum("hoan_thanh"),tam_dung:$report$$.csum("tam_dung"),cho:$report$$.csum("cho"),cham_tien_do:$report$$.csum("cham_tien_do"),diem:$report$$.csum("diem"),complete_hour:$report$$.csum("complete_hour"),
|
|
9
|
+
bold:!0});$callback$$(null,$report$$)})})})})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const task=global.getModel("task"),dmdt=global.getModel("dmdt"),async=require("async"),underscore=require("underscore"),dmloaitask=global.getModel("dmloaitask"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congviectheodt",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition$$.id_app};$condition$$.tu_ngay=moment(new Date($condition$$.tu_ngay)).startOf("date").toDate();$condition$$.den_ngay=moment(new Date($condition$$.den_ngay)).endOf("date").toDate();
|
|
3
|
+
$query$$.start_date={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$query$$.id_dt=$condition$$.id_dt?$condition$$.id_dt:{$ne:""};$condition$$.phu_trach&&($query$$.phu_trach=$condition$$.phu_trach);$condition$$.id_bp&&($query$$.id_bp=$condition$$.id_bp);$condition$$.id_kh&&($query$$.id_kh=$condition$$.id_kh);$condition$$.nh_cv&&($query$$.nh_cv=$condition$$.nh_cv);const $now$$=new Date;task.find($query$$).lean().exec(async function($error$$,$rs$$){if($error$$)return Logger.info($error$$,$query$$),
|
|
4
|
+
$callback$$($error$$);await $rs$$.filter($item$$=>$item$$.ma_loai_cv).asyncJoinModel2($req$$.user.current_id_app,dmloaitask,{where:"ma_loai_cv",fields:["ten_loai_cv","he_so"]});async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_so_luong=1;$r$$.chua_thuc_hien=$r$$.progress=="0"?1:0;$r$$.dang_thuc_hien=$r$$.progress=="1"?1:0;$r$$.kiem_tra=$r$$.progress=="2"?1:0;$r$$.hoan_thanh=$r$$.progress=="3"?1:0;$r$$.tam_dung=$r$$.progress=="4"?1:0;$r$$.cho=$r$$.progress=="5"?1:0;$r$$.cham_tien_do=0;$r$$.diem=
|
|
5
|
+
0;$r$$.complete_hour=task.calcCompleteHours($r$$);$r$$.he_so=$r$$.he_so===void 0?1:$r$$.he_so;$r$$.ngay=moment($r$$.start_date).date();$r$$.thang=(new Date($r$$.start_date)).getMonth()+1;$r$$.quy=moment($r$$.start_date).quarter();$r$$.nam=(new Date($r$$.start_date)).getFullYear();$r$$.due_date&&($r$$.finished_date?$r$$.finished_date.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1):$now$$.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1));$r$$.diem=($r$$.diem_du_tinh||0)*$r$$.he_so*
|
|
6
|
+
($r$$.percent||0)/100;$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);$error$$=["id_dt"];$condition$$.groupby&&($error$$=[...(new Set([...$error$$,...$condition$$.groupby.split(",")]))]);$rs$$.groupBy($error$$,[{name:"t_so_luong",value:"t_so_luong"},{name:"chua_thuc_hien",value:"chua_thuc_hien"},{name:"kiem_tra",value:"kiem_tra"},{name:"dang_thuc_hien",value:"dang_thuc_hien"},{name:"hoan_thanh",value:"hoan_thanh"},{name:"tam_dung",value:"tam_dung"},{name:"cho",
|
|
7
|
+
value:"cho"},{name:"cham_tien_do",value:"cham_tien_do"},{name:"diem",value:"diem"},{name:"complete_hour",value:"complete_hour"}],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.id_dt});$report$$.forEach(function($r$$,$i$$){$r$$.stt=$i$$+1;$r$$.bold=!1});$report$$.joinModel2($condition$$.id_app,dmdt,{where:{id_dt:"_id"},fields:["ma_dt","ten_dt"]},function(){$report$$.push({ten_dt:"T\u1ed5ng c\u1ed9ng",t_so_luong:$report$$.csum("t_so_luong"),
|
|
8
|
+
chua_thuc_hien:$report$$.csum("chua_thuc_hien"),kiem_tra:$report$$.csum("kiem_tra"),dang_thuc_hien:$report$$.csum("dang_thuc_hien"),hoan_thanh:$report$$.csum("hoan_thanh"),tam_dung:$report$$.csum("tam_dung"),cho:$report$$.csum("cho"),cham_tien_do:$report$$.csum("cham_tien_do"),diem:$report$$.csum("diem"),complete_hour:$report$$.csum("complete_hour"),bold:!0});$callback$$(null,$report$$)})})})})})};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const task=global.getModel("task"),customer=global.getModel("customer"),async=require("async"),underscore=require("underscore"),dmloaitask=global.getModel("dmloaitask"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congviectheokh",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");const $query$$={id_app:$condition$$.id_app};$condition$$.tu_ngay=moment(new Date($condition$$.tu_ngay)).startOf("date").toDate();$condition$$.den_ngay=moment(new Date($condition$$.den_ngay)).endOf("date").toDate();
|
|
3
|
+
$query$$.start_date={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$query$$.id_kh=$condition$$.id_kh?$condition$$.id_kh:{$ne:""};$condition$$.phu_trach&&($query$$.phu_trach=$condition$$.phu_trach);$condition$$.id_bp&&($query$$.id_bp=$condition$$.id_bp);$condition$$.id_dt&&($query$$.id_dt=$condition$$.id_dt);$condition$$.nh_cv&&($query$$.nh_cv=$condition$$.nh_cv);const $now$$=new Date;task.find($query$$).lean().exec(async function($error$$,$rs$$){if($error$$)return Logger.info($error$$,$query$$),
|
|
4
|
+
$callback$$($error$$);await $rs$$.filter($item$$=>$item$$.ma_loai_cv).asyncJoinModel2($req$$.user.current_id_app,dmloaitask,{where:"ma_loai_cv",fields:["ten_loai_cv","he_so"]});async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_so_luong=1;$r$$.chua_thuc_hien=$r$$.progress=="0"?1:0;$r$$.dang_thuc_hien=$r$$.progress=="1"?1:0;$r$$.kiem_tra=$r$$.progress=="2"?1:0;$r$$.hoan_thanh=$r$$.progress=="3"?1:0;$r$$.tam_dung=$r$$.progress=="4"?1:0;$r$$.cho=$r$$.progress=="5"?1:0;$r$$.cham_tien_do=0;$r$$.diem=
|
|
5
|
+
0;$r$$.complete_hour=task.calcCompleteHours($r$$);$r$$.he_so=$r$$.he_so===void 0?1:$r$$.he_so;$r$$.ngay=moment($r$$.start_date).date();$r$$.thang=(new Date($r$$.start_date)).getMonth()+1;$r$$.quy=moment($r$$.start_date).quarter();$r$$.nam=(new Date($r$$.start_date)).getFullYear();$r$$.due_date&&($r$$.finished_date?$r$$.finished_date.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1):$now$$.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1));$r$$.diem=($r$$.diem_du_tinh||0)*$r$$.he_so*
|
|
6
|
+
($r$$.percent||0)/100;$callback$$(null,$r$$)},function($error$$,$rs$$){if($error$$)return $callback$$($error$$);$error$$=["id_kh"];$condition$$.groupby&&($error$$=[...(new Set([...$error$$,...$condition$$.groupby.split(",")]))]);$rs$$.groupBy($error$$,[{name:"t_so_luong",value:"t_so_luong"},{name:"chua_thuc_hien",value:"chua_thuc_hien"},{name:"dang_thuc_hien",value:"dang_thuc_hien"},{name:"kiem_tra",value:"kiem_tra"},{name:"hoan_thanh",value:"hoan_thanh"},{name:"tam_dung",value:"tam_dung"},{name:"cho",
|
|
7
|
+
value:"cho"},{name:"cham_tien_do",value:"cham_tien_do"},{name:"diem",value:"diem"},{name:"complete_hour",value:"complete_hour"}],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.id_kh});let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=$i$$;$r$$.bold=!1;$i$$++});$report$$.joinModel2($condition$$.id_app,customer,{where:{id_kh:"_id"},fields:["ma_kh","ten_kh"]},function(){$report$$.push({ten_kh:"T\u1ed5ng c\u1ed9ng",
|
|
8
|
+
t_so_luong:$report$$.csum("t_so_luong"),chua_thuc_hien:$report$$.csum("chua_thuc_hien"),dang_thuc_hien:$report$$.csum("dang_thuc_hien"),kiem_tra:$report$$.csum("kiem_tra"),hoan_thanh:$report$$.csum("hoan_thanh"),tam_dung:$report$$.csum("tam_dung"),cho:$report$$.csum("cho"),cham_tien_do:$report$$.csum("cham_tien_do"),diem:$report$$.csum("diem"),complete_hour:$report$$.csum("complete_hour"),bold:!0});$callback$$(null,$report$$)})})})})})};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const task=global.getModel("task"),Participant=global.getModel("participant"),dmloaitask=global.getModel("dmloaitask"),async=require("async"),underscore=require("underscore"),controller=require("../../controllers/controllerRPT"),moment=require("moment");
|
|
2
|
+
module.exports=function($router$$){new controller($router$$,"congviectheonv",function($req$$,$callback$$){const $condition$$=$req$$.query;if(!$condition$$.tu_ngay||!$condition$$.den_ngay)return $callback$$("B\u00e1o c\u00e1o n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1:tu_ngay,den_ngay");$condition$$.tu_ngay=moment(new Date($condition$$.tu_ngay)).startOf("date").toDate();$condition$$.den_ngay=moment(new Date($condition$$.den_ngay)).endOf("date").toDate();const $query$$={id_app:$condition$$.id_app};
|
|
3
|
+
$query$$.start_date={$gte:$condition$$.tu_ngay,$lte:$condition$$.den_ngay};$condition$$.id_bp&&($query$$.id_bp=$condition$$.id_bp);$condition$$.id_dt&&($query$$.id_dt=$condition$$.id_dt);$condition$$.id_kh&&($query$$.id_kh=$condition$$.id_kh);$condition$$.nh_cv&&($query$$.nh_cv=$condition$$.nh_cv);const $now$$=new Date;task.find($query$$).lean().exec(async function($error$$,$rs$$){if($error$$)return $callback$$($error$$);await $rs$$.filter($item$$=>$item$$.ma_loai_cv).asyncJoinModel2($req$$.user.current_id_app,
|
|
4
|
+
dmloaitask,{where:"ma_loai_cv",fields:["ten_loai_cv","he_so"]});async.mapLimit($rs$$,20,function($r$$,$callback$$){$r$$.t_so_luong=1;$r$$.chua_thuc_hien=$r$$.progress=="0"?1:0;$r$$.dang_thuc_hien=$r$$.progress=="1"?1:0;$r$$.kiem_tra=$r$$.progress=="2"?1:0;$r$$.hoan_thanh=$r$$.progress=="3"?1:0;$r$$.tam_dung=$r$$.progress=="4"?1:0;$r$$.cho=$r$$.progress=="5"?1:0;$r$$.cham_tien_do=0;$r$$.diem=0;$r$$.complete_hour=task.calcCompleteHours($r$$);$r$$.he_so=$r$$.he_so===void 0?1:$r$$.he_so;$r$$.ngay=moment($r$$.start_date).date();
|
|
5
|
+
$r$$.thang=(new Date($r$$.start_date)).getMonth()+1;$r$$.quy=moment($r$$.start_date).quarter();$r$$.nam=(new Date($r$$.start_date)).getFullYear();$r$$.due_date&&($r$$.finished_date?$r$$.finished_date.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1):$now$$.getTime()>$r$$.due_date.getTime()&&($r$$.cham_tien_do=1));$r$$.diem=($r$$.diem_du_tinh||0)*$r$$.he_so*($r$$.percent||0)/100;$callback$$(null,$r$$)},function($error$$,$_rs$$){if($error$$)return $callback$$($error$$);$_rs$$.filter($r$$=>$r$$.attends&&
|
|
6
|
+
$r$$.attends.length>0&&$r$$.chia_diem&&$r$$.he_so_chia_diem.length>0).forEach($r$$=>{const $tong_diem$$=$r$$.diem,$tong_he_so$$=$r$$.he_so_chia_diem.map($u$$=>$u$$.he_so).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$tong_he_so$$&&($r$$.diem=0,$r$$.he_so_chia_diem.forEach($u$$=>{const $diem$$=$u$$.he_so/$tong_he_so$$*$tong_diem$$;$u$$.user===$r$$.phu_trach?$r$$.diem=$diem$$:$rs$$.push({...$r$$,phu_trach:$u$$.user,diem:$diem$$})}))});$condition$$.phu_trach&&($rs$$=$rs$$.filter($r$$=>$r$$.phu_trach===$condition$$.phu_trach));
|
|
7
|
+
$error$$=["phu_trach"];$condition$$.groupby&&($error$$=[...(new Set([...$error$$,...$condition$$.groupby.split(",")]))]);$rs$$.groupBy($error$$,[{name:"t_so_luong",value:"t_so_luong"},{name:"chua_thuc_hien",value:"chua_thuc_hien"},{name:"dang_thuc_hien",value:"dang_thuc_hien"},{name:"kiem_tra",value:"kiem_tra"},{name:"hoan_thanh",value:"hoan_thanh"},{name:"tam_dung",value:"tam_dung"},{name:"cho",value:"cho"},{name:"cham_tien_do",value:"cham_tien_do"},{name:"diem",value:"diem"},{name:"complete_hour",
|
|
8
|
+
value:"complete_hour"}],function($error$$,$rs$$){if($error$$)return $callback$$($error$$);const $report$$=underscore.sortBy($rs$$,function($r$$){return $r$$.phu_trach});let $i$$=1;$report$$.forEach(function($r$$){$r$$.stt=$i$$;$r$$.bold=!1;$i$$++});$report$$.joinModel2($condition$$.id_app,Participant,{where:{phu_trach:"email"},fields:[{name:"name",value:"name"}]},function(){$report$$.push({name:"T\u1ed5ng c\u1ed9ng",t_so_luong:$report$$.csum("t_so_luong"),chua_thuc_hien:$report$$.csum("chua_thuc_hien"),
|
|
9
|
+
dang_thuc_hien:$report$$.csum("dang_thuc_hien"),kiem_tra:$report$$.csum("kiem_tra"),hoan_thanh:$report$$.csum("hoan_thanh"),tam_dung:$report$$.csum("tam_dung"),cho:$report$$.csum("cho"),cham_tien_do:$report$$.csum("cham_tien_do"),diem:$report$$.csum("diem"),complete_hour:$report$$.csum("complete_hour"),bold:!0});$callback$$(null,$report$$)})})})})})};
|