Пример #1
0
        public void Insertar()
        {
            string Mensaje = "";

            System.IO.MemoryStream ms = new MemoryStream();
            this.pb_imagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] ruta_imagen = ms.GetBuffer();
            try
            {
                EMPRESA obj = new EMPRESA();
                obj.CELULAR                = txt_celular.Text == "   -   -" ? "" : txt_celular.Text.Trim();
                obj.DIRECCION              = txt_direccion.Text;
                obj.EMAIL                  = txt_email.Text.Trim();
                obj.ESLOGAN                = txt_eslogan.Text.Trim();
                obj.LOGO                   = ruta_imagen;
                obj.FAX                    = lbl_fax.Text == "   -   -" ? "" : lbl_fax.Text.Trim();
                obj.ID_EMPRESA             = Convert.ToInt32(Txt_ID.Text);
                obj.ID_TIPO_IDENTIFICACION = Convert.ToInt32(cb_tipo_identificacion.SelectedValue);
                obj.IMPRESORA              = txt_impresora.Text.Trim();
                obj.NOMBRE                 = txt_nombre.Text.Trim();
                obj.NUMERO_IDENTIFICACION  = txt_numero_identificacion.Text.Trim();
                obj.PAGINA_WEB             = txt_pagina_web.Text.Trim();
                obj.TELEFONO               = txt_telefono.Text == "   -   -" ? "" : txt_telefono.Text.Trim();

                S_Empresa.Actualizar_Empresa(obj);
                Mensaje = "Registro Actualizado con Éxito";

                S_Utilidades.Mensaje_Informacion(Mensaje);
                this.Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
Пример #2
0
        public void Insertar()
        {
            string   Mensaje = "";
            USUARIOS obj     = new USUARIOS();

            obj.CLAVE        = S_Utilidades.Encriptar_Clave(Txt_Clave.Text.Trim());
            obj.CREADO_POR   = "JMENA";
            obj.ESTADO       = Cb_Estado.Text == "Activo" ? "A" : "I";
            obj.FECHA_CREADO = DateTime.Now;
            obj.NOMBRE       = Txt_Nombre.Text.Trim();
            obj.SEXO         = Cb_Sexo.Text == "Masculino" ? "M" : "F";
            obj.USUARIO      = Txt_Usuario.Text.Trim();
            obj.TIPO         = cb_tipo.Text;
            try
            {
                if (Txt_ID.Text.Equals(""))
                {
                    S_Usuario.Insertar_Usuario(obj);
                    Mensaje = "Datos Insertados con Exito";
                }
                else
                {
                    obj.ID_USUARIO = Convert.ToInt32(Txt_ID.Text);
                    S_Usuario.Actualizar_Usuario(obj);
                    Mensaje = "Datos Actualizados con Exito";
                }
                S_Utilidades.Mensaje_Informacion(Mensaje);
                Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
Пример #3
0
        private void btn_entregar_Click(object sender, EventArgs e)
        {
            try
            {
                BD_JSYSEntities db         = new BD_JSYSEntities();
                CUADRES_DIARIOS obj_cuadre = new CUADRES_DIARIOS();
                string          fecha      = dt_fecha.Value.Date.ToString("dd/MM/yyyy");
                obj_cuadre.FECHA           = fecha;
                obj_cuadre.VALOR_ANULADO   = Convert.ToDecimal(txt_recibo_anulado.Text);
                obj_cuadre.VALOR_PAGADO    = Convert.ToDecimal(txt_recibo_pagado.Text);
                obj_cuadre.VALOR_DESCUENTO = Convert.ToDecimal(txt_valor_descuento.Text);
                obj_cuadre.VALOR_TOTAL     = Convert.ToDecimal(txt_recibo_total.Text);

                var obj = db.CUADRES_DIARIOS.Where(c => c.FECHA == fecha);

                if (obj.Count() == 0)
                {
                    S_Factura.Insertar_Cuadre_Diario(obj_cuadre);
                }
                else
                {
                    S_Factura.Actualizar_Cuadre_Diario(obj_cuadre);
                }

                S_Utilidades.Mensaje_Informacion("Cuadre Guardado Correctamente");
                Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
Пример #4
0
        public void Insertar()
        {
            string   Mensaje = "";
            CLIENTES obj     = new CLIENTES();

            obj.CASA_PROPIA           = cb_casa_propia.Text;
            obj.CELULAR               = txt_celular.Text == "   -   -" ? "" : txt_celular.Text.Trim();
            obj.CREADO_POR            = S_Utilidades.Datos_Usuario.USUARIO;
            obj.DIRECCION             = txt_direccion.Text.Trim();
            obj.DIRECCION_REFERENCIA1 = txt_direccion_referencia1.Text.Trim();
            obj.DIRECCION_REFERENCIA2 = txt_direccion_referencia2.Text.Trim();
            obj.DIRECCION_TRABAJO     = txt_direccion_trabajo.Text.Trim();
            obj.EMAIL                   = txt_email.Text.Trim();
            obj.ESTADO                  = cb_estado.Text == "Activo" ? "A" : "I";
            obj.FECHA_CREADO            = DateTime.Now;
            obj.ID_TIPO_IDENTIFICACION  = Convert.ToInt32(cb_tipo_identificacion.SelectedValue);
            obj.NOMBRE                  = txt_nombre.Text.Trim();
            obj.NOMBRE_CONYUGUE         = txt_nombre_conyugue.Text.Trim();
            obj.NOMBRE_REFERENCIA1      = txt_nombre_referencia1.Text.Trim();
            obj.NOMBRE_REFERENCIA2      = txt_nombre_referencia2.Text.Trim();
            obj.NUMERO_IDENTIFICACION   = txt_numero_identificacion.Text.Trim();
            obj.REFERENCIA              = txt_referencia.Text.Trim();
            obj.SUELDO                  = txt_sueldo.Text == "" ? 0 : Convert.ToDecimal(txt_sueldo.Text);
            obj.TELEFONO                = txt_telefono.Text == "   -   -" ? "" : txt_telefono.Text.Trim();
            obj.TELEFONO_CONYUGUE       = txt_telefono_conyugue.Text == "   -   -" ? "" : txt_telefono_conyugue.Text.Trim();
            obj.TELEFONO_REFERENCIA1    = txt_telefono_referencia1.Text == "   -   -" ? "" : txt_telefono_referencia1.Text.Trim();
            obj.TELEFONO_REFERENCIA2    = txt_telefono_referencia2.Text == "   -   -" ? "" : txt_telefono_referencia2.Text.Trim();
            obj.OBSERVACION             = txt_observacion.Text.Trim();
            obj.OBSERVACION_REFERENCIA1 = txt_observacion_referencia1.Text.Trim();
            obj.OBSERVACION_REFERENCIA2 = txt_observacion_referencia2.Text.Trim();
            try
            {
                if (txt_referencia.Enabled == true)
                {
                    S_Cliente.Insertar_Cliente(obj);
                    Mensaje = "Datos Insertados con Exito";
                }
                else
                {
                    obj.REFERENCIA = txt_referencia.Text.Trim();
                    S_Cliente.Actualizar_Cliente(obj);
                    Mensaje = "Datos Actualizados con Exito";
                }
                S_Utilidades.Mensaje_Informacion(Mensaje);
                Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
Пример #5
0
        private void btn_calcular_Click(object sender, EventArgs e)
        {
            if (dg_detalle_cuotas.Rows.Count == 0)
            {
                return;
            }
            txt_total.Text = "0";
            decimal monto = 0;

            foreach (DataGridViewRow row in dg_detalle_cuotas.Rows)
            {
                try
                {
                    if (Convert.ToBoolean(row.Cells[3].Value) == true)
                    {
                        decimal valor_cuota  = Convert.ToDecimal(row.Cells[2].Value);
                        decimal valor_pagado = Convert.ToDecimal(row.Cells[4].Value);
                        decimal diferencia   = valor_cuota - valor_pagado;

                        if ((diferencia == valor_cuota) || (valor_pagado > valor_cuota) || (valor_cuota == valor_pagado))
                        {
                            monto          = Convert.ToDecimal(row.Cells[2].Value) + Convert.ToDecimal(txt_total.Text);
                            txt_total.Text = monto.ToString("N2");
                        }
                        else if (valor_cuota > valor_pagado)
                        {
                            monto          = Convert.ToDecimal(row.Cells[4].Value) + Convert.ToDecimal(txt_total.Text);
                            txt_total.Text = monto.ToString("N2");
                        }
                    }
                }
                catch (Exception ex)
                {
                    S_Utilidades.Mensaje_Error(ex.Message);
                }
            }
        }
Пример #6
0
        public void Cargar_Permisos()
        {
            try
            {
                //Menu lateral derecho.
                var obj_1 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Menu - Mantenimientos").SingleOrDefault();
                btn_Mantenimiento.Enabled = obj_1.ACCESO == true ? true : false;

                var obj_2 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Menu - Procesos").SingleOrDefault();
                btn_procesos.Enabled = obj_2.ACCESO == true ? true : false;

                var obj_4 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Menu - Reportes").SingleOrDefault();
                btn_reportes.Enabled = obj_4.ACCESO == true ? true : false;

                var obj_5 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Menu - Consultas").SingleOrDefault();
                btn_reportes.Enabled = obj_5.ACCESO == true ? true : false;

                var obj_6 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Menu - Configuraciones").SingleOrDefault();
                btn_configuraciones.Enabled = obj_6.ACCESO == true ? true : false;

                //Botones Barra Mantenimiento
                var obj_7 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Mantenimientos - Usuarios").SingleOrDefault();
                //btn_usuario.Enabled = obj_7.ACCESO == true ? true : false;

                var obj_8 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Mantenimientos - Clientes").SingleOrDefault();
                // btn_cliente.Enabled = obj_8.ACCESO == true ? true : false;

                //Botones Barra Procesos
                var obj_10 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Procesos - Prestamos").SingleOrDefault();
                //btn_facturacion.Enabled = obj_10.ACCESO == true ? true : false;

                var obj_11 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Procesos - CXC").SingleOrDefault();
                //btn_cxc.Enabled = obj_11.ACCESO == true ? true : false;

                var obj_12 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Procesos - Cuadre Diario").SingleOrDefault();
                //btn_cuadre.Enabled = obj_12.ACCESO == true ? true : false;

                var obj_14 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Procesos - Anular Recibo").SingleOrDefault();
                //btn_anular_recibo.Enabled = obj_14.ACCESO == true ? true : false;

                //Botones Barra Reportes
                var obj_21 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Reportes - Cobros Realizados").SingleOrDefault();
                btn_rep_cobros_realizados.Enabled = obj_21.ACCESO == true ? true : false;

                var obj_22 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Reportes - Cuadre Diario").SingleOrDefault();
                //btn_rep_cuadre.Enabled = obj_22.ACCESO == true ? true : false;

                var obj_23 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Reportes - Prestamos").SingleOrDefault();
                //btn_rep_facturas.Enabled = obj_23.ACCESO == true ? true : false;

                var obj_25 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Reportes - Reimprimir Recibos").SingleOrDefault();
                //btn_rep_reimprimir_recibos.Enabled = obj_25.ACCESO == true ? true : false;

                var obj_31 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Reportes - Historial Pagos").SingleOrDefault();
                //btn_rep_historial.Enabled = obj_31.ACCESO == true ? true : false;

                //Botones Barra Consultas
                var obj_26 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Consultas - Prestamos Inactivos").SingleOrDefault();
                //btn_facturas_no_activas.Enabled = obj_26.ACCESO == true ? true : false;

                var obj_28 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Consultas - Recibos Anulados").SingleOrDefault();
                //btn_recibos_anulados.Enabled = obj_28.ACCESO == true ? true : false;

                //Botones Barra Configuraciones
                var obj_29 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Configuraciones - Empresa").SingleOrDefault();
                //btn_empresa.Enabled = obj_29.ACCESO == true ? true : false;

                var obj_30 = db.PERMISOS.Where(a => a.USUARIO == S_Utilidades.Datos_Usuario.USUARIO).Where(a => a.PANTALLA == "Configuraciones - Permisos").SingleOrDefault();
                //btn_permiso.Enabled = obj_30.ACCESO == true ? true : false;
            }
            catch
            {
                S_Utilidades.Mensaje_Error("Revisar si este Usuario tiene los Permisos Asignados");
                Close();
            }
        }
Пример #7
0
        public void Actualizar()
        {
            try
            {
                BD_JSYSEntities db = new BD_JSYSEntities();
                //insertar_factura
                FACTURAS obj_factura = new FACTURAS();
                obj_factura.ID_FACTURA       = Convert.ToInt32(txt_numero_factura.Text);
                obj_factura.ID_COBRADOR      = Convert.ToInt32(cb_cobrador.SelectedValue);
                obj_factura.ID_ESTADO        = Convert.ToInt32(cb_estado.SelectedValue);
                obj_factura.MONTO_TOTAL      = Convert.ToDecimal(txt_total.Text);
                obj_factura.NUMERO_LOTERIA   = cb_numero_loteria.Text;
                obj_factura.OBSERVACION      = txt_observacion.Text.Trim();
                obj_factura.GARANTIA1        = txt_garantia_1.Text.Trim();
                obj_factura.GARANTIA2        = txt_garantia_2.Text.Trim();
                obj_factura.GARANTIA3        = txt_garantia_3.Text.Trim();
                obj_factura.GARANTIA4        = txt_garantia_4.Text.Trim();
                obj_factura.GARANTIA5        = txt_garantia_5.Text.Trim();
                obj_factura.GARANTIA6        = txt_garantia_6.Text.Trim();
                obj_factura.GARANTIA7        = txt_garantia_7.Text.Trim();
                obj_factura.RUTA             = cb_ruta.Text;
                obj_factura.MONTO_DESCONTADO = Convert.ToDecimal(txt_descuento.Text);

                var factura = db.FACTURAS.Where(f => f.ID_FACTURA == obj_factura.ID_FACTURA).SingleOrDefault();
                if ((factura.FECHA_DESCUENTO == null || factura.FECHA_DESCUENTO.ToString() == "") && obj_factura.MONTO_DESCONTADO > 0)
                {
                    obj_factura.FECHA_DESCUENTO = DateTime.Now;
                }
                else
                {
                    obj_factura.FECHA_DESCUENTO = factura.FECHA_DESCUENTO;
                }
                S_Factura.Actualizar_Factura(obj_factura);

                if (cb_recalcular.Text == "Si")
                {
                    //insertar encabezado cuota
                    ENCABEZADO_CUOTAS obj_encabezado_cuota = new ENCABEZADO_CUOTAS();
                    obj_encabezado_cuota.CANTIADA_CUOTA      = Convert.ToInt32(txt_cantidad_cuota.Text);
                    obj_encabezado_cuota.ID_FACTURA          = Convert.ToInt32(txt_numero_factura.Text);
                    obj_encabezado_cuota.MODO_CALCULO        = cb_modo_calculo.Text;
                    obj_encabezado_cuota.FECHA_PRIMERA_CUOTA = dt_fecha_primera_cuota.Value;
                    S_Factura.Actualizar_Encabezado_Cuota(obj_encabezado_cuota);

                    //insertar detalles cuotas
                    S_Factura.Eliminar_Cuotas(Convert.ToInt32(txt_numero_factura.Text));



                    DETALLES_CUOTAS obj_detalle = new DETALLES_CUOTAS();

                    obj_detalle.ID_FACTURA   = Convert.ToInt32(txt_numero_factura.Text);
                    obj_detalle.RE_CALCULADO = "SI";

                    S_Factura.Actualizar_Cuotas(obj_detalle);

                    foreach (DataGridViewRow row in dg_detalle_cuotas.Rows)
                    {
                        DETALLES_CUOTAS obj_detalle_cuotas = new DETALLES_CUOTAS();

                        obj_detalle_cuotas.ID_FACTURA      = Convert.ToInt32(txt_numero_factura.Text);
                        obj_detalle_cuotas.NUMERO_CUOTA    = Convert.ToInt32(row.Cells[0].Value);
                        obj_detalle_cuotas.FECHA           = Convert.ToDateTime(row.Cells[1].Value);
                        obj_detalle_cuotas.MONTO_CUOTA     = Convert.ToDecimal(row.Cells[2].Value);
                        obj_detalle_cuotas.MONTO_PAGADO    = 0;
                        obj_detalle_cuotas.MONTO_PENDIENTE = Convert.ToDecimal(row.Cells[2].Value);
                        obj_detalle_cuotas.RE_CALCULADO    = "NO";
                        S_Factura.Insertar_Detalle_Cuota(obj_detalle_cuotas);
                    }
                }

                Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
Пример #8
0
        public void Insertar()
        {
            try
            {
                //insertar_factura
                FACTURAS obj_factura = new FACTURAS();
                obj_factura.CREADO_POR          = S_Utilidades.Datos_Usuario.USUARIO;
                obj_factura.CAMBIO_ESTADO_POR   = "";
                obj_factura.FECHA               = dt_fecha_factura.Value;
                obj_factura.FECHA_CAMBIO_ESTADO = "";
                obj_factura.FECHA_CREADO        = DateTime.Now;
                obj_factura.REFERENCIA          = cb_cliente.SelectedValue.ToString();
                obj_factura.ID_COBRADOR         = Convert.ToInt32(cb_cobrador.SelectedValue);
                obj_factura.ID_ESTADO           = Convert.ToInt32(cb_estado.SelectedValue);
                obj_factura.MONTO_PAGADO        = 0;
                obj_factura.MONTO_PENDIENTE     = Convert.ToDecimal(txt_total.Text);
                obj_factura.MONTO_TOTAL         = Convert.ToDecimal(txt_total.Text);
                obj_factura.NOTA_CAMBIO_ESTADO  = "";
                obj_factura.NUMERO_LOTERIA      = cb_numero_loteria.Text;
                obj_factura.OBSERVACION         = txt_observacion.Text.Trim();
                obj_factura.GARANTIA1           = txt_garantia_1.Text.Trim();
                obj_factura.GARANTIA2           = txt_garantia_2.Text.Trim();
                obj_factura.GARANTIA3           = txt_garantia_3.Text.Trim();
                obj_factura.GARANTIA4           = txt_garantia_4.Text.Trim();
                obj_factura.GARANTIA5           = txt_garantia_5.Text.Trim();
                obj_factura.GARANTIA6           = txt_garantia_6.Text.Trim();
                obj_factura.GARANTIA7           = txt_garantia_7.Text.Trim();
                obj_factura.MONTO_DESCONTADO    = 0;
                obj_factura.RUTA = cb_ruta.Text;
                S_Factura.Insertar_Factura(obj_factura);

                BD_JSYSEntities db = new BD_JSYSEntities();

                //obtener ultimo numero de factura
                int id_factura = db.FACTURAS.Max(m => m.ID_FACTURA);


                //insertar encabezado cuota
                ENCABEZADO_CUOTAS obj_encabezado_cuota = new ENCABEZADO_CUOTAS();
                obj_encabezado_cuota.CANTIADA_CUOTA      = Convert.ToInt32(txt_cantidad_cuota.Text);
                obj_encabezado_cuota.ID_FACTURA          = id_factura;
                obj_encabezado_cuota.MODO_CALCULO        = cb_modo_calculo.Text;
                obj_encabezado_cuota.FECHA_PRIMERA_CUOTA = dt_fecha_primera_cuota.Value;
                S_Factura.Insertar_Encabezado_Cuota(obj_encabezado_cuota);

                //insertar detalles cuotas
                foreach (DataGridViewRow row in dg_detalle_cuotas.Rows)
                {
                    DETALLES_CUOTAS obj_detalle_cuotas = new DETALLES_CUOTAS();

                    obj_detalle_cuotas.ID_FACTURA      = id_factura;
                    obj_detalle_cuotas.NUMERO_CUOTA    = Convert.ToInt32(row.Cells[0].Value);
                    obj_detalle_cuotas.FECHA           = Convert.ToDateTime(row.Cells[1].Value);
                    obj_detalle_cuotas.MONTO_CUOTA     = Convert.ToDecimal(row.Cells[2].Value);
                    obj_detalle_cuotas.MONTO_PAGADO    = 0;
                    obj_detalle_cuotas.MONTO_PENDIENTE = Convert.ToDecimal(row.Cells[2].Value);
                    obj_detalle_cuotas.RE_CALCULADO    = "NO";
                    S_Factura.Insertar_Detalle_Cuota(obj_detalle_cuotas);
                }
                Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }