diff --git a/BO/Views/croom/taxdetail.cshtml b/BO/Views/croom/taxdetail.cshtml
index 5033edd..20cbc50 100644
--- a/BO/Views/croom/taxdetail.cshtml
+++ b/BO/Views/croom/taxdetail.cshtml
@@ -253,7 +253,7 @@
}
발행취소
}
- 목록
+ 목록
@Html.Partial("./Partial/dform", Model)
@@ -307,9 +307,9 @@
}
function cbsave() {
if (capResult.code == 1000) {
- msg("저장되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
+ msg("저장되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
- msg("이미 발행요청건이 존재합니다.");
+ msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@@ -319,12 +319,12 @@
}
function cbtempsave() {
if (capResult.code == 1000) {
- msg("임시저장되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
+ msg("임시저장되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
- msg("이미 발행요청건이 존재합니다.");
+ msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
- msg(capResult.msg);
+ msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@@ -338,10 +338,10 @@
}
function cbcancelIssue() {
if (capResult.code == 1000) {
- msg("발행취소되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
+ msg("발행취소되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
- msg(capResult.msg);
+ msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@@ -354,12 +354,12 @@
}
function cbIssue() {
if (capResult.code == 1000) {
- msg("발행되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
+ msg("발행되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
- msg("이미 발행요청건이 존재합니다.");
+ msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
- msg(capResult.msg);
+ msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@@ -372,12 +372,12 @@
}
function cbregistIssue() {
if (capResult.code == 1000) {
- msg("즉시발행되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
+ msg("즉시발행되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
- msg("이미 발행요청건이 존재합니다.");
+ msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
- msg(capResult.msg);
+ msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
diff --git a/Base/Controller/ACommonCRoom.cs b/Base/Controller/ACommonCRoom.cs
index efb0874..b6e9a65 100644
--- a/Base/Controller/ACommonCRoom.cs
+++ b/Base/Controller/ACommonCRoom.cs
@@ -842,7 +842,7 @@ namespace NP.Base.Controllers
payTax.udt = DateTime.Now;
if (string.IsNullOrEmpty(payTax.mgtkey))
{
- payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.udt);
+ payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.taxno, payTax.udt);
}
if (Dao.Save("cr.paytax.save", payTax) > 0)
@@ -921,23 +921,46 @@ namespace NP.Base.Controllers
payTax.udt = DateTime.Now;
if (string.IsNullOrEmpty(payTax.mgtkey))
- {
- payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.udt);
+ {
+ payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao,payTax.taxno, payTax.udt);
}
if (Dao.Save("cr.paytax.save", payTax) > 0)
{
var payItems = Dao.Get("cr.paytaxitem2", new System.Collections.Hashtable() { { "taxno", payTax.taxno } });
-
- var result = Popbill.PopbillService.RegistIssue(Dao, payTax, payItems);
- if (result.IsSuccess)
+ //첨부파일이 있으면 임시저장 후 발행처리
+ if(payTax.fgno != null && payTax.fgno != 0)
{
- return JsonOK(result.Code);
+ var result = Popbill.PopbillService.TempSave(Dao, payTax, payItems);
+ if (result.IsSuccess)
+ {
+ var resultIssue = Popbill.PopbillService.Issue(payTax.mgtkey);
+ if (resultIssue.IsSuccess)
+ {
+ return JsonOK(resultIssue.Code);
+ }
+ else
+ {
+ return JsonError(JSONCode.Error, resultIssue.Message, resultIssue);
+ }
+ }
+ else
+ {
+ return JsonError(JSONCode.Error, result.Message, result);
+ }
}
else
{
- return JsonError(JSONCode.Error, result.Message, result);
- }
+ var result = Popbill.PopbillService.RegistIssue(Dao, payTax, payItems);
+ if (result.IsSuccess)
+ {
+ return JsonOK(result.Code);
+ }
+ else
+ {
+ return JsonError(JSONCode.Error, result.Message, result);
+ }
+ }
}
return JsonOK(0);
}
@@ -955,6 +978,13 @@ namespace NP.Base.Controllers
payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP();
payTax.iscancel = 1;
+ //mgtkey 발급여부 체크
+ var nowPayTax = Dao.Get("cr.paytaxes", new Hashtable() { { "taxno", payTax.taxno } }).FirstOrDefault();
+ if (nowPayTax != null && !string.IsNullOrEmpty(nowPayTax.mgtkey))
+ {
+ payTax.mgtkey = nowPayTax.mgtkey;
+ }
+
if (!string.IsNullOrEmpty(payTax.mgtkey))
{
var taxinvoice = Popbill.PopbillService.GetTaxinvoice(payTax).Data;
diff --git a/Base/Popbill/PopbillService.cs b/Base/Popbill/PopbillService.cs
index 9028e75..5b1cbe5 100644
--- a/Base/Popbill/PopbillService.cs
+++ b/Base/Popbill/PopbillService.cs
@@ -19,40 +19,52 @@ namespace NP.Base.Popbill
/// 세금계산서 mgtKey(문서번호) 생성
///
/// CommonDao
+ /// PayTax.taxno
/// 발행일
/// 세금계산서 유형 : SELL = 매출, BUY = 매입, TRUSTEE = 위수탁
/// mgtKey
- public static string MakeMgtKey(CommonDao Dao, DateTime writeDate, MgtKeyType keyType = MgtKeyType.SELL)
+ public static string MakeMgtKey(CommonDao Dao, long taxno, DateTime writeDate, MgtKeyType keyType = MgtKeyType.SELL)
{
int no = 1;
-
- var payTax = Dao.Get("cr.paytax.formgtkey", new Hashtable() { { "writeDate", writeDate } }).FirstOrDefault();
- if (payTax != null && !string.IsNullOrEmpty(payTax.mgtkey))
+ string mgtkey = string.Empty;
+ var nowPayTax = Dao.Get("cr.paytaxes", new Hashtable() { { "taxno", taxno } }).FirstOrDefault();
+ //이미 mgtkey 발급되어 있으면 발급된 mgtkey 사용
+ if (nowPayTax != null && !string.IsNullOrEmpty(nowPayTax.mgtkey))
{
- var strNo = payTax.mgtkey.Substring(payTax.mgtkey.IndexOf("L") + 1);
-
- if (int.TryParse(strNo, out no))
+ mgtkey = nowPayTax.mgtkey;
+ }
+ else
+ {
+ var payTax = Dao.Get("cr.paytax.formgtkey", new Hashtable() { { "writeDate", writeDate } }).FirstOrDefault();
+ if (payTax != null && !string.IsNullOrEmpty(payTax.mgtkey))
{
- ++no;
+ var strNo = payTax.mgtkey.Substring(payTax.mgtkey.IndexOf("L") + 1);
+
+ if (int.TryParse(strNo, out no))
+ {
+ ++no;
+ }
+ }
+
+ mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
+
+ bool isUse = true;
+ int checkLimit = 50;
+ while (isUse && checkLimit > 0)
+ {
+ isUse = PopbillConfig.taxinvoiceService.CheckMgtKeyInUse(PopbillConfig.CorpNum, keyType, mgtkey);
+ if (isUse)
+ {
+ ++no;
+ mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
+ }
+ else
+ {
+ break;
+ }
+ --checkLimit;
}
}
-
- string mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
-
- bool isUse = true;
- int checkLimit = 50;
- while (isUse && checkLimit > 0)
- {
- isUse = PopbillConfig.taxinvoiceService.CheckMgtKeyInUse(PopbillConfig.CorpNum, keyType, mgtkey);
- if (isUse)
- {
- ++no;
- mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
- }
-
- --checkLimit;
- }
-
return mgtkey;
}
#endregion
@@ -401,12 +413,7 @@ namespace NP.Base.Popbill
var taxinvoice = GetTaxinvoice(payTax, payItems, keyType).Data;
result.Data = PopbillConfig.taxinvoiceService.RegistIssue(PopbillConfig.CorpNum, taxinvoice, forceIssue, memo);
result.Code = result.Data.code;
- result.Message = result.Data.message;
-
- if (result.Data.code == 1)
- {
- AttachFile(Dao, payTax, keyType);
- }
+ result.Message = result.Data.message;
}
catch (PopbillException ex)
{