Exemplo n.º 1
0
 private void load_dmnhombd()
 {
     s_makho           = "";
     sql               = "select * from " + user + ".d_dmnhom where nhom=" + int.Parse(nhom.SelectedValue.ToString());
     sql              += " order by stt";
     dtnhom            = d.get_data(sql).Tables[0];
     dmnhom.DataSource = dtnhom;
 }
Exemplo n.º 2
0
        private void frmChonthongso_Load(object sender, EventArgs e)
        {
            cmbsophieu.DisplayMember = "sophieu";
            cmbsophieu.ValueMember   = "id";

            cmbKho.DisplayMember = "ten";
            cmbKho.ValueMember   = "id";
            cmbKho.DataSource    = d.get_data("select id,ten from " + d.user + ".d_dmkho").Tables[0];
        }
Exemplo n.º 3
0
        private void frmPhieuxuat_ng_Load(object sender, System.EventArgs e)
        {
            user       = d.user; stime = "'" + d.f_ngay + "'";
            i_dongiale = d.d_dongia_le(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";

            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.*,b.stt as sttnhom,b.ten as tennhom,c.ten as tenhang ";
            sql += " from " + user + ".d_dmbd a," + user + ".d_dmnhom b," + user + ".d_dmhang c where a.manhom=b.id and a.mahang=c.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_thkhoa.xml");
            dsxml.ReadXml("..//..//..//xml//d_thkhoa.xml");
        }
Exemplo n.º 4
0
        private void frmTtkcb_Load(object sender, System.EventArgs e)
        {
            user           = m.user;
            s_thetrongtinh = d.thetrongtinh(m.nhom_duoc);
            s_thetunguyen  = d.thetunguyen(m.nhom_duoc);
            if (s_thetunguyen != "")
            {
                s_tunguyen = s_thetunguyen.Replace(",", "','");
            }
            string vitri = d.thetunguyen_vitri_ora(m.nhom_duoc);

            if (vitri != "")
            {
                v1 = int.Parse(vitri.Substring(0, 1)); v2 = int.Parse(vitri.Substring(2, 1));
            }
            dtnhom = d.get_data("select distinct stt from " + user + ".v_nhombhyt order by stt").Tables[0];
            madoituong.DataSource    = m.get_data("select a.*,to_char(madoituong) as madoituong1 from " + user + ".doituong a where sothe<>0 order by madoituong").Tables[0];
            madoituong.DisplayMember = "DOITUONG";
            madoituong.ValueMember   = "MADOITUONG";
            sql = "select * from " + user + ".btdkp_bv";
            if (s_makp != "")
            {
                string s = s_makp.Replace(",", "','");
                sql += " where makp in ('" + s.Substring(0, s.Length - 3) + "')";
            }
            sql               += " order by loai,makp";
            dtkp               = m.get_data(sql).Tables[0];
            makp.DataSource    = dtkp;
            makp.DisplayMember = "TENKP";
            makp.ValueMember   = "MAKP";
            taotable();
            loaidt.SelectedIndex = 0;
        }
Exemplo n.º 5
0
        private void load_dmkho()
        {
            try
            {
                dtdmkho             = ttb.get_data("select * from " + user + ".ttb_dmkho where nhom=" + i_nhomkho.ToString() + " order by stt").Tables[0];
                makho.DataSource    = dtdmkho;
                makho.DisplayMember = "TEN";
                makho.ValueMember   = "ID";
                dtmakp            = d.get_data("select * from " + d.user + ".d_duockp where nhom like '%" + i_nhomkho.ToString() + ",%' order by stt").Tables[0];
                makp.DataSource   = dtmakp;
                dtdmnhom          = ttb.get_data("select * from " + user + ".ttb_dmnhom where nhom=" + i_nhomkho.ToString() + " order by stt").Tables[0];
                manhom.DataSource = dtdmnhom;
                dtnt = ttb.get_data("select * from " + user + ".ttb_dmloaint where nhom=" + i_nhomkho.ToString() + " order by stt").Tables[0];
                loaint.DataSource   = dtnt;
                dtkhac              = ttb.get_data("select * from " + user + ".ttb_dmkhac where nhom in(0," + i_nhomkho.ToString() + ") order by stt").Tables[0];
                loaikhac.DataSource = dtkhac;

                manhom.DisplayMember = "TEN";
                manhom.ValueMember   = "ID";

                loaint.DisplayMember = "TEN";
                loaint.ValueMember   = "ID";

                loaikhac.DisplayMember = "TEN";
                loaikhac.ValueMember   = "ID";

                makp.DisplayMember = "TEN";
                makp.ValueMember   = "ID";

                makho.DisplayMember = "TEN";
                makho.ValueMember   = "ID";
            }
            catch {}
        }
