使用存储过程向下钻取DevExpress

时间:2013-05-20 07:50:45

标签: c# sql stored-procedures devexpress drilldown

好吧,我正在尝试使用SQL Server中的存储过程创建一个向下钻取的DevExpress报告,但每行的钻取数据都相同,是否有人有解决方案?感谢。

这是存储过程:

BEGIN
SELECT 
a.ID_Sl_Invoice AS [ID_Invoice],
b.Kode AS [Kode_Konsumen],
B.Nama AS [Nama_Konsumen],
A.Nomor AS [Nomor_INJ],
a.Tanggal AS [Tanggal_INJ],
e.Nomor AS [Nomor_SPJ],
a.Harga AS [Nilai_Penagihan],
f.Tanggal AS [Tanggal_SJ],
f.Nomor AS [Nomor_SJ]

FROM Sl_Invoice a 
JOIN Ms_Konsumen b ON A.ID_Ms_Konsumen = B.ID_Ms_Konsumen
JOIN Sl_Invoice_SuratJalan c ON A.ID_Sl_Invoice = C.ID_Sl_Invoice
JOIN Sl_Invoice_SuratPesanan d ON a.ID_Sl_Invoice = d.ID_Sl_Invoice
JOIN Sl_SuratPesanan e ON d.ID_Sl_SuratPesanan = e.ID_Sl_SuratPesanan
JOIN Sl_SuratJalan f ON f.ID_Sl_SuratJalan = c.ID_Sl_SuratJalan 
WHERE 
a.Tanggal >=@tanggalAwal 
AND a.Tanggal <= @tanggalAkhir

END

这是我在报告中的代码

    const string sShowDetail = "Show Detail";
    const string sHideDetail = "Hide Detail";
    public RepInvoicePenj()
    {
        InitializeComponent();
    }

    ArrayList expandedValues = new ArrayList();

    bool ShouldShowDetail(int idInvoice)
    {
        return expandedValues.Contains(idInvoice);
    }

    private void DetailReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
    {            
        e.Cancel = !ShouldShowDetail((int)GetCurrentColumnValue("ID_Invoice"));
    }

    private void xrTableCell6_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
    {
        XRLabel label = (XRLabel)sender;
        if (ShouldShowDetail((int)label.Tag))
        {
            label.Text = sHideDetail;
        }
        else
        {
            label.Text = sShowDetail;
        }
    }

    private void xrTableCell6_PreviewClick(object sender, PreviewMouseEventArgs e)
    {

        int index = (int)e.Brick.Value;

        bool showDetail = ShouldShowDetail(index);

        if (showDetail)
        {
            expandedValues.Remove(index);
        }
        else
        {
            expandedValues.Add(index);
        }

        ViewControl viewcontrol = e.PreviewControl as ViewControl;
        FieldInfo fieldInfo = viewcontrol.GetType().GetField("pc", BindingFlags.NonPublic | BindingFlags.Instance);
        PrintControl printControl = (PrintControl)fieldInfo.GetValue(viewcontrol);
        Page page = printControl.SelectedPage;

        CreateDocument();

        printControl.SelectedPageIndex = page.Index;  //change SelectedPageIndex instead of calling the ShowBrick method.

    }

    private void xrTableCell6_PreviewMouseMove(object sender, PreviewMouseEventArgs e)
    {
        Cursor.Current = Cursors.Hand;
    }

    private void RepInvoicePenj_DataSourceDemanded(object sender, EventArgs e)
    {
          this.sP_InvoicePenjualanTableAdapter1.Fill(repSalesInvoiceDataSet1.SP_InvoicePenjualan,
            Convert.ToDateTime(this.tanggalAwalParam.Value), Convert.ToDateTime(this.tanggalAkhirParam.Value));
    }

结果就像

Row 1 = A
Drilled-down data 1 = A , B , C

Row 2 = B
Drilled-down data 2 = A , B , C

Row 3 = C
Drilled-down data 3 = A , B , C

我需要制作像

这样的结果
Row 1 = A
Drilled-down data = A

Row 2 = B
Drilled-down data = B

Row 3 = C
Drilled-down data = C

由于

0 个答案:

没有答案