/home/techb158/exp.abdallabala.com/application/controllers
Edit: /home/techb158/exp.abdallabala.com/application/controllers/export.php (4874B)
assign('_title', $_L['Reports'] . '- ' . $config['CompanyName']);
$ui->assign('_pagehead', '
Reports');
$ui->assign('_application_menu', 'reports');
$action = $routes['1'];
$user = User::_info();
$ui->assign('user', $user);
$mdate = date('Y-m-d');
$tdate = date('Y-m-d', strtotime('today - 30 days'));
//first day of month
$first_day_month = date('Y-m-01');
//
$this_week_start = date('Y-m-d', strtotime('previous sunday'));
// 30 days before
$before_30_days = date('Y-m-d', strtotime('today - 30 days'));
//this month
$month_n = date('n');
switch ($action) {
case 'printable':
$fdate = _post('fdate');
$tdate = _post('tdate');
$account = _post('account');
$stype = _post('stype');
$d = ORM::for_table('sys_transactions');
$d->where('account', $account);
if ($stype == 'credit') {
$d->where('dr', '0.00');
} elseif ($stype == 'debit') {
$d->where('cr', '0.00');
} else {
}
$d->where_gte('date', $fdate);
$d->where_lte('date', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$ui->assign('d', $x);
$ui->assign('fdate', $fdate);
$ui->assign('tdate', $tdate);
$ui->assign('account', $account);
$ui->display('printable.tpl');
break;
case 'pdf':
$fdate = _post('fdate');
$tdate = _post('tdate');
$account = _post('account');
$stype = _post('stype');
$d = ORM::for_table('sys_transactions');
$d->where('account', $account);
if ($stype == 'credit') {
$d->where('dr', '0.00');
} elseif ($stype == 'debit') {
$d->where('cr', '0.00');
} else {
}
$d->where_gte('date', $fdate);
$d->where_lte('date', $tdate);
$d->order_by_desc('id');
$x = $d->find_many();
$aadmin = $user['fullname'];
// $filename= date('Y-m-d')._raid(4).'.pdf';
$title = $account . ' Statement [' . $fdate . ' - ' . $tdate . ']';
$title = str_replace('-', ' ', $title);
if ($x) {
$html =
'
' .
$account .
' Statement [' .
date($config['df'], strtotime($fdate)) .
' - ' .
date($config['df'], strtotime($tdate)) .
']
| ' .
$_L['Date'] .
' |
' .
$_L['Description'] .
' |
' .
$_L['Dr'] .
' |
' .
$_L['Cr'] .
' |
' .
$_L['Balance'] .
' |
';
$c = true;
foreach ($x as $value) {
// $date = $value['date'];
$date = date($config['df'], strtotime($value['date']));
$description = $value['description'];
$dr = $value['dr'];
$cr = $value['cr'];
$bal = $value['bal'];
$html .=
"" .
"
| $date |
$description |
$dr |
$cr |
$bal |
";
}
$html .= '
';
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetTitle($config['CompanyName'] . ' Statement');
$mpdf->SetAuthor($config['CompanyName']);
$mpdf->SetWatermarkText($d['status']);
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'Helvetica';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$style = '
';
$nhtml = <<
WriteHTML($nhtml);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset pointer to the last page
// ---------------------------------------------------------
//Close and output PDF document
$mpdf->Output(date('Y-m-d') . _raid(4) . '.pdf', 'D');
} else {
echo 'No Data';
}
break;
default:
echo 'action not defined';
}