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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include Taxes in the A/P Invoice Batch

Status
Not open for further replies.

POSOL

Programmer
Jul 2, 2004
16
CA

Hi,

I am working on stand alone VB application to import invoice into ACCPAC. And I'm having problem importing PST into the invoice:


APINVOICEheader.Fields("CNTBTCH").PutWithoutVerification (BatchNo)
APINVOICEheader.Fields("CNTITEM").PutWithoutVerification ("0")
APINVOICEheader.Browse "CNTBTCH = " + BatchNo, 1
APINVOICEheader.Fetch
APINVOICEheader.Fields("CNTITEM").PutWithoutVerification ("0")
APINVOICEheader.Init
APINVOICEheader.Fields("IDVEND") = Main.rstSourceDB![Vendor ID]
APINVOICEheader.Fields("IDINVC") = Main.rstSourceDB![Invoice]
APINVOICEheader.Fields("ORDRNBR") = Main.rstSourceDB![Work Order Number]
APINVOICEheader.Fields("INVCDESC") = Main.rstSourceDB![Invoice Description]
APINVOICEheader.Fields("DATEINVC") = Main.rstSourceDB![Due Date]

DoEvents

'setting up Fiscal Year and period
APINVOICEheader.Fields("FISCYR") = Year(Date)
APINVOICEheader.Fields("FISCPER") = Month(Date)
'populate detail1 (Table at the bottom of main tab in ACCPAC)
APINVOICEdetail1.Init
APINVOICEdetail1.Fields("IDGLACCT") = Main.rstSourceDB![GL Account]
APINVOICEdetail1.Fields("AMTDIST") = Main.rstSourceDB![Total]
APINVOICEdetail1.Fields("AMTDIST") = Main.rstSourceDB![Total]
APINVOICEdetail1.Fields("TEXTDESC") = Main.rstSourceDB![Comments]

'**********************************************************************************
'taxes

APINVOICEheaderFields("CODETAXGRP").value = "GSTREB" 'Tax Group
APINVOICEheaderFields("AMTTAX1").value = Main.rstSourceDB![GST] 'Tax Amount 1
APINVOICEheaderFields("CODETAX2").value = "ONT" 'Tax AuthorityID 2
APINVOICEheaderFields("TAXCLASS2").value = 1 'Tax Class 2
APINVOICEheaderFields("AMTTAX2").value = Main.rstSourceDB![PST] 'Tax Amount 2

APINVOICEheaderFields("CODETAXGRP").value = "GSTREB"

APINVOICEheaderFields("CODETAX2").value = "ONT"
APINVOICEdetail1Fields("TAXCLASS2").value = 1
APINVOICEdetail1Fields("AMTTAX1").value = Main.rstSourceDB![GST] 'Tax Amount 1
APINVOICEdetail1Fields("AMTTAX2").value = Main.rstSourceDB![PST] 'Tax Amount 2
[/color red]
APINVOICEdetail1.Fields("AMTTOTTAX") = Main.rstSourceDB![GST] + Main.rstSourceDB![PST]
'**********************************************************************************

APINVOICEdetail1.Insert
'amout tax total of the invoice

APINVOICEheader.Fields("AMTGROSTOT") = Main.rstSourceDB![Total] + Main.rstSourceDB![GST] + Main.rstSourceDB![PST]
APINVOICEheader.Insert
[/color blue]

I can import GST (setting up tax group correctly),
but when I set tax group to GST and PST I get the following error on the last line of code:

Invalid input. The total tax amount of the details [x.xx] does not match the tax amount of the invoice [x.xx] for tax authority 2. (x stands for any digit)

Any help will be appreciated
 
I am not surte what the problem might be, however here is a sample of my tax entry into view AP00021,
Code:
.Fields("SWTAXBL").Value = ?
.Fields("SWCALCTX").Value = ?
.Fields("CODETAXGRP").Value = ?
.Fields("CODETAX1").Value = ?
.Fields("CODETAX2").Value = ?
.Fields("TAXCLASS1").Value = ?
.Fields("TAXCLASS2").Value = ?
.Fields("AMTGROSTOT").Value = ?
Hear is the detail (AP0022) for the corresponding header,
Code:
.Fields("TEXTDESC").Value =?
.Fields("TAXCLASS1").Value = ?
.Fields("TAXCLASS2").Value = ?
.Fields("IDGLACCT").Value = ?
.Fields("AMTDIST").Value = ?
It has been a while since I coded this but I think that the switches at the beginning are important and the view will calculate the taxes for you so I don't think that there is a need for the tax amounts to be entered.

Your problem may be that the tax is being calculated and added as well so you end up with twice as much tax. In any case it is a starting point, hope it helps.

zemp
 
Thanks Zemp,

I'll try to follow your guidelines.
The only thing that is different from the way that you have used is that I am trying to specify exact tax amounts instead of letting ACCPAC calculate those.

Thanks for your post again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top