106 lines
3.6 KiB
C#
106 lines
3.6 KiB
C#
|
|
using NP.Base;
|
|||
|
|
using Popbill;
|
|||
|
|
using Popbill.Taxinvoice;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web.Configuration;
|
|||
|
|
|
|||
|
|
namespace NP.Base.Popbill
|
|||
|
|
{
|
|||
|
|
public class PopbillService
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 세금계산서 문서번호{mgtKey} 생성
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static string MakeMgtKey()
|
|||
|
|
{
|
|||
|
|
string mgtKey = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string date = DateTime.Now.ToString("yyyy-MM-dd");
|
|||
|
|
string no = 1.ToString("D5");//수정->발행문서 검색 후 순번 + 1 하는 거로 변경
|
|||
|
|
mgtKey = $"{date}-L{no}";
|
|||
|
|
}
|
|||
|
|
catch (PopbillException ex)
|
|||
|
|
{
|
|||
|
|
Logger.TryError(ex.Message, ex);
|
|||
|
|
}
|
|||
|
|
return mgtKey;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 세금계산서 상세정보
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="mgtKey"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static Taxinvoice GetTaxinvoice(string mgtKey)
|
|||
|
|
{
|
|||
|
|
Taxinvoice taxinvoice = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
taxinvoice = PopbillConfig.taxinvoiceService.GetDetailInfo(PopbillConfig.CorpNum, MgtKeyType.SELL, mgtKey);
|
|||
|
|
}
|
|||
|
|
catch (PopbillException ex)
|
|||
|
|
{
|
|||
|
|
Logger.TryError(ex.Message, ex);
|
|||
|
|
}
|
|||
|
|
return taxinvoice;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 세금계산서 공급자정보
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static Taxinvoice GetTaxinvoiceR()
|
|||
|
|
{
|
|||
|
|
Taxinvoice Taxinvoice = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CorpInfo corpInfo = PopbillConfig.taxinvoiceService.GetCorpInfo(PopbillConfig.CorpNum, PopbillConfig.UserID);
|
|||
|
|
Contact contact = PopbillConfig.taxinvoiceService.ListContact(PopbillConfig.CorpNum, PopbillConfig.UserID).Where(w => w.mgrYN == true).FirstOrDefault();
|
|||
|
|
Taxinvoice = new Taxinvoice
|
|||
|
|
{
|
|||
|
|
invoicerAddr = corpInfo?.addr,
|
|||
|
|
invoicerCEOName = corpInfo?.ceoname,
|
|||
|
|
invoicerCorpName = corpInfo?.corpName,
|
|||
|
|
invoicerMgtKey = MakeMgtKey(),
|
|||
|
|
invoicerCorpNum = PopbillConfig.CorpNum,
|
|||
|
|
invoicerBizClass = corpInfo?.bizClass,
|
|||
|
|
invoicerBizType = corpInfo?.bizType,
|
|||
|
|
invoicerContactName = contact?.personName,
|
|||
|
|
invoicerEmail = contact?.email,
|
|||
|
|
invoicerHP = contact?.hp,
|
|||
|
|
invoicerTEL = contact?.tel
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
catch (PopbillException ex)
|
|||
|
|
{
|
|||
|
|
Logger.TryError(ex.Message, ex);
|
|||
|
|
}
|
|||
|
|
return Taxinvoice;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 세금계산서 즉시 발행
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="taxinvoice"></param>
|
|||
|
|
/// <param name="forceIssue"></param>
|
|||
|
|
/// <param name="memo"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static IssueResponse RegistIssue(Taxinvoice taxinvoice, bool forceIssue, string memo)
|
|||
|
|
{
|
|||
|
|
IssueResponse IssueResponse = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
PopbillConfig.taxinvoiceService.RegistIssue(PopbillConfig.CorpNum, taxinvoice, forceIssue, memo);
|
|||
|
|
}
|
|||
|
|
catch (PopbillException ex)
|
|||
|
|
{
|
|||
|
|
Logger.TryError(ex.Message, ex);
|
|||
|
|
}
|
|||
|
|
return IssueResponse;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|