Update modules/pricing/pricing_app.py
Browse files- modules/pricing/pricing_app.py +26 -30
modules/pricing/pricing_app.py
CHANGED
@@ -12,6 +12,12 @@ import json
|
|
12 |
import base64
|
13 |
from pathlib import Path
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
class PricingApp:
|
16 |
"""وحدة التسعير"""
|
17 |
|
@@ -27,6 +33,9 @@ class PricingApp:
|
|
27 |
if 'price_scenarios' not in st.session_state:
|
28 |
st.session_state.price_scenarios = []
|
29 |
|
|
|
|
|
|
|
30 |
def run(self):
|
31 |
self.render()
|
32 |
|
@@ -39,6 +48,8 @@ class PricingApp:
|
|
39 |
"تحليل التكاليف",
|
40 |
"سيناريوهات التسعير",
|
41 |
"المقارنة التنافسية",
|
|
|
|
|
42 |
"التقارير"
|
43 |
])
|
44 |
|
@@ -53,6 +64,10 @@ class PricingApp:
|
|
53 |
with tabs[4]:
|
54 |
self._render_competitive_analysis_tab()
|
55 |
with tabs[5]:
|
|
|
|
|
|
|
|
|
56 |
self._render_reports_tab()
|
57 |
|
58 |
def _render_dashboard_tab(self):
|
@@ -123,45 +138,26 @@ class PricingApp:
|
|
123 |
else:
|
124 |
st.error("يرجى إدخال جميع البيانات المطلوبة بشكل صحيح")
|
125 |
|
126 |
-
st.markdown("### ملخص جدول الكميات")
|
127 |
-
category_totals = {}
|
128 |
-
for item in st.session_state.bill_of_quantities:
|
129 |
-
category = item['category']
|
130 |
-
category_totals[category] = category_totals.get(category, 0) + item['total_price']
|
131 |
-
|
132 |
-
if category_totals:
|
133 |
-
category_df = pd.DataFrame({
|
134 |
-
'الفئة': list(category_totals.keys()),
|
135 |
-
'المبلغ': list(category_totals.values())
|
136 |
-
}).sort_values('المبلغ', ascending=False)
|
137 |
-
|
138 |
-
fig = px.bar(
|
139 |
-
category_df,
|
140 |
-
x='الفئة',
|
141 |
-
y='المبلغ',
|
142 |
-
title='إجمالي تكلفة البنود حسب الفئة',
|
143 |
-
color='الفئة',
|
144 |
-
text_auto=True
|
145 |
-
)
|
146 |
-
st.plotly_chart(fig, use_container_width=True)
|
147 |
-
|
148 |
-
total_boq = sum(item['total_price'] for item in st.session_state.bill_of_quantities)
|
149 |
-
st.markdown(f"### إجمالي جدول الكميات: **{total_boq:,.0f} ريال**")
|
150 |
-
else:
|
151 |
-
st.info("لم يتم إدخال بنود بعد.")
|
152 |
-
|
153 |
def _render_cost_analysis_tab(self):
|
154 |
st.markdown("### تحليل التكاليف")
|
155 |
-
|
156 |
|
157 |
def _render_pricing_scenarios_tab(self):
|
158 |
st.markdown("### سيناريوهات التسعير")
|
159 |
-
|
160 |
|
161 |
def _render_competitive_analysis_tab(self):
|
162 |
st.markdown("### المقارنة التنافسية")
|
163 |
st.info("سيتم عرض مقارنة الأسعار والمنافسين هنا.")
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
def _render_reports_tab(self):
|
166 |
st.markdown("### التقارير")
|
167 |
-
st.info("يمكنك هنا تنزيل التقارير الخاصة بالتسعير وجدول الكميات.")
|
|
|
12 |
import base64
|
13 |
from pathlib import Path
|
14 |
|
15 |
+
# استيراد الوحدات الجديدة من pricing_system
|
16 |
+
from pricing_system.modules.analysis import analysis_utils
|
17 |
+
from pricing_system.modules.catalogs import materials_catalog, equipment_catalog
|
18 |
+
from pricing_system.modules.indirect_support import overheads
|
19 |
+
from pricing_system.modules.pricing_strategies import balanced_pricing, profit_oriented
|
20 |
+
|
21 |
class PricingApp:
|
22 |
"""وحدة التسعير"""
|
23 |
|
|
|
33 |
if 'price_scenarios' not in st.session_state:
|
34 |
st.session_state.price_scenarios = []
|
35 |
|
36 |
+
if 'local_content_data' not in st.session_state:
|
37 |
+
st.session_state.local_content_data = {'target_percent': 30, 'actual_percent': 0, 'items': []}
|
38 |
+
|
39 |
def run(self):
|
40 |
self.render()
|
41 |
|
|
|
48 |
"تحليل التكاليف",
|
49 |
"سيناريوهات التسعير",
|
50 |
"المقارنة التنافسية",
|
51 |
+
"المحتوى المحلي",
|
52 |
+
"تسعير غير متزن",
|
53 |
"التقارير"
|
54 |
])
|
55 |
|
|
|
64 |
with tabs[4]:
|
65 |
self._render_competitive_analysis_tab()
|
66 |
with tabs[5]:
|
67 |
+
self._render_local_content_tab()
|
68 |
+
with tabs[6]:
|
69 |
+
self._render_unbalanced_pricing_tab()
|
70 |
+
with tabs[7]:
|
71 |
self._render_reports_tab()
|
72 |
|
73 |
def _render_dashboard_tab(self):
|
|
|
138 |
else:
|
139 |
st.error("يرجى إدخال جميع البيانات المطلوبة بشكل صحيح")
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
def _render_cost_analysis_tab(self):
|
142 |
st.markdown("### تحليل التكاليف")
|
143 |
+
analysis_utils.render_cost_breakdown()
|
144 |
|
145 |
def _render_pricing_scenarios_tab(self):
|
146 |
st.markdown("### سيناريوهات التسعير")
|
147 |
+
balanced_pricing.render_balanced_strategy()
|
148 |
|
149 |
def _render_competitive_analysis_tab(self):
|
150 |
st.markdown("### المقارنة التنافسية")
|
151 |
st.info("سيتم عرض مقارنة الأسعار والمنافسين هنا.")
|
152 |
|
153 |
+
def _render_local_content_tab(self):
|
154 |
+
st.markdown("### المحتوى المحلي")
|
155 |
+
overheads.render_local_content_ui()
|
156 |
+
|
157 |
+
def _render_unbalanced_pricing_tab(self):
|
158 |
+
st.markdown("### التسعير غير المتزن")
|
159 |
+
profit_oriented.render_profit_driven_strategy()
|
160 |
+
|
161 |
def _render_reports_tab(self):
|
162 |
st.markdown("### التقارير")
|
163 |
+
st.info("يمكنك هنا تنزيل التقارير الخاصة بالتسعير وجدول الكميات.")
|