/** * After Delete * @param success success * @return success */ protected override bool AfterDelete(bool success) { if (success) { // Get Order and decrease invoices MInvoiceLine iLine = new MInvoiceLine(GetCtx(), GetC_InvoiceLine_ID(), Get_TrxName()); int C_OrderLine_ID = iLine.GetC_OrderLine_ID(); if (C_OrderLine_ID == 0) { MInOutLine ioLine = new MInOutLine(GetCtx(), GetM_InOutLine_ID(), Get_TrxName()); C_OrderLine_ID = ioLine.GetC_OrderLine_ID(); } // No Order Found if (C_OrderLine_ID == 0) { return(success); } // Find MatchPO MMatchPO[] mPO = MMatchPO.Get(GetCtx(), C_OrderLine_ID, GetC_InvoiceLine_ID(), Get_TrxName()); for (int i = 0; i < mPO.Length; i++) { if (mPO[i].GetM_InOutLine_ID() == 0) { mPO[i].Delete(true); } else { mPO[i].SetC_InvoiceLine_ID(null); mPO[i].Save(); } } } return(success); }
/** * Get Match POs * @return matched purchase orders */ public MMatchPO[] GetMatchPO() { if (_matchPO == null) { _matchPO = MMatchPO.Get(GetCtx(), GetM_InOutLine_ID(), Get_TrxName()); } return(_matchPO); }