public String charge(Properties ctx,int WindowNo,GridTab mTab,GridField mField,Object value){
  Integer C_Charge_ID=(Integer)value;
  if (C_Charge_ID == null || C_Charge_ID.intValue() == 0)   return "";
  if (mTab.getValue("M_Product_ID") != null) {
    mTab.setValue("C_Charge_ID",null);
    return "ChargeExclusively";
  }
  mTab.setValue("M_AttributeSetInstance_ID",null);
  mTab.setValue("S_ResourceAssignment_ID",null);
  mTab.setValue("C_UOM_ID",new Integer(100));
  Env.setContext(ctx,WindowNo,"DiscountSchema","N");
  String sql="SELECT ChargeAmt FROM C_Charge WHERE C_Charge_ID=?";
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    pstmt=DB.prepareStatement(sql,null);
    pstmt.setInt(1,C_Charge_ID.intValue());
    rs=pstmt.executeQuery();
    if (rs.next()) {
      mTab.setValue("PriceEntered",rs.getBigDecimal(1));
      mTab.setValue("PriceActual",rs.getBigDecimal(1));
      mTab.setValue("PriceLimit",Env.ZERO);
      mTab.setValue("PriceList",Env.ZERO);
      mTab.setValue("Discount",Env.ZERO);
    }
  }
 catch (  SQLException e) {
    log.log(Level.SEVERE,sql + e);
    return e.getLocalizedMessage();
  }
 finally {
    DB.close(rs,pstmt);
    rs=null;
    pstmt=null;
  }
  return tax(ctx,WindowNo,mTab,mField,value);
}

public String charge ( Properties ctx , int WindowNo , GridTab mTab , GridField mField , Object value ) { Integer C_Charge_ID = ( Integer ) value ; if ( C_Charge_ID == null || C_Charge_ID . intValue ( ) == 0 ) return "" ; if ( mTab . getValue ( "M_Product_ID" ) != null ) { mTab . setValue ( "C_Charge_ID" , null ) ; return "ChargeExclusively" ; } mTab . setValue ( "M_AttributeSetInstance_ID" , null ) ; mTab . setValue ( "S_ResourceAssignment_ID" , null ) ; mTab . setValue ( "C_UOM_ID" , new Integer ( 100 ) ) ; Env . setContext ( ctx , WindowNo , "DiscountSchema" , "N" ) ; String sql = "SELECT ChargeAmt FROM C_Charge WHERE C_Charge_ID=?" ; PreparedStatement pstmt = null ; ResultSet rs = null ; try { pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setInt ( 1 , C_Charge_ID . intValue ( ) ) ; rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { mTab . setValue ( "PriceEntered" , rs . getBigDecimal ( 1 ) ) ; mTab . setValue ( "PriceActual" , rs . getBigDecimal ( 1 ) ) ; mTab . setValue ( "PriceLimit" , Env . ZERO ) ; mTab . setValue ( "PriceList" , Env . ZERO ) ; mTab . setValue ( "Discount" , Env . ZERO ) ; } } catch ( SQLException e ) { log . log ( Level . SEVERE , sql + e ) ; return e . getLocalizedMessage ( ) ; } finally { DB . close ( rs , pstmt ) ; rs = null ; pstmt = null ; } return tax ( ctx , WindowNo , mTab , mField , value ) ; }
invoice line - charge . - updates priceactual from charge - sets pricelimit , pricelist to zero calles tax
