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:
|
def clean_complex(self, year: int, state: str) -> None:
|
||||||
"""Clean the complex data. This means earnings before/after tax."""
|
"""Clean the complex data. This means earnings before/after tax."""
|
||||||
try:
|
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}"])
|
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}"])
|
self.cleaned_data[f"g{self.get_suffix(state)}{year}"] = int(self.data[f"Gewinn/Verlust {state} Steuern EUR {year}"])
|
||||||
else:
|
else:
|
||||||
self.report.log.debug(f"{self.cleaned_data['name']}:g{self.get_suffix(state)}{year} empty value")
|
self.report.log.debug(f"{self.cleaned_data['name']}:g{self.get_suffix(state)}{year} empty value")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.report.log.debug(f"{self.cleaned_data['name']}: g{self.get_suffix(state)}{year} 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:
|
def get_suffix(self, state: str) -> str:
|
||||||
"""Get suffix for the complex cleaning process."""
|
"""Get suffix for the complex cleaning process."""
|
||||||
return "n" if state == "nach" else "v"
|
return "n" if state == "nach" else "v"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user