Subversion Repositories SmartDukaan

Rev

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

Rev 734 Rev 744
Line 116... Line 116...
116
		    contentRow.createCell(1).setCellValue(order.getAirwaybill_no());
116
		    contentRow.createCell(1).setCellValue(order.getAirwaybill_no());
117
		    Cell awbDateCell = contentRow.createCell(2);
117
		    Cell awbDateCell = contentRow.createCell(2);
118
		    awbDateCell.setCellValue(awbDate);
118
		    awbDateCell.setCellValue(awbDate);
119
		    awbDateCell.setCellStyle(dateCellStyle);		    
119
		    awbDateCell.setCellStyle(dateCellStyle);		    
120
		    contentRow.createCell(3).setCellValue(order.getId());
120
		    contentRow.createCell(3).setCellValue(order.getId());
121
		    contentRow.createCell(4).setCellValue(order.getCustomer_name());
121
		    contentRow.createCell(4).setCellValue(getValueForEmptyString(order.getCustomer_name()));
122
		    contentRow.createCell(5).setCellValue(order.getCustomer_address1());
122
		    contentRow.createCell(5).setCellValue(getValueForEmptyString(order.getCustomer_address1()));
123
		    contentRow.createCell(6).setCellValue(order.getCustomer_address2());
123
		    contentRow.createCell(6).setCellValue(getValueForEmptyString(order.getCustomer_address2()));
124
		    contentRow.createCell(7).setCellValue(order.getCustomer_city());
124
		    contentRow.createCell(7).setCellValue(getValueForEmptyString(order.getCustomer_city()));
125
		    contentRow.createCell(8).setCellValue(order.getCustomer_state());
125
		    contentRow.createCell(8).setCellValue(getValueForEmptyString(order.getCustomer_state()));
126
		    contentRow.createCell(9).setCellValue(order.getCustomer_pincode());
126
		    contentRow.createCell(9).setCellValue(getValueForEmptyString(order.getCustomer_pincode()));
127
		    contentRow.createCell(10).setCellValue(order.getCustomer_mobilenumber());
127
		    contentRow.createCell(10).setCellValue(getValueForEmptyString(order.getCustomer_mobilenumber()));
128
		    contentRow.createCell(11).setCellValue("-");
128
		    contentRow.createCell(11).setCellValue("-");
129
		    contentRow.createCell(12).setCellValue("Prepaid");
129
		    contentRow.createCell(12).setCellValue("Prepaid");
130
		    contentRow.createCell(13).setCellValue(0);
130
		    contentRow.createCell(13).setCellValue(0);
131
		    List<LineItem> lineItems = order.getLineitems();
131
		    List<LineItem> lineItems = order.getLineitems();
132
		    LineItem lineItem = lineItems.get(0);
132
		    LineItem lineItem = lineItems.get(0);
133
		    contentRow.createCell(14).setCellValue(lineItem.getTotal_price());
133
		    contentRow.createCell(14).setCellValue(order.getTotal_amount());
134
		    contentRow.createCell(15).setCellValue(lineItem.getId());
134
		    contentRow.createCell(15).setCellValue(lineItem.getId());
135
		    Cell weightCell = contentRow.createCell(16);
135
		    Cell weightCell = contentRow.createCell(16);
136
		    weightCell.setCellValue(lineItem.getTotal_weight()/1000.0);
136
		    weightCell.setCellValue(lineItem.getTotal_weight()/1000.0);
137
		    weightCell.setCellStyle(weightStyle);
137
		    weightCell.setCellStyle(weightStyle);
138
		    contentRow.createCell(17).setCellValue(lineItem.getBrand() + " " + lineItem.getModel_number() + " " + lineItem.getModel_name() + " " + lineItem.getColor());
138
		    contentRow.createCell(17).setCellValue(lineItem.getBrand() + " " + lineItem.getModel_number() + " " + lineItem.getModel_name() + " " + lineItem.getColor());
Line 149... Line 149...
149
			e.printStackTrace();
149
			e.printStackTrace();
150
		}
150
		}
151
		
151
		
152
		return baosXLS;
152
		return baosXLS;
153
	}
153
	}
-
 
154
	
-
 
155
	private String getValueForEmptyString(String s){
-
 
156
		if(s==null || s.equals(""))
-
 
157
			return "-";
-
 
158
		else
-
 
159
			return s; 
-
 
160
	}
-
 
161
	
154
	/**
162
	/**
155
	 * @param args
163
	 * @param args
156
	 */
164
	 */
157
	public static void main(String[] args) {
165
	public static void main(String[] args) {
158
		System.out.println("Hey There");
166
		System.out.println("Hey There");
159
		CourierDetailsGenerator g = new CourierDetailsGenerator();
167
		CourierDetailsGenerator g = new CourierDetailsGenerator();
160
		try {
168
		try {
161
			FileOutputStream f = new FileOutputStream("/home/ashish/work/repo/Support/workbook.xls");
169
			FileOutputStream f = new FileOutputStream("/home/ashish/Downloads/courier-details.xls");
162
			ByteArrayOutputStream baosXLS = g.generateCourierDetails(1, 1);
170
			ByteArrayOutputStream baosXLS = g.generateCourierDetails(1, 1);
163
			baosXLS.writeTo(f);
171
			baosXLS.writeTo(f);
164
			f.close();
172
			f.close();
165
		} catch (FileNotFoundException e) {
173
		} catch (FileNotFoundException e) {
166
			// TODO Auto-generated catch block
174
			// TODO Auto-generated catch block
167
			e.printStackTrace();
175
			e.printStackTrace();
168
		} catch (IOException e) {
176
		} catch (IOException e) {
169
			// TODO Auto-generated catch block
177
			// TODO Auto-generated catch block
170
			e.printStackTrace();
178
			e.printStackTrace();
171
		}
179
		}
172
		
-
 
173
		System.out.println("Ok something ought to happen");
180
		System.out.println("Successfully generated the detailed courier report");
174
	}
181
	}
175
 
182
 
176
}
183
}