using System;
using System.Collections;

using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;

/*-----------------------------------------------------------------------------------------------*/
// 설      명 : 정산 데이터 생성
// 작  성  자 : 
// 변경  이력 : 
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
    class PosSaleExact : IServiceUs
    {
        protected SManager sManager = new SManager();                                 // 이 객체를 통해 업무 Service 호출
        protected StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)
        protected PosStatus m_cPosStatus = new PosStatus();                           // 기본정보 참조
        protected TranStatus m_cTrnStatus = new TranStatus();                         // 거래정보 참조

        private DataCommon m_cDataCommSrv = null;
        /// <summary>
        /// 정산데이터
        /// </summary>
        protected ArrayList m_aAccoutBuf = null;

        public PosSaleExact()
        {
            m_cPosStatus = (PosStatus)StateObject.POS;      // POS 기본정보
            m_cTrnStatus = (TranStatus)StateObject.TRAN;    // POS 거래정보
            m_cDataCommSrv = (DataCommon)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
        }

        /// <summary>
        /// 정산데이터 계산 처리
        /// </summary>
        /// <returns></returns>
        public string Execute(string[] aParam)
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                
                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 void ExactOpenClose()
        {
            try
            {
                

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        

        ///// <summary>
        ///// 정산 항목 저장(건수,금액)
        ///// </summary>
        ///// <param name="sCode"></param>
        ///// <param name="sComp"></param>
        ///// <param name="nCnt"></param>
        ///// <param name="nAmt"></param>
        //private void AddAccData(string sCode, string sComp, long nCnt, long nAmt)
        //{
        //    try
        //    {
        //        if (nCnt == 0 || nAmt == 0) return;

        //        foreach (Column.TR_ACCOUNT.DATA cAccData in m_aAccoutBuf)
        //        {
        //            if (cAccData.AccCode == sCode && cAccData.CmpCode == sComp)
        //            {
        //                cAccData.AccCnt += nCnt;
        //                cAccData.AccAmt += nAmt;
        //                return;
        //            }
        //        }

        //        Column.TR_ACCOUNT.DATA cData = new Column.TR_ACCOUNT.DATA();
        //        cData.ItemID = ItemConst.TR_ITEM_ID.TR_ACCOUNT_SALE;
        //        cData.AccCode = sCode;
        //        cData.CmpCode = sComp;
        //        cData.AccCnt = nCnt;
        //        cData.AccAmt = nAmt;
        //        m_aAccoutBuf.Add(cData);
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //            "PosSaleExact.AddAccData()", ex.Message);
        //    }
        //}

        ///// <summary>
        ///// 정산 항목 저장(금액만저장)
        ///// </summary>
        ///// <param name="sCode"></param>
        ///// <param name="sComp"></param>
        ///// <param name="nCnt"></param>
        ///// <param name="nAmt"></param>
        //private void AddAccAmt(string sCode, string sComp, long nCnt, long nAmt)
        //{
        //    try
        //    {
        //        if (nAmt == 0) return;

        //        foreach (Column.TR_ACCOUNT.DATA cAccData in m_aAccoutBuf)
        //        {
        //            if (cAccData.AccCode == sCode && cAccData.CmpCode == sComp)
        //            {
        //                cAccData.AccCnt = nCnt;
        //                cAccData.AccAmt += nAmt;
        //                return;
        //            }
        //        }

        //        Column.TR_ACCOUNT.DATA cData = new Column.TR_ACCOUNT.DATA();

        //        cData.ItemID = ItemConst.TR_ITEM_ID.TR_ACCOUNT_SALE;
        //        cData.AccCode = sCode;
        //        cData.CmpCode = sComp;
        //        cData.AccCnt = nCnt;
        //        cData.AccAmt = nAmt;

        //        m_aAccoutBuf.Add(cData);
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //            "PosSaleExact.AddAccAmt()", ex.Message);
        //    }
        //}

        ///// <summary>
        ///// 정산 항목 저장(금액만저장)
        ///// </summary>
        ///// <param name="sCode"></param>
        ///// <param name="sComp"></param>
        ///// <param name="nCnt"></param>
        ///// <param name="nAmt"></param>
        //private void SetAccData(string sCode, string sComp, long nCnt, long nAmt)
        //{
        //    try
        //    {
        //        if (nAmt == 0) return;

        //        foreach (Column.TR_ACCOUNT.DATA cAccData in m_aAccoutBuf)
        //        {
        //            if (cAccData.AccCode == sCode && cAccData.CmpCode == sComp)
        //            {
        //                cAccData.AccCnt = nCnt;
        //                cAccData.AccAmt = nAmt;
        //                return;
        //            }
        //        }

        //        Column.TR_ACCOUNT.DATA cData = new Column.TR_ACCOUNT.DATA();

        //        cData.ItemID = ItemConst.TR_ITEM_ID.TR_ACCOUNT_SALE;
        //        cData.AccCode = sCode;
        //        cData.CmpCode = sComp;
        //        cData.AccCnt = nCnt;
        //        cData.AccAmt = nAmt;

        //        m_aAccoutBuf.Add(cData);
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //            "PosSaleExact.SetAccData()", ex.Message);
        //    }
        //}

    }
}
