Example #1
0
        public history_payment(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

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

            if (Obj != null)
            {
                branch_id.Items.Add(new ComboItem(0, "ทุกสาขา"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(GF.toInt(Item["branch_id"].ToString()), Item["branch_name"].ToString() + " (" + Item["prefix"].ToString() + ")"));
                    }
                }

                branch_id.SelectedIndex = 0;
                GF.resizeComboBox(branch_id);
            }
            else
            {
                GF.closeLoading();
                GF.Error("ไม่มีข้อมูล 'สาขา' ในฐานข้อมูล !!\r\n\r\nกรุณาติดต่อผู้ดูแลระบบ !!");
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("detail", "รายละเอียด", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("branch_name", "สาขา"));
            DGVC.Add(new dgvColumn("cash", "เงินสด"));
            DGVC.Add(new dgvColumn("card", "บัตร"));
            DGVC.Add(new dgvColumn("card_no", "บัตรหมายเลข"));
            DGVC.Add(new dgvColumn("card_expiry_date", "วันหมดอายุบัตร"));
            DGVC.Add(new dgvColumn("by", "ผู้รับเงิน"));
            btn_dgv.initColumn(DGVC);

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }
Example #2
0
        public trainer_job_manage()
        {
            InitializeComponent();

            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") }
            };

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

            if (Obj != null)
            {
                trainer_emp_id.Items.Add(new ComboItem(0, "เลือก เทรนเนอร์"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        trainer_emp_id.Items.Add(new ComboItem(GF.toInt(Item["trainer_emp_id"].ToString()), Item["trainer_name"].ToString()));
                    }
                }

                trainer_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(trainer_emp_id);
            }
        }
