fix
This commit is contained in:
@@ -14,43 +14,21 @@ const detailFontSize = 3
|
||||
|
||||
const formatData = (rawData: any) => {
|
||||
const formattedData: any = []
|
||||
const total: any = {
|
||||
wo_total: 0,
|
||||
anomali_pln_mobile_marking: 0,
|
||||
anomali_cc123_marking: 0
|
||||
// total_anomali_marking: 0
|
||||
// persen_anomali_pln_mobile_marking: 0
|
||||
// persen_anomali_cc123_marking
|
||||
// persen_anomali_marking
|
||||
}
|
||||
|
||||
rawData.forEach((item: any) => {
|
||||
total.wo_total += item.wo_total
|
||||
total.anomali_pln_mobile_marking += item.anomali_pln_mobile_marking
|
||||
total.anomali_cc123_marking += item.anomali_cc123_marking
|
||||
formattedData.push([
|
||||
item.nama_unit,
|
||||
item.nama_petugas,
|
||||
formatNumber(item.wo_total),
|
||||
formatNumber(item.wo_pln_mobile),
|
||||
formatNumber(item.wo_cc123),
|
||||
formatNumber(item.wo_pln_mobile + item.wo_cc123),
|
||||
formatPercentage(item.persen_anomali_pln_mobile),
|
||||
formatPercentage(item.persen_anomali_cc123),
|
||||
formatPercentage(item.persen_anomali_pln_mobile + item.persen_anomali_cc123)
|
||||
])
|
||||
})
|
||||
|
||||
const total_anomali_marking = total.anomali_pln_mobile_marking + total.anomali_cc123_marking
|
||||
const persen_anomali_pln_mobile_marking = total.anomali_pln_mobile_marking / total.wo_total
|
||||
const persen_anomali_cc123_marking = total.anomali_cc123_marking / total.wo_total
|
||||
const persen_anomali_marking = persen_anomali_pln_mobile_marking + persen_anomali_cc123_marking
|
||||
|
||||
formattedData.push([
|
||||
{
|
||||
content: 'Semua Unit',
|
||||
colSpan: 2
|
||||
},
|
||||
formatNumber(total.wo_total),
|
||||
formatNumber(total.anomali_pln_mobile_marking),
|
||||
formatNumber(total.anomali_cc123_marking),
|
||||
formatNumber(total_anomali_marking),
|
||||
formatPercentage(
|
||||
!persen_anomali_pln_mobile_marking ? 0 : persen_anomali_pln_mobile_marking * 100
|
||||
),
|
||||
formatPercentage(!persen_anomali_cc123_marking ? 0 : persen_anomali_cc123_marking * 100),
|
||||
formatPercentage(!persen_anomali_marking ? 0 : persen_anomali_marking * 100)
|
||||
])
|
||||
|
||||
return formattedData
|
||||
}
|
||||
|
||||
@@ -84,8 +62,8 @@ const exportToPDF = (reportMeta: any, rawData: any, preview: boolean = false) =>
|
||||
const date = new Date().getDate()
|
||||
const month = new Date().toLocaleString('id-ID', { month: 'long' })
|
||||
const year = new Date().getFullYear()
|
||||
const data = formatData(rawData)
|
||||
const meta = formatMetaData(reportMeta)
|
||||
const data = formatData(rawData)
|
||||
const doc = new jsPDF({
|
||||
orientation: 'landscape'
|
||||
})
|
||||
|
Reference in New Issue
Block a user