diff --git a/src/report/Gangguan/Rekap/RGangguan_KTI.ts b/src/report/Gangguan/Rekap/RGangguan_KTI.ts index bfe05b1..87e8594 100644 --- a/src/report/Gangguan/Rekap/RGangguan_KTI.ts +++ b/src/report/Gangguan/Rekap/RGangguan_KTI.ts @@ -10,8 +10,10 @@ import { exportDetailToWord, exportToWord } from './doc/RGangguan_KTI_DOC' const reportName = 'Rekapitulasi Koreksi Transaksi Individual' const fontSize = 5 const detailFontSize = 3 +var metaReport: any = {} const formatData = (rawData: any) => { + const { uid, up3, posko } = metaReport const formattedData: any = [] const total: any = { month1: 0, @@ -28,7 +30,19 @@ const formatData = (rawData: any) => { month12: 0 } - formattedData.push([{ content: 'SELURUH UNIT', colSpan: 14, styles: { fontStyle: 'bold' } }]) + if (uid.id == 0) { + formattedData.push([{ content: 'SELURUH UNIT', colSpan: 14, styles: { fontStyle: 'bold' } }]) + } else { + if (up3.id == 0) { + formattedData.push([{ content: uid.name, colSpan: 14, styles: { fontStyle: 'bold' } }]) + } else { + if (posko.id == 0) { + formattedData.push([{ content: up3.name, colSpan: 14, styles: { fontStyle: 'bold' } }]) + } else { + formattedData.push([{ content: posko.name, colSpan: 14, styles: { fontStyle: 'bold' } }]) + } + } + } formattedData.push( ...rawData.map((item: any, i: any) => { @@ -114,8 +128,9 @@ 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) + metaReport = reportMeta const meta = formatMetaData(reportMeta) + const data = formatData(rawData) const doc = new jsPDF({ orientation: 'landscape' })