ton ac
SQL Sprint
10/05/2025
create or replace procedure PHD_HOI_TON
(b_ma_dvi varchar2,b_nsd varchar2,b_pas varchar2,
loai_n varchar2,ma_n varchar2,b_ma_hdac varchar2,cs_lke out pht_type.cs_type)
AS
b_loi varchar2(100);
begin
-- Lan - Liet ke chung tu hoa don
b_loi:=FHT_MA_NSD_KTRA(b_ma_dvi,b_nsd,b_pas,'HD','NX','X');
if b_loi is not null then raise PROGRAM_ERROR; end if;
if ma_n is null or b_ma_hdac is null then return; end if;
open cs_lke for select t.ma_dvi, t.loai_bp, t.ma_bp, t.ma, t.seri, t.dau, t.cuoi, t.thang from hd_sc t where t.loai_bp=loai_n and ma_bp=ma_n and ma = b_ma_hdac;
exception when others then raise_application_error(-20105,b_loi);
end;