Ejemplo n.º 1
0
        protected virtual void APInvoiceExt_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            APInvoiceExt invoice = e.Row as APInvoiceExt;

            if (invoice == null)
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled(sender, invoice, false);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.retainageReleasePct>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.curyRetainageReleasedAmt>(sender, invoice, true);

            if (invoice.Selected ?? true)
            {
                Dictionary <String, String> errors = PXUIFieldAttribute.GetErrors(sender, invoice, PXErrorLevel.Error);
                if (errors.Count > 0)
                {
                    invoice.Selected = false;
                    DocumentList.Cache.SetStatus(invoice, PXEntryStatus.Updated);
                    sender.RaiseExceptionHandling <APInvoiceExt.selected>(
                        invoice,
                        null,
                        new PXSetPropertyException(Messages.ErrorRaised, PXErrorLevel.RowError));

                    PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, false);
                }
            }
        }
Ejemplo n.º 2
0
        public static void ReleaseRetainage(APInvoiceEntry graph, APInvoiceExt invoice, APRetainageFilter filter, bool isAutoRelease)
        {
            graph.Clear(PXClearOption.ClearAll);
            PXUIFieldAttribute.SetError(graph.Document.Cache, null, null, null);

            RetainageOptions retainageOptions = new RetainageOptions();

            retainageOptions.DocDate          = filter.DocDate;
            retainageOptions.FinPeriodID      = filter.FinPeriodID;
            retainageOptions.CuryRetainageAmt = invoice.CuryRetainageReleasedAmt;
            retainageOptions.InvoiceNbr       = invoice.RetainageVendorRef;

            APInvoiceEntryRetainage retainageExt = graph.GetExtension <APInvoiceEntryRetainage>();

            APInvoice retainageInvoice = retainageExt.ReleaseRetainageProc(invoice, retainageOptions, isAutoRelease);

            graph.Save.Press();

            if (isAutoRelease && retainageInvoice.Hold != true)
            {
                List <APRegister> toRelease = new List <APRegister>()
                {
                    retainageInvoice
                };
                using (new PXTimeStampScope(null))
                {
                    APDocumentRelease.ReleaseDoc(toRelease, true);
                }
            }
        }
Ejemplo n.º 3
0
        protected virtual IEnumerable documentList()
        {
            foreach (PXResult <APInvoiceExt> result in PXSelect <APInvoiceExt,
                                                                 Where2 <
                                                                     Where <Current2 <APRetainageFilter.vendorID>, IsNull, Or <APInvoiceExt.vendorID, Equal <Current2 <APRetainageFilter.vendorID> > > >,
                                                                     And2 <Where <Current2 <APRetainageFilter.projectID>, IsNull, Or <APInvoiceExt.projectID, Equal <Current2 <APRetainageFilter.projectID> > > >,
                                                                           And2 <Where <Current2 <APRetainageFilter.branchID>, IsNull, Or <APInvoiceExt.branchID, Equal <Current2 <APRetainageFilter.branchID> > > >,
                                                                                 And2 <Where <Current <APRetainageFilter.showBillsWithOpenBalance>, Equal <True>,
                                                                                              Or <Where <APInvoiceExt.curyDocBal, Equal <decimal0>,
                                                                                                         And <Current <APRetainageFilter.showBillsWithOpenBalance>, NotEqual <True> > > > >,
                                                                                       And <APInvoiceExt.curyRetainageUnreleasedAmt, Greater <decimal0>,
                                                                                            And <APInvoiceExt.curyRetainageTotal, Greater <decimal0>,
                                                                                                 And <APInvoiceExt.docType, Equal <APDocType.invoice>,
                                                                                                      And <APInvoiceExt.retainageApply, Equal <True>,
                                                                                                           And <APInvoiceExt.released, Equal <True>,
                                                                                                                And <APInvoiceExt.docDate, LessEqual <Current <APRetainageFilter.docDate> > > > > > > > > > > >,
                                                                 OrderBy <Asc <APInvoiceExt.refNbr> > > .Select(this))
            {
                APInvoiceExt doc = result;

                PXResult <APRetainageInvoice> NotReleasedRetainageInvoice = PXSelect <APRetainageInvoice,
                                                                                      Where <APRetainageInvoice.isRetainageDocument, Equal <True>,
                                                                                             And <APRetainageInvoice.origDocType, Equal <Required <APInvoice.docType> >,
                                                                                                  And <APRetainageInvoice.origRefNbr, Equal <Required <APInvoice.refNbr> >,
                                                                                                       And <APRetainageInvoice.released, NotEqual <True> > > > > > .SelectSingleBound(this, null, doc.DocType, doc.RefNbr);

                if (NotReleasedRetainageInvoice == null)
                {
                    yield return(doc);
                }
            }
        }
Ejemplo n.º 4
0
        protected virtual void APInvoiceExt_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            APInvoiceExt invoice = e.Row as APInvoiceExt;

            if (invoice == null)
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled(sender, invoice, false);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.retainageReleasePct>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.curyRetainageReleasedAmt>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <APInvoiceExt.retainageVendorRef>(sender, invoice, true);

            APVendorRefNbrAttribute aPVendorRefNbrAttribute = sender.GetAttributesReadonly <APInvoiceExt.retainageVendorRef>()
                                                              .OfType <APVendorRefNbrAttribute>().FirstOrDefault();

            if (aPVendorRefNbrAttribute != null)
            {
                var args = new PXFieldVerifyingEventArgs(invoice, invoice.RetainageVendorRef, true);
                aPVendorRefNbrAttribute.FieldVerifying(sender, args);
            }

            if (invoice.Selected ?? true)
            {
                Dictionary <String, String> errors = PXUIFieldAttribute.GetErrors(sender, invoice, PXErrorLevel.Error);
                if (errors.Count > 0)
                {
                    invoice.Selected = false;
                    DocumentList.Cache.SetStatus(invoice, PXEntryStatus.Updated);
                    sender.RaiseExceptionHandling <APInvoiceExt.selected>(
                        invoice,
                        null,
                        new PXSetPropertyException(Messages.ErrorRaised, PXErrorLevel.RowError));

                    PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, false);
                }
            }
        }