private void button2_Click(object sender, EventArgs e)
        {
            Rahayu_Program.Report.ReportForm reportForm = new Rahayu_Program.Report.ReportForm(main);
            reportForm.MdiParent   = main;
            reportForm.WindowState = FormWindowState.Maximized;

            DataTable dt;

            dt = main.ExecuteQuery("SELECT barangID, namaBarang, nomorRak, sellPrice FROM MsBarang WHERE batasStock = 0");

            if (dt == null)
            {
                MessageBox.Show("OPEN REPORT ERROR (PRINT STOCK HABIS STATIONERY)");
                this.Dispose();
            }
            else
            {
                if (dt.Rows.Count > 0)
                {
                    Rahayu_Program.Report.Stationery.LaporanRekapAwal laporan = new Rahayu_Program.Report.Stationery.LaporanRekapAwal();
                    laporan.SetDataSource(dt);

                    reportForm.GetCrystalReportViewer().ReportSource = laporan;
                    reportForm.GetCrystalReportViewer().Refresh();

                    reportForm.Show();
                }
                else
                {
                    MessageBox.Show("DATA TIDAK ADA");
                }
            }
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            DataTable dt = main.ExecuteQuery("SELECT DISTINCT mb.barangID, mb.namaBarang, mb.stock, mb.sellPrice, mb.nomorRak FROM MsBarang mb, StationerySalesHeader ssh, StationerySalesDetail ssd WHERE mb.barangID = ssd.barangID AND ssh.stationerySalesID = ssd.stationerySalesID AND ssh.salesTime > '" + awal.ToString("yyyy-MM-dd HH:mm:ss") + "' AND ssh.salesTime < '" + akhir.ToString("yyyy-MM-dd HH:mm:ss") + "' ORDER BY mb.barangID");

            if (dt == null)
            {
                MessageBox.Show("ERROR PRINT REPORT (LAPORAN GROUP DI CLOSING FORM STATIONERY)");
                this.Dispose();
            }
            else
            {
                if (dt.Rows.Count > 0)
                {
                    Rahayu_Program.Report.Stationery.LaporanRekapAwal laporan = new Rahayu_Program.Report.Stationery.LaporanRekapAwal();
                    laporan.SetDataSource(dt);

                    buatLaporanByQuery(laporan);
                }
                else
                {
                    MessageBox.Show("DATA TIDAK ADA (LAPORAN MsBARANG DI CLOSING FORM STATIONERY)");
                }
            }
        }