<p class="form-title">Venta</p>
<?php 
if (!Forms::checkPermission(FORM_SELL_DETAIL)) {
    return;
}
require 'inc/class.sell.php';
require 'inc/class.formatter.php';
$sellid = isset($_GET['sell']) && is_numeric($_GET['sell']) ? $_GET['sell'] : false;
$log = Log::getInstance();
$isValid = true;
if (!$sellid) {
    $log->addError("No existen datos de Venta solicitada.");
    $isValid = false;
}
$sell = new Sell();
if (!$sell->read($sellid, true)) {
    $log->addError("No existen datos de Venta solicitada.");
    $isValid = false;
}
$details = SellDetail::getAll($sellid);
$payments = SellPayment::getAll($sellid);
include 'inc/widget/error.php';
if ($isValid) {
    ?>
<table class="form">
<tr>
	<td class="label">Venta Nro.:</td>
	<td><?php 
    echo $sell->id;
    ?>
</td>
<p class="form-title">Venta</p>
<?php 
if (!Forms::checkPermission(FORM_SELL_EDIT)) {
    return;
}
require 'inc/class.sell.php';
require 'inc/class.formatter.php';
$sellid = isset($_GET['sell']) && is_numeric($_GET['sell']) ? $_GET['sell'] : false;
$log = Log::getInstance();
$isValid = true;
if (!$sellid) {
    $log->addError("No existen datos de Venta solicitada.");
    $isValid = false;
}
$sell = new Sell();
if (!$sell->read($sellid)) {
    $log->addError("No existen datos de Venta solicitada.");
    $isValid = false;
}
$details = SellDetail::getAll($sellid);
$payments = SellPayment::getAll($sellid);
include 'inc/widget/error.php';
if (isset($_POST['page']) && isset($_POST['sell']) && !$log->isError()) {
    include 'inc/widget/success.php';
}
if ($isValid) {
    ?>
<form action="" method="POST" name="form1">
	<table class="form">
	<tr>
		<td class="label">Venta Nro.:</td>