Include rental fees in payday
This commit is contained in:
@@ -43,6 +43,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Finanzhilfe : ~g~+$" + (int)Economy.Paychecks[user.Id].FinancialHelp);
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Finanzhilfe : ~g~+$" + (int)Economy.Paychecks[user.Id].FinancialHelp);
|
||||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Fahrzeugsteuer : ~r~-$" + Economy.Paychecks[user.Id].VehicleTaxation);
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Fahrzeugsteuer : ~r~-$" + Economy.Paychecks[user.Id].VehicleTaxation);
|
||||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Grundsteuer (Haus) : ~r~-$" + Economy.Paychecks[user.Id].PropertyTaxation);
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Grundsteuer (Haus) : ~r~-$" + Economy.Paychecks[user.Id].PropertyTaxation);
|
||||||
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Mietkosten : ~r~-$" + Economy.Paychecks[user.Id].RentalFees);
|
||||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Einkommen Steuer : ~r~" + (int)(Economy.Paychecks[user.Id].FinancialInterest * 100) + " %");
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Einkommen Steuer : ~r~" + (int)(Economy.Paychecks[user.Id].FinancialInterest * 100) + " %");
|
||||||
ChatService.SendMessage(client, "");
|
ChatService.SendMessage(client, "");
|
||||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Ausgaben : ~r~-$" + (Economy.Paychecks[user.Id].Wage - Economy.Paychecks[user.Id].Amount));
|
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Ausgaben : ~r~-$" + (Economy.Paychecks[user.Id].Wage - Economy.Paychecks[user.Id].Amount));
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using ReallifeGamemode.Server.Entities;
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Models;
|
using ReallifeGamemode.Server.Models;
|
||||||
@@ -158,15 +159,25 @@ namespace ReallifeGamemode.Server.Finance
|
|||||||
(int bankAccount, float financialHelp, float financialInterest) = GetEconomyClass(client, wage);
|
(int bankAccount, float financialHelp, float financialInterest) = GetEconomyClass(client, wage);
|
||||||
float propertyTax = GetPropertyTaxation(client);
|
float propertyTax = GetPropertyTaxation(client);
|
||||||
int vehicleTaxation = GetVehicleTaxation(client);
|
int vehicleTaxation = GetVehicleTaxation(client);
|
||||||
|
int rentalFees = GetRentalFees(client);
|
||||||
|
|
||||||
int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp;
|
int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp;
|
||||||
|
|
||||||
Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount);
|
Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees);
|
||||||
User user = client.GetUser();
|
User user = client.GetUser();
|
||||||
Paychecks[user.Id] = paycheck;
|
Paychecks[user.Id] = paycheck;
|
||||||
ReleasePayDay(client, paycheck);
|
ReleasePayDay(client, paycheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int GetRentalFees(Client client)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User user = client.GetUser();
|
||||||
|
return dbContext.HouseRentals.Where(h => h.UserId == user.Id).Include(h => h.House).Sum(h => h.House.RentalFee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ReleasePayDay(Client client, Paycheck paycheck)
|
public static void ReleasePayDay(Client client, Paycheck paycheck)
|
||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ namespace ReallifeGamemode.Server.Finance
|
|||||||
public float PropertyTaxation { get; set; } = 0;
|
public float PropertyTaxation { get; set; } = 0;
|
||||||
public int Wage { get; set; } = 0;
|
public int Wage { get; set; } = 0;
|
||||||
public int Amount { get; set; } = 0;
|
public int Amount { get; set; } = 0;
|
||||||
|
public int RentalFees { get; set; } = 0;
|
||||||
|
|
||||||
public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount)
|
public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees)
|
||||||
{
|
{
|
||||||
this.FinancialHelp = FinancialHelp;
|
this.FinancialHelp = FinancialHelp;
|
||||||
this.FinancialInterest = FinancialInterest;
|
this.FinancialInterest = FinancialInterest;
|
||||||
@@ -27,8 +28,7 @@ namespace ReallifeGamemode.Server.Finance
|
|||||||
this.PropertyTaxation = PropertyTaxation;
|
this.PropertyTaxation = PropertyTaxation;
|
||||||
this.Wage = Wage;
|
this.Wage = Wage;
|
||||||
this.Amount = Amount;
|
this.Amount = Amount;
|
||||||
|
this.RentalFees = RentalFees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user