504 lines
30 KiB
C#
504 lines
30 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Data;
|
|
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.ServiceProvider;
|
|
using Cosmos.Common;
|
|
using Cosmos.CommonManager;
|
|
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
// 설 명 : 자동 세트 메뉴 구성 처리
|
|
// 작 성 자 :
|
|
// 변경 이력 :
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
namespace Cosmos.Service
|
|
{
|
|
class SalePluSetMenu : SalePluItemBase
|
|
{
|
|
#region 변수 선언
|
|
|
|
/// <summary>
|
|
/// 세트 마스터
|
|
/// </summary>
|
|
private DataTable m_dtMstSetHead = null;
|
|
private DataTable m_dtMstSetList = null;
|
|
private DataTable m_dtMstSetDetl = null;
|
|
#endregion
|
|
|
|
#region 생성자
|
|
public SalePluSetMenu()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 자동 세트 메뉴 마스터 로딩 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool LoadSetMenuDisMaster()
|
|
{
|
|
string sQuery;
|
|
try
|
|
{
|
|
// 세트메뉴 마스터
|
|
sQuery = " SELECT DISTINCT A.SUB_STOR_CD, A.ITEM_CD, B.TAKE_OUT_SALE_AMT, B.TAKE_IN_SALE_AMT ";
|
|
sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
sQuery += " JOIN POSMST..MST_ITEM B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD ";
|
|
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
sQuery += " AND A.SET_AUTO_DIV = '1' ";
|
|
sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD ";
|
|
m_dtMstSetHead = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
sQuery = " SELECT DISTINCT A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO, B.TAKE_OUT_SALE_AMT, B.TAKE_IN_SALE_AMT ";
|
|
sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
sQuery += " JOIN POSMST..MST_ITEM B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD ";
|
|
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
sQuery += " AND A.SET_AUTO_DIV = '1' ";
|
|
sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD ";
|
|
m_dtMstSetList = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
sQuery = " SELECT A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO, A.SET_ITEM_DIV, A.SET_ITEM_CD, B.SET_ITEM_CD GRP_SET_ITEM_CD, B.SET_ITEM_UP_PRC ";
|
|
sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
sQuery += " LEFT JOIN POSMST..MST_ITEM_SET_GRP B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND (A.SET_ITEM_CD = B.SET_ITEM_GRP_CD OR A.SET_ITEM_GRP_CD = B.SET_ITEM_GRP_CD)";
|
|
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
sQuery += " AND A.SET_AUTO_DIV = '1' ";
|
|
sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
sQuery += " AND (B.USE_YN IS NULL OR B.USE_YN = '" + PosConst.MST_USE_YN.YES + "') ";
|
|
sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO ";
|
|
m_dtMstSetDetl = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
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 bool ExecuteSetMenuDiscount()
|
|
{
|
|
try
|
|
{
|
|
if (m_dtMstSetHead == null || m_dtMstSetHead.Rows.Count <= 0) return true;
|
|
if (m_dtMstSetList == null || m_dtMstSetList.Rows.Count <= 0) return true;
|
|
if (m_dtMstSetDetl == null || m_dtMstSetDetl.Rows.Count <= 0) return true;
|
|
|
|
ArrayList alTrPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); // 상품 아이템
|
|
|
|
// 자동 세트 메뉴 계산
|
|
foreach (DataRow drH in m_dtMstSetHead.Rows)
|
|
{
|
|
string sSUB_STOR_CD = CmUtil.GetDataRowStr(drH, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD);
|
|
string sSET_MENU_CD = CmUtil.GetDataRowStr(drH, PosMst.MST_ITEM_SET.DATA.ITEM_CD);
|
|
|
|
for (int nLoop = 0; nLoop < 99999; nLoop++)
|
|
{
|
|
long nMatchQty = 0;
|
|
foreach (DataRow drL in m_dtMstSetList.Rows)
|
|
{
|
|
// 세트 그룹별 적용 가능수량 체크
|
|
if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.ITEM_CD)) continue;
|
|
|
|
string sSET_SEQ_NO = CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SEQ_NO);
|
|
long nSaleQty = 0;
|
|
foreach (DataRow drD in m_dtMstSetDetl.Rows)
|
|
{
|
|
if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.ITEM_CD)
|
|
|| sSET_SEQ_NO != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SEQ_NO)) continue;
|
|
|
|
string sITEM_CD = "";
|
|
// 자식상품구분 ==> 0:상품, 1:부가상품그룹코드, 2:상품+그룹
|
|
if (CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_DIV) == "1" || CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_DIV) == "2")
|
|
sITEM_CD = CmUtil.GetDataRowStr(drD, "GRP_SET_ITEM_CD");
|
|
else
|
|
sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_CD);
|
|
|
|
// 등록된 상품 리스트에서 세트 그룹별 상품 등록 여부 체크
|
|
foreach (Column.TR_PLU.DATA cSaleItem in alTrPluItem)
|
|
{
|
|
if (cSaleItem.ORDER_OK_FLAG != PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) continue;
|
|
if (cSaleItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL) continue;
|
|
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
|
|
if (cSaleItem.DC_DIV != ItemConst.PLU_DC_DIV.NORMAL) continue; // 서비스(무료)
|
|
if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
|
|
|
|
if (sSUB_STOR_CD != cSaleItem.SUB_SHOP_CD || sITEM_CD != cSaleItem.ITEM_PLU_CD) continue;
|
|
if (cSaleItem.SALE_QTY == 0) continue;
|
|
|
|
nSaleQty = cSaleItem.SALE_QTY;
|
|
if (nMatchQty == 0 || nMatchQty > nSaleQty) nMatchQty = nSaleQty;
|
|
break;
|
|
}
|
|
if (nMatchQty == 0 || nSaleQty > 0 ) break;
|
|
}
|
|
if (nSaleQty == 0) nMatchQty = 0;
|
|
if (nMatchQty == 0) break;
|
|
}
|
|
|
|
// 해당 세트가 성립하지 않으면 다음세트 체크
|
|
if (nMatchQty == 0) break;
|
|
|
|
// 세트 상품 등록 처리
|
|
string nStat = SetItemCode("", PosConst.SALE_PLU_INPUT_TYPE.MENUKEY, sSUB_STOR_CD, sSET_MENU_CD, "", "");
|
|
if (nStat != UserCom.RST_OK) break;
|
|
Column.TR_PLU.DATA cSetMainItem = (Column.TR_PLU.DATA)alTrPluItem[alTrPluItem.Count - 1];
|
|
cSetMainItem.ITEM_DIV = ItemConst.PLU_ITEM_DIV.SET_MAIN;
|
|
cSetMainItem.SALE_QTY = nMatchQty;
|
|
m_cDataService.UpdatePluItemAmount(cSetMainItem);
|
|
|
|
for (int i = 0; i < m_dtMstSetList.Rows.Count; i++)
|
|
{
|
|
DataRow drL = m_dtMstSetList.Rows[i];
|
|
|
|
if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.ITEM_CD)) continue;
|
|
|
|
string sSET_SEQ_NO = CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SEQ_NO);
|
|
foreach (DataRow drD in m_dtMstSetDetl.Rows)
|
|
{
|
|
if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.ITEM_CD)
|
|
|| sSET_SEQ_NO != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SEQ_NO)) continue;
|
|
|
|
string sITEM_CD = "";
|
|
// 자식상품구분 ==> 0:상품, 1:부가상품그룹코드, 2:상품+그룹
|
|
if (CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_DIV) == "1" || CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_DIV) == "2")
|
|
sITEM_CD = CmUtil.GetDataRowStr(drD, "GRP_SET_ITEM_CD");
|
|
else
|
|
sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SET_ITEM_CD);
|
|
|
|
bool bSetMenuDtl = false;
|
|
for (int nMenuRow = 0; nMenuRow < alTrPluItem.Count; nMenuRow++)
|
|
{
|
|
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)alTrPluItem[nMenuRow];
|
|
|
|
if (cSaleItem.ORDER_OK_FLAG != PosConst.PLU_ORDER_OK_FLAG.ORDER_ING) continue;
|
|
if (cSaleItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL) continue;
|
|
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
|
|
if (cSaleItem.DC_DIV != ItemConst.PLU_DC_DIV.NORMAL) continue; //
|
|
if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
|
|
|
|
if (sSUB_STOR_CD != cSaleItem.SUB_SHOP_CD || sITEM_CD != cSaleItem.ITEM_PLU_CD) continue;
|
|
if (cSaleItem.SALE_QTY < nMatchQty) continue;
|
|
|
|
cSaleItem.SALE_QTY -= nMatchQty;
|
|
m_cDataService.UpdatePluItemAmount(cSaleItem);
|
|
|
|
Column.TR_PLU.DATA cSetDtlItem = (Column.TR_PLU.DATA)cSaleItem.Clone();
|
|
|
|
cSetDtlItem.ITEM_DIV = ItemConst.PLU_ITEM_DIV.SET_DETL;
|
|
cSetDtlItem.SALE_QTY = nMatchQty;
|
|
cSetDtlItem.SALE_PRC = CmUtil.GetDataRowDouble(drD, PosMst.MST_ITEM_SET_GRP.DATA.SET_ITEM_UP_PRC);
|
|
cSetDtlItem.ITEM_NAME = ">" + cSetDtlItem.ITEM_NAME;
|
|
cSetDtlItem.SET_MENU_CD = sSET_MENU_CD;
|
|
m_cDataService.UpdatePluItemAmount(cSetDtlItem);
|
|
|
|
alTrPluItem.Add(cSetDtlItem);
|
|
bSetMenuDtl = true;
|
|
|
|
// 부가메뉴 이동
|
|
if (nMenuRow + 1 < m_alTrPluItem.Count)
|
|
{
|
|
for (int nSubMenuRow = nMenuRow + 1; nSubMenuRow < m_alTrPluItem.Count; nSubMenuRow++)
|
|
{
|
|
Column.TR_PLU.DATA cItem = (Column.TR_PLU.DATA)m_alTrPluItem[nSubMenuRow];
|
|
|
|
if (cItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.NORMAL || cItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN) break;
|
|
|
|
Column.TR_PLU.DATA cSubMenuItem = (Column.TR_PLU.DATA)cItem.Clone();
|
|
|
|
alTrPluItem.Add(cSubMenuItem);
|
|
|
|
cItem.SALE_QTY = 0;
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
if (bSetMenuDtl == true) break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 수량 0인것 삭제 처리
|
|
int nSelRow = 0;
|
|
while (nSelRow < m_alTrPluItem.Count)
|
|
{
|
|
Column.TR_PLU.DATA cItem = (Column.TR_PLU.DATA)m_alTrPluItem[nSelRow];
|
|
|
|
if (cItem.SALE_QTY == 0)
|
|
m_alTrPluItem.RemoveAt(nSelRow);
|
|
else
|
|
nSelRow++;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
//class SalePluSetDis
|
|
//{
|
|
// #region 변수 선언
|
|
// 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(); // 거래정보 참조
|
|
|
|
// /// <summary>
|
|
// /// 거래데이터 합계금액 계산 및 관리
|
|
// /// </summary>
|
|
// protected IDataProcessUs m_cDataService = null;
|
|
// /// <summary>
|
|
// /// 판매공통 모듈
|
|
// /// </summary>
|
|
// protected IDataCommonUs m_cDataCommon = null;
|
|
// /// <summary>
|
|
// /// 마스터 인터페이스
|
|
// /// </summary>
|
|
// protected IMasterUs m_cMstService = null;
|
|
|
|
// /// <summary>
|
|
// /// 세트 마스터
|
|
// /// </summary>
|
|
// private DataTable m_dtMstSetHead = null;
|
|
// private DataTable m_dtMstSetList = null;
|
|
// private DataTable m_dtMstSetDetl = null;
|
|
// #endregion
|
|
|
|
// #region 생성자
|
|
// public SalePluSetDis()
|
|
// {
|
|
// m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
|
// m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
|
|
|
|
// m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
|
|
// m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
|
// m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER);
|
|
// }
|
|
// #endregion
|
|
|
|
// /// <summary>
|
|
// /// 세트 메뉴 할인 마스터 로딩 처리
|
|
// /// </summary>
|
|
// /// <returns></returns>
|
|
// public bool LoadSetMenuDisMaster()
|
|
// {
|
|
// string sQuery;
|
|
// try
|
|
// {
|
|
// // 세트메뉴 마스터
|
|
// sQuery = " SELECT DISTINCT A.SUB_STOR_CD, A.ITEM_CD, B.TAKE_OUT_SALE_AMT ";
|
|
// sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
// sQuery += " JOIN POSMST..MST_ITEM B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD ";
|
|
// sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
// sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
// sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
// sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD ";
|
|
// m_dtMstSetHead = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
// sQuery = " SELECT DISTINCT A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO, B.TAKE_OUT_SALE_AMT ";
|
|
// sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
// sQuery += " JOIN POSMST..MST_ITEM B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.ITEM_CD = B.ITEM_CD ";
|
|
// sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
// sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
// sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
// sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD ";
|
|
// m_dtMstSetList = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
// sQuery = " SELECT A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO, A.SUB_ITEM_DIV, A.SUB_ITEM_CD, B.SUBPRC_MENU_KEY_CD ";
|
|
// sQuery += " FROM POSMST..MST_ITEM_SET A ";
|
|
// sQuery += " LEFT JOIN POSMST..MST_SUBPRC_MENU_GRP B ON A.CMP_CD=B.CMP_CD AND A.STOR_CD=B.STOR_CD AND A.SUB_STOR_CD = B.SUB_STOR_CD AND A.SUB_ITEM_CD = B.SUBPRC_MENU_GRP_CD ";
|
|
// sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' ";
|
|
// sQuery += " AND A.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' ";
|
|
// sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "' ";
|
|
// sQuery += " AND (B.USE_YN IS NULL OR B.USE_YN = '" + PosConst.MST_USE_YN.YES + "') ";
|
|
// sQuery += " ORDER BY A.SUB_STOR_CD, A.ITEM_CD, A.SEQ_NO ";
|
|
// m_dtMstSetDetl = m_cMstService.Select(new string[] { sQuery });
|
|
|
|
// 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 bool ExecuteSetMenuDiscount()
|
|
// {
|
|
// try
|
|
// {
|
|
// if (m_dtMstSetHead == null || m_dtMstSetHead.Rows.Count <= 0) return true;
|
|
// if (m_dtMstSetList == null || m_dtMstSetList.Rows.Count <= 0) return true;
|
|
// if (m_dtMstSetDetl == null || m_dtMstSetDetl.Rows.Count <= 0) return true;
|
|
|
|
// // 기존 세트 할인 정보 초기화
|
|
// ArrayList alTrPluItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM); // 상품 아이템
|
|
// foreach (Column.TR_PLU.DATA cSaleItem in alTrPluItem)
|
|
// {
|
|
// cSaleItem.SET_DC_AMT = 0;
|
|
// cSaleItem.SET_DC_QTY = 0;
|
|
// cSaleItem.SET_MENU_CD = "";
|
|
|
|
// m_cDataService.UpdatePluItemAmount(cSaleItem); // 상품 판매가 계산
|
|
// }
|
|
|
|
// // 세트할인 계산
|
|
// foreach (DataRow drH in m_dtMstSetHead.Rows)
|
|
// {
|
|
// string sSUB_STOR_CD = CmUtil.GetDataRowStr(drH, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD);
|
|
// string sSET_MENU_CD = CmUtil.GetDataRowStr(drH, PosMst.MST_ITEM_SET.DATA.ITEM_CD);
|
|
|
|
// for (int nLoop = 0; nLoop < 99999; nLoop++)
|
|
// {
|
|
// // 세트할인은 상품별 단가가 상이할수 있으므로 수량을 하나씩 계산
|
|
// //==============================================================
|
|
// bool bSetMenu = false;
|
|
// double nTotSaleAmt = 0;
|
|
// string sMaxSET_SEQ_NO = "";
|
|
// foreach (DataRow drL in m_dtMstSetList.Rows)
|
|
// {
|
|
// // 세트 그룹별 적용 가능수량 체크
|
|
// if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.ITEM_CD)) continue;
|
|
|
|
// string sSET_SEQ_NO = CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SEQ_NO);
|
|
// bSetMenu = false;
|
|
// foreach (DataRow drD in m_dtMstSetDetl.Rows)
|
|
// {
|
|
// if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.ITEM_CD)
|
|
// || sSET_SEQ_NO != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SEQ_NO)) continue;
|
|
|
|
// string sITEM_CD = "";
|
|
// if (CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_ITEM_DIV) == "1") // 0:상품, 1:부가상품그룹코드
|
|
// sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_SUBPRC_MENU_GRP.DATA.SUBPRC_MENU_KEY_CD);
|
|
// else
|
|
// sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_ITEM_CD);
|
|
|
|
// // 등록된 상품 리스트에서 세트 그룹별 상품 등록 여부 체크
|
|
// foreach (Column.TR_PLU.DATA cSaleItem in alTrPluItem)
|
|
// {
|
|
// if (cSaleItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL) continue;
|
|
// if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
|
|
// if (cSaleItem.DC_DIV == ItemConst.PLU_DC_DIV.FREE) continue; // 서비스(무료)
|
|
// if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
|
|
|
|
// if (sSUB_STOR_CD != cSaleItem.SUB_SHOP_CD || sITEM_CD != cSaleItem.ITEM_PLU_CD) continue;
|
|
|
|
// if (cSaleItem.SALE_QTY > cSaleItem.SET_DC_QTY)
|
|
// {
|
|
// bSetMenu = true;
|
|
// nTotSaleAmt = CmUtil.DoubleAdd(nTotSaleAmt, cSaleItem.SALE_PRC);
|
|
// sMaxSET_SEQ_NO = sSET_SEQ_NO;
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (bSetMenu == true) break;
|
|
// }
|
|
// if (bSetMenu == false) break;
|
|
// }
|
|
|
|
// // 해당 세트가 성립하지 않으면 다음세트 체크
|
|
// if (bSetMenu == false) break;
|
|
|
|
// // 세트 할인가 적용(세트상품단가합 - 세트판매가)
|
|
// double nTotDisAmt = CmUtil.DoubleSubtraction(nTotSaleAmt, CmUtil.GetDataRowDouble(drH, PosMst.MST_ITEM.DATA.TAKE_OUT_SALE_AMT));
|
|
// if (nTotSaleAmt <= 0) continue;
|
|
// double nNowDisAmt = 0;
|
|
// for (int i = 0; i < m_dtMstSetList.Rows.Count; i++)
|
|
// {
|
|
// DataRow drL = m_dtMstSetList.Rows[i];
|
|
|
|
// if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.ITEM_CD)) continue;
|
|
|
|
// string sSET_SEQ_NO = CmUtil.GetDataRowStr(drL, PosMst.MST_ITEM_SET.DATA.SEQ_NO);
|
|
// bSetMenu = false;
|
|
// foreach (DataRow drD in m_dtMstSetDetl.Rows)
|
|
// {
|
|
// if (sSUB_STOR_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_STOR_CD) || sSET_MENU_CD != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.ITEM_CD)
|
|
// || sSET_SEQ_NO != CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SEQ_NO)) continue;
|
|
|
|
// string sITEM_CD = "";
|
|
// if (CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_ITEM_DIV) == "1") // 0:상품, 1:부가상품그룹코드
|
|
// sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_SUBPRC_MENU_GRP.DATA.SUBPRC_MENU_KEY_CD);
|
|
// else
|
|
// sITEM_CD = CmUtil.GetDataRowStr(drD, PosMst.MST_ITEM_SET.DATA.SUB_ITEM_CD);
|
|
|
|
// foreach (Column.TR_PLU.DATA cSaleItem in alTrPluItem)
|
|
// {
|
|
// if (cSaleItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL) continue;
|
|
// if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
|
|
// if (cSaleItem.DC_DIV == ItemConst.PLU_DC_DIV.FREE) continue; // 서비스(무료)
|
|
// if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
|
|
|
|
// if (sSUB_STOR_CD != cSaleItem.SUB_SHOP_CD || sITEM_CD != cSaleItem.ITEM_PLU_CD) continue;
|
|
|
|
// if (cSaleItem.SALE_QTY > cSaleItem.SET_DC_QTY)
|
|
// {
|
|
// bSetMenu = true;
|
|
|
|
// double nDisAmt = 0;
|
|
// if (sSET_SEQ_NO == sMaxSET_SEQ_NO)
|
|
// {
|
|
// nDisAmt = CmUtil.DoubleSubtraction(nTotDisAmt, nNowDisAmt);
|
|
// }
|
|
// else
|
|
// {
|
|
// nDisAmt = CmUtil.DoubleMultiplication(nTotDisAmt, CmUtil.DoubleDivision(cSaleItem.SALE_PRC, nTotSaleAmt));
|
|
// nDisAmt = CmUtil.MathRounds(nDisAmt, m_cPosStatus.Mst.DcRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.DcRudDwLoc));
|
|
// }
|
|
// nNowDisAmt = CmUtil.DoubleAdd(nNowDisAmt, nDisAmt);
|
|
|
|
// cSaleItem.SET_DC_AMT = CmUtil.DoubleAdd(cSaleItem.SET_DC_AMT, nDisAmt);
|
|
// cSaleItem.SET_DC_QTY += 1;
|
|
// cSaleItem.SET_MENU_CD = sSET_MENU_CD;
|
|
|
|
// m_cDataService.UpdatePluItemAmount(cSaleItem);
|
|
// break;
|
|
// }
|
|
// }
|
|
// if (bSetMenu == true) break;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// 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;
|
|
// }
|
|
|
|
//}
|
|
}
|