Пример #1
0
    echo json_encode($employer);
    exit;
} elseif ($_GET['page'] === "edit-employer-dialog") {
    $employer = $model->getAllEmployer($_POST['id']);
    $employer['lang'] = $l10n->getLanguage();
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($employer);
    exit;
} elseif ($_GET['page'] === "edit-contact-dialog") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($model->getContactDetail($_POST['id'], $_POST['employer_id']));
    exit;
} elseif ($_GET['page'] === "show-contacts") {
    $contacts = array();
    $id = $_POST['id'];
    $billingContacts = $model->getBillingContact($id);
    $directContacts = $model->getDirectContact($id);
    if ($billingContacts) {
        foreach ($billingContacts as $b) {
            $b['contactType'] = 'billing';
            $contacts[$b['id']] = $b;
        }
    }
    if ($directContacts) {
        foreach ($directContacts as $d) {
            $d['contactType'] = 'direct';
            if ($contacts[$d['id']]) {
                $d['contactType'] = 'billing_direct';
            }
            $contacts[$d['id']] = $d;
        }
Пример #2
0
    $invoiceSummary = $model->getInvoiceSummary();
    $l10n->addResource(__DIR__ . '/l10n/invoices.json');
    $l10n->localizeArray($invoices, 'org_name');
    $l10n->localizeArray($invoices, 'event_name');
    $viewFile = 'views/invoices.php';
} elseif ($_GET['page'] === "get-events") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($eventModel->getEvent());
    exit;
} elseif ($_GET['page'] === "get-employers") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($eventModel->getEventRegistrationEvent($_POST['id']));
    exit;
} elseif ($_GET['page'] === "get-billing-contacts") {
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($employerModel->getBillingContact($_GET['id']));
    exit;
} elseif ($_GET['page'] === "download-invoice" || $_GET['page'] === "preview-invoice") {
    $result = $model->getInvoice($_GET['id']);
    $row = $result[0];
    if ($row['issued']) {
        // get latest invoice
        $issued_invoices = $model->getIssuedInvoices($row['id']);
        $latest_invoice = $issued_invoices[0];
        $mpdf = new \mPDF();
        $mpdf->WriteHTML($latest_invoice['file_contents']);
        $outputTag = $_GET['page'] === "preview-invoice" ? 'I' : 'D';
        $mpdf->Output($latest_invoice['file_name'], $outputTag);
        exit;
    }
    $requestedINV = $model->calculateInvoice($row);