1543 lines
80 KiB
C#
1543 lines
80 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using System.Collections;
|
|
|
|
using Cosmos.Win;
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.ServiceProvider;
|
|
using Cosmos.Common;
|
|
using Cosmos.CommonManager;
|
|
using Cosmos.UI;
|
|
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
// 설 명 : 묶음상품/쇼킹박스
|
|
// 작 성 자 :
|
|
// 변경 이력 :
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
namespace Cosmos.Win
|
|
{
|
|
public partial class frmBundleiTem : Form
|
|
{
|
|
|
|
#region 변수 선언
|
|
|
|
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
|
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
|
|
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
|
|
private PosOLEDevice.DelegateOlePos delegatePos;
|
|
|
|
private IICReaderUs m_cDeviceICReader = null;
|
|
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
|
|
private IDataProcessUs m_cDataService = null;
|
|
private ISalePluItemUs m_cPluService = null; // 판매 등록 관리
|
|
|
|
private string m_sPosMenuKeyIn;
|
|
public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
|
|
private string m_sPosMenuKeyOut;
|
|
public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }
|
|
|
|
private bool bNotDoubleClik = false; // 더블 클릭 방지용
|
|
|
|
private string m_sPosMenuKey; // 입력코드
|
|
/// <summary>
|
|
/// 할인 구분
|
|
/// </summary>
|
|
public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } }
|
|
|
|
/// <summary>
|
|
/// 입력구분
|
|
/// </summary>
|
|
private string m_sInPutType = "";
|
|
/// <summary>
|
|
/// 입력데이터
|
|
/// </summary>
|
|
private string m_sInPutData = "";
|
|
/// <summary>
|
|
/// 카드데이터
|
|
/// </summary>
|
|
private string m_sInEncData = "";
|
|
|
|
/// <summary>
|
|
/// 등록 상품 리스트 데이터
|
|
/// </summary>
|
|
private DataTable m_dtcglAlliTem;
|
|
/// <summary>
|
|
/// 선택 상품 리스트 데이터
|
|
/// </summary>
|
|
private DataTable m_dtcglBundleiTem;
|
|
|
|
#endregion 변수 선언
|
|
|
|
#region 생성자 & 소멸자 & 폼초기화
|
|
public frmBundleiTem()
|
|
{
|
|
InitializeComponent();
|
|
|
|
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
|
//this.UpdateStyles();
|
|
|
|
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
|
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
|
|
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
|
|
|
|
m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
|
|
m_cDeviceICReader = (IICReaderUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER);
|
|
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
|
m_cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
|
|
|
|
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
|
|
}
|
|
|
|
private void frmBundleiTem_Load(object sender, EventArgs e)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
|
|
|
|
InitControl();
|
|
}
|
|
|
|
private void frmBundleiTem_Activated(object sender, EventArgs e)
|
|
{
|
|
PosOLEDevice.SetEventHandle(delegatePos);
|
|
}
|
|
|
|
private void frmBundleiTem_Deactivate(object sender, EventArgs e)
|
|
{
|
|
PosOLEDevice.SetEventHandle(null);
|
|
}
|
|
|
|
private void frmBundleiTem_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 폼 컨트롤 초기화
|
|
/// </summary>
|
|
private void InitControl()
|
|
{
|
|
try
|
|
{
|
|
// 이미지 로딩 처리
|
|
//this.Size = new Size(800, 544);
|
|
//this.Location = new Point(110, 173);
|
|
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
|
|
|
|
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
|
|
FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
|
|
, m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);
|
|
|
|
//테마색상 적용!
|
|
padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
|
|
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
|
|
padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018);
|
|
|
|
btnAllUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
|
|
btnAllUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);
|
|
btnAllDw.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
|
|
btnAllDw.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);
|
|
|
|
btnBudleUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
|
|
btnBudleUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);
|
|
btnBudleDw.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
|
|
btnBudleDw.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);
|
|
|
|
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
|
|
if (btnExit.Image != null) btnExit.Text = "";
|
|
|
|
|
|
// 묶음상품/쇼킹박스
|
|
if (m_sPosMenuKey == PosKey.MENU_KEY.DC_COUPONS) lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0373);
|
|
|
|
|
|
//2017.12.20;타이틀 다국어 처리: WinPay.cs 에서 FORM_SAL_BUNDLE_ITEM 라인에서 호출 시 m_sPosMenuKey 값을 설정하는 부분이 없어 미주만 lblTitle 메시지 분기 처리 Start
|
|
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.US)//if (m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS))
|
|
{
|
|
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0373);
|
|
}
|
|
//2017.12.20;타이틀 다국어 처리: WinPay.cs 에서 FORM_SAL_BUNDLE_ITEM 라인에서 호출 시 m_sPosMenuKey 값을 설정하는 부분이 없어 미주만 lblTitle 메시지 분기 처리 End
|
|
|
|
|
|
|
|
lblPayAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0374); // 선택금액
|
|
lblSaleAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348); // 판매금액
|
|
|
|
//btnAddAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0375); // 추가(수량전체)
|
|
//btnAddOne.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0376); // 추가(수랑1개)
|
|
btnAddAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226); // 전체
|
|
btnAddOne.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0224); // 추가
|
|
btnDelete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0021); // 삭제
|
|
|
|
btnComplete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0380); // 묶음적용
|
|
btnCancel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0381); // 묶음취소
|
|
|
|
txtSaleAmt.Text = "0";
|
|
txtSaleAmt.Value = "0";
|
|
|
|
//txtPayAmt.Text = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Sale.RemainPayAmt); // 선택금액
|
|
txtPayAmt.Text = "0";
|
|
|
|
m_sInPutType = ""; // 입력구분
|
|
m_sInPutData = ""; // 입력데이터
|
|
m_sInEncData = ""; // 카드데이터
|
|
|
|
bNotDoubleClik = false;
|
|
|
|
DataGridSetting(0); // 그리드 초기화
|
|
|
|
txtSaleAmt.Select();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 버튼 입력 처리
|
|
/// <summary>
|
|
/// 버튼 입력 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnProc_Click(object sender, EventArgs e)
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
|
|
try
|
|
{
|
|
if (bNotDoubleClik) return;
|
|
bNotDoubleClik = true;
|
|
|
|
if ((UI.CsmButton)sender == btnAllUp) // 상단 그리드 Up
|
|
{
|
|
cglAlliTem.CsmGridScroll("UP");
|
|
}
|
|
else if ((UI.CsmButton)sender == btnAllDw) // 상단 그리드 Down
|
|
{
|
|
cglAlliTem.CsmGridScroll("DOWN");
|
|
}
|
|
else if ((UI.CsmButton)sender == btnBudleUp) // 하단 그리드 Up
|
|
{
|
|
cgdBundleiTem.CsmGridScroll("UP");
|
|
}
|
|
else if ((UI.CsmButton)sender == btnBudleDw) // 하단 그리드 Down
|
|
{
|
|
cgdBundleiTem.CsmGridScroll("DOWN");
|
|
}
|
|
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnAddAll) // 전체
|
|
{
|
|
sRet = DataGridSetting(1);
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnAddOne) // 추가
|
|
{
|
|
sRet = DataGridSetting(2);
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnDelete) // 삭제
|
|
{
|
|
sRet = DataGridSetting(3);
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnComplete) // 묶음적용
|
|
{
|
|
sRet = CompleteTxtInPut();
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnCancel) // 묶음취소
|
|
{
|
|
sRet = GetSaleItemSetDCCancel();
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
padInPut.SetActiveFocus();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
bNotDoubleClik = false;
|
|
}
|
|
bNotDoubleClik = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 닫기
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 키 입력 이벤트 처리
|
|
/// <summary>
|
|
/// 텍스트박스 키 입력 이벤트 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="sFuncValue"></param>
|
|
private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
|
|
{
|
|
try
|
|
{
|
|
if (sFuncValue == PosKey.MENU_KEY.ENTER)
|
|
{
|
|
btnProc_Click(btnComplete, null);
|
|
}
|
|
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
|
|
{
|
|
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
|
|
if (((Cosmos.UI.CsmPosEditBox)sender) == txtSaleAmt)
|
|
{
|
|
m_sInPutType = "";
|
|
m_sInPutData = "";
|
|
m_sInEncData = "";
|
|
txtSaleAmt.ReadOnly = false;
|
|
}
|
|
}
|
|
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
}
|
|
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="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void txtEditBox_EnterEvent(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
padInPut.SetActiveControl = (Control)sender;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 유효성 체크
|
|
/// <summary>
|
|
/// 텍스트박스 입력 유효성 체크
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <returns></returns>
|
|
private bool CheckTxtInPut(object sender)
|
|
{
|
|
try
|
|
{
|
|
if (txtSaleAmt.Value.Length > 10 || m_cDataService.DoubleParse(txtSaleAmt.Value) <= 0)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
|
|
txtSaleAmt.Focus();
|
|
return false;
|
|
}
|
|
|
|
if (CmUtil.AmountCut(m_cDataService.DoubleParse(txtSaleAmt.Value), CmUtil.IntParse(m_cPosStatus.Mst.PayRudDwLoc)) != m_cDataService.DoubleParse(txtSaleAmt.Value))
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
|
|
txtSaleAmt.Focus();
|
|
return false;
|
|
}
|
|
|
|
// 받을금액 체크
|
|
if (m_cDataService.DoubleParse(txtPayAmt.Text) <= 0)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0034);
|
|
txtSaleAmt.Focus();
|
|
return false;
|
|
}
|
|
|
|
// 판매금액과 받을금액 체크
|
|
if (m_cDataService.DoubleParse(txtSaleAmt.Text) > m_cDataService.DoubleParse(txtPayAmt.Text))
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0035);
|
|
txtSaleAmt.Focus();
|
|
return false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 완료 처리
|
|
/// <summary>
|
|
/// 할인 처리
|
|
/// </summary>
|
|
/// <param name="nFlowMode"></param>
|
|
/// <returns></returns>
|
|
private string CompleteTxtInPut()
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
try
|
|
{
|
|
if (cgdBundleiTem.CsmGridRowsCount <= 0) return UserCom.RST_OK;
|
|
|
|
if (CheckTxtInPut(null) != true) return sRet;
|
|
|
|
sRet = GetSaleItemSetDC(m_cDataService.DoubleParse(txtSaleAmt.Value));
|
|
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return sRet;
|
|
}
|
|
#endregion
|
|
|
|
#region DeviceEvent 관련
|
|
/// <summary>
|
|
/// DeviceEvent 관련
|
|
/// </summary>
|
|
/// <param name="sDevice"></param>
|
|
/// <param name="sData1"></param>
|
|
/// <param name="sData2"></param>
|
|
/// <param name="sData3"></param>
|
|
public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
|
|
{
|
|
try
|
|
{
|
|
switch (sDevice)
|
|
{
|
|
case PosConst.OPOS_DEVICE.MSR:
|
|
this.Invoke(new EventHandler(OnMSREvent));
|
|
break;
|
|
case PosConst.OPOS_DEVICE.SCANNER:
|
|
this.Invoke(new EventHandler(OnScannerEvent));
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// MSR Event
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnMSREvent(object source, EventArgs e)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 스캐너 이벤트 처리
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnScannerEvent(object source, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 카드 번호 암호화
|
|
/// </summary>
|
|
/// <param name="sInData"></param>
|
|
/// <param name="sCardData"></param>
|
|
/// <param name="sCardNo"></param>
|
|
/// <returns></returns>
|
|
private string EncryptedCardNo(string sInData, ref string sCardData, ref string sCardNo)
|
|
{
|
|
string sEncData = sInData;
|
|
|
|
try
|
|
{
|
|
if (sInData.Length <= 0) return "";
|
|
|
|
sEncData = m_cDeviceICReader.GetEncryptedCardNo(sInData).Trim();
|
|
|
|
if (CmUtil.MidH(sEncData, 0, 2) == "00")
|
|
{
|
|
sCardData = CmUtil.MidH(sEncData, 2, 512).Trim();
|
|
sCardNo = CmUtil.MidH(sEncData, 514, sEncData.Length - 514).Trim();
|
|
}
|
|
else
|
|
{
|
|
//암호화 처리 실패!
|
|
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sInData);
|
|
}
|
|
}
|
|
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 sEncData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// IC 카드 정보 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetIcCardData()
|
|
{
|
|
try
|
|
{
|
|
m_sInPutType = "";
|
|
m_sInPutData = "";
|
|
m_sInEncData = "";
|
|
txtSaleAmt.Value = "";
|
|
txtSaleAmt.ReadOnly = false;
|
|
|
|
string sRsvStr = "";
|
|
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.POINT, 1, ref sRsvStr) == true)
|
|
{
|
|
if (CmUtil.MidH(sRsvStr, 0, 2) == "00")
|
|
{
|
|
|
|
m_sInEncData = CmUtil.MidH(sRsvStr, 6, 512).Trim();
|
|
m_sInPutData = CmUtil.MidH(sRsvStr, 1030, 37).Trim();
|
|
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
|
|
|
|
txtSaleAmt.Value = m_sInPutData;
|
|
txtSaleAmt.ReadOnly = true;
|
|
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;
|
|
}
|
|
#endregion
|
|
|
|
#region 그리드 설정 및 사용
|
|
private string DataGridSetting(int index)
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
|
|
try
|
|
{
|
|
switch (index)
|
|
{
|
|
case 0:
|
|
#region 초기화
|
|
{
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 상단 그리드
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 초기화
|
|
cglAlliTem.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 9, FontStyle.Bold);
|
|
|
|
cglAlliTem.Font = new Font(m_cPosStatus.Base.FONT, 9, FontStyle.Regular);
|
|
|
|
|
|
//DataGridView 자체의 컬럼 헤더 Visible 여부
|
|
cglAlliTem.CsmGridColumnHeadersVisible = true;
|
|
//DataGridView 자체의 컬럼 헤더 높이
|
|
cglAlliTem.CsmGridColumnHeadersHeight = 33;
|
|
cglAlliTem.CsmGridRowsHeight = 35;
|
|
|
|
//그리드의 컬럼 수
|
|
cglAlliTem.CsmGridColumnCount = 14;
|
|
//그리드의 한 화면에 보이는 로우수
|
|
cglAlliTem.CsmGridShowPageRowsCount = 4;
|
|
|
|
cglAlliTem.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
|
|
cglAlliTem.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
|
|
cglAlliTem.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
|
|
cglAlliTem.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
|
|
cglAlliTem.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
|
|
cglAlliTem.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
|
|
|
|
//각 컬럼별 이름 지정
|
|
cglAlliTem.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
|
|
cglAlliTem.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0178));
|
|
cglAlliTem.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0015));
|
|
cglAlliTem.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017));
|
|
cglAlliTem.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348));
|
|
cglAlliTem.CsmGridColumnName(5, "");
|
|
cglAlliTem.CsmGridColumnName(6, "");
|
|
cglAlliTem.CsmGridColumnName(7, "");
|
|
cglAlliTem.CsmGridColumnName(8, "");
|
|
cglAlliTem.CsmGridColumnName(9, "");
|
|
cglAlliTem.CsmGridColumnName(10, "");
|
|
cglAlliTem.CsmGridColumnName(11, "");
|
|
cglAlliTem.CsmGridColumnName(12, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0036));
|
|
cglAlliTem.CsmGridColumnName(13, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1023));
|
|
cglAlliTem.CsmGridColumnShowHide(3, false);
|
|
cglAlliTem.CsmGridColumnShowHide(5, false);
|
|
cglAlliTem.CsmGridColumnShowHide(6, false);
|
|
cglAlliTem.CsmGridColumnShowHide(7, false);
|
|
cglAlliTem.CsmGridColumnShowHide(8, false);
|
|
cglAlliTem.CsmGridColumnShowHide(9, false);
|
|
cglAlliTem.CsmGridColumnShowHide(10, false);
|
|
cglAlliTem.CsmGridColumnShowHide(11, false);
|
|
|
|
//컬럼넓이 지정(420)
|
|
//cglAlliTem.CsmGridSetColumnWidth(new int[] { 45, 90, 124, 60, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
|
|
cglAlliTem.CsmGridSetColumnWidth(new int[] { 35, 0, 124, 0, 90, 0, 0, 0, 0, 0, 0, 0, 85, 85 });
|
|
|
|
//컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
|
|
cglAlliTem.CsmGridAlignment(new int[] { 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 });
|
|
|
|
m_dtcglAlliTem = new DataTable("GRID_LIST");
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("NO", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("ITEMCD", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("ITEMNM", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("QTY", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("AMOUNT", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("ITEM_DIV", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("DC_PRMT_YN", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("COST", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("SEQ", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("UPDATE", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("SET_DC_AMT", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("ORDER_OK_FLAG", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("TOT_DC_AMT", typeof(string)));
|
|
m_dtcglAlliTem.Columns.Add(new DataColumn("EXCEP_DC_AMT", typeof(string)));
|
|
m_dtcglAlliTem.Clear();
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 하단 그리드
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 초기화
|
|
cgdBundleiTem.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 9, FontStyle.Bold);
|
|
|
|
cgdBundleiTem.Font = new Font(m_cPosStatus.Base.FONT, 9, FontStyle.Regular);
|
|
|
|
//DataGridView 자체의 컬럼 헤더 Visible 여부
|
|
cgdBundleiTem.CsmGridColumnHeadersVisible = true;
|
|
//DataGridView 자체의 컬럼 헤더 높이
|
|
cgdBundleiTem.CsmGridColumnHeadersHeight = 34;
|
|
cgdBundleiTem.CsmGridRowsHeight = 35;
|
|
|
|
//그리드의 컬럼 수
|
|
cgdBundleiTem.CsmGridColumnCount = 14;
|
|
//그리드의 한 화면에 보이는 로우수
|
|
cgdBundleiTem.CsmGridShowPageRowsCount = 4;
|
|
|
|
cgdBundleiTem.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
|
|
cgdBundleiTem.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
|
|
cgdBundleiTem.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
|
|
cgdBundleiTem.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
|
|
cgdBundleiTem.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
|
|
cgdBundleiTem.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
|
|
|
|
//각 컬럼별 이름 지정
|
|
cgdBundleiTem.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
|
|
cgdBundleiTem.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0178));
|
|
cgdBundleiTem.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0015));
|
|
cgdBundleiTem.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017));
|
|
cgdBundleiTem.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348));
|
|
cgdBundleiTem.CsmGridColumnName(5, "");
|
|
cgdBundleiTem.CsmGridColumnName(6, "");
|
|
cgdBundleiTem.CsmGridColumnName(7, "");
|
|
cgdBundleiTem.CsmGridColumnName(8, "");
|
|
cgdBundleiTem.CsmGridColumnName(9, "");
|
|
cgdBundleiTem.CsmGridColumnName(10, "");
|
|
cgdBundleiTem.CsmGridColumnName(11, "");
|
|
cgdBundleiTem.CsmGridColumnName(12, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0036));
|
|
cgdBundleiTem.CsmGridColumnName(13, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1023));
|
|
cgdBundleiTem.CsmGridColumnShowHide(3, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(5, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(6, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(7, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(8, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(9, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(10, false);
|
|
cgdBundleiTem.CsmGridColumnShowHide(11, false);
|
|
|
|
//컬럼넓이 지정(406)
|
|
//cgdBundleiTem.CsmGridSetColumnWidth(new int[] { 45, 90, 124, 60, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
|
|
cgdBundleiTem.CsmGridSetColumnWidth(new int[] { 35, 0, 124, 0, 90, 0, 0, 0, 0, 0, 0, 0, 85, 85 });
|
|
|
|
//컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
|
|
cgdBundleiTem.CsmGridAlignment(new int[] { 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 });
|
|
|
|
m_dtcglBundleiTem = new DataTable("GRID_BUNDLE_LIST");
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("NO", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("ITEMCD", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("ITEMNM", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("QTY", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("AMOUNT", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("ITEM_DIV", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("DC_PRMT_YN", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("COST", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("SEQ", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("UPDATE", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("SET_DC_AMT", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("ORDER_OK_FLAG", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("TOT_DC_AMT", typeof(string)));
|
|
m_dtcglBundleiTem.Columns.Add(new DataColumn("EXCEP_DC_AMT", typeof(string)));
|
|
m_dtcglBundleiTem.Clear();
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 상품정보 (정상-묶음제외)
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
|
|
for (int iLoop = 0; iLoop < aSaleItem.Count; iLoop++)
|
|
{
|
|
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iLoop];
|
|
|
|
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.SET_DC_AMT > 0) continue;
|
|
|
|
DataRow drNewRow = m_dtcglAlliTem.NewRow();
|
|
|
|
if (cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.OPT_MENU || cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_DETL || cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN)
|
|
{
|
|
drNewRow["NO"] = "";
|
|
}
|
|
else
|
|
{
|
|
drNewRow["NO"] = SelectMaxNo(m_dtcglAlliTem).ToString();
|
|
}
|
|
drNewRow["ITEMCD"] = cSaleItem.ITEM_PLU_CD; // 상품코드
|
|
drNewRow["ITEMNM"] = cSaleItem.ITEM_NAME; // 상품명
|
|
drNewRow["QTY"] = m_cPosStatus.Global.NumericToQuantity(cSaleItem.SALE_QTY); // 수량
|
|
drNewRow["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.BILL_AMT); // 판매금액
|
|
drNewRow["ITEM_DIV"] = cSaleItem.ITEM_DIV; // 부가상품
|
|
drNewRow["DC_PRMT_YN"] = cSaleItem.DC_PRMT_YN; // 할인불가
|
|
drNewRow["COST"] = cSaleItem.SALE_PRC; // 단가
|
|
drNewRow["SEQ"] = iLoop; // Seq
|
|
drNewRow["UPDATE"] = ""; // 변경구분
|
|
drNewRow["SET_DC_AMT"] = cSaleItem.SET_DC_AMT; // 세트할인금액
|
|
drNewRow["ORDER_OK_FLAG"] = cSaleItem.ORDER_OK_FLAG; // 주문완료 상태
|
|
drNewRow["TOT_DC_AMT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleAdd(cSaleItem.ITEM_DC_AMT, cSaleItem.CPI_DC_AMT)); // 적용된 할인
|
|
drNewRow["EXCEP_DC_AMT"] = cSaleItem.EXCEP_DC_AMT; // 예외할인
|
|
m_dtcglAlliTem.Rows.Add(drNewRow);
|
|
}
|
|
|
|
cglAlliTem.CsmGridDataSource = m_dtcglAlliTem;
|
|
cglAlliTem.CsmGridSelectRow(0);
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
|
|
m_dtcglBundleiTem.Clear();
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
// 상품정보 (묶음만)
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
|
|
for (int iLoop = 0; iLoop < aSaleItem.Count; iLoop++)
|
|
{
|
|
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iLoop];
|
|
|
|
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.SET_DC_AMT <= 0) continue;
|
|
|
|
DataRow drNewRow = m_dtcglBundleiTem.NewRow();
|
|
|
|
if (cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.OPT_MENU || cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_DETL || cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN)
|
|
{
|
|
drNewRow["NO"] = "";
|
|
}
|
|
else
|
|
{
|
|
drNewRow["NO"] = SelectMaxNo(m_dtcglBundleiTem).ToString();
|
|
}
|
|
drNewRow["ITEMCD"] = cSaleItem.ITEM_PLU_CD; // 상품코드
|
|
drNewRow["ITEMNM"] = cSaleItem.ITEM_NAME; // 상품명
|
|
drNewRow["QTY"] = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.SALE_QTY); // 수량
|
|
drNewRow["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.BILL_AMT); // 판매금액
|
|
drNewRow["ITEM_DIV"] = cSaleItem.ITEM_DIV; // 부가상품
|
|
drNewRow["DC_PRMT_YN"] = cSaleItem.DC_PRMT_YN; // 할인불가
|
|
drNewRow["COST"] = cSaleItem.SALE_PRC; // 단가
|
|
drNewRow["SEQ"] = iLoop; // Seq
|
|
drNewRow["UPDATE"] = ""; // 변경구분
|
|
drNewRow["SET_DC_AMT"] = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.SET_DC_AMT); // 세트할인금액
|
|
drNewRow["ORDER_OK_FLAG"] = cSaleItem.ORDER_OK_FLAG; // 주문완료 상태
|
|
drNewRow["TOT_DC_AMT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleAdd(cSaleItem.SET_DC_AMT, cSaleItem.CPI_DC_AMT)); // 적용된 할인
|
|
drNewRow["EXCEP_DC_AMT"] = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.EXCEP_DC_AMT); // 예외할인
|
|
|
|
m_dtcglBundleiTem.Rows.Add(drNewRow);
|
|
}
|
|
|
|
cgdBundleiTem.CsmGridDataSource = m_dtcglBundleiTem;
|
|
cgdBundleiTem.CsmGridSelectRow(0);
|
|
// ------------------------------------------------------------------------------------------------------------------------
|
|
break;
|
|
}
|
|
#endregion
|
|
case 1:
|
|
#region 전체 추가
|
|
// 전체
|
|
{
|
|
//int iRow = cglAlliTem.CsmGridSelectedRowIndex;
|
|
|
|
//if (cglAlliTem.CsmGridRowsCount <= 0) break;
|
|
//if (m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU
|
|
// || m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL
|
|
// || m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_MAIN)
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0305);
|
|
// break;
|
|
//}
|
|
|
|
//if (m_dtcglAlliTem.Rows[iRow]["ORDER_OK_FLAG"].ToString() != PosConst.PLU_ORDER_OK_FLAG.ORDER_ING)
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0306);
|
|
// break;
|
|
//}
|
|
|
|
if (cglAlliTem.CsmGridRowsCount > 0)
|
|
{
|
|
//int iMaxCnt = cglAlliTem.CsmGridRowsCount;
|
|
int iMaxCnt = 0;
|
|
|
|
// 부가상품, 세트자식을 제외한 수량 체크
|
|
for (int iLoop = 0; iLoop < cglAlliTem.CsmGridRowsCount; iLoop++)
|
|
{
|
|
if (m_dtcglAlliTem.Rows[iLoop]["ITEM_DIV"].ToString() != ItemConst.PLU_ITEM_DIV.OPT_MENU && m_dtcglAlliTem.Rows[iLoop]["ITEM_DIV"].ToString() != ItemConst.PLU_ITEM_DIV.SET_DETL)
|
|
{
|
|
iMaxCnt++;
|
|
}
|
|
}
|
|
|
|
// 기존 할인이 있는지 확인
|
|
for (int iLoop = 0; iLoop < cglAlliTem.CsmGridRowsCount; iLoop++)
|
|
{
|
|
if (CmUtil.LongParse(m_dtcglAlliTem.Rows[iLoop]["TOT_DC_AMT"].ToString()) > 0)
|
|
{
|
|
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0680) == false)
|
|
{
|
|
return sRet;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
bool bAdd = false;
|
|
int iRow = 0;
|
|
for (int iLoop = 0; iLoop < iMaxCnt; iLoop++)
|
|
{
|
|
|
|
double aaa = m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["AMOUNT"].ToString());
|
|
|
|
if (m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU
|
|
|| m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL
|
|
|| m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_MAIN
|
|
|| m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["SET_DC_AMT"].ToString()) > 0
|
|
//|| m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["AMOUNT"].ToString()) <= 0
|
|
)
|
|
{
|
|
iRow++;
|
|
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0305);
|
|
continue;
|
|
}
|
|
|
|
//if (m_dtcglAlliTem.Rows[iRow]["ORDER_OK_FLAG"].ToString() != PosConst.PLU_ORDER_OK_FLAG.ORDER_ING)
|
|
//{
|
|
// //WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0306);
|
|
// continue;
|
|
//}
|
|
|
|
sRet = GridDataSet(cglAlliTem, m_dtcglAlliTem, cgdBundleiTem, m_dtcglBundleiTem, true, iRow, false);
|
|
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
bAdd = true;
|
|
}
|
|
|
|
if (bAdd == false)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0305);
|
|
}
|
|
}
|
|
//sRet = GridDataSet(cglAlliTem, m_dtcglAlliTem, cgdBundleiTem, m_dtcglBundleiTem, true, iRow, false);
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
|
|
break;
|
|
}
|
|
#endregion
|
|
case 2:
|
|
#region 선택 추가
|
|
// 추가
|
|
{
|
|
int iRow = cglAlliTem.CsmGridSelectedRowIndex;
|
|
|
|
if (cglAlliTem.CsmGridRowsCount <= 0) break;
|
|
if (m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU
|
|
|| m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL
|
|
|| m_dtcglAlliTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_MAIN
|
|
//|| m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["AMOUNT"].ToString()) <= 0
|
|
)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0305);
|
|
break;
|
|
}
|
|
|
|
//if (m_dtcglAlliTem.Rows[iRow]["ORDER_OK_FLAG"].ToString() != PosConst.PLU_ORDER_OK_FLAG.ORDER_ING)
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0306);
|
|
// break;
|
|
//}
|
|
|
|
// 기존 할인이 있는지 확인
|
|
if (CmUtil.LongParse(m_dtcglAlliTem.Rows[iRow]["TOT_DC_AMT"].ToString()) > 0)
|
|
{
|
|
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0680) == false)
|
|
{
|
|
return sRet;
|
|
}
|
|
}
|
|
//for (int iLoop = 0; iLoop < cglAlliTem.CsmGridRowsCount; iLoop++)
|
|
//{
|
|
// if (CmUtil.LongParse(m_dtcglAlliTem.Rows[iLoop]["TOT_DC_AMT"].ToString()) > 0)
|
|
// {
|
|
// if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0680) == false)
|
|
// {
|
|
// return sRet;
|
|
// }
|
|
// break;
|
|
// }
|
|
//}
|
|
|
|
sRet = GridDataSet(cglAlliTem, m_dtcglAlliTem, cgdBundleiTem, m_dtcglBundleiTem, true, iRow, false);
|
|
//sRet = GridDataSet(cglAlliTem, m_dtcglAlliTem, cgdBundleiTem, m_dtcglBundleiTem, false, iRow, false);
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
|
|
break;
|
|
}
|
|
#endregion
|
|
case 3:
|
|
#region 삭제
|
|
// 삭제
|
|
{
|
|
int iRow = cgdBundleiTem.CsmGridSelectedRowIndex;
|
|
|
|
if (cgdBundleiTem.CsmGridRowsCount <= 0) break;
|
|
if (m_dtcglBundleiTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU
|
|
|| m_dtcglBundleiTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL
|
|
|| m_dtcglBundleiTem.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_MAIN ) break;
|
|
|
|
sRet = GridDataSet(cgdBundleiTem, m_dtcglBundleiTem, cglAlliTem, m_dtcglAlliTem, true, iRow, true);
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
|
|
break;
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
sRet = UserCom.RST_OK;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
|
|
sRet = UserCom.RST_ERR;
|
|
}
|
|
|
|
return sRet;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 그리드 No 최대값 조회
|
|
/// </summary>
|
|
/// <param name="dtData"></param>
|
|
/// <returns></returns>
|
|
private string SelectMaxNo(DataTable dtData)
|
|
{
|
|
long nGetData = 0;
|
|
long nMaxNo = 0;
|
|
string sRet = "";
|
|
try
|
|
{
|
|
if (dtData.Rows.Count <= 0) sRet = "1";
|
|
|
|
for (int iLoop = 0; iLoop < dtData.Rows.Count; iLoop++)
|
|
{
|
|
DataRow dvDataRow = dtData.Rows[iLoop];
|
|
if (dvDataRow["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU || dvDataRow["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL) continue;
|
|
|
|
nGetData = m_cDataService.LongParse(dvDataRow["NO"].ToString());
|
|
|
|
if (nGetData >= nMaxNo)
|
|
{
|
|
nMaxNo = nGetData + 1;
|
|
|
|
sRet = (nMaxNo).ToString();
|
|
}
|
|
}
|
|
}
|
|
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>
|
|
/// 그리드 특정 Row 추가/삭제
|
|
/// </summary>
|
|
/// <param name="cdgSrc"></param>
|
|
/// <param name="dtSrc"></param>
|
|
/// <param name="cdgTaget"></param>
|
|
/// <param name="dtTarget"></param>
|
|
/// <param name="AllMove"></param>
|
|
/// <param name="iRow"></param>
|
|
/// <param name="bDelete"></param>
|
|
/// <returns></returns>
|
|
private string GridDataSet(Cosmos.UI.CsmGrid cdgSrc, DataTable dtSrc, Cosmos.UI.CsmGrid cdgTaget, DataTable dtTarget, bool AllMove, int iRow, bool bDelete)
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
double nPayAmount = 0;
|
|
|
|
try
|
|
{
|
|
if (cdgSrc.CsmGridRowsCount <= 0) return sRet;
|
|
|
|
// 할인 체크
|
|
if (m_cDataService.DoubleParse(dtSrc.Rows[iRow]["SET_DC_AMT"].ToString()) > 0 )
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0256);
|
|
return sRet;
|
|
}
|
|
|
|
// 할인불가 체크
|
|
if (dtSrc.Rows[iRow]["DC_PRMT_YN"].ToString() == "1")
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0050);
|
|
return sRet;
|
|
}
|
|
|
|
// 코드 체크
|
|
if (cdgSrc.CsmGridGetCell(iRow, 1).ToString().Trim() == "") return sRet;
|
|
|
|
DataRow drNewRow = dtTarget.NewRow();
|
|
|
|
if (cdgSrc.CsmGridGetCell(iRow, 5) == ItemConst.PLU_ITEM_DIV.OPT_MENU || cdgSrc.CsmGridGetCell(iRow, 5) == ItemConst.PLU_ITEM_DIV.SET_DETL)
|
|
{
|
|
drNewRow["NO"] = "";
|
|
}
|
|
else
|
|
{
|
|
drNewRow["NO"] = SelectMaxNo(dtTarget).ToString();
|
|
}
|
|
|
|
drNewRow["ITEMCD"] = cdgSrc.CsmGridGetCell(iRow, 1);
|
|
drNewRow["ITEMNM"] = cdgSrc.CsmGridGetCell(iRow, 2);
|
|
drNewRow["ITEM_DIV"] = cdgSrc.CsmGridGetCell(iRow, 5);
|
|
drNewRow["DC_PRMT_YN"] = cdgSrc.CsmGridGetCell(iRow, 6);
|
|
drNewRow["COST"] = cdgSrc.CsmGridGetCell(iRow, 7);
|
|
drNewRow["SEQ"] = cdgSrc.CsmGridGetCell(iRow, 8);
|
|
drNewRow["UPDATE"] = "U";
|
|
drNewRow["SET_DC_AMT"] = cdgSrc.CsmGridGetCell(iRow, 10);
|
|
drNewRow["ORDER_OK_FLAG"] = cdgSrc.CsmGridGetCell(iRow, 11);
|
|
drNewRow["EXCEP_DC_AMT"] = cdgSrc.CsmGridGetCell(iRow, 13);
|
|
|
|
dtSrc.Rows[iRow]["UPDATE"] = "U";
|
|
|
|
if (AllMove != true)
|
|
{
|
|
// 수량1개
|
|
long nQty = m_cDataService.LongParse(dtSrc.Rows[iRow]["QTY"].ToString());
|
|
double nAmount = m_cDataService.DoubleParse(dtSrc.Rows[iRow]["AMOUNT"].ToString());
|
|
double nDanga = m_cDataService.DoubleParse(dtSrc.Rows[iRow]["COST"].ToString());
|
|
double nEXCEP_DC_AMT = m_cDataService.DoubleParse(dtSrc.Rows[iRow]["EXCEP_DC_AMT"].ToString());
|
|
|
|
if (nQty <= 1)
|
|
{
|
|
// 삭제
|
|
dtSrc.Rows.RemoveAt(iRow);
|
|
}
|
|
else
|
|
{
|
|
// 원시 수량 1차감
|
|
nQty -= 1;
|
|
dtSrc.Rows[iRow]["QTY"] = m_cPosStatus.Global.NumericToQuantity(nQty);
|
|
dtSrc.Rows[iRow]["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(CmUtil.DoubleMultiplication(nQty, nDanga), nEXCEP_DC_AMT)); // 판매금액 재계산
|
|
|
|
// 타켓 수량 1로 설정
|
|
nQty = 1;
|
|
drNewRow["SEQ"] = ""; // 신규생성
|
|
|
|
// 다음 Row 세트자식/부가메뉴
|
|
iRow++;
|
|
}
|
|
|
|
drNewRow["QTY"] = m_cPosStatus.Global.NumericToQuantity(nQty);
|
|
drNewRow["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(CmUtil.DoubleMultiplication(nQty, nDanga), nEXCEP_DC_AMT));
|
|
|
|
cdgSrc.CsmGridDataSource = dtSrc;
|
|
cdgSrc.CsmGridSelectRow(iRow);
|
|
}
|
|
else
|
|
{
|
|
// 전체
|
|
drNewRow["QTY"] = m_cPosStatus.Global.NumericToQuantity(m_cDataService.IntParse(cdgSrc.CsmGridGetCell(iRow, 3)));
|
|
//drNewRow["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(cdgSrc.CsmGridGetCell(iRow, 4)));
|
|
double nQty = m_cDataService.DoubleParse(cdgSrc.CsmGridGetCell(iRow, 3));
|
|
double nCost = m_cDataService.DoubleParse(cdgSrc.CsmGridGetCell(iRow, 7));
|
|
double nEXCEP_DC_AMT = m_cDataService.DoubleParse(cdgSrc.CsmGridGetCell(iRow, 13));
|
|
drNewRow["AMOUNT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(CmUtil.DoubleMultiplication(nQty, nCost), nEXCEP_DC_AMT));
|
|
|
|
// 삭제
|
|
dtSrc.Rows.RemoveAt(iRow);
|
|
cdgSrc.CsmGridDataSource = dtSrc;
|
|
cdgSrc.CsmGridSelectRow(iRow);
|
|
}
|
|
|
|
// 추가
|
|
dtTarget.Rows.Add(drNewRow);
|
|
cdgTaget.CsmGridDataSource = dtTarget;
|
|
cdgTaget.CsmGridSelectRow(cdgTaget.CsmGridRowsCount);
|
|
|
|
// 부가메뉴 체크
|
|
if (cdgSrc.CsmGridRowsCount > iRow)
|
|
{
|
|
if (dtSrc.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.OPT_MENU || dtSrc.Rows[iRow]["ITEM_DIV"].ToString() == ItemConst.PLU_ITEM_DIV.SET_DETL)
|
|
sRet = GridDataSet(cdgSrc, dtSrc, cdgTaget, dtTarget, AllMove, iRow, bDelete);
|
|
}
|
|
|
|
|
|
DataTable dt = null;
|
|
|
|
//if (bDelete == true) //삭제면
|
|
// dt = dtSrc;
|
|
//else
|
|
// dt = dtTarget;
|
|
|
|
//if (dt.Rows.Count > 0)
|
|
//{
|
|
// for (int iLoop = 0; iLoop < dt.Rows.Count; iLoop++)
|
|
// {
|
|
// nPayAmount = CmUtil.DoubleAdd(nPayAmount, m_cDataService.DoubleParse(dt.Rows[iLoop]["AMOUNT"].ToString()));
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// nPayAmount = 0;
|
|
//}
|
|
|
|
// 선택금액
|
|
nPayAmount = 0;
|
|
if (m_dtcglBundleiTem.Rows.Count > 0)
|
|
{
|
|
for (int iLoop = 0; iLoop < m_dtcglBundleiTem.Rows.Count; iLoop++)
|
|
{
|
|
//nPayAmount = CmUtil.DoubleAdd(nPayAmount, m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iLoop]["AMOUNT"].ToString()));
|
|
double nCost = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iLoop]["COST"].ToString());
|
|
double nQty = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iLoop]["QTY"].ToString());
|
|
double nAmount = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iLoop]["AMOUNT"].ToString());
|
|
double nEXCEP_DC_AMT = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iLoop]["EXCEP_DC_AMT"].ToString());
|
|
|
|
if (m_dtcglBundleiTem.Rows[iLoop]["UPDATE"].Equals("U") != true) continue;
|
|
|
|
// 선택금액 = (수량*원가) - 예외할인 + 선택금액
|
|
if (nAmount > 0)
|
|
{
|
|
//nPayAmount = CmUtil.DoubleAdd(nPayAmount, CmUtil.DoubleSubtraction(CmUtil.DoubleMultiplication(nCost, nQty), nEXCEP_DC_AMT));
|
|
//nPayAmount = CmUtil.DoubleAdd(nPayAmount, CmUtil.DoubleSubtraction(nAmount, nEXCEP_DC_AMT));
|
|
nPayAmount = CmUtil.DoubleAdd(nPayAmount, nAmount);
|
|
}
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// for (int iLoop = 0; iLoop < dtSrc.Rows.Count; iLoop++)
|
|
// {
|
|
// nPayAmount = CmUtil.DoubleAdd(nPayAmount, m_cDataService.DoubleParse(dtSrc.Rows[iLoop]["AMOUNT"].ToString()));
|
|
// }
|
|
//}
|
|
|
|
txtPayAmt.Text = m_cPosStatus.Global.NumericTOCurrency(nPayAmount); // 선택금액
|
|
|
|
sRet = UserCom.RST_OK;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
sRet = UserCom.RST_ERR;
|
|
}
|
|
|
|
return sRet;
|
|
}
|
|
#endregion
|
|
|
|
#region 전체상품 할인 처리
|
|
/// <summary>
|
|
/// 전체상품 할인 처리
|
|
/// </summary>
|
|
/// <param name="nSaleAmount"></param>
|
|
/// <param name="nDCAvaAmount"></param>
|
|
/// <param name="nAmount"></param>
|
|
/// <returns></returns>
|
|
public string GetSaleItemSetDC(double nAmount)
|
|
{
|
|
double nSaleAmount = 0, nDCAvaAmount = 0;
|
|
double nPrice = 0, nDCSum = 0, nRate = 0, nDCAmount = 0, nMaxPrice = 0;
|
|
int iIndex = 0;
|
|
Column.TR_PLU.DATA cSaleItem = new Column.TR_PLU.DATA();
|
|
Column.TR_PLU.DATA cNewSaleItem = new Column.TR_PLU.DATA();
|
|
|
|
string sRet = UserCom.RST_ERR;
|
|
|
|
try
|
|
{
|
|
nDCSum = 0;
|
|
nRate = 0;
|
|
nDCAmount = 0;
|
|
nMaxPrice = 0;
|
|
|
|
// 상품정보
|
|
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
|
|
|
|
// 받을금액중 할인 안된 금액만 조회
|
|
nSaleAmount = GetSaleItemDCTargerAmt(true); // 받을 금액
|
|
// 받을금액중 할인 안된 금액만 조회
|
|
nDCAvaAmount = GetSaleItemDCTargerAmt(false); // 할인 대상 금액
|
|
|
|
nDCAmount = CmUtil.DoubleSubtraction(nSaleAmount, nAmount);
|
|
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
// 소스 업데이트
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
for (int iRow = 0; iRow < m_dtcglAlliTem.Rows.Count; iRow++)
|
|
{
|
|
if (m_dtcglAlliTem.Rows[iRow]["UPDATE"].ToString() != "U") continue;
|
|
|
|
if (m_dtcglAlliTem.Rows[iRow]["SEQ"].ToString() != "")
|
|
{
|
|
// 수정인 경우
|
|
int iSeq = CmUtil.IntParse(m_dtcglAlliTem.Rows[iRow]["SEQ"].ToString());
|
|
|
|
cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iSeq];
|
|
}
|
|
else
|
|
{
|
|
// 신규인 경우
|
|
cSaleItem = new Column.TR_PLU.DATA();
|
|
for (int iRow2 = 0; iRow2 < aSaleItem.Count; iRow2++)
|
|
{
|
|
cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow2];
|
|
|
|
if (m_dtcglBundleiTem.Rows[iRow]["ITEMCD"].ToString() == cSaleItem.ITEM_PLU_CD)
|
|
{
|
|
cSaleItem = (Column.TR_PLU.DATA)cSaleItem.Clone();
|
|
cSaleItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
// 기존 수량/금액 변경
|
|
cSaleItem.SALE_AMT = m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["AMOUNT"].ToString());
|
|
cSaleItem.BILL_AMT = m_cDataService.DoubleParse(m_dtcglAlliTem.Rows[iRow]["AMOUNT"].ToString());
|
|
cSaleItem.SALE_QTY = m_cDataService.LongParse(m_dtcglAlliTem.Rows[iRow]["QTY"].ToString());
|
|
|
|
cSaleItem.DC_DIV = ItemConst.PLU_DC_DIV.NORMAL;
|
|
cSaleItem.DC_TYPE = ItemConst.PLU_DC_TYPE.NORMAL;
|
|
|
|
cSaleItem.DC_RATE = 0;
|
|
cSaleItem.ITEM_DC_AMT = 0;
|
|
cSaleItem.CPI_DC_AMT = 0;
|
|
cSaleItem.CPI_PRESENT_DIV = "0";
|
|
|
|
cSaleItem.SET_DC_AMT = 0;
|
|
cSaleItem.SET_DC_GROUP_CD = 0;
|
|
|
|
if (m_cDataService.LongParse(m_dtcglAlliTem.Rows[iRow]["QTY"].ToString()) <= 0)
|
|
cSaleItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
|
|
|
|
if (cSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) cSaleItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD;
|
|
|
|
if (m_dtcglAlliTem.Rows[iRow]["SEQ"].ToString() == "") aSaleItem.Add(cSaleItem);
|
|
|
|
}
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
// 그룹코드 조회
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
ArrayList alSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
|
|
int iSetDCMaxSeq = 1;
|
|
for (int i = 0; i < alSaleItem.Count; i++)
|
|
{
|
|
Column.TR_PLU.DATA cPluItem = (Column.TR_PLU.DATA)alSaleItem[i];
|
|
|
|
if (cPluItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cPluItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue; // 지정취소
|
|
if (cPluItem.DC_PRMT_YN != "0") continue;
|
|
if (cPluItem.SET_DC_GROUP_CD > 0)
|
|
{
|
|
if (iSetDCMaxSeq <= cPluItem.SET_DC_GROUP_CD)
|
|
{
|
|
iSetDCMaxSeq = cPluItem.SET_DC_GROUP_CD + 1;
|
|
}
|
|
}
|
|
}
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
// 타켓 업데이트
|
|
// ---------------------------------------------------------------------------------------------------------
|
|
for (int iRow = 0; iRow < m_dtcglBundleiTem.Rows.Count; iRow++)
|
|
{
|
|
if (m_dtcglBundleiTem.Rows[iRow]["UPDATE"].ToString() != "U") continue;
|
|
|
|
if (m_dtcglBundleiTem.Rows[iRow]["SEQ"].ToString() != "")
|
|
{
|
|
// 수정인 경우
|
|
int iSeq = CmUtil.IntParse(m_dtcglBundleiTem.Rows[iRow]["SEQ"].ToString());
|
|
|
|
cNewSaleItem = (Column.TR_PLU.DATA)aSaleItem[iSeq];
|
|
}
|
|
else
|
|
{
|
|
// 신규인 경우
|
|
cNewSaleItem = new Column.TR_PLU.DATA();
|
|
for (int iRow2 = 0; iRow2 < aSaleItem.Count; iRow2++)
|
|
{
|
|
cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow2];
|
|
|
|
if (m_dtcglBundleiTem.Rows[iRow]["ITEMCD"].ToString() == cSaleItem.ITEM_PLU_CD)
|
|
{
|
|
cNewSaleItem = (Column.TR_PLU.DATA)cSaleItem.Clone();
|
|
cNewSaleItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (cNewSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cNewSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue ;// 지정취소
|
|
//if (cNewSaleItem.DC_DIV == ItemConst.PLU_DC_DIV.FREE) continue; // 서비스(무료)
|
|
/// if (cNewSaleItem.ITEM_DIV != ItemConst.PLU_ITEM_DIV.NORMAL) continue; // 상품구분(일반)
|
|
if (cNewSaleItem.NONSALES_RSN_CD != "0") continue; // 비매출구분
|
|
if (cNewSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
|
|
//if (cNewSaleItem.BILL_AMT <= 0) continue; // 영수금액
|
|
if (cNewSaleItem.DC_PRMT_YN != "0") continue; // 할인가능 여부
|
|
if (cNewSaleItem.FREE_GIFT_YN == "1") continue; // 사은품
|
|
if (cNewSaleItem.SET_DC_GROUP_CD > 0) continue; // 이미 적용
|
|
|
|
cNewSaleItem.SALE_AMT = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iRow]["AMOUNT"].ToString());
|
|
cNewSaleItem.BILL_AMT = m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iRow]["AMOUNT"].ToString());
|
|
cNewSaleItem.SALE_QTY = m_cDataService.LongParse(m_dtcglBundleiTem.Rows[iRow]["QTY"].ToString());
|
|
|
|
cNewSaleItem.DC_DIV = ItemConst.PLU_DC_DIV.NORMAL;
|
|
cNewSaleItem.DC_TYPE = ItemConst.PLU_DC_TYPE.NORMAL;
|
|
|
|
cNewSaleItem.DC_RATE = 0;
|
|
cNewSaleItem.ITEM_DC_AMT = 0;
|
|
cNewSaleItem.CPI_DC_AMT = 0;
|
|
cNewSaleItem.CPI_PRESENT_DIV = "0";
|
|
|
|
cNewSaleItem.SET_DC_AMT = 0;
|
|
cNewSaleItem.SET_DC_GROUP_CD = 0;
|
|
|
|
// 할인 절삭
|
|
nDCAmount = CmUtil.MathRounds(nDCAmount, m_cPosStatus.Mst.DcRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.DcRudDwLoc));
|
|
|
|
// 비율 = 상품금액 / 총판매가 * 100
|
|
//nRate = CmUtil.DoubleMultiplication(CmUtil.DoubleDivision(cNewSaleItem.BILL_AMT, nDCAvaAmount), 100);
|
|
|
|
// 분배금액 = 상품금액 * 비율 / 100
|
|
//nPrice = CmUtil.DoubleDivision(CmUtil.DoubleMultiplication(nDCAmount, nRate), 100);
|
|
|
|
// 금액 배분 절삭
|
|
nPrice = CmUtil.DoubleMultiplication(nDCAmount, CmUtil.DoubleDivision(cNewSaleItem.BILL_AMT, nDCAvaAmount));
|
|
nPrice = CmUtil.MathRounds(nPrice, m_cPosStatus.Mst.DcRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.DcRudDwLoc));
|
|
//nPrice = CmUtil.MathRounds(nPrice, m_cPosStatus.Mst.ItemRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.ItemRudDwLoc));
|
|
if (nPrice > cNewSaleItem.BILL_AMT) continue; // 할인금액이 상품금액보다 클수 없음
|
|
|
|
// 세트 할인 적용
|
|
cNewSaleItem.SET_DC_AMT = nPrice;
|
|
cNewSaleItem.SET_DC_GROUP_CD = iSetDCMaxSeq;
|
|
|
|
// 분배후 짜투리 금액 체크용
|
|
nDCSum = CmUtil.DoubleAdd(nDCSum, nPrice);
|
|
|
|
// 최종 적용 상품 index
|
|
if (nMaxPrice == 0 || nMaxPrice >= cNewSaleItem.BILL_AMT)
|
|
{
|
|
nMaxPrice = cNewSaleItem.BILL_AMT;
|
|
iIndex = iRow;
|
|
}
|
|
|
|
if (m_dtcglBundleiTem.Rows[iRow]["SEQ"].ToString() == "") aSaleItem.Add(cNewSaleItem);
|
|
|
|
if (cNewSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) cNewSaleItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD;
|
|
|
|
// 상품행별 영수 금액 재계산 처리
|
|
m_cDataService.UpdatePluItemAmount(cNewSaleItem);
|
|
}
|
|
|
|
// 짜투리 금액 최종 적용 상품에 추가
|
|
if (nDCSum != nDCAmount)
|
|
{
|
|
// 추가된 Row로 인해 index 재검색
|
|
nMaxPrice = 0;
|
|
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
|
|
{
|
|
cNewSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
|
|
|
|
if (cNewSaleItem.SET_DC_AMT <= 0) continue;
|
|
|
|
// 최종 적용 상품 index
|
|
if (nMaxPrice == 0 || nMaxPrice >= cNewSaleItem.BILL_AMT)
|
|
{
|
|
nMaxPrice = cNewSaleItem.BILL_AMT;
|
|
iIndex = iRow;
|
|
}
|
|
}
|
|
|
|
cNewSaleItem = (Column.TR_PLU.DATA)aSaleItem[iIndex];
|
|
|
|
nPrice = 0;
|
|
nPrice = CmUtil.DoubleSubtraction(nDCAmount, nDCSum);
|
|
|
|
cNewSaleItem.SET_DC_AMT = CmUtil.DoubleAdd(cNewSaleItem.SET_DC_AMT, nPrice); // 세트 할인 금액
|
|
|
|
if (cNewSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) cNewSaleItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD;
|
|
|
|
// 상품행별 영수 금액 재계산 처리
|
|
m_cDataService.UpdatePluItemAmount(cSaleItem);
|
|
}
|
|
|
|
// 상품 판매가 계산
|
|
m_cPluService.ItemAmountExeccute(true, 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>
|
|
/// 전체상품 할인 취소 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string GetSaleItemSetDCCancel()
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
|
|
try
|
|
{
|
|
// 상품정보
|
|
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
|
|
|
|
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
|
|
{
|
|
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
|
|
|
|
if (cSaleItem.SET_DC_AMT <= 0) continue;
|
|
|
|
// 세트 할인 적용
|
|
cSaleItem.SET_DC_AMT = 0;
|
|
cSaleItem.SET_DC_GROUP_CD = 0;
|
|
if (cSaleItem.ORDER_OK_FLAG == PosConst.PLU_ORDER_OK_FLAG.ORDER_OK) cSaleItem.ORDER_OK_FLAG = PosConst.PLU_ORDER_OK_FLAG.ORDER_MOD;
|
|
|
|
// 상품행별 영수 금액 재계산 처리
|
|
m_cDataService.UpdatePluItemAmount(cSaleItem);
|
|
}
|
|
|
|
// 상품 판매가 계산
|
|
m_cPluService.ItemAmountExeccute(true, 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>
|
|
/// 전체 상품중 할인 대상금액 조회
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public double GetSaleItemDCTargerAmt(bool bAllMode)
|
|
{
|
|
double nDCSum = 0;
|
|
|
|
string sRet = UserCom.RST_ERR;
|
|
|
|
try
|
|
{
|
|
nDCSum = 0;
|
|
|
|
for (int iRow = 0; iRow < m_dtcglBundleiTem.Rows.Count; iRow++)
|
|
{
|
|
// 할인 불가 체크
|
|
if (m_dtcglBundleiTem.Rows[iRow]["DC_PRMT_YN"].ToString() != "0") continue;
|
|
if (m_dtcglBundleiTem.Rows[iRow]["UPDATE"].ToString() != "U") continue;
|
|
|
|
// 할인 대상 금액 sum
|
|
nDCSum = CmUtil.DoubleAdd(nDCSum, m_cDataService.DoubleParse(m_dtcglBundleiTem.Rows[iRow]["AMOUNT"].ToString()));
|
|
}
|
|
}
|
|
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 nDCSum;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|