<?php

require 'database.inc.php';
require('../config/ficheatt.php');
if (Test_User($lg_user, $lg_password) == TRUE) {
	if (As_Right_Fonction(6, 36)) {
		if ($ligne = DBCash::getDBCashByNoCash($NoCash)) {
			$requette2 = "UPDATE commande" . ID_GARAGE . " SET APayer = APayer + (" . $ligne['Somme'] . ") WHERE NoCommande = " . $ligne['NoFacture'];
			Connection::executeRawQuery($requette2);
		}
		$requette = "DELETE FROM dbcash" . ID_GARAGE . " WHERE NoCash='$NoCash'";
		Connection::executeRawQuery($requette);
	}
	//cancel_quitance($NoCash);
	echo "<script language=JavaScript>\n";
	echo "window.opener.window.location.reload();\n";
	echo "window.close();\n";
	echo "</script>\n";
}
