meraproject/themes/merakomis/fot/budget/controller.php
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

37 lines
816 B
PHP

<?
namespace controller\themes\merakomis\fot\budget;
use ms\ms\structure\msControllerTable;
use themes\merakomis\Emp;
use themes\merakomis\fot\Budget;
class Api extends msControllerTable {
static $class = 'themes\merakomis\fot\Budget';
static function math()
{
$year = 2025;
$month = 3;
$b = Budget::get($year,$month);
Budget::math($b[Budget::$ID],$month);
}
static function updateFromTable()
{
$id = intval($_POST['id']?:$_GET['id']);
$value = cfloatval($_POST['value']?:$_GET['value']);
$res = [];
if(Emp::$IS_AUTH || true){
$r = Budget::updateById($id,[Budget::$MONEY=>$value,Budget::$CHANGED=>1]);
Budget::math($id);
$res['status'] = $r;
}
echo je($res);
}
}