Exemplo n.º 1
0
        private void btnDonLanhLieu_Click(object sender, EventArgs e)
        {
            var db = new MyDBContextDataContext();
            //if (radioGroup1.SelectedIndex == 0)
            //{
            var lst = (from s in db.DonSanXuat_LanhLieu_View()
                       where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.DanhSach == txtDanhSach.Value    // && s.Khac == "SKU 1"
                       select s).ToList();
            var rp = new rpDonLanhLieu_Avery {
                DataSource = lst
            };

            rp.databing();
            rp.ShowRibbonPreviewDialog();
            //}
            //else
            //{
            //    var lst = (from s in db.DonSanXuat_LanhLieu_View()
            //               where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.Khac != "SKU 1" && s.Khac != null
            //               select s).ToList();
            //    var rp = new rpDonLanhLieu_Avery { DataSource = lst };
            //    rp.databing();
            //    rp.ShowRibbonPreviewDialog();
            //}
        }
Exemplo n.º 2
0
        public void truyendulieu()
        {
            try
            {
                if (rows == null)
                {
                    return;
                }
                foreach (var SCD in rows)
                {
                    //if (!(t is DataRow row)) continue;
                    //var SCD = row["SCD"].ToString();
                    gridView1.AddNewRow();
                    gridView1.OptionsNavigation.AutoFocusNewRow = true;
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colSCD, SCD);

                    var db     = new MyDBContextDataContext();
                    var dulieu = (from s in db.DonSanXuat_LanhLieu_View() where s.SCD == SCD select s).Single();
                    //var kho = (from s in db.tbKhoBTP_TPs where s.SCD == SCD select s).Single();
                    string dvt = null;
                    if (dulieu.BoPhan == "OFFSET")
                    {
                        dvt = "TẤM";
                    }
                    else if (dulieu.BoPhan == "TEM VẢI")
                    {
                        dvt = "PCS";
                    }
                    else if (dulieu.BoPhan == "STICKER")
                    {
                        dvt = "SHEET / TỜ";
                    }
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colBoPhan, dulieu.BoPhan);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colLoaiSanPham, dulieu.LoaiSanPham);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colMaDonHang, dulieu.MaDonHang);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colTenKhachHang, dulieu.TenKhachHang);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colSoLuongXuatKhachHang, dulieu.SoLuong);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colTenSanPham, dulieu.TenSanPham);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colDonViTinh, dvt);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colKichThuoc, dulieu.KichThuoc);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colKhoGiayIn, dulieu.KhoGiayIn);
                    //gridView1.SetRowCellValue(gridView1.FocusedRowHandle, colIDKhoBTP_TP, kho.IDKhoBTP_TP);
                }
            }
            catch
            {
                //null
            }
        }
Exemplo n.º 3
0
        private void Ngayxuongdontxt_EditValueChanged(object sender, EventArgs e)
        {
            var db = new MyDBContextDataContext();
            //if (radioGroup1.SelectedIndex == 0)
            //{
            var lst = (from s in db.DonSanXuat_LanhLieu_View()
                       where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.DanhSach == txtDanhSach.Value     //&& s.Khac == "SKU 1"
                       select s).ToList();

            procDonSanXuat_ViewGridControl.DataSource = lst;
            //}
            //else
            //{
            //    var lst = (from s in db.DonSanXuat_LanhLieu_View()
            //               where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.Khac != "SKU 1" && s.Khac != null
            //               select s).ToList();
            //    procDonSanXuat_ViewGridControl.DataSource = lst;
            //}
        }