Exemplo n.º 6
0
        private void frmKiemtrakhoa_Load(object sender, System.EventArgs e)
        {
            if (Screen.PrimaryScreen.WorkingArea.Width > 800)
            {
                this.WindowState = System.Windows.Forms.FormWindowState.Normal;
            }
            user = ttb.user; stime = "'" + ttb.f_ngay + "'";
            sql  = "select * from " + user + ".ttb_dmnhomkho where id=" + i_nhom + " order by stt";
            nhom.DisplayMember = "TEN";
            nhom.ValueMember   = "ID";
            nhom.DataSource    = ttb.get_data(sql).Tables[0];

            phieu.DisplayMember = "TEN";
            phieu.ValueMember   = "ID";

            loai.DisplayMember = "TEN";
            loai.ValueMember   = "ID";
            loai.DataSource    = ttb.get_data("select * from " + user + ".ttb_dmphieu order by stt").Tables[0];
            load_phieu();

            sql  = "select * from " + d.user + ".d_duockp where nhom like '%" + i_nhom.ToString() + ",%'";
            sql += " order by stt";
            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            makp.DataSource    = d.get_data(sql).Tables[0];
        }
Exemplo n.º 7
0
 private void loadgrid(string maloai)
 {
     try
     {
         sql = " Select * from " + m.user + ".bhyt_maubaocao ";
         if (maloai.Trim() != "")
         {
             sql += " where maloai='" + maloai + "'";
         }
         dsxml = m.get_data(sql);
         dtct  = dsxml.Tables[0].Copy();
         dataGrid1.DataSource = dtct;
     }
     catch
     {}
 }
Exemplo n.º 8
0
 private void frmTscdlc_Load(object sender, System.EventArgs e)
 {
     user      = ttb.user;
     pic.Tag   = "0000.bmp";
     fstr      = new System.IO.FileStream(pic.Tag.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read);
     map       = new Bitmap(Image.FromStream(fstr));
     pic.Image = (Bitmap)map;
     image     = new byte[fstr.Length];
     fstr.Read(image, 0, System.Convert.ToInt32(fstr.Length));
     fstr.Close();
     pic.Tag = image;
     sql     = "select * from " + d.user + ".d_duockp where nhom like '%" + i_nhom.ToString().Trim() + ",%'";
     if (i_stt == 0)
     {
         sql += " and id<>" + i_makp;
     }
     sql += " order by stt";
     makp.DisplayMember = "TEN";
     makp.ValueMember   = "ID";
     makp.DataSource    = d.get_data(sql).Tables[0];
     if (i_stt != 0)
     {
         foreach (DataRow r in ttb.get_data("select makp,to_char(ngay,'dd/mm/yyyy') as ngay,diengiai,image from " + user + ".ttb_tscdlc where id=" + l_id + " and stt=" + i_stt).Tables[0].Rows)
         {
             makp.SelectedValue = r["makp"].ToString();
             ngay.Value         = new DateTime(int.Parse(r["ngay"].ToString().Substring(6)), int.Parse(r["ngay"].ToString().Substring(3, 2)), int.Parse(r["ngay"].ToString().Substring(0, 2)), 0, 0, 0);
             diengiai.Text      = r["diengiai"].ToString();
         }
     }
     vanban.DisplayMember = "TT";
     vanban.ValueMember   = "TT";
     load_vanban();
 }
