Ejemplo n.º 1
0
        private void btnGiaGiayIn_Click(object sender, EventArgs e)
        {
            if (frmGiayDeIn == null)
            {
                //Thông tin ban đầu
                var kichThuocSP = new KichThuocPhang
                {
                    Rong = 32,
                    Dai  = 22
                };
                var thongTinBanDau = new ThongTinBanDauChoGiayIn();
                thongTinBanDau.IdHangKhachHang  = this.IdHangKhachHang;
                thongTinBanDau.TinhTrangForm    = FormStateS.TinhThu;
                thongTinBanDau.KichThuocSanPham = kichThuocSP;
                thongTinBanDau.DonViTinhSanPham = "Tờ";
                thongTinBanDau.SoLuongSanPham   = 10;
                thongTinBanDau.ThongTinCanThiet = string.Format("Khổ SP A4: {0} x {1}cm",
                                                                kichThuocSP.Rong, kichThuocSP.Dai);

                //Giây de in
                GiayDeIn giayDeIn = new GiayDeIn(32, 47, 2, 1, 0, 0, false,
                                                 0, "", 1, 5, 1, 0);
                frmGiayDeIn               = new GiayDeInForm(thongTinBanDau, giayDeIn);
                frmGiayDeIn.FormClosed   += new FormClosedEventHandler(ByByWindows);
                frmGiayDeIn.Text          = "Tính thử " + cboHangKH.Text;
                frmGiayDeIn.MinimizeBox   = false;
                frmGiayDeIn.MaximizeBox   = false;
                frmGiayDeIn.StartPosition = FormStartPosition.CenterParent;
                frmGiayDeIn.Show();
            }
            else
            {
                frmGiayDeIn.Focus();
            }
        }
Ejemplo n.º 2
0
        public GiayDeBoiForm(ThongTinBanDauChoGiayIn thongTinBanDau, GiayDeBoi giayDeBoi)
        {
            InitializeComponent();
            this.TinhTrangForm         = thongTinBanDau.TinhTrangForm;
            this.ThongTinBaiIn_CauHinh = thongTinBanDau.ThongTinCanThiet;

            this.IdHangKH = thongTinBanDau.IdHangKhachHang;



            if (thongTinBanDau.LaInDanhThiep) //bắt nút tính số con
            {
                btnTinhSoConTrenToChay.Enabled = false;
            }
            else
            {
                btnTinhSoConTrenToChay.Enabled = true;
            }

            giayDeBoiPres = new GiayDeBoiPresenter(this, giayDeBoi);

            //cập nhật khổ in đỡ


            //event
            txtSoToBoiBuHao.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtSoToBoiTrenToLon.KeyPress += new KeyPressEventHandler(InputValidator);
            txtSoToBoiLyThuyet.KeyPress  += new KeyPressEventHandler(InputValidator);

            txtToBoiRong.KeyPress += new KeyPressEventHandler(InputValidator);
            txtToBoiCao.KeyPress  += new KeyPressEventHandler(InputValidator);


            txtSoToBoiBuHao.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToBoiTrenToLon.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtSoToBoiLyThuyet.TextChanged  += new EventHandler(TextBoxes_TextChanged);

            txtSoToGiayLon.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtTenGiayBoi.TextChanged  += new EventHandler(TextBoxes_TextChanged);


            lblSoToInTong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToBoiRong.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtToBoiCao.TextChanged   += new EventHandler(TextBoxes_TextChanged);


            txtSoToBoiBuHao.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToBoiTrenToLon.Leave += new EventHandler(TextBoxes_Leave);
        }
