Exemple #1
0
        private void btnReport_Click(object sender, EventArgs e)
        {//tjhios
            btnReport.Enabled = false;
            CrystalReport3 rpt = new CrystalReport3();

            rpt.SetParameterValue("ID", "ID: " + Selected_ID);
            rpt.SetParameterValue("USER", "Logged by:" + USER + " - Person Responsible: " + cmbPersonResponsible.Text);
            rpt.SetParameterValue("TITLE", "" + txtTitle.Text);
            rpt.SetParameterValue("DATE", "DATE LOGGED: " + txtLoggedDate.Text);
            rpt.SetParameterValue("ISSUE", "ISSUE: " + txtDescription.Text + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + " ACTION TAKEN: " + txtActionTaken.Text);;
            rpt.SetParameterValue("MEETINGTIME", "Time of meeting: .........................................");
            rpt.SetParameterValue("RESOLVED", "[ ] Resolved?");
            rpt.SetParameterValue("DISCUSSEDWITH", "Discussed With: " + cmbDiscussedWith.Text);
            rpt.SetParameterValue("DISCUSSEDWITHDATE", "Discussed Date: " + txtDiscussedDate.Text);
            rpt.SetParameterValue("CHECKEDBY", "Checked By: " + cmbCheckedBy.Text);
            rpt.SetParameterValue("CHECKEDBYDATE", "Checked Date: " + txtCheckedDate.Text);
            rpt.SetParameterValue("QUOTE", "Quote: " + txtQuote.Text);
            rpt.PrintToPrinter(1, false, 0, 0);
            MessageBox.Show("Report has been sent to your default printer!", "REPORT SENT", MessageBoxButtons.OK);

            //working code for paint shop
            //    label_test rpt = new label_test();
            //    string RAL = hiddenDGV.Rows[i].Cells[0].Value.ToString();
            //    string DOOR = hiddenDGV.Rows[i].Cells[1].Value.ToString();
            //    string FINISH = hiddenDGV.Rows[i].Cells[3].Value.ToString();
            //    string SUPPLIER = hiddenDGV.Rows[i].Cells[2].Value.ToString();
            //    rpt.SetParameterValue("RALCOLOUR", RAL);
            //    rpt.SetParameterValue("SUPPLIER", "Supplier: " + SUPPLIER);
            //    rpt.SetParameterValue("FINISH", "Finish: " + FINISH);
            //    rpt.SetParameterValue("DOORNUMBER", "Door Number: " + DOOR);
            //    rpt.PrintToPrinter(1, false, 0, 0); //this works well for auto printing
            //    insertINTO(DOOR);
            //}
        }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReport3 rpt = new CrystalReport3();

            rpt.Site = this.Site;
            return(rpt);
        }