[PXProcessButton(ShortcutCtrl = true, ShortcutChar = (char)65, Tooltip = GL.Messages.SaveAndAddToolTip)]         //Ctrl-A
        public virtual IEnumerable saveAndAdd(PXAdapter adapter)
        {
            Base.Save.Press();
            return(Base.Insert.Press(adapter));

#if USE_DOC_TEMPLATE
            Base.Save.Press();
            Base.Insert.Press();
            if (this.Base.IsWithinContext == true)
            {
                string     wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                GLWorkBook wb   = PXSelect <GLWorkBook, Where <GLWorkBook.workBookID, Equal <Required <GLWorkBook.workBookID> > > > .Select(this.Base, wbID);

                if (wb != null && wb.TemplateID.HasValue)
                {
                    var currentUserClipboard = PXCopyPasteData <PXGraph> .CurrentUserClipboard;
                    currentUserClipboard.LoadTemplateFromDb(Convert.ToInt32(wb.TemplateID));
                    currentUserClipboard.PasteTo(this.Base);
                }
            }

            List <APInvoice> res = new List <APInvoice>(1);
            res.Add(this.Base.Document.Current);
            return(res);
#endif
        }
Example #2
0
        protected virtual void ARInvoice_DocType_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting bs)
        {
            if (Base.IsWithinContext)
            {
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (wb?.DocType != null)
                {
                    e.NewValue = wb?.DocType;
                    e.Cancel   = true;
                }
            }
        }
        protected virtual void APQuickCheck_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted bs)
        {
            if (bs != null)
            {
                bs(sender, e);
            }
            bool isWithinContext = Base.IsWithinContext;

            if (isWithinContext)
            {
                string vb   = Base.GetContextValue <GLVoucherBatch.voucherBatchNbr>();
                string wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                this.VoucherBatch.Current = this.VoucherBatch.Select(wbID, vb);
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (!String.IsNullOrEmpty(vb))
                {
                    Guid?noteID = PXNoteAttribute.GetNoteID <AP.Standalone.APQuickCheck.noteID>(sender, e.Row);
                    this.Voucher.Insert(new GLVoucher());
                    this.Voucher.Cache.IsDirty        = false;
                    Base.Caches[typeof(Note)].IsDirty = false;
                }

                var row = (AP.Standalone.APQuickCheck)e.Row;

                if (wb.DefaultDescription != null && row.DocDesc == null)
                {
                    sender.SetValueExt <AP.Standalone.APQuickCheck.docDesc>(e.Row, wb.DefaultDescription);
                }

                if (wb.DefaultBAccountID != null && row.VendorID == null)
                {
                    sender.SetValueExt <AP.Standalone.APQuickCheck.vendorID>(e.Row, wb.DefaultBAccountID);

                    if (wb.DefaultLocationID != null)
                    {
                        sender.SetValueExt <AP.Standalone.APQuickCheck.vendorLocationID>(e.Row, wb.DefaultLocationID);
                    }
                }
            }
        }
        protected virtual void CAAdj_RowInserted(PXCache sender, PXRowInsertedEventArgs e, PXRowInserted bs)
        {
            if (bs != null)
            {
                bs(sender, e);
            }
            bool isWithinContext = Base.IsWithinContext;

            if (isWithinContext)
            {
                string vb   = Base.GetContextValue <GLVoucherBatch.voucherBatchNbr>();
                string wbID = Base.GetContextValue <GLVoucherBatch.workBookID>();
                this.VoucherBatch.Current = this.VoucherBatch.Select(wbID, vb);
                GLWorkBook wb = PXSelect <GLWorkBook,
                                          Where <GLWorkBook.workBookID, Equal <Required <GLVoucherBatch.workBookID> > > > .Select(this.Base, Base.GetContextValue <GLVoucherBatch.workBookID>());

                if (!String.IsNullOrEmpty(vb))
                {
                    Guid?noteID = PXNoteAttribute.GetNoteID <CAAdj.noteID>(sender, e.Row);
                    this.Voucher.Insert(new GLVoucher());
                    this.Voucher.Cache.IsDirty        = false;
                    Base.Caches[typeof(Note)].IsDirty = false;
                }

                var row = PXCache <CAAdj> .CreateCopy((CAAdj)e.Row);

                if (wb.DefaultDescription != null && row.TranDesc == null)
                {
                    row.TranDesc = wb.DefaultDescription;
                }
                if (wb.DefaultCashAccountID != null && row.CashAccountID == null)
                {
                    row.CashAccountID = wb.DefaultCashAccountID;
                }
                if (wb.DefaultEntryTypeID != null && row.EntryTypeID == null)
                {
                    row.EntryTypeID = wb.DefaultEntryTypeID;
                }

                sender.Update(row);
            }
        }