コード例 #1
0
        private void btnHDChuaTT_Click(object sender, EventArgs e)
        {
            CTHDList.Clear();
            fl_HD.Controls.Clear();
            tongtienHD       = 0;
            lb_tongtien.Text = tongtienHD.ToString();

            frmCatHD.loadLaiCTHD_ChuaThanhToanEvent += frmCatHD_loadLaiCTHD_ChuaThanhToanEvent;

            MaskedDialog.ShowDialog(this, frmCatHD.getForm);
        }
コード例 #2
0
        public static DialogResult ShowDialog(Form parent, Form dialog)
        {
            mask = new MaskedDialog(parent, dialog);
            dialog.StartPosition = FormStartPosition.CenterParent;
            mask.MdiParent       = parent.MdiParent;
            mask.Show();
            DialogResult result = dialog.ShowDialog(mask);

            mask.Close();
            return(result);
        }
コード例 #3
0
        public static DialogResult ShowDialog(Form parent, UserControl dialog)
        {
            mask         = new MaskedDialog(parent, dialog);
            frmContainer = new Form();
            frmContainer.ShowInTaskbar   = false;
            frmContainer.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            frmContainer.StartPosition   = FormStartPosition.CenterScreen;
            frmContainer.Height          = dialog.Height;
            frmContainer.Width           = dialog.Width;

            frmContainer.Controls.Add(dialog);
            mask.MdiParent = parent.MdiParent;
            mask.Show();
            DialogResult result = frmContainer.ShowDialog(mask);

            frmContainer.Close();
            mask.Close();
            return(result);
        }
