2026-01-30-v2
This commit is contained in:
107
bdGrupoSanchoToro/extensiones/asientos.cs
Normal file
107
bdGrupoSanchoToro/extensiones/asientos.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using FluentFTP.Helpers;
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace bdGrupoSanchoToro.db
|
||||
{
|
||||
public partial class asientos
|
||||
{
|
||||
public enum TipoAsiento : int
|
||||
{
|
||||
NORMAL = 0,
|
||||
APERTURA = 1,
|
||||
REGULARIZACION = 2
|
||||
}
|
||||
|
||||
public string Cuentas
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.apuntes.Count > 10)
|
||||
return "** MÁS DE 10 **";
|
||||
else
|
||||
{
|
||||
string sCuentas = "";
|
||||
foreach (var ap in this.apuntes)
|
||||
sCuentas += ap.idCuentaNavigation.NumeroCuenta + " ";
|
||||
return sCuentas.Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Documentos
|
||||
{
|
||||
get
|
||||
{
|
||||
string sDocumentos = "";
|
||||
foreach (var ap in this.apuntes.ToList().Where(x => x.NumeroDocumento != null && x.NumeroDocumento != "").GroupBy(x => x.NumeroDocumento))
|
||||
sDocumentos += ap.First().NumeroDocumento + " ";
|
||||
return sDocumentos.Trim();
|
||||
}
|
||||
}
|
||||
public string Conceptos
|
||||
{
|
||||
get
|
||||
{
|
||||
string sDocumentos = "";
|
||||
foreach (var ap in this.apuntes.ToList().GroupBy(x => x.Concepto))
|
||||
sDocumentos += ap.First().Concepto + " ";
|
||||
return sDocumentos.Trim();
|
||||
}
|
||||
}
|
||||
public int? idAsiento_Nulable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.idAsiento == 0)
|
||||
return null;
|
||||
else
|
||||
return this.idAsiento;
|
||||
}
|
||||
}
|
||||
public void RellenaCuentaTmp()
|
||||
{
|
||||
foreach (var ap in this.apuntes)
|
||||
{
|
||||
|
||||
ap.NumeroCuentaTmp = ap.idCuentaNavigation.NumeroCuenta;
|
||||
ap.DescripcionCuentaTmp = ap.idCuentaNavigation.Denominacion;
|
||||
}
|
||||
}
|
||||
|
||||
public void RefrescaExtensiones()
|
||||
{
|
||||
OnPropertyChanged("EjercicioTmp");
|
||||
OnPropertyChanged("idAsiento_Nulable");
|
||||
}
|
||||
|
||||
public static cuentas ObtieneCuenta(tscGrupoSanchoToro bd, string cta, int idEjercicio)
|
||||
{
|
||||
var cuenta = bd.cuentas.FirstOrDefault(x => x.NumeroCuenta == cta & x.idEjercicio == idEjercicio);
|
||||
if (cuenta == null)
|
||||
{
|
||||
var ctaant = bd.cuentas.Where(x => x.NumeroCuenta == cta).OrderByDescending(x => x.idEjercicioNavigation.FechaInicio).FirstOrDefault();
|
||||
if (ctaant != null)
|
||||
cuenta = bdGrupoSanchoToro.db.cuentas.CreaCuenta(bd, idEjercicio, cta, ctaant.Denominacion, ctaant.Observaciones);
|
||||
}
|
||||
return cuenta;
|
||||
}
|
||||
private string _Ejercicio;
|
||||
public string EjercicioTmp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Ejercicio == "" && idEjercicioNavigation != null)
|
||||
_Ejercicio = idEjercicioNavigation.Descripcion;
|
||||
return _Ejercicio;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Ejercicio = value;
|
||||
OnPropertyChanged("EjercicioTmp");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user