首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在更新UnitPrice时,当从发货中创建发票时,TaxAttribute.Calculate使用旧的扩展价格。

在更新UnitPrice时,当从发货中创建发票时,TaxAttribute.Calculate使用旧的扩展价格。
EN

Stack Overflow用户
提问于 2016-04-19 20:57:15
回答 1查看 216关注 0票数 3

在我们的加载项中,当使用Regex表达式根据我们自己的计算创建发货发票时,我们将修改UnitPrice。所有领域的情况似乎都很好,除了总是接受SOOrder税的税种。

我们创建了一个PXGraphExtension并使用了以下内容:

代码语言:javascript
复制
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType> order, PXResultset<SOShipLine, SOLine> details, Customer customer, DocumentList<ARInvoice, SOInvoice> list,
        Action<DateTime, PXResult<SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType>, PXResultset<SOShipLine, SOLine>, Customer, DocumentList<ARInvoice, SOInvoice>> method)
    {
        using (var scope = new PXTransactionScope())
        {                
            method(invoiceDate, order, details, customer, list);
            LookupBalesFromOrderAndShipment();
            scope.Complete();
        }
    }

在LookupBalesFromOrderAndShipment();中,我们根据计算修改UnitPrice,并使用新值调用Base.Transactions.Update(UpdatedLine),然后调用Base.Persist();

除了Tax Details选项卡之外,所有数据似乎都很好,该选项卡仍然使用旧的CuryLineAmt,而不是新创建的发票的新CuryLineAmt。

我尝试过在RowUpdated事件中强制重新计算税收,但它似乎没有做任何事情。

代码语言:javascript
复制
        protected virtual void ARTran_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
    {

        if (InvokeBaseHandler != null)
            InvokeBaseHandler(cache, e);


            TaxAttribute.Calculate<ARTran.taxCategoryID>(cache, e);


    }

声明var row = (ARTran)e.Row;检查变量会告诉我正确的新CuryLineAmt,但税收似乎仍然是根据SOOrder输入的内容计算的。

是否有其他方法强制进行税收计算或更新ARTax和ARTaxTran表而不存在任何风险?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-20 02:31:33

基函数InvoiceOrder更改税收计算方法,以适应最初创建的SalesInvoice:

代码语言:javascript
复制
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(this.Transactions.Cache, null, TaxCalc.ManualCalc);

每次访问此页面时,所使用的纳税计算方法都是SOInvoiceEntry构造函数中的一种:

代码语言:javascript
复制
TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Transactions.Cache, null, TaxCalc.ManualLineCalc);

您的解决方案将是在调用基本代表之后设置适当的纳税计算方法:

代码语言:javascript
复制
public delegate void InvoiceOrderDelegate(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list);
[PXOverride]
public void InvoiceOrder(DateTime invoiceDate, PXResult<SOOrderShipment,SOOrder,CurrencyInfo,SOAddress,SOContact,SOOrderType> order, PXResultset<SOShipLine,SOLine> details, Customer customer, DocumentList<ARInvoice,SOInvoice> list, InvoiceOrderDelegate baseMethod)
{
    baseMethod(invoiceDate,order,details,customer,list);

    TaxAttribute.SetTaxCalc<ARTran.taxCategoryID>(Base.Transactions.Cache, null, TaxCalc.ManualLineCalc);

    var tran = Base.Transactions.Current;
    tran.CuryUnitPrice = tran.CuryUnitPrice + 10m;
    Base.Transactions.Update(tran);
    Base.Actions.PressSave();
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36729324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档