Ejemplo n.º 1
0
 public virtual void Append(DetailsResult aSrc)
 {
     this._StatementBalance += aSrc.StatementBalance;
     this._AgeBalance00     += aSrc.AgeBalance00;
     if (this.CuryID == aSrc.CuryID)
     {
         this._CuryStatementBalance += aSrc.CuryStatementBalance;
         this._CuryAgeBalance00     += aSrc.CuryAgeBalance00;
     }
     else
     {
         this._CuryStatementBalance = Decimal.Zero;
         this._CuryAgeBalance00     = Decimal.Zero;
     }
 }
        public virtual IEnumerable ViewDetails(PXAdapter adapter)
        {
            if (this.Details.Current != null && this.Filter.Current != null)
            {
                DetailsResult          res   = this.Details.Current;
                ARStatementForCustomer graph = PXGraph.CreateInstance <ARStatementForCustomer>();

                ARStatementForCustomer.ARStatementForCustomerParameters filter = graph.Filter.Current;
                filter.CustomerID = res.CustomerId;
                graph.Filter.Update(filter);
                filter = graph.Filter.Select();
                throw new PXRedirectRequiredException(graph, Messages.CustomerStatementHistory);
            }
            return(Filter.Select());
        }
        /// <summary>
        /// Generates a list of documents that meet the filter criteria.
        /// This list is used for display in the processing screen
        /// </summary>
        /// <returns>List of Customers with Dunning Letters</returns>
        protected virtual IEnumerable details()
        {
            CreditHoldParameters header = Filter.Current;
            List <DetailsResult> result = new List <DetailsResult>();

            if (header == null)
            {
                yield break;
            }

            foreach (PXResult <Customer, ARDunningLetter> record in GetCustomersToProcess(header))
            {
                ARDunningLetter dunningLetter = record;
                Customer        customer      = record;
                if (header.ShowAll == false && customer.Status != header.IncludedCustomerStatus)
                {
                    continue;
                }

                DetailsResult res = new DetailsResult();
                res.Copy(this, dunningLetter, customer);

                IEnumerable <Override.ExtendedCustomer> customerFamily =
                    CustomerMaint.GetChildAccountsAndSelfStripped <Override.Customer.sharedCreditCustomerID>(this, customer.BAccountID);

                int?[] customerFamilyIDs = customerFamily
                                           .Select(row => row.BusinessAccount.BAccountID)
                                           .Where(id => id != null)
                                           .ToArray();

                var balances = CustomerMaint.GetCustomerBalances(this, customerFamilyIDs);
                if (balances != null)
                {
                    res.InvBal = balances.CurrentBal ?? 0.0m;
                }
                result.Add(res);
            }

            foreach (var item in result)
            {
                Details.Cache.SetStatus(item, PXEntryStatus.Held);
                yield return(item);
            }
            Details.Cache.IsDirty = false;
        }
        public virtual IEnumerable PrintReport(PXAdapter adapter)
        {
            if (this.Details.Current != null && this.Filter.Current != null)
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                DetailsResult res = this.Details.Current;

                Customer customer = PXSelect <Customer,
                                              Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                    .Select(this, res.CustomerId);

                Export(parameters, this.Filter.Current);
                parameters[ARStatementReportParams.Parameters.CustomerID] = customer.AcctCD;

                string reportID = (res.UseCurrency ?? false) ? ARStatementReportParams.CS_CuryStatementReportID : ARStatementReportParams.CS_StatementReportID;
                throw new PXReportRequiredException(parameters, reportID, "AR Statement Report");
            }
            return(Filter.Select());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generates a list of documents that meet the filter criteria.
        /// This list is used for display in the processing screen
        /// </summary>
        /// <returns>List of Customers with Dunning Letters</returns>
        protected virtual IEnumerable details()
        {
            CreditHoldParameters header = Filter.Current;
            List <DetailsResult> result = new List <DetailsResult>();

            if (header == null)
            {
                yield break;
            }

            foreach (PXResult <Customer, ARDunningLetter> record in GetCustomersToProcess(header))
            {
                ARDunningLetter dunningLetter = record;
                Customer        customer      = record;
                if (header.ShowAll == false && customer.Status != header.IncludedCustomerStatus)
                {
                    continue;
                }

                DetailsResult res = new DetailsResult();
                res.Copy(this, dunningLetter, customer);

                ARBalances balances = CustomerMaint.GetCustomerBalances <Override.Customer.sharedCreditCustomerID>(this, customer.BAccountID);
                if (balances != null)
                {
                    res.InvBal = balances.CurrentBal ?? 0.0m;
                }
                result.Add(res);
            }

            foreach (var item in result)
            {
                Details.Cache.SetStatus(item, PXEntryStatus.Held);
                yield return(item);
            }
            Details.Cache.IsDirty = false;
        }
 protected static void Export(Dictionary <string, string> aRes, DetailsResult aDetail)
 {
     aRes[ARStatementReportParams.Parameters.StatementCycleID] = aDetail.StatementCycleId;
     aRes[ARStatementReportParams.Parameters.StatementDate]    = aDetail.StatementDate.Value.ToString("d", CultureInfo.InvariantCulture);
 }
        protected virtual System.Collections.IEnumerable details()
        {
            ARStatementForCustomerParameters      header = Filter.Current;
            Dictionary <DetailKey, DetailsResult> result = new Dictionary <DetailKey, DetailsResult>(EqualityComparer <DetailKey> .Default);
            List <DetailsResult> curyResult = new List <DetailsResult>();

            if (header == null)
            {
                return(curyResult);
            }
            Customer customer = PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > > .Select(this, header.CustomerID);

            if (customer != null)
            {
                bool       useCurrency = customer.PrintCuryStatements ?? false;
                GL.Company company     = PXSelect <GL.Company> .Select(this);

                foreach (ARStatement st in PXSelect <ARStatement,
                                                     Where <ARStatement.statementCustomerID, Equal <Required <ARStatement.customerID> > >,
                                                     OrderBy <Asc <ARStatement.statementCycleId, Asc <ARStatement.statementDate, Asc <ARStatement.curyID> > > > >
                         .Select(this, header.CustomerID))
                {
                    DetailsResult res = new DetailsResult();
                    res.Copy(st, customer);
                    if (useCurrency)
                    {
                        DetailsResult last = curyResult.Count > 0 ? curyResult[curyResult.Count - 1] : null;
                        if (last != null &&
                            last.StatementCycleId == res.StatementCycleId &&
                            last.StatementDate == res.StatementDate && last.CuryID == res.CuryID)
                        {
                            last.Append(res);
                        }
                        else
                        {
                            curyResult.Add(res);
                        }
                        //curyResult.Add(res);
                    }
                    else
                    {
                        DetailKey key = new DetailKey(res.StatementDate.Value, res.StatementCycleId);
                        res.ResetToBaseCury(company.BaseCuryID);
                        if (!result.ContainsKey(key))
                        {
                            result[key] = res;
                        }
                        else
                        {
                            result[key].Append(res);
                        }
                    }
                }
                PXUIFieldAttribute.SetVisible <DetailsResult.curyID>(this.Details.Cache, null, useCurrency);
                PXUIFieldAttribute.SetVisible <DetailsResult.curyStatementBalance>(this.Details.Cache, null, useCurrency);
                PXUIFieldAttribute.SetVisible <DetailsResult.curyOverdueBalance>(this.Details.Cache, null, useCurrency);
                PXUIFieldAttribute.SetVisible <DetailsResult.statementBalance>(this.Details.Cache, null, !useCurrency);
                PXUIFieldAttribute.SetVisible <DetailsResult.overdueBalance>(this.Details.Cache, null, !useCurrency);

                return(useCurrency ? (System.Collections.IEnumerable)curyResult : (System.Collections.IEnumerable)result.Values);
                //return (System.Collections.IEnumerable)result.Values;
            }
            return(curyResult);
        }
Ejemplo n.º 8
0
 public static string GetCustomerReportID(PXGraph graph, string reportID, DetailsResult statement)
 {
     return(GetCustomerReportID(graph, reportID, statement.CustomerId, statement.BranchID));
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Generates a list of documents that meet the filter criteria.
        /// This list is used for display in the processing screen
        /// </summary>
        /// <returns>List of Dunning Letters</returns>
        protected virtual IEnumerable details()
        {
            Details.Cache.Clear();
            PrintParameters header = Filter.Current;

            if (header == null)
            {
                yield break;
            }
            List <DetailsResult> results = new List <DetailsResult>();

            PXSelectBase <ARDunningLetter> cmd = new PXSelectJoinGroupBy <ARDunningLetter,
                                                                          InnerJoin <ARDunningLetterDetail,
                                                                                     On <ARDunningLetterDetail.dunningLetterID, Equal <ARDunningLetter.dunningLetterID> > >,
                                                                          Where <ARDunningLetter.dunningLetterDate,
                                                                                 Between <Required <ARDunningLetter.dunningLetterDate>, Required <ARDunningLetter.dunningLetterDate> >,
                                                                                 And <ARDunningLetter.consolidated, Equal <Required <ARDunningLetter.consolidated> > > >,
                                                                          Aggregate <GroupBy <ARDunningLetter.dunningLetterID, Sum <ARDunningLetterDetail.overdueBal> > >,
                                                                          OrderBy <Asc <ARDunningLetter.bAccountID> > >(this);

            if (Filter.Current.Action == ActionTypes.Release)
            {
                cmd.WhereAnd <Where <ARDunningLetter.released, Equal <False>, And <ARDunningLetter.voided, Equal <False> > > >();
            }
            else
            {
                cmd.WhereAnd <Where <ARDunningLetter.released, Equal <True>, And <ARDunningLetter.voided, Equal <False> > > >();
            }
            foreach (PXResult <ARDunningLetter, ARDunningLetterDetail> res in cmd.Select(header.BeginDate, header.EndDate, this.Consolidated))
            {
                ARDunningLetter       dunningLetter = res;
                ARDunningLetterDetail detailSum     = res;

                if (Filter.Current.Action == ActionTypes.Print &&
                    header.ShowAll == false &&
                    (dunningLetter.DontPrint == true || dunningLetter.Printed == true))
                {
                    continue;
                }

                if (Filter.Current.Action == ActionTypes.Email &&
                    header.ShowAll == false &&
                    (dunningLetter.DontEmail == true || dunningLetter.Emailed == true))
                {
                    continue;
                }

                if (Filter.Current.Action == ActionTypes.MarkDontEmail &&
                    header.ShowAll == false &&
                    (dunningLetter.DontEmail == true || dunningLetter.Emailed == true))
                {
                    continue;
                }

                DetailsResult row = new DetailsResult();
                row.BranchID           = dunningLetter.BranchID;
                row.CustomerId         = dunningLetter.BAccountID;
                row.DunningLetterID    = dunningLetter.DunningLetterID;
                row.DunningLetterDate  = dunningLetter.DunningLetterDate;
                row.DunningLetterLevel = dunningLetter.DunningLetterLevel;
                row.LastLevel          = dunningLetter.LastLevel;
                row.DontEmail          = dunningLetter.DontEmail;
                row.DontPrint          = dunningLetter.DontPrint;
                row.Emailed            = dunningLetter.Emailed;
                row.Printed            = dunningLetter.Printed;
                row.DocBal             = detailSum.OverdueBal;
                results.Add(row);
            }
            foreach (DetailsResult item in results)
            {
                Details.Cache.SetStatus(item, PXEntryStatus.Held);
                yield return(item);
            }
            Details.Cache.IsDirty = false;
        }
Ejemplo n.º 10
0
        protected virtual IEnumerable details()
        {
            ARStatementForCustomerParameters      header = Filter.Current;
            Dictionary <DetailKey, DetailsResult> result = new Dictionary <DetailKey, DetailsResult>(EqualityComparer <DetailKey> .Default);
            List <DetailsResult> curyResult = new List <DetailsResult>();

            if (header == null)
            {
                return(curyResult);
            }

            Customer customer = CustomerRepository.FindByID(header.CustomerID);

            if (customer != null)
            {
                bool       useCurrency = customer.PrintCuryStatements ?? false;
                GL.Company company     = PXSelect <GL.Company> .Select(this);

                PXSelectBase <ARStatement> sel = new PXSelect <ARStatement,
                                                               Where <ARStatement.statementCustomerID, Equal <Required <ARStatement.customerID> > >,
                                                               OrderBy <Asc <ARStatement.statementCycleId, Asc <ARStatement.statementDate, Asc <ARStatement.curyID> > > > >(this);

                if (header.BranchID != null)
                {
                    sel.WhereAnd <Where <ARStatement.branchID, Equal <Required <ARStatement.branchID> > > >();
                }

                foreach (ARStatement st in sel.Select(header.CustomerID, header.BranchID))
                {
                    DetailsResult res = new DetailsResult();
                    res.Copy(st, customer);
                    if (useCurrency)
                    {
                        DetailsResult last = curyResult.Count > 0 ? curyResult[curyResult.Count - 1] : null;
                        if (last != null &&
                            last.StatementCycleId == res.StatementCycleId &&
                            last.StatementDate == res.StatementDate && last.CuryID == res.CuryID)
                        {
                            last.Append(res);
                        }
                        else
                        {
                            curyResult.Add(res);
                        }
                    }
                    else
                    {
                        DetailKey key = new DetailKey(res.StatementDate.Value, res.StatementCycleId, res.BranchID.Value);
                        res.ResetToBaseCury(company.BaseCuryID);
                        if (!result.ContainsKey(key))
                        {
                            result[key] = res;
                        }
                        else
                        {
                            result[key].Append(res);
                        }
                    }
                }

                return(useCurrency ? (curyResult as IEnumerable) : (result.Values as IEnumerable));
            }

            return(curyResult);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Generates a list of documents that meet the filter criteria.
        /// This list is used for display in the processing screen
        /// </summary>
        /// <returns>List of Customers with Dunning Letters</returns>
        protected virtual IEnumerable details()
        {
            CreditHoldParameters header = Filter.Current;
            List <DetailsResult> result = new List <DetailsResult>();

            if (header == null)
            {
                yield break;
            }

            bool AllShow = header.ShowAll ?? false;

            if (this.Filter.Current.Action == 0)
            {
                foreach (PXResult <Customer, ARDunningLetter> it in PXSelectJoin <Customer,
                                                                                  InnerJoin <ARDunningLetter, On <Customer.bAccountID, Equal <ARDunningLetter.bAccountID>,
                                                                                                                  And <ARDunningLetter.lastLevel, Equal <boolTrue> > > >,
                                                                                  Where <ARDunningLetter.dunningLetterDate,
                                                                                         Between <Required <ARDunningLetter.dunningLetterDate>, Required <ARDunningLetter.dunningLetterDate> > >,
                                                                                  OrderBy <Asc <ARDunningLetter.bAccountID> > >
                         .Select(this, header.BeginDate, header.EndDate))
                {
                    ARDunningLetter dl   = it;
                    Customer        cust = it;
                    if (!AllShow && cust.Status != BAccount.status.Active)
                    {
                        continue;
                    }

                    DetailsResult res = new DetailsResult();
                    res.Copy(this, dl, cust);

                    //==============================================================================
                    foreach (PXResult <ARInvoice> ix in
                             PXSelect <ARInvoice,
                                       Where <ARInvoice.customerID, Equal <Required <ARInvoice.customerID> >,
                                              And <ARInvoice.released, Equal <boolTrue>,
                                                   And <ARInvoice.openDoc, Equal <boolTrue>,
                                                        And <ARInvoice.voided, Equal <boolFalse>,
                                                             And <ARInvoice.docType, Equal <AP.APDocType.invoice>,
                                                                  And <ARInvoice.docDate, Between <Required <ARInvoice.docDate>, Required <ARInvoice.docDate> > > > > > > >
                                       > .Select(this, cust.BAccountID, header.BeginDate, header.EndDate))
                    {
                        ARInvoice inv = ix;

                        if (inv.BranchID != dl.BranchID)
                        {
                            continue;                              // alien branch
                        }
                        res.InvBal += inv.DocBal;
                    }
                    result.Add(res);
                }
            }
            else if (this.Filter.Current.Action == 1)
            {
                foreach (PXResult <Customer, ARDunningLetter> it in PXSelectJoin <Customer,
                                                                                  LeftJoin <ARDunningLetter, On <Customer.bAccountID, Equal <ARDunningLetter.bAccountID>,
                                                                                                                 And <ARDunningLetter.lastLevel, Equal <boolTrue> > > > >
                         .Select(this))
                {
                    ARDunningLetter dl   = it;
                    Customer        cust = it;
                    if (!AllShow && cust.Status != BAccount.status.CreditHold)
                    {
                        continue;
                    }

                    DetailsResult res = new DetailsResult();
                    res.Copy(this, dl, cust);

                    //==============================================================================
                    foreach (PXResult <ARInvoice> ix in
                             PXSelect <ARInvoice,
                                       Where <ARInvoice.customerID, Equal <Required <ARInvoice.customerID> >,
                                              And <ARInvoice.released, Equal <boolTrue>,
                                                   And <ARInvoice.openDoc, Equal <boolTrue>,
                                                        And <ARInvoice.voided, Equal <boolFalse>,
                                                             And <ARInvoice.docType, Equal <AP.APDocType.invoice>,
                                                                  And <ARInvoice.docDate, Less <Required <ARInvoice.docDate> > > > > > > >
                                       > .Select(this, cust.BAccountID, header.EndDate))
                    {
                        ARInvoice inv = ix;

                        //if (inv.BranchID != dl.BranchID) continue; // alien branch

                        res.InvBal += inv.DocBal;
                    }
                    result.Add(res);
                }
            }
            else
            {
                yield break;
            }
            foreach (var item in result)
            {
                Details.Cache.SetStatus(item, PXEntryStatus.Held);
                yield return(item);
            }
            Details.Cache.IsDirty = false;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 数据对比,rjy 时间计算修改
        /// </summary>
        /// <param name="time">前端传递时间,用于和服务器时间对比,判断自然周,自然月,自然季度</param>
        /// <param name="timeType">1:自然周,2:自然月,3:季度,4:天</param>
        /// <param name="upAndDown">0:当前, 1:前,2:后</param>
        /// <returns></returns>
        public async Task <DetailsResult> GetOrderDetailsAsync(DateTime time, string timeType, string upAndDown)
        {
            DetailsResult result        = null;
            string        startTime     = string.Empty; //显示数据开始时间
            string        endTime       = string.Empty; //显示数据结束时间
            string        lastStartTime = string.Empty; //对比数据开始时间
            string        lastEndTime   = string.Empty; //对比数据结束时间
            string        retStartTime  = string.Empty; //返回的开始时间
            string        retEndTime    = string.Empty; //返回的结束时间
            String        retQuarter    = string.Empty;

            //不管时间是什么时间啊,原始数据始终需要和前一次的数据比较,找出当前时间段,和对比时间段的开始时间和结束时间
            switch (timeType)
            {
            case "1":
            {
                if (upAndDown == "0")
                {
                    startTime = DateTimeExtensions.GetMondayDate(time).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.GetSundayDate(time).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "1")        //上
                {
                    startTime = DateTimeExtensions.GetMondayDate(DateTimeExtensions.GetMondayDate(time).AddDays(-1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.GetSundayDate(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "2")        //下
                {
                    startTime = DateTimeExtensions.GetMondayDate(DateTimeExtensions.GetSundayDate(time).AddDays(+1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.GetSundayDate(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                lastStartTime = DateTimeExtensions.GetMondayDate(DateTime.Parse(startTime).AddDays(-1)).ToString("yyyy-MM-dd");
                lastEndTime   = startTime;
                retStartTime  = startTime;
                retEndTime    = DateTime.Parse(endTime).AddDays(-1).ToString("yyyy-MM-dd");
            }
            break;

            case "2":
            {
                if (upAndDown == "0")
                {
                    startTime = DateTimeExtensions.FirstDayOfMonth(time).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.LastDayOfMonth(time).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "1")        //上
                {
                    startTime = DateTimeExtensions.FirstDayOfMonth(time.AddMonths(-1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.LastDayOfMonth(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "2")        //下
                {
                    //计算逻辑错误  比九月下一月应该是十月  十月应该和九月比较
                    startTime = DateTimeExtensions.FirstDayOfMonth(time.AddMonths(+1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.LastDayOfMonth(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                lastStartTime = DateTimeExtensions.FirstDayOfMonth(DateTime.Parse(startTime).AddMonths(-1)).ToString("yyyy-MM-dd");
                lastEndTime   = startTime;
                retStartTime  = DateTime.Parse(lastStartTime).ToString("yyyy-MM");
                retEndTime    = DateTime.Parse(startTime).ToString("yyyy-MM");
            }
            break;

            case "3":
            {
                if (upAndDown == "0")
                {
                    startTime = DateTimeExtensions.TwoToFirstDayOfSeason(time).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.TwoToLastDayOfSeason(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "1")        //上
                {
                    startTime = DateTimeExtensions.TwoToFirstDayOfSeason(DateTimeExtensions.TwoToFirstDayOfSeason(time).AddDays(-1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.TwoToLastDayOfSeason(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                if (upAndDown == "2")        //下
                {
                    startTime = DateTimeExtensions.TwoToFirstDayOfSeason(DateTimeExtensions.TwoToLastDayOfSeason(time).AddDays(+1)).ToString("yyyy-MM-dd");
                    endTime   = DateTimeExtensions.TwoToLastDayOfSeason(DateTime.Parse(startTime)).AddDays(+1).ToString("yyyy-MM-dd");
                }
                lastStartTime = DateTimeExtensions.TwoToFirstDayOfSeason(DateTime.Parse(startTime).AddDays(-1)).ToString("yyyy-MM-dd");
                lastEndTime   = startTime;
                retStartTime  = lastStartTime;
                retEndTime    = startTime;
                retQuarter    = DateTimeExtensions.JudgeTimeIsToDiff(DateTime.Parse(startTime));
            }
            break;

            case "4":
            {
                int day = 0;
                if (upAndDown == "0")
                {
                    day = 0;
                }
                if (upAndDown == "1")                                //上
                {
                    day = -1;
                }
                if (upAndDown == "2")                                //下
                {
                    day = 1;
                }
                startTime     = time.AddDays(day).ToString("yyyy-MM-dd");
                endTime       = time.AddDays(+(1 + day)).ToString("yyyy-MM-dd");
                lastStartTime = time.AddDays(-(1 - day)).ToString("yyyy-MM-dd");
                lastEndTime   = time.AddDays(day).ToString("yyyy-MM-dd");
                retStartTime  = lastStartTime;
                retEndTime    = startTime;
            }
            break;

            default:
                break;
            }
            //显示的数据源
            Details showDetails = await LeadDataDataAccess.Instance.GetOrderDetailsAsync(startTime, endTime);

            //对比的数据源
            Details trastDetails = await LeadDataDataAccess.Instance.GetOrderDetailsAsync(lastStartTime, lastEndTime);

            ShareProfit showShare = await LeadDataDataAccess.Instance.GetShareProfitAsync(startTime, endTime);

            ShareProfit trastShare = await LeadDataDataAccess.Instance.GetShareProfitAsync(lastStartTime, lastEndTime);

            bool isSuccess = false;

            //(今天-昨天)÷昨天×100%
            result = new DetailsResult();
            {
                result.Sum          = showDetails.Sum;
                result.Gross        = showDetails.Gross;
                result.Profit       = showDetails.Profit;
                result.Profits      = showDetails.Profits;
                result.Average      = showDetails.Average;
                result.Cashs        = showShare.Cashs;
                result.SumRate      = Contrast(showDetails.Sum, trastDetails.Sum, out isSuccess);
                result.SumTrend     = isSuccess;
                result.GrossRate    = Contrast(showDetails.Gross, trastDetails.Gross, out isSuccess);
                result.GrossTrend   = isSuccess;
                result.ProfitRate   = Contrast(showDetails.Profit, trastDetails.Profit, out isSuccess);
                result.ProfitTrend  = isSuccess;
                result.ProfitsRate  = Contrast(showDetails.Profits, trastDetails.Profits, out isSuccess);
                result.ProfitsTrend = isSuccess;
                result.AverageRate  = Contrast(showDetails.Average, trastDetails.Average, out isSuccess);
                result.AverageTrend = isSuccess;
                result.CashsRate    = Contrast(showShare.Cashs, trastShare.Cashs, out isSuccess);
                result.CashsTrend   = isSuccess;
                result.StartTime    = retStartTime;         //lastStartTime;
                result.EndTime      = retEndTime;           //startTime;//(DateTime.Parse(endTime).AddDays(-1)).ToString("yyyy-MM-dd");
                result.Quarter      = retQuarter;
            };
            return(result);
        }
Ejemplo n.º 13
0
        protected virtual IEnumerable details()
        {
            ARSetup setup = ARSetup.Current;

            PrintParameters      header = Filter.Current;
            List <DetailsResult> result = new List <DetailsResult>();

            if (header == null)
            {
                yield break;
            }

            GL.Company company = PXSelect <GL.Company> .Select(this);

            foreach (PXResult <ARStatement, Customer> it in PXSelectJoin <ARStatement,
                                                                          InnerJoin <Customer, On <Customer.bAccountID, Equal <ARStatement.statementCustomerID> > >,
                                                                          Where <ARStatement.statementDate, Equal <Required <ARStatement.statementDate> >,
                                                                                 And <ARStatement.statementCycleId, Equal <Required <ARStatement.statementCycleId> > > >,
                                                                          OrderBy <Asc <ARStatement.statementCustomerID, Asc <ARStatement.curyID> > > >
                     .Select(this, header.StatementDate, header.StatementCycleId))
            {
                DetailsResult res  = new DetailsResult();
                ARStatement   st   = it;
                Customer      cust = it;
                res.Copy(st, cust);

                if (setup.ConsolidatedStatement != true && st.BranchID != header.BranchID)
                {
                    continue;
                }

                if (Filter.Current.Action == 0 &&
                    header.ShowAll != true &&
                    (st.DontPrint == true || st.Printed == true))
                {
                    continue;
                }

                if ((Filter.Current.Action == 1 || Filter.Current.Action == 2) &&
                    header.ShowAll != true &&
                    (st.DontEmail == true || st.Emailed == true))
                {
                    continue;
                }

                if (cust.PrintCuryStatements == true)
                {
                    if (Filter.Current.CuryStatements != true)
                    {
                        continue;
                    }

                    DetailsResult last = result.Count > 0 ? result[result.Count - 1] : null;
                    if (last?.CustomerID == res.CustomerID && last?.CuryID == res.CuryID)
                    {
                        last.Append(res);
                    }
                    else
                    {
                        result.Add(res);
                    }
                }
                else
                {
                    if (Filter.Current.CuryStatements == true)
                    {
                        continue;
                    }

                    res.ResetToBaseCury(company.BaseCuryID);

                    DetailsResult last = result.Count > 0 ? result[result.Count - 1] : null;
                    if (last?.CustomerID == res.CustomerID)
                    {
                        last.Append(res);
                    }
                    else
                    {
                        result.Add(res);
                    }
                }
            }

            foreach (var item in result)
            {
                var located = Details.Cache.Locate(item);
                if (located != null)
                {
                    yield return(located);
                }
                else
                {
                    Details.Cache.SetStatus(item, PXEntryStatus.Held);
                    yield return(item);
                }
            }

            Details.Cache.IsDirty = false;
        }
Ejemplo n.º 14
0
 public DetailsViewModel(DetailsResult details)
 {
     Details = details;
 }
        /// <summary>
        /// Generates a list of documents that meet the filter criteria.
        /// This list is used for display in the processing screen
        /// </summary>
        /// <returns>List of Dunning Letters</returns>
        protected virtual IEnumerable details()
        {
            Details.Cache.Clear();
            PrintParameters      header = Filter.Current;
            List <DetailsResult> result = new List <DetailsResult>();

            if (header == null)
            {
                yield break;
            }

            GL.Company company = PXSelect <GL.Company> .Select(this);

            PXSelectBase <ARDunningLetter> cmd = new PXSelectJoin <ARDunningLetter, InnerJoin <Customer, On <Customer.bAccountID, Equal <ARDunningLetter.bAccountID> > >,
                                                                   Where <ARDunningLetter.dunningLetterDate,
                                                                          Between <Required <ARDunningLetter.dunningLetterDate>, Required <ARDunningLetter.dunningLetterDate> >,
                                                                          And <ARDunningLetter.consolidated, Equal <Required <ARDunningLetter.consolidated> > > >,
                                                                   OrderBy <Asc <ARDunningLetter.bAccountID> > >(this);

            if (Filter.Current.Action == 4)
            {
                cmd.WhereAnd <Where <ARDunningLetter.released, Equal <False>, And <ARDunningLetter.voided, Equal <False> > > >();
            }
            else
            {
                cmd.WhereAnd <Where <ARDunningLetter.released, Equal <True>, And <ARDunningLetter.voided, Equal <False> > > >();
            }
            foreach (PXResult <ARDunningLetter, Customer> it in cmd.Select(header.BeginDate, header.EndDate, this.Consolidated))
            {
                DetailsResult   res  = new DetailsResult();
                ARDunningLetter dl   = it;
                Customer        cust = it;
                res.Copy(this, dl, cust);

                if (this.Filter.Current.Action == 0)
                {
                    if (header.ShowAll == false && (dl.DontPrint == true || dl.Printed == true))
                    {
                        continue;
                    }
                }

                if (this.Filter.Current.Action == 1)
                {
                    if (header.ShowAll == false && (dl.DontEmail == true || dl.Emailed == true))
                    {
                        continue;
                    }
                }

                if (this.Filter.Current.Action == 2)
                {
                    if (header.ShowAll == false && (dl.DontEmail == true || dl.Emailed == true))
                    {
                        continue;
                    }
                }

                result.Add(res);
            }
            foreach (var item in result)
            {
                Details.Cache.SetStatus(item, PXEntryStatus.Held);
                yield return(item);
            }
            Details.Cache.IsDirty = false;
        }
Ejemplo n.º 16
0
        private static string GetCustomerReportID(PXGraph graph, string reportID, DetailsResult statement)
        {
            Customer customer = PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > > .SelectWindowed(graph, 0, 1, statement.CustomerId);

            return(new NotificationUtility(graph).SearchReport(ARNotificationSource.Customer, customer, reportID, statement.BranchID));
        }