Exemplo n.º 1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            TheoDoiHHDV hhdvReport = new TheoDoiHHDV();

            hhdvReport.SetDataSource(eMSDBDataSet);
            hhdvReport.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
            hhdvReport.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
            hhdvReport.PrintToPrinter(1, false, 1, 1);
            hhdvReport.Dispose();
        }
Exemplo n.º 2
0
 private void xemBaoCaoForm_Load(object sender, EventArgs e)
 {
     if (reportType == "monthly")
     {
         this.Text = "EMS - Báo Cáo Điện " + monthlyReportType + " Tháng " + thang.ToString() + ", Năm " + nam.ToString() + ", Trạm Số " + soTram;
         if (monthlyReportType == "Sinh Hoạt")
         {
             shReport = new MonthlyReport_SH();
             shReport.SetDataSource(DataTier.fillMonthlyReport(tramID, thang, nam, 1));
             string[] giaSH = DataTier.getPrice("e00f133e-f43c-4dc5-8ebb-a747200416c9").Split(',');
             shReport.SetParameterValue("giaDienMuc1", giaSH[0]);
             shReport.SetParameterValue("giaDienMuc2", giaSH[1]);
             shReport.SetParameterValue("giaDienMuc3", giaSH[2]);
             shReport.SetParameterValue("giaDienMuc4", giaSH[3]);
             shReport.SetParameterValue("giaDienMuc5", giaSH[4]);
             shReport.SetParameterValue("giaDienMuc6", giaSH[5]);
             shReport.SetParameterValue("soTram", soTram);
             shReport.SetParameterValue("ngayBatDau", DataTier.getDuration(tramID));
             shReport.SetParameterValue("ngayKetThuc", DataTier.getDuration(tramID));
             if (thang == 1)
             {
                 shReport.SetParameterValue("thangBatDau", "12");
                 shReport.SetParameterValue("namBatDau", (nam - 1).ToString());
             }
             else
             {
                 shReport.SetParameterValue("thangBatDau", (thang - 1).ToString());
                 shReport.SetParameterValue("namBatDau", nam.ToString());
             }
             shReport.SetParameterValue("thangKetThuc", thang.ToString());
             shReport.SetParameterValue("namKetThuc", nam.ToString());
             shReport.SetParameterValue("ngayKy", DataTier.getReportDate(tramID));
             shReport.SetParameterValue("thangKy", thang.ToString());
             shReport.SetParameterValue("namKy", nam.ToString());
             double tongTien = DataTier.getTongTienPhatSinh(tramID, thang, nam, "1") + DataTier.getTongNo(tramID, thang, nam, "1");
             shReport.SetParameterValue("moneyReader", Program.moneyReader(System.Math.Round(tongTien).ToString()));
             crvReport.ReportSource = shReport;
         }
         else if (monthlyReportType == "Mục Đích Khác")
         {
             mdkReport = new MonthlyReport_MDK();
             mdkReport.SetDataSource(DataTier.fillMonthlyReport(tramID, thang, nam, 0));
             mdkReport.SetParameterValue("giaHC", DataTier.getPrice("068b5479-814c-4576-86ea-8684b07ffb4a"));
             mdkReport.SetParameterValue("giaKD1", DataTier.getPrice("0cd8fc10-1369-4b21-9c59-806ada969bdb"));
             mdkReport.SetParameterValue("giaKD2", DataTier.getPrice("3f4627cb-3ae3-4fcf-86e1-117b1dfcac4d"));
             mdkReport.SetParameterValue("giaSX1", DataTier.getPrice("a8794644-b056-41dd-b515-bec60477947a"));
             mdkReport.SetParameterValue("giaSX2", DataTier.getPrice("d4770373-51bb-4d7a-90d1-327c7043cdeb"));
             mdkReport.SetParameterValue("gia30SX3", DataTier.getPrice("0cd8fc10-1369-4b21-9c59-806ada969bdb"));
             mdkReport.SetParameterValue("gia70SX3", DataTier.getPrice("422cf080-b750-411d-a895-9550b8950b66"));
             mdkReport.SetParameterValue("soTram", soTram);
             mdkReport.SetParameterValue("ngayBatDau", DataTier.getDuration(tramID));
             mdkReport.SetParameterValue("ngayKetThuc", DataTier.getDuration(tramID));
             if (thang == 1)
             {
                 mdkReport.SetParameterValue("thangBatDau", "12");
                 mdkReport.SetParameterValue("namBatDau", (nam - 1).ToString());
             }
             else
             {
                 mdkReport.SetParameterValue("thangBatDau", (thang - 1).ToString());
                 mdkReport.SetParameterValue("namBatDau", nam.ToString());
             }
             mdkReport.SetParameterValue("thangKetThuc", thang.ToString());
             mdkReport.SetParameterValue("namKetThuc", nam.ToString());
             mdkReport.SetParameterValue("ngayKy", DataTier.getReportDate(tramID));
             mdkReport.SetParameterValue("thangKy", thang.ToString());
             mdkReport.SetParameterValue("namKy", nam.ToString());
             double tongTien = DataTier.getTongTienPhatSinh(tramID, thang, nam, "0") + DataTier.getTongNo(tramID, thang, nam, "0");
             mdkReport.SetParameterValue("moneyReader", Program.moneyReader(System.Math.Round(tongTien).ToString()));
             crvReport.ReportSource = mdkReport;
         }
     }
     else if (reportType == "tongHop")
     {
         this.Text = "EMS - Báo Cáo Tổng Hợp Tháng " + thang.ToString() + ", Năm " + nam.ToString() + ", Trạm Số " + soTram;
         bcth      = new TotalReport();
         bcth.SetParameterValue("thang", thang.ToString());
         bcth.SetParameterValue("nam", nam.ToString());
         bcth.SetParameterValue("ngayKy", DataTier.getReportDate(tramID));
         bcth.SetParameterValue("soTram", "Số " + soTram);
         bcth.SetParameterValue("tongHoSH", soHoSH);
         bcth.SetParameterValue("tongHoMDK", soHoMDK);
         bcth.SetParameterValue("tongDienNhan", tongDienNhan);
         bcth.SetParameterValue("dienSH", tongNhanSH);
         bcth.SetParameterValue("dienMDK", tongNhanMDK);
         bcth.SetParameterValue("tongThanhToan", tongTienThanhToan);
         int tongDienThu = DataTier.getTongDienByMD(tramID, thang, nam, "all");
         bcth.SetParameterValue("tongDienThu", tongDienThu);
         bcth.SetParameterValue("dienThuSH", DataTier.getTongDienByMD(tramID, thang, nam, "e00f133e-f43c-4dc5-8ebb-a747200416c9"));
         bcth.SetParameterValue("dienThuMDK", DataTier.getTongDienByMD(tramID, thang, nam, "0"));
         double tyLeTonThat = tongDienNhan - tongDienThu;
         tyLeTonThat = tyLeTonThat / tongDienNhan;
         tyLeTonThat = tyLeTonThat * 100;
         bcth.SetParameterValue("tyLeTonThat", tyLeTonThat.ToString("N2") + "%");
         bcth.SetParameterValue("tienPhatSinh", DataTier.getTongTienPhatSinh(tramID, thang, nam, "all"));
         bcth.SetParameterValue("tienNoCu", DataTier.getTongNo(tramID, thang, nam, "all"));
         crvReport.ReportSource = bcth;
     }
     else if (reportType == "thuChi")
     {
         this.Text = "EMS - Báo Cáo Thu Chi";
     }
     else if (reportType == "theoDoiChuyenTien")
     {
         this.Text  = "EMS - Bảng Theo Dõi Chuyển Tiền";
         tdctReport = new TheoDoiChuyenTien();
         tdctReport.SetDataSource(this.DataSource);
         crvReport.ReportSource = tdctReport;
     }
     else if (reportType == "theoDoiHHDV")
     {
         this.Text  = "EMS - Bảng Theo Dõi Hàng Hóa Dịch Vụ";
         hhdvReport = new TheoDoiHHDV();
         hhdvReport.SetDataSource(this.DataSource);
         crvReport.ReportSource = hhdvReport;
     }
     else if (reportType == "theoDoiGTGT")
     {
         this.Text  = "EMS - Bảng Theo Dõi Thuế GTGT";
         gtgtReport = new TheoDoiGTGT();
         gtgtReport.SetDataSource(this.DataSource);
         crvReport.ReportSource = gtgtReport;
     }
     else if (reportType == "nhatKyChung")
     {
         this.Text         = "EMS - Sổ Nhật Ký Chung";
         nhatKyChungReport = new NhatKyChung();
         nhatKyChungReport.SetDataSource(this.DataSource);
         crvReport.ReportSource = nhatKyChungReport;
     }
 }