Subversion Repositories SmartDukaan

Rev

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

Rev 21965 Rev 22025
Line 66... Line 66...
66
            paragraphTitle.setAlignment(Element.ALIGN_CENTER);
66
            paragraphTitle.setAlignment(Element.ALIGN_CENTER);
67
            
67
            
68
            PdfPCell blankCell = new PdfPCell();
68
            PdfPCell blankCell = new PdfPCell();
69
            blankCell.setBorder(Rectangle.NO_BORDER);
69
            blankCell.setBorder(Rectangle.NO_BORDER);
70
            PdfPTable tableCustomerRetailer = new PdfPTable(3);
70
            PdfPTable tableCustomerRetailer = new PdfPTable(3);
-
 
71
            tableCustomerRetailer.setWidthPercentage(90);
71
            tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
72
            tableCustomerRetailer.getDefaultCell().setBorder(Rectangle.NO_BORDER);
72
            PdfPCell columnCustomerInfo = new PdfPCell();
73
            PdfPCell columnCustomerInfo = new PdfPCell();
73
            columnCustomerInfo.addElement(new Paragraph(customer.getName(), FONT_NORMAL));
74
            columnCustomerInfo.addElement(new Paragraph(customer.getName(), FONT_NORMAL));
74
            columnCustomerInfo.addElement(new Paragraph(customer.getAddress().getLine1() + ", " + customer.getAddress().getLine2(), FONT_NORMAL));
75
            columnCustomerInfo.addElement(new Paragraph(customer.getAddress().getLine1() + ", " + customer.getAddress().getLine2(), FONT_NORMAL));
75
            columnCustomerInfo.addElement(new Paragraph(customer.getAddress().getCity() + ", " + customer.getAddress().getState() + "(" + customerAddressStateCode + ")" + "\n" + customer.getAddress().getPinCode(), FONT_NORMAL));
76
            columnCustomerInfo.addElement(new Paragraph(customer.getAddress().getCity() + ", " + customer.getAddress().getState() + "(" + customerAddressStateCode + ")" + "\n" + customer.getAddress().getPinCode(), FONT_NORMAL));
Line 114... Line 115...
114
            if(gstWithInState){
115
            if(gstWithInState){
115
            	orders = new PdfPTable(8);
116
            	orders = new PdfPTable(8);
116
            }else{
117
            }else{
117
            	orders = new PdfPTable(10);
118
            	orders = new PdfPTable(10);
118
            }
119
            }
-
 
120
            orders.setWidthPercentage(90);
119
            //PdfPCell orderDetail = new PdfPCell(new Paragraph("Order Details:"));
121
            //PdfPCell orderDetail = new PdfPCell(new Paragraph("Order Details:"));
120
            /*PdfPTable ordersTable = new PdfPTable(8);
122
            /*PdfPTable ordersTable = new PdfPTable(8);
121
            PdfPCell srNo = new PdfPCell(new Paragraph("Sr No"));
123
            PdfPCell srNo = new PdfPCell(new Paragraph("Sr No"));
122
            PdfPCell description = new PdfPCell(new Paragraph("Description"));
124
            PdfPCell description = new PdfPCell(new Paragraph("Description"));
123
            PdfPCell quantity = new PdfPCell(new Paragraph("Quantity"));
125
            PdfPCell quantity = new PdfPCell(new Paragraph("Quantity"));
Line 135... Line 137...
135
            tax.setBorder(Rectangle.NO_BORDER);
137
            tax.setBorder(Rectangle.NO_BORDER);
136
            itemTotal.setBorder(Rectangle.NO_BORDER);*/
138
            itemTotal.setBorder(Rectangle.NO_BORDER);*/
137
            orders.addCell(new Paragraph("Sr No", FONT_BOLD));
139
            orders.addCell(new Paragraph("Sr No", FONT_BOLD));
138
            orders.addCell(new Paragraph("Description", FONT_BOLD));
140
            orders.addCell(new Paragraph("Description", FONT_BOLD));
139
            orders.addCell(new Paragraph("HSN Code", FONT_BOLD));
141
            orders.addCell(new Paragraph("HSN Code", FONT_BOLD));
140
            orders.addCell(new Paragraph("Quantity", FONT_BOLD));
142
            orders.addCell(new Paragraph("Qty", FONT_BOLD));
141
            orders.addCell(new Paragraph("Rate (Rs)", FONT_BOLD));
143
            orders.addCell(new Paragraph("Rate (Rs)", FONT_BOLD));
142
            orders.addCell(new Paragraph("Amount (Rs)", FONT_BOLD));
144
            orders.addCell(new Paragraph("Amount (Rs)", FONT_BOLD));
143
            if(gstWithInState){
145
            if(gstWithInState){
144
            	orders.addCell(new Paragraph("IGST Rate%", FONT_BOLD));
146
            	orders.addCell(new Paragraph("IGST Rate%", FONT_BOLD));
145
                orders.addCell(new Paragraph("IGST Amount", FONT_BOLD));
147
                orders.addCell(new Paragraph("IGST Amount", FONT_BOLD));
146
                orders.setWidths(new int[]{1, 3, 1, 1, 1, 1, 1, 1});
148
                //orders.setWidths(new float[]{1, 3, 1, 1, 1, 1, 1, 1});
-
 
149
                orders.setWidths(new float[]{.7f, 3, 1.2f, .7f, 1.1f, 1.1f, .9f, .9f});
147
            }else{
150
            }else{
148
            	orders.addCell(new Paragraph("CGST Rate%", FONT_BOLD));
151
            	orders.addCell(new Paragraph("CGST Rate%", FONT_BOLD));
149
                orders.addCell(new Paragraph("CGST Amount", FONT_BOLD));
152
                orders.addCell(new Paragraph("CGST Amount", FONT_BOLD));
150
                orders.addCell(new Paragraph("SGST Rate%", FONT_BOLD));
153
                orders.addCell(new Paragraph("SGST Rate%", FONT_BOLD));
151
                orders.addCell(new Paragraph("SGST Amount", FONT_BOLD));
154
                orders.addCell(new Paragraph("SGST Amount", FONT_BOLD));
152
                orders.setWidths(new int[]{1, 3, 1, 1, 1, 1, 1, 1, 1, 1});
155
                //orders.setWidths(new float[]{1, 3, 1, 1, 1, 1, 1, 1, 1, 1});
-
 
156
                orders.setWidths(new float[]{.7f, 3, 1.2f, .7f, 1.1f, 1.1f, .9f, .9f, .9f, .9f});
153
            }
157
            }
154
            
158
            
155
            //orders.addCell(new Paragraph("Item Total (Rs)", FONT_BOLD));
159
            //orders.addCell(new Paragraph("Item Total (Rs)", FONT_BOLD));
156
            
160
            
157
            orders.setHeaderRows(1);
161
            orders.setHeaderRows(1);
Line 162... Line 166...
162
        	for(CustomFofoOrderItem orderItem : orderItems){
166
        	for(CustomFofoOrderItem orderItem : orderItems){
163
            	orders.addCell(new Paragraph(String.valueOf(index++), FONT_NORMAL));
167
            	orders.addCell(new Paragraph(String.valueOf(index++), FONT_NORMAL));
164
            	orders.addCell(new Paragraph(orderItem.getDescription(), FONT_NORMAL));
168
            	orders.addCell(new Paragraph(orderItem.getDescription(), FONT_NORMAL));
165
            	orders.addCell(new Paragraph(orderItem.getHsnCode(), FONT_NORMAL));
169
            	orders.addCell(new Paragraph(orderItem.getHsnCode(), FONT_NORMAL));
166
            	orders.addCell(new Paragraph(String.valueOf(orderItem.getQuantity()), FONT_NORMAL));
170
            	orders.addCell(new Paragraph(String.valueOf(orderItem.getQuantity()), FONT_NORMAL));
167
            	orders.addCell(new Paragraph(String.valueOf(orderItem.getRate()), FONT_NORMAL));
171
            	orders.addCell(new Paragraph(String.format("%.2f", orderItem.getRate()), FONT_NORMAL));
168
            	orders.addCell(new Paragraph(String.format("%.2f", orderItem.getAmount()), FONT_NORMAL));
172
            	orders.addCell(new Paragraph(String.format("%.2f", orderItem.getAmount()), FONT_NORMAL));
169
            	if(gstWithInState){
173
            	if(gstWithInState){
170
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstRate()), FONT_NORMAL));
174
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstRate()), FONT_NORMAL));
171
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstAmount()), FONT_NORMAL));
175
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getIgstAmount()), FONT_NORMAL));
172
            		igstTotalAmount = igstTotalAmount + orderItem.getIgstAmount();
176
            		igstTotalAmount = igstTotalAmount + orderItem.getIgstAmount();
Line 176... Line 180...
176
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getSgstRate()), FONT_NORMAL));
180
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getSgstRate()), FONT_NORMAL));
177
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getSgstAmount()), FONT_NORMAL));
181
            		orders.addCell(new Paragraph(String.format("%.2f", orderItem.getSgstAmount()), FONT_NORMAL));
178
            		cgstTotalAmount = cgstTotalAmount + orderItem.getCgstAmount();
182
            		cgstTotalAmount = cgstTotalAmount + orderItem.getCgstAmount();
179
            		sgstTotalAmount = sgstTotalAmount + orderItem.getSgstAmount();
183
            		sgstTotalAmount = sgstTotalAmount + orderItem.getSgstAmount();
180
            	}
184
            	}
181
            	orders.addCell(new Paragraph(String.format("%.2f", orderItem.getItemTotal()), FONT_NORMAL));
185
            	//orders.addCell(new Paragraph(String.format("%.2f", orderItem.getItemTotal()), FONT_NORMAL));
182
            }
186
            }
183
            //orders.addCell("1");
187
            //orders.addCell("1");
184
            //orders.addCell("Sansui X71Activ Ta2s");
188
            //orders.addCell("Sansui X71Activ Ta2s");
185
            //orders.setHeaderRows(1);
189
            //orders.setHeaderRows(1);
186
            //orders.getDefaultCell().setBorder(Rectangle.NO_BORDER);
190
            //orders.getDefaultCell().setBorder(Rectangle.NO_BORDER);
Line 201... Line 205...
201
            
205
            
202
            
206
            
203
            PdfPTable gstTotalTable = null;
207
            PdfPTable gstTotalTable = null;
204
            if(gstWithInState){
208
            if(gstWithInState){
205
            	gstTotalTable = new PdfPTable(3);
209
            	gstTotalTable = new PdfPTable(3);
206
            	gstTotalTable.setWidths(new int[]{8, 1, 1});
210
            	gstTotalTable.setWidths(new float[]{8, .9f, .9f});
207
            }else{
211
            }else{
208
            	gstTotalTable = new PdfPTable(5);
212
            	gstTotalTable = new PdfPTable(5);
209
            	gstTotalTable.setWidths(new int[]{8, 1, 1, 1, 1});
213
            	gstTotalTable.setWidths(new float[]{8, .9f, .9f, .9f, .9f});
210
            }
214
            }
211
            
215
            gstTotalTable.setWidthPercentage(90);
212
            /*for(int i = 0; i < 6; i++){
216
            /*for(int i = 0; i < 6; i++){
213
            	grandTotalTable.addCell(new Paragraph());
217
            	grandTotalTable.addCell(new Paragraph());
214
            }*/
218
            }*/
215
            //PdfPCell grandTotalCell = new PdfPCell(new Paragraph("Grand total", fontBold));
219
            //PdfPCell grandTotalCell = new PdfPCell(new Paragraph("Grand total", fontBold));
216
            //grandTotalCell.setVerticalAlignment(Element.ALIGN_RIGHT);
220
            //grandTotalCell.setVerticalAlignment(Element.ALIGN_RIGHT);
Line 230... Line 234...
230
            //grandTotalCell.setColspan(6);
234
            //grandTotalCell.setColspan(6);
231
            document.add(gstTotalTable);
235
            document.add(gstTotalTable);
232
            
236
            
233
            PdfPTable grandTotalTable = new PdfPTable(3);
237
            PdfPTable grandTotalTable = new PdfPTable(3);
