|
|
@@ -3946,11 +3946,11 @@ class WindykacjaStatsHelper {
|
|
|
//$data_arr["PAY_DATE"] = '0000-00-00';// TODO: ?
|
|
|
}
|
|
|
}
|
|
|
- if(V::get('DBG_LAST_FVAT_PAY_TERM', '', $_GET)){echo'<pre>data_arr: ';print_r($data_arr);echo'</pre>';}
|
|
|
|
|
|
{
|
|
|
$hasActiveNET = 0;
|
|
|
$hasActiveTV = 0;
|
|
|
+ $isMovedToVectra = 0;
|
|
|
$db = DB::getDB();
|
|
|
$idUser = $user->ID;
|
|
|
$sql = "
|
|
|
@@ -3972,17 +3972,29 @@ class WindykacjaStatsHelper {
|
|
|
and 'NORMAL'=A_STATUS_L2_SQL_L1(srv.`ID`)
|
|
|
limit 1
|
|
|
), 1, 0) as hasActiveTV
|
|
|
+ ,
|
|
|
+ IF(1 = ('REZYGNACJA_Z_PRZEJSCIEM_DO_VECTRA'=(select `RODZAJ_DZIALANIA_HANDLOWEGO`
|
|
|
+ from `DEALS_TABLE`
|
|
|
+ where `A_STATUS`='NORMAL'
|
|
|
+ and `ID_BILLING_USERS`='{$user->ID}'
|
|
|
+ order by `ID` DESC
|
|
|
+ limit 1)
|
|
|
+ ), 1, 0) as isMovedToVectra
|
|
|
";
|
|
|
+ DBG::_('DBG_ACTIVE_SRV', '>2', "DBG_ACTIVE_SRV sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
$res = $db->query($sql);
|
|
|
if ($r = $db->fetch($res)) {
|
|
|
DBG::_('DBG_ACTIVE_SRV', '>2', "r", $r, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
$hasActiveNET = V::get('hasActiveNET', '', $r);
|
|
|
$hasActiveTV = V::get('hasActiveTV', '', $r);
|
|
|
+ $isMovedToVectra = V::get('isMovedToVectra', '', $r);
|
|
|
}
|
|
|
$data_arr['HAS_ACTIVE_NET'] = $hasActiveNET;
|
|
|
$data_arr['HAS_ACTIVE_TV'] = $hasActiveTV;
|
|
|
+ $data_arr['IS_MOVED_TO_VECTRA'] = $isMovedToVectra;
|
|
|
DBG::_('DBG_ACTIVE_SRV', '>2', "data_arr", $data_arr, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
}
|
|
|
+ if(V::get('DBG_LAST_FVAT_PAY_TERM', '', $_GET)){echo'<pre>data_arr #' . __LINE__ . ': ';print_r($data_arr);echo'</pre>';}
|
|
|
|
|
|
$sql_arr = array();
|
|
|
foreach ($data_arr as $k => $v) {
|
|
|
@@ -5067,13 +5079,14 @@ class WindykacjaStatsModel {
|
|
|
, w.`NR_SPRAWY_KOMORNIK`
|
|
|
, w.`ACCOUNT_NUMBER`
|
|
|
, w.`SERVICES_STREETS`
|
|
|
- , ('REZYGNACJA_Z_PRZEJSCIEM_DO_VECTRA'=(select `RODZAJ_DZIALANIA_HANDLOWEGO`
|
|
|
- from `DEALS_TABLE`
|
|
|
- where `A_STATUS`='NORMAL'
|
|
|
- and `ID_BILLING_USERS`=w.`ID_BILLING_USERS`
|
|
|
- order by `ID` DESC
|
|
|
- limit 1)
|
|
|
- ) as isMovedToVectra
|
|
|
+ , w.`IS_MOVED_TO_VECTRA` as isMovedToVectra
|
|
|
+-- , ('REZYGNACJA_Z_PRZEJSCIEM_DO_VECTRA'=(select `RODZAJ_DZIALANIA_HANDLOWEGO`
|
|
|
+-- from `DEALS_TABLE`
|
|
|
+-- where `A_STATUS`='NORMAL'
|
|
|
+-- and `ID_BILLING_USERS`=w.`ID_BILLING_USERS`
|
|
|
+-- order by `ID` DESC
|
|
|
+-- limit 1)
|
|
|
+-- ) as isMovedToVectra
|
|
|
, w.`HAS_ACTIVE_NET`
|
|
|
, w.`HAS_ACTIVE_TV`
|
|
|
";
|
|
|
@@ -5113,6 +5126,7 @@ class WindykacjaStatsModel {
|
|
|
{$sql_order_by}
|
|
|
{$sql_limit}
|
|
|
";
|
|
|
+ DBG::_('DBG_SQL', '>1', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
//echo'<pre>';print_r($sql);echo'</pre>';
|
|
|
$res = $db->query($sql);
|
|
|
while ($r = $db->fetch($res)) {
|