<?php
if( $a == 'list' ){
	if( isset( $sOption ) ){
		$content.= $oTpl->parse( 'message_done.tpl' );
	}
	$aVats = throwVats( );
	$oTpl->assign( 'aVats', $aVats );
	$content.= $oTpl->parse( 'vat_list.tpl' );
} elseif( $a == 'form' ){
	if( isset( $_POST['sOption'] ) ){
		$iVat = saveVat( $_POST );
		header( 'Location: ' . $_SERVER['PHP_SELF'] . '?p=' . $p . '&sOption=save&iVat=' . $iVat );
		exit;
	}
	if( isset( $sOption ) ) $content.= $oTpl->parse( 'message_done.tpl' );
	if( isset( $iVat ) && is_numeric( $iVat ) ){
		$aVat = throwVat( $iVat );
	} else{
		$aVat['iPosition'] = 0;
	}
	$oTpl->assign( 'aVat', $aVat );
	$content.= $oTpl->parse( 'vat_form.tpl' );
} elseif( $a == 'delete' && isset( $iVat ) && is_numeric( $iVat ) ){
	deleteVat( $iVat );
	header( 'Location: ' . $_SERVER['PHP_SELF'] . '?p=' . $aActions['f'] . '-list&sOption=del' );
	exit;
}
?>