public static String getP2013(String track_no) throws Exception { String ret = ""; DB db = new DB(); try { String sql = ""; sql += " select pke_arrest.getExhibitDesc(aae.id) exhibit_desc "; sql += " from application_arrest_exhibit aae "; sql += " where aae.track_no='" + track_no + "' "; ApplicationArrestExhibit aae = new ApplicationArrestExhibit(db); List<Map<String, Object>> cList = aae.findBySql(sql); if (cList != null && cList.size() > 0) { for (int i = 0; i < cList.size(); i++) { if (ret.equals("")) ret = "1. " + cList.get(i).get("exhibit_desc").toString(); else ret += "\n" + (i + 1) + ". " + cList.get(i).get("exhibit_desc").toString(); } } } catch (Exception e) { e.printStackTrace(); } finally { db.closedb(); } return ret; }
public static String getP2010(String trackno, String colNo) throws Exception { String ret = ""; DB db = new DB(); try { String str = ""; str += " select aae.track_no, nvl(aae.product_name, nvl(p.product_name,dt.duty_name)) product_name, "; str += " nvl(aae.brand_name, nvl(b.brand_main_thai,b.brand_main_eng)) brand_name," + "\n"; str += " aae.qty || ' ' || nvl(aae.qty_unit_name, u.thname) qty_desc, aae.qty, aae.remarks, nvl(aae.qty_unit_name,u.thname) qty_unit_name, "; str += " nvl(aae.sizes_desc,sp.size_desc) || ' ' || nvl(aae.sizes_unit_name, us.thname) sizes_desc,"; str += " trim(to_char(aae.netweight,'999G999G999G999D000')) || ' ' || nvl(aae.netweight_unit_name,uw.thname) netweight_desc"; str += " from application_arrest_exhibit aae"; str += " left join product p on p.product_code=aae.product_code"; str += " left join brand_main b on b.brand_main_code=aae.brand_code and aae.group_id = b.group_id"; str += " left join unit u on u.unit_code=aae.qty_unit_code "; str += " left join duty_table dt on dt.duty_code=aae.duty_code "; str += " left join size_package sp on sp.size_code=aae.sizes_code and sp.group_id=aae.group_id "; str += " left join unit us on us.unit_code=aae.size_unit_code"; str += " left join unit uw on uw.unit_code=aae.netweight_unit_code"; str += " where aae.track_no = '" + trackno + "'"; str += " order by aae.id"; ApplicationArrestExhibit aae = new ApplicationArrestExhibit(db); List<Map<String, Object>> aList = aae.findBySql(str); if (aList != null && aList.size() > 0) { String seq = ""; String productName = ""; String qty_desc = ""; String remarks = ""; for (int i = 0; i < aList.size(); i++) { Map<String, Object> data = aList.get(i); if (i == 0) { seq = "1"; productName = (data.get("product_name") != null ? data.get("product_name").toString() : ""); productName += (data.get("brand_name") != null ? " ยี่ห้อ " + data.get("brand_name").toString() : ""); productName += (data.get("sizes_desc") != null ? " ขนาดบรรจุ " + data.get("sizes_desc").toString() : ""); qty_desc = (data.get("qty") != null ? NumberUtil.getNumberFormat(new Double(data.get("qty").toString()), 0, "") : ""); qty_desc += (data.get("qty_unit_name") != null ? " " + data.get("qty_unit_name").toString() : ""); remarks = (data.get("netweight_desc") != null ? data.get("netweight_desc").toString() : ""); } else { seq += "\n" + (i + 1); productName += "\n" + (data.get("product_name") != null ? data.get("product_name").toString() : ""); productName += (data.get("brand_name") != null ? " ยี่ห้อ " + data.get("brand_name").toString() : ""); productName += (data.get("sizes_desc") != null ? " ขนาดบรรจุ " + data.get("sizes_desc").toString() : ""); qty_desc += "\n" + (data.get("qty") != null ? NumberUtil.getNumberFormat(new Double(data.get("qty").toString()), 0, "") : ""); qty_desc += (data.get("qty_unit_name") != null ? " " + data.get("qty_unit_name").toString() : ""); remarks += "\n" + (data.get("netweight_desc") != null ? data.get("netweight_desc").toString() : ""); } } if (colNo.equals("1")) { ret = seq; } else if (colNo.equals("2")) { ret = productName; } else if (colNo.equals("3")) { ret = qty_desc; } else if (colNo.equals("4")) { ret = remarks; } } } catch (Exception e) { e.printStackTrace(); } finally { db.closedb(); } return ret; }