private void LimpiarDatosCliente()
 {
     vg_decTara       = decimal.Zero;
     vg_intIdVenta    = int.MinValue;
     vg_intIdProducto = int.MinValue;
     lblProducto.ResetText();
     lblTotalBruto.ResetText();
     lblTotalTara.ResetText();
     lblTotalNeto.ResetText();
     DGP_Util.EnableControl(dgrvDevolucion, false);
     dgrvDevolucion.AllowUserToAddRows = false;
     DGP_Util.LiberarGridView(dgrvDevolucion);
 }
 private void ResetearFormulario()
 {
     if (cbProducto.DataSource != null)
     {
         DGP_Util.LiberarComboBox(cbProducto);
     }
     DGP_Util.EnabledComboBox(cbProducto, false);
     //DGP_Util.EnableControl(nudPrecioAmortizacion, false);
     //DGP_Util.EnableControl(btnAplicarMonto, false);
     DGP_Util.EnableControl(btnGrabar, false);
     DGP_Util.EnableControl(btnCancelar, false);
     DGP_Util.LiberarGridView(dgrvAmortizacion);
     LimpiarFormulario();
 }
 private void ResetearFormulario()
 {
     vg_intIdVenta    = int.MinValue;
     vg_intIdProducto = int.MinValue;
     vg_decTara       = decimal.Zero;
     gv_decTotalNeto  = decimal.Zero;
     vg_strCantidad   = string.Empty;
     vg_strPesoBruto  = string.Empty;
     vg_strPesoTara   = string.Empty;
     DGP_Util.LiberarComboBox(cbCliente);
     DGP_Util.LiberarComboBox(cbVenta);
     LimpiarDatosCliente();
     DGP_Util.EnableControl(btnAceptarDevolucion, false);
 }
 private void cbVenta_SelectedIndexChanged(object sender, EventArgs e)
 {
     try {
         // Validar si eligio una Ventas
         if (cbVenta.SelectedIndex > 0)
         {
             int.TryParse(cbVenta.SelectedValue.ToString(), out vg_intIdVenta);
             // Obtener datos de la Venta
             BEVenta oBEVenta = new BLVenta().ObtenerVenta(vg_intIdVenta);
             if (oBEVenta != null)
             {
                 BEProductoCliente oBEProductoCliente = new BEProductoCliente();
                 oBEProductoCliente.IdCliente  = oBEVenta.IdCliente;
                 oBEProductoCliente.IdProducto = oBEVenta.IdProducto;
                 vg_decTara = new BLProductoCliente().ObtenerTara(oBEProductoCliente);
                 // Establecer los datos
                 vg_intIdProducto   = oBEVenta.IdProducto;
                 lblProducto.Text   = oBEVenta.Producto;
                 lblPrecio.Text     = oBEVenta.Precio.ToString("#.00");;
                 lblTotalBruto.Text = oBEVenta.TotalPesoBruto.ToString();
                 lblTotalTara.Text  = oBEVenta.TotalPesoTara.ToString();
                 lblTotalNeto.Text  = oBEVenta.TotalPesoNeto.ToString();
                 DGP_Util.LiberarGridView(dgrvDevolucion);
                 DGP_Util.EnableControl(dgrvDevolucion, true);
                 dgrvDevolucion.AllowUserToAddRows = true;
                 DGP_Util.EnableControl(btnAceptarDevolucion, true);
             }
         }
         else
         {
             vg_decTara       = decimal.Zero;
             vg_intIdVenta    = int.MinValue;
             vg_intIdProducto = int.MinValue;
             lblProducto.ResetText();
             lblPrecio.ResetText();
             lblTotalBruto.ResetText();
             lblTotalTara.ResetText();
             lblTotalNeto.ResetText();
             DGP_Util.EnableControl(dgrvDevolucion, false);
             dgrvDevolucion.AllowUserToAddRows = false;
             DGP_Util.LiberarGridView(dgrvDevolucion);
             DGP_Util.EnableControl(btnAceptarDevolucion, false);
         }
     } catch (Exception ex) {
         MostrarMensaje(ex.Message, MessageBoxIcon.Error);
     }
 }
 private void InicializarFormulario()
 {
     DGP_Util.LiberarComboBox(cbCliente);
     DGP_Util.EnabledComboBox(cbCliente, true);
     DGP_Util.LiberarComboBox(cbProducto);
     DGP_Util.EnabledComboBox(cbProducto, false);
     //DGP_Util.EnableControl(nudPrecioAmortizacion, false);
     //DGP_Util.EnableControl(btnAplicarMonto, false);
     DGP_Util.EnableControl(btnGrabar, false);
     DGP_Util.EnableControl(btnCancelar, false);
     LimpiarFormulario();
     CargarCliente();
     // Definir al Usuario
     CargarUsuarios();
     dtpFechaPago.Value      = DateTime.Now.Date;
     cbUsuario.SelectedValue = VariablesSession.BEUsuarioSession.IdPersonal;
 }
