コード例 #1
0
ファイル: Correction.cs プロジェクト: Vialythen/AcumaticaTest
        protected virtual void _(Events.RowSelecting <ARInvoice> e)
        {
            if (e.Row?.IsUnderCorrection != true)
            {
                return;
            }
            PXView view = new SelectFrom <ARRegisterAlias>
                          .Where <ARRegisterAlias.origDocType.IsEqual <ARInvoice.docType.FromCurrent>
                                  .And <ARRegisterAlias.origRefNbr.IsEqual <ARInvoice.refNbr.FromCurrent>
                                        .And <Where2 <ARRegisterAlias.isCorrection.IsEqual <True>,
                                                      Or <ARRegisterAlias.isCancellation.IsEqual <True>
                                                          .And <ARRegisterAlias.released.IsNotEqual <True> > > > > > > .View.ReadOnly(Base).View;

            using (new PXConnectionScope())
                using (new PXFieldScope(view,
                                        typeof(ARRegisterAlias.docType),
                                        typeof(ARRegisterAlias.refNbr),
                                        typeof(ARRegisterAlias.isCancellation)))
                {
                    var correction = (ARRegisterAlias)view.SelectSingleBound(new[] { e.Row });
                    e.Row.CorrectionDocType   = correction?.DocType;
                    e.Row.CorrectionRefNbr    = correction?.RefNbr;
                    e.Row.IsUnderCancellation = correction?.IsCancellation == true;
                }
        }