Ejemplo n.º 1
0
		public ReadOnlyCollection<Document> Get(out int totalCount, int? count = null, int? offset = null, long? ownerId = null, DocFilter? filter = null)
		{
			var response = Get(count, offset, ownerId, filter);

			totalCount = Convert.ToInt32(response.TotalCount);

			return response.ToReadOnlyCollection();
		}
        /// <summary>
        /// 5.8. Получение списка входящих документов
        /// </summary>
        /// <param name="filter">Фильтр <see cref="DocFilter"/> списка документов.</param>
        /// <param name="startFrom">Индекс первой записи в списке возвращаемых документов</param>
        /// <param name="count">Количество записей в списке возвращаемых документов</param>
        public DocumentsResponse <IncomeDocument> GetIncomeDocuments(DocFilter filter, int startFrom, int count)
        {
            RequestRate(1); // 8

            return(Post <DocumentsResponse <IncomeDocument> >("documents/income", new
            {
                filter = filter,
                start_from = startFrom,
                count = count
            }));
        }
Ejemplo n.º 3
0
 public virtual IEnumerable ProcessPayment(PXAdapter adapter)
 {
     if (this.Documents.Current != null && this.Filter.Current != null)
     {
         CheckSummary      res           = this.Documents.Current;
         DocFilter         currentFilter = this.Filter.Current;
         APPrintChecks     graph         = PXGraph.CreateInstance <APPrintChecks>();
         PrintChecksFilter paymentFilter = graph.Filter.Current;
         paymentFilter.PayAccountID = res.PayAccountID;
         paymentFilter.PayTypeID    = res.PayTypeID;
         graph.Filter.Update(paymentFilter);
         throw new PXRedirectRequiredException(graph, "ProcessPayment");
     }
     return(Filter.Select());
 }
Ejemplo n.º 4
0
		public VkCollection<Document> Get(int? count = null, int? offset = null, long? ownerId = null, DocFilter? filter = null)
		{
			VkErrors.ThrowIfNumberIsNegative(() => count);
			VkErrors.ThrowIfNumberIsNegative(() => offset);

			var parameters = new VkParameters
			{
				{ "count", count },
				{ "offset", offset },
				{ "owner_id", ownerId },
				{ "type", filter }
			};

			return _vk.Call("docs.get", parameters).ToVkCollectionOf<Document>(r => r);
		}
Ejemplo n.º 5
0
        public virtual IEnumerable filter()
        {
            DocFilter locFilter = Filter.Cache.Current as DocFilter;

            if (locFilter != null)
            {
                locFilter.Balance     = 0m;
                locFilter.CuryBalance = 0m;
                locFilter.CuryID      = null;
                bool sameCurrency = true;
                bool isFirst      = true;
                foreach (CheckSummary it in Documents.Select())
                {
                    locFilter.Balance += it.DocBal;
                    if (isFirst)
                    {
                        locFilter.CuryID = it.CuryID;
                    }
                    else
                    {
                        if (!((string.IsNullOrEmpty(locFilter.CuryID) && string.IsNullOrEmpty(it.CuryID)) ||
                              locFilter.CuryID == it.CuryID))
                        {
                            sameCurrency = false;
                        }
                    }

                    if (sameCurrency)
                    {
                        locFilter.CuryBalance += it.CuryDocBal;
                    }

                    isFirst = false;
                }
                bool hasCurrency = !(string.IsNullOrEmpty(locFilter.CuryID));
                PXUIFieldAttribute.SetVisible <DocFilter.curyID>(Filter.Cache, locFilter, sameCurrency && hasCurrency);
                PXUIFieldAttribute.SetVisible <DocFilter.curyBalance>(Filter.Cache, locFilter, sameCurrency && hasCurrency);
                PXUIFieldAttribute.SetVisible <DocFilter.balance>(Filter.Cache, locFilter, !(sameCurrency && hasCurrency));
            }
            yield return(Filter.Cache.Current);

            Filter.Cache.IsDirty = false;
        }
Ejemplo n.º 6
0
		public ReadOnlyCollection<Document> Get(out int totalCount, int? count = null, int? offset = null, long? ownerId = null, DocFilter? filter = null)
		{
			VkErrors.ThrowIfNumberIsNegative(() => count);
			VkErrors.ThrowIfNumberIsNegative(() => offset);

			var parameters = new VkParameters
			{
				{ "count", count },
				{ "offset", offset },
				{ "owner_id", ownerId },
				{ "type", filter }
			};

			var response = _vk.Call("docs.get", parameters);

			totalCount = response["count"];

			VkResponseArray items = response["items"];
			return items.ToReadOnlyCollectionOf<Document>(r => r);
		}
