# 수집 내역 확인

## 1. Search - 수집 내역 확인

홈택스에서 수집된 전자세금계산서 매입/매출 내역을 확인합니다.

- 38개 항목으로 구성된 내역 확인이 가능합니다.

```vb
Function Search(CorpNum As String, jobID As String, tiType As Collection, taxType As Collection, purposeType As Collection, taxRegIDType As String, taxRegID As String, taxRegIDYN As String, page As Integer, perPage As Integer, order As String, Optional UserID As String = "", Optional SearchString As String = "") As PBHTTaxinvoiceSearch
```

> 매개변수 Page, PerPage, Order를 이용하여 페이징 기능을 구현할 수 있습니다.

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- jobID `type: String` `length: 18` `required: Y` `description: 팝빌에서 할당한 작업아이디`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/httaxinvoice/vb/api/job#RequestJob) API의 반환값
- tiType `type: Collection` `length: -` `required: N` `description: 세금계산서 문서형태 (다중 선택 가능)`
  - `N`: 세금계산서
  - `M`: 수정세금계산서
  - 기본값 : 전체조회
- taxType `type: Collection` `length: -` `required: N` `description: 과세형태 (다중 선택 가능)`
  - `T`: 과세
  - `N`: 면세
  - `Z`: 영세
  - 기본값 : 전체조회
- purposeType `type: Collection` `length: -` `required: N` `description: 영수/청구 (다중 선택 가능)`
  - `R`: 영수
  - `C`: 청구
  - `N`: 없음
  - 기본값 : 전체조회
- taxRegIDType `type: String` `length: -` `required: N` `description: 종사업장번호의 주체`
  - `S`: 공급자
  - `B`: 공급받는자
  - `T`: 수탁자
  - 기본값 : 전체조회
- taxRegID `type: String` `length: -` `required: N` `description: 종사업장번호`
  - 다수건 검색시 콤마(',')로 구분. 예) 1234,1000
  - 기본값 : 전체조회
- taxRegIDYN `type: String` `length: 1` `required: N` `description: 종사업장번호 유무`
  - `0`: 없음
  - `1`: 있음
  - 기본값 : 전체조회
- page `type: Integer` `length: -` `required: N` `description: 목록 페이지번호`
  - 기본값 : 1
- perPage `type: Integer` `length: -` `required: N` `description: 페이지당 표시할 목록 건수`
  - 최대 : 1,000건
  - 기본값 : 500건
