//Método Mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NVenta.Mostrar();
     this.OcultarColumnas();
     this.dataListado.Columns["total"].DefaultCellStyle.Format = "N2";
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Ejemplo n.º 2
0
        public void actulizarVenta()
        {
            try {
                NVenta listaVenta = new NVenta();
                listaventas = listaVenta.listVenta();

                var lista = (from listarVentas in listaventas
                             select new
                {
                    listarVentas.IdVenta,
                    listarVentas.IdCartelera.Id_Cartelera,
                    Pelicula = listarVentas.IdCartelera.Id_Pelicula.Nombre,
                    Sala = listarVentas.IdCartelera.Id_Sala.nombre,
                    listarVentas.Fecha,
                    listarVentas.Hora,
                    Tickets = listarVentas.NumTicket,
                    Valor = listarVentas.IdCartelera.valor,
                    listarVentas.CostoTotal
                }).ToList();

                dgvVentas.DataSource = lista;
                dgvVentas.Columns["IdVenta"].Visible      = false;
                dgvVentas.Columns["Id_Cartelera"].Visible = false;
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 3
0
 //Método BuscarFechas
 private void BuscarFechas()
 {
     this.dataListado.DataSource = NVenta.BuscarFechas(this.dtFecha1.Value.ToString("dd/MM/yyyy"),
                                                       this.dtFecha2.Value.ToString("dd/MM/yyyy"));
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Ejemplo n.º 4
0
 //Metodo buscar nombre
 private void BuscarFecha()
 {
     this.dataListado.DataSource = NVenta.BuscarFecha(this.dtFechaInicio.Value, this.dtFechaFin.Value);
     //this.OcultarColumnas();
     Listado.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count);
     //this.dataListado.Columns[0].Visible = true;
 }
Ejemplo n.º 5
0
 //Método BuscarDetalles
 private void MostrarDetalles()
 {
     this.dataListadoDetalle.DataSource = NVenta.MostrarDetalle(this.txtIdventa.Text);
     //this.OcultarColumnas();
     //lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
     //this.datalistadoDetalle.AutoGenerateColumns = false;
 }
Ejemplo n.º 6
0
        private void Mostrar()
        {
            this.dataListado.DataSource = NVenta.reporteDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));
            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
            }
            else
            {
                decimal total = 00.00m;
                this.dataListado.Visible = true;
                Formato();
                for (int i = 0; i < dataListado.Rows.Count; i++)
                {
                    total = total + Convert.ToDecimal(dataListado.Rows[i].Cells[5].Value);
                }
                this.lblTot.Text = total.ToString();
                if (lblTipo.Text == "PAGADA-D")
                {
                    this.lblTipo.Text = "VENTA DIVIDIDA";
                }
            }
        }
 private void Mostrar_Carga_Vista()
 {
     //mio
     this.dtgvListado.DataSource = NVenta.Mostrar_Carga_Vista();
     this.OcultarColumnas();
     lblTotal.Text = "Total Registros: " + Convert.ToString(dtgvListado.Rows.Count);
 }
