using System;
using System.Collections;
using System.Data;
using System.Windows.Forms;

using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.Common;
using Cosmos.CommonManager;

/*-----------------------------------------------------------------------------------------------*/
// 설      명 : 영수증 출력 처리(영업개시,영업종료,로그온,로그오프...)
// 작  성  자 : 
// 변경  이력 : 
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
    class PosReceiptOpenClose : PosReceiptBase, IServiceUs
    {
        /// <summary>
        /// 거래영수증 출력 처리
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public string Execute(string[] aParam)
        {
            return UserCom.RST_ERR;
        }

        /// <summary>
        /// 데이터 획득
        /// </summary>
        /// <param name="aParam"></param>
        /// <returns></returns>
        public string GetData(string[] aParam)
        {
            return "";
        }

        /// <summary>
        /// 영수증 출력
        /// </summary>
        public string ExecutePrint(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                switch (m_cTrnStatus.Head.TradeKind)
                {
                    case ItemConst.TRAN_KIND.LOG.LOGIN:
                        return UserCom.RST_OK;
                    case ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY:
                        return UserCom.RST_OK;
                    case ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT:
                    case ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT:
                        // 정산지
                        sRet = AccADMTReceipt(m_cTrnStatus.Head.TradeKind, aParam [1]);
                        break;
                    //case ItemConst.TRAN_KIND.STATEMENT.RESERVE_FUND:
                    //    return UserCom.RST_OK;
                }

                if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT || m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT)
                {
                    // 정산지 출력여부 확인
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT421) == "1")
                    {
                        if (WinManager.QuestionMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0464)) != true)
                        {
                            return sRet; ;
                        }
                    }
                }

                // 영수증 출력 처리
                if (PrintExecute(true, true, false) == true) 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;
        }

        /// <summary>
        /// 영업 개시/종료, 로그ON/OFF, 입출금 출력데이터 생성
        /// </summary>
        public string MakeOpenClose(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                
                switch (m_cTrnStatus.Head.TradeKind)
                {
                    case ItemConst.TRAN_KIND.LOG.LOGIN:
                        // 로그온
                        sRet = CashierLogOn();
                        break;
                    case ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY:
                    case ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT:
                    case ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT:
                        // 정산지
                        //sRet = AccADMTReceipt(m_cTrnStatus.Head.TradeKind);
                        sRet = UserCom.RST_OK;
                        break;                        
                    case ItemConst.TRAN_KIND.STATEMENT.RESERVE_FUND:
                        // 준비금
                        sRet = AccRemoneyReceipt(m_cTrnStatus.Head.TradeKind);
                        break;
                    case ItemConst.TRAN_KIND.STATEMENT.ETC_STATEMENT:
                        // 기타입출금
                        sRet = AccEtcReceipt(aParam[0], aParam[1]);
                        break;
                }
            }
            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;
        }

        /// <summary>
        /// 로그온 영수증 데이터 생성
        /// </summary>
        private string CashierLogOn()
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                int nSign = m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? -1 : 1;
                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_JNL, "LOG IN : " + m_cTrnStatus.Head.CashierId);
                SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false,false, true, false, false);     // 영수증 하단영역 출력
                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;
        }

        /// <summary>
        /// 준비금 입금 영수증 데이터 생성
        /// </summary>
        private string AccRemoneyReceipt(string sTradeKind)
        {
            string sRet = UserCom.RST_ERR;
            double nSumAmount = 0;
            string sTitleName = "";
            string sCancelMsg = "";

            try
            {
                int nSign = m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? -1 : 1;

                sCancelMsg = "";
                if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND)
                {
                    sCancelMsg = "-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0010);
                }

                if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.RESERVE_FUND)
                    sTitleName = "[ " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0085) + " ]";
                else if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT)
                    sTitleName = "[ " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0088) + " ]";
                else if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY)
                    sTitleName = "[ " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0503) + " ]";
                else if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT)
                    sTitleName = "[ " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0503) + " ]" + sCancelMsg;

                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true, sTitleName);      // 영수증 상단영역 출력

                string sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0500);
                string sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
                string sTitle3 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
                string sTitle4 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0501);

                // 준비금 입금 내역
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F300, sTitle1, sTitle2, sTitle3);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                ArrayList aSaleDpstWthdr = (ArrayList)StateObject.GetItemObject(Column.SALE_DPST_WTHDR.ITEM);
                for (int iRow = 0; iRow < aSaleDpstWthdr.Count; iRow++)
                {
                    Column.SALE_DPST_WTHDR.DATA cDpstWthdr = (Column.SALE_DPST_WTHDR.DATA)aSaleDpstWthdr[iRow];
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT012) != "0")
                    {
                        if (cDpstWthdr.DPST_WTHDR_CD == "ZZ") continue;
                    }
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F300, cDpstWthdr.DPST_WTHDR_NM, m_cPosStatus.Global.NumericToQuantity(cDpstWthdr.DPST_WTHDR_QTY * nSign),
                            m_cPosStatus.Global.NumericTOCurrency(cDpstWthdr.DPST_WTHDR_AMT * nSign));

                    if (CmUtil.DoubleParse(cDpstWthdr.DPST_WTHDR_CD.ToString()) < 30) nSumAmount += (cDpstWthdr.DPST_WTHDR_AMT * nSign);            // 합계 (외화 제외)

                    //// 준비금 합계 출력 전 한줄을 띄워주기 위한 if 문
                    //if (iRow == aSaleDpstWthdr.Count - 2 && sTradeKind == ItemConst.TRAN_KIND.STATEMENT.RESERVE_FUND) 
                    //{
                    //    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                    //}
                }
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F300, sTitle4, "", m_cPosStatus.Global.NumericTOCurrency(nSumAmount));

                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");


                SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false, false, true, false, false);    // 영수증 하단영역 출력

                SetEndPosPrintData(PosConst.PRT_ITEM.REC);                                                              // 영수증 출력 완료

                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;
        }

        /// <summary>
        /// 간이영수증 데이터 생성
        /// </summary>
        public string MakePosEtcReceipt(DataTable pEtcReceipt)
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                // POS 영수증 출력
                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                SetPosSaleEtcRecepit(PosConst.PRT_ITEM.REC, pEtcReceipt);       // 간이영수증 입력/합계 영역 출력
                SetBtmPosPrintData(PosConst.PRT_ITEM.REC, true, false, false, false, false, 0);    // 영수증 하단영역 출력
                SetEndPosPrintData(PosConst.PRT_ITEM.REC);

                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;
        }


        /// <summary>
        /// 간이영수증 입력 영역 출력
        /// </summary>
        /// <param name="sPrtID"></param>
        /// <returns></returns>
        private bool SetPosSaleEtcRecepit(string sPrtID, DataTable pEtcReceipt)
        {
            try
            {
                string sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0500); 
                string sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
                
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F200, sTitle1, sTitle2);
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                // 상품 출력
                if (pEtcReceipt != null)
                {
                    //int i = 1;
                    foreach (DataRow dr in pEtcReceipt.Rows)
                    {
                        AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F200, dr["PLU"].ToString(), m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(dr["AMOUNT"].ToString())));
                    }
                }

                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                // 합계/결제 부분
                // 총매출액
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F201,
                    MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0007), m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Head.NetSaleAmt));

                // 세금항목(면세,과세,부가세)
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F201,
                    MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0006), m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Head.TotVatAmt));
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");

                // 영수금액(총매출,상품할인,순매출)
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F201,
                    MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0018), m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Head.TotSaleAmt));
                AddPrintData(sPrtID, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "=");

                return true;
            }
            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 false;

        }

        /// <summary>
        /// 고객 불편 사항 출력
        /// </summary>
        /// <returns></returns>
        public string MakePosClaimReceipt()
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                // POS 영수증 출력
                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                SetPosClaimReceipt();
                SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false, false, true, false, false);    // 영수증 하단영역 출력
                SetEndPosPrintData(PosConst.PRT_ITEM.REC);  
                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;
        }

        /// <summary>
        /// 고객 불편 사항 입력 부분
        /// </summary>
        /// <returns></returns>
        private bool SetPosClaimReceipt()
        {
            try
            {
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0019));
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                ArrayList aClaimInfo = (ArrayList)StateObject.GetItemObject(Column.IQ_STORECLAIM_MSG_REQ.ITEM);
                //for (int iRow = 0; iRow < aClaimInfo.Count; iRow++)
                //{
                    //Column.IQ_STORECLAIM_MSG_REQ.DATA cClaimInfo = (Column.IQ_STORECLAIM_MSG_REQ.DATA)aClaimInfo[iRow];
                Column.IQ_STORECLAIM_MSG_REQ.DATA cClaimInfo = (Column.IQ_STORECLAIM_MSG_REQ.DATA)aClaimInfo[0];

                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0020), cClaimInfo.SALE_DT);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0021));
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0022) + " : ", cClaimInfo.CUST_NM);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0023) + " : ", cClaimInfo.CUST_SEX);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0024) + " : ", cClaimInfo.CUST_TEL);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0025));
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0026) + " : ", cClaimInfo.ITEM_SNM);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0027) + " : ", cClaimInfo.BUY_DT);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0028) + " : ", cClaimInfo.LOT_NO);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0029));
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0030) + " : ", cClaimInfo.CLAIM_PRC_GB);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0031) + " : ", cClaimInfo.CLAIM_PRC_COST);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F203, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0032) + " : ", cClaimInfo.CLAIM_PRC_MEMO);
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                //}

                return true;
            }
            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 false;

        }

        /// <summary>
        /// 해피포인트(인카드쿠폰) 내역 출력 데이터 생성
        /// </summary>
        /// <returns></returns>
        public string MakeInCardCpnReceipt(Column.TR_ETC.DATA cEtcItem, DataTable dtCpnList)
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, false);             // 영수증 상단영역 출력

                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F103, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0071));
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR);

                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101
                    , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0075) + " : " + m_cPosStatus.Global.DateToCulture(DateTime.Now.ToString("yyyyMMdd")));
                // 카드번호
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F202
                    , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0043), cEtcItem.OCCUR_ENTRY_01);
                // 잔여포인트 
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F202
                    , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0050), m_cPosStatus.Global.NumericTOCurrency(cEtcItem.AMT_ENTRY_03));
                // 가용포인트
                AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F202
                    , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0074), m_cPosStatus.Global.NumericTOCurrency(cEtcItem.AMT_ENTRY_04));
                if (cEtcItem.HP_EXT_POINT > 0)
                {
                    // 소멸예정포인트
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F202
                        , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0017), m_cPosStatus.Global.NumericTOCurrency(cEtcItem.HP_EXT_POINT));
                }

                // 인카드 쿠폰 내역 출력
                if ( dtCpnList != null && dtCpnList.Rows.Count > 0) 
                {
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F200,
                        MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0076), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0057));
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                    foreach (DataRow dr in dtCpnList.Rows)
                    {
                        AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F200
                            , CmUtil.GetDataRowStr(dr, "COUPON_NM"), m_cPosStatus.Global.DateToCulture(CmUtil.GetDataRowStr(dr, "END_DT")));
                    }
                 
                    AddPrintData(PosConst.PRT_ITEM.REC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                }

                SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false, false, false, false, false);    // 영수증 하단영역 출력
                SetEndPosPrintData(PosConst.PRT_ITEM.REC);      // 영수증 컷팅
                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;

        }

        /// <summary>
        /// 행사 주문 취합 내역 조회 데이터 생성
        /// </summary>
        /// <returns></returns>
        public string MakePosSearchEvent(string sPrintData)
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                string sRecvData = string.Empty;
                int iDataLen = 0;


                while (iDataLen <= sPrintData.Length)
                {
                    //if (iDataLen == 0)
                    //{
                    sRecvData += CmUtil.MidH(sPrintData, iDataLen, 40) + Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString();
                    iDataLen += 40;
                    //}
                    //else
                    //{
                    //    sRecvData += CmUtil.MidH(sPrtData, iDataLen + 4, 42) + Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString();
                    //    iDataLen += 46;
                    //}
                    //iDataLen += 42;
                }


                // POS 영수증 출력
                //SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                //sRet = SetPosSearchEvent();
                //SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false, false, true, false, false);    // 영수증 하단영역 출력
                //sRet = UserCom.RST_OK;

                AddPrintData("", sRecvData);

            }
            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;
        }

        /// <summary>
        /// 행사 주문 취합 내역 조회 데이터 생성
        /// </summary>
        /// <returns></returns>
        private string SetPosSearchEvent()
        {
            try
            {
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0019));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                ArrayList aClaimInfo = (ArrayList)StateObject.GetItemObject(Column.IQ_STORECLAIM_MSG_REQ.ITEM);
                //for (int iRow = 0; iRow < aClaimInfo.Count; iRow++)
                //{
                //Column.IQ_STORECLAIM_MSG_REQ.DATA cClaimInfo = (Column.IQ_STORECLAIM_MSG_REQ.DATA)aClaimInfo[iRow];
                Column.IQ_STORECLAIM_MSG_REQ.DATA cClaimInfo = (Column.IQ_STORECLAIM_MSG_REQ.DATA)aClaimInfo[0];

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0020), " ", cClaimInfo.SALE_DT);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0021));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0022), " : ", cClaimInfo.CUST_NM);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0023), " : ", cClaimInfo.CUST_SEX);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0024), " : ", cClaimInfo.CUST_TEL);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0025));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0026), " : ", cClaimInfo.ITEM_SNM);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0027), " : ", cClaimInfo.BUY_DT);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0028), " : ", cClaimInfo.LOT_NO);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0029));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0030), " : ", cClaimInfo.CLAIM_PRC_GB);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0031), " : ", cClaimInfo.CLAIM_PRC_COST);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0032), " : ", cClaimInfo.CLAIM_PRC_MEMO);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                //}

                return "";
            }
            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 "";

        }

        /// <summary>
        /// 정산지 출력 데이터 생성
        /// </summary>
        /// <param name="sTradeKind"></param>
        /// <returns></returns>
        private string AccADMTReceipt(string sTradeKind, string sSimplePrint)
        {
            //#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 + "()", "[AccADMTReceipt] Kind : " + sTradeKind + " , " + "Simple print :" + sSimplePrint);
            //#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 end, phj

            IAccADMT m_cAccADMT = null;
            bool bSubTitlePrint = false; 
            string sRet = UserCom.RST_ERR;
            m_cAccADMT = (IAccADMT)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.ACC_ADMT);

            try
            {
                ///PrintBufClear();        // 영수증 출력버퍼 초기화

                if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND) return UserCom.RST_OK;
                
                string sTitleMsg = "";
                if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT)
                {
                    sTitleMsg = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0484), "1");

                    // 중간정산 횟수 조회
                    DataTable dtData = m_cAccADMT.GetADMTCount(new string[] { "" });
                    if (dtData != null && dtData.Rows.Count != 0)
                    {
                        foreach (DataRow dr in dtData.Rows)
                        {
                            sTitleMsg = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0484), m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(dr["QTY"].ToString())));
                        }
                    }
                }
                else if (sTradeKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) sTitleMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0089);

                // SUB 타이틀 출력
                string sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0500);
                string sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
                string sTitle3 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);

                DataTable dtMemu = null;

                //dtMemu = m_cAccADMT.GetData_ADMTPrint(new string[] { sTradeKind, sSimplePrint });
                IDataSearch m_cDataSearch = (IDataSearch)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.DATASEARCH);
                sRet = m_cDataSearch.MakeAccADMTCheck(m_cPosStatus.Base.SaleDate, ref dtMemu, sSimplePrint);
                // 메뉴정보 설정
                if (dtMemu != null && dtMemu.Rows.Count > 0)
                {
                    int nSign = m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.REFUND ? -1 : 1;

                    // 영수증 상단영역 출력
                    SetTopPosPrintData(PosConst.PRT_ITEM.ETC, true, true, false, true);

                    // 영업일자 출력(2017.05.26)
                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101
                        , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0081) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate));
                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, "");

                    // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6
                    int[] aDataPrint = new int[10];
                    string sPrevCd = "";
                    foreach (DataRow dr in dtMemu.Rows)
                    {
                        if (sPrevCd == "" || sPrevCd != CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1))
                        {
                            sPrevCd = CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1);
                        }
                        aDataPrint[CmUtil.IntParse(sPrevCd)] += CmUtil.GetDataRowInt(dr, "QTY");
                    }
                    // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6

                    foreach (DataRow dr in dtMemu.Rows)
                    {
                        string sSeq = CmUtil.GetDataRowStr(dr, "SEQ_NO");                                                   // 정산지 수량이 있는 경우만 출력 추가 20170830 goblin6
                        string sTitle = CmUtil.GetDataRowStr(dr, "MSG");                                                    // 명칭
                        string sQty = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "QTY"));            // 수량
                        string sAmt = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "AMT"));            // 금액
                        string sSortDiv = CmUtil.GetDataRowStr(dr, "SORT_DIV");                                             // 정렬
                        string sSizeDiv = CmUtil.GetDataRowStr(dr, "SIZE_DIV");                                             // 크기
                        string sBillTag = CmUtil.GetDataRowStr(dr, "BILL_TYPE_TAG");                                        // 출력 타입
                        //string sBoldYn = CmUtil.GetDataRowStr(dr, "BOLD_YN");                                               // 진하게

                        // 정렬
                        if (sSortDiv == "1") sSortDiv = PosConst.PRT_FMT.F102;
                        else if (sSortDiv == "2") sSortDiv = PosConst.PRT_FMT.F103;
                        else if (sSortDiv == "3") sSortDiv = PosConst.PRT_FMT.F101;

                        // 크기
                        if (sSizeDiv == "1") sSizeDiv = PosConst.PRT_HDR.PRT_NOR;
                        else if (sSizeDiv == "2") sSizeDiv = PosConst.PRT_HDR.PRT_HOR;
                        else if (sSizeDiv == "3") sSizeDiv = PosConst.PRT_HDR.PRT_VER;
                        else if (sSizeDiv == "4") sSizeDiv = PosConst.PRT_HDR.PRT_BIG;
                        else sSizeDiv = PosConst.PRT_HDR.PRT_NOR;
                        //if (sBoldYn == "1") sSizeDiv = PosConst.PRT_HDR.PRT_BLD;

                        // 출력 정의
                        switch (sBillTag.Trim().ToUpper())
                        {
                            case "<LINE>":
                                // '-' 라인 추가
                                AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F100, "-");
                                break;
                            case "<CUT>":
                                // 영수증 커팅
                                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_CUT, "");
                                break;
                            case "<CODE>":
                                // 정산 데이터 출력
                                if (bSubTitlePrint != true)
                                {
                                    // 타이틀
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, sTitleMsg);
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_BLD, PosConst.PRT_FMT.F103, sTitleMsg);

                                    // sub 타이틀 
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sTitle1, sTitle2, sTitle3);
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                                    bSubTitlePrint = true;
                                }


                                // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6
                                if ((CmUtil.IntParse(sSeq) >= 2100 && CmUtil.IntParse(sSeq) < 6100
                                    || CmUtil.IntParse(sSeq) >= 8701 && CmUtil.IntParse(sSeq) <= 8704)
                                    && CmUtil.IntParse(sSeq) != 3800 && CmUtil.IntParse(sSeq) != 3801
                                    && CmUtil.IntParse(sSeq) != 4300 && CmUtil.IntParse(sSeq) != 4301
                                    )

                                {
                                    if (CmUtil.IntParse(sQty) > 0)
                                    {
                                        AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F301, sTitle, sQty, sAmt);
                                    }
                                    else
                                    {
                                        sPrevCd = CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1);
                                        if (aDataPrint[CmUtil.IntParse(sPrevCd)] == 0)
                                        {
                                            aDataPrint[CmUtil.IntParse(sPrevCd)] = 1;
                                            sTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0570); 
                                            AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F103, sTitle, "", "");
                                            //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                                        }
                                    }
                                }
                                else
                                {
                                    //#13509 마감지 '마감입금' 항목 정렬 수정 요청 start
                                    //기존

                                    //#13863 PB 동해평릉 - 마감지 정렬 방식 개선요청 start, phj
                                    //기존
                                    //AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F300, sTitle, sQty, sAmt);
                                    //변경
                                    AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F301, sTitle, sQty, sAmt);
                                    //#13863 PB 동해평릉 - 마감지 정렬 방식 개선요청 end, phj

                                    //변경
                                    /*
                                    if (sSortDiv == PosConst.PRT_FMT.F102)
                                    {
                                        AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F300, sTitle, sQty, sAmt);
                                    }
                                    else
                                    {
                                        AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, PosConst.PRT_FMT.F301, sTitle, sQty, sAmt);
                                    }
                                    */
                                    //#13509 마감지 '마감입금' 항목 정렬 수정 요청 end
                                }
                                // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6

                                break;
                            case "<ITEM>":
                            case "<CLASS>":
                            case "<TENDER>":
                            case "<CASHREFUND>":                                                                               // 현금반품 내역 추가 20170830 goblin6
                                // 상품별/분류별/결제별 집계
                                DataTable dtMemu2 = m_cAccADMT.SelectiTemClass(new string[] { sBillTag.Trim().ToUpper() });
                                if (dtMemu2 != null && dtMemu2.Rows.Count > 0)
                                {
                                    string sTitile = "";
                                    if (sBillTag.Trim().ToUpper() == "<ITEM>")
                                        sTitile = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0601);
                                    else if (sBillTag.Trim().ToUpper() == "<CLASS>")
                                        // #20170915 분류별 정산 내역 추가 start, phj
                                        //기존 
                                        //sTitile = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0602);
                                        //변경
                                        sTitile = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1033);
                                        // #20170915 분류별 정산 내역 추가 end, phj
                                    else if (sBillTag.Trim().ToUpper() == "<TENDER>")
                                        sTitile = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0603);
                                    else if (sBillTag.Trim().ToUpper() == "<CASHREFUND>")
                                        sTitile = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0207);                   // 현금반품 내역 추가 20170830 goblin6
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, sTitile);

                                    if (sBillTag.Trim().ToUpper() == "<CASHREFUND>")                                            // 현금반품 내역 추가 20170830 goblin6
                                    {
                                        sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0346);
                                        sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0446);
                                        sTitle3 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
                                    }
                                    // #20170915 분류별 정산 내역 추가 start, phj
                                    else if (sBillTag.Trim().ToUpper() == "<CLASS>")
                                    {
                                        // 분류, 수량, 금액
                                        sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1032);
                                        sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
                                        sTitle3 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
                                    }
                                    // #20170915 분류별 정산 내역 추가 end, phj
                                    else
                                    {
                                        sTitle1 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0500);
                                        sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
                                        sTitle3 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
                                    }

                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                    if (sBillTag.Trim().ToUpper() == "<CASHREFUND>")                                            // 현금반품 내역 추가 20170830 goblin6
                                        AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F303, sTitle1, sTitle2, sTitle3);
                                    else
                                        AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sTitle1, sTitle2, sTitle3);
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                                    // #20170915 분류별 정산 내역 추가 start, phj
                                    double dtotNetAmt = 0;
                                    if (sBillTag.Trim().ToUpper() == "<CLASS>")
                                    {
                                        // 총시재매출
                                        foreach (DataRow dr1 in dtMemu2.Rows)
                                        {
                                            // 2 - 합계row
                                            if (CmUtil.GetDataRowStr(dr1, "LEVEL_GB").ToString() == "2")
                                            {
                                                dtotNetAmt = CmUtil.GetDataRowDouble(dr1, "BILL_AMT");
                                                break;
                                            }
                                        }
                                    }
                                    // #20170915 분류별 정산 내역 추가 end, phj

                                    foreach (DataRow dr2 in dtMemu2.Rows)
                                    {
                                        string sSubTitle = "";                                                      // 현금반품 내역 추가 20170830 goblin6
                                        string sSubQty = "";
                                        string sSubAmt = "";
                                        // #20170915 분류별 정산 내역 추가 start, phj
                                        string sSubPercent = "";
                                        // #20170915 분류별 정산 내역 추가 end, phj

                                        if (sBillTag.Trim().ToUpper() == "<CASHREFUND>")                             // 현금반품 내역 추가 20170830 goblin6
                                        {
                                            sSubTitle = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString();                                         // 명칭
                                            sSubQty = CmUtil.GetDataRowStr(dr2, "SALE_QTY").ToString();                                          // 시간
                                            sSubAmt = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_AMT"));           // 금액
                                        }
                                        // #20170915 분류별 정산 내역 추가 start
                                        else if (sBillTag.Trim().ToUpper() == "<CLASS>")
                                        {
                                            sSubTitle = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString();                                         // 명칭
                                            sSubQty = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_QTY"));           // 수량
                                            sSubAmt = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "BILL_AMT"));           // 금액
                                            sSubPercent = (CmUtil.MathRounds(((Convert.ToDouble(sSubAmt) * 100) / dtotNetAmt), PosConst.MATH_ROUND.ROUND, 0)).ToString();                                                          // 퍼센트
                                        }
                                        // #20170915 분류별 정산 내역 추가 end
                                        else
                                        {
                                            sSubTitle = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString();                                         // 명칭
                                            sSubQty = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_QTY"));           // 수량
                                            sSubAmt = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_AMT"));           // 금액
                                        }


                                        if (sSubTitle.Trim() == "#SUM#")
                                        {
                                            sSubTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0501);
                                            AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                        }


                                        if (sBillTag.Trim().ToUpper() == "<CASHREFUND>")                             // 현금반품 내역 추가 20170830 goblin6
                                            AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F303, sSubTitle, sSubQty, sSubAmt);
                                        // #20170915 분류별 정산 내역 추가 start, phj
                                        else if (sBillTag.Trim().ToUpper() == "<CLASS>")
                                        {
                                            // 분류명 , 백분율 
                                            sSubTitle = CmUtil.RPadH(sSubTitle, 20) + CmUtil.LPadH(sSubPercent.ToString(), 3);

                                            AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sSubTitle, sSubQty, sSubAmt);
                                        }
                                        // #20170915 분류별 정산 내역 추가 end, phj
                                        else
                                            AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sSubTitle, sSubQty, sSubAmt);
                                    }

                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                                }

                                break;
                            default:
                                // 입력된 문구 출력
                                if (bSubTitlePrint != true)
                                {
                                    // 타이틀
                                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, sTitleMsg);
                                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");

                                    //bSubTitlePrint = true;
                                }

                                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                //if (bSubTitlePrint == true) AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, " ");
                                if (bSubTitlePrint != true)
                                {
                                    bSubTitlePrint = true;
                                }
                                AddPrintData(PosConst.PRT_ITEM.ETC, sSizeDiv, sSortDiv, sBillTag);

                                // sub 타이틀 
                                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sTitle1, sTitle2, sTitle3);
                                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                                break;
                        }

                        Application.DoEvents();
                    }

                    // 영수증 하단영역 출력
                    SetBtmPosPrintData(PosConst.PRT_ITEM.ETC, false, false, false, false, false);
                }                

                SetEndPosPrintData(PosConst.PRT_ITEM.ETC);                                                                              // 영수증 출력 완료

                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;
        }


        /// <summary>
        /// 기타입출금 데이터 생성
        /// </summary>
        public string AccEtcReceipt(string sFromDate, string sToDate)
        {
            string sRet = UserCom.RST_ERR;
            double nInSumAmount = 0;
            double nOutSumAmount = 0;
            //string sTitleName = "";
            string sDpstWthdrCdFlag = "";

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                // POS 영수증 출력
                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0111));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0075) + " : " 
                    + sFromDate + " " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0075) + " " + sToDate);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F402, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0113), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0114)
                    , MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0115), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0091));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                
                ArrayList aSaleDpstWthdr = (ArrayList)StateObject.GetItemObject(Column.SALE_DPST_WTHDR.ITEM);
                for (int iRow = 0; iRow < aSaleDpstWthdr.Count; iRow++)
                {
                    Column.SALE_DPST_WTHDR.DATA cDpstWthdr = (Column.SALE_DPST_WTHDR.DATA)aSaleDpstWthdr[iRow];

                    if (cDpstWthdr.DPST_WTHDR_CD == "01")
                    {
                        nInSumAmount += cDpstWthdr.DPST_WTHDR_AMT;             // 입금합계
                        cDpstWthdr.DPST_WTHDR_CD = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0486);
                    }
                    else if (cDpstWthdr.DPST_WTHDR_CD == "02")
                    {
                        nOutSumAmount += cDpstWthdr.DPST_WTHDR_AMT;            // 출금합계
                        cDpstWthdr.DPST_WTHDR_CD = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0524);
                    }

                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F402, cDpstWthdr.SALE_DT, cDpstWthdr.DPST_WTHDR_CD,
                            cDpstWthdr.DPST_WTHDR_NM, m_cPosStatus.Global.NumericTOCurrency(cDpstWthdr.DPST_WTHDR_AMT));

                    if (cDpstWthdr.ETC_REASON != "")
                    {
                        AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, "- " +cDpstWthdr.ETC_REASON);
                    }

                }
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F201, "** " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0116) + " **", m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(nInSumAmount.ToString())));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F201, "** " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0117) + " **", m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(nOutSumAmount.ToString())));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, "** " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0118) + " : " + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + " **");

                SetEndPosPrintData(PosConst.PRT_ITEM.ETC);                                                              // 영수증 출력 완료

                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;
        }

        /// <summary>
        /// 준비점검 공지사항 데이터 생성
        /// </summary>
        public string PrepStorNoticeReceipt(DataTable dtData)
        {
            string sRet = UserCom.RST_ERR;
            double nInSumAmount = 0;
            double nOutSumAmount = 0;
            //string sTitleName = "";
            string sDpstWthdrCdFlag = "";

            int nCnt = 0;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                // POS 영수증 출력
                //SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                //SetBtmPosPrintData(PosConst.PRT_ITEM.REC, false, false, true, false, false);    // 영수증 하단영역 출력

                //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, "준비점검 공지사항");
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, "영업일자 : " + m_cPosStatus.Base.SaleDate);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                //ArrayList aSaleDpstWthdr = (ArrayList)StateObject.GetItemObject(Column.SALE_DPST_WTHDR.ITEM);
                for (int iRow = 0; iRow < dtData.Rows.Count; iRow++)
                {
                    //AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F402, cDpstWthdr.SALE_DT, cDpstWthdr.DPST_WTHDR_CD,
                    //        cDpstWthdr.DPST_WTHDR_NM, m_cPosStatus.Global.NumericTOCurrency(cDpstWthdr.DPST_WTHDR_AMT));

                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, "[ " + CmUtil.GetDataRowStr(dtData.Rows[iRow], PosMst.MST_SALESORG_INSPCT_GRP.DATA.INSPCT_ENTRY_L_CLSS_NM) + " ] ");

                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, CmUtil.GetDataRowStr(dtData.Rows[iRow], PosMst.MST_SALESORG_INSPCT_DTL.DATA.INSPCT_ENTRY_NM));
                    nCnt = CmUtil.GetDataRowInt(dtData.Rows[iRow], PosMst.MST_SALESORG_INSPCT_DTL.DATA.SEL_ENTRY_CNT);
 
                    for (int iRow2 = 0; iRow2 < nCnt; iRow2++)
                    {
                        string sCellIndex = Convert.ToString(iRow2 + 1);

                        AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, CmUtil.GetDataRowStr(dtData.Rows[iRow], "SEL_ENTRY_" + sCellIndex));
                    }
                }

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, "** 출력시간 : " + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + " **");

                // 영수증 컷팅
                SetEndPosPrintData(PosConst.PRT_ITEM.ETC);

                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;
        }

        /// <summary>
        /// 준비금 등록내역 출력 데이터 생성
        /// </summary>
        /// <param name="dtData">등록내역 데이터</param>
        /// <param name="sFromDate">영업일자</param>
        /// <returns></returns>
        public string AccRemoneyListReceipt(DataTable dtData, string sFromDate)
        {
            string sRet = UserCom.RST_ERR;
            int nCnt = 0;

            try
            {
                PrintBufClear();        // 영수증 출력버퍼 초기화

                SetTopPosPrintData(PosConst.PRT_ITEM.REC, true, true, false, true);             // 영수증 상단영역 출력
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0080));
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0081) + " : " + sFromDate);
                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F403, MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0082),
                    MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0011), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0083), MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0084));

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                for (int iRow = 0; iRow < dtData.Rows.Count; iRow++)
                {
                    //nCnt = CmUtil.GetDataRowInt(dtData.Rows[iRow], PosMst.MST_SALESORG_INSPCT.DATA.SEL_ENTRY_CNT);

                    AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F403, CmUtil.GetDataRowStr(dtData.Rows[iRow], PosAcc.ACC_REMONEY_SEARCH.DATA.NO), CmUtil.GetDataRowStr(dtData.Rows[iRow], PosAcc.ACC_REMONEY_SEARCH.DATA.CASHIER_NM),
                        CmUtil.GetDataRowStr(dtData.Rows[iRow], PosAcc.ACC_REMONEY_SEARCH.DATA.TOTSALE_AMT), CmUtil.GetDataRowStr(dtData.Rows[iRow], PosAcc.ACC_REMONEY_SEARCH.DATA.PAY_TIME));

                }

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, "-");

                AddPrintData(PosConst.PRT_ITEM.ETC, PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, "** " + MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0085) + " : " + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + " **");

                // 영수증 컷팅
                SetEndPosPrintData(PosConst.PRT_ITEM.ETC);

                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;
        }
    }
}
