Пример #1
0
        private void frmTtkcbngtr_Load(object sender, System.EventArgs e)
        {
            user           = d.user; stime = "'" + d.f_ngay + "'";
            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 * from " + user + ".v_nhombhyt order by stt").Tables[0];
            madoituong.DisplayMember = "DOITUONG";
            madoituong.ValueMember   = "MADOITUONG";
            madoituong.DataSource    = d.get_data("select * from " + user + ".doituong where sothe<>0 order by madoituong").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";
            dtkho               = d.get_data(sql).Tables[0];
            makho.DataSource    = dtkho;
            makho.DisplayMember = "TEN";
            makho.ValueMember   = "ID";

            taotable();
            loaidt.SelectedIndex = 0;
        }
Пример #2
0
        private void frmInphieuxuat_Load(object sender, System.EventArgs e)
        {
            user          = d.user; stime = "'" + d.f_ngay + "'";
            loai.Enabled  = d.bChonloaiphieu_xuat(i_nhom);
            phieu.Enabled = loai.Enabled;
            imp.Visible   = m.Mabv_so == 701424;
            ds.ReadXml("..\\..\\..\\xml\\d_xuatkho.xml");
            ds.Tables[0].Columns.Add("manhom", typeof(decimal)).DefaultValue = 0;
            ds.Tables[0].Columns.Add("tennhom");
            //dsxml.ReadXml("..\\..\\..\\xml\\d_xuatkho.xml");
            dsxml = ds.Copy();
            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";

            dtloai             = d.get_data("select * from " + user + ".d_dmphieu where id<5 order by stt").Tables[0];
            loai.DataSource    = dtloai;
            loai.DisplayMember = "TEN";
            loai.ValueMember   = "ID";

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

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

            nhom.DisplayMember = "TEN";
            nhom.ValueMember   = "ID";
            load_nhom();
            load_makp();
            load_makho();

            load_dmnhom();
            dmnhom.DisplayMember = "TEN";
            dmnhom.ValueMember   = "ID";
        }
Пример #3
0
        private void frmTT_pttt_thuoc_Load(object sender, System.EventArgs e)
        {
            user = m.user;
            dtdt = m.get_data("select * from " + user + ".d_doituong order by madoituong").Tables[0];
            if (d.bQuanlynguon(i_nhom))
            {
                dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0];
            }
            else
            {
                dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0];
            }
            dsdm.ReadXml("..//..//..//xml//d_dmbd.xml");
            dsdm.Tables[0].Columns.Add("Chon", typeof(bool));
            load_grid();
            AddGridTableStyle();

            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));
            ds.ReadXml("..//..//..//xml//m_pttt_thuoc.xml");
            AddGridTableStyle1();
            load_chitiet();
        }
Пример #4
0
        private void frmPttt_thuoc_Load(object sender, System.EventArgs e)
        {
//			DataTable dt=d.get_data("select id from d_duyet where nhom="+i_nhom+" and to_char(ngay,'dd/mm/yyyy')='"+ngay+"'"+" and loai="+loai+" and phieu="+phieu+" and makhoa="+makp).Tables[0];
//			if (dt.Rows.Count!=0) l_duyet=long.Parse(dt.Rows[0][0].ToString());
//			else l_duyet=0;
            dtdt = m.get_data("select * from d_doituong order by madoituong").Tables[0];
            if (d.bQuanlynguon(i_nhom))
            {
                dtnguon = d.get_data("select * from d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0];
            }
            else
            {
                dtnguon = d.get_data("select * from d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0];
            }
            dsdm.ReadXml("..\\..\\..\\xml\\d_tutructh.xml");
            dsdm.Tables[0].Columns.Add("Chon", typeof(bool));
            load_grid();
            AddGridTableStyle();

            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));
            ds.ReadXml("..\\..\\..\\xml\\m_pttt_thuoc.xml");
            AddGridTableStyle1();
            load_chitiet();
        }
Пример #5
0
        private void frmTreoduyet_Load(object sender, System.EventArgs e)
        {
            user           = d.user;
            format_soluong = d.format_soluong(i_nhom);
            if (bTutrucchung)
            {
                label3.Text = "Tủ trực :";
            }
            load_ngay_duyet();

            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            makp.DataSource    = dtkp;
            makp.SelectedValue = i_makp.ToString();
            if (makp.Items.Count > 0)
            {
                kp.Text = dtkp.Rows[makp.SelectedIndex]["ma"].ToString();
            }
            string sql = "select * from " + user + ".d_loaiphieu ";

            if (bThua)
            {
                sql += " where id=0";
            }
            else
            {
                sql += " where nhom=" + i_nhom + " and loai=" + i_loai;
                sql += " and id<>0 order by stt";
            }
            dtph = d.get_data(sql).Tables[0];
            phieudutru.DisplayMember = "TEN";
            phieudutru.ValueMember   = "ID";
            phieudutru.DataSource    = dtph;
            load_phieu();
        }
Пример #6
0
 private void frmYlenh_cd_Load(object sender, System.EventArgs e)
 {
     user = d.user; f_ngay = d.f_ngay;
     dsmabd.ReadXml("..\\..\\..\\xml\\d_mabd.xml");
     makp.DisplayMember = "TEN";
     makp.ValueMember   = "ID";
     sql = "select * from " + user + ".d_duockp";
     if (s_makp != "")
     {
         sql += " where makp='" + s_makp + "'";
     }
     else
     {
         sql += " where makp is not null";
     }
     sql               += " and nhom like '%" + i_nhom.ToString() + ",%'";
     sql               += " order by stt";
     dtmakp             = d.get_data(sql).Tables[0];
     makp.DataSource    = dtmakp;
     makp.SelectedIndex = 0;
     if (i_makp >= 0)
     {
         makp.SelectedValue = i_makp;
     }
     else
     {
         makp.SelectedIndex = 0;
     }
     nhom.DisplayMember = "TEN";
     nhom.ValueMember   = "ID";
     load_nhom();
     load_makho();
     Chech_phieu();
 }
