/// <summary> /// Rate - set Multiply Rate from Divide Rate and vice versa /// </summary> /// <param name="ctx">context</param> /// <param name="windowNo">window no</param> /// <param name="tab">tab</param> /// <param name="field">field</param> /// <param name="value">value</param> /// <returns>null or error message</returns> public String Rate(Ctx ctx, int windowNo, GridTab tab, GridField field, Object value) { if (IsCalloutActive() || value == null) // assuming it is Conversion_Rate { return(""); } SetCalloutActive(true); Decimal rate1 = (Decimal)value; Decimal rate2 = Utility.Env.ZERO; Decimal one = new Decimal(1.0); if (System.Convert.ToDouble(rate1) != 0.0) // no divide by zero { rate2 = Decimal.Round(Decimal.Divide(one, rate1), 12, MidpointRounding.AwayFromZero); } // if (field.GetColumnName().Equals("MultiplyRate")) { tab.SetValue("DivideRate", rate2); } else { tab.SetValue("MultiplyRate", rate2); } log.Info(field.GetColumnName() + "=" + rate1 + " => " + rate2); SetCalloutActive(false); return(""); }
/** * Invoice Line - Charge. * - updates PriceActual from Charge * - sets PriceLimit, PriceList to zero * Calles tax * @param ctx context * @param WindowNo window no * @param mTab tab * @param mField field * @param value value * @return null or error message */ public String Invalidate(Ctx ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { // Summary ? if (mTab.GetValue("IsSummary") != null) { mTab.SetValue("IsValid", false); return(""); } return(""); } // charge
/// <summary> /// Set Account Date to the date of the calling column. /// </summary> /// <param name="ctx">context</param> /// <param name="windowNo">window no</param> /// <param name="tab">tab</param> /// <param name="field">field</param> /// <param name="value">value</param> /// <returns>null or error message</returns> public String DateAcct(Ctx ctx, int windowNo, GridTab tab, GridField field, Object value) { if (IsCalloutActive()) // assuming it is resetting value { return(""); } // setCalloutActive(true); if (value == null || !(value.GetType() == typeof(DateTime))) { return(""); } tab.SetValue("DateAcct", value); // setCalloutActive(false); return(""); }