Exemple #1
0
        protected virtual void TaxRev_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            if (Tax.Current.TaxVendorID == null)
            {
                switch (((TaxRev)e.Row).TaxBucketID)
                {
                case -1:
                    ((TaxRev)e.Row).TaxType = "P";
                    break;

                case -2:
                    ((TaxRev)e.Row).TaxType = "S";
                    break;
                }
            }
            else if (((TaxRev)e.NewRow).TaxBucketID != null)
            {
                TaxBucket bucket = (TaxBucket)PXSelect <TaxBucket, Where <TaxBucket.vendorID, Equal <Current <Tax.taxVendorID> >, And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > > .Select(this, ((TaxRev)e.NewRow).TaxBucketID);

                if (bucket != null)
                {
                    ((TaxRev)e.NewRow).TaxType = bucket.BucketType;
                }
            }

            object StartDate = ((TaxRev)e.NewRow).StartDate;
            object TaxType   = ((TaxRev)e.NewRow).TaxType;

            e.Cancel = UpdateRevisions(sender, (TaxRev)e.NewRow, PXSelect <TaxRev, Where <TaxRev.taxID, Equal <Current <Tax.taxID> >, And <TaxRev.taxType, Equal <Required <TaxRev.taxType> >, And <TaxRev.startDate, Equal <Required <TaxRev.startDate> > > > > > .Select(this, TaxType, StartDate), false);
        }
        protected virtual void TaxBucketMaster_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            TaxBucket bucket = (TaxBucket)PXSelect <TaxBucket, Where <TaxBucket.vendorID, Equal <Required <TaxBucket.vendorID> >, And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > > .Select(this, ((TaxBucketMaster)e.Row).VendorID, ((TaxBucketMaster)e.Row).BucketID);

            if (bucket != null)
            {
                ((TaxBucketMaster)e.Row).BucketType = bucket.BucketType;
            }
        }
Exemple #3
0
        protected virtual void TaxRev_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
        {
            TaxRev oldTaxRev = e.Row as TaxRev;
            TaxRev newTaxRev = e.NewRow as TaxRev;

            if (newTaxRev == null)
            {
                return;
            }

            if (Tax.Current.TaxVendorID == null)
            {
                if (oldTaxRev == null)
                {
                    return;
                }

                switch (oldTaxRev.TaxBucketID)
                {
                case -1:
                    oldTaxRev.TaxType = "P";
                    break;

                case -2:
                    oldTaxRev.TaxType = "S";
                    break;
                }
            }
            else if (newTaxRev.TaxBucketID != null)
            {
                TaxBucket bucket = (TaxBucket)
                                   PXSelect <TaxBucket,
                                             Where <TaxBucket.vendorID, Equal <Current <Tax.taxVendorID> >,
                                                    And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > >
                                   .Select(this, newTaxRev.TaxBucketID);

                if (bucket != null)
                {
                    newTaxRev.TaxType = bucket.BucketType;
                }
            }

            var summary =
                PXSelect <TaxRev,
                          Where <TaxRev.taxID, Equal <Current <Tax.taxID> >,
                                 And <TaxRev.taxType, Equal <Required <TaxRev.taxType> >,
                                      And <TaxRev.startDate, Equal <Required <TaxRev.startDate> > > > > >
                .Select(this, newTaxRev.TaxType, newTaxRev.StartDate);

            e.Cancel = UpdateRevisions(sender, newTaxRev, summary, false);
        }
Exemple #4
0
        protected virtual void TaxRev_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
        {
            TaxRev taxRevision = e.Row as TaxRev;

            if (taxRevision == null)
            {
                return;
            }

            if (Tax.Current.TaxVendorID == null)
            {
                switch (taxRevision.TaxBucketID)
                {
                case -1:
                    taxRevision.TaxType = CSTaxType.Use;
                    break;

                case -2:
                    taxRevision.TaxType = CSTaxType.Sales;
                    break;
                }
            }
            else if (taxRevision.TaxBucketID != null)
            {
                TaxBucket bucket = (TaxBucket)
                                   PXSelect <TaxBucket,
                                             Where <TaxBucket.vendorID, Equal <Current <Tax.taxVendorID> >,
                                                    And <TaxBucket.bucketID, Equal <Required <TaxBucket.bucketID> > > > >
                                   .Select(this, taxRevision.TaxBucketID);

                if (bucket != null)
                {
                    taxRevision.TaxType = bucket.BucketType;
                }
            }

            object StartDate = taxRevision.StartDate;
            object TaxType   = taxRevision.TaxType;
            var    summary   =
                PXSelect <TaxRev,
                          Where <TaxRev.taxID, Equal <Current <Tax.taxID> >,
                                 And <TaxRev.taxType, Equal <Required <TaxRev.taxType> >,
                                      And <TaxRev.startDate, Equal <Required <TaxRev.startDate> > > > > >
                .Select(this, TaxType, StartDate);

            e.Cancel = UpdateRevisions(sender, taxRevision, summary, true);
        }