<?php
date_default_timezone_set('Asia/Jakarta');
/**
 * Generate tagihan bulanan otomatis
 * Jalankan: 0 0 1 * * /usr/bin/php /path/to/cron/generate_monthly_bills.php
 * (Setiap tanggal 1 jam 00:00)
 */
require_once __DIR__ . '/../includes/db.php';
require_once __DIR__ . '/../includes/functions.php';
require_once __DIR__ . '/../classes/Bill.php';

$month = date('n');
$year  = date('Y');
$count = Bill::generateMonthly($month, $year);

echo "[" . date('Y-m-d H:i:s') . "] Generated $count bills for $month/$year\n";