/** * Get InOut-Invoice Matches * @param ctx context * @param M_InOutLine_ID shipment * @param C_InvoiceLine_ID invoice * @param trxName transaction * @return array of matches */ public static MMatchInv[] Get(Ctx ctx, int M_InOutLine_ID, int C_InvoiceLine_ID, Trx trxName) { if (M_InOutLine_ID == 0 || C_InvoiceLine_ID == 0) { return new MMatchInv[] { } } ; // String sql = "SELECT * FROM M_MatchInv WHERE M_InOutLine_ID=" + M_InOutLine_ID + " AND C_InvoiceLine_ID=" + C_InvoiceLine_ID; List <MMatchInv> list = new List <MMatchInv>(); DataSet ds = new DataSet(); try { ds = DB.ExecuteDataset(sql, null, trxName); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; list.Add(new MMatchInv(ctx, dr, trxName)); } ds = null; } catch (Exception e) { _log.Log(Level.SEVERE, sql, e); } MMatchInv[] retValue = new MMatchInv[list.Count]; retValue = list.ToArray(); return(retValue); }
/* Get Inv Matches for Invoice * @param ctx context * @param C_Invoice_ID invoice * @param trxName transaction * @return array of matches */ public static MMatchInv[] GetInvoice(Ctx ctx, int C_Invoice_ID, Trx trxName) { if (C_Invoice_ID == 0) { return new MMatchInv[] { } } ; // String sql = "SELECT * FROM M_MatchInv mi" + " INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID) " + "WHERE il.C_Invoice_ID=" + C_Invoice_ID; List <MMatchInv> list = new List <MMatchInv>(); DataTable dt = null; IDataReader idr = null; try { idr = DB.ExecuteReader(sql, null, trxName); dt = new DataTable(); dt.Load(idr); idr.Close(); foreach (DataRow dr in dt.Rows) { list.Add(new MMatchInv(ctx, dr, trxName)); } } catch (Exception e) { if (idr != null) { idr.Close(); } _log.Log(Level.SEVERE, sql, e); } finally { dt = null; } MMatchInv[] retValue = new MMatchInv[list.Count]; retValue = list.ToArray(); return(retValue); }