Ejemplo n.º 1
0
        public override void Add(ARInvoice item0, SOInvoice item1, CurrencyInfo curyInfo)
        {
            base.Add(item0, item1, curyInfo);
            List <int> indexes;

            if (!typedInvoices.TryGetValue(item0.DocType, out indexes))
            {
                typedInvoices.Add(item0.DocType, indexes = new List <int>());
            }
            indexes.Add(Count - 1);
        }
Ejemplo n.º 2
0
        public virtual IEnumerable soInvoiceList()
        {
            if (Filter.Current.Action == "<SELECT>")
            {
                yield break;
            }

            SOInvoiceFilter filter = Filter.Current;


            string actionID = (string)SOInvoiceList.GetTargetFill(null, null, null, Filter.Current.Action, "@ActionName");

            if (_ActionChanged)
            {
                SOInvoiceList.Cache.Clear();
            }

            foreach (ARInvoice item in SOInvoiceList.Cache.Updated)
            {
                yield return(item);
            }

            PXSelectBase <ARInvoice> cmd;

            switch (actionID)
            {
            case "Release":
                cmd = new PXSelectJoin <ARInvoice,
                                        InnerJoin <SOInvoice, On <SOInvoice.docType, Equal <ARInvoice.docType>, And <SOInvoice.refNbr, Equal <ARInvoice.refNbr> > > >,
                                        Where <ARInvoice.hold, Equal <boolFalse>, And <ARInvoice.released, Equal <boolFalse> > > >(this);
                break;

            case "Post":
                cmd = new PXSelectJoinGroupBy <ARInvoice,
                                               InnerJoin <SOInvoice, On <SOInvoice.docType, Equal <ARInvoice.docType>, And <SOInvoice.refNbr, Equal <ARInvoice.refNbr> > >,
                                                          InnerJoin <SOOrderShipment, On <SOOrderShipment.invoiceType, Equal <ARInvoice.docType>, And <SOOrderShipment.invoiceNbr, Equal <ARInvoice.refNbr> > >,
                                                                     InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> >,
                                                                                InnerJoin <ARTran, On <ARTran.tranType, Equal <ARInvoice.docType>, And <ARTran.refNbr, Equal <ARInvoice.refNbr> > >,
                                                                                           LeftJoin <INTran, On <INTran.aRDocType, Equal <ARTran.tranType>, And <INTran.aRRefNbr, Equal <ARTran.refNbr>, And <INTran.aRLineNbr, Equal <ARTran.lineNbr> > > > > > > > >,
                                               Where <ARInvoice.released, Equal <boolTrue>, And <SOOrderType.iNDocType, NotEqual <INTranType.noUpdate>, And <SOOrderShipment.invtRefNbr, IsNull, And <ARTran.lineType, Equal <SOLineType.inventory>, And <INTran.refNbr, IsNull> > > > >,
                                               Aggregate <
                                                   GroupBy <ARInvoice.docType,
                                                            GroupBy <ARInvoice.refNbr,
                                                                     GroupBy <ARInvoice.released> > > > >(this);
                break;

            case "CaptureCCPayment":
                cmd = new PXSelectJoin <ARInvoice,
                                        InnerJoin <SOInvoice, On <SOInvoice.docType, Equal <ARInvoice.docType>, And <SOInvoice.refNbr, Equal <ARInvoice.refNbr> > >,
                                                   InnerJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <SOInvoice.pMInstanceID> >,
                                                              InnerJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <CustomerPaymentMethod.paymentMethodID>,
                                                                                            And <PaymentMethod.paymentType, Equal <PaymentMethodType.creditCard>,
                                                                                                 And <PaymentMethod.aRIsProcessingRequired, Equal <True> > > > > > >,
                                        Where <SOInvoice.isCCCaptureFailed, Equal <Current <SOInvoiceFilter.showFailedCCCapture> > > >(this);
                break;

            case "CreditHold":
                cmd = new PXSelectJoin <ARInvoice,
                                        InnerJoin <SOInvoice, On <SOInvoice.docType, Equal <ARInvoice.docType>, And <SOInvoice.refNbr, Equal <ARInvoice.refNbr> > >,
                                                   LeftJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <SOInvoice.pMInstanceID> >,
                                                             LeftJoin <PaymentMethod, On <PaymentMethod.paymentMethodID, Equal <CustomerPaymentMethod.paymentMethodID>,
                                                                                          And <PaymentMethod.paymentType, Equal <PaymentMethodType.creditCard>,
                                                                                               And <PaymentMethod.aRIsProcessingRequired, Equal <True> > > > > > >,
                                        Where <PaymentMethod.paymentMethodID, IsNull> >(this);
                break;

            default:
                cmd = new PXSelectJoin <ARInvoice,
                                        InnerJoin <SOInvoice, On <SOInvoice.docType, Equal <ARInvoice.docType>, And <SOInvoice.refNbr, Equal <ARInvoice.refNbr> > > > >(this);
                break;
            }

            cmd.WhereAnd <Where <ARInvoice.docDate, LessEqual <Current <SOInvoiceFilter.endDate> > > >();

            if (filter.StartDate != null)
            {
                cmd.WhereAnd <Where <ARInvoice.docDate, GreaterEqual <Current <SOInvoiceFilter.startDate> > > >();
            }

            if (filter.CustomerID != null)
            {
                cmd.WhereAnd <Where <ARInvoice.customerID, Equal <Current <SOInvoiceFilter.customerID> > > >();
            }

            int startRow  = PXView.StartRow;
            int totalRows = 0;

            foreach (PXResult <ARInvoice, SOInvoice> res in cmd.View.Select(PXView.Currents, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows))
            {
                ARInvoice item = res;
                SOInvoice ext  = res;

                object paymentmethod;
                if ((paymentmethod = res[typeof(PaymentMethod)]) != null)
                {
                    item.IsCCPayment = ((PaymentMethod)paymentmethod).ARIsProcessingRequired != null;
                }
                else
                {
                    item.IsCCPayment = false;
                }

                if ((item = (ARInvoice)SOInvoiceList.Cache.Locate(item)) == null || SOInvoiceList.Cache.GetStatus(item) == PXEntryStatus.Notchanged)
                {
                    yield return((ARInvoice)res);
                }

                PXView.StartRow = 0;
            }
        }
Ejemplo n.º 3
0
        public virtual void UpdateDocState(SOInvoice doc, PX.CCProcessing.CCTranType lastOperation)
        {
            this.Document.Current = Document.Search<ARInvoice.refNbr>(doc.RefNbr, doc.DocType);

            bool needUpdate = CCPaymentEntry.UpdateCapturedState<SOInvoice>(doc, this.ccProcTran.Select());

            if (needUpdate)
            {
                //doc.PreAuthTranNumber = null;
                doc = this.SODocument.Update(doc);
                Document.Search<ARInvoice.refNbr>(doc.RefNbr, doc.DocType);
				if (doc.IsCCCaptured == true) 
				{
					foreach (CCProcTran tran in this.ccProcTran.Select()) 
					{
						if (String.IsNullOrEmpty(tran.RefNbr) || String.IsNullOrEmpty(tran.DocType)) 
						{
							tran.DocType = doc.DocType;
							tran.RefNbr = doc.RefNbr;
							this.ccProcTran.Update(tran);
						}
					}
				}
                this.Save.Press();
            }
        }