protected void btnPrint_Click(object sender, EventArgs e)
    {
        string msg = string.Empty;

        try
        {
            dsRptBeatWiseCanalDetailTableAdapters.RptBeatWiseCanalDetailTableAdapter ds = new dsRptBeatWiseCanalDetailTableAdapters.RptBeatWiseCanalDetailTableAdapter();
            Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("dsRptBeatWiseCanalDetail", (DataTable)ds.GetData(Convert.ToInt64(ddlSubDiv.SelectedValue), Convert.ToInt64(ddlDivision.SelectedValue)));
            ReportViewer viewer = new ReportViewer();
            viewer.ProcessingMode         = ProcessingMode.Local;
            viewer.LocalReport.ReportPath = Server.MapPath("Reports/rptBeatWiseCanalDetail.rdlc");
            viewer.LocalReport.DataSources.Add(rds);
            Warning[] warnings;
            string[]  streamids;
            string    mimeType;
            string    encoding;
            string    extension;
            byte[]    bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
            using (System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("Reports/BeatWiseCanalDetail.pdf"), System.IO.FileMode.Create))
            {
                fs.Write(bytes, 0, bytes.Length);
            }
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "newWindow", "window.open('Reports/BeatWiseCanalDetail.pdf','_blank','status=1,toolbar=0,menubar=0,location=1,scrollbars=1,resizable=1,width=800,height=600');", true);
        }
        catch (Exception ex)
        {
            Global.ErrorInsert(ex.Message, formname, "btnPrint_Click");
            msg = "Error" + ex.Message;
        }
    }
Beispiel #2
0
        private void RenderPerformanceReport(DateTime startdt, DateTime endingdt)
        {
            try
            {
                ReportViewerDisplay.Reset();

                SqlConnection con = HomeController.GetConnection();
                con.Open();

                string sqlQuery = "sp_EDW_User_Reports";

                System.Data.DataTable dt = new System.Data.DataTable();
                SqlDataAdapter        da = new SqlDataAdapter(sqlQuery, con);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                da.SelectCommand.Parameters.AddWithValue("@StartDate", startdt);
                da.SelectCommand.Parameters.AddWithValue("@EndDate", endingdt);
                da.Fill(dt);

                ReportViewerDisplay.LocalReport.DataSources.Clear();

                Microsoft.Reporting.WebForms.ReportDataSource rpdc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSetEDWReporting", dt);

                ReportViewerDisplay.LocalReport.DataSources.Add(rpdc);

                ReportViewerDisplay.LocalReport.EnableExternalImages = true;
                ReportViewerDisplay.LocalReport.ReportPath           = Server.MapPath("~/Reports/ReportEdwWorkersProductivity.rdlc");
                ReportViewerDisplay.LocalReport.Refresh();
            }
            catch (Exception)
            {
            }
        }
        public Byte[] GetReport(string ReportFile,string DataSourceName,object DataSource,
            List<KeyValuePair<string, string>> ReportParameters=null,bool LoadCompanyParameters=false)
        {
            ReportDataSource reportDataSource = new Microsoft.Reporting.WebForms.ReportDataSource();
            reportDataSource.Name = DataSourceName;
            reportDataSource.Value = DataSource;

            List<ReportParameter> reportList = new List<ReportParameter>();

            if (LoadCompanyParameters)
            {
                List<KeyValuePair<string, string>> companyParameters = GetCompanyReportInfo();
                foreach (var param in companyParameters)
                {
                    ReportParameter reportParam = new ReportParameter(param.Key, param.Value);
                    reportList.Add(reportParam);
                }
            }

            if (ReportParameters != null && ReportParameters.Count > 0)
            {
                foreach (var param in ReportParameters)
                {
                    ReportParameter reportParam = new ReportParameter(param.Key, param.Value);
                    reportList.Add(reportParam);
                }
            }
            ReportParameter[] reportParameters = reportList.ToArray();
            Byte[] bytes = PDFReport.InitialReport(ReportFile, reportDataSource, reportParameters);
            return bytes;
        }
Beispiel #4
0
        public WebForms.ReportViewer ReportViewer()
        {
            FileInfo reportFullPath = this.ReportFile;

            //check to make sure the file ACTUALLY exists, before we start working on it
            if (reportFullPath != null)
            {
                //map the reporting engine to the .rdl/.rdlc file
                LoadReportDefinitionFile(CurrentReportViewer.LocalReport, reportFullPath);

                //  1. Clear Report Data
                CurrentReportViewer.LocalReport.DataSources.Clear();

                //  2. Load new data
                // Look-up the DB query in the "DataSets" element of the report file (.rdl/.rdlc which contains XML)
                RDL.Report reportDef = this.ReportDefinition;

                //Load any other report parameters (which are not part of the DB query).
                //If any of the parameters are required, make sure they were provided, or show an error message.  Note: SSRS cannot render the report if required parameters are missing
                CheckReportParameters(CurrentReportViewer.LocalReport);

                if (!ErrorMessages.Any())
                {
                    // Run each query (usually, there is only one) and attach each to the report
                    foreach (RDL.DataSet ds in reportDef.GetDataSetsInReportSections())
                    {
                        WebForms.ReportDataSource rds = GetReportDataSource(reportDef, ds);
                        CurrentReportViewer.LocalReport.DataSources.Add(rds);
                    }
                }

                CurrentReportViewer.LocalReport.Refresh();
            }
            return(CurrentReportViewer);
        }
Beispiel #5
0
        protected void lbView_Click(object sender, EventArgs e)
        {
            if (ddlArea.SelectedIndex > 0)
            {
                this.rvWorkSchedule.ProcessingMode = ProcessingMode.Local;

                ISSA.Pages.Reports.DataSet1 DS_Report = new ISSA.Pages.Reports.DataSet1();
                DS_Report.EnforceConstraints = false;

                ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter Rpt_TableAdapter = new ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter();
                Rpt_TableAdapter.Fill(DS_Report.TA_RPT_WorkSchedule, ddlYear.SelectedValue, ddlMonth.SelectedValue, Convert.ToByte(ddlArea.SelectedValue), ddlShift.SelectedValue);

                if (DS_Report.TA_RPT_WorkSchedule.Rows.Count > 0)
                {
                    ISSA.Pages.Reports.DataSet1.dtParametersDataTable dtParam = new ISSA.Pages.Reports.DataSet1.dtParametersDataTable();

                    DataRow dr = dtParam.NewRow();
                    dr["ParamOne"] = ddlMonth.SelectedItem.Text + ", " + ddlYear.SelectedValue;
                    dr["ParamTwo"] = ddlArea.SelectedItem.Text;
                    if (ddlShift.SelectedIndex == 0)
                    {
                        dr["ParamThree"] = "All";
                    }
                    else
                    {
                        dr["ParamThree"] = ddlShift.SelectedItem.Text;
                    }
                    dr["User"] = MISC.getUserName().ToUpper();;
                    dr["Date"] = DateTime.Now;
                    dtParam.Rows.Add(dr);

                    Microsoft.Reporting.WebForms.ReportDataSource RpDs1          = new Microsoft.Reporting.WebForms.ReportDataSource();
                    Microsoft.Reporting.WebForms.ReportDataSource RpDsParameters = new Microsoft.Reporting.WebForms.ReportDataSource();

                    RpDs1.Name           = "TA_RPT_WorkSchedule";
                    RpDs1.Value          = DS_Report.TA_RPT_WorkSchedule;
                    RpDsParameters.Name  = "dtParameters";
                    RpDsParameters.Value = dtParam;

                    rvWorkSchedule.LocalReport.ReportPath = "Pages/Reports/rpt_WorkSchedule.rdlc";
                    rvWorkSchedule.LocalReport.DataSources.Clear();
                    rvWorkSchedule.LocalReport.DataSources.Add(RpDs1);
                    rvWorkSchedule.LocalReport.DataSources.Add(RpDsParameters);
                    rvWorkSchedule.LocalReport.Refresh();
                    rvWorkSchedule.Visible        = true;
                    rvWorkSchedule.ShowReportBody = true;
                    mpeViewWorkSchedule.Show();
                }
                else
                {
                    ShowMessage("No record found for selected parameters. Schedule may not have been created.", MessageType.Info);
                    mpeViewWorkSchedule.Hide();
                }
            }
            else
            {
                ShowMessage("Area is required", MessageType.Warning);
                //mpeViewWorkSchedule.Hide();
            }
        }
Beispiel #6
0
    protected void RunUndefinedDest()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString());

        conn.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandText = "uspUndefinedDestinations";
        cmd.CommandType = CommandType.StoredProcedure;

        SqlDataReader dr = cmd.ExecuteReader();

        dsUndefinedDest dsDetail = new dsUndefinedDest();

        while (dr.Read())
        {
            dsDetail.Tables[0].Rows.Add(System.Convert.ToDateTime(dr[0].ToString()), dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), dr[6].ToString());
        }

        dr.Close();

        this.rptViewer.LocalReport.DataSources.Clear();
        this.rptViewer.Reset();

        Microsoft.Reporting.WebForms.ReportDataSource rdInvDetail = new Microsoft.Reporting.WebForms.ReportDataSource("dsUndefinedDest", dsDetail.Tables[0]);
        this.rptViewer.LocalReport.DataSources.Add(rdInvDetail);

        this.rptViewer.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        this.rptViewer.LocalReport.ReportPath = @"Reports\UndefinedDestinations2.rdlc";

        this.rptViewer.LocalReport.Refresh();
    }
Beispiel #7
0
        protected void DownloadIndent(int id, string type)
        {
            Warning[] warnings;
            string[]  streamids;
            string    mimeType;
            string    encoding;
            string    filenameExtension;

            //here
            //set report
            //set report datasurce
            IndentReportService _IndentReportService = new IndentReportService();
            List <Services.Models.IndentReportDataSet> dataSource = _IndentReportService.GetIndentDetailById(id);

            if (dataSource.Count > 0)
            {
                //foreach (var ds in dataSource)
                //{
                //    if (ds.PlantId == null)
                //    {
                //        ds.PlantName = "General";
                //    }
                //}

                rvSiteMapping.Visible = false;
                pnlNoData.Visible     = false;
                byte[] bytes = null;
                if (type == "PR")
                {
                    String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportsFolder"].ToString();
                    rvSiteMapping.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

                    Microsoft.Reporting.WebForms.ReportDataSource datasrc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource);
                    datasrc.Name = "DataSet1";
                    //datasrc.DataSourceId=
                    rvSiteMapping.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource));

                    bytes = rvSiteMapping.LocalReport.Render(
                        "PDF", null, out mimeType, out encoding, out filenameExtension,
                        out streamids, out warnings);
                }
                else
                {
                    String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportsFolder"].ToString();
                    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

                    Microsoft.Reporting.WebForms.ReportDataSource datasrc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource);
                    datasrc.Name = "DataSet1";
                    //datasrc.DataSourceId=
                    ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource));

                    bytes = ReportViewer1.LocalReport.Render(
                        "PDF", null, out mimeType, out encoding, out filenameExtension,
                        out streamids, out warnings);
                }
                DownloadFile(bytes, string.Format("{0}.pdf", dataSource[0].IndentNo.Replace("/", "-")));
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string htqdRqStart = string.Empty;
            string htqdRqEnd   = string.Empty;
            string ssdq        = string.Empty;
            string htlb        = string.Empty;

            try
            {
                htqdRqStart = Request.QueryString["htqdRqStart"].ToString();
                htqdRqEnd   = Request.QueryString["htqdRqEnd"].ToString();
                ssdq        = Request.QueryString["ssdq"].ToString();
                htlb        = Request.QueryString["ContractTypeNum"].ToString();
            }
            catch
            {
            }
            if (!IsPostBack)
            {
                //Response.Write("<script type='text/javascript'>window.close();</script>");
                DataTable dt = RetrieveTjfx_Htba_Report(htqdRqStart, htqdRqEnd, ssdq, htlb);
                Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
                rds.Name  = "DataSet1";
                rds.Value = dt;
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.DataSources.Add(rds);
                this.ReportViewer1.Visible = true;

                this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("./Report1.rdlc");
                this.ReportViewer1.LocalReport.Refresh();

                Warning[] warnings;
                string[]  streamids;
                string    mimeType;
                string    encoding;
                string    extension;
                string    fileName = Guid.NewGuid().ToString();
                byte[]    bytes    = ReportViewer1.LocalReport.Render(
                    "PDF", null, out mimeType, out encoding, out extension,
                    out streamids, out warnings);
                string fileSaveName, fileSaveUrl;
                fileSaveName = DateTime.Now.ToString("yyyyMMddHHmmss") + "." + extension;
                fileSaveUrl  = "./AllFiles/" + fileSaveName;
                fileSaveUrl  = Server.MapPath(fileSaveUrl);
                FileStream   fs = new FileStream(fileSaveUrl, FileMode.Create);
                BinaryWriter bw = new BinaryWriter(fs);
                bw.Write(bytes);
                bw.Close();
                fs.Close();
                Response.Write("<script type='text/javascript'> window.open('./AllFiles/" + fileSaveName + "') ;</script>");
                Response.Write("<script type='text/javascript'>window.close();</script>");
            }
        }
