Example #1
0
        public void VistaPreviaNotaCreditoCliente(Notacreditocli notacreditocliMnt)
        {
            Tipocp tipocp = Service.GetTipocp(x => x.Idtipocp == notacreditocliMnt.Idtipocp);

            const string nameRelation = "ventas.vwnotacreditocliimpresion";
            string       whereList    = string.Format("idnotacreditocli = {0}", notacreditocliMnt.Idnotacreditocli);
            const string ordersList   = "numeroitem";
            const string fieldsList   = "*";

            DataTable dt = HelperDb.SqlConsulta(nameRelation, whereList, ordersList, fieldsList);

            dt.TableName = "cp";

            if (string.IsNullOrEmpty(tipocp.Nombrereporte))
            {
                XtraMessageBox.Show("No se asignó un formato de impresión", "Atención", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                return;
            }

            //ImporteLetras
            string importeDocumentoLetra = UtilityReport.ToNumberLetters(notacreditocliMnt.Totaldocumento.ToString(CultureInfo.InvariantCulture));
            string nameReporte           = FilesHelper.FindingFileName(Application.StartupPath, string.Format("Reportes\\Ventas\\{0}", tipocp.Nombrereporte.Trim()));

            switch (tipocp.Tiporeporteador)
            {
            case 0:     //FastReport
                Report fastReport = new Report();

                fastReport.Load(nameReporte);
                fastReport.RegisterData(dt, "cp");
                fastReport.RegisterData(VwSucursalList, "emp");
                fastReport.SetParameterValue("ImporteDocLetras", importeDocumentoLetra);

                ReportHelper1 reportHelper1 = new ReportHelper1(fastReport);
                reportHelper1.ShowDialog();

                break;

            case 1:     //XtraReport

                //XtraReport xtraReport = new XtraReport { DataSource = dt };
                //xtraReport.LoadLayout(nameReporte);

                //Parametros
                object[] parametrosReporte =
                {
                    importeDocumentoLetra
                };

                ReportHelper2 reportHelper2 = new ReportHelper2(nameReporte, dt, parametrosReporte, "NotaCreditoCliente");
                reportHelper2.ShowDialog();
                break;
            }
        }
Example #2
0
        public void FormatoCpVentaImpresora(int idCpVenta)
        {
            const string nameRelation = "ventas.vwcpventaimpresion";
            string       whereList    = string.Format("idcpventa = {0}", idCpVenta);
            const string ordersList   = "numeroitem";
            const string fieldsList   = "*";

            DataTable dtCpVenta = HelperDb.SqlConsulta(nameRelation, whereList, ordersList, fieldsList);

            dtCpVenta.TableName = "cp";

            DataRow row = dtCpVenta.Rows[0];

            string  nombreArchivoReporte = row["nombrereporte"].ToString();
            decimal totalDocumento       = Convert.ToDecimal(row["totaldocumento"]);
            string  nombreTipoMoneda     = row["nombretipomoneda"].ToString();
            string  nombreReporte        = string.Format("{0} {1}-{2}", row["nombretipoformato"].ToString().Trim(), row["seriecpventa"].ToString().Trim(), row["numerocpventa"].ToString().Trim());

            if (string.IsNullOrEmpty(nombreArchivoReporte))
            {
                XtraMessageBox.Show("No se asignó un formato de impresión", "Atención", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                return;
            }

            string importeDocumentoLetra  = string.Format("{0} {1}", UtilityReport.ToNumberLetters(totalDocumento.ToString(CultureInfo.InvariantCulture)), nombreTipoMoneda);
            string nombreArchivoImpresion = FilesHelper.FindingFileName(Application.StartupPath, string.Format("Reportes\\Ventas\\{0}", nombreArchivoReporte));

            object[] parametrosReporte =
            {
                importeDocumentoLetra
            };

            XtraReportCustom report = PrepareReport(dtCpVenta, parametrosReporte, nombreArchivoImpresion, nombreReporte);

            report.PrintDialog();
        }
Example #3
0
        public void FormatoCpVenta(Cpventa cpventa)
        {
            Tipocp tipocp = Service.GetTipocp(x => x.Idtipocp == cpventa.Idtipocp);

            const string nameRelation = "ventas.vwcpventaimpresion";
            string       whereList    = string.Format("idcpventa = {0}", cpventa.Idcpventa);
            const string ordersList   = "numeroitem";
            const string fieldsList   = "*";

            DataTable dt = HelperDb.SqlConsulta(nameRelation, whereList, ordersList, fieldsList);

            dt.TableName = "cp";

            if (string.IsNullOrEmpty(tipocp.Nombrereporte))
            {
                XtraMessageBox.Show("No se asignó un formato de impresión", "Atención", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                return;
            }

            VwCpventa vwCpventa = Service.GetVwCpventa(cpventa.Idcpventa);

            //ImporteLetras
            string importeDocumentoLetra = string.Format("{0} {1}", UtilityReport.ToNumberLetters(cpventa.Totaldocumento.ToString(CultureInfo.InvariantCulture)), vwCpventa.Nombretipomoneda);

            string nameReporte = FilesHelper.FindingFileName(Application.StartupPath, string.Format("Reportes\\Ventas\\{0}", tipocp.Nombrereporte.Trim()));

            switch (tipocp.Tiporeporteador)
            {
            case 0:     //FastReport
                Report fastReport = new Report();

                fastReport.Load(nameReporte);
                fastReport.RegisterData(dt, "cp");
                fastReport.RegisterData(VwSucursalList, "emp");
                fastReport.SetParameterValue("ImporteDocLetras", importeDocumentoLetra);

                ReportHelper1 reportHelper1 = new ReportHelper1(fastReport);
                reportHelper1.ShowDialog();

                break;

            case 1:     //XtraReport

                //XtraReport xtraReport = new XtraReport { DataSource = dt };
                //xtraReport.LoadLayout(nameReporte);
                //xtraReport.parameters["TotalDocumentoLetra"].Value = importeDocLetras;
                //xtraReport.RequestParameters = false;
                //xtraReport.ShowPreviewDialog();

                //Parametros
                object[] parametrosReporte =
                {
                    importeDocumentoLetra
                };

                ReportHelper2 reportHelper2 = new ReportHelper2(nameReporte, dt, parametrosReporte, "ComprobanteVenta");
                reportHelper2.ShowDialog();

                //XRDesignFormEx xRDesignFormEx = new XRDesignFormEx();
                //xRDesignFormEx.OpenReport(report);
                //xRDesignFormEx.DesignPanel.FileName = nameReporte;
                //xRDesignFormEx.ShowDialog();

                break;
            }
        }