|
@@ -3309,7 +3309,7 @@ jQuery(document).ready(function(){
|
|
|
<?php
|
|
<?php
|
|
|
//}
|
|
//}
|
|
|
|
|
|
|
|
- $oferty_opcje_all = PokazOfertyHelper::get_oferty_opcje_all();
|
|
|
|
|
|
|
+ $oferty_opcje_all = PokazOfertyHelper::get_oferty_opcje_all($building);
|
|
|
$oferty_opcje_cols = PokazOfertyHelper::get_oferty_opcje_visible_cols();
|
|
$oferty_opcje_cols = PokazOfertyHelper::get_oferty_opcje_visible_cols();
|
|
|
//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">$oferty_opcje: ';print_r($oferty_opcje);echo'</pre>';
|
|
//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">$oferty_opcje: ';print_r($oferty_opcje);echo'</pre>';
|
|
|
//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">';print_r($oferty_group_add_info ['labels']);echo'</pre>';
|
|
//echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">';print_r($oferty_group_add_info ['labels']);echo'</pre>';
|
|
@@ -4747,6 +4747,7 @@ class PokazOfertyHelper {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function get_oferty_opcje() {
|
|
public static function get_oferty_opcje() {
|
|
|
|
|
+ $db = DB::getDB();
|
|
|
$oferty_opcje = array();// [ service ] => array(ID => {oferta})
|
|
$oferty_opcje = array();// [ service ] => array(ID => {oferta})
|
|
|
$oferty_costs = self::get_offers_costs_by_offer_ids();
|
|
$oferty_costs = self::get_offers_costs_by_offer_ids();
|
|
|
// TODO: use [P_OFFER_TERM_BEGIN] => 0000-00-00, [P_OFFER_TERM] => 2011-12-31, [M_REWIR] => gd
|
|
// TODO: use [P_OFFER_TERM_BEGIN] => 0000-00-00, [P_OFFER_TERM] => 2011-12-31, [M_REWIR] => gd
|
|
@@ -4778,8 +4779,8 @@ class PokazOfertyHelper {
|
|
|
and o.`P_SERVICE_COMPANY`='BN'
|
|
and o.`P_SERVICE_COMPANY`='BN'
|
|
|
order by o.`ID_PRODUKT` desc, o.`P_CONTRACT_PRICE` desc
|
|
order by o.`ID_PRODUKT` desc, o.`P_CONTRACT_PRICE` desc
|
|
|
";
|
|
";
|
|
|
- $res = DB::query($sql);
|
|
|
|
|
- while ($r = DB::fetch($res)) {
|
|
|
|
|
|
|
+ $res = $db->query($sql);
|
|
|
|
|
+ while ($r = $db->fetch($res)) {
|
|
|
$r->srednia = '';
|
|
$r->srednia = '';
|
|
|
if (array_key_exists($r->ID, $oferty_costs)) {
|
|
if (array_key_exists($r->ID, $oferty_costs)) {
|
|
|
$r->koszt = $oferty_costs[ $r->ID ];
|
|
$r->koszt = $oferty_costs[ $r->ID ];
|
|
@@ -4789,13 +4790,22 @@ class PokazOfertyHelper {
|
|
|
return $oferty_opcje;
|
|
return $oferty_opcje;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function get_oferty_opcje_all() {
|
|
|
|
|
|
|
+ public static function get_oferty_opcje_all($building) {
|
|
|
|
|
+ $db = DB::getDB();
|
|
|
$oferty_opcje = array();// [ service ] => array(ID => {oferta})
|
|
$oferty_opcje = array();// [ service ] => array(ID => {oferta})
|
|
|
$oferty_costs = self::get_offers_costs_by_offer_ids();
|
|
$oferty_costs = self::get_offers_costs_by_offer_ids();
|
|
|
// TODO: use [P_OFFER_TERM_BEGIN] => 0000-00-00, [P_OFFER_TERM] => 2011-12-31, [M_REWIR] => gd
|
|
// TODO: use [P_OFFER_TERM_BEGIN] => 0000-00-00, [P_OFFER_TERM] => 2011-12-31, [M_REWIR] => gd
|
|
|
$sqlStatus = array('NORMAL');
|
|
$sqlStatus = array('NORMAL');
|
|
|
if (V::get('TEST_MONITOR', '', $_GET)) $sqlStatus[] = 'MONITOR';
|
|
if (V::get('TEST_MONITOR', '', $_GET)) $sqlStatus[] = 'MONITOR';
|
|
|
$sqlStatus = "and o.`A_STATUS` in('" . implode("','", $sqlStatus) . "')";
|
|
$sqlStatus = "and o.`A_STATUS` in('" . implode("','", $sqlStatus) . "')";
|
|
|
|
|
+ $sqlRewir = "";
|
|
|
|
|
+ if ($building) {
|
|
|
|
|
+ $sqlRewir = "
|
|
|
|
|
+ and (o.`M_REWIR`=''
|
|
|
|
|
+ or ('{$building->M_REWIR}' like o.`M_REWIR`)
|
|
|
|
|
+ )
|
|
|
|
|
+ ";
|
|
|
|
|
+ }
|
|
|
$sql = "select
|
|
$sql = "select
|
|
|
o.`ID`
|
|
o.`ID`
|
|
|
, o.`P_SERVICE`
|
|
, o.`P_SERVICE`
|
|
@@ -4818,14 +4828,19 @@ class PokazOfertyHelper {
|
|
|
, o.`P_MULTIROOM_ADD_DEKODER_SD`
|
|
, o.`P_MULTIROOM_ADD_DEKODER_SD`
|
|
|
, o.`P_MULTIROOM_ADD_DEKODER_HD`
|
|
, o.`P_MULTIROOM_ADD_DEKODER_HD`
|
|
|
, o.`P_MULTIROOM_ADD_MODUL_CAM`
|
|
, o.`P_MULTIROOM_ADD_MODUL_CAM`
|
|
|
|
|
+ , o.`M_REWIR`
|
|
|
|
|
+ , IF (''=o.`M_REWIR`, 1, 0) as rewir_empty
|
|
|
|
|
+ , IF ('{$building->M_REWIR}' like o.`M_REWIR`, 1, 0) as rewir_ok
|
|
|
from `USERS2_OFFERS` as o
|
|
from `USERS2_OFFERS` as o
|
|
|
where o.`P_SERVICE` in('OPCJE', 'OPCJA_TVC', 'OPCJA_TEL')
|
|
where o.`P_SERVICE` in('OPCJE', 'OPCJA_TVC', 'OPCJA_TEL')
|
|
|
{$sqlStatus}
|
|
{$sqlStatus}
|
|
|
and o.`P_SERVICE_COMPANY`='BN'
|
|
and o.`P_SERVICE_COMPANY`='BN'
|
|
|
|
|
+ {$sqlRewir}
|
|
|
order by o.`ID_PRODUKT` desc, o.`P_CONTRACT_PRICE` desc
|
|
order by o.`ID_PRODUKT` desc, o.`P_CONTRACT_PRICE` desc
|
|
|
";
|
|
";
|
|
|
- $res = DB::query($sql);
|
|
|
|
|
- while ($r = DB::fetch($res)) {
|
|
|
|
|
|
|
+ DBG::_('DBG', '>1', "sql oferty opcje", $sql, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ $res = $db->query($sql);
|
|
|
|
|
+ while ($r = $db->fetch($res)) {
|
|
|
$r->srednia = '';
|
|
$r->srednia = '';
|
|
|
if (array_key_exists($r->ID, $oferty_costs)) {
|
|
if (array_key_exists($r->ID, $oferty_costs)) {
|
|
|
$r->koszt = $oferty_costs[ $r->ID ];
|
|
$r->koszt = $oferty_costs[ $r->ID ];
|