コード例 #1
0
ファイル: frmDMPhieucd.cs プロジェクト: tayduivn/mdebv
        private void f_print()
        {
            try
            {
                string  sql = "select * from cd_phieucd order by reportname";
                DataSet ds  = m_m.get_data(sql);

                //ds.WriteXml("D:\\DMSo.xml",XmlWriteMode.WriteSchema);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                    crystalReportViewer1.ActiveViewIndex  = -1;
                    crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                    crystalReportViewer1.DisplayGroupTree = false;
                    crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                    crystalReportViewer1.Name             = "crystalReportViewer1";
                    crystalReportViewer1.ReportSource     = null;
                    crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                    crystalReportViewer1.TabIndex         = 85;
                    System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                    af.WindowState = FormWindowState.Maximized;
                    af.Controls.Add(crystalReportViewer1);
                    crystalReportViewer1.BringToFront();
                    crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                    string areport = "", asyt = "", abv = "", angayin = "", anguoiin = "", aghichu = "";
                    areport  = "cd_phieucd.rpt";
                    asyt     = m_m.Syte;
                    abv      = m_m.Tenbv;
                    angayin  = "Ngày " + DateTime.Now.Day.ToString().PadLeft(2, '0') + " tháng " + DateTime.Now.Month.ToString().PadLeft(2, '0') + " năm " + DateTime.Now.Year.ToString();
                    anguoiin = "";
                    aghichu  = "";

                    ReportDocument cMain = new ReportDocument();
                    cMain.Load(@"..\..\..\Report\" + areport, OpenReportMethod.OpenReportByTempCopy);
                    cMain.SetDataSource(ds);
                    cMain.DataDefinition.FormulaFields["v_syt"].Text     = "'" + asyt.ToUpper() + "'";
                    cMain.DataDefinition.FormulaFields["v_bv"].Text      = "'" + abv.ToUpper() + "'";
                    cMain.DataDefinition.FormulaFields["v_ngayin"].Text  = "'" + angayin + "'";
                    cMain.DataDefinition.FormulaFields["v_nguoiin"].Text = "'" + anguoiin + "'";
                    cMain.DataDefinition.FormulaFields["v_ghichu"].Text  = "'" + aghichu + "'";
                    cMain.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
                    cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
                    crystalReportViewer1.ReportSource   = cMain;
                    af.Text = "Danh mục Máy xét nghiệm";
                    af.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Trong Máy xét nghiệm không danh mục", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }
コード例 #2
0
        private void f_In()
        {
            try
            {
                DataSet ads = new DataSet();
                string  sql = "";
                sql = "select a.id, a.stt, a.ma, a.ten, a.id_nhom, b.stt as stt_nhom, b.ten as ten_nhom from medibv.v_loaivp a left join medibv.v_nhomvp b on a.id_nhom=b.ma order by b.stt, b.ten,a.stt,a.ten";
                ads = m_v.get_data(sql);
                //ads.WriteXml("..//..//Datareport//v_loaivp.xml", XmlWriteMode.WriteSchema);
                //return;

                CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                crystalReportViewer1.ActiveViewIndex  = -1;
                crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                crystalReportViewer1.DisplayGroupTree = false;
                crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                crystalReportViewer1.Name             = "crystalReportViewer1";
                crystalReportViewer1.ReportSource     = null;
                crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                crystalReportViewer1.TabIndex         = 85;

                System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                af.WindowState = FormWindowState.Maximized;
                af.Controls.Add(crystalReportViewer1);
                crystalReportViewer1.BringToFront();
                crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                string         areport = "v_2007_loaivp.rpt";
                ReportDocument cMain   = new ReportDocument();
                cMain.Load("..\\..\\..\\report\\" + areport, OpenReportMethod.OpenReportByTempCopy);
                cMain.SetDataSource(ads);
                cMain.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
                cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
                crystalReportViewer1.ReportSource   = cMain;
                af.Text =
                    lan.Change_language_MessageText("Phân loại viện phí (") + areport + ")";
                af.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
ファイル: frmDotKhuyenMai.cs プロジェクト: tayduivn/mdebv
        private void f_In()
        {
            try
            {
                DataSet ads = new DataSet();
                string  sql = "";
                sql = "select ten,to_char(tungay,'dd/mm/yyyy') tungay,to_char(denngay,'dd/mm/yyyy')denngay,tugio,dengio from medibv.v_dot_khuyenmai order by ten";
                ads = m_v.get_data(sql);
                //ads.WriteXml("..//..//Datareport//v_dotkm.xml", XmlWriteMode.WriteSchema);
                //return;

                CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                crystalReportViewer1.ActiveViewIndex  = -1;
                crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                crystalReportViewer1.DisplayGroupTree = false;
                crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                crystalReportViewer1.Name             = "crystalReportViewer1";
                crystalReportViewer1.ReportSource     = null;
                crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                crystalReportViewer1.TabIndex         = 85;

                System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                af.WindowState = FormWindowState.Maximized;
                af.Controls.Add(crystalReportViewer1);
                crystalReportViewer1.BringToFront();
                crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                string         areport = "v_2007_dotkm.rpt";
                ReportDocument cMain   = new ReportDocument();
                cMain.Load("..\\..\\..\\report\\" + areport, OpenReportMethod.OpenReportByTempCopy);
                cMain.SetDataSource(ads);
                cMain.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
                cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
                crystalReportViewer1.ReportSource   = cMain;
                af.Text = lan.Change_language_MessageText("Phân đợt khuyến mãi (") + areport + ")";
                af.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #4
0
        private void tmn_Indanhsach_Click(object sender, EventArgs e)
        {
            CurrencyManager cm      = (CurrencyManager)(BindingContext[dgHoadon.DataSource, dgHoadon.DataMember]);
            DataView        dv      = (DataView)(cm.List);
            string          aReport = "rptDanhsachin38.rpt";

            try
            {
                DataSet ads = new DataSet();

                if (dv.Table.Rows.Count == 0)
                {
                }
                else
                {
                    if (!System.IO.File.Exists("..\\..\\..\\report\\" + aReport))
                    {
                        MessageBox.Show(lan.Change_language_MessageText("Không tìm thấy report ") + aReport + ".");
                        return;
                    }



                    ads.WriteXml("..\\..\\Datareport\\rptDanhsachin38.xml", XmlWriteMode.WriteSchema);

                    CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                    crystalReportViewer1.ActiveViewIndex  = -1;
                    crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                    crystalReportViewer1.DisplayGroupTree = false;
                    crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                    crystalReportViewer1.Name             = "crystalReportViewer1";
                    crystalReportViewer1.ReportSource     = null;
                    crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                    crystalReportViewer1.TabIndex         = 85;

                    System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                    af.WindowState = FormWindowState.Maximized;
                    af.Controls.Add(crystalReportViewer1);
                    crystalReportViewer1.BringToFront();
                    crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                    ReportDocument cMain = new ReportDocument();

                    cMain.Load("..\\..\\..\\report\\" + aReport, OpenReportMethod.OpenReportByTempCopy);
                    cMain.SetDataSource(dv);

                    //cMain.DataDefinition.FormulaFields["c1"].Text = "'" + atenbn + "'";

                    //cMain.DataDefinition.FormulaFields["c2"].Text = "'" + Math.Round(decimal.Parse(asotien == "" ? "0" : asotien)) + "'";
                    //cMain.DataDefinition.FormulaFields["ngayin"].Text = "'ngày " + txtNgaythu.Text.Substring(0, 2) + " tháng " + txtNgaythu.Text.Substring(3, 2) + " năm " + txtNgaythu.Text.Substring(6, 4) + "'";
                    if (tmn_Xemtruockhiin.Checked)
                    {
                        //cMain.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA5;
                        //cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                        crystalReportViewer1.ReportSource = cMain;
                        af.Text = "Danh sách bệnh nhân in mẫu 01  ";
                        af.Text = af.Text + " (" + aReport + ")";
                        af.ShowDialog();
                    }
                    else
                    {
                        cMain.PrintToPrinter(1, false, 0, 0);
                    }
                }
            }
            catch { }
        }
コード例 #5
0
        private void butIN_Click(object sender, EventArgs e)
        {
            v_user = "";

            for (int i = 0; i < user_thu.Items.Count; i++)
            {
                if (user_thu.GetItemChecked(i))
                {
                    v_user += dt_user.Rows[i]["ID"].ToString() + ",";
                }
            }
            v_user = v_user.Trim(',');

            sql  = " select  c.hoten,d.sohieu,mavp,a.sobienlai,a.tamung,case when mavp in (select id from medibv.d_dmbd ) then sum(b.sotien) else 0 end thuoc,";
            sql += " case when mavp in (select id from medibv.v_giavp ) then sum(b.sotien) else 0 end vienphi ";
            sql += " from medibvmmyy.v_ttrvll a  inner join medibvmmyy.v_ttrvct b  on (a.id=b.id) inner join medibv.v_dlogin c on a.userid=c.id ";
            sql += " inner join medibv.v_quyenso d on a.quyenso=d.id";
            sql += "  where to_date(to_char(a.ngay,'dd/mm/yyyy'),'dd/mm/yyyy') between to_date('" + ngay.Text.Substring(0, 10) + "','dd/mm/yyyy') and to_date('" + den.Text.Substring(0, 10) + "','dd/mm/yyyy')";
            if (v_user != "")
            {
                sql += " and a.userid in(" + v_user + ")";
            }
            sql += " group by c.hoten,d.sohieu,mavp,a.sobienlai,a.tamung order by a.sobienlai";

            try
            {
                ds = a.get_data_mmyy(sql, ngay.Text, den.Text, true);
                if (ds == null || ds.Tables[0].Rows.Count < 0)
                {
                    MessageBox.Show(this,
                                    lan.Change_language_MessageText("Không có dữ liệu báo cáo"), a.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                ds.WriteXml("..//..//Datareport//v_BCDoanhthutonghop.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                crystalReportViewer1.ActiveViewIndex  = -1;
                crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                crystalReportViewer1.DisplayGroupTree = false;
                crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                crystalReportViewer1.Name             = "crystalReportViewer1";
                crystalReportViewer1.ReportSource     = null;
                crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                crystalReportViewer1.TabIndex         = 85;

                System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                af.WindowState = FormWindowState.Maximized;
                af.Controls.Add(crystalReportViewer1);
                crystalReportViewer1.BringToFront();
                crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                string areport = "v_BCDoanhthutonghop.rpt", asyt = "", abv = "", angayin = "";
                areport = "v_BCDoanhthutonghop.rpt";
                asyt    = a.Syte;
                abv     = a.Tenbv;
                if (ngay.Value == den.Value)
                {
                    angayin = "Ngày " + ngay.Text;
                }
                else
                {
                    angayin = "Từ Ngày " + ngay.Text + " Đến Ngày " + den.Text;
                }

                ReportDocument cMain = new ReportDocument();

                cMain.Load("..\\..\\..\\report\\" + areport, OpenReportMethod.OpenReportByTempCopy);
                cMain.SetDataSource(ds);

                cMain.DataDefinition.FormulaFields["v_syt"].Text    = "'" + asyt.ToUpper() + "'";
                cMain.DataDefinition.FormulaFields["v_bv"].Text     = "'" + abv.ToUpper() + "'";
                cMain.DataDefinition.FormulaFields["v_ngayin"].Text = "'" + angayin + "'";
                cMain.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
                cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                crystalReportViewer1.ReportSource   = cMain;
                af.Text = "Báo cáo doanh thu tổng hợp";
                af.Text = af.Text + " (" + areport + ")";
                af.ShowDialog();
            }
            catch { }
        }
コード例 #6
0
        private void f_ketxuat(bool v_print)
        {
            string sql = "", aReport = "", aexp = "", atenbv = "", adiachibv = "", asyt = "", ngay = "";

            aexp = " where a.ngayhd between to_date('" + dttungay.Text.Substring(0, 10) +
                   "','dd/mm/yyyy') and to_date('" + dtdenngay.Text.Substring(0, 10) + "','dd/mm/yyyy') ";
            if (chkDaduyetin.Checked)
            {
                aexp += " and a.done=1 ";
            }
            else
            {
                aexp += " and a.done=0 ";
            }
            if (cbdoituong.SelectedIndex == 0)
            {
                aexp   += " and a.bhyt = 0 ";
                aReport = "v_BKhoadontaichinh_dv.rpt";
            }
            else
            {
                aexp   += " and a.bhyt > 0 ";
                aReport = "v_BKhoadontaichinh_bh.rpt";
            }
            DataSet ads = new DataSet();

            sql  = "select a.id,e.hoten,to_char(a.ngayhd,'dd/mm/yyyy') as ngayhd,to_char(a.ngayhen,'dd/mm/yyyy') as ngayhen,a.tendv as congty,a.diachi as dccongty,a.masothue,a.noidung as ghichu,max(c.vat) as vat, ";
            sql += "sum(case when d.ma <> 15 and d.ma <> 4 and b.madoituong <>1 then b.sotien-b.mien else to_number('0')  end) as bntracls,";
            sql += "sum(case when d.ma <> 15 and d.ma <> 4 and b.madoituong = 1 then b.sotien-b.bhyt else to_number('0') end) as bndongtracls,";
            sql += "sum(case when d.ma = 15 and b.madoituong <> 1 then b.sotien-b.mien-b.bhyt else to_number('0') end) as bntrathuoc,";
            sql += "sum(case when d.ma = 15 and b.madoituong = 1 then b.sotien-b.bhyt-b.mien else to_number('0') end) as bndongtrathuoc,";
            sql += "sum(case when d.ma=4 then b.sotien-b.bhyt-b.mien else to_number('0') end) as congkham ";
            sql += "from medibvmmyy.v_bienlaitaichinhll a inner join medibvmmyy.v_bienlaitaichinhct b ";
            sql += "on a.id=b.id inner join (select id,ten as tenvp,vat,id_loai from medibv.v_giavp union all ";
            sql += "select id,ten as tenvp,vat,to_number('87') as loai from medibv.d_dmbd) c on b.mavp=c.id ";
            sql += "inner join medibv.v_loaivp dd on dd.id=c.id_loai inner join medibv.v_nhomvp d on dd.id_nhom=d.ma ";
            sql += "inner join medibv.btdbn e on a.mabn=e.mabn " + aexp;
            sql += "group by a.id,e.hoten,a.ngayhd,a.ngayhen,a.tendv,a.diachi,a.masothue,a.noidung";

            try
            {
                DateTime tungay  = Convert.ToDateTime(dttungay.Value);
                DateTime denngay = Convert.ToDateTime(dtdenngay.Value);
                ngay = "Từ ngày " + tungay.Day.ToString().PadLeft(2, '0') + "/" + tungay.Month.ToString().PadLeft(2, '0')
                       + "/" + tungay.Year + " đến ngày " + denngay.Day.ToString().PadLeft(2, '0') + "/" + denngay.Month.ToString().PadLeft(2, '0') + "/" + denngay.Year;
                ads = m_v.get_data_bc(tungay, denngay, sql);
                if (ads.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Không có số liệu. "));
                    return;
                }
                else
                {
                    if (!System.IO.File.Exists("..\\..\\..\\report\\" + aReport))
                    {
                        MessageBox.Show(lan.Change_language_MessageText("Không tìm thấy report )") + aReport + ".");
                        return;
                    }

                    atenbv    = m_v.Tenbv;
                    adiachibv = m_v.sys_diachi;
                    asyt      = m_v.Syte;

                    ads.WriteXml("..\\..\\Datareport\\" + aReport.Substring(0, aReport.Length - 3) + "xml", XmlWriteMode.WriteSchema);

                    CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                    crystalReportViewer1.ActiveViewIndex  = -1;
                    crystalReportViewer1.BackColor        = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239)));
                    crystalReportViewer1.DisplayGroupTree = false;
                    crystalReportViewer1.Dock             = System.Windows.Forms.DockStyle.Fill;
                    crystalReportViewer1.Name             = "crystalReportViewer1";
                    crystalReportViewer1.ReportSource     = null;
                    crystalReportViewer1.Size             = new System.Drawing.Size(792, 573);
                    crystalReportViewer1.TabIndex         = 85;

                    System.Windows.Forms.Form af = new System.Windows.Forms.Form();
                    af.WindowState = FormWindowState.Maximized;
                    af.Controls.Add(crystalReportViewer1);
                    crystalReportViewer1.BringToFront();
                    crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

                    ReportDocument cMain = new ReportDocument();

                    cMain.Load("..\\..\\..\\report\\" + aReport, OpenReportMethod.OpenReportByTempCopy);
                    cMain.SetDataSource(ads);

                    cMain.DataDefinition.FormulaFields["v_syt"].Text      = "'" + atenbv + "'";
                    cMain.DataDefinition.FormulaFields["v_bv"].Text       = "'" + atenbv + "'";
                    cMain.DataDefinition.FormulaFields["v_diachibv"].Text = adiachibv;
                    cMain.DataDefinition.FormulaFields["v_ngay"].Text     = "'" + ngay + "'";
                    if (!v_print)
                    {
                        //cMain.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA5;
                        //cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                        crystalReportViewer1.ReportSource = cMain;
                        af.Text = lan.Change_language_MessageText("Bảng kê xuất hóa đơn tài chính ");
                        af.Text = af.Text + " (" + aReport + ")";
                        af.ShowDialog();
                    }
                    else
                    {
                        cMain.PrintToPrinter(1, false, 0, 0);
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(lan.Change_language_MessageText(ex.ToString())); }
        }