示例#1
0
        protected virtual IEnumerable filter()
        {
            ApproveBillsFilter filter = Filter.Current;

            if (filter != null && filter.SelectionDate != null && filter.PendingRefresh == true)
            {
                DateTime PayInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.PayInLessThan.GetValueOrDefault());
                DateTime DueInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.DueInLessThan.GetValueOrDefault());
                DateTime DiscountExpiresInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.DiscountExpiresInLessThan.GetValueOrDefault());

                decimal approvedTotal = 0m;
                decimal docsTotal     = 0m;

                PXView view = new PXView(this, true, BqlCommand.CreateInstance(getAPDocumentSelect(true)));

                foreach (PXResult <APInvoice> temp in view.SelectMulti(PayInLessThan, DueInLessThan, DiscountExpiresInLessThan))
                {
                    APInvoice res = temp;
                    approvedTotal += res.PaySel == true ? (Accessinfo.CuryViewState ? (res.DocBal ?? 0m) : (res.CuryDocBal ?? 0m)) : 0m;
                    docsTotal     += Accessinfo.CuryViewState ? (res.DocBal ?? 0m) : (res.CuryDocBal ?? 0m);
                }

                Filter.Current.CuryApprovedTotal = approvedTotal;
                Filter.Current.CuryDocsTotal     = docsTotal;
                Filter.Current.PendingRefresh    = false;
            }

            yield return(Filter.Current);

            Filter.Cache.IsDirty = false;
        }
示例#2
0
        protected virtual IEnumerable apdocumentlist()
        {
            ApproveBillsFilter filter = Filter.Current;

            if (filter != null && filter.SelectionDate != null)
            {
                DateTime PayInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.PayInLessThan.GetValueOrDefault());
                DateTime DueInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.DueInLessThan.GetValueOrDefault());
                DateTime DiscountExpiresInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.DiscountExpiresInLessThan.GetValueOrDefault());

                PXView view = new PXView(this, false, BqlCommand.CreateInstance(getAPDocumentSelect(false)));

                foreach (PXResult <APInvoice> res in
                         view.Graph.QuickSelect(view.BqlSelect, new object[] { PayInLessThan, DueInLessThan, DiscountExpiresInLessThan }, null, false))
                {
                    APInvoice apdoc = res;

                    if (string.IsNullOrEmpty(apdoc.PayTypeID))
                    {
                        try
                        {
                            APDocumentList.Cache.SetDefaultExt <APInvoice.payTypeID>(apdoc);
                        }
                        catch (PXSetPropertyException e)
                        {
                            APDocumentList.Cache.RaiseExceptionHandling <APInvoice.payTypeID>(apdoc, apdoc.PayTypeID, e);
                        }
                    }

                    if (apdoc.PayAccountID == null)
                    {
                        try
                        {
                            APDocumentList.Cache.SetDefaultExt <APInvoice.payAccountID>(apdoc);
                        }
                        catch (PXSetPropertyException e)
                        {
                            APDocumentList.Cache.RaiseExceptionHandling <APInvoice.payAccountID>(apdoc, apdoc.PayAccountID, e);
                        }
                    }

                    yield return(apdoc);
                }
            }
        }
示例#3
0
        protected virtual void ApproveBillsFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled(APDocumentList.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <APInvoice.paySel>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payLocationID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payAccountID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payTypeID>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.payDate>(APDocumentList.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <APInvoice.separateCheck>(APDocumentList.Cache, null, true);

            PXUIFieldAttribute.SetVisible <ApproveBillsFilter.curyID>(sender, null, PXAccess.FeatureInstalled <FeaturesSet.multicurrency>());

            PXUIFieldAttribute.SetDisplayName <APInvoice.selected>(APDocumentList.Cache, Messages.Approve);
            PXUIFieldAttribute.SetDisplayName <APInvoice.vendorID>(APDocumentList.Cache, Messages.VendorID);

            APDocumentList.Cache.AllowInsert = APDocumentList.Cache.AllowDelete = false;

            ApproveBillsFilter row = e.Row as ApproveBillsFilter;

            if (row != null)
            {
                row.Days = PXMessages.LocalizeNoPrefix(row.Days);
            }
        }
示例#4
0
        protected virtual IEnumerable apdocumentlist()
        {
            ApproveBillsFilter filter = Filter.Current;

            if (filter != null && filter.SelectionDate != null)
            {
                DateTime PayInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.PayInLessThan.GetValueOrDefault());
                DateTime DueInLessThan             = ((DateTime)filter.SelectionDate).AddDays(filter.DueInLessThan.GetValueOrDefault());
                DateTime DiscountExpiresInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.DiscountExpiresInLessThan.GetValueOrDefault());

                foreach (PXResult <APInvoice, Vendor, APAdjust> res in PXSelectJoin <APInvoice,
                                                                                     InnerJoin <Vendor, On <Vendor.bAccountID, Equal <APInvoice.vendorID> >,
                                                                                                LeftJoin <APAdjust, On <APAdjust.adjdDocType, Equal <APInvoice.docType>,
                                                                                                                        And <APAdjust.adjdRefNbr, Equal <APInvoice.refNbr>,
                                                                                                                             And <APAdjust.released, Equal <False> > > >,
                                                                                                          LeftJoin <APPayment, On <APPayment.docType, Equal <APInvoice.docType>,
                                                                                                                                   And <APPayment.refNbr, Equal <APInvoice.refNbr>,
                                                                                                                                        And <Where <APPayment.docType, Equal <APDocType.prepayment>, Or <APPayment.docType, Equal <APDocType.debitAdj> > > > > > > > >,
                                                                                     Where <APInvoice.openDoc, Equal <True>,
                                                                                            And2 <Where <APInvoice.released, Equal <True>, Or <APInvoice.prebooked, Equal <True> > >,
                                                                                                  And <APAdjust.adjgRefNbr, IsNull,
                                                                                                       And <APPayment.refNbr, IsNull,
                                                                                                            And2 <Match <Vendor, Current <AccessInfo.userName> >,
                                                                                                                  And2 <Where <APInvoice.curyID, Equal <Current <ApproveBillsFilter.curyID> >,
                                                                                                                               Or <Current <ApproveBillsFilter.curyID>, IsNull> >,
                                                                                                                        And2 <Where2 <Where <Current <ApproveBillsFilter.showApprovedForPayment>, Equal <True>,
                                                                                                                                             And <APInvoice.paySel, Equal <True> > >,
                                                                                                                                      Or <Where <Current <ApproveBillsFilter.showNotApprovedForPayment>, Equal <True>,
                                                                                                                                                 And <APInvoice.paySel, Equal <False> > > > >,
                                                                                                                              And2 <Where <Vendor.bAccountID, Equal <Current <ApproveBillsFilter.vendorID> >,
                                                                                                                                           Or <Current <ApproveBillsFilter.vendorID>, IsNull> >,
                                                                                                                                    And2 <Where <Vendor.vendorClassID, Equal <Current <ApproveBillsFilter.vendorClassID> >,
                                                                                                                                                 Or <Current <ApproveBillsFilter.vendorClassID>, IsNull> >,
                                                                                                                                          And <Where2 <Where2 <Where <Current <ApproveBillsFilter.showPayInLessThan>, Equal <True>, And <APInvoice.payDate, LessEqual <Required <APInvoice.payDate> > > >,
                                                                                                                                                               Or2 <Where <Current <ApproveBillsFilter.showDueInLessThan>, Equal <True>,
                                                                                                                                                                           And <APInvoice.dueDate, LessEqual <Required <APInvoice.dueDate> > > >,
                                                                                                                                                                    Or <Where <Current <ApproveBillsFilter.showDiscountExpiresInLessThan>, Equal <True>,
                                                                                                                                                                               And <APInvoice.discDate, LessEqual <Required <APInvoice.discDate> > > > > > >,
                                                                                                                                                       Or <Where <Current <ApproveBillsFilter.showPayInLessThan>, Equal <False>,
                                                                                                                                                                  And <Current <ApproveBillsFilter.showDueInLessThan>, Equal <False>,
                                                                                                                                                                       And <Current <ApproveBillsFilter.showDiscountExpiresInLessThan>, Equal <False> > > > > > > > > > > > > > > > >
                         .Select(this, PayInLessThan, DueInLessThan, DiscountExpiresInLessThan))
                {
                    APInvoice apdoc = res;

                    if (string.IsNullOrEmpty(apdoc.PayTypeID))
                    {
                        try
                        {
                            APDocumentList.Cache.SetDefaultExt <APInvoice.payTypeID>(apdoc);
                        }
                        catch (PXSetPropertyException e)
                        {
                            APDocumentList.Cache.RaiseExceptionHandling <APInvoice.payTypeID>(apdoc, apdoc.PayTypeID, e);
                        }
                    }

                    if (apdoc.PayAccountID == null)
                    {
                        try
                        {
                            APDocumentList.Cache.SetDefaultExt <APInvoice.payAccountID>(apdoc);
                        }
                        catch (PXSetPropertyException e)
                        {
                            APDocumentList.Cache.RaiseExceptionHandling <APInvoice.payAccountID>(apdoc, apdoc.PayAccountID, e);
                        }
                    }

                    yield return(apdoc);
                }
            }
        }
