diff --git a/certificates/templates/certificates/print.html b/certificates/templates/certificates/print.html index 39b028a..3e75dc5 100644 --- a/certificates/templates/certificates/print.html +++ b/certificates/templates/certificates/print.html @@ -5,6 +5,7 @@ تاییدیه - {{ instance.code }} {% load static %} + {% load common_tags %} @@ -52,21 +53,31 @@
مشخصات چاه و کنتور هوشمند
-
موقعیت مکانی (UTM): {{ latest_report.utm_x|default:'-' }} , {{ latest_report.utm_y|default:'-' }}
+
موقعیت مکانی (UTM): X: {{ latest_report.utm_x|default:'-' }} , Y: {{ latest_report.utm_y|default:'-' }}
نیرو محرکه چاه: {{ latest_report.driving_force|default:'-' }}
نوع کنتور: {{ latest_report.get_meter_type_display|default:'-' }}
-
قطر لوله آبده (اینچ): {{ latest_report.discharge_pipe_diameter|default:'-' }}
+ {% if latest_report.meter_type == 'smart' %} +
مدل کنتور: {{ latest_report.get_meter_model_display|default:'-' }}
+ {% else %} +
سایز کنتور: {{ latest_report.meter_size|default:'-' }}
+ {% endif %}
نوع مصرف: {{ latest_report.get_usage_type_display|default:'-' }}
شماره سیم‌کارت: {{ latest_report.sim_number|default:'-' }}
+
شارژ کنتور (متر مکعب): {{ latest_report.meter_charge|default:'-' }}
+
پایان اعتبار شارژ: {{ latest_report.meter_charge_expiration_date|to_jalali|default:'-' }}
+
شماره سریال کنتور: {{ instance.well.water_meter_serial_number|default:'-' }}
+
-
سایز کنتور: {{ latest_report.meter_size|default:'-' }}
+
قطر لوله آبده (اینچ): {{ latest_report.discharge_pipe_diameter|default:'-' }}
شماره پروانه بهره‌برداری چاه: {{ latest_report.exploitation_license_number|default:'-' }}
-
قدرت موتور: {{ latest_report.motor_power|default:'-' }}
-
دبی قبل از کالیبراسیون: {{ latest_report.pre_calibration_flow_rate|default:'-' }}
-
دبی بعد از کالیبراسیون: {{ latest_report.post_calibration_flow_rate|default:'-' }}
+
قدرت موتور (کیلووات ساعت): {{ latest_report.motor_power|default:'-' }}
+
دبی (لیتر بر ثانیه): {{ latest_report.flow_rate|default:'-' }}
+
عدد کنتور (متر مکعب): {{ latest_report.meter_reading|default:'-' }}
+
پلمپ تابلو: {{ latest_report.is_panel_sealed|yesno:'دارد,ندارد' }}
+
تابلو قطع: {{ latest_report.is_panel_cut|yesno:'دارد,ندارد' }}
+
انجام عملیات قطع: {{ latest_report.is_disconnection_done|yesno:'دارد,ندارد' }}
نام شرکت کنتورساز: {{ latest_report.water_meter_manufacturer.name|default:'-' }}
-
شماره سریال کنتور: {{ instance.well.water_meter_serial_number|default:'-' }}
diff --git a/certificates/templates/certificates/step.html b/certificates/templates/certificates/step.html index f8249cb..8696e6c 100644 --- a/certificates/templates/certificates/step.html +++ b/certificates/templates/certificates/step.html @@ -2,6 +2,7 @@ {% load static %} {% load processes_tags %} {% load humanize %} + {% load common_tags %} {% load accounts_tags %} {% block sidebar %} @@ -73,21 +74,30 @@
مشخصات چاه و کنتور هوشمند
-
موقعیت مکانی (UTM):{{ latest_report.utm_x|default:'-' }} , {{ latest_report.utm_y|default:'-' }}
+
موقعیت مکانی (UTM):X: {{ latest_report.utm_x|default:'-' }} , Y: {{ latest_report.utm_y|default:'-' }}
نیرو محرکه چاه:{{ latest_report.driving_force|default:'-' }}
نوع کنتور:{{ latest_report.get_meter_type_display|default:'-' }}
-
قطر لوله آبده (اینچ):{{ latest_report.discharge_pipe_diameter|default:'-' }}
+ {% if latest_report.meter_type == 'smart' %} +
مدل کنتور:{{ latest_report.get_meter_model_display|default:'-' }}
+ {% else %} +
سایز کنتور:{{ latest_report.meter_size|default:'-' }}
+ {% endif %}
نوع مصرف:{{ latest_report.get_usage_type_display|default:'-' }}
شماره سیم‌کارت:{{ latest_report.sim_number|default:'-' }}
+
شارژ کنتور (متر مکعب):{{ latest_report.meter_charge|default:'-' }}
+
پایان اعتبار شارژ:{{ latest_report.meter_charge_expiration_date|to_jalali|default:'-' }}
+
شماره سریال کنتور:{{ instance.well.water_meter_serial_number|default:'-' }}
-
سایز کنتور:{{ latest_report.meter_size|default:'-' }}
+
قطر لوله آبده (اینچ):{{ latest_report.discharge_pipe_diameter|default:'-' }}
شماره پروانه بهره‌برداری چاه:{{ latest_report.exploitation_license_number|default:'-' }}
-
قدرت موتور:{{ latest_report.motor_power|default:'-' }}
-
دبی قبل از کالیبراسیون:{{ latest_report.pre_calibration_flow_rate|default:'-' }}
-
دبی بعد از کالیبراسیون:{{ latest_report.post_calibration_flow_rate|default:'-' }}
+
قدرت موتور (کیلووات ساعت):{{ latest_report.motor_power|default:'-' }}
+
دبی (لیتر بر ثانیه):{{ latest_report.flow_rate|default:'-' }}
+
عدد کنتور (متر مکعب):{{ latest_report.meter_reading|default:'-' }}
+
پلمپ تابلو:{{ latest_report.is_panel_sealed|yesno:'دارد,ندارد' }}
+
تابلو قطع:{{ latest_report.is_panel_cut|yesno:'دارد,ندارد' }}
+
انجام عملیات قطع:{{ latest_report.is_disconnection_done|yesno:'دارد,ندارد' }}
نام شرکت کنتورساز:{{ latest_report.water_meter_manufacturer.name|default:'-' }}
-
شماره سریال کنتور:{{ instance.well.water_meter_serial_number|default:'-' }}
diff --git a/db.sqlite3 b/db.sqlite3 index b4e650c..746ab0f 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/installations/admin.py b/installations/admin.py index fc78615..2a2f779 100644 --- a/installations/admin.py +++ b/installations/admin.py @@ -24,11 +24,12 @@ class InstallationReportAdmin(admin.ModelAdmin): list_display = ( 'assignment', 'visited_date', 'meter_type', 'meter_size', 'water_meter_manufacturer', 'discharge_pipe_diameter', 'usage_type', 'exploitation_license_number', - 'motor_power', 'pre_calibration_flow_rate', 'post_calibration_flow_rate', + 'motor_power', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date', 'new_water_meter_serial', 'seal_number', 'sim_number', + 'is_panel_sealed', 'is_panel_cut', 'is_disconnection_done', 'is_meter_suspicious', 'approved', 'created' ) - list_filter = ('is_meter_suspicious', 'approved', 'visited_date', 'meter_type', 'usage_type', 'water_meter_manufacturer') + list_filter = ('is_meter_suspicious', 'is_panel_sealed', 'is_panel_cut', 'is_disconnection_done', 'approved', 'visited_date', 'meter_type', 'usage_type', 'water_meter_manufacturer') search_fields = ( 'assignment__process_instance__code', 'new_water_meter_serial', 'seal_number', 'exploitation_license_number', 'sim_number' ) @@ -43,7 +44,7 @@ class InstallationReportAdmin(admin.ModelAdmin): ) }), ('مشخصات هیدرولیکی', { - 'fields': ('discharge_pipe_diameter', 'pre_calibration_flow_rate', 'post_calibration_flow_rate') + 'fields': ('discharge_pipe_diameter', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date') }), ('کاربری و مجوز', { 'fields': ('usage_type', 'exploitation_license_number') @@ -51,6 +52,9 @@ class InstallationReportAdmin(admin.ModelAdmin): ('توان و محرکه', { 'fields': ('driving_force', 'motor_power') }), + ('وضعیت تابلو/قطع', { + 'fields': ('is_panel_sealed', 'is_panel_cut', 'is_disconnection_done') + }), ('توضیحات', { 'fields': ('description',) }), diff --git a/installations/forms.py b/installations/forms.py index b8be2b0..4c30a5f 100644 --- a/installations/forms.py +++ b/installations/forms.py @@ -22,7 +22,8 @@ class InstallationReportForm(forms.ModelForm): 'visited_date', 'new_water_meter_serial', 'seal_number', 'utm_x', 'utm_y', 'meter_type', 'meter_size', 'meter_model', 'discharge_pipe_diameter', 'usage_type', 'exploitation_license_number', - 'motor_power', 'pre_calibration_flow_rate', 'post_calibration_flow_rate', + 'motor_power', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date', + 'is_panel_sealed', 'is_panel_cut', 'is_disconnection_done', 'water_meter_manufacturer', 'sim_number', 'driving_force', 'is_meter_suspicious', 'description' ] @@ -90,17 +91,24 @@ class InstallationReportForm(forms.ModelForm): 'class': 'form-control', 'required': True }), - 'pre_calibration_flow_rate': forms.NumberInput(attrs={ + 'flow_rate': forms.NumberInput(attrs={ 'class': 'form-control', 'min': '0', 'step': '0.0001', - 'required': True }), - 'post_calibration_flow_rate': forms.NumberInput(attrs={ + 'meter_reading': forms.NumberInput(attrs={ 'class': 'form-control', 'min': '0', 'step': '0.0001', - 'required': True + }), + 'meter_charge': forms.NumberInput(attrs={ + 'class': 'form-control', + 'min': '0', + 'step': '0.0001', + }), + 'meter_charge_expiration_date': forms.DateInput(attrs={ + 'type': 'date', + 'class': 'form-control', }), 'water_meter_manufacturer': forms.Select(attrs={ 'class': 'form-select', @@ -119,6 +127,15 @@ class InstallationReportForm(forms.ModelForm): 'class': 'form-check-input', 'id': 'id_is_meter_suspicious', }), + 'is_panel_sealed': forms.CheckboxInput(attrs={ + 'class': 'form-check-input', + }), + 'is_panel_cut': forms.CheckboxInput(attrs={ + 'class': 'form-check-input', + }), + 'is_disconnection_done': forms.CheckboxInput(attrs={ + 'class': 'form-check-input', + }), 'description': forms.Textarea(attrs={ 'class': 'form-control', 'rows': 3 @@ -137,12 +154,17 @@ class InstallationReportForm(forms.ModelForm): 'usage_type': 'نوع مصرف', 'exploitation_license_number': 'شماره پروانه بهره‌برداری', 'motor_power': 'قدرت موتور (کیلووات ساعت)', - 'pre_calibration_flow_rate': 'دبی قبل از کالیبراسیون (لیتر بر ثانیه)', - 'post_calibration_flow_rate': 'دبی بعد از کالیبراسیون (لیتر بر ثانیه)', + 'flow_rate': 'دبی (لیتر بر ثانیه)', + 'meter_reading': 'عدد کنتور (متر مکعب)', + 'meter_charge': 'شارژ کنتور (متر مکعب)', + 'meter_charge_expiration_date': 'تاریخ پایان اعتبار شارژ', 'water_meter_manufacturer': 'شرکت سازنده کنتور', 'sim_number': 'شماره سیمکارت', 'driving_force': 'نیرو محرکه چاه', 'is_meter_suspicious': 'کنتور مشکوک است', + 'is_panel_sealed': 'پلمپ تابلو', + 'is_panel_cut': 'تابلو قطع', + 'is_disconnection_done': 'انجام عملیات قطع', 'description': 'توضیحات' } diff --git a/installations/migrations/0012_installationreport_flow_rate_and_more.py b/installations/migrations/0012_installationreport_flow_rate_and_more.py new file mode 100644 index 0000000..1f3f29b --- /dev/null +++ b/installations/migrations/0012_installationreport_flow_rate_and_more.py @@ -0,0 +1,50 @@ +# Generated by Django 5.2.4 on 2025-10-27 03:42 + +import django.core.validators +from decimal import Decimal +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('installations', '0011_alter_installationreport_discharge_pipe_diameter'), + ] + + operations = [ + migrations.AddField( + model_name='installationreport', + name='flow_rate', + field=models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='(لیتر بر ثانیه)دبی'), + ), + migrations.AddField( + model_name='installationreport', + name='is_disconnection_done', + field=models.BooleanField(default=False, verbose_name='انجام عملیات قطع'), + ), + migrations.AddField( + model_name='installationreport', + name='is_panel_cut', + field=models.BooleanField(default=False, verbose_name='تابلو قطع'), + ), + migrations.AddField( + model_name='installationreport', + name='is_panel_sealed', + field=models.BooleanField(default=False, verbose_name='پلمپ تابلو'), + ), + migrations.AddField( + model_name='installationreport', + name='meter_charge', + field=models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0'))], verbose_name='شارژ کنتور (متر مکعب)'), + ), + migrations.AddField( + model_name='installationreport', + name='meter_charge_expiration_date', + field=models.DateField(blank=True, null=True, verbose_name='تاریخ پایان اعتبار شارژ'), + ), + migrations.AddField( + model_name='installationreport', + name='meter_reading', + field=models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0'))], verbose_name='عدد کنتور (متر مکعب)'), + ), + ] diff --git a/installations/migrations/0013_remove_installationreport_post_calibration_flow_rate_and_more.py b/installations/migrations/0013_remove_installationreport_post_calibration_flow_rate_and_more.py new file mode 100644 index 0000000..31f653d --- /dev/null +++ b/installations/migrations/0013_remove_installationreport_post_calibration_flow_rate_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 5.2.4 on 2025-10-27 03:47 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('installations', '0012_installationreport_flow_rate_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='installationreport', + name='post_calibration_flow_rate', + ), + migrations.RemoveField( + model_name='installationreport', + name='pre_calibration_flow_rate', + ), + ] diff --git a/installations/models.py b/installations/models.py index c7d7e31..ae86340 100644 --- a/installations/models.py +++ b/installations/models.py @@ -55,6 +55,12 @@ class InstallationReport(BaseModel): ] meter_model = models.CharField(max_length=20, choices=METER_MODEL_CHOICES, null=True, blank=True, verbose_name='مدل کنتور') meter_size = models.CharField(max_length=50, null=True, blank=True, verbose_name='سایز کنتور') + meter_reading = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, validators=[MinValueValidator(Decimal('0'))], verbose_name='عدد کنتور (متر مکعب)') + meter_charge = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, validators=[MinValueValidator(Decimal('0'))], verbose_name='شارژ کنتور (متر مکعب)') + meter_charge_expiration_date = models.DateField(null=True, blank=True, verbose_name='تاریخ پایان اعتبار شارژ') + is_panel_sealed = models.BooleanField(default=False, verbose_name='پلمپ تابلو') + is_panel_cut = models.BooleanField(default=False, verbose_name='تابلو قطع') + is_disconnection_done = models.BooleanField(default=False, verbose_name='انجام عملیات قطع') discharge_pipe_diameter = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name='قطر لوله آبده (اینچ)') USAGE_TYPE_CHOICES = [ ('domestic', 'شرب و خدمات'), @@ -64,8 +70,7 @@ class InstallationReport(BaseModel): usage_type = models.CharField(max_length=20, choices=USAGE_TYPE_CHOICES, null=True, verbose_name='نوع مصرف') exploitation_license_number = models.CharField(max_length=50, verbose_name='شماره پروانه بهره‌برداری چاه') motor_power = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name='(کیلووات ساعت) قدرت موتور') - pre_calibration_flow_rate = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name='(لیتر بر ثانیه)دبی قبل از کالیبراسیون') - post_calibration_flow_rate = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name='(لیتر بر ثانیه)دبی بعد از کالیبراسیون') + flow_rate = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name='(لیتر بر ثانیه)دبی') water_meter_manufacturer = models.ForeignKey('wells.WaterMeterManufacturer', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='شرکت سازنده کنتور آب') sim_number = models.CharField(max_length=20, null=True, blank=True, verbose_name='شماره سیمکارت') driving_force = models.CharField(max_length=50, null=True, blank=True, verbose_name='نیرو محرکه چاه') diff --git a/installations/templates/installations/installation_report_step.html b/installations/templates/installations/installation_report_step.html index 3246dea..fbd0405 100644 --- a/installations/templates/installations/installation_report_step.html +++ b/installations/templates/installations/installation_report_step.html @@ -156,8 +156,10 @@ {% endif %}

