Exemplo n.º 1
0
        private void VeBodyBangLS(DataTable dt)
        {
            Panel pn_Row          = null;
            Panel pn_BMaHD        = null;
            Panel pn_BTongtien    = null;
            Panel pn_BNgaytao     = null;
            Panel pn_BManhanvien  = null;
            Panel pn_BTenchinhanh = null;
            Panel pn_BTrangthai   = null;

            Label lb_BMaHD        = null;
            Label lb_BTongtien    = null;
            Label lb_BNgaytao     = null;
            Label lb_BManhanvien  = null;
            Label lb_BTenchinhanh = null;
            Label lb_BTrangthai   = null;

            int scaleBMaHD        = 10;
            int scaleBTongtien    = 15;
            int scaleBNgaytao     = 15;
            int scaleBManhanvien  = 10;
            int scaleBTenchinhanh = 35;
            int scaleBTrangthai   = 15;

            int cc               = 35;
            int crpn             = 824;
            int crpnBMaHD        = (crpn * scaleBMaHD) / 100;
            int crpnBTongtien    = (crpn * scaleBTongtien) / 100;
            int crpnBNgaytao     = (crpn * scaleBNgaytao) / 100;
            int crpnBManhanvien  = (crpn * scaleBManhanvien) / 100;
            int crpnBTenchinhanh = (crpn * scaleBTenchinhanh) / 100;
            int crpnBTrangthai   = (crpn * scaleBTrangthai) / 100;

            int slls = busHD.SoluongHDTheoKH(makh);

            for (int i = 0; i < slls; i++)
            {
                pn_Row          = new Panel();
                pn_BMaHD        = new Panel();
                pn_BTongtien    = new Panel();
                pn_BNgaytao     = new Panel();
                pn_BManhanvien  = new Panel();
                pn_BTenchinhanh = new Panel();
                pn_BTrangthai   = new Panel();

                lb_BMaHD        = new Label();
                lb_BTongtien    = new Label();
                lb_BNgaytao     = new Label();
                lb_BManhanvien  = new Label();
                lb_BTenchinhanh = new Label();
                lb_BTrangthai   = new Label();

                pn_Row.BorderStyle = BorderStyle.FixedSingle;
                pn_Row.Size        = new Size(crpn - 8, cc);
                pn_Row.Location    = new Point(0, 34 + (34 * i));

                pn_BMaHD.Size     = new Size(crpnBMaHD - 1, cc);
                pn_BMaHD.Location = new Point(-1, -1);

                lb_BMaHD.Width     = pn_BMaHD.Width;
                lb_BMaHD.Height    = pn_BMaHD.Height;
                lb_BMaHD.Text      = dt.Rows[i].ItemArray[0].ToString();
                lb_BMaHD.TextAlign = ContentAlignment.MiddleCenter;
                lb_BMaHD.Location  = new Point(0, 0);
                pn_BMaHD.Controls.Add(lb_BMaHD);

                pn_BTongtien.Size     = new Size(crpnBTongtien, cc);
                pn_BTongtien.Location = new Point(pn_BMaHD.Location.X + pn_BMaHD.Width, -1);

                lb_BTongtien.Width     = pn_BTongtien.Width;
                lb_BTongtien.Height    = pn_BTongtien.Height;
                lb_BTongtien.Text      = ChuyenDecimalToVND(ChuyenVNDToDecimal(dt.Rows[i].ItemArray[2].ToString()));
                lb_BTongtien.TextAlign = ContentAlignment.MiddleCenter;
                lb_BTongtien.Location  = new Point(0, 0);
                pn_BTongtien.Controls.Add(lb_BTongtien);

                pn_BNgaytao.Size     = new Size(crpnBNgaytao, cc);
                pn_BNgaytao.Location = new Point(pn_BTongtien.Location.X + pn_BTongtien.Width - 1, -1);

                lb_BNgaytao.Width     = pn_BNgaytao.Width;
                lb_BNgaytao.Height    = pn_BNgaytao.Height;
                lb_BNgaytao.Text      = dt.Rows[i].ItemArray[3].ToString();
                lb_BNgaytao.TextAlign = ContentAlignment.MiddleCenter;
                lb_BNgaytao.Location  = new Point(0, 0);
                pn_BNgaytao.Controls.Add(lb_BNgaytao);

                pn_BManhanvien.Size     = new Size(crpnBManhanvien, cc);
                pn_BManhanvien.Location = new Point(pn_BNgaytao.Location.X + pn_BNgaytao.Width - 1, -1);

                lb_BManhanvien.Width     = pn_BManhanvien.Width;
                lb_BManhanvien.Height    = pn_BManhanvien.Height;
                lb_BManhanvien.Text      = dt.Rows[i].ItemArray[4].ToString();
                lb_BManhanvien.TextAlign = ContentAlignment.MiddleCenter;
                lb_BManhanvien.Location  = new Point(0, 0);
                pn_BManhanvien.Controls.Add(lb_BManhanvien);

                pn_BTenchinhanh.Size     = new Size(crpnBTenchinhanh, cc);
                pn_BTenchinhanh.Location = new Point(pn_BManhanvien.Location.X + pn_BManhanvien.Width - 1, -1);

                lb_BTenchinhanh.Width     = pn_BTenchinhanh.Width;
                lb_BTenchinhanh.Height    = pn_BTenchinhanh.Height;
                lb_BTenchinhanh.Text      = busCN.LayTenCNTuMa(dt.Rows[i].ItemArray[5].ToString());
                lb_BTenchinhanh.TextAlign = ContentAlignment.MiddleCenter;
                lb_BTenchinhanh.Location  = new Point(0, 0);
                pn_BTenchinhanh.Controls.Add(lb_BTenchinhanh);

                pn_BTrangthai.Size     = new Size(crpnBTrangthai, cc);
                pn_BTrangthai.Location = new Point(pn_BTenchinhanh.Location.X + pn_BTenchinhanh.Width - 1, -1);

                lb_BTrangthai.Width     = pn_BTrangthai.Width;
                lb_BTrangthai.Height    = pn_BTrangthai.Height;
                lb_BTrangthai.Text      = int.Parse(dt.Rows[i].ItemArray[7].ToString()) == 0 ? "Đã xử lý" : "Đang xử lý";
                lb_BTrangthai.TextAlign = ContentAlignment.MiddleCenter;
                lb_BTrangthai.Location  = new Point(0, 0);
                pn_BTrangthai.Controls.Add(lb_BTrangthai);

                pn_Row.Controls.Add(pn_BMaHD);
                pn_Row.Controls.Add(pn_BTongtien);
                pn_Row.Controls.Add(pn_BNgaytao);
                pn_Row.Controls.Add(pn_BManhanvien);
                pn_Row.Controls.Add(pn_BTenchinhanh);
                pn_Row.Controls.Add(pn_BTrangthai);
                pnLS.Controls.Add(pn_Row);
            }
        }