diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx
index 67e8381c9..965839c55 100644
--- a/client/src/components/job-detail-lines/job-lines.component.jsx
+++ b/client/src/components/job-detail-lines/job-lines.component.jsx
@@ -160,7 +160,7 @@ export function JobLinesComponent({
render: (text, record) => (
<>
{record.act_price}
- {record.prt_dsmk_p !== 0 && (
+ {record.prt_dsmk_p && record.prt_dsmk_p !== 0 && (
{`(${record.prt_dsmk_p}%)`}
diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
index 07e9cc009..a2fa6b8ac 100644
--- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
+++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx
@@ -210,6 +210,13 @@ export default function JobLinesUpsertModalComponent({
>
+
+
+
diff --git a/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/down.yaml b/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/down.yaml
new file mode 100644
index 000000000..106fafc7e
--- /dev/null
+++ b/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/down.yaml
@@ -0,0 +1,5 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE ONLY "public"."joblines" ALTER COLUMN "prt_dsmk_p" DROP DEFAULT;
+ type: run_sql
diff --git a/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/up.yaml b/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/up.yaml
new file mode 100644
index 000000000..1b845543f
--- /dev/null
+++ b/hasura/migrations/1622571272382_alter_table_public_joblines_alter_column_prt_dsmk_p/up.yaml
@@ -0,0 +1,6 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE ONLY "public"."joblines" ALTER COLUMN "prt_dsmk_p" SET DEFAULT
+ 0;
+ type: run_sql
diff --git a/hasura/migrations/1622571551101_run_sql_migration/down.yaml b/hasura/migrations/1622571551101_run_sql_migration/down.yaml
new file mode 100644
index 000000000..fe51488c7
--- /dev/null
+++ b/hasura/migrations/1622571551101_run_sql_migration/down.yaml
@@ -0,0 +1 @@
+[]
diff --git a/hasura/migrations/1622571551101_run_sql_migration/up.yaml b/hasura/migrations/1622571551101_run_sql_migration/up.yaml
new file mode 100644
index 000000000..579fcb8c2
--- /dev/null
+++ b/hasura/migrations/1622571551101_run_sql_migration/up.yaml
@@ -0,0 +1,5 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: "update joblines \nset prt_dsmk_p = 0 where joblines.prt_dsmk_p is null;"
+ type: run_sql
diff --git a/server/job/job-costing.js b/server/job/job-costing.js
index 3f67bc36a..179b96d4d 100644
--- a/server/job/job-costing.js
+++ b/server/job/job-costing.js
@@ -314,7 +314,7 @@ function GenerateCostingData(job) {
amount: Math.round((val.act_price || 0) * 100),
})
.multiply(val.part_qty || 0)
- .percentage(val.prt_dsmk_p)
+ .percentage(val.prt_dsmk_p || 0)
);
if (!acc.parts[partsProfitCenter])
acc.parts[partsProfitCenter] = Dinero();
@@ -343,7 +343,7 @@ function GenerateCostingData(job) {
amount: Math.round((val.act_price || 0) * 100),
})
.multiply(val.part_qty || 0)
- .percentage(val.prt_dsmk_p)
+ .percentage(val.prt_dsmk_p || 0)
);
if (!acc.parts[partsProfitCenter])
diff --git a/server/job/job-totals.js b/server/job/job-totals.js
index 45f6bb4e5..ee9d76aca 100644
--- a/server/job/job-totals.js
+++ b/server/job/job-totals.js
@@ -217,7 +217,7 @@ function CalculatePartsTotals(jobLines) {
amount: Math.round((value.act_price || 0) * 100),
})
.multiply(value.part_qty || 0)
- .percentage(value.prt_dsmk_p)
+ .percentage(value.prt_dsmk_p || 0)
),
list: {
...acc.parts.list,
@@ -248,7 +248,7 @@ function CalculatePartsTotals(jobLines) {
amount: Math.round((value.act_price || 0) * 100),
})
.multiply(value.part_qty || 0)
- .percentage(value.prt_dsmk_p)
+ .percentage(value.prt_dsmk_p || 0)
),
},
};
@@ -382,7 +382,7 @@ function CalculateTaxesTotals(job, otherTotals) {
amount: Math.round((val.act_price || 0) * 100),
})
.multiply(val.part_qty || 0)
- .percentage(val.prt_dsmk_p)
+ .percentage(val.prt_dsmk_p || 0)
)
.percentage(
((job.parts_tax_rates &&