您好,登錄后才能下訂單哦!
create or replace function GET_ZNJ(
JFJZRQ in date,
YJE in number,
ZNJBL in number,
ZT in varchar2,
SJJFRQ in date,
MIAN_ZNJ in varchar2,
ZNJ_JMCS in number
) return NUMBER is
V_ZNJ NUMBER(14,2);
V_DATE date;
V_DAYS number;
begin
V_ZNJ := 0;
IF ZT <= '4' THEN
V_DATE := SYSDATE;
END IF;
IF ZT >= '5' THEN
V_DATE := SJJFRQ;
END IF;
V_DAYS := trunc(V_DATE) - trunc(JFJZRQ);
IF MIAN_ZNJ = '1' THEN --不予減免1
BEGIN
V_ZNJ := CASE WHEN V_DAYS <= 0 THEN 0
ELSE NVL(ROUND(V_DAYS * YJE * ZNJBL,2),0)
END;
END;
ELSIF MIAN_ZNJ = '0' THEN --全部減免0
BEGIN
V_ZNJ := 0;
END;
ELSIF MIAN_ZNJ = '2' THEN --日期減免2
BEGIN
V_ZNJ := CASE WHEN V_DAYS - ZNJ_JMCS <= 0 THEN 0
ELSE NVL(ROUND((V_DAYS - ZNJ_JMCS) * YJE * ZNJBL,2),0)
END;
END;
ELSIF MIAN_ZNJ = '3' THEN --比例減免3
BEGIN
V_ZNJ := CASE WHEN V_DAYS <= 0 THEN 0
ELSE NVL(ROUND(ROUND(V_DAYS * YJE * ZNJBL,2) * (1 - ZNJ_JMCS),2),0)
END;
END;
ELSIF MIAN_ZNJ = '4' THEN --定額減免4
BEGIN
V_ZNJ := CASE WHEN V_DAYS <= 0 THEN 0
ELSE NVL(ROUND(V_DAYS * YJE * ZNJBL,2),0) - ZNJ_JMCS
END;
IF V_ZNJ < 0 THEN
V_ZNJ := 0;
END IF;
END;
ELSE --不予減免
BEGIN
V_ZNJ := CASE WHEN V_DAYS <= 0 THEN 0
ELSE NVL(ROUND(V_DAYS * YJE * ZNJBL,2),0)
END;
END;
END IF;
-- 滯納金大于應(yīng)繳金額時(shí),滯納金=應(yīng)繳金額
IF V_ZNJ > YJE THEN
V_ZNJ := YJE;
END IF;
return V_ZNJ;
end GET_ZNJ;
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。