Example #1
0
        private void btnVAPay_Click(object sender, EventArgs e)
        {
            m_dPayAmount = 0;
            for (int i = 0; i < dgvVA.Rows.Count; i++)
            {
                if (!Program.MyBooleanParse(dgvVA.Rows[i].Cells["cc_check"].Value.ToString()))
                {
                    continue;
                }
                string inv      = dgvVA.Rows[i].Cells["cc_invoice"].Value.ToString();
                double dBalance = Program.MyMoneyParse(dgvVA.Rows[i].Cells["cc_balance"].Value.ToString());

                if (inv != "")
                {
                    m_sInvoices += ",";
                    m_sAmounts  += ",";
                }
                m_sInvoices  += inv;
                m_sAmounts   += dBalance.ToString();
                m_dPayAmount += dBalance;
            }
            if (m_dPayAmount < 0)
            {
                FormMSG fm = new FormMSG();
                fm.btnNo.Visible  = false;
                fm.btnYes.Visible = false;
                fm.m_sMsg         = "Sorry, Balance is negtive!";
                fm.ShowDialog();
                return;
            }
//			m_dPayAmount = Program.RoundUp(m_dPayAmount);
            m_bPay = true;             //bring up payment panel after close
            this.Close();
        }
 private void button4_Click(object sender, EventArgs e)
 {
     if (SaveSettings())
     {
         FormMSG fm = new FormMSG();
         fm.btnYes.Visible = false;
         fm.btnNo.Visible  = false;
         fm.m_sMsg         = " Setting Saved ";
         fm.ShowDialog();
         Program.m_formconfigshow = false;
         this.Close();
     }
 }
 private void clockinout_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 17)
     {
         if (!DoSearchStaff())
         {
             FormMSG msg = new FormMSG();
             msg.btnNo.Visible  = false;
             msg.btnYes.Visible = false;
             msg.m_sMsg         = "Sorry, Barcode Incorrect or Sales Not Exist";
             msg.ShowDialog();
             return;
         }
         else
         {
             if (DoClockInOut())
             {
                 FormMSG msg = new FormMSG();
                 msg.btnNo.Visible  = false;
                 msg.btnYes.Visible = false;
                 if (bCheckIn)
                 {
                     msg.m_sMsg = m_sStaffName + " You have Clocked In At :" + System.DateTime.Now.ToString();
                 }
                 else
                 {
                     msg.m_sMsg = m_sStaffName + " You have Clocked Out At :" + System.DateTime.Now.ToString();
                 }
                 msg.ShowDialog();
                 this.txtbarcode.Text = "";
                 m_sStaffName         = "";
                 m_sStaffBarcode      = "";
                 m_sStaffId           = "";
                 this.Close();
                 return;
             }
         }
     }
 }
Example #4
0
        private bool GetRespKey()
        {
            GetCustDetail();

            HttpWebRequest  req;
            HttpWebResponse resp;

            req  = (HttpWebRequest)WebRequest.Create("http://reg.gposnz.com/reg.aspx?k=" + txtvalidatekey.Text + "&authID=" + m_sAuth + "&t=" + m_sTradingName + "&add=" + m_sAddress + "&add1" + m_sAddress1 + "&add2=" + m_sAddress2 + "&ct=" + m_sCity + "&p=" + m_sPhone + "&m=" + GetMotherboardSerialNumber());
            resp = (HttpWebResponse)req.GetResponse();
            resp.ToString();
            string responseKey = resp.ResponseUri.Query.ToString();
            int    keyStart    = responseKey.IndexOf("=");
            int    idStart     = responseKey.IndexOf("&");

            if (responseKey.IndexOf("*f") > 0)
            {
                FormMSG fm = new FormMSG();
                fm.btnYes.Visible = false;
                fm.btnNo.Visible  = false;
                fm.m_sMsg         = "Register Error, Please contact GPOS Ltd ";
                fm.ShowDialog();
                return(false);
            }
            string returnKey = responseKey.Substring(keyStart + 1, 25);
            string cid       = responseKey.Substring(idStart + 4, (responseKey.Length - (idStart + 4)));
            string term      = responseKey.Substring(responseKey.Length - 3, 3);

            doSaveCustomerID(cid);
            txtkey1.Text = returnKey.Substring(0, 5);
            txtkey2.Text = returnKey.Substring(5, 5);
            txtkey3.Text = returnKey.Substring(10, 5);
            txtkey4.Text = returnKey.Substring(15, 5);
            txtkey5.Text = returnKey.Substring(20, 5);
            txtvkey.Text = term;
            return(true);
        }
