} } redir("id=" . $invoiceid); } $smartyvalues['manualapplycredit'] = true; $smartyvalues['totalcredit'] = formatCurrency($creditbal) . generate_token("form"); if (!$creditamount) { $creditamount = $balance <= $creditbal ? $balance : $creditbal; } $smartyvalues['creditamount'] = $creditamount; } $outputvars = $invoice->getOutput(); $smartyvalues = array_merge($smartyvalues, $outputvars); $invoiceitems = $invoice->getLineItems(); $smartyvalues['invoiceitems'] = $invoiceitems; $transactions = $invoice->getTransactions(); $smartyvalues['transactions'] = $transactions; $paymentbutton = $invoice->getData("status") == "Unpaid" && 0 < $invoice->getData("balance") ? $invoice->getPaymentLink() : ""; $smartyvalues['paymentbutton'] = $paymentbutton; $smartyvalues['offlinepaid'] = $whmcs->get_req_var("offlinepaid"); if ($whmcs->get_config("AllowCustomerChangeInvoiceGateway")) { $smartyvalues['allowchangegateway'] = true; $gateways = new WHMCS_Gateways(); $availablegateways = $gateways->getAvailableGateways($invoiceid); $frm = new WHMCS_Form(); $gatewaydropdown = generate_token("form") . $frm->dropdown("gateway", $availablegateways, $invoice->getData("paymentmodule"), "submit()"); $smartyvalues['gatewaydropdown'] = $gatewaydropdown; } else { $smartyvalues['allowchangegateway'] = false; } outputClientArea("viewinvoice", true);