Ejemplo n.º 1
0
        private void NcfLlenarFacturas()
        {
            Cargando.Mostrar();

            // Se obtienen los datos, en base al filtro
            int      iClienteID      = (this.Cliente == null ? 0 : this.Cliente.ClienteID);
            int      iSucursalID     = Util.Entero(this.cmbNcf_Sucursal.SelectedValue);
            DateTime dDesde          = this.dtpNcf_Desde.Value.Date;
            DateTime dHasta          = this.dtpNcf_Hasta.Value.Date.AddDays(1);
            bool     bTodasLasVentas = (this.chkNcf_TodasLasVentas.Checked);

            var oLista = Datos.GetListOf <VentasView>(c =>
                                                      c.ClienteID == iClienteID &&
                                                      c.Facturada &&
                                                      c.VentaEstatusID == Cat.VentasEstatus.Cobrada &&
                                                      c.Pagado <= 0 &&
                                                      (bTodasLasVentas || iSucursalID == 0 || c.SucursalID == iSucursalID) &&
                                                      c.Fecha >= dDesde &&
                                                      c.Fecha < dHasta
                                                      );

            // Se empiezan a llenar los datos
            this.dgvNcf_Facturas.Rows.Clear();
            foreach (var oReg in oLista)
            {
                this.dgvNcf_Facturas.Rows.Add(oReg.VentaID, false, oReg.Fecha, oReg.Folio, oReg.Sucursal, oReg.Total - oReg.Pagado);
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 2
0
        protected virtual void AplicarFiltro()
        {
            Cargando.Mostrar();

            //
            int      iClienteID   = (this.oCliente == null ? 0 : this.oCliente.ClienteID);
            int      iSucursalID  = Util.Entero(this.cmbSucursal.SelectedValue);
            DateTime dDesde       = this.dtpDesde.Value.Date;
            DateTime dHastaMas1   = this.dtpHasta.Value.Date.AddDays(1);
            int      iVendedorID  = Util.Entero(this.cmbVendedor.SelectedValue);
            int      iLineaID     = Util.Entero(this.cmbLinea.SelectedValue);
            int      iMarcaID     = Util.Entero(this.cmbMarca.SelectedValue);
            string   sDescripcion = this.txtDescripcion.Text;

            var oLista = Datos.GetListOf <VentasCotizacionesDetalleAvanzadoView>(c =>
                                                                                 (iClienteID == 0 || c.ClienteID == iClienteID) &&
                                                                                 (iSucursalID == 0 || c.SucursalID == iSucursalID) &&
                                                                                 (c.Fecha >= dDesde && c.Fecha < dHastaMas1) &&
                                                                                 (iVendedorID == 0 || c.VendedorID == iVendedorID) &&
                                                                                 (iLineaID == 0 || c.LineaID == iLineaID) &&
                                                                                 (iMarcaID == 0 || c.MarcaID == iMarcaID) &&
                                                                                 (sDescripcion == "" || c.Descripcion.Contains(sDescripcion))
                                                                                 );

            // Se llena el grid
            this.dgvDatos.Rows.Clear();
            foreach (var oReg in oLista)
            {
                this.dgvDatos.Rows.Add(oReg.VentaCotizacionID, oReg.Fecha, oReg.Sucursal, oReg.Vendedor, oReg.Cliente, oReg.Cantidad
                                       , oReg.NumeroDeParte, oReg.Descripcion, oReg.Linea, oReg.Marca, oReg.Importe);
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 3
0
        private void Asignar()
        {
            // Se obtiene la cuenta correspondiente
            var frmCuenta = new MensajeObtenerValor("Selecciona la cuenta a la cual se le van a asignar los movimientos seleccionados:", Cat.CuentasBancarias.Scotiabank, MensajeObtenerValor.Tipo.Combo);

            frmCuenta.CargarCombo("BancoCuentaID", "NombreDeCuenta", Datos.GetListOf <BancoCuenta>(c => c.UsoClientes));
            int iBancoCuentaID = 0;

            if (frmCuenta.ShowDialog(Principal.Instance) == DialogResult.OK)
            {
                iBancoCuentaID = Util.Entero(frmCuenta.Valor);
            }
            else
            {
                return;
            }

            Cargando.Mostrar();

            foreach (DataGridViewRow oFila in this.dgvAsignacion.Rows)
            {
                if (Util.Logico(oFila.Cells["asi_Sel"].Value))
                {
                    int iMovID = Util.Entero(oFila.Cells["asi_BancoCuentaMovimientoID"].Value);
                    ContaProc.AsignarMovimientoBancario(iMovID, iBancoCuentaID);
                }
            }

            Cargando.Cerrar();

            this.LlenarAsignaciones();
        }
Ejemplo n.º 4
0
        private void CargarLista9500()
        {
            Cargando.Mostrar();

            int      iSucursalID = Util.Entero(this.cmbBuscarSucursal.SelectedValue);
            int      iVendedorID = Util.Entero(this.cmbBuscarVendedor.SelectedValue);
            DateTime dDesde      = this.dtpBuscarDesde.Value.Date;
            DateTime dHasta      = this.dtpBuscarHasta.Value.Date.AddDays(1);

            var oDatos = Datos.GetListOf <Lista9500View>(c => c.EstatusGenericoID == Cat.EstatusGenericos.Pendiente &&
                                                         (iSucursalID == 0 || c.SucursalID == iSucursalID) &&
                                                         (iVendedorID == 0 || c.VendedorID == iVendedorID) &&
                                                         (c.Fecha >= dDesde && c.Fecha < dHasta)
                                                         ).OrderBy(c => c.Cotizacion9500ID);

            this.dgvDatos.Rows.Clear();
            foreach (var oReg in oDatos)
            {
                this.dgvDatos.Rows.Add(oReg.Cotizacion9500ID, oReg.Fecha, oReg.Vendedor, oReg.NumeroDeParte, oReg.Descripcion
                                       , oReg.Costo, oReg.PrecioAlCliente, oReg.Anticipo, oReg.Cliente, oReg.Sucursal, oReg.Proveedor, oReg.LineaMarca);
            }

            if (this.txtBusqueda.Text != "")
            {
                this.txtBusqueda_TextChanged(this, null);
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 5
0
        private void MostrarDatos()
        {
            Cargando.Mostrar();

            DateTime dHasta  = DateTime.Now.Date.DiaPrimero().AddDays(-1);
            var      oParams = new Dictionary <string, object>();

            oParams.Add("Desde", dHasta.AddYears(-1).AddDays(1));
            oParams.Add("Hasta", dHasta);
            this.oPartesAbc = Datos.ExecuteProcedure <pauPartesAbc_Result>("pauPartesAbc", oParams);

            // Se llena el grid
            this.dgvDatos.Rows.Clear();
            int iFila;

            foreach (var oParte in this.oPartesAbc)
            {
                iFila = this.dgvDatos.Rows.Add(oParte.ParteID, oParte.NumeroDeParte, oParte.Descripcion
                                               , oParte.UtilidadUniP1, oParte.Cantidad, oParte.Utilidad
                                               , oParte.AbcDeVentas, oParte.AbcDeUtilidad, oParte.AbcDeNegocio, oParte.AbcDeProveedor, oParte.AbcDeLinea);
                this.dgvDatos.Rows[iFila].Tag = oParte;
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 6
0
        private void CargarDatosCliente(int iClienteID)
        {
            Cargando.Mostrar();

            // Se obtienen los datos base
            int iSucursalID = Util.Entero(this.cmbSucursal.SelectedValue);
            var oParams     = new Dictionary <string, object>();

            oParams.Add("ClienteID", iClienteID);
            oParams.Add("SucursalID", (iSucursalID == 0 ? null : (int?)iSucursalID));
            oParams.Add("Pagadas", this.chkPagadas.Checked);
            oParams.Add("Cobradas", this.chkCobradas.Checked);
            oParams.Add("Solo9500", this.chk9500.Checked);
            oParams.Add("OmitirDomingo", this.chkOmitirDomingos.Checked);
            oParams.Add("Desde", this.dtpDesde.Value);
            oParams.Add("Hasta", this.dtpHasta.Value);
            var oDatos = Datos.ExecuteProcedure <pauCuadroDeControlCobranza_Result>("pauCuadroDeControlCobranza", oParams);

            // Se llenan los grids
            this.CargarPorSemana(oDatos);
            this.CargarPorMes(oDatos);
            this.AplicarFormatoColumnas();

            Cargando.Cerrar();
        }
Ejemplo n.º 7
0
        private void btnReporte_Click(object sender, EventArgs e)
        {
            Cargando.Mostrar();

            var oDatos = new List <CobroCliente>();

            foreach (Control oControl in this.flpEventos.Controls)
            {
                oDatos.Add(new CobroCliente()
                {
                    Fecha    = (oControl.Controls["dtpFecha"] as DateTimePicker).Value,
                    Cliente  = oControl.Controls["lblCliente"].Text,
                    Adeudo   = Util.Decimal(oControl.Controls["lblAdeudo"].Text.SoloNumeric()),
                    Vencido  = Util.Decimal(oControl.Controls["lblVencido"].Text.SoloNumeric()),
                    Contacto = oControl.Controls["lblContacto"].Text
                });
            }

            var oRep = new Report();

            oRep.Load(UtilLocal.RutaReportes("ClientesAvisos.frx"));
            oRep.RegisterData(oDatos, "Avisos");
            Cargando.Cerrar();
            UtilLocal.EnviarReporteASalida("Reportes.Clientes.Avisos", oRep);
        }
Ejemplo n.º 8
0
        public void LlenarEventos(bool bHoy)
        {
            Cargando.Mostrar();

            DateTime dHoy           = DateTime.Now.Date;
            DateTime dManiana       = dHoy.AddDays(1);
            DateTime dPasadoManiana = dManiana.AddDays(1);
            List <ClientesEventosCalendarioView> oAlertas;

            if (bHoy)
            {
                oAlertas = Datos.GetListOf <ClientesEventosCalendarioView>(c => c.Fecha >= dHoy && c.Fecha < dManiana && !c.Revisado);
            }
            else
            {
                oAlertas = Datos.GetListOf <ClientesEventosCalendarioView>(c => c.Fecha >= dManiana && c.Fecha < dPasadoManiana && !c.Revisado);
            }
            oAlertas = oAlertas.OrderBy(c => c.Fecha).ToList();

            this.LimpiarEventos();
            foreach (var oReg in oAlertas)
            {
                /* if (oReg.Fecha < DateTime.Now)
                 *  AdmonProc.MostrarRecordatorioClientes(oReg.ClienteEventoCalendarioID);
                 * else
                 *  Program.oTimers.Add("AlertaPedido" + Program.oTimers.Count.ToString(), new System.Threading.Timer(new TimerCallback(AdmonProc.MostrarRecordatorioClientes)
                 *      , oReg.ClienteEventoCalendarioID, (int)(oReg.Fecha - DateTime.Now).TotalMilliseconds, Timeout.Infinite));
                 */

                this.AgregarEvento(oReg.ClienteEventoCalendarioID, oReg.Fecha, oReg.Cliente, oReg.Evento);
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 9
0
        private bool AccionGuardar()
        {
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();

            // Se crea el movimiento bancario
            DateTime dFecha   = this.dtpFechaMovimiento.Value;
            var      oMovBanc = new BancoCuentaMovimiento()
            {
                BancoCuentaID   = this.OrigenBancoCuentaID,
                EsIngreso       = true,
                Fecha           = dFecha,
                FechaAsignado   = dFecha,
                SucursalID      = GlobalClass.SucursalID,
                Importe         = Util.Decimal(this.txtImporte.Text),
                Concepto        = this.txtConcepto.Text,
                Referencia      = GlobalClass.UsuarioGlobal.NombreUsuario,
                TipoFormaPagoID = Cat.FormasDePago.Efectivo
            };

            ContaProc.RegistrarMovimientoBancario(oMovBanc);

            // Se crea la póliza correspondiente (AfeConta)
            ContaProc.CrearPolizaAfectacion(Cat.ContaAfectaciones.DepositoBancario, oMovBanc.BancoCuentaMovimientoID
                                            , oMovBanc.Referencia, oMovBanc.Concepto, oMovBanc.Fecha);

            Cargando.Cerrar();

            return(true);
        }
Ejemplo n.º 10
0
        protected void dgvPrincipal_CurrentCellChanged(object sender, EventArgs e)
        {
            this.dgvGrupos.Rows.Clear();
            this.dgvSemanas.Rows.Clear();
            this.dgvMeses.Rows.Clear();
            this.dgvVendedor.Rows.Clear();
            this.dgvSucursal.Rows.Clear();
            this.dgvPartes.Rows.Clear();
            if (!this.dgvPrincipal.Focused)
            {
                return;
            }

            Cargando.Mostrar();

            bool bSelNueva = this.dgvPrincipal.VerSeleccionNueva();

            if (bSelNueva)
            {
                int iId = (this.dgvPrincipal.CurrentRow == null ? 0 : Util.Entero(this.dgvPrincipal.CurrentRow.Cells["Principal_Id"].Value));
                this.LlenarGrupos(iId);
                this.LlenarSemanas(iId);
                this.LlenarMeses(iId);
                this.LLenarVendedores(iId);
                this.LlenarSucursales(iId);
                // this.dgvPartes.Rows.Clear();
            }

            Cargando.Cerrar();

            this.PrincipalCambioSel(bSelNueva);
        }
Ejemplo n.º 11
0
        private void btnCancelarFacPen_Click(object sender, EventArgs e)
        {
            if (this.dgvFacturasPorCancelar.CurrentRow == null)
            {
                UtilLocal.MensajeAdvertencia("No hay ninguna factura por cancelar seleccionada.");
                return;
            }

            this.btnCancelarFacPen.Enabled = false;
            Cargando.Mostrar();

            int    iVentaFacturaDevolucionID = Util.Entero(this.dgvFacturasPorCancelar.CurrentRow.Cells["VentaFacturaDevolucionID"].Value);
            string sFolioFiscal = Util.Cadena(this.dgvFacturasPorCancelar.CurrentRow.Cells["FolioFiscal"].Value);
            var    Res          = VentasLoc.GenerarFacturaCancelacion(sFolioFiscal, iVentaFacturaDevolucionID);

            if (Res.Exito)
            {
                this.ActualizarFacturasPorCancelar();
                Cargando.Cerrar();
            }
            else
            {
                Cargando.Cerrar();
                UtilLocal.MensajeAdvertencia("Hubo un error al cancelar la factura:\n\n" + Res.Mensaje);
            }

            this.btnCancelarFacPen.Enabled = true;
        }
Ejemplo n.º 12
0
        protected void CargarDatosCompras()
        {
            Cargando.Mostrar();

            var oParams = this.ObtenerParametrosCompras();
            var oDatos  = Datos.ExecuteProcedure <pauCuadroDeControlCompras_Result>("pauCuadroDeControlCompras", oParams);

            // Se llena el grid principal
            var oConsulta = oDatos.GroupBy(g => new { g.ProveedorID, g.Proveedor })
                            .Select(c => new { c.Key.ProveedorID, c.Key.Proveedor, Actual = c.Sum(s => s.Actual), Anterior = c.Sum(s => s.Anterior) }).OrderByDescending(c => c.Actual);
            decimal mTotal = (oConsulta.Count() > 0 ? oConsulta.Sum(c => c.Actual).Valor() : 0);

            this.dgvPrincipal.Rows.Clear();
            foreach (var oReg in oConsulta)
            {
                this.dgvPrincipal.Rows.Add(oReg.ProveedorID, oReg.ProveedorID, oReg.Proveedor, oReg.Actual, oReg.Anterior
                                           , Util.DividirONull(oReg.Actual, oReg.Anterior), (Util.DividirONull(oReg.Actual, mTotal) * 100));
            }
            // Se llenan los totales
            decimal mTotalAnt = (oConsulta.Count() > 0 ? oConsulta.Sum(c => c.Anterior).Valor() : 0);

            this.dgvPrincipalTotales["PrincipalT_Actual", 0].Value    = mTotal;
            this.dgvPrincipalTotales["PrincipalT_Anterior", 0].Value  = mTotalAnt;
            this.dgvPrincipalTotales["PrincipalT_Resultado", 0].Value = Util.DividirONull(mTotal, mTotalAnt);

            Cargando.Cerrar();
        }
Ejemplo n.º 13
0
        private void LlenarResultados()
        {
            Cargando.Mostrar();

            int iLineaID = Util.Entero(this.cmbResultadosLineas.SelectedValue);
            int iOpcion  = this.cmbResultadosCasos.SelectedIndex;

            var oDatos = Datos.GetListOf <InventarioResultadosView>(c => c.LineaID == iLineaID &&
                                                                    ((iOpcion == 0 && ((c.DiferenciaMatriz != 0 && (c.DiferenciaSuc2 != 0 || c.DiferenciaSuc3 != 0)) || (c.DiferenciaSuc2 != 0 && c.DiferenciaSuc3 != 0))) ||
                                                                     (iOpcion == 1 && (c.DiferenciaMatriz == c.DiferenciaTotal || c.DiferenciaSuc2 == c.DiferenciaTotal || c.DiferenciaSuc3 == c.DiferenciaTotal) &&
                                                                      c.DiferenciaTotal != 0) ||
                                                                     (iOpcion == 2 && c.DiferenciaMatriz == 0 && c.DiferenciaSuc2 == 0 && c.DiferenciaSuc3 == 0))
                                                                    );

            // Se llenan los datos
            this.dgvResultados.Rows.Clear();
            foreach (var oReg in oDatos)
            {
                this.dgvResultados.Rows.Add(oReg.Costo, oReg.NumeroDeParte, oReg.Descripcion, oReg.Linea, oReg.Marca
                                            , oReg.ExistenciaMatriz, oReg.DiferenciaMatriz, (oReg.DiferenciaMatriz * oReg.Costo)
                                            , oReg.ExistenciaSuc2, oReg.DiferenciaSuc2, (oReg.DiferenciaSuc2 * oReg.Costo)
                                            , oReg.ExistenciaSuc3, oReg.DiferenciaSuc3, (oReg.DiferenciaSuc3 * oReg.Costo));
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 14
0
        private void Cancelar9500(int i9500ID)
        {
            var o9500 = Datos.GetEntity <Cotizacion9500>(q => q.Cotizacion9500ID == i9500ID && q.Estatus);

            // Se valida que ya se haya cobrado la venta del anticipo
            var oVenta = Datos.GetEntity <Venta>(q => q.VentaID == o9500.AnticipoVentaID && q.Estatus);

            if (oVenta.VentaEstatusID == Cat.VentasEstatus.Realizada)
            {
                UtilLocal.MensajeAdvertencia("El 9500 seleccionado no ha sido cobrado. Para cancelarlo, cancela la Venta del anticipo desde Ventas por Cobrar.");
                return;
            }

            if (UtilLocal.MensajePregunta("¿Estás seguro que deseas cancelar el 9500 seleccionado?") == DialogResult.Yes)
            {
                var oMotivo = UtilLocal.ObtenerValor("¿Cuál es el motivo de la baja?", "", MensajeObtenerValor.Tipo.TextoLargo);
                if (oMotivo == null)
                {
                    return;
                }
                var oResU = UtilLocal.ValidarObtenerUsuario();
                if (oResU.Error)
                {
                    return;
                }

                Cargando.Mostrar();
                // Se cancela el 9500
                VentasProc.Cancelar9500(i9500ID, Util.Cadena(oMotivo), oResU.Respuesta.UsuarioID);
                Cargando.Cerrar();
                this.CargarLista9500();
            }
        }
Ejemplo n.º 15
0
        protected override void CargarDatos()
        {
            Cargando.Mostrar();

            var oParams = this.ObtenerParametros();
            var oDatos  = Datos.ExecuteProcedure <pauCuadroDeControlGeneralNuevo_Result>("pauCuadroDeControlGeneral", oParams);

            // Se llena el grid principal
            var oVendedores = this.AgruparPorEnteroCadena(oDatos.GroupBy(g => new EnteroCadenaComp()
            {
                Entero = g.VendedorID, Cadena = g.Vendedor
            }))
                              .OrderByDescending(c => c.Actual);
            decimal mTotal = (oVendedores.Count() > 0 ? oVendedores.Sum(c => c.Actual) : 0);

            this.dgvPrincipal.Rows.Clear();
            foreach (var oReg in oVendedores)
            {
                this.dgvPrincipal.Rows.Add(oReg.Llave, oReg.Llave, oReg.Cadena, oReg.Actual, oReg.Anterior
                                           , Util.DividirONull(oReg.Actual, oReg.Anterior), (Util.DividirONull(oReg.Actual, mTotal) * 100));
            }
            // Se llenan los totales
            decimal mTotalAnt = (oVendedores.Count() > 0 ? oVendedores.Sum(c => c.Anterior) : 0);

            this.dgvPrincipalTotales["PrincipalT_Actual", 0].Value    = mTotal;
            this.dgvPrincipalTotales["PrincipalT_Anterior", 0].Value  = mTotalAnt;
            this.dgvPrincipalTotales["PrincipalT_Resultado", 0].Value = Util.DividirONull(mTotal, mTotalAnt);

            // Para configurar las columnas de los grids
            base.CargarDatos();

            Cargando.Cerrar();
        }
Ejemplo n.º 16
0
        private void LlenarAsignaciones()
        {
            Cargando.Mostrar();

            bool     bTodos = this.chkAsiMostrarTodos.Checked;
            DateTime dDesde = this.dtpAsiDesde.Value.Date;
            DateTime dHasta = this.dtpAsiHasta.Value.Date.AddDays(1);

            var oPendientes = Datos.GetListOf <BancosCuentasMovimientosView>(c => (c.RelacionTabla == null || c.RelacionTabla != Cat.Tablas.VentaPagoDetalle || c.Resguardado) &&
                                                                             (!c.BancoCuentaID.HasValue ||
                                                                              (bTodos && c.Fecha >= dDesde && c.Fecha < dHasta)));

            // Se quitan todos los datos con fecha menor al 31 de Mayo, petición especial
            oPendientes = oPendientes.Where(c => c.Fecha >= new DateTime(2015, 5, 31)).ToList();

            this.dgvAsignacion.Rows.Clear();
            foreach (var oReg in oPendientes)
            {
                int iFila = this.dgvAsignacion.Rows.Add(oReg.BancoCuentaMovimientoID, false, oReg.Fecha, oReg.Sucursal, oReg.Referencia, oReg.Concepto
                                                        , string.Format("{0}-{1}", (oReg.FormaDePago == null ? "" : oReg.FormaDePago.Substring(0, 2)), oReg.DatosDePago), oReg.Importe);
                if (oReg.BancoCuentaID.HasValue)
                {
                    this.dgvAsignacion.Rows[iFila].DefaultCellStyle.ForeColor = Color.Green;
                }
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 17
0
        protected override bool AccionGuardar()
        {
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();

            MetaVendedor oReg;

            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvDatos.ObtenerId(oFila);       // Util.ConvertirEntero(oFila.Cells["__Id"].Value);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila); // Util.ConvertirEntero(oFila.Cells["__Cambio"].Value);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new MetaVendedor();
                    }
                    else
                    {
                        oReg = Datos.GetEntity <MetaVendedor>(c => c.MetaVendedorID == iId);
                    }

                    oReg.VendedorID         = Util.Entero(oFila.Cells["UsuarioID"].Value);
                    oReg.SucursalID         = Util.Entero(oFila.Cells["SucursalID"].Value);
                    oReg.EsGerente          = Util.Logico(oFila.Cells["EsGerente"].Value);
                    oReg.MetaConsiderar9500 = Util.Logico(oFila.Cells["MetaConsiderar9500"].Value);
                    oReg.SueldoFijo         = Util.Decimal(oFila.Cells["SueldoFijo"].Value);
                    oReg.SueldoMeta         = Util.Decimal(oFila.Cells["SueldoMeta"].Value);
                    oReg.SueldoMinimo       = Util.Decimal(oFila.Cells["SueldoMinimo"].Value);
                    oReg.IncrementoUtil     = Util.Decimal(oFila.Cells["IncrementoUtil"].Value);
                    oReg.IncrementoFijo     = Util.Decimal(oFila.Cells["IncrementoFijo"].Value);
                    oReg.Porcentaje9500     = Util.Decimal(oFila.Cells["Porcentaje9500"].Value);

                    Datos.Guardar <MetaVendedor>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <MetaVendedor>(c => c.MetaVendedorID == iId);
                    Datos.Eliminar <MetaVendedor>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Ejemplo n.º 18
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (this.AccionAceptar())
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     Cargando.Cerrar();
 }
Ejemplo n.º 19
0
        protected override bool AccionGuardar()
        {
            // Se valida

            /* if (!this.Validar())
             *  return false;
             */

            Cargando.Mostrar();

            MetaSucursal oReg;

            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvDatos.ObtenerId(oFila);       // Util.ConvertirEntero(oFila.Cells["__Id"].Value);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila); // Util.ConvertirEntero(oFila.Cells["__Cambio"].Value);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new MetaSucursal();
                    }
                    else
                    {
                        oReg = Datos.GetEntity <MetaSucursal>(c => c.MetaSucursalID == iId);
                    }

                    // Se llenan los datos
                    oReg.SucursalID             = Util.Entero(oFila.Cells["SucursalID"].Value);
                    oReg.UtilSucursal           = Util.Decimal(oFila.Cells["UtilSucursal"].Value);
                    oReg.UtilSucursalMinimo     = Util.Decimal(oFila.Cells["UtilSucursalMinimo"].Value);
                    oReg.UtilSucursalLargoPlazo = Util.Decimal(oFila.Cells["UtilSucursalLargoPlazo"].Value);
                    oReg.UtilGerente            = Util.Decimal(oFila.Cells["UtilGerente"].Value);
                    oReg.UtilVendedor           = Util.Decimal(oFila.Cells["UtilVendedor"].Value);
                    oReg.DiasPorSemana          = Util.Entero(oFila.Cells["DiasPorSemana"].Value);

                    Datos.Guardar <MetaSucursal>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <MetaSucursal>(c => c.MetaSucursalID == iId);
                    Datos.Eliminar <MetaSucursal>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Ejemplo n.º 20
0
        public static void AbrirEnExcel(DataGridView oGrid)
        {
            Cargando.Mostrar();
            string sArchivo = (Path.GetTempFileName() + ".csv");

            oGrid.ExportarACsv(sArchivo, true);
            System.Diagnostics.Process.Start("excel", ("\"" + sArchivo + "\""));
            Cargando.Cerrar();
        }
Ejemplo n.º 21
0
 private void txtFiltrarNumeroDeParte_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Cargando.Mostrar();
         this.dgvDatos.FiltrarContiene(this.txtFiltrarNumeroDeParte.Text, "NumeroDeParte");
         Cargando.Cerrar();
     }
 }
Ejemplo n.º 22
0
        private void CargarDatos()
        {
            Cargando.Mostrar();

            var oParams = new Dictionary <string, object>();

            DateTime dHasta = DateTime.Now.Date.DiaPrimero().AddDays(-1);

            oParams.Add("Hasta", dHasta);
            oParams.Add("Desde", dHasta.AddYears(-1).AddDays(1));
            // if (this.cmbProveedor.SelectedValue != null)
            //     oParams.Add("ProveedorID", Util.ConvertirEntero(this.cmbProveedor.SelectedValue));
            if (this.ctlProveedores.ValoresSeleccionados.Count > 0)
            {
                var oDtProveedores = Util.ListaEntityADataTable(this.ctlProveedores.ElementosSeleccionados);
                oDtProveedores.Columns.Remove("Cadena");
                oParams.Add("Proveedores/tpuTablaEnteros", oDtProveedores);
            }
            // if (this.cmbMarca.SelectedValue != null)
            //     oParams.Add("MarcaID", Util.ConvertirEntero(this.cmbMarca.SelectedValue));
            if (this.ctlMarcas.ValoresSeleccionados.Count > 0)
            {
                var oDtMarcas = Util.ListaEntityADataTable(this.ctlMarcas.ElementosSeleccionados);
                oDtMarcas.Columns.Remove("Cadena");
                oParams.Add("Marcas/tpuTablaEnteros", oDtMarcas);
            }
            // if (this.cmbLinea.SelectedValue != null)
            //     oParams.Add("LineaID", Util.ConvertirEntero(this.cmbLinea.SelectedValue));
            if (this.ctlLineas.ValoresSeleccionados.Count > 0)
            {
                var oDtLineas = Util.ListaEntityADataTable(this.ctlLineas.ElementosSeleccionados);
                oDtLineas.Columns.Remove("Cadena");
                oParams.Add("Lineas/tpuTablaEnteros", oDtLineas);
            }
            //
            var oDatos = Datos.ExecuteProcedure <pauPartesMaster_Res>("pauPartesMaster", oParams);

            int iSC = Cat.TiposDeAfectacion.SinCambios;

            this.dgvDatos.Rows.Clear();
            foreach (var oParte in oDatos)
            {
                this.dgvDatos.Rows.Add(oParte.ParteID, iSC, iSC, true
                                       , oParte.NumeroDeParte, oParte.Descripcion, oParte.ProveedorID, oParte.LineaID, oParte.MarcaParteID
                                       , oParte.MedidaID, oParte.UnidadDeEmpaque, oParte.TiempoDeReposicion
                                       , oParte.AplicaComision, oParte.EsServicio, oParte.Etiqueta, oParte.SoloUnaEtiqueta, oParte.EsPar
                                       , oParte.CodigoDeBara, oParte.Existencia, oParte.Ventas, oParte.Costo, oParte.CostoConDescuento
                                       , oParte.PorcentajeUtilidadUno, oParte.PrecioUno, oParte.PrecioUno
                                       , oParte.PorcentajeUtilidadDos, oParte.PrecioDos, oParte.PrecioDos
                                       , oParte.PorcentajeUtilidadTres, oParte.PrecioTres, oParte.PrecioTres
                                       , oParte.PorcentajeUtilidadCuatro, oParte.PrecioCuatro, oParte.PrecioCuatro
                                       , oParte.PorcentajeUtilidadCinco, oParte.PrecioCinco, oParte.PrecioCinco
                                       );
            }

            Cargando.Cerrar();
        }
Ejemplo n.º 23
0
        private void btnExportar_Click(object sender, EventArgs e)
        {
            Cargando.Mostrar();
            string sArchivo = (Path.GetTempFileName() + ".csv");

            this.dgvDatos.ExportarACsv(sArchivo, true);
            System.Diagnostics.Process.Start("excel", sArchivo);
            Cargando.Cerrar();
        }
Ejemplo n.º 24
0
        private void GuardarConciliacion()
        {
            Cargando.Mostrar();

            DateTime dFechaMenor = DateTime.MaxValue;

            foreach (DataGridViewRow oFila in this.dgvConciliacion.Rows)
            {
                int iCambio = Util.Entero(oFila.Tag);
                if (iCambio > 0)  // Hubo una modificación
                {
                    int iMovID = Util.Entero(oFila.Cells["con_BancoCuentaMovimientoID"].Value);
                    var oMov   = Datos.GetEntity <BancoCuentaMovimiento>(c => c.BancoCuentaMovimientoID == iMovID);
                    oMov.Observacion = Util.Cadena(oFila.Cells["con_Observacion"].Value);

                    // Se verifica si se modificó la fecha de asignación, para saber desde dónde re-hacer el cálculo del saldo acumulado
                    if (iCambio == 2)
                    {
                        if (oMov.FechaAsignado < dFechaMenor)
                        {
                            dFechaMenor = oMov.FechaAsignado.Valor();
                        }
                        oMov.FechaAsignado = Util.FechaHora(oFila.Cells["con_FechaAsignado"].Value);
                    }

                    // Se guarda el movimiento
                    Datos.Guardar <BancoCuentaMovimiento>(oMov);

                    // Si se marcó el checkbox, se marca como conciliado
                    if (Util.Logico(oFila.Cells["con_Sel"].Value))
                    {
                        this.ConciliarMovimiento(oMov.BancoCuentaMovimientoID);
                    }
                }
            }

            // Se verifica si hubo un cambio de orden (fecha asignado), para recalcular los saldos acumulados
            if (dFechaMenor < DateTime.MaxValue)
            {
                this.RecalcularAcumulado(dFechaMenor);
            }

            // Se mandan a conciliar los agrupados, del grid de abajo, si hubiera | y si es que no se han conciliado ya anteriormente
            foreach (DataGridViewRow oFila in this.dgvConciliacionDetalle.Rows)
            {
                if (!oFila.Cells["cnd_Sel"].ReadOnly && Util.Logico(oFila.Cells["cnd_Sel"].Value))
                {
                    int iMovID = Util.Entero(oFila.Cells["cnd_BancoCuentaMovimientoID"].Value);
                    this.ConciliarMovimiento(iMovID);
                }
            }

            // Se actualizan los datos
            this.LlenarConciliaciones();

            Cargando.Cerrar();
        }
Ejemplo n.º 25
0
        protected override bool AccionGuardar()
        {
            // Se valida
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();

            BancoCuenta oReg;

            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvDatos.ObtenerId(oFila);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new BancoCuenta();
                    }
                    else
                    {
                        oReg = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == iId);
                    }

                    // Se llenan los datos
                    oReg.NumeroDeCuenta = Util.Cadena(oFila.Cells["NumeroDeCuenta"].Value);
                    oReg.NombreDeCuenta = Util.Cadena(oFila.Cells["NombreDeCuenta"].Value);
                    oReg.BancoID        = Util.Entero(oFila.Cells["BancoID"].Value);
                    oReg.UsoProveedores = Util.Logico(oFila.Cells["UsoProveedores"].Value);
                    oReg.UsoClientes    = Util.Logico(oFila.Cells["UsoClientes"].Value);
                    oReg.EsCpcp         = Util.Logico(oFila.Cells["EsCpcp"].Value);

                    Datos.Guardar <BancoCuenta>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == iId);
                    Datos.Eliminar <BancoCuenta>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Ejemplo n.º 26
0
        private void button1_Click(object sender, EventArgs e)
        {
            Cargando.Mostrar();
            int LineaId    = Util.Entero(cmbLinea.SelectedValue);
            int SucursalID = Util.Entero(cmbSucursales.SelectedValue);

            dgvExistencias.DataSource = Datos.GetListOf <PartesExistenciasView>(c => c.Existencia > 0 && c.LineaID == LineaId && c.SucursalID == SucursalID);
            Util.OcultarColumnas(this.dgvExistencias, new string[] { "Registro", "ParteExistenciaID", "ProveedorID", "Proveedor", "MarcaID", "Marca", "LineaID", "Linea", "Costo", "CostoConDescuento", "SucursalID", "UltimaVenta", "UltimaCompra", "FolioFactura" });
            Cargando.Cerrar();
        }
Ejemplo n.º 27
0
        protected override bool AccionGuardar()
        {
            // Se valida

            /* if (!this.Validar())
             *  return false;
             */

            Cargando.Mostrar();

            VentaTicketLeyenda oReg;

            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvDatos.ObtenerId(oFila);       // Util.ConvertirEntero(oFila.Cells["__Id"].Value);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila); // Util.ConvertirEntero(oFila.Cells["__Cambio"].Value);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new VentaTicketLeyenda();
                    }
                    else
                    {
                        oReg = Datos.GetEntity <VentaTicketLeyenda>(c => c.VentaTicketLeyendaID == iId);
                    }

                    // Se llenan los datos
                    oReg.NombreLeyenda = Util.Cadena(oFila.Cells["Nombre"].Value);
                    oReg.Leyenda       = Util.Cadena(oFila.Cells["Leyenda"].Value);
                    oReg.LineaID       = Util.Entero(oFila.Cells["LineaID"].Value);
                    oReg.LineaID       = (oReg.LineaID > 0 ? oReg.LineaID : null);

                    Datos.Guardar <VentaTicketLeyenda>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <VentaTicketLeyenda>(c => c.VentaTicketLeyendaID == iId);
                    Datos.Eliminar <VentaTicketLeyenda>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Ejemplo n.º 28
0
 private void dgvSucursal_CurrentCellChanged(object sender, EventArgs e)
 {
     if (this.dgvSucursal.Focused && this.dgvSucursal.VerSeleccionNueva())
     {
         Cargando.Mostrar();
         int iIdPrincipal = (this.dgvPrincipal.CurrentRow == null ? 0 : Util.Entero(this.dgvPrincipal.CurrentRow.Cells["Principal_Id"].Value));
         int iId          = (this.dgvSucursal.CurrentRow == null ? 0 : Util.Entero(this.dgvSucursal.CurrentRow.Cells["Sucursal_Id"].Value));
         this.LlenarPartes(CuadroMultiple.GridFuente.Sucursales, iIdPrincipal, iId);
         Cargando.Cerrar();
     }
 }
Ejemplo n.º 29
0
        private void AgregarMovimiento()
        {
            var frmMov = new MovimientoBancarioGen()
            {
                Text = "Agregar movimiento"
            };

            frmMov.LlenarComboCuenta();
            frmMov.cmbBancoCuenta.SelectedValue = this.ConBancoCuentaID;
            frmMov.lblEtImporteInfo.Visible     = false;
            frmMov.lblImporteInfo.Visible       = false;
            frmMov.ActiveControl = frmMov.txtImporte;
            // Para validar los datos
            frmMov.delValidar += () =>
            {
                frmMov.ctlError.LimpiarErrores();
                if (frmMov.BancoCuentaID <= 0)
                {
                    frmMov.ctlError.PonerError(frmMov.cmbBancoCuenta, "Debes especificar una cuenta.");
                }
                if (frmMov.Importe == 0)
                {
                    frmMov.ctlError.PonerError(frmMov.txtImporte, "El importe especificado es inválido.");
                }
                if (frmMov.txtConcepto.Text == "")
                {
                    frmMov.ctlError.PonerError(frmMov.txtConcepto, "Debes especificar un concepto.", ErrorIconAlignment.BottomLeft);
                }
                return(frmMov.ctlError.Valido);
            };
            if (frmMov.ShowDialog(Principal.Instance) == DialogResult.OK)
            {
                Cargando.Mostrar();

                // Se crea el movimiento bancario
                var oMov = new BancoCuentaMovimiento
                {
                    BancoCuentaID = frmMov.BancoCuentaID,
                    EsIngreso     = (frmMov.Importe >= 0),
                    Fecha         = frmMov.dtpFecha.Value,
                    FechaAsignado = frmMov.dtpFecha.Value,
                    SucursalID    = GlobalClass.SucursalID,
                    Importe       = (frmMov.Importe > 0 ? frmMov.Importe : (frmMov.Importe * -1)),
                    Concepto      = frmMov.txtConcepto.Text,
                    Referencia    = GlobalClass.UsuarioGlobal.NombreUsuario,
                    FueManual     = true
                };
                ContaProc.RegistrarMovimientoBancario(oMov);

                Cargando.Cerrar();
                this.LlenarConciliaciones();
            }
            frmMov.Dispose();
        }
Ejemplo n.º 30
0
        private void CargarAsignacion()
        {
            Cargando.Mostrar();

            int iLineaID   = Util.Entero(this.cmbLinea.SelectedValue);
            var oCantidad  = Datos.GetListOf <InventarioLineasPartesView>(c => c.LineaID == iLineaID);
            var oCapacidad = Datos.GetListOf <InventarioUsuariosView>().OrderBy(o => o.SucursalID).ToList();

            // Se determina cuántos le corresponden a cada usuario
            var  oUsuariosCant = new Dictionary <int, int>();
            bool bUsuariosRep  = false;

            foreach (var oReg in oCantidad)
            {
                var oUsuarios = oCapacidad.Where(c => c.SucursalID == oReg.SucursalID).ToList();
                if (oUsuarios.Count <= 0)
                {
                    continue;
                }

                int iCantPorUsuario = (oReg.Partes.Valor() / oUsuarios.Count);
                foreach (var oUsuario in oUsuarios)
                {
                    if (oUsuariosCant.ContainsKey(oUsuario.InvUsuarioID))
                    {
                        bUsuariosRep = true;
                    }
                    else
                    {
                        oUsuariosCant.Add(oUsuario.InvUsuarioID, iCantPorUsuario);
                    }
                }
                int iDiferencia = (oReg.Partes.Valor() - (iCantPorUsuario * oUsuarios.Count));
                if (iDiferencia > 0)
                {
                    oUsuariosCant[oUsuarios[0].InvUsuarioID] += iDiferencia;
                }
            }
            if (bUsuariosRep)
            {
                UtilLocal.MensajeAdvertencia("Existe uno o más usuarios repetidos en las diferentes sucursales. Revisar.");
            }

            // Se llena el grid de asignación
            this.dgvAsignacionManual.Rows.Clear();
            foreach (var oReg in oCapacidad)
            {
                int iPartes = oCantidad.SingleOrDefault(c => c.SucursalID == oReg.SucursalID).Partes.Valor();
                this.dgvAsignacionManual.Rows.Add(oReg.SucursalID, oReg.InvUsuarioID, oReg.Sucursal, iPartes, oReg.Usuario, oUsuariosCant[oReg.InvUsuarioID]);
            }

            Cargando.Cerrar();
            this.btnAsignar.Enabled = true;
        }