@zauru-sdk/hooks 1.0.105 → 1.0.106
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/dist/cjs/receptions.js +26 -17
- package/dist/esm/receptions.js +26 -17
- package/dist/receptions.d.ts +3 -3
- package/package.json +2 -2
package/dist/cjs/receptions.js
CHANGED
|
@@ -110,21 +110,21 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
|
|
|
110
110
|
baskets,
|
|
111
111
|
totalWeight,
|
|
112
112
|
discount,
|
|
113
|
-
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)
|
|
114
|
-
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)
|
|
115
|
-
probableUtilization
|
|
116
|
-
lbDiscounted
|
|
113
|
+
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
|
|
114
|
+
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
|
|
115
|
+
probableUtilization,
|
|
116
|
+
lbDiscounted,
|
|
117
117
|
};
|
|
118
118
|
}),
|
|
119
119
|
];
|
|
120
120
|
const totales = {
|
|
121
121
|
id: "",
|
|
122
|
-
baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))
|
|
123
|
-
totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))
|
|
122
|
+
baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
123
|
+
totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
124
124
|
discount: "-",
|
|
125
|
-
netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))
|
|
125
|
+
netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
126
126
|
weightByBasket: "-",
|
|
127
|
-
lbDiscounted: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0)),
|
|
127
|
+
lbDiscounted: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
128
128
|
probableUtilization: (0, common_1.toFixedIfNeeded)(tempPesadas
|
|
129
129
|
?.map((x) => Number(x.probableUtilization))
|
|
130
130
|
.reduce(common_1.reduceAdd, 0)),
|
|
@@ -169,7 +169,7 @@ exports.useGetPesadas = useGetPesadas;
|
|
|
169
169
|
* @param formInput
|
|
170
170
|
* @returns
|
|
171
171
|
*/
|
|
172
|
-
const getPesadasByForm = (formInput) => {
|
|
172
|
+
const getPesadasByForm = (formInput, stocks_only_integer = false) => {
|
|
173
173
|
// Inicializar array de pesadas
|
|
174
174
|
const tempPesadas = [];
|
|
175
175
|
// Iterar sobre los campos del formulario y extraer la información de pesadas
|
|
@@ -182,6 +182,7 @@ const getPesadasByForm = (formInput) => {
|
|
|
182
182
|
const basketWeight = 5;
|
|
183
183
|
let netWeight = totalWeight - baskets * basketWeight;
|
|
184
184
|
netWeight = netWeight * ((100 - discount) / 100);
|
|
185
|
+
netWeight = stocks_only_integer ? totalWeight : netWeight;
|
|
185
186
|
const weightByBasket = netWeight / baskets;
|
|
186
187
|
//Probable aprovechamiento en planta
|
|
187
188
|
const probableUtilization = netWeight * ((100 - (Number(formInput.porcentajeRechazo) ?? 0)) / 100);
|
|
@@ -193,10 +194,10 @@ const getPesadasByForm = (formInput) => {
|
|
|
193
194
|
baskets,
|
|
194
195
|
totalWeight,
|
|
195
196
|
discount,
|
|
196
|
-
netWeight: netWeight
|
|
197
|
-
weightByBasket: weightByBasket
|
|
198
|
-
probableUtilization
|
|
199
|
-
lbDiscounted
|
|
197
|
+
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
|
|
198
|
+
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
|
|
199
|
+
probableUtilization,
|
|
200
|
+
lbDiscounted,
|
|
200
201
|
});
|
|
201
202
|
index++;
|
|
202
203
|
}
|
|
@@ -210,10 +211,18 @@ const getPesadasByForm = (formInput) => {
|
|
|
210
211
|
const headers = [
|
|
211
212
|
{ label: "#", name: "id", type: "label", width: 5 },
|
|
212
213
|
{ label: "Canastas", name: "baskets", type: "label" },
|
|
213
|
-
{ label: "Peso báscula", name: "totalWeight", type: "label" },
|
|
214
|
-
{ label: "Peso Neto", name: "netWeight", type: "label" },
|
|
215
214
|
{
|
|
216
|
-
label: "
|
|
215
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso báscula"}`,
|
|
216
|
+
name: "totalWeight",
|
|
217
|
+
type: "label",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso Neto"}`,
|
|
221
|
+
name: "netWeight",
|
|
222
|
+
type: "label",
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso Neto"} por canasta`,
|
|
217
226
|
name: "weightByBasket",
|
|
218
227
|
type: "label",
|
|
219
228
|
},
|
|
@@ -266,7 +275,7 @@ const useGetBasketDetails = (purchaseOrder) => {
|
|
|
266
275
|
}
|
|
267
276
|
const totales = {
|
|
268
277
|
id: "",
|
|
269
|
-
total: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))
|
|
278
|
+
total: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
270
279
|
cc: joinedBaskets?.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
271
280
|
//granTotal: joinedBaskets?.map((x) => x.granTotal).reduce(reduceAdd, 0),
|
|
272
281
|
};
|
package/dist/esm/receptions.js
CHANGED
|
@@ -110,21 +110,21 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
|
|
|
110
110
|
baskets,
|
|
111
111
|
totalWeight,
|
|
112
112
|
discount,
|
|
113
|
-
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)
|
|
114
|
-
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)
|
|
115
|
-
probableUtilization
|
|
116
|
-
lbDiscounted
|
|
113
|
+
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
|
|
114
|
+
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
|
|
115
|
+
probableUtilization,
|
|
116
|
+
lbDiscounted,
|
|
117
117
|
};
|
|
118
118
|
}),
|
|
119
119
|
];
|
|
120
120
|
const totales = {
|
|
121
121
|
id: "",
|
|
122
|
-
baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))
|
|
123
|
-
totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))
|
|
122
|
+
baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
123
|
+
totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
124
124
|
discount: "-",
|
|
125
|
-
netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))
|
|
125
|
+
netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
126
126
|
weightByBasket: "-",
|
|
127
|
-
lbDiscounted: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0)),
|
|
127
|
+
lbDiscounted: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
128
128
|
probableUtilization: (0, common_1.toFixedIfNeeded)(tempPesadas
|
|
129
129
|
?.map((x) => Number(x.probableUtilization))
|
|
130
130
|
.reduce(common_1.reduceAdd, 0)),
|
|
@@ -169,7 +169,7 @@ exports.useGetPesadas = useGetPesadas;
|
|
|
169
169
|
* @param formInput
|
|
170
170
|
* @returns
|
|
171
171
|
*/
|
|
172
|
-
const getPesadasByForm = (formInput) => {
|
|
172
|
+
const getPesadasByForm = (formInput, stocks_only_integer = false) => {
|
|
173
173
|
// Inicializar array de pesadas
|
|
174
174
|
const tempPesadas = [];
|
|
175
175
|
// Iterar sobre los campos del formulario y extraer la información de pesadas
|
|
@@ -182,6 +182,7 @@ const getPesadasByForm = (formInput) => {
|
|
|
182
182
|
const basketWeight = 5;
|
|
183
183
|
let netWeight = totalWeight - baskets * basketWeight;
|
|
184
184
|
netWeight = netWeight * ((100 - discount) / 100);
|
|
185
|
+
netWeight = stocks_only_integer ? totalWeight : netWeight;
|
|
185
186
|
const weightByBasket = netWeight / baskets;
|
|
186
187
|
//Probable aprovechamiento en planta
|
|
187
188
|
const probableUtilization = netWeight * ((100 - (Number(formInput.porcentajeRechazo) ?? 0)) / 100);
|
|
@@ -193,10 +194,10 @@ const getPesadasByForm = (formInput) => {
|
|
|
193
194
|
baskets,
|
|
194
195
|
totalWeight,
|
|
195
196
|
discount,
|
|
196
|
-
netWeight: netWeight
|
|
197
|
-
weightByBasket: weightByBasket
|
|
198
|
-
probableUtilization
|
|
199
|
-
lbDiscounted
|
|
197
|
+
netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
|
|
198
|
+
weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
|
|
199
|
+
probableUtilization,
|
|
200
|
+
lbDiscounted,
|
|
200
201
|
});
|
|
201
202
|
index++;
|
|
202
203
|
}
|
|
@@ -210,10 +211,18 @@ const getPesadasByForm = (formInput) => {
|
|
|
210
211
|
const headers = [
|
|
211
212
|
{ label: "#", name: "id", type: "label", width: 5 },
|
|
212
213
|
{ label: "Canastas", name: "baskets", type: "label" },
|
|
213
|
-
{ label: "Peso báscula", name: "totalWeight", type: "label" },
|
|
214
|
-
{ label: "Peso Neto", name: "netWeight", type: "label" },
|
|
215
214
|
{
|
|
216
|
-
label: "
|
|
215
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso báscula"}`,
|
|
216
|
+
name: "totalWeight",
|
|
217
|
+
type: "label",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso Neto"}`,
|
|
221
|
+
name: "netWeight",
|
|
222
|
+
type: "label",
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: `${stocks_only_integer ? "Unidades" : "Peso Neto"} por canasta`,
|
|
217
226
|
name: "weightByBasket",
|
|
218
227
|
type: "label",
|
|
219
228
|
},
|
|
@@ -266,7 +275,7 @@ const useGetBasketDetails = (purchaseOrder) => {
|
|
|
266
275
|
}
|
|
267
276
|
const totales = {
|
|
268
277
|
id: "",
|
|
269
|
-
total: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))
|
|
278
|
+
total: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
270
279
|
cc: joinedBaskets?.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
271
280
|
//granTotal: joinedBaskets?.map((x) => x.granTotal).reduce(reduceAdd, 0),
|
|
272
281
|
};
|
package/dist/receptions.d.ts
CHANGED
|
@@ -44,8 +44,8 @@ type PesadaBody = {
|
|
|
44
44
|
discount: number;
|
|
45
45
|
netWeight: string;
|
|
46
46
|
weightByBasket: string;
|
|
47
|
-
probableUtilization:
|
|
48
|
-
lbDiscounted:
|
|
47
|
+
probableUtilization: number;
|
|
48
|
+
lbDiscounted: number;
|
|
49
49
|
};
|
|
50
50
|
type PesadaFooter = {
|
|
51
51
|
id: string;
|
|
@@ -61,7 +61,7 @@ export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stock
|
|
|
61
61
|
* @param formInput
|
|
62
62
|
* @returns
|
|
63
63
|
*/
|
|
64
|
-
export declare const getPesadasByForm: (formInput: FormInput) => {
|
|
64
|
+
export declare const getPesadasByForm: (formInput: FormInput, stocks_only_integer?: boolean) => {
|
|
65
65
|
tempPesadas: PesadaBody[];
|
|
66
66
|
totales: {
|
|
67
67
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/hooks",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.106",
|
|
4
4
|
"description": "Hooks reutilizables dentro de las webapps de Zauru.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-dom": "^18.2.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "664e7ee59830cf458ea3e47b597a89867b65b66b"
|
|
38
38
|
}
|