Update generate_jurnal.blade.php

This commit is contained in:
Jagad R R
2025-01-19 15:39:31 +07:00
parent 974cc4df50
commit c8dbef00d6
@@ -151,18 +151,42 @@
text: 'Export Excel',
customize: function (xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
// Add additional information to the Excel sheet
var additionalInfo = `
Cabang: {{ $cabang->name }}
Periode: {{ ucfirst($month) }} {{ $year }}
Cost Centre: {{ $cabang->cost->code }}
`;
var rows = additionalInfo.split('\n').map(function (text) {
return `<row><c t="inlineStr"><is><t>${text.trim()}</t></is></c></row>`;
}).join('');
// Inject the additional information at the top of the sheet
var data = $(sheet).find('sheetData').prepend(rows);
// Add a blank row for spacing
var blankRow = `<row><c t="inlineStr"><is><t></t></is></c></row>`;
// Bold text using Excel XML structure
var additionalInfo = `
<row>
<c t="inlineStr" s="2"><is><t>Cabang: {{ $cabang->name }}</t></is></c>
</row>
<row>
<c t="inlineStr" s="2"><is><t>Periode: {{ ucfirst($month) }} {{ $year }}</t></is></c>
</row>
<row>
<c t="inlineStr" s="2"><is><t>Cost Centre: {{ $cabang->cost->code }}</t></is></c>
</row>
`;
// Locate the sheet data and append the blank row and additional information
var sheetData = $(sheet).find('sheetData');
var existingRows = sheetData.children();
existingRows.last().after(blankRow + additionalInfo);
// Add bold style to the sheet
var styles = xlsx.xl['styles.xml'];
var cellXfs = $(styles).find('cellXfs');
cellXfs.append(`
<xf xfId="0" applyFont="1">
<alignment horizontal="left"/>
<font>
<b/>
<sz val="11"/>
<name val="Calibri"/>
<family val="2"/>
</font>
</xf>
`);
}
},
{