Exemple #1
0
        private void rptChiphidon_Load(object sender, System.EventArgs e)
        {
            user                  = d.user; stime = "'" + d.f_ngay + "'";
            i_songay              = d.Ngay_toa_bhyt(i_nhom);
            psothe.Enabled        = d.sothe_doituong(i_madoituong);
            s_thetrongtinh        = d.thetrongtinh(i_nhom);
            s_thetrongtinh_vitri  = d.thetrongtinh_vitri(i_nhom);
            bCongkham             = d.bcongkham_bhyt(i_nhom);
            bSotien               = d.bSotien_bhyt(i_nhom);
            manguon.DisplayMember = "TEN";
            manguon.ValueMember   = "ID";
            if (d.bQuanlynguon(i_nhom))
            {
                manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0];
            }
            else
            {
                manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0];
            }
            dt = d.get_data("select * from " + user + ".d_dmbd where nhom=" + i_nhom + " order by id").Tables[0];

            sql = "select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom;
            if (s_makho != "")
            {
                sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
            }
            sql              += " order by stt";
            dtdmkho           = d.get_data(sql).Tables[0];
            kho.DataSource    = dtdmkho;
            kho.DisplayMember = "TEN";
            kho.ValueMember   = "ID";

            sql = "select * from " + user + ".doituong";
            if (i_madoituong == 1)
            {
                sql += " where madoituong=1";
            }
            else
            {
                sql += " where madoituong<>1";
            }
            sql += " order by madoituong";
            madoituong.DisplayMember = "DOITUONG";
            madoituong.ValueMember   = "MADOITUONG";
            madoituong.DataSource    = d.get_data(sql).Tables[0];

            dc            = new DataColumn();
            dc.ColumnName = "id";
            dc.DataType   = Type.GetType("System.Decimal");
            dtnhomvp.Columns.Add(dc);
            dc            = new DataColumn();
            dc.ColumnName = "stt";
            dc.DataType   = Type.GetType("System.Decimal");
            dtnhomvp.Columns.Add(dc);
            dc            = new DataColumn();
            dc.ColumnName = "ten";
            dc.DataType   = Type.GetType("System.String");
            dtnhomvp.Columns.Add(dc);
            dc            = new DataColumn();
            dc.ColumnName = "tc";
            dc.DataType   = Type.GetType("System.Decimal");
            dtnhomvp.Columns.Add(dc);
        }