قطر لوله آبده (اینچ): {{ report.discharge_pipe_diameter|default:'-' }}

سازنده کنتور: {{ report.water_meter_manufacturer|default:'-' }}

-

شماره سیمکارت: {{ report.sim_number|default:'-' }}

+

شماره سیمکارت: {{ report.sim_number|default:'-' }}

نیرو محرکه چاه: {{ report.driving_force|default:'-' }}

+

شارژ کنتور (متر مکعب): {{ report.meter_charge|default:'-' }}

+

پایان اعتبار شارژ: {{ report.meter_charge_expiration_date|to_jalali|default:'-' }}

کنتور مشکوک: {{ report.is_meter_suspicious|yesno:'بله,خیر' }}

@@ -165,9 +167,12 @@

UTM Y: {{ report.utm_y|default:'-' }}

نوع مصرف: {{ report.get_usage_type_display|default:'-' }}

شماره پروانه بهره‌برداری: {{ report.exploitation_license_number|default:'-' }}

-

قدرت موتور(کیلووات ساعت): {{ report.motor_power|default:'-' }}

-

دبی قبل کالیبراسیون(لیتر/ثانیه): {{ report.pre_calibration_flow_rate|default:'-' }}

-

دبی بعد کالیبراسیون(لیتر/ثانیه): {{ report.post_calibration_flow_rate|default:'-' }}

