public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            PO_instructions rpt = new PO_instructions();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        //CREATES A PDF WITH CUTTING INSTRUCTIONS
        private void create_instructions(ref string header, ref string instruc)
        {
            DataSet   ds = new DataSet();
            DataTable dx = new DataTable();

            dx.Columns.Add("BOM Items");
            dx.Columns.Add("Quantity");

            int dt_counter = 0;

            //       connection.Open();
            for (int i = 0; i < drop_ctr; i++)
            {
                DataRow dr = dx.NewRow();
                dx.Rows.Add(dr);
                dx.Rows[dt_counter][0] = drop_length[i];
                dx.Rows[dt_counter][1] = drop_qty[i];
                dt_counter++;
            }
            //       connection.Close();

            ds.Tables.Add(dx);
            ds.WriteXmlSchema("po_instruction.xml");
            PO_instructions cs = new PO_instructions();

            cs.SetDataSource(ds);
            TextObject t = (TextObject)cs.ReportDefinition.Sections[0].ReportObjects["header"];

            t.Text += header;
            TextObject ins = (TextObject)cs.ReportDefinition.Sections[2].ReportObjects["patterns"];

            ins.Text = instruc;
            crystalReportViewer1.ReportSource = cs;
            if (!System.IO.Directory.Exists("C:\\Users\\" + Environment.UserName + "\\Desktop\\INS-DUMP"))
            {
                System.IO.Directory.CreateDirectory("C:\\Users\\" + Environment.UserName + "\\Desktop\\INS-DUMP");
            }
            // cs.ExportToDisk(ExportFormatType.PortableDocFormat, "C:\\Users\\" + Environment.UserName + "\\Desktop\\INS-DUMP\\Cut Ins(" + pageno + ").pdf");
            cs.ExportToDisk(ExportFormatType.PortableDocFormat, "C:\\Users\\" + Environment.UserName + "\\Desktop\\INS-DUMP\\Cut Ins.pdf");
        }