Exemplo n.º 9
0
        private void frmChonkhoa_Load(object sender, System.EventArgs e)
        {
            user = ttb.user;
            makho.DisplayMember = "TEN";
            makho.ValueMember   = "ID";
            string sql = "select * from " + user + ".ttb_dmkho where nhom=" + i_nhom;

            if (s_makho != "")
            {
                sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
            }
            sql += " order by stt";
            makho.DataSource = ttb.get_data(sql).Tables[0];
            if (makho.Items.Count > 0)
            {
                makho.SelectedIndex = 0;
            }

            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            sql = "select * from " + d.user + ".d_duockp where nhom like '%" + i_nhom.ToString() + ",%'";
            if (s_makp != "")
            {
                sql += " and id in (" + s_makp.Substring(0, s_makp.Length - 1) + ")";
            }
            sql   += " order by stt";
            dtkhoa = d.get_data(sql).Tables[0];
            ttb.convertFont(dtkhoa, "ten");
            makp.DataSource = dtkhoa;
            if (makp.Items.Count > 0)
            {
                makp.SelectedIndex = 0;
            }
        }
Exemplo n.º 10
0
 private void butMoi_Click(object sender, System.EventArgs e)
 {
     try
     {
         stt.Value = decimal.Parse(ttb.get_data("select max(stt) from " + user + ".ttb_dmnhomkho").Tables[0].Rows[0][0].ToString()) + 1;
     }
     catch { stt.Value = 1; }
     try
     {
         stt_medi = int.Parse(d.get_data("select max(stt) from " + d.user + ".d_dmnhomkho").Tables[0].Rows[0][0].ToString()) + 1;
     }
     catch { stt_medi = 1; }
     l_id                 = 0;
     ten.Text             = "";
     nhomcc.SelectedIndex = -1;
     ena_object(true);
     stt.Focus();
 }
Exemplo n.º 11
0
        private void frmHaophi_Load(object sender, System.EventArgs e)
        {
            //if (Screen.PrimaryScreen.WorkingArea.Width > 800) this.WindowState = System.Windows.Forms.FormWindowState.Normal;
            user = ttb.user; xxx = user;// +s_mmyy;
            //
            f_capnhat_db();
            //
            bKhoaso = ttb.bKhoaso(i_nhom, s_mmyy);
            link    = ttb.dbLink;
            string sField = ttb.f_get_select_field("ttb_dmbd", "image");

            sql                 = "select " + sField.Trim().Trim(',') + " from " + user + ".ttb_dmbd where nhom=" + i_nhom + " order by id";
            dtdmbd              = ttb.get_data(sql).Tables[0];
            dtphieu             = ttb.get_data("select * from " + user + ".ttb_loaiphieu where nhom=" + i_nhom + " and loai=" + i_loai + " order by stt").Tables[0];
            phieu.DisplayMember = "TEN";
            phieu.ValueMember   = "ID";
            phieu.DataSource    = dtphieu;

            sql = "select * from " + d.user + ".d_duockp where nhom like '%" + i_nhom.ToString() + ",%'";
            if (s_makp != "")
            {
                sql += " and id in (" + s_makp.Substring(0, s_makp.Length - 1) + ")";
            }
            sql += " order by stt";
            dtkp = d.get_data(sql).Tables[0];
            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            makp.DataSource    = dtkp;
            butChoduyet_Click(null, null);

            sql  = "select a.id,a.mabn,b.ten as hoten,to_char(a.ngay,'dd/mm/yyyy') as ngay,a.phieu,a.makp,a.idduyet,a.makhoa from " + xxx + ".ttb_xuatsdll a," + d.user + ".d_duockp" + link + " b ";
            sql += "where a.makp=b.id and a.loai=" + i_loai + " and a.nhom=" + i_nhom;
            if (ttb.bUserid)
            {
                sql += " and a.userid=" + i_userid;
            }
            if (ttb.bLoclinh)
            {
                sql += " and to_char(a.ngay,'dd/mm/yyyy')='" + s_ngay + "'";
            }
            if (s_makp != "")
            {
                sql += " and a.makp in (" + s_makp.Substring(0, s_makp.Length - 1) + ")";
            }
            sql += " order by a.id";
            dtll = ttb.get_data(sql).Tables[0];
            mabn.DisplayMember = "MABN";
            mabn.ValueMember   = "ID";
            mabn.DataSource    = dtll;
            if (dtll.Rows.Count > 0)
            {
                l_id = decimal.Parse(mabn.SelectedValue.ToString());
            }
            load_head();
            AddGridTableStyle();
        }
