This is a requirement for an integration I'm working on where I need to import manual AP Payments and apply them to existing vouchers. There is no eConnect option, but it looks like you can do it manually via SQL. I don't yet have code for it, but here are the 4 steps that appear to take place when you do an apply of a manual AP Payment.
If I end up coding it, I'll post an update.
Update AP voucher current transaction amount:
declare @p1 int
set @p1=45
exec sp_prepexec @p1 output,N'@P1 int,@P2 numeric(19, 5),@P3 numeric(19, 5),@P4 char(22),@P5 smallint',N'BEGIN TRANSACTION if exists (select 1 from tempdb.dbo.DEX_LOCK where row_id = @P1 and table_path_name = ''TWO.dbo.PM20000'') begin commit transaction raiserror (''DEXSHR'',15,2) end else begin BEGIN UPDATE TWO.dbo.PM20000 SET CURTRXAM = @P2 WHERE CURTRXAM = @P3 AND VCHRNMBR = @P4 AND DOCTYPE = @P5 SELECT @@rowcount END commit transaction end',259,500.00000,1000.00000,'1200108 ',1
select @p1
Insert Apply To Work record:
BEGIN DECLARE @num int EXEC TWO.dbo.zDP_PM10200SI 'ACETRAVE0001', '2017.04.12', '2017.04.12', '2017.04.12', '00:00:00', '1200108', 1, '292929', '2017.04.12', '2017.04.12', 'Z-US$', 1007, 500.00000, 0.00000, 0.00000, 0.00000, 500.00000, 0.00000, 0.00000, 0.00000, 0.0000000, 0.0000000, 0, 0, '1000179', 6, '20073', '2017.04.12', 'Z-US$', 500.00000, 0.00000, 0.00000, 0.00000, 500.00000, 0.00000, 0.00000, 0.00000, 0.0000000, 0.0000000, 0, 0, 0.00000, 0.00000, '', 0, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0, 0.00000, 1, 0, @num OUT SELECT @num END
Insert Apply To Open record?
BEGIN DECLARE @num int EXEC TWO.dbo.zDP_PM20100SI '10001796', '2017.04.12', '00:00:00', 'ACETRAVE0001', 0, '', 'sa', '1200108', 1, '2017.04.12', '292929', 500.00000, 0.00000, 0.00000, 0.00000, 'Z-US$', 1007, 500.00000, 0.00000, 0.00000, 0.00000, 1000.00000, 1000.00000, '1900.01.01', '2017.05.12', 'test', 0, '2017.04.12', 0.0000000, 0.0000000, 0, 0, 0, '1000179', 6, '20073', 'Z-US$', 500.00000, 0.00000, 500.00000, 0.00000, 0.00000, 0.00000, 500.00000, 0.00000, 0.00000, 0.00000, 0.0000000, 0.0000000, 0, 0, '', 0, 0.00000, 0.00000, '', 0.00000, 0.00000, 0.00000, 0.00000, 0x00000000, '2017.04.12', 'sa', '1900.01.01', '', 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.0000000, 2, 0, '', 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 'REMIT TO', 0.00000, 1, 0, @num OUT SELECT @num END
Update vendor balance:
declare @p1 int
set @p1=46
exec sp_prepexec @p1 output,N'@P1 numeric(19, 5),@P2 numeric(19, 5),@P3 char(16)',N'BEGIN UPDATE TWO.dbo.PM00201 SET CURRBLNC = @P1 WHERE CURRBLNC = @P2 AND VENDORID = @P3 SELECT @@rowcount END ',711.49000,1211.49000,'ACETRAVE0001 '
select @p1