/** * After Save * @param newRecord new * @param success success * @return success */ protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(success); } // set zero in net days at header if schedules created. string qry = "UPDATE C_PaymentTerm SET NetDays = 0 WHERE C_PaymentTerm_ID = " + GetC_PaymentTerm_ID(); int nos = DB.ExecuteQuery(qry, null, Get_Trx()); if (nos <= 0) { log.SaveWarning("Warning", Msg.GetMsg(GetCtx(), "PayTermNotUpdated")); } if (newRecord || Is_ValueChanged("Percentage") || Is_ValueChanged("IsActive")) { log.Fine("afterSave"); GetParent(); _parent.Validate(); _parent.Save(); } //SI_0646_4 : System should give the warning message on any change on payment term,if payment term is used in transaction. if (Is_Changed() && !newRecord) { string sql = @" SELECT SUM(COUNT) FROM ( SELECT COUNT(*) AS COUNT FROM C_Order WHERE IsActive = 'Y' AND DocStatus NOT IN ('RE' , 'VO') AND C_PaymentTerm_ID = " + GetC_PaymentTerm_ID() + @" UNION ALL SELECT COUNT(*) AS COUNT FROM C_Invoice WHERE IsActive = 'Y' AND DocStatus NOT IN ('RE' , 'VO') AND C_PaymentTerm_ID = " + GetC_PaymentTerm_ID() + @" UNION ALL SELECT COUNT(*) AS COUNT FROM C_Project WHERE IsActive = 'Y' AND C_PaymentTerm_ID = " + GetC_PaymentTerm_ID() + @" UNION ALL SELECT COUNT(*) AS COUNT FROM C_Contract WHERE IsActive = 'Y' AND DocStatus NOT IN ('RE' , 'VO') AND C_PaymentTerm_ID = " + GetC_PaymentTerm_ID() + " ) t"; int no = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, Get_Trx())); if (no > 0) { log.SaveWarning("Warning", Msg.GetMsg(GetCtx(), "VIS_ConflictChanges")); } } return(success); }
/** * After Save * @param newRecord new * @param success success * @return success */ protected override bool AfterSave(bool newRecord, bool success) { if (newRecord || Is_ValueChanged("Percentage")) { log.Fine("afterSave"); GetParent(); _parent.Validate(); _parent.Save(); } return(success); }