Example #5
0
        private void ShowUserInformation()
        {
            if (dst.Tables["user"] != null)
            {
                dst.Tables["user"].Clear();
            }
            string sc = " SELECT  * FROM card WHERE 1 = 1 ";

            if (m_sBarcode != "")
            {
                sc += " AND barcode = '" + m_sBarcode + "' ";
            }
            else if (m_sCard_id != "")
            {
                sc += " AND id = '" + m_sCard_id + "' ";
            }
            try
            {
                myAdapter = new SqlDataAdapter(sc, myConnection);
                if (myAdapter.Fill(dst, "user") <= 0)
                {
                    FormMSG fm = new FormMSG();
                    fm.btnYes.Visible = false;
                    fm.btnNo.Visible  = false;
                    fm.m_sMsg         = " User Not Found ";
                    fm.ShowDialog();
                    return;
                }
            }
            catch (Exception ex)
            {
                Program.ShowExp(sc, ex);
                myConnection.Close();
                return;
            }
            DataRow dr           = dst.Tables["user"].Rows[0];
            int     nAccessLevel = Program.MyIntParse(dr["access_level"].ToString());

            if (nAccessLevel >= 10)
            {
                ckbAdmin.Checked = true;
            }
            else
            {
                ckbAdmin.Checked      = false;
                ckbDeleteItem.Checked = Program.MyBooleanParse(dr["access_delete_item"].ToString());
                ckbRefund.Checked     = Program.MyBooleanParse(dr["access_refund"].ToString());
                ckbDiscount.Checked   = Program.MyBooleanParse(dr["access_discount"].ToString());
                ckbCashdraw.Checked   = Program.MyBooleanParse(dr["access_cashdraw"].ToString());
                ckbXTotal.Checked     = Program.MyBooleanParse(dr["access_x_total"].ToString());
                ckbReport.Checked     = Program.MyBooleanParse(dr["access_report"].ToString());
                ckbVipPayment.Checked = Program.MyBooleanParse(dr["access_vip_payment"].ToString());
                ckbProduct.Checked    = Program.MyBooleanParse(dr["access_product"].ToString());
                ckbStock.Checked      = Program.MyBooleanParse(dr["access_stock"].ToString());
                ckbSetting.Checked    = Program.MyBooleanParse(dr["access_setting"].ToString());
                ckbDatabase.Checked   = Program.MyBooleanParse(dr["access_database"].ToString());
                ckbAdminZone.Checked  = Program.MyBooleanParse(dr["access_admin_zone"].ToString());
            }

            if (dr["name"].ToString().ToLower() == "admin")
            {
                txtName.ReadOnly = true;
            }
            txtAddress1.Text        = dr["address1"].ToString();
            txtAddress2.Text        = dr["address2"].ToString();
            txtAddress3.Text        = dr["address3"].ToString();
            txtName.Text            = dr["name"].ToString();
            txtBarcode.Text         = dr["barcode"].ToString();
            txtMobile.Text          = dr["mobile"].ToString();
            txtPhone.Text           = dr["phone"].ToString();
            txtid.Text              = dr["id"].ToString();
            m_oldBarcode            = dr["barcode"].ToString();
            cbPriceLevel.Text       = dr["price_level"].ToString();
            txtPoints.Text          = dr["points"].ToString();
            txtvipdiscountrate.Text = Program.MyDoubleParse(dr["discount"].ToString()).ToString("p");
            string lang = dr["language"].ToString();

            if (lang == "2")
            {
                cbLanguage.Text = "English";
            }
            else if (lang == "1")
            {
                cbLanguage.Text = "Others";
            }
            else
            {
                cbLanguage.Text = "";
            }
            if (!m_bVIP)
            {
                txtcompany.Text    = GetCompanyInfo("trading_name");
                txtcompany.Enabled = false;
            }
            else
            {
                txtcompany.Enabled = true;
                txtcompany.Text    = dr["trading_name"].ToString();
            }
        }
