'That invoice no longer exists.'])); } $client_id = intval($doc['client_id']); enforceClientAccess(); $doc_number = billingNumber($doc_type, $doc); // Without the card fee it was paid with - that was for the payment (billingWithoutCardFees()) [$copy_lines, $card_fees] = billingWithoutCardFees(billingItems('invoice', intval($doc['invoice_id']))); $lines = count($copy_lines); // 0 is On Receipt - a contract in force's net terms, else the default [$terms, $terms_from] = contractNetTermsWhose($client_id, date('Y-m-d')); ob_start(); ?>