Beispiel #9
0
    protected void RunOriginSummary()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString());

        conn.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandText = "uspRptSummaryByOrigin";
        cmd.CommandType = CommandType.StoredProcedure;

        if (Session["profilename"].ToString() == "Client")
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", Session["ClientId"].ToString()));
        }
        else
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", this.lstClient.SelectedValue.ToString()));
        }
        SqlDataReader dr = cmd.ExecuteReader();

        dsInvoiceSummary dsSummary = new dsInvoiceSummary();

        while (dr.Read())
        {
            //dsSummary.Tables[0].Rows.Add(dr[0].ToString(), System.Convert.ToDouble(dr[1].ToString()));
            dsSummary.Tables[0].Rows.Add(dr[0].ToString(), dr[1].ToString(), System.Convert.ToDouble(dr[2].ToString()), dr[3].ToString());
        }

        this.rptViewer.LocalReport.DataSources.Clear();
        this.rptViewer.Reset();

        Microsoft.Reporting.WebForms.ReportDataSource rdInvSummary = new Microsoft.Reporting.WebForms.ReportDataSource("dsInvoiceSummary", dsSummary.Tables[0]);
        this.rptViewer.LocalReport.DataSources.Add(rdInvSummary);

        this.rptViewer.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        this.rptViewer.LocalReport.ReportPath = @"Reports\StatementSummaryBySrc.rdlc";

        Microsoft.Reporting.WebForms.ReportParameter ClientDescription = null;
        if (Session["profilename"].ToString() == "Client")
        {
            ClientDescription = new Microsoft.Reporting.WebForms.ReportParameter("ClientDescription", Session["ClientDesc"].ToString());
        }
        else
        {
            ClientDescription = new Microsoft.Reporting.WebForms.ReportParameter("ClientDescription", this.lstClient.SelectedItem.ToString());
        }
        this.rptViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { ClientDescription });

        this.rptViewer.LocalReport.EnableHyperlinks = true;
        this.rptViewer.LocalReport.Refresh();
    }
Beispiel #10
0
        private void renderMachinesListReport()
        {
            DashboardData reportData        = new DashboardData();
            var           data              = reportData.GetMachinesList();
            var           reportDataSource1 = new Microsoft.Reporting.WebForms.ReportDataSource();

            reportDataSource1.Name  = "dsMachinesList";
            reportDataSource1.Value = data;
            this.ReportViewer1.LocalReport.DataSources.Add(reportDataSource1);
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/Rdlc/MachinesList.rdlc");
            ReportViewer1.ShowPrintButton        = true;
            ReportViewer1.ZoomMode = ZoomMode.PageWidth;
        }
Beispiel #11
0
    protected void rptViewer_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString());

        conn.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandText = "uspRptDetailByOrigin";
        cmd.CommandType = CommandType.StoredProcedure;
        if (Session["profilename"].ToString() == "Client")
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", Session["ClientId"].ToString()));
        }
        else
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", this.lstClient.SelectedValue.ToString()));
        }

        Microsoft.Reporting.WebForms.ReportParameterInfoCollection DrillThroughValues = e.Report.GetParameters();

        cmd.Parameters.Add(new SqlParameter("@Src", DrillThroughValues[0].Values[0]));
        SqlDataReader dr = cmd.ExecuteReader();

        dsInvoiceDetail ds = new dsInvoiceDetail();

        while (dr.Read())
        {
            ds.Tables[0].Rows.Add(dr[0].ToString(), System.Convert.ToDateTime(dr[1].ToString()), dr[2].ToString(), dr[3].ToString(), System.Convert.ToInt32(dr[4].ToString()), System.Convert.ToDouble(dr[5].ToString()));
        }

        dr.Close();
        conn.Close();
        conn.Dispose();

        this.rptViewer.LocalReport.DataSources.Clear();
        this.rptViewer.Reset();

        LocalReport drillThroughReport = (LocalReport)e.Report;

        Microsoft.Reporting.WebForms.ReportDataSource rdInvDetail = new Microsoft.Reporting.WebForms.ReportDataSource("dsInvoiceDetailwhatever", ds.Tables[0]);
        drillThroughReport.DataSources.Add(rdInvDetail);

        this.rptViewer.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        this.rptViewer.LocalReport.ReportPath = @"Reports\StatementDetailBySrc.rdlc";

        Microsoft.Reporting.WebForms.ReportParameter Origin = new Microsoft.Reporting.WebForms.ReportParameter("Origin", DrillThroughValues[0].Values[0]);
        this.rptViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { Origin });

        this.rptViewer.LocalReport.Refresh();
    }
Beispiel #12
0
        protected void RenderReport()
        {
            try
            {
                DataCommandService dataCommandDB = DataCommandService.GetInstance();
                PageDB             pageDB        = new PageDB();

                viewer.Reset();

                LoadReportDefinition(viewer.LocalReport);
                viewer.LocalReport.DataSources.Clear();

                foreach (CodeTorch.Core.ReportParameter p in GetReportParameters())
                {
                    string parameterValue = null;

                    if (p.Value != null)
                    {
                        parameterValue = p.Value.ToString();
                    }

                    Microsoft.Reporting.WebForms.ReportParameter rp = new Microsoft.Reporting.WebForms.ReportParameter(p.Name, parameterValue);
                    viewer.LocalReport.SetParameters(rp);
                }

                foreach (CodeTorch.Core.ReportDataSource dataSource in Me.ReportDataSources)
                {
                    DataTable data = GetData(dataCommandDB, pageDB, dataSource);

                    Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(dataSource.Name, data);
                    viewer.LocalReport.DataSources.Add(rds);
                }

                viewer.LocalReport.DisplayName = "Report";

                viewer.LocalReport.Refresh();
                viewer.Visible = true;

                this.Visible = true;
            }
            catch (Exception ex)
            {
                Common.LogException(ex, false);


                page.DisplayErrorAlert(String.Format("<strong>The following error(s) occurred:</strong>{0}", Common.GetExceptionMessage(ex, 4)));
            }
        }
Beispiel #13
0
        private void RenderEdWEntryReport(Dictionary <string, string> dictRes)
        {
            try
            {
                ReportViewerDisplay.Reset();


                string        sqlQuery = "sp_EDW_Reports_TEST";
                SqlConnection con      = HomeController.GetConnection();
                con.Open();
                System.Data.DataTable dt = new System.Data.DataTable();
                SqlDataAdapter        da = new SqlDataAdapter(sqlQuery, con);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                //ADD PARAMETERS FOR LISTING REPORT
                DateTime defaultStartDateTime = dictRes.ContainsKey("dates") ? DateTime.ParseExact(dictRes["dates"].Split(',')[0], "yyyy-MM-dd", null) : DateTime.Now.AddYears(-1);
                DateTime defaultEndDateTime   = dictRes.ContainsKey("dates") ? DateTime.ParseExact(dictRes["dates"].Split(',')[1], "yyyy-MM-dd", null) : DateTime.Now;
                da.SelectCommand.Parameters.AddWithValue("@cnstncy_nbr", dictRes["const"]);
                da.SelectCommand.Parameters.AddWithValue("@app_type", dictRes["appType"]);
                da.SelectCommand.Parameters.AddWithValue("@worker_type", dictRes["workerType"]);
                da.SelectCommand.Parameters.AddWithValue("@status", dictRes["status"]);
                da.SelectCommand.Parameters.AddWithValue("@StartDate", defaultStartDateTime);
                da.SelectCommand.Parameters.AddWithValue("@EndDate", defaultEndDateTime);
                da.Fill(dt);

                ReportViewerDisplay.LocalReport.DataSources.Clear();


                Microsoft.Reporting.WebForms.ReportDataSource rpdc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dt);

                ReportViewerDisplay.LocalReport.DataSources.Add(rpdc);


                ReportViewerDisplay.LocalReport.EnableExternalImages = true;
                ReportViewerDisplay.LocalReport.ReportPath           = Server.MapPath("~/Reports/ReportEdwListing.rdlc");

                //ReportViewerDisplay.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("Dates", new string[] { defaultStartDateTime.ToString(), defaultEndDateTime.ToString() }, true));

                ReportParameter stDate = new ReportParameter("stDate", defaultStartDateTime.ToString());
                ReportParameter eDate  = new ReportParameter("eDate", defaultEndDateTime.ToString());
                ReportViewerDisplay.LocalReport.SetParameters(new ReportParameter[] { stDate, eDate });
                ReportViewerDisplay.LocalReport.Refresh();
            }
            catch (Exception)
            {
            }
        }
Beispiel #14
0
    private void RetrieveFieldsDetailLocal()
    {
        string mlTANGGAL      = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY   = "";

        mlDATATABLE    = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL      = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY   = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                     "WHERE Disabled = 0 AND InvReceiptFlag = 'R' AND InvReceiptCode = '" + mlDATATABLE.Rows[0]["InvReceiptCode"].ToString() + "'" +
                     " AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                     "ORDER BY InvPreparedForDate Desc";
            mlREADER2    = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS    = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE       = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        //Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource("INV_RECEIPT_DATAH", mlDATATABLE);
        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport      mlREPORTH    = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name  = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing   += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        ReportViewer1.LocalReport.Refresh();
    }
Beispiel #15
0
 public static string CreateReceiptPrintout2(DataSet ds, string reportName)
 {
     Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport();
     lr.DataSources.Clear();
     lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName;
     //Emnable Image
     lr.EnableExternalImages = true;
     //
     foreach (DataTable dt in ds.Tables)
     {
         Microsoft.Reporting.WebForms.ReportDataSource rs = new Microsoft.Reporting.WebForms.ReportDataSource();
         rs.Name  = dt.TableName;
         rs.Value = dt;
         lr.DataSources.Add(rs);
     }
     return(BuildPrintoutFile(lr, "PDF"));
 }
        private void PopulateReport()
        {
            List <Models.Medicine> medicines = null;

            using (Models.MyDBContext d = new Models.MyDBContext())
            {
                medicines = d.medicines.OrderBy(a => a.name).ToList();

                //var v = from a in d.medicines select a;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/rpt_medicineDetails.rdlc");

                ReportViewer1.LocalReport.DataSources.Clear();
                Microsoft.Reporting.WebForms.ReportDataSource rd = new Microsoft.Reporting.WebForms.ReportDataSource("medicineDetails", medicines);
                ReportViewer1.LocalReport.DataSources.Add(rd);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Beispiel #17
0
        public void CreatePDF(string argStrFilePath, string argStrFileName, DataTable argDataTable, string argStrDataSetName, bool argBoolIsForceDownload)
        {
            // argStrFilePath = @"~/Reports/"
            // Variables
            Warning[] warnings;
            string[]  streamIds;
            string    mimeType  = string.Empty;
            string    encoding  = string.Empty;
            string    extension = string.Empty;

            // Setup the report viewer object and get the array of bytes
            ReportDataSource reportDataSource = new Microsoft.Reporting.WebForms.ReportDataSource {
                Name = argStrDataSetName, Value = argDataTable
            };
            ReportViewer viewer = new ReportViewer();

            viewer.ProcessingMode         = ProcessingMode.Local;
            viewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath(argStrFilePath + argStrFileName + ".rdlc");//"YourReportHere.rdlc";
            viewer.LocalReport.DataSources.Clear();
            viewer.LocalReport.DataSources.Add(reportDataSource);

            byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

            // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.Buffer       = true;
            HttpContext.Current.Response.BufferOutput = true;
            HttpContext.Current.Response.ContentType  = string.IsNullOrEmpty(mimeType) ? "application/pdf" : mimeType;
            //Forec to download
            if (argBoolIsForceDownload)
            {
                HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + argStrFileName + DateTime.Now.Ticks.ToString() + "." + extension);
            }
            else //Direct to browser if has Acrobat plug-in available
            {
                HttpContext.Current.Response.AddHeader("content-disposition", "inline; filename=" + argStrFileName + DateTime.Now.Ticks.ToString() + "." + extension);
            }

            HttpContext.Current.Response.BinaryWrite(bytes); // create the file
            HttpContext.Current.Response.Flush();            // send it to the client to download
            HttpContext.Current.Response.Close();
        }
        protected void generateWorkSchedule()
        {
            this.rvWorkSchedule.ProcessingMode = ProcessingMode.Local;

            ISSA.Pages.Reports.DataSet1 DS_Report = new ISSA.Pages.Reports.DataSet1();
            DS_Report.EnforceConstraints = false;

            ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter Rpt_TableAdapter = new ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter();
            Rpt_TableAdapter.Fill(DS_Report.TA_RPT_WorkSchedule, ddlYear.SelectedValue, ddlMonth.SelectedValue, Convert.ToByte(ddlArea.SelectedValue), ddlShift.SelectedValue);

            ISSA.Pages.Reports.DataSet1.dtParametersDataTable dtParam = new ISSA.Pages.Reports.DataSet1.dtParametersDataTable();

            DataRow dr = dtParam.NewRow();

            dr["ParamOne"] = ddlMonth.SelectedItem.Text + ", " + ddlYear.SelectedValue;
            dr["ParamTwo"] = ddlArea.SelectedItem.Text;
            if (ddlShift.SelectedIndex == 0)
            {
                dr["ParamThree"] = "All";
            }
            else
            {
                dr["ParamThree"] = ddlShift.SelectedItem.Text;
            }
            dr["User"] = loggedInUser;
            dr["Date"] = DateTime.Now;
            dtParam.Rows.Add(dr);

            Microsoft.Reporting.WebForms.ReportDataSource RpDs1          = new Microsoft.Reporting.WebForms.ReportDataSource();
            Microsoft.Reporting.WebForms.ReportDataSource RpDsParameters = new Microsoft.Reporting.WebForms.ReportDataSource();

            RpDs1.Name           = "TA_RPT_WorkSchedule";
            RpDs1.Value          = DS_Report.TA_RPT_WorkSchedule;
            RpDsParameters.Name  = "dtParameters";
            RpDsParameters.Value = dtParam;

            this.rvWorkSchedule.LocalReport.ReportPath = "Pages/Reports/rpt_WorkSchedule.rdlc";
            this.rvWorkSchedule.LocalReport.DataSources.Clear();
            this.rvWorkSchedule.LocalReport.DataSources.Add(RpDs1);
            this.rvWorkSchedule.LocalReport.DataSources.Add(RpDsParameters);
            this.rvWorkSchedule.LocalReport.Refresh();
            this.rvWorkSchedule.Visible        = true;
            this.rvWorkSchedule.ShowReportBody = true;
        }
Beispiel #19
0
    public void LoadReport(CDTReportDataIn objCDTReportDataIn)
    {
        Orders objOrders;

        try
        {
            string [] sOrderTax_Discnt;

            switch (objCDTReportDataIn.ReportName)
            {
            case Constants.RPT_CUSTBILL:

                _lr.ReportPath = ConfigurationManager.AppSettings["reportPath"].ToString() + "rptCustBill.rdlc";

                objOrders        = new Orders();
                sOrderTax_Discnt = objOrders.getOrderTaxForBill(objCDTReportDataIn.OrderID);
                //Set the parameters
                ReportParameter p1 = new ReportParameter("HotelName", objCDTReportDataIn.HotelName);
                _lr.SetParameters(new ReportParameter[] { p1 });

                ReportParameter p2 = new ReportParameter("OrderID", objCDTReportDataIn.OrderID.ToString());
                _lr.SetParameters(new ReportParameter[] { p2 });

                ReportParameter p3 = new ReportParameter("TotalTax", sOrderTax_Discnt[0]);
                _lr.SetParameters(new ReportParameter[] { p3 });

                ReportParameter p4 = new ReportParameter("DiscountPrcnt", sOrderTax_Discnt[1]);
                _lr.SetParameters(new ReportParameter[] { p4 });

                Microsoft.Reporting.WebForms.ReportDataSource rds;
                rds       = null;
                rds       = new Microsoft.Reporting.WebForms.ReportDataSource();
                rds.Name  = "dsCustBill";
                rds.Value = objOrders.getCustBill(objCDTReportDataIn.OrderID).Tables[0];

                _lr.DataSources.Add(rds);
                break;
            }
        }
        finally
        {
            objOrders = null;
        }
    }
Beispiel #20
0
        public static string CreateReceiptPrintout(DataTable dtData, DataTable dtDetail, string reportName)
        {
            Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport();
            lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName;

            lr.EnableExternalImages = true;

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoice.Name  = dtData.TableName;
            rsInvoice.Value = dtData;
            lr.DataSources.Add(rsInvoice);

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoiceDetail.Name  = dtDetail.TableName;
            rsInvoiceDetail.Value = dtDetail;
            lr.DataSources.Add(rsInvoiceDetail);

            return(BuildPrintoutFile(lr, "PDF"));
        }
Beispiel #21
0
        private void renderProductionDetailedReport(ReportParameters para)
        {
            ReportData reportData        = new ReportData();
            var        data              = reportData.GetProductionDetailedReport(para);
            var        reportDataSource1 = new Microsoft.Reporting.WebForms.ReportDataSource();

            reportDataSource1.Name  = "dsProductionDetailedReport";
            reportDataSource1.Value = data;
            this.ReportViewer1.LocalReport.DataSources.Add(reportDataSource1);
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/Rdlc/ProductionDetailedReport.rdlc");

            ReportParameter[] rptParams = new ReportParameter[2];
            rptParams[0] = new ReportParameter("paraDateFrom", para.DateFrom.Date.ToString(), true);
            rptParams[1] = new ReportParameter("paraDateTo", para.DateTo.Date.ToString(), true);
            this.ReportViewer1.LocalReport.SetParameters(rptParams);

            ReportViewer1.ShowPrintButton = true;
            ReportViewer1.ZoomMode        = ZoomMode.PageWidth;
        }
Beispiel #22
0
        private DataTable GetData(string parameterName, string dataSourceName)
        {
            FileInfo reportFullPath = this.ReportFile;

            //check to make sure the file ACTUALLY exists, before we start working on it
            if (reportFullPath == null)
            {
                return(null);
            }

            var errorMessages = new List <ErrorMessage>();

            //map the reporting engine to the .rdl/.rdlc file
            LoadReportDefinitionFile(CurrentReportViewer.LocalReport, reportFullPath);

            // Look-up the DB query in the "DataSets" element of the report file (.rdl/.rdlc which contains XML)
            RDL.Report reportDef = this.ReportDefinition;
            CheckReportParameters(CurrentReportViewer.LocalReport);

            var parameter = reportDef.ReportParameters.FirstOrDefault(p => p.Name.Equals(parameterName));

            if (parameter == null)
            {
                ReportSingleErroMessage($"The parameter {parameterName } was not found in report {ReportName}");
                return(null);
            }
            // Run each query (usually, there is only one) and attach each to the report
            var validValue = parameter.ValidValues.FirstOrDefault(v => v.DataSetName.Equals(dataSourceName));

            if (validValue == null)
            {
                ReportSingleErroMessage($"The parameter {parameterName } has no valid DataSetName ({dataSourceName}) for report {ReportName}");
                return(null);
            }
            RDL.DataSet ds = parameter.ValidValues.FirstOrDefault().DataSet;

            WebForms.ReportDataSource rds = GetReportDataSource(reportDef, ds);
            return((DataTable)rds.Value);
        }
Beispiel #23
0
        public static byte[] RenderReport(ExportRDLCCommand reportDefinition, Hashtable dataItems, out string mime, out string ext)
        {
            byte[] retVal;

            LocalReport localReport = new LocalReport();

            localReport.DataSources.Clear();
            LoadReportDefinition(localReport, reportDefinition);

            foreach (CodeTorch.Core.ReportDataSource dataSource in reportDefinition.ReportDataSources)
            {
                DataTable data = (DataTable)dataItems[dataSource.Name];

                Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(dataSource.Name, data);
                localReport.DataSources.Add(rds);
            }

            localReport.Refresh();

            retVal = Export(localReport, reportDefinition, out mime, out ext);

            return(retVal);
        }
        //Metodo para Mostrar el archivo
        private void RenderReport(ReportViewer Report, HttpResponse Response)
        {
            try
            {

                Warning[] warnings = null;

                string[] streamids;
                string mimeType = "";
                string encoding;
                string extension = "pdf";
                string filename = "Liq" + Session["conse"].ToString() + "Ac"+Session["acta"].ToString();
                //Dataset para Liquidacion
                ObjectDataSource ObjectDataSource1 = new ObjectDataSource("Generals.Web.Datasets.Ds_liquiTableAdapters.Sp_RevisarLiquidacionTableAdapter", "GetData");
                ObjectDataSource1.SelectParameters.Add("conse", Session["Conse"].ToString());

                Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DsLiqui", ObjectDataSource1);

                //DataSet para Consumo
                ObjectDataSource ObjectDataSource2 = new ObjectDataSource("Generals.Web.Datasets.Ds_liquiTableAdapters.Sp_Consumos_RevisarLiquiTableAdapter", "GetData");
                ObjectDataSource2.SelectParameters.Add("acta", Session["acta"].ToString());

                Microsoft.Reporting.WebForms.ReportDataSource rds1 = new Microsoft.Reporting.WebForms.ReportDataSource("DsConsumos", ObjectDataSource2);

                Report.LocalReport.DataSources.Add(rds);
                Report.LocalReport.DataSources.Add(rds1);
                // Report.LocalReport.DataSources.Add(this.Page.FindControl("ObjectDataSource1"));
                byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

                //// esto es solo para mostrar l pdf en una pagina
                var saveAs = string.Format("{0}.pdf", Path.Combine(Server.MapPath(@"~\File\Documentos\"), filename));
                if (idx == 0)
                {
                    while (File.Exists(saveAs))
                    {
                        idx += 1;
                        saveAs = string.Format("{0}.{1}.pdf", Path.Combine(Server.MapPath(@"~\File\Documentos\"), filename), idx);
                    }

                    using (var stream = new FileStream(saveAs, FileMode.Create, FileAccess.Write))
                    {
                        stream.Write(bytes, 0, bytes.Length);
                        stream.Close();

                    }
                }

                Doc = new BllDocumentos.Documentos();
                Doc.DocuActa = int.Parse(Session["acta"].ToString());
                Doc.DocuTiDo = 13;
                Doc.DocuFeCa = System.DateTime.Now;
                Doc.DocuUsCa = Usuario.username;
                Doc.DocuUrLo = "~/File/Documentos/"+filename+"."+ extension;
                Doc.DocuSincro = "1";
                Doc.DocuVeri = "1";
                Doc.DocuFeVe = System.DateTime.Now.ToString();

                Doc.DocuUsVe = Usuario.username; ;

                int r = Doc.Insert();
                if (r > 0)
                {
                   // Panel p = new Panel(); ;
                   // Response.Clear();
                   // Response.Buffer = true;
                   // Response.ContentType = "application/pdf";
                   // Response.AddHeader("content-disposition", "attachment;filename="+filename+"."+ extension);
                   // Response.Charset = "";
                   // this.EnableViewState = false;
                   // ScriptManager pr = new ScriptManager();
                   // System.IO.StringWriter sw = new System.IO.StringWriter();
                   // System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
                   // p.Controls.Add(pr);
                   // p.Controls.Add(Report);
                   // p.RenderControl(htw);

                   // Response.Write(sw.ToString());
                   // Response.End();
                   //// Response.Buffer = true;
                   ////Response.Clear();
                   //// Response.ContentType = mimeType;
                   //// Response.AddHeader("content-Disposition", "attachment; filename=" + filename + "." + extension);
                   //// Response.BinaryWrite(bytes);
                   //// Response.Flush();
                    //Response.Close();
                    Response.Redirect("GestionBandejas.aspx", false);

                }
            }
            catch (Exception ex)
            {

                Log.EscribirError(ex);
            }
            finally
            {
                Response.Redirect("~/GestionBandejas.aspx", false);
            }
        }
Beispiel #25
0
        //Metodo para Mostrar el archivo
        private void RenderReport(ReportViewer Report, HttpResponse Response)
        {
            try
            {
                Warning[] warnings = null;

                string[] streamids;
                string mimeType = "";
                string encoding;
                string extension = "pdf";
                string filename = "Proceso" + Session["Proc"].ToString() + "Acta" + Session["acta"].ToString();
                ObjectDataSource ObjectDataSource1 = new ObjectDataSource("Generals.Web.Datasets.DstProcesoSimpliTableAdapters.Sp_Proceso_SimpliTableAdapter", "GetData");
                ObjectDataSource1.SelectParameters.Add("conse", Session["Proc"].ToString());

                Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DsPr", ObjectDataSource1);
                Report.LocalReport.DataSources.Add(rds);

                // Report.LocalReport.DataSources.Add(this.Page.FindControl("ObjectDataSource1"));
                byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

                //// esto es solo para mostrar l pdf en una pagina

                //Response.Clear();
                //Response.ContentType = mimeType;
                //Response.AppendHeader("content-Disposition", "attachment;filename=" + filename + "." + extension);

                var saveAs = string.Format("{0}.pdf", Path.Combine(Server.MapPath(@"~\File\Documentos\"), filename));

                if (idx == 0)
                {
                    while (File.Exists(saveAs))
                    {
                        idx += 1;
                        saveAs = string.Format("{0}.{1}.pdf", Path.Combine(Server.MapPath(@"~\File\Documentos\"), filename), idx);
                    }

                    using (var stream = new FileStream(saveAs, FileMode.Create, FileAccess.Write))
                    {
                        stream.Write(bytes, 0, bytes.Length);
                        stream.Close();

                    }
                }
                //Response.WriteFile(Server.MapPath(@"~\File\Documentos\" + filename + "." + extension));
                //Response.BinaryWrite(bytes);
                //Response.TransmitFile(Server.MapPath(@"~\File\Documentos\" + filename + "." + extension));
                //Response.BinaryWrite(bytes);
                Doc = new BllDocumentos.Documentos();
                Doc.DocuActa = int.Parse(Session["acta"].ToString());
                Doc.DocuTiDo = 16;
                Doc.DocuFeCa = System.DateTime.Now;
                Doc.DocuUsCa = Usuario.username;
                Doc.DocuUrLo = "~/File/Documentos/" + filename + "." + extension;
                Doc.DocuSincro = "1";
                Doc.DocuVeri = "1";
                Doc.DocuFeVe = System.DateTime.Now.ToString();

                Doc.DocuUsVe = Usuario.username; ;

                int r = Doc.Insert();

                if (r > 0)
                {
                    //  Response.Flush();
                    //HttpContext.Current.Response.Buffer = true;
                    //HttpContext.Current.Response.Clear();
                    //HttpContext.Current.Response.ContentType = mimeType;
                    //HttpContext.Current.Response.AddHeader("content-Disposition", "attachment; filename=" + "Proceso" + Session["acta"].ToString() + "." + extension);
                    //HttpContext.Current.Response.BinaryWrite(bytes);
                    //HttpContext.Current.Response.Flush();
                    //Response.Redirect("GestionBandejas.aspx");
                    //HttpContext.Current.Response.Close();
                    //Response.Buffer = true;
                    //Response.Clear();
                    //Response.ContentType = mimeType;
                    //Response.AddHeader("content-Disposition", "attachment; filename=" + "Proceso" + Session["acta"].ToString() + "." + extension);
                    //Response.BinaryWrite(bytes);
                    //Response.Flush();
                    Response.Redirect("GestionBandejas.aspx");
                    //HttpContext.Current.Response.Close();

                }

            }
            catch (Exception ex)
            {
               Response.Redirect("GestionBandejas.aspx", false); Log.EscribirError(ex);
            }
        }
Beispiel #26
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
        //rds.DataSourceId = "AbiMatuEnterprise_GetAllAGENTs";
        //rds.Name = "dsReceipt";
        //rvProducts.LocalReport.DataSources.Clear();
        //rvProducts.Reset();
        //rvProducts.LocalReport.Refresh();

        //rvProducts.LocalReport.ReportPath = "Report.rdlc";
        //rvProducts.LocalReport.DataSources.Add(rds);
        //rvProducts.LocalReport.Refresh();


        //Fill the datasource from DB
        //AdventureWorksTableAdapters.vProductAndDescriptionTableAdapter ta = new AdventureWorksTableAdapters.vProductAndDescriptionTableAdapter();
        //AdventureWorks.vProductAndDescriptionDataTable dt = new AdventureWorks.vProductAndDescriptionDataTable();
        //ta.Fill(dt);

        ////Create an instance of Barcode Professional
        //Neodynamic.WebControls.BarcodeProfessional.BarcodeProfessional bcp = new Neodynamic.WebControls.BarcodeProfessional.BarcodeProfessional();
        ////Barcode settings
        //bcp.Symbology = Neodynamic.WebControls.BarcodeProfessional.Symbology.Code128;
        //bcp.BarHeight = 0.25f;

        ////Update DataTable with barcode image
        //foreach (AdventureWorks.vProductAndDescriptionRow row in dt.Rows)
        //{
        //    //Set the value to encode
        //    bcp.Code = row.ProductID.ToString();
        //    //Generate the barcode image and store it into the Barcode Column
        //    row.Barcode = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Png);
        //}

        ////Create ReportViewer
        //Microsoft.Reporting.WebForms.ReportViewer viewer = new Microsoft.Reporting.WebForms.ReportViewer();

        ////Create Report Data Source
        //Microsoft.Reporting.WebForms.ReportDataSource rptDataSource = new Microsoft.Reporting.WebForms.ReportDataSource("AdventureWorks_vProductAndDescription", dt);

        //viewer.LocalReport.DataSources.Add(rptDataSource);
        //viewer.LocalReport.ReportPath = Server.MapPath("BarcodeReport.rdlc");

        ////Export to PDF
        //string mimeType;
        //string encoding;
        //string fileNameExtension;
        //string[] streams;
        //Microsoft.Reporting.WebForms.Warning[] warnings;

        //byte[] pdfContent = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

        ////Return PDF
        //this.Response.Clear();
        //this.Response.ContentType = "application/pdf";
        //this.Response.AddHeader("Content-disposition", "attachment; filename=BarcodeReport.pdf");
        //this.Response.BinaryWrite(pdfContent);
        //this.Response.End();

        SqlLOCATIONProvider sqlLOCATIONProvider = new SqlLOCATIONProvider();
        DataTable           dt = new DataTable();

        dt = sqlLOCATIONProvider.GetAllLOCATIONsForReport();

        //GridView1.DataSource = dt;
        //GridView1.DataBind();


        //Create ReportViewer
        Microsoft.Reporting.WebForms.ReportViewer viewer = new Microsoft.Reporting.WebForms.ReportViewer();

        //Create Report Data Source
        Microsoft.Reporting.WebForms.ReportDataSource rptDataSource = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dt);

        viewer.LocalReport.DataSources.Add(rptDataSource);
        viewer.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
    }
Beispiel #27
0
    //protected void ddlOrganization_DataBound(object sender, EventArgs e)
    //{
    //        ddlOrganization.Items.Insert(0, new ListItem("All Organizations", "0"));
    //        ddlOrganization.SelectedIndex = 0;
    //}
    //protected void ddlLocation_DataBound(object sender, EventArgs e)
    //{
    //    ddlLocation.Items.Insert(0, new ListItem("All Locations", "0"));
    //    ddlLocation.SelectedIndex = 0;
    //}
    //protected void ddlOrganization_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindLocation(ddlOrganization.SelectedValue);
    //}
    //protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //   // Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), txtDate1.Text, txtDate2.Text);
    //}
    //protected void btnRxReport_Click(object sender, EventArgs e)
    //{
    //   if(Request.QueryString["patID"]!=null)
    //       Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), Request.QueryString["patID"].ToString());
    //}
    protected void Filldata(int ClinicID, int FacilityID, string PatientID)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("eCareXdb_NewDataSet_sp_ReportMedLog");
        DataTable dtPatInfo =GetData(ClinicID, FacilityID, PatientID);
        rds.Value = dtPatInfo;

        ReportViewer2.LocalReport.ReportPath = "Reports/RptMedLog.rdlc";
        ReportParameter PatID = new ReportParameter("PatientID", PatientID);
        ReportParameter[] rp = new ReportParameter[] {PatID};

        ReportViewer2.LocalReport.SetParameters(rp);
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
    }
Beispiel #28
0
    protected void RunInternational()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString());

        conn.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandText = "uspRptInternational";
        cmd.CommandType = CommandType.StoredProcedure;
        if (Session["profilename"].ToString() == "Client")
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", Session["ClientId"].ToString()));
        }
        else
        {
            cmd.Parameters.Add(new SqlParameter("@ClientId", this.lstClient.SelectedValue.ToString()));
        }


        cmd.Parameters.Add(new SqlParameter("@StartDate", this.txtStartDate.Text));
        cmd.Parameters.Add(new SqlParameter("@EndDate", this.txtEndDate.Text));

        SqlDataReader dr = cmd.ExecuteReader();

        dsInvoiceDetail dsDetail = new dsInvoiceDetail();

        while (dr.Read())
        {
            dsDetail.Tables[0].Rows.Add(dr[0].ToString(), System.Convert.ToDateTime(dr[1].ToString()), dr[2].ToString(), dr[3].ToString(), System.Convert.ToInt32(dr[4].ToString()), System.Convert.ToDouble(dr[5].ToString()));
        }

        dr.Close();

        this.rptViewer.LocalReport.DataSources.Clear();
        this.rptViewer.Reset();

        Microsoft.Reporting.WebForms.ReportDataSource rdInvDetail = new Microsoft.Reporting.WebForms.ReportDataSource("dsInvoiceDetail", dsDetail.Tables[0]);
        this.rptViewer.LocalReport.DataSources.Add(rdInvDetail);

        this.rptViewer.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        this.rptViewer.LocalReport.ReportPath = @"Reports\International.rdlc";

        // Get the date range to show on the report
        var startDate = (from dta in dsDetail.Tables[0].AsEnumerable()
                         orderby dta.Field <DateTime>("CallDate") ascending
                         select(dta.Field <DateTime>("CallDate"))).FirstOrDefault();

        var endDate = (from dta in dsDetail.Tables[0].AsEnumerable()
                       orderby dta.Field <DateTime>("CallDate") ascending
                       select(dta.Field <DateTime>("CallDate"))).LastOrDefault();

        // Configure report params
        Microsoft.Reporting.WebForms.ReportParameter ClientDescription = null;
        if (Session["profilename"].ToString() == "Client")
        {
            ClientDescription = new Microsoft.Reporting.WebForms.ReportParameter("ClientDescription", Session["ClientDesc"].ToString());
        }
        else
        {
            ClientDescription = new Microsoft.Reporting.WebForms.ReportParameter("ClientDescription", this.lstClient.SelectedItem.ToString());
        }

        Microsoft.Reporting.WebForms.ReportParameter ReportDescription = new Microsoft.Reporting.WebForms.ReportParameter("ReportDescription", "From : " + startDate + Environment.NewLine + "To     : " + endDate);
        this.rptViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { ClientDescription, ReportDescription });

        this.rptViewer.LocalReport.Refresh();
    }
    protected void Filldata(int ClinicID, int FacilityID, string date1,string date2)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("eCareXdb_NewDataSet_sp_ReportNewPrescription");
        //rds.Name = "table1";
        rds.Value = GetData( ClinicID,  FacilityID,  date1, date2);
        ReportViewer2.LocalReport.ReportPath = "Reports/RptNewPatient.rdlc";

        ReportParameter Date1 = new ReportParameter("Date1", date1);
        ReportParameter Date2 = new ReportParameter("Date2", date2);
        ReportParameter[] rp = new ReportParameter[] { Date1, Date2 };

        ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
    //protected void ddlOrganization_DataBound(object sender, EventArgs e)
    //{
    //        ddlOrganization.Items.Insert(0, new ListItem("All Organizations", "0"));
    //        ddlOrganization.SelectedIndex = 0;
    //}
    //protected void ddlLocation_DataBound(object sender, EventArgs e)
    //{
    //    ddlLocation.Items.Insert(0, new ListItem("All Locations", "0"));
    //    ddlLocation.SelectedIndex = 0;
    //}
    //protected void ddlOrganization_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    bindLocation(ddlOrganization.SelectedValue);
    //}
    //protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    // Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), txtDate1.Text, txtDate2.Text);
    //}
    //protected void btnRxReport_Click(object sender, EventArgs e)
    //{
    //    Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), ddlSType.SelectedValue, txtDate1.Text, txtDate2.Text);
    //}
    protected void Filldata(int DrugID, int FacilityID, string DType, string date1, string date2)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet4_sp_ReportDrugActivityLog");
        //rds.Name = "table1";
        rds.Value = GetData(DrugID, FacilityID, DType, date1, date2);
        ReportViewer2.LocalReport.ReportPath = "Reports/RptSInventLog.rdlc";

        ReportParameter SPDrugID = new ReportParameter("DrugID", DrugID.ToString());
        ReportParameter SPType = new ReportParameter("DType", DType);
        ReportParameter FacID = new ReportParameter("FacID", FacilityID.ToString());
        ReportParameter Date1 = new ReportParameter("FromDate", date1);
        ReportParameter Date2 = new ReportParameter("ToDate", date2);

        ReportParameter[] rp = new ReportParameter[] { SPDrugID, SPType, FacID, Date1, Date2 };

        ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
Beispiel #31
0
    private void RetrieveFieldsDetailPDF1()
    {
        string mlTANGGAL      = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY   = "";

        Warning[] warnings;
        string[]  streamIds;
        string    mimeType   = string.Empty;
        string    encoding   = string.Empty;
        string    extension  = string.Empty;
        string    filename   = "";
        string    deviceInfo =
            "<DeviceInfo>" +
            "  <OutputFormat>EMF</OutputFormat>" +
            "  <PageWidth>8.27in</PageWidth>" +
            "  <PageHeight>11.69in</PageHeight>" +
            "  <MarginTop>0.7874in</MarginTop>" +
            "  <MarginLeft>0.98425in</MarginLeft>" +
            "  <MarginRight>0.98425in</MarginRight>" +
            "  <MarginBottom>0.7874in</MarginBottom>" +
            "</DeviceInfo>";

        mlDATATABLE    = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL      = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY   = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                     "WHERE Disabled = 0 AND InvReceiptFlag = 'R' AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                     "ORDER BY InvPreparedForDate Desc";
            mlREADER2    = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS    = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE       = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport      mlREPORTH    = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name  = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing   += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        //byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
        byte[] bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamIds, out warnings);

        string path = Server.MapPath("~/pj_delinv/Print_Files");

        // Open PDF File in Web Browser
        filename  = "InvReceipt";
        extension = "pdf";

        FileStream file = new FileStream(path + "/" + filename + "." + extension, FileMode.OpenOrCreate, FileAccess.ReadWrite);

        file.Write(bytes, 0, bytes.Length);
        file.Dispose();

        WebClient client = new WebClient();

        Byte[] buffer = client.DownloadData(path + "/" + filename + "." + extension);
        if (buffer != null)
        {
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-length", buffer.Length.ToString());
            Response.BinaryWrite(buffer);
        }
    }
Beispiel #32
0
    protected void Filldata(int ClinicID, int FacilityID, string rxstatus, string date1, string date2)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet4_sp_ReportDrugActivity");
        //rds.Name = "table1";
        if (rxstatus != "P" && rxstatus != "S")
            rxstatus = "%";

        rds.Value = GetData(ClinicID, FacilityID, rxstatus, date1, date2);
        ReportViewer2.Reset();
        ReportViewer2.LocalReport.ReportPath = "Reports/RptSLog.rdlc";

        ReportParameter Date1 = new ReportParameter("FromDate", date1);
        ReportParameter Date2 = new ReportParameter("ToDate", date2);
        ReportParameter[] rp = new ReportParameter[] { Date1, Date2 };

        ReportViewer2.LocalReport.EnableHyperlinks = true;
        ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
Beispiel #33
0
    protected void ReportViewer2_Drillthrough(object sender, DrillthroughEventArgs e)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rdis = new Microsoft.Reporting.WebForms.ReportDataSource("dsDInventLog_sp_ReportDrugActivityLog");
        //rds.Name = "table1";
        int rdrugID=0, rfacID=0;
        String rdrugName="", rclinName="", rdType="S";
        String date1="", date2="";
        LocalReport report = (LocalReport)e.Report;
        //ReportViewer2.LocalReport.ReportPath = "Reports/RptSInventLog.rdlc";

        IList<ReportParameter> list = report.OriginalParametersToDrillthrough;

        int i = 0;
        foreach (ReportParameter param in list) {

            switch (i)
            {
                case 0:
                    rdrugID = Convert.ToInt32(param.Values[0].ToString());
                    break;
                case 1:
                    rdrugName = param.Values[0].ToString();
                    break;

                case 2:
                    rdType = param.Values[0].ToString();
                    break;
                case 3:
                    rfacID = Convert.ToInt32(param.Values[0].ToString());
                    break;
                case 4:
                    rclinName = param.Values[0].ToString();
                    break;

                case 5:
                    date1 = param.Values[0].ToString();
                    break;
                case 6:
                    date2 = param.Values[0].ToString();
                    break;
            }
            i++;
        }

        rdis.Value = GetInventData(rdrugID, rfacID, rdType, date1, date2);
        ReportParameter DrugID = new ReportParameter("DrugID", rdrugID.ToString());
        ReportParameter DType = new ReportParameter("DName", rdrugName);
        ReportParameter DName = new ReportParameter("DType", rdType);
        ReportParameter FacID = new ReportParameter("FacID", rfacID.ToString());
        ReportParameter CName = new ReportParameter("CName", rclinName);
        ReportParameter Date1 = new ReportParameter("FromDate", date1);
        ReportParameter Date2 = new ReportParameter("ToDate", date2);
        ReportParameter[] rp = new ReportParameter[] { DrugID, DType, FacID, Date1, Date2 };

        report.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        report.DataSources.Add(rdis);
        //report.LocalReport.DataSources.Clear();
        //report.LocalReport.DataSources.Add(rds);
        //report.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
Beispiel #34
0
    protected void Filldata(int ClinicID, int FacilityID, string date1, string date2)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSetPayment");
        //rds.Name = "table1";
        rds.Value = GetDate(ClinicID, FacilityID, date1, date2);
        ReportViewer2.LocalReport.ReportPath = "Reports/RptPayment.rdlc";

        ReportParameter LocationName = new ReportParameter("LocationName", "7/7/2009");
        ReportParameter Date1 = new ReportParameter("FromDate", date1);
        ReportParameter Date2 = new ReportParameter("ToDate", date2);
        ReportParameter[] rp = new ReportParameter[] { LocationName, Date1, Date2 };

        ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
        public void GetRDLCContents()
        {
            #region Get RDLC Contents

            string     _ReportPath = "";
            string     mimeType;
            string     encoding;
            string     fileNameExtension;
            string[]   streams;
            DataSet    _DataSetGetRdlCName      = null;
            DataSet    _DataSetRdlForMainReport = null;
            DataSet    _DataSetRdlForSubReport  = null;
            DataRow[]  dr              = null;
            DataRow[]  _drSubReport    = null;
            string     _OrderingMethod = "";
            string     strErrorMessage = "";
            LogManager objLogManager   = null;

            ReportParameter[] _RptParam = null;
            int LocationId = 1;
            reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();
            string strIds = "";
            try
            {
                _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
                if (_ReportPath == "")
                {
                    strErrorMessage = "ReportPath is Missing In WebConfig";
                    ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                    return;
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                strErrorMessage = "ReportPath Key is Missing In WebConfig";
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
            finally
            {
                objLogManager = null;
            }
            try
            {
                Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
                objectClientMedications = new ClientMedication();
                _DataSetGetRdlCName     = objectClientMedications.GetRdlCNameDataBase(1026);
                _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
                _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";
                if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
                {
                    dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();
                    if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) && (dr[0]["ViewStoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                    {
                        #region Get the StoredProceudreName and Execute
                        string _StoredProcedureName = "";
                        string _ReportName          = "";
                        _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString();
                        _ReportName          = dr[0]["DocumentName"].ToString();
                        this.reportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                        this.reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                        this.reportViewer1.LocalReport.DataSources.Clear();
                        //Testing By Vikas Vyas
                        reportViewer1.LocalReport.Refresh();
                        //End

                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _DataSetRdlForMainReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                        Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                        DataSet dstemp = (DataSet)Session["DataSetRdlTemp"];
                        if (dstemp == null)
                        {
                            dstemp = _DataSetRdlForMainReport;
                        }
                        else
                        {
                            dstemp.Merge(_DataSetRdlForMainReport);
                        }
                        Session["DataSetRdlTemp"] = dstemp;

                        #endregion
                        if (_DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Rows.Count > 0)
                        {
                            _drSubReport = _DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Select();
                            reportViewer1.LocalReport.SubreportProcessing -= new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            for (int i = 0; i < _drSubReport.Length; i++)
                            {
                                if ((_drSubReport[i]["SubReportName"] != DBNull.Value || !String.IsNullOrEmpty(_drSubReport[i]["SubReportName"].ToString())) && (_drSubReport[i]["StoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(_drSubReport[i]["StoredProcedure"].ToString())))
                                {
                                    #region Get the StoredProcedureName For SubReport and Execute
                                    string _SubReportStoredProcedure = "";
                                    string _SubReportName            = "";
                                    _SubReportStoredProcedure = _drSubReport[i]["StoredProcedure"].ToString();
                                    _SubReportName            = _drSubReport[i]["SubReportName"].ToString();
                                    string str2 = Session["MedicationIdsForConsentDetailPage"].ToString();
                                    _DataSetRdlForSubReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_SubReportStoredProcedure, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str2, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                                    Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(_SubReportName, _DataSetRdlForSubReport.Tables[0]);
                                    reportViewer1.LocalReport.DataSources.Add(rds);
                                    string strRootPath = Server.MapPath(".");
                                    System.IO.StreamReader RdlSubReport = new System.IO.StreamReader(_ReportPath + "\\" + _SubReportName.Trim() + ".rdlc");
                                    reportViewer1.LocalReport.LoadReportDefinition(RdlSubReport);
                                    #endregion
                                }
                            }
                        }
                        _RptParam    = new ReportParameter[3];
                        _RptParam[0] = new ReportParameter("ClientId", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId));
                        string str1 = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _RptParam[1] = new ReportParameter("ClientMedicationId", str1);
                        _RptParam[2] = new ReportParameter("ClientName", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.LastName + ", " + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.FirstName));
                        reportViewer1.LocalReport.SetParameters(_RptParam);
                        reportViewer1.LocalReport.Refresh();
                        reportViewer1.LocalReport.DataSources.Add(DataSource);
                        strIds = str1;
                        //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["ChangedOrderMedicationIds"].ToString() + "');", true);
                    }
                }
                #endregion
                try
                {
                    if (Session["imgId1"] == null || Session["imgId1"] == "")
                    {
                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        Session["imgId1"] = str;
                    }
                    else
                    {
                        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                    }
                }
                catch (Exception ex)
                {
                }
                #region DeleteOldRenderedImages
                try
                {
                    using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }
                #endregion

                string         reportType = "PDF";
                IList <Stream> m_streams;
                m_streams = new List <Stream>();
                Microsoft.Reporting.WebForms.Warning[] warnings;
                string deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";
                //try
                //{
                //    if (Session["imgId1"] == null)
                //    {
                //        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                //        Session["imgId1"] = str;
                //    }
                //    else
                //    {
                //        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                //    }
                //}
                //catch (Exception ex)
                //{
                //}
                if (Session["imgId1"] == null)
                {
                    Session["imgId1"] = strIds;
                }
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);
                    objRDLC.RunConsent(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);

                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
                }
                //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["imgId1"].ToString() + "');", true);
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                _DataSetGetRdlCName      = null;
                _DataSetRdlForMainReport = null;
                _DataSetRdlForSubReport  = null;
                _RptParam = null;
            }
        }
    protected void CallTempData(int SurveyID, int ReportNumber)
    {
        string  query     = "";
        DataSet ReportSet = new DataSet();

        query = "Select SCID.*, SCID.Remark Description, IM.ItemName, IM.Unit, IM.HSNCode, IM.CGST, IM.SGST, IM.IGST, 0 IGSTValue, QH.QuotationNo, QH.QuotationDate, QH.PaymentTerm, QH.CurrencyID, CM.Currency, CurrencyUnit, CurrencyTotal, IGM.GroupName, SCIH.quotationdone, SCIH.ClientID, CMM.ClientName, CMM.Address1, CMM.Address2, CMM.City, CMM.State, CMM.PostalCode, CMM.Country, CMM.GSTNo from SurveyClientItemDetailsVersion SCID, ItemMaster IM, ItemGroupMaster IGM, SurveyClientItemHead SCIH, QuotationHeader QH, QuotationHeaderVersion QHV, CurrencyMaster CM, ClientMaster CMM where SCID.SurveyID=SCIH.surveyID and SCIH.ClientID=CMM.ClientID and IM.GroupID=IGM.GroupID and SCID.ItemID=IM.ItemID and SCIH.SurveyID=QH.SurveyID and QH.CurrencyID=CM.CurrencyID and SCIH.SurveyID=QHV.SurveyID and SCID.versionid=QHV.versionid and SCIH.SurveyID=" + SurveyID + " and SCID.VersionID=QHV.VersionID and QHV.VersionID=" + rblVersion.SelectedValue;

        SqlDataAdapter adpt = new SqlDataAdapter(query, conn);

        if (conn.State == ConnectionState.Closed)
        {
            conn.Open();
        }
        adpt.Fill(ReportSet, "QuotationTable");
        if (ReportSet.Tables["QuotationTable"].Rows.Count <= 0)
        {
            UpdateVersion();
            CallTempData(int.Parse(Session["SurveyID"].ToString()), 1);
        }

        double totalamt    = 0;
        double amount      = 0;
        string quotationNo = "";

        for (int i = 0; i < ReportSet.Tables["QuotationTable"].Rows.Count; i++)
        {
            quotationNo = ReportSet.Tables["QuotationTable"].Rows[i]["QuotationNo"].ToString();
            double total = double.Parse(ReportSet.Tables["QuotationTable"].Rows[i]["CurrencyTotal"].ToString());
            double gst   = 0;
            if (ReportSet.Tables["QuotationTable"].Rows[i]["IGST"].ToString().Trim().Length > 0)
            {
                gst = double.Parse(ReportSet.Tables["QuotationTable"].Rows[i]["IGST"].ToString());
            }
            else
            {
                gst = 0;
            }
            //double qty = double.Parse(dt.Rows[i]["Quantity"].ToString());
            double gstTotal = (total * gst) / 100;
            ReportSet.Tables["QuotationTable"].Rows[i]["IGSTValue"] = gstTotal;
            totalamt = totalamt + (total + gstTotal);
            amount   = amount + total;
        }
        lblQuotationNumber.Text = quotationNo;
        string wordamount = "";

        rv.LocalReport.DataSources.Clear(); //clear report
        //string reportHeading = "";
        //if (rbActDetails.Checked == true)
        //{
        //string path = Server.MapPath("");
        if (ReportNumber == 1)
        {
            rv.LocalReport.ReportPath = Server.MapPath("QuotationReportDescription.rdlc"); // bind reportviewer with .rdlc
            wordamount = NumberToWords(Int32.Parse(Math.Round(totalamt, 0).ToString()));
        }
        if (ReportNumber == 2)
        {
            rv.LocalReport.ReportPath = Server.MapPath("QuotationReport.rdlc"); // bind reportviewer with .rdlc
            wordamount = NumberToWords(Int32.Parse(Math.Round(totalamt, 0).ToString()));
        }
        if (ReportNumber == 3)
        {
            rv.LocalReport.ReportPath = Server.MapPath("QuotationReportwithoutGSTWithDescription.rdlc"); // bind reportviewer with .rdlc
            wordamount = NumberToWords(Int32.Parse(Math.Round(amount, 0).ToString()));
        }
        if (ReportNumber == 4)
        {
            rv.LocalReport.ReportPath = Server.MapPath("QuotationReportwithoutGSTWithwithoutDescription.rdlc"); // bind reportviewer with .rdlc
            wordamount = NumberToWords(Int32.Parse(Math.Round(amount, 0).ToString()));
        }
        //    reportHeading = "Degtails Report - Account Wise Grey Challan Register from " + dtpFrom.Value.ToString("dd-MMM-yyyy") + " to " + dtpTo.Value.ToString("dd-MMM-yyyy");
        //}
        //if (rbActSummary.Checked == true)
        //{
        //    DataReportViewer.LocalReport.ReportEmbeddedResource = "WeaverStock.net.Reports.ChallanRegisterGreyActSummary.rdlc"; // bind reportviewer with .rdlc
        //    reportHeading = "Summary Report - Account Wise Grey Challan Register from " + dtpFrom.Value.ToString("dd-MMM-yyyy") + " to " + dtpTo.Value.ToString("dd-MMM-yyyy");
        //}
        Microsoft.Reporting.WebForms.ReportDataSource dataset = new Microsoft.Reporting.WebForms.ReportDataSource("QuotationTable", ReportSet.Tables["QuotationTable"]); // set the datasource
        rv.LocalReport.DataSources.Add(dataset);
        /// Get Firm Data to Print on Header
        ///
        List <ReportParameter> paramList = new List <ReportParameter>();

        //conn = DC.FirmDataConnection();
        ////lstChallan.Items.Add("(All)");
        //conn.Close();
        //cmd = new SqlCommand("Select * from FirmMaster", conn);
        //if (conn.State == ConnectionState.Closed)
        //    conn.Open();
        //SqlDataReader drFirm;
        //drFirm = cmd.ExecuteReader();
        //paramList.Add(new ReportParameter("ReportHeading", reportHeading));
        //while (drFirm.Read())
        //{
        paramList.Add(new ReportParameter("CustomerName", "Name"));
        paramList.Add(new ReportParameter("Address1", "Address1"));
        paramList.Add(new ReportParameter("Address2", ""));
        paramList.Add(new ReportParameter("City", "City"));
        paramList.Add(new ReportParameter("State", "State"));
        paramList.Add(new ReportParameter("PostalCode", "Pin Code"));
        paramList.Add(new ReportParameter("Country", "India"));
        paramList.Add(new ReportParameter("GSTNo", "GST"));
        paramList.Add(new ReportParameter("AmountInWord", wordamount));
        rv.LocalReport.SetParameters(paramList);
        //}
        //drFirm.Close();
        //conn.Close();

        rv.LocalReport.Refresh();
        //rv.ReportRefresh(); // refresh report

        //SqlCommand cmd = new SqlCommand(query, conn);
        ////cmd.Parameters.Add(new SqlParameter("@ClientID", SqlDbType.NVarChar, ClientID.Trim().Length)).Value = ClientID.Trim();
        ////cmd.Parameters.Add(new SqlParameter("@SurveyEngineerID", SqlDbType.NVarChar, Session["userID"].ToString().Trim().Length)).Value = Session["userID"].ToString().Trim();
        //SqlDataAdapter adpt = new SqlDataAdapter();
        //adpt.SelectCommand = cmd;
        //DataTable dt = new DataTable();
        //DataColumn c = new DataColumn("sno", typeof(int));
        //c.AutoIncrement = true;
        //c.AutoIncrementSeed = 1;
        //c.AutoIncrementStep = 1;
        //dt.Columns.Add(c);
        //adpt.Fill(dt);
        //bool finishsurvey = true;
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    //double total = double.Parse(dt.Rows[i]["QuotedPriceTotal"].ToString());
        //    //double qty = double.Parse(dt.Rows[i]["Quantity"].ToString());
        //    //double CurrTotal = total / CurrencyValue;
        //    //double unit = CurrTotal / qty;
        //    //dt.Rows[i]["CurrencyUnit"] = unit;
        //    //dt.Rows[i]["CurrencyTotal"] = CurrTotal;
        //    //dt.Rows[i]["Currency"] = ddlCurrency.SelectedItem.ToString();
        //    //if (total <= 0 || bool.Parse(dt.Rows[i]["Changestatus"].ToString())==true)
        //    //    finishsurvey = false;
        //}
        //if (SurveyID > 0)
        //{
        //    if (dt.Rows.Count > 0)
        //    {
        //        //if ((bool)dt.Rows[dt.Rows.Count - 1]["quotationdone"] == true)
        //        //{
        //        //    gvitemdisplay.DataSource = dt;
        //        //    gvitemdisplay.DataBind();
        //        //    txtClientName.Enabled = false;
        //        //}
        //        //else
        //        //{
        //            gvFeed.DataSource = dt;
        //            gvFeed.DataBind();
        //            txtClientName.Enabled = false;
        //        //}
        //    }
        //}

        //if (finishsurvey == true)
        //    btnFinishSurvey.Enabled = false;
        //else
        //    btnFinishSurvey.Enabled = true;

        //SqlCommand cmdQNo = new SqlCommand("Select * from QuotationHeader where SurveyID=" + SurveyID, conn);
        //if (conn.State == ConnectionState.Closed)
        //    conn.Open();
        //SqlDataReader drq = cmdQNo.ExecuteReader();
        //bool quotationdone = false;
        //if(drq.Read())
        //{
        //    lblQuotationNumber.Text = drq["QuotationNo"].ToString();
        //    quotationdone = true;
        //}
        //drq.Close();
        //if(quotationdone==false)
        //{ lblQuotationNumber.Text = "Quotation Number will generate once costing done for all Item and Click on Finish Quotation Button"; }
        //else
        //{
        //    gvFeed.DataSource = dt;
        //    gvFeed.DataBind();
        //    txtClientNamze.Enabled = true;
        //    txtQuantity.Enabled = true;
        //    txtRemark.Enabled = true;
        //    btnSubmit.Enabled = true;

        //    ddlItem.Enabled = true;

        //}
        //if (conn.State == ConnectionState.Closed)
        //    conn.Open();

        //conn.Close();
    }
Beispiel #37
0
    private void RetrieveFieldsDetailPDF()
    {
        string mlTANGGAL      = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY   = "";

        Warning[] warnings;
        string[]  streamIds;
        string    mimeType  = string.Empty;
        string    encoding  = string.Empty;
        string    extension = string.Empty;
        string    filename  = "";

        mlDATATABLE    = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL      = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY   = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                     "WHERE Disabled = 0 AND InvReceiptFlag = 'R' AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                     "ORDER BY InvPreparedForDate Desc";
            mlREADER2    = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS    = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR    = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE       = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport      mlREPORTH    = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name  = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing   += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

        filename  = "InvReceipt";
        extension = "pdf";
        // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
        Response.Buffer = true;
        Response.Clear();
        Response.ContentType = mimeType;
        Response.AddHeader("content-disposition", "attachment; filename=" + filename + "." + extension);
        Response.BinaryWrite(bytes); // create the file
        Response.Flush();            // send it to the client to download
        Response.End();
        //Body.Size.Width + Report.Margins.Left + Report.Margins.Right <= Report.PageSize.Width
    }
Beispiel #38
0
    protected void Filldata(int PPID)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSetLowCost");
        //rds.Name = "table1";
        //rds.Value = GetData(PPID);
        ReportViewer2.LocalReport.ReportPath = "Reports/RptTimesheet.rdlc";
        SqlConnection sqlCon = new SqlConnection(conStr);

        //string sqlQuery = "select p.pat_FName, p.pat_LName, p.pat_DOB, p.pat_Gender, p.LastModified,pin.PI_PolicyID,pin.PI_GroupNo,pin.PI_BINNo,PI_InsdName,PI_InsdRel,ins.Ins_Name,p.Doc_ID,ph.Phrm_ID,pa.PA_Desc,ph.Phrm_Name,ph.Phrm_Address1,ph.Phrm_Address2,ph.Phrm_City,ph.Phrm_State,ph.Phrm_Zip,ph.Phrm_Phone,ph.Phrm_Fax from Patient_Info p, Patient_Ins pin, Patient_Allergies pa,Pharmacy_Info ph,Insurance_Info ins where p.pat_ID =" + Int32.Parse(patID) + " and pin.pat_ID=" + Int32.Parse(patID) + " and pa.pat_ID=" + Int32.Parse(patID) + "and p.Phrm_ID=ph.Phrm_ID and pin.Ins_ID=ins.Ins_ID";

        SqlCommand sqlCmd = new SqlCommand("sp_ReportTimeSheet", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter sp_PPID = sqlCmd.Parameters.Add("@PPID", SqlDbType.Int);
        sp_PPID.Value = PPID;

        SqlParameter sp_Date1 = sqlCmd.Parameters.Add("@SDate", SqlDbType.Date);
        sp_Date1.Direction = ParameterDirection.Output;
        SqlParameter sp_Date2 = sqlCmd.Parameters.Add("@EDate", SqlDbType.Date);
        sp_Date2.Direction = ParameterDirection.Output;

        SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
        DataSet dsPatient = new DataSet();
        try
        {
            sqlDa.Fill(dsPatient);

            ReportParameter Date1 = new ReportParameter("FromDate", sp_Date1.Value.ToString());
            ReportParameter Date2 = new ReportParameter("ToDate", sp_Date2.Value.ToString());
            ReportParameter[] rp = new ReportParameter[] { Date1, Date2 };

            ReportViewer2.LocalReport.SetParameters(rp);
            rds.Value = dsPatient.Tables[0];

        }
        catch (Exception ex)
        {

        }

        //ReportViewer2.LocalReport.SetParameters(rp);
        //ReportViewer2.LocalReport.SetParameters(new ReportParameter("Date2", "8/8/2009"));
        ReportViewer2.LocalReport.DataSources.Clear();
        ReportViewer2.LocalReport.DataSources.Add(rds);
        ReportViewer2.LocalReport.Refresh();
        //ReportViewer2.DataBind();
    }
Beispiel #39
0
    private void RetrieveFieldsDetailLocal()
    {
        string mlCRITERIA = "";
        string mlTANGGALFROM = "";
        string mlTANGGALTO = "";

        mlTANGGALFROM = FormatDateyyyyMMdd(mlTXTTANGGALFROM.Text);
        mlTANGGALTO = FormatDateyyyyMMdd(mlTXTTANGGALTO.Text);

        if ((mlTANGGALFROM != "") || (mlTANGGALTO != ""))
        {
            mlCRITERIA = "((PROCEEDSDATE BETWEEN '" + mlTANGGALFROM + "' AND '" + mlTANGGALTO + "') OR (DELIVEREDDATE BETWEEN '" + mlTANGGALFROM + "' AND '" + mlTANGGALTO + "') " +
                         "OR (RETURNEDDATE BETWEEN '" + mlTANGGALFROM + "' AND '" + mlTANGGALTO + "') OR (DONEDATE BETWEEN '" + mlTANGGALFROM + "' AND '" + mlTANGGALTO + "')) ";
        }

        if (mlDDLREPORTNAME.SelectedItem.Value != "InvDeliverySummary.rdlc")
        {
            if (mlDDLBRANCH.SelectedItem.Value != "-- Pilih --")
            {
                mlCRITERIA = mlCRITERIA + " AND BRANCH = '" + mlDDLBRANCH.SelectedItem.Value + "'";
            }

            mlSQL2 = "SELECT * FROM INV_DELIVERY_STATUS_BRANCH " +
                 "WHERE " + mlCRITERIA + "";
            mlREADER2 = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE = InsertReaderToDatatable(mlDATATABLE, mlDATAROW, mlREADER2);

        }
        else
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY_STATUS " +
                     "WHERE " + mlCRITERIA + "";
            mlREADER2 = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE = InsertReaderToDatatable(mlDATATABLE, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/" + mlDDLREPORTNAME.SelectedItem.Value + "");

        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE = new Microsoft.Reporting.WebForms.ReportParameter("Title", "REPORTING MONITORING DELIVERY INVOICE");

        //Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource("INV_RECEIPT_DATAH", mlDATATABLE);
        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport mlREPORTH = new Microsoft.Reporting.WebForms.LocalReport();

        if (mlDDLREPORTNAME.SelectedItem.Value != "InvDeliverySummary.rdlc")
        {
            mlDATASOURCE.Name = "INV_DELIVERY_STATUSBRANCH";
        }
        else
        {
            mlDATASOURCE.Name = "INV_DELIVERY_STATUS";
        }
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/" + mlDDLREPORTNAME.SelectedItem.Value + "";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        //ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlCOMPNAME, mlCOMPADDR, mlTITLE });

        ReportViewer1.LocalReport.Refresh();
    }
Beispiel #40
0
    //protected void ddlOrganization_DataBound(object sender, EventArgs e)
    //{
    //        ddlOrganization.Items.Insert(0, new ListItem("All Organizations", "0"));
    //        ddlOrganization.SelectedIndex = 0;
    //}
    //protected void ddlLocation_DataBound(object sender, EventArgs e)
    //{
    //    ddlLocation.Items.Insert(0, new ListItem("All Locations", "0"));
    //    ddlLocation.SelectedIndex = 0;
    //}
    //protected void ddlOrganization_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindLocation(ddlOrganization.SelectedValue);
    //}
    //protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //   // Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), txtDate1.Text, txtDate2.Text);
    //}
    //protected void btnRxReport_Click(object sender, EventArgs e)
    //{
    //   if(Request.QueryString["patID"]!=null)
    //       Filldata(int.Parse(ddlOrganization.SelectedValue), int.Parse(ddlLocation.SelectedValue), Request.QueryString["patID"].ToString());
    //}
    protected void Filldata(int ClinicID, int FacilityID, string RxReqID)
    {
        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("eCareXDBDataSet_sp_ReportRxReq");
        DataTable dtRxReqInfo =GetData(ClinicID, FacilityID, RxReqID);
        rds.Value = dtRxReqInfo;

        ReportViewer3.LocalReport.ReportPath = "Reports/RptRxReq.rdlc";
        ReportParameter RxRequestID = new ReportParameter("RxRequestID", RxReqID);
        ReportParameter[] rp = new ReportParameter[] {RxRequestID};

        ReportViewer3.LocalReport.SetParameters(rp);
        ReportViewer3.LocalReport.DataSources.Clear();
        ReportViewer3.LocalReport.DataSources.Add(rds);
        ReportViewer3.LocalReport.Refresh();
    }
    private void RetrieveFieldsDetailPDF()
    {
        string mlTANGGAL = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY = "";

        Warning[] warnings;
        string[] streamIds;
        string mimeType = string.Empty;
        string encoding = string.Empty;
        string extension = string.Empty;
        string filename = "";

        mlDATATABLE = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                      "WHERE Disabled = 0 AND InvReceiptFlag = 'R' AND InvReceiptCode = '" + mlDATATABLE.Rows[0]["InvReceiptCode"].ToString() + "'" +
                      " AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                      "ORDER BY InvPreparedForDate Desc";
            mlREADER2 = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport mlREPORTH = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

        filename = "InvReceipt";
        extension = "pdf";
        // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
        Response.Buffer = true;
        Response.Clear();
        Response.ContentType = mimeType;
        Response.AddHeader("content-disposition", "attachment; filename=" + filename + "." + extension);
        Response.BinaryWrite(bytes); // create the file
        Response.Flush(); // send it to the client to download
        Response.End();
        //Body.Size.Width + Report.Margins.Left + Report.Margins.Right <= Report.PageSize.Width
    }
    private void RetrieveFieldsDetailLocal()
    {
        string mlTANGGAL = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY = "";

        mlDATATABLE = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                      "WHERE Disabled = 0 AND InvReceiptFlag = 'R' AND InvReceiptCode = '" + mlDATATABLE.Rows[0]["InvReceiptCode"].ToString() + "'" +
                      " AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                      "ORDER BY InvPreparedForDate Desc";
            mlREADER2 = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        //Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource("INV_RECEIPT_DATAH", mlDATATABLE);
        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport mlREPORTH = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        ReportViewer1.LocalReport.Refresh();
    }
Beispiel #43
0
        private void ThrirdWay()
        {
            string[] recommendedInputPaths = new string[] { @"C:\Automation\Input", @"C:\Automation\OutPut", @"C:\Automation\Processed" };


            using (EventLog eventLog = new EventLog())
            {
                eventLog.Source = "Application";
                eventLog.WriteEntry("Files Created", EventLogEntryType.Error);
            }

            try
            {
                DirectoryCreation(recommendedInputPaths);

                //string[] accdbDirectory = System.IO.Directory.GetFiles(recommendedInputPaths[0], "*.xlsx");

                //string filePath = @"C:\Kalya Solutions\GMB insights (Discovery Report) - 2020-1-12 - 2020-1-18 - 54dfdd99d13944a11e53e473d2e7a7b4.xlsx";



                foreach (string accdbFile in Directory.GetFiles(recommendedInputPaths[0], "*.xlsx"))
                {
                    using (EventLog eventLog = new EventLog())
                    {
                        eventLog.Source = "Application";
                        eventLog.WriteEntry("Files Read", EventLogEntryType.SuccessAudit);
                    }

                    //string connectioFile = accdbFile;

                    // string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + accdbFile + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";";
                    DataTable resultsDataset = new DataTable();
                    //    using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + accdbFile + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";"))
                    //    {
                    //        OleDbCommand cmd = new OleDbCommand("SELECT * FROM [GMB insights (Discovery Report)$]", conn);
                    //        conn.Open();
                    //        OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
                    //        adapter.Fill(resultsDataset);
                    //        conn.Dispose();

                    //        resultsDataset.Dispose();
                    //    }


                    IExcelDataReader excelReader;
                    FileStream       stream = File.Open(accdbFile, FileMode.Open, FileAccess.Read);
                    excelReader = ExcelReaderFactory.CreateReader(stream);

                    DataSet result = excelReader.AsDataSet(new ExcelDataSetConfiguration()
                    {
                        ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                        {
                            UseHeaderRow = true
                        }
                    });

                    excelReader.Close();

                    resultsDataset = result.Tables[0];

                    using (EventLog eventLog = new EventLog())
                    {
                        eventLog.Source = "Application";
                        eventLog.WriteEntry("Data Set Prepared", EventLogEntryType.SuccessAudit);
                    }

                    //string moveDestinationPath = Path.Combine(recommendedInputPaths[2], Path.GetFileNameWithoutExtension("GMB insights (Discovery Report) - 2020-1-12 - 2020-1-18 - 54dfdd99d13944a11e53e473d2e7a7b4.xlsx"));

                    //File.Move(@"C:\Automation\Input\GMB insights (Discovery Report) - 2020-1-12 - 2020-1-18 - 54dfdd99d13944a11e53e473d2e7a7b4.xlsx", moveDestinationPath + DateTime.Now.ToString("_MMMdd_yyyy_HHmmss") + ".xlsx");

                    int resultDataSetRow = 1;


                    for (int i = 0; i < 6; i++)
                    {
                        DataSet   ds         = new DataSet();
                        DataTable mergeTable = new DataTable();
                        mergeTable.Clear();

                        mergeTable.Columns.Add("Storecode", typeof(System.String));
                        mergeTable.Columns.Add("BusinessName", typeof(System.String));
                        mergeTable.Columns.Add("Address", typeof(System.String));
                        mergeTable.Columns.Add("Labels", typeof(System.String));
                        mergeTable.Columns.Add("OverallRating", typeof(System.Double));
                        mergeTable.Columns.Add("TotalSearches", typeof(System.Double));
                        mergeTable.Columns.Add("DirectSearches", typeof(System.Double));
                        mergeTable.Columns.Add("DiscoverySearches", typeof(System.Double));
                        mergeTable.Columns.Add("TotalViews", typeof(System.Double));
                        mergeTable.Columns.Add("SearchViews", typeof(System.Double));
                        mergeTable.Columns.Add("MapsViews", typeof(System.Double));
                        mergeTable.Columns.Add("TotalActions", typeof(System.Double));
                        mergeTable.Columns.Add("WebsiteActions", typeof(System.Double));
                        mergeTable.Columns.Add("DirectionsActions", typeof(System.Double));
                        mergeTable.Columns.Add("PhoneCallActions", typeof(System.Double));


                        DataRow workRow = mergeTable.NewRow();
                        mergeTable.Rows.Add(workRow);

                        mergeTable.Rows[0][0]  = resultsDataset.Rows[resultDataSetRow]["Store code"];
                        mergeTable.Rows[0][1]  = resultsDataset.Rows[resultDataSetRow]["Business name"];
                        mergeTable.Rows[0][2]  = resultsDataset.Rows[resultDataSetRow]["Address"];
                        mergeTable.Rows[0][3]  = resultsDataset.Rows[resultDataSetRow]["Labels"];
                        mergeTable.Rows[0][4]  = resultsDataset.Rows[resultDataSetRow]["Overall rating"];
                        mergeTable.Rows[0][5]  = resultsDataset.Rows[resultDataSetRow]["Total searches"];
                        mergeTable.Rows[0][6]  = resultsDataset.Rows[resultDataSetRow]["Direct searches"];
                        mergeTable.Rows[0][7]  = resultsDataset.Rows[resultDataSetRow]["Discovery searches"];
                        mergeTable.Rows[0][8]  = resultsDataset.Rows[resultDataSetRow]["Total views"];
                        mergeTable.Rows[0][9]  = resultsDataset.Rows[resultDataSetRow]["Search views"];
                        mergeTable.Rows[0][10] = resultsDataset.Rows[resultDataSetRow]["Maps views"];
                        mergeTable.Rows[0][11] = resultsDataset.Rows[resultDataSetRow]["Total actions"];
                        mergeTable.Rows[0][12] = resultsDataset.Rows[resultDataSetRow]["Website actions"];
                        mergeTable.Rows[0][13] = resultsDataset.Rows[resultDataSetRow]["Directions actions"];
                        mergeTable.Rows[0][14] = resultsDataset.Rows[resultDataSetRow]["Phone call actions"];

                        ds.Tables.Add(mergeTable);

                        //ReportDataModels.GMBInformationDataTable gMBInformationRows = ds;

                        Microsoft.Reporting.WebForms.ReportViewer ReportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();

                        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

                        //Path.Combine(Directory.GetCurrentDirectory(), @"DBObjs\RawDataReport.txt")

                        ReportViewer1.LocalReport.ReportPath = @"C:\DRL RDLC\Report1.rdlc";
                        Microsoft.Reporting.WebForms.ReportDataSource datasource = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ds.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(datasource);

                        using (EventLog eventLog = new EventLog())
                        {
                            eventLog.Source = "Application";
                            eventLog.WriteEntry("Report Created", EventLogEntryType.SuccessAudit);
                        }

                        Warning[] warnings;
                        string[]  streamids;
                        string    mimeType;
                        string    encoding;
                        string    filenameExtension;

                        byte[] bytes = ReportViewer1.LocalReport.Render(
                            "PDF", null, out mimeType, out encoding, out filenameExtension,
                            out streamids, out warnings);


                        // string outputFileName = Path.Combine(recommendedInputPaths[1], resultsDataset.Rows[resultDataSetRow]["Business name"] + ".pdf");

                        //@"C:\Users\v-mapall\source\repos\ExcelCustomApps\GMBRDLC Application\" + resultsDataset.Rows[resultDataSetRow]["Business name"] + ".pdf"

                        using (FileStream fs = new FileStream(Path.Combine(recommendedInputPaths[1], resultsDataset.Rows[resultDataSetRow]["Business name"] + ".pdf"), FileMode.Create))
                        {
                            fs.Write(bytes, 0, bytes.Length);
                        }

                        using (EventLog eventLog = new EventLog())
                        {
                            eventLog.Source = "Application";
                            eventLog.WriteEntry("PDF Files Created", EventLogEntryType.SuccessAudit);
                        }

                        resultDataSetRow++;
                    }

                    //string accdbFileName = Path.GetFileName(accdbFile);

                    //string moveDestinationPath = Path.Combine(recommendedInputPaths[2], Path.GetFileName(accdbFile));


                    string moveDestinationPath = Path.Combine(recommendedInputPaths[2], Path.GetFileNameWithoutExtension(accdbFile));

                    File.Move(accdbFile, moveDestinationPath + DateTime.Now.ToString("_MMMdd_yyyy_HHmmss") + ".xlsx");

                    using (EventLog eventLog = new EventLog())
                    {
                        eventLog.Source = "Application";
                        eventLog.WriteEntry("Files Were Moved", EventLogEntryType.SuccessAudit);
                    }
                }
            }
            catch (Exception exeption)
            {
                using (EventLog eventLog = new EventLog())
                {
                    eventLog.Source = "Application";
                    eventLog.WriteEntry(exeption.Message, EventLogEntryType.Error);
                }
            }
        }
    private void RetrieveFieldsDetailPDF1()
    {
        string mlTANGGAL = "";
        string mlRECEIVEDCODE = "";
        string mlRECEIVEDBY = "";

        Warning[] warnings;
        string[] streamIds;
        string mimeType = string.Empty;
        string encoding = string.Empty;
        string extension = string.Empty;
        string filename = "";
        string deviceInfo =
        "<DeviceInfo>" +
        "  <OutputFormat>EMF</OutputFormat>" +
        "  <PageWidth>8.27in</PageWidth>" +
        "  <PageHeight>11.69in</PageHeight>" +
        "  <MarginTop>0.7874in</MarginTop>" +
        "  <MarginLeft>0.98425in</MarginLeft>" +
        "  <MarginRight>0.98425in</MarginRight>" +
        "  <MarginBottom>0.7874in</MarginBottom>" +
        "</DeviceInfo>";

        mlDATATABLE = (DataTable)Session["FormEditReceiptData"];
        mlTANGGAL = FormatDateyyyyMMdd(Convert.ToDateTime(mlDATATABLE.Rows[0]["InvPreparedForDate"]));
        mlRECEIVEDCODE = mlDATATABLE.Rows[0]["InvCodeMess"].ToString();
        mlRECEIVEDBY = mlDATATABLE.Rows[0]["InvMessName"].ToString();

        if (mlDATATABLE.Rows[0]["InvStatus"].ToString() == "PROCEEDS" && mlDATATABLE.Rows[0]["InvReceiptFlag"].ToString() == "R")
        {
            mlSQL2 = "SELECT * FROM INV_DELIVERY " +
                     "WHERE Disabled = '0' AND InvReceiptFlag = 'R' AND InvReceiptCode = '" + mlDATATABLE.Rows[0]["InvReceiptCode"].ToString() + "'" +
                     " AND InvPreparedForDate = '" + mlTANGGAL + "' AND InvCodeMess = '" + mlRECEIVEDCODE + "' AND InvMessName = '" + mlRECEIVEDBY + "' " +
                     "ORDER BY InvPreparedForDate Desc";
            mlREADER2 = mlOBJGS.DbRecordset(mlSQL2, "PB", mlCOMPANYID);
            mlDATATABLE1 = InsertReaderToDatatable(mlDATATABLE1, mlDATAROW, mlREADER2);
        }
        //else
        //{
        //    mlDATATABLE1 = mlDATATABLE.Copy();
        //}

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/pj_delinv/InvReceiptH.rdlc");

        Microsoft.Reporting.WebForms.ReportParameter mlRECEIPTCODE = new Microsoft.Reporting.WebForms.ReportParameter("ReceiptCode", mlDATATABLE.Rows[0]["InvReceiptCode"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCODEMESS = new Microsoft.Reporting.WebForms.ReportParameter("CodeMess", mlDATATABLE.Rows[0]["InvCodeMess"].ToString());
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPNAME = new Microsoft.Reporting.WebForms.ReportParameter("CompanyName", mlCOMPANYNAME);
        Microsoft.Reporting.WebForms.ReportParameter mlCOMPADDR = new Microsoft.Reporting.WebForms.ReportParameter("CompanyAddress", mlCOMPANYADDRESS);
        Microsoft.Reporting.WebForms.ReportParameter mlTITLE = new Microsoft.Reporting.WebForms.ReportParameter("Title", "INVOICE / RECEIPT");

        Microsoft.Reporting.WebForms.ReportDataSource mlDATASOURCE = new Microsoft.Reporting.WebForms.ReportDataSource();
        Microsoft.Reporting.WebForms.LocalReport mlREPORTH = new Microsoft.Reporting.WebForms.LocalReport();

        mlDATASOURCE.Name = "INV_RECEIPT_DATAH";
        mlDATASOURCE.Value = mlDATATABLE;
        mlREPORTH.ReportEmbeddedResource = "~/pj_delinv/InvReceiptH.rdlc";
        mlREPORTH.DataSources.Add(mlDATASOURCE);

        ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
        ReportViewer1.LocalReport.ReportEmbeddedResource = mlREPORTH.ReportEmbeddedResource;
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(mlDATASOURCE);
        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { mlRECEIPTCODE, mlCODEMESS, mlCOMPNAME, mlCOMPADDR, mlTITLE });

        //byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
        byte[] bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamIds, out warnings);

        string path = Server.MapPath("~/pj_delinv/Print_Files");

        // Open PDF File in Web Browser
        filename = "InvReceipt";
        extension = "pdf";

        FileStream file = new FileStream(path + "/" + filename + "." + extension, FileMode.OpenOrCreate, FileAccess.ReadWrite);
        file.Write(bytes, 0, bytes.Length);
        file.Dispose();

        WebClient client = new WebClient();
        Byte[] buffer = client.DownloadData(path + "/" + filename + "." + extension);
        if (buffer != null)
        {
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-length", buffer.Length.ToString());
            Response.BinaryWrite(buffer);
        }
    }
Beispiel #45
0
        private void Data_Binding()
        {
            string productMoFrom = Request.QueryString["productMoFrom"].ToString();
            string productMoTo   = Request.QueryString["productMoTo"].ToString();
            string invFrom       = Request.QueryString["invFrom"].ToString();
            string invTo         = Request.QueryString["invTo"].ToString();
            string dateFrom      = Request.QueryString["dateFrom"].ToString();
            string dateTo        = Request.QueryString["dateTo"].ToString();
            string remote_db     = DBUtility.remote_db;
            string within_code   = DBUtility.within_code;
            string strSql        = "Select b.mo_id,a.id,a.invoice_no,Convert(Varchar(20),a.invoice_date,111) AS invoice_date,c.name AS goods_cname " +
                                   ",b.issues_unit,Convert(INT,b.issues_qty) AS issues_qty,d.id AS order_id,d.unit_price,d.p_unit,f.rate" +
                                   ",Round((b.issues_qty/f.rate)*Convert(float,d.unit_price),2) AS order_amt" +
                                   ",a.linkman,d.table_head,e.m_id" +
                                   " From " + remote_db + "so_issues_mostly a" +
                                   " Inner Join " + remote_db + "so_issues_details b On a.within_code=b.within_code And a.id=b.id" +
                                   " Inner Join " + remote_db + "it_goods c On b.within_code=c.within_code And b.goods_id=c.id" +
                                   " Inner Join " + remote_db + "so_order_details d On b.within_code=d.within_code And b.mo_id=d.mo_id" +
                                   " Inner Join " + remote_db + "so_order_manage e On d.within_code=e.within_code And d.id=e.id And d.ver=e.ver" +
                                   " Inner Join " + remote_db + "it_coding f On d.within_code=f.within_code And d.p_unit=f.unit_code And b.issues_unit=f.basic_unit" +
                                   " Where a.within_code='" + within_code + "' And f.id='*'";

            if (dateFrom == "" && invFrom == "" && productMoFrom == "")
            {
                invFrom = "INV999999999";
                invTo   = "INV999999999";
            }
            if (dateFrom != "" && dateTo != "")
            {
                dateTo  = Convert.ToDateTime(dateTo).AddDays(1).ToString("yyyy/MM/dd");
                strSql += " And a.invoice_date>='" + dateFrom + "' And a.invoice_date<'" + dateTo + "'";
            }
            if (productMoFrom != "" && productMoTo != "")
            {
                strSql += " And b.mo_id>='" + productMoFrom + "' And b.mo_id<='" + productMoTo + "'";
            }
            if (invFrom != "" && invTo != "")
            {
                strSql += " And a.invoice_no>='" + invFrom + "' And a.invoice_no<='" + invTo + "'";
            }
            strSql += " Order By a.invoice_no,a.invoice_date,b.mo_id";
            DataTable dtPrint  = sh.ExecuteSqlReturnDataTable(strSql);
            decimal   totalAmt = 0;

            this.ReportViewer1.Reset();
            //this.ReportViewer1.LocalReport.Dispose();
            ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("../Reports/Sa_Iv_VatDeliveryDetails.rdlc");
            Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("dsSa_Iv_VatDeliveryDetails", dtPrint);
            //this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DSDgcf_pad", dtPrint));
            //ReportViewer1.LocalReport.DataSources.Add(
            //new Microsoft.Reporting.WebForms.ReportDataSource("DSDgcf_pad", dtPrint));

            //向報表傳遞多個參數
            List <ReportParameter> para = new List <ReportParameter>();            //这里是添加两个字段

            para.Add(new ReportParameter("totalAmt", totalAmt.ToString()));
            //para.Add(new ReportParameter("userName", "aaa"));
            ReportViewer1.LocalReport.SetParameters(para);
            ReportViewer1.LocalReport.DataSources.Add(rds);
            this.ReportViewer1.ZoomMode    = Microsoft.Reporting.WebForms.ZoomMode.Percent;
            this.ReportViewer1.ZoomPercent = 100;
            ReportViewer1.LocalReport.Refresh();

            //string doc_type_to = "相關制單";
            //string color = "N001";

            //ReportViewer1.LocalReport.ReportPath = "Reports\\sample_trace.rdlc";//Report1.rdlc;
            //ReportViewer1.LocalReport.EnableExternalImages = true;
            ////ReportViewer1.LocalReport.SetParameters(new ReportParameter(doc_type_to));//, Guid.NewGuid().ToString()

            ////向報表傳遞單個參數
            ////ReportParameter rp = new ReportParameter("doc_type_to", doc_type_to);
            ////ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
            ////向報表傳遞多個參數
            //ReportParameter[] para = new ReportParameter[3];
            //para[0] = new ReportParameter("Remark", txtRemark_head.Text);
            //para[1] = new ReportParameter("RouteDep", txtRouteDep.Text);
            //para[2] = new ReportParameter("barcode_url", barcode_url);
            //ReportViewer1.LocalReport.SetParameters(para);
            //ReportDataSource rds = new ReportDataSource("DataSet_Trace", dtPrint);
            //ReportViewer1.LocalReport.DataSources.Clear();
            //ReportViewer1.LocalReport.DataSources.Add(rds);
            //ReportViewer1.LocalReport.Refresh();
            //ReportViewer1.LocalReport.Refresh();
        }