public String warehouse(Properties ctx,int WindowNo,GridTab mTab,GridField mField,Object value){
  if (isCalloutActive())   return "";
  Integer M_Warehouse_ID=(Integer)value;
  if (M_Warehouse_ID == null || M_Warehouse_ID.intValue() == 0)   return "";
  String sql="SELECT w.AD_Org_ID, l.M_Locator_ID " + "FROM M_Warehouse w" + " LEFT OUTER JOIN M_Locator l ON (l.M_Warehouse_ID=w.M_Warehouse_ID AND l.IsDefault='Y') "+ "WHERE w.M_Warehouse_ID=?";
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    pstmt=DB.prepareStatement(sql,null);
    pstmt.setInt(1,M_Warehouse_ID.intValue());
    rs=pstmt.executeQuery();
    if (rs.next()) {
      Integer ii=new Integer(rs.getInt(1));
      int AD_Org_ID=Env.getContextAsInt(ctx,WindowNo,"AD_Org_ID");
      if (AD_Org_ID != ii.intValue())       mTab.setValue("AD_Org_ID",ii);
      ii=new Integer(rs.getInt(2));
      if (rs.wasNull())       Env.setContext(ctx,WindowNo,0,"M_Locator_ID",null);
 else {
        log.config("M_Locator_ID=" + ii);
        Env.setContext(ctx,WindowNo,"M_Locator_ID",ii.intValue());
      }
    }
  }
 catch (  SQLException e) {
    log.log(Level.SEVERE,sql,e);
    return e.getLocalizedMessage();
  }
 finally {
    DB.close(rs,pstmt);
  }
  return "";
}

public String warehouse ( Properties ctx , int WindowNo , GridTab mTab , GridField mField , Object value ) { if ( isCalloutActive ( ) ) return "" ; Integer M_Warehouse_ID = ( Integer ) value ; if ( M_Warehouse_ID == null || M_Warehouse_ID . intValue ( ) == 0 ) return "" ; String sql = "SELECT w.AD_Org_ID, l.M_Locator_ID " + "FROM M_Warehouse w" + " LEFT OUTER JOIN M_Locator l ON (l.M_Warehouse_ID=w.M_Warehouse_ID AND l.IsDefault='Y') " + "WHERE w.M_Warehouse_ID=?" ; PreparedStatement pstmt = null ; ResultSet rs = null ; try { pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setInt ( 1 , M_Warehouse_ID . intValue ( ) ) ; rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { Integer ii = new Integer ( rs . getInt ( 1 ) ) ; int AD_Org_ID = Env . getContextAsInt ( ctx , WindowNo , "AD_Org_ID" ) ; if ( AD_Org_ID != ii . intValue ( ) ) mTab . setValue ( "AD_Org_ID" , ii ) ; ii = new Integer ( rs . getInt ( 2 ) ) ; if ( rs . wasNull ( ) ) Env . setContext ( ctx , WindowNo , 0 , "M_Locator_ID" , null ) ; else { log . config ( "M_Locator_ID=" + ii ) ; Env . setContext ( ctx , WindowNo , "M_Locator_ID" , ii . intValue ( ) ) ; } } } catch ( SQLException e ) { log . log ( Level . SEVERE , sql , e ) ; return e . getLocalizedMessage ( ) ; } finally { DB . close ( rs , pstmt ) ; } return "" ; }
m_warehouse . set organization and default locator