Exemplo n.º 12
0
        private void load_grid(string s_ngay, decimal l_id, decimal l_sophieu, int idkho, int idkhoa)
        {
            sql  = "select b.ma,b.id as mabd1 ,trim(b.ten)||' '||b.hamluong as ten,b.hamluong,b.dang,g.ten as nhasx,f.sophieu,c.stt as sttnhom,c.ten as tennhom,d.ten as tenhang,";
            sql += "b.sltoithieu, b.tenhc,a.*,a.soluong as slduyet,e.ten as tenkho ";
            sql += " from " + user + ".d_dutrucsttct a," + user + ".d_dutrucsttll f," + user + ".d_dmbd b," + user + ".d_dmnhom c," + user + ".d_dmhang d," + user + ".d_dmkho e," + user + ".d_dmnx g ";
            sql += " where a.mabd=b.id and b.manhom=c.id and b.mahang=d.id and e.id=f.makho and b.madv=g.id and a.id=f.id and f.makho=" + idkho;
            sql += " and to_char(f.ngay,'dd/mm/yyyy')='" + s_ngay + "'";
            sql += " and a.id=" + l_id + " and sophieu=" + l_sophieu;
            sql += " and a.soluong >0 ";
            sql += " and f.done =2 and makp='" + i_makhoa + "'";
            sql += " order by c.stt,b.ma";
            dtct = d.get_data(sql).Tables[0];
            dataGrid1.DataSource = dtct;
            CurrencyManager cm = (CurrencyManager)BindingContext[dataGrid1.DataSource];
            DataView        dv = (DataView)cm.List;

            dv.AllowNew    = false;
            dv.AllowDelete = false;
        }
Exemplo n.º 13
0
        private void load_gird()
        {
            DataTable dt   = new DataTable();
            string    user = d.user;
            string    sql  = "select to_number('0') as chon,d.hoten as tenuser,b.id as makp,b.ten as tenkp,c.id as sophieu,c.ten as phieu,a.computer,to_char(a.ngay,'dd/mm/yyyy') as ngay from " + user + ".d_danglaysolieu a ";

            sql += " left join " + user + ".d_duockp b on a.makp=b.id left join " + user + ".d_loaiphieu c on a.phieu=c.id left join " + user + ".d_dlogin d on a.userid=d.id";
            sql += " where a.computer<>'" + System.Environment.MachineName + "'";
            dt   = d.get_data(sql).Tables[0];
            dataGridView1.DataSource = dt;
        }
Exemplo n.º 14
0
        private void frmDanhsachdutru_Load(object sender, EventArgs e)
        {
            d = new LibDuoc.AccessData();
            cboKhoa.DisplayMember = "TEN";
            cboKhoa.ValueMember   = "ID";
            string sql = "select id,ten from " + d.user + ".d_duockp";

            if (s_makp != "")
            {
                sql += " where makp in ('" + s_makp.Replace(",", "','") + "')";
            }
            sql += " order by ten";
            cboKhoa.DataSource = d.get_data(sql).Tables[0];
            txtThang.Value     = (decimal)DateTime.Now.Month;
            txtNam.Value       = (decimal)DateTime.Now.Year;
            dsdutru            = d.get_data("select 0 as id,'' as ngay,'' as loaiphieu,'' as tenphieu").Clone();
            dslinh             = d.get_data("select '' as ngay,'' as tenphieu").Clone();
            AddGridTableStyle();
            AddGridTableStyle2();
            this.WindowState = FormWindowState.Maximized;
        }
Exemplo n.º 15
0
        private void frmTtkcbngtr_Load(object sender, System.EventArgs e)
        {
            user           = m.user;
            i_nhom         = m.nhom_duoc;
            s_thetrongtinh = d.thetrongtinh(i_nhom);
            s_thetunguyen  = d.thetunguyen(i_nhom);
            if (s_thetunguyen != "")
            {
                s_tunguyen = s_thetunguyen.Replace(",", "','");
            }
            string vitri = d.thetunguyen_vitri_ora(i_nhom);

            if (vitri != "")
            {
                v1 = int.Parse(vitri.Substring(0, 1)); v2 = int.Parse(vitri.Substring(2, 1));
            }
            dtnhom = d.get_data("select distinct stt from " + user + ".v_nhombhyt order by stt").Tables[0];
            madoituong.DataSource    = d.get_data("select a.*,to_char(madoituong) as madoituong1 from " + user + ".doituong a where sothe<>0 order by madoituong").Tables[0];
            madoituong.DisplayMember = "DOITUONG";
            madoituong.ValueMember   = "MADOITUONG";
            taotable();
            loaidt.SelectedIndex = 0;
        }
Exemplo n.º 16
0
        private void butXem_Click(object sender, EventArgs e)
        {
            d = new LibDuoc.AccessData();
            string mmyy = txtThang.Value.ToString().PadLeft(2, '0') + txtNam.Value.ToString().Substring(2);

            if (d.bMmyy(mmyy))
            {
                string user = d.user;
                string xxx  = user + mmyy;
                string exp  = " where a.makp=" + cboKhoa.SelectedValue.ToString() + " and to_date(to_char(a.ngay,'dd/mm/yyyy'),'dd/mm/yyyy') between to_date('" + txtTungay.Text + "','dd/mm/yyyy') and to_date('" + txtDenngay.Text + "','dd/mm/yyyy') ";
                string sql  = "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,";
                sql    += " case when a.done=0 then 'x' else '' end as chuachuyen,";
                sql    += " case when a.done=1 then 'x' else '' end as chuyen,";
                sql    += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten ";
                sql    += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_dutrull a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id ";
                sql    += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id ";
                sql    += " left join " + user + ".dlogin d on a.userid=d.id ";
                sql    += exp;
                sql    += " union all ";
                sql    += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,";
                sql    += " case when a.done=0 then 'x' else '' end as chuachuyen,";
                sql    += " case when a.done=1 then 'x' else '' end as chuyen,";
                sql    += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten ";
                sql    += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_xtutrucll a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id ";
                sql    += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id ";
                sql    += " left join " + user + ".dlogin d on a.userid=d.id ";
                sql    += exp;
                sql    += " union all ";
                sql    += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,";
                sql    += " case when a.done=0 then 'x' else '' end as chuachuyen,";
                sql    += " case when a.done=1 then 'x' else '' end as chuyen,";
                sql    += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten ";
                sql    += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_hoantrall a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id ";
                sql    += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id ";
                sql    += " left join " + user + ".dlogin d on a.userid=d.id ";
                sql    += exp;
                sql    += " union all ";
                sql    += "select distinct a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten as loaiphieu,c.ten as tenphieu,";
                sql    += " case when a.done=0 then 'x' else '' end as chuachuyen,";
                sql    += " case when a.done=1 then 'x' else '' end as chuyen,";
                sql    += " case when a.done=2 then 'x' else '' end as duyet,a.loai,d.hoten ";
                sql    += " from " + xxx + ".d_duyet a inner join " + xxx + ".d_haophill a1 on a.id=a1.idduyet inner join " + user + ".d_dmphieu b on a.loai=b.id ";
                sql    += " inner join " + user + ".d_loaiphieu c on a.phieu=c.id ";
                sql    += " left join " + user + ".dlogin d on a.userid=d.id ";
                sql    += exp;
                dsdutru = d.get_data(sql);
                dataGrid1.DataSource = dsdutru.Tables[0];
            }
        }
