コード例 #1
0
ファイル: ViewCheque.php プロジェクト: J-P-Hanafin/TimeTrex-1
$smarty->assign('title', TTi18n::gettext($title = 'Employee Pay Stub'));
// See index.php
BreadCrumb::setCrumb($title);
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'page', 'sort_column', 'sort_order', 'hide_employer_rows', 'id', 'ids', 'export_type')));
$export_type = strtolower($export_type);
switch ($action) {
    default:
        if (isset($id) and !isset($ids)) {
            $ids = array($id);
        }
        if (count($ids) > 0) {
            $pslf = new PayStubListFactory();
            if ($permission->Check('pay_stub', 'view')) {
                $pslf->getByCompanyIdAndId($current_company->getId(), $ids);
            } else {
                $pslf->getByUserIdAndId($current_user->getId(), $ids);
                $hide_employer_rows = TRUE;
            }
            $output = $pslf->exportPayStub($pslf, $export_type);
            if (Debug::getVerbosity() < 11) {
                Misc::FileDownloadHeader('checks_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.pdf', 'application/pdf', strlen($output));
                echo $output;
                exit;
            }
        }
        break;
}
//Debug::Display();
コード例 #2
0
             $filter_data['hide_employer_rows'] = FALSE;
         }
         $output = $pslf->getPayStub($pslf, (bool) $filter_data['hide_employer_rows']);
         if (Debug::getVerbosity() < 11) {
             Misc::FileDownloadHeader('pay_stub.pdf', 'application/pdf', strlen($output));
             echo $output;
             exit;
         }
     }
 } elseif ($action == 'export' and $filter_data['export_type'] != 'csv') {
     Debug::Text('Export NON-CSV', __FILE__, __LINE__, __METHOD__, 10);
     $pslf = new PayStubListFactory();
     //$pslf->getByUserIdAndCompanyIdAndPayPeriodId( $filter_data['user_ids'], $current_company->getId(), $filter_data['pay_period_ids']);
     $pslf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
     if ($pslf->getRecordCount() > 0 and strlen($filter_data['export_type']) >= 3) {
         $output = $pslf->exportPayStub($pslf, $filter_data['export_type']);
         if (Debug::getVerbosity() < 11) {
             if (stristr($filter_data['export_type'], 'cheque')) {
                 Misc::FileDownloadHeader('checks_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.pdf', 'application/pdf', strlen($output));
             } else {
                 Misc::FileDownloadHeader('eft_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.txt', 'application/text', strlen($output));
             }
             if ($output != FALSE) {
                 echo $output;
             } else {
                 echo TTi18n::gettext('No data to export.') . "<br>\n";
             }
             exit;
         }
     } else {
         echo TTi18n::gettext('No data to export or export format is invalid.') . "<br>\n";