فهرست منبع

updated BiAuditRaport

Piotr Labudda 8 سال پیش
والد
کامیت
be37285abe
1فایلهای تغییر یافته به همراه98 افزوده شده و 47 حذف شده
  1. 98 47
      SE/se-lib/Route/UrlAction/BiAuditRaport.php

+ 98 - 47
SE/se-lib/Route/UrlAction/BiAuditRaport.php

@@ -336,8 +336,30 @@ public function showListKontrahenci($items) {
 	}
 
 	public function fetchPracownicyAjax($args) {
-		$id = V::get('ID', 1, $_REQUEST, 'int');
-		$items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY')->buildQuery([
+		$limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
+		if ($limitstart < 0) $limitstart = 0;
+		$search = V::get('search', '', $_REQUEST);
+		$searchParams = [];
+		if (!empty($search)) {
+			$ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
+			$searchParams['ogc:Filter'] = '
+				<ogc:Filter>
+			    <ogc:Or>
+			      <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
+			        <ogc:PropertyName>nip</ogc:PropertyName>
+			        <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
+			      </ogc:PropertyIsLike>
+			      <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
+			        <ogc:PropertyName>nazwisko</ogc:PropertyName>
+							<ogc:Literal>' . $ogcSearch . '</ogc:Literal>
+			      </ogc:PropertyIsLike>
+			    </ogc:Or>
+			  </ogc:Filter>
+			';
+		}
+
+		$acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
+		$query = $acl->buildQuery(array_merge([
 			'cols' => [ // TODO:? propertyName = []
 				'ID',
 				'imiona',
@@ -350,9 +372,30 @@ public function showListKontrahenci($items) {
 				'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*'
 			],
 			//'f_ID' => $id,
-		])->getItems([
-			'limit' => 10
-		]);
+			'limit' => 10,
+			'limitstart' => $limitstart, // offset
+			// 'order_by' => 'ID', // sortowanie po kolumnie
+			// 'order_dir' => 'DESC', // kierunek sortowania
+			// 'f_nip' = "=12345", // szukamy dokładnie tej wartości - mysql: where nip = "12345"
+			// 'f_nip' = "12345", // szukamy dokładnie tej wartości - mysql: where nip like "%12345%"
+			// 'f_nip' = "12345%", // szukamy dokładnie tej wartości - mysql: where nip like "12345%"
+			// 'f_ID' = "=12345", // szukamy dokładnie tej wartości - mysql: where ID = "12345"
+		], $searchParams));
+		$total = $query->getTotal();
+		$items = $query->getItems();
+
+		// { // tworzenie własnego zapytanie mysql
+		// 	$rootTableName = $acl->getRootTableName();
+		// 	DB::getPDO()->fetchAll("
+		// 		select t.*
+		// 		from {$rootTableName} t
+		// 		where t.ID in (
+		// 			select x.ID
+		// 			from ... x
+		// 			where
+		// 		)
+		// 	");
+		// }
 
 		return [
 			'type' => 'success',
@@ -367,42 +410,50 @@ public function showListKontrahenci($items) {
 	}
 
 
-	public function showListPracownicy($items) {
-		$view = '<form class="form-horizontal" method="post">
-						<table class="table table-bordered table-hover table-striped" height=5>
-									 <thead>
-										 <tr>
-										 		<td width=1><input type="checkbox" name="checkAll" id="checkAll" /></td>
-											 <td width=1>ID</td>
-											 <td>Imię/Imiona</td>
-											 <td>Nazwisko</td>
-											 <td>NIP</td>
-											 <td>Pesel</td>
-											 <td>Regon</td>
-											 <td>A_ADM_COMPANY</td>
-											 <td>A_STATUS</td>
-											 <td>Adresy</td>
-										 </tr>
-									 </thead>
-									 <tbody>
-					';
 
-		foreach ($items as $key => $row) {
-				$view .= '<tr>
-				<td><input type="checkbox" name="prID[]" value="'.$row['ID'].'" /></td>
-								<td align="right">'.$row["ID"].'</td>
-								<td align="right">'.$row["imiona"].'</td>
-								<td align="right">'.$row["nazwisko"].'</td>
-								<td align="right">'.$row["nip"].'</td>
-								<td align="right">'.$row["pesel"].'</td>
-								<td align="right">'.$row["regon"].'</td>
-								<td align="right">'.$row["A_ADM_COMPANY"].'</td>
-								<td align="right">'.$row["A_STATUS"].'</td>
-								<td align="right">'.$row["default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy"].'</td>
-
-								';
-		}
-		$view .= '</tbody></table></form>';
+	public function showTablePracownicy() {
+			$view = '<form class="form-horizontal" method="post">
+							<table class="table table-bordered table-hover table-striped" height=5>
+										 <thead>
+											 <tr>
+											 		<td width=1><input type="checkbox" name="checkAll" id="checkAll" /></td>
+												 <td width=1>ID</td>
+												 <td>Imię/Imiona</td>
+												 <td>Nazwisko</td>
+												 <td>NIP</td>
+												 <td>Pesel</td>
+												 <td>Regon</td>
+												 <td>A_ADM_COMPANY</td>
+												 <td>A_STATUS</td>
+												 <td>Adresy</td>
+											 </tr>
+										 </thead>
+										 <tbody id="body-pracownicy">
+										 </tbody></table>
+										 </form>';
+
+						return $view;
+
+	}
+
+	public function showTableRowsListPracownicy($items) {
+
+				foreach ($items as $key => $row) {
+						$view .= '<tr>
+						<td><input type="checkbox" name="prID[]" value="'.$row['ID'].'" /></td>
+										<td align="right">'.$row["ID"].'</td>
+										<td align="right">'.$row["imiona"].'</td>
+										<td align="right">'.$row["nazwisko"].'</td>
+										<td align="right">'.$row["nip"].'</td>
+										<td align="right">'.$row["pesel"].'</td>
+										<td align="right">'.$row["regon"].'</td>
+										<td align="right">'.$row["A_ADM_COMPANY"].'</td>
+										<td align="right">'.$row["A_STATUS"].'</td>
+										<td align="right">'.$row["default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy"].'</td>
+
+										';
+						}
+
 
 		return $view;
 	}
@@ -549,11 +600,11 @@ switch($type) {
 																		</li>
 																		<li>
 																				 <span class="button-checkbox">
-																						<button type="button" class="btn btn-grey-border" data-color="grey-border">WYSOKIEGO RYZYKA</button>
+																						<button type="button" class="btn btn-info" data-color="grey-border">WYSOKIEGO RYZYKA</button>
 																						<input type="checkbox" class="hidden"  />
 																				</span>
 																		</li>
-																		<li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default-red" data-color-noactive="">+ STWÓRZ GRUPĘ</a></li>
+																		<li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default" data-color-noactive="">+ STWÓRZ GRUPĘ</a></li>
 																</ul>
 														</div>
 												</div>
@@ -588,8 +639,8 @@ switch($type) {
 										<div class="menu-items">
 												<div class="menu-item">
 														<ul class="padding-0">
-																<li><a href="#" title="IMPORT PRACOWNIKÓW" class="btn btn-grey-border" data-color-noactive="">IMPORT PRACOWNIKÓW</a></li>
-																<li><a href="#" title="DODAJ PRACOWNIKÓW" class="btn btn-grey-border" data-color-noactive="">+ DODAJ PRACOWNIKÓW</a></li>
+																<li><a href="#" title="IMPORT PRACOWNIKÓW" class="btn btn-info data-color-noactive="">IMPORT PRACOWNIKÓW</a></li>
+																<li><a href="#" title="DODAJ PRACOWNIKÓW" class="btn btn-info" data-color-noactive="">+ DODAJ PRACOWNIKÓW</a></li>
 														</ul>
 												</div>
 										</div>
@@ -608,10 +659,10 @@ switch($type) {
 		<div class="container-fluid smad-employees-bottom-navigation">
 				<div class="container padding-0">
 						<div class="col-lg-6 ">
-								<a href="#" title="PRZENIEŚ DO GRUPY" class="btn btn-grey-border">PRZENIEŚ DO GRUPY</a>
+								<a href="#" title="PRZENIEŚ DO GRUPY" class="btn btn-info">PRZENIEŚ DO GRUPY</a>
 						</div>
 						<div class="col-lg-6 text-right">
-								<a href="index.php?_route=UrlAction_BiAuditRaport#KONTRAHENCI" onClick="reload" title="DODAJ DO ANALIZY" class="btn btn-default">DODAJ DO ANALIZY</a>
+								<a href="index.php?_route=UrlAction_BiAuditRaport#KONTRAHENCI"  title="DODAJ DO ANALIZY" class="btn btn-primary">DODAJ DO ANALIZY</a>
 						</div>
 				</div>
 		</div>
@@ -626,7 +677,7 @@ switch($type) {
 
 			switch ($type) {
 				case 'PRACOWNICY':
-					return $this->showListPracownicy($items);
+					return $this->showTablePracownicy();
 					break;
 				case 'KONTRAHENCI':
 					return $this->showListKontrahenci($items);