aggio modif

This commit is contained in:
Surya Paolo
2024-01-10 20:44:54 +01:00
parent c80b1da42d
commit ee064854a7
4 changed files with 38 additions and 12 deletions

View File

@@ -8255,9 +8255,28 @@ export const tools = {
return 0
},
getUnitsMeasure(unit: number, short: boolean) {
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
return unitrec ? (short ? unitrec.short : unitrec.label) : ''
getUnitsMeasure(unit: number, short: boolean, weight: number | undefined) {
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
let mystr = ''
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI)
}
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI)
}
mystr = unitrec ? (short ? unitrec.short : unitrec.label) : ''
return mystr
},
getWeightByUnit(unit: number, short: boolean, weight: number|undefined) {
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
return weight * 1000
}
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
return weight * 1000
}
return weight
},
getWeightTotalByOrder(order: IOrder) {