- order `type: String` `length: 1` `required: N` `description: 목록 정렬 방향`
  - `D`: 내림차순 : 기본값
  - `A`: 오름차순
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/httaxinvoice/vb/api/job#RequestJob) API의 매개변수 {DType} 기준
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`
- SearchString `type: String` `length: 13` `required: N` `description: 조회 검색어 ('-' 제외)`
  - 상호명 조회시 거래처상호 입력
  - 사업자 조회시 사업자번호 입력
  - 개인 조회시 주민등록번호 입력
  - 외국인 조회시 "9999999999999" 입력
  - 기본값 : 전체조회

### 응답

**PBHTTaxinvoiceSearch**

- code `type: Long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: String` `length: -` `description: API 처리에 대한 응답메시지`
- total `type: Integer` `length: -` `description: 총 검색결과 건수`
- perPage `type: Integer` `length: -` `description: 페이지당 목록 건수`
- pageNum `type: Integer` `length: -` `description: 페이지 번호`
- pageCount `type: Integer` `length: -` `description: 페이지 개수`
- list `type: PBHTTaxinvoiceAbbr[ ]` `length: -` `description: 세금계산서 요약정보`
  - 최대 : 1,000건
  - ntsconfirmNum `type: String` `length: 24` `description: 전자세금계산서 국세청승인번호`
  - writeDate `type: String` `length: 8` `description: 작성일자`
    - 형식 : yyyyMMdd
  - issueDate `type: String` `length: 8` `description: 발행일자`
    - 형식 : yyyyMMdd
  - sendDate `type: String` `length: 8` `description: 전송일자`
    - 형식 : yyyyMMdd
  - taxType `type: String` `length: 2` `description: 과세형태`
    - `과세`
    - `영세`
    - `면세`
  - purposeType `type: String` `length: 2` `description: 영수/청구`
    - `영수`
    - `청구`
    - `없음`
  - supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
  - taxTotal `type: String` `length: 18` `description: 세액 합계`
  - totalAmount `type: String` `length: 18` `description: 합계금액`
  - remark1 `type: String` `length: 450` `description: 비고`
    - 전자세금계산서 비고1/2/3 값의 합
  - invoiceType `type: String` `length: 2` `description: 전자세금계산서 유형`
    - `매입`
    - `매출`
  - modifyYN `type: Boolean` `length: -` `description: 수정 전자세금계산서 여부`
    - `True`: 수정세금계산서
    - `False`: 일반세금계산서
  - orgNTSConfirmNum `type: String` `length: 24` `description: 당초 국세청승인번호`
  - purchaseDate `type: String` `length: 8` `description: 품목1의 거래일자`
    - 형식 : yyyyMMdd
  - itemName `type: String` `length: 100` `description: 품목1의 품명`
  - spec `type: String` `length: 60` `description: 품목1의 규격`
  - qty `type: String` `length: 12` `description: 품목1의 수량`
    - 소수점 아래 2번째 자리까지 반환 가능
    - 마이너스 금액 반환 가능
  - unitCost `type: String` `length: 18` `description: 품목1의 단가`
    - 소수점 아래 2번째 자리까지 반환 가능
    - 마이너스 금액 반환 가능
  - supplyCost `type: String` `length: 18` `description: 품목1의 공급가액`
    - 마이너스 금액 반환 가능
  - tax `type: String` `length: 18` `description: 품목1의 세액`
    - 마이너스 금액 반환 가능
  - remark `type: String` `length: 100` `description: 품목1의 비고`
  - invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호`
  - invoicerTaxRegID `type: String` `length: 4` `description: 공급자 종사업장 식별번호`
  - invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
  - invoicerCEOName `type: String` `length: 100` `description: 공급자 대표자 성명`
  - invoicerEmail `type: String` `length: 100` `description: 공급자 담당자 메일`
  - invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 등록번호`
    - {invoiceeType}="사업자" 경우 사업자번호
    - {invoiceeType}="개인" 경우 주민등록번호
    - {invoiceeType}="외국인" 경우 "9999999999999"
  - invoiceeType `type: String` `length: 3` `description: 공급받는자 유형`
    - `사업자`
    - `개인`
    - `외국인`
  - invoiceeTaxRegID `type: String` `length: 4` `description: 공급받는자 종사업장 식별번호`
  - invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
  - invoiceeCEOName `type: String` `length: 100` `description: 공급받는자 대표자 성명`
  - invoiceeEmail1 `type: String` `length: 100` `description: 공급받는자 담당자 메일`
  - invoiceeEmail2 `type: String` `length: 70` `description: 공급받는자 부) 담당자 메일`
  - trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호`
  - trusteeTaxRegID `type: String` `length: 4` `description: 수탁자 종사업장 식별번호`
  - trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
  - trusteeCEOName `type: String` `length: 100` `description: 수탁자 대표자 성명`
  - trusteeEmail `type: String` `length: 100` `description: 수탁자 담당자 메일`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 2. Summary - 수집 내역 합계

홈택스에서 수집된 전자세금계산서 매입/매출 내역의 합계정보를 제공합니다.\
※ 합계정보 - 수집 건수, 공급가액 합계, 세액 합계, 총계 (공급가액 합계+세액 합계)

