public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PrintingSalesInvoiceKecil rpt = new PrintingSalesInvoiceKecil(); rpt.Site = this.Site; return(rpt); }
private void button1_Click(object sender, EventArgs e) { DataTable dt = main.ExecuteQuery("SELECT psh.printingSalesID, salesTime, " + "parentCompanyName, companyName, customerName, " + "tempo, purchaseOrderID, psd.printingType, psd.printingTitle, " + "jobType, CONCAT(quantity, ' ', quantityType) as quantity, " + "CONCAT(material, '; ', imageSize, '; ', sidePrint, '; ', psd.description) as description, " + "hargaMaterial, hargaOngkosCetak " + "FROM PrintingSalesHeader psh " + "LEFT JOIN PrintingSalesDetail psd ON psh.printingSalesID = psd.printingSalesID " + "LEFT JOIN MsCustomer cu ON cu.customerID = psh.customerID " + "LEFT JOIN MsCompany co ON co.companyID = cu.companyID " + "LEFT JOIN MsParentCompany pc ON co.parentCompanyID = pc.parentCompanyID " + "WHERE psh.printingSalesID = '" + salesID + "'"); DataTable dtSub = main.ExecuteQuery("SELECT * FROM PrintingSalesPayment WHERE printingSalesID = '" + salesID + "'"); if (dt == null) { MessageBox.Show("ERROR PRINT REPORT (LAPORAN HARIAN DI CLOSING FORM STATIONERY)"); this.Dispose(); } else { if (dt.Rows.Count > 0) { Rahayu_Program.Report.PrintingSales.PrintingSalesInvoiceKecil laporan = new Rahayu_Program.Report.PrintingSales.PrintingSalesInvoiceKecil(); laporan.SetDataSource(dt); laporan.Subreports["PrintingSalesSubReportPayment.rpt"].DataSourceConnections.Clear(); if (dtSub.Rows.Count > 0) { laporan.Subreports["PrintingSalesSubReportPayment.rpt"].SetDataSource(dtSub); } //buatLaporanByQuery(laporan); //direct print laporan.PrintOptions.PrinterName = System.IO.File.ReadAllText(Application.StartupPath + @"\config\printer\printing-sales-notakecil.is"); laporan.PrintToPrinter(1, false, 0, 0); } else { MessageBox.Show("DATA TIDAK ADA (LAPORAN HARIAN DI CLOSING FORM STATIONERY)"); } } }