234
            if(gstWithInState){
238
            if(gstWithInState){
235
            	grandTotalTable.setWidths(new int[]{8, 1, 1});
239
            	grandTotalTable.setWidths(new float[]{8, .9f, .9f});
236
            }else{
240
            }else{
237
            	grandTotalTable.setWidths(new int[]{10, 1, 1});
241
            	grandTotalTable.setWidths(new float[]{10, .9f, .9f});
238
            }
242
            }
239
            
243
            grandTotalTable.setWidthPercentage(90);
240
            
244
            
241
            Paragraph grandTotalParagraph = new Paragraph("Grand total", FONT_BOLD);
245
            Paragraph grandTotalParagraph = new Paragraph("Grand total", FONT_BOLD);
242
            grandTotalParagraph.setIndentationRight(20);
246
            grandTotalParagraph.setIndentationRight(20);
243
            grandTotalTable.addCell(grandTotalParagraph);
247
            grandTotalTable.addCell(grandTotalParagraph);
244
            Paragraph rsParagraph = new Paragraph("Rs.", FONT_BOLD);
248
            Paragraph rsParagraph = new Paragraph("Rs.", FONT_BOLD);
Line 249... Line 253...
249
            
253
            
250
            document.add(grandTotalTable);
254
            document.add(grandTotalTable);
251
            
255
            
252
            PdfPTable amountInWordsTable = new PdfPTable(3);
256
            PdfPTable amountInWordsTable = new PdfPTable(3);
253
            if(gstWithInState){
257
            if(gstWithInState){
254
            	amountInWordsTable.setWidths(new int[]{1, 6, 3});
258
            	amountInWordsTable.setWidths(new float[]{2, 5, 2.7f});
255
            }else{
259
            }else{
256
            	amountInWordsTable.setWidths(new int[]{1, 8, 3});
260
            	amountInWordsTable.setWidths(new float[]{2, 7, 2.7f});
257
            }
261
            }
-
 
262
            amountInWordsTable.setWidthPercentage(90);
258
            amountInWordsTable.addCell(new Paragraph("Amount in Words:", FONT_BOLD));
263
            amountInWordsTable.addCell(new Paragraph("Amount in Words:", FONT_BOLD));
259
            
264
            
260
            String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
265
            String amountInWords = toAmountInWords(pdfModel.getTotalAmount());
261
           	amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
266
           	amountInWordsTable.addCell(new Paragraph(amountInWords.toString(), FONT_BOLD));
262
            amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
267
            amountInWordsTable.addCell(new Paragraph("E & O.E", FONT_NORMAL));
263
            document.add(amountInWordsTable);            
268
            document.add(amountInWordsTable);            
264
            
269
            
265
            Paragraph warningParagraph = new Paragraph("Goods once sold will not be taken back.\nThis is a Computer Generated Invoice.", FONT_NORMAL);
270
            Paragraph warningParagraph = new Paragraph("Goods once sold will not be taken back.\nThis is a Computer Generated Invoice.", FONT_NORMAL);
266
            warningParagraph.setIndentationLeft(50);
271
            warningParagraph.setIndentationLeft(40);
267
            document.add(Chunk.NEWLINE);
272
            document.add(Chunk.NEWLINE);
268
            document.add(warningParagraph);
273
            document.add(warningParagraph);
269
            document.add(Chunk.NEWLINE);
274
            document.add(Chunk.NEWLINE);
270
            document.add(Chunk.NEWLINE);
275
            document.add(Chunk.NEWLINE);
271
            
276
            
272
            PdfPTable itemSerialNumbers = new PdfPTable(2);
277
            PdfPTable itemSerialNumbers = new PdfPTable(2);
-
 
278
            itemSerialNumbers.setWidthPercentage(90);
273
            itemSerialNumbers.addCell(new Paragraph("Item Name", FONT_BOLD));
279
            itemSerialNumbers.addCell(new Paragraph("Item Name", FONT_BOLD));
274
            itemSerialNumbers.addCell(new Paragraph("Serial Number", FONT_BOLD));
280
            itemSerialNumbers.addCell(new Paragraph("Serial Number", FONT_BOLD));
275
            itemSerialNumbers.setHeaderRows(1);
281
            itemSerialNumbers.setHeaderRows(1);
276
            
282
            
277
            for(CustomFofoOrderItem orderItem : orderItems){
283
            for(CustomFofoOrderItem orderItem : orderItems){