Exemplo n.º 4
0
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                var db      = new MyDBContextDataContext();
                var lst     = db.DonSanXuat_LanhLieu_View().Single(s => s.IDLanhLieu == xrIDLanhLieu.Text);
                var sanxuat = (from s in db.tbSanXuats where s.IDSanXuat == xrIDLanhLieu.Text select s).Single();
                var dsx     = (from s in db.tbDonSanXuats where s.SCD == xrIDLanhLieu.Text select s).Single();
                if (lst.LanhLieu == null)
                {
                    return;
                }
                xrTableCell13.Text = "01";
                if (sanxuat.BoPhanSX != null)
                {
                    lst.BoPhan       = sanxuat.BoPhanSX;
                    lst.PhuongPhapIn = sanxuat.PhuongPhapInSX;
                }
                if (sanxuat.VatLieuSX != null)
                {
                    lst.VatLieu = sanxuat.VatLieuSX;
                    lst.Kho     = sanxuat.KhoSX;
                }
                if (lst.BoPhan == "OFFSET")
                {
                    xrBoPhan.Text    = lst.BoPhan;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");
                    if (lst.Kho == "NGUYÊN VẬT LIỆU")
                    {
                        var khoGiayIn = (from a in db.tbKhoGiayIns where a.KhoIn == lst.KhoGiayIn && a.CatGiay == lst.CatGiay select a).Single();
                        xrVatLieu.Text = lst.VatLieu;
                        xrMucDich.Text = khoGiayIn.GiayLon;
                    }
                    else
                    {
                        xrVatLieu.Text = lst.VatLieu;
                        xrMucDich.Text = lst.KhoGiayIn;
                    }
                    xrIDLanhLieu2.Text = xrIDLanhLieu.Text;
                    xrSTT2.Text        = "01";
                    xrBoPhan2.Text     = "CTP";
                    xrVatLieu2.Text    = lst.MaDonHang;
                    xrMucDich2.Text    = "605*745";
                    xrDonViTinh2.Text  = lst.DonViTinh;
                    xrSoLuong2.Text    = lst.CtpOffset.ToString();
                    lblNgay2.Text      = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");
                }
                else if (lst.BoPhan == "DANH THIẾP")
                {
                    xrBoPhan.Text    = lst.BoPhan;
                    xrVatLieu.Text   = "Bản thể " + lst.VatLieu;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");

                    xrIDLanhLieu2.Text = xrIDLanhLieu.Text;
                    xrSTT2.Text        = "01";
                    xrBoPhan2.Text     = "CTP";
                    xrVatLieu2.Text    = lst.MaDonHang;
                    xrMucDich2.Text    = "440*460";
                    xrDonViTinh2.Text  = lst.DonViTinh;
                    xrSoLuong2.Text    = lst.CtpOffset.ToString();
                    lblNgay2.Text      = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");
                }
                else if (lst.BoPhan == "TEM VẢI")
                {
                    xrBoPhan.Text    = lst.BoPhan;
                    xrVatLieu.Text   = lst.VatLieu;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");

                    lblNgay2.Text = "NGÀY........THÁNG........NĂM........";
                }
                else if (lst.BoPhan == "STICKER")
                {
                    xrBoPhan.Text    = lst.BoPhan;
                    xrVatLieu.Text   = lst.VatLieu;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");

                    lblNgay2.Text = "NGÀY........THÁNG........NĂM........";
                }
                else if (lst.BoPhan == "KỸ THUẬT SỐ")
                {
                    xrBoPhan.Text    = lst.BoPhan;
                    xrVatLieu.Text   = "Bản Thể " + lst.VatLieu;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrMucDich.Text   = lst.KhoGiayIn;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");

                    lblNgay2.Text = "NGÀY........THÁNG........NĂM........";
                }
                else if (lst.BoPhan == "IN CHỮ VI TÍNH")
                {
                    xrBoPhan.Text = lst.BoPhan;
                    if (lst.LoaiSanPham == "TEM GIẤY")
                    {
                        xrVatLieu.Text   = "Bản Thể " + lst.VatLieu;
                        xrDonViTinh.Text = lst.DonViTinh;
                        xrMucDich.Text   = lst.KichThuoc;
                        xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    }
                    else if (lst.LoaiSanPham == "STICKER")
                    {
                        xrVatLieu.Text   = lst.VatLieu;
                        xrDonViTinh.Text = lst.DonViTinh;
                        xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    }

                    lblNgay.Text  = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");
                    lblNgay2.Text = "NGÀY........THÁNG........NĂM........";
                }
                else if (lst.BoPhan == "SAU IN")
                {
                    var khoGiayIn = (from a in db.tbKhoGiayIns where a.KhoIn == lst.KhoGiayIn && a.CatGiay == lst.CatGiay select a).Single();
                    xrBoPhan.Text    = lst.BoPhan;
                    xrVatLieu.Text   = lst.VatLieu + " " + khoGiayIn.GiayLon;
                    xrDonViTinh.Text = lst.DonViTinh;
                    xrSoLuong.Text   = Convert.ToInt32(lst.LanhLieu).ToString("#,#");
                    lblNgay.Text     = DateTime.Now.ToString("'NGÀY ' dd ' THÁNG ' MM ' NĂM ' yyyy");

                    lblNgay2.Text = "NGÀY........THÁNG........NĂM........";
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }
Exemplo n.º 5
0
        private void btnTinh_Click(object sender, EventArgs e)
        {
            try
            {
                var db = new MyDBContextDataContext();
                //if (radioGroup1.SelectedIndex == 0)
                //{
                var lst = (from s in db.DonSanXuat_LanhLieu_View()
                           where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.DanhSach == txtDanhSach.Value    // && s.Khac == "SKU 1"
                           select s).ToList();

                foreach (var dsx in lst)
                {
                    var tbLanhLieu = (from s in db.tbLanhLieus where s.LanhLieu == null select s).ToList();
                    foreach (var tb in tbLanhLieu)
                    {
                        if (tb.IDLanhLieu != dsx.SCD)
                        {
                            continue;
                        }
                        var kichthuoc = dsx.KichThuoc.Split('*');
                        //var sku = dsx.Khac.Split(' ');
                        tb.SoLuongSanXuat  = dsx.SoLuong;
                        tb.BuHao           = (double)txtBuHao.Value;
                        tb.NhanVienSanXuat = nvObj.Tennhanvien;
                        tb.DonViTinh       = "YARD";
                        var tinh = ((tb.SoLuongSanXuat * tb.BuHao) * Convert.ToDouble(kichthuoc[1]) * 1.09 / 1000) + (int)txtChoThem.Value * Convert.ToInt32(dsx.SKU);
                        if (tinh != null)
                        {
                            tb.LanhLieu = (int)tinh;
                        }
                        //if (tinh != null)
                        //{
                        //    if (dsx.SoLuong < 500)
                        //        tb.LanhLieu = (int)tinh + 5;
                        //    else
                        //        tb.LanhLieu = (int)tinh;
                        //}
                        var vatlieu = db.tbVatLieus.Single(s => s.TenHangHoa == dsx.VatLieu && tb.DonViTinh == "YARD");
                        tb.QuyCach = vatlieu.QuyCach;
                        db.SubmitChanges();
                    }
                }
                //}
                //else
                //{
                //    var donsanxuat = (from s in db.DonSanXuat_LanhLieu_View()
                //                  where s.NgayXuongDon == Ngayxuongdontxt.DateTime && s.TenKhachHang == PrintRibbon.AD && s.BoPhan == PrintRibbon.temvai && s.PhuongPhapIn == "Máy in Tem Vải (In Mềm)" && s.Khac != "SKU 1" && s.Khac != null
                //                  select s).ToList();
                //    foreach (var dsx in donsanxuat)
                //    {
                //        var lanhlieu = (from s in db.tbLanhLieus where s.IDLanhLieu == dsx.SCD select s).Single();
                //        var kichthuoc = dsx.KichThuoc.Split('*');
                //        var _Size = db.TemDanAD_GroupBy_Size(dsx.SCD).ToList();
                //        double tong = 0;
                //        foreach (var size in _Size)
                //        {
                //            double tong1;
                //            double tong2 = 0;
                //            var TongSize = (from s in db.TemDanAD_Size(dsx.SCD) select s).ToList();
                //            foreach (var item2 in TongSize)
                //            {
                //                if (size.Size != item2.Size) continue;
                //                if (item2.QTY == "500 + 5")
                //                {
                //                    var a = item2.QTY.Split('+');
                //                    tong2 = tong2 + Convert.ToInt32(a[0]);
                //                }
                //                else
                //                    tong2 = tong2 + Convert.ToInt32(item2.QTY);

                //            }
                //            if (tong2 < 500)
                //                tong1 = (double)(tong2 * lanhlieu.BuHao * Convert.ToInt32(kichthuoc[1]) * 1.09 / 1000 + 5);
                //            else
                //                tong1 = (double)(tong2 * lanhlieu.BuHao * Convert.ToInt32(kichthuoc[1]) * 1.09 / 1000);
                //            tong = tong + tong1;
                //        }
                //        //MessageBox.Show(item.SCD + "  - tong -  " + Math.Ceiling(tong));
                //        lanhlieu.SoLuongSanXuat = dsx.SoLuong;
                //        lanhlieu.BuHao = (double)txtBuHao.Value;
                //        lanhlieu.NhanVienSanXuat = nvObj.Tennhanvien;
                //        lanhlieu.DonViTinh = "YARD";
                //        lanhlieu.LanhLieu = (int)Math.Ceiling(tong);
                //        var vatlieu = db.tbVatLieus.Single(s => s.TenHangHoa == dsx.VatLieu && dsx.DonViTinh == "YARD");
                //        lanhlieu.QuyCach = vatlieu.QuyCach;
                //        db.SubmitChanges();
                //    }
                //}
                MessageBox.Show(PrintRibbon.themthanhcong);
            }
            catch (Exception)
            {
                //MessageBox.Show("Lỗi " + exception);
                //throw;
            }
            Ngayxuongdontxt_EditValueChanged(sender, e);
        }