Delete demo_pricing.py
Browse files- demo_pricing.py +0 -449
demo_pricing.py
DELETED
@@ -1,449 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import numpy as np
|
4 |
-
import matplotlib.pyplot as plt
|
5 |
-
import plotly.express as px
|
6 |
-
import plotly.graph_objects as go
|
7 |
-
|
8 |
-
# ملاحظة: تم نقل إعداد الصفحة إلى ملف app.py الرئيسي
|
9 |
-
# لتجنب أخطاء set_page_config يجب أن يكون في ملف واحد فقط
|
10 |
-
|
11 |
-
st.title("عرض تحسينات واجهة المستخدم")
|
12 |
-
|
13 |
-
# بيانات تجريبية للعرض
|
14 |
-
@st.cache_data
|
15 |
-
def get_sample_data():
|
16 |
-
items = pd.DataFrame({
|
17 |
-
'رقم البند': ['UB1', 'UB2', 'UB3', 'UB4', 'UB5'],
|
18 |
-
'وصف البند': ['حفر أساسات', 'صب خرسانة مسلحة', 'أعمال طوب', 'أعمال تشطيبات', 'أعمال كهرباء'],
|
19 |
-
'الوحدة': ['م3', 'م3', 'م2', 'م2', 'نقطة'],
|
20 |
-
'الكمية': [350.0, 120.0, 500.0, 800.0, 150.0],
|
21 |
-
'سعر الوحدة': [80.0, 950.0, 45.0, 120.0, 90.0],
|
22 |
-
'الإجمالي': [28000.0, 114000.0, 22500.0, 96000.0, 13500.0],
|
23 |
-
'إستراتيجية التسعير': ['نقص', 'زيادة', 'متوازن', 'زيادة', 'نقص']
|
24 |
-
})
|
25 |
-
return items
|
26 |
-
|
27 |
-
items = get_sample_data()
|
28 |
-
|
29 |
-
# 1. عرض الجدول مع تنسيق محسن
|
30 |
-
st.markdown("<h3 style='color: #1F7A8C; background: linear-gradient(to right, #f0f9ff, #ffffff); padding: 10px; border-radius: 5px;'>بنود التسعير غير المتوازن</h3>", unsafe_allow_html=True)
|
31 |
-
|
32 |
-
# تعيين ألوان للإستراتيجيات وتنسيق الجدول بشكل متقدم
|
33 |
-
def highlight_row(row):
|
34 |
-
strategy = row['إستراتيجية التسعير']
|
35 |
-
styles = [''] * len(row)
|
36 |
-
|
37 |
-
# تطبيق لون خلفية لكل صف حسب الإستراتيجية
|
38 |
-
if strategy == 'زيادة':
|
39 |
-
background = 'linear-gradient(90deg, rgba(168, 230, 207, 0.3), rgba(168, 230, 207, 0.1))'
|
40 |
-
text_color = '#1F7A8C'
|
41 |
-
elif strategy == 'نقص':
|
42 |
-
background = 'linear-gradient(90deg, rgba(255, 154, 162, 0.3), rgba(255, 154, 162, 0.1))'
|
43 |
-
text_color = '#9D2A45'
|
44 |
-
else:
|
45 |
-
background = 'linear-gradient(90deg, rgba(220, 237, 255, 0.3), rgba(220, 237, 255, 0.1))'
|
46 |
-
text_color = '#555555'
|
47 |
-
|
48 |
-
# تطبيق النمط على جميع الخلايا في الصف
|
49 |
-
for i in range(len(styles)):
|
50 |
-
styles[i] = f'background: {background}; color: {text_color}; border-bottom: 1px solid #ddd;'
|
51 |
-
|
52 |
-
# تطبيق نمط خاص على خلية الإستراتيجية
|
53 |
-
if strategy == 'زيادة':
|
54 |
-
styles[list(row.index).index('إستراتيجية التسعير')] = 'background-color: #a8e6cf; color: #007263; font-weight: bold; border-radius: 5px; text-align: center;'
|
55 |
-
elif strategy == 'نقص':
|
56 |
-
styles[list(row.index).index('إستراتيجية التسعير')] = 'background-color: #ff9aa2; color: #9D2A45; font-weight: bold; border-radius: 5px; text-align: center;'
|
57 |
-
else:
|
58 |
-
styles[list(row.index).index('إستراتيجية التسعير')] = 'background-color: #dceeff; color: #555555; font-weight: bold; border-radius: 5px; text-align: center;'
|
59 |
-
|
60 |
-
# تنسيق عمود السعر
|
61 |
-
price_idx = list(row.index).index('سعر الوحدة')
|
62 |
-
styles[price_idx] = styles[price_idx] + 'font-weight: bold;'
|
63 |
-
|
64 |
-
# تنسيق عمود الإجمالي
|
65 |
-
total_idx = list(row.index).index('الإجمالي')
|
66 |
-
styles[total_idx] = styles[total_idx] + 'font-weight: bold;'
|
67 |
-
|
68 |
-
return styles
|
69 |
-
|
70 |
-
# تطبيق التنسيق على الجدول
|
71 |
-
styled_items = items.style.apply(highlight_row, axis=1)
|
72 |
-
|
73 |
-
# تنسيق تنسيق الأرقام
|
74 |
-
styled_items = styled_items.format({
|
75 |
-
'الكمية': '{:,.2f}',
|
76 |
-
'سعر الوحدة': '{:,.2f}',
|
77 |
-
'الإجمالي': '{:,.2f}'
|
78 |
-
})
|
79 |
-
|
80 |
-
st.dataframe(styled_items, use_container_width=True, height=None)
|
81 |
-
|
82 |
-
# 2. عرض المقارنة مع تصميم محسن
|
83 |
-
st.markdown("<h3 style='color: #1F7A8C; background: linear-gradient(to right, #f0f9ff, #ffffff); padding: 10px; border-radius: 5px;'>مقارنة التسعير المتوازن وغير المتوازن</h3>", unsafe_allow_html=True)
|
84 |
-
|
85 |
-
# بيانات المقارنة
|
86 |
-
original_items = items.copy()
|
87 |
-
original_items['سعر الوحدة'] = [70.0, 820.0, 45.0, 100.0, 110.0]
|
88 |
-
original_items['الإجمالي'] = original_items['الكمية'] * original_items['سعر الوحدة']
|
89 |
-
|
90 |
-
original_total = original_items['الإجمالي'].sum()
|
91 |
-
unbalanced_total = items['الإجمالي'].sum()
|
92 |
-
|
93 |
-
# عرض بطاقات المقارنة بتصميم متقدم
|
94 |
-
st.markdown("""
|
95 |
-
<style>
|
96 |
-
.metric-container {
|
97 |
-
background: linear-gradient(to right, #f1f8ff, #ffffff);
|
98 |
-
border-radius: 10px;
|
99 |
-
padding: 15px;
|
100 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
101 |
-
text-align: center;
|
102 |
-
border: 1px solid #e6f2ff;
|
103 |
-
}
|
104 |
-
.metric-title {
|
105 |
-
color: #555;
|
106 |
-
font-size: 0.9em;
|
107 |
-
margin-bottom: 5px;
|
108 |
-
}
|
109 |
-
.metric-value {
|
110 |
-
color: #1F7A8C;
|
111 |
-
font-size: 1.8em;
|
112 |
-
font-weight: bold;
|
113 |
-
margin: 5px 0;
|
114 |
-
}
|
115 |
-
.metric-delta {
|
116 |
-
font-size: 0.9em;
|
117 |
-
font-weight: bold;
|
118 |
-
padding: 3px 8px;
|
119 |
-
border-radius: 10px;
|
120 |
-
display: inline-block;
|
121 |
-
margin-top: 5px;
|
122 |
-
}
|
123 |
-
.positive-delta {
|
124 |
-
background-color: rgba(40, 167, 69, 0.1);
|
125 |
-
color: #28a745;
|
126 |
-
}
|
127 |
-
.negative-delta {
|
128 |
-
background-color: rgba(220, 53, 69, 0.1);
|
129 |
-
color: #dc3545;
|
130 |
-
}
|
131 |
-
.neutral-delta {
|
132 |
-
background-color: rgba(108, 117, 125, 0.1);
|
133 |
-
color: #6c757d;
|
134 |
-
}
|
135 |
-
</style>
|
136 |
-
""", unsafe_allow_html=True)
|
137 |
-
|
138 |
-
col1, col2, col3 = st.columns(3)
|
139 |
-
|
140 |
-
with col1:
|
141 |
-
st.markdown("""
|
142 |
-
<div class="metric-container">
|
143 |
-
<div class="metric-title">إجمالي التسعير المتوازن</div>
|
144 |
-
<div class="metric-value">{:,.2f} ريال</div>
|
145 |
-
<div class="metric-delta neutral-delta">التسعير الأصلي</div>
|
146 |
-
</div>
|
147 |
-
""".format(original_total), unsafe_allow_html=True)
|
148 |
-
|
149 |
-
with col2:
|
150 |
-
st.markdown("""
|
151 |
-
<div class="metric-container">
|
152 |
-
<div class="metric-title">إجمالي التسعير غير المتوازن</div>
|
153 |
-
<div class="metric-value">{:,.2f} ريال</div>
|
154 |
-
<div class="metric-delta {}">بعد إعادة توزيع الأسعار</div>
|
155 |
-
</div>
|
156 |
-
""".format(
|
157 |
-
unbalanced_total,
|
158 |
-
"positive-delta" if unbalanced_total > original_total else "negative-delta" if unbalanced_total < original_total else "neutral-delta"
|
159 |
-
), unsafe_allow_html=True)
|
160 |
-
|
161 |
-
with col3:
|
162 |
-
diff = unbalanced_total - original_total
|
163 |
-
delta_percent = diff/original_total*100 if original_total > 0 else 0
|
164 |
-
|
165 |
-
st.markdown("""
|
166 |
-
<div class="metric-container">
|
167 |
-
<div class="metric-title">الفرق بين التسعيرين</div>
|
168 |
-
<div class="metric-value">{:,.2f} ريال</div>
|
169 |
-
<div class="metric-delta {}">نسبة الفرق: {:+.1f}%</div>
|
170 |
-
</div>
|
171 |
-
""".format(
|
172 |
-
diff,
|
173 |
-
"positive-delta" if diff > 0 else "negative-delta" if diff < 0 else "neutral-delta",
|
174 |
-
delta_percent
|
175 |
-
), unsafe_allow_html=True)
|
176 |
-
|
177 |
-
# 3. رسم بياني للمقارنة
|
178 |
-
st.markdown("<h3 style='color: #1F7A8C; background: linear-gradient(to right, #f0f9ff, #ffffff); padding: 10px; border-radius: 5px;'>تحليل بصري للتسعير غير المتوازن</h3>", unsafe_allow_html=True)
|
179 |
-
|
180 |
-
# إعداد البيانات للرسم البياني
|
181 |
-
chart_data = pd.DataFrame({
|
182 |
-
'وصف البند': original_items['وصف البند'],
|
183 |
-
'التسعير المتوازن': original_items['الإجمالي'],
|
184 |
-
'التسعير غير المتوازن': items['الإجمالي']
|
185 |
-
})
|
186 |
-
|
187 |
-
# إضافة عمود للنسبة المئوية للتغيير
|
188 |
-
chart_data['نسبة التغيير'] = (chart_data['التسعير غير المتوازن'] - chart_data['التسعير المتوازن']) / chart_data['التسعير المتوازن'] * 100
|
189 |
-
|
190 |
-
# تحديد لون الأعمدة بناءً على نسبة التغيير
|
191 |
-
bar_colors = []
|
192 |
-
for change in chart_data['نسبة التغيير']:
|
193 |
-
if change > 5: # زيادة كبيرة
|
194 |
-
bar_colors.append('#1F7A8C') # أزرق مخضر
|
195 |
-
elif change > 0: # زيادة صغيرة
|
196 |
-
bar_colors.append('#81B29A') # أخضر فاتح
|
197 |
-
elif change > -5: # نقص صغير
|
198 |
-
bar_colors.append('#F2CC8F') # أصفر
|
199 |
-
else: # نقص كبير
|
200 |
-
bar_colors.append('#E07A5F') # أحمر
|
201 |
-
|
202 |
-
# التبويب بين مخططات مختلفة للمقارنة
|
203 |
-
chart_tabs = st.tabs(["مخطط شريطي", "مخطط مقارنة", "مخطط نسبة التغيير"])
|
204 |
-
|
205 |
-
with chart_tabs[0]: # رسم بياني شريطي
|
206 |
-
# رسم بياني شريطي للمقارنة
|
207 |
-
fig = go.Figure()
|
208 |
-
|
209 |
-
fig.add_trace(go.Bar(
|
210 |
-
x=chart_data['وصف البند'],
|
211 |
-
y=chart_data['التسعير المتوازن'],
|
212 |
-
name='التسعير المتوازن',
|
213 |
-
marker_color='rgba(55, 83, 109, 0.7)'
|
214 |
-
))
|
215 |
-
|
216 |
-
fig.add_trace(go.Bar(
|
217 |
-
x=chart_data['وصف البند'],
|
218 |
-
y=chart_data['التسعير غير المتوازن'],
|
219 |
-
name='التسعير غير المتوازن',
|
220 |
-
marker_color=bar_colors
|
221 |
-
))
|
222 |
-
|
223 |
-
fig.update_layout(
|
224 |
-
title='مقارنة بين التسعير المتوازن وغير المتوازن',
|
225 |
-
xaxis_tickfont_size=14,
|
226 |
-
yaxis=dict(
|
227 |
-
title='الإجمالي (ريال)',
|
228 |
-
titlefont_size=16,
|
229 |
-
tickfont_size=14,
|
230 |
-
),
|
231 |
-
legend=dict(
|
232 |
-
x=0.01,
|
233 |
-
y=0.99,
|
234 |
-
bgcolor='rgba(255, 255, 255, 0.8)',
|
235 |
-
bordercolor='rgba(0, 0, 0, 0.1)',
|
236 |
-
borderwidth=1
|
237 |
-
),
|
238 |
-
barmode='group',
|
239 |
-
bargap=0.15,
|
240 |
-
bargroupgap=0.1,
|
241 |
-
plot_bgcolor='rgba(240, 249, 255, 0.5)',
|
242 |
-
margin=dict(t=50, b=50, l=20, r=20)
|
243 |
-
)
|
244 |
-
|
245 |
-
st.plotly_chart(fig, use_container_width=True)
|
246 |
-
|
247 |
-
with chart_tabs[1]: # رسم مقارنة
|
248 |
-
# رسم مقارنة بين التسعيرين
|
249 |
-
fig = go.Figure()
|
250 |
-
|
251 |
-
# إضافة خط للتسعير المتوازن
|
252 |
-
fig.add_trace(go.Scatter(
|
253 |
-
x=chart_data['و��ف البند'],
|
254 |
-
y=chart_data['التسعير المتوازن'],
|
255 |
-
name='التسعير المتوازن',
|
256 |
-
mode='lines+markers',
|
257 |
-
line=dict(color='rgb(55, 83, 109)', width=3),
|
258 |
-
marker=dict(size=10, color='rgb(55, 83, 109)')
|
259 |
-
))
|
260 |
-
|
261 |
-
# إضافة نقاط للتسعير غير المتوازن
|
262 |
-
fig.add_trace(go.Scatter(
|
263 |
-
x=chart_data['وصف البند'],
|
264 |
-
y=chart_data['التسعير غير المتوازن'],
|
265 |
-
name='التسعير غير المتوازن',
|
266 |
-
mode='lines+markers',
|
267 |
-
line=dict(color='rgb(26, 118, 255)', width=3),
|
268 |
-
marker=dict(
|
269 |
-
size=12,
|
270 |
-
color=bar_colors,
|
271 |
-
line=dict(width=2, color='white')
|
272 |
-
)
|
273 |
-
))
|
274 |
-
|
275 |
-
# تحديثات التخطيط
|
276 |
-
fig.update_layout(
|
277 |
-
title='مقارنة مرئية بين استراتيجيات التسعير',
|
278 |
-
xaxis_tickfont_size=14,
|
279 |
-
yaxis=dict(
|
280 |
-
title='القيمة الإجمالية (ريال)',
|
281 |
-
titlefont_size=16,
|
282 |
-
tickfont_size=14,
|
283 |
-
gridcolor='rgba(200, 200, 200, 0.2)'
|
284 |
-
),
|
285 |
-
legend=dict(
|
286 |
-
x=0.01,
|
287 |
-
y=0.99,
|
288 |
-
bgcolor='rgba(255, 255, 255, 0.8)',
|
289 |
-
bordercolor='rgba(0, 0, 0, 0.1)',
|
290 |
-
borderwidth=1
|
291 |
-
),
|
292 |
-
plot_bgcolor='rgba(240, 249, 255, 0.5)',
|
293 |
-
margin=dict(t=50, b=50, l=20, r=20)
|
294 |
-
)
|
295 |
-
|
296 |
-
st.plotly_chart(fig, use_container_width=True)
|
297 |
-
|
298 |
-
with chart_tabs[2]: # مخطط نسبة التغيير
|
299 |
-
# مخطط للنسبة المئوية للتغيير
|
300 |
-
fig = go.Figure()
|
301 |
-
|
302 |
-
# إضافة أعمدة لنسبة التغيير مع ألوان مختلفة حسب القيمة
|
303 |
-
fig.add_trace(go.Bar(
|
304 |
-
x=chart_data['وصف البند'],
|
305 |
-
y=chart_data['نسبة التغيير'],
|
306 |
-
name='نسبة التغيير',
|
307 |
-
marker_color=bar_colors,
|
308 |
-
text=[f"{val:.1f}%" for val in chart_data['نسبة التغيير']],
|
309 |
-
textposition='auto'
|
310 |
-
))
|
311 |
-
|
312 |
-
# إضافة خط أفقي عند الصفر
|
313 |
-
fig.add_shape(
|
314 |
-
type="line",
|
315 |
-
x0=-0.5,
|
316 |
-
y0=0,
|
317 |
-
x1=len(chart_data['وصف البند'])-0.5,
|
318 |
-
y1=0,
|
319 |
-
line=dict(
|
320 |
-
color="black",
|
321 |
-
width=2,
|
322 |
-
dash="dash",
|
323 |
-
)
|
324 |
-
)
|
325 |
-
|
326 |
-
# تحديثات التخطيط
|
327 |
-
fig.update_layout(
|
328 |
-
title='نسبة التغيير في أسعار البنود (%)',
|
329 |
-
xaxis_tickfont_size=14,
|
330 |
-
yaxis=dict(
|
331 |
-
title='نسبة التغيير (%)',
|
332 |
-
titlefont_size=16,
|
333 |
-
tickfont_size=14,
|
334 |
-
gridcolor='rgba(200, 200, 200, 0.2)',
|
335 |
-
zeroline=True,
|
336 |
-
zerolinecolor='black',
|
337 |
-
zerolinewidth=2
|
338 |
-
),
|
339 |
-
plot_bgcolor='rgba(240, 249, 255, 0.5)',
|
340 |
-
margin=dict(t=50, b=50, l=20, r=20)
|
341 |
-
)
|
342 |
-
|
343 |
-
st.plotly_chart(fig, use_container_width=True)
|
344 |
-
|
345 |
-
# إضافة جدول مع نسب التغيير
|
346 |
-
st.markdown("#### جدول مفصل بنسب التغيير")
|
347 |
-
|
348 |
-
# إعداد بيانات الجدول
|
349 |
-
table_data = chart_data[['وصف البند', 'التسعير المتوازن', 'التسعير غير المتوازن', 'نسبة التغيير']]
|
350 |
-
|
351 |
-
# تنسيق الجدول
|
352 |
-
def highlight_change(row):
|
353 |
-
change = row['نسبة التغيير']
|
354 |
-
if change > 5:
|
355 |
-
return ['', '', '', 'background-color: rgba(31, 122, 140, 0.3); color: #1F7A8C; font-weight: bold;']
|
356 |
-
elif change > 0:
|
357 |
-
return ['', '', '', 'background-color: rgba(129, 178, 154, 0.3); color: #2A9D8F; font-weight: bold;']
|
358 |
-
elif change > -5:
|
359 |
-
return ['', '', '', 'background-color: rgba(242, 204, 143, 0.3); color: #BC6C25; font-weight: bold;']
|
360 |
-
else:
|
361 |
-
return ['', '', '', 'background-color: rgba(224, 122, 95, 0.3); color: #AE2012; font-weight: bold;']
|
362 |
-
|
363 |
-
# تطبيق التنسيق
|
364 |
-
styled_table = table_data.style.apply(highlight_change, axis=1).format({
|
365 |
-
'التسعير المتوازن': '{:,.2f} ريال',
|
366 |
-
'التسعير غير المتوازن': '{:,.2f} ريال',
|
367 |
-
'نسبة التغيير': '{:+.1f}%'
|
368 |
-
})
|
369 |
-
|
370 |
-
st.dataframe(styled_table, use_container_width=True)
|
371 |
-
|
372 |
-
# 4. أزرار الحفظ والتصدير مع تصميم محسن
|
373 |
-
st.markdown("<hr style='margin-top: 30px; margin-bottom: 20px; border-top: 1px solid #ddd;'>", unsafe_allow_html=True)
|
374 |
-
st.markdown("<h3 style='color: #1F7A8C; background: linear-gradient(to right, #f0f9ff, #ffffff); padding: 10px; border-radius: 5px;'>حفظ وتصدير البيانات</h3>", unsafe_allow_html=True)
|
375 |
-
|
376 |
-
st.markdown("""
|
377 |
-
<style>
|
378 |
-
.action-card {
|
379 |
-
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
|
380 |
-
border-radius: 10px;
|
381 |
-
padding: 20px;
|
382 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
383 |
-
border-left: 5px solid #1F7A8C;
|
384 |
-
transition: all 0.3s ease;
|
385 |
-
}
|
386 |
-
.action-card:hover {
|
387 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
388 |
-
transform: translateY(-2px);
|
389 |
-
}
|
390 |
-
.action-icon {
|
391 |
-
color: #1F7A8C;
|
392 |
-
font-size: 24px;
|
393 |
-
margin-bottom: 10px;
|
394 |
-
}
|
395 |
-
.action-title {
|
396 |
-
color: #333;
|
397 |
-
font-size: 18px;
|
398 |
-
font-weight: bold;
|
399 |
-
margin-bottom: 10px;
|
400 |
-
}
|
401 |
-
.action-desc {
|
402 |
-
color: #666;
|
403 |
-
font-size: 14px;
|
404 |
-
margin-bottom: 15px;
|
405 |
-
}
|
406 |
-
</style>
|
407 |
-
""", unsafe_allow_html=True)
|
408 |
-
|
409 |
-
col1, col2 = st.columns(2)
|
410 |
-
|
411 |
-
with col1:
|
412 |
-
# بطاقة حفظ التسعير
|
413 |
-
st.markdown("""
|
414 |
-
<div class="action-card">
|
415 |
-
<div class="action-icon">💾</div>
|
416 |
-
<div class="action-title">حفظ التسعير غير المتوازن</div>
|
417 |
-
<div class="action-desc">قم بحفظ التسعير الحالي في المشروع لاستخدامه لاحقاً في التقارير وفي إجمالي التسعير.</div>
|
418 |
-
</div>
|
419 |
-
""", unsafe_allow_html=True)
|
420 |
-
|
421 |
-
# زر حفظ التسعير غير المتوازن
|
422 |
-
if st.button("حفظ التسعير غير المتوازن", type="primary", use_container_width=True):
|
423 |
-
st.success("تم حفظ التسعير غير المتوازن بنجاح!")
|
424 |
-
st.balloons() # إضافة تأثير احتفالي عند الحفظ
|
425 |
-
|
426 |
-
with col2:
|
427 |
-
# بطاقة تصدير التسعير
|
428 |
-
st.markdown("""
|
429 |
-
<div class="action-card">
|
430 |
-
<div class="action-icon">📊</div>
|
431 |
-
<div class="action-title">تصدير البيانات</div>
|
432 |
-
<div class="action-desc">قم بتصدير جدول التسعير الحالي بصيغة CSV لاستخدامه في برامج أخرى مثل Excel.</div>
|
433 |
-
</div>
|
434 |
-
""", unsafe_allow_html=True)
|
435 |
-
|
436 |
-
# زر تصدير التسعير
|
437 |
-
export_button = st.button("تجهيز ملف للتصدير", use_container_width=True)
|
438 |
-
if export_button:
|
439 |
-
# تحويل البيانات إلى CSV
|
440 |
-
csv = items.to_csv(index=False)
|
441 |
-
st.success("تم تجهيز ملف التصدير بنجاح! يمكنك تنزيله الآن.")
|
442 |
-
# تقديم البيانات للتنزيل
|
443 |
-
st.download_button(
|
444 |
-
label="تنزيل ملف CSV",
|
445 |
-
data=csv,
|
446 |
-
file_name="unbalanced_pricing.csv",
|
447 |
-
mime="text/csv",
|
448 |
-
use_container_width=True
|
449 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|