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;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : Take In/Out
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmTakeInOut : 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 IPaymentUs m_cCouponDC = null;
#endregion 변수 선언
#region 생성자 & 소멸자 & 폼초기화
public frmTakeInOut()
{
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);
m_cCouponDC = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.COUPONDC);
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
}
private void frmTakeInOut_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 frmTakeInOut_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
private void frmTakeInOut_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void frmTakeInOut_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);
}
///
/// 폼 컨트롤 초기화
///
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);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
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);
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0304);
grpbIn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0302);
grpOut.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0303);
lblAmtIn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
lblAmtOut.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
lblQtyIn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
lblQtyOut.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
btnSave.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0225);
DataGridSetting(); // 그리드 초기화
LoadItemToGridView();
TakeInOutTotal();
}
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 그리드 설정 및 사용
private void DataGridSetting()
{
try
{
dgvPluItem.Rows.Clear();
dgvPluItem.AllowUserToAddRows = false;
dgvPluItem.EnableHeadersVisualStyles = false;
dgvPluItem.RowsDefaultCellStyle.BackColor = Color.White;
dgvPluItem.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249);
dgvPluItem.Font = this.Font;
dgvPluItem.DefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 10);
//dgvPluItem.DefaultCellStyle.SelectionBackColor = Color.Transparent;
dgvPluItem.Font = new Font(m_cPosStatus.Base.FONT, 10);
dgvPluItem.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 10);
dgvPluItem.Columns[0].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0302);
dgvPluItem.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0303);
dgvPluItem.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0015);
dgvPluItem.Columns[3].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0016);
dgvPluItem.Columns[4].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
dgvPluItem.Columns[5].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019);
//6 : TAKE_IN_SALE_AMT : Take In 금액
//7 : TAKE_OUT_SALE_AMT : Take Out 금액
//#2018.01.29;미주 take in/out 계산을 위해 추가(그리드로 구분 하기엔 항목이 많아 문자열로 연결 후 split 해서 사용);girak.kim;Start
//8 : Column.TR_PLU.ITEM (CANCEL_DIV, CANCEL_DIV_MAIN, ITEM_TAX_DIV, NOTAX_DIV, SALE_AMT, TOT_DC_AMT, TAKE_IN_OUT_DIV, ITEM_TAKE_IN_VAT_CD, ITEM_TAKE_OUT_VAT_CD, TAXRATE_CD, TAX_AMT_INCLUDE_YN,APPLY_TAX_AMT ,TAX_RATE ,BILL_AMT)
//#2018.01.29;미주 take in/out 계산을 위해 추가;girak.kim;End
}
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
private void dgvPluItem_CellClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (dgvPluItem.CurrentCell != null)
{
if (e.RowIndex == -1)
{
dgvPluItem.ClearSelection();
dgvPluItem.CurrentCell = null;
for (int iRow = 0; iRow < dgvPluItem.Rows.Count; iRow++)
{
TakeInOutPrcDisp(e.ColumnIndex, iRow);
}
}
else
{
TakeInOutPrcDisp(e.ColumnIndex, e.RowIndex);
}
TakeInOutTotal();
}
}
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 버튼 입력 처리
///
/// 버튼 입력 처리
///
///
///
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if (SaveData() == false) return;
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);
}
}
///
/// 닫기
///
///
///
private void btnExit_Click(object sender, EventArgs e)
{
try
{
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);
}
}
#endregion Control Event
#region User Method
///
/// 등록 상품 로드
///
private void LoadItemToGridView()
{
try
{
// 상품정보
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];
int iRow = dgvPluItem.Rows.Add();
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL)
{
dgvPluItem.Rows[iRow].Visible = false;
continue;// 지정취소
}
else
{
dgvPluItem.Rows[iRow].Visible = true;
}
if (cSaleItem.TAKE_IN_OUT_DIV == PosConst.TAKE_IN_OUT_DIV.TAKE_IN)
{
dgvPluItem.Rows[iRow].Cells[0].Value = true;
dgvPluItem.Rows[iRow].Cells[1].Value = false;
}
else
{
dgvPluItem.Rows[iRow].Cells[0].Value = false;
dgvPluItem.Rows[iRow].Cells[1].Value = true;
}
dgvPluItem.Rows[iRow].Cells[2].Value = (cSaleItem.ITEM_TAX_DIV == PosConst.ITEM_TAX_DIV.FREE || cSaleItem.NOTAX_DIV == PosConst.ITEM_NOTAX_DIV.YES ? "*" : " ") + cSaleItem.ITEM_NAME; // 상품명
dgvPluItem.Rows[iRow].Cells[3].Value = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.SALE_PRC); // 단가
dgvPluItem.Rows[iRow].Cells[4].Value = m_cPosStatus.Global.NumericToQuantity(cSaleItem.SALE_QTY); // 수량
//#2018.01.26.001;미국 경우 금액이 아닌 부가세 적용된 금액 표시;Start
//원래 소스
//dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.SALE_AMT); // 금액
if(m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS))
{
dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.BILL_AMT);
}
else
{
dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.SALE_AMT); // 금액
}
//#2018.01.26.001;미국 경우 금액이 아닌 부가세 적용된 금액 표시;End
//dgvPluItem.Rows[iRow].Cells[6].Value = m_cPosStatus.Global.NumericTOCurrency(cSaleItem.APPLY_TAX_AMT); // 부가세
// 상품 마스터 조회
DataTable dtDataInfo = m_cDataCommon.SearchItemCode(cSaleItem.SUB_SHOP_CD, cSaleItem.ITEM_PLU_CD, "");
if (dtDataInfo == null || dtDataInfo.Rows.Count == 0)
{
dgvPluItem.Rows[iRow].Cells[6].Value = cSaleItem.SALE_PRC;
dgvPluItem.Rows[iRow].Cells[7].Value = cSaleItem.SALE_PRC;
}
else
{
DataRow drPlu = dtDataInfo.Rows[0];
//# 20180202 미국 Other상품 Take In/Out시에 수동입력된 금액으로 변경 Start
// 기존
//Take In 금액
//dgvPluItem.Rows[iRow].Cells[6].Value = CmUtil.GetDataRowDouble(drPlu, PosMst.MST_ITEM.DATA.TAKE_IN_SALE_AMT);
////Take Out 금액
//dgvPluItem.Rows[iRow].Cells[7].Value = CmUtil.GetDataRowDouble(drPlu, PosMst.MST_ITEM.DATA.TAKE_OUT_SALE_AMT);
//변경
string sOpenItemDiv = CmUtil.GetDataRowStr(drPlu, PosMst.MST_ITEM.DATA.OPEN_ITEM_DIV);
if (sOpenItemDiv.Equals("1") && m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS))
{
dgvPluItem.Rows[iRow].Cells[6].Value = cSaleItem.SALE_PRC;
dgvPluItem.Rows[iRow].Cells[7].Value = cSaleItem.SALE_PRC;
}
else
{
//Take In 금액
dgvPluItem.Rows[iRow].Cells[6].Value = CmUtil.GetDataRowDouble(drPlu, PosMst.MST_ITEM.DATA.TAKE_IN_SALE_AMT);
//Take Out 금액
dgvPluItem.Rows[iRow].Cells[7].Value = CmUtil.GetDataRowDouble(drPlu, PosMst.MST_ITEM.DATA.TAKE_OUT_SALE_AMT);
}
//# 20180202 미국 Other상품 Take In/Out시에 수동입력된 금액으로 변경 End
}
//#2018.01.29;미주 take in/out 계산을 위해 추가;girak.kim;Start
Hashtable htSaleItem = new Hashtable();//cSaleItem
htSaleItem.Add("CANCEL_DIV", cSaleItem.CANCEL_DIV );
htSaleItem.Add("CANCEL_DIV_MAIN", cSaleItem.CANCEL_DIV_MAIN );
htSaleItem.Add("ITEM_TAX_DIV", cSaleItem.ITEM_TAX_DIV );
htSaleItem.Add("NOTAX_DIV", cSaleItem.NOTAX_DIV );
htSaleItem.Add("SALE_AMT", cSaleItem.SALE_AMT );
htSaleItem.Add("TOT_DC_AMT", cSaleItem.TOT_DC_AMT );
htSaleItem.Add("TAKE_IN_OUT_DIV", cSaleItem.TAKE_IN_OUT_DIV );
htSaleItem.Add("ITEM_TAKE_IN_VAT_CD", cSaleItem.ITEM_TAKE_IN_VAT_CD);
htSaleItem.Add("ITEM_TAKE_OUT_VAT_CD", cSaleItem.ITEM_TAKE_OUT_VAT_CD);
htSaleItem.Add("TAXRATE_CD", cSaleItem.TAXRATE_CD );
htSaleItem.Add("TAX_AMT_INCLUDE_YN", cSaleItem.TAX_AMT_INCLUDE_YN);
htSaleItem.Add("APPLY_TAX_AMT", cSaleItem.APPLY_TAX_AMT );
htSaleItem.Add("TAX_RATE", cSaleItem.TAX_RATE );
htSaleItem.Add("BILL_AMT", cSaleItem.BILL_AMT );
dgvPluItem.Rows[iRow].Cells[8].Value = htSaleItem;//배열은 참조이므로 X 로 창 close 시 문제 발생 때문에 사용 배제
//dgvPluItem.Rows[iRow].Cells[8].Value = cSaleItem.CANCEL_DIV + "|"//0
// + cSaleItem.CANCEL_DIV_MAIN + "|"//1
// + cSaleItem.ITEM_TAX_DIV + "|"//2
// + cSaleItem.NOTAX_DIV + "|"//3
// + cSaleItem.SALE_AMT + "|"//4
// + cSaleItem.TOT_DC_AMT + "|"//5
// + cSaleItem.TAKE_IN_OUT_DIV + "|"//6
// + cSaleItem.ITEM_TAKE_IN_VAT_CD + "|"//7
// + cSaleItem.ITEM_TAKE_OUT_VAT_CD + "|"//8
// + cSaleItem.TAXRATE_CD + "|"//9
// + cSaleItem.TAX_AMT_INCLUDE_YN + "|"//10
// + cSaleItem.APPLY_TAX_AMT + "|"//11
// + cSaleItem.TAX_RATE + "|"//12
// + cSaleItem.BILL_AMT;//13
//#2018.01.29;미주 take in/out 계산을 위해 추가;girak.kim;End
}
dgvPluItem.Refresh();
}
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 TakeInOutPrcDisp(int iColumnIndex ,int iRow)
{
try
{
if (dgvPluItem.Rows[iRow].Visible == false) return;
if (iColumnIndex == 0)
{
if (dgvPluItem.Rows[iRow].Cells[0].Value.Equals(false))
{
dgvPluItem.Rows[iRow].Cells[0].Value = true;
dgvPluItem.Rows[iRow].Cells[1].Value = false;
}
}
else if (iColumnIndex == 1)
{
if (dgvPluItem.Rows[iRow].Cells[1].Value.Equals(false))
{
dgvPluItem.Rows[iRow].Cells[0].Value = false;
dgvPluItem.Rows[iRow].Cells[1].Value = true;
}
}
if (dgvPluItem.Rows[iRow].Cells[0].Value.Equals(true))
{
dgvPluItem.Rows[iRow].Cells[3].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[6].Value.ToString()));
}
else
{
dgvPluItem.Rows[iRow].Cells[3].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[7].Value.ToString()));
}
double dPrc = m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[3].Value.ToString());//TAKE_(IN/OUT)_SALE_AMT
double dQty = m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[4].Value.ToString());
//#2018.01.26.001;미국 경우 금액이 아닌 부가세 적용된 금액 표시;Start
//dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleMultiplication(dPrc, dQty)); //원래 소스
if (m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS))
{
double dBillAmt = CalcSaleItemBillAmt(iColumnIndex, (Hashtable)dgvPluItem.Rows[iRow].Cells[8].Value);//double dBillAmt = CalcSaleItemBillAmt(iColumnIndex, dgvPluItem.Rows[iRow].Cells[8].Value.ToString());
dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(dBillAmt);//BillAmt 가 계산 값이므로 dQty 을 별도 곱하기 할 필요 없음.
}
else
{
dgvPluItem.Rows[iRow].Cells[5].Value = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleMultiplication(dPrc, dQty));
}
//#2018.01.26.001;미국 경우 금액이 아닌 부가세 적용된 금액 표시;End
}
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 bool SaveData()
{
bool bRet = false;
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.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL)
{
continue; // 지정취소
}
else
{
cSaleItem.TAKE_IN_OUT_DIV = dgvPluItem.Rows[iRow].Cells[0].Value.Equals(true) ? "0":"1";
if(cSaleItem.TAKE_IN_OUT_DIV == PosConst.TAKE_IN_OUT_DIV.TAKE_IN)
{
cSaleItem.SALE_PRC = m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[6].Value.ToString());
cSaleItem.TAXRATE_CD = cSaleItem.ITEM_TAKE_IN_VAT_CD;
}
else
{
cSaleItem.SALE_PRC = m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[7].Value.ToString());
cSaleItem.TAXRATE_CD = cSaleItem.ITEM_TAKE_OUT_VAT_CD;
}
cSaleItem.SALE_AMT = CmUtil.DoubleMultiplication(cSaleItem.SALE_PRC, cSaleItem.SALE_QTY);
}
}
bRet = 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 bRet;
}
///
/// 합계 표시
///
private void TakeInOutTotal()
{
int iInCnt = 0;
double dInAmt = 0;
int iOutCnt = 0;
double dOutAmt = 0;
try
{
TotalInit();
for (int iRow = 0; iRow < dgvPluItem.Rows.Count; iRow++)
{
if (dgvPluItem.Rows[iRow].Cells[0].Value.Equals(true))
{
iInCnt +=CmUtil.IntParse(dgvPluItem.Rows[iRow].Cells[4].Value.ToString());
dInAmt = CmUtil.DoubleAdd(dInAmt,m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[5].Value.ToString()));
}
else
{
iOutCnt += CmUtil.IntParse(dgvPluItem.Rows[iRow].Cells[4].Value.ToString());
dOutAmt = CmUtil.DoubleAdd(dOutAmt, m_cDataService.DoubleParse(dgvPluItem.Rows[iRow].Cells[5].Value.ToString()));
}
}
txtQtyIn.Text = m_cPosStatus.Global.NumericToQuantity(iInCnt);
txtQtyOut.Text = m_cPosStatus.Global.NumericToQuantity(iOutCnt);
txtAmtIn.Text = m_cPosStatus.Global.NumericTOCurrency(dInAmt);
txtAmtOut.Text = m_cPosStatus.Global.NumericTOCurrency(dOutAmt);
}
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 TotalInit()
{
try
{
txtAmtIn.Text = m_cPosStatus.Global.NumericToQuantity(0);
txtQtyIn.Text = m_cPosStatus.Global.NumericToQuantity(0);
txtAmtOut.Text = m_cPosStatus.Global.NumericTOCurrency(0);
txtQtyOut.Text = m_cPosStatus.Global.NumericTOCurrency(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);
}
}
#region 2018.01.30;Take In/Out 체크박스 변경 시 미주의 경우 재계산 처리;girak.kim
private double CalcSaleItemBillAmt(int iColumnIndex, Hashtable htSaleItem)
{
//string[] aSaleItem = pSaleItem.Split(new string[] {"|"}, StringSplitOptions.None);
string sCANCEL_DIV = htSaleItem["CANCEL_DIV"].ToString();
string sCANCEL_DIV_MAIN = htSaleItem["CANCEL_DIV_MAIN"].ToString();
string sITEM_TAX_DIV = htSaleItem["ITEM_TAX_DIV"].ToString();
string sNOTAX_DIV = htSaleItem["NOTAX_DIV"].ToString();
double dSALE_AMT = CmUtil.DoubleParse(htSaleItem["SALE_AMT"].ToString());
double dTOT_DC_AMT = CmUtil.DoubleParse(htSaleItem["TOT_DC_AMT"].ToString());
string sTAKE_IN_OUT_DIV = htSaleItem["TAKE_IN_OUT_DIV"].ToString();
string sITEM_TAKE_IN_VAT_CD = htSaleItem["ITEM_TAKE_IN_VAT_CD"].ToString();
string sITEM_TAKE_OUT_VAT_CD = htSaleItem["ITEM_TAKE_OUT_VAT_CD"].ToString();
string sTAXRATE_CD = htSaleItem["TAXRATE_CD"].ToString();
string sTAX_AMT_INCLUDE_YN = htSaleItem["TAX_AMT_INCLUDE_YN"].ToString();
double dAPPLY_TAX_AMT = CmUtil.DoubleParse(htSaleItem["APPLY_TAX_AMT"].ToString());
double dTAX_RATE = CmUtil.DoubleParse(htSaleItem["TAX_RATE"].ToString());
double dBILL_AMT = CmUtil.DoubleParse(htSaleItem["BILL_AMT"].ToString());
double dItemTaxAmt = 0;
double dTargetAmt = 0;
if (sCANCEL_DIV == PosConst.CANCEL_DIV.NORMAL && sCANCEL_DIV_MAIN == PosConst.CANCEL_DIV.NORMAL)
{
//면세 체크
if (sITEM_TAX_DIV == PosConst.ITEM_TAX_DIV.TAX && sNOTAX_DIV != PosConst.ITEM_NOTAX_DIV.YES && dBILL_AMT > 0)
{
#region
dTargetAmt = CmUtil.DoubleSubtraction(dSALE_AMT, dTOT_DC_AMT);
double dTaxRate = 0;
// 상품별 VATCD는 상품마스터만 참조 하면됨(2017.05.29)
if (iColumnIndex.ToString() == PosConst.TAKE_IN_OUT_DIV.TAKE_IN)
{
sTAXRATE_CD = sITEM_TAKE_IN_VAT_CD;
}
else
{
sTAXRATE_CD = sITEM_TAKE_OUT_VAT_CD;
}
dTaxRate = m_cDataCommon.ItemTaxRate(sTAXRATE_CD);
if (sTAX_AMT_INCLUDE_YN == ItemConst.MST_ITEM_TAX_AMT_INCLUDE_YN.NOT_INCLUDED)//부가세 미포함 경우
{
dItemTaxAmt = CmUtil.DoubleAdd(1, CmUtil.DoubleDivision(dTaxRate, 100));
dItemTaxAmt = CmUtil.DoubleMultiplication(dTargetAmt, dItemTaxAmt);
dItemTaxAmt = CmUtil.DoubleSubtraction(dItemTaxAmt, dTargetAmt);
dItemTaxAmt = CmUtil.MathRounds(dItemTaxAmt, m_cPosStatus.Mst.VatRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.VatRudDwLoc));
dAPPLY_TAX_AMT = dItemTaxAmt;
//dTAX_RATE = dTaxRate;
}
else if (sTAX_AMT_INCLUDE_YN == ItemConst.MST_ITEM_TAX_AMT_INCLUDE_YN.INCLUDED) // 부가세 포함
{
dItemTaxAmt = CmUtil.MathRounds(dItemTaxAmt, m_cPosStatus.Mst.VatRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.VatRudDwLoc));
dAPPLY_TAX_AMT = dItemTaxAmt;
//dTAX_RATE = dTaxRate;
}
else // N , 또는 설정 없음 일 경우 면세처리..
{
dAPPLY_TAX_AMT = 0;
//dTAX_RATE = 0;
}
#endregion
}
else
{
dAPPLY_TAX_AMT = 0;
//dTAX_RATE = 0;
}
}
dBILL_AMT = CmUtil.DoubleSubtraction(dSALE_AMT, dTOT_DC_AMT);
if (sTAX_AMT_INCLUDE_YN == ItemConst.MST_ITEM_TAX_AMT_INCLUDE_YN.NOT_INCLUDED)
{
dBILL_AMT = CmUtil.DoubleAdd(dBILL_AMT, dAPPLY_TAX_AMT);
}
return dBILL_AMT;
}
#endregion
#endregion User Method
#region DeviceEvent 관련
///
/// DeviceEvent 관련
///
///
///
///
///
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);
}
}
///
/// MSR Event
///
///
///
private void OnMSREvent(object source, EventArgs e)
{
}
///
/// 스캐너 이벤트 처리
///
///
///
private void OnScannerEvent(object source, EventArgs e)
{
}
#endregion
}
}