예제 #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Print Laporan Perhitungan Stock. Siap kan kertas di printer."
                                               , "Print Laporan Perhitungan Stock"
                                               , MessageBoxButtons.OKCancel
                                               , MessageBoxIcon.Question
                                               , MessageBoxDefaultButton.Button2
                                               , MessageBoxOptions.DefaultDesktopOnly);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                rptSisaBarang gj = new rptSisaBarang();
                gj.ReportParameters["tanggal"].Value = dtpTanggal.Value;
                gj.ReportParameters["tipeid"].Value  = rddTipe.SelectedValue;
                gj.ReportParameters["User"].Value    = NBConfig.ValidUserName;
                IReportDocument report1 = (IReportDocument)gj;
                ////set parameters when necessary

                //// PrinterSettings
                PrinterSettings printerSettings = new PrinterSettings();
                //// Adjust the printer settings if necessary...
                try
                {
                    InstanceReportSource reportSource = new InstanceReportSource();
                    reportSource.ReportDocument = report1;

                    // Print the report using the printer settings.
                    ReportProcessor reportProcessor = new ReportProcessor();
                    reportProcessor.PrintReport(reportSource, printerSettings);

                    //print log
                    helper.PrintLog(this.Text, gj.Name, "tanggal:" + dtpTanggal.Value.ToString() +
                                    ",tipeid:" + rddTipe.SelectedValue.ToString());

                    //Process Stock Data Akhir
                    //TODO: For Tipe 1 keep data for BSJ & BJ
                    //TODO: For the rest only keep record with stock with parentid = -1
                }
                catch (Exception ex)
                {
                    helper.ErrorMessage("Ada masalah untuk print laporan stock. Segera hubungi administrator");
                    helper.SysLog(this.GetType().Name, this.Text, "ERROR : " + ex.Message + " : " + ex.StackTrace);
                }
            }
        }
예제 #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            ////On Printing Surat Jalan Make sure after printing surat jalan has been updated too
            ////printed so the next time surat jalan is printing COPY is appended to the title.
            DialogResult res = MessageBox.Show("Print Laporan Stock. Siap kan kertas di printer."
                                               , "Print Laporan Stock"
                                               , MessageBoxButtons.OKCancel
                                               , MessageBoxIcon.Question
                                               , MessageBoxDefaultButton.Button2
                                               , MessageBoxOptions.DefaultDesktopOnly);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                rptSisaBarang gj = new rptSisaBarang();
                gj.ReportParameters["tanggal"].Value = dtpTanggal.Value;
                gj.ReportParameters["tipeid"].Value  = rddTipe.SelectedValue;
                gj.ReportParameters["User"].Value    = NBConfig.ValidUserName;
                IReportDocument report1 = (IReportDocument)gj;
                ////set parameters when necessary

                //// PrinterSettings
                PrinterSettings printerSettings = new PrinterSettings();
                //// Adjust the printer settings if necessary...
                try
                {
                    InstanceReportSource reportSource = new InstanceReportSource();
                    reportSource.ReportDocument = report1;

                    // Print the report using the printer settings.
                    ReportProcessor reportProcessor = new ReportProcessor();
                    reportProcessor.PrintReport(reportSource, printerSettings);

                    //print log
                    helper.PrintLog(this.Text, gj.Name, "tanggal:" + dtpTanggal.Value.ToString() +
                                    ",tipeid:" + rddTipe.SelectedValue.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ada masalah untuk print laporan stock. Segera hubungi administrator", "SMS - Error Notification");
                }
            }
        }