private void CalculateTranIn(CATransfer transfer) { if ((transfer.CuryTranOut != 0m) && (CurInfoIN.Current != null)) { PXSelectBase <CurrencyInfo> currencyInfoStatement = new PXSelect <CurrencyInfo, Where <CurrencyInfo.curyInfoID, Equal <Current <CATransfer.inCuryInfoID> > > >(this); CurrencyInfo cinfo = (CurrencyInfo)currencyInfoStatement.Select(); if (transfer.OutCuryID == transfer.InCuryID) { transfer.CuryTranIn = transfer.CuryTranOut; PXCurrencyAttribute.CalcBaseValues <CATransfer.curyTranIn>(Transfer.Cache, transfer); } else { if (cinfo?.CuryRate != null) { decimal resultValue = decimal.Zero; decimal resultBaseValue = decimal.Zero; PXDBCurrencyAttribute.CuryConvCury(currencyInfoStatement.Cache, cinfo, (transfer.TranOut ?? decimal.Zero), out resultValue); transfer.CuryTranIn = resultValue; PXDBCurrencyAttribute.CuryConvBase(currencyInfoStatement.Cache, cinfo, (transfer.CuryTranIn ?? decimal.Zero), out resultBaseValue); transfer.TranIn = resultBaseValue; } } } }
protected virtual void CurrencyInfo_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e) { foreach (CATransfer doc in PXSelect <CATransfer, Where <CATransfer.outCuryInfoID, Equal <Required <CATransfer.outCuryInfoID> > > > .Select(sender.Graph, ((CurrencyInfo)e.Row).CuryInfoID)) { PXCurrencyAttribute.CalcBaseValues <CATransfer.curyTranOut>(Transfer.Cache, doc); CalculateTranIn(doc); Transfer.Cache.MarkUpdated(doc); } foreach (CATransfer doc in PXSelect <CATransfer, Where <CATransfer.inCuryInfoID, Equal <Required <CATransfer.inCuryInfoID> > > > .Select(sender.Graph, ((CurrencyInfo)e.Row).CuryInfoID)) { CalculateTranIn(doc); Transfer.Cache.MarkUpdated(doc); } }
protected virtual void CurrencyInfo_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e) { foreach (CATransfer doc in PXSelect <CATransfer, Where <CATransfer.outCuryInfoID, Equal <Required <CATransfer.outCuryInfoID> > > > .Select(sender.Graph, ((CurrencyInfo)e.Row).CuryInfoID)) { PXCurrencyAttribute.CalcBaseValues <CATransfer.curyTranOut>(Transfer.Cache, doc); CalculateTranIn(doc); if (Transfer.Cache.GetStatus(doc) == PXEntryStatus.Notchanged) { Transfer.Cache.SetStatus(doc, PXEntryStatus.Updated); } } foreach (CATransfer doc in PXSelect <CATransfer, Where <CATransfer.inCuryInfoID, Equal <Required <CATransfer.inCuryInfoID> > > > .Select(sender.Graph, ((CurrencyInfo)e.Row).CuryInfoID)) { CalculateTranIn(doc); if (Transfer.Cache.GetStatus(doc) == PXEntryStatus.Notchanged) { Transfer.Cache.SetStatus(doc, PXEntryStatus.Updated); } } }