Example #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Please enter Customer Name");
                txtName.Focus();
                return;
            }
            string viprate = txtvipdiscountrate.Text;

            viprate = viprate.Replace("%", "");
            if (viprate.Trim() == "")
            {
                viprate = "0";
            }
            try
            {
                double.Parse(viprate);
                if (Program.MyDoubleParse(viprate) > 1)
                {
                    m_dVipDiscount = Program.MyDoubleParse(viprate) / 100;
                }
                else
                {
                    m_dVipDiscount = Program.MyDoubleParse(viprate);
                }
            }
            catch (Exception ex)
            {
                string sex = ex.ToString();
                MessageBox.Show("Please type in number only for discount");
                txtvipdiscountrate.Text = "";
                return;
            }

            string sAccessLevel = "8";

            if (this.ckbAdmin.Checked)
            {
                sAccessLevel = "10";
            }
            if (btnSave.Text == "Save")
            {
                if (bBarcodeExist(txtBarcode.Text))
                {
                    MessageBox.Show("Error, Duplicate barcode");
                    return;
                }

                string cardID = "";
                if (dst.Tables["addnewcustomer"] != null)
                {
                    dst.Tables["addnewcustomer"].Clear();
                }
                string sc = " INSERT INTO card (name, email, phone, mobile, address1, address2, address3, barcode ";
                sc += ", type, gst_rate, access_level, password, m_discount_rate, discount, price_level ";
                sc += ", access_delete_item, access_refund, access_discount, access_cashdraw, access_x_total, access_report ";
                sc += ", access_vip_payment, access_product, access_stock, access_setting, access_database, access_admin_zone ";
                sc += ", trading_name, language) VALUES(";
                sc += " N'" + Program.EncodeQuote(txtName.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtBarcode.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtPhone.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtMobile.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtAddress1.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtAddress2.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtAddress3.Text) + "' ";
                sc += ", N'" + Program.EncodeQuote(txtBarcode.Text) + "' ";
                if (m_bVIP)
                {
                    sc += ", 6 ";
                    sc += ", " + GetSysGstRate() + " ";
                    sc += ", 0 ";
                    sc += ", '" + Program.md5(System.DateTime.Now.ToOADate().ToString()) + "'";
                    sc += ", '" + m_dVipDiscount.ToString() + "'";
                    sc += ", '" + m_dVipDiscount.ToString() + "'";
                    if (cbPriceLevel.Text == "")
                    {
                        cbPriceLevel.Text = "0";
                    }
                    sc += ", '" + cbPriceLevel.Text + "'";
                    sc += ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ";
                }
                else
                {
                    sc += ", 4";
                    sc += ", " + GetSysGstRate() + " ";
                    sc += ", " + sAccessLevel + " ";
                    sc += ", '" + Program.md5(System.DateTime.Now.ToOADate().ToString()) + "'";
                    sc += ", ''";
                    sc += ", ''";
                    sc += ", 0";

                    sc += ", '" + this.ckbDeleteItem.Checked + "'";
                    sc += ", '" + this.ckbRefund.Checked + "'";
                    sc += ", '" + this.ckbDiscount.Checked + "'";
                    sc += ", '" + this.ckbCashdraw.Checked + "'";
                    sc += ", '" + this.ckbXTotal.Checked + "'";
                    sc += ", '" + this.ckbReport.Checked + "'";
                    sc += ", '" + this.ckbVipPayment.Checked + "'";
                    sc += ", '" + this.ckbProduct.Checked + "'";
                    sc += ", '" + this.ckbStock.Checked + "'";
                    sc += ", '" + this.ckbSetting.Checked + "'";
                    sc += ", '" + this.ckbDatabase.Checked + "'";
                    sc += ", '" + this.ckbAdminZone.Checked + "'";
                }
                sc += ",'" + Program.EncodeQuote(txtcompany.Text) + "'";
                if (this.cbLanguage.Text == "English")
                {
                    sc += ", 2";
                }
                else if (this.cbLanguage.Text == "Others")
                {
                    sc += ", 1";
                }
                else
                {
                    sc += ", 0";
                }
                sc += ") ";
                sc += " SELECT IDENT_CURRENT('card') AS id";
                try
                {
                    myAdapter = new SqlDataAdapter(sc, myConnection);
                    if (myAdapter.Fill(dst, "addnewcustomer") <= 0)
                    {
                        return;
                    }
                    else
                    {
                        cardID = dst.Tables["addnewcustomer"].Rows[0]["id"].ToString();
                    }
                }
                catch (Exception e1)
                {
                    Program.ShowExp(sc, e1);
                    return;
                }
                m_sBarcode = cardID;
                FormMSG fm = new FormMSG();
                fm.btnNo.Visible  = false;
                fm.btnYes.Visible = false;
                fm.m_sMsg         = " User has been added";
                fm.ShowDialog();
                Close();
            }
            else if (btnSave.Text == "Update")
            {
                if (m_oldBarcode != Program.EncodeQuote(txtBarcode.Text))
                {
                    if (bBarcodeExist(txtBarcode.Text))
                    {
                        MessageBox.Show("Error, Duplicate barcode");

                        return;
                    }
                }

                string type = "";
                string sc1  = " Select type from card where id = '" + txtid.Text + "'";
                try
                {
                    myAdapter = new SqlDataAdapter(sc1, myConnection);
                    if (myAdapter.Fill(dst, "gettype") <= 0)
                    {
                        return;
                    }
                    else
                    {
                        type = dst.Tables["gettype"].Rows[0]["type"].ToString();
                    }
                }
                catch (Exception e1)
                {
                    Program.ShowExp(sc1, e1);
                    return;
                }

                string sc = " UPDATE card SET address1 = N'" + Program.EncodeQuote(txtAddress1.Text) + "'";
                sc += " , address2 = N'" + Program.EncodeQuote(txtAddress2.Text) + "'";
                sc += " , name = N'" + txtName.Text + "'";
                sc += " , address3 = N'" + Program.EncodeQuote(txtAddress3.Text) + "'";
                sc += " , phone = '" + Program.EncodeQuote(txtPhone.Text) + "'";
                sc += " , mobile = '" + Program.EncodeQuote(txtMobile.Text) + "'";
                sc += " , barcode ='" + Program.EncodeQuote(txtBarcode.Text) + "'";
                sc += " , discount ='" + m_dVipDiscount.ToString() + "'";
                sc += " , m_discount_rate ='" + m_dVipDiscount.ToString() + "'";

                sc += " , price_level = '" + Program.EncodeQuote(this.cbPriceLevel.Text) + "'";

                sc += " , trading_name  ='" + Program.EncodeQuote(txtcompany.Text) + "'";
                if (cbLanguage.Text == "English")
                {
                    sc += " , language  ='2'";
                }
                else if (cbLanguage.Text == "Others")
                {
                    sc += " , language  ='1'";
                }
                else
                {
                    sc += " , language  ='0'";
                }
                if (type == "4")
                {
                    sc += ", access_level = " + sAccessLevel;
                    sc += ", access_delete_item = '" + this.ckbDeleteItem.Checked + "'";
                    sc += ", access_refund = '" + this.ckbRefund.Checked + "'";
                    sc += ", access_discount = '" + this.ckbDiscount.Checked + "'";
                    sc += ", access_cashdraw = '" + this.ckbCashdraw.Checked + "'";
                    sc += ", access_x_total = '" + this.ckbXTotal.Checked + "'";
                    sc += ", access_report = '" + this.ckbReport.Checked + "'";
                    sc += ", access_vip_payment = '" + this.ckbVipPayment.Checked + "'";
                    sc += ", access_product = '" + this.ckbProduct.Checked + "'";
                    sc += ", access_stock = '" + this.ckbStock.Checked + "'";
                    sc += ", access_setting = '" + this.ckbSetting.Checked + "'";
                    sc += ", access_database = '" + this.ckbDatabase.Checked + "'";
                    sc += ", access_admin_zone = '" + this.ckbAdminZone.Checked + "'";
                }
                sc += " WHERE id ='" + txtid.Text + "'";
                try
                {
                    myCommand            = new SqlCommand(sc);
                    myCommand.Connection = myConnection;
                    myCommand.Connection.Open();
                    myCommand.ExecuteNonQuery();
                    myCommand.Connection.Close();
                }
                catch (Exception ex)
                {
                    Program.ShowExp(sc, ex);
                    return;
                }
                FormMSG fm = new FormMSG();
                fm.btnNo.Visible  = false;
                fm.btnYes.Visible = false;
                fm.m_sMsg         = " User detail updated ";
                fm.ShowDialog();
                Close();
            }
        }
