FETCH NEXT FROM GetJobLinkerCurs INTO @JOBNUMBER,@TRANSNMBR,@MASTERTYPE,@MASTERID,@MASTERNAME,@DEBITAMT,@CRDTAMNT,@VCHRNMBR,@DOCTYPE,@DOCDATE,@POSTDATE,@DOCNUMBR,@DOCAMNT,@TRXDSCRN,@DOCSOURCE,@ACTNUMST,@ACCATNUM
WHILE ( @@FETCH_STATUS = 0 )
BEGIN
/* Break amounts into categories */
SELECT CASE @ACCATNUM
WHEN 31 THEN IF @DOCTYPE IN (1,2,3) THEN @LABORAMT = @LABORAMT + @DEBITAMT ELSE @LABORAMT = @LABORAMT - @CRDTAMNT END
WHEN 32 THEN IF @DOCTYPE IN (1,2,3) THEN @MATLAMNT = @MATLAMNT + @DEBITAMT ELSE @MATLAMNT = @MATLAMNT - @CRDTAMNT END
WHEN 33 THEN IF @DOCTYPE IN (1,2,3) THEN @DELIVAMT = @DELIVAMT + @DEBITAMT ELSE @DELIVAMT = @DELIVAMT - @CRDTAMNT END
WHEN 34 THEN IF @DOCTYPE IN (1,2,3) THEN @OUTSVCAMT = @OUTSVCAMT + @DEBITAMT ELSE @OUTSVCAMT = @OUTSVCAMT - @CRDTAMNT END
WHEN 35 THEN IF @DOCTYPE IN (1,2,3) THEN @MISCAMNT = @MISCAMNT + @DEBITAMT ELSE @MISCAMNT = @MISCAMNT - @CRDTAMNT END
WHEN 36 THEN IF @DOCTYPE IN (1,2,3) THEN @CIASAMNT = @CIASAMNT + @DEBITAMT ELSE @CIASAMNT = @CIASAMNT - @CRDTAMNT END
END
|