/// <summary> /// After Save /// </summary> /// <param name="newRecord"></param> /// <param name="success">success</param> /// <returns>success</returns> protected override bool AfterSave(bool newRecord, bool success) { if (!IsActive()) { GetQtys(false); for (int i = 0; i < _qtys.Length; i++) { MRfQResponseLineQty qty = _qtys[i]; if (qty.IsActive()) { qty.SetIsActive(false); qty.Save(); } } } return(success); }
/// <summary> /// Check if Response is Complete /// </summary> /// <returns>null if complere - error message otherwise</returns> public String CheckComplete() { if (IsComplete()) { SetIsComplete(false); } MRfQ rfq = GetRfQ(); // Is RfQ Total valid String error = rfq.CheckQuoteTotalAmtOnly(); if (error != null && error.Length > 0) { return(error); } // Do we have Total Amount ? if (rfq.IsQuoteTotalAmt() || rfq.IsQuoteTotalAmtOnly()) { Decimal amt = GetPrice(); if (Env.ZERO.CompareTo(amt) >= 0) { return("No Total Amount"); } } // Do we have an amount/qty for all lines if (rfq.IsQuoteAllLines()) { MRfQResponseLine[] lines = GetLines(false); for (int i = 0; i < lines.Length; i++) { MRfQResponseLine line = lines[i]; if (!line.IsActive()) { return("Line " + line.GetRfQLine().GetLine() + ": Not Active"); } bool validAmt = false; MRfQResponseLineQty[] qtys = line.GetQtys(false); for (int j = 0; j < qtys.Length; j++) { MRfQResponseLineQty qty = qtys[j]; if (!qty.IsActive()) { continue; } Decimal?amt = qty.GetNetAmt(); if (Env.ZERO.CompareTo(amt) < 0) { validAmt = true; break; } } if (!validAmt) { return("Line " + line.GetRfQLine().GetLine() + ": No Amount"); } } } // Do we have an amount for all line qtys if (rfq.IsQuoteAllQty()) { MRfQResponseLine[] lines = GetLines(false); for (int i = 0; i < lines.Length; i++) { MRfQResponseLine line = lines[i]; MRfQResponseLineQty[] qtys = line.GetQtys(false); for (int j = 0; j < qtys.Length; j++) { MRfQResponseLineQty qty = qtys[j]; if (!qty.IsActive()) { return("Line " + line.GetRfQLine().GetLine() + " Qty=" + qty.GetRfQLineQty().GetQty() + ": Not Active"); } Decimal?amt = qty.GetNetAmt(); if (amt == null || Env.ZERO.CompareTo(amt) >= 0) { return("Line " + line.GetRfQLine().GetLine() + " Qty=" + qty.GetRfQLineQty().GetQty() + ": No Amount"); } } } } SetIsComplete(true); return(null); }