Ejemplo n.º 7
0
        public DataBase.IncomeDocumentList GetIncomeDocumentList(DateTime startDateTime, int startFrom, int count)
        {
            var docFilter = new DocFilter()
            {
                ProcessedDateFrom = startDateTime
            };

            ReaderWriterLockSlim.EnterReadLock();
            try
            {
                var result = Client.GetIncomingDocuments(docFilter, startFrom, count).Result;
                return(MapToDomainIncomeDocumentList(result));
            }
            catch (AggregateException ex)
            {
                throw ex.InnerException;
            }
            finally
            {
                ReaderWriterLockSlim.ExitReadLock();
            }
        }
Ejemplo n.º 8
0
        public virtual IEnumerable documents()
        {
            DocFilter filter = Filter.Current;
            Dictionary <CashAcctKey, CheckSummary> result = new Dictionary <CashAcctKey, CheckSummary>();

            if (filter == null && !filter.PayDate.HasValue)
            {
                return(result.Values);
            }
            PXSelectBase <APPaymentExt> sel = new PXSelectJoin <APPaymentExt,
                                                                InnerJoin <CashAccount, On <CashAccount.cashAccountID, Equal <APPaymentExt.cashAccountID> >,
                                                                           InnerJoin <Vendor, On <Vendor.bAccountID, Equal <APPayment.vendorID> >,
                                                                                      InnerJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <APPaymentExt.paymentMethodID> >,
                                                                                                 LeftJoin <CABatchDetail, On <CABatchDetail.origModule, Equal <GL.BatchModule.moduleAP>,
                                                                                                                              And <CABatchDetail.origDocType, Equal <APPayment.docType>,
                                                                                                                                   And <CABatchDetail.origRefNbr, Equal <APPayment.refNbr> > > > > > > >,
                                                                Where <APPaymentExt.released, Equal <boolFalse>,
                                                                       And <APPayment.docType, NotEqual <APDocType.prepayment>,
                                                                            And <APPayment.docType, NotEqual <APDocType.refund>,

                                                                                 And <APPaymentExt.openDoc, Equal <boolTrue>,
                                                                                      And2 <Match <Vendor, Current <AccessInfo.userName> >,
                                                                                            And <Where2 <Where <PaymentMethod.aPCreateBatchPayment, Equal <True>, And <CABatchDetail.batchNbr, IsNull> >,
                                                                                                         Or <Where <PaymentMethod.aPCreateBatchPayment, Equal <False>,
                                                                                                                    And <PaymentMethod.aPPrintChecks, Equal <boolTrue>,
                                                                                                                         And <APPayment.printed, Equal <boolFalse> > > > > > > > > > > >,
                                                                OrderBy <
                                                                    Asc <APPaymentExt.docType,
                                                                         Asc <APPaymentExt.refNbr> > >
                                                                >(this);

            if (filter.PayDate != null)
            {
                sel.WhereAnd <Where <APPaymentExt.docDate, LessEqual <Current <DocFilter.payDate> > > >();
            }

            if (filter.PayAccountID != null)
            {
                sel.WhereAnd <Where <APPaymentExt.cashAccountID, Equal <Current <DocFilter.payAccountID> > > >();
            }

            if (filter.PayTypeID != null)
            {
                sel.WhereAnd <Where <APPaymentExt.paymentMethodID, Equal <Current <DocFilter.payTypeID> > > >();
            }

            APPaymentKey lastInvoice = null;

            foreach (PXResult <APPaymentExt, CashAccount, Vendor, PaymentMethod, CABatchDetail> it in sel.Select())
            {
                APPaymentExt inv    = (APPaymentExt)it;
                CashAccount  acct   = (CashAccount)it;
                APPaymentKey invNbr = new APPaymentKey(inv.DocType, inv.RefNbr);
                if (lastInvoice != null && lastInvoice.CompareTo(invNbr) == 0)
                {
                    continue;                     //Skip multiple entries for invoice
                }
                //inv.DocCount = it.RowCount;
                lastInvoice = invNbr;
                CashAcctKey  key = new CashAcctKey(inv.CashAccountID.Value, inv.PaymentMethodID);
                CheckSummary res = null;
                if (!result.ContainsKey(key))
                {
                    res = new CheckSummary();
                    res.PayAccountID = inv.CashAccountID;
                    res.PayTypeID    = inv.PaymentMethodID;
                    res.CuryID       = acct.CuryID;
                    res.CuryInfoID   = inv.CuryInfoID;
                    result[key]      = res;
                }
                else
                {
                    res = result[key];
                }
                Aggregate(res, inv, filter.PayDate);
            }
            return(result.Values);
        }
Ejemplo n.º 9
0
		public ReadOnlyCollection<Document> Get(int? count = null, int? offset = null, long? ownerId = null, DocFilter? filter = null)
		{
			int totalCount;
			return Get(out totalCount, count, offset, ownerId, filter);
		}