Exemplo n.º 17
0
        private void frmChonphieucstt_Load(object sender, EventArgs e)
        {
            user = d.user;
            cmbsophieu.DisplayMember = "sophieu";
            cmbsophieu.ValueMember   = "id";
            cmbKho.DisplayMember     = "ten";
            cmbKho.ValueMember       = "id";
            sql = "select id,ten from " + user + ".d_dmkho ";
            if (s_makho != "")
            {
                sql += " where id in (" + s_makho.Trim(',') + ")";
            }
            cmbKho.DataSource     = d.get_data(sql).Tables[0];
            cmbKhoa.DisplayMember = "ten";
            cmbKhoa.ValueMember   = "id";
            sql = "select id,ten from " + user + ".d_duockp ";
            if (s_makp != "")
            {
                sql += " where id in (" + s_makp + ")";
            }
            cmbKhoa.DataSource = d.get_data(sql).Tables[0];

            ddmmyyyy_Validated(null, null);
        }
Exemplo n.º 18
0
 private void load_treeview()
 {
     try
     {
         treeView1.Nodes.Clear();
         DateTime ngay_dangnhap = new DateTime(int.Parse(s_ngaydangnhap.Substring(6, 4)), int.Parse(s_ngaydangnhap.Substring(3, 2)), int.Parse(s_ngaydangnhap.Substring(0, 2)));
         int      i_ngaykiemke  = d.iNgaykiemke;
         sql = " select a.sophieu,a.id,to_char(a.ngay,'dd/mm/yyyy') as ngay,b.ten from "
               + user + ".d_dutrukholl a," + user + ".d_dmkho b " +
               " where a.makho=b.id and to_date(to_char(a.ngay,'dd/mm/yyyy'),'dd/mm/yyyy') between to_date('"
               + ngay_dangnhap.AddDays(-i_ngaykiemke).ToString("dd/MM/yyyy") + "','dd/mm/yyyy') and to_date('"
               + ngay_dangnhap.AddDays(i_ngaykiemke).ToString("dd/MM/yyyy") + "','dd/mm/yyyy') and done=2";
         foreach (DataRow row in d.get_data(sql).Tables[0].Rows)
         {
             TreeNode node = new TreeNode(row["ten"].ToString() + " ( " + row["ngay"].ToString() + " )");
             node.Tag = row["id"].ToString();
             node.Nodes.Add("");
             treeView1.Nodes.Add(node);
         }
     }
     catch { }
 }
