Пример #1
0
        private void frmPhieulinh_ng_Load(object sender, System.EventArgs e)
        {
            user       = d.user; stime = "'" + d.f_ngay + "'";
            i_dongiale = d.d_dongia_le(i_nhom); bChuky = m.bChuky; bLinh_losx = d.bPhieulinh_dongia_losx_date(i_nhom);
            sql        = "select * from " + user + ".d_duockp ";
            sql       += " where nhom like '%" + i_nhom.ToString() + ",%'";
            if (s_makp != "")
            {
                string s = s_makp.Replace(",", "','");
                sql += " and makp in ('" + s.Substring(0, s.Length - 3) + "')";
            }
            sql               += " order by stt";
            dtkp               = d.get_data(sql).Tables[0];
            makp.DataSource    = dtkp;
            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";

            dstt.ReadXml("..//..//..//xml//d_sttphieulinh.xml");

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

            sql  = "select a.id,a.ma,trim(a.ten)||' '||a.hamluong as ten,a.dang,a.tenhc,c.ten as tennhom,c.stt as manhom,c.stt,d.ten as tenhang from " + user + ".d_dmbd a," + user + ".d_dmnhom b," + user + ".d_nhomin c," + user + ".d_dmhang d";
            sql += " where a.manhom=b.id ";
            if (d.bNhomin_mabd(i_nhom))
            {
                sql += " and a.nhomin=c.id ";
            }
            else
            {
                sql += " and b.nhomin=c.id ";
            }
            sql += " and a.mahang=d.id and a.nhom=" + i_nhom;
            dt   = d.get_data(sql).Tables[0];

            s_makho = d.get_dmkho(7).Trim();
            s_makho = (s_makho == "") ? "" : s_makho.Substring(0, s_makho.Length - 1);

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

            ds.ReadXml("..//..//..//xml//d_inphieu.xml");
            dsxml.ReadXml("..//..//..//xml//d_inphieu.xml");
            if (bChuky)
            {
                dtbs = d.get_data("select * from " + user + ".dmbs where nhom=" + LibMedi.AccessData.truongkhoa).Tables[0];
                DataColumn dc = new DataColumn("image_duoc", typeof(byte[]));
                dsxml.Tables[0].Columns.Add(dc);
                dc = new DataColumn("image_dieutri", typeof(byte[]));
                dsxml.Tables[0].Columns.Add(dc);
            }
            dtkho = d.get_data("select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom).Tables[0];

            dsmabn.ReadXml("..//..//..//xml//d_mabn.xml");
            dsmabn.Tables[0].Columns.Add("Chon", typeof(bool));
            dataGrid1.DataSource = dsmabn.Tables[0];
            AddGridTableStyle();
            lan.Read_dtgrid_to_Xml(dataGrid1, this.Name.ToString() + "_" + dataGrid1.Name.ToString());
            lan.Change_dtgrid_HeaderText_to_English(dataGrid1, this.Name.ToString() + "_" + dataGrid1.Name.ToString());
            this.disabledBackBrush = new SolidBrush(Color.FromArgb(255, 255, 192));
            this.disabledTextBrush = new SolidBrush(Color.FromArgb(255, 0, 0));

            this.alertBackBrush = new SolidBrush(SystemColors.HotTrack);
            this.alertFont      = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Bold);
            this.alertTextBrush = new SolidBrush(Color.White);

            this.currentRowFont      = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Regular);
            this.currentRowBackBrush = new SolidBrush(Color.FromArgb(0, 255, 255));
        }