add cutoff below 0 for earnings before tax
This commit is contained in:
parent
8ab1d05795
commit
aac4168b47
@ -56,15 +56,23 @@ class Company:
|
||||
def clean_complex(self, year: int, state: str) -> None:
|
||||
"""Clean the complex data. This means earnings before/after tax."""
|
||||
try:
|
||||
if f"Gewinn/(Verlust) {state} Steuern EUR {year}" in self.data.keys() and self.data[f"Gewinn/(Verlust) {state} Steuern EUR {year}"] != '' and not self.cleaned_data.get(f"gn{year}"):
|
||||
if f"Gewinn/(Verlust) {state} Steuern EUR {year}" in self.data.keys() and self.data[f"Gewinn/(Verlust) {state} Steuern EUR {year}"] != '' and not self.cleaned_data.get(f"gn{year}") and self.cut_negative(state, int(self.data[f"Gewinn/(Verlust) {state} Steuern EUR {year}"])):
|
||||
self.cleaned_data[f"g{self.get_suffix(state)}{year}"] = int(self.data[f"Gewinn/(Verlust) {state} Steuern EUR {year}"])
|
||||
elif f"Gewinn/Verlust {state} Steuern EUR {year}" in self.data.keys() and self.data[f"Gewinn/Verlust {state} Steuern EUR {year}"] != '' and not self.cleaned_data.get(f"gn{year}"):
|
||||
elif f"Gewinn/Verlust {state} Steuern EUR {year}" in self.data.keys() and self.data[f"Gewinn/Verlust {state} Steuern EUR {year}"] != '' and not self.cleaned_data.get(f"gn{year}") and self.cut_negative(state, int(self.data[f"Gewinn/(Verlust) {state} Steuern EUR {year}"])):
|
||||
self.cleaned_data[f"g{self.get_suffix(state)}{year}"] = int(self.data[f"Gewinn/Verlust {state} Steuern EUR {year}"])
|
||||
else:
|
||||
self.report.log.debug(f"{self.cleaned_data['name']}:g{self.get_suffix(state)}{year} empty value")
|
||||
except ValueError:
|
||||
self.report.log.debug(f"{self.cleaned_data['name']}: g{self.get_suffix(state)}{year} ValueError")
|
||||
|
||||
def cut_negative(self, state: str, gv: int) -> bool:
|
||||
if state == "vor":
|
||||
return False if gv < 0 else True
|
||||
elif state == "nach":
|
||||
return True
|
||||
else:
|
||||
raise Exception("IMPOSSIBLE STATE CN")
|
||||
|
||||
def get_suffix(self, state: str) -> str:
|
||||
"""Get suffix for the complex cleaning process."""
|
||||
return "n" if state == "nach" else "v"
|
||||
|
Loading…
x
Reference in New Issue
Block a user