Subversion Repositories SmartDukaan

Rev

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

Rev 33226 Rev 33227
Line 766... Line 766...
766
                    dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
766
                    dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
767
                    dateCell.setCellStyle(dateStyle);
767
                    dateCell.setCellStyle(dateStyle);
768
                    //TransactType
768
                    //TransactType
769
                    sheet.getRow(row).createCell(1).setCellValue(walletEntry.getReferenceType().toString());
769
                    sheet.getRow(row).createCell(1).setCellValue(walletEntry.getReferenceType().toString());
770
                    //Reference Id
770
                    //Reference Id
771
                    sheet.getRow(row).createCell(5).setCellValue(walletEntry.getReference());
771
                    sheet.getRow(row).createCell(2).setCellValue(walletEntry.getReference());
772
                    if (walletEntry.getAmount() > 0) {
772
                    if (walletEntry.getAmount() > 0) {
773
                        //Debit
773
                        //Debit
774
                        sheet.getRow(row).createCell(2).setCellValue(0);
774
                        sheet.getRow(row).createCell(3).setCellValue(0);
775
                        //Credit
775
                        //Credit
776
                        sheet.getRow(row).createCell(3).setCellValue(walletEntry.getAmount());
776
                        sheet.getRow(row).createCell(4).setCellValue(walletEntry.getAmount());
777
                        grandTotalCredit += walletEntry.getAmount();
777
                        grandTotalCredit += walletEntry.getAmount();
778
                    } else {
778
                    } else {
779
                        sheet.getRow(row).createCell(2).setCellValue(-walletEntry.getAmount());
779
                        sheet.getRow(row).createCell(3).setCellValue(-walletEntry.getAmount());
780
                        sheet.getRow(row).createCell(3).setCellValue(0);
780
                        sheet.getRow(row).createCell(4).setCellValue(0);
781
                        grandTotalDebit -= walletEntry.getAmount();
781
                        grandTotalDebit -= walletEntry.getAmount();
782
                    }
782
                    }
783
                    //Running balance
783
                    //Running balance
784
                    currentOpening += walletEntry.getAmount();
784
                    currentOpening += walletEntry.getAmount();
785
                    sheet.getRow(row).createCell(4).setCellValue(currentOpening);
785
                    sheet.getRow(row).createCell(5).setCellValue(currentOpening);
786
                    //Description
786
                    //Description
787
                    sheet.getRow(row).createCell(4).setCellValue(walletEntry.getDescription());
787
                    sheet.getRow(row).createCell(6).setCellValue(walletEntry.getDescription());
788
                    row++;
788
                    row++;
789
                }
789
                }
790
            }
790
            }
791
            List<StatementDetailModel> statementDetailModels = dateInvoiceMap.get(date);
791
            List<StatementDetailModel> statementDetailModels = dateInvoiceMap.get(date);
792
            LOGGER.info("statementDetailModels - {}", statementDetailModels);
792
            LOGGER.info("statementDetailModels - {}", statementDetailModels);
Line 796... Line 796...
796
                    dateCell.setCellValue(statementDetailModel.getOnDate());
796
                    dateCell.setCellValue(statementDetailModel.getOnDate());
797
                    dateCell.setCellStyle(dateStyle);
797
                    dateCell.setCellStyle(dateStyle);
798
                    //Transact Type
798
                    //Transact Type
799
                    sheet.getRow(row).createCell(1).setCellValue("BILLING");
799
                    sheet.getRow(row).createCell(1).setCellValue("BILLING");
800
                    //Transact Reference
800
                    //Transact Reference
801
                    sheet.getRow(row).createCell(5).setCellValue(statementDetailModel.getInvoiceNumber());
801
                    sheet.getRow(row).createCell(2).setCellValue(statementDetailModel.getInvoiceNumber());
