Esempio n. 1
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            try
            {
                string impresora = "";

                if (rbTicket.Checked == true)
                {
                    impresora = DatBox.Obtener_ImpresoraTicket(serialPC, "TICKET");
                }
                else if (rbA4.Checked == true)
                {
                    impresora = DatBox.Obtener_ImpresoraTicket(serialPC, "RECIBO");
                }

                reporte = new PrintDocument();
                reporte.PrinterSettings.PrinterName = impresora;

                if (reporte.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);
            }
        }
Esempio n. 2
0
        public void Actualizar_ImpresoraTicket(Box b)
        {
            int filasAfectadas = new DatBox().Actualizar_ImpresoraTicket(b);

            if (filasAfectadas != 1)
            {
                throw new ApplicationException("Ocurrió un error al actualizar los datos");
            }
        }
Esempio n. 3
0
        public void Agregar_Caja(Box b)
        {
            int filasAfectadas = new DatBox().Insertar_Caja(b);

            if (filasAfectadas != 1)
            {
                throw new ApplicationException("Ocurrio un error al insertar");
            }
        }
Esempio n. 4
0
        public Box showBoxBySerial(string serial)
        {
            DataRow dr = new DatBox().selectBoxBySerial(serial);
            Box     b  = new Box();

            b.Id          = Convert.ToInt32(dr["Id_Caja"].ToString());
            b.Descripcion = dr["Descripcion"].ToString();

            return(b);
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        private void DibujarCaja()
        {
            try
            {
                DataTable dt = new DatBox().ObtenerTipoCaja();

                foreach (DataRow item in dt.Rows)
                {
                    Panel      p1         = new Panel();
                    Panel      p2         = new Panel();
                    PictureBox pb1        = new PictureBox();
                    PictureBox pb2        = new PictureBox();
                    Label      lbl1       = new Label();
                    Label      lbl2       = new Label();
                    Label      lbl3       = new Label();
                    Label      lblUsuario = new Label();
                    Panel      pnlTop     = new Panel();
                    Panel      pnlBottom  = new Panel();
                    Panel      pnlSide    = new Panel();

                    lbl1.Text      = item["Descripcion"].ToString();
                    lbl1.Name      = item["Id_Caja"].ToString();
                    lbl1.Size      = new System.Drawing.Size(175, 25);
                    lbl1.Font      = new System.Drawing.Font("Microsoft Sans Serif", 20);
                    lbl1.BackColor = Color.Transparent;
                    lbl1.AutoSize  = false;
                    lbl1.ForeColor = Color.Black;
                    lbl1.Dock      = DockStyle.Fill;
                    lbl1.TextAlign = ContentAlignment.MiddleCenter;

                    lblUsuario.Text      = item["Nombre"].ToString();
                    lblUsuario.Dock      = DockStyle.Bottom;
                    lblUsuario.AutoSize  = false;
                    lblUsuario.TextAlign = ContentAlignment.MiddleCenter;
                    lblUsuario.BackColor = Color.Transparent;
                    lblUsuario.ForeColor = Color.Black;
                    lblUsuario.Font      = new System.Drawing.Font("Microsoft Sans Serif", 12);
                    lblUsuario.Size      = new System.Drawing.Size(430, 31);

                    pnlCPrincipal.Size        = new System.Drawing.Size(210, 130);
                    pnlCPrincipal.BorderStyle = BorderStyle.None;
                    p1.BackColor = Color.Transparent;

                    p2.Size      = new System.Drawing.Size(210, 30);
                    p2.Dock      = DockStyle.Bottom;
                    p2.BackColor = Color.Transparent;

                    lbl2.Text      = item["Estado"].ToString();
                    lbl2.Size      = new System.Drawing.Size(210, 30);
                    lbl2.Font      = new System.Drawing.Font("Microsoft Sans Serif", 10);
                    lbl1.BackColor = Color.Transparent;
                    lbl1.AutoSize  = false;
                    lbl1.ForeColor = Color.Black;
                    lbl1.Dock      = DockStyle.Fill;
                    lbl1.TextAlign = ContentAlignment.MiddleCenter;

                    p2.Controls.Add(lbl2);
                    p1.Controls.Add(p2);
                    // p1.Controls.Add(lbl1);
                    p1.Controls.Add(lblUsuario);
                    pnlCPrincipal.Controls.Add(p1);
                    lblUsuario.BringToFront();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error al mostrar los datos : " + ex.Message, "Configuacion de caja", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 7
0
        private void btnAbonar_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtMontoAbonar.Text))
                {
                    MessageBox.Show("Ingrese la cantidad a Abonar", "Datos necesarios", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    txtMontoAbonar.Focus();
                }
                else
                {
                    string  _strEstadoPago = Convert.ToDecimal(txtMontoAbonar.Text) >= Convert.ToDecimal(txtSaldoActual.Text) ? "PAGADO" : "PENDIENTE";
                    decimal _saldo         = Convert.ToDecimal(txtPendienteLiquidar.Text) <= 0 ? 0 : Convert.ToDecimal(txtPendienteLiquidar.Text);
                    int     _idVenta       = Convert.ToInt32(lblIdVenta.Text);
                    decimal abonado        = Convert.ToDecimal(txtPendienteLiquidar.Text) <= 0 ? Convert.ToDecimal(txtSaldoActual.Text) : Convert.ToDecimal(txtMontoAbonar.Text);
                    decimal efectivo       = Convert.ToDecimal(lblTotalAbonado.Text) + Convert.ToDecimal(txtMontoAbonar.Text);

                    new BusVentas().Actualizar_VentaACredito(_idVenta, _saldo, _strEstadoPago, efectivo);

                    #region BITACORA PAGO CLIENTE

                    ManagementObject mos      = new ManagementObject(@"Win32_PhysicalMedia='\\.\PHYSICALDRIVE0'");
                    string           serialPC = mos.Properties["SerialNumber"].Value.ToString().Trim();
                    int idUsuario             = new BusUser().ObtenerUsuario(EncriptarTexto.Encriptar(serialPC)).Id;

                    DatCatGenerico.Agregar_BitacoraCliente(_idVenta, idUsuario, abonado);
                    #endregion


                    #region TICKET
                    rptComprobanteAbono _rpt = new rptComprobanteAbono();
                    DataTable           dt   = new DatVenta().Obtener_ComprobanteCredito(_idVenta, abonado);
                    _rpt.tbCobro.DataSource = dt;
                    _rpt.DataSource         = dt;

                    reportViewer1.Report = _rpt;
                    reportViewer1.RefreshReport();

                    pnlVistaTicket.Visible = true;
                    #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);
                    }


                    LimpiarCampos();
                    ListarVentar_PorCobrar("");
                    MessageBox.Show("Abono realizado correctamente", "Éxito!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, "Error de actulizacion de pagos a crédito", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }