protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                SuratkeluarQuery skQ = new SuratkeluarQuery("a");
                NomorQuery nQ = new NomorQuery("b");
                skQ.Select(nQ.Keterangan, skQ.Nomorid, skQ.Nomor.Count().As("jumlahsurat"));
                skQ.InnerJoin(nQ).On(skQ.Nomorid == nQ.Format);
                skQ.GroupBy(skQ.Nomorid);
                SuratkeluarCollection skC = new SuratkeluarCollection();
                skC.Load(skQ);

                rptChartInboxMonthly rptChart = new rptChartInboxMonthly();
                rptChart.DataSource = skC;

                //foreach (Suratkeluar sk in skC)
                //{
                //    string jumlahSurat = sk.GetColumn("jumlahsurat").ToString();
                //    string keterangan = sk.GetColumn(NomorMetadata.ColumnNames.Keterangan, "kosong").ToString();
                //    double JumlahSurat = 0;
                //    if (!double.TryParse(jumlahSurat, out JumlahSurat))
                //        JumlahSurat = 0;

                //    ChartSeries cs = new ChartSeries();
                //    cs.Name = "Surat Keluar";
                //    cs.Type = ChartSeriesType.Bar;
                //    cs.AddItem(JumlahSurat, sk.Nomorid);

                //}

                Telerik.Reporting.InstanceReportSource inst = new Telerik.Reporting.InstanceReportSource();
                inst.ReportDocument = rptChart;
                this.ReportViewer1.ReportSource = inst;
                this.ReportViewer1.RefreshReport();
                this.ReportViewer1.Update();
            }
        }
        private void rptChartInboxMonthly_NeedDataSource(object sender, EventArgs e)
        {
            //Get Month and Year of all surat masuk
            //SuratkeluarQuery skq = new SuratkeluarQuery();
            //skq.Select(skq.Tanggal);
            //skq.es.Distinct = true;
            SuratkeluarQuery skQ = new SuratkeluarQuery("a");
            NomorQuery nQ = new NomorQuery("b");
            skQ.Select(nQ.Keterangan,skQ.Nomorid, skQ.Nomor.Count().As("jumlahsurat"));
            skQ.InnerJoin(nQ).On(skQ.Nomorid == nQ.Format);
            skQ.GroupBy(skQ.Nomorid);
            SuratkeluarCollection skC = new SuratkeluarCollection();
            skC.Load(skQ);
            if (skC.Count > 0)
            {
                foreach (Suratkeluar sk in skC)
                {
                    try
                    {
                        string jumlahSurat = sk.GetColumn("jumlahsurat").ToString();
                        //string Keterangan = sk.GetColumn(NomorMetadata.ColumnNames.Keterangan).ToString();
                        double JumlahSurat = 0;
                        if (!double.TryParse(jumlahSurat, out JumlahSurat))
                            JumlahSurat = 0;

                        ChartSeries cs = new ChartSeries();
                        cs.Name = "Surat Keluar";
                        cs.Type = ChartSeriesType.Bar;
                        cs.AddItem(JumlahSurat, sk.Nomorid);
                        this.chartSuratMasuk.Series.Add(cs);
                    }
                    catch (Exception ex)
                    { Ext.Net.X.Msg.Alert("error",ex.Message).Show(); }
                }
            }
        }