Update modules/pricing/pricing_app.py
Browse files- modules/pricing/pricing_app.py +25 -20
modules/pricing/pricing_app.py
CHANGED
@@ -453,32 +453,37 @@ class PricingApp:
|
|
453 |
)
|
454 |
|
455 |
if st.button("إضافة البند", key="add_boq_item"):
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
475 |
st.rerun()
|
476 |
-
else:
|
477 |
st.error("يرجى إدخال جميع البيانات المطلوبة بشكل صحيح")
|
478 |
|
479 |
# عرض ملخص جدول الكميات
|
480 |
st.markdown("### ملخص جدول الكميات")
|
481 |
|
|
|
|
|
|
|
482 |
# تجميع البيانات حسب الفئة
|
483 |
category_totals = {}
|
484 |
for item in st.session_state.bill_of_quantities:
|
|
|
453 |
)
|
454 |
|
455 |
if st.button("إضافة البند", key="add_boq_item"):
|
456 |
+
if new_code and new_description and new_quantity > 0 and new_unit_price > 0:
|
457 |
+
# حساب السعر الإجمالي
|
458 |
+
new_total_price = new_quantity * new_unit_price
|
459 |
+
|
460 |
+
# إضافة بند جديد
|
461 |
+
new_id = max([item['id'] for item in st.session_state.bill_of_quantities]) + 1
|
462 |
+
|
463 |
+
st.session_state.bill_of_quantities.append({
|
464 |
+
'id': new_id,
|
465 |
+
'code': new_code,
|
466 |
+
'description': new_description,
|
467 |
+
'unit': new_unit,
|
468 |
+
'quantity': new_quantity,
|
469 |
+
'unit_price': new_unit_price,
|
470 |
+
'total_price': new_total_price,
|
471 |
+
'category': new_category
|
472 |
+
})
|
473 |
+
|
474 |
+
st.success(f"تمت إضافة البند بنجاح: {new_description}")
|
475 |
+
|
476 |
+
# تحديث الصفحة لعرض البند الجديد
|
477 |
st.rerun()
|
478 |
+
else:
|
479 |
st.error("يرجى إدخال جميع البيانات المطلوبة بشكل صحيح")
|
480 |
|
481 |
# عرض ملخص جدول الكميات
|
482 |
st.markdown("### ملخص جدول الكميات")
|
483 |
|
484 |
+
# عرض ملخص جدول الكميات
|
485 |
+
st.markdown("### ملخص جدول الكميات")
|
486 |
+
|
487 |
# تجميع البيانات حسب الفئة
|
488 |
category_totals = {}
|
489 |
for item in st.session_state.bill_of_quantities:
|