Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/web/order.php
<?php
/**
 * Product: Katyshop
 * @version 0.3.2.1
 * @author Catalin Hulea - hide@address.com
 * @copyright Copyright (C) 2007 Catalin Hulea
 * @license GNU General Public License version 3
 * 			You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
 * @link https://sourceforge.net/projects/katyshop
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
require_once(dirname(__FILE__) . "/init.php");
require_once(WEB_DIR . "/includes/req_person_company.php");
?>
<html>
<head>
<title><?php echo APP_NAME; ?></title>
<?php require_once(WEB_DIR . "/includes/html_head.php"); ?>
</head>

<body>
<div id="container">
<?php require_once(WEB_DIR . "/includes/header.php"); ?>
<div id="middle">
<div id="left_vertical_line">
<?php require_once(WEB_DIR . "/includes/left.php"); ?>
<div id="content">
<h1>Vizualizare comanda</h1>
<?php require_once(WEB_DIR . "/includes/print_messages.php"); ?>

<dl>
<dt class="title"><b>Order products</b></dt>
<dd>
<a href="orders_list.php">&laquo; Click aici pentru a va intoarce la lista de comenzi</a> <br>
<?php
$db = Application::getDb();
$user = Application::getUser();
$order = $db->tbOrder->getRecordById(@$_GET["id"]);
if($order->id == 0)
{
	$order = Application::getShoppingCart();
}
elseif($order->id_user != $user->id)
{
	Application::addError("Comanda selectata nu poate fi afisata deoarece nu va apartine");
	Tools::redirect("index.php");
	exit();
}

if($order->getProductsCount() == 0)
{
	?>
	Comanda este goala
	<?php
}
else
{
	$order->computeValue();
	$vat = Application::getConfigValue("default_vat");
	$df = new DateFormat();
	$cfgDf = Application::getConfigValue("date_format");

	if($order->id == 0)
	{
		?>
		<form action="formparser/order.php?action=finalize" method="post">
		<input type="submit" value="Trimiteti comanda" class="button" style="font-weight: bold; ">
		</form>
		<br>
		<?php
	}
	else
	{
		?>
		Order code: <?php echo Escape::html($order->code); ?> <a href="proforma.php?code=<?php echo Escape::htmlValue($order->code); ?>" target="_blank">click aici pentru a vedea factura proforma</a><br>
		<?php
	}
	?>

	Titlu: <big><b><?php echo $order->title; ?></b></big> <br>
	Procent TVA: <?php echo Escape::html($vat); ?> % <br>
	Data emiterii: <?php echo Escape::html($df->displayDate($cfgDf["date"], $cfgDf["separator_date"])); ?> <br>
	<?php
	if($order->id > 0)
	{
		$df->readDateTime($order->date_updated);
		?>
		Data actualizarii statusului: <?php echo Escape::html($df->displayDate($cfgDf["date"], $cfgDf["separator_date"])); ?> <br>
		<?php
	}
	?>
	Status: <big><b><?php echo Escape::html($order->status); ?></b></big> <br>

	<table style="text-align: right; " cellpadding="2" cellspacing="0" class="cuborder">
	<tr align="center">
	<th>Nr.</th>
	<th>Produs</th>
	<th>U. M.</th>
	<th>Cantitate</th>
	<th><nobr>Pret unitar<nobr><br><nobr>(fara TVA)</nobr><br><nobr>- <?php echo Escape::html(Application::getConfigValue("default_currency")); ?> -</nobr></th>
	<th><nobr>Valoare<nobr><br><nobr>(fara TVA)</nobr><br><nobr>- <?php echo Escape::html(Application::getConfigValue("default_currency")); ?> -</nobr></th>
	<th>Valoare<br>TVA<br><nobr>- <?php echo Escape::html(Application::getConfigValue("default_currency")); ?> -</nobr></th>
	<th><nobr>Valoare<nobr><br><nobr>(cu TVA)</nobr><br><nobr>- <?php echo Escape::html(Application::getConfigValue("default_currency")); ?> -</nobr></th>
	</tr>
	<tr align="center">
	<th>&nbsp;</th>
	<th>1</th>
	<th>2</th>
	<th>3</th>
	<th>4</th>
	<th>5 (3x4)</th>
	<th>6</th>
	<th>7</th>
	</tr>
	<?php
	for($i = 0; $i < $order->getProductsCount(); $i++)
	{
		$op = $order->getOrderProduct($i + 1);
		?>
		<tr>
		<td>
			<?php echo Escape::html($op->line_number); ?>
		</td>
		<td align="center">
			<a href="product.php?id_product=<?php echo Escape::htmlValue($op->id_product); ?>"><?php echo Escape::html($op->product_name); ?></a>
		</td>
		<td><?php echo Escape::html($op->measuring_unit); ?>&nbsp;</td>
		<td><?php echo Escape::html(displayPrice($op->quantity)); ?>&nbsp;</td>
		<td><?php echo Escape::html(displayPrice($op->price)); ?></td>
		<td><?php echo Escape::html(displayPrice($op->value_without_vat)); ?></td>
		<td><?php echo Escape::html(displayPrice($op->value_vat)); ?></td>
		<td><?php echo Escape::html(displayPrice($op->value_total)); ?></td>
		</tr>
		<?php
	}
	?>
	<tr align="center" style="font-weight: bold; ">
	<td colspan="4" align="right">&nbsp;</td>
	<th>TOTAL: </th>
	<td><?php echo Escape::html(displayPrice($order->value_without_vat)); ?></td>
	<td><?php echo Escape::html(displayPrice($order->value_vat)); ?></td>
	<td>&nbsp;</td>
	</tr>

	<tr align="center" style="font-weight: bold; color: red; ">
	<td colspan="5" align="right" style="font-size: larger; ">
		<nobr>Total de plata:</nobr><br>
		<nobr>(col. 5 + col. 6)</nobr><br>
	</td>
	<td colspan="3" style="font-size: larger; ">
		<nobr><?php echo Escape::html(displayPrice($order->value_total)); ?> <?php echo Escape::html(Application::getConfigValue("default_currency")); ?></nobr>
	</td>
	</tr>
	<?php
	if($order->id == 0)
	{
		?>
		<tr>
		<td colspan="8" align="right">
			<input type="button" value="Actualizare produse" onclick="window.open('shopping_cart.php', '_self'); " class="button">
		</td>
		</tr>
		<?php
	}
	?>
	</table>
	<?php
}
?>
</dd>
</dl>

<div id="first_page">

<dl class="first_page">
<dt class="title"><a href="shopping_cart_address.php?action=select_invoice_address"><b>Adresa de livrare</b></a></dt>
<dd>
<?php
echo nl2br(Escape::html($order->delivery_address));
if($order->id == 0)
{
	?>
	<input type="button" value="Schimbati adresa de livrare" onclick="window.open('shopping_cart_address.php?action=select_delivery_address', '_self'); " class="button">
	<?php
}
?>
</dd>
</dl>

<dl class="first_page">
<dt class="title"><a href="shopping_cart_address.php?action=select_invoice_address"><b>Adresa de facturare</b></a></dt>
<dd>
<?php
echo nl2br(Escape::html($order->invoice_address));
if($order->id == 0)
{
	?>
	<input type="button" value="Schimbati adresa de facturare" onclick="window.open('shopping_cart_address.php?action=select_invoice_address', '_self'); " class="button">
	<?php
}
?>
</dd>
</dl>
<hr>
</div>

<?php
if($order->id == 0)
{
	?>
	<dl>
	<dt class="title"><b>Trimiteti comanda</b></dt>
	<dd>
	<form action="formparser/order.php?action=finalize" method="post">
	<input type="submit" value="Trimiteti comanda" class="button" style="font-weight: bold; "> Click aici pentru a trimite comanda catre magazin
	<input type="button" value="&laquo; Inapoi" onclick="window.open('shopping_cart_address.php?action=select_invoice_address', '_self'); " class="button"> Click aici pentru a schimba adresa de facturare
	</form>
	</dd>
	</dl>
	<?php
}
?>

</div>
<?php require_once(WEB_DIR . "/includes/right.php"); ?>
<?php require_once(WEB_DIR . "/includes/footer.php"); ?>
</div>
</div>
</div>
</body>
</html>
Return current item: Katyshop