diff --git a/inventory/urls.py b/inventory/urls.py index e2d76dcf..f8348b41 100644 --- a/inventory/urls.py +++ b/inventory/urls.py @@ -342,11 +342,6 @@ urlpatterns = [ views.CarDetailView.as_view(), name="car_detail", ), - path( - "/cars//estimate/", - views.create_estimate_for_car, - name="create_estimate_for_car", - ), path("cars//history/", views.car_history, name="car_history"), path( "/cars//update/", @@ -794,7 +789,7 @@ urlpatterns = [ ), path( "/sales/estimates/create//", - views.estimate_create_from_opportunity, + views.create_estimate, name="estimate_create_from_opportunity", ), path( @@ -943,7 +938,7 @@ urlpatterns = [ views.ItemServiceUpdateView.as_view(), name="item_service_update", ), - + path( "/items/services//detail/", views.ItemServiceDetailView.as_view(), @@ -967,7 +962,7 @@ urlpatterns = [ ), path( "/items/expeneses//detail/", - views.ItemExpenseDetailView.as_view(), + views.ItemExpenseDetailView.as_view(), name="item_expense_detail", ), # Bills diff --git a/inventory/views.py b/inventory/views.py index 308bf4c5..fe6584f2 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -5120,7 +5120,29 @@ class EstimatePrintView(EstimateDetailView): uses a dedicated, stripped-down print template. """ template_name = "sales/estimates/estimate_preview.html" - + + def get(self, request, *args, **kwargs): + + self.object = self.get_object() + context = self.get_context_data(object=self.object) + + + # lang = request.GET.get('lang', 'ar') + + + template_path = "sales/estimates/estimate_preview.html" + + + html_string = render_to_string(template_path, context) + + + pdf_file = HTML(string=html_string).write_pdf() + + + response = HttpResponse(pdf_file, content_type='application/pdf') + response['Content-Disposition'] = f'attachment; filename="estimate_{self.object.estimate_number}.pdf"' + + return response @login_required diff --git a/templates/inventory/car_detail.html b/templates/inventory/car_detail.html index a6746835..e6c88c50 100644 --- a/templates/inventory/car_detail.html +++ b/templates/inventory/car_detail.html @@ -542,7 +542,7 @@ data-bs-dismiss="modal" aria-label="Close"> -
+
{% csrf_token %} {{estimate_form|crispy}} diff --git a/templates/purchase_orders/includes/po_table_for_print.html b/templates/purchase_orders/includes/po_table_for_print.html new file mode 100644 index 00000000..14f0ffdc --- /dev/null +++ b/templates/purchase_orders/includes/po_table_for_print.html @@ -0,0 +1,52 @@ +{% load django_ledger %} +{% load i18n %} +{%load tenhal_tag %} +
+ + + + + + + + + + + + + {% for po in po_list %} + + + + + + + + + {% endfor %} + +
{% trans "PO Number" %}{% trans "Description" %}{% trans "Status Date" %}{% trans "PO Status" %}{% trans "PO Amount" %}{% trans "Actions" %}
+ {% if po.po_number %}{{ po.po_number }}{% endif %} + {{ po.po_title }}{{ po.get_status_action_date }}{{ po.get_po_status_display }} + {{ CURRENCY }}{{ po.po_amount | currency_format }} + + +
+
diff --git a/templates/purchase_orders/po_detail_ar_pdf.html b/templates/purchase_orders/po_detail_ar_pdf.html index ace5ec80..1bc3809e 100644 --- a/templates/purchase_orders/po_detail_ar_pdf.html +++ b/templates/purchase_orders/po_detail_ar_pdf.html @@ -1,6 +1,3 @@ -{% load i18n %} -{% load static %} -{% load django_ledger %} {% load tenhal_tag %} {% load custom_filters %} @@ -119,6 +116,12 @@ padding-top: 15px; margin-top: 30px; } + .footer-flex { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + } @@ -128,11 +131,7 @@

{{ po_model.po_number }}

- {% if dealer.logo %} - - {% else %}

{{ dealer.name }}

- {% endif %}
العنوان: {{ dealer.address }}
البريد الإلكتروني: {{ dealer.user.email }}
@@ -174,9 +173,10 @@

المبلغ الإجمالي: {{ po_total_amount|floatformat:'2g' }}

- - + + \ No newline at end of file diff --git a/templates/purchase_orders/po_detail_en_pdf.html b/templates/purchase_orders/po_detail_en_pdf.html index ecb02392..f777cca5 100644 --- a/templates/purchase_orders/po_detail_en_pdf.html +++ b/templates/purchase_orders/po_detail_en_pdf.html @@ -112,16 +112,19 @@ padding-top: 15px; margin-top: 30px; } + + .footer-flex { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + }
- {% if request.dealer.logo %} - - {% else %}

{{ dealer.name }}

- {% endif %}
Address: {{ dealer.address}}
Email: {{ dealer.user.email }}
@@ -162,8 +165,9 @@
- + +
+
+

{{ estimate.customer.customer_name }}: إلى

+

العميل: {{ estimate.customer.customer_name }}

+

البريد الإلكتروني: {{ estimate.customer.email |default:"N/A"}}

+

الهاتف: {{ estimate.customer.phone_number|default:"N/A" }}

+

العنوان: {{ estimate.customer.address_1|default:"N/A" }}

+
+
+

التفاصيل:

+

رقم عرض السعر: {{ estimate.estimate_number }}

+

تاريخ الإصدار: {{ estimate.date_approved|date:"Y/m/d" }}

+

طريقة الدفع: {{ estimate.get_terms_display }}

+
+
+ +
+
+
+ تفاصيل السيارة
- + + {% if data.additional_services %} +
+
+
+ الخدمات الإضافية
-

- Powered by  - TENHAL | تنحل -

+ + + + + + + + + + + {% for service in data.additional_services.services %} + + + + + + + {% endfor %} + +
النوعالقيمةضريبة الخدمةالإجمالي
{{ service.0.name }}{{ service.0.price|floatformat:2 }}{{ service.1|floatformat:2 }}{{ service.0.price_|floatformat:2 }}
- - - - - + {% endif %} + +
+
+

إجمالي ضريبة القيمة المضافة: {{ data.total_vat|floatformat:'2g' }}

+

الإجمالي الكلي: {{ data.grand_total|floatformat:'2g' }}

+

كتابةً: {{ data.grand_total|num_to_words }}

+
+
+ + + + + \ No newline at end of file