Subversion Repositories SmartDukaan

Rev

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

Rev 36116 Rev 36119
Line 722... Line 722...
722
                    msAddDataCell(itemTable, orderItem.getDescription(),                 Element.ALIGN_LEFT,   false, false);
722
                    msAddDataCell(itemTable, orderItem.getDescription(),                 Element.ALIGN_LEFT,   false, false);
723
                    msAddDataCell(itemTable, orderItem.getHsnCode(),                     Element.ALIGN_CENTER, false, false);
723
                    msAddDataCell(itemTable, orderItem.getHsnCode(),                     Element.ALIGN_CENTER, false, false);
724
                    msAddDataCell(itemTable, String.valueOf(orderItem.getQuantity()),     Element.ALIGN_CENTER, false, false);
724
                    msAddDataCell(itemTable, String.valueOf(orderItem.getQuantity()),     Element.ALIGN_CENTER, false, false);
725
 
725
 
726
                    if (isMargin) {
726
                    if (isMargin) {
727
                        float grossSaleValue = orderItem.getNetAmount() - taxAmount;
727
                        float grossSaleTotal = orderItem.getNetAmount() - taxAmount;
-
 
728
                        float grossSalePerUnit = grossSaleTotal / orderItem.getQuantity();
728
                        msAddDataCell(itemTable, String.format("%.2f", grossSaleValue),          Element.ALIGN_RIGHT, false, false);
729
                        msAddDataCell(itemTable, String.format("%.2f", grossSalePerUnit),        Element.ALIGN_RIGHT, false, false);
729
                        totalGrossSale += grossSaleValue;
730
                        totalGrossSale += grossSaleTotal;
730
                    } else {
731
                    } else {
731
                        msAddDataCell(itemTable, String.format("%.2f", orderItem.getRate()),      Element.ALIGN_RIGHT, false, false);
732
                        msAddDataCell(itemTable, String.format("%.2f", orderItem.getRate()),      Element.ALIGN_RIGHT, false, false);
732
                    }
733
                    }
733
                    totalNetAmount += orderItem.getNetAmount();
734
                    totalNetAmount += orderItem.getNetAmount();
734
                    msAddDataCell(itemTable, String.format("%.2f", orderItem.getAmount()),        Element.ALIGN_RIGHT, false, false);
735
                    msAddDataCell(itemTable, String.format("%.2f", orderItem.getAmount()),        Element.ALIGN_RIGHT, false, false);
Line 815... Line 816...
815
                }
816
                }
816
                msAddSummaryRow(sumTable, "Total Invoice Value", String.format("Rs. %.2f", totalInvoiceValue), true);
817
                msAddSummaryRow(sumTable, "Total Invoice Value", String.format("Rs. %.2f", totalInvoiceValue), true);
817
                summaryCell.addElement(sumTable);
818
                summaryCell.addElement(sumTable);
818
                bottomTable.addCell(summaryCell);
819
                bottomTable.addCell(summaryCell);
819
 
820
 
820
                // Row 2: empty (left) + Amount in words (right)
821
                // Row 2: empty (left) + Amount in words (right) — no gap
821
                PdfPCell emptyLeft = new PdfPCell(new Phrase("", MS_NORMAL));
822
                PdfPCell emptyLeft = new PdfPCell(new Phrase("", MS_NORMAL));
822
                emptyLeft.setBorder(Rectangle.NO_BORDER);
823
                emptyLeft.setBorder(Rectangle.NO_BORDER);
-
 
824
                emptyLeft.setPadding(0f);
-
 
825
                emptyLeft.setFixedHeight(0.1f);
823
                bottomTable.addCell(emptyLeft);
826
                bottomTable.addCell(emptyLeft);
824
                PdfPCell wordsCell = new PdfPCell(new Phrase(toAmountInWords(totalInvoiceValue), MS_ITALIC));
827
                PdfPCell wordsCell = new PdfPCell(new Phrase(toAmountInWords(totalInvoiceValue), MS_ITALIC));
825
                wordsCell.setBorder(Rectangle.BOX);
828
                wordsCell.setBorder(Rectangle.BOX);
826
                wordsCell.setBorderColor(MS_BORDER);
829
                wordsCell.setBorderColor(MS_BORDER);
827
                wordsCell.setPadding(5f);
830
                wordsCell.setPadding(4f);
828
                wordsCell.setBackgroundColor(MS_TOTAL_BG);
831
                wordsCell.setBackgroundColor(MS_TOTAL_BG);
829
                bottomTable.addCell(wordsCell);
832
                bottomTable.addCell(wordsCell);
830
 
833
 
831
                document.add(bottomTable);
834
                document.add(bottomTable);
832
 
835