Ratakan

Informations :

SP Perbaiki Data Originating RM Invoice Current Transction Amount

Case ini terjadi mana terdapat receivables Invoice originating yang di apply oleh Cash Receipt sudah lunas namun Cash Receipt nya ada yang nyangkut sehingga terpaksa Cash Receipt nya di Delete secara Table.

Namun RM Invoice nya mesti di perbaiki dengan menghitung ulang Current Transaction Amount nya.




Sintax Query : 


declare @DOCNUMBR VARCHAR(60)

set @DOCNUMBR = '[Nomor Invoice]'

update  a

set a.CURTRXAM = a.SLSAMNT-b.T_APPTOAMT

from RM20101 a 

inner join ( select sum (APPTOAMT) as T_APPTOAMT,APTODCNM,CUSTNMBR from RM20201 

where APTODCNM = @DOCNUMBR

group by APTODCNM,CUSTNMBR) b on a.DOCNUMBR = b.APTODCNM and a.CUSTNMBR = b.CUSTNMBR

where a.DOCNUMBR = @DOCNUMBR



declare @DOCNUMBR VARCHAR(60)

set @DOCNUMBR = '[Nomor Invoice]'

update  a

set a.ORCTRXAM = a.ORSLSAMT-b.T_ORAPTOAM

from MC020102 a 

inner join ( select sum (ORAPTOAM) as T_ORAPTOAM,APTODCNM,CUSTNMBR from RM20201 

where APTODCNM = @DOCNUMBR

group by APTODCNM,CUSTNMBR) b on a.DOCNUMBR = b.APTODCNM and a.CUSTNMBR = b.CUSTNMBR

where a.DOCNUMBR = @DOCNUMBR


No comments