コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            PrintingSalesWorkOrder rpt = new PrintingSalesWorkOrder();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void btnPrintWO_Click(object sender, EventArgs e)
        {
            DataTable dt = main.ExecuteQuery("SELECT psh.printingSalesID, salesTime, "
                                             + "parentCompanyName, companyName, customerName, "
                                             + "purchaseOrderID, deliveryNote, printingType, printingTitle, "
                                             + "jobType, CONCAT(FORMAT(quantity,0), ' ', quantityType) as quantity, "
                                             + "CONCAT(FORMAT(inschiet,0), ' ', inschietType) as inschiet, material, paperSize, "
                                             + "imageSize, sidePrint, totalPlat, description, deadline, note "
                                             + "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 dtSub2 = main.ExecuteQuery("SELECT printingSalesID, printingType, printingTitle, finishingType, detail as descriptionFinishing FROM PrintingSalesDetailFinishing 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.PrintingSalesWorkOrder laporan = new Rahayu_Program.Report.PrintingSales.PrintingSalesWorkOrder();

                    foreach (DataRow i in dt.Rows)
                    {
                        AnsBox       ans    = new AnsBox(main, i["printingType"].ToString() + ", " + i["printingTitle"].ToString() + ", cetak?");
                        DialogResult result = ans.ShowDialog();
                        if (result == System.Windows.Forms.DialogResult.OK)
                        {
                            laporan.DataSourceConnections.Clear();
                            laporan.SetDataSource(dt);
                            laporan.Subreports["PrintingSalesSubReportFinishing.rpt"].DataSourceConnections.Clear();
                            if (dtSub2.Rows.Count > 0)
                            {
                                laporan.Subreports["PrintingSalesSubReportFinishing.rpt"].SetDataSource(dtSub2);
                            }

                            //buatLaporanByQuery(laporan);

                            //direct print
                            laporan.PrintOptions.PrinterName = System.IO.File.ReadAllText(Application.StartupPath + @"\config\printer\printing-sales-wo.is");
                            laporan.PrintToPrinter(1, false, 0, 0);
                        }
                        else
                        {
                            ans    = new AnsBox(main, "batal cetak WO?");
                            result = ans.ShowDialog();
                            if (result == System.Windows.Forms.DialogResult.OK)
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("DATA TIDAK ADA (LAPORAN HARIAN DI CLOSING FORM STATIONERY)");
                }
            }
        }