コード例 #1
0
        protected virtual void AP1099Year_BranchID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            AP1099Year year = e.Row as AP1099Year;

            if (year == null)
            {
                return;
            }

            year.FinYear = null;
        }
コード例 #2
0
        public virtual IEnumerable Year1099SummaryReport(PXAdapter adapter)
        {
            AP1099Year filter = Year_Header.Current;

            if (filter != null)
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                Branch cbranch = PXSelect <Branch, Where <Branch.branchID, Equal <Current <AccessInfo.branchID> > > > .Select(this);

                parameters["MasterBranchID"] = cbranch != null ? cbranch.BranchCD : null;
                parameters["FinYear"]        = filter.FinYear;
                throw new PXReportRequiredException(parameters, "AP654000", Messages.Year1099SummaryReport);
            }
            return(adapter.Get());
        }
        protected virtual void AP1099Year_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            AP1099Year year1099 = (AP1099Year)e.Row;

            if (year1099 == null)
            {
                return;
            }

            close1099Year.SetEnabled(!string.IsNullOrEmpty(year1099.FinYear) && year1099.Status == AP1099Year.status.Open);

            int?[] childBranches = BranchMaint.GetChildBranches(this, Year_Header.Current.BranchID)
                                   .Select(branch => branch.BranchID)
                                   .ToArray();

            if (childBranches.Length == 0)
            {
                return;
            }

            bool hasUnappliedPrepayments = PXSelectJoin <APRegister,
                                                         InnerJoin <Vendor,
                                                                    On <APRegister.vendorID, Equal <Vendor.bAccountID> >,
                                                                    InnerJoin <FinPeriod,
                                                                               On <APRegister.finPeriodID, Equal <FinPeriod.finPeriodID> > > >,
                                                         Where <Vendor.vendor1099, Equal <True>,
                                                                And <APRegister.docType, Equal <APDocType.prepayment>,
                                                                     And <APRegister.status, NotEqual <APDocStatus.closed>,
                                                                          And <FinPeriod.finYear, Equal <Current <AP1099Year.finYear> >,
                                                                               And <APRegister.branchID, In <Required <APRegister.branchID> > > > > > > >
                                           .SelectWindowed(this, 0, 1, childBranches)
                                           .Any();

            PXSetPropertyException finYearExeption =
                hasUnappliedPrepayments
                                        ? new PXSetPropertyException(Messages.ExistsUnappliedPayments, PXErrorLevel.Warning, year1099.FinYear)
                                        : null;

            sender.RaiseExceptionHandling <AP1099Year.finYear>(
                year1099,
                year1099.FinYear,
                finYearExeption);
        }
        protected virtual void AP1099Year_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            AP1099Year year1099 = (AP1099Year)e.Row;

            if (year1099 == null)
            {
                return;
            }

            close1099Year.SetEnabled(!string.IsNullOrEmpty(year1099.FinYear) && year1099.Status == AP1099Year.status.Open);

            bool hasUnappliedPrepayments = PXSelectJoin <APRegister,
                                                         InnerJoin <Vendor, On <APRegister.vendorID, Equal <Vendor.bAccountID> >,
                                                                    InnerJoin <FinPeriod, On <APRegister.finPeriodID, Equal <FinPeriod.finPeriodID> > > >,
                                                         Where <Vendor.vendor1099, Equal <True>,
                                                                And <APRegister.docType, Equal <APDocType.prepayment>,
                                                                     And <APRegister.status, NotEqual <APDocStatus.closed>,
                                                                          And <FinPeriod.finYear, Equal <Current <AP1099Year.finYear> > > > > > > .Select(this).Any();

            sender.RaiseExceptionHandling <AP1099Year.finYear>(year1099, year1099.FinYear, hasUnappliedPrepayments
                                ? new PXSetPropertyException(Messages.ExistsUnappliedPayments, PXErrorLevel.Warning, year1099.FinYear)
                                : null);
        }