```vb
Function Summary(CorpNum As String, jobID As String, tiType As Collection, taxType As Collection, purposeType As Collection, taxRegIDType As String, taxRegID As String, taxRegIDYN As String, Optional UserID As String = "", Optional SearchString As String = "") As PBHTTaxinvoiceSummary
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- jobID `type: String` `length: 18` `required: Y` `description: 팝빌에서 할당한 작업아이디`
  - [\[RequestJob - 수집 요청\]](https://developers.popbill.com/reference/httaxinvoice/vb/api/job#RequestJob) API의 반환값
- tiType `type: Collection` `length: -` `required: N` `description: 세금계산서 문서형태 (다중 선택 가능)`
  - `N`: 세금계산서
  - `M`: 수정세금계산서
  - 기본값 : 전체조회
- taxType `type: Collection` `length: -` `required: N` `description: 과세형태 (다중 선택 가능)`
  - `T`: 과세
  - `N`: 면세
  - `Z`: 영세
  - 기본값 : 전체조회
- purposeType `type: Collection` `length: -` `required: N` `description: 영수/청구 (다중 선택 가능)`
  - `R`: 영수
  - `C`: 청구
  - `N`: 없음
  - 기본값 : 전체조회
- taxRegIDType `type: String` `length: -` `required: N` `description: 종사업장번호의 주체`
  - `S`: 공급자
  - `B`: 공급받는자
  - `T`: 수탁자
  - 기본값 : 전체조회
- taxRegID `type: String` `length: -` `required: N` `description: 종사업장번호`
  - 다수건 검색시 콤마(',')로 구분. 예) 1234,1000
  - 기본값 : 전체조회
- taxRegIDYN `type: String` `length: 1` `required: N` `description: 종사업장번호 유무`
  - `0`: 없음
  - `1`: 있음
  - 기본값 : 전체조회
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`
- SearchString `type: String` `length: 13` `required: N` `description: 조회 검색어 ('-' 제외)`
  - 상호명 조회시 거래처상호 입력
  - 사업자 조회시 사업자번호 입력
  - 개인 조회시 주민등록번호 입력
  - 외국인 조회시 "9999999999999" 입력
  - 기본값 : 전체조회

### 응답

**PBHTTaxinvoiceSummary**

- count `type: long` `length: -` `description: 수집 건수`
- supplyCostTotal `type: long` `length: 18` `description: 공급가액 합계`
- taxTotal `type: long` `length: 18` `description: 세액 합계`
- amountTotal `type: long` `length: 18` `description: 총계 (공급가액 합계+세액 합계)`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 3. GetTaxinvoice - 수집 상세 확인

홈택스에서 수집된 전자세금계산서 1건의 상세정보를 제공합니다.

- 60개 항목과 99개 품목으로 구성된 정보 확인이 가능합니다.

```vb
Function GetTaxinvoice(CorpNum As String, ntsconfirmNum As String, Optional UserID As String = "") As PBHTTaxinvoice
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- ntsconfirmNum `type: String` `length: 24` `required: Y` `description: 전자세금계산서 국세청승인번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBHTTaxinvoice**

- writeDate `type: String` `length: 8` `description: 작성일자`
  - 형식 : yyyyMMdd
- issueDT `type: String` `length: 14` `description: 발행일시`
  - 형식 : yyyyMMddHHmmss
- invoiceType `type: String` `length: 3` `description: 전자세금계산서 종류`
  - `101`: 세금계산서
  - `102`: 영세율 세금계산서
  - `103`: 위수탁 세금계산서
  - `104`: 수입 세금계산서
  - `105`: 위수탁영세율 세금계산서
  - `201`: 수정세금계산서
  - `202`: 영세율 수정세금계산서
  - `203`: 위수탁 수정세금계산서
  - `204`: 수입 수정세금계산서
  - `205`: 위수탁영세율 수정세금계산서
  - `301`: 계산서
  - `303`: 위수탁 계산서
  - `304`: 수입 계산서
  - `401`: 수정계산서
  - `403`: 위수탁 수정계산서
  - `404`: 수입 수정계산서
- taxType `type: String` `length: 2` `description: 과세형태`
  - `과세`
  - `영세`
  - `면세`
- taxTotal `type: String` `length: 18` `description: 세액 합계`
- supplyCostTotal `type: String` `length: 18` `description: 공급가액 합계`
- totalAmount `type: String` `length: 18` `description: 합계금액`
- purposeType `type: String` `length: 2` `description: 영수/청구`
  - `영수`
  - `청구`
  - `없음`