Ejemplo n.º 8
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try {
                EVenta datosVenta = new EVenta();

                datosVenta.IdCartelera.Id_Cartelera       = Convert.ToInt32(txtCartelera.Tag);
                datosVenta.IdCartelera.Id_Pelicula.Nombre = txtCartelera.Text;
                datosVenta.Fecha             = Convert.ToDateTime(dtpFecha.Text);
                datosVenta.Hora              = TimeSpan.Parse(dtpHora.Text);
                datosVenta.NumTicket         = Convert.ToInt32(nudNumTicket.Text);
                datosVenta.CostoTotal        = Convert.ToDecimal(txtCostoTotal.Text);
                datosVenta.IdCartelera.valor = Convert.ToDecimal(txtCostoTotal.Tag);
                NVenta agregarVenta = new NVenta();
                agregarVenta.agregarVenta(datosVenta);
                MessageBox.Show("Se guardo correctamente", "Venta Realizada", MessageBoxButtons.OK, MessageBoxIcon.Information);

                actulizarVenta();
                Limpiar();
                Deshabilitar();
                btncancelar.Enabled  = false;
                btnCartelera.Enabled = false;
                btnGuardar.Enabled   = false;
                btnImprimir.Enabled  = true;
                btnnuevo.Enabled     = true;
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
 private void MostrarDetalle()
 {
     this.dataListadoDetalle.DataSource = NVenta.MostrarDetalle(this.txtIdventa.Text);
     this.dataListadoDetalle.Columns["precio_venta"].DefaultCellStyle.Format = "N2";
     this.dataListadoDetalle.Columns["descuento"].DefaultCellStyle.Format    = "N2";
     this.dataListadoDetalle.Columns["subtotal"].DefaultCellStyle.Format     = "N2";
 }
        private void Mostrar()
        {
            if (cbProducto.SelectedIndex == -1)
            {
                MessageBox.Show("Seleccione un tipo de comprobante de la lista");
            }
            else
            {
                string fechaInicio = "";
                string fechaFin    = "";
                int    totalCan    = 0;
                if (rbAperturaCaja.Checked == true)
                {
                    //fecIn = Convert.ToDateTime(frmPrincipal.f1.lblFechaApertura.Text);
                    //fechaInicio = fecIn.ToString("yyyy-MM-dd hh:mm:ss");
                    fechaInicio = frmPrincipal.f1.lblFechaApertura.Text;
                    // fechaFin = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    fechaFin = DateTime.Now.ToString();
                }
                else if (rbElegir.Checked == true)
                {
                    fechaInicio = dtpFechaInicio.Value.ToString("yyyy-MM-dd" + " 00:00:00");
                    fechaFin    = dtpFechaFin.Value.ToString("yyyy-MM-dd" + " 23:59:59");
                }

                this.lblCaja.Text           = "0";
                this.dataListado.DataSource = NVenta.reporteVentaFechas_TipoComprobante(Convert.ToDateTime(fechaInicio), Convert.ToDateTime(fechaFin),
                                                                                        cbProducto.SelectedItem.ToString());
                decimal total = 00.00m, totalIGV = 00.00m, totalDcto = 00.00m, totalEfectivo = 00.00m, totalTarjeta = 00.00m;
                for (int i = 0; i < dataListado.Rows.Count; i++)
                {
                    //totalCan = totalCan + Convert.ToInt32(dataListado.Rows[i].Cells[4].Value.ToString());
                    total         = total + Convert.ToDecimal(dataListado.Rows[i].Cells[15].Value.ToString());
                    totalIGV      = totalIGV + Convert.ToDecimal(dataListado.Rows[i].Cells[14].Value.ToString());
                    totalDcto     = totalDcto + Convert.ToDecimal(dataListado.Rows[i].Cells[13].Value.ToString());
                    totalEfectivo = totalEfectivo + Convert.ToDecimal(dataListado.Rows[i].Cells[11].Value.ToString());
                    totalTarjeta  = totalTarjeta + Convert.ToDecimal(dataListado.Rows[i].Cells[12].Value.ToString());
                }
                lblCant.Text          = total.ToString();
                lblTotal.Text         = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
                lblTotalIgv.Text      = totalIGV.ToString();
                lblTotalDcto.Text     = totalDcto.ToString();
                lblTotalEfectivo.Text = totalEfectivo.ToString();
                lblTotalTarjeta.Text  = totalTarjeta.ToString();

                if (this.dataListado.Rows.Count == 0)
                {
                    this.dataListado.Visible = false;
                    lblCant.Text             = "0";
                    btnImprimir.Enabled      = false;
                    //ocultarColumnas();
                }
                else
                {
                    this.dataListado.Visible = true;
                    btnImprimir.Enabled      = true;
                    ocultarColumnas();
                }
            }
        }
Ejemplo n.º 11
0
 private void BtnInsertaringreso_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (TxtIdCliente.Text.Trim() == string.Empty || TxtImpuesto.Text.Trim() == string.Empty || TxtNumComprobante.Text.Trim() == string.Empty || DtDetalle.Rows.Count == 0)
         {
             this.MensajeError("Falta ingresar unos datos");
             ErrorIcono.SetError(TxtIdCliente, "Elige un proveedor");
             ErrorIcono.SetError(TxtImpuesto, "Falta agregar impuesto");
             ErrorIcono.SetError(TxtNumComprobante, "Falta agregar num comprobante");
             ErrorIcono.SetError(DgvDetalle, "Debe tener al menor un detalle");
         }
         else
         {
             Rpta = NVenta.Insertar(Convert.ToInt32(TxtIdCliente.Text.Trim()), Variables.IdUsuario, CboComprobante.Text, TxtSerieComprobante.Text.Trim(), TxtNumComprobante.Text.Trim(), Convert.ToDecimal(TxtImpuesto.Text.Trim()), Convert.ToDecimal(TxtTotal.Text.Trim()), DtDetalle);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se insertaron los datos de manera correcta");
                 this.Limpiar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 12
0
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (txtIdCliente.Text == string.Empty || txtImpuesto.Text == string.Empty || txtNumeroComprobante.Text == string.Empty || DtDetalle.Rows.Count == 0)
         {
             this.MensajeError("Falta ingresar algunos datos, serán remarcados.");
             Erroricono.SetError(txtIdCliente, "Seleccione un cliente.");
             Erroricono.SetError(txtImpuesto, "Ingrese un impuesto.");
             Erroricono.SetError(txtNumeroComprobante, "Ingrese el número del comprobante.");
             Erroricono.SetError(DgvDetalle, "Debe tener al menos un detalle.");
         }
         else
         {
             Rpta = NVenta.Insertar(Convert.ToInt32(txtIdCliente.Text), Varriables.IdUsuario, CboComprobante.Text, txtSerieComprobante.Text.Trim(), txtNumeroComprobante.Text.Trim(), Convert.ToDecimal(txtImpuesto.Text), Convert.ToDecimal(txtTotal.Text), DtDetalle);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se insertó de forma correcta el registro");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 13
0
        public void mostrarSinAbonos()
        {
            if (rbAperturaCaja.Checked)
            {
                DataTable dtSinAbono = new DataTable();
                dtSinAbono = NVenta.mostrarTotalCreditoVenta();
                if (dtSinAbono.Rows.Count > 0)
                {
                    dataListadoSinAbonr.DataSource = null;
                    dataListadoSinAbonr.Refresh();
                    dataListadoSinAbonr.DataSource = dtSinAbono;

                    decimal totalSinAbonado = 00.00m;
                    for (int k = 0; k < dataListadoSinAbonr.Rows.Count; k++)
                    {
                        totalSinAbonado = totalSinAbonado + Convert.ToDecimal(dataListadoSinAbonr.Rows[k].Cells[1].Value);
                    }
                    this.lblTotalSinAbonar.Text = totalSinAbonado.ToString();


                    dataListadoSinAbonr.Columns[0].Width = 300;
                    dataListadoSinAbonr.Columns[1].Width = 150;
                    this.dataListadoSinAbonr.ClearSelection();
                    this.dataListadoSinAbonr.ColumnHeadersDefaultCellStyle.Font        = new Font(dataListadoSinAbonr.ColumnHeadersDefaultCellStyle.Font, FontStyle.Bold);
                    this.dataListadoSinAbonr.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                    this.dataListadoSinAbonr.Font      = new Font("Roboto", 9);
                    this.dataListadoSinAbonr.GridColor = SystemColors.ActiveBorder;
                    this.lblTotalCreditos.Text         = Convert.ToString(Convert.ToDecimal(lblTotalAbonado.Text) + Convert.ToDecimal(lblTotalSinAbonar.Text));
                }
            }
            else if (rbElegir.Checked)
            {
                DataTable dtSinAbono = new DataTable();
                dtSinAbono = NVenta.mostrarTotalCreditoVentaCliente(Convert.ToInt32(cbProducto.SelectedValue));
                if (dtSinAbono.Rows.Count > 0)
                {
                    dataListadoSinAbonr.Visible    = true;
                    dataListadoSinAbonr.DataSource = null;
                    dataListadoSinAbonr.Refresh();
                    dataListadoSinAbonr.DataSource = dtSinAbono;

                    decimal totalSinAbonado = 00.00m;
                    for (int k = 0; k < dataListadoSinAbonr.Rows.Count; k++)
                    {
                        totalSinAbonado = totalSinAbonado + Convert.ToDecimal(dataListadoSinAbonr.Rows[k].Cells[1].Value);
                    }
                    this.lblTotalSinAbonar.Text = totalSinAbonado.ToString();


                    dataListadoSinAbonr.Columns[0].Width = 300;
                    dataListadoSinAbonr.Columns[1].Width = 150;
                    this.dataListadoSinAbonr.ClearSelection();
                    this.dataListadoSinAbonr.ColumnHeadersDefaultCellStyle.Font        = new Font(dataListadoSinAbonr.ColumnHeadersDefaultCellStyle.Font, FontStyle.Bold);
                    this.dataListadoSinAbonr.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                    this.dataListadoSinAbonr.Font      = new Font("Roboto", 9);
                    this.dataListadoSinAbonr.GridColor = SystemColors.ActiveBorder;
                    this.lblTotalCreditos.Text         = Convert.ToString(Convert.ToDecimal(lblTotalAbonado.Text) + Convert.ToDecimal(lblTotalSinAbonar.Text));
                }
            }
        }
Ejemplo n.º 14
0
 //Metodo Mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NVenta.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros:" + Convert.ToString(dataListado.Rows.Count);
     Registro      = (dataListado.Rows.Count);
 }
Ejemplo n.º 15
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente Desea Eliminiar los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    string Codigo;
                    string Rpta = "";
                    foreach (DataGridViewRow row in dataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo = Convert.ToString(row.Cells[1].Value);
                            Rpta   = NVenta.Eliminar(Convert.ToInt32(Codigo));

                            if (Rpta.Equals("OK"))
                            {
                                this.MensajeOK("Se Eliminó Correctamente la venta");
                            }
                            else
                            {
                                this.MensajeError(Rpta);
                            }
                        }
                    }
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 16
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = string.Empty;
                if (this.txtSerie.Text == string.Empty || this.txtCorrelativo.Text == string.Empty ||
                    this.txtIgv.Text == string.Empty || this.txtCliente.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    this.ErrorIcono.SetError(txtSerie, "Ingrese un valor");
                    this.ErrorIcono.SetError(txtCorrelativo, "Ingrese un valor");
                    this.ErrorIcono.SetError(txtIgv, "Ingrese un valor");
                    this.ErrorIcono.SetError(txtCliente, "Ingrese un valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NVenta.Insertar(
                            Convert.ToInt32(this.txtIdCliente.Text), IdTrabajador,
                            this.dtFecha.Value,
                            this.cbTipoComprobante.Text,
                            this.txtSerie.Text,
                            this.txtCorrelativo.Text,
                            Convert.ToDecimal(this.txtIgv.Text),
                            dtDetalle);

                        ////Vamos a insertar un Ingreso
                        //Rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(txtIdproveedor.Text),
                        //dtFecha.Value, cbTipo_Comprobante.Text,
                        //txtSerie.Text, txtCorrelativo.Text,
                        //Convert.ToDecimal(txtIgv.Text), "EMITIDO", dtDetalle);
                    }


                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se ingresó correctamente el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.Consultar();
                    this.LimpiarDetalle();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 17
0
        //Metodo buscar por parametro de Fechas
        private void BuscarFechas()
        {
            this.DataListadoVenta.DataSource = NVenta.BuscarFechas(this.dateTimePickerFI.Value.ToString("dd/MM/yyyy"),
                                                                   this.dateTimePickerFA.Value.ToString("dd/MM/yyyy"));

            this.OcultarColumnas();
            lbltotal.Text = "Total de Registros " + Convert.ToString(DataListadoVenta.Rows.Count);
        }
Ejemplo n.º 18
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = "";

                if (txtIdCliente.Text == string.Empty)
                {
                    Utilidades.MensajeError("Falta ingresar algunos datos.");
                    errorIcono.SetError(txtIdCliente, "Seleccione un proveedor");
                }
                else if (txtSerie.Text == string.Empty)
                {
                    Utilidades.MensajeError("Falta ingresar algunos datos.");
                    errorIcono.SetError(txtSerie, "Ingrese un valor");
                }
                else if (txtCorrelativo.Text == string.Empty)
                {
                    Utilidades.MensajeError("Falta ingresar algunos datos.");
                    errorIcono.SetError(txtCorrelativo, "Ingrese un valor");
                }
                else if (txtItbis.Text == string.Empty)
                {
                    Utilidades.MensajeError("Falta ingresar algunos datos.");
                    errorIcono.SetError(txtItbis, "Ingrese un valor");
                }
                else
                {
                    if (isNuevo)
                    {
                        respuesta = NVenta.Insertar(Convert.ToInt32(txtIdCliente.Text), iDTrabajador, dtFechaIngresoAlmacen.Value,
                                                    cbTipoComprobante.Text, txtSerie.Text, txtCorrelativo.Text, Convert.ToDecimal(txtItbis.Text), dtDetalles);
                    }

                    if (respuesta.Equals("Ok"))
                    {
                        if (isNuevo)
                        {
                            Utilidades.MensajeOK("La venta se insertó correctamente");
                        }
                    }
                    else
                    {
                        Utilidades.MensajeError(respuesta);
                    }

                    isNuevo = false;
                    HabilitarBotones();
                    Limpiar();
                    limpiarDetalle();
                    Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 19
0
        private void dataListado_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataListado.Columns["Eliminar"].Index)
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    String Codigo;
                    String Rpta = "";

                    Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["id"].Value);
                    NDetalleVenta.Eliminar(Convert.ToInt32(Codigo));
                    Rpta = NVenta.Eliminar(Convert.ToInt32(Codigo));


                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se ELimino Correctamente el Registro");
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }

                    this.Mostrar();
                }
            }
            else
            {
                if (e.ColumnIndex == dataListado.Columns["EditarVenta"].Index)
                {
                    this.txtIdVenta.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["id"].Value);
                    // this.txtFecha.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["fecha"].Value);
                    // this.txtPrecio.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["precio"].Value);
                    this.txtCliente.Text  = Convert.ToString(this.dataListado.CurrentRow.Cells["cliente_nombre"].Value);
                    this.txtEmpleado.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["empleado_nombre"].Value);
                    this.crearTabla();
                    this.buscarDetalle();
                    this.ocultarDetalle();
                    usar = true;
                    this.pListas.Visible   = false;
                    this.IsEditar          = true;
                    this.IsNuevo           = false;
                    this.pRegistro.Visible = true;
                    this.txtFecha.Focus();
                    this.cargarComboModelo();
                    this.cargarComboCliente();
                    this.cargarComboEmpleado();
                    this.sumartotal();
                }
            }

            this.cargarComboModelo();
        }
Ejemplo n.º 20
0
        //Buscar por fechas columnas en DATAGRID
        private void BuscarFechas()
        {
            string textobuscar  = dtpFechaInicial.Value.ToString("yyyy-MM-dd");
            string textobuscar2 = dtpFechaFinal.Value.ToString("yyyy-MM-dd");

            //MessageBox.Show(textobuscar + "final: " + textobuscar2);
            //codigo buscar
            this.dgvVentas.DataSource = NVenta.BuscarFechas(textobuscar, textobuscar2);
            this.OcultarColumnas();
            this.lblNumElementos.Text = "Elementos: " + Convert.ToString(this.dgvVentas.Rows.Count);
        }
Ejemplo n.º 21
0
        public void Mostrar()
        {
            this.dataListado.DataSource = NVenta.MostrarCreditosPendientes(Convert.ToInt32(cbCliente.SelectedValue));
            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
                this.btnAbonar.Enabled   = false;
                this.btnVerAbono.Enabled = true;
                DataTable dtSaldo = NAbono.MostrarSaldoCliente(Convert.ToInt32(cbCliente.SelectedValue));
                decimal   saldo   = Convert.ToDecimal(dtSaldo.Rows[0][2]);
                if (saldo <= 0)
                {
                    MessageBox.Show("No hay saldos para este cliente");
                    return;
                }
                else
                {
                    this.dataListado.DataSource = dtSaldo;
                    this.dataListado.Visible    = true;
                    this.lblBanderaAbono.Text   = "1";
                    this.ocultarColumnas1();
                    btnUltimoSaldo.Enabled = false;
                }
                //ocultarColumnas();
            }
            else
            {
                this.lblBanderaAbono.Text = "0";
                this.dataListado.Visible  = true;
                // this.btnAbonar.Enabled = true;
                this.btnVerAbono.Enabled = true;
                ocultarColumnas();
                DataTable dtSaldo = NAbono.MostrarUltimoSaldo(Convert.ToInt32(cbCliente.SelectedValue));

                if (dtSaldo.Rows.Count > 0)
                {
                    lblUltimoSaldo.Text = dtSaldo.Rows[0][0].ToString();
                    AñadirSaldo();
                }
                else
                {
                    lblUltimoSaldo.Text = "00.00";
                    AñadirSaldo();
                }
                int     nroFilas    = dataListado.Rows.Count;
                decimal ultimoSaldo = Convert.ToDecimal(dataListado.Rows[nroFilas - 1].Cells[11].Value);
                decimal ultimoCargo = Convert.ToDecimal(dataListado.Rows[nroFilas - 1].Cells[9].Value);
                decimal total       = ultimoCargo + ultimoSaldo;
                lblDeudaTotal.Text     = total.ToString();
                btnUltimoSaldo.Enabled = true;
            }
        }
Ejemplo n.º 22
0
        private void mostrarReserva()
        {
            DataTable dtReserva = new DataTable();

            dtReserva      = NVenta.mostrarReserva(Convert.ToInt32(frmVentasReservadas.f1.lblIdVenta.Text));
            dtpFecha.Value = Convert.ToDateTime(dtReserva.Rows[0][8].ToString() + "/" + dtReserva.Rows[0][7].ToString() + "/" + dtReserva.Rows[0][6].ToString());
            dtpHora.Value  = Convert.ToDateTime(dtReserva.Rows[0][4].ToString() + ":" + dtReserva.Rows[0][5].ToString());
            txtCel.Text    = dtReserva.Rows[0][1].ToString();
            txtNombre.Text = dtReserva.Rows[0][0].ToString();
            txtMotivo.Text = dtReserva.Rows[0][2].ToString();
            txtObs.Text    = dtReserva.Rows[0][3].ToString();
        }
Ejemplo n.º 23
0
        public void Imprimir()
        {
            string  cliente   = "";
            string  direccion = "";
            string  nroDoc    = "";
            string  mesa      = "";
            string  salon     = "";
            string  tel       = "";
            string  fecha     = "";
            decimal totalDcto = 00.00m;


            this.dataDetalle.DataSource = NVenta.reporteDetalleVenta(Convert.ToInt32(this.lblIdVenta.Text));

            for (int i = 0; i < dataDetalle.Rows.Count; i++)
            {
                totalDcto = totalDcto + Convert.ToInt32(dataDetalle.Rows[i].Cells[4].Value);
                dataDetalle.Columns[6].DefaultCellStyle.Format = "N2";
            }


            decimal subTotal  = Convert.ToDecimal(this.lblTotalVenta.Text) - Convert.ToDecimal(this.lblIgv.Text);
            decimal efectivo1 = 00.00m;

            if (this.lblForma.Text == "EFECTIVO")
            {
                efectivo1 = Convert.ToDecimal(this.lblTotalVenta.Text) + Convert.ToDecimal(this.lblVuelto.Text);
            }
            else if (this.lblForma.Text == "TARJETA")
            {
                efectivo1 = 00.00m;
            }
            else if (this.lblForma.Text == "MIXTO")
            {
                efectivo1 = Convert.ToDecimal(this.lblEfectivo.Text);
            }

            if (lblComprobante.Text == "FACTURA MANUAL" || lblComprobante.Text == "BOLETA MANUAL")
            {
                NImprimir_Comprobante.imprimirComRepetidoManual(this.lblSerie.Text, this.lblNumero.Text, this.lblComprobante.Text, cliente, direccion, nroDoc, salon, mesa, dataDetalle, totalDcto.ToString(), this.lblDcto.Text,
                                                                subTotal.ToString(), this.lblIgv.Text, this.lblTotalVenta.Text, efectivo1.ToString(),
                                                                this.lblTarjeta.Text, this.lblForma.Text, "Detallado", this.lblRedondeo.Text, tel, lblVuelto.Text, DateTime.Now.ToString());
                this.dataListado.ClearSelection();
            }
            else
            {
                NImprimir_Comprobante.imprimirComRepetido(this.lblNumero.Text, this.lblComprobante.Text, lblCliente.Text, lblDireccion.Text, nroDoc, salon, mesa, dataDetalle, totalDcto.ToString(),
                                                          this.lblDcto.Text, subTotal.ToString(), this.lblIgv.Text, this.lblTotalVenta.Text, efectivo1.ToString(),
                                                          this.lblTarjeta.Text, this.lblForma.Text, "Detallado", this.lblRedondeo.Text, tel, lblVuelto.Text, lblFechaGene.Text,
                                                          frmPrincipal.f1.lblUsuario.Text + frmPrincipal.f1.lblApellidos.Text, NAliento.MensajeAliento(), lblAdelanto.Text, lblSaldo.Text);
                this.dataListado.ClearSelection();
            }
        }