示例#5
0
        protected virtual IEnumerable apdocumentlist()
        {
            ApproveBillsFilter filter = (ApproveBillsFilter)Filter.Current;
            PXResultset<APInvoice> ret = new PXResultset<APInvoice>();

            if (filter != null && filter.SelectionDate!=null)
            {
                                DateTime PayInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.PayInLessThan.GetValueOrDefault());
                                DateTime DueInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.DueInLessThan.GetValueOrDefault());
                                DateTime DiscountExpiresInLessThan = ((DateTime)filter.SelectionDate).AddDays(filter.DiscountExpiresInLessThan.GetValueOrDefault());

                foreach (PXResult<APInvoice, Vendor, APAdjust> res in PXSelectJoin<APInvoice,
                        InnerJoin<Vendor,
                            On<Vendor.bAccountID, Equal<APInvoice.vendorID>>,
                        LeftJoin<APAdjust,
                            On<APAdjust.adjdDocType, Equal<APInvoice.docType>,
                             And<APAdjust.adjdRefNbr, Equal<APInvoice.refNbr>,
                             And<APAdjust.released, Equal<boolFalse>>>>,
                        LeftJoin<APPayment,
                            On<APPayment.docType, Equal<APInvoice.docType>,
                            And<APPayment.refNbr, Equal<APInvoice.refNbr>,
                            And<Where<APPayment.docType, Equal<APDocType.prepayment>, Or<APPayment.docType, Equal<APDocType.debitAdj>>>>>>>>>,
                    Where<APInvoice.openDoc, Equal<boolTrue>,
                        And2<Where<APInvoice.released, Equal<boolTrue>, Or<APInvoice.prebooked, Equal<boolTrue>>>,
                        And<APAdjust.adjgRefNbr, IsNull,
                        And<APPayment.refNbr, IsNull,
                        And2<Where<APInvoice.curyID, Equal<Current<ApproveBillsFilter.curyID>>,
                               Or<Current<ApproveBillsFilter.curyID>, IsNull>>,
                        And2<Where2<Where<Current<ApproveBillsFilter.showApprovedForPayment>, Equal<boolTrue>,
                                        And<APInvoice.paySel, Equal<boolTrue>>>,
                                 Or<Where<Current<ApproveBillsFilter.showNotApprovedForPayment>, Equal<boolTrue>,
                                        And<APInvoice.paySel, Equal<boolFalse>>>>>,
                        And2<Where<Vendor.bAccountID, Equal<Current<ApproveBillsFilter.vendorID>>,
                                 Or<Current<ApproveBillsFilter.vendorID>, IsNull>>,
                        And2<Where<Vendor.vendorClassID, Equal<Current<ApproveBillsFilter.vendorClassID>>,
                                 Or<Current<ApproveBillsFilter.vendorClassID>, IsNull>>,
                                                And<Where2<Where2<Where<Current<ApproveBillsFilter.showPayInLessThan>, Equal<boolTrue>,
                                                                                                And<APInvoice.payDate, LessEqual<Required<APInvoice.payDate>>
                                                                                                >>,
                                        Or2<Where<Current<ApproveBillsFilter.showDueInLessThan>, Equal<boolTrue>,
                                                And<APInvoice.dueDate, LessEqual<Required<APInvoice.dueDate>>
                                                >>,
                                        Or<Where<Current<ApproveBillsFilter.showDiscountExpiresInLessThan>, Equal<boolTrue>,
                                                And<APInvoice.discDate, LessEqual<Required<APInvoice.discDate>>
                                                >>>>>,
                                                                Or<Where<Current<ApproveBillsFilter.showPayInLessThan>, Equal<boolFalse>,
                                       And<Current<ApproveBillsFilter.showDueInLessThan>, Equal<boolFalse>,
                                       And<Current<ApproveBillsFilter.showDiscountExpiresInLessThan>, Equal<boolFalse>>>>>
                                   >>>>>>>>>>>.Select(this,
                                                                                    PayInLessThan,
                                          DueInLessThan,
                                          DiscountExpiresInLessThan))
                {
                    APInvoice apdoc = (APInvoice)res;
                    Vendor vend = (Vendor)res;

                    if (string.IsNullOrEmpty(apdoc.PayTypeID))
                    {
                        APDocumentList.Cache.SetDefaultExt<APInvoice.payTypeID>(apdoc);
                    }

                    if (apdoc.PayAccountID == null)
                    {
                        APDocumentList.Cache.SetDefaultExt<APInvoice.payAccountID>(apdoc);
                    }

                    ret.Add(new PXResult<APInvoice>(apdoc));
                }
            }
            return ret;
        }