Example #7
0
        private void PosRefund()
        {
            merchant_id  = Program.m_sMyPosMateMerchantId;
            config_id    = Program.m_sMyPosMateConfigId;
            reference_id = m_sRefundReferenceNo;
            string refund_amount = (-m_dAmount).ToString();

            random_str  = m_sInvoiceNumber + "-" + DateTime.Now.ToString("yyyyMMdd-hhmmss");
            refData1    = "";
            refData2    = "";
            terminal_id = "";


            string formatted_string = "config_id=" + config_id;

            formatted_string += "&merchant_id=" + merchant_id;
            formatted_string += "&random_str=" + random_str;
            formatted_string += "&reference_id=" + reference_id;
            formatted_string += "&refund_amount=" + refund_amount;
            formatted_string += "&refund_password="******"")
            {
                formatted_string += "&terminal_id=" + terminal_id;
            }
            string final_data = formatted_string + merchant_account_id;
            string signature  = "";

            using (MD5 md5Hash = MD5.Create())
            {
                signature = GetMd5Hash(md5Hash, final_data);

                Console.WriteLine("The MD5 hash of " + final_data + " is: " + signature + ".");

                Console.WriteLine("Verifying the hash...");

                if (VerifyMd5Hash(md5Hash, final_data, signature))
                {
                    Console.WriteLine("The hashes are the same.");
                }
                else
                {
                    Console.WriteLine("The hashes are not same.");
                }
            }
            string host = Program.m_sMyPosMateUrlRefund + "?" + formatted_string + "&signature=" + signature;
            string sRet = Http.get(host);

            if (sRet == null)
            {
                MessageBox.Show("network anomaly", "prompt");
                return;
            }
            //txtDebug.Text = sRet;
            MyPosMate.PosRefundResponse pp = (MyPosMate.PosRefundResponse)JsonConvert.DeserializeObject <MyPosMate.PosRefundResponse>(sRet);
            //int p = 0;
            //string rCode = JsonGetSimpleValue(sRet, "\"code\":", ref p);
            //string rMessage = JsonGetSimpleValue(sRet, "\"message\":", ref p);
            if (pp.status == true)
            {
                m_bSuccess = true;
                return;
            }
            else
            {
                //MessageBox.Show("refund failed: " + pp.message, "prompt");
                FormMSG fm = new FormMSG();
                fm.btnYes.Visible = false;
                fm.btnNo.Visible  = false;
                fm.m_sMsg         = "refund failed: " + pp.message;
                fm.ShowDialog();
                return;
            }
        }
Example #8
0
        private bool updatelevelprice(string code)
        {
            string sc = " UPDATE code_relations SET ";

            if (!this.checkBox1.Checked)
            {
                sc += "  level_price1 = N'" + Program.MyMoneyParse(this.tblevel1.Text) + "' ";
                sc += ", level_price2 = N'" + Program.MyMoneyParse(this.tblevel2.Text) + "' ";
                sc += ", level_price3 = N'" + Program.MyMoneyParse(this.tblevel3.Text) + "' ";
                sc += ", level_price4 = N'" + Program.MyMoneyParse(this.tblevel4.Text) + "' ";
                sc += ", level_price5 = N'" + Program.MyMoneyParse(this.tblevel5.Text) + "' ";
                sc += ", level_price6 = N'" + Program.MyMoneyParse(this.tblevel6.Text) + "' ";
            }
            else if (this.checkBox1.Checked)
            {
                sc += "  level_price1 = N'" + Program.MyMoneyParse(this.tblevel1.Text) / (1 + d_taxrate) + "' ";
                sc += ", level_price2 = N'" + Program.MyMoneyParse(this.tblevel2.Text) / (1 + d_taxrate) + "' ";
                sc += ", level_price3 = N'" + Program.MyMoneyParse(this.tblevel3.Text) / (1 + d_taxrate) + "' ";
                sc += ", level_price4 = N'" + Program.MyMoneyParse(this.tblevel4.Text) / (1 + d_taxrate) + "' ";
                sc += ", level_price5 = N'" + Program.MyMoneyParse(this.tblevel5.Text) / (1 + d_taxrate) + "' ";
                sc += ", level_price6 = N'" + Program.MyMoneyParse(this.tblevel6.Text) / (1 + d_taxrate) + "' ";
            }
            sc += " WHERE code = " + code;
            try
            {
                myCommand            = new SqlCommand(sc);
                myCommand.Connection = myConnection;
                myCommand.Connection.Open();
                myCommand.ExecuteNonQuery();
                myCommand.Connection.Close();
            }
            catch (Exception e1)
            {
                Program.ShowExp(sc, e1);
                return(false);
            }

            FormMSG fm = new FormMSG();

            fm.m_sMsg         = "Level Price Updated!";
            fm.btnNo.Visible  = false;
            fm.btnYes.Visible = false;
            fm.ShowDialog();
            if (!this.checkBox1.Checked)
            {
                this.lblRetailPrice1.Text = d_retail_price_no_gst.ToString(".00");
                this.lblRetailPrice2.Text = d_retail_price_no_gst.ToString(".00");
                this.lblRetailPrice3.Text = d_retail_price_no_gst.ToString(".00");
                this.lblRetailPrice4.Text = d_retail_price_no_gst.ToString(".00");
                this.lblRetailPrice5.Text = d_retail_price_no_gst.ToString(".00");
                this.lblRetailPrice6.Text = d_retail_price_no_gst.ToString(".00");
                this.lblLevelRate1.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel1.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate2.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel2.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate3.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel3.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate4.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel4.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate5.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel5.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate6.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel6.Text) / d_retail_price_no_gst, 2) * 100).ToString() + "%";
            }
            else if (this.checkBox1.Checked)
            {
                this.lblRetailPrice1.Text = d_retail_price_with_gst.ToString(".00");
                this.lblRetailPrice2.Text = d_retail_price_with_gst.ToString(".00");
                this.lblRetailPrice3.Text = d_retail_price_with_gst.ToString(".00");
                this.lblRetailPrice4.Text = d_retail_price_with_gst.ToString(".00");
                this.lblRetailPrice5.Text = d_retail_price_with_gst.ToString(".00");
                this.lblRetailPrice6.Text = d_retail_price_with_gst.ToString(".00");
                this.lblLevelRate1.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel1.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate2.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel2.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate3.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel3.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate4.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel4.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate5.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel5.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
                this.lblLevelRate6.Text   = (Math.Round(Program.MyMoneyParse(this.tblevel6.Text) / d_retail_price_with_gst, 2) * 100).ToString() + "%";
            }
            return(true);
        }
        private void FormConfig_Load(object sender, EventArgs e)
        {
            this.Server.Text             = Program.m_sServer;
            this.server2.Text            = Program.m_sServer2;
            this.User.Text               = Program.m_sUser;
            this.Password.Text           = Program.m_sPass;
            this.Catalog.Text            = Program.m_sCompanyName;
            this.PrinterName.Text        = Program.m_sPrinterName;
            this.PaperWidth.Text         = Program.m_nPaperWidth.ToString();
            this.fontName.Text           = Program.m_sFontName;
            this.fontSize.Text           = Program.m_sFontSize;
            this.fontStyle.Text          = Program.m_sFontStyle;
            this.ScaleName.Text          = Program.m_sScaleName;
            this.ScannerName.Text        = Program.m_sScannerName;
            this.textStationID.Text      = Program.m_sStationID;
            this.textTimeout.Text        = Program.m_nTimeout.ToString();
            this.textBoxAdUrl.Text       = Program.m_sAdUrl;
            this.cbSerialDevicePort.Text = Program.m_sSerialDevicePort;

            this.chkCustomerDis.Checked = bool.Parse(Program.m_sDMoniter.ToString());

            this.txtgroceryitem.Text            = Program.m_sgroceryitem;
            this.txtgroceryweight.Text          = Program.m_sgroceryweight;
            this.txtvoidscale.Text              = Program.m_svoidscale;
            this.txtgroceryitemaddup.Text       = Program.m_sgroceryitemaddup;
            this.txtgroceryweightitemaddup.Text = Program.m_sgroceryweightitemaddup;
            this.txtvoiddisc.Text = Program.m_svoiddis;

            this.chkEnableEftpos.Checked = bool.Parse(Program.m_bEnableEftpos.ToString());

            this.eftposCom.Text            = Program.m_sEftposCom;
            this.txtVoucherServiceURL.Text = Program.m_sVoucherServiceURL;
            this.txtelog.Text            = Program.m_sEftposLogDay;
            this.chkelog.Checked         = bool.Parse(Program.m_bEnableEftposLog.ToString());
            this.rdbmonitorr.Checked     = bool.Parse(Program.m_bRegularMonitor.ToString());
            this.rdbmonitors.Checked     = bool.Parse(Program.m_bSmallMonitor.ToString());
            this.chkEnableVipDis.Checked = bool.Parse(Program.m_bEnableVipDis.ToString());

            this.ckbSpecialDis.Checked = bool.Parse(Program.m_bEnableSpecialDis.ToString());

            this.ckbBackupData.Checked = bool.Parse(Program.m_backupdata.ToString());
            this.tbBackup.Text         = Program.m_backuproot;
            this.ckbSync.Checked       = bool.Parse(Program.m_sync.ToString());
            this.tbSyncRoot.Text       = Program.m_syncroot;

            this.txtiis.Text       = Program.m_sIISServer;
            this.cbEftposType.Text = Program.m_eftposType;
            this.cbDebugLog.Text   = Program.m_debugLogType;
            this.Server.Focus();

            if (Program.m_bServer2)
            {
                this.Hide();
                FormMSG confirm = new FormMSG();
                confirm.m_sMsg     = "Server 1 Down ";
                confirm.m_sconfirm = "1";
                confirm.m_showconf = "1";
                confirm.ShowDialog();
                if (confirm.m_sconfirm == "1")
                {
                    SaveSettings();
                    this.Close();
                }
                else if (confirm.m_showconf == "1")
                {
                    this.Show();
                }
            }
        }