Пример #7
0
 private void load_grid()
 {
     sql  = "select c.ten as tennguon,b.ma,trim(b.ten)||' '||b.hamluong as tenbd,b.tenhc,b.dang,a.tondau,a.slnhap,a.slxuat,a.tondau+a.slnhap-a.slxuat as toncuoi, d.ten as tenkho ";
     sql += " from " + xxx + ".d_tutructh a," + user + ".d_dmbd b," + user + ".d_dmnguon c," + user + ".d_dmkho d ";
     sql += " where a.mabd=b.id and a.manguon=c.id and a.makho=d.id and a.makp=" + i_makp;
     if (i_kho > 0)
     {
         sql += "  and a.makho=" + i_kho + "";
     }
     sql += " order by d.ten, b.ten";
     dt   = d.get_data(sql).Tables[0];
     dataGrid1.DataSource = dt;
 }
Пример #8
0
        private void f_load_dmnhomkho()
        {
            string  asql = "select * from " + d.user + ".d_dmnhomkho where id>0 ";
            DataSet ads  = d.get_data(asql);

            cmbNhomkhonguon.DataSource    = ads.Tables[0].Copy();
            cmbNhomkhonguon.DisplayMember = "TEN";
            cmbNhomkhonguon.ValueMember   = "ID";

            cmbNhomkhoDich.DataSource    = ads.Tables[0].Copy();
            cmbNhomkhoDich.DisplayMember = "TEN";
            cmbNhomkhoDich.ValueMember   = "ID";
        }
Пример #9
0
        private void frmInphieuxuat_Load(object sender, System.EventArgs e)
        {
            user        = m.user; stime = "'" + m.f_ngay + "'";
            imp.Visible = m.Mabv_so == 701424;
            ds.ReadXml("..//..//..//xml//d_xuatkho.xml");
            dsxml.ReadXml("..//..//..//xml//d_xuatkho.xml");
            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";

            dtloai             = d.get_data("select * from " + user + ".d_dmphieu where id<5 order by stt").Tables[0];
            loai.DataSource    = dtloai;
            loai.DisplayMember = "TEN";
            loai.ValueMember   = "ID";

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

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

            nhom.DisplayMember = "TEN";
            nhom.ValueMember   = "ID";
            load_nhom();
            load_makp();
            load_makho();
        }
Пример #10
0
        private void frmDiungthuoc_Load(object sender, System.EventArgs e)
        {
            if (bbadt)
            {
                this.Location        = new System.Drawing.Point(188 - 38, 120);//151
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.Size            = new Size(829 + 40, 610);
            }
            //try
            //{
            //    sql = "alter table   " + user + ".qn_benhnhan add column tieudoan varchar(50) ";
            //    m.execute_data(sql);
            //}
            //catch
            //{
            //}
            user = m.user;
            //LoaiDonVi
            cb_quandoan.DisplayMember = "TEN";
            cb_quandoan.ValueMember   = "id";
            //khuyen 12/02/2014 cb_quandoan.DataSource = d.get_data("select * from " + user + ".qn_dmloaidv order by id").Tables[0];
            cb_quandoan.DataSource = d.get_data("select * from " + user + ".qn_dmdonvi_cap1 order by id").Tables[0];//khuyen 12/02/2014 thay table qn_dmloaidv=qn_dmdonvi_cap1
            //Donvi
            cb_sudoan.DisplayMember = "TEN";
            cb_sudoan.ValueMember   = "id";
            //khuyen 12/02/14 cmbDonVi.DataSource = d.get_data("select * from " + user + ".qn_dmdonvi order by id").Tables[0];
            cb_sudoan.DataSource = d.get_data("select * from " + user + ".qn_dmdonvi_cap2 order by id").Tables[0];//12/02/14 thay table qn_dmdonvi=qn_dmdonvi_cap2

            //khuyen 12/02/2014 them 2 table qn_dmdonvi_cap3,qn_dmdonvi_cap4 vao phan quan ly thong tin bo doi
            //Donvi trung doan
            cmbTrung_Doan.DisplayMember = "TEN";
            cmbTrung_Doan.ValueMember   = "id";
            cmbTrung_Doan.DataSource    = d.get_data("select * from " + user + ".qn_dmdonvi_cap3 order by id").Tables[0];
            //Donvi tieu doan
            cmbTieu_doan.DisplayMember = "TEN";
            cmbTieu_doan.ValueMember   = "id";
            cmbTieu_doan.DataSource    = d.get_data("select * from " + user + ".qn_dmdonvi_cap4 order by id").Tables[0];
            //end
            //CapBac
            cmbCapBac.DisplayMember = "TEN";
            cmbCapBac.ValueMember   = "id";
            cmbCapBac.DataSource    = d.get_data("select * from " + user + ".qn_dmcapbac order by id").Tables[0];
            //ChucVu
            cmbChucVu.DisplayMember = "TEN";
            cmbChucVu.ValueMember   = "id";
            cmbChucVu.DataSource    = d.get_data("select * from " + user + ".qn_dmchucvu order by id").Tables[0];
            load_grid();
            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());

            ref_text();
            if (bxemlai == false)
            {
                butMoi_Click(null, null);
            }
            //  cb_quandoan_SelectedIndexChanged(null, null);
        }
Пример #11
0
        private void frmDiungthuoc_Load(object sender, System.EventArgs e)
        {
            list.DisplayMember = "MA";
            list.ValueMember   = "TEN";
            list.DataSource    = d.get_data("select a.ma,a.ten from d_dmhoatchat a,d_dmnhomkho b where a.nhom=b.id and b.loai=1 order by a.ten").Tables[0];

            mucdo.DisplayMember = "TEN";
            mucdo.ValueMember   = "ID";
            mucdo.DataSource    = d.get_data("select * from mucdodiung order by stt").Tables[0];
            load_grid();
            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());

            ref_text();
        }
Пример #12
0
        private void frmSotienNgay_Load(object sender, System.EventArgs e)
        {
            user = m.user;
            ds.ReadXml("..//..//..//xml//sotienngay.xml");
            makp.DataSource    = d.get_data("select * from " + user + ".btdkp_bv order by loai,makp").Tables[0];
            makp.DisplayMember = "TENKP";
            makp.ValueMember   = "MAKP";

            ketqua.DataSource    = d.get_data("select * from " + user + ".ketqua order by ma").Tables[0];
            ketqua.DisplayMember = "TEN";
            ketqua.ValueMember   = "MA";

            dataGrid1.DataSource = ds.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());
        }
Пример #13
0
 private void load_grid()
 {
     if (dt == null || dt.Rows.Count == 0)
     {
         dt = d.get_data("select * from " + user + mmyy + ".d_chandoan where id=" + l_id + " and loai=" + i_loai).Tables[0];
     }
     dataGrid1.DataSource = dt;
 }
Пример #14
0
        //binh
        private string get_dirreport(int s_id)
        {
            string s_dir = "";
            string sql   = "select * from " + d.user + ".d_thongso where id=" + s_id + " and nhom=" + i_nhom;

            try
            {
                System.Data.DataTable dt = d.get_data(sql).Tables[0];
                foreach (DataRow r in dt.Rows)
                {
                    s_dir = r["ten"].ToString().Trim();
                }
                dt.Dispose();
            }
            catch {}
            return((s_dir == "")?"report":s_dir);
        }
Пример #15
0
        public DataTable get_db_tuongtac(string s_generic1)
        {
            string suser = d.user;

            //sql = "select * from " + suser + ".d_group where lower(generic1)='" + s_generic1.Trim() + "'";
            sql  = "select lower(generic1) as generic1, lower(generic2) as generic2, g1, g2, effect, a.severity, action1, action2, action3, action4, action5 ";
            sql += ", b.effect_eng, effect_vn, c1.action_eng as action_eng1, c1.action_vn as action_vn1, c2.action_eng as action_eng2, c2.action_vn as action_vn2, c3.action_eng as action_eng3, c3.action_vn as action_vn3, c4.action_eng as action_eng4, c4.action_vn as action_vn4, c5.action_eng as action_eng5, c5.action_vn as action_vn5 ";
            sql += ", d.vietnam as severity_v, d.severity_e, a.kt_ ";
            sql += " from " + suser_tt + ".d_drug_interaction_full a, " + suser_tt + ".d_effect b,  " + suser_tt + ".d_action c1," + suser_tt + ".d_action c2," + suser_tt + ".d_action c3, " + suser_tt + ".d_action c4, " + suser_tt + ".d_action c5 ";
            sql += " , " + suser_tt + ".d_severity d";
            sql += " where a.effect=b.code(+) and a.action1=c1.code(+) and a.action2=c2.code(+) and a.action3=c3.code(+) and a.action4=c4.code(+) and a.action5=c5.code (+) ";
            sql += " and a.severity = d.code(+)";
            sql += " and lower(a.generic1)='" + s_generic1.Trim().ToLower() + "'";
            return(d.get_data(sql).Tables[0]);
        }
Пример #16
0
        private void rptXuat_khoa_Load(object sender, System.EventArgs e)
        {
            user           = d.user; stime = "'" + d.f_ngay + "'";
            i_dongia       = d.d_dongia_le(i_nhom);
            format_soluong = d.format_soluong(i_nhom);
            sql            = "select a.*, b.stt as sttnhom, b.ten as tennhom from " + user + ".d_dmbd a, " + user + ".d_dmnhom b";
            sql           += " where a.manhom=b.id and a.nhom=" + i_nhom + " order by a.id";
            dt             = d.get_data(sql).Tables[0];

            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];
            }

            sql = "select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom;
            if (s_kho != "")
            {
                sql += " and id in (" + s_kho.Substring(0, s_kho.Length - 1) + ")";
            }
            sql                += " order by stt";
            dtdmkho             = d.get_data(sql).Tables[0];
            makho.DataSource    = dtdmkho;
            makho.DisplayMember = "TEN";
            makho.ValueMember   = "ID";
        }
Пример #17
0
        private void f_Loadchinhanh()
        {
            string asql = "select * from medibv.dmchinhanh where id>0 ";

            if (i_ChiNhanhHienTai > 0)
            {
                asql += " and id<>" + i_ChiNhanhHienTai;
            }
            dscn = d.get_data(asql);
            cmbChinhanh.DataSource    = dscn.Tables[0];
            cmbChinhanh.DisplayMember = "TEN";
            cmbChinhanh.ValueMember   = "ID";
        }
Пример #18
0
        private void frmDiungthuoc_Load(object sender, System.EventArgs e)
        {
            if (bbadt)
            {
                this.Location        = new System.Drawing.Point(188 - 38, 120);//151
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.Size            = new Size(829 + 40, 610);
            }
            user = m.user;
            list.DisplayMember = "MA";
            list.ValueMember   = "TEN";
            list.DataSource    = d.get_data("select a.ma,a.ten from " + user + ".d_dmhoatchat a," + user + ".d_dmnhomkho b where a.nhom=b.id and b.loai=1 and a.ten<>'' order by a.ten").Tables[0];

            mucdo.DisplayMember = "TEN";
            mucdo.ValueMember   = "ID";
            mucdo.DataSource    = d.get_data("select * from " + user + ".mucdodiung order by stt").Tables[0];
            load_grid();
            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());

            ref_text();
        }
Пример #19
0
        private void frmPttt_thuoc_Load(object sender, System.EventArgs e)
        {
            user = d.user;
            dtdt = m.get_data("select * from " + user + ".d_doituong order by madoituong").Tables[0];
            if (d.bQuanlynguon(i_nhom))
            {
                dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0];
            }
            else
            {
                dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0];
            }
            dsdm.ReadXml("..//..//..//xml//d_tutructh.xml");
            dsdm.Tables[0].Columns.Add("Chon", typeof(bool));
            if (mapt != "")
            {
                foreach (DataRow r in m.get_data("select mavp from " + user + ".dmpttt where mapt='" + mapt + "'").Tables[0].Rows)
                {
                    l_mavp = decimal.Parse(r["mavp"].ToString());
                }
            }
            load_grid();
            AddGridTableStyle();
            f_soluong = d.format_soluong(i_nhom);
            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));
            ds.ReadXml("..//..//..//xml//m_pttt_thuoc.xml");
            AddGridTableStyle1();
            load_chitiet();
        }
Пример #20
0
        private void load_d_dm()
        {
            string sql = "select * from d_duockp order by stt";

            tenkp.DisplayMember = "TEN";
            tenkp.ValueMember   = "ID";
            tenkp.DataSource    = d.get_data(sql).Tables[0];
            //
            //dtdmbd=d.get_data("select a.ma,trim(a.ten)||' '||a.hamluong ten,trim(b.ten)||'/'||c.ten hang,a.dang,a.tenhc,a.id,a.giaban,b.ten tenhang,c.ten tennuoc from d_dmbd a,d_dmhang b,d_dmnuoc c where a.mahang=b.id and a.manuoc=c.id and a.nhom="+i_nhom+" order by a.ten").Tables[0];
            dtdmbd = d.get_data("select a.ma,trim(a.ten)||' '||a.hamluong ten,trim(b.ten)||'/'||c.ten hang,a.dang,a.tenhc,a.id,a.giaban,b.ten tenhang,c.ten tennuoc, d.ma stk from d_dmbd a,d_dmhang b,d_dmnuoc c,d_dmnhomkt d where a.mahang=b.id and a.manuoc=c.id and a.sotk=d.id(+) and a.nhom=" + i_nhom + " order by a.ten").Tables[0].Copy();
            //
            no.Tag = "";
            co.Tag = "";
        }
Пример #21
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (thumuc.Text == "")
            {
                button1_Click(null, null);
                return;
            }
            if (!System.IO.File.Exists(thumuc.Text))
            {
                MessageBox.Show("Không tìm thấy File !");
                return;
            }
            string sql = "";

            sql = " create table " + s_user + ".d_group (id numeric(7), generic1 varchar(255),generic2 varchar(255), group1 varchar(255), group2 varchar(255), severity numeric(3), mechanism text,actions text, s_effect text, mec_detail text)";
            d.execute_data(sql);
            //
            dthc = d.get_data("select * from " + s_user + ".d_group ").Tables[0];
            sql  = "select * from group1 order by generic1";
            string s_name = "", s_generic = "", s_group = "", s_exp = "", s_id = "0", s_severity = "0";
            string s_ploai = "";
            int    i_loai = 0, i_stt = 0, i_id = 0, i_nhom = 1;//Khoa duoc
            long   l_id = 0;

            ds = m.get_data_acc(sql, thumuc.Text);
            int jjj = 0;

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                s_exp = "generic1='" + r["generic1"].ToString().Trim().Replace("'", "") + "' and generic2='" + r["generic2"].ToString().Trim().Replace("'", "") + "'";
                DataRow dr = d.getrowbyid(dthc, s_exp);
                if (dr == null)
                {
                    s_group    = r["group1"].ToString().Trim().Replace("'", "");
                    s_generic  = r["generic1"].ToString().Trim().Replace("'", "");
                    s_id       = (r["id"].ToString().Trim() == "") ? "0" : r["id"].ToString().Trim();
                    s_severity = (r["severity"].ToString().Trim() == "") ? "0" : r["severity"].ToString().Trim();
                    sql        = "insert into " + s_user + ".d_group (id, generic1, generic2, group1, group2, severity, mechanism, actions, s_effect, mec_detail) ";
                    sql       += " values(" + s_id + ",'" + s_generic + "','" + r["generic2"].ToString().Trim().Replace("'", "") + "','" + s_group + "','" + r["group2"].ToString().Trim().Replace("'", "") + "'," + s_severity + ",'" + r["mechanism"].ToString().Trim().Replace("'", "") + "','" + r["actions"].ToString().Trim().Replace("'", "") + "','" + r["s_effect"].ToString().Trim().Replace("'", "") + "','" + r["mec_detail"].ToString().Trim().Replace("'", "") + "')";
                    d.execute_data(sql);
                }
                jjj        += 1;
                label1.Text = "Record " + jjj.ToString();
                this.Refresh();
            }
            thumuc.Text = "";
        }
Пример #22
0
 private void rptBcngay_Load(object sender, System.EventArgs e)
 {
     user                 = d.user; stime = "'" + d.f_ngay + "'";
     dtnhom               = d.get_data("select * from " + user + ".d_dmnhom where nhom=" + i_nhom + " order by stt").Tables[0];
     manhom.DataSource    = dtnhom;
     manhom.DisplayMember = "TEN";
     manhom.ValueMember   = "ID";
     sql = "select * from " + user + ".d_duockp where makp is not null and 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";
     dtmakp             = d.get_data(sql).Tables[0];
     makp.DataSource    = dtmakp;
     makp.DisplayMember = "TEN";
     makp.ValueMember   = "ID";
     dt = d.get_data("select * from " + user + ".d_dmbd where nhom=" + i_nhom + " order by id").Tables[0];
     dsngay.ReadXml("..//..//..//xml//d_tsngay.xml");
     dieutri.SelectedIndex = 0;
 }
Пример #23
0
 private void load_makp()
 {
     if (nhom.SelectedIndex != -1)
     {
         sql = "select * from " + user + ".d_duockp where nhom like '%" + int.Parse(nhom.SelectedValue.ToString()) + ",%'";
         if (s_makp != "")
         {
             string s = s_makp.Replace(",", "','");
             sql += " and makp in ('" + s.Substring(0, s.Length - 3) + "')";
         }
         else if (i_benhnhan == 1)
         {
             sql += " and makp is not null";
         }
         sql            += " order by stt";
         dtmakp          = d.get_data(sql).Tables[0];
         makp.DataSource = dtmakp;
         if (makp.Items.Count > 0)
         {
             kp.Text = dtmakp.Rows[makp.SelectedIndex]["ma"].ToString();
         }
         if (i_loai == 2)
         {
             load_matutruc();
         }
     }
 }
Пример #24
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            string sql1 = "", sql2 = "";
            int    loai;

            ds.Clear();
            ds.ReadXml("..\\..\\..\\xml\\thnx.xml");
            foreach (DataColumn c in ds.Tables[0].Columns)
            {
                c.DefaultValue = 0;
            }
            if (loaibenh.SelectedIndex < 0)
            {
                loai = -1;
                sql  = "select to_char(ngay,'dd/mm/yyyy') ngay,count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(b.makp,'02',1,0)) a,";
                sql += "sum(decode(b.makp,'03',1,0)) b,sum(decode(b.makp,'04',1,0)) c,sum(decode(b.makp,'05',1,0)) d,sum(decode(b.makp,'06',1,0)) e,";
                sql += "sum(decode(b.makp,'07',1,0)) x1,sum(decode(b.makp,'08',1,0)) x2,sum(decode(b.makp,'09',1,0)) x3,sum(decode(b.makp,'10',1,0)) hc,sum(decode(b.makp,'20',1,0)) vl";
                sql += " from btdbn a,nhapkhoa b where a.mabn=b.mabn and to_date(b.ngay,'dd/mm/yy') between to_date('" + tu.Text + "','dd/mm/yy') and to_date('" + den.Text + "','dd/mm/yy') ";
                sql += "group by to_char(ngay,'dd/mm/yyyy') order by substr(ngay,7)||substr(ngay,4,2)||substr(ngay,1,2)";

                sql1  = "select to_char(ngay,'dd/mm/yyyy') ngay,count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql1 += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(c.makp,'02',1,0)) a,";
                sql1 += "sum(decode(c.makp,'03',1,0)) b,sum(decode(c.makp,'04',1,0)) c,sum(decode(c.makp,'05',1,0)) d,sum(decode(c.makp,'06',1,0)) e,";
                sql1 += "sum(decode(c.makp,'07',1,0)) x1,sum(decode(c.makp,'08',1,0)) x2,sum(decode(c.makp,'09',1,0)) x3,sum(decode(c.makp,'10',1,0)) hc,sum(decode(c.makp,'20',1,0)) vl";
                sql1 += " from btdbn a,xuatkhoa b,nhapkhoa c,benhandt d where a.mabn=c.mabn and c.maql=d.maql and b.id=c.id and to_date(b.ngay,'dd/mm/yy') between to_date('" + tu.Text + "','dd/mm/yy') and to_date('" + den.Text + "','dd/mm/yy') ";
                sql1 += "group by to_char(ngay,'dd/mm/yyyy') order by substr(ngay,7)||substr(ngay,4,2)||substr(ngay,1,2)";

                sql2  = "select count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql2 += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(c.makp,'02',1,0)) a,";
                sql2 += "sum(decode(c.makp,'03',1,0)) b,sum(decode(c.makp,'04',1,0)) c,sum(decode(c.makp,'05',1,0)) d,sum(decode(c.makp,'06',1,0)) e,";
                sql2 += "sum(decode(c.makp,'07',1,0)) x1,sum(decode(c.makp,'08',1,0)) x2,sum(decode(c.makp,'09',1,0)) x3,sum(decode(c.makp,'10',1,0)) hc,sum(decode(c.makp,'20',1,0)) vl";
                sql2 += " from nhapkhoa c,btdbn a,xuatkhoa b where c.id=b.id(+) and a.mabn=c.mabn ";
                sql2 += " and to_date(c.ngay,'dd/mm/yy')<to_date('" + tu.Text + "','dd/mm/yy') and (b.ngay is null or to_date(b.ngay,'dd/mm/yy')>to_date('" + tu.Text + "','dd/mm/yy'))";
            }
            else
            {
                loai = int.Parse(loaibenh.SelectedValue.ToString());
                sql  = "select to_char(b.ngay,'dd/mm/yyyy') ngay,count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(b.makp,'02',1,0)) a,";
                sql += "sum(decode(b.makp,'03',1,0)) b,sum(decode(b.makp,'04',1,0)) c,sum(decode(b.makp,'05',1,0)) d,sum(decode(b.makp,'06',1,0)) e,";
                sql += "sum(decode(b.makp,'07',1,0)) x1,sum(decode(b.makp,'08',1,0)) x2,sum(decode(b.makp,'09',1,0)) x3,sum(decode(b.makp,'10',1,0)) hc,sum(decode(b.makp,'20',1,0)) vl";
                sql += " from btdbn a,nhapkhoa b,benhandt c where a.mabn=b.mabn and b.maql=c.maql and to_date(b.ngay,'dd/mm/yy') between to_date('" + tu.Text + "','dd/mm/yy') and to_date('" + den.Text + "','dd/mm/yy') and loaiba=" + loai;
                sql += " group by to_char(b.ngay,'dd/mm/yyyy') order by substr(ngay,7)||substr(ngay,4,2)||substr(ngay,1,2)";

                sql1  = "select to_char(b.ngay,'dd/mm/yyyy') ngay,count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql1 += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(c.makp,'02',1,0)) a,";
                sql1 += "sum(decode(c.makp,'03',1,0)) b,sum(decode(c.makp,'04',1,0)) c,sum(decode(c.makp,'05',1,0)) d,sum(decode(c.makp,'06',1,0)) e,";
                sql1 += "sum(decode(c.makp,'07',1,0)) x1,sum(decode(c.makp,'08',1,0)) x2,sum(decode(c.makp,'09',1,0)) x3,sum(decode(c.makp,'10',1,0)) hc,sum(decode(c.makp,'20',1,0)) vl";
                sql1 += " from btdbn a,xuatkhoa b,nhapkhoa c,benhandt d where a.mabn=c.mabn and c.maql=d.maql and to_date(b.ngay,'dd/mm/yy') between to_date('" + tu.Text + "','dd/mm/yy') and to_date('" + den.Text + "','dd/mm/yy') and b.id=c.id and loaiba=" + loai;
                sql1 += " group by to_char(b.ngay,'dd/mm/yyyy') order by substr(ngay,7)||substr(ngay,4,2)||substr(ngay,1,2)";

                sql2  = "select count(*) ts,sum(decode(a.phai,0,1,0)) nu,sum(decode(a.mann,'07',1,0)) cb,sum(decode(a.mann,'04',1,0)) cn,";
                sql2 += "sum(decode(a.mann,'01',1,0)) te,sum(decode(a.mann,'04',0,'01',0,'07',0,1)) nd,sum(decode(c.makp,'02',1,0)) a,";
                sql2 += "sum(decode(c.makp,'03',1,0)) b,sum(decode(c.makp,'04',1,0)) c,sum(decode(c.makp,'05',1,0)) d,sum(decode(c.makp,'06',1,0)) e,";
                sql2 += "sum(decode(c.makp,'07',1,0)) x1,sum(decode(c.makp,'08',1,0)) x2,sum(decode(c.makp,'09',1,0)) x3,sum(decode(c.makp,'10',1,0)) hc,sum(decode(c.makp,'20',1,0)) vl";
                sql2 += " from nhapkhoa c,btdbn a,xuatkhoa b,benhandt d where c.id=b.id(+) and a.mabn=c.mabn and c.maql=d.maql and loaiba=" + loai;
                sql2 += " and to_date(c.ngay,'dd/mm/yy')<to_date('" + tu.Text + "','dd/mm/yy') and (b.ngay is null or to_date(b.ngay,'dd/mm/yy')>to_date('" + tu.Text + "','dd/mm/yy'))";
            }

            System.Data.DataTable dtdk = new System.Data.DataTable();          //dau ky
            dtdk = m.get_data(sql2).Tables[0];

            dt = m.get_data(sql1).Tables[0];
            DataRow r1, r2, rdk;

            foreach (DataRow r in m.get_data(sql).Tables[0].Rows)
            {
                r1     = ds.Tables[0].NewRow();
                r1[0]  = r["ngay"].ToString();
                r1[1]  = Decimal.Parse(r["ts"].ToString());
                r1[2]  = Decimal.Parse(r["nu"].ToString());
                r1[3]  = Decimal.Parse(r["cb"].ToString());
                r1[4]  = Decimal.Parse(r["cn"].ToString());
                r1[5]  = Decimal.Parse(r["nd"].ToString());
                r1[6]  = Decimal.Parse(r["te"].ToString());
                r1[7]  = Decimal.Parse(r["a"].ToString());
                r1[8]  = Decimal.Parse(r["b"].ToString());
                r1[9]  = Decimal.Parse(r["c"].ToString());
                r1[10] = Decimal.Parse(r["d"].ToString());
                r1[11] = Decimal.Parse(r["e"].ToString());
                r1[12] = Decimal.Parse(r["x1"].ToString());
                r1[13] = Decimal.Parse(r["x2"].ToString());
                r1[14] = Decimal.Parse(r["x3"].ToString());
                r1[15] = Decimal.Parse(r["hc"].ToString());
                r1[16] = Decimal.Parse(r["vl"].ToString());

                r2 = m.getrowbyid(dt, "ngay='" + r["ngay"].ToString() + "'");
                if (r2 != null)
                {
                    r1[17] = Decimal.Parse(r2["ts"].ToString());
                    r1[18] = Decimal.Parse(r2["nu"].ToString());
                    r1[19] = Decimal.Parse(r2["cb"].ToString());
                    r1[20] = Decimal.Parse(r2["cn"].ToString());
                    r1[21] = Decimal.Parse(r2["nd"].ToString());
                    r1[22] = Decimal.Parse(r2["te"].ToString());
                    r1[23] = Decimal.Parse(r2["a"].ToString());
                    r1[24] = Decimal.Parse(r2["b"].ToString());
                    r1[25] = Decimal.Parse(r2["c"].ToString());
                    r1[26] = Decimal.Parse(r2["d"].ToString());
                    r1[27] = Decimal.Parse(r2["e"].ToString());
                    r1[28] = Decimal.Parse(r2["x1"].ToString());
                    r1[29] = Decimal.Parse(r2["x2"].ToString());
                    r1[30] = Decimal.Parse(r2["x3"].ToString());
                    r1[31] = Decimal.Parse(r2["hc"].ToString());
                    r1[32] = Decimal.Parse(r2["vl"].ToString());
                }
                //dau ky + nhap - xuat
                rdk = dtdk.Rows[0];
                //rdk["nl"]=Decimal.Parse(rdk["ts"].ToString())+Decimal.Parse(r1["v_ts"].ToString())-Decimal.Parse(r1["r_ts"].ToString())-(Decimal.Parse(rdk["te"].ToString())+Decimal.Parse(r1["v_te"].ToString())-Decimal.Parse(r1["r_te"].ToString()));
                rdk["nu"] = Decimal.Parse(rdk["nu"].ToString()) + Decimal.Parse(r1["v_nu"].ToString()) - Decimal.Parse(r1["r_nu"].ToString());
                rdk["cb"] = Decimal.Parse(rdk["cb"].ToString()) + Decimal.Parse(r1["v_cb"].ToString()) - Decimal.Parse(r1["r_cb"].ToString());
                rdk["cn"] = Decimal.Parse(rdk["cn"].ToString()) + Decimal.Parse(r1["v_cn"].ToString()) - Decimal.Parse(r1["r_cn"].ToString());
                rdk["nd"] = Decimal.Parse(rdk["nd"].ToString()) + Decimal.Parse(r1["v_nd"].ToString()) - Decimal.Parse(r1["r_nd"].ToString());
                rdk["te"] = Decimal.Parse(rdk["te"].ToString()) + Decimal.Parse(r1["v_te"].ToString()) - Decimal.Parse(r1["r_te"].ToString());
                rdk["a"]  = Decimal.Parse(rdk["a"].ToString()) + Decimal.Parse(r1["v_a"].ToString()) - Decimal.Parse(r1["r_a"].ToString());
                rdk["b"]  = Decimal.Parse(rdk["b"].ToString()) + Decimal.Parse(r1["v_b"].ToString()) - Decimal.Parse(r1["r_b"].ToString());
                rdk["c"]  = Decimal.Parse(rdk["c"].ToString()) + Decimal.Parse(r1["v_c"].ToString()) - Decimal.Parse(r1["r_c"].ToString());
                rdk["d"]  = Decimal.Parse(rdk["d"].ToString()) + Decimal.Parse(r1["v_d"].ToString()) - Decimal.Parse(r1["r_d"].ToString());
                rdk["e"]  = Decimal.Parse(rdk["e"].ToString()) + Decimal.Parse(r1["v_e"].ToString()) - Decimal.Parse(r1["r_e"].ToString());
                rdk["x1"] = Decimal.Parse(rdk["x1"].ToString()) + Decimal.Parse(r1["v_1"].ToString()) - Decimal.Parse(r1["r_1"].ToString());
                rdk["x2"] = Decimal.Parse(rdk["x2"].ToString()) + Decimal.Parse(r1["v_2"].ToString()) - Decimal.Parse(r1["r_2"].ToString());
                rdk["x3"] = Decimal.Parse(rdk["x3"].ToString()) + Decimal.Parse(r1["v_3"].ToString()) - Decimal.Parse(r1["r_3"].ToString());
                rdk["hc"] = Decimal.Parse(rdk["hc"].ToString()) + Decimal.Parse(r1["v_hc"].ToString()) - Decimal.Parse(r1["r_hc"].ToString());
                rdk["vl"] = Decimal.Parse(rdk["vl"].ToString()) + Decimal.Parse(r1["v_vl"].ToString()) - Decimal.Parse(r1["r_vl"].ToString());
                rdk["ts"] = Decimal.Parse(rdk["ts"].ToString()) + Decimal.Parse(r1["v_ts"].ToString()) - Decimal.Parse(r1["r_ts"].ToString());

                r1[33] = Decimal.Parse(rdk["ts"].ToString()) - Decimal.Parse(rdk["te"].ToString());
                r1[34] = rdk["nu"];
                r1[35] = rdk["cb"];
                r1[36] = rdk["cn"];
                r1[37] = rdk["nd"];
                r1[38] = rdk["te"];
                r1[39] = rdk["a"];
                r1[40] = rdk["b"];
                r1[41] = rdk["c"];
                r1[42] = rdk["d"];
                r1[43] = rdk["e"];
                r1[44] = rdk["x1"];
                r1[45] = rdk["x2"];
                r1[46] = rdk["x3"];
                r1[47] = rdk["hc"];
                r1[48] = rdk["vl"];
                r1[49] = rdk["ts"];
                ds.Tables[0].Rows.Add(r1);
            }
            try
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Không có số liệu !");
                    return;
                }
                else
                {
                    string title = "Từ ngày " + tu.Text + " Đến ngày " + den.Text;
                    if (tu.Text == den.Text)
                    {
                        title = "Ngày " + tu.Text;
                    }
//					ds.WriteXml("rthnx.xml");
                    exp_excel(false);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Пример #25
0
 private void load_makp()
 {
     if (nhom.SelectedIndex != -1)
     {
         sql = "select a.* from " + user + ".d_duockp a left join " + user + ".btdkp_bv b on a.makp=b.makp where a.nhom like '%" + int.Parse(nhom.SelectedValue.ToString()) + ",%'";
         if (s_makp != "")
         {
             string s = s_makp.Replace(",", "','");
             if (s.Length > 3)
             {
                 s = s.Substring(0, s.Length - 3);
             }
             sql += " and a.makp in ('" + s + "')";
         }
         else if (i_benhnhan == 1)
         {
             sql += " and a.makp is not null";
         }
         if (i_khudt != 0)
         {
             sql += " and (a.khu=0 or a.khu=" + i_khudt + ")";              //binh 210411
         }
         if (i_idchinhanh > 0)
         {
             sql += " and a.chinhanh=" + i_idchinhanh;
         }
         sql            += " order by a.stt";
         dtmakp          = d.get_data(sql).Tables[0];
         makp.DataSource = dtmakp;
         if (makp.Items.Count > 0)
         {
             kp.Text = dtmakp.Rows[makp.SelectedIndex]["ma"].ToString();
         }
         if (i_loai == 2)
         {
             load_matutruc();
         }
     }
 }
Пример #26
0
        private void load_phieu()
        {
            if (bThua)
            {
                sql = "select * from " + user + ".d_loaiphieu where id=0";
            }
            else
            {
                string s_phieu = "";
                string tenfile = (i_loai == 2) ? "d_bucstt" : "d_xuatsdct";
                sql = "select distinct a.phieu from " + xxx + ".d_xuatsdll a," + xxx + "." + tenfile + " b where a.id=b.id and a.nhom=" + i_nhom + " and a.loai=" + i_loai + " and to_char(a.ngay,'dd/mm/yyyy')='" + s_ngay + "'";
                if (makp.SelectedIndex != -1)
                {
                    if (bIntheocstt)
                    {
                        sql += " and a.makp=" + int.Parse(makp.SelectedValue.ToString());
                    }
                    else
                    {
                        sql += " and a.makhoa=" + int.Parse(makp.SelectedValue.ToString());
                    }
                }
                if (s_makho != "")
                {
                    sql += " and b.makho in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
                }
                foreach (DataRow r in d.get_data(sql).Tables[0].Rows)
                {
                    s_phieu += r["phieu"].ToString() + ",";
                }

                sql  = "select * from " + user + ".d_loaiphieu where nhom=" + i_nhom;
                sql += " and loai=" + i_loai;
                if (s_phieu != "")
                {
                    sql += " and id in (" + s_phieu.Substring(0, s_phieu.Length - 1) + ")";
                }
                sql += " order by stt";
            }
            dtphieu          = d.get_data(sql).Tables[0];
            phieu.DataSource = dtphieu;
        }
Пример #27
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);
        }
Пример #28
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));
        }
Пример #29
0
        private void frmKhoacstt_Load(object sender, System.EventArgs e)
        {
            s_makho = ""; user = d.user; stime = "'" + d.f_ngay + "'";
            foreach (DataRow r in d.get_data("select kho from " + user + ".d_dmphieu where id=2").Tables[0].Rows)
            {
                s_makho = r["kho"].ToString();
            }

            makho.DisplayMember = "TEN";
            makho.ValueMember   = "ID";
            string sql = "select * from " + user + ".d_dmkho where hide=0 and loai=" + i_loai;

            if (i_loai == 1)
            {
                sql += " and nhom=" + i_nhom;
                if (s_makho != "")
                {
                    sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
                }
            }
            else
            {
                sql += " and nhom<>" + i_nhom;
                if (s_nhomkho != "")
                {
                    sql += " and nhom in (" + s_nhomkho.Substring(0, s_nhomkho.Length - 1) + ")";
                }
            }
            sql             += " order by stt";
            dtdmkho          = d.get_data(sql).Tables[0];
            makho.DataSource = dtdmkho;
            if (makho.Items.Count > 0)
            {
                makho.SelectedIndex = 0;
            }

            makp.DisplayMember = "TEN";
            makp.ValueMember   = "ID";
            sql = "select * from " + user + ".d_duockp 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;
            if (makp.Items.Count > 0)
            {
                makp.SelectedIndex = 0;
            }

            ds.ReadXml("..//..//..//xml//d_khoacstt.xml");
            dsxml.ReadXml("..//..//..//xml//d_khoacstt.xml");
            format_soluong = d.format_soluong(i_nhom);
            sql            = "select a.*, b.stt as sttnhom, b.ten as tennhom,c.ten as tenhang,d.ten as nuocsx from " + user + ".d_dmbd a, " + user + ".d_dmnhom b," + user + ".d_dmhang c," + user + ".d_dmnuoc d";
            sql           += " where a.manhom=b.id and a.mahang=c.id and a.manuoc=d.id and a.nhom=" + i_nhom + " order by a.id";
            dt             = d.get_data(sql).Tables[0];

            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 nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0];
            }
        }