- serialNum `type: String` `length: 30` `description: 일련번호`
- cash `type: String` `length: 18` `description: 현금`
- chkBill `type: String` `length: 18` `description: 수표`
- credit `type: String` `length: 18` `description: 외상`
- note `type: String` `length: 18` `description: 어음`
- remark1 `type: String` `length: 150` `description: 비고1`
- remark2 `type: String` `length: 150` `description: 비고2`
- remark3 `type: String` `length: 150` `description: 비고3`
- ntsconfirmNum `type: String` `length: 24` `description: 국세청승인번호`
- invoicerCorpNum `type: String` `length: 10` `description: 공급자 사업자번호`
- invoicerMgtKey `type: String` `length: 24` `description: 공급자 문서번호`
- invoicerTaxRegID `type: String` `length: 4` `description: 공급자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- invoicerCorpName `type: String` `length: 200` `description: 공급자 상호`
- invoicerCEOName `type: String` `length: 100` `description: 공급자 대표자 성명`
- invoicerAddr `type: String` `length: 300` `description: 공급자 주소`
- invoicerBizType `type: String` `length: 100` `description: 공급자 업태`
- invoicerBizClass `type: String` `length: 100` `description: 공급자 종목`
- invoicerContactName `type: String` `length: 100` `description: 공급자 담당자 성명`
- invoicerDeptName `type: String` `length: 100` `description: 공급자 담당자 부서명`
- invoicerTEL `type: String` `length: 20` `description: 공급자 담당자 연락처`
- invoicerEmail `type: String` `length: 100` `description: 공급자 담당자 메일`
- invoiceeCorpNum `type: String` `length: 13` `description: 공급받는자 등록번호 ('-' 제외)`
  - {invoiceeType}="사업자" 경우 사업자번호
  - {invoiceeType}="개인" 경우 주민등록번호
  - {invoiceeType}="외국인" 경우 "9999999999999"
- invoiceeType `type: String` `length: 3` `description: 공급받는자 유형`
  - `사업자`
  - `개인`
  - `외국인`
- invoiceeMgtKey `type: String` `length: 24` `description: 공급받는자 문서번호`
- invoiceeTaxRegID `type: String` `length: 4` `description: 공급받는자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- invoiceeCorpName `type: String` `length: 200` `description: 공급받는자 상호`
- invoiceeCEOName `type: String` `length: 100` `description: 공급받는자 대표자 성명`
- invoiceeAddr `type: String` `length: 300` `description: 공급받는자 주소`
- invoiceeBizType `type: String` `length: 100` `description: 공급받는자 업태`
- invoiceeBizClass `type: String` `length: 100` `description: 공급받는자 종목`
- invoiceeContactName1 `type: String` `length: 100` `description: 공급받는자 주) 담당자 성명`
- invoiceeDeptName1 `type: String` `length: 100` `description: 공급받는자 주) 담당자 부서명`
- invoiceeTEL1 `type: String` `length: 20` `description: 공급받는자 주) 담당자 연락처`
- invoiceeEmail1 `type: String` `length: 100` `description: 공급받는자 주) 담당자 메일`
- invoiceeContactName2 `type: String` `length: 100` `description: 공급받는자 부) 담당자 성명`
- invoiceeDeptName2 `type: String` `length: 100` `description: 공급받는자 부) 담당자 부서명`
- invoiceeTEL2 `type: String` `length: 20` `description: 공급받는자 부) 담당자 연락처`
- invoiceeEmail2 `type: String` `length: 100` `description: 공급받는자 부) 담당자 메일`
- trusteeCorpNum `type: String` `length: 10` `description: 수탁자 사업자번호`
- trusteeMgtKey `type: String` `length: 24` `description: 수탁자 문서번호`
- trusteeTaxRegID `type: String` `length: 4` `description: 수탁자 종사업장 식별번호`
  - 종사업장 식별번호는 4자리 숫자로만 구성
