오류수정 : 계산서 즉시발행시 첨부파일이 있으면 발행 후 수정이 안되는 오류가 있어서 발행완료 되나 첨부파일등록 오류로 에러 리턴됨
- 즉시발행 함수에 첨부파일 로직 삭제 - 즉시발행시 첨부파일 있으면 임시저장->발행 순서로 처리하게 로직 수정
This commit is contained in:
parent
5066977cb6
commit
fa2df36c09
|
|
@ -253,7 +253,7 @@
|
|||
}
|
||||
<a href="#" class="btn btn-danger" onclick="cancelIssue();">발행취소</a>
|
||||
}
|
||||
<a href="#" class="btn btn-default" onclick="$('#dform').attr('action', '/croom/tax');golist();">목록</a>
|
||||
<a href="#" class="btn btn-default" onclick="golist();">목록</a>
|
||||
</div>
|
||||
@Html.Partial("./Partial/dform", Model)
|
||||
</form>
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<PayItem>("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<PayTax>("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;
|
||||
|
|
|
|||
|
|
@ -19,40 +19,52 @@ namespace NP.Base.Popbill
|
|||
/// 세금계산서 mgtKey(문서번호) 생성
|
||||
/// </summary>
|
||||
/// <param name="Dao">CommonDao</param>
|
||||
/// <param name="taxno">PayTax.taxno</param>
|
||||
/// <param name="writeDate">발행일</param>
|
||||
/// <param name="keyType">세금계산서 유형 : SELL = 매출, BUY = 매입, TRUSTEE = 위수탁</param>
|
||||
/// <returns>mgtKey</returns>
|
||||
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<PayTax>("cr.paytax.formgtkey", new Hashtable() { { "writeDate", writeDate } }).FirstOrDefault();
|
||||
if (payTax != null && !string.IsNullOrEmpty(payTax.mgtkey))
|
||||
string mgtkey = string.Empty;
|
||||
var nowPayTax = Dao.Get<PayTax>("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<PayTax>("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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue