示例#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));
        }
示例#2
0
        private void frmReport_Load(object sender, System.EventArgs e)
        {
            this.Report.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
            this.Size        = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
            string dir = System.IO.Directory.GetCurrentDirectory();

            //
            bAdminHethong = d.bAdmin(d_userid);
            i_nhom        = get_nhomkho();
            if (!bAdminHethong && d.bUserthuong_CamxuatExcel_E11(i_nhom))
            {
                butExcel.Enabled        = false;
                Report.ShowExportButton = false;
            }
            //
            ExportPath = "";
            int j = 0;

            for (int i = 0; i < dir.Length; i++)
            {
                if (dir.Substring(i, 1) == "\\")
                {
                    j++;
                }
                if (j == 2)
                {
                    break;
                }
                ExportPath += dir.Substring(i, 1);
            }
            ExportPath += "\\pdf\\";
            if (!System.IO.Directory.Exists(ExportPath))
            {
                System.IO.Directory.CreateDirectory(ExportPath);
            }
            s_dirreport    = get_dirreport(56);       //doc thu muc report cua tung benh vien
            i_soluong_le   = d.d_soluong_le(i_nhom);
            i_dongia_le    = d.d_dongia_le(i_nhom);
            i_thanhtien_le = d.d_thanhtien_le(i_nhom);
            //
            if (b_bienlai)
            {
                Bienlai();
            }
            else if (ReportFile.ToString().ToLower() == "d_phieunhap.rpt")
            {
                Phieunhap();
            }
            else if (bDs)
            {
                Reportds();
            }
            else if (msg != "")
            {
                treem();
            }
            else
            {
                PreviewReport();
            }
        }
示例#3
0
        private void taotable()
        {
            if (!kiemtra())
            {
                return;
            }
            i_dongia = d.d_dongia_le(int.Parse(nhom.SelectedValue.ToString()));
            ds.Clear();
            s_loai = ""; s_phieu = "";
            for (int i = 0; i < loai.Items.Count; i++)
            {
                if (loai.GetItemChecked(i))
                {
                    s_loai += dtloai.Rows[i]["id"].ToString().Trim() + ",";
                }
            }
            for (int i = 0; i < phieu.Items.Count; i++)
            {
                if (phieu.GetItemChecked(i))
                {
                    s_phieu += dtphieu.Rows[i]["id"].ToString().Trim() + ",";
                }
            }
            dtdmbd = d.get_data("select * from " + user + ".d_dmbd where nhom=" + int.Parse(nhom.SelectedValue.ToString())).Tables[0];
            string cont = " and a.makp=" + int.Parse(makp.SelectedValue.ToString()) + " and a.nhom=" + int.Parse(nhom.SelectedValue.ToString());

            cont += " and a.ngay between to_date('" + tu.Text + "'," + stime + ") and to_date('" + den.Text + "'," + stime + ")";
            if (s_loai != "")
            {
                cont += " and a.loai in (" + s_loai.Substring(0, s_loai.Length - 1) + ")";
            }
            if (s_phieu != "")
            {
                cont += " and a.phieu in (" + s_phieu.Substring(0, s_phieu.Length - 1) + ")";
            }
            if (imp.Visible)
            {
                if (imp.Checked)
                {
                    cont += " and c.manhom in (31,55)";
                }
                else
                {
                    cont += " and c.manhom not in (31,55)";
                }
            }
            s_makho = ""; s_tenkho = "";
            for (int i = 0; i < makho.Items.Count; i++)
            {
                if (makho.GetItemChecked(i))
                {
                    s_makho  += dtkho.Rows[i]["id"].ToString().Trim() + ",";
                    s_tenkho += dtkho.Rows[i]["ten"].ToString().Trim() + ";";
                }
            }
            if (s_makho == "")
            {
                for (int i = 0; i < makho.Items.Count; i++)
                {
                    s_makho  += dtkho.Rows[i]["id"].ToString().Trim() + ",";
                    s_tenkho += dtkho.Rows[i]["ten"].ToString().Trim() + ";";
                }
            }
            //
            s_manhom = ""; s_tennhom = "";
            for (int i = 0; i < dmnhom.Items.Count; i++)
            {
                if (dmnhom.GetItemChecked(i))
                {
                    s_manhom  += dtdmnhom.Rows[i]["id"].ToString().Trim() + ",";
                    s_tennhom += dtdmnhom.Rows[i]["ten"].ToString().Trim() + ";";
                }
            }
            if (s_manhom == "")
            {
                for (int i = 0; i < dmnhom.Items.Count; i++)
                {
                    s_manhom  += dtdmnhom.Rows[i]["id"].ToString().Trim() + ",";
                    s_tennhom += dtdmnhom.Rows[i]["ten"].ToString().Trim() + ";";
                }
            }
            //
            if (s_makho != "")
            {
                cont += " and b.makho in (" + s_makho.Substring(0, s_makho.Length - 1) + ")";
            }
            if (s_manhom.Trim().Trim(',') != "")
            {
                cont += " and c.manhom in(" + s_manhom.Trim().Trim(',') + ")";
            }
            DateTime dt1 = d.StringToDate(tu.Text).AddDays(-d.iNgaykiemke);
            DateTime dt2 = d.StringToDate(den.Text).AddDays(d.iNgaykiemke);
            int      y1 = dt1.Year, m1 = dt1.Month;
            int      y2 = dt2.Year, m2 = dt2.Month;
            int      itu, iden;
            string   mmyy = "";

            for (int i = y1; i <= y2; i++)
            {
                itu  = (i == y1)?m1:1;
                iden = (i == y2)?m2:12;
                for (int j = itu; j <= iden; j++)
                {
                    mmyy = j.ToString().PadLeft(2, '0') + i.ToString().Substring(2, 2);
                    if (d.bMmyy(mmyy))
                    {
                        get_xuat(mmyy, cont);
                        get_hoantra(mmyy, cont);
                    }
                }
            }
            sort();
        }