Example #10
0
        private void eftpos_Load(object sender, EventArgs e)
        {
            m_left = this.Left;

            if (Program.m_eftposType == "ingenico")
            {
                if (m_sRefNum.Length > 3)
                {
                    m_sRefNum = m_sRefNum.Substring(m_sRefNum.Length - 3, 3);
                }
                else
                {
                    m_sRefNum = Program.MyIntParse(Program.m_sStationID).ToString("D3");
                }
            }
            else
            {
                if (Program.m_eftposType != "dps" || Program.m_eftposType != "dps_hit")
                {
                    m_sRefNum = Program.MyIntParse(Program.m_sStationID).ToString("D3");
                }
            }
            if (Program.m_eftposType == "nitro")
            {
                this.Left = -16348;
                //				this.ShowInTaskbar = false;
                //				timer3.Start(); //hide main window
                if (m_nitro == null)
                {
                    m_nitro = new CNitro();
                }
                m_sReceipt = "";
            }
            if (m_bEnableCancel)
            {
                btnCancel.Visible = true;
            }
            else
            {
                btnCancel.Visible = false;
            }
            if (!m_bAdmin)
            {
                if (Program.m_eftposType == "ingenico")
                {
                    if (Program.m_sEftposCom == "0" || Program.m_sEftposCom == "" || Program.m_sEftposCom == null)
                    {
                        FormMSG fm = new FormMSG();
                        //						fm.btnNo.Visible = false;
                        //						fm.btnYes.Visible = false;
                        fm.m_sMsg = "Please check Port!";
                        fm.ShowDialog();
                        return;
                    }
                    m_ee.Purchase(m_dAmount, m_dCashOut, m_sRefNum);
                }
                else if (Program.m_eftposType == "smartpay")
                {
                    if (m_dAmount < 0)
                    {
                        m_es.Refund(0 - m_dAmount, m_sRefNum);
                    }
                    else
                    {
                        m_es.Purchase(m_dAmount, m_dCashOut, m_sRefNum);
                    }
                    txtResposneEftpos.Text = "SWIPE CARD";
                }
                else if (Program.m_eftposType == "vxlink")
                {
                    if (Program.MyCheckPrinter(Program.m_sPrinterName))
                    {
                        timer1.Stop();
                        MyMessageBox fm = new MyMessageBox();
                        fm.m_title = "Printer Error";
                        fm.m_msg   = "Printer Error, please check printer first before using EFTPOS";
                        fm.ShowDialog();
                        this.Close();
                        return;
                    }
                    m_evx.ConfigurePrinting();
                    m_evx.Purchase(m_dAmount, m_dCashOut, m_sRefNum);
                }
                else if (Program.m_eftposType == "vllink")
                {
                    m_evl.Purchase(m_dAmount, m_dCashOut, m_sRefNum);
                }
                else if (Program.m_eftposType == "dps")
                {
                    m_dps             = new FDps();
                    this.Left         = -16348;
                    m_dps.m_dPurchase = m_dAmount;
                    m_dps.m_dCashOut  = m_dCashOut;
                    m_dps.m_sRef      = m_sRefNum;
                    m_dps.ShowDialog();
                    if (m_dps.m_bAuthorized)
                    {
                        sResponseTxt = "ACCEPTED";
                        m_bAccepted  = true;
                        m_sReceipt   = m_dps.m_sReceipt;
                    }
                    this.Close();
                    return;
                }
                else if (Program.m_eftposType == "dps_hit")
                {
                    FormDPSHIT fm = new FormDPSHIT();
                    this.Left     = -16348;
                    fm.m_dAmount  = m_dAmount;
                    fm.m_dCashOut = m_dCashOut;
                    fm.m_sRef     = m_sRefNum;
                    fm.ShowDialog();
                    if (fm.m_bAuthorized)
                    {
                        sResponseTxt = "ACCEPTED";
                        m_bAccepted  = true;
                        m_sReceipt   = fm.m_sReceipt;
                    }
                    this.Close();
                    return;
                }
                else if (Program.m_eftposType == "verifone")
                {
                    this.Left = -16348;
                    string sRet = m_valut.Purchase(m_dAmount, m_dCashOut, m_dChequeAmount, m_sRefNum);
                    if (sRet == "ACCEPTED")
                    {
                        sResponseTxt = "ACCEPTED";
                        m_bAccepted  = true;
                        m_sReceipt   = m_valut.GetReceiptText();
                    }
                    else
                    {
                        sResponseTxt = "DECLINED";
                        m_bAccepted  = false;
                        m_sReceipt   = m_valut.GetReceiptText();
                    }
                    this.Close();
                    return;
                }
                else if (Program.m_eftposType == "nitro")
                {
                    Program.g_log.Info("nitro start, amount=" + m_dAmount.ToString("c"));
                    if (!m_nitro.Connect())
                    {
                        this.Left = m_left;
                        this.Close();
                        return;
                    }
                    if (m_dAmount > 0)
                    {
                        if (!m_nitro.Purchase(m_dAmount, m_dCashOut, m_dChequeAmount, m_sRefNum))
                        {
                            this.Close();
                            return;
                        }
                    }
                    else
                    {
                        if (!m_nitro.Refund(0 - m_dAmount, m_sRefNum))
                        {
                            this.Close();
                            return;
                        }
                    }
                }
                m_nCount        = 0;
                timer1.Interval = 500;
                timer1.Start();
                btnok.Visible = false;
            }
            if (m_bAdmin)
            {
                btnInt.Visible    = true;
                btnSettle.Visible = true;
            }
        }