Example #3
0
        public history_checkin(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

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

            if (Obj != null)
            {
                branch_id.Items.Add(new ComboItem(0, "ทุกสาขา"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(GF.toInt(Item["branch_id"].ToString()), Item["branch_name"].ToString() + " (" + Item["prefix"].ToString() + ")"));
                    }
                }

                branch_id.SelectedIndex = 0;
                GF.resizeComboBox(branch_id);
            }
            else
            {
                GF.closeLoading();
                GF.Error("ไม่มีข้อมูล 'สาขา' ในฐานข้อมูล !!\r\n\r\nกรุณาติดต่อผู้ดูแลระบบ !!");
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("checkin_datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("branch_name", "สาขา", DataGridViewContentAlignment.MiddleLeft));
            btn_dgv.initColumn(DGVC);

            GF.closeLoading();
        }
        public employee_manage()
        {
            InitializeComponent();

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };
            Dictionary <string, object> Obj = DB.Post("Branch/BranchList/", values);

            if (Obj != null)
            {
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(GF.toInt(Item["branch_id"].ToString()), Item["branch_name"].ToString()));
                    }
                }
            }

            branch_id.SelectedIndex = 0;
            GF.resizeComboBox(branch_id);
        }
        public member()
        {
            InitializeComponent();

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            gender.SelectedIndex = 0;
            filter.SelectedIndex = 0;

            Dictionary <string, string> values = new()
            {
                { "user_id", GF.userID }
            };

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

            if (Obj != null)
            {
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Branch in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        branch_id.Items.Add(new ComboItem(Convert.ToInt32(Branch["branch_id"].ToString()), Branch["branch_name"].ToString()));
                    }
                }
                GF.resizeComboBox(branch_id);
                int selectedIndex = 0;

                foreach (var cb in branch_id.Items)
                {
                    if ((cb as ComboItem).Key.ToString() == GF.Settings("branch_id"))
                    {
                        branch_id.SelectedIndex = selectedIndex;
                        break;
                    }
                    selectedIndex++;
                }
            }

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("member_no", "รหัสสมาชิก"));
            DGVC.Add(new dgvColumn("card_no", "เลขบัตรสมาชิก"));
            DGVC.Add(new dgvColumn("fullname", "ชื่อ", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("gender", "เพศ"));
            DGVC.Add(new dgvColumn("start_date", "บันทึกข้อมูลเมื่อ"));
            DGVC.Add(new dgvColumn("member_type", "ประเภทสมาชิก"));
            DGVC.Add(new dgvColumn("contract_no", "หมายเลขสัญญา"));
            DGVC.Add(new dgvColumn("during_date", "ระหว่างวันที่"));
            DGVC.Add(new dgvColumn("birthday", "วันเกิด"));
            DGVC.Add(new dgvColumn("age", "อายุ"));
            DGVC.Add(new dgvColumn("tel", "โทรศัพท์"));
            DGVC.Add(new dgvColumn("drop_during", "ใช้สิทธิ์ดรอประหว่างวันที่"));
            DGVC.Add(new dgvColumn("is_drop_active", "is_drop_active", DataGridViewContentAlignment.BottomCenter, false));
            DGVC.Add(new dgvColumn("suspend_since", "ระงับใช้เมื่อ"));
            DGVC.Add(new dgvColumn("suspend_reason", "สาเหตุ"));
            DGVC.Add(new dgvColumn("suspend_by", "ระงับโดย"));
            DGVC.Add(new dgvColumn("member_id", "member_id", DataGridViewContentAlignment.BottomCenter, false));
            DGVC.Add(new dgvColumn("member_drop_id", "member_drop_id", DataGridViewContentAlignment.BottomCenter, false));
            btn_dgv.initColumn(DGVC);

            btn_dgv.DGV.MouseClick += (ss, ee) =>
            {
                if (ee.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (btn_dgv.DGV.HitTest(ee.X, ee.Y).ColumnIndex > -1 && btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex > -1)
                    {
                        btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].Selected = true;
                        btn_dgv.theContextMenu.Items.Clear();
                        if (btn_dgv.DGV.SelectedRows.Count == 1)
                        {
                            btn_dgv.theContextMenu.Items.Add("แก้ไข", null, new EventHandler(EditEvent));
                            btn_dgv.theContextMenu.Items.Add("-");
                            btn_dgv.theContextMenu.Items.Add("ซื้อ MEMBER", null, new EventHandler(BuyMemberEvent));

                            if (!string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["member_no"].Value ?? "").ToString()))
                            {
                                if (!string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["member_type"].Value ?? "").ToString()))
                                {
                                    btn_dgv.theContextMenu.Items.Add("ซื้อ PT", null, new EventHandler(BuyPTEvent));
                                    btn_dgv.theContextMenu.Items.Add("-");
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการซื้อ Member", null, new EventHandler(BuyMemberHistoryEvent));
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการซื้อ PT", null, new EventHandler(BuyPTHistoryEvent));
                                    btn_dgv.theContextMenu.Items.Add("-");
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการเข้าใช้", null, new EventHandler(CheckInHistoryEvent));
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการชำระเงิน", null, new EventHandler(PaymentHistoryEvent));
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการใช้ PT", null, new EventHandler(PTUsageHistoryEvent));
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการดรอป", null, new EventHandler(DropHistoryEvent));

                                    if ((btn_dgv.DGV.SelectedRows[0].Cells["member_type"].Value ?? "").ToString() != "หมดอายุแล้ว" && (btn_dgv.DGV.SelectedRows[0].Cells["member_type"].Value ?? "").ToString() != "ยังไม่ถึงวันเริ่มต้น")
                                    {
                                        if (string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["drop_during"].Value ?? "").ToString()) || (btn_dgv.DGV.SelectedRows[0].Cells["is_drop_active"].Value ?? "").ToString() == "NO")
                                        {
                                            btn_dgv.theContextMenu.Items.Add("-");
                                            btn_dgv.theContextMenu.Items.Add("ดรอป", null, new EventHandler(DropEvent));
                                        }
                                        else if (btn_dgv.DGV.SelectedRows[0].Cells["is_drop_active"].Value.ToString() == "YES")
                                        {
                                            btn_dgv.theContextMenu.Items.Add("-");
                                            btn_dgv.theContextMenu.Items.Add("ยกเลิกดรอป", null, new EventHandler(CancelDropEvent));
                                        }
                                    }

                                    btn_dgv.theContextMenu.Items.Add("-");
                                    btn_dgv.theContextMenu.Items.Add("บันทึก / เปลี่ยนแปลง บัตรสมาชิก", null, new EventHandler(CardNoEvent));
                                    btn_dgv.theContextMenu.Items.Add("ประวัติ การเปลี่ยนแปลง บัตรสมาชิก", null, new EventHandler(CardNoHistoryEvent));

                                    btn_dgv.theContextMenu.Items.Add("-");
                                    if (string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["suspend_since"].Value ?? "").ToString()))
                                    {
                                        btn_dgv.theContextMenu.Items.Add("ระงับการใช้งาน", null, new EventHandler(SuspendEvent));
                                    }
                                    else
                                    {
                                        btn_dgv.theContextMenu.Items.Add("ยกเลิก การระงับการใช้งาน", null, new EventHandler(CancelSuspendEvent));
                                    }
                                    btn_dgv.theContextMenu.Items.Add("ประวัติการระงับการใช้", null, new EventHandler(SuspendHistoryEvent));
                                }
                            }
                        }
                    }
                }
            };
        }
        public trainer_job_list()
        {
            InitializeComponent();

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") }
            };

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

            if (Obj != null)
            {
                trainer_emp_id.Items.Add(new ComboItem(0, "ทุกคน"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        trainer_emp_id.Items.Add(new ComboItem(GF.toInt(Item["trainer_emp_id"].ToString()), Item["trainer_name"].ToString()));
                    }
                }

                trainer_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(trainer_emp_id);
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("during", "ระหว่างเวลา"));
            DGVC.Add(new dgvColumn("detail", "รายละเอียด", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("trainer_name", "เทรนเนอร์", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("confirm_by", "ยืนยันว่าเกิดขึ้นจริง โดย"));
            DGVC.Add(new dgvColumn("confirm_datetime", "วันเวลา ที่ยืนยันว่าเกิดขึ้นจริง"));
            DGVC.Add(new dgvColumn("create_by", "สร้าง โดย"));
            DGVC.Add(new dgvColumn("create_datetime", "สร้าง เมื่อ"));
            DGVC.Add(new dgvColumn("last_modified_by", "ปรับปรุงล่าสุด โดย"));
            DGVC.Add(new dgvColumn("last_modified_datetime", "ปรับปรุงล่าสุด เมื่อ"));
            DGVC.Add(new dgvColumn("trainer_job_id", "trainer_job_id", DataGridViewContentAlignment.MiddleLeft, false));
            btn_dgv.initColumn(DGVC);

            btn_dgv.DGV.MouseClick += (ss, ee) =>
            {
                if (ee.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (btn_dgv.DGV.HitTest(ee.X, ee.Y).ColumnIndex > -1 && btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex > -1)
                    {
                        btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].Selected = true;
                        btn_dgv.theContextMenu.Items.Clear();
                        if (btn_dgv.DGV.SelectedRows.Count == 1)
                        {
                            btn_dgv.theContextMenu.Items.Add("แก้ไข", null, new EventHandler(EditEvent));
                            if (string.IsNullOrEmpty((btn_dgv.DGV.SelectedRows[0].Cells["confirm_by"].Value ?? "").ToString()))
                            {
                                btn_dgv.theContextMenu.Items.Add("ยืนยันว่าเกิดขึ้นจริง", null, new EventHandler(ConfirmEvent));
                            }
                        }
                    }
                }
            };

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }
Example #7
0
        private void member_pt_Load(object sender, EventArgs e)
        {
            GF.showLoading(this);

            if (onlySee)
            {
                disableAll();
            }

            if (isForceEdit || isForceAdd)
            {
                amount_left_lbl1.Visible = amount_left.Visible = amount_left_lbl2.Visible = true;
                seller_emp_lbl.Visible   = seller_emp_id.Visible = true;

                GF.disableBtn(add_payment_btn);
                payment_DGV.Enabled = false;
            }

            if (isAlreadyVoided)
            {
                amount_left.Enabled   = false;
                seller_emp_id.Enabled = false;
            }

            Dictionary <string, string> values = new()
            {
                { "branch_id", ((isForceAdd || isForceEdit || onlySee) ? "-1" : GF.Settings("branch_id")) }
            };

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

            if (Obj != null)
            {
                if (!isForceAdd && !isForceEdit)
                {
                    pt_emp_id.Items.Add(new ComboItem(0, "เลือก 'เทรนเนอร์'"));
                }

                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        pt_emp_id.Items.Add(new ComboItem(GF.toInt(Item["emp_id"].ToString()), Item["fullname"].ToString() + " (" + Item["nickname"].ToString() + ")"));
                        seller_emp_id.Items.Add(new ComboItem(GF.toInt(Item["emp_id"].ToString()), Item["fullname"].ToString() + " (" + Item["nickname"].ToString() + ")"));
                    }
                }

                pt_emp_id.SelectedIndex     = 0;
                seller_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(pt_emp_id);
                GF.resizeComboBox(seller_emp_id);
            }
            else
            {
                GF.Error("ไม่มีข้อมูล 'เทรนเนอร์' !!\r\n\r\nกรุณาแจ้งผู้ดูแลระบบ !!");
            }

            // GET BUY PT DATA
            if (!string.IsNullOrEmpty(member_pt_id))
            {
                values = new()
                {
                    { "member_pt_id", member_pt_id.Trim() }
                };

                Obj = DB.Post("Member/getBuyPTData/", values);

                if (Obj != null)
                {
                    if (Obj.ContainsKey("result"))
                    {
                        Dictionary <string, object> Item = GF.ToType <Dictionary <string, object> >(Obj["result"]);
                        if (Item.Keys.Count > 0)
                        {
                            hours.Text       = Item["max_hours"].ToString();
                            start_date.Text  = (Item["start_date"] ?? "").ToString();
                            expiry_date.Text = Item["expiry_date"].ToString();
                            price.Text       = Item["price"].ToString();
                            age.Text         = (Item["age"] ?? "").ToString();
                            amount_left.Text = (Item["left_hours"] ?? "").ToString();
                            note_txt.Text    = (Item["note"] ?? "").ToString();

                            foreach (ComboItem cb in pt_emp_id.Items)
                            {
                                if (cb.Key.ToString() == Item["pt_emp_id"].ToString())
                                {
                                    pt_emp_id.Text = cb.Value;
                                }
                            }

                            foreach (ComboItem cb in seller_emp_id.Items)
                            {
                                if (cb.Key.ToString() == Item["pt_seller_id"].ToString())
                                {
                                    seller_emp_id.Text = cb.Value;
                                }
                            }

                            string payment_data = (Item["payment_data"] ?? "").ToString().Trim();
                            if (!string.IsNullOrEmpty(payment_data))
                            {
                                payment_DGV.Rows.Clear();
                                string[] payment_record = payment_data.Split(new string[] { "!!" }, StringSplitOptions.None);
                                foreach (string payment_item in payment_record)
                                {
                                    string[] tmp = payment_item.Split(new string[] { "##" }, StringSplitOptions.None);
                                    string   the_payment_type = Array.Find(GF.payment_type, p => Convert.ToInt32(p.Key) == Convert.ToInt32(tmp[0].ToString())).Value;

                                    string[] Data =
                                    {
                                        the_payment_type,
                                        tmp[1].ToString(),
                                        (tmp[2] ?? "").ToString(),
                                        (tmp[3] ?? "").ToString(),
                                        tmp[4].ToString(),
                                        GF.formatDBDateTime(tmp[5].ToString()),
                                        tmp[6].ToString(),
                                        tmp[7].ToString()
                                    };

                                    GF.addPaymentRow(payment_DGV, Data, tmp[6].ToString());
                                }
                                payment_DGV.ClearSelection();
                            }
                        }
                    }
                }
            }

            GF.closeLoading();
        }
        public history_buy_member(string member_id)
        {
            InitializeComponent();

            _member_id = member_id;

            GF.showLoading(this);
            Dictionary <string, string> values = new()
            {
                { "is_suspend", "0" }
            };
            Dictionary <string, object> Obj = DB.Post("MemberType/getMemberType/", values);

            if (Obj != null)
            {
                member_type_id.Items.Add(new ComboItem(0, "ทุกประเภท"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        member_type_id.Items.Add(new ComboItem(GF.toInt(Item["member_type_id"].ToString()), Item["member_type_name"].ToString()));
                    }
                }

                member_type_id.SelectedIndex = 0;
                GF.resizeComboBox(member_type_id);
            }
            else
            {
                GF.closeLoading();
                GF.Error("ไม่มีข้อมูล 'ประเภทสมาชิก' ในฐานข้อมูล !!\r\n\r\nกรุณาติดต่อผู้ดูแลระบบ !!");
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("datetime", "วันที่", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("member_type", "ประเภท Member", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("allow_branch", "สาขาที่ใช้ได้", DataGridViewContentAlignment.MiddleCenter));
            DGVC.Add(new dgvColumn("since", "เริ่มต้น"));
            DGVC.Add(new dgvColumn("until", "สิ้นสุด"));
            DGVC.Add(new dgvColumn("full_amount", "ราคาเต็ม"));
            DGVC.Add(new dgvColumn("discount_amount", "ส่วนลด"));
            DGVC.Add(new dgvColumn("discount_by", "อนุมัติส่วนลดโดย", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("discount_note", "รายละเอียดส่วนลด", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("void_by", "VOID โดย", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("void_datetime", "เมื่อ", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("void_reason", "สาเหตุ", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("member_id", "member_id", DataGridViewContentAlignment.MiddleLeft, false));
            DGVC.Add(new dgvColumn("member_ext_id", "member_ext_id", DataGridViewContentAlignment.MiddleLeft, false));
            DGVC.Add(new dgvColumn("is_import", "is_import", DataGridViewContentAlignment.MiddleLeft, false));
            btn_dgv.initColumn(DGVC);

            btn_dgv.DGV.CellDoubleClick += (ss, ee) =>
            {
                if (ee.RowIndex > -1 && ee.ColumnIndex > -1)
                {
                    using member_ext ExtData    = new();
                    ExtData.onlySee             = true;
                    ExtData.member_ext_id       = btn_dgv.DGV.Rows[ee.RowIndex].Cells["member_ext_id"].Value.ToString();
                    ExtData.manage_btn.Visible  = false;
                    ExtData.print_btn.Left      = ExtData.manage_btn.Right - ExtData.print_btn.Width;
                    ExtData.branch_list.Enabled = false;
                    ExtData.Owner = this;
                    ExtData.ShowDialog();
                    this.Select();
                }
            };

            btn_dgv.DGV.MouseClick += (ss, ee) =>
            {
                if (ee.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (btn_dgv.DGV.HitTest(ee.X, ee.Y).ColumnIndex > -1 && btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex > -1)
                    {
                        btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].Selected = true;
                        btn_dgv.theContextMenu.Items.Clear();
                        if (btn_dgv.DGV.SelectedRows.Count == 1)
                        {
                            if (btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].DefaultCellStyle.BackColor != Color.LightCoral)
                            {
                                btn_dgv.theContextMenu.Items.Add("แก้ไข สาขาที่เข้าใช้ได้", null, new EventHandler(ChangeBranchEvent));
                                if (GF.isAdmin)
                                {
                                    btn_dgv.theContextMenu.Items.Add("-");
                                    btn_dgv.theContextMenu.Items.Add("แก้ไขข้อมูลการซื้อสมาชิก โดยผู้มีอำนาจ", null, new EventHandler(ForceEditEvent));
                                    btn_dgv.theContextMenu.Items.Add("VOID รายการ โดยผู้มีอำนาจ", null, new EventHandler(VoidEvent));
                                }
                            }
                        }
                    }
                }
            };

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }
        public trainer_list_member()
        {
            InitializeComponent();

            GF.showLoading(this);

            Dictionary <string, string> values = new()
            {
                { "branch_id", GF.Settings("branch_id") }
            };

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

            if (Obj != null)
            {
                trainer_emp_id.Items.Add(new ComboItem(0, "เลือก เทรนเนอร์"));
                if (Obj.ContainsKey("result"))
                {
                    foreach (Dictionary <string, object> Item in GF.ToType <Dictionary <string, object>[]>(Obj["result"]))
                    {
                        trainer_emp_id.Items.Add(new ComboItem(GF.toInt(Item["trainer_emp_id"].ToString()), Item["trainer_name"].ToString()));
                    }
                }

                trainer_emp_id.SelectedIndex = 0;
                GF.resizeComboBox(trainer_emp_id);
            }

            //PAGING DELEGATE
            btn_dgv.firstClick        += doLoadGridData;
            btn_dgv.prevClick         += doLoadGridData;
            btn_dgv.nextClick         += doLoadGridData;
            btn_dgv.lastClick         += doLoadGridData;
            btn_dgv.pageNumberChanged += doLoadGridData;

            List <dgvColumn> DGVC = new();

            DGVC.Add(new dgvColumn("member_no", "รหัสสมาชิก", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("member_name", "สมาชิก", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("pt_course_name", "คอร์ส", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("hours", "คงเหลือ", DataGridViewContentAlignment.MiddleCenter));
            DGVC.Add(new dgvColumn("expiry_date", "วันหมดอายุ", DataGridViewContentAlignment.MiddleCenter));
            DGVC.Add(new dgvColumn("seller", "ผู้ขาย", DataGridViewContentAlignment.MiddleLeft));
            DGVC.Add(new dgvColumn("process_date", "วันที่ซื้อ", DataGridViewContentAlignment.MiddleCenter));
            DGVC.Add(new dgvColumn("member_pt_id", "member_pt_id", DataGridViewContentAlignment.MiddleLeft, false));
            btn_dgv.initColumn(DGVC);

            btn_dgv.DGV.MouseClick += (ss, ee) =>
            {
                if (ee.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (btn_dgv.DGV.HitTest(ee.X, ee.Y).ColumnIndex > -1 && btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex > -1)
                    {
                        btn_dgv.DGV.Rows[btn_dgv.DGV.HitTest(ee.X, ee.Y).RowIndex].Selected = true;
                        btn_dgv.theContextMenu.Items.Clear();
                        if (btn_dgv.DGV.SelectedRows.Count == 1)
                        {
                            btn_dgv.theContextMenu.Items.Add("เปลี่ยนเทรนเนอร์", null, new EventHandler(ChangeTrainerEvent));
                        }
                    }
                }
            };

            GF.closeLoading();

            this.Width  = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            this.CenterToScreen();
        }