Subversion Repositories SmartDukaan

Rev

Rev 35028 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35028 Rev 35799
Line 65... Line 65...
65
        lines.add(rightPad("Item", descWidthForHeader) + hdrTrailer);
65
        lines.add(rightPad("Item", descWidthForHeader) + hdrTrailer);
66
        lines.add(repeat('-', lineWidth));
66
        lines.add(repeat('-', lineWidth));
67
 
67
 
68
        // ===== ITEMS =====
68
        // ===== ITEMS =====
69
        if (invoice.getOrderItems() != null) {
69
        if (invoice.getOrderItems() != null) {
-
 
70
            boolean marginSeparatorAdded = false;
70
            for (CustomOrderItem item : invoice.getOrderItems()) {
71
            for (CustomOrderItem item : invoice.getOrderItems()) {
-
 
72
                if (item != null && item.isMarginScheme() && !marginSeparatorAdded) {
-
 
73
                    lines.add(repeat('-', lineWidth));
-
 
74
                    lines.add(center("Margin Scheme - Rule 32(5)", lineWidth));
-
 
75
                    lines.add(repeat('-', lineWidth));
-
 
76
                    marginSeparatorAdded = true;
-
 
77
                }
71
                lines.addAll(formatItem(item, lineWidth));
78
                lines.addAll(formatItem(item, lineWidth));
72
            }
79
            }
73
        }
80
        }
74
        lines.add(repeat('-', lineWidth));
81
        lines.add(repeat('-', lineWidth));
75
 
82
 
Line 83... Line 90...
83
            for (String t : invoice.getTncs()) {
90
            for (String t : invoice.getTncs()) {
84
                lines.addAll(wrapWords(safe(t), lineWidth));
91
                lines.addAll(wrapWords(safe(t), lineWidth));
85
            }
92
            }
86
        }
93
        }
87
 
94
 
-
 
95
        // ===== MARGIN SCHEME DECLARATION =====
-
 
96
        if (invoice.isHasMarginSchemeItems() && invoice.getMarginSchemeDeclarations() != null
-
 
97
                && !invoice.getMarginSchemeDeclarations().isEmpty()) {
-
 
98
            lines.add(repeat('-', lineWidth));
-
 
99
            lines.add("Margin Scheme Declaration:");
-
 
100
            for (String decl : invoice.getMarginSchemeDeclarations()) {
-
 
101
                lines.addAll(wrapWords("- " + safe(decl), lineWidth));
-
 
102
            }
-
 
103
        }
-
 
104
 
88
        lines.add(center("Thank you! Visit again", lineWidth));
105
        lines.add(center("Thank you! Visit again", lineWidth));
89
        // Writer writes into the provided baos
106
        // Writer writes into the provided baos
90
        Document document = new Document();
107
        Document document = new Document();
91
 
108
 
92
        // Create PdfWriter that writes into baos
109
        // Create PdfWriter that writes into baos
Line 166... Line 183...
166
 
183
 
167
        if (safeFloat(item.getDiscount()) > 0.0f) {
184
        if (safeFloat(item.getDiscount()) > 0.0f) {
168
            out.add("   Disc: " + formatAmount(item.getDiscount()));
185
            out.add("   Disc: " + formatAmount(item.getDiscount()));
169
        }
186
        }
170
 
187
 
-
 
188
        if (item.isMarginScheme()) {
-
 
189
            out.add("   Purchase Price: " + formatAmount(item.getPurchasePrice()));
-
 
190
            out.add("   Selling Price : " + formatAmount(item.getSellingPrice()));
-
 
191
            out.add("   Margin (Taxable): " + formatAmount(item.getMargin()));
-
 
192
        }
-
 
193
 
171
        return out;
194
        return out;
172
    }
195
    }
173
 
196
 
174
// ===== Printing =====
197
// ===== Printing =====
175
 
198