- trusteeCorpName `type: String` `length: 200` `description: 수탁자 상호`
- trusteeCEOName `type: String` `length: 100` `description: 수탁자 대표자 성명`
- trusteeAddr `type: String` `length: 300` `description: 수탁자 주소`
- trusteeBizType `type: String` `length: 100` `description: 수탁자 업태`
- trusteeBizClass `type: String` `length: 100` `description: 수탁자 종목`
- trusteeContactName `type: String` `length: 100` `description: 수탁자 담당자 성명`
- trusteeDeptName `type: String` `length: 100` `description: 수탁자 담당자 부서명`
- trusteeTEL `type: String` `length: 20` `description: 수탁자 담당자 연락처`
- trusteeEmail `type: String` `length: 100` `description: 수탁자 담당자 메일`
- modifyCode `type: Integer` `length: 1` `description: 수정 사유코드`
  - `1`: 기재사항 착오정정
  - `2`: 공급가액 변동
  - `3`: 환입
  - `4`: 계약의 해지
  - `5`: 내국신용장 사후개설
  - `6`: 착오에 의한 이중발행
- orgNTSConfirmNum `type: String` `length: 24` `description: 당초 국세청승인번호`
- detailList `type: PBHTTaxinvoiceDetail` `length: -` `description: 품목 상세정보`
  - 최대 : 99건
  - serialNum `type: Integer` `length: 2` `description: 일련번호`
  - purchaseDT `type: String` `length: 8` `description: 거래일자`
    - 형식 : yyyyMMdd
  - itemName `type: String` `length: 100` `description: 품명`
  - spec `type: String` `length: 60` `description: 규격`
  - qty `type: String` `length: 12` `description: 수량`
    - 소수점 아래 2번째 자리까지 반환 가능
    - 마이너스 금액 반환 가능
  - unitCost `type: String` `length: 18` `description: 단가`
    - 소수점 아래 2번째 자리까지 반환 가능
    - 마이너스 금액 반환 가능
  - supplyCost `type: String` `length: 18` `description: 공급가액`
    - 마이너스 금액 반환 가능
  - tax `type: String` `length: 18` `description: 세액`
    - 마이너스 금액 반환 가능
  - remark `type: String` `length: 100` `description: 비고`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 4. GetXML - 수집 상세 확인 (XML)

홈택스에서 수집된 전자세금계산서 1건의 상세정보를 XML 데이터 포맷으로 제공합니다.

```vb
Function GetXML(CorpNum As String, ntsconfirmNum As String, Optional UserID As String = "") As PBHTTaxinvoiceXML
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- ntsconfirmNum `type: String` `length: 24` `required: Y` `description: 전자세금계산서 국세청승인번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBHTTaxinvoiceXML**

- ResultCode `type: Long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- Message `type: String` `length: -` `description: API 처리에 대한 응답메시지`
- retObject `type: String` `length: -` `description: 전자세금계산서 XML 문서`

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 5. GetPopUpURL - 전자세금계산서 팝업 URL

![전자세금계산서 팝업 URL 미리보기](https://developers.popbill.com/images/reference/httaxinvoice/getPopUpURL.png)

**홈택스에서 수집된 전자세금계산서 1건의 팝업 URL을 반환합니다.**

- 권장 사이즈 : width = 1,000px (최소 725px) / height = 730px
- 반환되는 URL은 30초 동안만 사용이 가능합니다.
- 반환되는 URL에서만 유효한 세션을 포함하고 있습니다.

```vb
Function GetPopUpURL(CorpNum As String, ntsconfirmNum As String, Optional UserID As String = "") As String
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- ntsconfirmNum `type: String` `length: 24` `required: Y` `description: 전자세금계산서 국세청승인번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

String - 요청에 대한 응답 URL

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 6. GetPrintURL - 전자세금계산서 인쇄 팝업 URL

![전자세금계산서 인쇄 팝업 URL 미리보기](https://developers.popbill.com/images/reference/httaxinvoice/getPrintURL.png)

**홈택스에서 수집된 전자세금계산서 1건의 인쇄 팝업 URL을 반환합니다.**

- 권장 사이즈 : width = 930px / height = 765px
- 반환되는 URL은 30초 동안만 사용이 가능합니다.
- 반환되는 URL에서만 유효한 세션을 포함하고 있습니다.

```vb
Function GetPrintURL(CorpNum As String, ntsconfirmNum As String, Optional UserID As String = "") As String
```

### 요청

**Parameters**

- CorpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- ntsconfirmNum `type: String` `length: 24` `required: Y` `description: 전자세금계산서 국세청승인번호`
- UserID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

String - 요청에 대한 응답 URL

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`
