|
@@ -131,7 +131,7 @@ class ReportMemoryMaterial {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- _completeMaterialGl(materialGl) {
|
|
|
+ _completeMaterialGl(materialGl, decimal) {
|
|
|
const tTypeStr = [], mTypeStr = [];
|
|
|
for (const t of materialConst.t_type) {
|
|
|
tTypeStr[t.value] = t.text;
|
|
@@ -140,7 +140,7 @@ class ReportMemoryMaterial {
|
|
|
mTypeStr[m.value] = m.text;
|
|
|
}
|
|
|
for (const gl of materialGl) {
|
|
|
- gl.tp = this.ctx.helper.mul(gl.quantity, gl.m_spread, 2);
|
|
|
+ gl.tp = this.ctx.helper.mul(gl.quantity, gl.m_spread, decimal.tp);
|
|
|
gl.t_type_str = tTypeStr[gl.t_type];
|
|
|
gl.m_type_str = mTypeStr[gl.m_type];
|
|
|
gl.end_tp = this.ctx.helper.add(gl.tp, gl.pre_tp);
|
|
@@ -171,9 +171,10 @@ class ReportMemoryMaterial {
|
|
|
});
|
|
|
if (materials.length === 0) return [];
|
|
|
|
|
|
- let result, material;
|
|
|
+ let result, material, decimal;
|
|
|
if (materials[0].order === material_order) {
|
|
|
material = materials[0];
|
|
|
+ decimal = material.decimal ? JSON.parse(material.decimal) : { qty: 3, up: 3, tp: 2 };
|
|
|
if (material.is_stage_self) {
|
|
|
const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type,' +
|
|
|
' msb.quantity, mb.expr,' +
|
|
@@ -195,6 +196,7 @@ class ReportMemoryMaterial {
|
|
|
material = this.ctx.helper._.find(materials, {order: material_order});
|
|
|
if (!material) return [];
|
|
|
|
|
|
+ decimal = material.decimal ? JSON.parse(material.decimal) : { tp: 2 };
|
|
|
if (material.is_stage_self) {
|
|
|
const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type,' +
|
|
|
' msb.quantity, mbh.expr,' +
|
|
@@ -221,7 +223,7 @@ class ReportMemoryMaterial {
|
|
|
result = await this.ctx.app.mysql.query(sql, [tender_id, material.id]);
|
|
|
}
|
|
|
}
|
|
|
- this._completeMaterialGl(result);
|
|
|
+ this._completeMaterialGl(result, decimal);
|
|
|
|
|
|
if (this._checkFieldsExist(fields, ['month_msg_tp', 'month'])) await this._loadMaterialMonth(material, result);
|
|
|
return result;
|