+

قدرت موتور (کیلووات ساعت): {{ report.motor_power|default:'-' }}

+

دبی (لیتر/ثانیه): {{ report.flow_rate|default:'-' }}

+

عدد کنتور (متر مکعب): {{ report.meter_reading|default:'-' }}

+

پلمپ تابلو: {{ report.is_panel_sealed|yesno:'بله,خیر' }}

+

تابلو قطع: {{ report.is_panel_cut|yesno:'بله,خیر' }}

+

انجام عملیات قطع: {{ report.is_disconnection_done|yesno:'بله,خیر' }}

@@ -389,17 +394,32 @@ {% endif %}
- {{ form.pre_calibration_flow_rate.label_tag }} - {{ form.pre_calibration_flow_rate }} - {% if form.pre_calibration_flow_rate.errors %} -
{{ form.pre_calibration_flow_rate.errors.0 }}
+ {{ form.flow_rate.label_tag }} + {{ form.flow_rate }} + {% if form.flow_rate.errors %} +
{{ form.flow_rate.errors.0 }}
{% endif %}
- {{ form.post_calibration_flow_rate.label_tag }} - {{ form.post_calibration_flow_rate }} - {% if form.post_calibration_flow_rate.errors %} -
{{ form.post_calibration_flow_rate.errors.0 }}
+ {{ form.meter_reading.label_tag }} + {{ form.meter_reading }} + {% if form.meter_reading.errors %} +
{{ form.meter_reading.errors.0 }}
+ {% endif %} +
+
+ {{ form.meter_charge.label_tag }} + {{ form.meter_charge }} + {% if form.meter_charge.errors %} +
{{ form.meter_charge.errors.0 }}
+ {% endif %} +
+
+ {{ form.meter_charge_expiration_date.label_tag }} + + + {% if form.meter_charge_expiration_date.errors %} +
{{ form.meter_charge_expiration_date.errors.0 }}
{% endif %}
@@ -432,14 +452,43 @@
{{ form.driving_force.errors.0 }}
{% endif %}
-
-
- {{ form.is_meter_suspicious }} - {{ form.is_meter_suspicious.label_tag }} +
+
+
+ {{ form.is_meter_suspicious }} + {{ form.is_meter_suspicious.label_tag }} +
+ {% if form.is_meter_suspicious.errors %} +
{{ form.is_meter_suspicious.errors.0 }}
+ {% endif %} +
+
+
+ {{ form.is_panel_sealed }} + {{ form.is_panel_sealed.label_tag }} +
+ {% if form.is_panel_sealed.errors %} +
{{ form.is_panel_sealed.errors.0 }}
+ {% endif %} +
+
+
+ {{ form.is_panel_cut }} + {{ form.is_panel_cut.label_tag }} +
+ {% if form.is_panel_cut.errors %} +
{{ form.is_panel_cut.errors.0 }}
+ {% endif %} +
+
+
+ {{ form.is_disconnection_done }} + {{ form.is_disconnection_done.label_tag }} +
+ {% if form.is_disconnection_done.errors %} +
{{ form.is_disconnection_done.errors.0 }}
+ {% endif %}
- {% if form.is_meter_suspicious.errors %} -
{{ form.is_meter_suspicious.errors.0 }}
- {% endif %}
@@ -653,7 +702,7 @@