diff --git a/certificates/templates/certificates/print.html b/certificates/templates/certificates/print.html index 3e75dc5..39b028a 100644 --- a/certificates/templates/certificates/print.html +++ b/certificates/templates/certificates/print.html @@ -5,7 +5,6 @@ تاییدیه - {{ instance.code }} {% load static %} - {% load common_tags %} @@ -53,31 +52,21 @@
مشخصات چاه و کنتور هوشمند
-
موقعیت مکانی (UTM): X: {{ latest_report.utm_x|default:'-' }} , Y: {{ latest_report.utm_y|default:'-' }}
+
موقعیت مکانی (UTM): {{ latest_report.utm_x|default:'-' }} , {{ latest_report.utm_y|default:'-' }}
نیرو محرکه چاه: {{ latest_report.driving_force|default:'-' }}
نوع کنتور: {{ latest_report.get_meter_type_display|default:'-' }}
- {% if latest_report.meter_type == 'smart' %} -
مدل کنتور: {{ latest_report.get_meter_model_display|default:'-' }}
- {% else %} -
سایز کنتور: {{ latest_report.meter_size|default:'-' }}
- {% endif %} +
قطر لوله آبده (اینچ): {{ latest_report.discharge_pipe_diameter|default:'-' }}
نوع مصرف: {{ 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.discharge_pipe_diameter|default:'-' }}
+
سایز کنتور: {{ latest_report.meter_size|default:'-' }}
شماره پروانه بهره‌برداری چاه: {{ latest_report.exploitation_license_number|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.motor_power|default:'-' }}
+
دبی قبل از کالیبراسیون: {{ latest_report.pre_calibration_flow_rate|default:'-' }}
+
دبی بعد از کالیبراسیون: {{ latest_report.post_calibration_flow_rate|default:'-' }}
نام شرکت کنتورساز: {{ 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 8696e6c..f8249cb 100644 --- a/certificates/templates/certificates/step.html +++ b/certificates/templates/certificates/step.html @@ -2,7 +2,6 @@ {% load static %} {% load processes_tags %} {% load humanize %} - {% load common_tags %} {% load accounts_tags %} {% block sidebar %} @@ -74,30 +73,21 @@
مشخصات چاه و کنتور هوشمند
-
موقعیت مکانی (UTM):X: {{ latest_report.utm_x|default:'-' }} , Y: {{ latest_report.utm_y|default:'-' }}
+
موقعیت مکانی (UTM):{{ latest_report.utm_x|default:'-' }} , {{ latest_report.utm_y|default:'-' }}
نیرو محرکه چاه:{{ latest_report.driving_force|default:'-' }}
نوع کنتور:{{ latest_report.get_meter_type_display|default:'-' }}
- {% if latest_report.meter_type == 'smart' %} -
مدل کنتور:{{ latest_report.get_meter_model_display|default:'-' }}
- {% else %} -
سایز کنتور:{{ latest_report.meter_size|default:'-' }}
- {% endif %} +
قطر لوله آبده (اینچ):{{ latest_report.discharge_pipe_diameter|default:'-' }}
نوع مصرف:{{ 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.discharge_pipe_diameter|default:'-' }}
+
سایز کنتور:{{ latest_report.meter_size|default:'-' }}
شماره پروانه بهره‌برداری چاه:{{ latest_report.exploitation_license_number|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.motor_power|default:'-' }}
+
دبی قبل از کالیبراسیون:{{ latest_report.pre_calibration_flow_rate|default:'-' }}
+
دبی بعد از کالیبراسیون:{{ latest_report.post_calibration_flow_rate|default:'-' }}
نام شرکت کنتورساز:{{ latest_report.water_meter_manufacturer.name|default:'-' }}
+
شماره سریال کنتور:{{ instance.well.water_meter_serial_number|default:'-' }}
diff --git a/db.sqlite3 b/db.sqlite3 index 746ab0f..b4e650c 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/installations/admin.py b/installations/admin.py index 2a2f779..fc78615 100644 --- a/installations/admin.py +++ b/installations/admin.py @@ -24,12 +24,11 @@ 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', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date', + 'motor_power', 'pre_calibration_flow_rate', 'post_calibration_flow_rate', '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', 'is_panel_sealed', 'is_panel_cut', 'is_disconnection_done', 'approved', 'visited_date', 'meter_type', 'usage_type', 'water_meter_manufacturer') + list_filter = ('is_meter_suspicious', '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' ) @@ -44,7 +43,7 @@ class InstallationReportAdmin(admin.ModelAdmin): ) }), ('مشخصات هیدرولیکی', { - 'fields': ('discharge_pipe_diameter', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date') + 'fields': ('discharge_pipe_diameter', 'pre_calibration_flow_rate', 'post_calibration_flow_rate') }), ('کاربری و مجوز', { 'fields': ('usage_type', 'exploitation_license_number') @@ -52,9 +51,6 @@ 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 4c30a5f..b8be2b0 100644 --- a/installations/forms.py +++ b/installations/forms.py @@ -22,8 +22,7 @@ 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', 'flow_rate', 'meter_reading', 'meter_charge', 'meter_charge_expiration_date', - 'is_panel_sealed', 'is_panel_cut', 'is_disconnection_done', + 'motor_power', 'pre_calibration_flow_rate', 'post_calibration_flow_rate', 'water_meter_manufacturer', 'sim_number', 'driving_force', 'is_meter_suspicious', 'description' ] @@ -91,24 +90,17 @@ class InstallationReportForm(forms.ModelForm): 'class': 'form-control', 'required': True }), - 'flow_rate': forms.NumberInput(attrs={ + 'pre_calibration_flow_rate': forms.NumberInput(attrs={ 'class': 'form-control', 'min': '0', 'step': '0.0001', + 'required': True }), - 'meter_reading': forms.NumberInput(attrs={ + 'post_calibration_flow_rate': forms.NumberInput(attrs={ 'class': 'form-control', 'min': '0', 'step': '0.0001', - }), - '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', + 'required': True }), 'water_meter_manufacturer': forms.Select(attrs={ 'class': 'form-select', @@ -127,15 +119,6 @@ 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 @@ -154,17 +137,12 @@ class InstallationReportForm(forms.ModelForm): 'usage_type': 'نوع مصرف', 'exploitation_license_number': 'شماره پروانه بهره‌برداری', 'motor_power': 'قدرت موتور (کیلووات ساعت)', - 'flow_rate': 'دبی (لیتر بر ثانیه)', - 'meter_reading': 'عدد کنتور (متر مکعب)', - 'meter_charge': 'شارژ کنتور (متر مکعب)', - 'meter_charge_expiration_date': 'تاریخ پایان اعتبار شارژ', + 'pre_calibration_flow_rate': 'دبی قبل از کالیبراسیون (لیتر بر ثانیه)', + 'post_calibration_flow_rate': 'دبی بعد از کالیبراسیون (لیتر بر ثانیه)', '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 deleted file mode 100644 index 1f3f29b..0000000 --- a/installations/migrations/0012_installationreport_flow_rate_and_more.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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 deleted file mode 100644 index 31f653d..0000000 --- a/installations/migrations/0013_remove_installationreport_post_calibration_flow_rate_and_more.py +++ /dev/null @@ -1,21 +0,0 @@ -# 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 ae86340..c7d7e31 100644 --- a/installations/models.py +++ b/installations/models.py @@ -55,12 +55,6 @@ 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', 'شرب و خدمات'), @@ -70,7 +64,8 @@ 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='(کیلووات ساعت) قدرت موتور') - flow_rate = 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='(لیتر بر ثانیه)دبی بعد از کالیبراسیون') 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 fbd0405..3246dea 100644 --- a/installations/templates/installations/installation_report_step.html +++ b/installations/templates/installations/installation_report_step.html @@ -156,10 +156,8 @@ {% 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:'بله,خیر' }}

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

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

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

شماره پروانه بهره‌برداری: {{ report.exploitation_license_number|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:'بله,خیر' }}

+

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

+

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

+

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

@@ -394,32 +389,17 @@ {% endif %}
- {{ form.flow_rate.label_tag }} - {{ form.flow_rate }} - {% if form.flow_rate.errors %} -
{{ form.flow_rate.errors.0 }}
+ {{ 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 }}
{% endif %}
- {{ 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 }}
+ {{ 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 }}
{% endif %}
@@ -452,43 +432,14 @@
{{ form.driving_force.errors.0 }}
{% endif %}
-
-
-
- {{ 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 %} +
+
+ {{ form.is_meter_suspicious }} + {{ form.is_meter_suspicious.label_tag }}
+ {% if form.is_meter_suspicious.errors %} +
{{ form.is_meter_suspicious.errors.0 }}
+ {% endif %}
@@ -702,7 +653,7 @@