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

            if (invoice == null)
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled(sender, invoice, false);
            PXUIFieldAttribute.SetEnabled <ARInvoiceExt.selected>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <ARInvoiceExt.retainageReleasePct>(sender, invoice, true);
            PXUIFieldAttribute.SetEnabled <ARInvoiceExt.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 <ARInvoiceExt.selected>(
                        invoice,
                        null,
                        new PXSetPropertyException(PX.Objects.AP.Messages.ErrorRaised, PXErrorLevel.RowError));

                    PXUIFieldAttribute.SetEnabled <ARInvoiceExt.selected>(sender, invoice, false);
                }
            }
        }
        public static void ReleaseRetainage(ARInvoiceEntry graph, ARInvoiceExt invoice, ARRetainageFilter 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;

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

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

            graph.Save.Press();

            if (isAutoRelease)
            {
                List <ARRegister> toRelease = new List <ARRegister>()
                {
                    retainageInvoice
                };
                using (new PXTimeStampScope(null))
                {
                    ARDocumentRelease.ReleaseDoc(toRelease, true);
                }
            }
        }
        protected virtual IEnumerable documentList()
        {
            foreach (PXResult <ARInvoiceExt> result in PXSelect <ARInvoiceExt,
                                                                 Where2 <
                                                                     Where <Current2 <ARRetainageFilter.customerID>, IsNull, Or <ARInvoiceExt.customerID, Equal <Current2 <ARRetainageFilter.customerID> > > >,
                                                                     And2 <Where <Current2 <ARRetainageFilter.projectID>, IsNull, Or <ARInvoiceExt.projectID, Equal <Current2 <ARRetainageFilter.projectID> > > >,
                                                                           And2 <Where <Current2 <ARRetainageFilter.branchID>, IsNull, Or <ARInvoiceExt.branchID, Equal <Current2 <ARRetainageFilter.branchID> > > >,
                                                                                 And2 <Where <Current <ARRetainageFilter.showBillsWithOpenBalance>, Equal <True>,
                                                                                              Or <Where <ARInvoiceExt.curyDocBal, Equal <decimal0>,
                                                                                                         And <Current <ARRetainageFilter.showBillsWithOpenBalance>, NotEqual <True> > > > >,
                                                                                       And <ARInvoiceExt.curyRetainageUnreleasedAmt, Greater <decimal0>,
                                                                                            And <ARInvoiceExt.curyRetainageTotal, Greater <decimal0>,
                                                                                                 And <ARInvoiceExt.docType, Equal <ARDocType.invoice>,
                                                                                                      And <ARInvoiceExt.retainageApply, Equal <True>,
                                                                                                           And <ARInvoiceExt.released, Equal <True>,
                                                                                                                And <ARInvoiceExt.docDate, LessEqual <Current <ARRetainageFilter.docDate> > > > > > > > > > > >,
                                                                 OrderBy <Asc <ARInvoiceExt.refNbr> > > .Select(this))
            {
                ARInvoiceExt doc = result;

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

                if (NotReleasedRetainageInvoice == null)
                {
                    yield return(doc);
                }
            }
        }
Ejemplo n.º 4
0
        private ARTran SearchProjectTransaction(ARInvoiceExt doc)
        {
            ARRetainageFilter filter     = Filter.Current;
            List <object>     parameters = new List <object>();

            var selectProjectTransaction = new PXSelectJoin <ARTran,
                                                             LeftJoin <Account, On <Account.accountID, Equal <ARTran.accountID> > >,
                                                             Where <ARTran.tranType, Equal <Required <ARTran.tranType> >,
                                                                    And <ARTran.refNbr, Equal <Required <ARTran.refNbr> > > > >(this);

            parameters.Add(doc.DocType);
            parameters.Add(doc.RefNbr);

            if (filter.ProjectTaskID != null)
            {
                selectProjectTransaction.WhereAnd <Where <ARTran.taskID, Equal <Required <ARTran.taskID> > > >();
                parameters.Add(filter.ProjectTaskID);
            }

            if (filter.AccountGroupID != null)
            {
                selectProjectTransaction.WhereAnd <Where <Account.accountGroupID, Equal <Required <Account.accountGroupID> > > >();
                parameters.Add(filter.AccountGroupID);
            }

            if (filter.CostCodeID != null)
            {
                selectProjectTransaction.WhereAnd <Where <ARTran.costCodeID, Equal <Required <ARTran.costCodeID> > > >();
                parameters.Add(filter.CostCodeID);
            }

            if (filter.InventoryID != null)
            {
                selectProjectTransaction.WhereAnd <Where <ARTran.inventoryID, Equal <Required <ARTran.inventoryID> > > >();
                parameters.Add(filter.InventoryID);
            }

            return(selectProjectTransaction.SelectSingle(parameters.ToArray()));
        }