spc-kiosk-pb/Window/WinSale/frmReJournal.cs

1666 lines
77 KiB
C#
Raw Permalink Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Collections;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 영수증 반품
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmReJournal : Form
{
#region Variable
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 ISaleCompleteUs cSaleComplete = null;
private IDataProcessUs m_cDataService = null;
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
private ISaleReceipt m_cTradeDeal = null;
private ISaleRefundUs m_cSaleRefund = null; // 반품처리
private IHpAfterSaveUs m_cHpAfterSave = null; // HP 사후적립
//#20180322 휴게소pos매출연동 start,phj
private IDatabaseSQL m_cSqlDbService = null;
//#20180322 휴게소pos매출연동 end,phj
/// <summary>
/// 영수증 리스트
/// </summary>
private DataTable m_dtSearchList;
/// <summary>
/// 서버 거래 호출 여부
/// </summary>
private bool m_bServerTranCall = false;
private string m_CallBiz = ""; // 호출 화면 구분(판매일때만 복원 보이기하기 위해!)
public string SetCallBiz { set { this.m_CallBiz = value; } }
private bool bDoubleClick = false;
#endregion
#region &
/// <summary>
/// 생성자
/// </summary>
public frmReJournal()
{
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;
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
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_cTradeDeal = (ISaleReceipt)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.SALE_RECEIPT);
m_cSaleRefund = (ISaleRefundUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_REFUND);
m_cHpAfterSave = (IHpAfterSaveUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.HP_AFTER_SAVE);
cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
//#20180322 휴게소pos매출연동 start,phj
m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
//#20180322 휴게소pos매출연동 end,phj
GetBtnImg(); //버튼이미지로드
}
/// <summary>
/// 폼로드
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReJournal_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();
}
/// <summary>
/// 폼클로즈
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReJournal_FormClosing(object sender, FormClosingEventArgs e)
{
vScrollbar.Attach(null);
m_CallBiz = "";
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>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReJournal_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
/// <summary>
/// 폼디엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReJournal_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
btnDate.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.ICON_DATE_BASIC);
//FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
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);
txtPrtData.Font = new Font(m_cPosStatus.Base.FONT_FIX, txtPrtData.Font.Size, txtPrtData.Font.Style);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
//테마색상 적용!
btnPrint.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
btnPluLoad.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0324);
lblSaleDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242);
lblPosNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0370);
//lblTradeNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0346);
lblTradeType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0371);
btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004);
btnPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257);
btnSmiPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0881);
btnPluLoad.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0372);
btnAfCash.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0065);
btnAfPnt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0789);
//#20180322 휴게소pos매출연동 start,phj
btnRestAreaPos.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0874);
//#20180322 휴게소pos매출연동 end,phj
txtSaleDate.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
//dtSaleDate.Value = DateTime.ParseExact(m_cPosStatus.Base.SaleDate, "yyyyMMdd", null);
txtPrtData.Text = "";
txtPosNo.Text = m_cPosStatus.Base.PosNo;
InitializeGrid();
InitComboBox();
m_bServerTranCall = false;
//if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.MENU_EXECUTE)
//{
// btnPluLoad.Visible = false;
// txtBarCode.Size = new Size(420, 40);
//}
//else
//{
// btnPluLoad.Visible = true;
// txtBarCode.Size = new Size(311, 40);
//}
//#20180322 휴게소pos매출연동 start,phj
btnRestAreaPos.Visible = false;
PnlRestposResend.Visible = false;
if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_KOR_03)
{
InitRestposResend();
btnResend.Visible = true;
btnResendClose.Visible = true;
PnlRestposResend.Left = txtPrtData.Left;
//PnlRestposResend.Width = txtPrtData.Width;
PnlRestposResend.Top = txtBarCode.Top;
PnlRestposResend.Height = txtBarCode.Height;
btnRestAreaPos.Visible = true;
}
//#20180322 휴게소pos매출연동 end,phj
btnAfCash.Visible = false;
btnAfPnt.Visible = false;
txtSaleDate.ReadOnly = false;
btnDate.Enabled = true;
vScrollbar.Attach(txtPrtData);
bDoubleClick = false;
if (m_CallBiz == "")
{
txtBarCode.Visible = false;
btnPluLoad.Visible = false;
}
else
{
txtBarCode.Visible = true;
btnPluLoad.Visible = true;
txtBarCode.Text = "";
txtBarCode.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);
}
}
//#20180322 휴게소pos매출연동 start,phj
private void InitRestposResend()
{
try
{
cmbRestposResend.Items.Clear();
cmbRestposResend.Items.Add(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1115));//전체 재전송
cmbRestposResend.Items.Add(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1116));//단건 재전송
cmbRestposResend.Items.Add(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1117));//정산 재전송
cmbRestposResend.SelectedIndex = 0;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
//#20180322 휴게소pos매출연동 end,phj
/// <summary>
/// 그리드 초기화
/// </summary>
private void InitializeGrid()
{
try
{
grdSearchList.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
grdSearchList.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12);
grdSearchList.CsmGridColumnHeadersHeight = 38; //DataGridView 자체의 컬럼 헤더 높이
grdSearchList.CsmGridRowsHeight = 35;
grdSearchList.CsmGridColumnCount = 16; //그리드의 컬럼수
grdSearchList.CsmGridShowPageRowsCount = 9; //그리드의 한 화면에 보이는 로우수
grdSearchList.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
grdSearchList.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
grdSearchList.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
grdSearchList.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
grdSearchList.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
grdSearchList.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
grdSearchList.CsmGridSetColumnWidth(new int[] { 100, 50, 100, 80, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0 }); //컬럼넓이 지정
grdSearchList.CsmGridAlignment(new int[] { 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
//각 컬럼별 이름 지정(영업일자,POS번호,판매금액,거래번호,거래시간,거래구분,)
grdSearchList.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242));
grdSearchList.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0377));
grdSearchList.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348));
grdSearchList.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0378));
grdSearchList.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0347));
grdSearchList.CsmGridColumnName(5, "TRADE_KIND");
grdSearchList.CsmGridColumnName(6, "ORG_INFO");
grdSearchList.CsmGridColumnName(7, "RTN_INFO");
grdSearchList.CsmGridColumnName(8, "AF_CASH");
grdSearchList.CsmGridColumnName(9, "AF_POINT");
grdSearchList.CsmGridColumnName(10, "CASH_APP_AMT");
grdSearchList.CsmGridColumnName(11, "NET_SALE_AMT");
grdSearchList.CsmGridColumnName(12, "TOT_VAT");
grdSearchList.CsmGridColumnName(13, "AF_ACCUM_POINT_AMT");
grdSearchList.CsmGridColumnName(14, "AF_ACCUM_POINT_INFO");
grdSearchList.CsmGridColumnName(15, "SYS_DT");
//그리드 초기화 테이블
m_dtSearchList = new DataTable("REFUND_INIT");
m_dtSearchList.Columns.Add(new DataColumn("SALE_DT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("POS_NO", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("TOTSALE_AMT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("TRADE_NO", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("SYS_TIME", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("TRADE_KIND", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("ORG_INFO", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("RTN_INFO", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("AF_CASH", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("AF_POINT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("CASH_APP_AMT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("NET_SALE_AMT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("TOT_VAT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("AF_ACCUM_POINT_AMT", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("AF_ACCUM_POINT_INFO", typeof(string)));
m_dtSearchList.Columns.Add(new DataColumn("SYS_DT", typeof(string)));
m_dtSearchList.Clear();
}
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>
private void InitComboBox()
{
try
{
cbTradeType.Items.Clear();
cbTradeType.Items.Add("0. " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226));
//cbTradeType.Items.Add("1. " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0076));
cbTradeType.Items.Add("2. " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0075));
cbTradeType.Items.Add("3. " + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0345));
cbTradeType.SelectedIndex = 0;
}
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>
private void GetBtnImg()
{
try
{
//승인 종류 버튼 테마색상 적용!
if (m_cPosStatus.ScnMst.ThemeColor.Length == 9)
{
btnPrint.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
btnPluLoad.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
}
//네이게이션 버튼 이미지 적용!
btnUp.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP1_BASIC);
btnUp.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP1_PRESS);
btnUp2.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP2_BASIC);
btnUp2.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP2_PRESS);
btnDw.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN1_BASIC);
btnDw.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN1_PRESS);
btnDw2.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN2_BASIC);
btnDw2.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN2_PRESS);
}
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 Control Event
#region
/// <summary>
/// 버튼 입력 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnProc_Click(object sender, EventArgs e)
{
try
{
string sPosMenuKeyIn = string.Empty;
if (bDoubleClick == true) return;
bDoubleClick = true;
if (((Cosmos.UI.CsmButton)sender) == btnAfCash)
{
//#20171227 인천공항 포스연동 start, phj
if (PosMstManager.GetPosOption(POS_OPTION.OPT512) == "1")
{
WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0745);
return;
}
//#20171227 인천공항 포스연동 end, phj
sPosMenuKeyIn = PosKey.MENU_KEY.CASH_APPROVAL_LATER;
}
else if (((Cosmos.UI.CsmButton)sender) == btnAfPnt)
{
sPosMenuKeyIn = PosKey.MENU_KEY.HPP_APPROVAL_LATER;
}
// 현금영수증추후발행/포인트추후적립 에 대해 권한 체크 추가(2017.07.10)
if (WinBasic.CheckMenuKeyAuth(sPosMenuKeyIn) == false) return;
if (((Cosmos.UI.CsmButton)sender) == btnSearch) // 조회
{
TradeDealSearch("", "", "", "");
}
else if (((Cosmos.UI.CsmButton)sender) == btnPrint || ((Cosmos.UI.CsmButton)sender) == btnSmiPrint) // 출력
{
PrintTradeDeal(((Cosmos.UI.CsmButton)sender).Name);
}
else if (((Cosmos.UI.CsmButton)sender) == btnPluLoad) // 내역복원
{
LoadPluTrade();
}
else if (((Cosmos.UI.CsmButton)sender) == btnAfCash) // 현금영수증 추후 발행
{
CompleteCashTrade();
}
else if (((Cosmos.UI.CsmButton)sender) == btnAfPnt) // 포인트 추후 발행
{
CompleteTrade();
}
//#20180322 휴게소pos매출연동 start,phj
else if (((Cosmos.UI.CsmButton)sender) == btnRestAreaPos) // 도로공사휴게소POS
{
RestposResend("0");
}
else if (((Cosmos.UI.CsmButton)sender) == btnResend) // 도로공사휴게소POS재전송- 재전송
{
RestposResend("1");
}
else if (((Cosmos.UI.CsmButton)sender) == btnResendClose)// 도로공사휴게소POS재전송- 닫기
{
RestposResend("2");
}
//#20180322 휴게소pos매출연동 end,phj
else if (((Cosmos.UI.CsmButton)sender) == btnExit)
{
m_cDataService.TranComplete();
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);
}
finally
{
bDoubleClick = false;
}
}
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
try
{
if ((UI.CsmButton)sender == btnUp2)
{
grdSearchList.CsmGridScroll("PAGE UP");
}
else if ((UI.CsmButton)sender == btnUp)
{
grdSearchList.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
grdSearchList.CsmGridScroll("DOWN");
}
else if ((UI.CsmButton)sender == btnDw2)
{
grdSearchList.CsmGridScroll("PAGE DOWN");
}
}
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
/// <summary>
/// 그리드 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="rowIndex"></param>
private void grdSearchItem_GridClickEvent(object sender, string rowIndex)
{
try
{
txtPrtData.Text = "";
txtPrtData.Tag = "";
if (grdSearchList.CsmGridRowsCount == 0) return;
int nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) return;
//(영업일자,POS번호,판매금액,거래번호,거래시간,거래구분)
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sNetAmt = grdSearchList.CsmGridGetCell(nRow, 2);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
string sTradeKind = grdSearchList.CsmGridGetCell(nRow, 5);
string sOrgInfo = grdSearchList.CsmGridGetCell(nRow, 6);
string sRtnInfo = grdSearchList.CsmGridGetCell(nRow, 7);
string sAfCash = grdSearchList.CsmGridGetCell(nRow, 8);
string sAfPnt = grdSearchList.CsmGridGetCell(nRow, 9);
string sSysDate = grdSearchList.CsmGridGetCell(nRow, 15);
if (sSysDate != DateTime.Now.ToString("yyyyMMdd"))
{
//거래 시스템일자 와 금일과 같지 않으면 비활성화!
btnAfCash.Visible = false;
//btnAfPnt.Visible = false;
}
else
{
//현금영수증 추후 발행 활성화
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR
&& sAfCash == "0" && sTradeKind.StartsWith(ItemConst.TRAN_DIV.NORMAL) == true && sRtnInfo == "")
btnAfCash.Visible = true;
else
btnAfCash.Visible = false;
}
//포인트 추후 발행 활성화
if (sAfPnt == "0" && sTradeKind.StartsWith(ItemConst.TRAN_DIV.NORMAL) == true && sRtnInfo == "")
btnAfPnt.Visible = true;
else
btnAfPnt.Visible = false;
// 저널 데이터 조회
string sJnlData = m_cSaleRefund.SearchPrintSaleReceiptDetail(sSaleDate, sPosNo, sTradeNo);
string sJnlText = "";
if ( sTradeKind.StartsWith(ItemConst.TRAN_DIV.REFUND) == true)
{
// 반품 영수증
sJnlText += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0249) + PosConst.CRLF;
if (sOrgInfo.Length >= 15)
sJnlText += " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0250) + " " + sOrgInfo.Substring(0, 8) + "-" + sOrgInfo.Substring(8, 2) + "-" + sOrgInfo.Substring(10, 5)
+ PosConst.CRLF + PosConst.CRLF;
}
else if (sRtnInfo != "")
{
// 반품된 영수증
sJnlText += MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0251) + PosConst.CRLF;
if (sRtnInfo.Length >= 15)
sJnlText += " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0252) + " " + sRtnInfo.Substring(0, 8) + "-" + sRtnInfo.Substring(8, 2) + "-" + sRtnInfo.Substring(10, 5)
+ PosConst.CRLF + PosConst.CRLF;
}
int iDataLen = 0;
//1.추후적립 내역이 있는지 확인 한다!
//2.데이터를 담아 둔다(커팅 제외)
//3.원거래 읽어 온다
//4.1 추후가 있으면 바코드 또는 고객용을 체크한다
//4.2 추후영수증을 넣는다.
//4.3 추후가 없으면 현재 영수증을 넣는다.
string sAfterJnlData = "";
string sAfterJnlText = "";
// 추후적립 내역
//ISaleCompleteUs cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
string sAftData = cSaleComplete.AddHappyPointAfterSave(sSaleDate, sPosNo, sTradeNo);
if (sAftData != "")
{
//string sLine = "";
//string sLine1 = "";
iDataLen = 0;
while (iDataLen <= CmUtil.LenH(sAftData))
{
//if (iDataLen == 0)
//{
// sLine = CmUtil.MidH(sAftData, iDataLen + 5, 42) + PosConst.CRLF;
// sLine1 = CmUtil.MidH(sAftData, iDataLen, 47);
//}
//else
//{
string tt = CmUtil.MidH(sAftData, iDataLen + 5, 42);
if (CmUtil.MidH(sAftData, iDataLen + 5, 42).Trim() != "")
{
sAfterJnlText += CmUtil.MidH(sAftData, iDataLen + 5, 42) + PosConst.CRLF;
if (CmUtil.MidH(sAftData, iDataLen, 5) != PosConst.PRT_HDR.PRT_CUT)
{
sAfterJnlData += CmUtil.MidH(sAftData, iDataLen, 47);
}
}
//}
iDataLen += 47;
}
//sAfterJnlText += sLine;
//sAfterJnlData += sLine1;
}
string sPrtJnlData = "";
iDataLen = 0;
// 저널 텍스트 편집
while (iDataLen <= CmUtil.LenH(sJnlData))
{
string sJnlHdr = CmUtil.MidH(sJnlData, iDataLen, 5);
if (sJnlHdr == PosConst.PRT_HDR.PRT_HOR || sJnlHdr == PosConst.PRT_HDR.PRT_BIG)
{
if (m_cDataService.DoubleParse(CmUtil.MidH(sJnlData, iDataLen + 5 + 11, 11).Trim()) != 0)
sJnlText += CmUtil.MidH(sJnlData, iDataLen + 5, 11) + CmUtil.LPadH(CmUtil.MidH(sJnlData, iDataLen + 5 + 11, 11), 32) + PosConst.CRLF;
else
sJnlText += CmUtil.MidH(sJnlData, iDataLen + 5, 42) + PosConst.CRLF;
}
//#20180625 영수증반품, 영수증재발행에서 영수증 조회시 추후적립내역 미표시 증상 수정 start
//기존
//else if (sAfterJnlText != "" && (sJnlHdr == PosConst.PRT_HDR.PRT_BA1 || CmUtil.MidH(sJnlData, iDataLen + 5, 42).Trim().Replace("[", "").StartsWith(MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0136))))
//변경
else if (sAfterJnlText != "" &&
(sJnlHdr == PosConst.PRT_HDR.PRT_BA1 ||
sJnlHdr == PosConst.PRT_HDR.PRT_BAR ||
CmUtil.MidH(sJnlData, iDataLen + 5, 42).Trim().Replace("[", "").StartsWith(MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0136))))
//#20180625 영수증반품, 영수증재발행에서 영수증 조회시 추후적립내역 미표시 증상 수정 end
{
sJnlText += sAfterJnlText;
sPrtJnlData += sAfterJnlData;
sJnlText += CmUtil.MidH(sJnlData, iDataLen + 5, 42) + PosConst.CRLF;
sAfterJnlText = "";
sAfterJnlData = "";
}
else
{
sJnlText += CmUtil.MidH(sJnlData, iDataLen + 5, 42) + PosConst.CRLF;
}
sPrtJnlData += CmUtil.MidH(sJnlData, iDataLen, 47);
//#Rhee 20180308 미주 영수증 미리보기창에서 영수증 번호 표기 추가 Start
if ((iDataLen) == 329 && m_cPosStatus.Base.CmpCd.Equals("PCUS"))
{
sJnlText += "Bill number : " + sTradeNo + " " + PosConst.CRLF;
}
//#Rhee 20180308 미주 영수증 미리보기창에서 영수증 번호 표기 추가 End
iDataLen += 47;
}
txtPrtData.Text = sJnlText;
txtPrtData.Tag = sPrtJnlData;
}
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 Control_SelectedIndexChanged(object sender, EventArgs e)
{
txtBarcodeSetFocus();
}
private void txtPrtData_Enter(object sender, EventArgs e)
{
txtBarcodeSetFocus();
}
private void grdSearchList_Enter(object sender, EventArgs e)
{
txtBarcodeSetFocus();
}
private void txtBarcodeSetFocus()
{
try
{
txtBarCode.Text = "";
txtBarCode.Focus();
}
catch { }
}
#endregion
#region User Method
/// <summary>
/// 거래 데이터 조회
/// </summary>
private void TradeDealSearch(string sSaleDate, string sPosNo, string sTradeNo, string sPayTime)
{
try
{
if (sSaleDate == "" && txtSaleDate.Text.Length != 10)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0186));
return;
}
m_bServerTranCall = false;
txtPrtData.Text = "";
txtPrtData.Tag = "";
m_dtSearchList.Clear();
string sTradeType = "0";
if ( sSaleDate == "")
{
sSaleDate = m_cPosStatus.Global.CultureToDate(txtSaleDate.Text);
//sSaleDate = dtSaleDate.Value.ToString("yyyyMMdd");
//sPosNo = m_cPosStatus.Base.PosNo;
sPosNo = txtPosNo.Text;
sTradeNo = "";
sTradeType = cbTradeType.Text.Substring(0, 1);
}
// 거래데이터 조회
DataTable dtData = m_cTradeDeal.SearchSaleReceiptList(sSaleDate, sPosNo, sTradeNo, sPayTime, sTradeType);
if (dtData != null && dtData.Rows.Count > 0)
{
foreach (DataRow dr in dtData.Rows)
{
DataRow drNewRow = m_dtSearchList.NewRow();
drNewRow["SALE_DT"] = m_cPosStatus.Global.DateToCulture(CmUtil.GetDataRowStr(dr, "SALE_DT"));
drNewRow["POS_NO"] = CmUtil.GetDataRowStr(dr, "POS_NO");
int nSign = CmUtil.GetDataRowStr(dr, "TRADE_DIV") == "1" ? -1 : 1;
drNewRow["TOTSALE_AMT"] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "NET_SALE_AMT") * nSign);
drNewRow["TRADE_NO"] = CmUtil.GetDataRowStr(dr, "TRADE_NO");
drNewRow["SYS_TIME"] = CmUtil.StrToTime(CmUtil.GetDataRowStr(dr,"PAY_TIME"));
drNewRow["TRADE_KIND"] = CmUtil.GetDataRowStr(dr,"TRADE_DIV") + CmUtil.GetDataRowStr(dr,"TRADE_KINDPER");
drNewRow["ORG_INFO"] = CmUtil.GetDataRowStr(dr,"ORG_INFO");
drNewRow["RTN_INFO"] = CmUtil.GetDataRowStr(dr,"RTN_INFO");
drNewRow["AF_CASH"] = CmUtil.GetDataRowStr(dr, "AF_CASH");
drNewRow["AF_POINT"] = CmUtil.GetDataRowStr(dr, "AF_POINT");
drNewRow["CASH_APP_AMT"] = CmUtil.GetDataRowStr(dr, "CASH_APP_AMT");
drNewRow["NET_SALE_AMT"] = CmUtil.GetDataRowStr(dr, "NET_SALE_AMT");
drNewRow["TOT_VAT"] = CmUtil.GetDataRowStr(dr, "TOT_VAT");
drNewRow["AF_ACCUM_POINT_AMT"] = CmUtil.GetDataRowStr(dr, "AF_ACCUM_POINT_AMT");
drNewRow["AF_ACCUM_POINT_INFO"] = CmUtil.GetDataRowStr(dr, "AF_ACCUM_POINT_INFO");
drNewRow["SYS_DT"] = CmUtil.GetDataRowStr(dr, "SYS_DT");
m_dtSearchList.Rows.Add(drNewRow);
}
}
else
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
}
//그리드 적용
grdSearchList.CsmGridDataSource = m_dtSearchList;
grdSearchList.CsmGridIndicateForeColor = Color.Red;
if (dtData != null && dtData.Rows.Count > 0)
{
int nRow = 0;
foreach (DataRow dr in dtData.Rows)
{
if (CmUtil.GetDataRowStr(dr, "TRADE_DIV") == "1" || CmUtil.GetDataRowStr(dr, "RTN_INFO") != "")
grdSearchList.CsmGridIndicateRow(nRow, true);
nRow++;
}
}
grdSearchList.CsmGridSelectRow(0);
//grdSearchItem_GridClickEvent(null, null);
}
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>
/// <returns></returns>
private bool PrintTradeDeal(string sName)
{
bool bRet = false;
string sTmpDate = "";
string sPrtData = "";
try
{
if (txtPrtData.Tag.ToString() == "")
{
return bRet;
}
sTmpDate = txtPrtData.Tag.ToString();
if (sName == "btnSmiPrint")
{
bool bSkip = false;
int iDataLen = 0;
while (iDataLen <= CmUtil.LenH(sTmpDate))
{
string sLineData = CmUtil.MidH(sTmpDate, iDataLen , 47);
if (sLineData.Substring(5).Trim().StartsWith(MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0101))) //시작
{
bSkip = true;
}
else if (sLineData.Substring(5).Trim().StartsWith(MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0007))) //종료
{
bSkip = false;
}
if (bSkip == false)
sPrtData += sLineData;
iDataLen += 47;
}
}
else
{
sPrtData = txtPrtData.Tag.ToString();
}
bRet = m_cTradeDeal.PrintSaleReceipt(sPrtData);
int nRow = grdSearchList.CsmGridSelectedRowIndex;
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
//기타 헤더 저장!
cSaleComplete.EtcLogTrSave(ItemConst.TRAN_KIND.LOG.RE_PRINT, false, sSaleDate, sPosNo, sTradeNo);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
//#20180322 휴게소pos매출연동 start,phj
/// <summary>
/// 도로공사 POS 재전송
/// </summary>
/// <returns></returns>
private void RestposResend(string sType)
{
string sSaleDate = string.Empty;
string sPosNo = string.Empty;
string sTradeNo = string.Empty;
string sReSendTp = string.Empty;
string sMsg = string.Empty;
int nRow = -1;
try
{
if (m_cPosStatus.RestAreaPos.RestAreaPosDir == "" ||
m_cPosStatus.RestAreaPos.RestAreaPosGroupCd == "" ||
m_cPosStatus.RestAreaPos.RestAreaPosPosGroupCd == "" ||
m_cPosStatus.RestAreaPos.RestAreaPosCd == "" ||
m_cPosStatus.RestAreaPos.RestAreaPosPosNo == "")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0771));
return;
}
if (grdSearchList.CsmGridRowsCount == 0)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
return;
}
if (sType == "0")
{
cmbRestposResend.SelectedIndex = 0;
PnlRestposResend.Visible = true;
// 20180404 두번째 화면 오픈 시 패널이 뒤로 숨는 현상 수정.
btnRestAreaPos.Visible = false;
}
else if (sType == "1")
{
nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) { return;}
sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
sReSendTp = cmbRestposResend.SelectedIndex.ToString(); // 재전송타입 (0: 전체 재전송 , 1:단 건 재전송 , 2 : 정산 재전송)
if (sReSendTp == ItemConst.RESTPOS_RESEND.EACH_RESEND)
{
sMsg = grdSearchList.CsmGridGetCell(nRow, 0) + " BILL: " + sTradeNo + " POS: " + sPosNo + PosConst.CRLF + cmbRestposResend.Items[cmbRestposResend.SelectedIndex].ToString() + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0773);
}
else
{
sMsg = grdSearchList.CsmGridGetCell(nRow, 0) + " POS: " + sPosNo + PosConst.CRLF + cmbRestposResend.Items[cmbRestposResend.SelectedIndex].ToString() + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0773);
}
if (WinManager.QuestionMessage(sMsg) != true) return;
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
" 도로공사 휴게소POS 재전송 시도! " + " 영업일자:" + sSaleDate + " 영수증번호:" + sTradeNo + " 포스번호:" + sPosNo + " 타입:" + sReSendTp + "(0:전체,1:단건)");
if (sReSendTp == ItemConst.RESTPOS_RESEND.ADMT_RESEND)
{
//고속도로 휴게소 입점 POS (2018)
ICalDataIF cCalDataIF = (ICalDataIF)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CAL_DATA_IF);
cCalDataIF.Execute(new string[] { "EX2018", sSaleDate });
}
else
{
RestAreaPosReSend(sReSendTp, sSaleDate, sPosNo, sTradeNo);
}
}
else if (sType == "2")
{
//닫기
cmbRestposResend.SelectedIndex = 0;
PnlRestposResend.Visible = false;
// 20180404 두번째 화면 오픈 시 패널이 뒤로 숨는 현상 수정.
btnRestAreaPos.Visible = 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);
}
}
//#20180322 휴게소pos매출연동 end,phj
/// <summary>
/// 추후 적립 처리
/// </summary>
/// <returns></returns>
private bool CompleteTrade()
{
bool bRet = false;
try
{
if (grdSearchList.CsmGridRowsCount == 0) return false;
int nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) return false;
//영업일자,POS번호,판매금액,거래번호,거래시간,사후적립금액,추가적립정보
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sNetSaleAmt = grdSearchList.CsmGridGetCell(nRow, 11);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
string sTradeTm = grdSearchList.CsmGridGetCell(nRow, 4);
string sPointAmt = grdSearchList.CsmGridGetCell(nRow, 13);
string sPointInfo = grdSearchList.CsmGridGetCell(nRow, 14);
string sSysDate = grdSearchList.CsmGridGetCell(nRow, 15);
double nAddHours = CmUtil.LongParse(PosMstManager.GetPosOption(POS_OPTION.OPT016));
if (nAddHours == 24) //24일경우 당일만
{
if (CmUtil.LongParse(sSysDate) != CmUtil.LongParse(DateTime.Now.ToString("yyyyMMdd")))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0395);
return false;
}
}
else if (nAddHours > 0)
{
DateTime dtSaleDT = new DateTime(CmUtil.IntParse(sSysDate.Substring(0, 4)),
CmUtil.IntParse(sSysDate.Substring(4, 2)),
CmUtil.IntParse(sSysDate.Substring(6, 2)),
CmUtil.IntParse(sTradeTm.Substring(0, 2)),
CmUtil.IntParse(sTradeTm.Substring(2, 2)), 0);
if (dtSaleDT.AddHours(nAddHours) < DateTime.Now)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0395);
return false;
}
}
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0270) != true) return bRet;
// 추후적립 가능 여부 체크 처리
bRet = m_cHpAfterSave.ChekcAfterSaveTran(sSaleDate, sPosNo, sTradeNo);
if (bRet == false) return bRet;
// 추후 적립 처리(중국 추후적립 2017.06.02)
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.CN)
{
frmPointHappyPointAfter_China fFormPay = (frmPointHappyPointAfter_China)FormManager.GetForm(FormManager.FORM_POINT_HAPPYPOINT_AFTER);
if (fFormPay == null)
{
fFormPay = new frmPointHappyPointAfter_China();
FormManager.AddForm(FormManager.FORM_POINT_HAPPYPOINT_AFTER, fFormPay);
}
fFormPay.SaleDateTime = m_cPosStatus.Global.DateToCulture(sSaleDate) + " " + CmUtil.StrToTime(sTradeTm);
fFormPay.NetSaleAmt = m_cDataService.DoubleParse(sNetSaleAmt);
fFormPay.AfterSaveAmt = m_cDataService.DoubleParse(sPointAmt);
fFormPay.AfterSaveInfo = sPointInfo;
if (fFormPay.ShowDialog() != DialogResult.OK) return false;
}
else
{
frmPointHappyPointAfter fFormPay = (frmPointHappyPointAfter)FormManager.GetForm(FormManager.FORM_POINT_HAPPYPOINT_AFTER);
if (fFormPay == null)
{
fFormPay = new frmPointHappyPointAfter();
FormManager.AddForm(FormManager.FORM_POINT_HAPPYPOINT_AFTER, fFormPay);
}
fFormPay.SaleDateTime = m_cPosStatus.Global.DateToCulture(sSaleDate) + " " + CmUtil.StrToTime(sTradeTm);
fFormPay.NetSaleAmt = m_cDataService.DoubleParse(sNetSaleAmt);
fFormPay.AfterSaveAmt = m_cDataService.DoubleParse(sPointAmt);
fFormPay.AfterSaveInfo = sPointInfo;
if (fFormPay.ShowDialog() != DialogResult.OK) return false;
}
// 거래구분 설정 => 사후적립
m_cTrnStatus.Head.TradeDiv = ItemConst.TRAN_DIV.NORMAL;
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.AFTER.HP_SAVE;
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
// 거래 완료 처리
ISaleCompleteUs m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
string sRet = m_cSaleComplete.PosSaleExecute(new string[] { });
if (sRet != UserCom.RST_OK) return bRet;
// 거래데이터 재조회
if (m_bServerTranCall == false)
{
TradeDealSearch("", "", "", "");
}
else
{
TradeDealSearch(sSaleDate, sPosNo, sTradeNo, "");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
/// <summary>
/// 추후 현금 영수증 처리
/// </summary>
/// <returns></returns>
private bool CompleteCashTrade()
{
bool bRet = false;
try
{
if (grdSearchList.CsmGridRowsCount == 0) return false;
int nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) return false;
//영업일자,POS번호,판매금액,거래번호,거래시간,사후적립금액,추가적립정보
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sNetSaleAmt = grdSearchList.CsmGridGetCell(nRow, 11);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
string sTaxAmt = grdSearchList.CsmGridGetCell(nRow, 12);
string sCashAmt = grdSearchList.CsmGridGetCell(nRow, 10);
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0564) != true) return bRet;
//if (m_bServerTranCall == false)
//{
// // 사후적립 가능 여부 체크 처리
// bRet = m_cHpAfterSave.ChekcAfterSaveTran(sSaleDate, sPosNo, sTradeNo);
// if (bRet == false) return bRet;
//}
// 거래구분 설정 => 사후적립
m_cTrnStatus.Head.TradeDiv = ItemConst.TRAN_DIV.NORMAL;
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.AFTER.CASH_RECEIPT;
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
//사후 적립 처리
//부가세 계산
double dTax = CmUtil.DoubleMultiplication(m_cDataService.DoubleParse(sTaxAmt), CmUtil.DoubleDivision(m_cDataService.DoubleParse(sCashAmt), m_cDataService.DoubleParse(sNetSaleAmt)));
dTax = CmUtil.MathRounds(dTax, m_cPosStatus.Mst.VatRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.VatRudDwLoc));
// 현금 화면 진행
string sRet = WinPay.ShowForm(new string[] { FormManager.FORM_PAY_CASH_APPROVAL, PosKey.MENU_KEY.CASH_APPROVAL_LATER_RECEIPT, m_cDataService.DoubleParse(sCashAmt).ToString(), dTax.ToString() });
if (sRet != UserCom.RST_OK)
{
m_cDataService.TranComplete();
return false;
}
// 거래 완료 처리
ISaleCompleteUs m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
sRet = m_cSaleComplete.PosSaleExecute(new string[] { });
if (sRet != UserCom.RST_OK) return bRet;
// 거래데이터 재조회
if (m_bServerTranCall == false)
{
TradeDealSearch("", "", "", "");
}
else
{
TradeDealSearch(sSaleDate, sPosNo, sTradeNo, "");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
/// <summary>
/// 반품처리
/// </summary>
/// <returns></returns>
private bool ReturnTrade()
{
bool bRet = false;
try
{
string sNewTradeNo = m_cPosStatus.Base.TradeNo;
if (grdSearchList.CsmGridRowsCount == 0) return false;
int nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) return false;
//(영업일자,POS번호,판매금액,거래번호,거래시간,거래구분)
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
string sTradeKind = grdSearchList.CsmGridGetCell(nRow, 5);
string sOrgInfo = grdSearchList.CsmGridGetCell(nRow, 6);
string sRtnInfo = grdSearchList.CsmGridGetCell(nRow, 7);
if (sTradeKind.StartsWith(ItemConst.TRAN_DIV.REFUND) == true)
{
// 반품 영수증
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0230);
return bRet;
}
else if (sRtnInfo != "")
{
// 반품된 영수증
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0229);
return bRet;
}
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0253) != true) return bRet;
if (m_bServerTranCall == false)
{
// 거래데이터 로딩 처리
bRet = m_cSaleRefund.LoadLocalTran(sSaleDate, sPosNo, sTradeNo);
if (bRet == false) return bRet;
}
// 반품 사유코드 등록
frmSelReasonCode fForm = (frmSelReasonCode)FormManager.GetForm(FormManager.FORM_REASON_CODE);
if (fForm == null)
{
fForm = new frmSelReasonCode();
FormManager.AddForm(FormManager.FORM_REASON_CODE, fForm);
}
fForm.ReasonGroup = PosConst.COMMON_CODE_GROUP.Z0008; // 사유 그룹코드
if (fForm.ShowDialog() != DialogResult.OK)
{
m_cDataService.TranComplete();
return false;
}
m_cTrnStatus.Head.RtnReasonCd = fForm.ReasonCode; // 선택된 사유코드
m_cTrnStatus.Head.RtnReasonMemo = fForm.ReasonName; // 선택된 사유명
// 거래구분 설정 => 반품
m_cTrnStatus.Head.TradeDiv = ItemConst.TRAN_DIV.REFUND;
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
// 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePluAmount();
// 영수증 반품
frmRefundPay fFormPay = (frmRefundPay)FormManager.GetForm(FormManager.FORM_SAL_RETURN_RECEIPT_PAY);
if (fFormPay == null)
{
fFormPay = new frmRefundPay();
FormManager.AddForm(FormManager.FORM_SAL_RETURN_RECEIPT_PAY, fFormPay);
}
if (fFormPay.ShowDialog() != DialogResult.OK)
{
m_cDataService.TranComplete();
return false;
}
this.Update();
// 거래 완료 처리
ISaleCompleteUs m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
string sRet = m_cSaleComplete.PosSaleExecute(new string[] { });
if (sRet != UserCom.RST_OK) return bRet;
// 거래데이터 재조회
if (m_bServerTranCall == false)
{
TradeDealSearch("", "", "", "");
}
else
{
TradeDealSearch(m_cPosStatus.Base.SaleDate, m_cPosStatus.Base.PosNo, sNewTradeNo, "");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
/// <summary>
/// 내역 불러오기
/// </summary>
/// <returns></returns>
private bool LoadPluTrade()
{
bool bRet = false;
try
{
if (m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.MENU_EXECUTE) return false;
if (grdSearchList.CsmGridRowsCount == 0) return false;
int nRow = grdSearchList.CsmGridSelectedRowIndex;
if (nRow < 0) return false;
//(영업일자,POS번호,판매금액,거래번호,거래시간,거래구분)
string sSaleDate = m_cPosStatus.Global.CultureToDate(grdSearchList.CsmGridGetCell(nRow, 0));
string sPosNo = grdSearchList.CsmGridGetCell(nRow, 1);
string sTradeNo = grdSearchList.CsmGridGetCell(nRow, 3);
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0254) != true) return bRet;
// 거래데이터 로딩 처리
bRet = m_cSaleRefund.LoadLocalTranPlu(sSaleDate, sPosNo, sTradeNo);
if (bRet == false) return bRet;
ISalePluItemUs cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
//#17199 PB 대구남산_ [영수증-내역복원]시 임의할인된 내역도 포함되도록 개선 요청. start
//기존
cPluService.ItemDcAllClear(true, true);
//변경
//cPluService.ItemDcAllClear(true, true, false);
//#17199 PB 대구남산_ [영수증-내역복원]시 임의할인된 내역도 포함되도록 개선 요청. end
this.DialogResult = DialogResult.OK;
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);
}
return bRet;
}
#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.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>
/// SCANNER Event
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void OnScannerEvent(object source, EventArgs e)
{
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);
}
}
#endregion DeviceEvent
/// <summary>
/// 입력박스 (바코드 입력 처리)
/// </summary>
/// <param name="sender"></param>
/// <param name="sFuncValue"></param>
private void txtBarCode_EditBoxKeyDownEvent(object sender, string sFuncValue)
{
try
{
if (sFuncValue == PosKey.MENU_KEY.ENTER)
{
//#20170623, 해피앱 추후적립_바코드 수정_lsr Start
// 기존
/*if (txtBarCode.Text.Length != 16)
{
txtBarCode.Text = "";
return;
}
m_bServerTranCall = false;
string sSaleDate = txtBarCode.Text.Substring(0, 8);
string sPosNo = txtBarCode.Text.Substring(8, 2);
string sSaleTime = txtBarCode.Text.Substring(10, 6);
*/
if (txtBarCode.Text.Length != 16 && txtBarCode.Text.Length != 20)
{
txtBarCode.Text = "";
return;
}
m_bServerTranCall = false;
string sSaleDate = "";
string sPosNo = "";
string sSaleTime = "";
string sTradeNo = "";
if (txtBarCode.Text.Length == 16)
{
sSaleDate = txtBarCode.Text.Substring(0, 8);
sPosNo = txtBarCode.Text.Substring(8, 2);
sSaleTime = txtBarCode.Text.Substring(10, 6);
}
else
{
// 회사, 빌5(끝4자리), P1, 년1, 빌4, 년2, P2, 년3, 점1(5자리), 년4, 점2, 월1, 빌3, 월2, 점3, 일1, 빌2, 일2, 점4, 점5
sSaleDate = txtBarCode.Text.Substring(3, 1) + txtBarCode.Text.Substring(5, 1) + txtBarCode.Text.Substring(7, 1) + txtBarCode.Text.Substring(9, 1) +
txtBarCode.Text.Substring(11, 1) + txtBarCode.Text.Substring(13, 1) + txtBarCode.Text.Substring(15, 1) + txtBarCode.Text.Substring(17, 1);
sPosNo = txtBarCode.Text.Substring(2, 1) + txtBarCode.Text.Substring(6, 1);
sTradeNo = "0" + txtBarCode.Text.Substring(16, 1) + txtBarCode.Text.Substring(12, 1) + txtBarCode.Text.Substring(4, 1) + txtBarCode.Text.Substring(1, 1);
}
//#20170623, 해피앱 추후적립_바코드 수정_lsr End
txtBarCode.Text = "";
txtPrtData.Text = "";
txtPrtData.Tag = "";
//if ( sPosNo == m_cPosStatus.Base.PosNo)
//{
//#20170623, 해피앱 추후적립_바코드 수정_lsr Start
// 기존
//TradeDealSearch(sSaleDate, sPosNo, "", sSaleTime);
TradeDealSearch(sSaleDate, sPosNo, sTradeNo, sSaleTime);
//#20170623, 해피앱 추후적립_바코드 수정_lsr End
//}
//else
//{
// m_dtSearchList.Clear();
// // 서버 거래 호출 만 처리
// string sRet = m_cSaleRefund.SearchServerTran(sSaleDate, sPosNo, "", sSaleTime);
// if (sRet == UserCom.RST_OK)
// {
// DataRow drNewRow = m_dtSearchList.NewRow();
// drNewRow["SALE_DT"] = m_cPosStatus.Global.DateToCulture(m_cTrnStatus.Head.SaleDate);
// drNewRow["POS_NO"] = m_cTrnStatus.Head.PosNo;
// drNewRow["TOTSALE_AMT"] = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Head.NetSaleAmt);
// drNewRow["TRADE_NO"] = m_cTrnStatus.Head.TradeNo;
// drNewRow["SYS_TIME"] = CmUtil.StrToTime(m_cTrnStatus.Head.PayHms);
// drNewRow["TRADE_KIND"] = m_cTrnStatus.Head.TradeDiv + m_cTrnStatus.Head.TradeKind;
// drNewRow["ORG_INFO"] = "";
// drNewRow["RTN_INFO"] = "";
// drNewRow["AF_CASH"] = "";
// drNewRow["AF_POINT"] = "";
// m_dtSearchList.Rows.Add(drNewRow);
// m_bServerTranCall = true;
// }
// //그리드 적용
// grdSearchList.CsmGridDataSource = m_dtSearchList;
// grdSearchList.CsmGridSelectRow(0);
// grdSearchItem_GridClickEvent(null, null);
//}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private void btnDate_Click(object sender, EventArgs e)
{
try
{
string sDate = WinBasic.ShowForm(new string[] { FormManager.FORM_CALENDAR });
if (sDate != "" && sDate.Length == 8)
{
DateTime dtNew = DateTime.ParseExact(sDate, "yyyyMMdd", null);
if ( CmUtil.LongParse(dtNew.AddDays(90).ToString("yyyyMMdd")) < CmUtil.LongParse(m_cPosStatus.Base.SaleDate))
{
string sMsg = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0547), 90);
WinManager.ErrorMessage(sMsg);
return;
}
txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(sDate);
}
txtBarCode.Focus();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private void txtPosNo_Click(object sender, EventArgs e)
{
try
{
// 포스번호 입력 처리
string sStat = WinBasic.ShowForm(new string[] { FormManager.FORM_USER_INPUT_DATA, PosConst.FRM_INPUT_DATA.POSNO });
if (sStat != UserCom.RST_ERR && sStat.Length > 0)
{
txtPosNo.Text = string.Format("{0:D2}", CmUtil.LongParse(sStat));
}
else
{
txtPosNo.Text = m_cPosStatus.Base.PosNo;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
private void grdSearchItem_GridKeyDownEvent(object sender, string sMenuKey)
{
try
{
if(sMenuKey == PosKey.MENU_KEY.SCANKEY_UP_ARROW)
{
grdSearchList.CsmGridScroll("UP");
}
else if(sMenuKey == PosKey.MENU_KEY.SCANKEY_DOWN_ARROW)
{
grdSearchList.CsmGridScroll("DOWN");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
//#20180322 휴게소pos매출연동 start,phj
private int RestAreaPosReSend(string sType,string sSaleDate,string sPosNo,string sTradeNo)
{
int iRet = UserCom.NG;
string sQuery = string.Empty;
try
{
sQuery = " UPDATE POSLOG..TR_SALE_HEADER \n"
//20180404 도로공사 재전송 기능을 제외한 기본 스레드 동작에서는 영업일자 기준으로 동작하지 않도록 수정 start, phj
//기존
//+ " SET OUT_SEND_YN = '0' \n"
//변경
+ " SET OUT_SEND_YN = 'R' \n"
//20180404 도로공사 재전송 기능을 제외한 기본 스레드 동작에서는 영업일자 기준으로 동작하지 않도록 수정 end, phj
+ " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"
+ " AND SALE_DT = '" + sSaleDate + "' \n"
+ " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"
+ " AND POS_NO = '" + sPosNo + "' \n"
+ " AND TRAIN_MODE_YN = '0' \n"
+ " AND TRADE_KINDPER IN ('00','20','21','42') \n";
if (sType == ItemConst.RESTPOS_RESEND.EACH_RESEND)
{
sQuery = sQuery + " AND TRADE_NO = '" + sTradeNo + "' \n";
}
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
iRet = m_cSqlDbService.DBExecuteNonQuery(sQuery);
m_cSqlDbService.Close();
if (iRet != UserCom.OK)
{
UserLog.WriteLogFile(UserCom.LOG_IOS,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
" 도로공사 휴게소POS 재전송 실패! " + " 영업일자:" + sSaleDate + " 영수증번호:" + sTradeNo + " 포스번호:" + sPosNo + " 타입:" + sType + "(0:전체,1:단건)");
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
" 도로공사 휴게소POS 재전송 실패! " + ex.Message );
}
return iRet;
}
//#20180322 휴게소pos매출연동 end,phj
}
}