protected virtual void TaxTranDefaulting(PXCache sender, TaxTran tran)
        {
            _Tax = SalesTax_Select.Select(tran.TaxID);

            sender.SetDefaultExt <TaxTran.accountID>(tran);
            sender.SetDefaultExt <TaxTran.subID>(tran);
            sender.SetDefaultExt <TaxTran.taxType>(tran);
            sender.SetDefaultExt <TaxTran.tranDate>(tran);

            _TaxRev = SalesTaxRev_Select.Select(tran.TaxID, tran.TaxType, tran.TranDate);

            sender.SetDefaultExt <TaxTran.taxBucketID>(tran);
            sender.SetDefaultExt <TaxTran.taxRate>(tran);

            _Tax    = null;
            _TaxRev = null;
        }
        private void AddReversedTaxTransactionsToReversedTaxAdjustment(TaxAdjustment originalTaxAdj, TaxAdjustment reversedTaxAdj)
        {
            if (reversedTaxAdj == null)
            {
                PXTrace.WriteError("The creation reversed Tax Adjustment for the Tax Adjustment with the ID {0} failed", originalTaxAdj.RefNbr);
                throw new PXException("The creation reversed Tax Adjustment for the Tax Adjustment with the ID {0} failed", originalTaxAdj.RefNbr);
            }

            var originalTransactions =
                PXSelect <TaxTran,
                          Where <TaxTran.tranType, Equal <Required <TaxAdjustment.docType> >,
                                 And <TaxTran.refNbr, Equal <Required <TaxAdjustment.refNbr> > > > >
                .Select(this, originalTaxAdj.DocType, originalTaxAdj.RefNbr);

            foreach (TaxTran originalTaxTran in originalTransactions)
            {
                TaxTran reversingTran = PXCache <TaxTran> .CreateCopy(originalTaxTran);

                reversingTran.TranType = originalTaxTran.TranType;
                reversingTran.RefNbr   = reversedTaxAdj.RefNbr;
                reversingTran.RecordID = null;

                reversingTran.Released   = null;
                reversingTran.CuryInfoID = null;

                reversingTran.ExpenseAmt     = -originalTaxTran.ExpenseAmt;
                reversingTran.CuryExpenseAmt = -originalTaxTran.CuryExpenseAmt;

                reversingTran.OrigTaxableAmt     = -originalTaxTran.OrigTaxableAmt;
                reversingTran.CuryOrigTaxableAmt = -originalTaxTran.CuryOrigTaxableAmt;

                reversingTran.TaxAmt     = -originalTaxTran.TaxAmt;
                reversingTran.CuryTaxAmt = -originalTaxTran.CuryTaxAmt;

                reversingTran.TaxableAmt     = -originalTaxTran.TaxableAmt;
                reversingTran.CuryTaxableAmt = -originalTaxTran.CuryTaxableAmt;

                reversingTran.ReportTaxAmt     = -originalTaxTran.ReportTaxAmt;
                reversingTran.ReportTaxableAmt = -originalTaxTran.ReportTaxableAmt;

                Transactions.Insert(reversingTran);
            }

            Transactions.View.RequestRefresh();
        }
Beispiel #3
0
        protected virtual void TaxTran_TaxID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            TaxTran tran = (TaxTran)e.Row;

            if (tran == null)
            {
                return;
            }

            TaxTran copy = (TaxTran)sender.CreateCopy(tran);

            copy.TaxID = (string)e.NewValue;
            TaxTranDefaulting(sender, copy);

            if (copy.TaxBucketID == null)
            {
                throw new PXSetPropertyException(Messages.EffectiveTaxNotFound, copy.TaxID, new TaxType.Attribute().ValueLabelDic[copy.TaxType]);
            }
        }