private void tmr_delayed_load_Tick_1(object sender, EventArgs e) { tmr_delayed_load.Interval = 2000; tmr_delayed_load.Enabled = false; if (_current_action == "get_customer_information") { String htmlResponse = ""; try { TopitUp.Web WebResponse = new TopitUp.Web(10000); htmlResponse = WebResponse.GetURL("/terminal/cashmx/get-customer-info"); WebResponse = null; if (htmlResponse.IndexOf("err>") > -1) { // } else if (htmlResponse.Length > 0) { JObject json = JObject.Parse(htmlResponse); if (!String.IsNullOrEmpty((string)json["dc_code"])) { txtLoadNoPre.Text = (string)json["dc_code"]; } if (!String.IsNullOrEmpty((string)json["cashms_acc_number"])) { txtPONumber.Text = (string)json["cashms_acc_number"]; } } } catch (Exception ex) { showMessage(ex.Message, Color.Red); } } _current_action = ""; }
private void btnProcessPayment_Click(object sender, EventArgs e) { if (btnProcessPayment.Text == "Clear") { btnProcessPayment.BackColor = System.Drawing.Color.Green; btn_cashms_clear.Visible = true; btnPrintStoreCopy.Visible = false; if (provider_type == 2) { txtPONumber.Text = ""; } //picRandBg.Visible = true; txtRandValue.Text = ""; txtLoadNo.Text = ""; txtDriverNo.Text = ""; txtDriverCell.Text = ""; //txtLoadNoPre.Text = TopitUp.globalSettings.cashms_depot_prefix; //txtPONumber.Text = TopitUp.globalSettings.cashms_customer_number; pnlComplete.Visible = false; //pnlKeypad.Visible = true; //keyb_shown_full = true; btnProcessPayment.Text = "Process Payment"; return; } if (txtRandValue.Text == "") { showMessage("Please enter a payment amount.", Color.Red); txtRandValue.Enabled = true; txtRandValue.Focus(); return; } string value = txtRandValue.Text.Replace(".", ""); // if (Convert.ToInt32(value) > 2000000) // { // Util.showMessage("Amount entered is too high.", false); // txtRandValue.Enabled = true; // txtRandValue.Focus(); // return; //} if (provider_type == 2) { if (txtPONumber.Text.Length < 2) { showMessage("Please check the customer number!", Color.Red); txtPONumber.Enabled = true; txtPONumber.Focus(); return; } } if (provider_type == 1) { if (txtPONumber.Text.Length != 6) { showMessage("Please check the customer number!", Color.Red); txtPONumber.Enabled = true; txtPONumber.Focus(); return; } if (txtLoadNoPre.Text.Length != 3) { showMessage("Please check the load prefix!", Color.Red); txtLoadNoPre.Enabled = true; txtLoadNoPre.Focus(); return; } if (txtLoadNo.Text.Length != 6) { showMessage("Please check the load number!", Color.Red); txtLoadNo.Enabled = true; txtLoadNo.Focus(); return; } if (txtDriverNo.Text.Length != 4) { showMessage("Please check your driver number!", Color.Red); txtDriverNo.Enabled = true; txtDriverNo.Focus(); return; } if (txtDriverCell.Text.Length != 10) { showMessage("Please check the cell number!", Color.Red); txtDriverCell.Enabled = true; txtDriverCell.Focus(); return; } } //if (!lblNoPaper.Visible) //{ // if (TopitUp.globalSettings.gen_ignore_paper == "0") // { // if (TopitUp.Util.checkPrinterState() == 1) // { // lblNoPaper.Show(); // return; // } // } //} lblNoPaper.Hide(); String htmlResponse = ""; String storeno = txtPONumber.Text; String loadno = txtLoadNoPre.Text + txtLoadNo.Text; String driverno = txtDriverNo.Text; String drivercell = txtDriverCell.Text; TopitUp.Web WebResponse = new TopitUp.Web(60000, 1, ""); htmlResponse = WebResponse.GetURL("/terminal/cashmx/account-payment?ptype=" + provider_type + "&storeno=" + storeno + "&loadno=" + loadno + "&driverno=" + driverno + "&drivercell=" + drivercell + "&amt=" + value); WebResponse = null; if (htmlResponse.IndexOf("err") > -1) { showMessage(htmlResponse.StripErrorTags(), Color.Red); } else { btnPrintStoreCopy.Visible = true; //picRandBg.Visible = false; btn_cashms_clear.Visible = false; pnlComplete.Visible = true; String driver_copy = ""; driver_copy += "1\n"; driver_copy += "1***********************\n"; driver_copy += "1 DRIVER COPY\n"; driver_copy += "1***********************\n"; payment_slip_toprint = htmlResponse; TopitUp.Util.printText(driver_copy + payment_slip_toprint, false); btnProcessPayment.Text = "Clear"; btnProcessPayment.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); //pnlKeypad.Visible = false; //keyb_shown_full = false; } }