Exemplo n.º 1
0
        protected virtual void CAEnqFilter_AccountID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            CAEnqFilter filter = e.Row as CAEnqFilter;

            if (filter == null || filter.AccountID == null)
            {
                return;
            }
            cashaccount.Current = (CashAccount)PXSelectorAttribute.Select <CAEnqFilter.accountID>(sender, filter);
            sender.SetDefaultExt <CAEnqFilter.curyID>(filter);
            AddFilter.Cache.SetValueExt <AddTrxFilter.cashAccountID>(AddFilter.Current, filter.AccountID);

            if (filter != null && filter.ShowSummary != true)
            {
                bool needReselect = false;
                foreach (CATranExt tran in PXSelect <CATranExt, Where2 <Where <Required <CAEnqFilter.includeUnreleased>, Equal <boolTrue>,
                                                                               Or <CATran.released, Equal <boolTrue> > >,
                                                                        And <CATranExt.cashAccountID, Equal <Required <CAEnqFilter.accountID> >,
                                                                             And <CATranExt.tranDate, Between <Required <CAEnqFilter.startDate>, Required <CAEnqFilter.endDate> > > > >,
                                                     OrderBy <Asc <CATranExt.tranDate, Asc <CATranExt.extRefNbr, Asc <CATranExt.tranID> > > > > .Select(this, filter.IncludeUnreleased, filter.AccountID, filter.StartDate, filter.EndDate))
                {
                    if (tran.Selected == true)
                    {
                        tran.Selected = false;
                        CATranListRecords.Update(tran);
                        needReselect = true;
                    }
                }
                if (needReselect == true)
                {
                    Save.Press();
                }
            }
        }
        protected virtual IEnumerable careconrecords()
        {
            List <CAReconMessage> listMessages = PXLongOperation.GetCustomInfo(this.UID) as List <CAReconMessage>;
            CAEnqFilter           filter       = Filter.Current;

            foreach (CARecon recon in PXSelectJoin <CARecon,
                                                    InnerJoin <CashAccount, On <CashAccount.cashAccountID, Equal <CARecon.cashAccountID> >,
                                                               InnerJoin <Account, On <Account.accountID, Equal <CashAccount.accountID>, And <Match <Account, Current <AccessInfo.userName> > > >,
                                                                          InnerJoin <Sub, On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > > >,
                                                    Where2 <Where <CARecon.cashAccountID, Equal <Required <CAEnqFilter.accountID> >,
                                                                   Or <Required <CAEnqFilter.accountID>, IsNull> >,
                                                            And2 <Where <CARecon.reconDate, GreaterEqual <Required <CAEnqFilter.startDate> >,
                                                                         Or <Required <CAEnqFilter.startDate>, IsNull> >,
                                                                  And <Where <CARecon.reconDate, LessEqual <Required <CAEnqFilter.endDate> >,
                                                                              Or <Required <CAEnqFilter.endDate>, IsNull> > > > >,
                                                    OrderBy <Asc <CARecon.reconDate, Asc <CARecon.reconNbr> > > >
                     .Select(this, filter.AccountID, filter.AccountID, filter.StartDate, filter.StartDate, filter.EndDate, filter.EndDate))
            {
                TimeSpan  timespan;
                Exception ex;
                if ((PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Aborted || PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Completed) &&
                    listMessages != null && listMessages.Count > 0)
                {
                    for (int i = 0; i < listMessages.Count; i++)
                    {
                        CAReconMessage message = (CAReconMessage)listMessages[i];
                        if (message.KeyCashAccount == recon.CashAccountID && message.KeyReconNbr == recon.ReconNbr)
                        {
                            CAReconRecords.Cache.RaiseExceptionHandling <CARecon.reconNbr>(recon, recon.ReconNbr, new PXSetPropertyException(message.Message, message.ErrorLevel));
                        }
                    }
                }
                yield return(recon);
            }
        }
Exemplo n.º 3
0
        public virtual IEnumerable release(PXAdapter adapter)
        {
            CASetup     setup  = casetup.Current;
            CAEnqFilter filter = Filter.Current;

            List <CATran> tranList = new List <CATran>();

            foreach (CATran transToRelease in PXSelect <CATran, Where2 <Where <Required <CAEnqFilter.includeUnreleased>, Equal <boolTrue>,
                                                                               Or <CATran.released, Equal <boolTrue> > >,
                                                                        And <CATran.cashAccountID, Equal <Required <CAEnqFilter.accountID> >,
                                                                             And <CATran.tranDate, Between <Required <CAEnqFilter.startDate>, Required <CAEnqFilter.endDate> > > > >,
                                                        OrderBy <Asc <CATran.tranDate, Asc <CATran.extRefNbr, Asc <CATran.tranID> > > > > .Select(this, filter.IncludeUnreleased, filter.AccountID, filter.StartDate, filter.EndDate))
            {
                if (transToRelease.Selected == true)
                {
                    tranList.Add(transToRelease);
                }
            }
            Save.Press();
            if (tranList.Count == 0)
            {
                throw new PXException(Messages.NoDocumentSelected);
            }
            else
            {
                PXLongOperation.StartOperation(this, delegate() { CATrxRelease.GroupReleaseTransaction(tranList, setup.ReleaseAP == true, setup.ReleaseAR == true, true); });
            }
            return(adapter.Get());
        }
Exemplo n.º 4
0
        protected virtual void CAEnqFilter_EndDate_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            DateTime?   startDate;
            DateTime?   endDate;
            CAEnqFilter filter = (CAEnqFilter)e.Row;

            GetRange((DateTime)this.Accessinfo.BusinessDate, casetup.Current.DateRangeDefault, filter?.AccountID, out startDate, out endDate);
            e.NewValue = endDate;
        }
Exemplo n.º 5
0
        protected virtual void CAEnqFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            CAEnqFilter filter = (CAEnqFilter)e.Row;

            if (filter == null)
            {
                return;
            }

            bool ShowSummaryNotChecked = filter.ShowSummary != true;

            bool CashAccountNeedReconcilation = (cashaccount.Current != null) && (bool)cashaccount.Current.Reconcile;

            if (cashaccount.Current != null && AddFilter.Current != null && AddFilter.Current.CashAccountID != filter.AccountID)
            {
                AddFilter.Cache.SetValueExt <AddTrxFilter.cashAccountID>(AddFilter.Current, cashaccount.Current.CashAccountCD);
            }
            AddDet.SetEnabled(filter.AccountID != null);
            PXCache tranCache = CATranListRecords.Cache;

            tranCache.AllowInsert = false;
            tranCache.AllowUpdate = (ShowSummaryNotChecked);
            tranCache.AllowDelete = (ShowSummaryNotChecked);

            PXUIFieldAttribute.SetVisible <CATran.selected>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.hold>(tranCache, null, false);
            PXUIFieldAttribute.SetVisible <CATran.status>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origModule>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origRefNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.origTranType>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.extRefNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.batchNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.finPeriodID>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.tranDesc>(tranCache, null, ShowSummaryNotChecked);

            PXUIFieldAttribute.SetVisible <CATran.referenceName>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.reconciled>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.clearDate>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.cleared>(tranCache, null, ShowSummaryNotChecked && CashAccountNeedReconcilation);
            PXUIFieldAttribute.SetVisible <CATran.dayDesc>(tranCache, null, !ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATranExt.dayDesc>(tranCache, null, !ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATranExt.depositNbr>(tranCache, null, ShowSummaryNotChecked);
            PXUIFieldAttribute.SetVisible <CATran.referenceID>(tranCache, null, ShowSummaryNotChecked);
            PXCache bAcctCache = this.Caches[typeof(BAccountR)];

            PXUIFieldAttribute.SetVisible <BAccountR.acctName>(bAcctCache, null, ShowSummaryNotChecked);

            Clearence.SetEnabled(CashAccountNeedReconcilation);
            AddFilter.Cache.RaiseRowSelected(AddFilter.Current);

            bool operationExists = PXLongOperation.Exists(UID);

            Save.SetEnabled(!operationExists);
            Release.SetEnabled(!operationExists);
            Clearence.SetEnabled(!operationExists);
        }
Exemplo n.º 6
0
        protected virtual void CAEnqFilter_ShowSummary_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            CAEnqFilter filter = e.Row as CAEnqFilter;

            if (filter.ShowSummary == true)
            {
                if (filter.LastEndDate != null)
                {
                    filter.StartDate     = filter.LastStartDate;
                    filter.EndDate       = filter.LastEndDate;
                    filter.LastStartDate = null;
                    filter.LastEndDate   = null;
                }
            }
        }
        protected virtual void CAEnqFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            CAEnqFilter filter = (CAEnqFilter)e.Row;

            if (filter == null)
            {
                return;
            }
            PXCache reconCache = CAReconRecords.Cache;

            reconCache.AllowInsert = false;
            reconCache.AllowUpdate = false;
            reconCache.AllowDelete = false;
            CashAccountFilter reconCreateFilter = cashAccountFilter.Current;

            cashAccountFilter.Cache.RaiseRowSelected(reconCreateFilter);
        }
Exemplo n.º 8
0
        public virtual IEnumerable DoubleClick(PXAdapter adapter)
        {
            CAEnqFilter filterCur = Filter.Current;

            if (filterCur.ShowSummary == true)
            {
                CATran tran = (CATran)(CATranListRecords.Current);
                filterCur.LastStartDate = filterCur.StartDate;
                filterCur.LastEndDate   = filterCur.EndDate;
                filterCur.StartDate     = tran.TranDate;
                filterCur.EndDate       = tran.TranDate;
                filterCur.ShowSummary   = false;

                CATranListRecords.Cache.Clear();
                Caches[typeof(CADailySummary)].Clear();
            }

            return(adapter.Get());
        }
Exemplo n.º 9
0
        protected virtual void CAEnqFilter_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            CAEnqFilter  filter    = e.Row as CAEnqFilter;
            AddTrxFilter addFilter = AddFilter.Current;
            CurrencyInfo curInfo   = currencyinfo.Current;

            CATranListRecords.Cache.Clear();
            Caches[typeof(CADailySummary)].Clear();

            if (!e.ExternalCall)
            {
                DateTime?startDate;
                DateTime?endDate;
                GetRange((DateTime)Accessinfo.BusinessDate, casetup.Current.DateRangeDefault, filter.AccountID, out startDate, out endDate);
                if (filter != null)
                {
                    filter.StartDate = startDate;
                    filter.EndDate   = endDate;
                }
            }
        }
Exemplo n.º 10
0
        public virtual IEnumerable clearence(PXAdapter adapter)
        {
            CAEnqFilter filter = Filter.Current;
            CATranExt   newrow = null;

            foreach (CATranExt transToClear in PXSelect <CATranExt, Where2 <Where <Required <CAEnqFilter.includeUnreleased>, Equal <boolTrue>,
                                                                                   Or <CATranExt.released, Equal <boolTrue> > >,
                                                                            And <CATranExt.cashAccountID, Equal <Required <CAEnqFilter.accountID> >,
                                                                                 And <CATranExt.tranDate, Between <Required <CAEnqFilter.startDate>, Required <CAEnqFilter.endDate> > > > >,
                                                         OrderBy <Asc <CATranExt.tranDate, Asc <CATranExt.extRefNbr, Asc <CATranExt.tranID> > > > > .Select(this, filter.IncludeUnreleased, filter.AccountID, filter.StartDate, filter.EndDate))
            {
                if (transToClear.Reconciled != true)
                {
                    newrow = PXCache <CATranExt> .CreateCopy(transToClear);

                    newrow.Cleared = true;
                    CATranListRecords.Cache.Update(newrow);
                }
            }
            Save.Press();
            return(adapter.Get());
        }
Exemplo n.º 11
0
        public virtual IEnumerable cATranListRecords()
        {
            CAEnqFilter filter = Filter.Current;

            List <PXResult <CATranExt, BAccountR> > result = new List <PXResult <CATranExt, BAccountR> >();

            if (filter != null && filter.ShowSummary == true)
            {
                long?id        = 0;
                int  startRow  = 0;
                int  totalRows = 0;
                foreach (CADailySummary daily in CATranListSummarized.View.Select(null, null, new object[PXView.SortColumns.Length], PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, 0, ref totalRows))
                {
                    CATranExt tran = new CATranExt();
                    id++;
                    tran.TranID        = id;
                    tran.CashAccountID = daily.CashAccountID;
                    tran.TranDate      = daily.TranDate;

                    tran.CuryDebitAmt  = daily.AmtReleasedClearedDr + daily.AmtReleasedUnclearedDr;
                    tran.CuryCreditAmt = daily.AmtReleasedClearedCr + daily.AmtReleasedUnclearedCr;

                    if (Filter.Current.IncludeUnreleased == true)
                    {
                        tran.CuryDebitAmt  += daily.AmtUnreleasedClearedDr + daily.AmtUnreleasedUnclearedDr;
                        tran.CuryCreditAmt += daily.AmtUnreleasedClearedCr + daily.AmtUnreleasedUnclearedCr;
                    }
                    tran.DayDesc = TM.EPCalendarFilter.CalendarTypeAttribute.GetDayName(((DateTime)tran.TranDate).DayOfWeek);
                    result.Add(new PXResult <CATranExt, BAccountR>(tran, new BAccountR()));
                }
            }
            else
            {
                Dictionary <long, CAMessage> listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <long, CAMessage>;
                PXSelectBase <CATranExt>     cmd          = new PXSelectJoin <CATranExt, LeftJoin <ARPayment, On <ARPayment.docType, Equal <CATranExt.origTranType>,
                                                                                                                  And <ARPayment.refNbr, Equal <CATran.origRefNbr> > >,
                                                                                                   LeftJoin <BAccountR, On <BAccountR.bAccountID, Equal <CATranExt.referenceID> > > >,
                                                                              Where2 <Where <Current <CAEnqFilter.includeUnreleased>, Equal <boolTrue>,
                                                                                             Or <CATran.released, Equal <boolTrue> > >,
                                                                                      And <CATranExt.cashAccountID, Equal <Current <CAEnqFilter.accountID> >,
                                                                                           And <CATranExt.tranDate, Between <Current <CAEnqFilter.startDate>, Current <CAEnqFilter.endDate> > > > >,
                                                                              OrderBy <Asc <CATranExt.tranDate, Asc <CATranExt.extRefNbr, Asc <CATranExt.tranID> > > > >(this);
                int startRow  = 0;
                int totalRows = 0;
                foreach (PXResult <CATranExt, ARPayment, BAccountR> iRes in cmd.View.Select(null, null, new object[PXView.SortColumns.Length], PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, 0, ref totalRows))
                {
                    CATranExt tran     = iRes;
                    ARPayment payment  = iRes;
                    BAccountR baccount = iRes;
                    tran.DayDesc     = TM.EPCalendarFilter.CalendarTypeAttribute.GetDayName(((DateTime)tran.TranDate).DayOfWeek);
                    tran.DepositNbr  = payment.DepositNbr;
                    tran.DepositType = payment.DepositType;
                    if (listMessages != null)
                    {
                        CAMessage message;
                        if (listMessages.TryGetValue(tran.TranID.Value, out message))
                        {
                            if (message != null && message.Key == tran.TranID)
                            {
                                CATranListRecords.Cache.RaiseExceptionHandling <CATran.origRefNbr>(tran, tran.OrigRefNbr, new PXSetPropertyException(message.Message, message.ErrorLevel));
                            }
                        }
                    }
                    result.Add(new PXResult <CATranExt, BAccountR>(tran, baccount));
                }
            }

            decimal curBalance = 0;

            if (filter != null && filter.BegBal != null)
            {
                curBalance = (decimal)filter.BegBal;
            }
            PXView.ReverseOrder = false;
            foreach (PXResult <CATranExt, BAccountR> it in PXView.Sort(result))
            {
                CATran tran = it;
                tran.BegBal = curBalance;
                tran.EndBal = tran.BegBal + tran.CuryDebitAmt - tran.CuryCreditAmt;
                curBalance  = (decimal)tran.EndBal;
                CATranListRecords.Cache.Hold(tran);
            }
            return(result);
        }
Exemplo n.º 12
0
        protected virtual IEnumerable filter()
        {
            PXCache cache = Caches[typeof(CAEnqFilter)];

            if (cache != null)
            {
                CAEnqFilter filter = cache.Current as CAEnqFilter;
                if (filter != null)
                {
                    if (filter.StartDate == null || filter.EndDate == null)
                    {
                        DateTime?startDate;
                        DateTime?endDate;

                        GetRange((DateTime)this.Accessinfo.BusinessDate, casetup.Current.DateRangeDefault, filter.AccountID, out startDate, out endDate);
                        filter.StartDate = startDate;
                        filter.EndDate   = endDate;
                    }
                    if (filter.AccountID != null && filter.StartDate != null)
                    {
                        CADailySummary begBal = PXSelectGroupBy <CADailySummary,
                                                                 Where <CADailySummary.cashAccountID, Equal <Required <CAEnqFilter.accountID> >,
                                                                        And <CADailySummary.tranDate, Less <Required <CAEnqFilter.startDate> > > >,
                                                                 Aggregate <Sum <CADailySummary.amtReleasedClearedCr,
                                                                                 Sum <CADailySummary.amtReleasedClearedDr,
                                                                                      Sum <CADailySummary.amtReleasedUnclearedCr,
                                                                                           Sum <CADailySummary.amtReleasedUnclearedDr,
                                                                                                Sum <CADailySummary.amtUnreleasedClearedCr,
                                                                                                     Sum <CADailySummary.amtUnreleasedClearedDr,
                                                                                                          Sum <CADailySummary.amtUnreleasedUnclearedCr,
                                                                                                               Sum <CADailySummary.amtUnreleasedUnclearedDr,
                                                                                                                    GroupBy <CADailySummary.cashAccountID> > > > > > > > > > >
                                                .Select(this, filter.AccountID, filter.StartDate);

                        if ((begBal == null) || (begBal.CashAccountID == null))
                        {
                            filter.BegBal        = (decimal)0.0;
                            filter.BegClearedBal = (decimal)0.0;
                        }
                        else
                        {
                            filter.BegBal = begBal.AmtReleasedClearedDr -
                                            begBal.AmtReleasedClearedCr +
                                            begBal.AmtReleasedUnclearedDr -
                                            begBal.AmtReleasedUnclearedCr;

                            filter.BegClearedBal = begBal.AmtReleasedClearedDr -
                                                   begBal.AmtReleasedClearedCr;

                            if (filter.IncludeUnreleased == true)
                            {
                                filter.BegBal += begBal.AmtUnreleasedClearedDr -
                                                 begBal.AmtUnreleasedClearedCr +
                                                 begBal.AmtUnreleasedUnclearedDr -
                                                 begBal.AmtUnreleasedUnclearedCr;

                                filter.BegClearedBal += begBal.AmtUnreleasedClearedDr -
                                                        begBal.AmtUnreleasedClearedCr;
                            }
                        }
                        filter.DebitTotal         = 0m;
                        filter.CreditTotal        = 0m;
                        filter.DebitClearedTotal  = 0m;
                        filter.CreditClearedTotal = 0m;
                        int startRow  = 0;
                        int totalRows = 0;
                        foreach (PXResult <CATranExt> res in CATranListRecords.View.Select(PXView.Currents, PXView.Parameters, new object[0], new string[0], new bool[0], CATranListRecords.View.GetExternalFilters(), ref startRow, 0, ref totalRows))
                        {
                            CATranExt tran = (CATranExt)res;
                            filter.DebitTotal         += tran.CuryDebitAmt;
                            filter.CreditTotal        += tran.CuryCreditAmt;
                            filter.DebitClearedTotal  += tran.CuryClearedDebitAmt;
                            filter.CreditClearedTotal += tran.CuryClearedCreditAmt;
                        }
                        filter.EndBal        = filter.BegBal + filter.DebitTotal - filter.CreditTotal;
                        filter.EndClearedBal = filter.BegClearedBal + filter.DebitClearedTotal - filter.CreditClearedTotal;
                    }
                }
            }
            yield return(cache.Current);

            cache.IsDirty = false;
        }