Overview
Comment:Fix count for simple tracking
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3db9fbfa3db7f0fa4a43fe7f7f6029afdff02316
User & Date: bohwaz on 2020-12-08 18:04:04
Other Links: manifest | tags
Context
2020-12-08
18:14
Alert message if statement is unbalanced check-in: f5f8777028 user: bohwaz tags: trunk
18:04
Fix count for simple tracking check-in: 3db9fbfa3d user: bohwaz tags: trunk
17:47
Allow to do an opening balance from nothing check-in: 99bb6ee70f user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Accounting/Transactions.php from [907c89f054] to [4a62ce7a06].

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
			LEFT JOIN acc_accounts b ON b.id = l.id_analytical';
		$conditions = sprintf('t.type = %s AND t.id_year = %d', $type, $year_id);

		$sum = 0;

		$list = new DynamicList($columns, $tables, $conditions);
		$list->orderBy('date', true);
		$list->setCount('COUNT(*)');
		$list->groupBy('t.id');
		$list->setModifier(function (&$row) use (&$sum, $reverse) {
			$row->date = \DateTime::createFromFormat('!Y-m-d', $row->date);
		});
		$list->setExportCallback(function (&$row) {
			$row->change = Utils::money_format($row->change, '.', '', false);
		});

		return $list;
	}
}







|











389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
			LEFT JOIN acc_accounts b ON b.id = l.id_analytical';
		$conditions = sprintf('t.type = %s AND t.id_year = %d', $type, $year_id);

		$sum = 0;

		$list = new DynamicList($columns, $tables, $conditions);
		$list->orderBy('date', true);
		$list->setCount('COUNT(DISTINCT t.id)');
		$list->groupBy('t.id');
		$list->setModifier(function (&$row) use (&$sum, $reverse) {
			$row->date = \DateTime::createFromFormat('!Y-m-d', $row->date);
		});
		$list->setExportCallback(function (&$row) {
			$row->change = Utils::money_format($row->change, '.', '', false);
		});

		return $list;
	}
}