Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/web/admin/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(dirname(__FILE__)) . "/init.php");
require_once(WEB_DIR . "/includes/req_admin.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 . "/admin/includes/left.php"); ?>
<div id="content">
<h1>Administrare comenzi</h1>
<?php require_once(WEB_DIR . "/includes/print_messages.php"); ?>

<?php
if(@$_GET["action"] == "detail")
{
	?>
	<dl>
	<dt class="title"><b>Produsele din comanda</b></dt>
	<dd>
	<a href="admin/order.php">&laquo; Click aici pentru a va intoarce la lista de comenzi</a> <br>
	<?php
	$db = Application::getDb();
	$order = $db->tbOrder->getRecordById(@$_GET["id"]);

	if($order->getProductsCount() == 0)
	{
		?>
		Comanda este goala
		<?php
	}
	else
	{
		$order->computeValue();
		$vat = Application::getConfigValue("default_vat");
		$df = new DateFormat();
		$cfgDf = Application::getConfigValue("date_format");
		?>
		Codul comenzii: <?php echo Escape::html($order->code); ?> <a href="admin/proforma.php?code=<?php echo Escape::htmlValue($order->code); ?>" target="_blank">click aici pentru a vedea factura proforma</a> <br>
		Titlu: <big><b><?php echo $order->title; ?></b></big> <br>
		Procent TVA: <?php echo Escape::html($vat); ?> % <br>
		Data emiterii: <?php echo Escape::html($order->displayDateTime("date_ordered")); ?> <br>
		Data actualizarii: <?php echo Escape::html($order->displayDateTime("date_updated")); ?> <br>
		Status: <big><b><?php echo Escape::html($order->status); ?></b></big> <a href="javascript:showHide('change_status_container'); ">click aici pentru a schimba statusul</a> <br>
		<form action="admin/formparser/order.php?action=change_status" method="post" id="change_status_container" style="display: none; ">
		<input type="hidden" name="id_order" value="<?php echo Escape::htmlValue($order->id); ?>">
		<select name="status">
		<option value="">-- Alegeti --</option>
		<?php
		$list = Order::getPossibleStatuses();
		for($i = 0; $i < count($list); $i++)
		{
			if($list[$i] == "in cos")
				continue;
			$selected = ($list[$i] == $order->status) ? "selected" : "";
			?>
			<option value="<?php echo Escape::htmlValue($list[$i]); ?>" <?php echo $selected; ?>><?php echo Escape::html($list[$i]); ?></option>
			<?php
		}
		?>
		</select>
		<input type="submit" value="Actualizati" class="button">
		</form>

		<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>
		</table>
		<?php
	}
	?>
	</dd>
	</dl>

	<div style="background-color: white; margin-left: 10px; color: 000077; ">
	<p><b>Atentie!</b> Adresa de livrare, adresa de facturare si detaliile utilizatorului
	au fost inregistrate la momentul cand acesta a trimis comanda. Este posibil ca intre timp
	el sa isi fi schimbat adresa sau detaliile de utilizator folosind formularul de profil.</p>

	<p>Totusi, chiar daca el si-a schimbat datele, acestea sunt informatiile pe care le stiam
	despre el la momentul cand a trimis comanda.</p>
	</div>

	<div id="first_page">
		<dl class="first_page">
		<dt class="title"><b>Adresa de livrare</b></dt>
		<dd>
		<?php echo nl2br(Escape::html($order->delivery_address)); ?>
		</dd>
		</dl>

		<dl class="first_page">
		<dt class="title"><b>Adresa de facturare</b></dt>
		<dd>
		<?php echo nl2br(Escape::html($order->invoice_address)); ?>
		</dd>
		</dl>
		<hr>
	</div>

	<dl>
	<dt class="title"><b>Detalii utilizator</b></dt>
	<dd>
	<?php echo nl2br(Escape::html($order->user_details)); ?>
	</dd>
	</dl>
	<?php
}
else
{
	?>
	<dl>
	<dt class="title"><b>Lista comenzi</b></dt>
	<dd>

	<p>
	Selectati dupa status:
	<a href="admin/order.php">Toate</a>
	<?php
	$list = Order::getPossibleStatuses();
	for($i = 0; $i < count($list); $i++)
	{
		if($list[$i] != "in cos")
		{
			?>
			| <a href="admin/order.php?status=<?php echo Escape::url($list[$i]); ?>"><?php echo Escape::html($list[$i]); ?></a>
			<?php
		}
	}
	?>
	</p>

	<form action="admin/order.php" method="get">
	<?php echo Tools::http_build_hidden_inputs($_GET, array("title", "username")); ?>
	<b style="display: block; ">Cautare</b>
	<table cellspacing="0" style="text-align: right; ">
	<tr>
	<td>ID: <input type="text" name="id" value="<?php echo Escape::htmlValue(@$_GET["id"]); ?>"></td>
	<td>Cod: <input type="text" name="code" value="<?php echo Escape::htmlValue(@$_GET["code"]); ?>"></td>
	</tr>
	<tr>
	<td>Titlu: <input type="text" name="title" value="<?php echo Escape::htmlValue(@$_GET["title"]); ?>"></td>
	<td>Username: <input type="text" name="username" value="<?php echo Escape::htmlValue(@$_GET["username"]); ?>"></td>
	</tr>
	<tr>
	<td>Status: <input type="text" name="status" value="<?php echo Escape::htmlValue(@$_GET["status"]); ?>"></td>
	<td><input type="submit" value="Cauta" class="button"></td>
	</tr>
	</table>
	</form>

	<?php
	$db = Application::getDb();
	$list = $db->tbOrder->search($_GET, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"], @$_GET["order_direction"]);
	$ordersCount = $db->tbOrder->getCount($_GET, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"], @$_GET["order_direction"]);
	if($ordersCount > 0)
	{
		?>
		<table class="cuborder" cellspacing="0">
		<tr>
		<th nowrap><?php echo pagination_columnHead("ID", "id"); ?></th>
		<th nowrap><?php echo pagination_columnHead("Titlu", "title"); ?></th>
		<th nowrap><?php echo pagination_columnHead("User", "username"); ?></th>
		<th nowrap><?php echo pagination_columnHead("Status", "status"); ?></th>
		<th nowrap><?php echo pagination_columnHead("Data emiterii", "date_ordered"); ?></th>
		<th nowrap><?php echo pagination_columnHead("Valoarea", "value_total"); ?></th>
		</tr>
		<?php
		for($i = 0; $i < count($list); $i++)
		{
			$o = $list[$i];
			?>
			<tr onmouseover="this.style.backgroundColor='#ddeeff'; " onmouseout="this.style.backgroundColor='#ffffff'; ">
			<td><?php echo Escape::html($o->id); ?></td>
			<td onclick="redirect('admin/order.php?action=detail&id=<?php echo Escape::htmlValue($o->id); ?>'); ">
				<a href="admin/order.php?action=detail&id=<?php echo Escape::htmlValue($o->id); ?>"><?php echo Escape::html($o->title); ?></a>
				&nbsp;
			</td>
			<td><?php echo Escape::html($o->username); ?></td>
			<td><?php echo Escape::html($o->status); ?></td>
			<td><?php echo Escape::html($o->date_ordered); ?></td>
			<td align="right" style="font-weight: bold; "><?php echo Escape::html(displayPrice($o->value_total)); ?></td>
			</tr>
			<?php
		}
		?>
		<tr>
		<td colspan="5" align="right">
		<?php
		echo pagination_listPages($ordersCount);
		echo pagination_rowsPerPage();
		?>
		</td>
		</tr>
		</table>
		<?php
	}
	else
	{
		?>
		Nu a putut fi gasita nici o comanda folosind criteriile de cautare specificate.
		<?php
	}
	?>
	</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