diff --git a/src/services/api/report/production-result.ts b/src/services/api/report/production-result.ts index 3a8d2fae..43417aff 100644 --- a/src/services/api/report/production-result.ts +++ b/src/services/api/report/production-result.ts @@ -1,6 +1,6 @@ import * as XLSX from 'xlsx'; import toast from 'react-hot-toast'; -import { formatDate } from '@/lib/helper'; +import { formatDate, safeRound } from '@/lib/helper'; import { isResponseSuccess } from '@/lib/api-helper'; import { BaseApiService } from '@/services/api/base'; import { httpClient, httpClientFetcher } from '@/services/http/client'; @@ -68,41 +68,41 @@ export class ProductionResultReportApiService extends BaseApiService< row.productionResult?.forEach((productionResult) => { groupedData[kandangName].push({ - woa: productionResult.woa, - bw: productionResult.bw, - std_bw: productionResult.std_bw, - uniformity: productionResult.uniformity, + woa: safeRound(productionResult.woa, 2), + bw: safeRound(productionResult.bw, 2), + std_bw: safeRound(productionResult.std_bw, 2), + uniformity: safeRound(productionResult.uniformity, 2), std_uniformity: productionResult.std_uniformity, - dep_kum: productionResult.dep_kum, - dep_std: productionResult.dep_std, - butiran_utuh: productionResult.butiran_utuh, - butiran_putih: productionResult.butiran_putih, - butiran_retak: productionResult.butiran_retak, - butiran_pecah: productionResult.butiran_pecah, - butiran_jumlah: productionResult.butiran_jumlah, - total_butir: productionResult.total_butir, - kg_utuh: productionResult.kg_utuh, - kg_putih: productionResult.kg_putih, - kg_retak: productionResult.kg_retak, - kg_pecah: productionResult.kg_pecah, - kg_jumlah: productionResult.kg_jumlah, - total_kg: productionResult.total_kg, - persen_utuh: productionResult.persen_utuh, - persen_putih: productionResult.persen_putih, - persen_retak: productionResult.persen_retak, - persen_pecah: productionResult.persen_pecah, - hd: productionResult.hd, - hd_std: productionResult.hd_std, - fi: productionResult.fi, - fi_std: productionResult.fi_std, - em: productionResult.em, - em_std: productionResult.em_std, - ew: productionResult.ew, - ew_std: productionResult.ew_std, - fcr: productionResult.fcr, - fcr_std: productionResult.fcr_std, - hh: productionResult.hh, - hh_std: productionResult.hh_std, + dep_kum: safeRound(productionResult.dep_kum, 2), + dep_std: safeRound(productionResult.dep_std, 2), + butiran_utuh: safeRound(productionResult.butiran_utuh, 2), + butiran_putih: safeRound(productionResult.butiran_putih, 2), + butiran_retak: safeRound(productionResult.butiran_retak, 2), + butiran_pecah: safeRound(productionResult.butiran_pecah, 2), + butiran_jumlah: safeRound(productionResult.butiran_jumlah, 2), + total_butir: safeRound(productionResult.total_butir, 2), + kg_utuh: safeRound(productionResult.kg_utuh, 2), + kg_putih: safeRound(productionResult.kg_putih, 2), + kg_retak: safeRound(productionResult.kg_retak, 2), + kg_pecah: safeRound(productionResult.kg_pecah, 2), + kg_jumlah: safeRound(productionResult.kg_jumlah, 2), + total_kg: safeRound(productionResult.total_kg, 2), + persen_utuh: safeRound(productionResult.persen_utuh, 2), + persen_putih: safeRound(productionResult.persen_putih, 2), + persen_retak: safeRound(productionResult.persen_retak, 2), + persen_pecah: safeRound(productionResult.persen_pecah, 2), + hd: safeRound(productionResult.hd, 2), + hd_std: safeRound(productionResult.hd_std, 2), + fi: safeRound(productionResult.fi, 2), + fi_std: safeRound(productionResult.fi_std, 2), + em: safeRound(productionResult.em, 2), + em_std: safeRound(productionResult.em_std, 2), + ew: safeRound(productionResult.ew, 2), + ew_std: safeRound(productionResult.ew_std, 2), + fcr: safeRound(productionResult.fcr, 2), + fcr_std: safeRound(productionResult.fcr_std, 2), + hh: safeRound(productionResult.hh, 2), + hh_std: safeRound(productionResult.hh_std, 2), project_flock_name: row.projectFlockKandang.project_flock.flock_name, project_flock_category: