Beispiel #1
0
        protected virtual void EPExpenseClaimDetails_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {
            EPExpenseClaimDetails row = (EPExpenseClaimDetails)e.Row;

            if (!string.IsNullOrEmpty(row.RefNbr) && e.TranStatus == PXTranStatus.Completed)
            {
                ExpenseClaimEntry expenseClaimEntry = CreateInstance <ExpenseClaimEntry>();
                expenseClaimEntry.ExpenseClaim.Current = expenseClaimEntry.ExpenseClaim.Search <EPExpenseClaim.refNbr>(row.RefNbr);
                if (expenseClaimEntry.ExpenseClaim.Current != null)
                {
                    expenseClaimEntry.currencyinfo.Current = expenseClaimEntry.currencyinfo.Search <EPExpenseClaim.curyInfoID>(expenseClaimEntry.ExpenseClaim.Current.CuryInfoID);
                    expenseClaimEntry.SubmitDetail(row);
                    expenseClaimEntry.Actions.PressSave();
                    Cancel.Press();
                }
            }
        }
        private void CheckExpensesOnHold()
        {
            bool holdExpenses = false;

            var adjSet = new List <string>();

            foreach (CAExpense exp in Expenses.Select())
            {
                if (!string.IsNullOrEmpty(exp.AdjRefNbr))
                {
                    adjSet.Add(exp.AdjRefNbr);
                }
            }

            if (adjSet.Count < 1)
            {
                return;
            }

            Cancel.Press();

            var adjs = PXSelectReadonly <CAAdj, Where <CAAdj.adjRefNbr, In <Required <CAExpense.adjRefNbr> > > > .Select(this, new object[] { adjSet.ToArray() });

            foreach (CAAdj adj in adjs)
            {
                if (adj.Hold == true)
                {
                    var expense = (CAExpense)Expenses.Select().ToArray().First(m => ((CAExpense)m)?.AdjRefNbr == adj.AdjRefNbr);
                    Expenses.Cache.RaiseExceptionHandling <CAExpense.adjRefNbr>(expense, expense.AdjRefNbr, new PXSetPropertyException(Messages.HoldExpense, PXErrorLevel.RowError));
                    holdExpenses = true;
                }
            }

            if (holdExpenses)
            {
                throw new PXException(Messages.HoldExpenses, Transfer.Current.TransferNbr);
            }
        }
 public SOInvoiceEntry()
 {
     Cancel.Press();
 }