Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conflict transferring to Sage Accpac 55 A/R 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

The below code is causing problems when being sent to Sage Accpac 55 Accounts Receivable.

Here's the problem:
- I am creating a receipt entry from my program. The user specifies the amount then transfers it to Accpac.
- The user can split the amount to pay several invoices, if desired.
- The amounts are correct when transferring, although, once the transfer is complete, the values are completely wrong in Accpac.

Scenario:
Say you have an entry with four or more details.
- Detail 'A' has a balance of $23.54;
- Detail 'B' has a balance of $307.85;
- Detail 'C' has a balance of $414.60;
- Detail 'D' has a balance of $104.45.

I have a total of $100 and want to place $25 on detail entry 'C' and the remaining $75 on detail entry 'B'.

Results:
When transferred to Accpac AR, the batch information is correct, the header information is correct but the details are completely wrong.

The total amount of $100 (Not $25) is applied to detail 'C' providing a Net Balance of $314.60.
Detail B is applying the entire remaining invoice balance (Not $75). Thus Applied Amount is $307.85 and a Net Balance of $0.00

Due to this conflict, the receipt unapplied amount is -$307.85.

I have been told that this code has never produced any problems when used in earlier Sage Accpac ERP versions.

...
'// Details.
With ARPOOP
.Browse "", 1
.Fetch
.Fields("PAYMTYPE").PutWithoutVerification ("CA") '// Batch Type.
.Fields("CNTBTCH").PutWithoutVerification (BatchInfo.BatchNum) '// Batch Number.
.Fields("CNTITEM").PutWithoutVerification (BatchInfo.EntryNum) '// Entry Number.
.Fields("IDCUST").PutWithoutVerification (ccrOneCust.strID) '// ID Customer.
.Fields("AMTRMIT").PutWithoutVerification (g_dblAppliedAmt) '// Receipt Amount.
.Process

'// Determine which lines to apply payment.
For i = 0 To g_intMultiple - 1
.Fields("PAYMTYPE").PutWithoutVerification ("CA") '// Batch Type.
.Fields("CNTBTCH").PutWithoutVerification (BatchInfo.BatchNum) '// Batch Number.
.Fields("CNTITEM").PutWithoutVerification (BatchInfo.EntryNum) '// Entry Number.
.Fields("CNTKEY").PutWithoutVerification (Str(g_intArLocation(i) * -1)) '// Count key.
.Fields("AMTRMIT").PutWithoutVerification (g_dblAppliedAmt) '// Receipt Amount.
.Read '// Put the correct record as the currect record.
.Fields("APPLY").value = "Y" '// Apply.
.Update '// Update the superview, but do not commit to the tables.
Next i
End With

ARTCR.Insert '// Commit to the tables.
ARBTA.Fields("CNTLASTITM").value = BatchInfo.EntryNum
ARBTA.Update
...

I have also tried entering the exact amount the user entered for each entry with the following (which produced a 'View Call Failed' error):
.Fields("PAYMAMT").value = g_strAppliedAmt(i).Amount

Any help would be greatly appreciated.
 
Record a macro in AR 5.5 for a receipt and check the code for changes, there might be some changes in the way that AR 5.5 processes receipts.
From your code above you are not applying any amounts to the invoices, so you can expect unexpected results.
 
Thanks ettienne for the response.

As mentioned the code ran without any problems in 54. The main difference with the macro is that the first amount is going to ...("PAYMAMT").

The error immediately appeared as soon as execution encountered that field.
 
I'm amazed that it worked in the previous version. I would change the code to explicitly apply the relevant amount to each invoice.
 
Sorry, I misread your code.
I see you do apply the receipt amount to the invoice
Code:
.Fields("AMTRMIT").PutWithoutVerification (g_dblAppliedAmt)             '// Receipt Amount.

There must be some subtle change in the way that AR 5.5 processes receipts. The only way to figure that out is by recording a macro and comparing the generated code to your existing code. The fact that it worked in a previous version does not mean it will work in a new version.
 
It seems like the order on the macro is slightly different than what is being used, but not by much.

I can try to rearrange the code to match the pattern of the macro.

Any suggestions on how to use the field PAYMAMT with obtaining the error? The execution seems to accept .Fields("AMTRMIT").value = g_strAppliedAmt(i).Amount, but macro only uses that for the total amount. (This may also be affected by the order)
 
I'm not sure why you are using ARPOOP.
I recorded a macro and this is what I get:
Code:
Dim DBLink As AccpacCOMAPI.AccpacDBLink
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView
Dim ARdetail5 As AccpacCOMAPI.AccpacView

