Subversion Repositories SmartDukaan

Rev

Rev 36754 | Rev 36769 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36754 Rev 36755
Line 1128... Line 1128...
1128
            currentOpening -= interestAccruedCost;
1128
            currentOpening -= interestAccruedCost;
1129
            sheet.getRow(row).createCell(5).setCellValue(currentOpening);
1129
            sheet.getRow(row).createCell(5).setCellValue(currentOpening);
1130
            sheet.getRow(row).createCell(6).setCellValue("SD Credit — Interest accrued (financing cost)");
1130
            sheet.getRow(row).createCell(6).setCellValue("SD Credit — Interest accrued (financing cost)");
1131
            row++;
1131
            row++;
1132
        }
1132
        }
1133
        // Pending-indent + floating-diff line: lands the running balance exactly on the formula closing. For a clean
1133
        // Float-difference line: lands the running balance exactly on the formula closing. With clean data this is only
1134
        // monthly statement this is ~float; it also absorbs legitimate cross-period residuals (scheme→CN timing, a
1134
        // a few rupees of rounding/float; a large value signals a data issue (e.g. MARGINS CN not yet rolled out) and is
1135
        // CN_CANCELLATION reversing a prior month, a return whose sale was billed earlier).
1135
        // surfaced by the reconciliation warning below rather than being a real ledger movement.
1136
        double pendingIndentLine = closingBalance - currentOpening;
1136
        double floatDiff = closingBalance - currentOpening;
1137
        if (Math.abs(pendingIndentLine) > 0.01) {
1137
        if (Math.abs(floatDiff) > 0.01) {
1138
            Cell dateCell = sheet.createRow(row).createCell(0);
1138
            Cell dateCell = sheet.createRow(row).createCell(0);
1139
            dateCell.setCellValue(new Date(endLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
1139
            dateCell.setCellValue(new Date(endLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
1140
            dateCell.setCellStyle(dateStyle);
1140
            dateCell.setCellStyle(dateStyle);
1141
            sheet.getRow(row).createCell(1).setCellValue("NET PENDING INDENT / DIFF");
1141
            sheet.getRow(row).createCell(1).setCellValue("FLOAT DIFF");
1142
            sheet.getRow(row).createCell(2).setCellValue("");
1142
            sheet.getRow(row).createCell(2).setCellValue("");
1143
            if (pendingIndentLine > 0) {
1143
            if (floatDiff > 0) {
1144
                sheet.getRow(row).createCell(3).setCellValue(0);
1144
                sheet.getRow(row).createCell(3).setCellValue(0);
1145
                sheet.getRow(row).createCell(4).setCellValue(pendingIndentLine);
1145
                sheet.getRow(row).createCell(4).setCellValue(floatDiff);
1146
                grandTotalCredit += (long) pendingIndentLine;
1146
                grandTotalCredit += (long) floatDiff;
1147
            } else {
1147
            } else {
1148
                sheet.getRow(row).createCell(3).setCellValue(-pendingIndentLine);
1148
                sheet.getRow(row).createCell(3).setCellValue(-floatDiff);
1149
                sheet.getRow(row).createCell(4).setCellValue(0);
1149
                sheet.getRow(row).createCell(4).setCellValue(0);
1150
                grandTotalDebit += (long) -pendingIndentLine;
1150
                grandTotalDebit += (long) -floatDiff;
1151
            }
1151
            }
1152
            currentOpening += pendingIndentLine;
1152
            currentOpening += floatDiff;
1153
            sheet.getRow(row).createCell(5).setCellValue(currentOpening);
1153
            sheet.getRow(row).createCell(5).setCellValue(currentOpening);
1154
            sheet.getRow(row).createCell(6).setCellValue("Net Pending Indent + reconciling diff (cross-period / timing / float)");
1154
            sheet.getRow(row).createCell(6).setCellValue("Rounding / float difference");
1155
            row++;
1155
            row++;
1156
        }
1156
        }
1157
 
1157
 
1158
        sheet.createRow(row).createCell(2).setCellValue("Grand Total");
1158
        sheet.createRow(row).createCell(2).setCellValue("Grand Total");
1159
        sheet.getRow(row).createCell(3).setCellValue(grandTotalDebit);
1159
        sheet.getRow(row).createCell(3).setCellValue(grandTotalDebit);