Example #1
0
        private void btnXemTruoc_Click(object sender, EventArgs e)
        {
            RptBaoCao rpt = new RptBaoCao();

            this.xtraTabControl1.SelectedTabPageIndex = 10;

            this.fillReport(rpt);
            this.ucReport1.printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument();
        }
Example #2
0
        private void fillReport(RptBaoCao rpt)
        {
            rpt.MaCapNS  = selMaCapNS.EditValue == DBNull.Value ? "" : (selMaCapNS.EditValue as string);
            rpt.MaChuong = selMaChuong.EditValue == DBNull.Value ? "" : (selMaChuong.EditValue as string);
            rpt.MaQHNS   = selMaDVQHNS.EditValue == DBNull.Value ? "" : (selMaDVQHNS.EditValue as string);

            DateTime fromDate;
            DateTime toDate;
            int      nam = (int)selNam.Value;
            string   quy = selQuy.Text;

            if (quy == "1")
            {
                fromDate           = new DateTime(nam, 1, 1);
                toDate             = new DateTime(nam, 3, DateTime.DaysInMonth(nam, 3));
                rpt.lblQuyNam.Text = string.Format("Quý " + selQuy.Text + " / Năm " + nam.ToString());
            }
            else if (quy == "2")
            {
                fromDate           = new DateTime(nam, 4, 1);
                toDate             = new DateTime(nam, 6, DateTime.DaysInMonth(nam, 6));
                rpt.lblQuyNam.Text = string.Format("Quý " + selQuy.Text + " / Năm " + nam.ToString());
            }
            else if (quy == "3")
            {
                fromDate           = new DateTime(nam, 7, 1);
                toDate             = new DateTime(nam, 9, DateTime.DaysInMonth(nam, 9));
                rpt.lblQuyNam.Text = string.Format("Quý " + selQuy.Text + " / Năm " + nam.ToString());
            }
            else if (quy == "4")
            {
                fromDate           = new DateTime(nam, 10, 1);
                toDate             = new DateTime(nam, 12, DateTime.DaysInMonth(nam, 12));
                rpt.lblQuyNam.Text = string.Format("Quý " + selQuy.Text + " / Năm " + nam.ToString());
            }
            else
            {
                fromDate           = new DateTime(nam, 1, 1);
                toDate             = new DateTime(nam, 12, DateTime.DaysInMonth(nam, 12));
                rpt.lblQuyNam.Text = string.Format("Năm " + nam.ToString());
            }

            rpt.FromDate = fromDate;
            rpt.ToDate   = toDate;

            rpt.lblDonVi.Text    = selMaDVQHNS.GetColumnValue("tenquanheNS") as String;
            rpt.lblMaCapNS.Text  = selMaCapNS.EditValue as string;
            rpt.lblMaChuong.Text = selMaChuong.EditValue as string;
            rpt.lblMaDVDHNS.Text = selMaDVQHNS.EditValue as string;
        }
Example #3
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     using (RptBaoCao rpt = new RptBaoCao())
     {
         this.fillReport(rpt);
         this.ucReport1.printControl1.PrintingSystem = rpt.PrintingSystem;
         try
         {
             rpt.Landscape = true;
             rpt.Print();
         }
         catch (Exception ex)
         {
             //MessageBox.Show(ex.Message, "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }