query("SELECT id, title, amount, expected_date FROM pf_expected_expenses WHERE is_paid = 0 ORDER BY expected_date ASC"); $provisions = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($provisions)) { $html = '

' . tr('no_provisions') . '

'; } else { $html = ''; $html .= ''; $html .= ''; $html .= ''; foreach ($provisions as $p) { $dateFormated = date('d/m/Y', strtotime($p['expected_date'])); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= '
' . tr('provision_label') . '' . tr('amount') . '' . tr('expected_date') . 'Actions
' . htmlspecialchars($p['title']) . '' . number_format($p['amount'], 2, ',', ' ') . ' €' . $dateFormated . '
'; } echo json_encode(['success' => true, 'html' => $html]); } catch (PDOException $e) { echo json_encode(['success' => false, 'message' => $e->getMessage()]); }