kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$page = ClientData::get('page');
?>
<table class="alternate-body">
	<thead>
		<tr>
			<th>Tid</th>
			<th>Användare</th>
			<th>Konton</th>
			<th>Summa</th>
			<th>Beskrivning</th>
		</tr>
	</thead>
	<? foreach(AccountTransaction::selection(array(
			'@order' => 'timestamp:desc',
			'@limit' => array($page*50, 50),
		)) as $transaction):
	?>
		<?php 
$contents = $transaction->AccountTransactionContent(array('@custom_order' => 'abs(`account_transaction_contents`.`amount`) DESC'));
$num_rows = count($contents);
$content = array_shift($contents);
$account = $content->Account;
?>
		<tbody>
			<tr>
				<td rowspan="<?php 
echo $num_rows;
?>
"><a href="/account_transaction/<?php 
echo $transaction->id;
    $diff = $counts[$i] - $product->count;
    $money_diff += $diff * $product->value;
    $product->count = $counts[$i];
    $product->commit();
    $contents = new DeliveryContent();
    $contents->cost = 0;
    $contents->delivery_id = $delivery->id;
    $contents->product_id = $product_id;
    $contents->count = $diff;
    var_dump($contents->count);
    $contents->commit();
}
if ($money_diff != 0) {
    $from_account = Account::from_code_name('stock_diff');
    $to_account = Account::from_code_name('stock');
    $transaction = new AccountTransaction();
    $transaction->description = "inventering: {$delivery->id}";
    $transaction->user = $_SESSION['login'];
    $from = new AccountTransactionContent();
    $from->amount = $money_diff;
    $from->account_id = $from_account->id;
    $to = new AccountTransactionContent();
    $to->amount = -$money_diff;
    $to->account_id = $to_account->id;
    $transaction->commit();
    $from->account_transaction_id = $transaction->id;
    $to->account_transaction_id = $transaction->id;
    $from->commit();
    $to->commit();
}
$db->commit();
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . kickback_url());
}
$transaction = AccountTransaction::from_id(array_shift($request));
$contents = $transaction->AccountTransactionContent;
?>
<h1>Transaktion - <p><?php 
echo $transaction->description;
?>
</h1>
<table>
	<tr>
		<th>Användare</th>
		<td><?php 
echo $transaction->User;
?>
</td>
	</tr>
	<tr>
		<th>Tid</th>
		<td><?php 
echo $transaction->timestamp;
?>
</td>
	</tr>
</table>
<table>
	<thead>
		<tr>