コード例 #1
0
        private string NumeroATexto(string _strtotal)
        {
            string total = _strtotal;

            total = decimal.Parse(total).ToString("##0.00");
            int    numero   = Convert.ToInt32(Math.Floor(Convert.ToDouble(total)));
            string strTotal = Convertir_NumeroLetra.Conversion_Total_a_Letra(numero);

            string[] a = total.Split('.');
            string   strTotalDecimal    = a[1];
            string   strTotalConvertido = strTotal + " " + strTotalDecimal + "/100 M.N";

            return(strTotalConvertido);
        }
コード例 #2
0
        private void ImprimirTicket(Venta venta)
        {
            #region TICKET
            string textoNumero = Convertir_NumeroLetra.NumeroATexto(venta.MontoTotal.ToString());
            // DataTable dt = DatDetalleVenta.ObtenerDatos_Ticket(venta.Id, textoNumero);
            ParametrosReporte reporte = DatVenta.Consultar_Ticket_Parametro(venta.Id);
            reporte.LetraNumero = textoNumero;

            //rptTicket rptTicket = new rptTicket();
            ReportTicket rptTicket = new ReportTicket();
            rptTicket.tbTicket.DataSource = reporte.lstDetalleVenta;
            rptTicket.DataSource          = reporte;
            reportViewer1.Report          = rptTicket;
            reportViewer1.RefreshReport();
            #endregion

            try
            {
                string impresora = DatBox.Obtener_ImpresoraTicket(serialPC, "TICKET");
                TICKET = new PrintDocument();
                TICKET.PrinterSettings.PrinterName = impresora;

                if (TICKET.PrinterSettings.IsValid)
                {
                    PrinterSettings printerSettings = new PrinterSettings();
                    printerSettings.PrinterName = impresora;

                    ReportProcessor reportProcessor = new ReportProcessor();
                    reportProcessor.PrintReport(reportViewer1.ReportSource, printerSettings);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al imprimir el ticket : " + ex.Message, "Error de impresión", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }