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