Esempio n. 6
0
        private void cmbClientes_Leave(object sender, EventArgs e)
        {
            try
            {
                int intIdCliente = 0;
                if (this.cmbClientes.SelectedIndex >= 0)
                {
                    BEClienteProveedor oBEClienteProveedor = (BEClienteProveedor)this.cmbClientes.SelectedItem;

                    int.TryParse(cmbClientes.SelectedValue.ToString(), out intIdCliente);
                    CargarProductoCliente(intIdCliente);
                    DGP_Util.EnabledComboBox(cbProducto, true);
                    CargarAmortizaciones(Convert.ToInt32(cmbClientes.SelectedValue), 0);
                    DGP_Util.EnableControl(nudMontoDocumento, true);
                    CargarAmortizacionesSinAplicar(intIdCliente);

                    //if (cmbClientes.SelectedIndex > 0)
                    //{
                    //    int.TryParse(cmbClientes.SelectedValue.ToString(), out intIdCliente);
                    //    CargarProductoCliente(intIdCliente);
                    //    DGP_Util.EnabledComboBox(cbProducto, true);
                    //    CargarAmortizaciones(Convert.ToInt32(cmbClientes.SelectedValue), 0);
                    //    DGP_Util.EnableControl(nudMontoDocumento, true);
                    //    CargarAmortizacionesSinAplicar(intIdCliente);
                    //}
                    //else
                    //{
                    //    ResetearFormulario();
                    //}

                    //MostrarMensaje(oBEClienteProveedor.IdCliente.ToString() + oBEClienteProveedor.Nombre, MessageBoxIcon.Information);
                }
                else
                {
                    ResetearFormulario();
                }
            }
            catch (Exception ex)
            {
                this.MostrarMensaje("" + ex.Message, MessageBoxIcon.Error);
            }
        }
 private void cbCliente_SelectedIndexChanged(object sender, EventArgs e)
 {
     try {
         int intIdCliente = 0;
         if (cbCliente.SelectedIndex > 0)
         {
             int.TryParse(cbCliente.SelectedValue.ToString(), out intIdCliente);
             CargarProductoCliente(intIdCliente);
             DGP_Util.EnabledComboBox(cbProducto, true);
             CargarAmortizaciones(Convert.ToInt32(cbCliente.SelectedValue), 0);
             DGP_Util.EnableControl(nudPrecioAmortizacion, true);
         }
         else
         {
             ResetearFormulario();
         }
     } catch (Exception ex) {
         MostrarMensaje(ex.Message, MessageBoxIcon.Error);
     }
 }
        private void CargarAmortizaciones(int pIdCliente, int pIdProducto)
        {
            VistaAmortizacion oEntidad = new VistaAmortizacion();

            oEntidad.IdCliente  = pIdCliente;
            oEntidad.IdProducto = pIdProducto;
            List <VistaAmortizacion> vLista = new List <VistaAmortizacion>();

            vLista = new BLAmortizacionVenta().Listar(oEntidad);
            dgrvAmortizacion.DataSource = vLista;
            // Validar Controles
            if (vLista.Count > 0)
            {
                DGP_Util.EnableControl(btnGrabar, true);
                DGP_Util.EnableControl(btnCancelar, true);
            }
            else
            {
                DGP_Util.EnableControl(btnGrabar, false);
                DGP_Util.EnableControl(btnCancelar, false);
            }
            // Habilitar solamente las Ventas
            oCeldaPagoCuenta = new DataGridViewCellStyle();
            oCeldaPagoCuenta.SelectionBackColor = Color.Silver;
            oCeldaPagoCuenta.BackColor          = Color.Silver;
            foreach (DataGridViewRow vRow in dgrvAmortizacion.Rows)
            {
                // Obtener Indicador
                object oIndicador = vRow.Cells[ePosicionCol.Indicador.GetHashCode()].Value;
                if (oIndicador.ToString() == "0")
                {
                    vRow.Cells[ePosicionCol.Cantidad.GetHashCode()].Value = "";
                    vRow.Cells[ePosicionCol.PesoNeto.GetHashCode()].Value = "";
                    vRow.Cells[ePosicionCol.Saldo.GetHashCode()].Value    = "";
                    vRow.Cells[ePosicionCol.Pago.GetHashCode()].Value     = "";
                    vRow.Cells[ePosicionCol.Pago.GetHashCode()].ReadOnly  = true;
                    vRow.Cells[ePosicionCol.Pago.GetHashCode()].Style     = oCeldaPagoCuenta;
                }
            }
        }