- - PR -
CSV
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2006-02-28 16:46
private void genCSV(String memcd, String yearmonth) {
try { SessionManager sessionManager = new SessionManager(); ServletContext cxt = sessionManager.obtainSession().getServletContext(); String path = ""; String fileName = ""; File file; path = cxt.getRealPath("/" + memcd + yearmonth + ".csv"); file = new File(path); fileName = file.getCanonicalPath(); String str1 = ""; String str2 = ""; String str3 = ""; String str4 = ""; String str5 = ""; String str6 = ""; String str7 = ""; String str8 = ""; String str9 = ""; String str10 = ""; PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileName))); out.println("年月" + "," + "日" + "," + "曜日" + "," + "社員コード" + "," + "氏名" + "," + "部課" + "," + "出勤種別名" + "," + "実働時間" + "," + "超過時間" + "," + "深夜超過時間"); for (int i = 0; i < this.approveList.size(); i++) { this.approve = new Geppou(); this.approve = (Geppou) this.approveList.get(i); if(i != (this.approveList.size()-1)) { str1 = yearmonth; str2 = this.approve.getDate(); str3 = this.approve.getYoubi(); str4 = memcd; str5 = this.memName; str6 = this.depShname; str7 = this.approve.getWorkType(); str8 = this.approve.getWorkTime(); str9 = this.approve.getOverTime(); str10 = this.approve.getNoverTime(); } else { str1 = ""; str2 = this.approve.getDate(); str3 = ""; str4 = ""; str5 = ""; str6 = ""; str7 = ""; str8 = this.approve.getWorkTime(); str9 = this.approve.getOverTime(); str10 = this.approve.getNoverTime(); } out.println(str1 + "," + str2 + "," + str3 + "," + str4 + "," + str5 + "," + str6 + "," + str7 + "," + str8 + "," + str9 + "," + str10); } out.close(); } catch (EOFException e) { e.printStackTrace(); this.log.error(e.getMessage()); } catch (IOException e1) { e1.printStackTrace(); this.log.error(e1.getMessage()); } catch (Exception e2) { e2.printStackTrace(); this.log.error(e2.getMessage()); } } |
1