<% Response.CharSet = "EUC-KR" '한글 Response.AddHeader "Pragma","no-cache" Response.AddHeader "cache-control", "no-staff" Response.Expires = -1 Set BST = New BaroService_TI Select Case Request("Company") Case "kri" CERTKEY = "2485FCBA-A2A2-4803-84DF-C39B7E1C7F74" '인증키 CorpNum = "2148156664" '바로빌 회원 사업자번호 ('-' 제외, 10자리) UserID = "kriit_1" '바로빌 회원 아이디 Case "krc" CERTKEY = "5E5BFD5F-DE1B-4582-8FB5-B8052EF2F183" '인증키 CorpNum = "4068104391" '바로빌 회원 사업자번호 ('-' 제외, 10자리) UserID = "kriit_2" '바로빌 회원 아이디 Case "krt" CERTKEY = "B0EBFC53-5CC8-4DD9-8486-A660DC930B61" '인증키 CorpNum = "5238101665" '바로빌 회원 사업자번호 ('-' 제외, 10자리) UserID = "kriit_3" '바로빌 회원 아이디 Case "krd" CERTKEY = "B0EBFC53-5CC8-4DD9-8486-A660DC930B61" '인증키 CorpNum = "5238101665" '바로빌 회원 사업자번호 ('-' 제외, 10자리) UserID = "kriit_3" '바로빌 회원 아이디 End Select NTSConfirmNum = Request("NTSConfirmNum") '국세청 승인번호 PWD = "" '바로빌 회원 비밀번호 TaxType = 1 '과세형태, 1:과세+영세 3:면세 DateType = 1 '조회기준, 1:작성일자 2:발행일자 BaseMonth = Request("sMonth") '기준월 If BaseMonth <> "" Then BaseMonth = Replace(BaseMonth, "-", "") End If CountPerPage = 100 '페이지당 갯수 CurrentPage = Request("sPage") '현재페이지 If CurrentPage = "" Then CurrentPage = 1 OrderDirection = 2 '1:ASC 2:DESC Select Case Request("command") Case "GetTaxInvoiceNK" '문서 정보 Set Result = BST.GetTaxInvoiceNK(CERTKEY, CorpNum, NTSConfirmNum) Response.write Result.toJson() Case "GetMonthlyTaxInvoicePurchaseList" '월별 매입 세금계산서 조회 [국세청 전송완료 건만] (대표품목 포함) Set Result = BST.GetMonthlyTaxInvoicePurchaseList(CERTKEY, CorpNum, UserID, TaxType, DateType, BaseMonth, CountPerPage, CurrentPage, OrderDirection) Response.write Result.toJson() Case "GetTaxInvoicePopUpURLNK" '문서 내용보기 팝업 URL Result = BST.GetTaxInvoicePopUpURLNK(CERTKEY, CorpNum, NTSConfirmNum, UserID, PWD) Response.write Result Case "GetTaxInvoiceHistory" '인트라넷에 등록된 세금계산서별 사용 금액 조회 SQL = "" SQL = SQL & " SELECT CONVERT(varchar(10), target3) AS writeDate, CONVERT(varchar(100), target18) AS taxNum, " SQL = SQL & " SUM(CONVERT(money, CONVERT(varchar(100), target5))) AS AmountTotal, " SQL = SQL & " SUM(CONVERT(money, REPLACE(CONVERT(varchar(100), target6), ',', ''))) AS TaxTotal, " SQL = SQL & " SUM(CONVERT(money, REPLACE(CONVERT(varchar(100), target7), ',', ''))) AS TotalAmount " SQL = SQL & " FROM 문서내용 WITH(NOLOCK) " SQL = SQL & " WHERE 문서제목='지출결의서' AND del_yes_no = 'no' " SQL = SQL & " AND target4 LIKE '세금계산서' " If BaseMonth <> "" Then SQL = SQL & " AND Replace(CONVERT(varchar(7), target3), '-', '') LIKE '" & BaseMonth & "%' " SQL = SQL & " AND target18 NOT LIKE '' " End If If NTSConfirmNum <> "" Then SQL = SQL & " AND target18 LIKE '" & NTSConfirmNum & "' " End If SQL = SQL & " GROUP BY CONVERT(varchar(10), target3), CONVERT(varchar(100), target18) " Adors.Open SQL, adoConn, 1 If Adors.recordCount > 0 Then Response.Write "[" Do While Not Adors.Eof Response.Write "{" Response.Write """writeDate"":""" & Adors("writeDate") & """," Response.Write """taxNum"":""" & Adors("taxNum") & """," Response.Write """AmountTotal"":""" & Adors("AmountTotal") & """," Response.Write """TaxTotal"":""" & Adors("TaxTotal") & """," Response.Write """TotalAmount"":""" & Adors("TotalAmount") & """" Response.Write "}" Adors.MoveNext If Not Adors.Eof Then Response.Write "," End If Loop Response.Write "]" Else Response.Write "[]" End IF Adors.Close Case "SetPaperTax" SQL = "" SQL = SQL & " INSERT INTO T_PAPER_TAX ( " SQL = SQL & " paperTaxNum, Company, WriteDate, " SQL = SQL & " CorpNum, CorpName, CEOName, " SQL = SQL & " Items, AmountTotal, TaxTotal, TotalAmount, " SQL = SQL & " WriteUser, insert_user, insert_ip " SQL = SQL & " ) VALUES ( " SQL = SQL & " '"& Request("paperTaxNum") &"', '"& Request("Company") &"', '"& Request("WriteDate") &"', " SQL = SQL & " '"& Request("CorpNum") &"', '"& URLDecode(Request("CorpName")) &"', '"& URLDecode(Request("CEOName")) &"', " SQL = SQL & " '"& URLDecode(Request("Items")) &"', '"& Request("AmountTotal") &"', '"& Request("TaxTotal") &"', '"& Request("TotalAmount") &"', " SQL = SQL & " '"& Request("WriteUser") &"', '"& Session("User_Number") &"', '"& clientIp &"' " SQL = SQL & " ) " adoConn.Execute SQL Response.Write "1" Case "GetPaperTax" SQL = "" SQL = SQL & " SELECT id, paperTaxNum, WriteDate, Company, CorpNum, CorpName, CEOName, " SQL = SQL & " Items, AmountTotal, TaxTotal, TotalAmount, WriteUser " SQL = SQL & " FROM T_PAPER_TAX " SQL = SQL & " WHERE flag = '1' " SQL = SQL & " ORDER BY id DESC " Adors.Open SQL, adoConn, 1 If Adors.recordCount > 0 Then Response.Write "[" Do While Not Adors.Eof Response.Write "{" Response.Write """id"":"""& Adors("id") &"""," Response.Write """paperTaxNum"":"""& Adors("paperTaxNum") &"""," Response.Write """WriteDate"":"""& Adors("WriteDate") &"""," Response.Write """Company"":"""& Adors("Company") &"""," Response.Write """CorpNum"":"""& Adors("CorpNum") &"""," Response.Write """CorpName"":"""& Adors("CorpName") &"""," Response.Write """CEOName"":"""& Adors("CEOName") &"""," Response.Write """Items"":"""& Adors("Items") &"""," Response.Write """AmountTotal"":"""& Adors("AmountTotal") &"""," Response.Write """TaxTotal"":"""& Adors("TaxTotal") &"""," Response.Write """TotalAmount"":"""& Adors("TotalAmount") &"""," Response.Write """WriteUser"":"""& Adors("WriteUser") &"""" Response.Write "}" Adors.MoveNext If Not Adors.Eof Then Response.Write "," End If Loop Response.Write "]" Else Response.Write "[]" End IF Adors.Close Case "DeletePaperTax" SQL = "" SQL = SQL & " UPDATE T_PAPER_TAX SET flag = '0' WHERE id = '"& Request("id") &"' " adoConn.Execute SQL Response.Write "1" Case Else Response.Write "0" End Select Function URLDecode(str) Dim objScript Set objScript = Server.CreateObject("ScriptControl") objScript.Language = "JavaScript" URLDecode = objScript.Eval("decodeURIComponent(""" & str & """.replace(/\+/g,"" ""))") Set objScript = Nothing End Function %>