Subversion Repositories SmartDukaan

Rev

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

Rev 2008 Rev 2011
Line 52... Line 52...
52
		CUSTOMER_NAME(2),
52
		CUSTOMER_NAME(2),
53
		BRAND(3),
53
		BRAND(3),
54
		MODEL_NAME(4),
54
		MODEL_NAME(4),
55
		MODEL_NUMBER(5),
55
		MODEL_NUMBER(5),
56
		COLOR(6),
56
		COLOR(6),
57
		XFER_PRICE(7);
57
		XFER_PRICE(7),
-
 
58
		SELLING_PRICE(8);
58
		
59
		
59
		private int value;
60
		private int value;
60
		
61
		
61
		ReportColumn(int value) {
62
		ReportColumn(int value) {
62
			this.value = value;
63
			this.value = value;
Line 173... Line 174...
173
	    headerRow.createCell(ReportColumn.BRAND.getValue()).setCellValue("Brand");
174
	    headerRow.createCell(ReportColumn.BRAND.getValue()).setCellValue("Brand");
174
	    headerRow.createCell(ReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
175
	    headerRow.createCell(ReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
175
	    headerRow.createCell(ReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
176
	    headerRow.createCell(ReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
176
	    headerRow.createCell(ReportColumn.COLOR.getValue()).setCellValue("Color");
177
	    headerRow.createCell(ReportColumn.COLOR.getValue()).setCellValue("Color");
177
	    headerRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
178
	    headerRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
-
 
179
	    headerRow.createCell(ReportColumn.SELLING_PRICE.getValue()).setCellValue("Selling Price");
178
 
180
 
179
	    double totalTransferPrice = 0.0;
181
	    double totalTransferPrice = 0.0;
-
 
182
	    double totalSellingPrice = 0.0;
180
	    
183
	    
181
	    for(int i = 0; i < orders.size(); i ++)	{
184
	    for(int i = 0; i < orders.size(); i ++)	{
182
	    	Order order = orders.get(i);
185
	    	Order order = orders.get(i);
183
			serialNo ++;
186
			serialNo ++;
184
	    	Row contentRow = sheet.createRow(serialNo);
187
	    	Row contentRow = sheet.createRow(serialNo);
185
		    
188
		    
186
		    LineItem lineItem = order.getLineitems().get(0);
189
		    LineItem lineItem = order.getLineitems().get(0);
187
		    double transferPrice = lineItem.getTransfer_price();
190
		    double transferPrice = lineItem.getTransfer_price();
188
		    totalTransferPrice += transferPrice;
191
		    totalTransferPrice += transferPrice;
189
 
192
 
-
 
193
                    double sellingPrice = lineItem.getTotal_price();
-
 
194
                    totalSellingPrice += sellingPrice;
-
 
195
 
190
		    contentRow.createCell(ReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
196
		    contentRow.createCell(ReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
191
		    contentRow.createCell(ReportColumn.BILLING_DATE.getValue()).setCellValue(dateFormat.format(new Date(order.getBilling_timestamp())));
197
		    contentRow.createCell(ReportColumn.BILLING_DATE.getValue()).setCellValue(dateFormat.format(new Date(order.getBilling_timestamp())));
192
		    contentRow.createCell(ReportColumn.CUSTOMER_NAME.getValue()).setCellValue(order.getCustomer_name());
198
		    contentRow.createCell(ReportColumn.CUSTOMER_NAME.getValue()).setCellValue(order.getCustomer_name());
193
		    contentRow.createCell(ReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
199
		    contentRow.createCell(ReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
194
		    contentRow.createCell(ReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
200
		    contentRow.createCell(ReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
195
		    contentRow.createCell(ReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
201
		    contentRow.createCell(ReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
196
		    contentRow.createCell(ReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
202
		    contentRow.createCell(ReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
197
		    contentRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
203
		    contentRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
-
 
204
		    contentRow.createCell(ReportColumn.SELLING_PRICE.getValue()).setCellValue(sellingPrice);
198
	    }
205
	    }
199
	    sheet.createRow(serialNo ++);
206
	    sheet.createRow(serialNo ++);
200
    	Row contentRow = sheet.createRow(serialNo);
207
    	Row contentRow = sheet.createRow(serialNo);
201
    	contentRow.createCell(0).setCellValue("Total Transfer Price");
208
    	contentRow.createCell(0).setCellValue("Total Transfer Price");
202
    	contentRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
209
    	contentRow.createCell(ReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
-
 
210
    	contentRow.createCell(ReportColumn.SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
203
    	sheet.addMergedRegion(new CellRangeAddress(serialNo, serialNo, 0, 5));
211
    	sheet.addMergedRegion(new CellRangeAddress(serialNo, serialNo, 0, 5));
204
    	
212
    	
205
		// Write the workbook to the output stream
213
		// Write the workbook to the output stream
206
		try {
214
		try {
207
			wb.write(baosXLS);
215
			wb.write(baosXLS);
Line 241... Line 249...
241
		int year = date.get(Calendar.YEAR);
249
		int year = date.get(Calendar.YEAR);
242
		int month = date.get(Calendar.MONTH) +1;
250
		int month = date.get(Calendar.MONTH) +1;
243
		int day = date.get(Calendar.DAY_OF_MONTH);
251
		int day = date.get(Calendar.DAY_OF_MONTH);
244
		return "" + year + "." + month + "." + day;
252
		return "" + year + "." + month + "." + day;
245
	}
253
	}
246
}
-
 
247
254
}
-
 
255