Import Amount Paid in screen Bill And Adjusment using webservices API in acumatica system

后端 未结 1 1486
名媛妹妹
名媛妹妹 2021-01-29 03:10

I need to import value of Amount Paid using webservices to Acumatica ERP System. Please refer to this screenshot below.

I have already create some codes using R

相关标签:
1条回答
  • 2021-01-29 03:30

    Looks like there is an issue with Adjustments data view delegate caused by performance improvements we made for the Bills and Adjustments screen about a year ago. I've forwarded all details to Acumatica engineering team for further investigation.

    As a temporary workaround you can implement an extension for the APInvoiceEntry BLC and slightly change delegate of the Adjustments data view:

    public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
    {
        [PXCopyPasteHiddenView]
        public PXSelectJoin<APAdjust,
            InnerJoin<APPayment, On<APPayment.docType, Equal<APAdjust.adjgDocType>,
                And<APPayment.refNbr, Equal<APAdjust.adjgRefNbr>>>>> Adjustments;
    
        public IEnumerable adjustments()
        {
            IEnumerable result;
    
            bool origIsImport = Base.IsImport;
            Base.IsImport = false;
            try
            {
                result = Base.Adjustments.Select();
            }
            finally
            {
                Base.IsImport = origIsImport;
            }
    
            return result;
        }
    }
    

    With the temporary workaround applied, I was able to update AmountPaid field with following set of commands. Given the level of complexity put into the Adjustments data view (as it has to work with both records retrieved from database and created at runtime), you have to use RowNumber service command when there are more than 1 document in the Applications tab (Screen-Based API commands of the Key type unfortunately will not work to locate record in the Applications tab).

    The sample below will send 2 requests to Acumatica API: - 1st call to export all records from the Applications tab - by looping though returned array, you can determine what are RowNumbers of records, that require new value set for AmountPaid - with your 2nd call, you pass RowNumber and assign new value to the AmountPaid field

    Screen context = new Screen();
    context.CookieContainer = new System.Net.CookieContainer();
    context.Url = "http://localhost/AP301000/Soap/AP301000.asmx";
    context.Login("admin", "123");
    
    Content billSchema = context.GetSchema();
    
    // 1st call to export all records from the Applications tab
    billSchema.DocumentSummary.Type.Commit = false;
    billSchema.DocumentSummary.Type.LinkedCommand = null;
    
    var commands = new Command[]
    {
        new Value
        {
            Value = "Bill",
            LinkedCommand = billSchema.DocumentSummary.Type
        },
        new Value
        {
            Value = "000927",
            LinkedCommand = billSchema.DocumentSummary.ReferenceNbr
        },
        billSchema.Applications.DocTypeDisplayDocType,
        billSchema.Applications.ReferenceNbrDisplayRefNbr,
        billSchema.Applications.Balance
    };
    var applications = context.Submit(commands).ToList();
    // end of 1st call to export all records from the Applications tab
    
    // 2nd call to set AmountPaid in the Applications tab
    var cmds = new List<Command>();
    foreach (var application in applications)
    {
        cmds.Add(
            new Value
            {
                Value = applications.IndexOf(application).ToString(),
                LinkedCommand = billSchema.Applications.ServiceCommands.RowNumber
            });
        cmds.Add(
            new Value
            {
                Value = application.Applications.Balance.Value,
                LinkedCommand = billSchema.Applications.AmountPaid
            });
    }
    cmds.Add(billSchema.Actions.Save);
    context.Submit(cmds.ToArray());
    // end of 2nd call to set AmountPaid in the Applications tab
    
    0 讨论(0)
提交回复
热议问题