<?php
namespace PHPMaker2020\project2;

// Session
if (session_status() !== PHP_SESSION_ACTIVE)
	session_start(); // Init session data

// Output buffering
ob_start();

// Autoload
include_once "autoload.php";
?>
<?php

// Write header
WriteHeader(FALSE);

// Create page object
$kp_codbarras_list = new kp_codbarras_list();

// Run the page
$kp_codbarras_list->run();

// Setup login status
SetupLoginStatus();
SetClientVar("login", LoginStatus());

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$kp_codbarras_list->Page_Render();
?>
<?php include_once "header.php"; ?>
<?php if (!$kp_codbarras_list->isExport()) { ?>
<script>
var fkp_codbarraslist, currentPageID;
loadjs.ready("head", function() {

	// Form object
	currentPageID = ew.PAGE_ID = "list";
	fkp_codbarraslist = currentForm = new ew.Form("fkp_codbarraslist", "list");
	fkp_codbarraslist.formKeyCountName = '<?php echo $kp_codbarras_list->FormKeyCountName ?>';
	loadjs.done("fkp_codbarraslist");
});
var fkp_codbarraslistsrch;
loadjs.ready("head", function() {

	// Form object for search
	fkp_codbarraslistsrch = currentSearchForm = new ew.Form("fkp_codbarraslistsrch");

	// Dynamic selection lists
	// Filters

	fkp_codbarraslistsrch.filterList = <?php echo $kp_codbarras_list->getFilterList() ?>;
	loadjs.done("fkp_codbarraslistsrch");
});
</script>
<script>
loadjs.ready("head", function() {

	// Client script
	// Write your client script here, no need to add script tags.

});
</script>
<?php } ?>
<?php if (!$kp_codbarras_list->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($kp_codbarras_list->TotalRecords > 0 && $kp_codbarras_list->ExportOptions->visible()) { ?>
<?php $kp_codbarras_list->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($kp_codbarras_list->ImportOptions->visible()) { ?>
<?php $kp_codbarras_list->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($kp_codbarras_list->SearchOptions->visible()) { ?>
<?php $kp_codbarras_list->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($kp_codbarras_list->FilterOptions->visible()) { ?>
<?php $kp_codbarras_list->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$kp_codbarras_list->renderOtherOptions();
?>
<?php if ($Security->CanSearch()) { ?>
<?php if (!$kp_codbarras_list->isExport() && !$kp_codbarras->CurrentAction) { ?>
<form name="fkp_codbarraslistsrch" id="fkp_codbarraslistsrch" class="form-inline ew-form ew-ext-search-form" action="<?php echo CurrentPageName() ?>">
<div id="fkp_codbarraslistsrch-search-panel" class="<?php echo $kp_codbarras_list->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="kp_codbarras">
	<div class="ew-extended-search">
<div id="xsr_<?php echo $kp_codbarras_list->SearchRowCount + 1 ?>" class="ew-row d-sm-flex">
	<div class="ew-quick-search input-group">
		<input type="text" name="<?php echo Config("TABLE_BASIC_SEARCH") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH") ?>" class="form-control" value="<?php echo HtmlEncode($kp_codbarras_list->BasicSearch->getKeyword()) ?>" placeholder="<?php echo HtmlEncode($Language->phrase("Search")) ?>">
		<input type="hidden" name="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" value="<?php echo HtmlEncode($kp_codbarras_list->BasicSearch->getType()) ?>">
		<div class="input-group-append">
			<button class="btn btn-primary" name="btn-submit" id="btn-submit" type="submit"><?php echo $Language->phrase("SearchBtn") ?></button>
			<button type="button" data-toggle="dropdown" class="btn btn-primary dropdown-toggle dropdown-toggle-split" aria-haspopup="true" aria-expanded="false"><span id="searchtype"><?php echo $kp_codbarras_list->BasicSearch->getTypeNameShort() ?></span></button>
			<div class="dropdown-menu dropdown-menu-right">
				<a class="dropdown-item<?php if ($kp_codbarras_list->BasicSearch->getType() == "") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this);"><?php echo $Language->phrase("QuickSearchAuto") ?></a>
				<a class="dropdown-item<?php if ($kp_codbarras_list->BasicSearch->getType() == "=") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, '=');"><?php echo $Language->phrase("QuickSearchExact") ?></a>
				<a class="dropdown-item<?php if ($kp_codbarras_list->BasicSearch->getType() == "AND") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'AND');"><?php echo $Language->phrase("QuickSearchAll") ?></a>
				<a class="dropdown-item<?php if ($kp_codbarras_list->BasicSearch->getType() == "OR") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'OR');"><?php echo $Language->phrase("QuickSearchAny") ?></a>
			</div>
		</div>
	</div>
</div>
	</div><!-- /.ew-extended-search -->
</div><!-- /.ew-search-panel -->
</form>
<?php } ?>
<?php } ?>
<?php $kp_codbarras_list->showPageHeader(); ?>
<?php
$kp_codbarras_list->showMessage();
?>
<?php if ($kp_codbarras_list->TotalRecords > 0 || $kp_codbarras->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($kp_codbarras_list->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> kp_codbarras">
<form name="fkp_codbarraslist" id="fkp_codbarraslist" class="form-inline ew-form ew-list-form" action="<?php echo CurrentPageName() ?>" method="post">
<?php if ($Page->CheckToken) { ?>
<input type="hidden" name="<?php echo Config("TOKEN_NAME") ?>" value="<?php echo $Page->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="kp_codbarras">
<div id="gmp_kp_codbarras" class="<?php echo ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($kp_codbarras_list->TotalRecords > 0 || $kp_codbarras_list->isGridEdit()) { ?>
<table id="tbl_kp_codbarraslist" class="table ew-table"><!-- .ew-table -->
<thead>
	<tr class="ew-table-header">
<?php

// Header row
$kp_codbarras->RowType = ROWTYPE_HEADER;

// Render list options
$kp_codbarras_list->renderListOptions();

// Render list options (header, left)
$kp_codbarras_list->ListOptions->render("header", "left");
?>
<?php if ($kp_codbarras_list->id_reg->Visible) { // id_reg ?>
	<?php if ($kp_codbarras_list->SortUrl($kp_codbarras_list->id_reg) == "") { ?>
		<th data-name="id_reg" class="<?php echo $kp_codbarras_list->id_reg->headerCellClass() ?>"><div id="elh_kp_codbarras_id_reg" class="kp_codbarras_id_reg"><div class="ew-table-header-caption"><?php echo $kp_codbarras_list->id_reg->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="id_reg" class="<?php echo $kp_codbarras_list->id_reg->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $kp_codbarras_list->SortUrl($kp_codbarras_list->id_reg) ?>', 1);"><div id="elh_kp_codbarras_id_reg" class="kp_codbarras_id_reg">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $kp_codbarras_list->id_reg->caption() ?></span><span class="ew-table-header-sort"><?php if ($kp_codbarras_list->id_reg->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($kp_codbarras_list->id_reg->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($kp_codbarras_list->idempresa->Visible) { // idempresa ?>
	<?php if ($kp_codbarras_list->SortUrl($kp_codbarras_list->idempresa) == "") { ?>
		<th data-name="idempresa" class="<?php echo $kp_codbarras_list->idempresa->headerCellClass() ?>"><div id="elh_kp_codbarras_idempresa" class="kp_codbarras_idempresa"><div class="ew-table-header-caption"><?php echo $kp_codbarras_list->idempresa->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="idempresa" class="<?php echo $kp_codbarras_list->idempresa->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $kp_codbarras_list->SortUrl($kp_codbarras_list->idempresa) ?>', 1);"><div id="elh_kp_codbarras_idempresa" class="kp_codbarras_idempresa">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $kp_codbarras_list->idempresa->caption() ?></span><span class="ew-table-header-sort"><?php if ($kp_codbarras_list->idempresa->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($kp_codbarras_list->idempresa->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($kp_codbarras_list->idarticulo->Visible) { // idarticulo ?>
	<?php if ($kp_codbarras_list->SortUrl($kp_codbarras_list->idarticulo) == "") { ?>
		<th data-name="idarticulo" class="<?php echo $kp_codbarras_list->idarticulo->headerCellClass() ?>"><div id="elh_kp_codbarras_idarticulo" class="kp_codbarras_idarticulo"><div class="ew-table-header-caption"><?php echo $kp_codbarras_list->idarticulo->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="idarticulo" class="<?php echo $kp_codbarras_list->idarticulo->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $kp_codbarras_list->SortUrl($kp_codbarras_list->idarticulo) ?>', 1);"><div id="elh_kp_codbarras_idarticulo" class="kp_codbarras_idarticulo">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $kp_codbarras_list->idarticulo->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($kp_codbarras_list->idarticulo->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($kp_codbarras_list->idarticulo->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($kp_codbarras_list->codbarra->Visible) { // codbarra ?>
	<?php if ($kp_codbarras_list->SortUrl($kp_codbarras_list->codbarra) == "") { ?>
		<th data-name="codbarra" class="<?php echo $kp_codbarras_list->codbarra->headerCellClass() ?>"><div id="elh_kp_codbarras_codbarra" class="kp_codbarras_codbarra"><div class="ew-table-header-caption"><?php echo $kp_codbarras_list->codbarra->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="codbarra" class="<?php echo $kp_codbarras_list->codbarra->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $kp_codbarras_list->SortUrl($kp_codbarras_list->codbarra) ?>', 1);"><div id="elh_kp_codbarras_codbarra" class="kp_codbarras_codbarra">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $kp_codbarras_list->codbarra->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($kp_codbarras_list->codbarra->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($kp_codbarras_list->codbarra->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

// Render list options (header, right)
$kp_codbarras_list->ListOptions->render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
if ($kp_codbarras_list->ExportAll && $kp_codbarras_list->isExport()) {
	$kp_codbarras_list->StopRecord = $kp_codbarras_list->TotalRecords;
} else {

	// Set the last record to display
	if ($kp_codbarras_list->TotalRecords > $kp_codbarras_list->StartRecord + $kp_codbarras_list->DisplayRecords - 1)
		$kp_codbarras_list->StopRecord = $kp_codbarras_list->StartRecord + $kp_codbarras_list->DisplayRecords - 1;
	else
		$kp_codbarras_list->StopRecord = $kp_codbarras_list->TotalRecords;
}
$kp_codbarras_list->RecordCount = $kp_codbarras_list->StartRecord - 1;
if ($kp_codbarras_list->Recordset && !$kp_codbarras_list->Recordset->EOF) {
	$kp_codbarras_list->Recordset->moveFirst();
	$selectLimit = $kp_codbarras_list->UseSelectLimit;
	if (!$selectLimit && $kp_codbarras_list->StartRecord > 1)
		$kp_codbarras_list->Recordset->move($kp_codbarras_list->StartRecord - 1);
} elseif (!$kp_codbarras->AllowAddDeleteRow && $kp_codbarras_list->StopRecord == 0) {
	$kp_codbarras_list->StopRecord = $kp_codbarras->GridAddRowCount;
}

// Initialize aggregate
$kp_codbarras->RowType = ROWTYPE_AGGREGATEINIT;
$kp_codbarras->resetAttributes();
$kp_codbarras_list->renderRow();
while ($kp_codbarras_list->RecordCount < $kp_codbarras_list->StopRecord) {
	$kp_codbarras_list->RecordCount++;
	if ($kp_codbarras_list->RecordCount >= $kp_codbarras_list->StartRecord) {
		$kp_codbarras_list->RowCount++;

		// Set up key count
		$kp_codbarras_list->KeyCount = $kp_codbarras_list->RowIndex;

		// Init row class and style
		$kp_codbarras->resetAttributes();
		$kp_codbarras->CssClass = "";
		if ($kp_codbarras_list->isGridAdd()) {
		} else {
			$kp_codbarras_list->loadRowValues($kp_codbarras_list->Recordset); // Load row values
		}
		$kp_codbarras->RowType = ROWTYPE_VIEW; // Render view

		// Set up row id / data-rowindex
		$kp_codbarras->RowAttrs->merge(["data-rowindex" => $kp_codbarras_list->RowCount, "id" => "r" . $kp_codbarras_list->RowCount . "_kp_codbarras", "data-rowtype" => $kp_codbarras->RowType]);

		// Render row
		$kp_codbarras_list->renderRow();

		// Render list options
		$kp_codbarras_list->renderListOptions();
?>
	<tr <?php echo $kp_codbarras->rowAttributes() ?>>
<?php

// Render list options (body, left)
$kp_codbarras_list->ListOptions->render("body", "left", $kp_codbarras_list->RowCount);
?>
	<?php if ($kp_codbarras_list->id_reg->Visible) { // id_reg ?>
		<td data-name="id_reg" <?php echo $kp_codbarras_list->id_reg->cellAttributes() ?>>
<span id="el<?php echo $kp_codbarras_list->RowCount ?>_kp_codbarras_id_reg" class="kp_codbarras_id_reg">
<span<?php echo $kp_codbarras_list->id_reg->viewAttributes() ?>><?php echo $kp_codbarras_list->id_reg->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($kp_codbarras_list->idempresa->Visible) { // idempresa ?>
		<td data-name="idempresa" <?php echo $kp_codbarras_list->idempresa->cellAttributes() ?>>
<span id="el<?php echo $kp_codbarras_list->RowCount ?>_kp_codbarras_idempresa" class="kp_codbarras_idempresa">
<span<?php echo $kp_codbarras_list->idempresa->viewAttributes() ?>><?php echo $kp_codbarras_list->idempresa->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($kp_codbarras_list->idarticulo->Visible) { // idarticulo ?>
		<td data-name="idarticulo" <?php echo $kp_codbarras_list->idarticulo->cellAttributes() ?>>
<span id="el<?php echo $kp_codbarras_list->RowCount ?>_kp_codbarras_idarticulo" class="kp_codbarras_idarticulo">
<span<?php echo $kp_codbarras_list->idarticulo->viewAttributes() ?>><?php echo $kp_codbarras_list->idarticulo->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($kp_codbarras_list->codbarra->Visible) { // codbarra ?>
		<td data-name="codbarra" <?php echo $kp_codbarras_list->codbarra->cellAttributes() ?>>
<span id="el<?php echo $kp_codbarras_list->RowCount ?>_kp_codbarras_codbarra" class="kp_codbarras_codbarra">
<span<?php echo $kp_codbarras_list->codbarra->viewAttributes() ?>><?php echo $kp_codbarras_list->codbarra->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$kp_codbarras_list->ListOptions->render("body", "right", $kp_codbarras_list->RowCount);
?>
	</tr>
<?php
	}
	if (!$kp_codbarras_list->isGridAdd())
		$kp_codbarras_list->Recordset->moveNext();
}
?>
</tbody>
</table><!-- /.ew-table -->
<?php } ?>
</div><!-- /.ew-grid-middle-panel -->
<?php if (!$kp_codbarras->CurrentAction) { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
</form><!-- /.ew-list-form -->
<?php

// Close recordset
if ($kp_codbarras_list->Recordset)
	$kp_codbarras_list->Recordset->Close();
?>
<?php if (!$kp_codbarras_list->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$kp_codbarras_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $kp_codbarras_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $kp_codbarras_list->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($kp_codbarras_list->TotalRecords == 0 && !$kp_codbarras->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $kp_codbarras_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$kp_codbarras_list->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<?php if (!$kp_codbarras_list->isExport()) { ?>
<script>
loadjs.ready("load", function() {

	// Startup script
	// Write your table-specific startup script here
	// console.log("page loaded");

});
</script>
<?php } ?>
<?php include_once "footer.php"; ?>
<?php
$kp_codbarras_list->terminate();
?>