802
                    if (statementDetailModel.getAmount() > 0) {
802
                    if (statementDetailModel.getAmount() > 0) {
803
                        sheet.getRow(row).createCell(2).setCellValue(statementDetailModel.getAmount());
803
                        sheet.getRow(row).createCell(3).setCellValue(statementDetailModel.getAmount());
804
                        sheet.getRow(row).createCell(3).setCellValue(0);
804
                        sheet.getRow(row).createCell(4).setCellValue(0);
805
                        grandTotalDebit += statementDetailModel.getAmount();
805
                        grandTotalDebit += statementDetailModel.getAmount();
806
                    } else {
806
                    } else {
807
                        sheet.getRow(row).createCell(2).setCellValue(0);
807
                        sheet.getRow(row).createCell(3).setCellValue(0);
808
                        sheet.getRow(row).createCell(3).setCellValue(-statementDetailModel.getAmount());
808
                        sheet.getRow(row).createCell(4).setCellValue(-statementDetailModel.getAmount());
809
                        grandTotalCredit += -statementDetailModel.getAmount();
809
                        grandTotalCredit += -statementDetailModel.getAmount();
810
                    }
810
                    }
811
                    //Running Balance
811
                    //Running Balance
812
                    currentOpening += statementDetailModel.getAmount();
812
                    currentOpening += statementDetailModel.getAmount();
-
 
813
                    sheet.getRow(row).createCell(5).setCellValue(statementDetailModel.getReferenceType());
813
 
814
 
814
 
815
 
815
                    //Narration
816
                    //Narration
816
                    sheet.getRow(row).createCell(4).setCellValue(statementDetailModel.getReferenceType());
817
                    sheet.getRow(row).createCell(6).setCellValue(statementDetailModel.getReferenceType());
817
 
818
 
818
                    row += 1;
819
                    row += 1;
819
                }
820
                }
820
            }
821
            }
821
            if (YearMonth.from(date).atEndOfMonth().equals(date)) {
822
            if (YearMonth.from(date).atEndOfMonth().equals(date)) {
Line 825... Line 826...
825
                        double cnAmount = creditNoteLineRepository.selectAllByCreditNote(creditNote.getId()).stream().collect(Collectors.summingDouble(x -> x.getAmount()));
826
                        double cnAmount = creditNoteLineRepository.selectAllByCreditNote(creditNote.getId()).stream().collect(Collectors.summingDouble(x -> x.getAmount()));
826
                        Cell dateCell = sheet.createRow(row).createCell(0);
827
                        Cell dateCell = sheet.createRow(row).createCell(0);
827
                        dateCell.setCellValue(new Date(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
828
                        dateCell.setCellValue(new Date(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
828
                        dateCell.setCellStyle(dateStyle);
829
                        dateCell.setCellStyle(dateStyle);
829
                        sheet.getRow(row).createCell(1).setCellValue("CREDIT NOTE");
830
                        sheet.getRow(row).createCell(1).setCellValue("CREDIT NOTE");
830
                        sheet.getRow(row).createCell(5).setCellValue(creditNote.getCreditNoteNumber());
831
                        sheet.getRow(row).createCell(2).setCellValue(creditNote.getCreditNoteNumber());
831
                        if (cnAmount > 0) {
832
                        if (cnAmount > 0) {
832
                            sheet.getRow(row).createCell(2).setCellValue(0);
833
                            sheet.getRow(row).createCell(3).setCellValue(0);
833
                            sheet.getRow(row).createCell(3).setCellValue(cnAmount);
834
                            sheet.getRow(row).createCell(4).setCellValue(cnAmount);
834
                            grandTotalCredit += cnAmount;
835
                            grandTotalCredit += cnAmount;
835
                        } else {
836
                        } else {
836
                            sheet.getRow(row).createCell(2).setCellValue(-cnAmount);
837
                            sheet.getRow(row).createCell(3).setCellValue(-cnAmount);
837
                            sheet.getRow(row).createCell(3).setCellValue(0);
838
                            sheet.getRow(row).createCell(4).setCellValue(0);
838
                            grandTotalDebit += -cnAmount;
839
                            grandTotalDebit += -cnAmount;
839
                        }
840
                        }
840
                        //Running balance
841
                        //Running balance
841
                        currentOpening += cnAmount;
842
                        currentOpening += cnAmount;
842
                        sheet.getRow(row).createCell(4).setCellValue(currentOpening);
843
                        sheet.getRow(row).createCell(5).setCellValue(currentOpening);
843
                        //Narration
844
                        //Narration
844
                        sheet.getRow(row).createCell(4).setCellValue("Credit Note Issued");
845
                        sheet.getRow(row).createCell(6).setCellValue("Credit Note Issued");
845
 
846
 
846
                        row += 1;
847
                        row += 1;
847
                    }
848
                    }
848
                }
849
                }
849
            }
850
            }