Exemplo n.º 19
0
        private void frmAbout_KeyDown(object sender, KeyEventArgs e)
        {
            string user = d.user, xxx = user + mmyy;

            if (e.KeyCode == Keys.F7)
            {
                string  sql = "select a.* from " + xxx + ".d_tutrucct a," + user + ".d_dmkho b," + xxx + ".d_theodoi t where a.makho=b.id and a.tondau<0 and a.stt=t.id and b.nhom=" + i_nhom + " order by a.makp,a.makho,t.manguon,a.mabd,a.stt";
                decimal sl  = 0;
                foreach (DataRow r in d.get_data(sql).Tables[0].Rows)
                {
                    sl   = decimal.Parse(r["tondau"].ToString());
                    sql  = "select a.* from " + xxx + ".d_tutrucct a," + xxx + ".d_theodoi t where a.stt=t.id and a.mabd=" + decimal.Parse(r["mabd"].ToString()) + " and a.makp=" + decimal.Parse(r["makp"].ToString());
                    sql += " and a.makho=" + decimal.Parse(r["makho"].ToString()) + " and t.manguon=" + decimal.Parse(r["manguon"].ToString());
                    sql += " and a.tondau>=" + Math.Abs(sl) + " and a.tondau+a.slnhap-a.slxuat>=" + Math.Abs(sl);
                    sql += " order by a.makp,a.makho,t.manguon,a.mabd,a.stt";
                    foreach (DataRow r1 in d.get_data(sql).Tables[0].Rows)
                    {
                        sql  = "update " + xxx + ".d_tutrucct set tondau=tondau+" + sl + " where mabd=" + decimal.Parse(r["mabd"].ToString());
                        sql += " and makp=" + decimal.Parse(r["makp"].ToString()) + " and stt=" + decimal.Parse(r1["stt"].ToString());
                        d.execute_data(sql);
                        sql  = "update " + xxx + ".d_tutrucct set tondau=0 where mabd=" + decimal.Parse(r["mabd"].ToString());
                        sql += " and makp=" + decimal.Parse(r["makp"].ToString()) + " and stt=" + decimal.Parse(r["stt"].ToString());
                        d.execute_data(sql);
                        break;
                    }
                }
                MessageBox.Show(lan.Change_language_MessageText("Đã kiểm tra lại tồn đầu tủ trực !"), d.Msg);
            }
            else if (e.KeyCode == Keys.F8)
            {
                kiemtra_nhap();
            }
            else if (e.KeyCode == Keys.F12)
            {
                if (!d.bMahoamatkhau)
                {
                    foreach (DataRow r in m.get_data("select * from " + user + ".d_dlogin").Tables[0].Rows)
                    {
                        try
                        {
                            d.execute_data("update " + user + ".d_dlogin set password_='" + m.encode(r["password_"].ToString()) + "' where id=" + decimal.Parse(r["id"].ToString()));
                        }
                        catch { }
                    }
                    d.upd_thongso(i_nhom, -13, "", "1");
                    MessageBox.Show(lan.Change_language_MessageText("Đã mã hóa mật khẩu !"), LibMedi.AccessData.Msg);
                }
                else
                {
                    MessageBox.Show(lan.Change_language_MessageText("Mật khẩu đã mã hóa !"), LibMedi.AccessData.Msg);
                }
            }
            else if (e.KeyCode == Keys.F11)
            {
                if (d.bMahoamatkhau)
                {
                    foreach (DataRow r in m.get_data("select * from " + user + ".d_dlogin").Tables[0].Rows)
                    {
                        try
                        {
                            d.execute_data("update " + user + ".d_dlogin set password_='" + m.decode(r["password_"].ToString()) + "' where id=" + decimal.Parse(r["id"].ToString()));
                        }
                        catch { }
                    }
                    d.execute_data("delete from " + user + ".d_thongso where id=-13");
                    MessageBox.Show(lan.Change_language_MessageText("Đã giải hóa mật khẩu !"), LibMedi.AccessData.Msg);
                }
                else
                {
                    MessageBox.Show(lan.Change_language_MessageText("Mật khẩu chưa mã hóa !"), LibMedi.AccessData.Msg);
                }
            }
            else if (e.KeyCode == Keys.L && e.Control && e.Alt && e.Shift)
            {
                frmRight_BV f = new frmRight_BV(d, tree, i_nhom);
                f.Show();
            }
        }
