private void KeypadButtonOk_Click(object sender, EventArgs e) { //----------------------------------------------------------------- // 취소 요청 // DTOPurchaseCancelResponse rsp = APIController.API_PatchPurchaseCancel(XRfid, this.label_Display.Text); //----------------------------------------------------------------- // 데이터 로딩 다이얼로그 using (FormLoadingDialog form = new FormLoadingDialog(Action_API_PatchPurchaseCancel)) { form.TopLevel = true; form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); } //----------------------------------------------------------------- // 완료 if (rsp.code == 200) { OnPageSuccess(); } // 실패 else { using (FormMessageBox dlg = new FormMessageBox()) { dlg.StartPosition = FormStartPosition.CenterParent; DialogResult dlgResult = dlg.ShowDialog(@"취소 요청 처리되지 않았습니다." + Environment.NewLine + rsp.reason, @"취소 요청 결과", CustomMessageBoxButtons.OK); return; } } }
/// <summary> /// 주문 취소 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCancleButton(object sender, EventArgs e) { using (FormMessageBox dlg = new FormMessageBox()) { { dlg.Left = 1430; dlg.Top = this.Location.X + (ClientSize.Height / 2) - 100; dlg.XColorTitle = Color.FromArgb(235, 82, 87); } DialogResult dlgResult = dlg.ShowDialog(@"구매 절차를 취소하시겠습니까?", @"구매 중단", CustomMessageBoxButtons.YesNo); if (dlgResult == DialogResult.Yes) { OnPageCancle(); } } }
/// <summary> /// 프린터 초기화 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_Load(object sender, EventArgs e) { if (!ReceiptController.Instance.ConnectToUSB()) // 영수증 프린터 연결 실패 { using (FormMessageBox dlgPrint = new FormMessageBox()) { { //dlgPrint.Left = 1430; //dlgPrint.Top = this.Location.X + (ClientSize.Height / 2) - 100; //dlgPrint.XColorTitle = Color.FromArgb(73, 156, 188); dlgPrint.StartPosition = FormStartPosition.CenterParent; } DialogResult dlgPrintResult = dlgPrint.ShowDialog(@"영수증 프린터를 점검해 주세요." + Environment.NewLine + "프린터 연결 실패", @"영수증 프린터 점검", CustomMessageBoxButtons.OK); // 프린터 연결될 때까지 재시도 if (dlgPrintResult == DialogResult.OK) { this.FormMain_Load(this, EventArgs.Empty); } } } }
/// <summary> /// NAME, SIZE, TYPE 조합으로 주문 카트 내역 추가 /// CartOrderItem.Name = aItemName+aItemSize+aItemType 으로 CartOrderItem 객체 식별 /// </summary> /// <param name="aMenuButtonObj"></param> /// <param name="aMenuNameKR"></param> /// <param name="aMenuSize"></param> /// <param name="aMenuType"></param> /// <param name="aMenuUnitPrice"></param> /// <param name="aMenuAmount"></param> private void OrderCartAdd(UCMenuButton aMenuButtonObj, string aMenuNameKR, string aMenuSize, string aMenuType, int aMenuUnitPrice, int aMenuAmount = 1) { // 타입이 "BOTH"이면 "메시지 박스 출력 선택 if ((aMenuType.ToUpper()).CompareTo("BOTH") == 0) { using (FormMessageBox dlg = new FormMessageBox()) { { dlg.Left = 450; dlg.Top = this.Location.X + (ClientSize.Height / 2) - 100; } DialogResult dlgResult = dlg.ShowDialog("추가 옵션을 선택하세요.", "추가 옵션 선택", CustomMessageBoxButtons.HotIced); { if (dlgResult == DialogResult.OK) { aMenuType = "HOT"; } else if (dlgResult == DialogResult.Cancel) { aMenuType = "ICED"; } } } } // 카트 콘트롤 이름 string keyName = string.Format("{0}{1}{2}", aMenuNameKR, aMenuSize, aMenuType); // 카트에 주문이 있으면 추가 하지 않고, 주문 개수 증가 시킴 if (this.flowLayoutPanel_OrderCartLayout.Controls.ContainsKey(keyName) == true) { UCOrderItem control = this.flowLayoutPanel_OrderCartLayout.Controls[keyName] as UCOrderItem; control.XMenuAmount++; // 총액 업데이트 OrderCartUpdateTotalPrice(); return; } // 주문 추가 UCOrderItem _OrderItem = new UCOrderItem(); { _OrderItem.Name = keyName; //---------------------------------------------------------- _OrderItem.BackColor = System.Drawing.Color.Transparent; _OrderItem.Font = new System.Drawing.Font("SpoqaHanSans-Regular", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); _OrderItem.Size = new System.Drawing.Size(539, 50); _OrderItem.XForeTextColor = System.Drawing.Color.White; //---------------------------------------------------------- _OrderItem.XMenuNameKR = aMenuNameKR; _OrderItem.XMenuSize = aMenuSize; _OrderItem.XMenuType = aMenuType; _OrderItem.XMenuUnitPrice = aMenuUnitPrice; //---------------------------------------------------------- _OrderItem.XMenuAmount = aMenuAmount; _OrderItem.XMenuTotalAmount = aMenuUnitPrice * aMenuAmount; //---------------------------------------------------------- _OrderItem.XMenuButtonObject = aMenuButtonObj; //---------------------------------------------------------- _OrderItem.OnMinusButtonClicked += UcOrderItem_OnMinusButtonClicked; _OrderItem.OnPlusButtonClicked += UcOrderItem_OnPlusButtonClicked; } this.flowLayoutPanel_OrderCartLayout.Controls.Add(_OrderItem); // 총액 업데이트 OrderCartUpdateTotalPrice(); }
/// <summary> /// 주문 완료 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnOkButton(object sender, EventArgs e) { //------------------------------------------------------------------------------------- using (FormMessageBox dlg = new FormMessageBox()) { { dlg.Left = 1430; dlg.Top = this.Location.X + (ClientSize.Height / 2) - 100; dlg.XColorTitle = Color.FromArgb(73, 156, 188); } DialogResult dlgResult = dlg.ShowDialog(@"구매를 완료 하시겠습니까?", @"최종 확인", CustomMessageBoxButtons.YesNo); if (dlgResult == DialogResult.Yes) { //----------------------------------------------------------------------------- // 영수증 프린터 연결 확인 //if (!ReceiptController.Instance.ConnectToUSB()) // 영수증 프린터 연결 실패 if (ReceiptController.Instance.GetStatus() != PRINT_STATUS.BXL_STS_CASHDRAWER_HIGH) { using (FormMessageBox dlgPrint = new FormMessageBox()) { { dlgPrint.Left = 1430; dlgPrint.Top = this.Location.X + (ClientSize.Height / 2) - 100; dlgPrint.XColorTitle = Color.FromArgb(73, 156, 188); } PRINT_STATUS printStatus = ReceiptController.Instance.GetStatus(); DialogResult dlgPrintResult = dlgPrint.ShowDialog(@"영수증 프린터를 점검해 주세요." + Environment.NewLine + printStatus.ToString(), @"영수증 프린터 점검", CustomMessageBoxButtons.OK); } return; } //----------------------------------------------------------------------------- // 구매 확정 API 호출 DTOPurchasesRequest _req = GetDTOPurchaseRequest(); DTOPurchasesResponse _rsp = APIController.API_PostPurchaseSuccess(XReceiptId.ToString(), _req); //----------------------------------------------------------------------------- if (_rsp.code == 200) { // 영수증 출력 string _strUserInfo = string.Format("{0}님 ({1})", XName, XCompany); string _strPayType = ""; string _totalPayment = "0"; if (XPayType == PAY_TYPE.MonthlyDeduction) { _strPayType = "월말공제"; // 결제 총액 계산 _totalPayment = (_rsp.total_price - _rsp.total_dc_price).ToString("N0"); } else if (XPayType == PAY_TYPE.CustomerPayment) { _strPayType = "손님결제"; // 손님결제일 경우, 영수증 결제 총액을 0원으로 표시 _totalPayment = "0"; } string _strCurrentDateTime = Utilities.DateTimeFormatString.getNowDateTimeFormatString(); List <VOPrintMenu> _printMenuList = GetPurchasePrintObject(); ReceiptController.Instance.Print( _strUserInfo, XReceiptId.ToString(), _strPayType, _printMenuList, _strCurrentDateTime, _rsp.total_price.ToString("N0"), // 구매 총액 _rsp.total_dc_price.ToString("N0"), // 할인 총액 _totalPayment // 결제 총액 ); // 완료 OnPageSuccess(); } else { //------------------------------------------------------------------------- using (FormMessageBox dlg1 = new FormMessageBox()) { { dlg1.Left = 1430; dlg1.Top = this.Location.X + (ClientSize.Height / 2) - 100; dlg1.XColorTitle = Color.FromArgb(73, 156, 188); } DialogResult dlgResult1 = dlg.ShowDialog(@"구매 처리를 완료하지 못했습니다." + Environment.NewLine + _rsp.reason, @"구매 확정 처리 결과", CustomMessageBoxButtons.OK); }//using } } }//using }