Пример #30
0
        private void butChon_Click(object sender, System.EventArgs e)
        {
            if (makp.SelectedIndex == -1)
            {
                makp.Focus(); return;
            }
            if (phieu.SelectedIndex == -1)
            {
                phieu.Focus(); return;
            }
            s_phieu = "";
            if (phieudutru.CheckedItems.Count > 0)
            {
                for (int i = 0; i < phieudutru.Items.Count; i++)
                {
                    if (phieudutru.GetItemChecked(i))
                    {
                        s_phieu += dtph.Rows[i]["id"].ToString().Trim() + ",";
                    }
                }
            }
            s_tu    = tu.Text; s_den = den.Text; i_phieu = int.Parse(phieu.SelectedValue.ToString()); i_makp = int.Parse(makp.SelectedValue.ToString());
            s_tenkp = makp.Text;
            if (d.get_duyet(s_mmyy, i_makp, i_nhom, i_loai, i_phieu, s_ngay, s_makho))
            {
                MessageBox.Show(lan.Change_language_MessageText("Ngày") + " " + s_ngay + "\n" + lan.Change_language_MessageText("Khoa") + " " + makp.Text + "\n" + lan.Change_language_MessageText("Phiếu") + " " + phieu.Text + "\n" + lan.Change_language_MessageText("Đã duyệt !"), d.Msg);
                return;
            }
            bool bChieu_sang = m.bChieu_sang;

            if (bChieu_sang)
            {
                DataRow r1, r2;
                r2 = d.getrowbyid(dtphieu, "id=" + int.Parse(phieu.SelectedValue.ToString()));
                if (r2 != null)
                {
                    if (r2["buoi"].ToString() == "0")
                    {
                        r1 = d.getrowbyid(dtkp, "id=" + int.Parse(makp.SelectedValue.ToString()));
                        if (r1 != null)
                        {
                            if (d.get_ttngay(s_ngay, r1["makp"].ToString()))
                            {
                                MessageBox.Show(lan.Change_language_MessageText("Ngày") + " " + s_ngay + " " + lan.Change_language_MessageText("viện phí đã in danh sách thu tiền") + "\n" + lan.Change_language_MessageText("Yêu cầu chọn phiếu buổi chiều !"), d.Msg);
                                return;
                            }
                        }
                    }
                }
            }
            if (chkChuyen.Checked)
            {
                string sql = "select id from " + xxx + ".d_duyet ";
                sql += " where done=0 and nhom=" + i_nhom + " and loai=" + i_loai;
                sql += " and makhoa=" + i_makp;
                sql += " and ngay between to_date('" + s_tu + "','" + f_ngay + "') and to_date('" + s_den + "','" + f_ngay + "')";
                if (s_phieu != "")
                {
                    sql += " and phieu in (" + s_phieu.Substring(0, s_phieu.Length - 1) + ")";
                }
                foreach (DataRow r in d.get_data(sql).Tables[0].Rows)
                {
                    d.execute_data("update " + xxx + ".d_duyet set done=1 where id=" + decimal.Parse(r["id"].ToString()));
                }
            }
            DataTable dttam = new DataTable();

            dttam = d.get_data("select computer from " + user + ".d_danglaysolieu where makp=" + i_makp +
                               " and phieu=" + i_phieu + " and to_char(ngay,'dd/mm/yyyy')='" + s_ngay + "' and computer<>'" + System.Environment.MachineName + "'").Tables[0];
            if (dttam.Rows.Count > 0)
            {
                MessageBox.Show(lan.Change_language_MessageText("Phiếu này đang lấy số liệu duyệt tại máy ") + dttam.Rows[0][0].ToString() + lan.Change_language_MessageText(".\n Vui lòng chọn phiếu khác."));
                return;
            }
            d.upd_danglaysolieu(i_makp, i_phieu, s_ngay, i_userid);
            d.close(); this.Close();
        }