Ejemplo n.º 3
0
        public GiayDeInForm(ThongTinBanDauChoGiayIn thongTinBanDau, GiayDeIn giayDeIn)
        {
            InitializeComponent();
            this.TinhTrangForm         = thongTinBanDau.TinhTrangForm;
            this.ThongTinBaiIn_CauHinh = thongTinBanDau.ThongTinCanThiet;
            this.SoLuongSanPham        = thongTinBanDau.SoLuongSanPham;
            this.IdHangKH     = thongTinBanDau.IdHangKhachHang;
            this.PhuongPhapIn = thongTinBanDau.PhuongPhapIn;
            this.SanPhamRong  = thongTinBanDau.KichThuocSanPham.Rong;
            this.SanPhamCao   = thongTinBanDau.KichThuocSanPham.Dai;
            lblDonViTinh.Text = thongTinBanDau.DonViTinhSanPham;

            if (thongTinBanDau.LaInDanhThiep) //bắt nút tính số con
            {
                btnTinhSoConTrenToChay.Enabled = false;
            }
            else
            {
                btnTinhSoConTrenToChay.Enabled = true;
            }

            giayDeInPres = new GiayDeInPresenter(this, giayDeIn);

            //cập nhật khổ in đỡ


            //event
            txtSoToChayBuHao.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtSoToChayTrenToLon.KeyPress += new KeyPressEventHandler(InputValidator);
            txtSoToChayLyThuyet.KeyPress  += new KeyPressEventHandler(InputValidator);
            txtSoConTrenToIn.KeyPress     += new KeyPressEventHandler(InputValidator);
            txtToChayRong.KeyPress        += new KeyPressEventHandler(InputValidator);
            txtToChayDai.KeyPress         += new KeyPressEventHandler(InputValidator);
            txtSoLuongSP.KeyPress         += new KeyPressEventHandler(InputValidator);
            txtSPRong.KeyPress            += new KeyPressEventHandler(InputValidator);
            txtSPCao.KeyPress             += new KeyPressEventHandler(InputValidator);

            txtSoToChayBuHao.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayTrenToLon.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtSoToChayLyThuyet.TextChanged  += new EventHandler(TextBoxes_TextChanged);
            txtSoConTrenToIn.TextChanged     += new EventHandler(TextBoxes_TextChanged);
            txtSoToGiayLon.TextChanged       += new EventHandler(TextBoxes_TextChanged);
            txtTenGiayIn.TextChanged         += new EventHandler(TextBoxes_TextChanged);
            txtSoLuongSP.TextChanged         += new EventHandler(TextBoxes_TextChanged);
            txtSPRong.TextChanged            += new EventHandler(TextBoxes_TextChanged);
            txtSPCao.TextChanged             += new EventHandler(TextBoxes_TextChanged);

            chkGiayKhach.CheckedChanged += new EventHandler(CheckBoxes_CheckChanged);

            lblSoToInTong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayRong.TextChanged += new EventHandler(TextBoxes_TextChanged);
            txtToChayDai.TextChanged  += new EventHandler(TextBoxes_TextChanged);



            txtSoConTrenToIn.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayBuHao.Leave     += new EventHandler(TextBoxes_Leave);
            txtSoToChayTrenToLon.Leave += new EventHandler(TextBoxes_Leave);
            txtSoLuongSP.Leave         += new EventHandler(TextBoxes_Leave);
            txtSPRong.Leave            += new EventHandler(TextBoxes_Leave);
            txtSPCao.Leave             += new EventHandler(TextBoxes_Leave);
        }
Ejemplo n.º 4
0
        private void btnLayGiay_Click(object sender, EventArgs e)
        {
            //Thong tin ban đầu
            if (this.SoLopLotGiua <= 0)
            {
                MessageBox.Show("Bạn cần lớp số lớp lót");
                txtSoLopLot.Focus();
                return;
            }
            var thongTinBanDau = new ThongTinBanDauChoGiayIn();

            var strThongTin = string.Format(" Tờ bồi: {0} x {1}cm" + '\r' + '\n',
                                            this.ToBoiRong, this.ToBoiCao);

            strThongTin += string.Format("Tờ lót giữa: {0} tờ", thPhBoiNhieuLopPres.SoToLotGiua());

            ///Nếu mới chưa có giấy bồi là mới còn có giáy bồi là edit
            if (this.GiayDeBoiChon == null)
            {
                thongTinBanDau.TinhTrangForm     = FormStateS.New;
                thongTinBanDau.ThongTinCanThiet  = "[Mới] Chọn giấy bồi" + '\r' + '\n';
                thongTinBanDau.ThongTinCanThiet += strThongTin;
            }
            else
            {
                thongTinBanDau.TinhTrangForm     = FormStateS.Edit;
                thongTinBanDau.ThongTinCanThiet  = "[Sửa] Giấy để bồi";
                thongTinBanDau.ThongTinCanThiet += strThongTin;
            }



            //Tao giay de bồi
            var soLuongToBoi     = thPhBoiNhieuLopPres.SoToLotGiua();
            var soToBuHao        = 0;
            var idGiay           = 0;
            var tenGiayIn        = "";
            var soToBoiTrenToLon = 0;
            var soToLonTong      = 0;

            if (this.GiayDeBoiChon != null)
            {
                soToBuHao        = this.GiayDeBoiChon.SoToBoiBuHao;
                soLuongToBoi     = this.GiayDeBoiChon.SoToBoiLyThuyet;
                idGiay           = this.GiayDeBoiChon.IdGiay;
                tenGiayIn        = this.GiayDeBoiChon.TenGiayIn;
                soToBoiTrenToLon = this.GiayDeBoiChon.SoToBoiTrenToLon;
                soToLonTong      = this.GiayDeBoiChon.SoToLonTong;
            }
            var mucGiayDeBoi = new GiayDeBoi(this.ToBoiRong, this.ToBoiCao,
                                             soToBuHao, soLuongToBoi, idGiay, tenGiayIn, 0,
                                             soToBoiTrenToLon, soToLonTong, 0);//

            //Tiến hành gắn

            var frm = new GiayDeBoiForm(thongTinBanDau, mucGiayDeBoi);

            if (this.GiayDeBoiChon == null)
            {
                frm.Text = "[Mới] BỒI NHIỀU LỚP";
            }
            else
            {
                frm.Text = "[Sửa] BỒI NHIỀU LỚP";
            }

            frm.MinimizeBox   = false;
            frm.MaximizeBox   = false;
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                XuLyNutOKTrenFormChuanBiGiay_Click(frm);
                //MessageBox.Show(this.CauHinhSanPhamS.Count().ToString());
            }
        }