$response = array('employer' => $result); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'resend') { $invoice = Invoice::get($_POST['id']); $invoice[0]['items'] = Invoice::getItems($_POST['id']); $employer = new Employer($invoice[0]['employer']); $recipients = $employer->getEmailAddress(); if (isset($_POST['recipients'])) { if (!empty($_POST['recipients'])) { $recipients = str_replace(';', ',', $_POST['recipients']); } } $branch = $employer->getAssociatedBranch(); $sales = 'sales.' . strtolower($branch[0]['country']) . '@yellowelevator.com'; $branch[0]['address'] = str_replace(array("\r\n", "\r"), "\n", $branch[0]['address']); $branch['address_lines'] = explode("\n", $branch[0]['address']); $currency = Currency::getSymbolFromCountryCode($branch[0]['country']); $amount_payable = 0.0; foreach ($invoice[0]['items'] as $i => $item) { $amount_payable += $item['amount']; $items[$i]['amount'] = number_format($item['amount'], 2, '.', ', '); } $amount_payable = number_format($amount_payable, 2, '.', ', '); // generate pdf $pdf = new GeneralInvoice(); $pdf->AliasNbPages(); $pdf->SetAuthor('Yellow Elevator. This invoice was automatically generated. Signature is not required.'); $pdf->SetTitle($GLOBALS['COMPANYNAME'] . ' - Invoice ' . pad($invoice[0]['id'], 11, '0'));
protected function support($_employer_id = '') { $support = file_get_contents(dirname(__FILE__) . '/../../html/employer_support.html'); $support = str_replace('%root%', $this->url_root, $support); $phone_number = ''; $fax_number = ''; $country_code = ''; if (!empty($_employer_id)) { $employer = new Employer($_employer_id); $branch = $employer->getAssociatedBranch(); $phone_number = $branch[0]['phone']; $fax_number = $branch[0]['fax']; $country_code = $branch[0]['country']; } if (empty($phone_number) || is_null($phone_number)) { $phone_number = '+60 4 640 6363'; } if (empty($fax_number) || is_null($fax_number)) { $fax_number = '+60 4 640 6366'; } if (empty($country_code) || is_null($country_code)) { $country_code = 'my'; } $support = str_replace('%phone_number%', $phone_number, $support); $support = str_replace('%fax_number%', $fax_number, $support); $support = str_replace('%country%', strtolower($country_code), $support); echo $support; }