Добавились строки
This commit is contained in:
@@ -50,6 +50,7 @@ public class Corrector1S {
|
|||||||
private int cellNumSum = 0;
|
private int cellNumSum = 0;
|
||||||
/** номер колонки с больничными */
|
/** номер колонки с больничными */
|
||||||
private int cellBol = 0;
|
private int cellBol = 0;
|
||||||
|
/** последняя колонка в исходном документе */
|
||||||
private int lastColumn = 0;
|
private int lastColumn = 0;
|
||||||
private CellStyle cellStyle1, cellStyle2;
|
private CellStyle cellStyle1, cellStyle2;
|
||||||
private int maxLines = 0;
|
private int maxLines = 0;
|
||||||
@@ -337,6 +338,60 @@ public class Corrector1S {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertNewLines() {
|
||||||
|
Cell cell = sheet.createRow(19).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Итого по справке:");
|
||||||
|
cell = sheet.getRow(19).getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.FORMULA);
|
||||||
|
cell.setCellFormula(String.format("%s%d", CellReference.convertNumToColString(this.lastColumn+3), this.maxLines+2));
|
||||||
|
|
||||||
|
cell = sheet.createRow(20).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Дополнительные страховые взносы за сварщиков");
|
||||||
|
|
||||||
|
cell = sheet.createRow(21).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Корпоративный транспорт");
|
||||||
|
|
||||||
|
cell = sheet.createRow(22).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Подбор персонала сторонним агентством");
|
||||||
|
|
||||||
|
cell = sheet.createRow(23).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Страхование жизни");
|
||||||
|
|
||||||
|
cell = sheet.createRow(24).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Страхование НС");
|
||||||
|
|
||||||
|
cell = sheet.createRow(25).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Итого без НДС");
|
||||||
|
cell = sheet.getRow(25).getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.FORMULA);
|
||||||
|
cell.setCellFormula(String.format("%s%d", CellReference.convertNumToColString(6), 19+1));
|
||||||
|
|
||||||
|
cell = sheet.createRow(26).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Сумма НДС:");
|
||||||
|
cell = sheet.getRow(26).getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.FORMULA);
|
||||||
|
cell.setCellFormula(String.format("%s%d*18%%", CellReference.convertNumToColString(6), 25+1));
|
||||||
|
|
||||||
|
cell = sheet.createRow(27).getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue("Всего (с учетом НДС):");
|
||||||
|
cell = sheet.getRow(27).getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.FORMULA);
|
||||||
|
cell.setCellFormula(String.format("%s%d+%s%d",
|
||||||
|
CellReference.convertNumToColString(6),
|
||||||
|
25+1,
|
||||||
|
CellReference.convertNumToColString(6),
|
||||||
|
26+1));
|
||||||
|
}
|
||||||
|
|
||||||
public void saveFile() throws IOException {
|
public void saveFile() throws IOException {
|
||||||
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class Main {
|
|||||||
corrector1S.removeMergedCells();
|
corrector1S.removeMergedCells();
|
||||||
corrector1S.replaceData();
|
corrector1S.replaceData();
|
||||||
corrector1S.insertNewCols();
|
corrector1S.insertNewCols();
|
||||||
|
corrector1S.insertNewLines();
|
||||||
corrector1S.saveFile();
|
corrector1S.saveFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ public class MainController {
|
|||||||
|
|
||||||
progressBar.setProgress(0.70d);
|
progressBar.setProgress(0.70d);
|
||||||
corrector.insertNewCols();
|
corrector.insertNewCols();
|
||||||
|
corrector.insertNewLines();
|
||||||
|
|
||||||
progressBar.setProgress(0.99d);
|
progressBar.setProgress(0.99d);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user