private void manage_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(amount.Text.Trim()))
            {
                GF.Error("กรุณากรอก 'จำนวนเงิน' !!");
                amount.Select();
                return;
            }

            if (Convert.ToInt32(amount.Text.Trim()) <= 0)
            {
                GF.Error("กรุณากรอก 'จำนวนเงิน' !!");
                amount.Select();
                return;
            }

            if (payment_type.SelectedIndex == 1)
            {
                if (string.IsNullOrEmpty(card_no.Text.Trim().Replace("_", "").Replace(" ", "")))
                {
                    GF.Error("กรุณากรอก 'หมายเลขบัตร' !!");
                    card_no.Select();
                    return;
                }

                if (card_no.Text.Trim().Replace("_", "").Replace(" ", "").Length < 16)
                {
                    GF.Error("กรุณากรอก 'หมายเลขบัตร' ให้ครบ 16 หลัก !!");
                    card_no.Select();
                    return;
                }

                if (string.IsNullOrEmpty(card_expiry_date.Text.Trim().Replace("_", "").Replace("/", "").Replace(" ", "")))
                {
                    GF.Error("กรุณากรอก 'วันหมดอายุบัตร' !!");
                    card_expiry_date.Select();
                    return;
                }

                if (card_expiry_date.Text.Trim().Replace("_", "").Replace("/", "").Replace(" ", "").Length < 4)
                {
                    GF.Error("กรุณากรอก 'วันหมดอายุบัตร' ให้ครบ !!\r\n\r\n(หากเลขเดือนมีหลักเดียว ให้เติม 0 ข้างหน้า)");
                    card_expiry_date.Select();
                    return;
                }
            }

            string[] Data =
            {
                payment_type.Text,
                GF.formatNumber(Convert.ToInt32(amount.Text)),
                "",
                "",
                "",
                "",
                (payment_type.SelectedItem as ComboItem).Key.ToString()
            };

            if (payment_type.SelectedIndex == 1)
            {
                Data[2] = card_no.Text;
                Data[3] = card_expiry_date.Text;
            }

            GF.addPaymentRow((this.Owner as member_pt).payment_DGV, Data, (payment_type.SelectedItem as ComboItem).Key.ToString());

            this.Close();
        }
        private void bill_no_KeyUp(object sender, KeyEventArgs e)
        {
            if (!string.IsNullOrEmpty(bill_no.Text.Trim()) && e.KeyCode == Keys.Enter)
            {
                GF.showLoading(this);
                Dictionary <string, string> values = new()
                {
                    { "bill_no", bill_no.Text.Trim() }
                };

                Dictionary <string, object> Obj = DB.Post("Shop/getDataByBillNo/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (item.Keys.Count > 0)
                        {
                            string Product_Data = item["product_data"].ToString();
                            string Payment_Data = item["payment_data"].ToString();
                            (this.Owner as shop).bill_id = item["bill_id"].ToString();

                            if (item["is_void"].ToString() == "0" && GF.isAdmin)
                            {
                                (this.Owner as shop).void_btn.Visible = true;
                                (this.Owner as shop).void_txt.Visible = false;
                                (this.Owner as shop).void_txt.Left    = 273;
                            }

                            if (item["is_void"].ToString() == "1")
                            {
                                (this.Owner as shop).void_txt.Visible = true;
                                (this.Owner as shop).void_txt.Text    = "*** บิลถูก VOID : " + item["void_reason"].ToString() + " ***\r\nโดย : " + item["void_by"].ToString() + " เมื่อ " + GF.formatDBDateTime(item["void_datetime"].ToString());
                                (this.Owner as shop).void_txt.Left    = (this.Owner as shop).void_btn.Left;
                            }

                            string[] tmp_data = Product_Data.Split(new string[] { "!!" }, StringSplitOptions.None);
                            foreach (string product in tmp_data)
                            {
                                string[] Item = product.Split(new string[] { "##" }, StringSplitOptions.None);
                                (this.Owner as shop).addRow(Item[0].ToString(), Item[1].ToString(), Item[2].ToString(), Item[3].ToString(), Item[5].ToString(), Item[6].ToString(), Item[7].ToString());
                            }

                            tmp_data = Payment_Data.Split(new string[] { "!!" }, StringSplitOptions.None);
                            foreach (string payment in tmp_data)
                            {
                                string[]     Item = payment.Split(new string[] { "##" }, StringSplitOptions.None);
                                DataGridView DGV  = (this.Owner as shop).payment_DGV;
                                DGV.Rows.Add(
                                    GF.payment_type[Convert.ToInt32(Item[0].ToString())],
                                    GF.formatNumber(Convert.ToInt32(Item[1].ToString())),
                                    (Item[2] ?? "").ToString(),
                                    (Item[3] ?? "").ToString(),
                                    Item[4].ToString(),
                                    GF.formatDBDateTime(Item[5].ToString()),
                                    Item[0].ToString()
                                    );
                            }

                            (this.Owner as shop).product_DGV.ClearSelection();
                            (this.Owner as shop).payment_DGV.ClearSelection();

                            (this.Owner as shop).bill_search_btn.Text = "เปิดบิลใหม่";
                            (this.Owner as shop).product_code.Enabled = false;
                            GF.disableBtn((this.Owner as shop).add_product_btn);
                            (this.Owner as shop).product_DGV.Enabled = false;
                            GF.disableBtn((this.Owner as shop).add_payment_btn);
                            (this.Owner as shop).payment_DGV.Enabled = false;
                            GF.disableBtn((this.Owner as shop).manage_btn);

                            (this.Owner as shop).print_btn.Visible = true;
                            (this.Owner as shop).print_btn.Left    = (this.Owner as shop).manage_btn.Left;
                            (this.Owner as shop).print_btn.Top     = (this.Owner as shop).manage_btn.Top;
                            (this.Owner as shop).print_btn.BringToFront();
                        }
                    }
                }

                GF.closeLoading();
                this.Close();
            }
        }