package cn.iocoder.lyzsys.module.tjt.service.report.builder;

import lombok.Data;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Objects;

@Component
public class ProjectBudgetExcelBuilder extends AbstractProjectOutputExcelBuilder {

    private static final String SUMMARY_PLACEHOLDER = "/";
    private static final String BUDGET_SHEET_NAME = "建筑（装饰）工程项目考核产值预算表";
    private static final String BUDGET_SHEET_FALLBACK_NAME = "项目考核产值预算表";
    private static final String BUDGET_SHEET_TITLE = "附件4  建筑（装饰）工程项目考核产值预算表";
    private static final String QUARTER_BUDGET_SHEET_NAME = "项目考核产值年度季度预算计取表";
    private static final String QUARTER_BUDGET_SHEET_FALLBACK_NAME = "年度季度预算计取表";
    private static final String QUARTER_BUDGET_REMARK = "注：1、设计阶段考核产值为总考核产值×阶段占比；本年度/季度考核产值为阶段考核产值×本年度/季度发放比例。";
    private static final String DATE_TEXT = "日期：     年       月      日";

    public Workbook build(ExportData data) {
        Workbook workbook = createWorkbook();
        buildBudgetSheet(workbook, data);
        buildQuarterBudgetSheet(workbook, data);
        return workbook;
    }

