UNPKG

flexbiz-server

Version:

Flexible Server

10 lines (9 loc) 3.99 kB
const dtbanletheosp=require("../../libs/dtbanletheosp"),controller=require("../../controllers/controllerRPT"); module.exports=function($router$$){new controller($router$$,"dtbanletheosp",async function($req$$,$callback$$){const $condition$$=$req$$.query;try{let $report$$=await dtbanletheosp($condition$$);await $report$$.asyncJoinModel2($condition$$.id_app,"dmvt",{where:"ma_vt",fields:["ma_nvt","ma_nvt2","ma_nvt3","ma_nvt4"]});await $report$$.filter($r$$=>$r$$.ma_kh).asyncJoinModel2($condition$$.id_app,"customer",{where:{ma_kh:"ma_kh"},fields:["nh_kh"]});let $group_by$$=$req$$.query.group_by;$group_by$$&&(typeof $group_by$$== "string"&&($group_by$$=[$group_by$$]),$report$$=await $report$$.asyncGroupBy($group_by$$,"sl_xuat sl_nhap sl_xuat_qd sl_nhap_qd sl_xuat_qd_bc sl_nhap_qd_bc tien_hang_nt tien_hang_ct_nt tien_hang tien_hang_ct tien_cp tien_cp_nt tien_ck_nt tien_ck tien_thue tien_thue_nt tien tien_nt tt tt_nt tien_xuat_tmp tien_xuat tien_nhap loi_nhuan_tmp loi_nhuan tien_hoa_hong tien_hoa_hong_gt tien_hoa_hong_ctv tien_hoa_hong_ql t_hoa_hong".split(" ")));await $report$$.filter($r$$=>$r$$.ma_vt).asyncJoinModel2($condition$$.id_app, "dmvt",{where:"ma_vt",fields:["ten_vt","ma_nvt","ma_nvt2","ma_nvt3","ma_nvt4"]});await $report$$.filter($r$$=>$r$$.ma_nvt).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt:"_id"},fields:["ten_nvt"]});await $report$$.filter($r$$=>$r$$.ma_nvt2).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt2:"_id"},fields:[{ten_nvt2:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_nvt3).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt3:"_id"},fields:[{ten_nvt3:"ten_nvt"}]});await $report$$.filter($r$$=> $r$$.ma_nvt4).asyncJoinModel2($condition$$.id_app,"dmnvt",{where:{ma_nvt4:"_id"},fields:[{ten_nvt4:"ten_nvt"}]});await $report$$.filter($r$$=>$r$$.ma_kh).asyncJoinModel2($condition$$.id_app,"customer",{where:{ma_kh:"ma_kh"},fields:["ten_kh","nh_kh"]});await $report$$.filter($r$$=>$r$$.nh_kh).asyncJoinModel2($condition$$.id_app,"group",{where:{nh_kh:"_id"},fields:[{ten_nh_kh:"group_name"}]});await $report$$.filter($r$$=>$r$$.ma_bp).asyncJoinModel2($condition$$.id_app,"dmbp",{where:{ma_bp:"ma_bp"}, fields:[{ten_bp:"ten_bp"}]});const $tong_cong$$={[$group_by$$?$group_by$$[0]:"ten_vt"]:"T\u1ed5ng c\u1ed9ng",sl_xuat:$report$$.csum("sl_xuat",{sysorder:5}),sl_nhap:$report$$.csum("sl_nhap",{sysorder:5}),sl_xuat_qd:$report$$.csum("sl_xuat_qd",{sysorder:5}),sl_nhap_qd:$report$$.csum("sl_nhap_qd",{sysorder:5}),sl_xuat_qd_bc:$report$$.csum("sl_xuat_qd_bc",{sysorder:5}),sl_nhap_qd_bc:$report$$.csum("sl_nhap_qd_bc",{sysorder:5}),tien_hang_nt:$report$$.csum("tien_hang_nt",{sysorder:5}),tien_hang_ct_nt:$report$$.csum("tien_hang_ct_nt", {sysorder:5}),tien_hang:$report$$.csum("tien_hang",{sysorder:5}),tien_hang_ct:$report$$.csum("tien_hang_ct",{sysorder:5}),tien_cp:$report$$.csum("tien_cp",{sysorder:5}),tien_cp_nt:$report$$.csum("tien_cp_nt",{sysorder:5}),tien_ck_nt:$report$$.csum("tien_ck_nt",{sysorder:5}),tien_ck:$report$$.csum("tien_ck",{sysorder:5}),tien_thue:$report$$.csum("tien_thue",{sysorder:5}),tien_thue_nt:$report$$.csum("tien_thue_nt",{sysorder:5}),tien:$report$$.csum("tien",{sysorder:5}),tien_nt:$report$$.csum("tien_nt", {sysorder:5}),tt:$report$$.csum("tt",{sysorder:5}),tt_nt:$report$$.csum("tt_nt",{sysorder:5}),tien_xuat_tmp:$report$$.csum("tien_xuat_tmp",{sysorder:5}),tien_xuat:$report$$.csum("tien_xuat",{sysorder:5}),tien_nhap:$report$$.csum("tien_nhap",{sysorder:5}),loi_nhuan_tmp:$report$$.csum("loi_nhuan_tmp",{sysorder:5}),loi_nhuan:$report$$.csum("loi_nhuan",{sysorder:5}),tien_hoa_hong:$report$$.csum("tien_hoa_hong",{sysorder:5}),tien_hoa_hong_gt:$report$$.csum("tien_hoa_hong_gt",{sysorder:5}),tien_hoa_hong_ctv:$report$$.csum("tien_hoa_hong_ctv", {sysorder:5}),tien_hoa_hong_ql:$report$$.csum("tien_hoa_hong_ql",{sysorder:5}),t_hoa_hong:$report$$.csum("t_hoa_hong",{sysorder:5}),bold:!0};$report$$.push($tong_cong$$);$callback$$(null,$report$$)}catch($e$$){$callback$$($e$$)}})};