Exemplo n.º 20
0
        private void frmInphieu_Load(object sender, System.EventArgs e)
        {
            link                = ttb.dbLink;
            user                = ttb.user; xxx = user;// +s_mmyy;
            f_ngay              = ttb.f_ngay;
            bInngang            = ttb.bPhieulinh_ngang(i_nhom);
            bDoituong_phieulinh = ttb.bDoituong_Phieulinh(i_nhom);
            xem.Checked         = ttb.bPreview;
            banin.Enabled       = !xem.Checked;
            s_doc               = "";
            if (ttb.bHoten_docGN(i_nhom) != 0)
            {
                s_doc += ttb.bHoten_docGN(i_nhom).ToString() + ",";
            }
            if (ttb.bHoten_docHTT(i_nhom) != 0)
            {
                s_doc += ttb.bHoten_docHTT(i_nhom).ToString() + ",";
            }
            if (ttb.bHoten_docAB(i_nhom) != 0)
            {
                s_doc += ttb.bHoten_docAB(i_nhom).ToString() + ",";
            }
            s_doc            = (s_doc != "")?s_doc.Substring(0, s_doc.Length - 1):"";
            bNhomin_mabd     = ttb.bNhomin_mabd(i_nhom);
            xuatcstt.Enabled = i_loai == 2 || bBuhaophi;
            i_songay         = ttb.Ngay_in_phieu(i_nhom);
            ds.ReadXml("..\\..\\..\\xml\\ttb_inphieu.xml");
            dsxml.ReadXml("..\\..\\..\\xml\\ttb_inphieu.xml");
            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 + ".ttb_dmbd a," + user + ".ttb_dmnhom b," + user + ".ttb_nhomin c," + user + ".ttb_dmhang d";
            sql += " where a.manhom=b.id ";
            if (bNhomin_mabd)
            {
                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                  = ttb.get_data(sql).Tables[0];
            tu.Value            = new DateTime(int.Parse(s_ngay.Substring(6, 4)), int.Parse(s_ngay.Substring(3, 2)), int.Parse(s_ngay.Substring(0, 2)), 0, 0, 0);
            den.Value           = tu.Value;
            phieu.DisplayMember = "TEN";
            phieu.ValueMember   = "ID";
            phieu.DataSource    = dtphieu;
            if (i_phieu != -1)
            {
                phieu.SelectedValue = i_phieu.ToString();
            }
            else
            {
                phieu.SelectedIndex = 0;
            }

            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            makp.DataSource    = dtkp;
            if (i_makp != -1)
            {
                makp.SelectedValue = i_makp.ToString();
            }
            else
            {
                makp.SelectedIndex = 0;
            }

            if (ttb.bQuanlynguon(i_nhom))
            {
                dtnguon = ttb.get_data("select * from " + user + ".ttb_dmnguon where nhom=" + i_nhom + " order by id").Tables[0];
            }
            else
            {
                dtnguon = ttb.get_data("select * from " + user + ".ttb_dmnguon where id=0 or nhom=" + i_nhom + " order by id").Tables[0];
            }
            manguon.DataSource    = dtnguon;
            manguon.DisplayMember = "TEN";
            manguon.ValueMember   = "ID";

            dtdt = d.get_data("select * from " + d.user + ".d_doituong order by madoituong").Tables[0];
            madoituong.DataSource    = dtdt;
            madoituong.DisplayMember = "DOITUONG";
            madoituong.ValueMember   = "MADOITUONG";

            if (bDoituong_phieulinh)
            {
                foreach (DataRow r in dtdt.Rows)
                {
                    dc            = new DataColumn();
                    dc.ColumnName = "c_" + r["madoituong"].ToString().Trim();
                    dc.DataType   = Type.GetType("System.Decimal");
                    ds.Tables[0].Columns.Add(dc);
                    dc            = new DataColumn();
                    dc.ColumnName = "c_" + r["madoituong"].ToString().Trim();
                    dc.DataType   = Type.GetType("System.Decimal");
                    dsxml.Tables[0].Columns.Add(dc);
                }
            }
            load_makho();
            kho.DisplayMember = "TEN";
            kho.ValueMember   = "ID";

            if (bBuhaophi)
            {
                file1 = "ttb_haophill"; file2 = "ttb_haophict";
            }
            else
            {
                switch (i_loai)
                {
                case 1: file1 = "ttb_dutrull"; file2 = "ttb_dutruct";
                    break;

                case 2: file1 = "ttb_xtutrucll"; file2 = "ttb_xtutrucct";
                    break;

                case 3: file1 = "ttb_hoantrall"; file2 = "ttb_hoantract";
                    break;

                default: file1 = "ttb_haophill"; file2 = "ttb_haophict";
                    break;
                }
            }
        }
Exemplo n.º 21
0
 private void butTao_Click(object sender, EventArgs e)
 {
     m.execute_data("create table " + user + ".anhxa(ma_medisoft numeric(7) ,ma_benhvien numeric(7),loai varchar(50),constraint pk_anhxa primary key(ma_medisoft,ma_benhvien,loai))");
     m.execute_data("alter table " + user + ".anhxa modify (ma_benhvien numeric(7),ma_medisoft numeric(7))");
     dtdm = m.get_data("select * from " + user + ".anhxa where loai='" + cboSolieu.Tag.ToString() + "'").Tables[0];
 }