/** Descripción de Método */ private void cmd_translate() { ArrayList list = new ArrayList(); ValueNamePair pp = null; String sql = "SELECT Name, AD_Language FROM AD_Language WHERE IsSystemLanguage='Y' ORDER BY 1"; try { PreparedStatement pstmt = DB.prepareStatement(sql); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { list.add(new ValueNamePair(rs.getString(2), rs.getString(1))); } rs.close(); pstmt.close(); } catch (SQLException e) { log.log(Level.SEVERE, "", e); } if (list.size() == 0) { ADialog.warn(m_WindowNo, this, "NoTranslation"); return; } // Dialog String title = Msg.getMsg(Env.getCtx(), "PrintFormatTrl", true); String message = Msg.getMsg(Env.getCtx(), "PrintFormatTrl", false); int choice = JOptionPane.showOptionDialog( this, message, title, JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE, null, list.toArray(), null); if (choice == JOptionPane.CLOSED_OPTION) { return; } // pp = (ValueNamePair) list.get(choice); String AD_Language = pp.getValue(); int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().getID(); log.config(AD_Language + " - AD_PrintFormat_ID=" + AD_PrintFormat_ID); StringBuffer sb = new StringBuffer(); // English if (Language.isBaseLanguage(AD_Language)) { sb.append( "UPDATE AD_PrintFormatItem pfi " + "SET Name = (SELECT e.Name FROM AD_Element e, AD_Column c" + " WHERE e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID)," + "PrintName = (SELECT e.PrintName FROM AD_Element e, AD_Column c" + " WHERE e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID) " + "WHERE AD_PrintFormat_ID=") .append(AD_PrintFormat_ID) .append( " AND EXISTS (SELECT * FROM AD_Element e, AD_Column c" + " WHERE e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID)"); } else { AD_Language = "'" + AD_Language + "'"; sb.append( "UPDATE AD_PrintFormatItem pfi " + "SET Name = (SELECT e.Name FROM AD_Element_Trl e, AD_Column c" + " WHERE e.AD_Language=") .append(AD_Language) .append( " AND e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID), " + "PrintName = (SELECT e.PrintName FROM AD_Element_Trl e, AD_Column c" + " WHERE e.AD_Language=") .append(AD_Language) .append( " AND e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID) " + "WHERE AD_PrintFormat_ID=") .append(AD_PrintFormat_ID) .append( " AND EXISTS (SELECT * FROM AD_Element_Trl e, AD_Column c" + " WHERE e.AD_Language=") .append(AD_Language) .append(" AND e.AD_Element_ID=c.AD_Element_ID AND c.AD_Column_ID=pfi.AD_Column_ID)"); } int count = DB.executeUpdate(sb.toString()); log.config("Count=" + count); // m_reportEngine.setPrintFormat(MPrintFormat.get(Env.getCtx(), AD_PrintFormat_ID, true)); revalidate(); } // cmd_translate
/** Descripción de Método */ private void setStartEndDate() { GregorianCalendar cal = new GregorianCalendar(Language.getLoginLanguage().getLocale()); cal.setTimeInMillis(p_StartDate.getTime()); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); // Yearly if (MCommission.FREQUENCYTYPE_Yearly.equals(m_com.getFrequencyType())) { cal.set(Calendar.DAY_OF_YEAR, 1); p_StartDate = new Timestamp(cal.getTimeInMillis()); // cal.add(Calendar.YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, -1); m_EndDate = new Timestamp(cal.getTimeInMillis()); } // Quarterly else if (MCommission.FREQUENCYTYPE_Quarterly.equals(m_com.getFrequencyType())) { cal.set(Calendar.DAY_OF_MONTH, 1); int month = cal.get(Calendar.MONTH); if (month < Calendar.APRIL) { cal.set(Calendar.MONTH, Calendar.JANUARY); } else if (month < Calendar.JULY) { cal.set(Calendar.MONTH, Calendar.APRIL); } else if (month < Calendar.OCTOBER) { cal.set(Calendar.MONTH, Calendar.JULY); } else { cal.set(Calendar.MONTH, Calendar.OCTOBER); } p_StartDate = new Timestamp(cal.getTimeInMillis()); // cal.add(Calendar.MONTH, 3); cal.add(Calendar.DAY_OF_YEAR, -1); m_EndDate = new Timestamp(cal.getTimeInMillis()); } // Weekly else if (MCommission.FREQUENCYTYPE_Weekly.equals(m_com.getFrequencyType())) { cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); p_StartDate = new Timestamp(cal.getTimeInMillis()); // cal.add(Calendar.DAY_OF_YEAR, 7); m_EndDate = new Timestamp(cal.getTimeInMillis()); } // Monthly else { cal.set(Calendar.DAY_OF_MONTH, 1); p_StartDate = new Timestamp(cal.getTimeInMillis()); // cal.add(Calendar.MONTH, 1); cal.add(Calendar.DAY_OF_YEAR, -1); m_EndDate = new Timestamp(cal.getTimeInMillis()); } log.fine("setStartEndDate = " + p_StartDate + " - " + m_EndDate); } // setStartEndDate