Beispiel #1
0
        private void PreviewLabelNota(JualProduk jual, bool isPreview = true)
        {
            ICetakNotaBll cetakBll       = new CetakNotaBll(_log);
            var           listOfItemNota = cetakBll.GetNotaPenjualan(jual.jual_id);

            if (listOfItemNota.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "NotaPenjualan",
                    Value = listOfItemNota
                };

                foreach (var item in listOfItemNota)
                {
                    item.label_dari1 = txtDari1.Text;
                    item.label_dari2 = txtDari2.Text;
                    item.label_dari3 = txtDari3.Text;

                    item.label_kepada1 = txtKepada1.Text;
                    item.label_kepada2 = txtKepada2.Text;
                    item.label_kepada3 = txtKepada3.Text;
                    item.label_kepada4 = txtKepada4.Text;

                    if (_pengaturanUmum.is_singkat_penulisan_ongkir && item.ongkos_kirim > 0)
                    {
                        item.ongkos_kirim      /= 1000;
                        item.label_ongkos_kirim = item.ongkos_kirim.ToString();
                    }
                    else
                    {
                        item.label_ongkos_kirim = NumberHelper.NumberToString(item.ongkos_kirim);
                    }
                }

                var reportName = "RvLabelNotaPenjualan";

                if (isPreview)
                {
                    reportName = string.Format(_reportNameSpace, reportName);
                    var stream = _assemblyReport.GetManifestResourceStream(reportName);

                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource);
                    this.reportViewer1.LocalReport.LoadReportDefinition(stream);

                    this.reportViewer1.RefreshReport();
                }
                else
                {
                    var printReport = new ReportViewerPrintHelper(reportName, reportDataSource, printerName: _pengaturanUmum.nama_printer);
                    printReport.Print();
                }
            }
        }
Beispiel #2
0
        private void CetakNota(string jualProdukId)
        {
            ICetakNotaBll cetakBll       = new CetakNotaBll(_log);
            var           listOfItemNota = cetakBll.GetNotaPenjualan(jualProdukId);

            if (listOfItemNota.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "NotaPenjualan",
                    Value = listOfItemNota
                };

                var parameters = new List <ReportParameter>();
                parameters.Add(new ReportParameter("profil", _profil.nama_profil));
                parameters.Add(new ReportParameter("alamat", _profil.alamat));
                parameters.Add(new ReportParameter("kota", _profil.kota));
                parameters.Add(new ReportParameter("telepon", _profil.telepon));

                var printReport = new ReportViewerPrintHelper("RvNotaPenjualanProduk", reportDataSource, parameters, _pengaturanUmum.nama_printer);
                printReport.Print();
            }
        }
Beispiel #3
0
        private void CetakNota(string jualProdukId)
        {
            ICetakNotaBll cetakBll       = new CetakNotaBll(_log);
            var           listOfItemNota = cetakBll.GetNotaPenjualan(jualProdukId);

            if (listOfItemNota.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "NotaPenjualan",
                    Value = listOfItemNota
                };

                // set header nota
                var parameters = new List <ReportParameter>();
                var index      = 1;

                foreach (var item in _pengaturanUmum.list_of_header_nota)
                {
                    var paramName = string.Format("header{0}", index);
                    parameters.Add(new ReportParameter(paramName, item.keterangan));

                    index++;
                }

                // set footer nota
                var dt             = DateTime.Now;
                var kotaAndTanggal = string.Format("{0}, {1}", _profil.kota, dt.Day + " " + DayMonthHelper.GetBulanIndonesia(dt.Month) + " " + dt.Year);

                parameters.Add(new ReportParameter("kota", kotaAndTanggal));
                parameters.Add(new ReportParameter("footer", _pengguna.nama_pengguna));

                var printReport = new ReportViewerPrintHelper("RvNotaPenjualanProduk2", reportDataSource, parameters, _pengaturanUmum.nama_printer);
                printReport.Print();
            }
        }
        private void PreviewNota(JualProduk jual, bool isPreview = true)
        {
            ICetakNotaBll cetakBll       = new CetakNotaBll(_log);
            var           listOfItemNota = cetakBll.GetNotaPenjualan(jual.jual_id);

            if (listOfItemNota.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "NotaPenjualan",
                    Value = listOfItemNota
                };

                // set header nota
                var parameters = new List <ReportParameter>();
                var index      = 1;

                foreach (var item in _pengaturanUmum.list_of_header_nota)
                {
                    var paramName = string.Format("header{0}", index);
                    parameters.Add(new ReportParameter(paramName, item.keterangan));

                    index++;
                }

                foreach (var item in listOfItemNota)
                {
                    item.is_sdac = chkIsSdac.Checked;

                    if (!chkIsSdac.Checked)
                    {
                        item.kirim_kepada    = txtKepada1.Text;
                        item.kirim_alamat    = txtKepada2.Text;
                        item.kirim_kecamatan = txtKepada3.Text;
                        item.kirim_kelurahan = txtKepada4.Text;
                    }
                }

                // set footer nota
                var dt             = DateTime.Now;
                var kotaAndTanggal = string.Format("{0}, {1}", _profil.kota, dt.Day + " " + DayMonthHelper.GetBulanIndonesia(dt.Month) + " " + dt.Year);

                parameters.Add(new ReportParameter("kota", kotaAndTanggal));
                parameters.Add(new ReportParameter("footer", _pengguna.nama_pengguna));

                var reportName = jual.is_dropship ? "RvNotaPenjualanProdukTanpaLabelDropship" : "RvNotaPenjualanProdukTanpaLabel";

                if (isPreview)
                {
                    reportName = string.Format(_reportNameSpace, reportName);
                    var stream = _assemblyReport.GetManifestResourceStream(reportName);

                    this.reportViewer1.LocalReport.DataSources.Clear();
                    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource);
                    this.reportViewer1.LocalReport.LoadReportDefinition(stream);

                    if (!(parameters == null))
                    {
                        this.reportViewer1.LocalReport.SetParameters(parameters);
                    }

                    this.reportViewer1.RefreshReport();
                }
                else
                {
                    var printReport = new ReportViewerPrintHelper(reportName, reportDataSource, parameters, _pengaturanUmum.nama_printer);
                    printReport.Print();
                }
            }
        }