diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 0a56fe6ca753..e58afced97fd 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1030,14 +1030,20 @@ class Invoice extends EntityModel implements BalanceAffecting if($dueDate) { return date('Y-m-d', $dueDate);// SQL format } - } - else if ($this->client->payment_terms != 0) { + } elseif ($this->client->payment_terms != 0) { // No custom due date set for this invoice; use the client's payment terms $days = $this->client->payment_terms; if ($days == -1) { $days = 0; } return date('Y-m-d', strtotime('+'.$days.' day', $now)); + } elseif ($this->account->payment_terms != 0) { + // No custom due date set for this invoice; use the client's payment terms + $days = $this->account->payment_terms; + if ($days == -1) { + $days = 0; + } + return date('Y-m-d', strtotime('+'.$days.' day', $now)); } }