Primera versión
This commit is contained in:
112
bdHerramientaCACOA/CosteDirectoIndirecto.cs
Normal file
112
bdHerramientaCACOA/CosteDirectoIndirecto.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using bdHerramientaCACOA.db;
|
||||
using Mysqlx.Expr;
|
||||
using static bdHerramientaCACOA.CASA;
|
||||
|
||||
namespace bdHerramientaCACOA
|
||||
{
|
||||
public class CosteDirectoIndirecto
|
||||
{
|
||||
public CosteDirectoIndirecto() {
|
||||
CalcularDatos();
|
||||
}
|
||||
public CosteDirectoIndirecto(int NumeroTrabajadores,double CosteMinimo,double CosteMaximo, int JornadaLaboral, double HorasProduccionMedia,double porcentajeCostesVariables,double IPCCosteIndirecto) {
|
||||
this._porcentajeCostesVariables = porcentajeCostesVariables;
|
||||
this._JornadaLaboral = JornadaLaboral;
|
||||
this._HorasProdMedia = Math.Round(HorasProduccionMedia / 100,2, MidpointRounding.AwayFromZero);
|
||||
this._NumeroTrabajadores = NumeroTrabajadores;
|
||||
this._CosteMinimoPersonal= Math.Round(CosteMinimo, 2, MidpointRounding.AwayFromZero);
|
||||
this._CosteMaximoPersonal = Math.Round(CosteMaximo, 2, MidpointRounding.AwayFromZero);
|
||||
this._IPCCosteIndirecto = IPCCosteIndirecto;
|
||||
CalcularDatos();
|
||||
}
|
||||
private double _IPCCosteIndirecto = 0;
|
||||
public double IPCCosteIndirecto
|
||||
{
|
||||
get { return _IPCCosteIndirecto; }
|
||||
set
|
||||
{
|
||||
_IPCCosteIndirecto = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _JornadaLaboral = 0;
|
||||
public int JornadaLaboral
|
||||
{
|
||||
get { return _JornadaLaboral; }
|
||||
set
|
||||
{
|
||||
_JornadaLaboral = value;
|
||||
CalcularDatos();
|
||||
}
|
||||
}
|
||||
private double _HorasProdMedia = 0;
|
||||
public double HorasProdMedia
|
||||
{
|
||||
get { return _HorasProdMedia; }
|
||||
set
|
||||
{
|
||||
_HorasProdMedia = value;
|
||||
CalcularDatos();
|
||||
}
|
||||
}
|
||||
private double _porcentajeCostesVariables = 0;
|
||||
public double PorcentajeCostesVariables
|
||||
{
|
||||
get { return _porcentajeCostesVariables; }
|
||||
set
|
||||
{
|
||||
_porcentajeCostesVariables = value;
|
||||
CalcularDatos();
|
||||
}
|
||||
}
|
||||
|
||||
private int _NumeroTrabajadores = 0;
|
||||
public int NumeroTrabajadores {
|
||||
get { return _NumeroTrabajadores; }
|
||||
set {
|
||||
_NumeroTrabajadores = value;
|
||||
CalcularDatos();
|
||||
} }
|
||||
private double _CosteMinimoPersonal = 0;
|
||||
public double CosteMinimoPersonal
|
||||
{
|
||||
get { return _CosteMinimoPersonal; }
|
||||
set
|
||||
{
|
||||
_CosteMinimoPersonal = value;
|
||||
CalcularDatos();
|
||||
}
|
||||
}
|
||||
private double _CosteMaximoPersonal = 0;
|
||||
public double CosteMaximoPersonal
|
||||
{
|
||||
get { return _CosteMaximoPersonal; }
|
||||
set
|
||||
{
|
||||
_CosteMaximoPersonal = value;
|
||||
CalcularDatos();
|
||||
}
|
||||
}
|
||||
public double HorasProduccionAnuales { get; set; } = 0;
|
||||
public double CosteMedioPersonal { get; set; } = 0;
|
||||
public double CostesDirectos { get; set; } = 0;
|
||||
public double CostesIndirectos { get; set; } = 0;
|
||||
public double CostesVariables { get; set; } = 0;
|
||||
public double TotalDespachoProfesional { get; set; } = 0;
|
||||
|
||||
public void CalcularDatos() {
|
||||
HorasProduccionAnuales = Math.Round(NumeroTrabajadores * JornadaLaboral * HorasProdMedia, 0, MidpointRounding.AwayFromZero);
|
||||
CosteMedioPersonal= Math.Round((CosteMaximoPersonal + CosteMinimoPersonal)/2, 2, MidpointRounding.AwayFromZero);
|
||||
CostesDirectos = Math.Round((CosteMedioPersonal/HorasProduccionAnuales), 2, MidpointRounding.AwayFromZero);
|
||||
CostesIndirectos = Math.Round((-2.535 * Math.Log(NumeroTrabajadores) + 10.753)* IPCCosteIndirecto, 2, MidpointRounding.AwayFromZero);
|
||||
CostesVariables= Math.Round((CostesDirectos+CostesIndirectos)*PorcentajeCostesVariables, 2, MidpointRounding.AwayFromZero);
|
||||
TotalDespachoProfesional = Math.Round(CostesDirectos + CostesIndirectos+CostesVariables, 2, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user