Archived
0

Honorarium -> HonorariumPercent & HonorariumRUB

Разделение по двум разным форумлам
This commit is contained in:
2018-07-24 12:32:12 +03:00
parent cd2b55fce8
commit 00ef10dc1d
2 changed files with 73 additions and 20 deletions

View File

@@ -39,7 +39,9 @@ public class Corrector1S {
@Setter @Setter
private File targetFile; private File targetFile;
@Setter @Setter
private double honorarium; private Double honorariumPercent = null;
@Setter
private Double honorariumRub = null;
@Setter @Setter
private double fss; private double fss;
@@ -50,6 +52,14 @@ public class Corrector1S {
private int cellNumSum = 0; private int cellNumSum = 0;
/** номер колонки с больничными */ /** номер колонки с больничными */
private int cellBol = 0; private int cellBol = 0;
/** номер колонки "Дневные" */
private int cellDay = 0;
/** номер колонки "Выходные" */
private int cellWeekend = 0;
/** номер колонки "Сверхурочные 1.5 ставки" */
private int cellOver15 = 0;
/** номер колонки "Сверхурочные 2 ставки" */
private int cellOver2 = 0;
/** последняя колонка в исходном документе */ /** последняя колонка в исходном документе */
private int lastColumn = 0; private int lastColumn = 0;
private CellStyle cellStyle1, cellStyle2; private CellStyle cellStyle1, cellStyle2;
@@ -70,7 +80,8 @@ public class Corrector1S {
} }
public void check() throws Exception { public void check() throws Exception {
if (honorarium == 0.0d) throw new AssertionError("Honorarium not be 0.0%!"); if (honorariumPercent != null && honorariumPercent == 0.0d) throw new AssertionError("Honorarium not be 0.0%!");
if (honorariumRub != null && honorariumRub == 0.0d) throw new AssertionError("Honorarium not be 0.0 rub!");
if (fss == 0.0d) throw new AssertionError("FSS not be 0.0%!"); if (fss == 0.0d) throw new AssertionError("FSS not be 0.0%!");
if (sourceFile == null) throw new AssertionError("Source file not be null!"); if (sourceFile == null) throw new AssertionError("Source file not be null!");
@@ -125,7 +136,14 @@ public class Corrector1S {
record.addition = 0; record.addition = 0;
} }
} else { } else {
record.dataList.add(cell.getNumericCellValue()); double value;
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
String preDouble = cell.getStringCellValue().replace(',','.');
value = Double.parseDouble(preDouble);
} else {
value = cell.getNumericCellValue();
}
record.dataList.add(value);
} }
} }
@@ -191,11 +209,17 @@ public class Corrector1S {
setCellRecord(record, column++); setCellRecord(record, column++);
this.cellBol = column-1; this.cellBol = column-1;
} }
if ((record = mapRecords.remove("Дневные")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Дневные")) != null) {
setCellRecord(record, column++);
this.cellDay = column-1;
}
if ((record = mapRecords.remove("Ночные")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Ночные")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Ночные_123")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Ночные_123")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("питание_124")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("питание_124")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Выходные")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Выходные")) != null) {
setCellRecord(record, column++);
this.cellWeekend = column-1;
}
if ((record = mapRecords.remove("выходные_135")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("выходные_135")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("пересчет за прошлый месяц_141")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("пересчет за прошлый месяц_141")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("вредность_145")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("вредность_145")) != null) setCellRecord(record, column++);
@@ -204,9 +228,15 @@ public class Corrector1S {
if ((record = mapRecords.remove("Оплата по среднему (донорство, посещение врача)_174")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Оплата по среднему (донорство, посещение врача)_174")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Компенсация проезда при использовании личного транспорта_176")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Компенсация проезда при использовании личного транспорта_176")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("сверхурочные_133")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("сверхурочные_133")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Сверхурочные 1.5 ставки")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Сверхурочные 1.5 ставки")) != null) {
setCellRecord(record, column++);
this.cellOver15 = column-1;
}
if ((record = mapRecords.remove("сверхурочные 1,5_180")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("сверхурочные 1,5_180")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Сверхурочные 2 ставки")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Сверхурочные 2 ставки")) != null) {
setCellRecord(record, column++);
this.cellOver2 = column-1;
}
if ((record = mapRecords.remove("сверхурочные 2_181")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("сверхурочные 2_181")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Компенсация за неиспользованный отпуск (с декабря 2017)_184")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Компенсация за неиспользованный отпуск (с декабря 2017)_184")) != null) setCellRecord(record, column++);
if ((record = mapRecords.remove("Месячная премия 2018_186")) != null) setCellRecord(record, column++); if ((record = mapRecords.remove("Месячная премия 2018_186")) != null) setCellRecord(record, column++);
@@ -316,15 +346,31 @@ public class Corrector1S {
); );
// HONORARIUM // HONORARIUM
if (honorariumPercent != null) {
insertCell( insertCell(
"Гонорар", "Гонорар",
String.format("%.2f%%", this.honorarium), String.format("%.2f%%", this.honorariumPercent),
String.format("%s{L}*%.2f%%", String.format("%s{L}*%.2f%%",
CellReference.convertNumToColString(column-1), CellReference.convertNumToColString(column-1),
this.honorarium), this.honorariumPercent),
buildSumFormula(column, 8, this.maxLines), buildSumFormula(column, 8, this.maxLines),
column++ column++
); );
} else if (honorariumRub != null) {
insertCell(
"Гонорар",
String.format("%.2f руб/час", this.honorariumRub),
// =(K9+L9+U9+W9)*38,41
String.format("(%s{L}+%s{L}+%s{L}+%s{L})*%.2f",
CellReference.convertNumToColString(this.cellDay),
CellReference.convertNumToColString(this.cellWeekend),
CellReference.convertNumToColString(this.cellOver15),
CellReference.convertNumToColString(this.cellOver2),
this.honorariumRub),
buildSumFormula(column, 8, this.maxLines),
column++
);
}
// SUM ALL // SUM ALL
insertCell( insertCell(

View File

@@ -8,6 +8,7 @@ import ru.dmitriymx.corrector1s.gui.MainApp;
import java.io.File; import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@@ -24,10 +25,12 @@ public class Main {
optionParser.acceptsAll(Arrays.asList("t", "target"), "Target Excel file (default: target = source)") optionParser.acceptsAll(Arrays.asList("t", "target"), "Target Excel file (default: target = source)")
.withRequiredArg() .withRequiredArg()
.ofType(File.class); .ofType(File.class);
optionParser.acceptsAll(Arrays.asList("h", "honorarium"), "Honorarium (in percentages)") optionParser.acceptsAll(Collections.singletonList("honorariumPercent"), "Honorarium (in percentages)")
.withRequiredArg() .withRequiredArg()
.ofType(Double.class) .ofType(Double.class);
.defaultsTo(9.0d); optionParser.acceptsAll(Collections.singletonList("honorariumRub"), "Honorarium (in rub)")
.withRequiredArg()
.ofType(Double.class);
optionParser.acceptsAll(Arrays.asList("f", "fss"), "FSS (in percentages)") optionParser.acceptsAll(Arrays.asList("f", "fss"), "FSS (in percentages)")
.withRequiredArg() .withRequiredArg()
.ofType(Double.class) .ofType(Double.class)
@@ -82,7 +85,11 @@ public class Main {
Corrector1S corrector1S = new Corrector1S(); Corrector1S corrector1S = new Corrector1S();
corrector1S.setSourceFile(sourceFile); corrector1S.setSourceFile(sourceFile);
corrector1S.setTargetFile(targetFile); corrector1S.setTargetFile(targetFile);
corrector1S.setHonorarium((Double) optionSet.valueOf("honorarium")); if (optionSet.has("honorariumPercent")) {
corrector1S.setHonorariumPercent((Double) optionSet.valueOf("honorariumPercent"));
} else if (optionSet.has("honorariumRub")) {
corrector1S.setHonorariumRub((Double) optionSet.valueOf("honorariumRub"));
}
corrector1S.setFss((Double) optionSet.valueOf("fss")); corrector1S.setFss((Double) optionSet.valueOf("fss"));
corrector1S.check(); corrector1S.check();