protected virtual void SOOrderTypeOperation_InvtMult_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { SOOrderTypeOperation row = e.Row as SOOrderTypeOperation; if (row != null) { e.NewValue = INTranType.InvtMult(row.INDocType); e.Cancel = true; } }
protected virtual void SOOrderTypeOperation_INDocType_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { SOOrderTypeOperation row = (SOOrderTypeOperation)e.Row; if (row == null) { return; } short?inInvtMult = INTranType.InvtMult((string)e.NewValue); if ((row.Operation == SOOperation.Issue && inInvtMult > 0) || (row.Operation == SOOperation.Receipt && inInvtMult < 0)) { throw new PXSetPropertyException(Messages.OrderTypeUnsupportedOperation); } }
protected virtual void Validate(PXCache sender, SOOrderType row) { SOOrderTypeOperation def = this.defaultOperation.Select(row.OrderType, row.DefaultOperation); if (def == null) { return; } //if (def.INDocType != INTranType.NoUpdate && row.RequireShipping != true && row.RequireLocation != true) //{ // PXException ex = new PXSetPropertyException(Messages.OrderTypeShipmentOrLocation); // sender.RaiseExceptionHandling<SOOrderType.requireShipping>(row, row.RequireShipping, ex); // sender.RaiseExceptionHandling<SOOrderType.requireLocation>(row, row.RequireLocation, ex); //} //else if (def.INDocType != INTranType.NoUpdate && row.RequireShipping == true && row.RequireLocation == true) //{ // PXException ex = new PXSetPropertyException(Messages.OrderTypeShipmentNotLocation); // sender.RaiseExceptionHandling<SOOrderType.requireShipping>(row, row.RequireShipping, ex); // sender.RaiseExceptionHandling<SOOrderType.requireLocation>(row, row.RequireLocation, ex); //} short?arInvtMult = 0; short?inInvtMult = INTranType.InvtMult(def.INDocType); switch (row.ARDocType) { case ARDocType.Invoice: case ARDocType.DebitMemo: case ARDocType.CashSale: arInvtMult = -1; break; case ARDocType.CreditMemo: arInvtMult = 1; break; } if (row.Behavior != SOBehavior.RM && inInvtMult != arInvtMult && inInvtMult != 0 && arInvtMult != 0) { PXException ex = new PXSetPropertyException(Messages.OrderTypeUnsupportedCombination); sender.RaiseExceptionHandling <SOOrderType.aRDocType>(row, row.ARDocType, ex); this.operations.Cache.RaiseExceptionHandling <SOOrderTypeOperation.iNDocType>(def, def.INDocType, ex); } }