Ejemplo n.º 24
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //La variable que almacena si se inserto
                //o se modifico la tabla
                string Rpta = "";
                if (this.txtIdcliente.Text == string.Empty || this.txtSerie.Text == string.Empty || txtCorrelativo.Text == string.Empty || txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtCliente, "Seleccione un Proveedor");
                    errorIcono.SetError(txtSerie, "Ingrese la serie del comprobante");
                    errorIcono.SetError(txtCorrelativo, "Ingrese el número del comprobante");
                    errorIcono.SetError(txtIgv, "Ingrese el porcentaje de IGV");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        //Vamos a insertar un Ingreso
                        Rpta = NVenta.Insertar(Convert.ToInt32(txtIdcliente.Text),
                                               Idtrabajador,
                                               dtFecha.Text, cbTipo_Comprobante.Text,
                                               txtSerie.Text, txtCorrelativo.Text,
                                               Convert.ToDecimal(txtIgv.Text), dtDetalle);
                    }

                    //Si la respuesta fue OK, fue porque se
                    //o inserto la venta
                    //de forma correcta
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se insertó de forma correcta el registro");
                    }
                    else
                    {
                        //Mostramos el mensaje de error
                        this.MensajeError(Rpta);
                    }
                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 25
0
 private void Buscar()
 {
     try
     {
         DgvListado.DataSource = NVenta.ConsultaFecha(Convert.ToDateTime(datapickerInicio.Value),
                                                      Convert.ToDateTime(datapickerFinal.Value));
         this.Limpiar();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message + e.StackTrace);
     }
 }
