BOI - How to insert an adjustment record in AP Invoice Data Entry

SOLVED

Hi

I am using BOI to insert records in AP Invoice Data Entry. I am able to insert the header and lines record
successfully. Can anybody please help me understand how can I insert an adjustment record? Because while inserting an adjustment
record I have to use the same invoice number inserted before and when I try to insert the same invoice number, I get an exception which says
"Invoice number is in use by another user". Is there any header field that I have to set while inserting an adjustment record?
The header fields that I am inserting are
APDivisionNo
VendorNo
BatchNo
InvoiceNo
InvoiceDate
InvoiceDueDate
HoldPayment
Comment
Adjustment
RecurringInvoice
SeparateCheck
InvoiceAmt
NetInvoiceAmt
TermsCode

Thank you in advance.

Parents
  • 0

    mm09,

    Are you trying to create an invoice and its adjustment in the same data entry batch?  You cannot do that.  You can only create adjustment for an invoice that has been updated.  An adjustment invoice is like a normal invoice except that you set Adjustment$ to Y.  When you set the InvoiceNo$, you will get a warning (-1).  You can continue to SetKey and the rest of the fields.

  • 0 in reply to Natasha Chang

    Thank you Natasha. I appreciate your help.

    So I will have to add one more header record with same invoice number but Adjustment$ set to Y and a line item with the adjustment amount. Should the amount on line match with the invoice amount on header?

    For Example, I have added an invoice record where Adjustment$ is set to N with invoice amt 1200.

    Now I want to add an adjustment record with adjustment amount -500. I create a header record with same invoice number where Adjustment$ is set to Y.

    What should be the Invoice Amt on (adjustment)header and (adjustment)line in this case?

    Thank you again for your help.

  • 0 in reply to mm09

    Both header and line amounts need to be -500.

  • 0 in reply to Natasha Chang

    Natasha,

    When I try to add the header and line record with the same invoice number and Adjustment$ set to Y and with the same header and line amount, I get an error which says "The invoice is out of balance. Do you want to delete the Invoice?". Where am I going wrong?

  • 0 in reply to mm09

    Did you set InvoiceAmt in the header and DistributionAmt in the detail?  There are several amount fields.

    Here is my really quick test in PVX syntax:

    o = NEW("AP_Invoice_bus", %sys_ss)

    r = o'SetKeyValue("APDivisionNo$", "01")

    r = o'SetKeyValue("VendorNo$", "AIRWAY")

    r = o'SetKeyValue("InvoiceNo$", "1053190")

    r = o'SetKey()

    r = o'SetValue("Adjustment$", "Y")

    r = o'SetValue("InvoiceAmt", -10)

    r = o'AddLine()

    r = o'Lines'SetValue("AccountKey$", "100000000")

    r = o'Lines'SetValue("DistributionAmt", -10)

    r = o'Lines'Write()

    r = o'Write()

     

  • 0 in reply to Natasha Chang

    Yes. I am setting the same amount in  InvoiceAmt field in Header and in DistributionAmt field in line.

  • 0 in reply to mm09

    See my example above.  Is your script similar to mine?

  • 0 in reply to Natasha Chang

    Natasha,

    My script looks the same like yours except that I am also setting the other header fields in the adjustment invoice and I am setting the same value in InvoiceAmt and in DistributionAmt field.

    r = o'SetKeyValue("APDivisionNo$", "00")

    r = o'SetKeyValue("VendorNo$","HD")

    r = o'SetKeyValue("InvoiceNo$","1000124")

    r = o'SetKey()

    r = o'SetValue("InvoiceDate$", "04/30/2014")

    r = o'SetValue("InvoiceDueDate$", "04/30/2014")

    r = o'SetValue("HoldPayment$", "N")

    r = o'SetValue("Comment$", "IMPORTED")

    r = o'SetValue("Adjustment$", "Y")

    r = o'SetValue("RecurringInvoice$", "N")

    r = o'SetValue("SeparateCheck$", "N")

    r = o'SetValue("InvoiceAmt","-200.00")

    r = o'SetValue("TermsCode$", "00")

    r = o'Lines'AddLine()

    r = o'Lines'SetValue("AccountKey$","220100000")

    r = o'Lines'SetValue("DistributionAmt","-200.00")

    r = o'Lines'Write()

    r = o'Write()

    Thanks you.

  • 0 in reply to mm09

    I forgot to mention something. Before setting APDivisionNo, I am selecting the batch number. It is the same batch number which has the invoice with same invoice number and where Adjustment$ is set to N.(It is the invoice without the adjustment amount)

    r = o'Selectbatch("01113")

  • 0 in reply to mm09

    The InvoiceAmt and DistributionAmt fields are numeric fields.  Remove the quotes from around the values when doing the SetValue() of a numeric field.

    The two lines from your example should be:

    r = o'SetValue("InvoiceAmt",-200.00)

    and

    r = o'Lines'SetValue("DistributionAmt",-200.00)

Reply Children
  • 0 in reply to Steve Passmore

    Hi Steve,

    Thank you for pointing that out. I made the changes but that did not solve my problem :( . I am still getting "The invoice is out of balance. Do you want to delete the Invoice?". error. :(

  • 0 in reply to mm09

    "It is the same batch number which has the invoice with same invoice number and where Adjustment$ is set to N.(It is the invoice without the adjustment amount)"

    Are you trying to create 2 invoices for the same vendor with the same invoice number in the same batch?  You cannot adjust an invoice that has not been updated.  Your script may be modifying the existing invoice (the one that's not an adjustment) and adding an extra line to that invoice.  Therefore the line total doesn't match the invoice amount.  Does o'SetKey() return 1 (existing record) or 2 (new record)?

  • 0 in reply to Natasha Chang

    You are right Natasha. I  am trying to create 2 invoices for the same vendor with the same invoice number in the same batch. I checked o'SetKey returns 0. I think you pointed out where I am going wrong. Thank you. Can you please help me understand what does "You cannot adjust an invoice that has not been updated"  mean? What is updating an invoice?

    Thank you again. You are helping me to understand this better.

  • 0 in reply to mm09
    verified answer

    The reason you do an adjustment is because the original invoice doesn't exist in data entry anymore.  Someone has printed and updated the invoice register.  And you need to change the amount.

    If the invoice is still in data entry, you can just modify that invoice, instead of creating an adjustment invoice.

    If SetKey returns 1 (invoice exists in data entry), you can use GetValue to get the current invoice amount, then do SetValue of the new amount (existing amount - 200).  You can add a new line with distribution amount = -200.  Then the header and detail totals should match.

  • 0 in reply to Natasha Chang

    Natasha,

    Got your point. I was trying to create the adjustment record when the invoice was still in the data entry and that is why I was getting these errors. Now it is clear how the adjustment  works.

    Thank you so much once again for helping me to understand this.

    Have a great day!!