1 14 package org.compiere.model; 15 16 import java.util.*; 17 import java.sql.*; 18 import java.math.*; 19 20 import org.compiere.util.*; 21 22 28 public class MInOut extends X_M_InOut 29 { 30 public MInOut (Properties ctx, int M_InOut_ID) 31 { 32 super (ctx, M_InOut_ID); 33 if (M_InOut_ID == 0) 34 { 35 setM_Warehouse_ID (0); 36 setDateAcct (new Timestamp (System.currentTimeMillis ())); 37 setMovementDate (new Timestamp (System.currentTimeMillis ())); 40 setProcessed (false); 42 setC_BPartner_Location_ID (0); 44 setIsSOTrx (false); 45 setDeliveryRule (null); 46 setIsPrinted (false); 47 setFreightCostRule (null); 48 setC_BPartner_ID (0); 49 setC_DocType_ID (0); 50 setSendEMail (false); 51 } 54 } 56 61 public MInOut (Properties ctx, ResultSet rs) 62 { 63 super (ctx, rs); 64 } 66 70 public String getDocStatusName() 71 { 72 return MRef_List.getListName(getCtx(), 131, getDocStatus()); 73 } 75 79 public String toString () 80 { 81 StringBuffer sb = new StringBuffer ("MInOut[") 82 .append (getID()).append("-").append(getDocumentNo()) 83 .append(",DocStatus=").append(getDocStatus()) 84 .append ("]"); 85 return sb.toString (); 86 } 88 92 public MInOutLine[] getMInOutLines() 93 { 94 ArrayList list = new ArrayList(); 95 String sql = "SELECT * FROM M_InOutLine WHERE M_InOut_ID=? ORDER BY Line"; 96 PreparedStatement pstmt = null; 97 try 98 { 99 pstmt = DB.prepareStatement(sql); 100 pstmt.setInt(1, getM_InOut_ID()); 101 ResultSet rs = pstmt.executeQuery(); 102 while (rs.next()) 103 list.add(new MInOutLine(getCtx(), rs)); 104 rs.close(); 105 pstmt.close(); 106 pstmt = null; 107 } 108 catch (SQLException ex) 109 { 110 log.error("", ex); 111 } 112 try 113 { 114 if (pstmt != null) 115 pstmt.close(); 116 } 117 catch (SQLException ex1) 118 { 119 } 120 pstmt = null; 121 MInOutLine[] retValue = new MInOutLine[list.size()]; 123 list.toArray(retValue); 124 return retValue; 125 } 127 } | Popular Tags |