Files
hallasanup/쿼리/2026/06/20260623_기성지불전표와 실전표정보 차이 조정하기.sql
2026-06-23 17:45:48 +09:00

66 lines
2.1 KiB
SQL

-- ==========================================
-- 작업일자: 2026-06-23
-- 작 성 자: 류호성
-- 작업목적: [기성지불 전표와 발행된 회계 전표와의 차이를 찾아서 정보를 일치시킨다.]
-- 요청자/티켓번호: [체크시 발견된 사항이며, 선급금 전표 발행시 프로시저 점검하여 보완해야 할 것으로 보입니다.]
-- 데이타베이스 : MS-SQL
-- ==========================================
-- [0] 기성지불 전표정보와 실제 전표정보와의 차이 조회하기
select
a.cont_no, a.year, a.month, a.gs_gbn, a.gs_seq, a.gs_amt, a.sk_amt, a.sj_amt, a.slpdate, a.dtcode, a.slpnum, b.slpnum , b.slpamt
from
HPOIMS.dbo.gs_payment a
left outer join
ACC.dbo.t23b10 b
on
a.slpdate = b.slpdate and a.dtcode = b.dtcode
where
a.year = '2026' and a.slpnum <> b.slpnum and (a.gs_amt = b.slpamt or a.sk_amt = b.slpamt)
--cont_no year month gs_gbn gs_seq gs_amt sk_amt sj_amt slpdate dtcode slpnum slpnum slpamt
--V26G010 2026 06 M 1 0 40000000 0 20260612 1321 205 203 40000000
-- [1] 기성지불정보의 전표정보 조회하기
select
*
from
HPOIMS.dbo.gs_payment
where
cont_no = 'V26G010' and year = '2026' and month = '06' and gs_gbn = 'M' and gs_seq = 1
-- [2] 해당 전표번호로 기성지불내역에 존재여부 재확인하기
select
*
from
HPOIMS.dbo.gs_payment a
where
a.slpdate = '20260612' and a.dtcode = '1321' and a.slpnum between 201 and 205
-- [3] 실행일은 상황에 따라 적절하게 수정하여 해당 전표번호로 전표내역 확인하기
select
*
from
ACC.dbo.t23b10_tr
where
actdate>'20260401' and slpdate = '20260612' and dtcode = '1321' and slpnum = 203
order by actdate, acttime
select
*
from
ACC.dbo.t23b10_tr
where
actdate>'20260401' and slpdate = '20260612' and dtcode = '1321' and slpnum = 205
order by actdate, acttime
-- [4] 기성지불에 올바른 전표번호로 수정하기
/*
update
HPOIMS.dbo.gs_payment
set
slpnum = 203
where
cont_no = 'V26G010' and year = '2026' and month = '06' and gs_gbn = 'M' and gs_seq = 1
*/