$TrNotes = $_POST["Notes"];
#Execute common insert
db_function::category_insert_single($TrCategory, $TrSubCategory);
db_function::payee_insert_single($TrPayee, $TrCategory, $TrSubCategory);
db_function::payee_update_single($TrPayee, $TrCategory, $TrSubCategory);
if (isset($_POST["TrEditedNr"])) {
    $TrEditedNr = $_POST["TrEditedNr"];
    # Update
    db_function::transaction_update($TrEditedNr, $TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes);
    echo "<script type='text/javascript'>";
    echo "location.href='show.php'";
    echo "</script>";
} else {
    $TrEditedNr = db_function::transaction_insert($TrDate, $TrStatus, $TrType, $TrAccount, $TrToAccount, $TrPayee, $TrCategory, $TrSubCategory, $TrAmount, $TrNotes);
}
attachments::rename_zero($TrEditedNr);
?>
        
        <div class="container text_align_center">
            <br />
            <br />
            <h3>Transaction inserted successfully</h3>
            <br />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Insert new" onclick="top.location.href = 'new_transaction.php'" />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Show transaction" onclick="top.location.href = 'show.php'" />
            <br />
            <input type="button" class="btn btn-lg btn-success btn-block" value="Return to menu" onclick="top.location.href = 'landing.php'" />
            <br />
            <br />