Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
0
        public virtual IEnumerable addDet(PXAdapter adapter)
        {
            AddFilter.AskExt(true);
            if (AddFilter.View.Answer == WebDialogResult.OK)
            {
                using (new PXTimeStampScope(this.TimeStamp))
                {
                    CATran catran = AddTrxFilter.VerifyAndCreateTransaction(this, AddFilter, currencyinfo);
                    if (catran != null)
                    {
                        CATranExt copy = new CATranExt();
                        PXCache <CATran> .RestoreCopy(copy, catran);

                        CATranListRecords.Update(copy);
                        Save.Press();
                    }
                }
                CATranListRecords.Cache.Clear();
                Caches[typeof(CADailySummary)].Clear();
                Filter.Current.BegBal = null;
            }
            AddFilter.Cache.Clear();
            return(adapter.Get());
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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;
        }