    private void buildBudgetSheet(Workbook workbook, ExportData data) {
        Sheet sheet = createSheet(workbook, BUDGET_SHEET_NAME, BUDGET_SHEET_FALLBACK_NAME);
        setColumnWidths(sheet, 16, 14, 22, 16, 18, 14, 12, 12, 12, 18, 12, 14, 16);

        CellStyle titleStyle = createTitleStyle(workbook);
        CellStyle infoStyle = createInfoStyle(workbook);
        CellStyle infoValueStyle = createDerivedStyle(workbook, infoStyle,
                null, HorizontalAlignment.LEFT, false, (short) 10);
        CellStyle baseHeaderStyle = createHeaderStyle(workbook);
        CellStyle headerStyle = createDerivedStyle(workbook, baseHeaderStyle,
                IndexedColors.LEMON_CHIFFON, HorizontalAlignment.CENTER, true, (short) 10);
        CellStyle cellStyle = createCellStyle(workbook);
        CellStyle subtotalStyle = headerStyle;
        CellStyle totalStyle = createDerivedStyle(workbook, baseHeaderStyle,
                IndexedColors.GOLD, HorizontalAlignment.CENTER, true, (short) 10);

        int rowIndex = 0;
        rowIndex = writeMergedTitleRow(sheet, rowIndex, BUDGET_SHEET_TITLE, titleStyle, 12);
        rowIndex = buildBudgetHeader(sheet, rowIndex, headerStyle);
        int dataStartRow = rowIndex;

        if (data.getBudgetRows() != null) {
            for (BudgetRow rowData : data.getBudgetRows()) {
                if (rowData == null || rowData.getRowType() == null) {
                    continue;
                }
                if (BudgetRowType.DETAIL.equals(rowData.getRowType())) {
                    writeBudgetDetailRow(sheet, rowIndex++, rowData, cellStyle);
                    continue;
                }
                if (BudgetRowType.PART_EMPTY.equals(rowData.getRowType())) {
                    writeBudgetEmptyRow(sheet, rowIndex++, rowData, cellStyle);
                    continue;
                }
                if (BudgetRowType.PART_SUBTOTAL.equals(rowData.getRowType())) {
                    writeBudgetSummaryRow(sheet, rowIndex++, rowData, subtotalStyle);
                    continue;
                }
                if (BudgetRowType.PLANNING_TOTAL.equals(rowData.getRowType())) {
                    writeBudgetSummaryRow(sheet, rowIndex++, rowData, totalStyle);
                }
            }
        }
        mergeBudgetPlanningContentColumn(sheet, data.getBudgetRows(), dataStartRow);

        Row remarkRow = sheet.createRow(rowIndex++);
        setMergedRegionText(sheet, remarkRow.getRowNum(), remarkRow.getRowNum(), 0, 12,
                "备注：" + safeText(data.getRemark()), infoValueStyle);

        Row signRow = sheet.createRow(rowIndex);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 0, 3,
                "项目经理/工程负责人：", infoValueStyle);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 4, 7,
                "设计中心负责人：", infoValueStyle);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 8, 12,
                "市场运营中心负责人：", infoValueStyle);
    }

    private int buildBudgetHeader(Sheet sheet, int rowIndex, CellStyle headerStyle) {
        int firstRow = rowIndex;
        sheet.createRow(firstRow);
        sheet.createRow(firstRow + 1);
        sheet.createRow(firstRow + 2);

        setMergedRegionText(sheet, firstRow, firstRow + 1, 0, 0, "项目规模", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 1, 1, 2, "建筑工程（㎡）\n精装工程（㎡）", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 2, 3, 3, "内部指导单价（元 /㎡）", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow, 4, 10, "考核产值面积", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 2, 10, 10, "小计（㎡）", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 2, 11, 11, "设计阶段占比", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 2, 12, 12, "考核产值小计（万元）", headerStyle);

        setMergedRegionText(sheet, firstRow + 1, firstRow + 2, 4, 4, "建筑（装饰）设计面积（㎡）", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 1, 5, 6, "套图系数", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 1, 7, 9, "调整系数", headerStyle);

        writeRow(sheet, firstRow + 2, headerStyle, (Object[]) new String[]{
                "规划内容", "设计部位", "设计内容/设计类型", "", "", "栋数 / 户型数",
                "套图系数", "规模系数", "修改系数", "复杂系数 / 复杂等级", "", "", ""
        });
        return rowIndex + 3;
    }

    private void writeBudgetDetailRow(Sheet sheet, int rowIndex, BudgetRow rowData, CellStyle style) {
        Row row = sheet.createRow(rowIndex);
        setText(row, 0, safeText(rowData.getPlanningContent()), style);
        setText(row, 1, safeText(rowData.getDisplayDesignPart()), style);
        setText(row, 2, safeText(rowData.getDisplayBuildingType()), style);
        setText(row, 3, textOrBlank(rowData.getInternalGuidanceUnitPrice()), style);
        setText(row, 4, textOrBlank(rowData.getDesignArea()), style);
        setText(row, 5, integerText(rowData.getBuildingOrUnitCount()), style);
        setText(row, 6, factorTextOrBlank(rowData.getDrawingSetFactor(), 2), style);
        setText(row, 7, factorTextOrBlank(rowData.getScaleFactor(), 2), style);
        setText(row, 8, factorTextOrBlank(rowData.getModificationFactor(), 2), style);
        setText(row, 9, factorTextOrBlank(rowData.getComplexityFactor(), 2), style);
        setText(row, 10, textOrBlank(rowData.getSubtotalArea()), style);
        setText(row, 11, percentTextOrBlank(rowData.getCurrentDesignStageRatio()), style);
        setText(row, 12, textOrBlank(rowData.getAssessmentOutputValueWan()), style);
    }

    private void writeBudgetEmptyRow(Sheet sheet, int rowIndex, BudgetRow rowData, CellStyle style) {
        Row row = sheet.createRow(rowIndex);
        setText(row, 0, safeText(rowData.getPlanningContent()), style);
        setText(row, 1, safeText(rowData.getDisplayDesignPart()), style);
        for (int i = 2; i <= 12; i++) {
            setText(row, i, "", style);
        }
    }

    private void writeBudgetSummaryRow(Sheet sheet, int rowIndex, BudgetRow rowData, CellStyle style) {
        Row row = sheet.createRow(rowIndex);
        setText(row, 0, safeText(rowData.getPlanningContent()), style);
        setText(row, 1, safeText(rowData.getDisplayDesignPart()), style);
        setMergedRegionText(sheet, rowIndex, rowIndex, 2, 3, SUMMARY_PLACEHOLDER, style);
        setText(row, 4, text(rowData.getDesignArea()), style);
        setMergedRegionText(sheet, rowIndex, rowIndex, 5, 9, SUMMARY_PLACEHOLDER, style);
        setText(row, 10, text(rowData.getSubtotalArea()), style);
        setText(row, 11, SUMMARY_PLACEHOLDER, style);
        setText(row, 12, text(rowData.getAssessmentOutputValueWan()), style);
    }

    private void mergeBudgetPlanningContentColumn(Sheet sheet, List<BudgetRow> budgetRows, int dataStartRow) {
        if (budgetRows == null || budgetRows.isEmpty()) {
            return;
        }
        int mergeStartRow = dataStartRow;
        Long currentPlanningId = budgetRows.get(0).getPlanningId();
        for (int i = 1; i < budgetRows.size(); i++) {
            Long planningId = budgetRows.get(i).getPlanningId();
            if (Objects.equals(currentPlanningId, planningId)) {
                continue;
            }
            mergeBudgetPlanningContentRange(sheet, mergeStartRow, dataStartRow + i - 1);
            mergeStartRow = dataStartRow + i;
            currentPlanningId = planningId;
        }
        mergeBudgetPlanningContentRange(sheet, mergeStartRow, dataStartRow + budgetRows.size() - 1);
    }

    private void mergeBudgetPlanningContentRange(Sheet sheet, int startRow, int endRow) {
        if (endRow <= startRow) {
            return;
        }
        merge(sheet, startRow, endRow, 0, 0);
    }

    private void buildQuarterBudgetSheet(Workbook workbook, ExportData data) {
        Sheet sheet = createSheet(workbook, QUARTER_BUDGET_SHEET_NAME, QUARTER_BUDGET_SHEET_FALLBACK_NAME);
        setColumnWidths(sheet, 10, 20, 18, 24, 16, 16, 16, 12, 14, 14, 12, 12, 12, 12, 14, 14, 12, 12, 12, 12, 14, 24);

        CellStyle infoStyle = createInfoStyle(workbook);
        CellStyle infoValueStyle = createDerivedStyle(workbook, infoStyle,
                null, HorizontalAlignment.LEFT, false, (short) 10);
        CellStyle baseHeaderStyle = createHeaderStyle(workbook);
        CellStyle headerStyle = createDerivedStyle(workbook, baseHeaderStyle,
                IndexedColors.LEMON_CHIFFON, HorizontalAlignment.CENTER, true, (short) 10);
        CellStyle cellStyle = createCellStyle(workbook);
        CellStyle totalStyle = createDerivedStyle(workbook, baseHeaderStyle,
                IndexedColors.GOLD, HorizontalAlignment.CENTER, true, (short) 10);
        CellStyle centeredCellStyle = createDerivedStyle(workbook, cellStyle,
                null, HorizontalAlignment.CENTER, false, (short) 10);
        CellStyle rightAlignedInfoStyle = createDerivedStyle(workbook, infoValueStyle,
                null, HorizontalAlignment.RIGHT, false, (short) 10);

        int rowIndex = 0;
        rowIndex = buildQuarterBudgetHeader(sheet, rowIndex, data, headerStyle, centeredCellStyle);
        int dataStartRow = rowIndex;

        for (QuarterBudgetRow rowData : data.getQuarterBudgetRows()) {
            Row row = sheet.createRow(rowIndex++);
            if (rowData.isTotalRow()) {
                writeQuarterBudgetTotalRow(sheet, row, rowData, totalStyle);
                continue;
            }

            setText(row, 0, rowData.getSerialNo(), cellStyle);
            setText(row, 1, safeText(data.getProjectName()), cellStyle);
            setText(row, 2, safeText(rowData.getOutputType()), cellStyle);
            setText(row, 3, safeText(rowData.getDesignContent()), cellStyle);
            setText(row, 4, textOrBlank(rowData.getTotalDesignArea()), cellStyle);
            setText(row, 5, textOrBlank(rowData.getTotalAssessmentArea()), cellStyle);
            setText(row, 6, textOrBlank(rowData.getTotalAssessmentOutputWan()), cellStyle);
            setText(row, 7, percentTextOrBlank(rowData.getDesignStageRatio()), cellStyle);
            setText(row, 8, textOrBlank(rowData.getDesignStageOutputWan()), cellStyle);
            setText(row, 9, percentTextOrBlank(rowData.getHistoricalIssuedRatio()), cellStyle);
            setText(row, 10, percentTextOrBlank(rowData.getQuarterOneRatio()), cellStyle);
            setText(row, 11, percentTextOrBlank(rowData.getQuarterTwoRatio()), cellStyle);
            setText(row, 12, percentTextOrBlank(rowData.getQuarterThreeRatio()), cellStyle);
            setText(row, 13, percentTextOrBlank(rowData.getQuarterFourRatio()), cellStyle);
            setText(row, 14, percentTextOrBlank(rowData.getCurrentYearRatio()), cellStyle);
            setText(row, 15, percentTextOrBlank(rowData.getPendingRatio()), cellStyle);
            setText(row, 16, textOrBlank(rowData.getQuarterOneAmountWan()), cellStyle);
            setText(row, 17, textOrBlank(rowData.getQuarterTwoAmountWan()), cellStyle);
            setText(row, 18, textOrBlank(rowData.getQuarterThreeAmountWan()), cellStyle);
            setText(row, 19, textOrBlank(rowData.getQuarterFourAmountWan()), cellStyle);
            setText(row, 20, textOrBlank(rowData.getYearTotalAmountWan()), cellStyle);
            setText(row, 21, safeText(rowData.getRatioRemark()), cellStyle);
        }
        mergeQuarterBudgetProjectAndOutputType(sheet, data.getQuarterBudgetRows(), dataStartRow);

        Row remarkRow = sheet.createRow(rowIndex++);
        setMergedRegionText(sheet, remarkRow.getRowNum(), remarkRow.getRowNum(), 0, 21,
                QUARTER_BUDGET_REMARK, infoValueStyle);

        Row signRow = sheet.createRow(rowIndex++);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 0, 6,
                "项目经理/工程负责人：", infoValueStyle);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 7, 13,
                "设计中心负责人：", infoValueStyle);
        setMergedRegionText(sheet, signRow.getRowNum(), signRow.getRowNum(), 14, 21,
                "市场运营中心负责人：", infoValueStyle);

        Row dateRow = sheet.createRow(rowIndex);
        setMergedRegionText(sheet, dateRow.getRowNum(), dateRow.getRowNum(), 0, 21,
                DATE_TEXT, rightAlignedInfoStyle);
    }

    private void mergeQuarterBudgetProjectAndOutputType(Sheet sheet,
                                                        List<QuarterBudgetRow> rows,
                                                        int dataStartRow) {
        if (rows == null || rows.isEmpty()) {
            return;
        }
        int detailRowCount = 0;
        for (QuarterBudgetRow row : rows) {
            if (row != null && !row.isTotalRow()) {
                detailRowCount++;
            }
        }
        if (detailRowCount <= 0) {
            return;
        }
        if (detailRowCount > 1) {
            merge(sheet, dataStartRow, dataStartRow + detailRowCount - 1, 1, 1);
        }

        int currentStartRow = -1;
        String currentOutputType = null;
        int currentRowIndex = dataStartRow;
        for (QuarterBudgetRow row : rows) {
            if (row == null || row.isTotalRow()) {
                continue;
            }
            String outputType = safeText(row.getOutputType());
            if (currentStartRow < 0) {
                currentStartRow = currentRowIndex;
                currentOutputType = outputType;
            } else if (!Objects.equals(currentOutputType, outputType)) {
                mergeQuarterBudgetOutputTypeRange(sheet, currentStartRow, currentRowIndex - 1);
                currentStartRow = currentRowIndex;
                currentOutputType = outputType;
            }
            currentRowIndex++;
        }
        mergeQuarterBudgetOutputTypeRange(sheet, currentStartRow, dataStartRow + detailRowCount - 1);
    }

    private void mergeQuarterBudgetOutputTypeRange(Sheet sheet, int startRow, int endRow) {
        if (startRow < 0 || endRow <= startRow) {
            return;
        }
        merge(sheet, startRow, endRow, 2, 2);
    }

    private int buildQuarterBudgetHeader(Sheet sheet, int rowIndex, ExportData data,
                                         CellStyle headerStyle, CellStyle valueStyle) {
        int firstRow = rowIndex;
        sheet.createRow(firstRow);
        sheet.createRow(firstRow + 1);
        sheet.createRow(firstRow + 2);

        setMergedRegionText(sheet, firstRow, firstRow + 1, 0, 0, "工程编号", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 1, 1, 1, safeText(data.getProjectCode()), valueStyle);
        setText(sheet.getRow(firstRow + 2), 0, "序号", headerStyle);
        setText(sheet.getRow(firstRow + 2), 1, "项目名称", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow + 1, 2, 3, "类别", headerStyle);
        setText(sheet.getRow(firstRow + 2), 2, "产值类型", headerStyle);
        setText(sheet.getRow(firstRow + 2), 3, "设计内容", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow + 2, 4, 4, "总建筑（精装）设计面积(㎡)", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 2, 5, 5, "总考核产值面积(㎡)", headerStyle);
        setMergedRegionText(sheet, firstRow, firstRow + 2, 6, 6, "总考核产值（万元）", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow + 1, 7, 8, "设计阶段考核产值分配", headerStyle);
        setText(sheet.getRow(firstRow + 2), 7, "阶段占比", headerStyle);
        setText(sheet.getRow(firstRow + 2), 8, "考核产值", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow, 9, 15, "发放情况", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 2, 9, 9, "往年已发放比例", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 1, 10, 14, "本年度发放比例", headerStyle);
        setText(sheet.getRow(firstRow + 2), 10, "一季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 11, "二季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 12, "三季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 13, "四季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 14, "本年度小计", headerStyle);
        setMergedRegionText(sheet, firstRow + 1, firstRow + 2, 15, 15, "未发放比例", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow + 1, 16, 20, "本年度项目考核产值（万元）", headerStyle);
        setText(sheet.getRow(firstRow + 2), 16, "一季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 17, "二季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 18, "三季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 19, "四季度", headerStyle);
        setText(sheet.getRow(firstRow + 2), 20, "本年度小计", headerStyle);

        setMergedRegionText(sheet, firstRow, firstRow + 2, 21, 21, "备注（本年度比例说明）", headerStyle);
        return rowIndex + 3;
    }

    private void writeQuarterBudgetTotalRow(Sheet sheet, Row row, QuarterBudgetRow rowData, CellStyle totalStyle) {
        int rowIndex = row.getRowNum();
        setMergedRegionText(sheet, rowIndex, rowIndex, 0, 3, "项目合计", totalStyle);
        setText(row, 4, textOrBlank(rowData.getTotalDesignArea()), totalStyle);
        setText(row, 5, textOrBlank(rowData.getTotalAssessmentArea()), totalStyle);
        setText(row, 6, textOrBlank(rowData.getTotalAssessmentOutputWan()), totalStyle);
        setText(row, 7, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 8, textOrBlank(rowData.getDesignStageOutputWan()), totalStyle);
        setText(row, 9, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 10, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 11, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 12, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 13, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 14, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 15, SUMMARY_PLACEHOLDER, totalStyle);
        setText(row, 16, textOrBlank(rowData.getQuarterOneAmountWan()), totalStyle);
        setText(row, 17, textOrBlank(rowData.getQuarterTwoAmountWan()), totalStyle);
        setText(row, 18, textOrBlank(rowData.getQuarterThreeAmountWan()), totalStyle);
        setText(row, 19, textOrBlank(rowData.getQuarterFourAmountWan()), totalStyle);
        setText(row, 20, textOrBlank(rowData.getYearTotalAmountWan()), totalStyle);
        setText(row, 21, "", totalStyle);
    }

    private String factorTextOrBlank(BigDecimal value, int digits) {
        if (value == null) {
            return "";
        }
        return value.setScale(digits, RoundingMode.HALF_UP).toPlainString();
    }

    private String textOrBlank(BigDecimal value) {
        if (value == null) {
            return "";
        }
        return value.setScale(2, RoundingMode.HALF_UP).toPlainString();
    }

    private String percentTextOrBlank(BigDecimal value) {
        if (value == null) {
            return "";
        }
        return percentText(value);
    }

    private String integerText(Integer value) {
        return value == null ? "" : String.valueOf(value);
    }

    @Data
    public static class ExportData {
        private String projectCode;
        private String projectName;
        private String projectManagerName;
        private String engineeringPrincipalName;
        private BigDecimal totalConstructionArea;
        private BigDecimal contractUnitPrice;
        private BigDecimal internalGuidanceUnitPrice;
        private BigDecimal totalAssessmentArea;
        private BigDecimal totalAssessmentOutputValue;
        private BigDecimal totalAssessmentOutputValueWan;
        private String remark;
        private String yearRangeText;
        private List<BudgetRow> budgetRows;
        private List<QuarterBudgetRow> quarterBudgetRows;
    }

    public enum BudgetRowType {
        DETAIL,
        PART_EMPTY,
        PART_SUBTOTAL,
        PLANNING_TOTAL
    }

    @Data
    public static class BudgetRow {
        private BudgetRowType rowType;
        private Long planningId;
        private String planningContent;
        private String displayDesignPart;
        private String displayBuildingType;
        private BigDecimal internalGuidanceUnitPrice;
        private BigDecimal designArea;
        private Integer buildingOrUnitCount;
        private BigDecimal drawingSetFactor;
        private BigDecimal scaleFactor;
        private BigDecimal modificationFactor;
        private BigDecimal complexityFactor;
        private BigDecimal subtotalArea;
        private BigDecimal currentDesignStageRatio;
        private BigDecimal assessmentOutputValueWan;
    }

    @Data
    public static class QuarterBudgetRow {
        private Integer serialNo;
        private boolean totalRow;
        private String outputType;
        private String designContent;
        private Integer budgetYear;
        private BigDecimal totalDesignArea;
        private BigDecimal totalAssessmentArea;
        private BigDecimal totalAssessmentOutputWan;
        private BigDecimal designStageRatio;
        private BigDecimal designStageOutputWan;
        private BigDecimal historicalIssuedRatio;
        private BigDecimal quarterOneRatio;
        private BigDecimal quarterTwoRatio;
        private BigDecimal quarterThreeRatio;
        private BigDecimal quarterFourRatio;
        private BigDecimal currentYearRatio;
        private BigDecimal pendingRatio;
        private BigDecimal quarterOneAmountWan;
        private BigDecimal quarterTwoAmountWan;
        private BigDecimal quarterThreeAmountWan;
        private BigDecimal quarterFourAmountWan;
        private BigDecimal yearTotalAmountWan;
        private String ratioRemark;
    }

}
