diff --git a/src/com/pms/api/SalesSlipApiClient.java b/src/com/pms/api/SalesSlipApiClient.java
index 3e25515..90168b5 100644
--- a/src/com/pms/api/SalesSlipApiClient.java
+++ b/src/com/pms/api/SalesSlipApiClient.java
@@ -238,6 +238,73 @@ public class SalesSlipApiClient {
}
}
+ /*
+ * 자동전표 데이터를 아마란스에서 삭제한다. (api11A17)
+ * 필요 시 주석 해제 후 사용
+ *
+ public String deleteSalesSlip(String baseUrl, String coCd, String menuDt, int menuSq) throws Exception {
+ String requestBody = "{\"coCd\":\"" + coCd + "\",\"menuDt\":\"" + menuDt + "\",\"menuSq\":" + menuSq + "}";
+
+ System.setProperty("https.protocols", "TLSv1.2");
+ TrustManager[] trustAllCerts = new TrustManager[] {
+ new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() { return null; }
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {}
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {}
+ }
+ };
+ SSLContext sc = SSLContext.getInstance("TLS");
+ sc.init(null, trustAllCerts, new java.security.SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+ HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
+
+ String urlPath = "/apiproxy/api11A17";
+ String cleanBaseUrl = baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length() - 1) : baseUrl;
+ String fullUrl = cleanBaseUrl + urlPath;
+
+ System.out.println("[SalesSlipApi] 삭제 요청 URL: " + fullUrl);
+ System.out.println("[SalesSlipApi] 삭제 요청 Body: " + requestBody);
+
+ URL url = new URL(fullUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setConnectTimeout(30000);
+ connection.setReadTimeout(30000);
+
+ try {
+ connection.setRequestMethod("POST");
+ connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
+ connection.setRequestProperty("callerName", CALLER_NAME);
+ connection.setRequestProperty("Authorization", "Bearer " + ACCESS_TOKEN);
+ String transactionId = generateTransactionId();
+ connection.setRequestProperty("transaction-id", transactionId);
+ String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
+ connection.setRequestProperty("timestamp", timestamp);
+ connection.setRequestProperty("groupSeq", GROUP_SEQ);
+ connection.setRequestProperty("wehago-sign", generateWehagoSign(ACCESS_TOKEN, transactionId, timestamp, urlPath));
+
+ connection.setDoOutput(true);
+ OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), StandardCharsets.UTF_8);
+ writer.write(requestBody);
+ writer.flush();
+ writer.close();
+
+ int responseCode = connection.getResponseCode();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ responseCode >= 200 && responseCode < 300 ? connection.getInputStream() : connection.getErrorStream(),
+ StandardCharsets.UTF_8));
+ StringBuilder response = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) response.append(line);
+ reader.close();
+
+ System.out.println("[SalesSlipApi] 삭제 응답: " + response.toString());
+ return response.toString();
+ } finally {
+ connection.disconnect();
+ }
+ }
+ */
+
/**
* 국내 매출전표 JSON 생성 (세금계산서)
*
@@ -251,12 +318,13 @@ public class SalesSlipApiClient {
* @param supplyAmount 공급가액
* @param itemSummary 적요 (품명)
* @param taxFg 세무구분코드 (convertTaxType으로 변환한 값)
+ * @param issDt 신고기준일 (yyyyMMdd, 세금계산서발행일)
* @return 전표 JSON 문자열
*/
public String buildDomesticSlipJson(String menuDt, int menuSq, String slipTitle,
String trCd, String trNm,
long totalAmount, long vatAmount, long supplyAmount,
- String itemSummary, String taxFg) {
+ String itemSummary, String taxFg, String issDt) {
StringBuilder json = new StringBuilder();
json.append("{");
json.append("\"coCd\":\"").append(CO_CD).append("\"");
@@ -299,8 +367,10 @@ public class SalesSlipApiClient {
json.append(",\"attrCd\":\"").append(ATTR_TAX_INVOICE).append("\"");
json.append(",\"rmkDc\":\"").append(escapeJson(itemSummary)).append("\"");
json.append(",\"taxFg\":\"").append(escapeJson(taxFg)).append("\"");
+ json.append(",\"issDt\":\"").append(escapeJson(issDt)).append("\"");
json.append(",\"jeonjaYn\":\"1\"");
json.append(",\"supAm\":").append(supplyAmount);
+ json.append(",\"vatDivCd\":\"").append(DIV_CD).append("\"");
json.append(",\"ctDept\":\"").append(SALES_DEPT_CD).append("\"");
json.append(",\"insertId\":\"").append(INSERT_ID).append("\"");
json.append(",\"exFg\":\"1\"");
diff --git a/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java b/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
index 7d5966e..4caab37 100644
--- a/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
+++ b/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
@@ -1154,7 +1154,7 @@ public Map saveSaleRegistration(HttpServletRequest request, Map<
slipDate, menuSq, slipTitle,
erpClientCd, customerName,
totalAmount, totalVat, totalSupplyPrice,
- itemSummary, taxFg
+ itemSummary, taxFg, slipDate
);
// API 호출