agregado procesos y bd clases

This commit is contained in:
2026-04-28 11:52:16 +02:00
parent 59a774c397
commit cd2e8b8530
251 changed files with 56881 additions and 49 deletions

View File

@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using bdAsegasa.dbcontext;
namespace bdAsegasa.db
{
public partial class apuntes
{
public string NumeroCuentaTmp { get; set; }
public double SaldoCuentaTmp { get; set; }
public string DescripcionCuentaTmp { get; set; }
public static void EstableceSaldoTmp(List<apuntes> lap)
{
double SaldoAnterior = 0;
foreach (var ap in lap)
{
SaldoAnterior = SaldoAnterior + ap.Debe - ap.Haber;
ap.SaldoCuentaTmp = SaldoAnterior;
}
}
public enum TiposDocumentos
{
RECIBO = 1,
FACTURA = 2,
OTRO = 99
}
public static List<Tipo> ListaTiposDocumentos()
{
var lEstados = new List<Tipo>();
foreach (TiposDocumentos Enumeracion in Enum.GetValues(typeof(TiposDocumentos)))
{
lEstados.Add(new Tipo { id = (int)Enumeracion, Descripcion = Enumeracion.ToString().Replace("_", " ") });
}
return lEstados;
}
public double DebeAnterior(tscgestionasegasa bd, DateOnly Fecha)
{
try
{
var aps = bd.apuntes.Where(X => X.idCuenta == this.idCuenta && X.idAsientoNavigation.Fecha < Fecha).ToList();
return aps.Sum(x => x.Debe);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
public double HaberAnterior(tscgestionasegasa bd, DateOnly Fecha)
{
try
{
var aps = bd.apuntes.Where(X => X.idCuenta == this.idCuenta && X.idAsientoNavigation.Fecha < Fecha).ToList();
return aps.Sum(x => x.Haber);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
public double Saldo => Math.Round(Debe - Haber, 2);
private bool? _Conciliado;
public bool Conciliado
{
get
{
if (_Conciliado.HasValue)
{
return _Conciliado.Value;
}
else
{
if (ConciliacionActual_TMP != null)
{
if (ConciliacionActual_TMP.idconciliacion != this.idConciliacion)
{
return false;
}
else
{
return this.idConciliacion.HasValue;
}
}
else
{
return this.idConciliacion.HasValue;
}
}
}
set
{
_Conciliado = value;
if (value)
{
this.idConciliacionNavigation = this.ConciliacionActual_TMP;
}
else
{
this.idConciliacion = null;
}
}
}
public virtual conciliacionesbancarias ConciliacionActual_TMP { get; set; }
public string ConciliadoEn
{
get
{
if (ConciliacionActual_TMP != null && this.idConciliacion.HasValue && this.idConciliacion != ConciliacionActual_TMP.idconciliacion)
{
return "Nº Conc.: " + this.idConciliacion + " (" + this.idConciliacionNavigation.Año.ToString() + "-" + this.idConciliacionNavigation.Mes.ToString() + ")";
}
else
{
return "";
}
}
}
public double Diferencia => Debe - Haber;
}
public class Tipo
{
public int id { get; set; }
public string Descripcion { get; set; }
}
}