spc-kiosk-pb/Service/AsvDataProcess/MakeTranLog.cs
2019-06-16 14:12:09 +09:00

3035 lines
179 KiB
C#

using System;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 거래데이터 생성
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class MakeTranLog : IServiceUs, IMakeAccADMT
{
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private PosStatus m_cPosStatus = null; // 기본정보 참조
private TranStatus m_cTrnStatus = null; // 거래정보 참조
private IDataCommonUs m_cDataCommSrv = null;
private IDatabaseSQL m_cSqlDbService = null; // 데이터베이스 관리
/// <summary>
/// 트란데이터
/// </summary>
private string m_sTranData;
public MakeTranLog()
{
m_cPosStatus = (PosStatus)StateObject.POS; //POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; //POS 거래정보
m_cDataCommSrv = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
}
#region
/// <summary>
/// 거래데이터 생성
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string Execute(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
m_sTranData = "";
StringBuilder sb = new StringBuilder();
m_sTranData = sb.ToString();
sRet = UserCom.RST_OK;
}
catch(Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
//#region 거래번호 증가 체크
///// <summary>
/////
///// </summary>
///// <returns></returns>
//public bool TradeNoAddCheck()
//{
// bool bRet = true;
// try
// {
// if (m_cTrnStatus.Head.TrainModeYn == "0"&&
// (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_COMPLETE || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_REG ||
// m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.FORIGN.O2O || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.FORIGN.SHOPPINGMALL || // m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.CHARGESALE.CHARGE ||
// m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.CHARGESALE.GIFT || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.CHARGESALE.PREPAID || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.CHARGESALE.REFUND ||
// m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.ETC.LOSS || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT || // m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY ||
// m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT))
// {
// //증가!
// }
// else
// {
// //미증가!
// bRet = false;
// }
// }
// catch (Exception ex)
// {
// WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
// }
// return bRet;
//}
//#endregion
#region
/// <summary>
/// 거래 데이터 저장 처리
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string SaveTranExecute(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
if (m_cDataCommSrv.TradeNoAddCheck("") == true)
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
m_cSqlDbService.Begin();
//17.05.18 dkshin 쇼킹박스 추가
//if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.LOG.SHOCKING_BOX && m_cTrnStatus.Head.ShockingBoxStat == "1")
// m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.NORMAL.SALE;
sRet = SaveEtcItem(); // 기타정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveEtcItem");
return sRet;
}
sRet = SaveCampaignItem(); // 캠페인정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveCampaignItem");
return sRet;
}
sRet = SaveSignItem(aParam[0]); // 사인데이터 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveSignItem");
return sRet;
}
sRet = SaveDpstWthdr(); // 입출금정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveDpstWthdr");
return sRet;
}
sRet = SavePluItem(); // 상품정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SavePluItem");
return sRet;
}
sRet = SavePaymentItem(); // 결제정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SavePaymentItem");
return sRet;
}
sRet = SaveTranReservInfo(aParam[0]); // 트란예약 고객 정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveTranReservInfo");
return sRet;
}
sRet = SaveGuestCnt(); // 고객수정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveGuestCnt");
return sRet;
}
DataTable dtReturn = null;
sRet = SaveAccADMT(m_cTrnStatus.Head.TradeKind, m_cPosStatus.Base.SaleDate, ref dtReturn, "0"); // 정산지 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveAccADMT");
return sRet;
}
//#Rhee, 20180116 미국 예약등록으로 결제완료이면 전송안되게 SEND_YN = '1' 변경 start
// 기존(Rhee)
////#20180131 인천공항 통합POS 사용유무가 사용이면 SEND_YN을 A로 설정 start
////TR_SALE_HEADER, TR_SALE_JOURNAL
////기존
//sRet = SaveTranHeader(aParam[0]); // 트란해더 저장
////변경
///*
//if (PosMstManager.GetPosOption(POS_OPTION.OPT512) == "1")
//{
// sRet = SaveTranHeader("A"); // 트란해더 저장
//}
//else
//{
// sRet = SaveTranHeader(aParam[0]); // 트란해더 저장
//}
//*/
////#20180131 인천공항 통합POS 사용유무가 사용이면 SEND_YN을 A로 설정 end
// 변경(Rhee)
if ((m_cPosStatus.Base.CmpCd.Equals("PCUS") && m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_COMPLETE) && (m_cTrnStatus.Head.TradeDiv == "0"))
{
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_PICKUP; // 픽업모드로 변경
sRet = SaveTranHeader("1"); // 트란해더 저장
}
//#20180131 인천공항 통합POS 사용유무가 사용이면 SEND_YN을 A로 설정 start
else if (PosMstManager.GetPosOption(POS_OPTION.OPT512) == "1"
//grayber@20180228 [BRKR] 인천공항 SEND_YN 매출전송유무 'A' 제거
&& m_cPosStatus.Mst.CorpDiv.Equals(ItemConst.CORP_DIV.BR) != true
//grayber@20180228 [BRKR] 인천공항 SEND_YN 매출전송유무 'A' 제거
)
{
sRet = SaveTranHeader("A"); // 트란해더 저장
}
//#20180131 인천공항 통합POS 사용유무가 사용이면 SEND_YN을 A로 설정 end
else
{
sRet = SaveTranHeader(aParam[0]); // 트란해더 저장
}
//#Rhee, 20180116 미국 예약등록으로 결제완료이면 전송안되게 SEND_YN = '1' 변경 end
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveTranHeader");
return sRet;
}
if (aParam[0] != "1") // 거래데이터 복구시 주방출력 안함(2017.05.24)
{
sRet = SaveKtchOrdMsg(); // 주방 데이터 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveKtchOrdMsg");
return sRet;
}
}
//17.05.18 dkshin 쇼킹박스 추가
//쇼킹박스 결제 영수증 번호 update(반품시 필요!)
if (m_cTrnStatus.Head.ShockingBoxStat == "1")
{
sRet = UpdateShockingBoxTradeNo();
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => UpdateShockingBoxTradeNo");
return sRet;
}
}
//2017-06-02 dkshin 해피앱 추후적립
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
if (m_cTrnStatus.Head.AftSavePoint > 0)
{
//#20170809 해피포인트 업무 미사용시 해피앱 추후적립 기능 적용 안되도록 수정 start
//기존
//sRet = SaveHPAppAfter();
//변경
//#20180509 해피앱 추후적립 사용여부 옵션 처리 start
//기존
//if (PosMstManager.GetPosOption(POS_OPTION.OPT316) != "0") // 해피포인트 업무 사용 여부(0:사용안함, 1:사용함(한국), 2:사용함(중국))
//변경
if (PosMstManager.GetPosOption(POS_OPTION.OPT316) == "1" && // 해피포인트 업무 사용 여부(0:사용안함, 1:사용함(한국), 2:사용함(중국))
PosMstManager.GetPosOption(POS_OPTION.OPT515) == "1") // 해피앱 추후적립 사용 여부(0:사용안함, 1:사용함)
//#20180509 해피앱 추후적립 사용여부 옵션 처리 end
{
//#20181023 반품 건에도 해피앱추후적립 데이터 생성되는 현상 막기 start
//기존
//sRet = SaveHPAppAfter();
//변경
//일반 TradeDiv 0 && org_info == "" && TradeKind 00
//일반반품 TradeDiv 1 && org_info != "" && TradeKind 00
//낱개반품 TradeDiv 1 && org_info == "" && TradeKind 00
//낱개반품반품 TradeDiv 0 && org_info != "" && TradeKind 00
//로스 TradeDiv 0 && org_info == "" && TradeKind 50
//로스반품 TradeDiv 1 && org_info != "" && TradeKind 50
string org_info = m_cTrnStatus.Head.OrgSaleDate + m_cTrnStatus.Head.OrgPosNo + m_cTrnStatus.Head.OrgTradeNo;
if ((m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE) &&
(m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL && org_info == ""))
{
sRet = SaveHPAppAfter();
}
//#20181023 반품 건에도 해피앱추후적립 데이터 생성되는 현상 막기 end
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveHPAppAfter");
return sRet;
}
}
//#20170809 해피포인트 업무 미사용시 해피앱 추후적립 기능 적용 안되도록 수정 end
}
}
m_cSqlDbService.Commit();
}
else
{
EtcSaveDataMain(aParam[0]);
}
// 보류 로그 남기기!
if (m_cTrnStatus.Head.HoldStat != "")
SaveHoldLog(m_cTrnStatus.Head.HoldStat, m_cTrnStatus.Head.HoldOrgRegNo, 0, 0);
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 트란해더 저장 처리
/// </summary>
/// <returns></returns>
public string SaveTranHeader(string sSendYN)
{
string sQuery = "";
string sRet = UserCom.RST_ERR;
try
{
sQuery += " INSERT INTO POSLOG..TR_SALE_HEADER ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO, TRADE_NO ,TRADE_DIV ,TRAIN_MODE_YN ,TRADE_KINDPER ,SYS_DT ,ORD_TIME ";
sQuery += " ,PAY_TIME ,PIC_NO ,ORD_PIC_NO ,STOR_OWN_PART_TIME_DIV ,ORG_BILL_POSNO ,ORG_BILLDT ,ORG_BILL_NO ,RTN_RSN_CD ,RTN_RSN_MEMO ,NONSALES_RSN_CD ";
sQuery += " ,RESERV_NO ,RESERV_DT ,CUST_NO ,ORD_DIV ,FLOOR_CD ,TBL_NO ,GUESTFLOOR ,FRGNR_DIV ,CUSTCNT ,PAY_GNDR_DIV ";
sQuery += " ,PAY_AGE ,MAN_CMPNPSN_CNT ,WOMAN_CMPNPSN_CNT ,QTY ,TOTSALE_AMT ,TOTDC_AMT ,NET_SALE_AMT ,ITEM_DC_AMT ,CPI_DC_AMT,COOP_CARD_DC_AMT ";
sQuery += " ,POINT_DC_AMT ,CPN_DC_AMT ,EMP_DC_AMT ,SET_DC_AMT ,ETC_AMT ,EXCEP_DC_AMT ,TOT_VAT ,SVC_FEE_AMT ,SVC_FEE_VAT ,ETC_VAT ";
sQuery += " ,AF_ACCUM_POINT_AMT ,AF_ACCUM_POINT_INFO ,PPCARD_CUSTNM ,AMT_DUTCHPAY_YN ,BILLSPR_CNT ,ORDER_NO ,SLACK_FIELD ,MID_CLOSE_SEQ ,PPCARD_CUSTID ,PACK_TRADE_DIV ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
//기존
//sQuery += " ,SEND_YN ,OUT_SEND_YN ,REG_DATE ,UPD_DATE ,VIP_TY";
//변경
sQuery += " ,SEND_YN ,OUT_SEND_YN ,REG_DATE ,UPD_DATE ,VIP_TY, HP_EXCLUDE_YN";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, END
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', N'{18}', '{19}', ";
sQuery += " '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', ";
sQuery += " '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}', '{39}', ";
sQuery += " '{40}', '{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', ";
sQuery += " '{50}', '{51}', N'{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}', '{59}', ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
//기존
//sQuery += " '{60}', '{61}', '{62}', '{63}', '{64}' ) ";
//변경
sQuery += " '{60}', '{61}', '{62}', '{63}', '{64}', '{65}' ) ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, END
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
// 주문시간
if (m_cTrnStatus.Head.OrderHms.Trim() == "") m_cTrnStatus.Head.OrderHms = m_cTrnStatus.Head.PayHms;
sQuery = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, m_cTrnStatus.Head.TradeDiv // TRADE_DIV
, m_cTrnStatus.Head.TrainModeYn // TRAIN_MODE_YN
, m_cTrnStatus.Head.TradeKind // TRADE_KINDPER
, m_cTrnStatus.Head.SysYmd // SYS_DT
, m_cTrnStatus.Head.OrderHms // ORD_TIME
, m_cTrnStatus.Head.PayHms // PAY_TIME
, m_cTrnStatus.Head.CashierId // PIC_NO
, m_cTrnStatus.Head.OrderPicNo // ORD_PIC_NO
, m_cTrnStatus.Head.OwnPartDiv // STOR_OWN_PART_TIME_DIV
, m_cTrnStatus.Head.OrgPosNo // ORG_BILL_POSNO
, m_cTrnStatus.Head.OrgSaleDate // ORG_BILLDT
, m_cTrnStatus.Head.OrgTradeNo // ORG_BILL_NO
, m_cTrnStatus.Head.RtnReasonCd // RTN_RSN_CD
, m_cTrnStatus.Head.RtnReasonMemo // RTN_RSN_MEMO
, m_cTrnStatus.Head.NonSaleRsnCd =="" ? "0": m_cTrnStatus.Head.NonSaleRsnCd // NONSALES_RSN_CD
, m_cTrnStatus.Head.ReserveNo // RESERV_NO
, m_cTrnStatus.Head.ReserveYmd // RESERV_DT
, m_cTrnStatus.Head.MemberCustNo // CUST_NO
, m_cTrnStatus.Head.OrderFlag // ORD_DIV
, m_cTrnStatus.Head.FloorCd // FLOOR_CD
, m_cTrnStatus.Head.TableNo // TBL_NO
, m_cTrnStatus.Head.CustFloor // GUESTFLOOR
, m_cTrnStatus.Head.ForeignFlag // FRGNR_DIV
, m_cTrnStatus.Head.CustCnt // CUSTCNT
, m_cTrnStatus.Head.PayGndrDiv // PAY_GNDR_DIV
, m_cTrnStatus.Head.PayAge // PAY_AGE
, m_cTrnStatus.Head.ManCmpnpsnCnt // MAN_CMPNPSN_CNT
, m_cTrnStatus.Head.WomanCmpnpsnCnt // WOMAN_CMPNPSN_CNT
, m_cTrnStatus.Head.TotQty // QTY
, m_cTrnStatus.Head.TotSaleAmt // TOTSALE_AMT
, m_cTrnStatus.Head.TotDcAmt // TOTDC_AMT
, m_cTrnStatus.Head.NetSaleAmt // NET_SALE_AMT
, m_cTrnStatus.Head.ItemDcAmt // ITEM_DC_AMT
, m_cTrnStatus.Head.CpiDcAmt // CPI_DC_AMT
, m_cTrnStatus.Head.CoopCardDcAmt // COOP_CARD_DC_AMT
, m_cTrnStatus.Head.PointDcAmt // POINT_DC_AMT
, m_cTrnStatus.Head.CpnDcAmt // CPN_DC_AMT
, m_cTrnStatus.Head.EmpDcAmt // EMP_DC_AMT
, m_cTrnStatus.Head.SetDcAmt // SET_DC_AMT
, m_cTrnStatus.Head.EtcDcAmt // ETC_AMT
, m_cTrnStatus.Head.ExcepDcAmt // EXCEP_DC_AMT
, m_cTrnStatus.Head.TotVatAmt // TOT_VAT
, m_cTrnStatus.Head.SvcFeeAmt // SVC_FEE_AMT
, m_cTrnStatus.Head.SvcFeeVat // SVC_FEE_VAT
, m_cTrnStatus.Head.EtcVatAmt // ETC_VAT
, m_cTrnStatus.Head.AftSavePoint // AF_ACCUM_POINT_AMT
, m_cTrnStatus.Head.AftSaveAddInfo // AF_ACCUM_POINT_INFO
, m_cTrnStatus.Head.PpCardCustNm // PPCARD_CUSTNM
, m_cTrnStatus.Head.AmtDutchPayYn // AMT_DUTCHPAY_YN
, m_cTrnStatus.Head.BillSplitCnt // BILLSPR_CNT
, m_cTrnStatus.Head.OrderNo // ORDER_NO
, "" // SLACK_FIELD
, m_cTrnStatus.Head.MidCloseSeq // MID_CLOSE_SEQ
, m_cTrnStatus.Head.PpCardCustId // PPCARD_CUSTID
, m_cTrnStatus.Head.PackTradeDiv // PACK_TRADE_DIV
, sSendYN // SEND_YN
, '0' // OUT_SEND_YN
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, m_cTrnStatus.Head.VipTy // VIP_TY
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
, m_cTrnStatus.Head.HP_EXCLUDE_YN // HP_EXCLUDE_YN
//#20170828 해피포인트 적립 제외 버튼 추가 phj, END
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) == UserCom.OK) return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 상품 저장 처리
/// </summary>
/// <returns></returns>
public string SavePluItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
int iSeq = 1;
//#20170926 매출 생성시 부가상품인 경우 서브점포코드 안들어가는 현상 수정 start
string sSubStorCd = "";
//#20170926 매출 생성시 부가상품인 경우 서브점포코드 안들어가는 현상 수정 end
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 start
string sTakeInOutDiv = "";
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 end
try
{
//#20171227 거래데이터 저장 오류 관련 로그추가 start
/*
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
"SavePluItem STEP 1");
*/
//#20171227 거래데이터 저장 오류 관련 로그추가 end
// 상품정보
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
if (aSaleItem.Count == 0) return UserCom.RST_OK;
//#20171227 거래데이터 저장 오류 관련 로그추가 start
/*
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
"SavePluItem STEP 2");
*/
//#20171227 거래데이터 저장 오류 관련 로그추가 end
sQuery += " INSERT INTO POSLOG..TR_SALE_DETAIL ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO , TRADE_NO ,SEQ ,ORD_TIME ,FLOOR_CD ,TBL_NO ,SUB_SHOP_CD ";
sQuery += " ,ITEM_PLU_CD ,ITEM_DIV ,SALE_QTY ,SALE_PRC ,SALE_AMT ,FLAVOUR_DIV ,FLAVOUR_WEIGHT ,ITEM_INPUT_DIV ,ITEM_BAR_CD ,TAKE_IN_OUT_DIV ";
sQuery += " ,ITEM_TAX_DIV ,TAX_AMT_INCLUDE_YN, TAXRATE_CD, APPLY_TAX_AMT, SVC_FEE_AMT ,SVC_FEE_VAT ,NONSALES_RSN_CD, SVC_TAXREATE_CD, BILL_AMT ,DC_DIV ";
sQuery += " ,DC_TYPE ,DC_RATE ,ITEM_DC_AMT ,SUM_DC_AMT ,CPI_DC_QTY ,CPI_DC_AMT ,COOP_CARD_DC_DIV ,COOP_CARD_DC_AMT ,POINT_DC_DIV ,POINT_DC_AMT ";
sQuery += " ,CPN_DC_DIV ,CPN_DC_AMT ,EMP_DC_DIV ,EMP_DC_AMT ,SET_DC_AMT ,ETC_DC_DIV ,ETC_DC_AMT ,EXCEP_DC_DIV ,EXCEP_DC_AMT ,PACK_DIV ";
sQuery += " ,SUBPRC_MENU_KEY_DIV ,SET_MENU_CD ,CPI_PRESENT_DIV ,BILLSPR_NO ,SALE_GIFT_NO ,CPN_NO ,SLACK_FIELD ,DISPO_ITEM_DIV ,CANCEL_DIV ,REG_DATE";
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 start
//기존
//sQuery += " ,UPD_DATE, NOTAX_DIV ";
//변경
sQuery += " ,UPD_DATE, NOTAX_DIV, HPO_REG_YN ";
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 end
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}', '{39}',";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', ";
sQuery += " '{50}','{51}', '{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}', '{59}', ";
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 start
//기존
//sQuery += " '{60}','{61}' )";
//변경
sQuery += " '{60}','{61}','{62}' )";
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 end
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 start
//KDS 부가 정보 사용 여부 [고객명/VIP 구분](0:사용안함, 1:사용함) - 쒝쒝버거용
if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT027), "0") == "1")
{
if (m_cTrnStatus.Head.PackTradeDiv == "1")
{
sTakeInOutDiv = PosConst.TAKE_IN_OUT_DIV.TAKE_IN;
}
else if (m_cTrnStatus.Head.PackTradeDiv == "2")
{
sTakeInOutDiv = PosConst.TAKE_IN_OUT_DIV.TAKE_OUT;
}
}
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 end
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
if (cSaleItem.CANCEL_DIV == "1" || cSaleItem.CANCEL_DIV_MAIN == "1") cSaleItem.CANCEL_DIV = "1";
if (cSaleItem.CANCEL_DIV == "1" && m_cPosStatus.Sale.DutchPayFlg == "1" && (cSaleItem.DUTCH_PAY_CAN_DIV != "1" || cSaleItem.DUTCH_PAY_MAIN_CAN_DIV != "1"))
{
continue;
}
// 취소 소계 전후 체크
string sCanDiv = cSaleItem.CANCEL_DIV;
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL)
{
sCanDiv = m_cTrnStatus.Sale.SubTotalCancelDiv == true ? PosConst.CANCEL_DIV.CANCEL_SUBTOT : PosConst.CANCEL_DIV.CANCEL;
}
// 주문시간
if (cSaleItem.ORD_TIME.Trim() == "") cSaleItem.ORD_TIME = m_cTrnStatus.Head.PayHms;
//#20170926 매출 생성시 부가상품인 경우 서브점포코드 안들어가는 현상 수정 start
//서브 점포 코드가 없으면 직전 서브 점포 코드로 셋팅
if ((cSaleItem.SUB_SHOP_CD.Trim() == "") && (cSaleItem.ITEM_DIV == "3"))
{
cSaleItem.SUB_SHOP_CD = sSubStorCd;
}
else
{
sSubStorCd = cSaleItem.SUB_SHOP_CD;
}
//#20170926 매출 생성시 부가상품인 경우 서브점포코드 안들어가는 현상 수정 end
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
//, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iSeq++ //iRow + 1 // SEQ
, cSaleItem.ORD_TIME // ORD_TIME
, cSaleItem.FLOOR_CD // FLOOR_CD
, cSaleItem.TBL_NO // TBL_NO
, cSaleItem.SUB_SHOP_CD // SUB_SHOP_CD
, cSaleItem.ITEM_PLU_CD // ITEM_PLU_CD
, cSaleItem.ITEM_DIV // ITEM_DIV
, cSaleItem.SALE_QTY // SALE_QTY
, cSaleItem.SALE_PRC // SALE_PRC
, cSaleItem.SALE_AMT // SALE_AMT
, cSaleItem.FLAVOUR_DIV // FLAVOUR_DIV
, cSaleItem.FLAVOUR_STOCK // FLAVOUR_STOCK
, cSaleItem.ITEM_INPUT_DIV // ITEM_INPUT_DIV
, cSaleItem.ITEM_BAR_CD // ITEM_BAR_CD
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 start
//기존
//, cSaleItem.TAKE_IN_OUT_DIV // TAKE_IN_OUT_DIV
//변경
, sTakeInOutDiv == "" ? cSaleItem.TAKE_IN_OUT_DIV : sTakeInOutDiv // TAKE_IN_OUT_DIV
//#20180118 KDS 부가 정보 사용시 TAKE IN / TAKE OUT 선택값 TR_SALE_DETAIL.TAKE_IN_OUT_DIV 값 설정 end
, cSaleItem.ITEM_TAX_DIV // ITEM_TAX_DIV
, cSaleItem.TAX_AMT_INCLUDE_YN // TAX_AMT_INCLUDE_YN
, cSaleItem.TAXRATE_CD // TAXRATE_CD
, cSaleItem.APPLY_TAX_AMT // APPLY_TAX_AMT
, cSaleItem.SVC_FEE_AMT // SVC_FEE_AMT
, cSaleItem.SVC_FEE_VAT // SVC_FEE_VAT
, cSaleItem.NONSALES_RSN_CD == "" ? "0" : cSaleItem.NONSALES_RSN_CD // NONSALES_RSN_CD
, cSaleItem.SVC_TAXREATE_CD //SVC_TAXREATE_CD
, cSaleItem.BILL_AMT // BILL_AMT
, cSaleItem.DC_DIV
, cSaleItem.DC_TYPE
, cSaleItem.DC_RATE
, cSaleItem.ITEM_DC_AMT
, cSaleItem.SUM_DC_AMT
, cSaleItem.CPI_DC_QTY
, cSaleItem.CPI_DC_AMT
, cSaleItem.COOP_CARD_DC_DIV
, cSaleItem.COOP_CARD_DC_AMT
, cSaleItem.POINT_DC_DIV
, cSaleItem.POINT_DC_AMT
, cSaleItem.CPN_DC_DIV
, cSaleItem.CPN_DC_AMT
, cSaleItem.EMP_DC_DIV
, cSaleItem.EMP_DC_AMT
, cSaleItem.SET_DC_AMT
, cSaleItem.ETC_DC_DIV
, cSaleItem.ETC_DC_AMT
, cSaleItem.EXCEP_DC_DIV
, cSaleItem.EXCEP_DC_AMT
, cSaleItem.PACK_DIV
, cSaleItem.SUBPRC_MENU_KEY_DIV
, cSaleItem.SET_MENU_CD == "" ? cSaleItem.SUB_MENU_MAIN_CD : cSaleItem.SET_MENU_CD
, cSaleItem.CPI_PRESENT_DIV
, cSaleItem.BILLSPR_NO
, cSaleItem.SALE_GIFT_NO
, cSaleItem.CPN_NO
, cSaleItem.SLACK_FIELD // 선불카드권종(2017.06.27)
, cSaleItem.DISPO_ITEM_DIV
, sCanDiv
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, cSaleItem.NOTAX_DIV
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 start
, cSaleItem.HPO_REG_YN
//#20180903 해피오더 매출 생성 시 tr_sale_detail에 구분자 추가 end
);
//#20171227 거래데이터 저장 오류 관련 로그추가 start
/*
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
"SavePluItem STEP 3 -> " + sSQL);
*/
//#20171227 거래데이터 저장 오류 관련 로그추가 end
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 결제 저장 처리
/// </summary>
/// <returns></returns>
public string SavePaymentItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 결제정보
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
if (alPayItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG..TR_SALE_PAY ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, TRADE_NO, SEQ, PAY_WAY_CD, PAY_AMT, PAY_DTL_CD_01, PAY_DTL_CD_02";
sQuery += " , PAY_DTL_CD_03, PAY_DTL_CD_04, PAY_DTL_CD_05, QTY_ENTRY_01, QTY_ENTRY_02, QTY_ENTRY_03, QTY_ENTRY_04, QTY_ENTRY_05, AMT_ENTRY_01, AMT_ENTRY_02";
sQuery += " , AMT_ENTRY_03, AMT_ENTRY_04, AMT_ENTRY_05, AMT_ENTRY_06, AMT_ENTRY_07, AMT_ENTRY_08, AMT_ENTRY_09,AMT_ENTRY_10, OCCUR_ENTRY_01, OCCUR_ENTRY_02";
sQuery += " , OCCUR_ENTRY_03, OCCUR_ENTRY_04, OCCUR_ENTRY_05, OCCUR_ENTRY_06, OCCUR_ENTRY_07, OCCUR_ENTRY_08, OCCUR_ENTRY_09, OCCUR_ENTRY_10, OCCUR_ENTRY_11, OCCUR_ENTRY_12";
sQuery += " , OCCUR_ENTRY_13, OCCUR_ENTRY_14, OCCUR_ENTRY_15, OCCUR_ENTRY_16, OCCUR_ENTRY_17, OCCUR_ENTRY_18, OCCUR_ENTRY_19, OCCUR_ENTRY_20, OCCUR_ENTRY_21, OCCUR_ENTRY_22";
sQuery += " , OCCUR_ENTRY_23, OCCUR_ENTRY_24, OCCUR_ENTRY_25, BILLSPR_NO, CANCEL_DIV, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', ";
sQuery += " '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', N'{28}', N'{29}', ";
sQuery += " N'{30}', N'{31}', N'{32}', N'{33}', N'{34}', N'{35}', N'{36}', N'{37}', N'{38}', N'{39}', ";
sQuery += " N'{40}', N'{41}', N'{42}', N'{43}', N'{44}', N'{45}', N'{46}', N'{47}', N'{48}', N'{49}', ";
sQuery += " N'{50}', N'{51}', N'{52}', '{53}', '{54}', '{55}', '{56}' )";
for (int iRow = 0; iRow < alPayItem.Count; iRow++)
{
Column.TR_PAYMENT.DATA cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[iRow];
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
//, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iRow + 1 // SEQ
, cPayItem.PAY_WAY_CD // PAY_WAY_CD
, cPayItem.PAY_AMT // PAY_AMT
, cPayItem.PAY_DTL_CD_01 // PAY_DTL_CD_01
, cPayItem.PAY_DTL_CD_02 // PAY_DTL_CD_02
, cPayItem.PAY_DTL_CD_03 // PAY_DTL_CD_03
, cPayItem.PAY_DTL_CD_04 // PAY_DTL_CD_04
, cPayItem.PAY_DTL_CD_05 // PAY_DTL_CD_05
, cPayItem.QTY_ENTRY_01 // QTY_ENTRY_01
, cPayItem.QTY_ENTRY_02 // QTY_ENTRY_02
, cPayItem.QTY_ENTRY_03 // QTY_ENTRY_03
, cPayItem.QTY_ENTRY_04 // QTY_ENTRY_04
, cPayItem.QTY_ENTRY_05 // QTY_ENTRY_05
, cPayItem.AMT_ENTRY_01 // AMT_ENTRY_01
, cPayItem.AMT_ENTRY_02 // AMT_ENTRY_02
, cPayItem.AMT_ENTRY_03 // AMT_ENTRY_03
, cPayItem.AMT_ENTRY_04 // AMT_ENTRY_04
, cPayItem.AMT_ENTRY_05 // AMT_ENTRY_05
, cPayItem.AMT_ENTRY_06 // AMT_ENTRY_06
, cPayItem.AMT_ENTRY_07 // AMT_ENTRY_07
, cPayItem.AMT_ENTRY_08 // AMT_ENTRY_08
, cPayItem.AMT_ENTRY_09 // AMT_ENTRY_09
, cPayItem.AMT_ENTRY_10 // AMT_ENTRY_10
, cPayItem.OCCUR_ENTRY_01 // OCCUR_ENTRY_01
, cPayItem.OCCUR_ENTRY_02 // OCCUR_ENTRY_02
, cPayItem.OCCUR_ENTRY_03 // OCCUR_ENTRY_03
, cPayItem.OCCUR_ENTRY_04 // OCCUR_ENTRY_04
, cPayItem.OCCUR_ENTRY_05 // OCCUR_ENTRY_05
, cPayItem.OCCUR_ENTRY_06 // OCCUR_ENTRY_06
, cPayItem.OCCUR_ENTRY_07 // OCCUR_ENTRY_07
, cPayItem.OCCUR_ENTRY_08 // OCCUR_ENTRY_08
, cPayItem.OCCUR_ENTRY_09 // OCCUR_ENTRY_09
, cPayItem.OCCUR_ENTRY_10 // OCCUR_ENTRY_10
, cPayItem.OCCUR_ENTRY_11 // OCCUR_ENTRY_11
, cPayItem.OCCUR_ENTRY_12 // OCCUR_ENTRY_12
, cPayItem.OCCUR_ENTRY_13 // OCCUR_ENTRY_13
, cPayItem.OCCUR_ENTRY_14 // OCCUR_ENTRY_14
, cPayItem.OCCUR_ENTRY_15 // OCCUR_ENTRY_15
, cPayItem.OCCUR_ENTRY_16 // OCCUR_ENTRY_16
, cPayItem.OCCUR_ENTRY_17 // OCCUR_ENTRY_17
, cPayItem.OCCUR_ENTRY_18 // OCCUR_ENTRY_18
, cPayItem.OCCUR_ENTRY_19 // OCCUR_ENTRY_19
, cPayItem.OCCUR_ENTRY_20 // OCCUR_ENTRY_20
, cPayItem.OCCUR_ENTRY_21 // OCCUR_ENTRY_21
, cPayItem.OCCUR_ENTRY_22 // OCCUR_ENTRY_22
, cPayItem.OCCUR_ENTRY_23 // OCCUR_ENTRY_23
, cPayItem.OCCUR_ENTRY_24 // OCCUR_ENTRY_24
, cPayItem.OCCUR_ENTRY_25 // OCCUR_ENTRY_25
, cPayItem.BILLSPR_NO // BILLSPR_NO
, cPayItem.CANCEL_DIV // CANCEL_DIV
, DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
//현금 알리 저장!
AddCashAlarm(cPayItem.PAY_WAY_CD, cPayItem.PAY_DTL_CD_01, cPayItem.PAY_AMT, cPayItem.AMT_ENTRY_02);
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 기타 수단코드 저장
/// </summary>
/// <returns></returns>
public string SaveEtcItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
if (alEtcItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG..TR_SALE_ETC ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, TRADE_NO, SEQ, ETC_WAY_CD, ETC_AMT, ETC_DTL_CD_01, ETC_DTL_CD_02 ";
sQuery += " , ETC_DTL_CD_03, ETC_DTL_CD_04, ETC_DTL_CD_05, QTY_ENTRY_01, QTY_ENTRY_02, QTY_ENTRY_03, QTY_ENTRY_04, QTY_ENTRY_05, AMT_ENTRY_01, AMT_ENTRY_02 ";
sQuery += " , AMT_ENTRY_03, AMT_ENTRY_04, AMT_ENTRY_05, AMT_ENTRY_06, AMT_ENTRY_07, AMT_ENTRY_08, AMT_ENTRY_09, AMT_ENTRY_10, OCCUR_ENTRY_01, OCCUR_ENTRY_02 ";
sQuery += " , OCCUR_ENTRY_03, OCCUR_ENTRY_04, OCCUR_ENTRY_05, OCCUR_ENTRY_06, OCCUR_ENTRY_07, OCCUR_ENTRY_08, OCCUR_ENTRY_09, OCCUR_ENTRY_10, OCCUR_ENTRY_11, OCCUR_ENTRY_12 ";
sQuery += " , OCCUR_ENTRY_13, OCCUR_ENTRY_14, OCCUR_ENTRY_15, OCCUR_ENTRY_16, OCCUR_ENTRY_17, OCCUR_ENTRY_18, OCCUR_ENTRY_19,OCCUR_ENTRY_20, OCCUR_ENTRY_21, OCCUR_ENTRY_22 ";
sQuery += " , OCCUR_ENTRY_23, OCCUR_ENTRY_24, OCCUR_ENTRY_25, BILLSPR_NO, CANCEL_DIV, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , '{19}', ";
sQuery += " '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', N'{28}' , N'{29}', ";
sQuery += " N'{30}',N'{31}', N'{32}', N'{33}', N'{34}', N'{35}', N'{36}', N'{37}', N'{38}' , N'{39}', ";
sQuery += " N'{40}',N'{41}', N'{42}', N'{43}', N'{44}', N'{45}', N'{46}', N'{47}', N'{48}' , N'{49}', ";
sQuery += " N'{50}',N'{51}', N'{52}', '{53}', '{54}', '{55}', '{56}' )";
for (int iRow = 0; iRow < alEtcItem.Count; iRow++)
{
Column.TR_ETC.DATA cEtcItem = (Column.TR_ETC.DATA)alEtcItem[iRow];
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
//, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iRow + 1 // SEQ
, cEtcItem.ETC_WAY_CD // ETC_WAY_CD
, cEtcItem.ETC_AMT // ETC_AMT
, cEtcItem.ETC_DTL_CD_01 // ETC_DTL_CD_01
, cEtcItem.ETC_DTL_CD_02 // ETC_DTL_CD_02
, cEtcItem.ETC_DTL_CD_03 // ETC_DTL_CD_03
, cEtcItem.ETC_DTL_CD_04 // ETC_DTL_CD_04
, cEtcItem.ETC_DTL_CD_05 // ETC_DTL_CD_05
, cEtcItem.QTY_ENTRY_01 // QTY_ENTRY_01
, cEtcItem.QTY_ENTRY_02 // QTY_ENTRY_02
, cEtcItem.QTY_ENTRY_03 // QTY_ENTRY_03
, cEtcItem.QTY_ENTRY_04 // QTY_ENTRY_04
, cEtcItem.QTY_ENTRY_05 // QTY_ENTRY_05
, cEtcItem.AMT_ENTRY_01 // AMT_ENTRY_01
, cEtcItem.AMT_ENTRY_02 // AMT_ENTRY_02
, cEtcItem.AMT_ENTRY_03 // AMT_ENTRY_03
, cEtcItem.AMT_ENTRY_04 // AMT_ENTRY_04
, cEtcItem.AMT_ENTRY_05 // AMT_ENTRY_05
, cEtcItem.AMT_ENTRY_06 // AMT_ENTRY_06
, cEtcItem.AMT_ENTRY_07 // AMT_ENTRY_07
, cEtcItem.AMT_ENTRY_08 // AMT_ENTRY_08
, cEtcItem.AMT_ENTRY_09 // AMT_ENTRY_09
, cEtcItem.AMT_ENTRY_10 // AMT_ENTRY_10
, cEtcItem.OCCUR_ENTRY_01 // OCCUR_ENTRY_01
, cEtcItem.OCCUR_ENTRY_02 // OCCUR_ENTRY_02
, cEtcItem.OCCUR_ENTRY_03 // OCCUR_ENTRY_03
, cEtcItem.OCCUR_ENTRY_04 // OCCUR_ENTRY_04
, cEtcItem.OCCUR_ENTRY_05 // OCCUR_ENTRY_05
, cEtcItem.OCCUR_ENTRY_06 // OCCUR_ENTRY_06
, cEtcItem.OCCUR_ENTRY_07 // OCCUR_ENTRY_07
, cEtcItem.OCCUR_ENTRY_08 // OCCUR_ENTRY_08
, cEtcItem.OCCUR_ENTRY_09 // OCCUR_ENTRY_09
, cEtcItem.OCCUR_ENTRY_10 // OCCUR_ENTRY_10
, cEtcItem.OCCUR_ENTRY_11 // OCCUR_ENTRY_11
, cEtcItem.OCCUR_ENTRY_12 // OCCUR_ENTRY_12
, cEtcItem.OCCUR_ENTRY_13 // OCCUR_ENTRY_13
, cEtcItem.OCCUR_ENTRY_14 // OCCUR_ENTRY_14
, cEtcItem.OCCUR_ENTRY_15 // OCCUR_ENTRY_15
, cEtcItem.OCCUR_ENTRY_16 // OCCUR_ENTRY_16
, cEtcItem.OCCUR_ENTRY_17 // OCCUR_ENTRY_17
, cEtcItem.OCCUR_ENTRY_18 // OCCUR_ENTRY_18
, cEtcItem.OCCUR_ENTRY_19 // OCCUR_ENTRY_19
, cEtcItem.OCCUR_ENTRY_20 // OCCUR_ENTRY_20
, cEtcItem.OCCUR_ENTRY_21 // OCCUR_ENTRY_21
, cEtcItem.OCCUR_ENTRY_22 // OCCUR_ENTRY_22
, cEtcItem.OCCUR_ENTRY_23 // OCCUR_ENTRY_23
, cEtcItem.OCCUR_ENTRY_24 // OCCUR_ENTRY_24
, cEtcItem.OCCUR_ENTRY_25 // OCCUR_ENTRY_25
, cEtcItem.BILLSPR_NO // BILLSPR_NO
, cEtcItem.CANCEL_DIV // CANCEL_DIV
, DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 캠페인 정보 저장
/// </summary>
/// <returns></returns>
public string SaveCampaignItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 상품 정보
ArrayList alTrSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
if (alTrSaleItem.Count == 0) return UserCom.RST_OK;
// 캠페인 정보
ArrayList alTrCpiItem = (ArrayList)StateObject.GetItemObject(Column.TR_SALE_CPI_RSLT.ITEM);
// 상품 캠페인 정보
for (int i = 0; i < alTrSaleItem.Count; i++ )
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)alTrSaleItem[i];
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
if (cSaleItem.alTrSaleCpi == null) continue;
foreach (Column.TR_SALE_CPI_RSLT.DATA cTrPluCpi in cSaleItem.alTrSaleCpi)
{
if (cTrPluCpi.PAY_DC_DIV == PosConst.PAY_DC_TYPE.PAY) continue; // 할인결제구분 (1:결제, 2:할인)
if (cTrPluCpi.DC_SUM_AMT <= 0 && cTrPluCpi.DC_QTY <= 0) continue;
Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi = new Column.TR_SALE_CPI_RSLT.DATA();
// 캠페인 실적 정보 설정
cTrSaleCpi.NMTAX_SEQ = i + 1;
cTrSaleCpi.CPI_CD = cTrPluCpi.CPI_CD;
cTrSaleCpi.ITEM_APPLY_METHD = cTrPluCpi.ITEM_APPLY_METHD;
cTrSaleCpi.SUB_SHOP_CD = cTrPluCpi.SUB_SHOP_CD;
cTrSaleCpi.ITEM_PLU_CD = cTrPluCpi.ITEM_PLU_CD;
cTrSaleCpi.DC_QTY = cTrPluCpi.DC_QTY;
cTrSaleCpi.DC_PRC = cTrPluCpi.DC_PRC;
cTrSaleCpi.DC_SUM_AMT = cTrPluCpi.DC_SUM_AMT;
cTrSaleCpi.CPI_CUST_BNFT_TYPE = cTrPluCpi.CPI_CUST_BNFT_TYPE;
cTrSaleCpi.LTTR_NMPLAT_NO = cTrPluCpi.LTTR_NMPLAT_NO;
cTrSaleCpi.TRGT_CUST_TYPE = cTrPluCpi.TRGT_CUST_TYPE;
cTrSaleCpi.BILLSPR_NO = cTrPluCpi.BILLSPR_NO;
cTrSaleCpi.SLACK_FIELD = cTrPluCpi.SLACK_FIELD;
cTrSaleCpi.CANCEL_DIV = cTrPluCpi.CANCEL_DIV;
cTrSaleCpi.ACCUM_POINT = cTrPluCpi.ACCUM_POINT;
cTrSaleCpi.CUST_PAY_TYPE = cTrPluCpi.CUST_PAY_TYPE;
cTrSaleCpi.PRESENT_DIV = cTrPluCpi.PRESENT_DIV;
alTrCpiItem.Add(cTrSaleCpi);
}
}
if (alTrCpiItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG..TR_SALE_CPI_RSLT ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, TRADE_NO, SEQ, CPI_TYPE, NMTAX_SEQ, CPI_CD, ";
sQuery += " SUB_SHOP_CD, ITEM_PLU_CD, DC_QTY, DC_PRC, DC_SUM_AMT, CPI_DIV, PAYMNT_DIV, ACCUM_POINT, LTTR_NMPLAT_NO, CPI_CUST_DIV, ";
sQuery += " BILLSPR_NO, SLACK_FIELD, CANCEL_DIV, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , '{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}' )";
// 기타 캠페인 정보
for(int i = 0; i < alTrCpiItem.Count ; i++)
{
Column.TR_SALE_CPI_RSLT.DATA cTrSaleCpi = (Column.TR_SALE_CPI_RSLT.DATA)alTrCpiItem[i];
if (cTrSaleCpi.CANCEL_DIV == "1") continue;
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
//, m_cTrnStatus.Head.RegNo // REG_NO
, i + 1 // SEQ
, cTrSaleCpi.ITEM_APPLY_METHD // CPI_TYPE
, cTrSaleCpi.NMTAX_SEQ // NMTAX_SEQ
, cTrSaleCpi.CPI_CD // CPI_CD
, cTrSaleCpi.SUB_SHOP_CD // SUB_SHOP_CD
, cTrSaleCpi.ITEM_PLU_CD // ITEM_PLU_CD
, cTrSaleCpi.DC_QTY // DC_QTY
, cTrSaleCpi.DC_PRC // DC_PRC
, cTrSaleCpi.DC_SUM_AMT // DC_SUM_AMT
, cTrSaleCpi.CPI_CUST_BNFT_TYPE // CPI_DIV
, cTrSaleCpi.CUST_PAY_TYPE // PAYMNT_DIV
, cTrSaleCpi.ACCUM_POINT // ACCUM_POINT
, cTrSaleCpi.LTTR_NMPLAT_NO // LTTR_NMPLAT_NO
, cTrSaleCpi.TRGT_CUST_TYPE // CPI_CUST_DIV
, cTrSaleCpi.BILLSPR_NO // BILLSPR_NO
, cTrSaleCpi.SLACK_FIELD // SLACK_FIELD
, "0" // CANCEL_DIV
, DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 사인데이터 저장
/// </summary>
/// <returns></returns>
public string SaveSignItem(string sSendYN)
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
ArrayList alSignItem = (ArrayList)StateObject.GetItemObject(Column.TR_SIGN.ITEM);
if (alSignItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG.dbo.TR_SALE_SIGN_LOG( ";
sQuery += " CMP_CD,SALE_DT,STOR_CD,POS_NO,TRADE_NO,SEQ,PAY_SEQ,SIGN_TIME,SIGN_DATA ";
sQuery += " ,SEND_YN,REG_DATE,UPD_DATE ";
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}','{11}' )";
for (int iRow = 0; iRow < alSignItem.Count; iRow++)
{
Column.TR_SIGN.DATA cSignItem = (Column.TR_SIGN.DATA)alSignItem[iRow];
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
//, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iRow + 1 // SEQ
, cSignItem.PAY_SEQ
, cSignItem.SIGN_TIME
, cSignItem.SIGN_DATA
, sSendYN
, DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 입출금 저장
/// </summary>
/// <returns></returns>
public string SaveDpstWthdr()
{
string sReturn = UserCom.RST_ERR;
string sQuery = string.Empty;
string sInsQuery = string.Empty;
try
{
// 입출금 정보
ArrayList aSaleDpstWthdr = (ArrayList)StateObject.GetItemObject(Column.SALE_DPST_WTHDR.ITEM);
if (aSaleDpstWthdr.Count == 0) return UserCom.RST_OK;
if (m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource,
m_cPosStatus.Base.LocalDbCatalog,
m_cPosStatus.Base.LocalDbUserID,
m_cPosStatus.Base.LocalDbPassword) == true)
{
sInsQuery += " INSERT INTO POSLOG..ETC_SALE_DPST_WTHDR ( ";
sInsQuery += " CMP_CD ,SALE_DT ,STOR_CD ,POS_NO ,REG_NO, SEQ ,TRADE_NO ,DPST_WTHDR_TYPE ,DPST_WTHDR_ACC_CD, DPST_WTHDR_CD, DPST_WTHDR_QTY, DPST_WTHDR_AMT ";
sInsQuery += ",DPST_WTHDR_NM ,CUST_NO, STOR_PAY_TYPE, ETC_REASON, SLACK_FIELD_01 ,SLACK_FIELD_02 ,SLACK_FIELD_03 ,SLACK_FIELD_04 ,SLACK_FIELD_05 ";
sInsQuery += ",REG_DATE ,UPD_DATE ";
sInsQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', {5}, '{6}', '{7}', '{8}' , '{9}', ";
sInsQuery += " {10},'{11}', N'{12}', '{13}', '{14}', N'{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}' )";
}
for (int iRow = 0; iRow < aSaleDpstWthdr.Count; iRow++)
{
Column.SALE_DPST_WTHDR.DATA cSaleDpstWthdr = (Column.SALE_DPST_WTHDR.DATA)aSaleDpstWthdr[iRow];
// 준비금 합계는 저장하지 않는다.
if (cSaleDpstWthdr.DPST_WTHDR_CD == PosConst.FRM_ACC_REMONEY_CODE.TOTAL_REMONEY) continue;
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
sQuery = string.Format(sInsQuery
, m_cTrnStatus.Head.CmpCd
, m_cTrnStatus.Head.SaleDate
, m_cTrnStatus.Head.StoreCd
, m_cTrnStatus.Head.PosNo
, m_cTrnStatus.Head.RegNo
, iRow + 1 // SEQ
, m_cTrnStatus.Head.TradeNo // 거래번호
, cSaleDpstWthdr.DPST_WTHDR_TYPE // 입출금유형
, cSaleDpstWthdr.DPST_WTHDR_ACC_CD // 입출금 계정
, cSaleDpstWthdr.DPST_WTHDR_CD // 입출금 코드
, cSaleDpstWthdr.DPST_WTHDR_QTY // 입출금 수량
, cSaleDpstWthdr.DPST_WTHDR_AMT // 입출금 금액
, cSaleDpstWthdr.DPST_WTHDR_NM // 입출금 명
, cSaleDpstWthdr.CUST_NO // 고객번호
, cSaleDpstWthdr.STOR_PAY_TYPE // 점포결제유형
, cSaleDpstWthdr.ETC_REASON // 기타사유
, cSaleDpstWthdr.SLACK_FIELD_01 // 여유필드01
, cSaleDpstWthdr.SLACK_FIELD_02 // 여유필드02
, cSaleDpstWthdr.SLACK_FIELD_03 // 여유필드03
, cSaleDpstWthdr.SLACK_FIELD_04 // 여유필드04
, cSaleDpstWthdr.SLACK_FIELD_05 // 여유필드05
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sReturn;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sReturn;
}
#endregion
#region
/// <summary>
/// 기타 데이터 저장 처리
/// </summary>
/// <returns></returns>
public string EtcSaveDataMain(string sSendYN)
{
string sRet = UserCom.RST_ERR;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
m_cSqlDbService.Begin();
sRet = SaveDpstWthdr(); // 입출금정보(준비금) 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveDpstWthdr");
return sRet;
}
sRet = SaveEtcPluItem(); // 상품정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveEtcPluItem");
return sRet;
}
sRet = SaveEtcPaymentItem(); // 결제정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveEtcPaymentItem");
return sRet;
}
sRet = SaveEtcEtcItem(); // 기타정보 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveEtcEtcItem");
return sRet;
}
sRet = SaveEtcHeader(sSendYN); // 트란해더 저장
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveEtcHeader");
return sRet;
}
if (sSendYN != "1") // 거래데이터 복구시 주방출력 안함(2017.05.24)
{
sRet = SaveKtchOrdMsg(); // 주방 데이터 저장 // Add, 2017.03.06, 주방출력 연습모드 적용
if (sRet != UserCom.RST_OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail => SaveKtchOrdMsg");
return sRet;
}
}
m_cSqlDbService.Commit();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 기타 해더 저장 처리
/// </summary>
/// <returns></returns>
public string SaveEtcHeader(string sSendYN)
{
string sQuery = "";
string sRet = UserCom.RST_ERR;
try
{
sQuery += " INSERT INTO POSLOG..ETC_SALE_HEADER ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO, REG_NO ,TRADE_NO ,TRADE_DIV ,TRAIN_MODE_YN ,TRADE_KINDPER ,SYS_DT ";
sQuery += " ,ORD_TIME ,PAY_TIME ,PIC_NO ,ORD_PIC_NO ,STOR_OWN_PART_TIME_DIV ,ORG_BILL_POSNO ,ORG_BILLDT ,ORG_BILL_NO ,RTN_RSN_CD ,RTN_RSN_MEMO ";
sQuery += " ,NONSALES_RSN_CD ,RESERV_NO ,RESERV_DT ,CUST_NO ,ORD_DIV ,FLOOR_CD ,TBL_NO ,GUESTFLOOR ,FRGNR_DIV ,CUSTCNT ";
sQuery += " ,PAY_GNDR_DIV ,PAY_AGE ,MAN_CMPNPSN_CNT ,WOMAN_CMPNPSN_CNT ,QTY ,TOTSALE_AMT ,TOTDC_AMT ,NET_SALE_AMT ,ITEM_DC_AMT ,CPI_DC_AMT ";
sQuery += " ,COOP_CARD_DC_AMT,POINT_DC_AMT,CPN_DC_AMT,EMP_DC_AMT,SET_DC_AMT ,ETC_AMT ,EXCEP_DC_AMT ,TOT_VAT ,SVC_FEE_AMT ,SVC_FEE_VAT ";
sQuery += " ,ETC_VAT, AF_ACCUM_POINT_AMT ,AF_ACCUM_POINT_INFO, PPCARD_CUSTNM, AMT_DUTCHPAY_YN ,BILLSPR_CNT ,ORDER_NO,SLACK_FIELD,MID_CLOSE_SEQ,PPCARD_CUSTID ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
//기존
//sQuery += " ,PACK_TRADE_DIV,TRADE_STAT, SEND_YN ,REG_DATE ,UPD_DATE ,VIP_TY";
//변경
sQuery += " ,PACK_TRADE_DIV,TRADE_STAT, SEND_YN ,REG_DATE ,UPD_DATE ,VIP_TY ,HP_EXCLUDE_YN";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, end
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , N'{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}' , '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}' , '{39}', ";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}' , '{49}', ";
sQuery += " '{50}','{51}', '{52}',N'{53}', '{54}', '{55}', '{56}', '{57}', '{58}' , '{59}', ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
//기존
//sQuery += " '{60}','{61}', '{62}', '{63}', '{64}', '{65}' ) ";
//변경
sQuery += " '{60}','{61}', '{62}', '{63}', '{64}', '{65}', '{66}' ) ";
//#20170828 해피포인트 적립 제외 버튼 추가 phj, end
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
// 주문시간
if (m_cTrnStatus.Head.OrderHms.Trim() == "") m_cTrnStatus.Head.OrderHms = m_cTrnStatus.Head.PayHms;
sQuery = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, m_cTrnStatus.Head.TradeDiv // TRADE_DIV
, m_cTrnStatus.Head.TrainModeYn // TRAIN_MODE_YN
, m_cTrnStatus.Head.TradeKind // TRADE_KINDPER
, m_cTrnStatus.Head.SysYmd // SYS_DT
, m_cTrnStatus.Head.OrderHms // ORD_TIME
, m_cTrnStatus.Head.PayHms // PAY_TIME
, m_cTrnStatus.Head.CashierId // PIC_NO
, m_cTrnStatus.Head.OrderPicNo // ORD_PIC_NO
, m_cTrnStatus.Head.OwnPartDiv // STOR_OWN_PART_TIME_DIV
, m_cTrnStatus.Head.OrgPosNo // ORG_BILL_POSNO
, m_cTrnStatus.Head.OrgSaleDate // ORG_BILLDT
, m_cTrnStatus.Head.OrgTradeNo // ORG_BILL_NO
, m_cTrnStatus.Head.RtnReasonCd // RTN_RSN_CD
, m_cTrnStatus.Head.RtnReasonMemo // RTN_RSN_MEMO
, m_cTrnStatus.Head.NonSaleRsnCd =="" ? "0": m_cTrnStatus.Head.NonSaleRsnCd // NONSALES_RSN_CD
, m_cTrnStatus.Head.ReserveNo // RESERV_NO
, m_cTrnStatus.Head.ReserveYmd // RESERV_DT
, m_cTrnStatus.Head.MemberCustNo // CUST_NO
, m_cTrnStatus.Head.OrderFlag // ORD_DIV
, m_cTrnStatus.Head.FloorCd // FLOOR_CD
, m_cTrnStatus.Head.TableNo // TBL_NO
, m_cTrnStatus.Head.CustFloor // GUESTFLOOR
, m_cTrnStatus.Head.ForeignFlag // FRGNR_DIV
, m_cTrnStatus.Head.CustCnt // CUSTCNT
, m_cTrnStatus.Head.PayGndrDiv // PAY_GNDR_DIV
, m_cTrnStatus.Head.PayAge // PAY_AGE
, m_cTrnStatus.Head.ManCmpnpsnCnt // MAN_CMPNPSN_CNT
, m_cTrnStatus.Head.WomanCmpnpsnCnt // WOMAN_CMPNPSN_CNT
, m_cTrnStatus.Head.TotQty // QTY
, m_cTrnStatus.Head.TotSaleAmt // TOTSALE_AMT
, m_cTrnStatus.Head.TotDcAmt // TOTDC_AMT
, m_cTrnStatus.Head.NetSaleAmt // NET_SALE_AMT
, m_cTrnStatus.Head.ItemDcAmt // ITEM_DC_AMT
, m_cTrnStatus.Head.CpiDcAmt // CPI_DC_AMT
, m_cTrnStatus.Head.CoopCardDcAmt // COOP_CARD_DC_AMT
, m_cTrnStatus.Head.PointDcAmt // POINT_DC_AMT
, m_cTrnStatus.Head.CpnDcAmt // CPN_DC_AMT
, m_cTrnStatus.Head.EmpDcAmt // EMP_DC_AMT
, m_cTrnStatus.Head.SetDcAmt // SET_DC_AMT
, m_cTrnStatus.Head.EtcDcAmt // ETC_AMT
, m_cTrnStatus.Head.ExcepDcAmt // EXCEP_DC_AMT
, m_cTrnStatus.Head.TotVatAmt // TOT_VAT
, m_cTrnStatus.Head.SvcFeeAmt // SVC_FEE_AMT
, m_cTrnStatus.Head.SvcFeeVat // SVC_FEE_VAT
, m_cTrnStatus.Head.EtcVatAmt // ETC_VAT
, m_cTrnStatus.Head.AftSavePoint // AF_ACCUM_POINT_AMT
, m_cTrnStatus.Head.AftSaveAddInfo // AF_ACCUM_POINT_INFO
, m_cTrnStatus.Head.PpCardCustNm // PPCARD_CUSTNM
, m_cTrnStatus.Head.AmtDutchPayYn // AMT_DUTCHPAY_YN
, m_cTrnStatus.Head.BillSplitCnt // BILLSPR_CNT
, m_cTrnStatus.Head.OrderNo // ORDER_NO
, "" // SLACK_FIELD
, m_cTrnStatus.Head.MidCloseSeq // MID_CLOSE_SEQ
, m_cTrnStatus.Head.PpCardCustId // PPCARD_CUSTID
, m_cTrnStatus.Head.PackTradeDiv // PACK_TRADE_DIV
, "0" // TRADE_STAT
, sSendYN // SEND_YN
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, m_cTrnStatus.Head.VipTy // VIP_TY
//#20170828 해피포인트 적립 제외 버튼 추가 phj, start
, m_cTrnStatus.Head.HP_EXCLUDE_YN // HP_EXCLUDE_YN
//#20170828 해피포인트 적립 제외 버튼 추가 phj, end
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) == UserCom.OK) return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 기타 상품 저장 처리
/// </summary>
/// <returns></returns>
public string SaveEtcPluItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 상품정보
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
if (aSaleItem.Count == 0) return UserCom.RST_OK;
sQuery = "";
sQuery += " INSERT INTO POSLOG..ETC_SALE_DETAIL ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO ,REG_NO ,SEQ ,TRADE_NO ,ORD_TIME ,FLOOR_CD ,TBL_NO ";
sQuery += " ,SUB_SHOP_CD ,ITEM_PLU_CD ,ITEM_DIV ,SALE_QTY ,SALE_PRC ,SALE_AMT ,FLAVOUR_DIV ,FLAVOUR_WEIGHT ,ITEM_INPUT_DIV, ITEM_BAR_CD ";
sQuery += " ,TAKE_IN_OUT_DIV ,ITEM_TAX_DIV ,TAX_AMT_INCLUDE_YN, TAXRATE_CD, APPLY_TAX_AMT ,SVC_FEE_AMT ,SVC_FEE_VAT ,NONSALES_RSN_CD, SVC_TAXREATE_CD, BILL_AMT ";
sQuery += " ,DC_DIV ,DC_TYPE ,DC_RATE ,ITEM_DC_AMT ,SUM_DC_AMT ,CPI_DC_QTY ,CPI_DC_AMT ,COOP_CARD_DC_DIV ,COOP_CARD_DC_AMT ,POINT_DC_DIV ";
sQuery += " ,POINT_DC_AMT ,CPN_DC_DIV ,CPN_DC_AMT ,EMP_DC_DIV ,EMP_DC_AMT ,SET_DC_AMT ,ETC_DC_DIV ,ETC_DC_AMT ,EXCEP_DC_DIV ,EXCEP_DC_AMT ";
sQuery += " ,PACK_DIV ,SET_MENU_CD ,SUBPRC_MENU_KEY_DIV ,CPI_PRESENT_DIV ,BILLSPR_NO ,SALE_GIFT_NO ,CPN_NO ,SLACK_FIELD ,DISPO_ITEM_DIV ,CANCEL_DIV ";
sQuery += " ,REG_DATE ,UPD_DATE ,NOTAX_DIV";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}', '{39}',";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', ";
sQuery += " '{50}','{51}', '{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}', '{59}', ";
sQuery += " '{60}','{61}', '{62}' )";
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
if (cSaleItem.CANCEL_DIV == "1" || cSaleItem.CANCEL_DIV_MAIN == "1") cSaleItem.CANCEL_DIV = "1";
//취소 소계 전후 체크
string sCanDiv = cSaleItem.CANCEL_DIV;
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL)
{
sCanDiv = m_cTrnStatus.Sale.SubTotalCancelDiv == true ? PosConst.CANCEL_DIV.CANCEL_SUBTOT : PosConst.CANCEL_DIV.CANCEL;
}
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
// 주문시간
if (cSaleItem.ORD_TIME.Trim() == "") cSaleItem.ORD_TIME = m_cTrnStatus.Head.PayHms;
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.RegNo // REG_NO
, iRow + 1 // SEQ
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, cSaleItem.ORD_TIME // ORD_TIME
, cSaleItem.FLOOR_CD // FLOOR_CD
, cSaleItem.TBL_NO // TBL_NO
, cSaleItem.SUB_SHOP_CD // SUB_SHOP_CD
, cSaleItem.ITEM_PLU_CD // ITEM_PLU_CD
, cSaleItem.ITEM_DIV // ITEM_DIV
, cSaleItem.SALE_QTY // SALE_QTY
, cSaleItem.SALE_PRC // SALE_PRC
, cSaleItem.SALE_AMT // SALE_AMT
, cSaleItem.FLAVOUR_DIV // FLAVOUR_DIV
, cSaleItem.FLAVOUR_STOCK // FLAVOUR_STOCK
, cSaleItem.ITEM_INPUT_DIV // ITEM_INPUT_DIV
, cSaleItem.ITEM_BAR_CD // ITEM_BAR_CD
, cSaleItem.TAKE_IN_OUT_DIV // TAKE_IN_OUT_DIV
, cSaleItem.ITEM_TAX_DIV // ITEM_TAX_DIV
, cSaleItem.TAX_AMT_INCLUDE_YN // TAX_AMT_INCLUDE_YN
, cSaleItem.TAXRATE_CD // TAXRATE_CD
, cSaleItem.APPLY_TAX_AMT // APPLY_TAX_AMT
, cSaleItem.SVC_FEE_AMT // SVC_FEE_AMT
, cSaleItem.SVC_FEE_VAT // SVC_FEE_VAT
, cSaleItem.NONSALES_RSN_CD == "" ? "0" : cSaleItem.NONSALES_RSN_CD // NONSALES_RSN_CD
, cSaleItem.SVC_TAXREATE_CD //SVC_TAXREATE_CD
, cSaleItem.BILL_AMT // BILL_AMT
, cSaleItem.DC_DIV
, cSaleItem.DC_TYPE
, cSaleItem.DC_RATE
, cSaleItem.ITEM_DC_AMT
, cSaleItem.SUM_DC_AMT
, cSaleItem.CPI_DC_QTY
, cSaleItem.CPI_DC_AMT
, cSaleItem.COOP_CARD_DC_DIV
, cSaleItem.COOP_CARD_DC_AMT
, cSaleItem.POINT_DC_DIV
, cSaleItem.POINT_DC_AMT
, cSaleItem.CPN_DC_DIV
, cSaleItem.CPN_DC_AMT
, cSaleItem.EMP_DC_DIV
, cSaleItem.EMP_DC_AMT
, cSaleItem.SET_DC_AMT
, cSaleItem.ETC_DC_DIV
, cSaleItem.ETC_DC_AMT
, cSaleItem.EXCEP_DC_DIV
, cSaleItem.EXCEP_DC_AMT
, cSaleItem.PACK_DIV
, cSaleItem.SET_MENU_CD == "" ? cSaleItem.SUB_MENU_MAIN_CD : cSaleItem.SET_MENU_CD
, cSaleItem.SUBPRC_MENU_KEY_DIV
, cSaleItem.CPI_PRESENT_DIV
, cSaleItem.BILLSPR_NO
, cSaleItem.SALE_GIFT_NO
, cSaleItem.CPN_NO
, cSaleItem.SLACK_FIELD // 선불카드권종(2017.06.27)
, cSaleItem.DISPO_ITEM_DIV
, sCanDiv
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, cSaleItem.NOTAX_DIV
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 기타 결제 저장 처리
/// </summary>
/// <returns></returns>
public string SaveEtcPaymentItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 결제정보
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
if (alPayItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG..ETC_SALE_PAY ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, REG_NO, TRADE_NO, SEQ, PAY_WAY_CD, PAY_AMT, PAY_DTL_CD_01,";
sQuery += " PAY_DTL_CD_02, PAY_DTL_CD_03, PAY_DTL_CD_04, PAY_DTL_CD_05, QTY_ENTRY_01, QTY_ENTRY_02, QTY_ENTRY_03, QTY_ENTRY_04,QTY_ENTRY_05, AMT_ENTRY_01, ";
sQuery += " AMT_ENTRY_02, AMT_ENTRY_03, AMT_ENTRY_04, AMT_ENTRY_05, AMT_ENTRY_06, AMT_ENTRY_07, AMT_ENTRY_08, AMT_ENTRY_09,AMT_ENTRY_10, OCCUR_ENTRY_01, ";
sQuery += " OCCUR_ENTRY_02, OCCUR_ENTRY_03, OCCUR_ENTRY_04, OCCUR_ENTRY_05, OCCUR_ENTRY_06, OCCUR_ENTRY_07, OCCUR_ENTRY_08, OCCUR_ENTRY_09, OCCUR_ENTRY_10, OCCUR_ENTRY_11, ";
sQuery += " OCCUR_ENTRY_12, OCCUR_ENTRY_13, OCCUR_ENTRY_14, OCCUR_ENTRY_15, OCCUR_ENTRY_16, OCCUR_ENTRY_17, OCCUR_ENTRY_18, OCCUR_ENTRY_19,OCCUR_ENTRY_20, OCCUR_ENTRY_21, ";
sQuery += " OCCUR_ENTRY_22, OCCUR_ENTRY_23, OCCUR_ENTRY_24, OCCUR_ENTRY_25, BILLSPR_NO, CANCEL_DIV, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , '{19}', ";
sQuery += " '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}' , N'{29}', ";
sQuery += " N'{30}',N'{31}', N'{32}', N'{33}', N'{34}', N'{35}', N'{36}', N'{37}', N'{38}' , N'{39}', ";
sQuery += " N'{40}',N'{41}', N'{42}', N'{43}', N'{44}', N'{45}', N'{46}', N'{47}', N'{48}' , N'{49}', ";
sQuery += " N'{50}',N'{51}', N'{52}', N'{53}', '{54}', '{55}', '{56}', '{57}' )";
for (int iRow = 0; iRow < alPayItem.Count; iRow++)
{
Column.TR_PAYMENT.DATA cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[iRow];
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iRow + 1 // SEQ
, cPayItem.PAY_WAY_CD // PAY_WAY_CD
, cPayItem.PAY_AMT // PAY_AMT
, cPayItem.PAY_DTL_CD_01 // PAY_DTL_CD_01
, cPayItem.PAY_DTL_CD_02 // PAY_DTL_CD_02
, cPayItem.PAY_DTL_CD_03 // PAY_DTL_CD_03
, cPayItem.PAY_DTL_CD_04 // PAY_DTL_CD_04
, cPayItem.PAY_DTL_CD_05 // PAY_DTL_CD_05
, cPayItem.QTY_ENTRY_01 // QTY_ENTRY_01
, cPayItem.QTY_ENTRY_02 // QTY_ENTRY_02
, cPayItem.QTY_ENTRY_03 // QTY_ENTRY_03
, cPayItem.QTY_ENTRY_04 // QTY_ENTRY_04
, cPayItem.QTY_ENTRY_05 // QTY_ENTRY_05
, cPayItem.AMT_ENTRY_01 // AMT_ENTRY_01
, cPayItem.AMT_ENTRY_02 // AMT_ENTRY_02
, cPayItem.AMT_ENTRY_03 // AMT_ENTRY_03
, cPayItem.AMT_ENTRY_04 // AMT_ENTRY_04
, cPayItem.AMT_ENTRY_05 // AMT_ENTRY_05
, cPayItem.AMT_ENTRY_06 // AMT_ENTRY_06
, cPayItem.AMT_ENTRY_07 // AMT_ENTRY_07
, cPayItem.AMT_ENTRY_08 // AMT_ENTRY_08
, cPayItem.AMT_ENTRY_09 // AMT_ENTRY_09
, cPayItem.AMT_ENTRY_10 // AMT_ENTRY_10
, cPayItem.OCCUR_ENTRY_01 // OCCUR_ENTRY_01
, cPayItem.OCCUR_ENTRY_02 // OCCUR_ENTRY_02
, cPayItem.OCCUR_ENTRY_03 // OCCUR_ENTRY_03
, cPayItem.OCCUR_ENTRY_04 // OCCUR_ENTRY_04
, cPayItem.OCCUR_ENTRY_05 // OCCUR_ENTRY_05
, cPayItem.OCCUR_ENTRY_06 // OCCUR_ENTRY_06
, cPayItem.OCCUR_ENTRY_07 // OCCUR_ENTRY_07
, cPayItem.OCCUR_ENTRY_08 // OCCUR_ENTRY_08
, cPayItem.OCCUR_ENTRY_09 // OCCUR_ENTRY_09
, cPayItem.OCCUR_ENTRY_10 // OCCUR_ENTRY_10
, cPayItem.OCCUR_ENTRY_11 // OCCUR_ENTRY_11
, cPayItem.OCCUR_ENTRY_12 // OCCUR_ENTRY_12
, cPayItem.OCCUR_ENTRY_13 // OCCUR_ENTRY_13
, cPayItem.OCCUR_ENTRY_14 // OCCUR_ENTRY_14
, cPayItem.OCCUR_ENTRY_15 // OCCUR_ENTRY_15
, cPayItem.OCCUR_ENTRY_16 // OCCUR_ENTRY_16
, cPayItem.OCCUR_ENTRY_17 // OCCUR_ENTRY_17
, cPayItem.OCCUR_ENTRY_18 // OCCUR_ENTRY_18
, cPayItem.OCCUR_ENTRY_19 // OCCUR_ENTRY_19
, cPayItem.OCCUR_ENTRY_20 // OCCUR_ENTRY_20
, cPayItem.OCCUR_ENTRY_21 // OCCUR_ENTRY_21
, cPayItem.OCCUR_ENTRY_22 // OCCUR_ENTRY_22
, cPayItem.OCCUR_ENTRY_23 // OCCUR_ENTRY_23
, cPayItem.OCCUR_ENTRY_24 // OCCUR_ENTRY_24
, cPayItem.OCCUR_ENTRY_25 // OCCUR_ENTRY_25
, cPayItem.BILLSPR_NO // BILLSPR_NO
, cPayItem.CANCEL_DIV // CANCEL_DIV
, DateTime.Now.ToString("yyyyMMddHHmmss")
, DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 기타 기타 수단코드 저장
/// </summary>
/// <returns></returns>
public string SaveEtcEtcItem()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
if (alEtcItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG..ETC_SALE_ETC ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, REG_NO, TRADE_NO, SEQ, ETC_WAY_CD, ETC_AMT, ETC_DTL_CD_01,";
sQuery += " ETC_DTL_CD_02, ETC_DTL_CD_03, ETC_DTL_CD_04, ETC_DTL_CD_05, QTY_ENTRY_01, QTY_ENTRY_02, QTY_ENTRY_03, QTY_ENTRY_04,QTY_ENTRY_05, AMT_ENTRY_01, ";
sQuery += " AMT_ENTRY_02, AMT_ENTRY_03, AMT_ENTRY_04, AMT_ENTRY_05, AMT_ENTRY_06, AMT_ENTRY_07, AMT_ENTRY_08, AMT_ENTRY_09,AMT_ENTRY_10, OCCUR_ENTRY_01, ";
sQuery += " OCCUR_ENTRY_02, OCCUR_ENTRY_03, OCCUR_ENTRY_04, OCCUR_ENTRY_05, OCCUR_ENTRY_06, OCCUR_ENTRY_07, OCCUR_ENTRY_08, OCCUR_ENTRY_09, OCCUR_ENTRY_10, OCCUR_ENTRY_11, ";
sQuery += " OCCUR_ENTRY_12, OCCUR_ENTRY_13, OCCUR_ENTRY_14, OCCUR_ENTRY_15, OCCUR_ENTRY_16, OCCUR_ENTRY_17, OCCUR_ENTRY_18, OCCUR_ENTRY_19,OCCUR_ENTRY_20, OCCUR_ENTRY_21, ";
sQuery += " OCCUR_ENTRY_22, OCCUR_ENTRY_23, OCCUR_ENTRY_24, OCCUR_ENTRY_25, BILLSPR_NO, CANCEL_DIV, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , '{19}', ";
sQuery += " '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}' , N'{29}', ";
sQuery += " N'{30}',N'{31}', N'{32}', N'{33}', N'{34}', N'{35}', N'{36}', N'{37}', N'{38}' , N'{39}', ";
sQuery += " N'{40}',N'{41}', N'{42}', N'{43}', N'{44}', N'{45}', N'{46}', N'{47}', N'{48}' , N'{49}', ";
sQuery += " N'{50}',N'{51}', N'{52}', N'{53}', '{54}', '{55}', '{56}', '{57}' )";
for (int iRow = 0; iRow < alEtcItem.Count; iRow++)
{
Column.TR_ETC.DATA cEtcItem = (Column.TR_ETC.DATA)alEtcItem[iRow];
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, iRow + 1 // SEQ
, cEtcItem.ETC_WAY_CD // ETC_WAY_CD
, cEtcItem.ETC_AMT // ETC_AMT
, cEtcItem.ETC_DTL_CD_01 // ETC_DTL_CD_01
, cEtcItem.ETC_DTL_CD_02 // ETC_DTL_CD_02
, cEtcItem.ETC_DTL_CD_03 // ETC_DTL_CD_03
, cEtcItem.ETC_DTL_CD_04 // ETC_DTL_CD_04
, cEtcItem.ETC_DTL_CD_05 // ETC_DTL_CD_05
, cEtcItem.QTY_ENTRY_01 // QTY_ENTRY_01
, cEtcItem.QTY_ENTRY_02 // QTY_ENTRY_02
, cEtcItem.QTY_ENTRY_03 // QTY_ENTRY_03
, cEtcItem.QTY_ENTRY_04 // QTY_ENTRY_04
, cEtcItem.QTY_ENTRY_05 // QTY_ENTRY_05
, cEtcItem.AMT_ENTRY_01 // AMT_ENTRY_01
, cEtcItem.AMT_ENTRY_02 // AMT_ENTRY_02
, cEtcItem.AMT_ENTRY_03 // AMT_ENTRY_03
, cEtcItem.AMT_ENTRY_04 // AMT_ENTRY_04
, cEtcItem.AMT_ENTRY_05 // AMT_ENTRY_05
, cEtcItem.AMT_ENTRY_06 // AMT_ENTRY_06
, cEtcItem.AMT_ENTRY_07 // AMT_ENTRY_07
, cEtcItem.AMT_ENTRY_08 // AMT_ENTRY_08
, cEtcItem.AMT_ENTRY_09 // AMT_ENTRY_09
, cEtcItem.AMT_ENTRY_10 // AMT_ENTRY_10
, cEtcItem.OCCUR_ENTRY_01 // OCCUR_ENTRY_01
, cEtcItem.OCCUR_ENTRY_02 // OCCUR_ENTRY_02
, cEtcItem.OCCUR_ENTRY_03 // OCCUR_ENTRY_03
, cEtcItem.OCCUR_ENTRY_04 // OCCUR_ENTRY_04
, cEtcItem.OCCUR_ENTRY_05 // OCCUR_ENTRY_05
, cEtcItem.OCCUR_ENTRY_06 // OCCUR_ENTRY_06
, cEtcItem.OCCUR_ENTRY_07 // OCCUR_ENTRY_07
, cEtcItem.OCCUR_ENTRY_08 // OCCUR_ENTRY_08
, cEtcItem.OCCUR_ENTRY_09 // OCCUR_ENTRY_09
, cEtcItem.OCCUR_ENTRY_10 // OCCUR_ENTRY_10
, cEtcItem.OCCUR_ENTRY_11 // OCCUR_ENTRY_11
, cEtcItem.OCCUR_ENTRY_12 // OCCUR_ENTRY_12
, cEtcItem.OCCUR_ENTRY_13 // OCCUR_ENTRY_13
, cEtcItem.OCCUR_ENTRY_14 // OCCUR_ENTRY_14
, cEtcItem.OCCUR_ENTRY_15 // OCCUR_ENTRY_15
, cEtcItem.OCCUR_ENTRY_16 // OCCUR_ENTRY_16
, cEtcItem.OCCUR_ENTRY_17 // OCCUR_ENTRY_17
, cEtcItem.OCCUR_ENTRY_18 // OCCUR_ENTRY_18
, cEtcItem.OCCUR_ENTRY_19 // OCCUR_ENTRY_19
, cEtcItem.OCCUR_ENTRY_20 // OCCUR_ENTRY_20
, cEtcItem.OCCUR_ENTRY_21 // OCCUR_ENTRY_21
, cEtcItem.OCCUR_ENTRY_22 // OCCUR_ENTRY_22
, cEtcItem.OCCUR_ENTRY_23 // OCCUR_ENTRY_23
, cEtcItem.OCCUR_ENTRY_24 // OCCUR_ENTRY_24
, cEtcItem.OCCUR_ENTRY_25 // OCCUR_ENTRY_25
, cEtcItem.BILLSPR_NO // BILLSPR_NO
, cEtcItem.CANCEL_DIV // CANCEL_DIV
, DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 예약 고객 정보
/// </summary>
/// <returns></returns>
public string SaveTranReservInfo(string sSendYN)
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 상품정보
ArrayList aSaleReservInfo = (ArrayList)StateObject.GetItemObject(Column.TR_RESERV_INFO.ITEM);
if (aSaleReservInfo.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG.dbo.TR_RESERV_INFO ( ";
sQuery += " CMP_CD ,SALE_DT ,STOR_CD ,POS_NO ,TRADE_NO ,RESERV_NO ,RESERV_REG_DT ,RESERV_REG_TM ,ONOFF_DIV ,CUSTNM ";
sQuery += " ,CUST_PHN_NO ,RESERV_DT ,RESERV_TM ,RESERV_MEMO ,SEND_YN ,REG_DATE ,UPD_DATE) ";
sQuery += " VALUES( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , N'{9}', ";
sQuery += " '{10}','{11}', '{12}', N'{13}', '{14}', '{15}', '{16}' )";
Column.TR_RESERV_INFO.DATA cSaleReservInfo = (Column.TR_RESERV_INFO.DATA)aSaleReservInfo[0];
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, cSaleReservInfo.RESERV_NO
, cSaleReservInfo.RESERV_REG_DT
, cSaleReservInfo.RESERV_REG_TM
, cSaleReservInfo.ONOFF_DIV
, cSaleReservInfo.CUSTNM
, cSaleReservInfo.CUST_PHN_NO
, cSaleReservInfo.RESERV_DT
, cSaleReservInfo.RESERV_TM
, cSaleReservInfo.RESERV_MEMO
, sSendYN
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 고객수 정보
/// </summary>
/// <returns></returns>
public string SaveGuestCnt()
{
string sQuery = "";
string sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
// 고객수 정보
ArrayList alCuestItem = (ArrayList)StateObject.GetItemObject(Column.TR_GUEST.ITEM);
if (alCuestItem.Count == 0) return UserCom.RST_OK;
sQuery += " INSERT INTO POSLOG.dbo.TR_SALE_GUESTCNT ( ";
sQuery += " CMP_CD, STOR_CD, SALE_DT, POS_NO, TRADE_NO ";
sQuery += " ,MALE_10L, MALE_20L, MALE_30L, MALE_40L, MALE_50L ";
sQuery += " ,FMALE_10L, FMALE_20L, FMALE_30L, FMALE_40L, FMALE_50L ";
sQuery += " ,SEND_DIV, REG_DATE, UPD_DATE) ";
sQuery += " VALUES( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}' ";
sQuery += " ,'{5}', '{6}', '{7}', '{8}' , '{9}' ";
sQuery += " ,'{10}','{11}', '{12}', '{13}', '{14}' ";
sQuery += " ,'{15}', '{16}', '{17}' )";
Column.TR_GUEST.DATA clCuestItem = (Column.TR_GUEST.DATA)alCuestItem[0];
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, clCuestItem.MALE_10L
, clCuestItem.MALE_20L
, clCuestItem.MALE_30L
, clCuestItem.MALE_40L
, clCuestItem.MALE_50L
, clCuestItem.FMALE_10L
, clCuestItem.FMALE_20L
, clCuestItem.FMALE_30L
, clCuestItem.FMALE_40L
, clCuestItem.FMALE_50L
, "0", sRegDateTime, sRegDateTime );
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
#endregion
#region
/// <summary>
/// 지정취소 데이터 저장 처리
/// </summary>
/// <returns></returns>
public string ItemCancelSaveData()
{
string sQuery = "", sSQL = "";
string sRet = UserCom.RST_ERR;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
m_cSqlDbService.Begin();
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
// 상품정보
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
if (aSaleItem.Count == 0) return UserCom.RST_OK;
sQuery = "";
sQuery += " INSERT INTO POSLOG..ETC_SALE_DETAIL ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO ,REG_NO ,SEQ ,TRADE_NO ,ORD_TIME ,FLOOR_CD ,TBL_NO ";
sQuery += " ,SUB_SHOP_CD ,ITEM_PLU_CD ,ITEM_DIV ,SALE_QTY ,SALE_PRC ,SALE_AMT ,FLAVOUR_DIV ,FLAVOUR_WEIGHT ,ITEM_INPUT_DIV, ITEM_BAR_CD ";
sQuery += " ,TAKE_IN_OUT_DIV ,ITEM_TAX_DIV ,TAX_AMT_INCLUDE_YN, TAXRATE_CD, APPLY_TAX_AMT ,SVC_FEE_AMT ,SVC_FEE_VAT ,NONSALES_RSN_CD, SVC_TAXREATE_CD, BILL_AMT ";
sQuery += " ,DC_DIV ,DC_TYPE ,DC_RATE ,ITEM_DC_AMT ,SUM_DC_AMT ,CPI_DC_QTY ,CPI_DC_AMT ,COOP_CARD_DC_DIV ,COOP_CARD_DC_AMT ,POINT_DC_DIV ";
sQuery += " ,POINT_DC_AMT ,CPN_DC_DIV ,CPN_DC_AMT ,EMP_DC_DIV ,EMP_DC_AMT ,SET_DC_AMT ,ETC_DC_DIV ,ETC_DC_AMT ,EXCEP_DC_DIV ,EXCEP_DC_AMT ";
sQuery += " ,PACK_DIV ,SET_MENU_CD ,SUBPRC_MENU_KEY_DIV ,CPI_PRESENT_DIV ,BILLSPR_NO ,SALE_GIFT_NO ,CPN_NO ,SLACK_FIELD ,DISPO_ITEM_DIV ,CANCEL_DIV ";
sQuery += " ,REG_DATE ,UPD_DATE ,NOTAX_DIV ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}', '{39}',";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', ";
sQuery += " '{50}','{51}', '{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}', '{59}', ";
sQuery += " '{60}','{61}', '{62}' )";
int nItemRow = 0;
long nTotQty = 0;
double nTotAmt = 0;
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
if (cSaleItem.CANCEL_DIV != "1") continue;
//취소 소계 전후 체크
string sCanDiv = m_cTrnStatus.Sale.SubTotalCancelDiv == true ? PosConst.CANCEL_DIV.CANCEL_SUBTOT : PosConst.CANCEL_DIV.CANCEL;
nItemRow++;
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.RegNo // REG_NO
, nItemRow // SEQ
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, cSaleItem.ORD_TIME // ORD_TIME
, cSaleItem.FLOOR_CD // FLOOR_CD
, cSaleItem.TBL_NO // TBL_NO
, cSaleItem.SUB_SHOP_CD // SUB_SHOP_CD
, cSaleItem.ITEM_PLU_CD // ITEM_PLU_CD
, cSaleItem.ITEM_DIV // ITEM_DIV
, cSaleItem.SALE_QTY // SALE_QTY
, cSaleItem.SALE_PRC // SALE_PRC
, cSaleItem.SALE_AMT // SALE_AMT
, cSaleItem.FLAVOUR_DIV // FLAVOUR_DIV
, cSaleItem.FLAVOUR_STOCK // FLAVOUR_STOCK
, cSaleItem.ITEM_INPUT_DIV // ITEM_INPUT_DIV
, cSaleItem.ITEM_BAR_CD // ITEM_BAR_CD
, cSaleItem.TAKE_IN_OUT_DIV // TAKE_IN_OUT_DIV
, cSaleItem.ITEM_TAX_DIV // ITEM_TAX_DIV
, cSaleItem.TAX_AMT_INCLUDE_YN // TAX_AMT_INCLUDE_YN
, cSaleItem.TAXRATE_CD // TAXRATE_CD
, cSaleItem.APPLY_TAX_AMT // APPLY_TAX_AMT
, cSaleItem.SVC_FEE_AMT // SVC_FEE_AMT
, cSaleItem.SVC_FEE_VAT // SVC_FEE_VAT
, cSaleItem.NONSALES_RSN_CD // NONSALES_RSN_CD
, cSaleItem.SVC_TAXREATE_CD //SVC_TAXREATE_CD
, cSaleItem.SALE_AMT // BILL_AMT
, cSaleItem.DC_DIV
, cSaleItem.DC_TYPE
, 0
, 0
, 0
, 0
, 0
, cSaleItem.COOP_CARD_DC_DIV
, 0
, cSaleItem.POINT_DC_DIV
, 0
, cSaleItem.CPN_DC_DIV
, 0
, cSaleItem.EMP_DC_DIV
, 0
, 0
, cSaleItem.ETC_DC_DIV
, 0
, cSaleItem.EXCEP_DC_DIV
, cSaleItem.EXCEP_DC_AMT
, cSaleItem.PACK_DIV
, cSaleItem.SET_MENU_CD == "" ? cSaleItem.SUB_MENU_MAIN_CD : cSaleItem.SET_MENU_CD
, cSaleItem.SUBPRC_MENU_KEY_DIV
, cSaleItem.CPI_PRESENT_DIV
, cSaleItem.BILLSPR_NO
, cSaleItem.SALE_GIFT_NO
, cSaleItem.CPN_NO
, ""
, cSaleItem.DISPO_ITEM_DIV
, sCanDiv
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, cSaleItem.NOTAX_DIV
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
nTotQty += cSaleItem.SALE_QTY;
nTotAmt = CmUtil.DoubleAdd(nTotAmt, cSaleItem.SALE_AMT);
}
sQuery = "";
sQuery += " INSERT INTO POSLOG..ETC_SALE_HEADER ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO, REG_NO ,TRADE_NO ,TRADE_DIV ,TRAIN_MODE_YN ,TRADE_KINDPER ,SYS_DT ";
sQuery += " ,ORD_TIME ,PAY_TIME ,PIC_NO ,ORD_PIC_NO ,STOR_OWN_PART_TIME_DIV ,ORG_BILL_POSNO ,ORG_BILLDT ,ORG_BILL_NO ,RTN_RSN_CD ,RTN_RSN_MEMO ";
sQuery += " ,NONSALES_RSN_CD ,RESERV_NO ,RESERV_DT ,CUST_NO ,ORD_DIV ,FLOOR_CD ,TBL_NO ,GUESTFLOOR ,FRGNR_DIV ,CUSTCNT ";
sQuery += " ,PAY_GNDR_DIV ,PAY_AGE ,MAN_CMPNPSN_CNT ,WOMAN_CMPNPSN_CNT ,QTY ,TOTSALE_AMT ,TOTDC_AMT ,NET_SALE_AMT ,ITEM_DC_AMT ,CPI_DC_AMT ";
sQuery += " ,COOP_CARD_DC_AMT,POINT_DC_AMT,CPN_DC_AMT,EMP_DC_AMT,SET_DC_AMT ,ETC_AMT ,TOT_VAT ,SVC_FEE_AMT ,SVC_FEE_VAT ,ETC_VAT ";
sQuery += " ,AF_ACCUM_POINT_AMT ,AF_ACCUM_POINT_INFO, PPCARD_CUSTNM, AMT_DUTCHPAY_YN ,BILLSPR_CNT ,ORDER_NO,SLACK_FIELD, TRADE_STAT, SEND_YN ,REG_DATE ,UPD_DATE";
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , N'{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}' , '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}' , '{39}', ";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}' , '{49}', ";
sQuery += " '{50}','{51}', N'{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}' , '{59}', ";
sQuery += " '{60}' ) ";
sQuery = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cPosStatus.Base.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, m_cTrnStatus.Head.TradeDiv // TRADE_DIV
, m_cTrnStatus.Head.TrainModeYn // TRAIN_MODE_YN
, ItemConst.TRAN_KIND.LOG.ITEM_CANCEL // TRADE_KINDPER
, m_cTrnStatus.Head.SysYmd // SYS_DT
, m_cTrnStatus.Head.OrderHms // ORD_TIME
, m_cTrnStatus.Head.PayHms // PAY_TIME
, m_cTrnStatus.Head.CashierId // PIC_NO
, m_cTrnStatus.Head.OrderPicNo // ORD_PIC_NO
, m_cTrnStatus.Head.OwnPartDiv // STOR_OWN_PART_TIME_DIV
, m_cTrnStatus.Head.OrgPosNo // ORG_BILL_POSNO
, m_cTrnStatus.Head.OrgSaleDate // ORG_BILLDT
, m_cTrnStatus.Head.OrgTradeNo // ORG_BILL_NO
, m_cTrnStatus.Head.RtnReasonCd // RTN_RSN_CD
, m_cTrnStatus.Head.RtnReasonMemo // RTN_RSN_MEMO
, m_cTrnStatus.Head.NonSaleRsnCd // NONSALES_RSN_CD
, m_cTrnStatus.Head.ReserveNo // RESERV_NO
, m_cTrnStatus.Head.ReserveYmd // RESERV_DT
, m_cTrnStatus.Head.MemberCustNo // CUST_NO
, m_cTrnStatus.Head.OrderFlag // ORD_DIV
, m_cTrnStatus.Head.FloorCd // FLOOR_CD
, m_cTrnStatus.Head.TableNo // TBL_NO
, m_cTrnStatus.Head.CustFloor // GUESTFLOOR
, m_cTrnStatus.Head.ForeignFlag // FRGNR_DIV
, m_cTrnStatus.Head.CustCnt // CUSTCNT
, m_cTrnStatus.Head.PayGndrDiv // PAY_GNDR_DIV
, m_cTrnStatus.Head.PayAge // PAY_AGE
, m_cTrnStatus.Head.ManCmpnpsnCnt // MAN_CMPNPSN_CNT
, m_cTrnStatus.Head.WomanCmpnpsnCnt // WOMAN_CMPNPSN_CNT
, nTotQty // QTY
, nTotAmt // TOTSALE_AMT
, 0 // TOTDC_AMT
, nTotAmt // NET_SALE_AMT
, 0 // ITEM_DC_AMT
, 0 // CPI_DC_AMT
, 0 // COOP_CARD_DC_AMT
, 0 // POINT_DC_AMT
, 0 // CPN_DC_AMT
, 0 // EMP_DC_AMT
, 0 // SET_DC_AMT
, 0 // ETC_AMT
, 0 // TOT_VAT
, 0 // SVC_FEE_AMT
, 0 // SVC_FEE_VAT
, 0 // ETC_VAT
, m_cTrnStatus.Head.AftSavePoint // AF_ACCUM_POINT_AMT
, m_cTrnStatus.Head.AftSaveAddInfo // AF_ACCUM_POINT_INFO
, m_cTrnStatus.Head.PpCardCustNm // PPCARD_CUSTNM
, m_cTrnStatus.Head.AmtDutchPayYn // AMT_DUTCHPAY_YN
, m_cTrnStatus.Head.BillSplitCnt // BILLSPR_CNT
, m_cTrnStatus.Head.OrderNo // ORDER_NO
, "" // SLACK_FIELD
, "0" // TRADE_STAT
, "0" // SEND_YN
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
m_cSqlDbService.Commit();
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 주방 데이터 저장 처리
/// </summary>
/// <returns></returns>
public string SaveKtchOrdMsg()
{
var sQuery = string.Empty;
var sSQL = string.Empty;
var sRet = UserCom.RST_ERR;
var iSeq = 0;
try
{
// 해피오더일 경우 상품 준비 단계에서 이미 주방 프린터로 출력 되므로 거래 완료 시에는 주방데이터 처리를 하지 않는다.
//if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.FORIGN.O2O) return UserCom.RST_OK;
// 매출 거래가 아니면 주방 출력 안함! 20170406 => 로스거래 주방출력 함(2017.05.25)
//if (m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.NORMAL.SALE && m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.ETC.LOSS)
//170914 dkshin 해피오더 추가 - KDS 전송 되기 위해
//if (m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.NORMAL.SALE && m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.ETC.LOSS)
if (m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.NORMAL.SALE && m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.ETC.LOSS && m_cTrnStatus.Head.TradeKind != ItemConst.TRAN_KIND.FORIGN.O2O)
{
//거래 중지 거래 중 원거래 종류가 매출이 아니면...
if (!(m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.LOG.STOP && m_cTrnStatus.Head.OrgTradeKind == ItemConst.TRAN_KIND.NORMAL.SALE))
{
return UserCom.RST_OK;
}
}
// 상품정보
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
if (aSaleItem.Count == 0) return UserCom.RST_OK;
// 후불판매모드 일때 주방출력
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT &&
m_cPosStatus.Sale.EtcOperateMode != PosConst.ETC_OPERATION_MODE.NO_ORDER_SALE)
{
var isStop = true;
foreach (Column.TR_PLU.DATA cSaleItem in aSaleItem)
{
if (cSaleItem.ORDER_OK_FLAG != PosConst.PLU_ORDER_OK_FLAG.ORDER_OK)
{
isStop = false;
break;
}
}
if (isStop) return UserCom.RST_OK;
}
// 후불매장 전일자 반품 주방출력 안함.
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT &&
m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND)
{
if (m_cPosStatus.Base.SaleDate != m_cTrnStatus.Head.SaleDate) return UserCom.RST_OK;
}
//20161014 선불일때 PK에러로 추가함!
if (m_cTrnStatus.Head.OrderNo == "") return UserCom.RST_OK;
// 주방출력(KPS,KVS,KDS) 사용 옵션
if (PosMstManager.GetPosOption(POS_OPTION.OPT506) != "1" && PosMstManager.GetPosOption(POS_OPTION.OPT027) != "1" &&
PosMstManager.GetPosOption(POS_OPTION.OPT507) != "1")
{
return UserCom.RST_OK;
}
// Add, 2017.04.11, 거래번호 -> 연습모드 일때는 등록번호 치환
var floorCd = m_cTrnStatus.Head.PosNo;
var tableNo = m_cPosStatus.Base.TrainingFlag != ItemConst.TRAINING_FLAG.TRAINING_YES
? m_cTrnStatus.Head.TradeNo
: m_cTrnStatus.Head.RegNo;
var orderNo = m_cTrnStatus.Head.OrderNo;
var orderSeq = string.Empty;
var etcOrderFlag = string.Empty;
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
{
var cTableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE);
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND &&
string.IsNullOrWhiteSpace(m_cTrnStatus.Head.FloorCd + m_cTrnStatus.Head.TableNo))
{
// 후불매장 반품인데 층/테이블 번호가 없음면, 후불판매 반품
etcOrderFlag = "1";
}
else if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.NO_ORDER_SALE)
{
orderSeq = string.Empty;
etcOrderFlag = "1";
}
else
{
// 후불-테이블 일때는 주문차수 발번 처리
floorCd = m_cTrnStatus.Head.FloorCd;
tableNo = m_cTrnStatus.Head.TableNo;
}
}
//20170918 dkshin 해피오더 중복 거래 완료처리 수정
var orderTime = DateTime.Now.ToString("HHmmss");
//if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.FORIGN.O2O)
if (m_cTrnStatus.Head.HPOrderPickupTime != "")
{
m_cTrnStatus.Head.PackTradeDiv = "0";//해피오더에서 0으로 고정
etcOrderFlag = "2";//해피오더
orderTime = m_cTrnStatus.Head.HPOrderPickupTime;
orderTime = orderTime.Substring(5, 5) + " " + orderTime.Substring(14, 5);//ex) 03-29 17:30
}
if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.FORIGN.O2O)
etcOrderFlag = "2";//해피오더
//
// 일련번호
sQuery = "SELECT ISNULL(MAX(SEQ), 0) + 1 AS NEXT_SEQ FROM POSMST..MST_KTCH_ORD_MSG "
+ " WHERE TRAIN_MODE_YN = '{0}' AND ORD_DIV = '{1}' AND FLOOR_CD = '{2}' AND TBL_NO = '{3}' ";
sSQL = string.Format(sQuery, m_cPosStatus.Base.TrainingFlag // Add, 2017.03.06, 연습모드
, PosConst.ORDER_TYPE.NORMAL
, floorCd
, tableNo);
DataTable dtReturn = null;
if(m_cSqlDbService.DBSelect(sSQL, out dtReturn) == UserCom.OK)
{
iSeq = CmUtil.GetDataRowInt(dtReturn.Rows[0], "NEXT_SEQ");
}
#region ()
//sQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG ";
//sQuery += " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD ";
//sQuery += " , ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO ";
//sQuery += " , SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT ) ";
//sQuery += " VALUES ";
//sQuery += " ( '{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', N'{13}', {14}, '{15}', '{16}' ";
//sQuery += " , '{17}', '{18}', '{19}', N'{20}', N'{21}', N'{22}', '{23}', '{24}', '{25}', '{26}' ";
//sQuery += " , '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}' ) ";
#endregion
#region () , 2017.03.06
//sQuery = " INSERT INTO POSMST..MST_KTCH_ORD_MSG \n"
// + " ( ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD \n"
// + " , ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO \n"
// + " , SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT ) \n"
// + " VALUES \n"
// + " ( '{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', N'{14}', {15}, '{16}' \n"
// + " , '{17}', '{18}', '{19}', '{20}', N'{21}', N'{22}', N'{23}', '{24}', '{25}', '{26}' \n"
// + " , '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}' ) ";
#endregion
#region () KPS + KDS , 2017.04.26
//sQuery = "INSERT INTO POSMST..MST_KTCH_ORD_MSG ( \n"
// + " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD \n"
// + ", ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO \n"
// + ", SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, TRAIN_MODE_YN \n"
// + ", KTCH_MSG \n" // Add, 2017.03.23, 주방메시지
// + ", ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
// + ", ORG_QTY \n" // Add, 2017.03.31, 이전주문수량
// + ", ORD_POS_NO \n" // Add, 2017.04.10, 주문포스번호 (서브포스에서도 주방출력 처리)
// + ") VALUES ( \n"
// + " '{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', N'{14}', {15}, '{16}' \n"
// + ", '{17}', '{18}', '{19}', '{20}', N'{21}', N'{22}', N'{23}', '{24}', '{25}', '{26}' \n"
// + ", '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}' \n"
// + ", N'{39}' \n" // Add, 2017.03.23, 주방메시지
// + ", N'{40}' \n" // Add, 2017.03.28, 주문담당자
// + ", 0 \n" // Add, 2017.03.31, 이전주문수량
// + ", '{41}' \n" // Add, 2017.04.10, 주문포스번호 (서브포스에서도 주방출력 처리)
// + ")";
#endregion
sQuery = "INSERT INTO POSMST..MST_KTCH_ORD_MSG ( \n"
+ " ORD_DIV, FLOOR_CD, TBL_NO, SEQ, CMP_CD, BRAND_CD, STOR_CD, SUB_STOR_CD, POS_NO, TRADE_NO, SALE_DT, POS_TYPE, ITEM_CD, ITEM_DIV, SHTCUT_ITEMNM, SALE_QTY, PACK_DIV, SET_MENU_CD \n"
+ ", ORD_TIME, CANCEL_DIV, SUB_MEMO_DIV, MSG1, MSG2, MSG3, MSG_REG_TIME, ORG_BILL_POSNO, ORG_BILLDT, ORG_BILL_NO \n"
+ ", SEND_YN, SEND_CONFIRM_DIV, RESEND_YN, FILLER1, FILLER2, FILLER3, FILLER4, FILLER5, UPD_DT, REG_DT, TRAIN_MODE_YN \n"
+ ", KTCH_MSG \n" // Add, 2017.03.23, 주방메시지
+ ", ORD_PIC_NM \n" // Add, 2017.03.28, 주문담당자
+ ", ORG_QTY \n" // Add, 2017.03.31, 이전주문수량
+ ", ORD_POS_NO \n" // Add, 2017.04.10, 주문포스번호 (서브포스에서도 주방출력 처리)
+ ", KDS_SEND_YN \n" // Add, 2017.04.26, KDS 전송여부
+ ") VALUES ( \n"
+ " '{0}', '{1}', '{2}', {3}, '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', N'{14}', {15}, '{16}' \n"
+ ", '{17}', '{18}', '{19}', '{20}', N'{21}', N'{22}', N'{23}', '{24}', '{25}', '{26}' \n"
+ ", '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}' \n"
+ ", N'{39}' \n" // Add, 2017.03.23, 주방메시지
+ ", N'{40}' \n" // Add, 2017.03.28, 주문담당자
+ ", 0 \n" // Add, 2017.03.31, 이전주문수량
+ ", '{41}' \n" // Add, 2017.04.10, 주문포스번호 (서브포스에서도 주방출력 처리)
+ ", '{42}' \n" // Add, 2017.04.26, KDS 전송여부
+ ")";
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
if (cSaleItem.CANCEL_DIV == "1" || cSaleItem.CANCEL_DIV_MAIN == "1") cSaleItem.CANCEL_DIV = "1";
if (cSaleItem.CANCEL_DIV == "1") continue;
if (cSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) continue;
// Add, 2017.04.26, 후불 수량변경없이 가격변경 후 바로 결제시
if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT &&
cSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD)
{
if (cSaleItem.ORG_QTY > 0 && cSaleItem.SALE_QTY - cSaleItem.ORG_QTY == 0)
{
continue;
}
}
// Add, 2017.04.12, 주문차수
if (cSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) cSaleItem.ORDER_SEQ = orderSeq;
//취소 소계 전후 체크
string sCanDiv = cSaleItem.CANCEL_DIV;
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL)
{
sCanDiv = m_cTrnStatus.Sale.SubTotalCancelDiv == true ? PosConst.CANCEL_DIV.CANCEL_SUBTOT : PosConst.CANCEL_DIV.CANCEL;
}
var itemMemoRegTime = string.Empty;
var temp = cSaleItem.ITEM_MEMO_1 + cSaleItem.ITEM_MEMO_2 + cSaleItem.ITEM_MEMO_3;
if (string.IsNullOrWhiteSpace(temp) == false) itemMemoRegTime = DateTime.Now.ToString("HHmmss");
// Add, 2017.01.18, 주방프린트 수동출력 사용자 선택값
var menualOrderValue = string.Empty;
var menualMsgRegTime = string.Empty;
var menualOrderMemo = string.Empty;
if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "1")
{
// 장치코드 또는 NOPRINT
menualOrderValue = string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderValue)
? "NOPRINT"
: m_cTrnStatus.Sale.MenualOrderValue;
}
else if (PosMstManager.GetPosOption(POS_OPTION.OPT425) == "2")
{
// 선택상품코드 또는 NOPRINT
int idx = m_cTrnStatus.Sale.MenualOrderValue.IndexOf(iRow.ToString());
menualOrderValue = idx < 0 ? "NOPRINT" : "PRINT";
// Del, 2017.04.25, 주방메모 출력 (대기번호 입력)
// 주방메모
//if (menualOrderValue != "NOPRINT" && string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderMemo) == false)
//{
// menualOrderMemo = m_cTrnStatus.Sale.MenualOrderMemo.Trim();
// menualMsgRegTime = DateTime.Now.ToString("HHmmss");
//}
}
// Add, 2017.04.25, 주방메모 출력 (대기번호 입력)
if (menualOrderValue != "NOPRINT" && string.IsNullOrWhiteSpace(m_cTrnStatus.Sale.MenualOrderMemo) == false)
{
menualOrderMemo = m_cTrnStatus.Sale.MenualOrderMemo.Trim();
menualMsgRegTime = DateTime.Now.ToString("HHmmss");
}
// INSERT INTO POSMST..MST_KTCH_ORD_MSG
sSQL = string.Format(sQuery
, PosConst.ORDER_TYPE.NORMAL // ORD_DIV
//, m_cTrnStatus.Head.PosNo // FLOOR_CD(선불POS일 경우 POS번호)
, floorCd //
, m_cTrnStatus.Head.TradeNo // TBL_NO(선불POS일 경우 거래번호)
//, tableNo // Mod, 2017.03.06, 주방출력 연습모드 적용
, iSeq++ // SEQ
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cPosStatus.Base.BrandCd // BRAND_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, cSaleItem.SUB_SHOP_CD // SUB_STOR_CD // 2017.02.06, Add
//#20170919 ss해피오더 반품시 POS_NO 항목이 원거래포스번호가 들어가야 KDS에서 반품 처리됨. start
//기존
//, m_cTrnStatus.Head.PosNo // POS_NO
//변경
, m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? m_cTrnStatus.Head.OrgPosNo : m_cTrnStatus.Head.PosNo // POS_NO
//#20170919 ss해피오더 반품시 POS_NO 항목이 원거래포스번호가 들어가야 KDS에서 반품 처리됨. end
//, m_cTrnStatus.Head.OrderNo // TRADE_NO
, orderNo // // Mod, 2017.04.11
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cPosStatus.Base.PosType // POS유형(0:선불, 1:후불)
//, cSaleItem.ITEM_PLU_CD // ITEM_CD
, (cSaleItem.SUBPRC_MENU_KEY_DIV == "1" || cSaleItem.SUBPRC_MENU_KEY_DIV == "2") ? cSaleItem.SUB_MENU_MAIN_CD : cSaleItem.ITEM_PLU_CD
, cSaleItem.ITEM_DIV // ITEM_DIV
//텀블러할인 강제 적용 2019.05.08
, cSaleItem.EXCEP_DC_DIV.Equals("1703") ? cSaleItem.ITEM_NAME +"(텀블러)" : cSaleItem.ITEM_NAME // SHTCUT_ITEMNM
, cSaleItem.SALE_QTY // SALE_QTY
//, cSaleItem.PACK_DIV // PACK_DIV
, m_cTrnStatus.Head.PackTradeDiv // PACK_TRADE_DIV(1:일반, 2:포장, 3:배달)
// SET_MENU_CD
, cSaleItem.SET_MENU_CD == "" ? cSaleItem.SUB_MENU_MAIN_CD : cSaleItem.SET_MENU_CD
//, cSaleItem.ORD_TIME // ORD_TIME
//20170918 dkshin 해피오더 중복 거래 완료처리 수정
//, DateTime.Now.ToString("HHmmss")
, orderTime
, m_cTrnStatus.Head.TradeDiv // CANCEL_DIV
, cSaleItem.SUBPRC_MENU_KEY_DIV // SUB_MEMO_DIV
, ConvertDBStr(cSaleItem.ITEM_MEMO_1) // MSG1
, ConvertDBStr(cSaleItem.ITEM_MEMO_2) // MSG2
, ConvertDBStr(cSaleItem.ITEM_MEMO_3) // MSG3
, itemMemoRegTime // MSG_REG_TIME
, m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? m_cTrnStatus.Head.OrgPosNo : "" // ORG_BILL_POSNO
, m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? m_cTrnStatus.Head.OrgSaleDate : "" // ORG_BILLDT
, m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? m_cTrnStatus.Head.OrgTradeNo : "" // ORG_BILL_NO
, "0" // SEND_YN
, "0" // SEND_CONFIRM_DIV
, "0" // RESEND_YN
, menualOrderValue // FILLER1
, etcOrderFlag // FILLER2 // 기타주문구분 (1:후불일반판매, 2:해피오더)
, "" // FILLER3
, m_cTrnStatus.Head.VipTy // FILLER4 // VIP구분 (0:일반, 1:VIP, 2:직원)
, "" // FILLER5 // 주문차수
, DateTime.Now.ToString("yyyyMMddHHmmss") // UPD_DT
, DateTime.Now.ToString("yyyyMMddHHmmss") // REG_DT
, m_cPosStatus.Base.TrainingFlag // Add, 2017.03.06, 연습모드
, ConvertDBStr(menualOrderMemo) // Add, 2017.03.23, 주방메시지
, ConvertDBStr(m_cTrnStatus.Head.OrderPicNm) // Add, 2017.03.28, 주문담당자
, m_cPosStatus.Base.PosNo // Add, 2017.04.10, 주문포스번호 (서브포스에서도 주방출력 처리)
, "0" // Add, 2017.04.26, KDS 전송여부
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
"Insert ERROR into MST_KTCH_ORD_MSG - " + sSQL);
m_cSqlDbService.Rollback();
return sRet;
}
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
private string ConvertDBStr(string str)
{
return str.Replace("'", "''");
}
#endregion
#region
/// <summary>
/// 정산지 및 점검지 생성
/// </summary>
/// <param name="sSaleDate"></param>
/// <param name="sTableName"></param>
/// <returns></returns>
public string SaveAccADMT(string sKind, string sSaleDate, ref DataTable dtReturn, string sSimplePrint)
{
string[] sSql = new string [50];
int iSqlIndex = 0;
string sSql2 = "";
string sRet = UserCom.RST_ERR;
try
{
//#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 start, phj
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "[SaveAccADMT] Kind : " + sKind + " , SaleDate : " + sSaleDate + " , Simple print :" + sSimplePrint);
//#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 end, phj
//string sKind = m_cTrnStatus.Head.TradeKind;
//m_cDataService.SetTranBaseToHead(); //트란 헤더 정보 재설정
if (sKind != ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY && sKind != ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT && sKind != ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) return UserCom.RST_OK;
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND) return UserCom.RST_OK;
// 중간정산 옵션값변경(2017.06.14) => 중간점검 사용 여부 (0:사용안함, 1: 사용함, 2:사용함[차수별])
string sMidCloseSeq = m_cPosStatus.Base.MidCloseSeq;
if (sKind != ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT && sMidCloseSeq != "99")
{
if (PosMstManager.GetPosOption(POS_OPTION.OPT321) != "2") sMidCloseSeq = "99";
}
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
// 정산 프로시져
sSql2 = "";
sSql2 += "EXEC POSMST..SP_ADJUSTMENT ";
sSql2 += " '" + m_cTrnStatus.Head.TradeDiv + "'"; // 거래구분 (0:정상, 1:반품)
sSql2 += ", '" + m_cPosStatus.Base.CmpCd + "'"; // 회사코드
sSql2 += ", '" + m_cPosStatus.Base.StoreNo + "'"; // 점포코드
sSql2 += ", '" + sSaleDate + "'"; // 영업일
sSql2 += ", '" + m_cPosStatus.Base.PosNo + "'"; // POS 번호
sSql2 += ", '" + m_cPosStatus.Base.TradeNo + "'"; // 거래번호
sSql2 += ", '" + sKind + "'"; // 거래종별
sSql2 += ", '" + m_cPosStatus.Base.Country + "'"; // 문화코드
sSql2 += ", '" + sMidCloseSeq + "'"; // 중간마감 차수
//sSql2 += ", '" + m_cPosStatus.Base.MidCloseSeq + "'"; // 중간마감 차수
sSql2 += ", '" + sSimplePrint + "'"; // 간편출력 여부
// 정산지 생성
int iRet = m_cSqlDbService.DBSelect(sSql2, out dtReturn);
//#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 start, phj
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "[SaveAccADMT] Sql: " + sSql2);
//#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 end, phj
if (iRet != UserCom.OK && iRet != UserCom.NG4)
{
//return sRet;
}
else
{
sRet = UserCom.RST_OK;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
sRet = ex.Message;
m_cSqlDbService.Rollback();
}
return sRet;
}
#endregion
#region
/// <summary>
/// 현금 알람 저장
/// </summary>
/// <param name="sPayWayCd"></param>
/// <param name="sPayCd"></param>
/// <param name="dPayAmt"></param>
/// <param name="dReMain"></param>
private void AddCashAlarm(string sPayWayCd, string sPayCd, double dPayAmt, double dReMain)
{
try
{
if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT310), "0") != "0")
{
//매출, 예약 거래 일때만
if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_REG || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_COMPLETE)
{
if (sPayWayCd == ItemConst.TR_ITEM_ID.CASH_ITEM || sPayWayCd == ItemConst.TR_ITEM_ID.CHECK_ITEM)
{
//현금 수표일때 추가
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
{
m_cPosStatus.Mst.CashAlarmAmt = CmUtil.DoubleAdd(m_cPosStatus.Mst.CashAlarmAmt, dPayAmt);
}
else
{
m_cPosStatus.Mst.CashAlarmAmt = CmUtil.DoubleSubtraction(m_cPosStatus.Mst.CashAlarmAmt, dPayAmt);
}
}
else if (sPayWayCd == ItemConst.TR_ITEM_ID.GIFT_ITEM || sPayWayCd == ItemConst.TR_ITEM_ID.FOREIGNEX_ITEM || (sPayWayCd == ItemConst.TR_ITEM_ID.PAYETC_ITEM && sPayWayCd == ItemConst.TR_ITEM_ID.PAYETC.MEAL_TIKET))
{
//상품권, 식권 일때 거스름 , 식권일때도 거스름 저장
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
{
m_cPosStatus.Mst.CashAlarmAmt = CmUtil.DoubleSubtraction(m_cPosStatus.Mst.CashAlarmAmt, dReMain);
}
else
{
m_cPosStatus.Mst.CashAlarmAmt = CmUtil.DoubleAdd(m_cPosStatus.Mst.CashAlarmAmt, dReMain);
}
}
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
/// <summary>
/// 기타 헤더 저장
/// </summary>
/// <returns></returns>
public string EtcHeaderSaveData(string sTradeDiv, string sTradeKindper, string[] aParam)
{
string sQuery = "";
string sRet = UserCom.RST_ERR;
try
{
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
m_cSqlDbService.Begin();
string sRegDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
string sOrgSaleDt = aParam[0];
string sOrgPosNo = aParam[1];
string sOrgTradeNo = aParam[2];
sQuery = "";
sQuery += " INSERT INTO POSLOG..ETC_SALE_HEADER ( ";
sQuery += " CMP_CD ,STOR_CD ,SALE_DT ,POS_NO ,REG_NO ,TRADE_NO ,TRADE_DIV ,TRAIN_MODE_YN ,TRADE_KINDPER ,SYS_DT ";
sQuery += " ,ORD_TIME ,PAY_TIME ,PIC_NO ,ORD_PIC_NO ,STOR_OWN_PART_TIME_DIV ,ORG_BILL_POSNO ,ORG_BILLDT ,ORG_BILL_NO ,RTN_RSN_CD ,RTN_RSN_MEMO ";
sQuery += " ,NONSALES_RSN_CD ,RESERV_NO ,RESERV_DT ,CUST_NO ,ORD_DIV ,FLOOR_CD ,TBL_NO ,GUESTFLOOR ,FRGNR_DIV ,CUSTCNT ";
sQuery += " ,PAY_GNDR_DIV ,PAY_AGE ,MAN_CMPNPSN_CNT ,WOMAN_CMPNPSN_CNT ,QTY ,TOTSALE_AMT ,TOTDC_AMT ,NET_SALE_AMT ,ITEM_DC_AMT ,CPI_DC_AMT ";
sQuery += " ,COOP_CARD_DC_AMT ,POINT_DC_AMT ,CPN_DC_AMT ,EMP_DC_AMT ,SET_DC_AMT ,ETC_AMT ,TOT_VAT ,SVC_FEE_AMT ,SVC_FEE_VAT ,ETC_VAT ";
sQuery += " ,AF_ACCUM_POINT_AMT ,AF_ACCUM_POINT_INFO, PPCARD_CUSTNM, AMT_DUTCHPAY_YN ,BILLSPR_CNT ,ORDER_NO ,SLACK_FIELD ,MID_CLOSE_SEQ ,PPCARD_CUSTID, TRADE_STAT " ;
sQuery += " ,PACK_TRADE_DIV ,SEND_YN ,REG_DATE ,UPD_DATE ,VIP_TY ";
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}','{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' , N'{19}', ";
sQuery += " '{20}','{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}' , '{29}', ";
sQuery += " '{30}','{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}' , '{39}', ";
sQuery += " '{40}','{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}' , '{49}', ";
sQuery += " '{50}','{51}', N'{52}','{53}', '{54}', '{55}', '{56}', '{57}', '{58}' , '{59}', ";
sQuery += " '{60}','{61}', '{62}' ,'{63}', '{64}') ";
sQuery = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cPosStatus.Base.RegNo // REG_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, sTradeDiv // TRADE_DIV
, m_cTrnStatus.Head.TrainModeYn // TRAIN_MODE_YN
, sTradeKindper // TRADE_KINDPER
, m_cTrnStatus.Head.SysYmd // SYS_DT
, m_cTrnStatus.Head.OrderHms // ORD_TIME
, DateTime.Now.ToString("HHmmss") // PAY_TIME
, m_cTrnStatus.Head.CashierId // PIC_NO
, "" // ORD_PIC_NO
, m_cTrnStatus.Head.OwnPartDiv // STOR_OWN_PART_TIME_DIV
, sOrgPosNo // ORG_BILL_POSNO
, sOrgSaleDt // ORG_BILLDT
, sOrgTradeNo // ORG_BILL_NO
, "" // RTN_RSN_CD
, "" // RTN_RSN_MEMO
, "0" // NONSALES_RSN_CD
, "" // RESERV_NO
, "" // RESERV_DT
, "" // CUST_NO
, "0" // ORD_DIV
, "" // FLOOR_CD
, "" // TBL_NO
, "" // GUESTFLOOR
, "" // FRGNR_DIV
, 0 // CUSTCNT
, "" // PAY_GNDR_DIV
, 0 // PAY_AGE
, 0 // MAN_CMPNPSN_CNT
, 0 // WOMAN_CMPNPSN_CNT
, 0 // QTY
, 0 // TOTSALE_AMT
, 0 // TOTDC_AMT
, 0 // NET_SALE_AMT
, 0 // ITEM_DC_AMT
, 0 // CPI_DC_AMT
, 0 // COOP_CARD_DC_AMT
, 0 // POINT_DC_AMT
, 0 // CPN_DC_AMT
, 0 // EMP_DC_AMT
, 0 // SET_DC_AMT
, 0 // ETC_AMT
, 0 // TOT_VAT
, 0 // SVC_FEE_AMT
, 0 // SVC_FEE_VAT
, 0 // ETC_VAT
, 0 // AF_ACCUM_POINT_AMT
, "" // AF_ACCUM_POINT_INFO
, "" // PPCARD_CUSTNM
, "" // AMT_DUTCHPAY_YN
, 0 // BILLSPR_CNT
, "" // ORDER_NO
, "" // SLACK_FIELD
, m_cTrnStatus.Head.MidCloseSeq // MID_CLOSE_SEQ
, "" // PPCARD_CUSTID
, "0" // TRADE_STAT
, "" // PACK_TRADE_DIV
, "0" // SEND_YN
, sRegDateTime // REG_DATE
, sRegDateTime // UPD_DATE
, "" // VIP_TY
);
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
m_cSqlDbService.Commit();
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 보류 로그 저장
/// </summary>
/// <returns></returns>
public void SaveHoldLog(string sHoldStat, string sOrgRegNo, double dQty, double dSaleAmt)
{
string sQuery = "";
string sRegNo = "";
try
{
// 보류 로드 상태에서 거래 완료시 치환!
if (m_cTrnStatus.Head.HoldStat == ItemConst.HOLD_STAT_CD.LOAD && m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE)
sHoldStat = ItemConst.HOLD_STAT_CD.FINISH;
if (sHoldStat == ItemConst.HOLD_STAT_CD.HOLD || sHoldStat == ItemConst.HOLD_STAT_CD.REHOLD)
{
sRegNo = m_cTrnStatus.Head.RegNo;
}
else if (sHoldStat == ItemConst.HOLD_STAT_CD.DELETE)
{
sRegNo = sOrgRegNo;
m_cTrnStatus.Head.HoldOrgRegNo = sRegNo;
}
else
{
sRegNo = m_cTrnStatus.Head.HoldOrgRegNo;
}
if (sHoldStat != ItemConst.HOLD_STAT_CD.DELETE)
{
dQty = m_cTrnStatus.Head.TotQty;
dSaleAmt = m_cTrnStatus.Head.NetSaleAmt;
}
// 등록 순번 , 원등록 순번
//1.보류면 등록 MAX +1 , 등록 MAX +1
//2.삭제면 등록 MAX +1 , 원거래순번
//3.거래취소 등록 MAX +1 , 원거래순번
//4.재보류 등록 MAX +1 , 원거래순번
//5.결제완료 등록 MAX +1 , 원거래순번
sQuery = " DECLARE @V_SEQ INT ";
sQuery += " DECLARE @V_REGSEQ VARCHAR(5) ";
sQuery += " DECLARE @V_ORGREGSEQ VARCHAR(5) ";
sQuery += " DECLARE @V_STAT VARCHAR(3) ";
sQuery += " SET @V_STAT = '{5}' ";
sQuery += " SELECT @V_SEQ = ISNULL(MAX(SEQ),0) + 1 , @V_REGSEQ = RIGHT('00000' + CONVERT(VARCHAR,ISNULL(MAX(CONVERT(INT,REG_SEQ)),0) + 1),5) ";
sQuery += " FROM POSLOG.dbo.ETC_HOLD_HISTORY ";
sQuery += " WHERE 1 = 1 AND CMP_CD = '{0}' AND SALE_DT = '{1}' AND STOR_CD = '{2}' AND POS_NO = '{3}' ";
sQuery += " IF @V_STAT = 'H01' ";
sQuery += " BEGIN ";
sQuery += " SET @V_ORGREGSEQ=@V_REGSEQ ";
sQuery += " END ";
sQuery += " ELSE ";
sQuery += " BEGIN ";
sQuery += " SELECT @V_ORGREGSEQ = RIGHT('00000' + CONVERT(VARCHAR,ISNULL(MAX(CONVERT(INT,REG_SEQ)),0)),5) ";
sQuery += " FROM POSLOG.dbo.ETC_HOLD_HISTORY ";
sQuery += " WHERE 1 = 1 AND CMP_CD = '{0}' AND SALE_DT = '{1}' AND STOR_CD = '{2}' AND POS_NO = '{3}' AND REG_NO = '" + m_cTrnStatus.Head.HoldOrgRegNo + "' ";
sQuery += " END ";
sQuery += " INSERT INTO POSLOG.dbo.ETC_HOLD_HISTORY ( ";
sQuery += " CMP_CD, SALE_DT, STOR_CD, POS_NO, REG_NO, SEQ, HOLD_STAT, SYS_DT, SYS_TM, REG_SEQ ";
sQuery += " ,ORG_REG_SEQ, PIC_NO, ITEM_QTY, SALE_AMT, AMT_FILLER_01, AMT_FILLER_02, STR_FILLER_01, STR_FILLER_02, SEND_YN, REG_DATE ";
sQuery += " ,UPD_DATE ";
sQuery += " ) VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', @V_SEQ, '{5}', '{6}', '{7}', @V_REGSEQ, ";
sQuery += " @V_ORGREGSEQ, '{8}' ,'{9}', '{10}', '{11}', '{12}', '{13}', N'{14}', N'{15}', '{16}', '{17}' ) ";
string sRegDate = DateTime.Now.ToString("yyyyMMdd");
string sRegTime = DateTime.Now.ToString("HHmmss");
sQuery = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.PosNo // POS_NO
, sRegNo // REG_NO
, sHoldStat // HOLD_STAT
, sRegDate // SYS_DT
, sRegTime // SYS_TM
, m_cTrnStatus.Head.CashierId // PIC_NO
, dQty // ITEM_QTY
, dSaleAmt // SALE_AMT
, 0 // AMT_FILLER_01
, 0 // AMT_FILLER_02
, "" // STR_FILLER_01
, "" // STR_FILLER_02
, "0" // SEND_YN
, sRegDate + sRegTime // REG_DATE
, sRegDate + sRegTime // UPD_DATE
);
m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery });
m_cTrnStatus.Head.HoldStat = "";
m_cTrnStatus.Head.HoldOrgRegNo = "";
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
//17.05.18 dkshin 쇼킹박스 추가
public string PosShockingBoxSerch(string aParam)
{
string sRet = UserCom.RST_ERR;
var sQuery = string.Empty;
var sSQL = string.Empty;
sQuery = "SELECT * FROM POSLOG..ETC_SALE_HEADER "
+ "WHERE CMP_CD = '{0}' AND STOR_CD = '{1}' AND POS_NO = '{2}' AND SALE_DT + REG_NO = '{3}' ";
sSQL = string.Format(sQuery, m_cTrnStatus.Head.CmpCd, m_cTrnStatus.Head.StoreCd, m_cTrnStatus.Head.PosNo, aParam);
DataTable dtReturn = null;
if (m_cSqlDbService.DBSelect(sSQL, out dtReturn) == UserCom.OK)
{
//#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 start
//기존
//sRet = UserCom.RST_OK;
//변경
DataRow dr = dtReturn.Rows[0];
sRet = CmUtil.GetDataRowStr(dr, "TRADE_KINDPER");
//#15746 해피오더 '쇼킹박스' 관련 POS 시스템 개발 요청 end
}
return sRet;
}
//17.05.18 dkshin 쇼킹박스 추가
public string UpdateShockingBoxTradeNo()
{
string sRet = UserCom.RST_ERR;
var sQuery = string.Empty;
var sSQL = string.Empty;
try
{
sQuery = "UPDATE POSLOG..ETC_SALE_HEADER SET ORG_BILL_POSNO = '{0}' , ORG_BILLDT = '{1}', ORG_BILL_NO = '{2}' "
+ "WHERE CMP_CD = '{3}' AND STOR_CD = '{4}' AND POS_NO = '{5}' AND SALE_DT + REG_NO = '{6}' ";
sSQL = string.Format(sQuery, m_cTrnStatus.Head.PosNo, m_cTrnStatus.Head.SaleDate, m_cTrnStatus.Head.TradeNo, m_cTrnStatus.Head.CmpCd, m_cTrnStatus.Head.StoreCd, m_cTrnStatus.Head.PosNo, m_cTrnStatus.Head.ShockingBoxBarcodeData);
if(m_cSqlDbService.DBExecuteNonQuery(sSQL) == UserCom.OK)
{
sRet = UserCom.RST_OK;
}
return sRet;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
//2017-06-02 dkshin 해피앱 추후적립
public string SaveHPAppAfter()
{
string sRet = UserCom.RST_ERR;
string sQuery = "";
string sSQL = "";
try
{
//ArrayList alEtcItem = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
//if (alEtcItem.Count == 0)
{
sQuery += " INSERT INTO POSLOG..TR_HPAPP_AFTER_SAVE ( ";
sQuery += " CMP_CD, SALE_DT, STOR_CD, POS_NO, TRADE_NO, BILL_BAR_CD, TMNLNO, TOT_TRADE_AMT, ACCUM_TRGT_AMT, APPR_WAY_CD, APPR_CARD_NO, ADD_ACCUM_YN, ";
sQuery += " ADD_ACCUM_CD, ADD_ACCUM_HQ_ALLOT_AMT, ADD_ACCUM_STOR_ALLOT_AMT, SAVE_STATUS, SEND_YN, REG_DATE, UPD_DATE ";
sQuery += " ) VALUES ( ";
sQuery += " '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' , '{9}', ";
sQuery += " '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}' )";
string sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ETC_INFO_ITEM, ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD);
string sApprID = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.APPR_ID);
String sAddHpAccumeYN = "N";
String sAddHpAccumeCD = string.Empty;
double lADDBRNDSHRPT = 0;
if (m_cTrnStatus.Head.AftSaveAddInfo != "")
{
sAddHpAccumeYN = m_cTrnStatus.Head.AftSaveAddInfo.ToString().Substring(25, 1);
sAddHpAccumeCD = m_cTrnStatus.Head.AftSaveAddInfo.ToString().Substring(26, 2);
if (sAddHpAccumeYN == "Y")
{
lADDBRNDSHRPT = Convert.ToDouble(m_cTrnStatus.Head.AftSaveAddInfo.ToString().Substring(28, 7));
}
//lADDBRNDSHRPT = string.Format("{0:D7}", lADDBRNDSHRPT);
}
sSQL = string.Format(sQuery
, m_cTrnStatus.Head.CmpCd // CMP_CD
, m_cTrnStatus.Head.SaleDate // SALE_DT
, m_cTrnStatus.Head.StoreCd // STOR_CD
, m_cTrnStatus.Head.PosNo // POS_NO
, m_cTrnStatus.Head.TradeNo // TRADE_NO
, m_cTrnStatus.Head.RcptBarcodeData // BILL_BAR_CD
, sApprID // TMNLNO : 단말기 승인 ID
, m_cTrnStatus.Head.TotSaleAmt // TOT_TRADE_AMT : 총거래금액
, m_cTrnStatus.Head.AftSavePoint// ACCUM_TRGT_AMT : 적립대상금액
, "01" // APPR_WAY_CD : 결제수단코드(01:현금,02:신용 등)
, "null" // APPR_CARD_NO : 결제카드번호
, sAddHpAccumeYN // ADD_ACCUM_YN : 추가적립여부
, sAddHpAccumeCD // ADD_ACCUM_CD : 추가적립코드
, lADDBRNDSHRPT // ADD_ACCUM_HQ_ALLOT_AMT : 추가적립본사부담금
, 0 // ADD_ACCUM_STOR_ALLOT_AMT :추가적립점포부담금
, 'N' // SAVE_STATUS : 해피앱 적립여부 (INSERT:N(미적립),반품:R,추후적립:P,적립:Y)
, '0' // SEND_YN : TR전송 여부(0:미전송, 1: 전송, 9: 전송실패)
, DateTime.Now.ToString("yyyyMMddHHmmss") // REG_DATE
, DateTime.Now.ToString("yyyyMMddHHmmss") // UPD_DATE
);
}
if (m_cSqlDbService.DBExecuteNonQuery(new string[] { sSQL }) != UserCom.OK)
{
m_cSqlDbService.Rollback();
return sRet;
}
return UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_cSqlDbService.Rollback();
return sRet;
}
}
}