1
0
Fork 0
HANYANG_MES/show_dir/www/ksvc/excel/sample.js

798 lines
31 KiB
JavaScript

let default_font = "Times New Roman";
let myBorder = {
aroundThin : { top: {style:'thin'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}},
thin1 : { left: {style:'thin'}, bottom: {style:'thin'}, },
thin2 : { bottom: {style:'thin'},},
thin3 : { bottom: {style:'thin'}, right: {style:'thin'}},
thin4 : { left: {style:'thin'}, },
thin6 : { right: {style:'thin'}},
thin7 : { top: {style:'thin'}, left: {style:'thin'}, },
thin8 : { top: {style:'thin'}, },
thin9 : { top: {style:'thin'}, right: {style:'thin'}},
thin123 : { left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}},
thin789 : { top: {style:'thin'}, left: {style:'thin'}, right: {style:'thin'}},
aroundThick : { top: {style:'thick'}, left: {style:'thick'}, bottom: {style:'thick'}, right: {style:'thick'}},
thick1 : { left: {style:'thick'}, bottom: {style:'thick'}, },
thick2 : { bottom: {style:'thick'},},
thick3 : { bottom: {style:'thick'}, right: {style:'thick'}},
thick4 : { left: {style:'thick'}, },
thick6 : { right: {style:'thick'}},
thick7 : { top: {style:'thick'}, left: {style:'thick'}, },
thick8 : { top: {style:'thick'}, },
thick9 : { top: {style:'thick'}, right: {style:'thick'}},
aroundMedium : { top: {style:'medium'}, left: {style:'medium'}, bottom: {style:'medium'}, right: {style:'medium'}},
medium1 : { left: {style:'medium'}, bottom: {style:'medium'}, },
medium2 : { bottom: {style:'medium'},},
medium3 : { bottom: {style:'medium'}, right: {style:'medium'}},
medium4 : { left: {style:'medium'}, },
medium6 : { right: {style:'medium'}},
medium7 : { top: {style:'medium'}, left: {style:'medium'}, },
medium8 : { top: {style:'medium'}, },
medium9 : { top: {style:'medium'}, right: {style:'medium'}},
medium123 : { left: {style:'medium'}, bottom: {style:'medium'}, right: {style:'medium'}},
medium789 : { top: {style:'medium'}, left: {style:'medium'}, right: {style:'medium'}},
sumRow : { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'medium'}, right: {style:'thin'}},
}
let mystyle = {
algCenter: {horizontal: 'center', vertical: 'middle', wrapText: true},
algCenter_wtf: {horizontal: 'center', vertical: 'middle', wrapText: false},
algLeft: {horizontal: 'left', vertical: 'middle', wrapText: true},
algLeft_wrf: {horizontal: 'left', vertical: 'middle', wrapText: false},
algRight: {horizontal: 'right', vertical: 'middle', wrapText: true},
}
let myFill = {
fillInput : {type: 'pattern', pattern: 'solid', fgColor: {argb: 'FCD5B4'}},
fillInput2 : {type: 'pattern', pattern: 'solid', fgColor: {argb: 'FDE9D9'}},
fillBlue : {type: 'pattern', pattern: 'solid', fgColor: {argb: 'C5D9F1'}},
fillYellow : {type: 'pattern', pattern: 'solid', fgColor: {argb: 'FFFF00'}},
}
let dfont = {size: 11, name: default_font, bold: true,},
tfont1 = {size: 9, name: default_font,},
tfont2 = {size: 10, name: default_font,},
tfont3 = {size: 11, name: default_font, bold: true,},
tfont4 = {size: 11, name: default_font,},
lfont = {size: 12, name: 'HY헤드라인M',},
lifont = {size: 10, name: default_font,},
lifontSum = {size: 11, name: default_font,},
bFont9 = {size: 9, name: default_font,},
bFont10 = {size: 10, name: default_font,},
bFont11 = {size: 11, name: default_font,},
sfont = {size: 20, name: default_font, underline:true,};
let nRow = null, nCell = null;
getEstiExcel = async ( filename, title ) => {
if (typeof ExcelJS == "undefined") return false;
filename = filename || "noname.xlsx";
title = title || "제목을 입력하지 않았습니다.";
filename = filename.replace(/[\*\?\:\\\/\[\]]/, '');
const workBook = new ExcelJS.Workbook();
workBook.creator = "스틸코리아 MES (http://mes.steelkorea.kr)";
workBook.subject = "스틸코리아 MES - " + title;
workBook.title = "스틸코리아 MES - " + title;
workBook.description = "STEELKOREA MES - " + title;
workBook.keywords = "http://mes.steelkorea.kr - " + title;
workBook.catetory = "스틸코리아 MES";
workBook.company = "스틸코리아 MES (mes.steelkorea.kr)";
getSheet(workBook, '단조견적22');
workBook.xlsx.writeBuffer().then((data) => {
let blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }),
url = window.URL.createObjectURL(blob),
anchor = document.createElement('a');
anchor.href = url;
anchor.download = filename;
anchor.click();
window.URL.revokeObjectURL(url);
});
};
getApplyRow = (row) => {
let aCellArr = [];
for (let i = 0; i < 9; i++) {
aCellArr.push(row.getCell(i+1));
}
return aCellArr;
}
getSheet = ( wbook, sheetname ) => {
sheetname = sheetname;
let tSumRow = 35;
let workSheet = wbook.addWorksheet(sheetname,{
pageSetup: {
paperSize: 9,
fitToPage: true,
horizontalCentered: true,
margins: {
left : 0.28,
right : 0.28,
top : 0.88,
bottom: 0.64,
header: 0.48,
footer: 0.52,
},
},
properties: {defaultRowHeight: 15,},
});
workSheet.columns = [
{ width: 7.56, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 7.89, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 7.89, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 7.89, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 9.22, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 7.56, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 8.56, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 9.22, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
{ width: 11.56, style: { alignment:{ vertical: 'middle', horizontal: 'left', }, font: {size:11, name:default_font}, }, },
];
nRow = workSheet.getRow(1);
nRow.height = 33;
nRow = workSheet.getRow(2);
nRow.height = 10.05;
nRow = workSheet.getRow(3);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: '30 Mieumsandan 2-ro, 16beon-gil Ganseo-gu Busan Korea', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft_wrf;
nRow = workSheet.getRow(4);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: 'Tel.:+82 70 5020 5459(Dir.) Fax.:+82 51-714-0888', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft_wrf;
nRow = workSheet.getRow(5);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: 'E-mail : steelkorea@steelkorea.kr Web Site : www.steelkorea.kr', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft_wrf;
nRow = workSheet.getRow(6);
nRow.height = 42.75;
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'OFFER SHEET', font: {size: 22, name: default_font, bold:true} }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('A6:I6');
nCell.border = { top: {style:'double'}, bottom: {style:'double'},}
nRow = workSheet.getRow(7);
nRow.height = 18.75;
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Customer :', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nRow = workSheet.getRow(7);
nCell = nRow.getCell('B');
nCell.value = { richText: [{ text: 'BP_NM', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nCell.fill = myFill.fillInput;
workSheet.mergeCells('B7:E7');
nRow = workSheet.getRow(7);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: 'Date : ', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nRow = workSheet.getRow(7);
nCell = nRow.getCell('G');
nCell.value = { richText: [{ text: 'EST_DATE', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nCell.fill = myFill.fillInput;
workSheet.mergeCells('G7:I7');
nRow = workSheet.getRow(8);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Attn. : ', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nRow = workSheet.getRow(8);
nCell = nRow.getCell('B');
nCell.value = { richText: [{ text: 'BP_PRSN_NM', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nCell.fill = myFill.fillInput;
workSheet.mergeCells('B8:E8');
nRow = workSheet.getRow(8);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: 'Offer No.:', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nRow = workSheet.getRow(8);
nCell = nRow.getCell('G');
nCell.value = { richText: [{ text: 'EST_UID', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
nCell.fill = myFill.fillInput;
workSheet.mergeCells('G8:I8');
nRow = workSheet.getRow(9);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Your Ref. No. :', font: {size: 11, name: default_font} }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A9:B9');
nRow = workSheet.getRow(9);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: 'UR_REF_NO', font: {size: 11, name: default_font} }] };
nCell.fill = myFill.fillInput;
nCell.alignment = mystyle.algRight;
nRow = workSheet.getRow(10);
nRow.height = 16.5;
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Total Amount : CURRENCY_CD' , font: {size: 11, name: default_font,} }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A10:B11');
nRow = workSheet.getRow(10);
nCell = nRow.getCell('C');
// currency(sumEa, {symbol: '', decimal: ',', precision:0}).format(),
nCell.value = {formula: 'H'+tSumRow, richText: [{ font: {size: 11, name: default_font, bold: true, } }] };
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('C10:D11');
nRow = workSheet.getRow(10);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: 'Contact person: EMP_NM', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algCenter_wtf;
nRow = workSheet.getRow(11);
nRow.height = 12.75;
nRow = workSheet.getRow(12);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'We are pleased to offer the under-mentioned article(s) as per following conditions and details.', font: {size: 10, name: default_font, bold:true,} }] };
nCell.alignment = mystyle.algLeft_wrf;
let aCells = getApplyRow(nRow);
aCells.forEach(cell => {
cell.border = { top: {style:'thin'}, bottom: {style:'medium'},}
})
nRow = workSheet.getRow(12);
nCell = nRow.getCell('I');
nCell.value = { richText: [{ text: 'Currency : EURO', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
// 상세 테이블 //헤더
nRow = workSheet.getRow(13);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'No.', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('A13:A14');
nRow.getCell('A').border = { top: {style:'medium'}, left: {style:'medium'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('B');
nCell.value = { richText: [{ text: 'Description (size/mm)', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('B13:D13');
nRow.getCell('B').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(14);
nCell = nRow.getCell('B');
nCell.value = { richText: [{ text: 'OD', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
nRow.getCell('B').border = myBorder.aroundThin;
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(14);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: 'ID', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
nRow.getCell('C').border = myBorder.aroundThin;
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(14);
nCell = nRow.getCell('D');
nCell.value = { richText: [{ text: 'T/L', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
nRow.getCell('D').border = myBorder.aroundThin;
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('E');
nCell.value = { richText: [{ text: 'Material', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('E13:E14');
nRow.getCell('E').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: 'Q\'ty', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('F13:F14');
nRow.getCell('F').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('G');
nCell.value = { richText: [{ text: 'U/Price', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('G13:G14');
nRow.getCell('G').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('H');
nCell.value = { richText: [{ text: 'Amount', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('H13:H14');
nRow.getCell('H').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(13);
nCell = nRow.getCell('I');
nCell.value = { richText: [{ text: 'Remark', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
workSheet.mergeCells('I13:I14');
nRow.getCell('I').border = { top: {style:'medium'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'thin'}};
nCell.fill = myFill.fillBlue;
// 상세 견적내용
let itnum = 15;
for (let i = 0; i < 10; i++ ) {
nRow = workSheet.getRow(itnum);
aCells = getApplyRow(nRow);
aCells.forEach(cell => {
cell.border = myBorder.aroundThin;
})
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: i + 1, font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
nCell = nRow.getCell('B');
nCell.value = '0';
nCell.numFmt = '#,##0.0';
nCell.alignment = mystyle.algCenter;
nCell.font = bFont10;
nCell = nRow.getCell('C');
nCell.value = '0';
nCell.numFmt = '#,##0.0';
nCell.alignment = mystyle.algCenter;
nCell.font = bFont10;
nCell = nRow.getCell('D');
nCell.value = '0';
nCell.numFmt = '#,##0.0';
nCell.alignment = mystyle.algCenter;
nCell.font = bFont10;
nCell = nRow.getCell('E');
nCell.value = { richText: [{ text: '라', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
nCell = nRow.getCell('F');
nCell.value = '0';
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nCell.font = bFont10;
nCell = nRow.getCell('G');
nCell.value = '0';
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nCell.font = bFont10;
nCell = nRow.getCell('H');
nCell.value = 0;
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nCell.font = bFont10;
nCell = nRow.getCell('I');
nCell.value = { richText: [{ text: 'AA', font: bFont10 }] };
nCell.alignment = mystyle.algCenter;
itnum++;
}
if (itnum < 31) {
for (let i = itnum; i <= 31; i++) {
nRow = workSheet.getRow(i);
aCells = getApplyRow(nRow);
aCells.forEach(cell => {
cell.border = myBorder.aroundThin;
})
nCell = nRow.getCell('A');
nCell.value = '';
nCell = nRow.getCell('B');
nCell.value = '';
nCell = nRow.getCell('C');
nCell.value = '';
nCell = nRow.getCell('D');
nCell.value = '';
nCell = nRow.getCell('E');
nCell.value = '';
nCell = nRow.getCell('F');
nCell.value = '';
nCell = nRow.getCell('G');
nCell.value = '';
nCell = nRow.getCell('H');
nCell.value = '';
nCell = nRow.getCell('I');
nCell.value = '';
}
}
// 합계
let sumRow = 32;
if (itnum > 31) {
sumRow = itnum
}
let totalStr = 'TOTAL';
let totalStr2 = 'G.TOTAL';
nRow = workSheet.getRow(sumRow);
nRow.height = 24;
nCell = nRow.getCell('A');
nCell.value = {richText: [{text: totalStr, font: bFont9}]};
nCell.alignment = mystyle.algRight;
workSheet.mergeCells('A' + sumRow + ':E' + sumRow);
nRow.getCell('A').border = {
top: {style: 'thin'},
left: {style: 'medium'},
bottom: {style: 'medium'},
right: {style: 'thin'}
};
nCell.fill = myFill.fillBlue;
nCell.font = lifontSum;
nRow = workSheet.getRow(sumRow);
nCell = nRow.getCell('F');
nCell.value = {formula: 'SUM(F15:F' + (itnum - 1) + ')', richText: [{font: bFont11}]};
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algCenter;
nRow.getCell('F').border = {
top: {style: 'thin'},
left: {style: 'thin'},
bottom: {style: 'medium'},
right: {style: 'thin'}
};
nCell.fill = myFill.fillBlue;
nCell.font = lifontSum;
nRow = workSheet.getRow(sumRow);
nCell = nRow.getCell('G');
nRow.getCell('G').border = {
top: {style: 'thin'},
left: {style: 'thin'},
bottom: {style: 'medium'},
right: {style: 'thin'}
};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow);
nCell = nRow.getCell('H');
nCell.value = {formula: 'SUM(H15:H' + (itnum - 1) + ')', richText: [{font: bFont9}]};
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nRow.getCell('H').border = {
top: {style: 'thin'},
left: {style: 'thin'},
bottom: {style: 'medium'},
right: {style: 'thin'}
};
nCell.fill = myFill.fillBlue;
nCell.font = lifontSum;
nRow = workSheet.getRow(sumRow);
nCell = nRow.getCell('I');
nRow.getCell('I').border = {
top: {style: 'thin'},
left: {style: 'thin'},
bottom: {style: 'medium'},
right: {style: 'medium'}
};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 1);
nRow.height = 24;
nCell = nRow.getCell('A');
nCell.value = {
richText: [{
text: 'PACKING COST',
font: bFont9
}]
};
nCell.alignment = mystyle.algRight;
workSheet.mergeCells('A' + (sumRow + 1) + ':E' + (sumRow + 1));
nRow.getCell('A').border = {left: {style: 'medium'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = lifontSum;
nRow = workSheet.getRow(sumRow + 1);
nCell = nRow.getCell('F');
nRow.getCell('F').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 1);
nCell = nRow.getCell('G');
nRow.getCell('G').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 1);
nCell = nRow.getCell('H');
nCell.value = '';
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nRow.getCell('H').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont11;
nRow = workSheet.getRow(sumRow + 1);
nCell = nRow.getCell('I');
nRow.getCell('I').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'medium'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 2);
nRow.height = 24;
nCell = nRow.getCell('A');
nCell.value = {
richText: [{
text: 'SEA FREIGHT CHARGE & INSURANCE PREMIUM',
font: {size: 9, name: default_font,}
}]
};
nCell.alignment = mystyle.algRight;
workSheet.mergeCells('A' + (sumRow + 2) + ':E' + (sumRow + 2));
nRow.getCell('A').border = {left: {style: 'medium'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont9;
nRow = workSheet.getRow(sumRow + 2);
nCell = nRow.getCell('F');
nRow.getCell('F').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 2);
nCell = nRow.getCell('G');
nRow.getCell('G').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
let feeAmt = 0;
nRow = workSheet.getRow(sumRow + 2);
nCell = nRow.getCell('H');
nCell.value = feeAmt || '';
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nRow.getCell('H').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont11;
nRow = workSheet.getRow(sumRow + 2);
nCell = nRow.getCell('I');
nRow.getCell('I').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'medium'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 3);
nRow.height = 24;
nCell = nRow.getCell('A');
nCell.value = {richText: [{text: 'ETC', font: {size: 9, name: default_font,}}]};
nCell.alignment = mystyle.algRight;
workSheet.mergeCells('A' + (sumRow + 3) + ':E' + (sumRow + 3));
nRow.getCell('A').border = {left: {style: 'medium'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont9;
nRow = workSheet.getRow(sumRow + 3);
nCell = nRow.getCell('F');
nRow.getCell('F').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 3);
nCell = nRow.getCell('G');
nRow.getCell('G').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
let etcAmt = 0;
nRow = workSheet.getRow(sumRow + 3);
nCell = nRow.getCell('H');
nCell.value = etcAmt || '';
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nRow.getCell('H').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont11;
nRow = workSheet.getRow(sumRow + 3);
nCell = nRow.getCell('I');
nRow.getCell('I').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'medium'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 4);
nRow.height = 24;
nCell = nRow.getCell('A');
nCell.value = {richText: [{text: totalStr2, font: {size: 9, name: default_font,}}]};
nCell.alignment = mystyle.algRight;
workSheet.mergeCells('A' + (sumRow + 4) + ':E' + (sumRow + 4));
nRow.getCell('A').border = {left: {style: 'medium'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont9;
nRow = workSheet.getRow(sumRow + 4);
nCell = nRow.getCell('F');
nCell.value = {formula: 'SUM(F15:F' + (itnum - 1) + ')', richText: [{font: {size: 9, name: default_font,}}]};
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algCenter;
nRow.getCell('F').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont11;
nRow = workSheet.getRow(sumRow + 4);
nCell = nRow.getCell('G');
nRow.getCell('G').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nRow = workSheet.getRow(sumRow + 4);
tSumRow = sumRow + 2;
nCell = nRow.getCell('H');
nCell.value = {
formula: 'SUM(H' + sumRow + ':H' + (sumRow + 3) + ')',
};
nCell.numFmt = '#,##0';
nCell.alignment = mystyle.algRight;
nRow.getCell('H').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'thin'}};
nCell.fill = myFill.fillBlue;
nCell.font = bFont11;
nRow = workSheet.getRow(sumRow + 4);
nCell = nRow.getCell('I');
nRow.getCell('I').border = {left: {style: 'thin'}, bottom: {style: 'medium'}, right: {style: 'medium'}};
nCell.fill = myFill.fillBlue;
// 푸터 부분
let footerRow = sumRow + 5;
nRow = workSheet.getRow(footerRow);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Supplying Condition', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + footerRow +':B' + footerRow);
nRow = workSheet.getRow(footerRow);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: ': TT', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft_wrf;
nCell.fill = myFill.fillInput;
nRow = workSheet.getRow(footerRow +1);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Port of Loading', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+1) +':B' + (footerRow+1));
nRow = workSheet.getRow(footerRow +1);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: ': AB', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft_wrf;
nCell.fill = myFill.fillInput;
nRow = workSheet.getRow(footerRow +2);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Ship Via', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+2) +':B' + (footerRow+2));
nRow = workSheet.getRow(footerRow +2);
nCell = nRow.getCell('C');
nCell.value = { richText: [{ text: ': VVIA', font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft_wrf;
nCell.fill = myFill.fillInput;
nRow = workSheet.getRow(footerRow +3);
nRow.height = 6.75;
nRow = workSheet.getRow(footerRow +4);
nRow.height = 6.75;
nRow = workSheet.getRow(footerRow +5);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: ' Price Terms : ', font: {size: 11, name: default_font, } },
{ text: '가', font: {size: 11, name: default_font, color: {argb: '2B00FF'} } },] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+5) +':E' + (footerRow+5));
nCell.border = { top: {style:'thin'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'double'}};
nRow = workSheet.getRow(footerRow +5);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: ' Packing : ', font: {size: 11, name: default_font, } },
{ text: '나' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('F' + (footerRow+5) +':I' + (footerRow+5));
nCell.border = { top: {style:'thin'}, left: {style:'double'}, bottom: {style:'thin'}, right: {style:'thin'}};
nRow = workSheet.getRow(footerRow +6);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: ' Time of Shipment : ' , font: {size: 11, name: default_font, } },
{ text: '다' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+6) +':E' + (footerRow+6));
nCell.border = { top: {style:'thin'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'double'}};
nRow = workSheet.getRow(footerRow +6);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: ' Inspection : ', font: {size: 11, name: default_font, } },
{ text: '라' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('F' + (footerRow+6) +':I' + (footerRow+6));
nCell.border = { top: {style:'thin'}, left: {style:'double'}, bottom: {style:'thin'}, right: {style:'thin'}};
nRow = workSheet.getRow(footerRow +7);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: ' Payment Terms : ' , font: {size: 11, name: default_font, } },
{ text: '마' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+7) +':E' + (footerRow+7));
nCell.border = { top: {style:'thin'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'double'}};
nRow = workSheet.getRow(footerRow +7);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: ' Validity : ', font: {size: 11, name: default_font, } },
{ text: '바', font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('F' + (footerRow+7) +':I' + (footerRow+7));
nCell.border = { top: {style:'thin'}, left: {style:'double'}, bottom: {style:'thin'}, right: {style:'thin'}};
nRow = workSheet.getRow(footerRow +8);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: ' Country Origin : ' , font: {size: 11, name: default_font, } },
{ text: '사' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} }, }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+8) +':E' + (footerRow+8));
nCell.border = { top: {style:'thin'}, left: {style:'thin'}, bottom: {style:'thin'}, right: {style:'double'}};
nRow = workSheet.getRow(footerRow +8);
nCell = nRow.getCell('F');
workSheet.mergeCells('F' + (footerRow+8) +':I' + (footerRow+8));
nCell.border = { top: {style:'thin'}, left: {style:'double'}, bottom: {style:'thin'}, right: {style:'thin'}};
nRow = workSheet.getRow(footerRow +11);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: 'Note.' , font: {size: 11, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
let estTextArr = ['A','B','C'];
estTextArr.forEach((sts,idx) => {
nRow = workSheet.getRow(footerRow +12 +idx);
nCell = nRow.getCell('A');
nCell.value = { richText: [{ text: '우' , font: {size: 11, name: default_font, color: {argb: '2B00FF'} } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('A' + (footerRow+12 +idx) +':E' + (footerRow+12 +idx));
})
nRow = workSheet.getRow(footerRow +12);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: 'The president of STEEL KOREA Co.,Ltd' , font: {size: 10, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('F' + (footerRow+12) +':I' + (footerRow+12));
nCell.border = { top: {style:'thin'}, bottom: {style:'medium'},};
nRow = workSheet.getRow(footerRow +17);
nRow.height = 9.75;
nRow = workSheet.getRow(footerRow +18);
nCell = nRow.getCell('F');
nCell.value = { richText: [{ text: ' HYEON DO HEO' , font: {size: 10, name: default_font, } }] };
nCell.alignment = mystyle.algLeft;
workSheet.mergeCells('F' + (footerRow+18) +':I' + (footerRow+18));
nCell.border = { top: {style:'medium'},};
return workSheet;
};
document.getElementById("btnDownSample").addEventListener("click",function(){
getEstiExcel("sample.xlsx","타이틀");
});