finished updating for US tons
This commit is contained in:
parent
9414e30cea
commit
62c2f6a63c
16 changed files with 180 additions and 211 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -11967,7 +11967,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#8281f64aa2c8db09a73f5a2eb8a1b97a63bcc653",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#932bdfbc7637f23032ac542a7d059af1e0a88401",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -446,14 +446,14 @@ export default function BinCard(props: Props) {
|
||||||
|
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||||
return (
|
return (
|
||||||
bin.grainTonnes().toLocaleString() +
|
bin.grainInventory().toLocaleString() +
|
||||||
" mT " +
|
" mT " +
|
||||||
bin.fillPercent() +
|
bin.fillPercent() +
|
||||||
"%"
|
"%"
|
||||||
);
|
);
|
||||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
|
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||||
return (
|
return (
|
||||||
bin.grainTons().toLocaleString() +
|
bin.grainInventory().toLocaleString() +
|
||||||
" t " +
|
" t " +
|
||||||
bin.fillPercent() +
|
bin.fillPercent() +
|
||||||
"%"
|
"%"
|
||||||
|
|
|
||||||
|
|
@ -239,21 +239,18 @@ export default function BinSettings(props: Props) {
|
||||||
if (!initForm.inventory.bushelsPerTonne) {
|
if (!initForm.inventory.bushelsPerTonne) {
|
||||||
initForm.inventory.bushelsPerTonne = grain.bushelsPerTonne;
|
initForm.inventory.bushelsPerTonne = grain.bushelsPerTonne;
|
||||||
}
|
}
|
||||||
if (!initForm.inventory.bushelsPerTon) {
|
|
||||||
initForm.inventory.bushelsPerTon = grain.bushelsPerTon;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
setBushelConversion(initForm.inventory.bushelsPerTonne)
|
setBushelConversion(initForm.inventory.bushelsPerTonne)
|
||||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
setBushelConversion(initForm.inventory.bushelsPerTon)
|
setBushelConversion(initForm.inventory.bushelsPerTonne * 0.907)
|
||||||
}
|
}
|
||||||
if (initForm.inventory.customGrain){
|
if (initForm.inventory.customGrain){
|
||||||
setCustomGrain(initForm.inventory.customGrain)
|
setCustomGrain(initForm.inventory.customGrain)
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne)
|
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne)
|
||||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
setBushelConversion(initForm.inventory.customGrain.bushelsPerTon)
|
setBushelConversion(initForm.inventory.customGrain.bushelsPerTonne * 0.907)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if the target temp is not set (older bins) make it the midpoint of the high and low temps assuming they are set otherwise make it 15
|
//if the target temp is not set (older bins) make it the midpoint of the high and low temps assuming they are set otherwise make it 15
|
||||||
|
|
@ -310,13 +307,13 @@ export default function BinSettings(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
weight = (gb/initForm.inventory.bushelsPerTonne).toFixed(2)
|
weight = (gb/initForm.inventory.bushelsPerTonne).toFixed(2)
|
||||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
weight = (gb/initForm.inventory.bushelsPerTon).toFixed(2)
|
weight = (gb/(initForm.inventory.bushelsPerTonne * 0.907)).toFixed(2)
|
||||||
}
|
}
|
||||||
if(initForm.inventory.customGrain){
|
if(initForm.inventory.customGrain){
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
weight = (gb/initForm.inventory.customGrain.bushelsPerTonne).toFixed(2)
|
weight = (gb/initForm.inventory.customGrain.bushelsPerTonne).toFixed(2)
|
||||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
weight = (gb/initForm.inventory.customGrain.bushelsPerTon).toFixed(2)
|
weight = (gb/(initForm.inventory.customGrain.bushelsPerTonne * 0.907)).toFixed(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -927,7 +924,6 @@ export default function BinSettings(props: Props) {
|
||||||
...form.inventory,
|
...form.inventory,
|
||||||
grainType: pond.Grain.GRAIN_CUSTOM,
|
grainType: pond.Grain.GRAIN_CUSTOM,
|
||||||
bushelsPerTonne: 0,
|
bushelsPerTonne: 0,
|
||||||
bushelsPerTon: 0
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
updateFormExtension("grainType", null);
|
updateFormExtension("grainType", null);
|
||||||
|
|
@ -1186,14 +1182,13 @@ export default function BinSettings(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
conversion = newGrainSettings.bushelsPerTonne
|
conversion = newGrainSettings.bushelsPerTonne
|
||||||
}else if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
}else if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
conversion = newGrainSettings.bushelsPerTon
|
conversion = newGrainSettings.bushelsPerTonne * 0.907
|
||||||
}
|
}
|
||||||
updateForm(
|
updateForm(
|
||||||
"inventory",
|
"inventory",
|
||||||
pond.BinInventory.create({
|
pond.BinInventory.create({
|
||||||
...form.inventory,
|
...form.inventory,
|
||||||
bushelsPerTonne: newGrainSettings.bushelsPerTonne,
|
bushelsPerTonne: newGrainSettings.bushelsPerTonne,
|
||||||
bushelsPerTon: newGrainSettings.bushelsPerTon
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
setBushelConversion(conversion)
|
setBushelConversion(conversion)
|
||||||
|
|
@ -1220,7 +1215,6 @@ export default function BinSettings(props: Props) {
|
||||||
...form.inventory,
|
...form.inventory,
|
||||||
grainType: newGrainType,
|
grainType: newGrainType,
|
||||||
bushelsPerTonne: GrainDescriber(newGrainType).bushelsPerTonne,
|
bushelsPerTonne: GrainDescriber(newGrainType).bushelsPerTonne,
|
||||||
bushelsPerTon: GrainDescriber(newGrainType).bushelsPerTon
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
let conversion = 0
|
let conversion = 0
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,8 @@ export default function BinTransactions(props: Props){
|
||||||
let tonneWeight = bushels / grainTransaction.bushelsPerTonne
|
let tonneWeight = bushels / grainTransaction.bushelsPerTonne
|
||||||
return tonneWeight + " mT"
|
return tonneWeight + " mT"
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTon > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainTransaction.bushelsPerTonne > 1){
|
||||||
let tonneWeight = bushels / grainTransaction.bushelsPerTon
|
let tonneWeight = bushels / (grainTransaction.bushelsPerTonne * 0.907)
|
||||||
return tonneWeight + " t"
|
return tonneWeight + " t"
|
||||||
}
|
}
|
||||||
return bushels + " bushels"
|
return bushels + " bushels"
|
||||||
|
|
|
||||||
|
|
@ -497,8 +497,8 @@ export default function BinVisualizer(props: Props) {
|
||||||
} else {
|
} else {
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||||
return Math.round((val / bin.bushelsPerTonne()) * 100) / 100;
|
return Math.round((val / bin.bushelsPerTonne()) * 100) / 100;
|
||||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
|
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||||
return Math.round((val / bin.bushelsPerTon()) * 100) / 100;
|
return Math.round((val / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
|
|
@ -515,7 +515,7 @@ export default function BinVisualizer(props: Props) {
|
||||||
}
|
}
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1) {
|
||||||
return "mT (" + bin.fillPercent() + "%)";
|
return "mT (" + bin.fillPercent() + "%)";
|
||||||
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
|
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||||
return "t (" + bin.fillPercent() + "%)";
|
return "t (" + bin.fillPercent() + "%)";
|
||||||
} else {
|
} else {
|
||||||
return " / " + capacity.toLocaleString() + " bu";
|
return " / " + capacity.toLocaleString() + " bu";
|
||||||
|
|
@ -1332,10 +1332,10 @@ export default function BinVisualizer(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1) {
|
||||||
diffDisplay = diffDisplay / bin.bushelsPerTon();
|
diffDisplay = diffDisplay / (bin.bushelsPerTonne()*0.907);
|
||||||
if (pendingDisplay) {
|
if (pendingDisplay) {
|
||||||
pendingDisplay = pendingDisplay / bin.bushelsPerTon();
|
pendingDisplay = pendingDisplay / (bin.bushelsPerTonne()*0.907);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1999,7 +1999,6 @@ export default function BinVisualizer(props: Props) {
|
||||||
b.settings.inventory.grainType = grainType;
|
b.settings.inventory.grainType = grainType;
|
||||||
b.settings.inventory.customTypeName = customTypeName;
|
b.settings.inventory.customTypeName = customTypeName;
|
||||||
b.settings.inventory.bushelsPerTonne = GrainDescriber(grainType).bushelsPerTonne
|
b.settings.inventory.bushelsPerTonne = GrainDescriber(grainType).bushelsPerTonne
|
||||||
b.settings.inventory.bushelsPerTon = GrainDescriber(grainType).bushelsPerTon
|
|
||||||
// b.settings.inventory.bushelsPerTonne = isNaN(parseFloat(bushPerTonne))
|
// b.settings.inventory.bushelsPerTonne = isNaN(parseFloat(bushPerTonne))
|
||||||
// ? 0
|
// ? 0
|
||||||
// : parseFloat(bushPerTonne);
|
// : parseFloat(bushPerTonne);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
cap = cap / bin.bushelsPerTonne();
|
cap = cap / bin.bushelsPerTonne();
|
||||||
}
|
}
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||||
cap = cap / bin.bushelsPerTon();
|
cap = cap / (bin.bushelsPerTonne()*0.907);
|
||||||
}
|
}
|
||||||
setCapacity(cap);
|
setCapacity(cap);
|
||||||
binAPI
|
binAPI
|
||||||
|
|
@ -92,8 +92,8 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
|
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||||
}
|
}
|
||||||
let newData: InventoryAt = {
|
let newData: InventoryAt = {
|
||||||
timestamp: moment(hist.timestamp).valueOf(),
|
timestamp: moment(hist.timestamp).valueOf(),
|
||||||
|
|
@ -124,8 +124,8 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
|
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||||
}
|
}
|
||||||
data.push({
|
data.push({
|
||||||
value: fertilizerBin
|
value: fertilizerBin
|
||||||
|
|
@ -160,7 +160,7 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
cap = cap / bin.bushelsPerTonne();
|
cap = cap / bin.bushelsPerTonne();
|
||||||
}
|
}
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && cap) {
|
||||||
cap = cap / bin.bushelsPerTon();
|
cap = cap / (bin.bushelsPerTonne()*0.907);
|
||||||
}
|
}
|
||||||
setCapacity(cap);
|
setCapacity(cap);
|
||||||
let autoBarData: BarData[] = [];
|
let autoBarData: BarData[] = [];
|
||||||
|
|
@ -183,8 +183,8 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTonne()) * 100) / 100;
|
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((grainDisplay / bin.bushelsPerTon()) * 100) / 100;
|
grainDisplay = Math.round((grainDisplay / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||||
}
|
}
|
||||||
autoBarData.push({
|
autoBarData.push({
|
||||||
value: grainDisplay,
|
value: grainDisplay,
|
||||||
|
|
@ -202,8 +202,8 @@ export default function BinLevelOverTime(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
grainDisplay = Math.round((bushels / bin.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTon() > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && bin.bushelsPerTonne() > 1){
|
||||||
grainDisplay = Math.round((bushels / bin.bushelsPerTon()) * 100) / 100;
|
grainDisplay = Math.round((bushels / (bin.bushelsPerTonne()*0.907)) * 100) / 100;
|
||||||
}
|
}
|
||||||
autoBarData.push({
|
autoBarData.push({
|
||||||
value: fertilizerBin
|
value: fertilizerBin
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,14 @@ export default function ContractSettings(props: Props) {
|
||||||
setContractValue(contract.settings.totalValue.toString());
|
setContractValue(contract.settings.totalValue.toString());
|
||||||
setCommodity(contract.settings.commodity);
|
setCommodity(contract.settings.commodity);
|
||||||
setContractDate(contract.settings.contractDate);
|
setContractDate(contract.settings.contractDate);
|
||||||
setConversionValue(
|
let conv = 1
|
||||||
contract.settings.conversionValue > 0 ? contract.settings.conversionValue.toString() : "1"
|
if(contract.settings.conversionValue > 1){
|
||||||
);
|
conv = contract.settings.conversionValue
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
|
conv = conv * 0.907
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setConversionValue(conv.toFixed(2));
|
||||||
setUseCustom(contract.isCustom());
|
setUseCustom(contract.isCustom());
|
||||||
}
|
}
|
||||||
}, [contract]);
|
}, [contract]);
|
||||||
|
|
@ -158,17 +163,21 @@ export default function ContractSettings(props: Props) {
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
let conVal = isNaN(parseFloat(conversionValue)) ? 1 : parseFloat(conversionValue);
|
let conVal = isNaN(parseFloat(conversionValue)) ? 1 : parseFloat(conversionValue);
|
||||||
if(contractType === pond.ContractType.CONTRACT_TYPE_GRAIN){
|
//the toStoredUnit will convert what they entered for amount and size using the conversion that they entered
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
//we will assume that both of those entries are using the same unit ie both US ton or both metric tonne
|
||||||
conVal = conVal/1.102 //convert the ton they entered to mT to be sotred in the contract
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const deliveredVal = isNaN(parseFloat(deliveredAmount))
|
const deliveredVal = isNaN(parseFloat(deliveredAmount))
|
||||||
? 0
|
? 0
|
||||||
: Math.round(Contract.toStoredUnit(parseFloat(deliveredAmount), contractType, conVal));
|
: Math.round(Contract.toStoredUnit(parseFloat(deliveredAmount), contractType, conVal));
|
||||||
const sizeVal = isNaN(parseFloat(contractSize))
|
const sizeVal = isNaN(parseFloat(contractSize))
|
||||||
? 0
|
? 0
|
||||||
: Math.round(Contract.toStoredUnit(parseFloat(contractSize), contractType, conVal));
|
: Math.round(Contract.toStoredUnit(parseFloat(contractSize), contractType, conVal));
|
||||||
|
|
||||||
|
//then after the conversion to bushels change the conversion value to metric to be stored in the contract
|
||||||
|
if(contractType === pond.ContractType.CONTRACT_TYPE_GRAIN){
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
|
conVal = conVal / 0.907 //convert the ton they entered to mT to be stored in the contracts conversion value
|
||||||
|
}
|
||||||
|
}
|
||||||
if (contract) {
|
if (contract) {
|
||||||
let settings: pond.ContractSettings = contract.settings;
|
let settings: pond.ContractSettings = contract.settings;
|
||||||
settings.commodity = commodity;
|
settings.commodity = commodity;
|
||||||
|
|
@ -215,7 +224,6 @@ export default function ContractSettings(props: Props) {
|
||||||
settings.type = contractType;
|
settings.type = contractType;
|
||||||
settings.conversionValue = conVal;
|
settings.conversionValue = conVal;
|
||||||
settings.contractDate = contractDate;
|
settings.contractDate = contractDate;
|
||||||
|
|
||||||
contractAPI
|
contractAPI
|
||||||
.addContract(name, settings, as)
|
.addContract(name, settings, as)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,17 @@ export default function ContractTransactionGraph(props: Props) {
|
||||||
if (transaction?.grainTransaction) {
|
if (transaction?.grainTransaction) {
|
||||||
value = transaction.grainTransaction.bushels;
|
value = transaction.grainTransaction.bushels;
|
||||||
if (
|
if (
|
||||||
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT &&
|
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE &&
|
||||||
transaction.grainTransaction.bushelsPerTonne > 1
|
transaction.grainTransaction.bushelsPerTonne > 1
|
||||||
) {
|
) {
|
||||||
value = value / transaction.grainTransaction.bushelsPerTonne;
|
value = value / transaction.grainTransaction.bushelsPerTonne;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON &&
|
||||||
|
transaction.grainTransaction.bushelsPerTonne > 1
|
||||||
|
) {
|
||||||
|
value = value / (transaction.grainTransaction.bushelsPerTonne * 0.907);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
d.push({
|
d.push({
|
||||||
timestamp: time.valueOf(),
|
timestamp: time.valueOf(),
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import {MenuItem, TextField } from "@mui/material"
|
||||||
import { cloneDeep } from "lodash"
|
import { cloneDeep } from "lodash"
|
||||||
import { pond } from "protobuf-ts/pond"
|
import { pond } from "protobuf-ts/pond"
|
||||||
import React, { useEffect, useRef, useState } from "react"
|
import React, { useEffect, useRef, useState } from "react"
|
||||||
|
import { getGrainUnit } from "utils"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
grainSettings?: pond.GrainSettings
|
grainSettings?: pond.GrainSettings
|
||||||
|
|
@ -18,9 +19,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
const [constantB, setConstantB] = useState("0")
|
const [constantB, setConstantB] = useState("0")
|
||||||
const [constantC, setConstantC] = useState("0")
|
const [constantC, setConstantC] = useState("0")
|
||||||
const [kgPerBushel, setKgPerBushel] = useState("0")
|
const [kgPerBushel, setKgPerBushel] = useState("0")
|
||||||
const [bushelsPerTonne, setBushelsPerTonne] = useState("0")//this is metric
|
const [bushelsConversion, setBushelConversion] = useState("0")//this is either per tonne or per US ton depending on user preferences
|
||||||
const [lbPerBushel, setLbPerBushel] = useState("0")
|
|
||||||
const [bushelsPerTon, setBushelsPerTon] = useState("0")//this is US ton
|
|
||||||
const valid = useRef(false)
|
const valid = useRef(false)
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
|
@ -32,9 +31,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
setConstantB(grainSettings.b.toString())
|
setConstantB(grainSettings.b.toString())
|
||||||
setConstantC(grainSettings.c.toString())
|
setConstantC(grainSettings.c.toString())
|
||||||
setKgPerBushel(grainSettings.kgPerBushel.toString())
|
setKgPerBushel(grainSettings.kgPerBushel.toString())
|
||||||
setBushelsPerTonne(grainSettings.bushelsPerTonne.toString())
|
setBushelConversion(grainSettings.bushelsPerTonne.toString())
|
||||||
setLbPerBushel(grainSettings.poundsPerBushel.toString())
|
|
||||||
setBushelsPerTon(grainSettings.bushelsPerTon.toString())
|
|
||||||
setNewGrainSettings(grainSettings)
|
setNewGrainSettings(grainSettings)
|
||||||
}
|
}
|
||||||
},[grainSettings])
|
},[grainSettings])
|
||||||
|
|
@ -46,18 +43,14 @@ export default function CustomGrainForm(props: Props) {
|
||||||
constB: string,
|
constB: string,
|
||||||
constC: string,
|
constC: string,
|
||||||
kgPerBushel: string,
|
kgPerBushel: string,
|
||||||
bushelsPerTonne: string,
|
bushelsPerTonne: string) => {
|
||||||
lbPerBushel: string,
|
|
||||||
bushelsPerTon: string) => {
|
|
||||||
if (name === "") return false
|
if (name === "") return false
|
||||||
if (group === "") return false
|
if (group === "") return false
|
||||||
if (isNaN(parseFloat(constA))) return false
|
if (isNaN(parseFloat(constA))) return false
|
||||||
if (isNaN(parseFloat(constB))) return false
|
if (isNaN(parseFloat(constB))) return false
|
||||||
if (isNaN(parseFloat(constC))) return false
|
if (isNaN(parseFloat(constC))) return false
|
||||||
if (isNaN(parseFloat(kgPerBushel))) return false
|
if (isNaN(parseFloat(kgPerBushel))) return false
|
||||||
if (isNaN(parseFloat(lbPerBushel))) return false
|
|
||||||
if (isNaN(parseFloat(bushelsPerTonne))) return false
|
if (isNaN(parseFloat(bushelsPerTonne))) return false
|
||||||
if (isNaN(parseFloat(bushelsPerTon))) return false
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +72,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
setName(name)
|
setName(name)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
settings.name = name
|
settings.name = name
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsConversion)
|
||||||
settingsChanged(settings)
|
settingsChanged(settings)
|
||||||
}}/>
|
}}/>
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -92,7 +85,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
setGroup(group)
|
setGroup(group)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
settings.group = group
|
settings.group = group
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsConversion)
|
||||||
settingsChanged(settings)
|
settingsChanged(settings)
|
||||||
}}/>
|
}}/>
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -106,7 +99,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
setEquation(enumVal)
|
setEquation(enumVal)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
settings.equation = enumVal
|
settings.equation = enumVal
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsConversion)
|
||||||
settingsChanged(settings)
|
settingsChanged(settings)
|
||||||
}}
|
}}
|
||||||
select>
|
select>
|
||||||
|
|
@ -136,7 +129,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let val = e.target.value
|
let val = e.target.value
|
||||||
setConstantA(val)
|
setConstantA(val)
|
||||||
valid.current = validate(name, group, val, constantB, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, val, constantB, constantC, kgPerBushel, bushelsConversion)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
if(!isNaN(parseFloat(val))){
|
if(!isNaN(parseFloat(val))){
|
||||||
settings.a = parseFloat(val)
|
settings.a = parseFloat(val)
|
||||||
|
|
@ -154,7 +147,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let val = e.target.value
|
let val = e.target.value
|
||||||
setConstantB(val)
|
setConstantB(val)
|
||||||
valid.current = validate(name, group, constantA, val, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, val, constantC, kgPerBushel, bushelsConversion)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
if(!isNaN(parseFloat(val))){
|
if(!isNaN(parseFloat(val))){
|
||||||
settings.b = parseFloat(val)
|
settings.b = parseFloat(val)
|
||||||
|
|
@ -172,7 +165,7 @@ export default function CustomGrainForm(props: Props) {
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let val = e.target.value
|
let val = e.target.value
|
||||||
setConstantC(val)
|
setConstantC(val)
|
||||||
valid.current = validate(name, group, constantA, constantB, val, kgPerBushel, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, val, kgPerBushel, bushelsConversion)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
if(!isNaN(parseFloat(val))){
|
if(!isNaN(parseFloat(val))){
|
||||||
settings.c = parseFloat(val)
|
settings.c = parseFloat(val)
|
||||||
|
|
@ -190,14 +183,10 @@ export default function CustomGrainForm(props: Props) {
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let val = e.target.value
|
let val = e.target.value
|
||||||
setKgPerBushel(val)
|
setKgPerBushel(val)
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, val, bushelsPerTonne, lbPerBushel, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, constantC, val, bushelsConversion)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
if(!isNaN(parseFloat(val))){
|
if(!isNaN(parseFloat(val))){
|
||||||
settings.kgPerBushel = parseFloat(val)
|
settings.kgPerBushel = parseFloat(val)
|
||||||
//then calculate the kilograms to pounds and update it as well
|
|
||||||
let newLb = Math.round((parseFloat(val)*2.205)*100)/100
|
|
||||||
settings.poundsPerBushel = newLb
|
|
||||||
setLbPerBushel(newLb.toString())
|
|
||||||
}
|
}
|
||||||
settingsChanged(settings)
|
settingsChanged(settings)
|
||||||
}}
|
}}
|
||||||
|
|
@ -206,66 +195,24 @@ export default function CustomGrainForm(props: Props) {
|
||||||
sx={{marginBottom: 2}}
|
sx={{marginBottom: 2}}
|
||||||
fullWidth
|
fullWidth
|
||||||
type="number"
|
type="number"
|
||||||
value={lbPerBushel}
|
value={bushelsConversion}
|
||||||
error={isNaN(parseFloat(lbPerBushel))}
|
error={isNaN(parseFloat(bushelsConversion))}
|
||||||
helperText={isNaN(parseFloat(lbPerBushel)) ? "Must be a valid number" : ""}
|
helperText={isNaN(parseFloat(bushelsConversion)) ? "Must be a valid number" : ""}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let val = e.target.value
|
let val = e.target.value
|
||||||
setLbPerBushel(val)
|
setBushelConversion(val)
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsPerTonne, val, bushelsPerTon)
|
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, val)
|
||||||
let settings = cloneDeep(newGrainSettings)
|
|
||||||
if(!isNaN(parseFloat(val))){
|
|
||||||
settings.poundsPerBushel = parseFloat(val)
|
|
||||||
//then calculate the pounds to kilograms and update it as well
|
|
||||||
let newKg = Math.round((parseFloat(val)/2.205)*100)/100
|
|
||||||
settings.kgPerBushel = newKg
|
|
||||||
setKgPerBushel(newKg.toString())
|
|
||||||
}
|
|
||||||
settingsChanged(settings)
|
|
||||||
}}
|
|
||||||
label="lb per Bushel"/>
|
|
||||||
<TextField
|
|
||||||
sx={{marginBottom: 2}}
|
|
||||||
fullWidth
|
|
||||||
type="number"
|
|
||||||
value={bushelsPerTonne}
|
|
||||||
error={isNaN(parseFloat(bushelsPerTonne))}
|
|
||||||
helperText={isNaN(parseFloat(bushelsPerTonne)) ? "Must be a valid number" : ""}
|
|
||||||
onChange={(e) => {
|
|
||||||
let val = e.target.value
|
|
||||||
setBushelsPerTonne(val)
|
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, val, lbPerBushel, bushelsPerTon)
|
|
||||||
let settings = cloneDeep(newGrainSettings)
|
let settings = cloneDeep(newGrainSettings)
|
||||||
if(!isNaN(parseFloat(val))){
|
if(!isNaN(parseFloat(val))){
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
|
settings.bushelsPerTonne = parseFloat(val)/0.907
|
||||||
|
}else{
|
||||||
settings.bushelsPerTonne = parseFloat(val)
|
settings.bushelsPerTonne = parseFloat(val)
|
||||||
let newTon = Math.round((parseFloat(val)*0.907)*100)/100
|
}
|
||||||
settings.bushelsPerTon = newTon
|
|
||||||
setBushelsPerTon(newTon.toString())
|
|
||||||
}
|
}
|
||||||
settingsChanged(settings)
|
settingsChanged(settings)
|
||||||
}}
|
}}
|
||||||
label="Bushels per Tonne"/>
|
label={"Bushels per " + (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE ? " Tonne" : "Ton")}/>
|
||||||
<TextField
|
|
||||||
sx={{marginBottom: 2}}
|
|
||||||
fullWidth
|
|
||||||
type="number"
|
|
||||||
value={bushelsPerTon}
|
|
||||||
error={isNaN(parseFloat(bushelsPerTon))}
|
|
||||||
helperText={isNaN(parseFloat(bushelsPerTon)) ? "Must be a valid number" : ""}
|
|
||||||
onChange={(e) => {
|
|
||||||
let val = e.target.value
|
|
||||||
setBushelsPerTon(val)
|
|
||||||
valid.current = validate(name, group, constantA, constantB, constantC, kgPerBushel, bushelsPerTonne, lbPerBushel, val)
|
|
||||||
let settings = cloneDeep(newGrainSettings)
|
|
||||||
if(!isNaN(parseFloat(val))){
|
|
||||||
settings.bushelsPerTon = parseFloat(val)
|
|
||||||
let newTonne = Math.round((parseFloat(val)/0.907)*100)/100
|
|
||||||
settings.bushelsPerTonne = newTonne
|
|
||||||
setBushelsPerTonne(newTonne.toString())
|
|
||||||
}
|
|
||||||
settingsChanged(settings)
|
|
||||||
}}
|
|
||||||
label="Bushels per Ton"/>
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,14 +230,8 @@ export default function GrainTransaction(props: Props) {
|
||||||
//use the sources bushel per tonne if one was selected otherwise use the destination
|
//use the sources bushel per tonne if one was selected otherwise use the destination
|
||||||
if (source) {
|
if (source) {
|
||||||
bPerTonne = source.value.bushelsPerTonne();
|
bPerTonne = source.value.bushelsPerTonne();
|
||||||
if(source.value.bushelsPerTon){
|
|
||||||
bPerTon = source.value.bushelsPerTon()
|
|
||||||
}
|
|
||||||
} else if (dest) {
|
} else if (dest) {
|
||||||
bPerTonne = dest.value.bushelsPerTonne();
|
bPerTonne = dest.value.bushelsPerTonne();
|
||||||
if(dest.value.bushelsPerTon){
|
|
||||||
bPerTon = dest.value.bushelsPerTon()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let newTransaction = pond.Transaction.create({
|
let newTransaction = pond.Transaction.create({
|
||||||
|
|
@ -247,7 +241,6 @@ export default function GrainTransaction(props: Props) {
|
||||||
bushels: finalVal,
|
bushels: finalVal,
|
||||||
message: grainMessage,
|
message: grainMessage,
|
||||||
bushelsPerTonne: bPerTonne,
|
bushelsPerTonne: bPerTonne,
|
||||||
bushelsPerTon: bPerTonne * 0.907
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
@ -542,18 +535,14 @@ export default function GrainTransaction(props: Props) {
|
||||||
grainVal = (+grainVal * selectedDestination.value.bushelsPerTonne()).toFixed(2);
|
grainVal = (+grainVal * selectedDestination.value.bushelsPerTonne()).toFixed(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE) {
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) {
|
||||||
if (!isNaN(parseFloat(e.target.value))) {
|
if (!isNaN(parseFloat(e.target.value))) {
|
||||||
if (selectedSource) {
|
if (selectedSource) {
|
||||||
if(selectedSource.value.bushelsPerTonne){
|
if(selectedSource.value.bushelsPerTonne){
|
||||||
grainVal = (+grainVal * selectedSource.value.bushelsPerTon()).toFixed(2);
|
|
||||||
}else{
|
|
||||||
grainVal = (+grainVal * (selectedSource.value.bushelsPerTonne() * 0.907)).toFixed(2);
|
grainVal = (+grainVal * (selectedSource.value.bushelsPerTonne() * 0.907)).toFixed(2);
|
||||||
}
|
}
|
||||||
} else if (selectedDestination) {
|
} else if (selectedDestination) {
|
||||||
if(selectedDestination.value.bushelsPerTonne){
|
if(selectedDestination.value.bushelsPerTonne){
|
||||||
grainVal = (+grainVal * selectedDestination.value.bushelsPerTon()).toFixed(2);
|
|
||||||
}else{
|
|
||||||
grainVal = (+grainVal * (selectedDestination.value.bushelsPerTonne() * 0.907)).toFixed(2);
|
grainVal = (+grainVal * (selectedDestination.value.bushelsPerTonne() * 0.907)).toFixed(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,14 @@ export default function GrainBagInventoryGraph(props: Props) {
|
||||||
//let time = hist.timestamp;
|
//let time = hist.timestamp;
|
||||||
let val = hist.object.grainBagSettings.currentBushels ?? 0;
|
let val = hist.object.grainBagSettings.currentBushels ?? 0;
|
||||||
if (
|
if (
|
||||||
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT &&
|
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE &&
|
||||||
grainBag.bushelsPerTonne() > 1
|
grainBag.bushelsPerTonne() > 1
|
||||||
) {
|
) {
|
||||||
val = Math.round((val / grainBag.bushelsPerTonne()) * 100) / 100;
|
val = Math.round((val / grainBag.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainBag.bushelsPerTonne() > 1){
|
||||||
|
val = Math.round((val / (grainBag.bushelsPerTonne() * 0.907)) * 100) / 100;
|
||||||
|
}
|
||||||
if (val !== lastBushels) {
|
if (val !== lastBushels) {
|
||||||
lastBushels = val;
|
lastBushels = val;
|
||||||
barData.push({
|
barData.push({
|
||||||
|
|
@ -51,13 +54,16 @@ export default function GrainBagInventoryGraph(props: Props) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (barData.length === 0) {
|
if (barData.length === 0) {
|
||||||
|
let val = grainBag.bushels()
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && grainBag.bushelsPerTonne() > 1){
|
||||||
|
val = grainBag.bushels() / grainBag.bushelsPerTonne()
|
||||||
|
}
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainBag.bushelsPerTonne() > 1){
|
||||||
|
val = grainBag.bushels() / (grainBag.bushelsPerTonne() * 0.907)
|
||||||
|
}
|
||||||
barData.push({
|
barData.push({
|
||||||
timestamp: moment.now().valueOf(),
|
timestamp: moment.now().valueOf(),
|
||||||
value:
|
value: Math.round(val*100)/100
|
||||||
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT &&
|
|
||||||
grainBag.bushelsPerTonne() > 1
|
|
||||||
? Math.round((grainBag.bushels() / grainBag.bushelsPerTonne()) * 100) / 100
|
|
||||||
: grainBag.bushels()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setData(barData);
|
setData(barData);
|
||||||
|
|
@ -71,6 +77,17 @@ export default function GrainBagInventoryGraph(props: Props) {
|
||||||
}
|
}
|
||||||
}, [grainBagAPI, grainBag, startDate, endDate, openSnack]); //eslint-disable-line react-hooks/exhaustive-deps
|
}, [grainBagAPI, grainBag, startDate, endDate, openSnack]); //eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
const maxYAxis = () => {
|
||||||
|
let val = grainBag.capacity()
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
|
val = Math.round((val / grainBag.bushelsPerTonne()) * 100) / 100;
|
||||||
|
}
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainBag.bushelsPerTonne() > 1){
|
||||||
|
val = Math.round((val / (grainBag.bushelsPerTonne() * 0.907)) * 100) / 100;
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card raised>
|
<Card raised>
|
||||||
<Box padding={2}>
|
<Box padding={2}>
|
||||||
|
|
@ -87,11 +104,7 @@ export default function GrainBagInventoryGraph(props: Props) {
|
||||||
}
|
}
|
||||||
data={data}
|
data={data}
|
||||||
yMin={0}
|
yMin={0}
|
||||||
yMax={
|
yMax={maxYAxis()}
|
||||||
getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT
|
|
||||||
? grainBag.capacity() / grainBag.bushelsPerTonne()
|
|
||||||
: grainBag.capacity()
|
|
||||||
}
|
|
||||||
customHeight={customHeight}
|
customHeight={customHeight}
|
||||||
useGradient
|
useGradient
|
||||||
labels
|
labels
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export default function GrainBagSettings(props: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [grainUpdate, setGrainUpdate] = useState(false);
|
const [grainUpdate, setGrainUpdate] = useState(false);
|
||||||
const [grainDiff, setGrainDiff] = useState(0);
|
const [grainDiff, setGrainDiff] = useState(0);
|
||||||
const [bushelsPerTonne, setBushelsPerTonne] = useState(0);
|
const [bushelConversion, setBushelConversion] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (grainBag) {
|
if (grainBag) {
|
||||||
|
|
@ -84,8 +84,10 @@ export default function GrainBagSettings(props: Props) {
|
||||||
: grainBag.settings.length
|
: grainBag.settings.length
|
||||||
);
|
);
|
||||||
let grainVal = grainBag.bushels();
|
let grainVal = grainBag.bushels();
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE) {
|
||||||
grainVal = grainBag.bushels() / grainBag.bushelsPerTonne();
|
grainVal = grainBag.bushels() / grainBag.bushelsPerTonne();
|
||||||
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) {
|
||||||
|
grainVal = grainBag.bushels() / (grainBag.bushelsPerTonne() * 0.907)
|
||||||
}
|
}
|
||||||
setGrainFill(grainVal.toFixed(2));
|
setGrainFill(grainVal.toFixed(2));
|
||||||
setBagName(grainBag.name());
|
setBagName(grainBag.name());
|
||||||
|
|
@ -117,6 +119,10 @@ export default function GrainBagSettings(props: Props) {
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
//if a bag was passed in do an update
|
//if a bag was passed in do an update
|
||||||
|
let tonneConversion = bushelConversion
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
|
tonneConversion = bushelConversion / 0.907
|
||||||
|
}
|
||||||
if (grainBag) {
|
if (grainBag) {
|
||||||
grainBag.title = bagName;
|
grainBag.title = bagName;
|
||||||
grainBag.settings.initialMoisture = initialMoisture;
|
grainBag.settings.initialMoisture = initialMoisture;
|
||||||
|
|
@ -127,7 +133,7 @@ export default function GrainBagSettings(props: Props) {
|
||||||
grainBag.settings.bushelCapacity = grainCapacity;
|
grainBag.settings.bushelCapacity = grainCapacity;
|
||||||
grainBag.settings.grainSubtype = grainSubtype;
|
grainBag.settings.grainSubtype = grainSubtype;
|
||||||
grainBag.settings.fillDate = fillDate;
|
grainBag.settings.fillDate = fillDate;
|
||||||
grainBag.settings.bushelsPerTonne = bushelsPerTonne;
|
grainBag.settings.bushelsPerTonne = tonneConversion;
|
||||||
grainBag.settings.storageType = isCustom
|
grainBag.settings.storageType = isCustom
|
||||||
? pond.BinStorage.BIN_STORAGE_UNSUPPORTED_GRAIN
|
? pond.BinStorage.BIN_STORAGE_UNSUPPORTED_GRAIN
|
||||||
: pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN;
|
: pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN;
|
||||||
|
|
@ -161,7 +167,7 @@ export default function GrainBagSettings(props: Props) {
|
||||||
settings.currentBushels = grainBushels;
|
settings.currentBushels = grainBushels;
|
||||||
settings.grainSubtype = grainSubtype;
|
settings.grainSubtype = grainSubtype;
|
||||||
settings.fillDate = fillDate;
|
settings.fillDate = fillDate;
|
||||||
settings.bushelsPerTonne = bushelsPerTonne;
|
settings.bushelsPerTonne = tonneConversion;
|
||||||
settings.storageType = isCustom
|
settings.storageType = isCustom
|
||||||
? pond.BinStorage.BIN_STORAGE_UNSUPPORTED_GRAIN
|
? pond.BinStorage.BIN_STORAGE_UNSUPPORTED_GRAIN
|
||||||
: pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN;
|
: pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN;
|
||||||
|
|
@ -206,10 +212,10 @@ export default function GrainBagSettings(props: Props) {
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label="Bushels Per Tonne"
|
label="Bushels Per Tonne"
|
||||||
value={bushelsPerTonne}
|
value={bushelConversion}
|
||||||
type="number"
|
type="number"
|
||||||
onChange={event => {
|
onChange={event => {
|
||||||
setBushelsPerTonne(+event.target.value);
|
setBushelConversion(+event.target.value);
|
||||||
}}
|
}}
|
||||||
fullWidth
|
fullWidth
|
||||||
className={classes.bottomSpacing}
|
className={classes.bottomSpacing}
|
||||||
|
|
@ -228,7 +234,7 @@ export default function GrainBagSettings(props: Props) {
|
||||||
? pond.Grain[option.value as keyof typeof pond.Grain]
|
? pond.Grain[option.value as keyof typeof pond.Grain]
|
||||||
: pond.Grain.GRAIN_INVALID;
|
: pond.Grain.GRAIN_INVALID;
|
||||||
setSupportedGrainType(newGrainType);
|
setSupportedGrainType(newGrainType);
|
||||||
setBushelsPerTonne(GrainDescriber(newGrainType).bushelsPerTonne);
|
setBushelConversion(GrainDescriber(newGrainType).bushelsPerTonne);
|
||||||
setSelectedGrainOp(option);
|
setSelectedGrainOp(option);
|
||||||
}}
|
}}
|
||||||
group
|
group
|
||||||
|
|
@ -247,6 +253,18 @@ export default function GrainBagSettings(props: Props) {
|
||||||
return invalid;
|
return invalid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const grainUnitDisplay = () => {
|
||||||
|
if(bushelConversion > 1){
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE){
|
||||||
|
return "mT"
|
||||||
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON){
|
||||||
|
return "t"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return "bu"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<GrainTransaction
|
<GrainTransaction
|
||||||
|
|
@ -390,30 +408,24 @@ export default function GrainBagSettings(props: Props) {
|
||||||
className={classes.bottomSpacing}
|
className={classes.bottomSpacing}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label={
|
label={"Current Inventory"}
|
||||||
"Current " +
|
|
||||||
(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && bushelsPerTonne > 0
|
|
||||||
? "Weight"
|
|
||||||
: "Bushels")
|
|
||||||
}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
type="number"
|
type="number"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
InputProps={{
|
InputProps={{
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
{getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && bushelsPerTonne > 0
|
{grainUnitDisplay()}
|
||||||
? "mT"
|
|
||||||
: "bu"}
|
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
value={grainFill}
|
value={grainFill}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
let bushelVal = +e.target.value;
|
let bushelVal = +e.target.value;
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE || getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) {
|
||||||
//convert the number as a weight into the bushel value
|
//convert the number as a weight into the bushel value, no changing or conversions necessary
|
||||||
bushelVal = +e.target.value * (bushelsPerTonne > 0 ? bushelsPerTonne : 1);
|
// since these are both user entered fields and should be the same unit (ton or tonne)
|
||||||
|
bushelVal = +e.target.value * (bushelConversion > 0 ? bushelConversion : 1);
|
||||||
}
|
}
|
||||||
if (bushelVal > grainCapacity) {
|
if (bushelVal > grainCapacity) {
|
||||||
bushelVal = grainCapacity;
|
bushelVal = grainCapacity;
|
||||||
|
|
|
||||||
|
|
@ -83,12 +83,19 @@ export default function GrainBagVisualizer(props: Props) {
|
||||||
const grainOverlay = () => {
|
const grainOverlay = () => {
|
||||||
let displayPending = pendingGrainAmount;
|
let displayPending = pendingGrainAmount;
|
||||||
let displayDiff = grainDiff;
|
let displayDiff = grainDiff;
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && grainBag.bushelsPerTonne() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && grainBag.bushelsPerTonne() > 1) {
|
||||||
if (displayPending && displayDiff) {
|
if (displayPending && displayDiff) {
|
||||||
displayPending = Math.round((displayPending / grainBag.bushelsPerTonne()) * 100) / 100;
|
displayPending = Math.round((displayPending / grainBag.bushelsPerTonne()) * 100) / 100;
|
||||||
displayDiff = Math.round((displayDiff / grainBag.bushelsPerTonne()) * 100) / 100;
|
displayDiff = Math.round((displayDiff / grainBag.bushelsPerTonne()) * 100) / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainBag.bushelsPerTonne() > 1) {
|
||||||
|
if (displayPending && displayDiff) {
|
||||||
|
displayPending = Math.round((displayPending / (grainBag.bushelsPerTonne() * 0.907)) * 100) / 100;
|
||||||
|
displayDiff = Math.round((displayDiff / (grainBag.bushelsPerTonne()* 0.907)) * 100) / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
{grainDiff !== undefined && grainDiff > 0 && (
|
{grainDiff !== undefined && grainDiff > 0 && (
|
||||||
|
|
@ -141,7 +148,7 @@ export default function GrainBagVisualizer(props: Props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const grainAmountDisplay = () => {
|
const grainAmountDisplay = () => {
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && grainBag.bushelsPerTonne() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && grainBag.bushelsPerTonne() > 1) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: "flex", flexDirection: "row" }}>
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||||
<Typography variant="body2" style={{ fontWeight: "bold", marginRight: "4px" }}>
|
<Typography variant="body2" style={{ fontWeight: "bold", marginRight: "4px" }}>
|
||||||
|
|
@ -150,6 +157,15 @@ export default function GrainBagVisualizer(props: Props) {
|
||||||
<Typography variant="body2">({grainBag.fillPercent()}%)</Typography>
|
<Typography variant="body2">({grainBag.fillPercent()}%)</Typography>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
} else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && grainBag.bushelsPerTonne() > 1) {
|
||||||
|
return (
|
||||||
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||||
|
<Typography variant="body2" style={{ fontWeight: "bold", marginRight: "4px" }}>
|
||||||
|
{(grainBag.bushels() / (grainBag.bushelsPerTonne()*0.907)).toFixed(2) + " t"}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2">({grainBag.fillPercent()}%)</Typography>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: "flex", flexDirection: "row" }}>
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import GrainDescriber from "grain/GrainDescriber";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { MarkerData } from "maps/mapMarkers/Markers";
|
import { MarkerData } from "maps/mapMarkers/Markers";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
|
import { getGrainUnit } from "utils";
|
||||||
import { stringToMaterialColour } from "utils/strings";
|
import { stringToMaterialColour } from "utils/strings";
|
||||||
import { or } from "utils/types";
|
import { or } from "utils/types";
|
||||||
|
|
||||||
|
|
@ -235,46 +236,14 @@ export class Bin {
|
||||||
return bpt;
|
return bpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public grainInventory(): number {
|
||||||
* returns the bushels per ton set in the bins settings, if not set will return 1
|
let grain = this.bushels()
|
||||||
* @returns 1 or bushels per tonne
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && this.bushelsPerTonne() > 1){
|
||||||
*/
|
grain = this.bushels() / this.bushelsPerTonne()
|
||||||
public bushelsPerTon(): number {
|
}else if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && this.bushelsPerTonne() > 1){
|
||||||
//trying to avoid a divide by 0 error by only returning a value greater than 0
|
grain = this.bushels() / (this.bushelsPerTonne() * 0.907)
|
||||||
//since to get the weight you divide the current bushels by the bushels per tonne
|
|
||||||
let bpt = 1;
|
|
||||||
if (this.settings.inventory) {
|
|
||||||
if (this.settings.inventory.bushelsPerTon > 0) {
|
|
||||||
bpt = this.settings.inventory.bushelsPerTon;
|
|
||||||
}
|
}
|
||||||
}
|
return Math.round(grain*100)/100
|
||||||
return bpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the weight in tonnes (metric) for the grain inventory provided the bushels per tonne is set
|
|
||||||
* if it is not set it will divide by 1 effectively returning the bushels
|
|
||||||
* @returns grain weight
|
|
||||||
*/
|
|
||||||
public grainTonnes(): number {
|
|
||||||
let weight = 0;
|
|
||||||
if (this.settings.inventory) {
|
|
||||||
weight = this.settings.inventory.grainBushels / this.bushelsPerTonne();
|
|
||||||
}
|
|
||||||
return Math.round(weight * 100) / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the weight in tons (imperial) for the grain inventory provided the bushels per ton is set
|
|
||||||
* if it is not set it will divide by 1 effectively returning the bushels
|
|
||||||
* @returns grain weight
|
|
||||||
*/
|
|
||||||
public grainTons(): number {
|
|
||||||
let weight = 0;
|
|
||||||
if (this.settings.inventory) {
|
|
||||||
weight = this.settings.inventory.grainBushels / this.bushelsPerTon();
|
|
||||||
}
|
|
||||||
return Math.round(weight * 100) / 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,13 @@ export class Contract {
|
||||||
|
|
||||||
private measurementUnit(): string {
|
private measurementUnit(): string {
|
||||||
if (this.settings.type === pond.ContractType.CONTRACT_TYPE_GRAIN) {
|
if (this.settings.type === pond.ContractType.CONTRACT_TYPE_GRAIN) {
|
||||||
return getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT ? "mT" : "bu";
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && this.conversionValue() > 1){
|
||||||
|
return "mT"
|
||||||
|
}
|
||||||
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && this.conversionValue() > 1){
|
||||||
|
return "t"
|
||||||
|
}
|
||||||
|
return "bu";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -202,9 +208,12 @@ export class Contract {
|
||||||
let size = this.settings.size;
|
let size = this.settings.size;
|
||||||
switch (this.settings.type) {
|
switch (this.settings.type) {
|
||||||
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && this.conversionValue() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && this.conversionValue() > 1) {
|
||||||
size = size / this.conversionValue();
|
size = size / this.conversionValue();
|
||||||
}
|
}
|
||||||
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && this.conversionValue() > 1){
|
||||||
|
size = size / (this.conversionValue() * 0.907); //the conversion for grain will be stored in metric tonnes, this will convert it to US tons
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Math.round(size * 100) / 100;
|
return Math.round(size * 100) / 100;
|
||||||
}
|
}
|
||||||
|
|
@ -213,26 +222,33 @@ export class Contract {
|
||||||
let del = this.settings.delivered;
|
let del = this.settings.delivered;
|
||||||
switch (this.settings.type) {
|
switch (this.settings.type) {
|
||||||
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && this.conversionValue() > 1) {
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && this.conversionValue() > 1) {
|
||||||
del = del / this.conversionValue();
|
del = del / this.conversionValue();
|
||||||
}
|
}
|
||||||
|
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && this.conversionValue() > 1){
|
||||||
|
del = del / (this.conversionValue() * 0.907); //the conversion for grain will be stored in metric tonnes, this will convert it to US tons
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Math.round(del * 100) / 100;
|
return Math.round(del * 100) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static toStoredUnit(
|
public static toStoredUnit(
|
||||||
secondaryUnitVal: number,
|
secondaryUnitVal: number,
|
||||||
contractType: pond.ContractType,
|
contractType: pond.ContractType,
|
||||||
conversionValue: number
|
conversionValue: number
|
||||||
): number {
|
): number {
|
||||||
let storedunitVal = secondaryUnitVal;
|
let storedUnitVal = secondaryUnitVal;
|
||||||
switch (contractType) {
|
switch (contractType) {
|
||||||
|
//use the value and conversion they entered directly, it is safe to assume they are both the same unit (ton vs tonne) so dont need to convert anything
|
||||||
|
//before converting to bushels
|
||||||
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
case pond.ContractType.CONTRACT_TYPE_GRAIN:
|
||||||
if (getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_WEIGHT && conversionValue > 1) {
|
if ((getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE || getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON) && conversionValue > 1) {
|
||||||
storedunitVal = secondaryUnitVal * conversionValue;
|
storedUnitVal = secondaryUnitVal * conversionValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return storedunitVal;
|
return storedUnitVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public grainName(): string {
|
public grainName(): string {
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ export default function TransactionDataDisplay(props: Props) {
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && gt.bushelsPerTonne > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TONNE && gt.bushelsPerTonne > 1){
|
||||||
return "Weight: " + Math.round(gt.bushels / gt.bushelsPerTonne*100)/100 + " mT"
|
return "Weight: " + Math.round(gt.bushels / gt.bushelsPerTonne*100)/100 + " mT"
|
||||||
}
|
}
|
||||||
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && gt.bushelsPerTon > 1){
|
if(getGrainUnit() === pond.GrainUnit.GRAIN_UNIT_TON && gt.bushelsPerTonne > 1){
|
||||||
return "Weight: " + Math.round(gt.bushels / gt.bushelsPerTon*100)/100 + " t"
|
return "Weight: " + Math.round(gt.bushels / (gt.bushelsPerTonne*0.907)*100)/100 + " t"
|
||||||
}
|
}
|
||||||
return "Bushels: " + gt.bushels
|
return "Bushels: " + gt.bushels
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue