Beispiel #1
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);

                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);
                        }
                    }
                    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);
                        }
                    }
                }

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

            return(curyResult);
        }
        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);
        }
 public virtual bool Equals(DetailKey other)
 {
     return(base.Equals(other));
 }