Set DBLink = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
DBLink.OpenView "AR0041", ARbatch
DBLink.OpenView "AR0042", ARheader
DBLink.OpenView "AR0044", ARdetail1
DBLink.OpenView "AR0045", ARdetail2
DBLink.OpenView "AR0043", ARdetail3
DBLink.OpenView "AR0406", ARdetail4
DBLink.OpenView "AR0170", ARdetail5

ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail3, ARdetail1, ARdetail4, ARdetail5)
ARdetail1.Compose Array(ARheader, ARdetail2, Nothing)
ARdetail2.Compose Array(ARdetail1)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARheader)
ARdetail5.Compose Array(ARheader)

ARbatch.RecordClear
ARbatch.Fields("CODEPYMTYP").PutWithoutVerification ("CA")      ' Batch Type
ARbatch.Fields("CNTBTCH").PutWithoutVerification ("0")          ' Batch Number
ARbatch.RecordCreate 1
ARbatch.Fields("PROCESSCMD").PutWithoutVerification ("2")       ' Process Command
ARbatch.Process

ARheader.RecordCreate 2
ARheader.Fields("IDCUST").Value = "1100"                        ' Customer Number
ARheader.Fields("PROCESSCMD").PutWithoutVerification ("0")      ' Process Command Code
ARheader.Process
ARheader.Fields("AMTRMIT").Value = "100.000"                    ' Bank Receipt Amount

ARdetail1.RecordCreate 0
ARdetail1.Fields("IDINVC").Value = "IN0000000000058"            ' Document Number
ARdetail1.Fields("CNTPAYM").Value = "1"                         ' Payment Number
ARdetail1.Fields("AMTPAYM").Value = "75.000"                    ' Cust. Receipt Amount
ARdetail1.Insert

ARdetail1.RecordCreate 0
ARdetail1.Fields("IDINVC").Value = "IN0000000000060"            ' Document Number
ARdetail1.Fields("CNTPAYM").Value = "1"                         ' Payment Number
ARdetail1.Fields("AMTPAYM").Value = "25.00"                    ' Cust. Receipt Amount
ARdetail1.Insert

ARheader.Insert
 
I Thank you for your response and find this very interesting. The macro I have uses AR0061 (ARPOOP).

Here is the code I received from a previous test (exclude declarations and compositions.

Code:
ARRECMAC3detail4Fields("APPLY").Value = "Y"                           ' Apply

temp = ARRECMAC3detail4.Exists
temp = ARRECMAC3detail4.Exists

ARRECMAC3detail4Fields("PAYMAMT").Value = "100.000"                   ' Receipt Amount

temp = ARRECMAC3detail4.Exists
ARRECMAC3detail4.Update

ARRECMAC3detail4Fields("CNTITEM").PutWithoutVerification ("1")        ' Entry Number
ARRECMAC3detail4Fields("CNTKEY").PutWithoutVerification ("-4")        ' Count key

ARRECMAC3detail4.Read

ARRECMAC3detail4Fields("APPLY").Value = "Y"                           ' Apply

temp = ARRECMAC3detail4.Exists
temp = ARRECMAC3detail4.Exists
ARRECMAC3detail4.Update

ARRECMAC3detail4Fields("CNTITEM").PutWithoutVerification ("1")        ' Entry Number
ARRECMAC3detail4Fields("CNTKEY").PutWithoutVerification ("-4")        ' Count key

ARRECMAC3detail4.Read
ARRECMAC3header.Update
ARRECMAC3detail4.Cancel
temp = ARRECMAC3header.Exists
ARRECMAC3detail4Fields("PAYMTYPE").Value = "CA"                       ' Batch Type

ARRECMAC3detail4Fields("CNTBTCH").Value = "40"                        ' Batch Number
ARRECMAC3detail4Fields("CNTITEM").Value = "1"                         ' Entry Number
ARRECMAC3detail4Fields("IDCUST").Value = "1200"                       ' ID Customer
ARRECMAC3detail4Fields("AMTRMIT").Value = "200.000"                   ' Receipt Amount

ARRECMAC3detail4.Process

I'm still rearranging code but I can try your macro as well.
 
It might just be the way we are processing the AR receipts, I unchecked the Select Mode check box and then used the Document Number finder to pick the invoice to pay. If you leave Select Mode checked then it might fire up a different view.
 
Thank you for your posts ettienne.

I think the issue is now resolved. I recorded a new macro and recreated the entire proceedure to match the setup of the new macro. I then took some of the above code and inserted into the new code.

So far, so good. I received no errors and things seem to be working again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top