Ejemplo n.º 26
0
 private void Buscar()
 {
     try
     {
         DgvListado.DataSource = NVenta.Buscar(TxtBuscar.Text);
         this.Formato();
         LblTotal.Text = "Total de registros: " + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 27
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = "";
                if (this.txtIDCliente.Text == string.Empty || this.txtCliente.Text == string.Empty || this.txtCantidad.Text == string.Empty || this.txtPrecio.Text == string.Empty || this.txtTotal.Text == string.Empty || this.txtIVA.Text == string.Empty || this.txtVehiculo.Text == string.Empty || this.txtIDVehiculo.Text == string.Empty || this.txtIDInventario.Text == string.Empty || this.dtpFecha_Venta.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos relevantes");
                    errorIcono.SetError(txtCantidad, "Ingrese un Valor");
                    errorIcono.SetError(txtPrecio, "Ingrese un Valor");
                    errorIcono.SetError(txtVehiculo, "Ingrese un Valor");
                    errorIcono.SetError(txtIDVehiculo, "Ingrese un Valor");
                    errorIcono.SetError(txtIDInventario, "Ingrese un Valor");
                    errorIcono.SetError(txtIDCliente, "Ingrese un Valor");
                    errorIcono.SetError(txtCliente, "Ingrese un Valor");
                    errorIcono.SetError(txtTotal, "Ingrese un Valor");
                    errorIcono.SetError(txtIVA, "Ingrese un Valor");
                    errorIcono.SetError(dtpFecha_Venta, "Ingrese un Valor");
                }
                else
                {
                    if (Convert.ToInt32(txtCantidad.Text) == 0)
                    {
                        this.MensajeError("Inventario Agotado");
                    }
                    else
                    {
                        respuesta = NVenta.Insertar(Convert.ToInt32(this.txtIDCliente.Text), Idempleado, Convert.ToInt32(this.txtIDInventario.Text), this.dtpFecha_Venta.Text, Convert.ToDecimal(this.txtIVA.Text), Convert.ToDecimal(this.txtTotal.Text));

                        if (respuesta.Equals("OK"))
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeError(respuesta);
                        }
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
                gbxListado.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 28
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtIdcliente.Text == string.Empty || this.txtSerie.Text == string.Empty || this.txtCorrelativo.Text == string.Empty ||
                    this.txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtIdcliente, "Ingrese un Valor");
                    errorIcono.SetError(txtSerie, "Ingrese un Valor");
                    errorIcono.SetError(txtCorrelativo, "Ingrese un Valor");
                    errorIcono.SetError(txtIgv, "Ingrese un Valor");
                }
                else
                {
                    errorIcono.Clear();


                    if (this.IsNuevo == true)
                    {
                        rpta = NVenta.Insertar(Convert.ToInt32(this.txtIdcliente.Text), Idtrabajador, dtFecha.Value, cbTipo_Comprobante.Text, txtSerie.Text, txtCorrelativo.Text,
                                               Convert.ToDecimal(txtIgv.Text), dtDetalle);
                    }


                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                    }

                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 29
0
        private void Mostrar()
        {
            string fechaInicio = "";
            string fechaFin    = "";
            int    totalCan    = 0;

            if (rbAperturaCaja.Checked == true)
            {
                //fecIn = Convert.ToDateTime(frmPrincipal.f1.lblFechaApertura.Text);
                //fechaInicio = fecIn.ToString("yyyy-MM-dd hh:mm:ss");
                fechaInicio = frmPrincipal.f1.lblFechaApertura.Text;
                // fechaFin = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                fechaFin = DateTime.Now.ToString();
            }
            else if (rbElegir.Checked == true)
            {
                fechaInicio = dtpFechaInicio.Value.ToString("yyyy-MM-dd" + " 00:00:00");
                fechaFin    = dtpFechaFin.Value.ToString("yyyy-MM-dd" + " 23:59:59");
            }

            //this.lblCaja.Text = "0";
            this.dataListado.DataSource = NVenta.reporteVentaFechas(Convert.ToDateTime(fechaInicio), Convert.ToDateTime(fechaFin));
            for (int i = 0; i < dataListado.Rows.Count; i++)
            {
                totalCan = totalCan + Convert.ToInt32(dataListado.Rows[i].Cells[6].Value.ToString());
            }
            //lblCant.Text = totalCan.ToString();
            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;

                btnImprimir.Enabled = false;
                //ocultarColumnas();
            }
            else
            {
                this.dataListado.Visible = true;
                btnImprimir.Enabled      = true;
                ocultarColumnas();
                decimal totalVentas = 00.00m;
                for (int i = 0; i < dataListado.Rows.Count; i++)
                {
                    totalVentas = totalVentas + Convert.ToDecimal(dataListado.Rows[i].Cells[13].Value.ToString());
                }
                lblSumaTotal.Text = totalVentas.ToString();
                rbNroComp.Checked = true;
                txtBuscar.Select();
            }
        }
Ejemplo n.º 30
0
 private void Listar()
 {
     try
     {
         DgvListado.DataSource = NVenta.Listar();
         this.Formato();
         this.Limpiar();
         labelTotal.Text = "TOTAL DE REGISTROS:" + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message + e.StackTrace);
     }
 }