public void OpenCashDrawer(string reason) { OpenCashDrawer ocd = new OpenCashDrawer(); ocd.Reason = reason; Send("/OpenCashDrawer", ocd); }
public void OpenCashDrawer(HttpListenerContext context) { OpenCashDrawer message = ParseRequest <OpenCashDrawer>(context); GetServer.CloverConnector.OpenCashDrawer(message.Reason); this.SendTextResponse(context, ""); }
private void btnProcess_Click(object sender, EventArgs e) { if (decimal.Parse(lblChange.Text) < 0) { MessageBoxUI mb = new MessageBoxUI("Amount rendered must be greater than Total Due!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.showDialog(); txtAmountRendered.Focus(); return; } lFromClose = false; loPOSTransaction.Id = lTransactionId; loPOSTransaction.Date = DateTime.Now; loPOSTransaction.CashierPeriodId = GlobalVariables.CashierPeriodId; loPOSTransaction.CustomerId = lCustomerId; loPOSTransaction.OrderType = lOrderType; loPOSTransaction.TableId = lTableId; loPOSTransaction.ORNo = txtORNo.Text; loPOSTransaction.TotalPrice = decimal.Parse(lblTotalPrice.Text); loPOSTransaction.TotalDiscount = decimal.Parse(lblTotalDiscount.Text); loPOSTransaction.TotalLessVAT = decimal.Parse(lblLessVAT.Text); loPOSTransaction.TotalDue = decimal.Parse(lblTotalDue.Text); loPOSTransaction.VATSale = decimal.Parse(lblVATSale.Text); loPOSTransaction.VATExemptSale = decimal.Parse(lblVATExemptSale.Text); loPOSTransaction.VATAmount = decimal.Parse(lblVATAmount.Text); loPOSTransaction.AmountTendered = decimal.Parse(txtAmountRendered.Text); loPOSTransaction.Paid = "Y"; loPOSTransaction.DiscountId = lDiscountId; loPOSTransaction.ModeOfPaymentId = lModeOfPaymentId; loPOSTransaction.PaymentDetails = lPaymentDetails; loPOSTransaction.OutletId = GlobalVariables.CurrentLocationId; loPOSTransaction.CashierId = GlobalVariables.CashierId; loPOSTransaction.Terminal = GlobalVariables.Terminal; loPOSTransaction.Remarks = lblRemarks.Text; loPOSTransaction.UserId = GlobalVariables.UserId; try { string _TransactionId; if (lOperation == "Add") { _TransactionId = loPOSTransaction.save(GlobalVariables.Operation.Add); } else if (lOperation == "Edit") { _TransactionId = loPOSTransaction.save(GlobalVariables.Operation.Edit); } else { MessageBoxUI _mb = new MessageBoxUI("Operation not defined!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } if (_TransactionId != "") { decimal _totalQty = 0; foreach (DataGridViewRow _dr in loDataGrid.Rows) { loPOSTransactionDetail.TransactionId = _TransactionId; loPOSTransactionDetail.StockId = _dr.Cells["DetailStockId"].Value.ToString(); loPOSTransactionDetail.LocationId = GlobalVariables.CurrentLocationId; loPOSTransactionDetail.VATable = "Y"; _totalQty += decimal.Parse(_dr.Cells["DetailQty"].Value.ToString()); loPOSTransactionDetail.Qty = decimal.Parse(_dr.Cells["DetailQty"].Value.ToString()); loPOSTransactionDetail.UnitCost = decimal.Parse(_dr.Cells["DetailUnitCost"].Value.ToString()); loPOSTransactionDetail.BasePrice = decimal.Parse(_dr.Cells["DetailBasePrice"].Value.ToString()); loPOSTransactionDetail.UnitPrice = decimal.Parse(_dr.Cells["DetailUnitPrice"].Value.ToString()); loPOSTransactionDetail.DiscountId = "0"; loPOSTransactionDetail.DiscountAmount = 0; loPOSTransactionDetail.TotalPrice = decimal.Parse(_dr.Cells["DetailTotalPrice"].Value.ToString()); loPOSTransactionDetail.UserId = GlobalVariables.UserId; if (lOperation == "Add") { loPOSTransactionDetail.save(GlobalVariables.Operation.Add); } else if (lOperation == "Edit") { if (_dr.Cells[0].Value.ToString() != "") { loPOSTransactionDetail.DetailId = _dr.Cells["DetailId"].Value.ToString(); loPOSTransactionDetail.save(GlobalVariables.Operation.Edit); } else { loPOSTransactionDetail.save(GlobalVariables.Operation.Add); } } } //insert Inventory loInventory.final(insertInventory(_TransactionId, lCustomerId, _totalQty)); try { OpenCashDrawer loOpenCashDrawer = new OpenCashDrawer(); loOpenCashDrawer.openCashDrawer(); this.Close(); } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.showDialog(); } writeORSeqNo(); if (lOperation == "Add") { printOrderSlip(_TransactionId, txtORNo.Text); } this.Close(); } } catch (Exception ex) { MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } }