# 수집 내역 확인

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

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

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

```python
def search(CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, Page, PerPage, Order, UserID=None, SearchString=None)
```

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

### 요청

**Parameters**

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

### 응답

**HTTaxinvoiceSearchResult**

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

### 예외

**PopbillException**

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

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

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

```python
def summary(CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, UserID=None, SearchString=None)
```

### 요청

**Parameters**

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

### 응답

**HTTaxinvoiceSummary**

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

### 예외

**PopbillException**

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

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

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

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

```python
def getTaxinvoice(CorpNum, NTSConfirmNum, UserID=None)
```

### 요청

**Parameters**

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

### 응답

**HTTaxinvoice**

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

### 예외

**PopbillException**

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

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

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

```python
def getXML(CorpNum, NTSConfirmNum, UserID=None)
```

### 요청

**Parameters**

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

### 응답

**HTTaxinvoiceXMLResponse**

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

### 예외

**PopbillException**

- code `type: int` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- message `type: str` `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에서만 유효한 세션을 포함하고 있습니다.

```python
def getPopUpURL(CorpNum, NTSConfirmNum, UserID=None)
```

### 요청

**Parameters**

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

### 응답

str - 요청에 대한 응답 URL

### 예외

**PopbillException**

- code `type: int` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- message `type: str` `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에서만 유효한 세션을 포함하고 있습니다.

```python
def getPrintURL(CorpNum, NTSConfirmNum, UserID=None)
```

### 요청

**Parameters**

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

### 응답

str - 요청에 대한 응답 URL

### 예외

**PopbillException**

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