question: public static int invoiceDueDays ( int p_C_Invoice_ID , Timestamp p_PayDate ) throws SQLException { if ( p_C_Invoice_ID == 0 ) return 0 ; int retValue = 0 ; String sql = "SELECT C_PaymentTerm_ID, DateInvoiced " + "FROM C_Invoice " + "WHERE C_Invoice_ID=?" ; PreparedStatement pstmt = Adempiere . prepareStatement ( sql ) ; pstmt . setInt ( 1 , p_C_Invoice_ID ) ; ResultSet rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { int C_PaymentTerm_ID = rs . getInt ( 1 ) ; Timestamp DocDate = rs . getTimestamp ( 2 ) ; retValue = dueDays ( C_PaymentTerm_ID , DocDate , p_PayDate ) ; } rs . close ( ) ; pstmt . close ( ) ; return retValue ; }
target:  Get Due Days of invoice