mirror of
https://github.com/itsdave-de/msp.git
synced 2025-05-06 15:35:12 +02:00
Anpassung Styler V15
This commit is contained in:
parent
d3b3551681
commit
124fa2f3e3
@ -176,7 +176,8 @@ class VerkaufsstatistikReport(Document):
|
|||||||
df= self.add_total_row(df)
|
df= self.add_total_row(df)
|
||||||
if df.empty:
|
if df.empty:
|
||||||
frappe.throw('Für die angegebene Periode sind keine Daten vorhanden')
|
frappe.throw('Für die angegebene Periode sind keine Daten vorhanden')
|
||||||
self.report_ausgabe = self.get_styler(df).render()
|
self.report_ausgabe = self.get_styler(df).to_html()
|
||||||
|
#self.report_ausgabe = self.get_styler(df).render()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def add_total_row(self,df):
|
def add_total_row(self,df):
|
||||||
@ -185,14 +186,16 @@ class VerkaufsstatistikReport(Document):
|
|||||||
df.loc['SUM'] = sum_row
|
df.loc['SUM'] = sum_row
|
||||||
|
|
||||||
return df
|
return df
|
||||||
def get_styler(self,df):
|
|
||||||
|
def get_styler(self, df):
|
||||||
|
|
||||||
styles = [
|
styles = [
|
||||||
dict(props=[("border-collapse", "collapse"), ("width", "100%")]),
|
dict(selector="table", props=[("border-collapse", "collapse"), ("width", "100%")]),
|
||||||
dict(selector="th, td", props=[("padding", ".75rem"), ("border-top", "1px solid #dee2e6")]),
|
dict(selector="th, td", props=[("padding", ".75rem"), ("border-top", "1px solid #dee2e6")]),
|
||||||
dict(selector=".col_heading", props=[('text-align', 'right')]),
|
dict(selector=".col_heading", props=[('text-align', 'right')]),
|
||||||
dict(selector=".col_heading.col0", props=[('text-align', 'left')]),
|
dict(selector=".col_heading.col0", props=[('text-align', 'left')]),
|
||||||
dict(selector=".data", props=[("text-align", "right")]),
|
dict(selector=".data", props=[("text-align", "right")]),
|
||||||
#dict(selector=".col0", props=[("text-align", "left")]), # first column
|
# dict(selector=".col0", props=[("text-align", "left")]), # first column
|
||||||
dict(selector="tbody tr:nth-of-type(odd)", props=[("background-color", "rgba(0,0,0,.05)")]), # stripes
|
dict(selector="tbody tr:nth-of-type(odd)", props=[("background-color", "rgba(0,0,0,.05)")]), # stripes
|
||||||
]
|
]
|
||||||
if self.summenzeile == 1:
|
if self.summenzeile == 1:
|
||||||
@ -200,6 +203,21 @@ class VerkaufsstatistikReport(Document):
|
|||||||
styles.append(a)
|
styles.append(a)
|
||||||
return df.style.format('{:.2f}').set_table_styles(styles)
|
return df.style.format('{:.2f}').set_table_styles(styles)
|
||||||
|
|
||||||
|
# def get_styler(self,df):
|
||||||
|
# styles = [
|
||||||
|
# dict(props=[("border-collapse", "collapse"), ("width", "100%")]),
|
||||||
|
# dict(selector="th, td", props=[("padding", ".75rem"), ("border-top", "1px solid #dee2e6")]),
|
||||||
|
# dict(selector=".col_heading", props=[('text-align', 'right')]),
|
||||||
|
# dict(selector=".col_heading.col0", props=[('text-align', 'left')]),
|
||||||
|
# dict(selector=".data", props=[("text-align", "right")]),
|
||||||
|
# #dict(selector=".col0", props=[("text-align", "left")]), # first column
|
||||||
|
# dict(selector="tbody tr:nth-of-type(odd)", props=[("background-color", "rgba(0,0,0,.05)")]), # stripes
|
||||||
|
# ]
|
||||||
|
# if self.summenzeile == 1:
|
||||||
|
# a = dict(selector="tr:nth-last-child(1)", props=[("font-weight", "bold")])
|
||||||
|
# styles.append(a)
|
||||||
|
# return df.style.format('{:.2f}').set_table_styles(styles)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def generate_excel_sheet(self):
|
def generate_excel_sheet(self):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user