private void cbCliente_Leave(object sender, EventArgs e)
 {
     try {
         // Validar si eligio el producto
         if (!string.IsNullOrEmpty(cbCliente.Text.Trim()))
         {
             int intIdCliente = 0;
             if (cbCliente.SelectedIndex <= 0)
             {
                 CargarVentaCliente(false, int.MinValue);
                 LimpiarDatosCliente();
             }
             else
             {
                 int.TryParse(cbCliente.SelectedValue.ToString(), out intIdCliente);
                 CargarVentaCliente(true, intIdCliente);
             }
         }
         else
         {
             if (this.Visible == true)
             {
                 DGP_Util.LiberarComboBox(cbVenta);
             }
         }
     } catch (Exception ex) {
         MostrarMensaje(ex.Message, MessageBoxIcon.Error);
     }
 }
 private void LimpiarFiltrosBusqueda()
 {
     txtCodigoVenta.Text = string.Empty;
     DGP_Util.LiberarComboBox(cbTipoDocumento);
     DGP_Util.LiberarComboBox(cbProducto);
     DGP_Util.SetDateTimeNow(dtpFechaInicial);
     DGP_Util.SetDateTimeNow(dtpFechaFinal);
     DGP_Util.LiberarGridView(dgrvVentas);
 }
 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);
 }
Esempio n. 4
0
        //private void CargarCliente() {
        //    List<BEClienteProveedor> vListaCliente = new List<BEClienteProveedor>();
        //    BEClienteProveedor oTemp = new BEClienteProveedor();
        //    oTemp.IdZona = 0;
        //    vListaCliente = new BLClienteProveedor().Listar(oTemp);
        //    //vListaCliente.Insert(0, new BEClienteProveedor(0, "CE : Cliente Eventual"));
        //    vListaCliente.Insert(0, new BEClienteProveedor(0, "--------Todos--------"));
        //    cbCliente.DataSource = vListaCliente;
        //    cbCliente.DisplayMember = "Nombre";
        //    cbCliente.ValueMember = "IdCliente";
        //}

        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. 8
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);
     }
 }
Esempio n. 10
0
        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;
                }
            }
        }
Esempio n. 11
0
 private void LimpiarControles()
 {
     txtObservacion.ResetText();
     nudPrecioAdelanto.Value = 1;
     DGP_Util.LiberarComboBox(cbCliente);
 }