flexbiz-server 12.5.31 → 12.5.33
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
CHANGED
|
@@ -133,16 +133,18 @@ const view = async (user,self,rows,next,options)=> {
|
|
|
133
133
|
let fields ={_id:1};
|
|
134
134
|
//cần kiểm tra từng vật tư xem có vật tư nào không được post sổ không
|
|
135
135
|
if(book=="sokho" && item.details?.length>0){
|
|
136
|
-
await item.details.asyncJoinModel2(item.id_app,"dmvt",{where:"ma_vt",fields:"tg_tk"});
|
|
136
|
+
await item.details.asyncJoinModel2(item.id_app,"dmvt",{where:"ma_vt",fields:["tg_tk"]});
|
|
137
137
|
fields.ma_vt =1;
|
|
138
|
-
let exists = await global.getModel(book).
|
|
139
|
-
if(exists){
|
|
138
|
+
let exists = await global.getModel(book).find({id_ct:item._id.toString()},fields).lean();
|
|
139
|
+
if(exists.length>0){
|
|
140
140
|
let ds_vt_voucher = item.details.filter(d=>d.tg_tk).map(d=>d.ma_vt).sort((a,b)=>a-b);
|
|
141
141
|
let ds_vt_book = exists.map(d=>d.ma_vt).sort((a,b)=>a-b);
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
//Tất cả các vật tư đã post
|
|
144
|
+
if(!ds_vt_voucher.find(v=>ds_vt_book.indexOf(v)<0)){
|
|
145
|
+
item[`${book}_posted`] = true;
|
|
145
146
|
}else{
|
|
147
|
+
//console.log("[viewHandler][check posted] danh sách vật tư trong chứng từ khác trong sổ kho",ds_vt_voucher,ds_vt_book,item.so_ct)
|
|
146
148
|
item[`${book}_posted`] = false;
|
|
147
149
|
}
|
|
148
150
|
|