コード例 #4
0
        private void btnCatHD_Click(object sender, EventArgs e) //======================== cất hóa đơn ===================================
        {
            if (MessageBox.Show("Bạn có chắc muốn tạm giữ order???", "Hỏi ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (cbx_phuongthuc.SelectedIndex == 0)
                {
                    if (CTHDList.Count != 0)
                    {
                        int?t = null;
                        if (frm_NhapKhachHang.tenKH != null || frm_NhapKhachHang.sDTKH != null || frm_NhapKhachHang.diaChiKH != null)
                        {
                            webservice.insert_KhachHang(frm_NhapKhachHang.tenKH, frm_NhapKhachHang.sDTKH, frm_NhapKhachHang.diaChiKH);
                            t = webservice.get_MaxMaKhachHang();
                        }
                        else if (frm_NhapKhachHang.maKH == null)
                        {
                            t = null;
                        }
                        else
                        {
                            t = Int32.Parse(frm_NhapKhachHang.maKH.ToString());
                        }

                        webservice.insert_HoaDon(frm_DangNhap.IDNV, Int32.Parse(lb_tongtien.Text.ToString()), t, false);

                        int tmp = webservice.get_MAXMaHoaDon();

                        foreach (var item in CTHDList)
                        {
                            int thanhtien = 0;

                            dt = c.ToDataTable(webservice.get_ChiTietHD(Int32.Parse(item.Item1)));

                            //thanhtien = ((dt.Rows[0]["gia"]-(Int32.Parse(dt.Rows[0]["gia"].ToString()) * Int32.Parse(dt.Rows[0]["tengiamgia"].ToString()) / 100) * item.Item2);
                            thanhtien = (Int32.Parse(dt.Rows[0]["gia"].ToString()) - (Int32.Parse(dt.Rows[0]["gia"].ToString()) * Int32.Parse(dt.Rows[0]["tengiamgia"].ToString()) / 100)) * item.Item2;

                            webservice.insert_CTHD(tmp, Int32.Parse(item.Item1.ToString()), item.Item2, thanhtien);

                            webservice.update_soLuongBanhTrongNgaySauThanhToan(Int32.Parse(item.Item1), item.Item2);
                            // mã bánh và số lượng
                        }

                        CTHDList.Clear();
                        fl_HD.Controls.Clear();
                        tongtienHD       = 0;
                        lb_tongtien.Text = tongtienHD.ToString();

                        loadDSBanhKemTrongNgay();

                        frm_Alert.Alert("Giữ hóa đơn thành công", frm_Alert.AlertType.success);
                    }
                    else
                    {
                        frm_Alert.Alert("Vui lòng chọn SP trước khi TT", frm_Alert.AlertType.warning);
                    }
                }
                else
                {
                    if (CTHDList.Count != 0)
                    {
                        if (DateTime.Parse(frmNote.ngaynhan.ToString("yyyy/MM/dd")) < DateTime.Parse(DateTime.Now.ToString("yyyy/MM/dd")))
                        {
                            frm_Alert.Alert("Vui lòng chọn ngày nhận", frm_Alert.AlertType.warning);
                            MaskedDialog.ShowDialog(this, frmNote.getForm);
                            return;
                        }
                        int kt = 0;
                        if ((frm_NhapKhachHang.kt == 1 && frm_NhapKhachHang.maKH == null) || (frm_NhapKhachHang.kt == 0 && frm_NhapKhachHang.tenKH == null))
                        {
                            frm_Alert.Alert("Vui lòng nhập TT khách hàng", frm_Alert.AlertType.warning);

                            kt = -1;

                            MaskedDialog.ShowDialog(this, frm_NhapKhachHang.getForm);
                            return;
                        }
                        else
                        {
                            if (frm_NhapKhachHang.maKH != null)
                            {
                                kt = 1;
                            }
                            else
                            {
                                kt = 2;
                            }
                            switch (kt)
                            {
                            case 1:
                                webservice.insert_PhieuDat(frm_DangNhap.IDNV, frmNote.ngaynhan, Int32.Parse(lb_tongtien.Text.ToString()), Int32.Parse(frm_NhapKhachHang.maKH.ToString()), frmNote.note, false);
                                break;

                            case 2:
                                webservice.insert_KhachHang(frm_NhapKhachHang.tenKH, frm_NhapKhachHang.sDTKH, frm_NhapKhachHang.diaChiKH);

                                webservice.insert_PhieuDat(frm_DangNhap.IDNV, frmNote.ngaynhan, Int32.Parse(lb_tongtien.Text.ToString()), webservice.get_MaxMaKhachHang(), frmNote.note, false);

                                int tmp = webservice.get_MAXMaPhieuDat();

                                foreach (var item in CTHDList)
                                {
                                    int thanhtien = 0;

                                    dt = c.ToDataTable(webservice.get_ChiTietPD(Int32.Parse(item.Item1)));

                                    //thanhtien = ((dt.Rows[0]["gia"]-(Int32.Parse(dt.Rows[0]["gia"].ToString()) * Int32.Parse(dt.Rows[0]["tengiamgia"].ToString()) / 100) * item.Item2);
                                    thanhtien = (Int32.Parse(dt.Rows[0]["gia"].ToString()) - (Int32.Parse(dt.Rows[0]["gia"].ToString()) * Int32.Parse(dt.Rows[0]["tengiamgia"].ToString()) / 100)) * item.Item2;

                                    webservice.insert_CTPD(tmp, item.Item2, thanhtien, Int32.Parse(item.Item1));
                                }
                                break;

                            default:
                                break;
                            }

                            CTHDList.Clear();
                            fl_HD.Controls.Clear();
                            tongtienHD       = 0;
                            lb_tongtien.Text = tongtienHD.ToString();

                            frm_Alert.Alert("Giữ phiếu đặt thành công", frm_Alert.AlertType.success);
                        }
                    }
                    else
                    {
                        frm_Alert.Alert("Vui lòng chọn SP trước khi TT", frm_Alert.AlertType.warning);
                    }
                }
            }
        }
コード例 #5
0
 private void btnNote_Click(object sender, EventArgs e)
 {
     MaskedDialog.ShowDialog(this, frmNote.getForm);
 }
コード例 #6
0
 private void btnNhapKH_Click(object sender, EventArgs e)
 {
     MaskedDialog.ShowDialog(this, frm_NhapKhachHang.getForm);
     //frm_NhapKhachHang.getForm.Dispose();
 }
コード例 #7
0
 private void btn_HuyBanhHetHan_Click(object sender, EventArgs e)
 {
     MaskedDialog.ShowDialog(this, frm_CheckBanhHetHan.getFrom);
 }