Updated Latest changes
Showing
144 changed files
with
7902 additions
and
3988 deletions
application/031118_Version.txt
0 → 100644
| 1 | Version No. 1.19v | ||
| 2 | Changes:made changes by Jadhav in getPersonshome function,KHRMSLib.php | ||
| 3 | Date: 12/09/2018 | ||
| 4 | |||
| 5 | Version No. 1.18v | ||
| 6 | Changes: Missed calls to changed will reflect after 11th sept.,Changes DialerController.php and dialer.blade.php | ||
| 7 | Date: 10/09/2018 | ||
| 8 | |||
| 9 | Version No. 1.17v | ||
| 10 | Changes: DAP implementation, Changes KFormLib has been Changed, | ||
| 11 | Date: 10/09/2018 | ||
| 12 | |||
| 13 | Version No. 1.16v | ||
| 14 | Changes: missed call bucket in order Changes KHRMSLib.php added one function for asc | ||
| 15 | Date: 10/09/2018 | ||
| 16 | |||
| 17 | Version No. 1.15v | ||
| 18 | Changes: progressive new logic like COP, Changes dialerController.php | ||
| 19 | Date: 08/09/2018 | ||
| 20 | |||
| 21 | Version No. 1.14v | ||
| 22 | Changes: agent time report updated, commented if condition. | ||
| 23 | Date: 03/09/2018 | ||
| 24 | |||
| 25 | Version No. 1.13v | ||
| 26 | Changes: hangup beep, footer.blade.php, dialer.js changed and hangup beep added to assets/sounds/ | ||
| 27 | Date: 11/08/2018 Only on Mumbai servers | ||
| 28 | |||
| 29 | Version No. 1.12v | ||
| 30 | Changes: followup for new disposition, DialerController.php and dialer.js is changed. | ||
| 31 | Date: 11/08/2018 | ||
| 32 | |||
| 33 | Version No. 1.11v | ||
| 34 | Changes: Master report download, Changes main.blade.php, Added two libraries lib, php, KHRMS.php, XLSX library. | ||
| 35 | Date: 08/08/2018 | ||
| 36 | |||
| 37 | Version No. 1.10v | ||
| 38 | Changes: Username for inbounddrop and Userbusy for SIP/GATEWAY , Changes KPAMIListen.php | ||
| 39 | Date: 02/08/2018 | ||
| 40 | |||
| 41 | Version No. 1.9v | ||
| 42 | Changes: Call log report supervisor, and Date range in call report. | ||
| 43 | Date: 30/07/2018 | ||
| 44 | |||
| 45 | Version No. 1.8v | ||
| 46 | Changes: HDFC Mogo, Changes 1.extension.conf, 2.DialerController.php, 3.mogo tune in moh location. | ||
| 47 | Date 20/07/2018 | ||
| 48 | |||
| 49 | Version No. 1.7V | ||
| 50 | Changes: Live report reload button issue, commented one line of code in Livereport.blade.php | ||
| 51 | Date: 19/07/2018 | ||
| 52 | |||
| 53 | Versio No. 1.6V | ||
| 54 | Changes: call forward, KPAMIListen, .env and extension.conf file updated | ||
| 55 | Date: 14/07/2018 | ||
| 56 | |||
| 57 | Version No. 1.5V | ||
| 58 | Changes: Birthday calls for progressive mode, DialerController.php is updated | ||
| 59 | Date: 13/07/2018 | ||
| 60 | |||
| 61 | Version No. 1.4V | ||
| 62 | Changes: To Blank diallines, DailyLogout.php is updated. | ||
| 63 | Date: 6/07/2018 | ||
| 64 | |||
| 65 | Version No. 1.3v | ||
| 66 | Changes: Bulkupload | ||
| 67 | Date: 5/07/2018 | ||
| 68 | |||
| 69 | Version NO. 1.2v | ||
| 70 | Changes: To remove multiple circles in dialer, dialer.js is updated. | ||
| 71 | Date: 4/07/2018 | ||
| 72 | |||
| 73 | Version No. 1.1v | ||
| 74 | Changes: To remove Inbound Portfolio issue, KPAMIListen updated. | ||
| 75 | Date: 18/06/2018 | ||
| 76 | |||
| 77 |
application/1009_Version.txt
0 → 100644
| 1 | Version No. 1.14v | ||
| 2 | Changes: agent time report updated, commented if condition. | ||
| 3 | Date: 03/09/2018 | ||
| 4 | |||
| 5 | Version No. 1.13v | ||
| 6 | Changes: hangup beep, footer.blade.php, dialer.js changed and hangup beep added to assets/sounds/ | ||
| 7 | Date: 11/08/2018 Only on Mumbai servers | ||
| 8 | |||
| 9 | Version No. 1.12v | ||
| 10 | Changes: followup for new disposition, DialerController.php and dialer.js is changed. | ||
| 11 | Date: 11/08/2018 | ||
| 12 | |||
| 13 | Version No. 1.11v | ||
| 14 | Changes: Master report download, Changes main.blade.php, Added two libraries lib, php, KHRMS.php, XLSX library. | ||
| 15 | Date: 08/08/2018 | ||
| 16 | |||
| 17 | Version No. 1.10v | ||
| 18 | Changes: Username for inbounddrop and Userbusy for SIP/GATEWAY , Changes KPAMIListen.php | ||
| 19 | Date: 02/08/2018 | ||
| 20 | |||
| 21 | Version No. 1.9v | ||
| 22 | Changes: Call log report supervisor, and Date range in call report. | ||
| 23 | Date: 30/07/2018 | ||
| 24 | |||
| 25 | Version No. 1.8v | ||
| 26 | Changes: HDFC Mogo, Changes 1.extension.conf, 2.DialerController.php, 3.mogo tune in moh location. | ||
| 27 | Date 20/07/2018 | ||
| 28 | |||
| 29 | Version No. 1.7V | ||
| 30 | Changes: Live report reload button issue, commented one line of code in Livereport.blade.php | ||
| 31 | Date: 19/07/2018 | ||
| 32 | |||
| 33 | Versio No. 1.6V | ||
| 34 | Changes: call forward, KPAMIListen, .env and extension.conf file updated | ||
| 35 | Date: 14/07/2018 | ||
| 36 | |||
| 37 | Version No. 1.5V | ||
| 38 | Changes: Birthday calls for progressive mode, DialerController.php is updated | ||
| 39 | Date: 13/07/2018 | ||
| 40 | |||
| 41 | Version No. 1.4V | ||
| 42 | Changes: To Blank diallines, DailyLogout.php is updated. | ||
| 43 | Date: 6/07/2018 | ||
| 44 | |||
| 45 | Version No. 1.3v | ||
| 46 | Changes: Bulkupload | ||
| 47 | Date: 5/07/2018 | ||
| 48 | |||
| 49 | Version NO. 1.2v | ||
| 50 | Changes: To remove multiple circles in dialer, dialer.js is updated. | ||
| 51 | Date: 4/07/2018 | ||
| 52 | |||
| 53 | Version No. 1.1v | ||
| 54 | Changes: To remove Inbound Portfolio issue, KPAMIListen updated. | ||
| 55 | Date: 18/06/2018 | ||
| 56 | |||
| 57 |
application/131118_Version.txt
0 → 100644
| 1 | Version No. 1.20v | ||
| 2 | Changes:Dialer Controller for Diallines blocked, KPAMIListen for Log comment, show.blade.php casesensitivity campaign error: No Access | ||
| 3 | Date: 02/11/2018 | ||
| 4 | |||
| 5 | Version No. 1.19v | ||
| 6 | Changes:made changes by Jadhav in getPersonshome function,KHRMSLib.php | ||
| 7 | Date: 12/09/2018 | ||
| 8 | |||
| 9 | Version No. 1.18v | ||
| 10 | Changes: Missed calls to changed will reflect after 11th sept.,Changes DialerController.php and dialer.blade.php | ||
| 11 | Date: 10/09/2018 | ||
| 12 | |||
| 13 | Version No. 1.17v | ||
| 14 | Changes: DAP implementation, Changes KFormLib has been Changed, | ||
| 15 | Date: 10/09/2018 | ||
| 16 | |||
| 17 | Version No. 1.16v | ||
| 18 | Changes: missed call bucket in order Changes KHRMSLib.php added one function for asc | ||
| 19 | Date: 10/09/2018 | ||
| 20 | |||
| 21 | Version No. 1.15v | ||
| 22 | Changes: progressive new logic like COP, Changes dialerController.php | ||
| 23 | Date: 08/09/2018 | ||
| 24 | |||
| 25 | Version No. 1.14v | ||
| 26 | Changes: agent time report updated, commented if condition. | ||
| 27 | Date: 03/09/2018 | ||
| 28 | |||
| 29 | Version No. 1.13v | ||
| 30 | Changes: hangup beep, footer.blade.php, dialer.js changed and hangup beep added to assets/sounds/ | ||
| 31 | Date: 11/08/2018 Only on Mumbai servers | ||
| 32 | |||
| 33 | Version No. 1.12v | ||
| 34 | Changes: followup for new disposition, DialerController.php and dialer.js is changed. | ||
| 35 | Date: 11/08/2018 | ||
| 36 | |||
| 37 | Version No. 1.11v | ||
| 38 | Changes: Master report download, Changes main.blade.php, Added two libraries lib, php, KHRMS.php, XLSX library. | ||
| 39 | Date: 08/08/2018 | ||
| 40 | |||
| 41 | Version No. 1.10v | ||
| 42 | Changes: Username for inbounddrop and Userbusy for SIP/GATEWAY , Changes KPAMIListen.php | ||
| 43 | Date: 02/08/2018 | ||
| 44 | |||
| 45 | Version No. 1.9v | ||
| 46 | Changes: Call log report supervisor, and Date range in call report. | ||
| 47 | Date: 30/07/2018 | ||
| 48 | |||
| 49 | Version No. 1.8v | ||
| 50 | Changes: HDFC Mogo, Changes 1.extension.conf, 2.DialerController.php, 3.mogo tune in moh location. | ||
| 51 | Date 20/07/2018 | ||
| 52 | |||
| 53 | Version No. 1.7V | ||
| 54 | Changes: Live report reload button issue, commented one line of code in Livereport.blade.php | ||
| 55 | Date: 19/07/2018 | ||
| 56 | |||
| 57 | Versio No. 1.6V | ||
| 58 | Changes: call forward, KPAMIListen, .env and extension.conf file updated | ||
| 59 | Date: 14/07/2018 | ||
| 60 | |||
| 61 | Version No. 1.5V | ||
| 62 | Changes: Birthday calls for progressive mode, DialerController.php is updated | ||
| 63 | Date: 13/07/2018 | ||
| 64 | |||
| 65 | Version No. 1.4V | ||
| 66 | Changes: To Blank diallines, DailyLogout.php is updated. | ||
| 67 | Date: 6/07/2018 | ||
| 68 | |||
| 69 | Version No. 1.3v | ||
| 70 | Changes: Bulkupload | ||
| 71 | Date: 5/07/2018 | ||
| 72 | |||
| 73 | Version NO. 1.2v | ||
| 74 | Changes: To remove multiple circles in dialer, dialer.js is updated. | ||
| 75 | Date: 4/07/2018 | ||
| 76 | |||
| 77 | Version No. 1.1v | ||
| 78 | Changes: To remove Inbound Portfolio issue, KPAMIListen updated. | ||
| 79 | Date: 18/06/2018 | ||
| 80 | |||
| 81 |
| 1 | The difference between this server and other servers is KPAMIListen.php Please make sure updating this file. | 1 | Version No.1.21v |
| 2 | Changes: DialerController for the after New calls based on Subdispo Not contacted call will come in the queue. | ||
| 3 | Date: 12/11/2018 | ||
| 4 | |||
| 5 | Version No. 1.20v | ||
| 6 | Changes:Dialer Controller for Diallines blocked, KPAMIListen for Log comment, show.blade.php casesensitivity campaign error: No Access | ||
| 7 | Date: 02/11/2018 | ||
| 8 | |||
| 9 | Version No. 1.19v | ||
| 10 | Changes:made changes by Jadhav in getPersonshome function,KHRMSLib.php | ||
| 11 | Date: 12/09/2018 | ||
| 12 | |||
| 13 | Version No. 1.18v | ||
| 14 | Changes: Missed calls to changed will reflect after 11th sept.,Changes DialerController.php and dialer.blade.php | ||
| 15 | Date: 10/09/2018 | ||
| 16 | |||
| 17 | Version No. 1.17v | ||
| 18 | Changes: DAP implementation, Changes KFormLib has been Changed, | ||
| 19 | Date: 10/09/2018 | ||
| 20 | |||
| 21 | Version No. 1.16v | ||
| 22 | Changes: missed call bucket in order Changes KHRMSLib.php added one function for asc | ||
| 23 | Date: 10/09/2018 | ||
| 24 | |||
| 25 | Version No. 1.15v | ||
| 26 | Changes: progressive new logic like COP, Changes dialerController.php | ||
| 27 | Date: 08/09/2018 | ||
| 2 | 28 | ||
| 3 | Version No. 1.14v | 29 | Version No. 1.14v |
| 4 | Changes: agent time report updated, commented if condition. | 30 | Changes: agent time report updated, commented if condition. | ... | ... |
No preview for this file type
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | use App\Models\Notification; | ||
| 15 | use App\Jobs\KHRMSLib; | ||
| 16 | |||
| 17 | use Input; | ||
| 18 | |||
| 19 | use Illuminate\Database\Schema\Blueprint; | ||
| 20 | |||
| 21 | class bulkserverupload_data extends Command { | ||
| 22 | |||
| 23 | /** | ||
| 24 | * The console command name. | ||
| 25 | * | ||
| 26 | * @var string | ||
| 27 | */ | ||
| 28 | protected $signature = 'bulkserverupload_data'; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * The console command description. | ||
| 32 | * | ||
| 33 | * @var string | ||
| 34 | */ | ||
| 35 | protected $description = 'bulkserverupload_data'; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Execute the console command. | ||
| 39 | * | ||
| 40 | * @return mixed | ||
| 41 | */ | ||
| 42 | public function handle() | ||
| 43 | { | ||
| 44 | |||
| 45 | //echo "\n".date('Y-m-d')."\n"; | ||
| 46 | |||
| 47 | echo "2"; | ||
| 48 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 49 | $server_ip=env('app_ip'); | ||
| 50 | $central_ip=env('central_ip'); | ||
| 51 | |||
| 52 | |||
| 53 | $wakka = new KHRMSLib(); | ||
| 54 | |||
| 55 | $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); | ||
| 56 | $kformlib->gthis=$wakka; | ||
| 57 | |||
| 58 | $themehome=$wakka->GetThemePath('/'); | ||
| 59 | $updatetime=time(); | ||
| 60 | |||
| 61 | $clientlst=$wakka->GetBBBUserData("clientslist"); | ||
| 62 | |||
| 63 | $isadmin=$wakka->IsAdmin(); | ||
| 64 | $username=$wakka->GetUserName(); | ||
| 65 | $triggers=Input::get("triggers"); | ||
| 66 | $tmpstr=explode(",",$kformlib->HRFiledsStr); | ||
| 67 | |||
| 68 | $success="";$message="";$successcnt=0;$duplicatecount=0; | ||
| 69 | |||
| 70 | |||
| 71 | $conn = array( | ||
| 72 | 'driver' => 'mysql', | ||
| 73 | 'host' => $central_ip, | ||
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 75 | 'username' => env('DB_USERNAME', 'root'), | ||
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | ||
| 77 | 'charset' => 'utf8', | ||
| 78 | 'collation' => 'utf8_unicode_ci', | ||
| 79 | 'prefix' => '', | ||
| 80 | 'options' => array( | ||
| 81 | PDO::ATTR_TIMEOUT => 5, | ||
| 82 | ), | ||
| 83 | ); | ||
| 84 | Config::set("database.connections.conn", $conn); | ||
| 85 | |||
| 86 | DB::connection("conn")->getDatabaseName(); | ||
| 87 | |||
| 88 | $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'")); | ||
| 89 | $location=$serverclist[0]->location; | ||
| 90 | |||
| 91 | |||
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_150918 where SERVER_IP='$server_ip'")); | ||
| 93 | |||
| 94 | $conn=''; | ||
| 95 | |||
| 96 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 97 | |||
| 98 | foreach($excelarray as $key => $array){ | ||
| 99 | $excelarray[$key] = (array)$array; | ||
| 100 | } | ||
| 101 | |||
| 102 | $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_150918'")); | ||
| 103 | $highestColumn = $highestColumn[0]->cnt; | ||
| 104 | |||
| 105 | $highestrow = count($excelarray); | ||
| 106 | |||
| 107 | $flag = 0; | ||
| 108 | $editflag=0; | ||
| 109 | |||
| 110 | for($i=0;$i<$highestrow;$i++) | ||
| 111 | { | ||
| 112 | if($excelarray[$i]["clientcode"]!="") | ||
| 113 | { | ||
| 114 | /*if($excelarray[$i]["id"]=="CREATE") | ||
| 115 | { | ||
| 116 | $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 117 | } | ||
| 118 | else*/ | ||
| 119 | $excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]); | ||
| 120 | //$excelarray[$i]["client"]=$excelarray[$i]["rm_code"]; | ||
| 121 | if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1) | ||
| 122 | { | ||
| 123 | //$empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 124 | $empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]); | ||
| 125 | $ppldata=$empdata["peopledata"]; | ||
| 126 | $createdlog=$empdata['modifylog']; | ||
| 127 | $fdirty=$empdata['dirty']; | ||
| 128 | |||
| 129 | $createdlog[$updatetime]=$username."::"; | ||
| 130 | $createdlog["updated"]=$updatetime; | ||
| 131 | |||
| 132 | $newdata=$ppldata; | ||
| 133 | foreach($excelarray[$i] as $key => $value) | ||
| 134 | { | ||
| 135 | if($value!="") | ||
| 136 | { | ||
| 137 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 138 | { | ||
| 139 | $value=str_replace("'"," ",$value); | ||
| 140 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 141 | |||
| 142 | $fdirty[$key]=1; | ||
| 143 | |||
| 144 | $newdata[$key]=$value; | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | /*Start - Changes need to be done*/ | ||
| 150 | |||
| 151 | if($excelarray[$i]["status"]==null) | ||
| 152 | { | ||
| 153 | $empdata['status'] = "rom"; | ||
| 154 | } | ||
| 155 | |||
| 156 | if($excelarray[$i]["dialer_status"]==null) | ||
| 157 | { | ||
| 158 | $empdata['dialer_status'] = "rom"; | ||
| 159 | } | ||
| 160 | |||
| 161 | if($excelarray[$i]["dialer_substatus"]==null) | ||
| 162 | { | ||
| 163 | $empdata['dialer_substatus'] = "rom"; | ||
| 164 | } | ||
| 165 | |||
| 166 | /*End - Changes need to be done*/ | ||
| 167 | |||
| 168 | $empdata["peopledata"]=$newdata; | ||
| 169 | $empdata['modifylog']=$createdlog; | ||
| 170 | $empdata['dirty']=$fdirty; | ||
| 171 | |||
| 172 | //$wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 173 | $wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata); | ||
| 174 | $excelarray[$i]['modified']=date('Y-m-d H:i:s'); | ||
| 175 | $successArr[] = $excelarray[$i]; | ||
| 176 | |||
| 177 | } | ||
| 178 | else | ||
| 179 | { | ||
| 180 | $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 181 | $empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 182 | $ppldata=$empdata["peopledata"]; | ||
| 183 | $createdlog=$empdata['modifylog']; | ||
| 184 | $fdirty=$empdata['dirty']; | ||
| 185 | |||
| 186 | |||
| 187 | $createdlog[$updatetime]=$username."::"; | ||
| 188 | $createdlog["updated"]=$updatetime; | ||
| 189 | |||
| 190 | $newdata=$ppldata; | ||
| 191 | foreach($excelarray[$i] as $key => $value) | ||
| 192 | { | ||
| 193 | if($value!="") | ||
| 194 | { | ||
| 195 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 196 | { | ||
| 197 | $value=str_replace("'"," ",$value); | ||
| 198 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 199 | |||
| 200 | $fdirty[$key]=1; | ||
| 201 | |||
| 202 | $newdata[$key]=$value; | ||
| 203 | } | ||
| 204 | } | ||
| 205 | } | ||
| 206 | $empdata["peopledata"]=$newdata; | ||
| 207 | $empdata['modifylog']=$createdlog; | ||
| 208 | $empdata['dirty']=$fdirty; | ||
| 209 | |||
| 210 | //$wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 211 | $wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 212 | |||
| 213 | $reason = ""; | ||
| 214 | |||
| 215 | $reason .= "Record ID is not on local server,"; | ||
| 216 | |||
| 217 | $excelarray[$i]['server_ip'] =$server_ip; | ||
| 218 | $excelarray[$i]['location'] =$location; | ||
| 219 | |||
| 220 | if($excelarray[$i]["clientcode"]!="") | ||
| 221 | $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"]; | ||
| 222 | $excelarray[$i]['record_id'] = $excelarray[$i]["id"]; | ||
| 223 | |||
| 224 | $excelarray[$i]['Reason'] = $reason; | ||
| 225 | |||
| 226 | $failureArr[] = $excelarray[$i]; | ||
| 227 | |||
| 228 | } | ||
| 229 | } | ||
| 230 | else | ||
| 231 | { | ||
| 232 | |||
| 233 | $reason = ""; | ||
| 234 | |||
| 235 | if($excelarray[$i]["id"]=="") | ||
| 236 | $reason .= "Column ID is blank,"; | ||
| 237 | |||
| 238 | $excelarray[$i]['server_ip'] =$server_ip; | ||
| 239 | $excelarray[$i]['location'] =$location; | ||
| 240 | |||
| 241 | if($excelarray[$i]["clientcode"]!="") | ||
| 242 | $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"]; | ||
| 243 | |||
| 244 | $excelarray[$i]['Reason'] = $reason; | ||
| 245 | |||
| 246 | $failureArr[] = $excelarray[$i]; | ||
| 247 | |||
| 248 | } | ||
| 249 | |||
| 250 | } | ||
| 251 | /*if(!empty($successArr)){ | ||
| 252 | foreach($successArr as $succes) | ||
| 253 | { | ||
| 254 | $setSuccess=array(); | ||
| 255 | |||
| 256 | $setSuccess[] = "server_ip='$server_ip'"; | ||
| 257 | $setSuccess[] = "location='$location'"; | ||
| 258 | $setSuccess[] = "record_id='".$succes['id']."'"; | ||
| 259 | $setSuccess[] = "cust_id='".$succes['clientcode']."'"; | ||
| 260 | $setSuccess[] = "modified='".$succes['modified']."'"; | ||
| 261 | |||
| 262 | $setSuccess = implode(",",$setSuccess); | ||
| 263 | |||
| 264 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess")); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | if(!empty($failureArr)){ | ||
| 268 | foreach($failureArr as $failur) | ||
| 269 | { | ||
| 270 | $setFailure=array(); | ||
| 271 | |||
| 272 | $setFailure[] = "server_ip='$server_ip'"; | ||
| 273 | $setFailure[] = "location='$location'"; | ||
| 274 | $setFailure[] = "cust_id='".$failur['clientcode']."'"; | ||
| 275 | $setFailure[] = "record_id='".$failur['record_id']."'"; | ||
| 276 | $setFailure[] = "reason='".$failur['Reason']."'"; | ||
| 277 | |||
| 278 | $setFailure = implode(",",$setFailure); | ||
| 279 | |||
| 280 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | ||
| 281 | } | ||
| 282 | }*/ | ||
| 283 | |||
| 284 | DB::connection("conn")->disconnect(); | ||
| 285 | } | ||
| 286 | } |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | use App\Models\Notification; | ||
| 15 | use App\Jobs\KHRMSLib; | ||
| 16 | |||
| 17 | use Input; | ||
| 18 | |||
| 19 | use Illuminate\Database\Schema\Blueprint; | ||
| 20 | |||
| 21 | class bulkServerUpload extends Command { | ||
| 22 | |||
| 23 | /** | ||
| 24 | * The console command name. | ||
| 25 | * | ||
| 26 | * @var string | ||
| 27 | */ | ||
| 28 | protected $signature = 'bulkServerUpload'; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * The console command description. | ||
| 32 | * | ||
| 33 | * @var string | ||
| 34 | */ | ||
| 35 | protected $description = 'bulkServerUpload'; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Execute the console command. | ||
| 39 | * | ||
| 40 | * @return mixed | ||
| 41 | */ | ||
| 42 | public function handle() | ||
| 43 | { | ||
| 44 | |||
| 45 | //echo "\n".date('Y-m-d')."\n"; | ||
| 46 | |||
| 47 | echo "2"; | ||
| 48 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 49 | $server_ip=env('app_ip'); | ||
| 50 | $central_ip=env('central_ip'); | ||
| 51 | |||
| 52 | |||
| 53 | $wakka = new KHRMSLib(); | ||
| 54 | |||
| 55 | $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); | ||
| 56 | $kformlib->gthis=$wakka; | ||
| 57 | |||
| 58 | $themehome=$wakka->GetThemePath('/'); | ||
| 59 | $updatetime=time(); | ||
| 60 | |||
| 61 | $clientlst=$wakka->GetBBBUserData("clientslist"); | ||
| 62 | |||
| 63 | $isadmin=$wakka->IsAdmin(); | ||
| 64 | $username=$wakka->GetUserName(); | ||
| 65 | $triggers=Input::get("triggers"); | ||
| 66 | $tmpstr=explode(",",$kformlib->HRFiledsStr); | ||
| 67 | |||
| 68 | $success="";$message="";$successcnt=0;$duplicatecount=0; | ||
| 69 | |||
| 70 | |||
| 71 | $conn = array( | ||
| 72 | 'driver' => 'mysql', | ||
| 73 | 'host' => $central_ip, | ||
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 75 | 'username' => env('DB_USERNAME', 'root'), | ||
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | ||
| 77 | 'charset' => 'utf8', | ||
| 78 | 'collation' => 'utf8_unicode_ci', | ||
| 79 | 'prefix' => '', | ||
| 80 | 'options' => array( | ||
| 81 | PDO::ATTR_TIMEOUT => 5, | ||
| 82 | ), | ||
| 83 | ); | ||
| 84 | Config::set("database.connections.conn", $conn); | ||
| 85 | |||
| 86 | DB::connection("conn")->getDatabaseName(); | ||
| 87 | |||
| 88 | $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'")); | ||
| 89 | $location=$serverclist[0]->location; | ||
| 90 | |||
| 91 | |||
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_1 where SERVER_IP='$server_ip'")); | ||
| 93 | |||
| 94 | $conn=''; | ||
| 95 | |||
| 96 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 97 | |||
| 98 | foreach($excelarray as $key => $array){ | ||
| 99 | $excelarray[$key] = (array)$array; | ||
| 100 | } | ||
| 101 | |||
| 102 | $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_1'")); | ||
| 103 | $highestColumn = $highestColumn[0]->cnt; | ||
| 104 | |||
| 105 | $highestrow = count($excelarray); | ||
| 106 | |||
| 107 | $flag = 0; | ||
| 108 | $editflag=0; | ||
| 109 | |||
| 110 | for($i=0;$i<$highestrow;$i++) | ||
| 111 | { | ||
| 112 | if($excelarray[$i]["clientcode"]!="") | ||
| 113 | { | ||
| 114 | /*if($excelarray[$i]["id"]=="CREATE") | ||
| 115 | { | ||
| 116 | $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 117 | } | ||
| 118 | else*/ | ||
| 119 | $excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]); | ||
| 120 | //$excelarray[$i]["client"]=$excelarray[$i]["rm_code"]; | ||
| 121 | if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1) | ||
| 122 | { | ||
| 123 | //$empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 124 | $empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]); | ||
| 125 | $excelarray[$i]["other_information"]='2018-10-09_1'; | ||
| 126 | $ppldata=$empdata["peopledata"]; | ||
| 127 | $createdlog=$empdata['modifylog']; | ||
| 128 | $fdirty=$empdata['dirty']; | ||
| 129 | |||
| 130 | $createdlog[$updatetime]=$username."::"; | ||
| 131 | $createdlog["updated"]=$updatetime; | ||
| 132 | |||
| 133 | $newdata=$ppldata; | ||
| 134 | foreach($excelarray[$i] as $key => $value) | ||
| 135 | { | ||
| 136 | if($value!="") | ||
| 137 | { | ||
| 138 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 139 | { | ||
| 140 | $value=str_replace("'"," ",$value); | ||
| 141 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 142 | |||
| 143 | $fdirty[$key]=1; | ||
| 144 | |||
| 145 | $newdata[$key]=$value; | ||
| 146 | } | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | /*Start - Changes need to be done*/ | ||
| 151 | |||
| 152 | if($excelarray[$i]["status"]==null) | ||
| 153 | { | ||
| 154 | $empdata['status'] = "rom"; | ||
| 155 | } | ||
| 156 | |||
| 157 | if($excelarray[$i]["dialer_status"]==null) | ||
| 158 | { | ||
| 159 | $empdata['dialer_status'] = "rom"; | ||
| 160 | } | ||
| 161 | |||
| 162 | if($excelarray[$i]["dialer_substatus"]==null) | ||
| 163 | { | ||
| 164 | $empdata['dialer_substatus'] = "rom"; | ||
| 165 | } | ||
| 166 | |||
| 167 | /*End - Changes need to be done*/ | ||
| 168 | |||
| 169 | $empdata["peopledata"]=$newdata; | ||
| 170 | $empdata['modifylog']=$createdlog; | ||
| 171 | $empdata['dirty']=$fdirty; | ||
| 172 | |||
| 173 | //$wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 174 | $wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata); | ||
| 175 | $excelarray[$i]['modified']=date('Y-m-d H:i:s'); | ||
| 176 | $successArr[] = $excelarray[$i]; | ||
| 177 | |||
| 178 | } | ||
| 179 | else | ||
| 180 | { | ||
| 181 | $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 182 | $empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 183 | $ppldata=$empdata["peopledata"]; | ||
| 184 | $createdlog=$empdata['modifylog']; | ||
| 185 | $fdirty=$empdata['dirty']; | ||
| 186 | |||
| 187 | |||
| 188 | $createdlog[$updatetime]=$username."::"; | ||
| 189 | $createdlog["updated"]=$updatetime; | ||
| 190 | |||
| 191 | $newdata=$ppldata; | ||
| 192 | foreach($excelarray[$i] as $key => $value) | ||
| 193 | { | ||
| 194 | if($value!="") | ||
| 195 | { | ||
| 196 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 197 | { | ||
| 198 | $value=str_replace("'"," ",$value); | ||
| 199 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 200 | |||
| 201 | $fdirty[$key]=1; | ||
| 202 | |||
| 203 | $newdata[$key]=$value; | ||
| 204 | } | ||
| 205 | } | ||
| 206 | } | ||
| 207 | $empdata["peopledata"]=$newdata; | ||
| 208 | $empdata['modifylog']=$createdlog; | ||
| 209 | $empdata['dirty']=$fdirty; | ||
| 210 | |||
| 211 | //$wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 212 | $wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 213 | |||
| 214 | $reason = ""; | ||
| 215 | |||
| 216 | $reason .= "Record ID is not on local server,"; | ||
| 217 | |||
| 218 | $excelarray[$i]['server_ip'] =$server_ip; | ||
| 219 | $excelarray[$i]['location'] =$location; | ||
| 220 | |||
| 221 | if($excelarray[$i]["clientcode"]!="") | ||
| 222 | $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"]; | ||
| 223 | $excelarray[$i]['record_id'] = $excelarray[$i]["id"]; | ||
| 224 | |||
| 225 | $excelarray[$i]['Reason'] = $reason; | ||
| 226 | |||
| 227 | $failureArr[] = $excelarray[$i]; | ||
| 228 | |||
| 229 | } | ||
| 230 | } | ||
| 231 | else | ||
| 232 | { | ||
| 233 | |||
| 234 | $reason = ""; | ||
| 235 | |||
| 236 | if($excelarray[$i]["id"]=="") | ||
| 237 | $reason .= "Column ID is blank,"; | ||
| 238 | |||
| 239 | $excelarray[$i]['server_ip'] =$server_ip; | ||
| 240 | $excelarray[$i]['location'] =$location; | ||
| 241 | |||
| 242 | if($excelarray[$i]["clientcode"]!="") | ||
| 243 | $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"]; | ||
| 244 | |||
| 245 | $excelarray[$i]['Reason'] = $reason; | ||
| 246 | |||
| 247 | $failureArr[] = $excelarray[$i]; | ||
| 248 | |||
| 249 | } | ||
| 250 | |||
| 251 | } | ||
| 252 | echo "\n"."Updated data partial upload end"."\n"; | ||
| 253 | /*if(!empty($successArr)){ | ||
| 254 | foreach($successArr as $succes) | ||
| 255 | { | ||
| 256 | $setSuccess=array(); | ||
| 257 | |||
| 258 | $setSuccess[] = "server_ip='$server_ip'"; | ||
| 259 | $setSuccess[] = "location='$location'"; | ||
| 260 | $setSuccess[] = "record_id='".$succes['id']."'"; | ||
| 261 | $setSuccess[] = "cust_id='".$succes['clientcode']."'"; | ||
| 262 | $setSuccess[] = "modified='".$succes['modified']."'"; | ||
| 263 | |||
| 264 | $setSuccess = implode(",",$setSuccess); | ||
| 265 | |||
| 266 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_09102018_1_success set $setSuccess")); | ||
| 267 | } | ||
| 268 | } | ||
| 269 | if(!empty($failureArr)){ | ||
| 270 | foreach($failureArr as $failur) | ||
| 271 | { | ||
| 272 | $setFailure=array(); | ||
| 273 | |||
| 274 | $setFailure[] = "server_ip='$server_ip'"; | ||
| 275 | $setFailure[] = "location='$location'"; | ||
| 276 | $setFailure[] = "cust_id='".$failur['clientcode']."'"; | ||
| 277 | $setFailure[] = "record_id='".$failur['record_id']."'"; | ||
| 278 | $setFailure[] = "reason='".$failur['Reason']."'"; | ||
| 279 | |||
| 280 | $setFailure = implode(",",$setFailure); | ||
| 281 | |||
| 282 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | ||
| 283 | } | ||
| 284 | }*/ | ||
| 285 | |||
| 286 | DB::connection("conn")->disconnect(); | ||
| 287 | } | ||
| 288 | } |
application/app/Console/Commands/BirthdayDate.php
100644 → 100755
File mode changed
application/app/Console/Commands/Calllogupdate.php
100644 → 100755
| ... | @@ -50,9 +50,9 @@ class Calllogupdate extends Command { | ... | @@ -50,9 +50,9 @@ class Calllogupdate extends Command { |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | use App\Models\Notification; | ||
| 15 | use App\Jobs\KHRMSLib; | ||
| 16 | use App\Http\Controllers\DialerController; | ||
| 17 | |||
| 18 | use Input; | ||
| 19 | use Log; | ||
| 20 | use App\Models\Sipid; | ||
| 21 | use App\Models\Kqueue; | ||
| 22 | use App\Models\Dialline; | ||
| 23 | use App\Models\Session; | ||
| 24 | use App\Models\Cutoff; | ||
| 25 | |||
| 26 | use Illuminate\Database\Schema\Blueprint; | ||
| 27 | |||
| 28 | class CreateCall extends Command { | ||
| 29 | |||
| 30 | /** | ||
| 31 | * The console command name. | ||
| 32 | * | ||
| 33 | * @var string | ||
| 34 | */ | ||
| 35 | protected $signature = 'CreateCall'; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * The console command description. | ||
| 39 | * | ||
| 40 | * @var string | ||
| 41 | */ | ||
| 42 | protected $description = 'Create Pedictive Call If any User is Free'; | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Execute the console command. | ||
| 46 | * | ||
| 47 | * @return mixed | ||
| 48 | */ | ||
| 49 | public function handle() | ||
| 50 | { | ||
| 51 | while(true) | ||
| 52 | { | ||
| 53 | usleep(2000000); | ||
| 54 | $this->runPredictive(); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | public function runPredictive() | ||
| 59 | { | ||
| 60 | |||
| 61 | try { | ||
| 62 | $this->updatePrepareColumn(); | ||
| 63 | $usrArrs = $this->getActiveUsersCampaignWise("with"); | ||
| 64 | $cntAndStrArr = $this->getActualAvailChannelCount(); | ||
| 65 | |||
| 66 | $availChannel = $cntAndStrArr['cnt']; | ||
| 67 | $availDialStr = $cntAndStrArr['dialstr']; | ||
| 68 | |||
| 69 | if(count($usrArrs)){ | ||
| 70 | |||
| 71 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 72 | //Log::info($usrArrs); | ||
| 73 | |||
| 74 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 75 | //Log::info("Channel=".$availChannel); | ||
| 76 | |||
| 77 | foreach ($usrArrs as $client => $usrArr) { | ||
| 78 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 79 | //Log::info("campaign=".$client); | ||
| 80 | |||
| 81 | $acalls = $this->getCreateCallCount($client, count($usrArr)); | ||
| 82 | |||
| 83 | $acalls = min($acalls, $availChannel); | ||
| 84 | |||
| 85 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 86 | //Log::info("CallCount=".$acalls); | ||
| 87 | |||
| 88 | $this->CreateCall($client, $acalls, $availDialStr); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | } catch (Exception $e) { | ||
| 92 | Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 93 | Log::error($e); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | public function updatePrepareColumn() | ||
| 98 | { | ||
| 99 | $allClientUsrIdArr = array(); | ||
| 100 | $updatedUserIdArr = array(); | ||
| 101 | $currentTime = strtotime(date("Y-m-d H:i:s")); | ||
| 102 | |||
| 103 | $clientWiseUserIdArr = $this->getActiveUsersCampaignWise("without"); | ||
| 104 | |||
| 105 | if(count($clientWiseUserIdArr)) { | ||
| 106 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 107 | //Log::info("updatePrepareColumn");Log::info($clientWiseUserIdArr); | ||
| 108 | |||
| 109 | foreach ($clientWiseUserIdArr as $client => $usrIdArr) { | ||
| 110 | $allClientUsrIdArr = array_merge($allClientUsrIdArr, $usrIdArr); | ||
| 111 | } | ||
| 112 | |||
| 113 | $usersTimeArr = Cutoff::whereIn('user_id', $allClientUsrIdArr)->get(); | ||
| 114 | |||
| 115 | foreach ($usersTimeArr as $userTimeArr) { | ||
| 116 | $cutOffTime = strtotime($userTimeArr->hangup_time) + ($userTimeArr->avg_dispo - $userTimeArr->avg_ring); | ||
| 117 | |||
| 118 | if($cutOffTime < $currentTime) | ||
| 119 | { | ||
| 120 | $updatedUserIdArr[] = $userTimeArr->user_id; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | if(count($updatedUserIdArr)) { | ||
| 125 | //Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 126 | //Log::info("updatedUserIdArr");Log::info($updatedUserIdArr); | ||
| 127 | } | ||
| 128 | |||
| 129 | DB::table('sipids')->whereIn('user', $updatedUserIdArr)->update(['prepare_call'=>1]); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | public function getActiveUsersCampaignWise($checkPrepareCol) | ||
| 134 | { | ||
| 135 | $campaignWiseUsrs = array(); | ||
| 136 | $prepareUsrIds = array(); | ||
| 137 | |||
| 138 | $loggedInSips = Sipid::where('server','=',env('app_ip'))->where("user", "!=", 0)->where("status","=","1"); | ||
| 139 | if($checkPrepareCol=="with"){ | ||
| 140 | $loggedInSips = $loggedInSips->where("prepare_call","=","1"); | ||
| 141 | } | ||
| 142 | elseif($checkPrepareCol=="without"){ | ||
| 143 | $loggedInSips = $loggedInSips->where("patched","=","0"); | ||
| 144 | } | ||
| 145 | |||
| 146 | $loggedInSips = $loggedInSips->groupBy('user')->get(); | ||
| 147 | |||
| 148 | if(count($loggedInSips)){ | ||
| 149 | |||
| 150 | foreach ($loggedInSips as $loggedInSip) { | ||
| 151 | $prepareUsrIds[] = $loggedInSip->user; | ||
| 152 | } | ||
| 153 | |||
| 154 | //TODO: Change Dialmode Value in the column Of User Table (Ready to Predictive) | ||
| 155 | $usersLoggedIn = User::whereIn('id', $prepareUsrIds); | ||
| 156 | if($checkPrepareCol=="without")$usersLoggedIn = $usersLoggedIn->where('current_dialmode', '=', 'Predictive'); | ||
| 157 | $usersLoggedIn = $usersLoggedIn->select('id','sel_campaign')->get(); | ||
| 158 | |||
| 159 | foreach ($usersLoggedIn as $userLoggedIn) { | ||
| 160 | $campaignWiseUsrs[$userLoggedIn->sel_campaign][] = $userLoggedIn->id; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | return $campaignWiseUsrs; | ||
| 164 | } | ||
| 165 | |||
| 166 | public function getActualAvailChannelCount() | ||
| 167 | { | ||
| 168 | $data = array(); | ||
| 169 | $cnt = 0; | ||
| 170 | $allChanlCnt = $this->getSpanCount(); | ||
| 171 | $dialstr = ""; | ||
| 172 | |||
| 173 | $diallineVal = Dialline::where('server','=', env('app_ip'))->where("status","=","Free")->where("dialstr","!=","")->where("enabled","=","1")->select('dialstr')->first(); | ||
| 174 | |||
| 175 | //TODO: When SIP and Dahdi both are active | ||
| 176 | if(count($diallineVal)){ | ||
| 177 | if(stristr($diallineVal->dialstr,"Dahdi")){ | ||
| 178 | $dialedCnt = $this->getActualDahdiDialedCallCount(); | ||
| 179 | |||
| 180 | $cnt = $allChanlCnt - $dialedCnt; | ||
| 181 | } | ||
| 182 | elseif(stristr($diallineVal->dialstr,"GATEWAY")){ | ||
| 183 | $dialedCnt = $this->getActualSipDialedCallCount(); | ||
| 184 | |||
| 185 | $cnt = $allChanlCnt - $dialedCnt; | ||
| 186 | } | ||
| 187 | |||
| 188 | $dialstr = $diallineVal->dialstr; | ||
| 189 | } | ||
| 190 | |||
| 191 | $data['cnt'] = $cnt; | ||
| 192 | $data['dialstr'] = $dialstr; | ||
| 193 | |||
| 194 | return $data; | ||
| 195 | } | ||
| 196 | |||
| 197 | public function getActualSipDialedCallCount() | ||
| 198 | { | ||
| 199 | $allChnnlArr = array(); | ||
| 200 | $dialstr = "Dial(SIP/GATEWAY/"; | ||
| 201 | $chnlCnt = 0; | ||
| 202 | |||
| 203 | exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnls); | ||
| 204 | |||
| 205 | foreach($allChnnls as $allChnnl){ | ||
| 206 | //$allChnnlArr[] = explode(" ", preg_replace('!\s+!', ' ', $allChnnl) ); | ||
| 207 | if(stristr($allChnnl, $dialstr)){ | ||
| 208 | $chnlCnt++; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | return $chnlCnt; | ||
| 213 | } | ||
| 214 | |||
| 215 | public function getActualDahdiDialedCallCount() | ||
| 216 | { | ||
| 217 | $allChnnlArr = array(); | ||
| 218 | $dialstr = "- ACTIVE"; | ||
| 219 | $status = "RED"; | ||
| 220 | $chnlCnt = 0; | ||
| 221 | |||
| 222 | //exec("/usr/sbin/asterisk -rx 'service dahdi status'",$allChnnls); | ||
| 223 | exec("service dahdi status",$allChnnls); | ||
| 224 | |||
| 225 | foreach($allChnnls as $allChnnl){ | ||
| 226 | //$allChnnlArr[] = explode(" ", preg_replace('!\s+!', ' ', $allChnnl) ); | ||
| 227 | if(stristr($allChnnl, $status)){ | ||
| 228 | Break; | ||
| 229 | } | ||
| 230 | |||
| 231 | if(stristr($allChnnl, $dialstr)){ | ||
| 232 | $chnlCnt++; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 236 | return $chnlCnt; | ||
| 237 | } | ||
| 238 | |||
| 239 | //TODO: Generate Client File To Take All Parameteres Of Campaigns | ||
| 240 | public function getCreateCallCount($client, $usrCnt) | ||
| 241 | { | ||
| 242 | $wakka = new KHRMSLib(); | ||
| 243 | $mastersdata=$wakka->getCompanyMaster($client); | ||
| 244 | |||
| 245 | $ratio = $mastersdata["autodialercampaign"]; | ||
| 246 | $dialedCallCnt = $this->getDialedCallCount($client); | ||
| 247 | |||
| 248 | return ($usrCnt*$ratio) - $dialedCallCnt; | ||
| 249 | } | ||
| 250 | |||
| 251 | public function getDialedCallCount($client) | ||
| 252 | { | ||
| 253 | $cnt = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->where("regexstr","=",$client)->count(); | ||
| 254 | |||
| 255 | return $cnt; | ||
| 256 | } | ||
| 257 | |||
| 258 | public function CreateCall($client, $acalls, $availDialStr) | ||
| 259 | { | ||
| 260 | if($acalls>0) | ||
| 261 | { | ||
| 262 | for($i=0;$i<$acalls;$i++) | ||
| 263 | { | ||
| 264 | $this->useChannelToDial($client, $availDialStr); | ||
| 265 | } | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | public function useChannelToDial($client, $availDialStr) | ||
| 270 | { | ||
| 271 | $dialline=Dialline::where('server','=', env('app_ip'))->where("status","=","Free")->where("enabled","=","1")->where("dialstr", "=", $availDialStr)->orderBy('updated_at','ASC')->first(); | ||
| 272 | |||
| 273 | //TODO::Need To Code Dspan Logic as per discussion | ||
| 274 | //if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan)->where('id','<=','30'); | ||
| 275 | //$dialline=$dialline->orderBy('id','ASC')->first(); | ||
| 276 | |||
| 277 | if(!empty($dialline)) | ||
| 278 | { | ||
| 279 | $this->createCrmCall($client, $dialline); | ||
| 280 | } | ||
| 281 | |||
| 282 | return; | ||
| 283 | } | ||
| 284 | |||
| 285 | public function createCrmCall($client, $dialline) | ||
| 286 | { | ||
| 287 | //TODO: Need to check whether callerid is required or not (in case of GSM Gateway) | ||
| 288 | $callerid=""; | ||
| 289 | $wakka = new KHRMSLib(); | ||
| 290 | |||
| 291 | $gz = new DialerController(); | ||
| 292 | $users= $gz->getCallSequencing(1,$client); | ||
| 293 | |||
| 294 | if(sizeof($users)>=1) | ||
| 295 | { | ||
| 296 | $record=$wakka->getPerson($users[0]['id'],$client); | ||
| 297 | if($record) | ||
| 298 | { | ||
| 299 | $record["peopledata"]["status"]="AutoCall"; | ||
| 300 | $wakka->setPerson($users[0]['id'],$record,$client); | ||
| 301 | DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); | ||
| 302 | } | ||
| 303 | |||
| 304 | $dialline->user_id=$user_id; | ||
| 305 | $dialline->status="AutoCall"; | ||
| 306 | $dialline->regexstr=$users[0]['client']; | ||
| 307 | $dialline->number=$users[0]["mobile"]; | ||
| 308 | $dialline->save(); | ||
| 309 | |||
| 310 | $nowts=microtime(true)*1000; | ||
| 311 | |||
| 312 | //start the call log | ||
| 313 | $crmcall=new CRMCall(); | ||
| 314 | $crmcall->number=$users[0]["mobile"]; | ||
| 315 | $crmcall->user_id=0; | ||
| 316 | $crmcall->sipid_id=0; | ||
| 317 | $crmcall->crm_id=$users[0]['id']; | ||
| 318 | //$crmcall->lan=$users[0]['lan']; | ||
| 319 | $crmcall->client=$users[0]['client']; | ||
| 320 | $crmcall->department=$users[0]['department']; | ||
| 321 | $crmcall->state='New'; | ||
| 322 | $crmcall->type="AutoCall"; | ||
| 323 | $crmcall->dialline_id=$dialline->id; | ||
| 324 | |||
| 325 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 326 | $crmcall->setTs('ts_Call',$nowts); | ||
| 327 | |||
| 328 | $crmcall->did=$callerid; | ||
| 329 | |||
| 330 | $tdata=array(); | ||
| 331 | $crmcall->data=json_encode($tdata); | ||
| 332 | $crmcall->save(); | ||
| 333 | |||
| 334 | //start actual calls | ||
| 335 | $newqueue=new Kqueue(); | ||
| 336 | $newqueue->autoCallOut($users[0]["mobile"],$callerid,$crmcall,$dialline); | ||
| 337 | } | ||
| 338 | |||
| 339 | return; | ||
| 340 | } | ||
| 341 | |||
| 342 | public function getSpanCount() | ||
| 343 | { | ||
| 344 | $spanArr = array("span1" => 30, "span2" => 30, "span3" => 30, "span4" => 30); | ||
| 345 | |||
| 346 | $cnt = array_sum($spanArr); | ||
| 347 | |||
| 348 | return $cnt; | ||
| 349 | } | ||
| 350 | } |
| ... | @@ -45,14 +45,14 @@ class CreportEight extends Command { | ... | @@ -45,14 +45,14 @@ class CreportEight extends Command { |
| 45 | 45 | ||
| 46 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | 46 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); |
| 47 | $central_ip=env('central_ip'); | 47 | $central_ip=env('central_ip'); |
| 48 | $server_ip=env('app_ip'); | 48 | $server_ip=env('DB_HOST'); |
| 49 | $calllog_report = "calllog_report_".$date; | 49 | $calllog_report = "calllog_report_".$date; |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -53,9 +53,9 @@ class CreportNine extends Command { | ... | @@ -53,9 +53,9 @@ class CreportNine extends Command { |
| 53 | $conn = array( | 53 | $conn = array( |
| 54 | 'driver' => 'mysql', | 54 | 'driver' => 'mysql', |
| 55 | 'host' => $central_ip, | 55 | 'host' => $central_ip, |
| 56 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 56 | 'database' => env('CENTRAL_DB'), |
| 57 | 'username' => env('DB_USERNAME', 'root'), | 57 | 'username' => env('CENTRAL_USERNAME'), |
| 58 | 'password' => env('DB_PASSWORD', ''), | 58 | 'password' => env('CENTRAL_PASSWORD'), |
| 59 | 'charset' => 'utf8', | 59 | 'charset' => 'utf8', |
| 60 | 'collation' => 'utf8_unicode_ci', | 60 | 'collation' => 'utf8_unicode_ci', |
| 61 | 'prefix' => '', | 61 | 'prefix' => '', | ... | ... |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | |||
| 15 | use Illuminate\Database\Schema\Blueprint; | ||
| 16 | |||
| 17 | class CreportTen extends Command { | ||
| 18 | |||
| 19 | /** | ||
| 20 | * The console command name. | ||
| 21 | * | ||
| 22 | * @var string | ||
| 23 | */ | ||
| 24 | protected $signature = 'CreportTen'; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * The console command description. | ||
| 28 | * | ||
| 29 | * @var string | ||
| 30 | */ | ||
| 31 | protected $description = 'App Main Daily Task for CreportTen'; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * Execute the console command. | ||
| 35 | * | ||
| 36 | * @return mixed | ||
| 37 | */ | ||
| 38 | public function handle() | ||
| 39 | { | ||
| 40 | $nowts=time(); | ||
| 41 | $date=date('F_Y'); | ||
| 42 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 43 | |||
| 44 | $logdate=strtotime('0 day'); | ||
| 45 | |||
| 46 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 47 | $central_ip=env('central_ip'); | ||
| 48 | $server_ip=env('app_ip'); | ||
| 49 | //$calllog_report = "calllog_report_".date("d_m_Y"); | ||
| 50 | $calllog_report = "calllog_report_test"; | ||
| 51 | $conn = array( | ||
| 52 | 'driver' => 'mysql', | ||
| 53 | 'host' => $central_ip, | ||
| 54 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 55 | 'username' => env('DB_USERNAME', 'root'), | ||
| 56 | 'password' => env('DB_PASSWORD', ''), | ||
| 57 | 'charset' => 'utf8', | ||
| 58 | 'collation' => 'utf8_unicode_ci', | ||
| 59 | 'prefix' => '', | ||
| 60 | 'options' => array( | ||
| 61 | PDO::ATTR_TIMEOUT => 5, | ||
| 62 | ), | ||
| 63 | ); | ||
| 64 | Config::set("database.connections.conn", $conn); | ||
| 65 | |||
| 66 | DB::connection("conn")->getDatabaseName(); | ||
| 67 | |||
| 68 | $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'")); | ||
| 69 | $server_id=$serverclist[0]->id; | ||
| 70 | if($server_id<10){ | ||
| 71 | $server_id="0".$server_id; | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'")); | ||
| 76 | |||
| 77 | $maxids=$maxid[0]->maxid; | ||
| 78 | echo "Maxid".$maxids; | ||
| 79 | |||
| 80 | //$alist=DB::select(DB::raw("SELECT * from crmcalls_archive where created_at>'2018-06-01' and created_at<'2018-07-01'")); | ||
| 81 | //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'")); | ||
| 82 | |||
| 83 | $alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'")); | ||
| 84 | |||
| 85 | $userarr=array(); | ||
| 86 | foreach($alist as $aline) | ||
| 87 | { | ||
| 88 | $setstrarr=array(); | ||
| 89 | |||
| 90 | |||
| 91 | $clientcode="";$currentstatus="";$legalstatus="";$record_id=""; | ||
| 92 | if($aline->crm_id>0) | ||
| 93 | { | ||
| 94 | $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;")); | ||
| 95 | if(isset($user[0])) | ||
| 96 | { | ||
| 97 | $record_id=$user[0]->id; | ||
| 98 | $clientcode=$user[0]->clientcode; | ||
| 99 | $currentstatus=$user[0]->currentstatus; | ||
| 100 | $legalstatus=$user[0]->legalstatus; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | $tpostdata=json_decode($aline->data,true); | ||
| 104 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60); | ||
| 105 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 106 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 107 | |||
| 108 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 109 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 110 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 111 | $globalid=$server_id.$record_id; | ||
| 112 | $setstrarr[]="server='$server_id'"; | ||
| 113 | $setstrarr[]="record_id='$record_id'"; | ||
| 114 | $setstrarr[]="crmcall_id='$aline->id'"; | ||
| 115 | $setstrarr[]="globalid='$globalid'"; | ||
| 116 | $setstrarr[]="created_at='$aline->created_at'"; | ||
| 117 | $setstrarr[]="start='$fulldate'"; | ||
| 118 | $setstrarr[]="length='$length'"; | ||
| 119 | $setstrarr[]="user='$username'"; | ||
| 120 | $setstrarr[]="name='$dispname'"; | ||
| 121 | $setstrarr[]="dispo='$aline->userstatus'"; | ||
| 122 | $setstrarr[]="subdispo='$aline->usersubstatus'"; | ||
| 123 | $setstrarr[]="callback='$aline->usercallback'"; | ||
| 124 | |||
| 125 | $setstrarr[]="number='$aline->number'"; | ||
| 126 | $setstrarr[]="clientcode='$clientcode'"; | ||
| 127 | $setstrarr[]="currentstatus='$currentstatus'"; | ||
| 128 | $setstrarr[]="legalstatus='$legalstatus'"; | ||
| 129 | $setstrarr[]="client='$aline->client'"; | ||
| 130 | $setstrarr[]="department='$aline->department'"; | ||
| 131 | $setstrarr[]="state='$aline->state'"; | ||
| 132 | $setstrarr[]="hsource='$aline->hsource'"; | ||
| 133 | |||
| 134 | $setstrarr[]="type='$aline->type'"; | ||
| 135 | $setstrarr[]="status='$aline->status'"; | ||
| 136 | $setstrarr[]="statuscode='$aline->statuscode'"; | ||
| 137 | $setstrarr[]="statusstr='$aline->substatus'"; | ||
| 138 | $setstrarr[]="dialline='$aline->dialline_id'"; | ||
| 139 | $setstrarr[]="did='$aline->did'"; | ||
| 140 | $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'"; | ||
| 141 | $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'"; | ||
| 142 | $setstrarr[]="talksec='".round($talktime/1000,2)."'"; | ||
| 143 | $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'"; | ||
| 144 | $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'"; | ||
| 145 | $setstrarr[]="userdata='$aline->userdata'"; | ||
| 146 | $setstrarr[]="attempt='$aline->attempt'"; | ||
| 147 | $setstrarr[]="priority='$aline->priority'"; | ||
| 148 | $setstrarr[]="question='$aline->question'"; | ||
| 149 | |||
| 150 | $setstr=implode(",",$setstrarr); | ||
| 151 | DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr")); | ||
| 152 | //DB::connection("conn")->update(DB::raw("UPDATE ".$calllog_report." as ca INNER JOIN crmcalls as c on ca.crmcall_id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question")); | ||
| 153 | } | ||
| 154 | echo "AfterUploadingData=".date('Y-m-d H:i:s'); | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 |
| ... | @@ -98,9 +98,9 @@ class KstychDaily extends Command { | ... | @@ -98,9 +98,9 @@ class KstychDaily extends Command { |
| 98 | $conn = array( | 98 | $conn = array( |
| 99 | 'driver' => 'mysql', | 99 | 'driver' => 'mysql', |
| 100 | 'host' => $server, | 100 | 'host' => $server, |
| 101 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 101 | 'database' => env('CENTRAL_DB'), |
| 102 | 'username' => env('DB_USERNAME', 'root'), | 102 | 'username' => env('CENTRAL_USERNAME'), |
| 103 | 'password' => env('DB_PASSWORD', ''), | 103 | 'password' => env('CENTRAL_PASSWORD'), |
| 104 | 'charset' => 'utf8', | 104 | 'charset' => 'utf8', |
| 105 | 'collation' => 'utf8_unicode_ci', | 105 | 'collation' => 'utf8_unicode_ci', |
| 106 | 'prefix' => '', | 106 | 'prefix' => '', | ... | ... |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | use App\Models\Notification; | ||
| 15 | use App\Jobs\KHRMSLib; | ||
| 16 | |||
| 17 | use Input; | ||
| 18 | use App\Models\Sipid; | ||
| 19 | use App\Models\Kqueue; | ||
| 20 | use App\Models\Dialline; | ||
| 21 | use App\Models\Session; | ||
| 22 | use App\Models\Cutoff; | ||
| 23 | |||
| 24 | use Log; | ||
| 25 | use Illuminate\Database\Schema\Blueprint; | ||
| 26 | |||
| 27 | class PredictiveCallHangUp extends Command { | ||
| 28 | |||
| 29 | /** | ||
| 30 | * The console command name. | ||
| 31 | * | ||
| 32 | * @var string | ||
| 33 | */ | ||
| 34 | protected $signature = 'PredictiveCallHangUp'; | ||
| 35 | |||
| 36 | /** | ||
| 37 | * The console command description. | ||
| 38 | * | ||
| 39 | * @var string | ||
| 40 | */ | ||
| 41 | protected $description = 'Hang Up Extra Calls If Agents Are Not Free'; | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Execute the console command. | ||
| 45 | * | ||
| 46 | * @return mixed | ||
| 47 | */ | ||
| 48 | public function handle() | ||
| 49 | { | ||
| 50 | while(true) | ||
| 51 | { | ||
| 52 | usleep(1000000); | ||
| 53 | $this->runHangUp(); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | public function runHangUp() | ||
| 58 | { | ||
| 59 | try { | ||
| 60 | $breathingTime = 30; | ||
| 61 | $avgringsec = 30; | ||
| 62 | |||
| 63 | $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); | ||
| 64 | if($avgringsec)$avgringsec= intval($avgringsec->avgringsec); | ||
| 65 | |||
| 66 | $diallines = Dialline::whereIn("status", ["Auto","AutoCall"])->where("conf","=","")->select('src_channel','status','updated_at','channel','server')->get(); | ||
| 67 | |||
| 68 | foreach ($diallines as $dialline) { | ||
| 69 | |||
| 70 | $newqueue=new Kqueue(); | ||
| 71 | $lastUpdatedTime = strtotime(date("Y-m-d H:i:s")) - strtotime($dialline->updated_at); | ||
| 72 | |||
| 73 | if ($dialline->status == 'Auto' && $lastUpdatedTime > $breathingTime) { | ||
| 74 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); | ||
| 75 | } | ||
| 76 | elseif($dialline->status == 'AutoCall' && $lastUpdatedTime > ($avgringsec+$breathingTime)) { | ||
| 77 | $newqueue->hangupChannelS($dialline->src_channel,$dialline->server); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } catch (Exception $e) { | ||
| 81 | Log::useFiles(storage_path()."/logs/predictive_".date("Y_m_d").".log"); | ||
| 82 | Log::error($e); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | } |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | |||
| 15 | use Illuminate\Database\Schema\Blueprint; | ||
| 16 | |||
| 17 | class Smsreport extends Command { | ||
| 18 | |||
| 19 | /** | ||
| 20 | * The console command name. | ||
| 21 | * | ||
| 22 | * @var string | ||
| 23 | */ | ||
| 24 | protected $signature = 'Smsreport'; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * The console command description. | ||
| 28 | * | ||
| 29 | * @var string | ||
| 30 | */ | ||
| 31 | protected $description = 'App Main Daily Task for Smsreport'; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * Execute the console command. | ||
| 35 | * | ||
| 36 | * @return mixed | ||
| 37 | */ | ||
| 38 | public function handle() | ||
| 39 | { | ||
| 40 | $nowts=time(); | ||
| 41 | $date=date('F_Y'); | ||
| 42 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 43 | |||
| 44 | $logdate=strtotime('0 day'); | ||
| 45 | |||
| 46 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 47 | $central_ip=env('central_ip'); | ||
| 48 | $server_ip=env('app_ip'); | ||
| 49 | $calllog_report = "calllog_report_".$date; | ||
| 50 | $conn = array( | ||
| 51 | 'driver' => 'mysql', | ||
| 52 | 'host' => $central_ip, | ||
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 54 | 'username' => env('DB_USERNAME', 'root'), | ||
| 55 | 'password' => env('DB_PASSWORD', ''), | ||
| 56 | 'charset' => 'utf8', | ||
| 57 | 'collation' => 'utf8_unicode_ci', | ||
| 58 | 'prefix' => '', | ||
| 59 | 'options' => array( | ||
| 60 | PDO::ATTR_TIMEOUT => 5, | ||
| 61 | ), | ||
| 62 | ); | ||
| 63 | Config::set("database.connections.conn", $conn); | ||
| 64 | |||
| 65 | DB::connection("conn")->getDatabaseName(); | ||
| 66 | |||
| 67 | $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'")); | ||
| 68 | $server_id=str_pad($serverclist[0]->id, 2, '0', STR_PAD_LEFT); | ||
| 69 | |||
| 70 | $maxid=DB::connection("conn")->select(DB::raw("SELECT max(sms_id) as maxid from sms_report where server='$server_id'")); | ||
| 71 | |||
| 72 | $maxids=$maxid[0]->maxid; | ||
| 73 | |||
| 74 | $alist=DB::select(DB::raw("SELECT * from sms_log where id>'$maxids'")); | ||
| 75 | $iii=0; | ||
| 76 | $shortinsert=""; | ||
| 77 | foreach($alist as $aline) | ||
| 78 | { | ||
| 79 | $iii++; | ||
| 80 | $server = $server_id; | ||
| 81 | $sms_id = $aline->id; | ||
| 82 | $created_at = $aline->created_at; | ||
| 83 | $message_time = date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60); | ||
| 84 | $server_ip = $aline->server_ip; | ||
| 85 | $call_id = $aline->call_id; | ||
| 86 | $agent_name = $aline->agent_name; | ||
| 87 | $subdispo = $aline->subdispo; | ||
| 88 | $number = $aline->number; | ||
| 89 | $message = $aline->message; | ||
| 90 | $response = $aline->response; | ||
| 91 | |||
| 92 | $shortinsert.="('$server', '$sms_id','$created_at', '$message_time', '$server_ip', '$call_id', '$agent_name', '$subdispo', '$number', '$message', '$response'),"; | ||
| 93 | |||
| 94 | if($iii%50==0 || $iii == count($alist)){ | ||
| 95 | |||
| 96 | $shortinsert=substr($shortinsert,0,-1); | ||
| 97 | DB::connection("conn")->insert(DB::raw("INSERT INTO sms_report (`server`, `sms_id`, `created_at`, `message_time`, `server_ip`, `call_id`, `agent_name`, `subdispo`, `number`, `message`, `response`) VALUES $shortinsert")); | ||
| 98 | $shortinsert=""; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 102 | DB::connection("conn")->disconnect(); | ||
| 103 | } | ||
| 104 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | //use Mail; | ||
| 5 | use DB; | ||
| 6 | use Config; | ||
| 7 | |||
| 8 | use App\Models\User; | ||
| 9 | use App\Models\Accesslog; | ||
| 10 | |||
| 11 | use App\Models\CRMCall; | ||
| 12 | use Schema; | ||
| 13 | use PDO; | ||
| 14 | use App\Models\Notification; | ||
| 15 | use App\Jobs\KHRMSLib; | ||
| 16 | |||
| 17 | use Input; | ||
| 18 | use App\Models\Sipid; | ||
| 19 | use App\Models\Kqueue; | ||
| 20 | use App\Models\Dialline; | ||
| 21 | use App\Models\Session; | ||
| 22 | use App\Models\Cutoff; | ||
| 23 | |||
| 24 | use Log; | ||
| 25 | use Illuminate\Database\Schema\Blueprint; | ||
| 26 | |||
| 27 | class UpdateAvgRingSec extends Command { | ||
| 28 | |||
| 29 | /** | ||
| 30 | * The console command name. | ||
| 31 | * | ||
| 32 | * @var string | ||
| 33 | */ | ||
| 34 | protected $signature = 'UpdateAvgRingSec'; | ||
| 35 | |||
| 36 | /** | ||
| 37 | * The console command description. | ||
| 38 | * | ||
| 39 | * @var string | ||
| 40 | */ | ||
| 41 | protected $description = 'Update Avg Call Ring Sec Of Last 50 Calls'; | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Execute the console command. | ||
| 45 | * | ||
| 46 | * @return mixed | ||
| 47 | */ | ||
| 48 | public function handle() | ||
| 49 | { | ||
| 50 | $avgcallsecObj = CRMCall::select(DB::Raw('ROUND((avg(callsec))/1000) as avgcallsec'))->limit(50)->where("type","!=","Inbound")->first(); | ||
| 51 | |||
| 52 | if(count($avgcallsecObj)) | ||
| 53 | { | ||
| 54 | Cutoff::where('user_id', '!=', "")->update( | ||
| 55 | ['avg_ring' => $avgcallsecObj->avgcallsec | ||
| 56 | ]); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -40,16 +40,18 @@ class Userlog_data extends Command { | ... | @@ -40,16 +40,18 @@ class Userlog_data extends Command { |
| 40 | echo "\n".date('Y-m-d')."\n"; | 40 | echo "\n".date('Y-m-d')."\n"; |
| 41 | 41 | ||
| 42 | $logdate=strtotime('-1 day'); | 42 | $logdate=strtotime('-1 day'); |
| 43 | //$date=date('F_Y'); | ||
| 44 | echo date("Y-m-d",$logdate); | ||
| 43 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | 45 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); |
| 44 | $server_ip=env('app_ip'); | 46 | $server_ip=env('DB_HOST'); |
| 45 | $central_ip=env('central_ip'); | 47 | $central_ip=env('central_ip'); |
| 46 | 48 | ||
| 47 | $conn = array( | 49 | $conn = array( |
| 48 | 'driver' => 'mysql', | 50 | 'driver' => 'mysql', |
| 49 | 'host' => $central_ip, | 51 | 'host' => $central_ip, |
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 52 | 'database' => env('CENTRAL_DB'), |
| 51 | 'username' => env('DB_USERNAME', 'root'), | 53 | 'username' => env('CENTRAL_USERNAME'), |
| 52 | 'password' => env('DB_PASSWORD', ''), | 54 | 'password' => env('CENTRAL_PASSWORD'), |
| 53 | 'charset' => 'utf8', | 55 | 'charset' => 'utf8', |
| 54 | 'collation' => 'utf8_unicode_ci', | 56 | 'collation' => 'utf8_unicode_ci', |
| 55 | 'prefix' => '', | 57 | 'prefix' => '', |
| ... | @@ -85,7 +87,11 @@ class Userlog_data extends Command { | ... | @@ -85,7 +87,11 @@ class Userlog_data extends Command { |
| 85 | $enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at)); | 87 | $enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at)); |
| 86 | $enddate=explode(" ",$enddatetime)[0]; | 88 | $enddate=explode(" ",$enddatetime)[0]; |
| 87 | $endtime=explode(" ",$enddatetime)[1]; | 89 | $endtime=explode(" ",$enddatetime)[1]; |
| 88 | $durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime)); | 90 | //echo "endtime".$endtime; |
| 91 | //$durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime)); | ||
| 92 | $durationsec=strtotime(date("Y-m-d H:i:s",strtotime($endtime)-strtotime($aline->starttime))); | ||
| 93 | //echo "durationsec".$durationsec; | ||
| 94 | if($aline->created_at==$aline->updated_at){ $durationsec=0; } | ||
| 89 | } | 95 | } |
| 90 | else | 96 | else |
| 91 | { | 97 | { |
| ... | @@ -93,11 +99,11 @@ class Userlog_data extends Command { | ... | @@ -93,11 +99,11 @@ class Userlog_data extends Command { |
| 93 | $endtime=$aline->endtime; | 99 | $endtime=$aline->endtime; |
| 94 | $durationsec=$aline->durationsec; | 100 | $durationsec=$aline->durationsec; |
| 95 | } | 101 | } |
| 96 | 102 | //echo $endtime."^".$enddate."^".$durationsec; | |
| 97 | $rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id, | 103 | $rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id, |
| 98 | 'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id], | 104 | 'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id], |
| 99 | 'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime, | 105 | 'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime, |
| 100 | 'durationsec'=>$durationsec,'data'=>$aline->data,'group'=>$aline->group,'login'=>'','dialnext'=>'','dialnext-agentbriefing'=>'','dialnext-downtime'=>'','dialnext-floorannouncements'=>'','dialnext-incoming'=>'','dialnext-lunchbreak'=>'','dialnext-manual'=>'','dialnext-notready'=>'','dialnext-qualityfeedback'=>'','dialnext-teabreak'=>'','dialnext-teammeeting'=>'','dialnext-utilitybreak'=>'','manual'=>'','manual-agentbriefing'=>'','manual-agentbriefing'=>'','manual-downtime'=>'','manual-floorannouncements'=>'','manual-incoming'=>'','manual-lunchbreak'=>'','manual-manual'=>'','manual-notready'=>'','manual-qualityfeedback'=>'','manual-teabreak'=>'','manual-teammeeting'=>'','manual-utilitybreak'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','paused-wrapup'=>'','progressive'=>'','progressive-agentbriefing'=>'','progressive-agentbriefing'=>'','progressive-downtime'=>'','progressive-floorannouncements'=>'','progressive-incoming'=>'','progressive-lunchbreak'=>'','progressive-manual'=>'','progressive-notready'=>'','progressive-qualityfeedback'=>'','progressive-teabreak'=>'','progressive-teammeeting'=>'','progressive-utilitybreak'=>'','ready-incoming'=>'' | 106 | 'durationsec'=>$durationsec,'group'=>$aline->group,'login'=>'','dialnext'=>'','manual'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-wrapup'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','progressive'=>'','ready-incoming'=>'' |
| 101 | ); | 107 | ); |
| 102 | 108 | ||
| 103 | $data=json_decode($aline->data,true); | 109 | $data=json_decode($aline->data,true); |
| ... | @@ -111,45 +117,69 @@ class Userlog_data extends Command { | ... | @@ -111,45 +117,69 @@ class Userlog_data extends Command { |
| 111 | { | 117 | { |
| 112 | if($states[0] != 1) | 118 | if($states[0] != 1) |
| 113 | { | 119 | { |
| 120 | //if($previous!='paused-wrapup'){ | ||
| 114 | $rowdata[$previous] +=round(($fts-$prets)/1000,2); | 121 | $rowdata[$previous] +=round(($fts-$prets)/1000,2); |
| 115 | 122 | ||
| 116 | $previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]); | 123 | $previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]); |
| 117 | $prets=$fts; | 124 | $prets=$fts; |
| 125 | //} | ||
| 118 | } | 126 | } |
| 119 | 127 | ||
| 120 | } | 128 | } |
| 121 | $rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2); | 129 | $rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2); |
| 122 | } | 130 | } |
| 123 | } | 131 | } |
| 124 | $rowdata["login"] = $aline->durationsec; | 132 | //$rowdata["login"] = $aline->durationsec; |
| 133 | $rowdata["login"] = $durationsec; | ||
| 134 | |||
| 135 | //$rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak']; | ||
| 136 | /*$rowdata["not-ready"] = $durationsec-($rowdata['dialnext']+$rowdata['manual']+$rowdata['paused']+$rowdata['paused-agentbriefing']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-incoming']+$rowdata['paused-lunchbreak']+$rowdata['paused-manual']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teabreak']+$rowdata['paused-teammeeting']+$rowdata['paused-utilitybreak']+$rowdata['paused-autowrapup']+$rowdata['progressive']+$rowdata['ready-incoming']);*/ | ||
| 125 | 137 | ||
| 126 | $rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak']; | ||
| 127 | //$rowdata["not-ready"] = $aline->durationsec-($rowdata['dialnext']+$rowdata['dialnext-agentbriefing']+$rowdata['dialnext-downtime']+$rowdata['dialnext-floorannouncements']+$rowdata['dialnext-incoming']+$rowdata['dialnext-lunchbreak']+$rowdata['dialnext-manual']+$rowdata['dialnext-notready']+$rowdata['dialnext-qualityfeedback']+$rowdata['dialnext-teabreak']+$rowdata['dialnext-teammeeting']+$rowdata['dialnext-utilitybreak']+$rowdata['manual']+$rowdata['manual-agentbriefing']+$rowdata['manual-downtime']+$rowdata['manual-floorannouncements']+$rowdata['manual-incoming']+$rowdata['manual-lunchbreak']+$rowdata['manual-manual']+$rowdata['manual-notready']+$rowdata['manual-qualityfeedback']+$rowdata['manual-teabreak']+$rowdata['manual-teammeeting']+$rowdata['manual-utilitybreak']+$rowdata['paused']+$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-incoming']+$rowdata['paused-lunchbreak']+$rowdata['paused-manual']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teabreak']+$rowdata['paused-teammeeting']+$rowdata['paused-utilitybreak']+$rowdata['paused-autowrapup']+$rowdata['paused-wrapup']+$rowdata['progressive']+$rowdata['progressive-agentbriefing']+$rowdata['progressive-agentbriefing']+$rowdata['progressive-downtime']+$rowdata['progressive-floorannouncements']+$rowdata['progressive-incoming']+$rowdata['progressive-lunchbreak']+$rowdata['progressive-manual']+$rowdata['progressive-notready']+$rowdata['progressive-qualityfeedback']+$rowdata['progressive-teabreak']+$rowdata['progressive-teammeeting']+$rowdata['progressive-utilitybreak']+$rowdata['ready-incoming']); | ||
| 128 | 138 | ||
| 129 | $key_value = ''; | 139 | $key_value = ''; |
| 130 | foreach($rowdata AS $key=>$value) { | 140 | /*foreach($rowdata AS $key=>$value) { |
| 131 | if($key != 1) | 141 | //if($key == 1){ $key } |
| 142 | if($key != 1 && $key != 'paused-wrapup'){ | ||
| 132 | $key_value .= "`$key` = '$value', "; | 143 | $key_value .= "`$key` = '$value', "; |
| 133 | } | 144 | } |
| 145 | }*/ | ||
| 134 | 146 | ||
| 135 | $startTime=$aline->startdate." ".$aline->starttime; | 147 | $startTime=$aline->startdate." ".$aline->starttime; |
| 136 | $endTime=$aline->enddate." ".$aline->endtime; | ||
| 137 | 148 | ||
| 138 | $crmCalls=DB::select(DB::raw("select user_id,type,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close from crmcalls WHERE updated_at>='".$startTime."' and updated_at<'".$endTime."' and user_id='".$aline->user_id."'")); | 149 | //$endTime=$aline->enddate." ".$aline->endtime; |
| 150 | if($aline->enddate=='0000-00-00'|| $aline->endtime=='00:00:00' || $aline->durationsec=='0') | ||
| 151 | { | ||
| 152 | $endTime=date("Y-m-d H:i:s",strtotime($aline->updated_at)); | ||
| 153 | }else{ | ||
| 154 | $endTime=$aline->enddate." ".$aline->endtime; | ||
| 155 | } | ||
| 156 | //$crmCalls=DB::select(DB::raw("select user_id,type,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close,waitSec,callSec,talkSec,recstartSec,recendSec,dispoSec from crmcalls WHERE created_at>='".$startTime."' and updated_at<'".$endTime."' and user_id='".$aline->user_id."'")); | ||
| 157 | $crmCalls=DB::select(DB::raw("select updated_at,user_id,type,userstatus,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close from crmcalls WHERE created_at>='".$startTime."' and created_at<'".$endTime."' and user_id='".$aline->user_id."'")); | ||
| 139 | 158 | ||
| 140 | $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0; | 159 | $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0; |
| 141 | $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0; | 160 | $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0; |
| 142 | $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0; | 161 | $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0; |
| 143 | $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0; | 162 | $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0; |
| 144 | $tt_prog=0;$tt_man=0;$tt_inb=0; | 163 | $tt_prog=0;$tt_man=0;$tt_inb=0; |
| 164 | $force_Close=0;$force_Wait=0;$force_Call=0;$force_Talk=0;$force_Dispo=0; | ||
| 145 | 165 | ||
| 146 | if($crmCalls!=null){ | 166 | if($crmCalls!=null){ |
| 147 | foreach($crmCalls as $crmCall){ | 167 | foreach($crmCalls as $crmCall){ |
| 168 | /*$ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 169 | $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 170 | $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 171 | $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);*/ | ||
| 172 | if($crmCall->userstatus =='FORCEDCLOSE' || $crmCall->updated_at > $endTime) | ||
| 173 | { | ||
| 174 | $force_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 175 | $force_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 176 | $force_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 177 | // $force_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 178 | }else{ | ||
| 148 | $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | 179 | $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); |
| 149 | $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | 180 | $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); |
| 150 | $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | 181 | $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); |
| 151 | $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | 182 | $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); |
| 152 | |||
| 153 | if($crmCall->type == 'Progressive') | 183 | if($crmCall->type == 'Progressive') |
| 154 | { | 184 | { |
| 155 | $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | 185 | $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); |
| ... | @@ -160,10 +190,15 @@ class Userlog_data extends Command { | ... | @@ -160,10 +190,15 @@ class Userlog_data extends Command { |
| 160 | 190 | ||
| 161 | if($crmCall->type == 'Manual') | 191 | if($crmCall->type == 'Manual') |
| 162 | { | 192 | { |
| 193 | /*$manTs_Wait += round($crmCall->waitSec/1000,2); | ||
| 194 | $manTs_Call += round($crmCall->callSec/1000,2); | ||
| 195 | $manTs_Talk += round(($crmCall->talkSec+$crmCall->recstartSec+$crmCall->recendSec)/1000,2); | ||
| 196 | $manTs_Dispo += round($crmCall->dispoSec/1000,2);*/ | ||
| 163 | $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | 197 | $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); |
| 164 | $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | 198 | $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); |
| 165 | $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | 199 | $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); |
| 166 | $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | 200 | $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); |
| 201 | //echo round($crmCall->dispoSec/1000,2).":"; | ||
| 167 | } | 202 | } |
| 168 | 203 | ||
| 169 | if($crmCall->type == 'Inbound') | 204 | if($crmCall->type == 'Inbound') |
| ... | @@ -175,17 +210,23 @@ class Userlog_data extends Command { | ... | @@ -175,17 +210,23 @@ class Userlog_data extends Command { |
| 175 | } | 210 | } |
| 176 | } | 211 | } |
| 177 | } | 212 | } |
| 178 | 213 | } | |
| 214 | $inbTs_Call =0; | ||
| 215 | //print_r($manTs_Dispo); | ||
| 179 | $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo; | 216 | $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo; |
| 180 | $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo; | 217 | $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo; |
| 181 | $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo; | 218 | $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo; |
| 182 | //$rowdata['not-ready']=$aline->durationsec-($rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak']+$tt_prog+$tt_man+$tt_inb); | 219 | $tt_act_inb=$tt_inb-$inbTs_Call; |
| 183 | $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo; | 220 | // $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo; |
| 184 | //$rowdata['not-ready']=$aline->durationsec-$prod_TOS; | 221 | |
| 222 | $force_Close = $force_Wait + $force_Call + $force_Talk + $force_Dispo; | ||
| 223 | $prod_TOS = $tt_prog+$tt_man+$tt_inb+$force_Close; | ||
| 224 | |||
| 185 | $key_value .= "`tt_prog` = '$tt_prog', "; | 225 | $key_value .= "`tt_prog` = '$tt_prog', "; |
| 186 | $key_value .= "`tt_man` = '$tt_man', "; | 226 | $key_value .= "`tt_man` = '$tt_man', "; |
| 187 | $key_value .= "`tt_inb` = '$tt_inb', "; | 227 | $key_value .= "`tt_inb` = '$tt_inb', "; |
| 188 | 228 | ||
| 229 | $key_value .= "`force_Close` = '$force_Close',"; | ||
| 189 | $key_value .= "`ts_Wait` = '$ts_Wait', "; | 230 | $key_value .= "`ts_Wait` = '$ts_Wait', "; |
| 190 | $key_value .= "`ts_Call` = '$ts_Call', "; | 231 | $key_value .= "`ts_Call` = '$ts_Call', "; |
| 191 | $key_value .= "`ts_Talk` = '$ts_Talk', "; | 232 | $key_value .= "`ts_Talk` = '$ts_Talk', "; |
| ... | @@ -204,12 +245,25 @@ class Userlog_data extends Command { | ... | @@ -204,12 +245,25 @@ class Userlog_data extends Command { |
| 204 | $key_value .= "`incts_Dispo` = '$inbTs_Dispo', "; | 245 | $key_value .= "`incts_Dispo` = '$inbTs_Dispo', "; |
| 205 | $key_value .= "`prod_tos` = '$prod_TOS', "; | 246 | $key_value .= "`prod_tos` = '$prod_TOS', "; |
| 206 | 247 | ||
| 248 | $key_value .= "`manual` = '$tt_man',"; | ||
| 249 | $key_value .= "`progressive` = '$tt_prog',"; | ||
| 250 | $key_value .= "`ready-incoming` = '$tt_act_inb',"; | ||
| 251 | $rowdata["not-ready"] = $durationsec-($rowdata['dialnext']+$rowdata['paused']+$rowdata['paused-agentbriefing']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-incoming']+$rowdata['paused-lunchbreak']+$rowdata['paused-manual']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teabreak']+$rowdata['paused-teammeeting']+$rowdata['paused-utilitybreak']+$rowdata['paused-autowrapup']+$tt_man+$tt_prog+$tt_act_inb+$force_Close); | ||
| 252 | //$key_value = ''; | ||
| 253 | foreach($rowdata AS $key=>$value) { | ||
| 254 | //if($key == 1){ $key } | ||
| 255 | if($key != 1 && $key != 'paused-wrapup' && $key != 'progressive' && $key != 'manual' && $key != 'ready-incoming'){ | ||
| 256 | //if($key != 1 && $key != 'paused-wrapup' && $key != 'progressive' && $key != 'manual'){ | ||
| 207 | 257 | ||
| 208 | 258 | $key_value .= "`$key` = '$value', "; | |
| 259 | } | ||
| 260 | } | ||
| 209 | $key_value = substr($key_value, 0, -2); | 261 | $key_value = substr($key_value, 0, -2); |
| 210 | 262 | //print_r($key_value); | |
| 211 | $userlogsTable = "userlogs_".date("d_m_Y",$logdate); | 263 | $userlogsTable = "userlogs_".date("d_m_Y",$logdate);; |
| 264 | //echo $userlogsTable; | ||
| 212 | DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value")); | 265 | DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value")); |
| 266 | //DB::connection("conn")->insert(DB::raw("INSERT INTO userlogs_13_11_2018_bk SET $key_value")); | ||
| 213 | 267 | ||
| 214 | } | 268 | } |
| 215 | 269 | ... | ... |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | use DB; | ||
| 5 | use Config; | ||
| 6 | |||
| 7 | use App\Models\User; | ||
| 8 | use App\Models\Accesslog; | ||
| 9 | |||
| 10 | use App\Models\CRMCall; | ||
| 11 | use Schema; | ||
| 12 | use PDO; | ||
| 13 | |||
| 14 | use Illuminate\Database\Schema\Blueprint; | ||
| 15 | |||
| 16 | class Userlog_datavalidation extends Command { | ||
| 17 | |||
| 18 | /** | ||
| 19 | * The console command name. | ||
| 20 | * | ||
| 21 | * @var string | ||
| 22 | */ | ||
| 23 | protected $signature = 'Userlog_datavalidation'; | ||
| 24 | |||
| 25 | /** | ||
| 26 | * The console command description. | ||
| 27 | * | ||
| 28 | * @var string | ||
| 29 | */ | ||
| 30 | protected $description = 'Userlog_datavalidation'; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Execute the console command. | ||
| 34 | * | ||
| 35 | * @return mixed | ||
| 36 | */ | ||
| 37 | public function handle() | ||
| 38 | { | ||
| 39 | $nowts=time(); | ||
| 40 | echo "\n".date('Y-m-d')."\n"; | ||
| 41 | |||
| 42 | $logdate=strtotime('-1 day'); | ||
| 43 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 44 | $server_ip=env('app_ip'); | ||
| 45 | $central_ip=env('central_ip'); | ||
| 46 | |||
| 47 | $conn = array( | ||
| 48 | 'driver' => 'mysql', | ||
| 49 | 'host' => $central_ip, | ||
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 51 | 'username' => env('DB_USERNAME', 'root'), | ||
| 52 | 'password' => env('DB_PASSWORD', ''), | ||
| 53 | 'charset' => 'utf8', | ||
| 54 | 'collation' => 'utf8_unicode_ci', | ||
| 55 | 'prefix' => '', | ||
| 56 | 'options' => array( | ||
| 57 | PDO::ATTR_TIMEOUT => 5, | ||
| 58 | ), | ||
| 59 | ); | ||
| 60 | Config::set("database.connections.conn", $conn); | ||
| 61 | if(DB::connection("conn")->getDatabaseName()) | ||
| 62 | { | ||
| 63 | $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'")); | ||
| 64 | $server_id=$serverclist[0]->id; | ||
| 65 | if($server_id<10){ | ||
| 66 | $server_id="0".$server_id; | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | $i=0; | ||
| 71 | |||
| 72 | |||
| 73 | $ulist=DB::select(DB::raw("select * from users WHERE 1")); | ||
| 74 | foreach($ulist as $uline) { | ||
| 75 | $users[$uline->id] = $uline->username; | ||
| 76 | } | ||
| 77 | if($alist=DB::select(DB::raw("select * from userlogs WHERE created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"))){ | ||
| 78 | |||
| 79 | |||
| 80 | foreach($alist as $aline) { | ||
| 81 | $i++; | ||
| 82 | $global_id = $server_id . $i; | ||
| 83 | if($aline->enddate=='0000-00-00'|| $aline->endtime=='00:00:00' || $aline->durationsec=='0') | ||
| 84 | { | ||
| 85 | $enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at)); | ||
| 86 | $enddate=explode(" ",$enddatetime)[0]; | ||
| 87 | $endtime=explode(" ",$enddatetime)[1]; | ||
| 88 | $durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime)); | ||
| 89 | } | ||
| 90 | else | ||
| 91 | { | ||
| 92 | $enddate=$aline->enddate; | ||
| 93 | $endtime=$aline->endtime; | ||
| 94 | $durationsec=$aline->durationsec; | ||
| 95 | } | ||
| 96 | |||
| 97 | $rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id, | ||
| 98 | 'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id], | ||
| 99 | 'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime, | ||
| 100 | 'durationsec'=>$durationsec,'data'=>$aline->data,'group'=>$aline->group,'login'=>'','dialnext'=>'','dialnext-agentbriefing'=>'','dialnext-downtime'=>'','dialnext-floorannouncements'=>'','dialnext-incoming'=>'','dialnext-lunchbreak'=>'','dialnext-manual'=>'','dialnext-notready'=>'','dialnext-qualityfeedback'=>'','dialnext-teabreak'=>'','dialnext-teammeeting'=>'','dialnext-utilitybreak'=>'','manual'=>'','manual-agentbriefing'=>'','manual-agentbriefing'=>'','manual-downtime'=>'','manual-floorannouncements'=>'','manual-incoming'=>'','manual-lunchbreak'=>'','manual-manual'=>'','manual-notready'=>'','manual-qualityfeedback'=>'','manual-teabreak'=>'','manual-teammeeting'=>'','manual-utilitybreak'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','paused-wrapup'=>'','progressive'=>'','progressive-agentbriefing'=>'','progressive-agentbriefing'=>'','progressive-downtime'=>'','progressive-floorannouncements'=>'','progressive-incoming'=>'','progressive-lunchbreak'=>'','progressive-manual'=>'','progressive-notready'=>'','progressive-qualityfeedback'=>'','progressive-teabreak'=>'','progressive-teammeeting'=>'','progressive-utilitybreak'=>'','ready-incoming'=>'' | ||
| 101 | ); | ||
| 102 | |||
| 103 | $data=json_decode($aline->data,true); | ||
| 104 | foreach($data as $sipid=>$sdata) | ||
| 105 | { | ||
| 106 | $prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000; | ||
| 107 | if(isset($sdata['states'])) | ||
| 108 | { | ||
| 109 | $previous="login"; | ||
| 110 | foreach($sdata['states'] as $fts=>$states) | ||
| 111 | { | ||
| 112 | if($states[0] != 1) | ||
| 113 | { | ||
| 114 | $rowdata[$previous] +=round(($fts-$prets)/1000,2); | ||
| 115 | |||
| 116 | $previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]); | ||
| 117 | $prets=$fts; | ||
| 118 | } | ||
| 119 | |||
| 120 | } | ||
| 121 | $rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2); | ||
| 122 | } | ||
| 123 | } | ||
| 124 | $rowdata["login"] = $aline->durationsec; | ||
| 125 | |||
| 126 | $rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak']; | ||
| 127 | |||
| 128 | |||
| 129 | $key_value = ''; | ||
| 130 | |||
| 131 | |||
| 132 | $startTime=$aline->startdate." ".$aline->starttime; | ||
| 133 | $endTime=$aline->enddate." ".$aline->endtime; | ||
| 134 | |||
| 135 | $crmCalls=DB::select(DB::raw("select user_id,type,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close from crmcalls WHERE updated_at>='".$startTime."' and updated_at<'".$endTime."' and user_id='".$aline->user_id."'")); | ||
| 136 | |||
| 137 | $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0; | ||
| 138 | $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0; | ||
| 139 | $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0; | ||
| 140 | $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0; | ||
| 141 | $tt_prog=0;$tt_man=0;$tt_inb=0; | ||
| 142 | |||
| 143 | if($crmCalls!=null){ | ||
| 144 | foreach($crmCalls as $crmCall){ | ||
| 145 | $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 146 | $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 147 | $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 148 | $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 149 | |||
| 150 | if($crmCall->type == 'Progressive') | ||
| 151 | { | ||
| 152 | $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 153 | $progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 154 | $progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 155 | $progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 156 | } | ||
| 157 | |||
| 158 | if($crmCall->type == 'Manual') | ||
| 159 | { | ||
| 160 | $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 161 | $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 162 | $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 163 | $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 164 | } | ||
| 165 | |||
| 166 | if($crmCall->type == 'Inbound') | ||
| 167 | { | ||
| 168 | $inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 169 | $inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 170 | $inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 171 | $inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 172 | } | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo; | ||
| 177 | $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo; | ||
| 178 | $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo; | ||
| 179 | |||
| 180 | $total_idealtime=$rowdata["login"]-($rowdata['not-ready']+$tt_prog+$tt_man+$tt_inb); | ||
| 181 | |||
| 182 | echo "notready time-----idle----".$total_idealtime; | ||
| 183 | |||
| 184 | foreach($rowdata AS $key=>$value) { | ||
| 185 | if($key != 1) | ||
| 186 | $key_value .= "`$key` = '$value', "; | ||
| 187 | } | ||
| 188 | $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo; | ||
| 189 | |||
| 190 | $key_value .= "`tt_prog` = '$tt_prog', "; | ||
| 191 | $key_value .= "`tt_man` = '$tt_man', "; | ||
| 192 | $key_value .= "`tt_inb` = '$tt_inb', "; | ||
| 193 | |||
| 194 | $key_value .= "`ts_Wait` = '$ts_Wait', "; | ||
| 195 | $key_value .= "`ts_Call` = '$ts_Call', "; | ||
| 196 | $key_value .= "`ts_Talk` = '$ts_Talk', "; | ||
| 197 | $key_value .= "`ts_Dispo` = '$ts_Dispo', "; | ||
| 198 | $key_value .= "`progts_Wait` = '$progTs_Wait', "; | ||
| 199 | $key_value .= "`progts_Call` = '$progTs_Call', "; | ||
| 200 | $key_value .= "`progts_Talk` = '$progTs_Talk', "; | ||
| 201 | $key_value .= "`progts_Dispo` = '$progTs_Dispo', "; | ||
| 202 | $key_value .= "`mants_Wait` = '$manTs_Wait', "; | ||
| 203 | $key_value .= "`mants_Call` = '$manTs_Call', "; | ||
| 204 | $key_value .= "`mants_Talk` = '$manTs_Talk', "; | ||
| 205 | $key_value .= "`mants_Dispo` = '$manTs_Dispo', "; | ||
| 206 | $key_value .= "`incts_Wait` = '$inbTs_Wait', "; | ||
| 207 | $key_value .= "`incts_Call` = '$inbTs_Call', "; | ||
| 208 | $key_value .= "`incts_Talk` = '$inbTs_Talk', "; | ||
| 209 | $key_value .= "`incts_Dispo` = '$inbTs_Dispo', "; | ||
| 210 | $key_value .= "`prod_tos` = '$prod_TOS', "; | ||
| 211 | $key_value .= "`totalidealtime` = '$total_idealtime', "; | ||
| 212 | |||
| 213 | |||
| 214 | |||
| 215 | $key_value = substr($key_value, 0, -2); | ||
| 216 | |||
| 217 | //$userlogsTable = "userlogs_".date("d_m_Y",$logdate); | ||
| 218 | $userlogsTable = "userlogs_datavalid"; | ||
| 219 | DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value")); | ||
| 220 | |||
| 221 | } | ||
| 222 | |||
| 223 | } | ||
| 224 | } | ||
| 225 | } | ||
| 226 | } |
| 1 | <?php namespace App\Console\Commands; | ||
| 2 | |||
| 3 | use Illuminate\Console\Command; | ||
| 4 | use DB; | ||
| 5 | use Config; | ||
| 6 | |||
| 7 | use App\Models\User; | ||
| 8 | use App\Models\Accesslog; | ||
| 9 | |||
| 10 | use App\Models\CRMCall; | ||
| 11 | use Schema; | ||
| 12 | use PDO; | ||
| 13 | |||
| 14 | use Illuminate\Database\Schema\Blueprint; | ||
| 15 | |||
| 16 | class dailyupload_calllog extends Command { | ||
| 17 | |||
| 18 | /** | ||
| 19 | * The console command name. | ||
| 20 | * | ||
| 21 | * @var string | ||
| 22 | */ | ||
| 23 | protected $signature = 'dailyupload_calllog'; | ||
| 24 | |||
| 25 | /** | ||
| 26 | * The console command description. | ||
| 27 | * | ||
| 28 | * @var string | ||
| 29 | */ | ||
| 30 | protected $description = 'dailyupload_calllog'; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Execute the console command. | ||
| 34 | * | ||
| 35 | * @return mixed | ||
| 36 | */ | ||
| 37 | public function handle() | ||
| 38 | { | ||
| 39 | $nowts=time(); | ||
| 40 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 41 | $logdate=strtotime('0 day'); | ||
| 42 | |||
| 43 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 44 | $server_ip=env('app_ip'); | ||
| 45 | $central_ip=env('central_ip'); | ||
| 46 | $calllog_report = "calllog_report_".date("d_m_Y",$logdate); | ||
| 47 | $created_at=date("Y-m-d H:i:s"); | ||
| 48 | |||
| 49 | $conn = array( | ||
| 50 | 'driver' => 'mysql', | ||
| 51 | 'host' => $central_ip, | ||
| 52 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 53 | 'username' => env('DB_USERNAME', 'root'), | ||
| 54 | 'password' => env('DB_PASSWORD', ''), | ||
| 55 | 'charset' => 'utf8', | ||
| 56 | 'collation' => 'utf8_unicode_ci', | ||
| 57 | 'prefix' => '', | ||
| 58 | 'options' => array( | ||
| 59 | PDO::ATTR_TIMEOUT => 5, | ||
| 60 | ), | ||
| 61 | ); | ||
| 62 | Config::set("database.connections.conn", $conn); | ||
| 63 | if(DB::connection("conn")->getDatabaseName()) | ||
| 64 | { | ||
| 65 | |||
| 66 | $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'")); | ||
| 67 | $server_id=$serverclist[0]->id; | ||
| 68 | if($server_id<10){ | ||
| 69 | $server_id="0".$server_id; | ||
| 70 | } | ||
| 71 | |||
| 72 | $clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server")); | ||
| 73 | $caar=[]; | ||
| 74 | foreach($clist as $cline) | ||
| 75 | { | ||
| 76 | $caar[$cline->server]= $cline->cnt; | ||
| 77 | |||
| 78 | |||
| 79 | } | ||
| 80 | $mlist=DB::select(DB::raw("select count(*) as countrecord from crmcalls where created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'")); | ||
| 81 | |||
| 82 | $location_cont='0'; | ||
| 83 | $central_cont='0'; | ||
| 84 | |||
| 85 | $location_cont=$mlist[0]->countrecord; | ||
| 86 | if(array_key_exists($server_id,$caar)){ | ||
| 87 | $central_cont=$caar[$server_id]; | ||
| 88 | }else{ | ||
| 89 | $central_cont=0; | ||
| 90 | |||
| 91 | } | ||
| 92 | $dif=($central_cont)-($mlist[0]->countrecord); | ||
| 93 | |||
| 94 | if($dif==0){ | ||
| 95 | |||
| 96 | $result="Y"; | ||
| 97 | |||
| 98 | DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'")); | ||
| 99 | |||
| 100 | }else{ | ||
| 101 | |||
| 102 | $result="N"; | ||
| 103 | DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'")); | ||
| 104 | |||
| 105 | } | ||
| 106 | |||
| 107 | DB::connection("conn")->disconnect(); | ||
| 108 | |||
| 109 | } | ||
| 110 | |||
| 111 | } | ||
| 112 | |||
| 113 | |||
| 114 | } |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', |
| ... | @@ -88,8 +88,7 @@ class bulkServerUpload extends Command { | ... | @@ -88,8 +88,7 @@ class bulkServerUpload extends Command { |
| 88 | $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'")); | 88 | $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'")); |
| 89 | $location=$serverclist[0]->location; | 89 | $location=$serverclist[0]->location; |
| 90 | 90 | ||
| 91 | 91 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 0,50000")); | |
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 0,20000")); | ||
| 93 | 92 | ||
| 94 | $conn=''; | 93 | $conn=''; |
| 95 | 94 | ||
| ... | @@ -211,7 +210,7 @@ class bulkServerUpload extends Command { | ... | @@ -211,7 +210,7 @@ class bulkServerUpload extends Command { |
| 211 | } | 210 | } |
| 212 | 211 | ||
| 213 | } | 212 | } |
| 214 | if(!empty($successArr)){ | 213 | /*if(!empty($successArr)){ |
| 215 | foreach($successArr as $succes) | 214 | foreach($successArr as $succes) |
| 216 | { | 215 | { |
| 217 | $setSuccess=array(); | 216 | $setSuccess=array(); |
| ... | @@ -242,7 +241,7 @@ class bulkServerUpload extends Command { | ... | @@ -242,7 +241,7 @@ class bulkServerUpload extends Command { |
| 242 | 241 | ||
| 243 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | 242 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); |
| 244 | } | 243 | } |
| 245 | } | 244 | }*/ |
| 246 | 245 | ||
| 247 | DB::connection("conn")->disconnect(); | 246 | DB::connection("conn")->disconnect(); |
| 248 | } | 247 | } | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_1 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_1 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', |
| ... | @@ -89,7 +89,7 @@ class bulkServerUpload_1 extends Command { | ... | @@ -89,7 +89,7 @@ class bulkServerUpload_1 extends Command { |
| 89 | $location=$serverclist[0]->location; | 89 | $location=$serverclist[0]->location; |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 20001,40000")); | 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 50000,50000")); |
| 93 | 93 | ||
| 94 | $conn=''; | 94 | $conn=''; |
| 95 | 95 | ||
| ... | @@ -211,6 +211,7 @@ class bulkServerUpload_1 extends Command { | ... | @@ -211,6 +211,7 @@ class bulkServerUpload_1 extends Command { |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | } | 213 | } |
| 214 | /* | ||
| 214 | if(!empty($successArr)){ | 215 | if(!empty($successArr)){ |
| 215 | foreach($successArr as $succes) | 216 | foreach($successArr as $succes) |
| 216 | { | 217 | { |
| ... | @@ -243,6 +244,7 @@ class bulkServerUpload_1 extends Command { | ... | @@ -243,6 +244,7 @@ class bulkServerUpload_1 extends Command { |
| 243 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | 244 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); |
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 247 | */ | ||
| 246 | 248 | ||
| 247 | DB::connection("conn")->disconnect(); | 249 | DB::connection("conn")->disconnect(); |
| 248 | } | 250 | } | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_2 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_2 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', |
| ... | @@ -89,7 +89,7 @@ class bulkServerUpload_2 extends Command { | ... | @@ -89,7 +89,7 @@ class bulkServerUpload_2 extends Command { |
| 89 | $location=$serverclist[0]->location; | 89 | $location=$serverclist[0]->location; |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 40001,60000")); | 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 100000,50000")); |
| 93 | 93 | ||
| 94 | $conn=''; | 94 | $conn=''; |
| 95 | 95 | ||
| ... | @@ -211,6 +211,7 @@ class bulkServerUpload_2 extends Command { | ... | @@ -211,6 +211,7 @@ class bulkServerUpload_2 extends Command { |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | } | 213 | } |
| 214 | /* | ||
| 214 | if(!empty($successArr)){ | 215 | if(!empty($successArr)){ |
| 215 | foreach($successArr as $succes) | 216 | foreach($successArr as $succes) |
| 216 | { | 217 | { |
| ... | @@ -243,7 +244,7 @@ class bulkServerUpload_2 extends Command { | ... | @@ -243,7 +244,7 @@ class bulkServerUpload_2 extends Command { |
| 243 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | 244 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); |
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 246 | 247 | */ | |
| 247 | DB::connection("conn")->disconnect(); | 248 | DB::connection("conn")->disconnect(); |
| 248 | } | 249 | } |
| 249 | } | 250 | } | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_3 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_3 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', |
| ... | @@ -89,7 +89,7 @@ class bulkServerUpload_3 extends Command { | ... | @@ -89,7 +89,7 @@ class bulkServerUpload_3 extends Command { |
| 89 | $location=$serverclist[0]->location; | 89 | $location=$serverclist[0]->location; |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 60001,80000")); | 92 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 150000,50000")); |
| 93 | 93 | ||
| 94 | $conn=''; | 94 | $conn=''; |
| 95 | 95 | ||
| ... | @@ -211,6 +211,7 @@ class bulkServerUpload_3 extends Command { | ... | @@ -211,6 +211,7 @@ class bulkServerUpload_3 extends Command { |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | } | 213 | } |
| 214 | /* | ||
| 214 | if(!empty($successArr)){ | 215 | if(!empty($successArr)){ |
| 215 | foreach($successArr as $succes) | 216 | foreach($successArr as $succes) |
| 216 | { | 217 | { |
| ... | @@ -243,7 +244,7 @@ class bulkServerUpload_3 extends Command { | ... | @@ -243,7 +244,7 @@ class bulkServerUpload_3 extends Command { |
| 243 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); | 244 | DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure")); |
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 246 | 247 | */ | |
| 247 | DB::connection("conn")->disconnect(); | 248 | DB::connection("conn")->disconnect(); |
| 248 | } | 249 | } |
| 249 | } | 250 | } | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_4 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_4 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_5 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_5 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_6 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_6 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_daily extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_daily extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', |
| ... | @@ -91,7 +91,7 @@ echo $central_ip; | ... | @@ -91,7 +91,7 @@ echo $central_ip; |
| 91 | echo $location; | 91 | echo $location; |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='$server_ip'")); | 94 | $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='$server_ip' order by auto_id asc limit 0,200")); |
| 95 | 95 | ||
| 96 | $conn=''; | 96 | $conn=''; |
| 97 | 97 | ... | ... |
application/app/Console/Commands/bulkServerUpload_data3.php
100644 → 100755
| ... | @@ -71,9 +71,9 @@ class bulkServerUpload_data3 extends Command { | ... | @@ -71,9 +71,9 @@ class bulkServerUpload_data3 extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', | ... | ... |
| ... | @@ -71,9 +71,9 @@ class bulkserverupload_data extends Command { | ... | @@ -71,9 +71,9 @@ class bulkserverupload_data extends Command { |
| 71 | $conn = array( | 71 | $conn = array( |
| 72 | 'driver' => 'mysql', | 72 | 'driver' => 'mysql', |
| 73 | 'host' => $central_ip, | 73 | 'host' => $central_ip, |
| 74 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 74 | 'database' => env('CENTRAL_DB'), |
| 75 | 'username' => env('DB_USERNAME', 'root'), | 75 | 'username' => env('CENTRAL_USERNAME'), |
| 76 | 'password' => env('DB_PASSWORD', 'yb9738z'), | 76 | 'password' => env('CENTRAL_PASSWORD'), |
| 77 | 'charset' => 'utf8', | 77 | 'charset' => 'utf8', |
| 78 | 'collation' => 'utf8_unicode_ci', | 78 | 'collation' => 'utf8_unicode_ci', |
| 79 | 'prefix' => '', | 79 | 'prefix' => '', | ... | ... |
| ... | @@ -51,9 +51,9 @@ class calllog extends Command { | ... | @@ -51,9 +51,9 @@ class calllog extends Command { |
| 51 | $conn = array( | 51 | $conn = array( |
| 52 | 'driver' => 'mysql', | 52 | 'driver' => 'mysql', |
| 53 | 'host' => $central_ip, | 53 | 'host' => $central_ip, |
| 54 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 54 | 'database' => env('CENTRAL_DB'), |
| 55 | 'username' => env('DB_USERNAME', 'root'), | 55 | 'username' => env('CENTRAL_USERNAME'), |
| 56 | 'password' => env('DB_PASSWORD', ''), | 56 | 'password' => env('CENTRAL_PASSWORD'), |
| 57 | 'charset' => 'utf8', | 57 | 'charset' => 'utf8', |
| 58 | 'collation' => 'utf8_unicode_ci', | 58 | 'collation' => 'utf8_unicode_ci', |
| 59 | 'prefix' => '', | 59 | 'prefix' => '', | ... | ... |
| ... | @@ -47,9 +47,9 @@ class complaint_data extends Command { | ... | @@ -47,9 +47,9 @@ class complaint_data extends Command { |
| 47 | $conn = array( | 47 | $conn = array( |
| 48 | 'driver' => 'mysql', | 48 | 'driver' => 'mysql', |
| 49 | 'host' => $central_ip, | 49 | 'host' => $central_ip, |
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 50 | 'database' => env('CENTRAL_DB'), |
| 51 | 'username' => env('DB_USERNAME', 'root'), | 51 | 'username' => env('CENTRAL_USERNAME'), |
| 52 | 'password' => env('DB_PASSWORD', ''), | 52 | 'password' => env('CENTRAL_PASSWORD'), |
| 53 | 'charset' => 'utf8', | 53 | 'charset' => 'utf8', |
| 54 | 'collation' => 'utf8_unicode_ci', | 54 | 'collation' => 'utf8_unicode_ci', |
| 55 | 'prefix' => '', | 55 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ class dailyupload_calllog extends Command { | ... | @@ -50,9 +50,9 @@ class dailyupload_calllog extends Command { |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -51,9 +51,9 @@ class dailyupload_questionaire extends Command { | ... | @@ -51,9 +51,9 @@ class dailyupload_questionaire extends Command { |
| 51 | $conn = array( | 51 | $conn = array( |
| 52 | 'driver' => 'mysql', | 52 | 'driver' => 'mysql', |
| 53 | 'host' => $central_ip, | 53 | 'host' => $central_ip, |
| 54 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 54 | 'database' => env('CENTRAL_DB'), |
| 55 | 'username' => env('DB_USERNAME', 'root'), | 55 | 'username' => env('CENTRAL_USERNAME'), |
| 56 | 'password' => env('DB_PASSWORD', ''), | 56 | 'password' => env('CENTRAL_PASSWORD'), |
| 57 | 'charset' => 'utf8', | 57 | 'charset' => 'utf8', |
| 58 | 'collation' => 'utf8_unicode_ci', | 58 | 'collation' => 'utf8_unicode_ci', |
| 59 | 'prefix' => '', | 59 | 'prefix' => '', | ... | ... |
| ... | @@ -44,15 +44,15 @@ class full_remark_details extends Command { | ... | @@ -44,15 +44,15 @@ class full_remark_details extends Command { |
| 44 | 44 | ||
| 45 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | 45 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); |
| 46 | $server_ip=env('app_ip'); | 46 | $server_ip=env('app_ip'); |
| 47 | $full_remark = "full_remark_details"; | ||
| 48 | $central_ip=env('central_ip'); | 47 | $central_ip=env('central_ip'); |
| 48 | $full_remark = "full_remark_details"; | ||
| 49 | 49 | ||
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', |
| ... | @@ -76,8 +76,8 @@ class full_remark_details extends Command { | ... | @@ -76,8 +76,8 @@ class full_remark_details extends Command { |
| 76 | $maxids=$maxid[0]->maxid; | 76 | $maxids=$maxid[0]->maxid; |
| 77 | 77 | ||
| 78 | //$qlist=DB::select(DB::raw("SELECT * from full_remark")); | 78 | //$qlist=DB::select(DB::raw("SELECT * from full_remark")); |
| 79 | $qlist=DB::select(DB::raw("SELECT * from full_remark where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'")); | 79 | $qlist=DB::select(DB::raw("SELECT * from full_remark where id>'$maxids' and fullremark!=''")); |
| 80 | 80 | echo count($qlist); | |
| 81 | $userarr=array(); | 81 | $userarr=array(); |
| 82 | foreach($qlist as $qline) | 82 | foreach($qlist as $qline) |
| 83 | { | 83 | { |
| ... | @@ -94,6 +94,7 @@ class full_remark_details extends Command { | ... | @@ -94,6 +94,7 @@ class full_remark_details extends Command { |
| 94 | DB::connection("conn")->insert(DB::raw("insert into ".$full_remark." set $setstr")); | 94 | DB::connection("conn")->insert(DB::raw("insert into ".$full_remark." set $setstr")); |
| 95 | 95 | ||
| 96 | } | 96 | } |
| 97 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 97 | DB::connection("conn")->disconnect(); | 98 | DB::connection("conn")->disconnect(); |
| 98 | 99 | ||
| 99 | } | 100 | } | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -47,9 +47,9 @@ class relationship_tag extends Command { | ... | @@ -47,9 +47,9 @@ class relationship_tag extends Command { |
| 47 | $conn = array( | 47 | $conn = array( |
| 48 | 'driver' => 'mysql', | 48 | 'driver' => 'mysql', |
| 49 | 'host' => $central_ip, | 49 | 'host' => $central_ip, |
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 50 | 'database' => env('CENTRAL_DB'), |
| 51 | 'username' => env('DB_USERNAME', 'root'), | 51 | 'username' => env('CENTRAL_USERNAME'), |
| 52 | 'password' => env('DB_PASSWORD', ''), | 52 | 'password' => env('CENTRAL_PASSWORD'), |
| 53 | 'charset' => 'utf8', | 53 | 'charset' => 'utf8', |
| 54 | 'collation' => 'utf8_unicode_ci', | 54 | 'collation' => 'utf8_unicode_ci', |
| 55 | 'prefix' => '', | 55 | 'prefix' => '', | ... | ... |
| ... | @@ -47,9 +47,9 @@ public function handle() | ... | @@ -47,9 +47,9 @@ public function handle() |
| 47 | $conn = array( | 47 | $conn = array( |
| 48 | 'driver' => 'mysql', | 48 | 'driver' => 'mysql', |
| 49 | 'host' => $central_ip, | 49 | 'host' => $central_ip, |
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 50 | 'database' => env('CENTRAL_DB'), |
| 51 | 'username' => env('DB_USERNAME', 'root'), | 51 | 'username' => env('CENTRAL_USERNAME'), |
| 52 | 'password' => env('DB_PASSWORD', ''), | 52 | 'password' => env('CENTRAL_PASSWORD'), |
| 53 | 'charset' => 'utf8', | 53 | 'charset' => 'utf8', |
| 54 | 'collation' => 'utf8_unicode_ci', | 54 | 'collation' => 'utf8_unicode_ci', |
| 55 | 'prefix' => '', | 55 | 'prefix' => '', | ... | ... |
| ... | @@ -54,9 +54,9 @@ public function handle() | ... | @@ -54,9 +54,9 @@ public function handle() |
| 54 | $conn = array( | 54 | $conn = array( |
| 55 | 'driver' => 'mysql', | 55 | 'driver' => 'mysql', |
| 56 | 'host' => $central_ip, | 56 | 'host' => $central_ip, |
| 57 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 57 | 'database' => env('CENTRAL_DB'), |
| 58 | 'username' => env('DB_USERNAME', 'root'), | 58 | 'username' => env('CENTRAL_USERNAME'), |
| 59 | 'password' => env('DB_PASSWORD', ''), | 59 | 'password' => env('CENTRAL_PASSWORD'), |
| 60 | 'charset' => 'utf8', | 60 | 'charset' => 'utf8', |
| 61 | 'collation' => 'utf8_unicode_ci', | 61 | 'collation' => 'utf8_unicode_ci', |
| 62 | 'prefix' => '', | 62 | 'prefix' => '', | ... | ... |
| ... | @@ -60,9 +60,9 @@ use Illuminate\Database\Schema\Blueprint; | ... | @@ -60,9 +60,9 @@ use Illuminate\Database\Schema\Blueprint; |
| 60 | $conn = array( | 60 | $conn = array( |
| 61 | 'driver' => 'mysql', | 61 | 'driver' => 'mysql', |
| 62 | 'host' => $central_ip, | 62 | 'host' => $central_ip, |
| 63 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 63 | 'database' => env('CENTRAL_DB'), |
| 64 | 'username' => env('DB_USERNAME', 'root'), | 64 | 'username' => env('CENTRAL_USERNAME'), |
| 65 | 'password' => env('DB_PASSWORD', ''), | 65 | 'password' => env('CENTRAL_PASSWORD'), |
| 66 | 'charset' => 'utf8', | 66 | 'charset' => 'utf8', |
| 67 | 'collation' => 'utf8_unicode_ci', | 67 | 'collation' => 'utf8_unicode_ci', |
| 68 | 'prefix' => '', | 68 | 'prefix' => '', | ... | ... |
| ... | @@ -51,9 +51,9 @@ class recording_reconcilation_metadata extends Command | ... | @@ -51,9 +51,9 @@ class recording_reconcilation_metadata extends Command |
| 51 | $conn = array( | 51 | $conn = array( |
| 52 | 'driver' => 'mysql', | 52 | 'driver' => 'mysql', |
| 53 | 'host' => $central_ip, | 53 | 'host' => $central_ip, |
| 54 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 54 | 'database' => env('CENTRAL_DB'), |
| 55 | 'username' => env('DB_USERNAME', 'root'), | 55 | 'username' => env('CENTRAL_USERNAME'), |
| 56 | 'password' => env('DB_PASSWORD', ''), | 56 | 'password' => env('CENTRAL_PASSWORD'), |
| 57 | 'charset' => 'utf8', | 57 | 'charset' => 'utf8', |
| 58 | 'collation' => 'utf8_unicode_ci', | 58 | 'collation' => 'utf8_unicode_ci', |
| 59 | 'prefix' => '', | 59 | 'prefix' => '', | ... | ... |
| ... | @@ -46,9 +46,9 @@ class records_details extends Command { | ... | @@ -46,9 +46,9 @@ class records_details extends Command { |
| 46 | $conn = array( | 46 | $conn = array( |
| 47 | 'driver' => 'mysql', | 47 | 'driver' => 'mysql', |
| 48 | 'host' => $central_ip, | 48 | 'host' => $central_ip, |
| 49 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 49 | 'database' => env('CENTRAL_DB'), |
| 50 | 'username' => env('DB_USERNAME', 'root'), | 50 | 'username' => env('CENTRAL_USERNAME'), |
| 51 | 'password' => env('DB_PASSWORD', ''), | 51 | 'password' => env('CENTRAL_PASSWORD'), |
| 52 | 'charset' => 'utf8', | 52 | 'charset' => 'utf8', |
| 53 | 'collation' => 'utf8_unicode_ci', | 53 | 'collation' => 'utf8_unicode_ci', |
| 54 | 'prefix' => '', | 54 | 'prefix' => '', |
| ... | @@ -73,7 +73,7 @@ echo ",".$server_ip; | ... | @@ -73,7 +73,7 @@ echo ",".$server_ip; |
| 73 | 73 | ||
| 74 | $maxids=$maxid[0]->maxid; | 74 | $maxids=$maxid[0]->maxid; |
| 75 | 75 | ||
| 76 | $qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records` where id>'$maxids'")); | 76 | $qlist=DB::select(DB::raw("SELECT id,created,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records` where id>'$maxids' and client != 'Inactive'")); |
| 77 | 77 | ||
| 78 | $countnumber=count($qlist); | 78 | $countnumber=count($qlist); |
| 79 | $finalnumber=$countnumber/50; | 79 | $finalnumber=$countnumber/50; |
| ... | @@ -86,6 +86,7 @@ echo ",".$server_ip; | ... | @@ -86,6 +86,7 @@ echo ",".$server_ip; |
| 86 | foreach($qlist as $qline) | 86 | foreach($qlist as $qline) |
| 87 | { | 87 | { |
| 88 | $record_id=$qline->id; | 88 | $record_id=$qline->id; |
| 89 | $created=$qline->created; | ||
| 89 | $clientcode=$qline->clientcode; | 90 | $clientcode=$qline->clientcode; |
| 90 | $client=$qline->client; | 91 | $client=$qline->client; |
| 91 | $status=$qline->status; | 92 | $status=$qline->status; |
| ... | @@ -96,19 +97,19 @@ echo ",".$server_ip; | ... | @@ -96,19 +97,19 @@ echo ",".$server_ip; |
| 96 | $question=$qline->question; | 97 | $question=$qline->question; |
| 97 | $firstname=$qline->firstname; | 98 | $firstname=$qline->firstname; |
| 98 | 99 | ||
| 99 | $shortinsert.="('$client', '$server_ip', '$record_id', '$clientcode', '$status', '$clientinternalid', '$location', '$mobile', '$question', '$firstname', '$priority', '$modified'),"; | 100 | $shortinsert.="('$client', '$server_ip', '$record_id', '$clientcode', '$status', '$clientinternalid', '$location', '$mobile', '$question', '$firstname', '$priority', '$modified', '$created'),"; |
| 100 | 101 | ||
| 101 | 102 | ||
| 102 | if($kkk<=$finalnumber){ | 103 | if($kkk<=$finalnumber){ |
| 103 | if($iii%50==0){ | 104 | if($iii%50==0){ |
| 104 | 105 | ||
| 105 | $shortinsert=substr($shortinsert,0,-1); | 106 | $shortinsert=substr($shortinsert,0,-1); |
| 106 | DB::connection("conn")->insert(DB::raw("INSERT INTO `records_details` (`client`, `server_ip`, `record_id`, `cust_id`, `records_status`, `group_id`, `location`, `mobile`, `question`,`firstname`, `priority`, `modified`) VALUES $shortinsert")); | 107 | DB::connection("conn")->insert(DB::raw("INSERT INTO `records_details` (`client`, `server_ip`, `record_id`, `cust_id`, `records_status`, `group_id`, `location`, `mobile`, `question`,`firstname`, `priority`, `modified`, `created`) VALUES $shortinsert")); |
| 107 | 108 | ||
| 108 | $kkk++; | 109 | $kkk++; |
| 109 | } | 110 | } |
| 110 | }else{ | 111 | }else{ |
| 111 | DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'")); | 112 | DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified',created='$created'")); |
| 112 | } | 113 | } |
| 113 | if($iii%50==0){ | 114 | if($iii%50==0){ |
| 114 | $shortinsert=""; | 115 | $shortinsert=""; | ... | ... |
| ... | @@ -47,9 +47,9 @@ class relationship_tag extends Command { | ... | @@ -47,9 +47,9 @@ class relationship_tag extends Command { |
| 47 | $conn = array( | 47 | $conn = array( |
| 48 | 'driver' => 'mysql', | 48 | 'driver' => 'mysql', |
| 49 | 'host' => $central_ip, | 49 | 'host' => $central_ip, |
| 50 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 50 | 'database' => env('CENTRAL_DB'), |
| 51 | 'username' => env('DB_USERNAME', 'root'), | 51 | 'username' => env('CENTRAL_USERNAME'), |
| 52 | 'password' => env('DB_PASSWORD', ''), | 52 | 'password' => env('CENTRAL_PASSWORD'), |
| 53 | 'charset' => 'utf8', | 53 | 'charset' => 'utf8', |
| 54 | 'collation' => 'utf8_unicode_ci', | 54 | 'collation' => 'utf8_unicode_ci', |
| 55 | 'prefix' => '', | 55 | 'prefix' => '', | ... | ... |
| ... | @@ -46,9 +46,9 @@ public function handle() | ... | @@ -46,9 +46,9 @@ public function handle() |
| 46 | $conn = array( | 46 | $conn = array( |
| 47 | 'driver' => 'mysql', | 47 | 'driver' => 'mysql', |
| 48 | 'host' => $central_ip, | 48 | 'host' => $central_ip, |
| 49 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 49 | 'database' => env('CENTRAL_DB'), |
| 50 | 'username' => env('DB_USERNAME', 'root'), | 50 | 'username' => env('CENTRAL_USERNAME'), |
| 51 | 'password' => env('DB_PASSWORD', ''), | 51 | 'password' => env('CENTRAL_PASSWORD'), |
| 52 | 'charset' => 'utf8', | 52 | 'charset' => 'utf8', |
| 53 | 'collation' => 'utf8_unicode_ci', | 53 | 'collation' => 'utf8_unicode_ci', |
| 54 | 'prefix' => '', | 54 | 'prefix' => '', | ... | ... |
| ... | @@ -46,9 +46,9 @@ public function handle() | ... | @@ -46,9 +46,9 @@ public function handle() |
| 46 | $conn = array( | 46 | $conn = array( |
| 47 | 'driver' => 'mysql', | 47 | 'driver' => 'mysql', |
| 48 | 'host' => $central_ip, | 48 | 'host' => $central_ip, |
| 49 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 49 | 'database' => env('CENTRAL_DB'), |
| 50 | 'username' => env('DB_USERNAME', 'root'), | 50 | 'username' => env('CENTRAL_USERNAME'), |
| 51 | 'password' => env('DB_PASSWORD', ''), | 51 | 'password' => env('CENTRAL_PASSWORD'), |
| 52 | 'charset' => 'utf8', | 52 | 'charset' => 'utf8', |
| 53 | 'collation' => 'utf8_unicode_ci', | 53 | 'collation' => 'utf8_unicode_ci', |
| 54 | 'prefix' => '', | 54 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -50,9 +50,9 @@ public function handle() | ... | @@ -50,9 +50,9 @@ public function handle() |
| 50 | $conn = array( | 50 | $conn = array( |
| 51 | 'driver' => 'mysql', | 51 | 'driver' => 'mysql', |
| 52 | 'host' => $central_ip, | 52 | 'host' => $central_ip, |
| 53 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 53 | 'database' => env('CENTRAL_DB'), |
| 54 | 'username' => env('DB_USERNAME', 'root'), | 54 | 'username' => env('CENTRAL_USERNAME'), |
| 55 | 'password' => env('DB_PASSWORD', ''), | 55 | 'password' => env('CENTRAL_PASSWORD'), |
| 56 | 'charset' => 'utf8', | 56 | 'charset' => 'utf8', |
| 57 | 'collation' => 'utf8_unicode_ci', | 57 | 'collation' => 'utf8_unicode_ci', |
| 58 | 'prefix' => '', | 58 | 'prefix' => '', | ... | ... |
| ... | @@ -47,8 +47,10 @@ protected $commands = [ | ... | @@ -47,8 +47,10 @@ protected $commands = [ |
| 47 | 'App\Console\Commands\BirthdayDate', | 47 | 'App\Console\Commands\BirthdayDate', |
| 48 | 'App\Console\Commands\bulkserverupload_data', | 48 | 'App\Console\Commands\bulkserverupload_data', |
| 49 | 'App\Console\Commands\bulkServerUpload_data3', | 49 | 'App\Console\Commands\bulkServerUpload_data3', |
| 50 | 'App\Console\Commands\Userlog_datavalidation', | 50 | 'App\Console\Commands\Calllogupdate', |
| 51 | 51 | 'App\Console\Commands\CreateCall', | |
| 52 | 'App\Console\Commands\PredictiveCallHangUp', | ||
| 53 | 'App\Console\Commands\UpdateAvgRingSec', | ||
| 52 | ]; | 54 | ]; |
| 53 | 55 | ||
| 54 | /** | 56 | /** |
| ... | @@ -59,12 +61,13 @@ protected $commands = [ | ... | @@ -59,12 +61,13 @@ protected $commands = [ |
| 59 | */ | 61 | */ |
| 60 | protected function schedule(Schedule $schedule) | 62 | protected function schedule(Schedule $schedule) |
| 61 | { | 63 | { |
| 62 | $schedule->command('KstychDaily')->daily()->withoutOverlapping(); | 64 | //$schedule->command('KstychDaily')->daily()->withoutOverlapping(); |
| 65 | $schedule->command('UpdateAvgRingSec')->daily()->withoutOverlapping(); | ||
| 63 | //$schedule->command('bulkServerUpload')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 66 | //$schedule->command('bulkServerUpload')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 64 | //$schedule->command('bulkserverupload_data')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserverupload_data.txt")->withoutOverlapping(); | 67 | //$schedule->command('bulkserverupload_data')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserverupload_data.txt")->withoutOverlapping(); |
| 65 | $schedule->command('bulkserverupload_data')->dailyAt('14:17')->appendOutputTo(storage_path()."/reason/bulkserverupload_data.txt")->withoutOverlapping(); | 68 | //$schedule->command('bulkserverupload_data')->dailyAt('14:17')->appendOutputTo(storage_path()."/reason/bulkserverupload_data.txt")->withoutOverlapping(); |
| 66 | $schedule->command('bulkServerUpload')->dailyAt('14:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 69 | //$schedule->command('bulkServerUpload')->dailyAt('14:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 67 | $schedule->command('bulkServerUpload_data3')->dailyAt('14:20')->appendOutputTo(storage_path()."/reason/bulkServerUpload_data3.txt")->withoutOverlapping(); | 70 | //$schedule->command('bulkServerUpload_data3')->dailyAt('14:20')->appendOutputTo(storage_path()."/reason/bulkServerUpload_data3.txt")->withoutOverlapping(); |
| 68 | 71 | ||
| 69 | //$schedule->command('relationship_tag')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_tag.txt")->withoutOverlapping(); | 72 | //$schedule->command('relationship_tag')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_tag.txt")->withoutOverlapping(); |
| 70 | //$schedule->command('calllog')->everyMinute()->appendOutputTo(storage_path()."/reason/calllog.txt")->withoutOverlapping(); | 73 | //$schedule->command('calllog')->everyMinute()->appendOutputTo(storage_path()."/reason/calllog.txt")->withoutOverlapping(); |
| ... | @@ -73,19 +76,18 @@ protected function schedule(Schedule $schedule) | ... | @@ -73,19 +76,18 @@ protected function schedule(Schedule $schedule) |
| 73 | //$schedule->command('supervisor_agent_rec')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_agent_rec.txt")->withoutOverlapping(); | 76 | //$schedule->command('supervisor_agent_rec')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_agent_rec.txt")->withoutOverlapping(); |
| 74 | //$schedule->command('supervisor_recommendation')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_recommendation.txt")->withoutOverlapping(); | 77 | //$schedule->command('supervisor_recommendation')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_recommendation.txt")->withoutOverlapping(); |
| 75 | //$schedule->command('question_tree')->everyMinute()->appendOutputTo(storage_path()."/reason/question_tree.txt")->withoutOverlapping(); | 78 | //$schedule->command('question_tree')->everyMinute()->appendOutputTo(storage_path()."/reason/question_tree.txt")->withoutOverlapping(); |
| 79 | //$schedule->command('bulkServerUpload')->dailyAt('10:08')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 76 | 80 | ||
| 77 | $schedule->command('Userlog_data')->dailyAt('01:10')->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping(); | 81 | //$schedule->command('Userlog_data')->dailyAt('01:10')->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping(); |
| 78 | |||
| 79 | //$schedule->command('Userlog_data')->everyMinute()->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping(); | ||
| 80 | 82 | ||
| 81 | $schedule->command('bulkServerUpload')->dailyAt('14:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 83 | $schedule->command('bulkServerUpload')->dailyAt('14:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 82 | $schedule->command('bulkServerUpload_1')->dailyAt('16:18')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 84 | $schedule->command('bulkServerUpload_1')->dailyAt('16:12')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 83 | $schedule->command('bulkServerUpload_2')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 85 | $schedule->command('bulkServerUpload_2')->dailyAt('16:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 84 | $schedule->command('bulkServerUpload_3')->dailyAt('19:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 86 | $schedule->command('bulkServerUpload_3')->dailyAt('21:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 85 | $schedule->command('bulkServerUpload_4')->dailyAt('20:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | 87 | $schedule->command('bulkServerUpload_4')->dailyAt('23:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); |
| 86 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkServerUpload_daily.txt")->withoutOverlapping(); | 88 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkServerUpload_daily.txt")->withoutOverlapping(); |
| 87 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | 89 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); |
| 88 | $schedule->command('BirthdayDate')->dailyAt('01:45')->appendOutputTo(storage_path()."/reason/BirthdayDate.txt")->withoutOverlapping(); | 90 | /*$schedule->command('BirthdayDate')->dailyAt('01:45')->appendOutputTo(storage_path()."/reason/BirthdayDate.txt")->withoutOverlapping(); |
| 89 | $schedule->command('bulkServerUpload_daily')->dailyAt('05:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | 91 | $schedule->command('bulkServerUpload_daily')->dailyAt('05:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); |
| 90 | $schedule->command('bulkServerUpload_daily')->dailyAt('07:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | 92 | $schedule->command('bulkServerUpload_daily')->dailyAt('07:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); |
| 91 | $schedule->command('bulkServerUpload_daily')->dailyAt('09:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | 93 | $schedule->command('bulkServerUpload_daily')->dailyAt('09:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); |
| ... | @@ -98,7 +100,7 @@ protected function schedule(Schedule $schedule) | ... | @@ -98,7 +100,7 @@ protected function schedule(Schedule $schedule) |
| 98 | $schedule->command('CreportNine')->dailyAt('14:44')->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); | 100 | $schedule->command('CreportNine')->dailyAt('14:44')->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); |
| 99 | 101 | ||
| 100 | $schedule->command('CreportNine')->dailyAt('01:14')->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); | 102 | $schedule->command('CreportNine')->dailyAt('01:14')->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); |
| 101 | 103 | $schedule->command('Calllogupdate')->dailyAt('09:55')->appendOutputTo(storage_path()."/reason/calllog_update.txt")->withoutOverlapping(); | |
| 102 | //$schedule->command('CreportNine')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); | 104 | //$schedule->command('CreportNine')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); |
| 103 | //$schedule->command('CreportEight')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping(); | 105 | //$schedule->command('CreportEight')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping(); |
| 104 | $schedule->command('questionnaire_details')->hourly()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping(); | 106 | $schedule->command('questionnaire_details')->hourly()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping(); |
| ... | @@ -126,8 +128,7 @@ protected function schedule(Schedule $schedule) | ... | @@ -126,8 +128,7 @@ protected function schedule(Schedule $schedule) |
| 126 | 128 | ||
| 127 | //$schedule->command('relationship_data')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_data.txt")->withoutOverlapping(); | 129 | //$schedule->command('relationship_data')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_data.txt")->withoutOverlapping(); |
| 128 | //$schedule->command('table_create')->everyMinute()->appendOutputTo(storage_path()."/reason/table_create.txt")->withoutOverlapping(); | 130 | //$schedule->command('table_create')->everyMinute()->appendOutputTo(storage_path()."/reason/table_create.txt")->withoutOverlapping(); |
| 129 | 131 | */ | |
| 130 | //$schedule->command('Userlog_datavalidation')->everyMinute()->appendOutputTo(storage_path()."/reason/Userlog_datavalid.txt")->withoutOverlapping(); | ||
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | } | 134 | } | ... | ... |
| 1 | <?php namespace App\Console; | ||
| 2 | |||
| 3 | use Illuminate\Console\Scheduling\Schedule; | ||
| 4 | use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
| 5 | |||
| 6 | class Kernel extends ConsoleKernel | ||
| 7 | { | ||
| 8 | |||
| 9 | /** | ||
| 10 | * The Artisan commands provided by your application. | ||
| 11 | * | ||
| 12 | * @var array | ||
| 13 | */ | ||
| 14 | protected $commands = [ | ||
| 15 | 'App\Console\Commands\KstychDaily', | ||
| 16 | 'App\Console\Commands\KstychPAMI', | ||
| 17 | 'App\Console\Commands\KstychPAGI', | ||
| 18 | 'App\Console\Commands\DailyLogout', | ||
| 19 | 'App\Console\Commands\bulkServerUpload', | ||
| 20 | 'App\Console\Commands\bulkServerUpload_1', | ||
| 21 | 'App\Console\Commands\bulkServerUpload_2', | ||
| 22 | 'App\Console\Commands\bulkServerUpload_3', | ||
| 23 | 'App\Console\Commands\bulkServerUpload_4', | ||
| 24 | //'App\Console\Commands\bulkServerUpload_5', | ||
| 25 | 'App\Console\Commands\bulkServerUpload_daily', | ||
| 26 | 'App\Console\Commands\InsertCrmArchive', | ||
| 27 | 'App\Console\Commands\DeleteCrmcalls', | ||
| 28 | 'App\Console\Commands\records_details', | ||
| 29 | 'App\Console\Commands\CreportEight', | ||
| 30 | 'App\Console\Commands\questionnaire_details', | ||
| 31 | 'App\Console\Commands\Userlog_data', | ||
| 32 | 'App\Console\Commands\lead_form_details', | ||
| 33 | 'App\Console\Commands\full_remark_details', | ||
| 34 | 'App\Console\Commands\recording_reconcilation', | ||
| 35 | 'App\Console\Commands\recording_reconcilation_metadata', | ||
| 36 | 'App\Console\Commands\dailyupload_calllog', | ||
| 37 | 'App\Console\Commands\dailyupload_questionaire', | ||
| 38 | 'App\Console\Commands\relationship_data', | ||
| 39 | 'App\Console\Commands\relationship_tag', | ||
| 40 | 'App\Console\Commands\supervisor_agent_rec', | ||
| 41 | 'App\Console\Commands\supervisor_recommendation', | ||
| 42 | 'App\Console\Commands\rlppb_details', | ||
| 43 | 'App\Console\Commands\question_tree', | ||
| 44 | //'App\Console\Commands\table_create', | ||
| 45 | //'App\Console\Commands\calllog', | ||
| 46 | //'App\Console\Commands\CreportNine', | ||
| 47 | //'App\Console\Commands\CreportTen', | ||
| 48 | 'App\Console\Commands\BirthdayDate', | ||
| 49 | 'App\Console\Commands\bulkserverupload_data', | ||
| 50 | ]; | ||
| 51 | |||
| 52 | /** | ||
| 53 | * Define the application's command schedule. | ||
| 54 | * | ||
| 55 | * @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
| 56 | * @return void | ||
| 57 | */ | ||
| 58 | protected function schedule(Schedule $schedule) | ||
| 59 | { | ||
| 60 | $schedule->command('KstychDaily')->daily()->withoutOverlapping(); | ||
| 61 | //$schedule->command('bulkServerUpload')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 62 | |||
| 63 | $schedule->command('bulkserverupload_data')->dailyAt('01:45')->appendOutputTo(storage_path()."/reason/bulkserverupload_data.txt")->withoutOverlapping(); | ||
| 64 | |||
| 65 | //$schedule->command('relationship_tag')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_tag.txt")->withoutOverlapping(); | ||
| 66 | //$schedule->command('calllog')->everyMinute()->appendOutputTo(storage_path()."/reason/calllog.txt")->withoutOverlapping(); | ||
| 67 | //$schedule->command('rlppb_details')->everyMinute()->appendOutputTo(storage_path()."/reason/rlppb_details.txt")->withoutOverlapping(); | ||
| 68 | $schedule->command('BirthdayDate')->dailyAt('01:45')->appendOutputTo(storage_path()."/reason/BirthdayDate.txt")->withoutOverlapping(); | ||
| 69 | //$schedule->command('supervisor_agent_rec')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_agent_rec.txt")->withoutOverlapping(); | ||
| 70 | //$schedule->command('supervisor_recommendation')->everyMinute()->appendOutputTo(storage_path()."/reason/supervisor_recommendation.txt")->withoutOverlapping(); | ||
| 71 | //$schedule->command('question_tree')->everyMinute()->appendOutputTo(storage_path()."/reason/question_tree.txt")->withoutOverlapping(); | ||
| 72 | |||
| 73 | $schedule->command('Userlog_data')->dailyAt('01:10')->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping(); | ||
| 74 | |||
| 75 | $schedule->command('bulkServerUpload')->dailyAt('14:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 76 | $schedule->command('bulkServerUpload_1')->dailyAt('16:18')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 77 | $schedule->command('bulkServerUpload_2')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 78 | $schedule->command('bulkServerUpload_3')->dailyAt('19:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 79 | $schedule->command('bulkServerUpload_4')->dailyAt('20:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping(); | ||
| 80 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkServerUpload_daily.txt")->withoutOverlapping(); | ||
| 81 | //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 82 | |||
| 83 | $schedule->command('bulkServerUpload_daily')->dailyAt('05:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 84 | $schedule->command('bulkServerUpload_daily')->dailyAt('07:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 85 | $schedule->command('bulkServerUpload_daily')->dailyAt('09:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 86 | $schedule->command('bulkServerUpload_daily')->dailyAt('11:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 87 | $schedule->command('bulkServerUpload_daily')->dailyAt('13:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping(); | ||
| 88 | |||
| 89 | $schedule->command('dailyupload_questionaire')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailyupload_questionaire.txt")->withoutOverlapping(); | ||
| 90 | //$schedule->command('CreportEight')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping(); | ||
| 91 | |||
| 92 | $schedule->command('CreportEight')->everyTenMinutes()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping(); | ||
| 93 | //$schedule->command('CreportNine')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportNine.txt")->withoutOverlapping(); | ||
| 94 | //$schedule->command('CreportTen')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportTen.txt")->withoutOverlapping(); | ||
| 95 | //$schedule->command('CreportEight')->everyMinute()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping(); | ||
| 96 | $schedule->command('questionnaire_details')->hourly()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping(); | ||
| 97 | $schedule->command('InsertCrmArchive')->hourly()->appendOutputTo(storage_path()."/reason/InsertCrmArchive.txt")->withoutOverlapping(); | ||
| 98 | |||
| 99 | |||
| 100 | //$schedule->command('InsertCrmArchive')->everyMinute()->appendOutputTo(storage_path()."/reason/InsertCrmArchive.txt")->withoutOverlapping(); | ||
| 101 | $schedule->command('DeleteCrmcalls')->hourly()->withoutOverlapping(); | ||
| 102 | |||
| 103 | $schedule->command('DailyLogout')->dailyAt('14:30')->withoutOverlapping(); | ||
| 104 | |||
| 105 | $schedule->command('lead_form_details')->everyTenMinutes()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping(); | ||
| 106 | $schedule->command('records_details')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping(); | ||
| 107 | //$schedule->command('recording_reconcilation')->everyMinute()->appendOutputTo(storage_path()."/reason/recording_reconcilation.txt")->withoutOverlapping(); | ||
| 108 | //$schedule->command('recording_reconcilation_metadata')->everyMinute()->appendOutputTo(storage_path()."/reason/recording_reconcilation_metadata.txt")->withoutOverlapping(); | ||
| 109 | |||
| 110 | //$schedule->command('lead_form_details')->everyMinute()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping(); | ||
| 111 | |||
| 112 | $schedule->command('dailyupload_calllog')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailycalllog_records.txt")->withoutOverlapping(); | ||
| 113 | |||
| 114 | //$schedule->command('records_details')->everyMinute()->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping(); | ||
| 115 | $schedule->command('full_remark_details')->hourly()->appendOutputTo(storage_path()."/reason/full_remark_details.txt")->withoutOverlapping(); | ||
| 116 | //$schedule->command('questionnaire_details')->everyMinute()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping(); | ||
| 117 | |||
| 118 | //$schedule->command('relationship_data')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_data.txt")->withoutOverlapping(); | ||
| 119 | //$schedule->command('table_create')->everyMinute()->appendOutputTo(storage_path()."/reason/table_create.txt")->withoutOverlapping(); | ||
| 120 | |||
| 121 | } | ||
| 122 | |||
| 123 | } |
| 1 | <?php | ||
| 2 | define('SMS_NOTCONTACTED',1); | ||
| 3 | define('SMS_THANKYOU',2); | ||
| 4 | $smsContactedSubdispositionsArr = array ('Contacted','Feedback'); | ||
| 5 | $smsNotContactedSubdispositionsArr = array ( | ||
| 6 | 'NC - Customer Traveling / Abroad', | ||
| 7 | 'NC - Customer in Meeting', | ||
| 8 | 'NC - Ringing / No response', | ||
| 9 | 'NC - Not Reachable', | ||
| 10 | 'NC - Switched off', | ||
| 11 | 'NC - Third Party' | ||
| 12 | ); | ||
| 13 | $smsTemplatesArr = array( | ||
| 14 | //SMS_NOTCONTACTED => "Dear Customer,Your Virtual Relationship Manager #name# from HDFC Bank tried reaching you. Kindly call #number# for all your banking and financial needs", | ||
| 15 | //SMS_NOTCONTACTED =>"Dear Customer, Your Virtual RM #name# from HDFC Bank tried reaching you. Kindly call #number# for all your banking and financial needs.", | ||
| 16 | SMS_NOTCONTACTED =>"Your RM is unable to contact you! | ||
| 17 | Call #name# @ #number# for any banking need. | ||
| 18 | Check & invest in our FD/RD @best rate. | ||
| 19 | Click here: bit.ly/2TqCdKA", | ||
| 20 | //SMS_THANKYOU =>"Thank you for speaking to your VirtualRM on #date# . Now also access your account 24/7 via NetBanking/MobileBanking. Download MobileBanking App: bit.ly/2ajTksK" | ||
| 21 | //SMS_THANKYOU =>"Thank you for speaking to your Virtual RM on #date#. Now also access your account 24/7 via Net / Mobile Banking. Download Mobile App: bit.ly/2ajTksK" | ||
| 22 | SMS_THANKYOU =>"Your opinion matters! | ||
| 23 | Thanks for talking & sharing your feedback on #number# with RM #name# | ||
| 24 | Check & invest in our FD/RD @best rate | ||
| 25 | Click: bit.ly/2TqCdKA" | ||
| 26 | ); | ||
| 27 | ?> |
application/app/Constants/gatewaydispo.php
0 → 100644
| 1 | <?php namespace App\Http\Controllers; | ||
| 2 | |||
| 3 | use DB; | ||
| 4 | use Auth; | ||
| 5 | use Input; | ||
| 6 | use App\Models\Campaign; | ||
| 7 | use App\Services\FormBuilder; | ||
| 8 | use Illuminate\Http\Request; | ||
| 9 | use Response; | ||
| 10 | use App\Models\User; | ||
| 11 | use SimpleXLSX; | ||
| 12 | use App\Jobs\KHRMSLib; | ||
| 13 | |||
| 14 | class CampaignController extends Controller { | ||
| 15 | |||
| 16 | public function __construct() | ||
| 17 | { | ||
| 18 | $this->middleware('auth'); | ||
| 19 | $this->middleware('module_access'); | ||
| 20 | } | ||
| 21 | |||
| 22 | public function index() | ||
| 23 | { | ||
| 24 | $data['campaignList'] = Campaign::where('mtype',"=","company")->where('status','=','active')->orderBy('mkey')->get(); | ||
| 25 | $dashboarduser=Auth::user(); | ||
| 26 | if($dashboarduser->usertype != 'Admin'){ | ||
| 27 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 28 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 29 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 30 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 31 | })->get(); | ||
| 32 | } | ||
| 33 | else | ||
| 34 | { | ||
| 35 | $allusers=DB::table('users')->select('*')->where('status','=','Active')->get(); | ||
| 36 | } | ||
| 37 | foreach($allusers as $alluser) | ||
| 38 | { | ||
| 39 | |||
| 40 | $username[] = $alluser->username; | ||
| 41 | } | ||
| 42 | |||
| 43 | //$data['client'] = $client; | ||
| 44 | if(isset($username))$data['username'] = $username; | ||
| 45 | return view("layout.module.campaign.index",$data); | ||
| 46 | } | ||
| 47 | |||
| 48 | public function create() | ||
| 49 | { | ||
| 50 | } | ||
| 51 | |||
| 52 | public function store(Request $request) | ||
| 53 | { | ||
| 54 | $action = Input::get("action"); | ||
| 55 | if($action == 'upload'){ | ||
| 56 | if($request->hasFile('file')){ | ||
| 57 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 58 | include(app_path().'/lib/simplexlsx-master/simplexlsx.class.php'); | ||
| 59 | |||
| 60 | $path = $request->file->getRealPath(); | ||
| 61 | $objSimpleXLSX = SimpleXLSX::parse($path); | ||
| 62 | |||
| 63 | $objWorksheet = $objSimpleXLSX->rows(); | ||
| 64 | $highestColumn = count($objWorksheet[0]); | ||
| 65 | $highestrow=count($objWorksheet); | ||
| 66 | |||
| 67 | //echo "<pre>";print_r($objWorksheet); | ||
| 68 | //echo "\n"; | ||
| 69 | //print_r($highestColumn); | ||
| 70 | //echo "\n"; | ||
| 71 | |||
| 72 | //echo $highestrow; | ||
| 73 | |||
| 74 | for($i=0;$i<$highestrow;$i++) | ||
| 75 | {//echo $i; | ||
| 76 | $excelarray[$i]=array(); | ||
| 77 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 78 | { | ||
| 79 | if($i==0) | ||
| 80 | { | ||
| 81 | $keys[$head]=trim($objWorksheet[$i][$head]); | ||
| 82 | |||
| 83 | } | ||
| 84 | else | ||
| 85 | { | ||
| 86 | $excelarray[$i][$keys[$head]]=trim($objWorksheet[$i][$head]); | ||
| 87 | } | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | //echo "<pre>";print_r($excelarray); | ||
| 92 | |||
| 93 | for($i=1;$i<$highestrow;$i++) | ||
| 94 | { | ||
| 95 | if($excelarray[$i]["name"]!="" || $excelarray[$i]["name"]!="0" || $excelarray[$i]["name"]!=0 ) | ||
| 96 | { | ||
| 97 | //echo $excelarray[$i]["name"]; | ||
| 98 | if(!empty($excelarray[$i]["name"])){ | ||
| 99 | $campaign = Input::get("selectCampaignField"); | ||
| 100 | |||
| 101 | if($campaign=="all"){ | ||
| 102 | $campaign=""; | ||
| 103 | $allcampaign=Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); | ||
| 104 | foreach ($allcampaign as $mkeycampaign) | ||
| 105 | { | ||
| 106 | $campaign .= $mkeycampaign->mkey.","; | ||
| 107 | } | ||
| 108 | $campaign=substr($campaign, 0, -1); | ||
| 109 | } | ||
| 110 | |||
| 111 | $usercampaign=User::where('username','=',trim($excelarray[$i]["name"])); | ||
| 112 | |||
| 113 | if($usercampaign->count() > 0){ | ||
| 114 | $usercampaign = $usercampaign->first(); | ||
| 115 | $campaignList =$usercampaign->clients.",".$campaign; | ||
| 116 | $data=json_decode($usercampaign->data,true); | ||
| 117 | if(isset($data['hrmsdata'])) | ||
| 118 | { | ||
| 119 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 120 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 121 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 122 | }else | ||
| 123 | { | ||
| 124 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 125 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 126 | } | ||
| 127 | $data=json_encode($data); | ||
| 128 | $usercampaign->updated_at=date("Y-m-d H:i:s"); | ||
| 129 | $usercampaign->clients=$campaignList; | ||
| 130 | $usercampaign->data=$data; | ||
| 131 | $usercampaign->save(); | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | } | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | if($action == 'bulkupload'){ | ||
| 143 | if($request->hasFile('file')){ | ||
| 144 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 145 | include(app_path().'/lib/simplexlsx-master/simplexlsx.class.php'); | ||
| 146 | |||
| 147 | $path = $request->file->getRealPath(); | ||
| 148 | $objSimpleXLSX = SimpleXLSX::parse($path); | ||
| 149 | |||
| 150 | |||
| 151 | $objWorksheet = $objSimpleXLSX->rows(); | ||
| 152 | $highestColumn = count($objWorksheet[0]); | ||
| 153 | $highestrow=count($objWorksheet); | ||
| 154 | |||
| 155 | |||
| 156 | $dbUsers=DB::table('users')->select('username', 'data')->where('status','=','Active')->get(); | ||
| 157 | $dbCampaigns=DB::table('hrms_masters')->select('mkey')->where('status','=','Active')->get(); | ||
| 158 | |||
| 159 | $activeUser = array(); | ||
| 160 | $activeCampaign = array(); | ||
| 161 | $activeUserData = array(); | ||
| 162 | foreach ($dbUsers as $key => $dbUser){ | ||
| 163 | $activeUser[] = $dbUser->username; | ||
| 164 | $activeUserData[$dbUser->username] = $dbUser->data; | ||
| 165 | } | ||
| 166 | foreach ($dbCampaigns as $key => $dbCampaign)$activeCampaign[] = $dbCampaign->mkey; | ||
| 167 | |||
| 168 | $campaigns = array(); | ||
| 169 | $users = array(); | ||
| 170 | for($row=0;$row<$highestrow;$row++) | ||
| 171 | { | ||
| 172 | if($row!=0 && !empty(trim($objWorksheet[$row][0]))){ | ||
| 173 | |||
| 174 | if(in_array(trim($objWorksheet[$row][0]), $activeCampaign) && in_array(trim($objWorksheet[$row][1]), $activeUser)){ | ||
| 175 | |||
| 176 | $users[trim($objWorksheet[$row][1])][] = $objWorksheet[$row][0]; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | foreach ($users as $userName => $campaigns) { | ||
| 182 | $campaignList = implode(',', $campaigns); | ||
| 183 | |||
| 184 | $data=json_decode($activeUserData[$userName],true); | ||
| 185 | |||
| 186 | if(isset($data['hrmsdata'])) | ||
| 187 | { | ||
| 188 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 189 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 190 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 191 | }else | ||
| 192 | { | ||
| 193 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 194 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 195 | } | ||
| 196 | $data=json_encode($data); | ||
| 197 | |||
| 198 | DB::table('users')->where('username', $userName)->update(['clients'=>$campaignList, 'data' => $data]); | ||
| 199 | } | ||
| 200 | } | ||
| 201 | } | ||
| 202 | // if($action=="createCampaign") | ||
| 203 | // { | ||
| 204 | // $this->validate($request,[ | ||
| 205 | // 'campaignName' => 'required|alpha_dash', | ||
| 206 | // ]); | ||
| 207 | |||
| 208 | // $campaignName = Input::get("campaignName"); | ||
| 209 | |||
| 210 | // if($campaignName != ""){ | ||
| 211 | // Campaign::insert(["mkey"=>$campaignName,"mtype"=>"company"]); | ||
| 212 | // $data['campaignDetails'] = Campaign::where("mtype","=","company")->where("mkey","=",$campaignName)->first(); | ||
| 213 | // return view("layout.module.campaign.campaign",$data); | ||
| 214 | // }else{ | ||
| 215 | // return "<script>simpleNotification('error','topRight','Campaign name should not be blank.');</script><br/><p class='text-danger text-center'>Campaign name should not be blank.</p>"; | ||
| 216 | // } | ||
| 217 | // } | ||
| 218 | |||
| 219 | // if($action=="buildForm") | ||
| 220 | // { | ||
| 221 | // $rawData = Input::get("rawData"); | ||
| 222 | // $fb = new FormBuilder(); | ||
| 223 | // $output = $fb->buildForm($rawData); | ||
| 224 | // return $output; | ||
| 225 | // } | ||
| 226 | |||
| 227 | // if($action=="dataUpload") | ||
| 228 | // { | ||
| 229 | // return view("layout.module.campaign.campaignTabData"); | ||
| 230 | // } | ||
| 231 | } | ||
| 232 | |||
| 233 | public function show($id) | ||
| 234 | { | ||
| 235 | if($id=="show") | ||
| 236 | { | ||
| 237 | $gthis = new KHRMSLib(); | ||
| 238 | $campaign = Input::get("campaign"); | ||
| 239 | |||
| 240 | $mastersdata=$gthis->getCompanyMaster($campaign); | ||
| 241 | $disposition = array(); | ||
| 242 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList']; | ||
| 243 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | ||
| 244 | foreach($dispoarr as $dispo) | ||
| 245 | { | ||
| 246 | if(!empty($dispo)) | ||
| 247 | { | ||
| 248 | $dispoprts=explode("|",$dispo); | ||
| 249 | if(sizeof($dispoprts)>=3) | ||
| 250 | { | ||
| 251 | $disposition[$dispoprts[1]] = $dispoprts[2]; | ||
| 252 | $dispositionCode[$dispoprts[1]] = $dispoprts[0]; | ||
| 253 | /*$data.="dialerdispoarray['$dispoprts[1]']='$dispoprts[2]'; | ||
| 254 | dispoClassArray['$dispoprts[0]']='$dispoprts[1]';";*/ | ||
| 255 | } | ||
| 256 | } | ||
| 257 | } | ||
| 258 | $data['disposition'] = $disposition; | ||
| 259 | $data['dispositionCode'] = $dispositionCode; | ||
| 260 | |||
| 261 | |||
| 262 | $dispositionList=DB::table('hrms_masters')->select('*')->where('status','=','Active')->where("mkey","=",$campaign)->where("mtype","=",'coreconfig')->first(); | ||
| 263 | |||
| 264 | $dispolist=explode("~",$dispositionList->mvalue); | ||
| 265 | $dispositionList = array(); | ||
| 266 | foreach ($dispolist as $key => $dispo) { | ||
| 267 | if(!empty($dispo)) | ||
| 268 | { | ||
| 269 | $dispoprts=explode("|",$dispo); | ||
| 270 | $dispositionList[$dispoprts[1]]= $dispoprts[2]; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | $data['dispositionList'] = $dispositionList; | ||
| 275 | //$campaign = Input::get("campaign"); | ||
| 276 | if($campaign != ""){ | ||
| 277 | //this condition for getting all campaign data | ||
| 278 | if($campaign == "all") | ||
| 279 | { | ||
| 280 | $data['campaignDetails']['mkey'] ="All"; | ||
| 281 | |||
| 282 | $data['dataCountByStatus'] = DB::table("records")->select(DB::Raw('status, count(*) as recordCount'))->groupBy('status')->get(); | ||
| 283 | $data['dataCountByDisposition'] = DB::table("records")->select(DB::Raw('dialer_status, count(*) as recordCount'))->groupBy('dialer_status')->get(); | ||
| 284 | $data['queryLogs'] = DB::table("campaign_query")->get(); | ||
| 285 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); | ||
| 286 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); | ||
| 287 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); | ||
| 288 | |||
| 289 | }else{ | ||
| 290 | $data['campaignDetails'] = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); | ||
| 291 | $data['dataCountByStatus'] = DB::table("records")->select(DB::Raw('status, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('status')->get(); | ||
| 292 | $data['dataCountByDisposition'] = DB::table("records")->select(DB::Raw('dialer_status, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('dialer_status')->get(); | ||
| 293 | $data['queryLogs'] = DB::table("campaign_query")->where('campaign', '=', $campaign)->get(); | ||
| 294 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); | ||
| 295 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); | ||
| 296 | //$scheduledCampaign = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); | ||
| 297 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); | ||
| 298 | } | ||
| 299 | |||
| 300 | }else{ | ||
| 301 | return "<script>simpleNotification('error','topRight','Campaign name should not be blank.');</script><br/><p class='text-danger text-center'>Campaign name should not be blank.</p>"; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | if($id=="runquery") | ||
| 305 | { | ||
| 306 | $campaign = Input::get("campaign"); | ||
| 307 | $querySelect = Input::get("allvalues"); | ||
| 308 | $queryConditions = Input::get("queryConditions"); | ||
| 309 | if($queryConditions){ | ||
| 310 | $queryConditions = str_replace('"', "'", $queryConditions); | ||
| 311 | $queryConditions = str_replace(''', "'", $queryConditions); | ||
| 312 | }else{ | ||
| 313 | $queryConditions = '1'; | ||
| 314 | } | ||
| 315 | $fields = explode(",", $querySelect); | ||
| 316 | |||
| 317 | $i = 1; $output = ''; | ||
| 318 | try { | ||
| 319 | |||
| 320 | |||
| 321 | if($campaign=="All") | ||
| 322 | { | ||
| 323 | // $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 324 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; | ||
| 325 | $sqlQuery = DB::select($selQuery); | ||
| 326 | }else | ||
| 327 | { | ||
| 328 | //$selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 329 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; | ||
| 330 | $sqlQuery = DB::select($selQuery); | ||
| 331 | } | ||
| 332 | } catch(\Illuminate\Database\QueryException $ex){ | ||
| 333 | $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; | ||
| 334 | return $output; | ||
| 335 | } | ||
| 336 | |||
| 337 | if(count($sqlQuery)){ | ||
| 338 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | ||
| 339 | } | ||
| 340 | return $output; | ||
| 341 | } | ||
| 342 | if($id=="savequery") | ||
| 343 | { | ||
| 344 | $campaign = Input::get("campaign"); | ||
| 345 | $querySelect = Input::get("allvalues"); | ||
| 346 | $queryConditions = Input::get("queryConditions"); | ||
| 347 | if($queryConditions){ | ||
| 348 | $queryConditions = str_replace('"', "'", $queryConditions); | ||
| 349 | $queryConditions = str_replace(''', "'", $queryConditions); | ||
| 350 | }else{ | ||
| 351 | $queryConditions = '1'; | ||
| 352 | } | ||
| 353 | // $queryInCondition = Input::get("queryInCondition"); | ||
| 354 | // if($queryInCondition != 'null'){ | ||
| 355 | // $queryInCondition = str_replace('"', "'", $queryInCondition); | ||
| 356 | // $queryInCondition = str_replace(''', "'", $queryInCondition); | ||
| 357 | // $queryInCondition = "or elegible IN ($queryInCondition)"; | ||
| 358 | // $querySelect .= ',elegible'; | ||
| 359 | // }else{ | ||
| 360 | // $queryInCondition = ''; | ||
| 361 | // } | ||
| 362 | //$queryLimit = Input::get("queryLimit"); | ||
| 363 | //$queryOffset = Input::get("queryOffset"); | ||
| 364 | //$checkedValue = Input::get("checkedValue"); | ||
| 365 | // print_r($checkedValue); | ||
| 366 | $fields = explode(",", $querySelect); | ||
| 367 | |||
| 368 | $i = 1; $output = ''; | ||
| 369 | try { | ||
| 370 | |||
| 371 | |||
| 372 | if($campaign=="All") | ||
| 373 | { | ||
| 374 | // $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 375 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; | ||
| 376 | $sqlQuery = DB::select($selQuery); | ||
| 377 | }else | ||
| 378 | { | ||
| 379 | //$selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 380 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; | ||
| 381 | $sqlQuery = DB::select($selQuery); | ||
| 382 | } | ||
| 383 | |||
| 384 | if($sqlQuery){ | ||
| 385 | |||
| 386 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); | ||
| 387 | |||
| 388 | if(empty($queryExist)) | ||
| 389 | { | ||
| 390 | DB::table('campaign_query')->insert(['campaign'=>$campaign, 'query'=>$selQuery, 'select_col'=>$querySelect,'where_cond'=>"client = '$campaign' AND $queryConditions"]); | ||
| 391 | }else{ | ||
| 392 | $output .="<p class='text-danger'>".'QueryAlreadyExist'."</p></br>"; | ||
| 393 | } | ||
| 394 | |||
| 395 | } | ||
| 396 | |||
| 397 | |||
| 398 | } catch(\Illuminate\Database\QueryException $ex){ | ||
| 399 | $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; | ||
| 400 | return $output; | ||
| 401 | } | ||
| 402 | |||
| 403 | if(count($sqlQuery)){ | ||
| 404 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | ||
| 405 | } | ||
| 406 | /*$output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; | ||
| 407 | foreach ($fields as $key) { | ||
| 408 | $output .= '<th class="text-center">'.trim($key).'</th>'; | ||
| 409 | } | ||
| 410 | $output .= "</tr></thed><tbody>"; | ||
| 411 | foreach($sqlQuery as $row){ | ||
| 412 | $output .= '<tr><th class="text-center">'.$i.'</th>'; | ||
| 413 | foreach ($fields as $key) { | ||
| 414 | $output .= '<td>'.trim($row->$key).'</td>'; | ||
| 415 | } | ||
| 416 | $output .= "</tr>"; | ||
| 417 | $i++; | ||
| 418 | } | ||
| 419 | }else{ | ||
| 420 | $output .= '<h5 class="text-danger"><i class="fa fa-exclamation-circle"></i> No Result!</h5>'; | ||
| 421 | } | ||
| 422 | $output .= '</tbody></table></div>';*/ | ||
| 423 | return $output; | ||
| 424 | } | ||
| 425 | /*if($id="runcount"){ | ||
| 426 | $output = ''; | ||
| 427 | $i = 1; | ||
| 428 | $campaign = Input::get("campaign"); | ||
| 429 | |||
| 430 | $id = Input::get("id"); | ||
| 431 | $queryTxt = DB::table('campaign_query')->where('id','=', $id)->select('query','select_col')->first(); | ||
| 432 | $fields = explode(",", $queryTxt->select_col); | ||
| 433 | |||
| 434 | $sqlQuery = DB::select($queryTxt->query); | ||
| 435 | if(count($sqlQuery)){ | ||
| 436 | $output .= '<div style="overflow-x:auto;"><h5>'.count($sqlQuery).'</h5>'; | ||
| 437 | }else{ | ||
| 438 | $output .= '<h5 class="text-danger"><i class="fa fa-exclamation-circle"></i> No Result!</h5>'; | ||
| 439 | } | ||
| 440 | return $output; | ||
| 441 | }*/ | ||
| 442 | |||
| 443 | if($id=="fquery") | ||
| 444 | { | ||
| 445 | $output = '';$i = 1; | ||
| 446 | $campaign = Input::get("campaign"); | ||
| 447 | |||
| 448 | $id = Input::get("id"); | ||
| 449 | |||
| 450 | $queryTxt = DB::table('campaign_query')->where('id','=', $id)->select('query','select_col')->first(); | ||
| 451 | |||
| 452 | $fields = explode(",", $queryTxt->select_col); | ||
| 453 | |||
| 454 | $sqlQuery = DB::select($queryTxt->query); | ||
| 455 | |||
| 456 | if(count($sqlQuery)){ | ||
| 457 | $output .= '<div style="overflow-x:auto;"><h5>'.count($sqlQuery).'</h5>'; | ||
| 458 | /*foreach ($fields as $key) { | ||
| 459 | $output .= '<th class="text-center">'.trim($key).'</th>'; | ||
| 460 | } | ||
| 461 | $output .= "</tr></thed><tbody>"; | ||
| 462 | foreach($sqlQuery as $row){ | ||
| 463 | $output .= '<tr><th class="text-center">'.$i.'</th>'; | ||
| 464 | foreach ($fields as $key) { | ||
| 465 | $output .= '<td>'.trim($row->$key).'</td>'; | ||
| 466 | } | ||
| 467 | $output .= "</tr>"; | ||
| 468 | $i++; | ||
| 469 | }*/ | ||
| 470 | }else{ | ||
| 471 | $output .= '<h5 class="text-danger"><i class="fa fa-exclamation-circle"></i> No Result!</h5>'; | ||
| 472 | } | ||
| 473 | |||
| 474 | return $output; | ||
| 475 | } | ||
| 476 | |||
| 477 | if($id=="delete") | ||
| 478 | { | ||
| 479 | $id = Input::get("id"); | ||
| 480 | |||
| 481 | DB::table('campaign_query')->where('id','=', $id)->delete(); | ||
| 482 | |||
| 483 | return; | ||
| 484 | } | ||
| 485 | |||
| 486 | if($id=="download") | ||
| 487 | { | ||
| 488 | $campaign = Input::get("campaign"); | ||
| 489 | $querySelect = Input::get("querySelect"); | ||
| 490 | $queryConditions = Input::get("queryConditions"); | ||
| 491 | if($queryConditions){ | ||
| 492 | $queryConditions = str_replace('"', "'", $queryConditions); | ||
| 493 | $queryConditions = str_replace(''', "'", $queryConditions); | ||
| 494 | }else{ | ||
| 495 | $queryConditions = '1'; | ||
| 496 | } | ||
| 497 | $queryInCondition = Input::get("queryInCondition"); | ||
| 498 | if($queryInCondition != 'null'){ | ||
| 499 | $queryInCondition = str_replace('"', "'", $queryInCondition); | ||
| 500 | $queryInCondition = str_replace(''', "'", $queryInCondition); | ||
| 501 | $queryInCondition = "or elegible IN ($queryInCondition)"; | ||
| 502 | $querySelect .= ',elegible'; | ||
| 503 | }else{ | ||
| 504 | $queryInCondition = ''; | ||
| 505 | } | ||
| 506 | $queryLimit = Input::get("queryLimit"); | ||
| 507 | $queryOffset = Input::get("queryOffset"); | ||
| 508 | |||
| 509 | try { | ||
| 510 | if($campaign=="All"){ | ||
| 511 | //$selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 512 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 513 | $sqlQuery = DB::select($selQuery); | ||
| 514 | }else{ | ||
| 515 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions $queryInCondition LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 516 | //$selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 517 | $sqlQuery = DB::select($selQuery); | ||
| 518 | } | ||
| 519 | } catch(\Illuminate\Database\QueryException $ex){ | ||
| 520 | $output .= "<p class='text-danger'>".$ex->getMessage()."</p>"; | ||
| 521 | return $output; | ||
| 522 | } | ||
| 523 | |||
| 524 | $data['fieldsarr'] = explode(",", $querySelect); | ||
| 525 | $data['alist'] = $sqlQuery; | ||
| 526 | |||
| 527 | return view("layout.module.campaign.download",$data); | ||
| 528 | } | ||
| 529 | |||
| 530 | if($id=="getDataFormat") | ||
| 531 | { | ||
| 532 | return view("layout.module.campaign.campaignTabData"); | ||
| 533 | } | ||
| 534 | |||
| 535 | if($id=="addCurrQueue") | ||
| 536 | { | ||
| 537 | $campQryId = Input::get("radioValue"); | ||
| 538 | $campaign = Input::get("campaign"); | ||
| 539 | |||
| 540 | DB::table('campaign_query')->where('id','!=', $campQryId)->where('campaign','=',$campaign)->update(['current_queue'=>'']); | ||
| 541 | DB::table('campaign_query')->where('id','=', $campQryId)->where('campaign','=',$campaign)->update(['current_queue'=>'selected']); | ||
| 542 | $queryCond=DB::table('campaign_query')->where('id','=',$campQryId)->where('campaign','=',$campaign)->select('where_cond'); | ||
| 543 | if($queryCond->count() > 0){ | ||
| 544 | $queryCond = $queryCond->first(); | ||
| 545 | DB::update(DB::raw("UPDATE records set filter_condition='1' where $queryCond->where_cond")); | ||
| 546 | } | ||
| 547 | return; | ||
| 548 | //return "<script>simpleNotification('success','topRight','Query Logic Successfully Applied');</script>"; | ||
| 549 | } | ||
| 550 | if($id=="assigncampaign") | ||
| 551 | { | ||
| 552 | $agentsNewArr = array(); | ||
| 553 | |||
| 554 | $agents = Input::get('agents'); | ||
| 555 | $campaign = Input::get("selectCampaignField"); | ||
| 556 | $agentsArr = explode(",", $agents); | ||
| 557 | $hrmsdata['clientsownerlist'] = array(); | ||
| 558 | $campaignList=""; | ||
| 559 | if($campaign=="all") | ||
| 560 | { | ||
| 561 | $campaign=""; | ||
| 562 | $allcampaign=Campaign::where('mtype',"=","company")->orderBy('mkey')->get(); | ||
| 563 | foreach ($allcampaign as $mkeycampaign) | ||
| 564 | { | ||
| 565 | $campaign .= $mkeycampaign->mkey.","; | ||
| 566 | } | ||
| 567 | $campaign=substr($campaign, 0, -1); | ||
| 568 | foreach ($agentsArr as $key => $agent) | ||
| 569 | { | ||
| 570 | $usercampaign=DB::table('users')->where('username','=',$agent)->select('clients','data')->first(); | ||
| 571 | $data=json_decode($usercampaign->data,true); | ||
| 572 | if(isset($data['hrmsdata'])){ | ||
| 573 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 574 | |||
| 575 | $hrmsdata['clientsownerlist'].=",".$campaign; | ||
| 576 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 577 | }else{ | ||
| 578 | $hrmsdata['clientsownerlist'] =$campaign; | ||
| 579 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 580 | } | ||
| 581 | $data=json_encode($data); | ||
| 582 | |||
| 583 | |||
| 584 | DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$campaign',data='$data' where username='$agent'"); | ||
| 585 | } | ||
| 586 | } | ||
| 587 | else | ||
| 588 | { | ||
| 589 | |||
| 590 | foreach ($agentsArr as $key => $agent) | ||
| 591 | { | ||
| 592 | $usercampaign=User::where('username','=',$agent)->first(); | ||
| 593 | //$campaignList =$usercampaign->clients.",".$campaign; | ||
| 594 | |||
| 595 | $data=json_decode($usercampaign->data,true); | ||
| 596 | if(isset($data['hrmsdata'])) | ||
| 597 | { | ||
| 598 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 599 | if($usercampaign->clients==$hrmsdata['clientsownerlist']){ | ||
| 600 | $campaignList =$usercampaign->clients.",".$campaign; | ||
| 601 | // print_r($hrmsdata['clientsownerlist']); | ||
| 602 | // $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 603 | }else{ | ||
| 604 | //print_r($hrmsdata['clientsownerlist']); | ||
| 605 | $campaignList = $hrmsdata['clientsownerlist'].",".$campaign; | ||
| 606 | //$hrmsdata['clientsownerlist'] = $hrmsdata['clientsownerlist'].",".$campaign; | ||
| 607 | } | ||
| 608 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 609 | //print_r($hrmsdata['clientsownerlist']); | ||
| 610 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 611 | //print_r($data['hrmsdata']); | ||
| 612 | //exit(); | ||
| 613 | }else | ||
| 614 | { | ||
| 615 | //exit(); | ||
| 616 | $campaignList =$usercampaign->clients.",".$campaign; | ||
| 617 | $hrmsdata['clientsownerlist'] = $campaignList; | ||
| 618 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 619 | //print_r($data['hrmsdata']); | ||
| 620 | } | ||
| 621 | $data=json_encode($data); | ||
| 622 | //print_r($data); | ||
| 623 | $usercampaign->updated_at=date("Y-m-d H:i:s"); | ||
| 624 | $usercampaign->clients=$campaignList; | ||
| 625 | $usercampaign->data=$data; | ||
| 626 | $usercampaign->save(); | ||
| 627 | |||
| 628 | //DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$campaign1',data='$data' where username='$agent'"); | ||
| 629 | } | ||
| 630 | } | ||
| 631 | |||
| 632 | return; | ||
| 633 | } | ||
| 634 | |||
| 635 | if($id=="removecampaign") | ||
| 636 | { | ||
| 637 | $agentsNewArr = array(); | ||
| 638 | $agents = Input::get('agents'); | ||
| 639 | $campaign = Input::get("selectCampaignField"); | ||
| 640 | $agentsArr = explode(",", $agents); | ||
| 641 | $hrmsdata['clientsownerlist'] = array(); | ||
| 642 | $campaignList=""; | ||
| 643 | |||
| 644 | if($campaign) | ||
| 645 | { | ||
| 646 | $usercampaignall=User::where('clients','like','%'.$campaign.'%')->pluck('username')->toArray(); | ||
| 647 | $removeagentsArr=array(); | ||
| 648 | if ($usercampaignall) | ||
| 649 | { | ||
| 650 | $removeagentsArr=array_diff($usercampaignall,$agentsArr); | ||
| 651 | } | ||
| 652 | foreach ($removeagentsArr as $key => $agent) | ||
| 653 | { | ||
| 654 | $usercampaign=DB::table('users')->where('username','=',$agent)->select('clients','data')->first(); | ||
| 655 | $data=json_decode($usercampaign->data,true); | ||
| 656 | $clients=$usercampaign->clients; | ||
| 657 | |||
| 658 | if($clients) | ||
| 659 | { | ||
| 660 | $clients_arr=explode(",",$clients); | ||
| 661 | $update_campaign[]=$campaign; | ||
| 662 | $update_clients=array_diff($clients_arr, $update_campaign); | ||
| 663 | $finalcampaign= implode(",",$update_clients); | ||
| 664 | } | ||
| 665 | |||
| 666 | if(isset($data['hrmsdata'])) | ||
| 667 | { | ||
| 668 | $hrmsdata=unserialize($data['hrmsdata']); | ||
| 669 | //print_r($hrmsdata); | ||
| 670 | $hrms_arr=explode(",", $hrmsdata['clientsownerlist']); | ||
| 671 | $update_campaign[]=$campaign; | ||
| 672 | $update_hrms=array_diff($hrms_arr, $update_campaign); | ||
| 673 | $hrmsdata['clientsownerlist']= implode(",",$update_hrms); | ||
| 674 | $final = implode(",",$update_hrms); | ||
| 675 | // print_r($hrmsdata['clientsownerlist']); | ||
| 676 | $data['hrmsdata']=serialize($hrmsdata); | ||
| 677 | $data=json_encode($data); | ||
| 678 | |||
| 679 | } | ||
| 680 | $usercampaign1=User::where('username','=',$agent)->first(); | ||
| 681 | $usercampaign1->updated_at=date("Y-m-d H:i:s"); | ||
| 682 | $usercampaign1->clients=$finalcampaign; | ||
| 683 | $usercampaign1->data=$data; | ||
| 684 | $usercampaign1->save(); | ||
| 685 | //DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',clients='$finalcampaign',data='$data' where username='$agent'"); | ||
| 686 | } | ||
| 687 | } | ||
| 688 | |||
| 689 | return; | ||
| 690 | } | ||
| 691 | if($id=="schedulecampaign"){ | ||
| 692 | $campaign = Input::get("selectCampaignField"); | ||
| 693 | $starttime = Input::get("starttime"); | ||
| 694 | $endtime = Input::get("endtime"); | ||
| 695 | //return view("layout.module.outputreport.supervisorreport", $data); | ||
| 696 | /*$updateschedule = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); | ||
| 697 | $updateschedule->campaignstartdate=$starttime; | ||
| 698 | $updateschedule->campaignenddate=$endtime; | ||
| 699 | $updateschedule->save();*/ | ||
| 700 | /* $scheduledCampaign = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->get(); | ||
| 701 | $data['scheduledCampaign']=$scheduledCampaign; | ||
| 702 | return view("layout/module/campaign/campaignScheduler",$data);*/ | ||
| 703 | DB::statement("update hrms_masters set campaignstartdate='$starttime:00',campaignenddate='$endtime:00' where mkey='$campaign' and mtype='company'"); | ||
| 704 | } | ||
| 705 | |||
| 706 | if($id=="bulkupload"){ | ||
| 707 | return view("layout.module.campaign.bulkupload"); | ||
| 708 | } | ||
| 709 | |||
| 710 | if($id=='deleteAssignDisposition'){ | ||
| 711 | $wakka = new KHRMSLib(); | ||
| 712 | $campaign = Input::get("selectCampaignField"); | ||
| 713 | $disposition = Input::get("disposition"); | ||
| 714 | echo $disposition; | ||
| 715 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 716 | if($hrmsdata->count() > 0){ | ||
| 717 | $hrmsdata = $hrmsdata->first(); | ||
| 718 | $dispolist=explode("~",$hrmsdata->mvalue); | ||
| 719 | $dispositionList = array(); | ||
| 720 | $mvalue = ''; | ||
| 721 | foreach ($dispolist as $key => $dispo) { | ||
| 722 | if(!empty($dispo)) | ||
| 723 | { | ||
| 724 | $dispoprts=explode("|",$dispo); | ||
| 725 | if($dispoprts[1] != $disposition){ | ||
| 726 | if(empty($mvalue)){ | ||
| 727 | $mvalue .= "$dispo"; | ||
| 728 | }else{ | ||
| 729 | $mvalue .= "~$dispo"; | ||
| 730 | } | ||
| 731 | } | ||
| 732 | } | ||
| 733 | } | ||
| 734 | //echo $mvalue; | ||
| 735 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 736 | } | ||
| 737 | } | ||
| 738 | |||
| 739 | if($id=="assigndisposition"){ | ||
| 740 | $wakka = new KHRMSLib(); | ||
| 741 | $code = Input::get('code'); | ||
| 742 | $disposition = Input::get('disposition'); | ||
| 743 | $subDisposition = Input::get('subDisposition'); | ||
| 744 | $campaign = Input::get("selectCampaignField"); | ||
| 745 | |||
| 746 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 747 | if($hrmsdata->count() == 0){ | ||
| 748 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 749 | DB::table('hrms_masters')->insert(['mkey'=>$campaign, 'mtype'=>'coreconfig', 'mvalue'=>$mvalue,'status'=>'active']); | ||
| 750 | }else{ | ||
| 751 | $hrmsdata = $hrmsdata->first(); | ||
| 752 | if(!empty($hrmsdata->mvalue)){ | ||
| 753 | $dispolist=explode("~",$hrmsdata->mvalue); | ||
| 754 | $dispositionList = array(); | ||
| 755 | $mvalue = ''; | ||
| 756 | foreach ($dispolist as $key => $dispo) { | ||
| 757 | if(!empty($dispo)) | ||
| 758 | { | ||
| 759 | $dispoprts=explode("|",$dispo); | ||
| 760 | if($dispoprts[1] == $disposition){ | ||
| 761 | $mvalue = $hrmsdata->mvalue; | ||
| 762 | $mvalue = str_replace($dispoprts[2], $subDisposition, $mvalue); | ||
| 763 | |||
| 764 | } | ||
| 765 | } | ||
| 766 | } | ||
| 767 | if(empty($mvalue)){ | ||
| 768 | $mvalue .= $hrmsdata->mvalue."~$code|$disposition|$subDisposition"; | ||
| 769 | } | ||
| 770 | }else{ | ||
| 771 | |||
| 772 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 773 | } | ||
| 774 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 775 | } | ||
| 776 | |||
| 777 | } | ||
| 778 | |||
| 779 | if($id == "sampleDataExcel"){ | ||
| 780 | /*$objPHPExcel = new \PHPExcel(); | ||
| 781 | $objPHPExcel->getProperties() | ||
| 782 | ->setCreator("Temporaris") | ||
| 783 | ->setLastModifiedBy("Temporaris") | ||
| 784 | ->setTitle("Template Relevé des heures intérimaires") | ||
| 785 | ->setSubject("Template excel") | ||
| 786 | ->setDescription("Template excel permettant la création d'un ou plusieurs relevés d'heures") | ||
| 787 | ->setKeywords("Template excel"); | ||
| 788 | $objPHPExcel->setActiveSheetIndex(0); | ||
| 789 | $objPHPExcel->getActiveSheet()->SetCellValue('A1', "12"); | ||
| 790 | |||
| 791 | $writer = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); | ||
| 792 | header('Content-Type: application/vnd.ms-excel'); | ||
| 793 | header('Content-Disposition: attachment;filename="excel.xls"'); | ||
| 794 | header('Cache-Control: max-age=0'); | ||
| 795 | |||
| 796 | $writer->save('php://output'); | ||
| 797 | |||
| 798 | return ;*/ | ||
| 799 | |||
| 800 | return view("layout.module.campaign.sampleDataExcel"); | ||
| 801 | } | ||
| 802 | |||
| 803 | return; | ||
| 804 | } | ||
| 805 | |||
| 806 | public function edit($id) | ||
| 807 | { | ||
| 808 | } | ||
| 809 | |||
| 810 | public function update($id) | ||
| 811 | { | ||
| 812 | } | ||
| 813 | |||
| 814 | public function destroy($id) | ||
| 815 | { | ||
| 816 | } | ||
| 817 | |||
| 818 | } |
| ... | @@ -10,6 +10,9 @@ use Response; | ... | @@ -10,6 +10,9 @@ use Response; |
| 10 | use App\Models\User; | 10 | use App\Models\User; |
| 11 | use SimpleXLSX; | 11 | use SimpleXLSX; |
| 12 | use App\Jobs\KHRMSLib; | 12 | use App\Jobs\KHRMSLib; |
| 13 | use App\Models\Disposition; | ||
| 14 | use App\Models\SubDisposition; | ||
| 15 | use App\Models\DispositionPlan; | ||
| 13 | 16 | ||
| 14 | class CampaignController extends Controller { | 17 | class CampaignController extends Controller { |
| 15 | 18 | ||
| ... | @@ -64,13 +67,6 @@ class CampaignController extends Controller { | ... | @@ -64,13 +67,6 @@ class CampaignController extends Controller { |
| 64 | $highestColumn = count($objWorksheet[0]); | 67 | $highestColumn = count($objWorksheet[0]); |
| 65 | $highestrow=count($objWorksheet); | 68 | $highestrow=count($objWorksheet); |
| 66 | 69 | ||
| 67 | //echo "<pre>";print_r($objWorksheet); | ||
| 68 | //echo "\n"; | ||
| 69 | //print_r($highestColumn); | ||
| 70 | //echo "\n"; | ||
| 71 | |||
| 72 | //echo $highestrow; | ||
| 73 | |||
| 74 | for($i=0;$i<$highestrow;$i++) | 70 | for($i=0;$i<$highestrow;$i++) |
| 75 | {//echo $i; | 71 | {//echo $i; |
| 76 | $excelarray[$i]=array(); | 72 | $excelarray[$i]=array(); |
| ... | @@ -88,8 +84,6 @@ class CampaignController extends Controller { | ... | @@ -88,8 +84,6 @@ class CampaignController extends Controller { |
| 88 | } | 84 | } |
| 89 | } | 85 | } |
| 90 | 86 | ||
| 91 | //echo "<pre>";print_r($excelarray); | ||
| 92 | |||
| 93 | for($i=1;$i<$highestrow;$i++) | 87 | for($i=1;$i<$highestrow;$i++) |
| 94 | { | 88 | { |
| 95 | if($excelarray[$i]["name"]!="" || $excelarray[$i]["name"]!="0" || $excelarray[$i]["name"]!=0 ) | 89 | if($excelarray[$i]["name"]!="" || $excelarray[$i]["name"]!="0" || $excelarray[$i]["name"]!=0 ) |
| ... | @@ -129,13 +123,21 @@ class CampaignController extends Controller { | ... | @@ -129,13 +123,21 @@ class CampaignController extends Controller { |
| 129 | $usercampaign->clients=$campaignList; | 123 | $usercampaign->clients=$campaignList; |
| 130 | $usercampaign->data=$data; | 124 | $usercampaign->data=$data; |
| 131 | $usercampaign->save(); | 125 | $usercampaign->save(); |
| 132 | } | 126 | }else{ |
| 133 | 127 | ||
| 128 | $discardedData[] = $excelarray[$i]["name"]; | ||
| 129 | |||
| 130 | } | ||
| 134 | 131 | ||
| 135 | } | 132 | } |
| 136 | } | 133 | } |
| 137 | } | 134 | } |
| 138 | 135 | ||
| 136 | // download discarded data | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 139 | } | 141 | } |
| 140 | } | 142 | } |
| 141 | 143 | ||
| ... | @@ -237,41 +239,26 @@ class CampaignController extends Controller { | ... | @@ -237,41 +239,26 @@ class CampaignController extends Controller { |
| 237 | $gthis = new KHRMSLib(); | 239 | $gthis = new KHRMSLib(); |
| 238 | $campaign = Input::get("campaign"); | 240 | $campaign = Input::get("campaign"); |
| 239 | 241 | ||
| 240 | $mastersdata=$gthis->getCompanyMaster($campaign); | 242 | $dispositionPlans=DispositionPlan::where("status","=","active")->get(); |
| 241 | $disposition = array(); | ||
| 242 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList']; | ||
| 243 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | ||
| 244 | foreach($dispoarr as $dispo) | ||
| 245 | { | ||
| 246 | if(!empty($dispo)) | ||
| 247 | { | ||
| 248 | $dispoprts=explode("|",$dispo); | ||
| 249 | if(sizeof($dispoprts)>=3) | ||
| 250 | { | ||
| 251 | $disposition[$dispoprts[1]] = $dispoprts[2]; | ||
| 252 | $dispositionCode[$dispoprts[1]] = $dispoprts[0]; | ||
| 253 | /*$data.="dialerdispoarray['$dispoprts[1]']='$dispoprts[2]'; | ||
| 254 | dispoClassArray['$dispoprts[0]']='$dispoprts[1]';";*/ | ||
| 255 | } | ||
| 256 | } | ||
| 257 | } | ||
| 258 | $data['disposition'] = $disposition; | ||
| 259 | $data['dispositionCode'] = $dispositionCode; | ||
| 260 | 243 | ||
| 244 | $data['dispositionPlans'] = $dispositionPlans; | ||
| 261 | 245 | ||
| 262 | $dispositionList=DB::table('hrms_masters')->select('*')->where('status','=','Active')->where("mkey","=",$campaign)->where("mtype","=",'coreconfig')->first(); | 246 | $data['selectedDispositionPlan'] = DB::table('campaign_disposition_plan') |
| 247 | ->join('disposition_plan', 'campaign_disposition_plan.dispo_plan_id', '=', 'disposition_plan.id') | ||
| 248 | //->select('disposition_plan.name as name ', 'disposition_plan.id as planid')->where("campaign","=",$campaign)->first(); | ||
| 249 | ->select('disposition_plan.name as name ', 'disposition_plan.id as planid') | ||
| 250 | ->where("campaign","=",$campaign) | ||
| 251 | ->where("disposition_plan.status","active") | ||
| 252 | ->first(); | ||
| 263 | 253 | ||
| 264 | $dispolist=explode("~",$dispositionList->mvalue); | 254 | $data['dispositionList'] = DB::table('campaign_disposition_plan') |
| 265 | $dispositionList = array(); | 255 | ->join('disposition_plan_config', 'campaign_disposition_plan.dispo_plan_id', '=', 'disposition_plan_config.dispo_plan_id') |
| 266 | foreach ($dispolist as $key => $dispo) { | 256 | ->join('disposition_plan', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') |
| 267 | if(!empty($dispo)) | 257 | ->select('disposition_plan_config.disposition as disposition ', 'disposition_plan_config.sub_disposition as subDisposition') |
| 268 | { | 258 | ->where("campaign","=",$campaign) |
| 269 | $dispoprts=explode("|",$dispo); | 259 | ->where("disposition_plan.status","active") |
| 270 | $dispositionList[$dispoprts[1]]= $dispoprts[2]; | 260 | ->get(); |
| 271 | } | ||
| 272 | } | ||
| 273 | 261 | ||
| 274 | $data['dispositionList'] = $dispositionList; | ||
| 275 | //$campaign = Input::get("campaign"); | 262 | //$campaign = Input::get("campaign"); |
| 276 | if($campaign != ""){ | 263 | if($campaign != ""){ |
| 277 | //this condition for getting all campaign data | 264 | //this condition for getting all campaign data |
| ... | @@ -294,6 +281,7 @@ class CampaignController extends Controller { | ... | @@ -294,6 +281,7 @@ class CampaignController extends Controller { |
| 294 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); | 281 | // $data['dataList'] = DB::table("records")->select(DB::Raw('list_id, count(*) as recordCount'))->where("client","=",$campaign)->groupBy('list_id')->get(); |
| 295 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); | 282 | $userassignedcampign=DB::table('users')->select('username','clients')->whereRaw(' FIND_IN_SET(?,clients)', [$campaign])->get(); |
| 296 | //$scheduledCampaign = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); | 283 | //$scheduledCampaign = Campaign::where("mtype","=","company")->where("mkey","=",$campaign)->first(); |
| 284 | // $data['pri_details'] = DB::table("pri_details")->where("server_ip","=",env('app_ip'))->get(); | ||
| 297 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); | 285 | return view("layout.module.campaign.campaign",$data,compact('userassignedcampign')); |
| 298 | } | 286 | } |
| 299 | 287 | ||
| ... | @@ -320,12 +308,10 @@ class CampaignController extends Controller { | ... | @@ -320,12 +308,10 @@ class CampaignController extends Controller { |
| 320 | 308 | ||
| 321 | if($campaign=="All") | 309 | if($campaign=="All") |
| 322 | { | 310 | { |
| 323 | // $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 324 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; | 311 | $selQuery = "SELECT $querySelect FROM records WHERE $queryConditions"; |
| 325 | $sqlQuery = DB::select($selQuery); | 312 | $sqlQuery = DB::select($selQuery); |
| 326 | }else | 313 | }else |
| 327 | { | 314 | { |
| 328 | //$selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions LIMIT $queryLimit OFFSET $queryOffset"; | ||
| 329 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; | 315 | $selQuery = "SELECT $querySelect FROM records WHERE client = '$campaign' AND $queryConditions"; |
| 330 | $sqlQuery = DB::select($selQuery); | 316 | $sqlQuery = DB::select($selQuery); |
| 331 | } | 317 | } |
| ... | @@ -336,6 +322,8 @@ class CampaignController extends Controller { | ... | @@ -336,6 +322,8 @@ class CampaignController extends Controller { |
| 336 | 322 | ||
| 337 | if(count($sqlQuery)){ | 323 | if(count($sqlQuery)){ |
| 338 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | 324 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; |
| 325 | }else{ | ||
| 326 | $output .="<p class='text-danger'>No result Found.</p>"; | ||
| 339 | } | 327 | } |
| 340 | return $output; | 328 | return $output; |
| 341 | } | 329 | } |
| ... | @@ -381,7 +369,7 @@ class CampaignController extends Controller { | ... | @@ -381,7 +369,7 @@ class CampaignController extends Controller { |
| 381 | $sqlQuery = DB::select($selQuery); | 369 | $sqlQuery = DB::select($selQuery); |
| 382 | } | 370 | } |
| 383 | 371 | ||
| 384 | if($sqlQuery){ | 372 | if($selQuery!=''){ |
| 385 | 373 | ||
| 386 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); | 374 | $queryExist = DB::table('campaign_query')->where('query','=',$selQuery)->where('campaign', '=', $campaign)->select('id')->first(); |
| 387 | 375 | ||
| ... | @@ -402,6 +390,8 @@ class CampaignController extends Controller { | ... | @@ -402,6 +390,8 @@ class CampaignController extends Controller { |
| 402 | 390 | ||
| 403 | if(count($sqlQuery)){ | 391 | if(count($sqlQuery)){ |
| 404 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; | 392 | $output .='<div><label>'.count($sqlQuery).'</label></div>'; |
| 393 | }else{ | ||
| 394 | $output .="<p class='text-danger'>No result found.</p>"; | ||
| 405 | } | 395 | } |
| 406 | /*$output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; | 396 | /*$output .= '<div style="overflow-x:auto;"><table class="table table-bordered"><thead><tr><th class="text-center">#</th>'; |
| 407 | foreach ($fields as $key) { | 397 | foreach ($fields as $key) { |
| ... | @@ -542,7 +532,7 @@ class CampaignController extends Controller { | ... | @@ -542,7 +532,7 @@ class CampaignController extends Controller { |
| 542 | $queryCond=DB::table('campaign_query')->where('id','=',$campQryId)->where('campaign','=',$campaign)->select('where_cond'); | 532 | $queryCond=DB::table('campaign_query')->where('id','=',$campQryId)->where('campaign','=',$campaign)->select('where_cond'); |
| 543 | if($queryCond->count() > 0){ | 533 | if($queryCond->count() > 0){ |
| 544 | $queryCond = $queryCond->first(); | 534 | $queryCond = $queryCond->first(); |
| 545 | DB::update(DB::raw("UPDATE records set filter_condition='1' where $queryCond->where_cond")); | 535 | DB::update(DB::raw("UPDATE records_$campaign set filter_condition='1' where $queryCond->where_cond")); |
| 546 | } | 536 | } |
| 547 | return; | 537 | return; |
| 548 | //return "<script>simpleNotification('success','topRight','Query Logic Successfully Applied');</script>"; | 538 | //return "<script>simpleNotification('success','topRight','Query Logic Successfully Applied');</script>"; |
| ... | @@ -734,9 +724,88 @@ class CampaignController extends Controller { | ... | @@ -734,9 +724,88 @@ class CampaignController extends Controller { |
| 734 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | 724 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); |
| 735 | } | 725 | } |
| 736 | } | 726 | } |
| 737 | 727 | if($id=="campaignpri"){ | |
| 728 | $selected = Input::get("select"); | ||
| 729 | $client = Input::get("campaignField"); | ||
| 730 | //echo "selected".$selected; | ||
| 731 | DB::statement("update hrms_masters set pri_line='$selected' where mkey='$client' and mtype='company'"); | ||
| 732 | } | ||
| 738 | if($id=="assigndisposition"){ | 733 | if($id=="assigndisposition"){ |
| 739 | $wakka = new KHRMSLib(); | 734 | $wakka = new KHRMSLib(); |
| 735 | $planId = Input::get('plan'); | ||
| 736 | $campaign = Input::get("selectCampaignField"); | ||
| 737 | |||
| 738 | $campaignDispositionPlan = DB::table('campaign_disposition_plan')->where('campaign','=', $campaign)->select('*'); | ||
| 739 | |||
| 740 | if($campaignDispositionPlan->count() > 0){ | ||
| 741 | DB::table('campaign_disposition_plan')->where('campaign','=', $campaign)->update(['dispo_plan_id' => $planId,'updated_at'=>date("Y-m-d H:i:s")]); | ||
| 742 | }else{ | ||
| 743 | DB::table('campaign_disposition_plan')->insert(['campaign'=>$campaign,'dispo_plan_id'=>$planId, 'created_at'=>date("Y-m-d H:i:s"),'updated_at'=>date("Y-m-d H:i:s")]); | ||
| 744 | } | ||
| 745 | |||
| 746 | $dispositionEntities = DispositionPlan::join('disposition_plan_config', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 747 | ->join('disposition', 'disposition.name', '=', 'disposition_plan_config.disposition') | ||
| 748 | ->select('disposition_plan.id as dispositionPlanId', 'disposition_plan.name as name','disposition_plan.status AS status','disposition.code AS code','disposition_plan_config.disposition as disposition','disposition_plan_config.sub_disposition as sub_disposition') | ||
| 749 | ->where('disposition_plan.id','=',$planId) | ||
| 750 | ->where('disposition.status','active') | ||
| 751 | ->get(); | ||
| 752 | |||
| 753 | if($dispositionEntities->count() > 0){ | ||
| 754 | $mvalue = ''; | ||
| 755 | foreach ($dispositionEntities as $key => $dispositionEntity) { | ||
| 756 | $code = $dispositionEntity->code; | ||
| 757 | $disposition = $dispositionEntity->disposition; | ||
| 758 | $subDisposition = $dispositionEntity->sub_disposition; | ||
| 759 | |||
| 760 | if(!empty($mvalue)){ | ||
| 761 | $mvalue = $mvalue."~$code|$disposition|$subDisposition"; | ||
| 762 | }else{ | ||
| 763 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 764 | } | ||
| 765 | } | ||
| 766 | |||
| 767 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 768 | if($hrmsdata->count() == 0){ | ||
| 769 | DB::table('hrms_masters')->insert(['mkey'=>$campaign, 'mtype'=>'coreconfig', 'mvalue'=>$mvalue,'status'=>'active']); | ||
| 770 | }else{ | ||
| 771 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 772 | } | ||
| 773 | |||
| 774 | } | ||
| 775 | |||
| 776 | /*foreach ($plans as $key => $plan) { | ||
| 777 | $dispositionPlan = Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 778 | ->select('disposition.id as dispoId', 'disposition.plan AS plan', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 779 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 780 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 781 | ->where("plan","=",$plan) | ||
| 782 | ->groupBy('sub_disposition.dispo_id') | ||
| 783 | ->get(); | ||
| 784 | |||
| 785 | if($dispositionPlan->count() > 0){ | ||
| 786 | $dispositionPlan = $dispositionPlan->first(); | ||
| 787 | $code = $dispositionPlan->code; | ||
| 788 | $disposition = $dispositionPlan->disposition; | ||
| 789 | $subDisposition = $dispositionPlan->sunDispoName; | ||
| 790 | |||
| 791 | $hrmsdata = DB::table('hrms_masters')->where('mkey','=', $campaign)->where('mtype','=', 'coreconfig')->select('*'); | ||
| 792 | if($hrmsdata->count() == 0){ | ||
| 793 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 794 | DB::table('hrms_masters')->insert(['mkey'=>$campaign, 'mtype'=>'coreconfig', 'mvalue'=>$mvalue,'status'=>'active']); | ||
| 795 | }else{ | ||
| 796 | $hrmsdata = $hrmsdata->first(); | ||
| 797 | if(!empty($hrmsdata->mvalue)){ | ||
| 798 | $mvalue .= $hrmsdata->mvalue."~$code|$disposition|$subDisposition"; | ||
| 799 | }else{ | ||
| 800 | $mvalue = "$code|$disposition|$subDisposition"; | ||
| 801 | } | ||
| 802 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | ||
| 803 | } | ||
| 804 | } | ||
| 805 | }*/ | ||
| 806 | |||
| 807 | |||
| 808 | /*$wakka = new KHRMSLib(); | ||
| 740 | $code = Input::get('code'); | 809 | $code = Input::get('code'); |
| 741 | $disposition = Input::get('disposition'); | 810 | $disposition = Input::get('disposition'); |
| 742 | $subDisposition = Input::get('subDisposition'); | 811 | $subDisposition = Input::get('subDisposition'); |
| ... | @@ -771,32 +840,40 @@ class CampaignController extends Controller { | ... | @@ -771,32 +840,40 @@ class CampaignController extends Controller { |
| 771 | $mvalue = "$code|$disposition|$subDisposition"; | 840 | $mvalue = "$code|$disposition|$subDisposition"; |
| 772 | } | 841 | } |
| 773 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); | 842 | $wakka->Query("update hrms_masters set mvalue='$mvalue' where mkey='$campaign' and mtype='coreconfig';"); |
| 774 | } | 843 | }*/ |
| 775 | |||
| 776 | } | 844 | } |
| 777 | 845 | ||
| 778 | if($id == "sampleDataExcel"){ | 846 | if($id == "sampleDataExcel"){ |
| 779 | /*$objPHPExcel = new \PHPExcel(); | 847 | /*include_once(app_path().'/lib/phpexcel/PHPExcel.php'); |
| 780 | $objPHPExcel->getProperties() | 848 | $objPHPExcel = new \PHPExcel(); |
| 781 | ->setCreator("Temporaris") | ||
| 782 | ->setLastModifiedBy("Temporaris") | ||
| 783 | ->setTitle("Template Relevé des heures intérimaires") | ||
| 784 | ->setSubject("Template excel") | ||
| 785 | ->setDescription("Template excel permettant la création d'un ou plusieurs relevés d'heures") | ||
| 786 | ->setKeywords("Template excel"); | ||
| 787 | $objPHPExcel->setActiveSheetIndex(0); | 849 | $objPHPExcel->setActiveSheetIndex(0); |
| 788 | $objPHPExcel->getActiveSheet()->SetCellValue('A1', "12"); | 850 | $objPHPExcel->getActiveSheet()->SetCellValue('A1', "campaign"); |
| 851 | $objPHPExcel->getActiveSheet()->SetCellValue('A2', "C1"); | ||
| 852 | $objPHPExcel->getActiveSheet()->SetCellValue('A3', "C1"); | ||
| 853 | $objPHPExcel->getActiveSheet()->SetCellValue('A4', "C2"); | ||
| 854 | $objPHPExcel->getActiveSheet()->SetCellValue('A5', "C2"); | ||
| 855 | $objPHPExcel->getActiveSheet()->SetCellValue('B1', "name"); | ||
| 856 | $objPHPExcel->getActiveSheet()->SetCellValue('B2', "U1"); | ||
| 857 | $objPHPExcel->getActiveSheet()->SetCellValue('B3', "U2"); | ||
| 858 | $objPHPExcel->getActiveSheet()->SetCellValue('B4', "U1"); | ||
| 859 | $objPHPExcel->getActiveSheet()->SetCellValue('B5', "U3"); | ||
| 789 | 860 | ||
| 790 | $writer = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); | 861 | $writer = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); |
| 791 | header('Content-Type: application/vnd.ms-excel'); | 862 | header('Content-Type: application/vnd.ms-excel'); |
| 792 | header('Content-Disposition: attachment;filename="excel.xls"'); | 863 | header('Content-Disposition: attachment;filename="campaignUserMappingExcelFormat.xls"'); |
| 793 | header('Cache-Control: max-age=0'); | 864 | header('Cache-Control: max-age=0'); |
| 794 | 865 | ||
| 795 | $writer->save('php://output'); | 866 | $writer->save('php://output');*/ |
| 796 | 867 | ||
| 797 | return ;*/ | 868 | //$filepath = "assets/extras/campaignUserMappingFormat.xlsx"; |
| 869 | $action = Input::get('action'); | ||
| 798 | 870 | ||
| 799 | return view("layout.module.campaign.sampleDataExcel"); | 871 | if($action == 'upload'){ |
| 872 | $filepath = "assets/extras/MultipleUserCampaignUploadFormat.xlsx"; | ||
| 873 | }else if($action == 'bulkupload'){ | ||
| 874 | $filepath = "assets/extras/MultipleUserMultipleCampaignUploadFormat.xlsx"; | ||
| 875 | } | ||
| 876 | return Response::download($filepath); | ||
| 800 | } | 877 | } |
| 801 | 878 | ||
| 802 | return; | 879 | return; | ... | ... |
| ... | @@ -77,7 +77,7 @@ class DialModeController extends Controller { | ... | @@ -77,7 +77,7 @@ class DialModeController extends Controller { |
| 77 | 77 | ||
| 78 | $data['client'] = $client; | 78 | $data['client'] = $client; |
| 79 | $data['username'] = $username; | 79 | $data['username'] = $username; |
| 80 | 80 | $data['callingmodeArr'] = array("Progressive", "Manual", "Incoming", "Predictive"); | |
| 81 | 81 | ||
| 82 | return view('layout.module.dialmode.index',$data); | 82 | return view('layout.module.dialmode.index',$data); |
| 83 | } | 83 | } | ... | ... |
| ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; | ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; |
| 12 | use App\Models\CRM; | 12 | use App\Models\CRM; |
| 13 | use App\Models\CRMCampaign; | 13 | use App\Models\CRMCampaign; |
| 14 | use App\Models\CRMList; | 14 | use App\Models\CRMList; |
| 15 | use App\Models\Cutoff; | ||
| 15 | use App\Jobs\KHRMSLib; | 16 | use App\Jobs\KHRMSLib; |
| 16 | use App\Models\Sipid; | 17 | use App\Models\Sipid; |
| 17 | use App\Models\Dialline; | 18 | use App\Models\Dialline; |
| ... | @@ -149,23 +150,30 @@ class DialerController extends Controller { | ... | @@ -149,23 +150,30 @@ class DialerController extends Controller { |
| 149 | $oclientlst=$wakka->clientsReadAccess(); | 150 | $oclientlst=$wakka->clientsReadAccess(); |
| 150 | //print_r($oclientlst); | 151 | //print_r($oclientlst); |
| 151 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 152 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 152 | |||
| 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 154 | |||
| 155 | $users=array();$searchresult=""; | 154 | $users=array();$searchresult=""; |
| 156 | if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1"); | 155 | $client=Input::get("client"); |
| 157 | else $users=$this->getCallSequencing(1); | 156 | if($client==''||$client==undefined){ |
| 157 | $client=""; | ||
| 158 | } | ||
| 159 | //$client=$this->campaignlist($client); | ||
| 160 | if(!empty($kstychCall["previewcrmid"])){ | ||
| 161 | $users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' limit 1",$client);} | ||
| 162 | else{ | ||
| 163 | $users=$this->getCallSequencing(1); | ||
| 164 | } | ||
| 158 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); | 165 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); |
| 159 | if($users[0]['id']>0){ | 166 | if($users[0]['id']>0){ |
| 160 | Log::info("1----".$users[0]['id']); | 167 | if($client!=''){ |
| 161 | DB::table('records')->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); | 168 | DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); |
| 169 | } | ||
| 162 | } | 170 | } |
| 163 | if(!empty($users)) | 171 | if(!empty($users)) |
| 164 | { | 172 | { |
| 165 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; | 173 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; |
| 166 | 174 | ||
| 167 | $searchresult.="<div id=internalid_matchlist></div><script> | 175 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 168 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 176 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 169 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 177 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 170 | }); | 178 | }); |
| 171 | </script>"; | 179 | </script>"; |
| ... | @@ -187,7 +195,13 @@ class DialerController extends Controller { | ... | @@ -187,7 +195,13 @@ class DialerController extends Controller { |
| 187 | $oclientlst=$wakka->clientsReadAccess(); | 195 | $oclientlst=$wakka->clientsReadAccess(); |
| 188 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 196 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 189 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 197 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 198 | //Log::info("newcall-->> ".$roclientstr); | ||
| 199 | $client=Input::get("client"); | ||
| 190 | 200 | ||
| 201 | if($client==''||$client==undefined){ | ||
| 202 | $client=''; | ||
| 203 | } | ||
| 204 | //$client=$this->campaignlist($client); | ||
| 191 | $users=array();$callnumber=$kstychCall['callnumber']; | 205 | $users=array();$callnumber=$kstychCall['callnumber']; |
| 192 | if($kstychCall['crmid']) | 206 | if($kstychCall['crmid']) |
| 193 | { | 207 | { |
| ... | @@ -213,7 +227,7 @@ class DialerController extends Controller { | ... | @@ -213,7 +227,7 @@ class DialerController extends Controller { |
| 213 | altphone7 like '%".substr($callnumber,-10)."' OR | 227 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 214 | altphone8 like '%".substr($callnumber,-10)."' OR | 228 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 215 | altphone9 like '%".substr($callnumber,-10)."' OR | 229 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 216 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid $roclientstr "); | 230 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid ",$client); |
| 217 | 231 | ||
| 218 | 232 | ||
| 219 | } | 233 | } |
| ... | @@ -229,7 +243,7 @@ class DialerController extends Controller { | ... | @@ -229,7 +243,7 @@ class DialerController extends Controller { |
| 229 | altphone7 like '%".substr($callnumber,-10)."' OR | 243 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 230 | altphone8 like '%".substr($callnumber,-10)."' OR | 244 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 231 | altphone9 like '%".substr($callnumber,-10)."' OR | 245 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 232 | altphone10 like '%".substr($callnumber,-10)."' $roclientstr"); | 246 | altphone10 like '%".substr($callnumber,-10)."'",$client); |
| 233 | 247 | ||
| 234 | } | 248 | } |
| 235 | 249 | ||
| ... | @@ -246,7 +260,7 @@ class DialerController extends Controller { | ... | @@ -246,7 +260,7 @@ class DialerController extends Controller { |
| 246 | altphone7 like '%$callnumber' OR | 260 | altphone7 like '%$callnumber' OR |
| 247 | altphone8 like '%$callnumber' OR | 261 | altphone8 like '%$callnumber' OR |
| 248 | altphone9 like '%$callnumber' OR | 262 | altphone9 like '%$callnumber' OR |
| 249 | altphone10 like '%$callnumber' ) and id in ($idstr) $roclientstr"); | 263 | altphone10 like '%$callnumber' ) and id in ($idstr)",$client); |
| 250 | 264 | ||
| 251 | if(!$users) | 265 | if(!$users) |
| 252 | { | 266 | { |
| ... | @@ -256,8 +270,8 @@ class DialerController extends Controller { | ... | @@ -256,8 +270,8 @@ class DialerController extends Controller { |
| 256 | 270 | ||
| 257 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") | 271 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") |
| 258 | { | 272 | { |
| 259 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' $roclientstr limit 1"); | 273 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' limit 1",$client); |
| 260 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1"); | 274 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1",$client); |
| 261 | else $users=$this->getCallSequencing(1); | 275 | else $users=$this->getCallSequencing(1); |
| 262 | } | 276 | } |
| 263 | 277 | ||
| ... | @@ -275,7 +289,7 @@ class DialerController extends Controller { | ... | @@ -275,7 +289,7 @@ class DialerController extends Controller { |
| 275 | 289 | ||
| 276 | if($kstychDialer['mDialerState']=="Manual"){ | 290 | if($kstychDialer['mDialerState']=="Manual"){ |
| 277 | if(!is_numeric($callnumber) || strlen($callnumber)<6){ | 291 | if(!is_numeric($callnumber) || strlen($callnumber)<6){ |
| 278 | return Response::make("<script>simpleNotification('error','topRight','Please enter a valid phone number');</script>"); | 292 | return Response::make("<simpleNotification('error','topRight','Please enter a valid phone number');</script>"); |
| 279 | } | 293 | } |
| 280 | } | 294 | } |
| 281 | 295 | ||
| ... | @@ -296,14 +310,57 @@ class DialerController extends Controller { | ... | @@ -296,14 +310,57 @@ class DialerController extends Controller { |
| 296 | 310 | ||
| 297 | $calleridarr=explode(":",$callerid);$dspan="1"; | 311 | $calleridarr=explode(":",$callerid);$dspan="1"; |
| 298 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} | 312 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} |
| 313 | /*$calleridarr=explode(":",env("non_open")); | ||
| 314 | $callerid=$calleridarr[0]; | ||
| 315 | $dspan =$calleridarr[1]; | ||
| 316 | }*/ | ||
| 299 | 317 | ||
| 300 | //see if user is online on this sipid | 318 | //see if user is online on this sipid |
| 301 | $sipid=Sipid::find($kstychDialer['phone']); | 319 | $sipid=Sipid::find($kstychDialer['phone']); |
| 302 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 320 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| 303 | { | 321 | { |
| 304 | 322 | //echo $client."--".$ppldata['client']; | |
| 323 | if($client=='')$client=$ppldata['client']; | ||
| 305 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1")->where("server","=",env("app_ip")); | 324 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1")->where("server","=",env("app_ip")); |
| 306 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | 325 | $master=DB::table('hrms_masters')->select('pri_line')->where('mkey','=',$client)->where('mtype','=','company')->first(); |
| 326 | //echo $ppldata['client']; | ||
| 327 | $diallineenabled=DB::table('diallines')->distinct('dspan')->where('enabled','=','1')->where("server","=",env("app_ip"))->groupBy('dspan')->get(); | ||
| 328 | $count=0; | ||
| 329 | foreach($diallineenabled as $diallines){ | ||
| 330 | $count++; | ||
| 331 | } | ||
| 332 | $callerid=""; | ||
| 333 | if($master->pri_line!=''){ | ||
| 334 | if($count>2){ | ||
| 335 | if($master->pri_line=='open'){ | ||
| 336 | $dialline->where('dspan','>=','3'); | ||
| 337 | }else if($master->pri_line=='non-open'){ | ||
| 338 | $dialline->where('dspan','<=','2'); | ||
| 339 | } | ||
| 340 | |||
| 341 | }else if($count<3){ | ||
| 342 | //echo $count; | ||
| 343 | //echo $master->pri_line; | ||
| 344 | if($master->pri_line=='open'){ | ||
| 345 | $dialline->where('dspan','=','2'); | ||
| 346 | $callerid=env("openline"); | ||
| 347 | }else if($master->pri_line=='non-open'){ | ||
| 348 | $dialline->where('dspan','=','1'); | ||
| 349 | $callerid=env("140line"); | ||
| 350 | } | ||
| 351 | } | ||
| 352 | }else{ | ||
| 353 | return Response::make("<script>simpleNotification('error','topRight','No PRI Lines Selected Please Contact to Your Admin!');</script>"); | ||
| 354 | /*$callerid="";if(!empty($mastersdata["DialerDID"]))$callerid=$mastersdata["DialerDID"]; | ||
| 355 | if($callerid=="")$callerid=Auth::user()->exten; | ||
| 356 | $dspan="1"; | ||
| 357 | $calleridarr=explode(":",$callerid); | ||
| 358 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1]; | ||
| 359 | } | ||
| 360 | if($dspan!="")$dialline->where('dspan','=',$dspan);*/ | ||
| 361 | |||
| 362 | } | ||
| 363 | //if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | ||
| 307 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); | 364 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); |
| 308 | 365 | ||
| 309 | if($dialline) | 366 | if($dialline) |
| ... | @@ -339,12 +396,15 @@ class DialerController extends Controller { | ... | @@ -339,12 +396,15 @@ class DialerController extends Controller { |
| 339 | $crmcall->data=json_encode($tdata); | 396 | $crmcall->data=json_encode($tdata); |
| 340 | $crmcall->save(); | 397 | $crmcall->save(); |
| 341 | if($users[0]['id']>0){ | 398 | if($users[0]['id']>0){ |
| 342 | DB::table('records')->where('id',$users[0]['id'])->update(['filter_condition'=>'3','usr_id'=>Auth::user()->id]); | 399 | if($client!='')$records='records_'.$client;else $records='records'; |
| 400 | |||
| 401 | DB::table($records)->where('id',$users[0]['id'])->update(['filter_condition'=>'3','usr_id'=>Auth::user()->id]); | ||
| 402 | DB::table('records')->where('id',$users[0]['id'])->update(['usr_id'=>Auth::user()->id]); | ||
| 343 | } | 403 | } |
| 344 | //start actual calls | 404 | //start actual calls |
| 345 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); | 405 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); |
| 346 | $preppldata['peopledata'] = serialize($ppldata); | 406 | $preppldata['peopledata'] = serialize($ppldata); |
| 347 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata); | 407 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,$client); $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,""); |
| 348 | 408 | ||
| 349 | $newqueue=new Kqueue(); | 409 | $newqueue=new Kqueue(); |
| 350 | $newqueue->userToConf($sipid); | 410 | $newqueue->userToConf($sipid); |
| ... | @@ -357,7 +417,7 @@ class DialerController extends Controller { | ... | @@ -357,7 +417,7 @@ class DialerController extends Controller { |
| 357 | 417 | ||
| 358 | 418 | ||
| 359 | $searchresult.="<div id=internalid_matchlist></div><script> | 419 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 360 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 420 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 361 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 421 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 362 | }); | 422 | }); |
| 363 | </script>"; | 423 | </script>"; |
| ... | @@ -377,7 +437,8 @@ class DialerController extends Controller { | ... | @@ -377,7 +437,8 @@ class DialerController extends Controller { |
| 377 | } | 437 | } |
| 378 | else | 438 | else |
| 379 | { | 439 | { |
| 380 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber"); | 440 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",$client); |
| 441 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",""); | ||
| 381 | 442 | ||
| 382 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); | 443 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); |
| 383 | } | 444 | } |
| ... | @@ -470,9 +531,118 @@ if($action=="addconfcall") | ... | @@ -470,9 +531,118 @@ if($action=="addconfcall") |
| 470 | return Response::make($retstr); | 531 | return Response::make($retstr); |
| 471 | } | 532 | } |
| 472 | 533 | ||
| 534 | if($action=="transfercall") | ||
| 535 | { | ||
| 536 | $retstr=""; | ||
| 537 | $callnumber=Input::get("confnumber"); | ||
| 538 | $callerid=""; | ||
| 539 | //see if user is online on this sipid | ||
| 540 | $sipid=Sipid::find($kstychDialer['phone']); | ||
| 541 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | ||
| 542 | { | ||
| 543 | $oldcrmcall=CRMCall::find($kstychCall['callid']); | ||
| 544 | if($oldcrmcall) | ||
| 545 | { | ||
| 546 | $olddialline=Dialline::find($oldcrmcall->dialline_id); | ||
| 547 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; | ||
| 548 | |||
| 549 | // $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | ||
| 550 | // if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | ||
| 551 | // $dialline=$dialline->orderBy('updated_at','ASC')->first(); | ||
| 552 | |||
| 553 | if($olddialline) | ||
| 554 | { | ||
| 555 | $callerid=$oldcrmcall->did; | ||
| 556 | |||
| 557 | // $dialline->status="transfer"; | ||
| 558 | // $dialline->channel=$olddialline->channel; | ||
| 559 | // $dialline->save(); | ||
| 560 | |||
| 561 | $nowts=microtime(true)*1000; | ||
| 562 | |||
| 563 | //start the call log | ||
| 564 | $crmcall=new CRMCall(); | ||
| 565 | $crmcall->number=$callnumber; | ||
| 566 | $crmcall->user_id=Auth::user()->id; | ||
| 567 | $crmcall->sipid_id=$sipid->id; | ||
| 568 | $crmcall->crm_id=$oldcrmcall->crm_id; | ||
| 569 | $crmcall->client=$oldcrmcall->client; | ||
| 570 | $crmcall->department=$oldcrmcall->department; | ||
| 571 | $crmcall->state='New'; | ||
| 572 | $crmcall->userstatus='Transfer'; | ||
| 573 | $crmcall->usersubstatus='Transfer'; | ||
| 574 | $crmcall->type='Transfer'; | ||
| 575 | //$crmcall->dialline_id=$dialline->id; | ||
| 576 | |||
| 577 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 578 | $crmcall->setTs('ts_Call',$nowts); | ||
| 579 | |||
| 580 | $crmcall->did=$callerid; | ||
| 581 | |||
| 582 | $tdata=array(); | ||
| 583 | $crmcall->data=json_encode($tdata); | ||
| 584 | $crmcall->save(); | ||
| 585 | |||
| 586 | |||
| 587 | $newqueue=new Kqueue(); | ||
| 588 | $newqueue->transferCall($sipid,$callnumber,$callerid,$crmcall,$olddialline); | ||
| 589 | //start actual calls | ||
| 590 | // $newqueue=new Kqueue(); | ||
| 591 | // $newqueue->userToConf($sipid); | ||
| 592 | // $newqueue=new Kqueue(); | ||
| 593 | // $newqueue->custToConf($sipid,$callnumber,$callerid,$crmcall,$dialline); | ||
| 594 | |||
| 595 | $retstr=$crmcall->id; | ||
| 596 | } | ||
| 597 | else | ||
| 598 | { | ||
| 599 | $retstr="Error : No Lines Free to Dial!"; | ||
| 600 | } | ||
| 601 | } | ||
| 602 | else | ||
| 603 | { | ||
| 604 | $retstr="Error : No calls to conference found!"; | ||
| 605 | } | ||
| 606 | } | ||
| 607 | else | ||
| 608 | { | ||
| 609 | $retstr="Error : You Are Not Connected!"; | ||
| 610 | } | ||
| 611 | |||
| 612 | return Response::make($retstr); | ||
| 613 | } | ||
| 614 | |||
| 615 | |||
| 473 | if($action=="hangupall") | 616 | if($action=="hangupall") |
| 474 | { | 617 | { |
| 475 | $res=0; | 618 | $res=0; |
| 619 | $aUser = Auth::user(); | ||
| 620 | If($aUser->current_dialmode == "Predictive"){ | ||
| 621 | $avgTimeArr = array(); | ||
| 622 | $user_id = $aUser->id; | ||
| 623 | $campaign = $aUser->sel_campaign; | ||
| 624 | |||
| 625 | $avgTimeArr = $this->getAvgTimeArray($campaign, $user_id); | ||
| 626 | |||
| 627 | $cutOffUsrArr = Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->get(); | ||
| 628 | |||
| 629 | if(count($cutOffUsrArr)){ | ||
| 630 | Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->update( | ||
| 631 | ['hangup_time' => date('Y-m-d H:i:s'), | ||
| 632 | 'avg_dispo' => $avgTimeArr['avgdisposec'] | ||
| 633 | ]); | ||
| 634 | } | ||
| 635 | else | ||
| 636 | { | ||
| 637 | $cutoff = new Cutoff(); | ||
| 638 | $cutoff->user_id = $user_id; | ||
| 639 | $cutoff->c_name = $campaign; | ||
| 640 | $cutoff->hangup_time = date('Y-m-d H:i:s'); | ||
| 641 | $cutoff->avg_dispo = $avgTimeArr['avgdisposec']; | ||
| 642 | $cutoff->avg_ring = 0; | ||
| 643 | $cutoff->save(); | ||
| 644 | } | ||
| 645 | } | ||
| 476 | $callid=intval($kstychCall['callid'])+0; | 646 | $callid=intval($kstychCall['callid'])+0; |
| 477 | $crmcall=CRMCall::find($callid); | 647 | $crmcall=CRMCall::find($callid); |
| 478 | if($crmcall&&$crmcall->user_id==Auth::user()->id) | 648 | if($crmcall&&$crmcall->user_id==Auth::user()->id) |
| ... | @@ -545,12 +715,18 @@ if($action=="closecall") | ... | @@ -545,12 +715,18 @@ if($action=="closecall") |
| 545 | { | 715 | { |
| 546 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); | 716 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); |
| 547 | } | 717 | } |
| 718 | if($kstychCall["userappointment"]!="") | ||
| 719 | { | ||
| 720 | $kstychCall["userappointment"]=date("Y-m-d H:i:s",strtotime($kstychCall["userappointment"].":00")+((Auth::user()->timezone)*60)); | ||
| 721 | } | ||
| 548 | 722 | ||
| 549 | $crmcall->setTs('ts_Close',$nowts); | 723 | $crmcall->setTs('ts_Close',$nowts); |
| 550 | 724 | ||
| 551 | $crmcall->userstatus =$kstychCall["userstatus"]; | 725 | $crmcall->userstatus =$kstychCall["userstatus"]; |
| 552 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; | 726 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; |
| 553 | $crmcall->usercallback =$kstychCall["usercallback"]; | 727 | $crmcall->usercallback =$kstychCall["usercallback"]; |
| 728 | $crmcall->userappointmentdate =$kstychCall["userappointment"]; | ||
| 729 | //$user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 554 | //$kstychCall["attempt"]=''; | 730 | //$kstychCall["attempt"]=''; |
| 555 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; | 731 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; |
| 556 | $crmcall->call_flag="Z"; | 732 | $crmcall->call_flag="Z"; |
| ... | @@ -568,7 +744,8 @@ if($action=="closecall") | ... | @@ -568,7 +744,8 @@ if($action=="closecall") |
| 568 | { | 744 | { |
| 569 | $crmcall->crm_id=$kstychCall["crmid"]; | 745 | $crmcall->crm_id=$kstychCall["crmid"]; |
| 570 | 746 | ||
| 571 | $temparr=$wakka->getPerson($crmcall->crm_id); | 747 | $temparr=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 748 | |||
| 572 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; | 749 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; |
| 573 | } | 750 | } |
| 574 | } | 751 | } |
| ... | @@ -618,12 +795,14 @@ if($action=="closecall") | ... | @@ -618,12 +795,14 @@ if($action=="closecall") |
| 618 | $tcrmcall->save(); | 795 | $tcrmcall->save(); |
| 619 | 796 | ||
| 620 | 797 | ||
| 621 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | 798 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); |
| 799 | |||
| 800 | $tuser=$wakka->getPerson($tcrmid,$crmcall->client); | ||
| 622 | 801 | ||
| 623 | $tuser=$wakka->getPerson($tcrmid); | ||
| 624 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 802 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 625 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 803 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 626 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 804 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 805 | $tuser['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 627 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 806 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 628 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 807 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 629 | 808 | ||
| ... | @@ -643,22 +822,25 @@ if($action=="closecall") | ... | @@ -643,22 +822,25 @@ if($action=="closecall") |
| 643 | $tuser['supcomntid']=$kstychCall["supcomntid"]; | 822 | $tuser['supcomntid']=$kstychCall["supcomntid"]; |
| 644 | 823 | ||
| 645 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); | 824 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); |
| 646 | $wakka->setPerson($tcrmid,$tuser); | 825 | $wakka->setPerson($tcrmid,$tuser,$crmcall->client); |
| 826 | $wakka->setPerson($tcrmid,$tuser,""); | ||
| 647 | } | 827 | } |
| 648 | } | 828 | } |
| 649 | } | 829 | } |
| 650 | } | 830 | } |
| 651 | 831 | ||
| 652 | 832 | ||
| 653 | $user=$wakka->getPerson($crmcall->crm_id); | 833 | $user=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 834 | |||
| 654 | if($user['peopledata']['id']==$crmcall->crm_id) | 835 | if($user['peopledata']['id']==$crmcall->crm_id) |
| 655 | { | 836 | { |
| 656 | if($crmcall->crm_id>0){ | 837 | if($crmcall->crm_id>0){ |
| 657 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | 838 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); |
| 658 | } | 839 | } |
| 659 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 840 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 660 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 841 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 661 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 842 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 843 | $user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 662 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 844 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 663 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 845 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 664 | 846 | ||
| ... | @@ -688,25 +870,29 @@ if($action=="closecall") | ... | @@ -688,25 +870,29 @@ if($action=="closecall") |
| 688 | $user['agentcomments']=$kstychCall["agentcomments"]; | 870 | $user['agentcomments']=$kstychCall["agentcomments"]; |
| 689 | $user['supcomntid']=$kstychCall["supcomntid"]; | 871 | $user['supcomntid']=$kstychCall["supcomntid"]; |
| 690 | 872 | ||
| 691 | $wakka->setPerson($crmcall->crm_id,$user); | 873 | $wakka->setPerson($crmcall->crm_id,$user,$crmcall->client); |
| 692 | 874 | $wakka->setPerson($crmcall->crm_id,$user,""); | |
| 693 | //update groupid if this is not groupid TODO move to config | 875 | //update groupid if this is not groupid TODO move to config |
| 694 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) | 876 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) |
| 695 | { | 877 | { |
| 696 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1"); | 878 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1",$crmcall->client); |
| 697 | 879 | ||
| 698 | if(!empty($tusers)) | 880 | if(!empty($tusers)) |
| 699 | { | 881 | { |
| 700 | $tppldata=unserialize($tusers[0]['peopledata']); | 882 | $tppldata=unserialize($tusers[0]['peopledata']); |
| 701 | if($tppldata['status']=='New' || $tppldata['status']=='Incall')$wakka->setPersonKey($tusers[0]['id'],'status','Called'); | 883 | if($tppldata['status']=='New' || $tppldata['status']=='Incall'){ |
| 702 | 884 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",$crmcall->client); | |
| 885 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",""); | ||
| 886 | } | ||
| 703 | 887 | ||
| 704 | //print_r($tppldata['status']); | 888 | //print_r($tppldata['status']); |
| 705 | //Log::info($tppldata['status']); | 889 | //Log::info($tppldata['status']); |
| 706 | //if($tppldata['dialer_status']=='') //TODO Config | 890 | //if($tppldata['dialer_status']=='') //TODO Config |
| 707 | { | 891 | { |
| 708 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"]); | 892 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",$crmcall->client); |
| 709 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"]); | 893 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",""); |
| 894 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",$crmcall->client); | ||
| 895 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",""); | ||
| 710 | } | 896 | } |
| 711 | } | 897 | } |
| 712 | } | 898 | } |
| ... | @@ -830,13 +1016,24 @@ if($action=="kCallAction") | ... | @@ -830,13 +1016,24 @@ if($action=="kCallAction") |
| 830 | 1016 | ||
| 831 | if($action=="dialerstate") | 1017 | if($action=="dialerstate") |
| 832 | { | 1018 | { |
| 833 | $ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; | 1019 | //$ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; |
| 1020 | $ready=0;$perpareCall=0; | ||
| 1021 | if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait") | ||
| 1022 | { | ||
| 1023 | $ready=1; | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | if($kstychDialer['mDialerSubState']=="Predictive"&&$kstychCall['mCallState']=="Wait") | ||
| 1027 | { | ||
| 1028 | $perpareCall=1; | ||
| 1029 | } | ||
| 834 | $nowts=microtime(true)*1000; | 1030 | $nowts=microtime(true)*1000; |
| 835 | 1031 | ||
| 836 | $sipid=Sipid::find($kstychDialer['phone']); | 1032 | $sipid=Sipid::find($kstychDialer['phone']); |
| 837 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 1033 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| 838 | { | 1034 | { |
| 839 | $sipid->ready=$ready; | 1035 | $sipid->ready=$ready; |
| 1036 | $sipid->prepare_call=$perpareCall; | ||
| 840 | $sipid->save(); | 1037 | $sipid->save(); |
| 841 | 1038 | ||
| 842 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); | 1039 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); |
| ... | @@ -845,6 +1042,71 @@ if($action=="dialerstate") | ... | @@ -845,6 +1042,71 @@ if($action=="dialerstate") |
| 845 | } | 1042 | } |
| 846 | return Response::make(""); | 1043 | return Response::make(""); |
| 847 | } | 1044 | } |
| 1045 | if($action=="usersel") | ||
| 1046 | { | ||
| 1047 | |||
| 1048 | $user = Auth::user(); | ||
| 1049 | $currDialerState = $kstychDialer['mDialerState']; | ||
| 1050 | //$client=Input::get("client"); | ||
| 1051 | if($kstychDialer['mDialerSubState'] != "") | ||
| 1052 | $currDialerState = $kstychDialer['mDialerSubState']; | ||
| 1053 | if($client!=""){ | ||
| 1054 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1055 | 'sel_campaign'=>$client, | ||
| 1056 | 'current_dialmode'=>$currDialerState | ||
| 1057 | ]); | ||
| 1058 | }else{ | ||
| 1059 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1060 | 'current_dialmode'=>$currDialerState | ||
| 1061 | ]); | ||
| 1062 | |||
| 1063 | } | ||
| 1064 | |||
| 1065 | $campaigndata = Sipid::select("clients")->where("user", $user->id)->where("status", "=", 1)->first(); | ||
| 1066 | |||
| 1067 | if($campaigndata) | ||
| 1068 | { | ||
| 1069 | $campdata= json_decode($campaigndata->clients); | ||
| 1070 | if(Auth::user()->id!='1'){ | ||
| 1071 | $campdata->sel_campaign=$client; | ||
| 1072 | |||
| 1073 | Sipid::where("user",$user->id)->update(["clients"=>json_encode($campdata)]); | ||
| 1074 | } | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | return Response::make(""); | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | if($action=="sipcleanup") | ||
| 1081 | { | ||
| 1082 | $user = Auth::user(); | ||
| 1083 | |||
| 1084 | $sipid = Sipid::where("user", $user->id)->select('id')->first(); | ||
| 1085 | |||
| 1086 | Sipid::where("user", $user->id)->update([ | ||
| 1087 | "user" => 0, | ||
| 1088 | "status" => 0, | ||
| 1089 | "ready" => 0, | ||
| 1090 | "patched" => 0, | ||
| 1091 | "prepare_call" => 0, | ||
| 1092 | "confup" => 0, | ||
| 1093 | "clients" => "" | ||
| 1094 | ]); | ||
| 1095 | |||
| 1096 | $diallines = Dialline::where('status', '!=', 'Free')->where('conf', '=', "1000".$sipid->id); | ||
| 1097 | if($diallines){ | ||
| 1098 | $diallines=$diallines->get(); | ||
| 1099 | |||
| 1100 | foreach ($diallines as $dialline) { | ||
| 1101 | $newqueue=new Kqueue(); | ||
| 1102 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); | ||
| 1103 | } | ||
| 1104 | } | ||
| 1105 | if(count($sipid)){ | ||
| 1106 | exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid->id.'"'); | ||
| 1107 | exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid->id.' all"'); | ||
| 1108 | } | ||
| 1109 | } | ||
| 848 | 1110 | ||
| 849 | if($action=="spychannel") | 1111 | if($action=="spychannel") |
| 850 | { | 1112 | { |
| ... | @@ -875,11 +1137,14 @@ if($action=="recarchive") | ... | @@ -875,11 +1137,14 @@ if($action=="recarchive") |
| 875 | } | 1137 | } |
| 876 | public function show($id) | 1138 | public function show($id) |
| 877 | { | 1139 | { |
| 1140 | //echo "show--->".$id; | ||
| 1141 | //exit(); | ||
| 878 | if($id=="bucketdata") | 1142 | if($id=="bucketdata") |
| 879 | { | 1143 | { |
| 1144 | //Log::info("ABCDDD----".Input::get("client")); | ||
| 880 | $client=Input::get("client",""); | 1145 | $client=Input::get("client",""); |
| 881 | $bucket=Input::get("bucket"); | 1146 | $bucket=Input::get("bucket"); |
| 882 | $currentstatus=Input::get("currentstatus"); | 1147 | //$currentstatus=Input::get("currentstatus"); |
| 883 | $legalstatus=Input::get("legalstatus"); | 1148 | $legalstatus=Input::get("legalstatus"); |
| 884 | $page=intval(Input::get('page'));if($page<1)$page=1; | 1149 | $page=intval(Input::get('page'));if($page<1)$page=1; |
| 885 | $skey=Input::get('skey'); | 1150 | $skey=Input::get('skey'); |
| ... | @@ -931,9 +1196,9 @@ public function show($id) | ... | @@ -931,9 +1196,9 @@ public function show($id) |
| 931 | $birthdate=date('m-d'); | 1196 | $birthdate=date('m-d'); |
| 932 | 1197 | ||
| 933 | $dbres=array(); | 1198 | $dbres=array(); |
| 934 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(20); | 1199 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(1); |
| 935 | else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); | 1200 | /*else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); |
| 936 | else if($bucket=="TotalData")$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); | 1201 | else if($bucket=="TotalData")//$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); |
| 937 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); | 1202 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); |
| 938 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1203 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 939 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); | 1204 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); |
| ... | @@ -941,9 +1206,9 @@ public function show($id) | ... | @@ -941,9 +1206,9 @@ public function show($id) |
| 941 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1206 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 942 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1207 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 943 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); | 1208 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); |
| 944 | 1209 | */ | |
| 945 | else if($bucket=="MissedCalls") | 1210 | else if($bucket=="MissedCalls") |
| 946 | { | 1211 | {/* |
| 947 | $udidlinesstr = array(); | 1212 | $udidlinesstr = array(); |
| 948 | foreach($didlinesstr as $didlinestr){ | 1213 | foreach($didlinesstr as $didlinestr){ |
| 949 | $didlinestrArr=explode(":",$didlinestr); | 1214 | $didlinestrArr=explode(":",$didlinestr); |
| ... | @@ -972,8 +1237,6 @@ public function show($id) | ... | @@ -972,8 +1237,6 @@ public function show($id) |
| 972 | 1237 | ||
| 973 | if(count($number_list) > 0) { | 1238 | if(count($number_list) > 0) { |
| 974 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); | 1239 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); |
| 975 | //$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number)"); | ||
| 976 | //$lcalls=$lcalls->orderBy("id","DESC"); | ||
| 977 | foreach($lcalls as $lcall) | 1240 | foreach($lcalls as $lcall) |
| 978 | { | 1241 | { |
| 979 | if($lcall->userstatus=="InboundDROP") | 1242 | if($lcall->userstatus=="InboundDROP") |
| ... | @@ -1005,7 +1268,7 @@ public function show($id) | ... | @@ -1005,7 +1268,7 @@ public function show($id) |
| 1005 | } | 1268 | } |
| 1006 | 1269 | ||
| 1007 | 1270 | ||
| 1008 | } | 1271 | */ } |
| 1009 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1272 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 1010 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1273 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 1011 | 1274 | ||
| ... | @@ -1182,26 +1445,33 @@ public function show($id) | ... | @@ -1182,26 +1445,33 @@ public function show($id) |
| 1182 | 1445 | ||
| 1183 | $calllog = DB::table('records') | 1446 | $calllog = DB::table('records') |
| 1184 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 1447 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') |
| 1185 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 1448 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 1186 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00"); | 1449 | ->where("dialer_callback", "!=","0000-00-00 00:00:00"); |
| 1187 | 1450 | ||
| 1188 | if($role == 'Supervisor'){ | 1451 | if($role == 'Supervisor'){ |
| 1189 | $userName = Auth::user()->username; | 1452 | $userName = Auth::user()->username; |
| 1190 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | 1453 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); |
| 1191 | $supervisorUsers = implode(",",$supervisorUsers); | 1454 | $userIds= []; |
| 1455 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | ||
| 1456 | $supervisorUsers = implode(",",$userIds); | ||
| 1457 | //print_r($supervisorUsers); | ||
| 1458 | //$supervisorUsers = implode(",",$supervisorUsers); | ||
| 1459 | print_r($supervisorUsers); | ||
| 1192 | if(!empty($supervisorUsers)){ | 1460 | if(!empty($supervisorUsers)){ |
| 1193 | 1461 | ||
| 1194 | if($selection == 'all'){ | 1462 | if($selection == 'all'){ |
| 1195 | $setClient =''; | 1463 | $setClient =''; |
| 1464 | $calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00'"); | ||
| 1196 | }else{ | 1465 | }else{ |
| 1197 | $setClient = $client; | 1466 | $setClient = $client; |
| 1198 | $calllog = $calllog->where('records.client', '=', $client); | 1467 | $calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00' and client = '$client'"); |
| 1468 | //$calllog = $calllog->where('client', '=', $client); | ||
| 1199 | } | 1469 | } |
| 1470 | //print_r($supervisorUsers); | ||
| 1471 | //$calllog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00'"); | ||
| 1472 | //$calllog = $calllog->whereIn("usr_id",[$supervisorUsers]) ->get(); | ||
| 1200 | 1473 | ||
| 1201 | $calllog = $calllog->whereIn("records.usr_id",[$supervisorUsers]) | 1474 | echo $count = count($calllog); |
| 1202 | ->get(); | ||
| 1203 | |||
| 1204 | $count = count($calllog); | ||
| 1205 | } | 1475 | } |
| 1206 | 1476 | ||
| 1207 | }else if($role == 'User'){ | 1477 | }else if($role == 'User'){ |
| ... | @@ -1209,9 +1479,9 @@ public function show($id) | ... | @@ -1209,9 +1479,9 @@ public function show($id) |
| 1209 | $setClient =''; | 1479 | $setClient =''; |
| 1210 | }else{ | 1480 | }else{ |
| 1211 | $setClient = $client; | 1481 | $setClient = $client; |
| 1212 | $calllog = $calllog->where('records.client', '=', $client); | 1482 | $calllog = $calllog->where('client', '=', $client); |
| 1213 | } | 1483 | } |
| 1214 | $calllog = $calllog->where("records.usr_id",$user)->get(); | 1484 | $calllog = $calllog->where("usr_id",$user)->get(); |
| 1215 | 1485 | ||
| 1216 | $count = count($calllog); | 1486 | $count = count($calllog); |
| 1217 | } | 1487 | } |
| ... | @@ -1221,6 +1491,62 @@ public function show($id) | ... | @@ -1221,6 +1491,62 @@ public function show($id) |
| 1221 | $data['count'] = $count; | 1491 | $data['count'] = $count; |
| 1222 | return view("layout.module.dialer.followUp",$data); | 1492 | return view("layout.module.dialer.followUp",$data); |
| 1223 | } | 1493 | } |
| 1494 | if($id=="loadAppointmentData") | ||
| 1495 | { | ||
| 1496 | |||
| 1497 | $wakka = new KHRMSLib(); | ||
| 1498 | $user=Auth::user()->id; | ||
| 1499 | $role = Auth::user()->usertype; | ||
| 1500 | $client = Input::get("client"); | ||
| 1501 | $selection = Input::get("selection"); | ||
| 1502 | $setClient = ''; | ||
| 1503 | $count = 0; | ||
| 1504 | |||
| 1505 | $totalAppointmentCount = DB::table('records') | ||
| 1506 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') | ||
| 1507 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 1508 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); | ||
| 1509 | //print_r($totalAppointmentCount); | ||
| 1510 | if($role == 'Supervisor'){ | ||
| 1511 | $userName = Auth::user()->username; | ||
| 1512 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | ||
| 1513 | $userIds = []; | ||
| 1514 | //print_r($supervisorUsers); | ||
| 1515 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | ||
| 1516 | $supervisorUsers = implode(",",$userIds); | ||
| 1517 | //echo $supervisorUsers; | ||
| 1518 | if(!empty($supervisorUsers)){ | ||
| 1519 | |||
| 1520 | if($selection == 'all'){ | ||
| 1521 | $setClient =''; | ||
| 1522 | }else{ | ||
| 1523 | $setClient = $client; | ||
| 1524 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1525 | } | ||
| 1526 | |||
| 1527 | $totalAppointmentCount = $totalAppointmentCount->whereIn("usr_id",[$supervisorUsers]) | ||
| 1528 | ->get(); | ||
| 1529 | |||
| 1530 | $count = count($totalAppointmentCount); | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | }else if($role == 'User'){ | ||
| 1534 | if($selection == 'all'){ | ||
| 1535 | $setClient =''; | ||
| 1536 | }else{ | ||
| 1537 | $setClient = $client; | ||
| 1538 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1539 | } | ||
| 1540 | $totalAppointmentCount = $totalAppointmentCount->where("usr_id",$user)->get(); | ||
| 1541 | |||
| 1542 | $count = count($totalAppointmentCount); | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | $data['appointment'] = $totalAppointmentCount; | ||
| 1546 | $data['client'] = $setClient; | ||
| 1547 | $data['count'] = $count; | ||
| 1548 | return view("layout.module.dialer.appointment",$data); | ||
| 1549 | } | ||
| 1224 | if($id=="reports") | 1550 | if($id=="reports") |
| 1225 | { | 1551 | { |
| 1226 | return view("layout.module.dialer.reports",array()); | 1552 | return view("layout.module.dialer.reports",array()); |
| ... | @@ -1467,11 +1793,13 @@ public function show($id) | ... | @@ -1467,11 +1793,13 @@ public function show($id) |
| 1467 | //echo "OK"; | 1793 | //echo "OK"; |
| 1468 | } | 1794 | } |
| 1469 | 1795 | ||
| 1470 | private function getCallSequencing($limit) | 1796 | public function getCallSequencing($limit,$client=null) |
| 1471 | { | 1797 | { |
| 1798 | //Log::info("Inside getCall"); | ||
| 1472 | $wakka = new KHRMSLib(); | 1799 | $wakka = new KHRMSLib(); |
| 1473 | 1800 | ||
| 1474 | $roclientstr=array();$didlinesstr=array(); | 1801 | $roclientstr=array();$didlinesstr=array(); |
| 1802 | if($client==null){ | ||
| 1475 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; | 1803 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; |
| 1476 | $oclientlst=$wakka->clientsOwnerRWAccess(); | 1804 | $oclientlst=$wakka->clientsOwnerRWAccess(); |
| 1477 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | 1805 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") |
| ... | @@ -1485,21 +1813,20 @@ public function show($id) | ... | @@ -1485,21 +1813,20 @@ public function show($id) |
| 1485 | $mroclientstr = $roclientstr; | 1813 | $mroclientstr = $roclientstr; |
| 1486 | 1814 | ||
| 1487 | $client=Input::get("client"); | 1815 | $client=Input::get("client"); |
| 1488 | //print_r($client); | ||
| 1489 | 1816 | ||
| 1490 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; | 1817 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; |
| 1491 | // echo $roclientstr."Abc"; | ||
| 1492 | $users=array(); | 1818 | $users=array(); |
| 1493 | 1819 | ||
| 1494 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} | 1820 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} |
| 1821 | }else{ | ||
| 1822 | $roclientstr="client='$client'"; | ||
| 1823 | } | ||
| 1824 | //$client=$this->campaignlist($client); | ||
| 1825 | if($client!='')$records='records_'.$client;else $records='records'; | ||
| 1826 | DB::table($records)->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); | ||
| 1495 | 1827 | ||
| 1496 | DB::table('records')->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); | 1828 | //if($client!=''){ |
| 1497 | 1829 | $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client); | |
| 1498 | |||
| 1499 | // $clientDetails=$wakka->getPersonshome("$roclientstr order by dialer_lastcall asc"); | ||
| 1500 | //$campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); | ||
| 1501 | |||
| 1502 | $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;"); | ||
| 1503 | if(count($tusers)>0){ | 1830 | if(count($tusers)>0){ |
| 1504 | if($limit>0){ | 1831 | if($limit>0){ |
| 1505 | $l=1; | 1832 | $l=1; |
| ... | @@ -1516,7 +1843,9 @@ public function show($id) | ... | @@ -1516,7 +1843,9 @@ public function show($id) |
| 1516 | $limit=$limit-sizeof($tusers); | 1843 | $limit=$limit-sizeof($tusers); |
| 1517 | } | 1844 | } |
| 1518 | } | 1845 | } |
| 1846 | //Log::info("clients-->".$roclientstr); | ||
| 1519 | $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); | 1847 | $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); |
| 1848 | //Log::info($campaign); | ||
| 1520 | if($campaign) | 1849 | if($campaign) |
| 1521 | { | 1850 | { |
| 1522 | if(stripos($campaign->where_cond,"order by")===false){ | 1851 | if(stripos($campaign->where_cond,"order by")===false){ |
| ... | @@ -1524,9 +1853,7 @@ public function show($id) | ... | @@ -1524,9 +1853,7 @@ public function show($id) |
| 1524 | }else{ | 1853 | }else{ |
| 1525 | $orderby =""; | 1854 | $orderby =""; |
| 1526 | } | 1855 | } |
| 1527 | // echo "campaign1"; | 1856 | $tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond $orderby limit 1;",$client); |
| 1528 | //print_r($campaign); | ||
| 1529 | $tusers=$wakka->getPersonshome("filter_condition = '1' and $campaign->where_cond $orderby limit 1;"); | ||
| 1530 | //print_r($tusers); | 1857 | //print_r($tusers); |
| 1531 | if(count($tusers)>0){ | 1858 | if(count($tusers)>0){ |
| 1532 | if($limit>0){ | 1859 | if($limit>0){ |
| ... | @@ -1546,14 +1873,11 @@ public function show($id) | ... | @@ -1546,14 +1873,11 @@ public function show($id) |
| 1546 | $limit=$limit-sizeof($tusers); | 1873 | $limit=$limit-sizeof($tusers); |
| 1547 | } | 1874 | } |
| 1548 | }else{ | 1875 | }else{ |
| 1549 | // echo "campaign 2"; | ||
| 1550 | $condition=$campaign->where_cond; | 1876 | $condition=$campaign->where_cond; |
| 1551 | if(stripos($condition,"order by")!==false){ | 1877 | if(stripos($condition,"order by")!==false){ |
| 1552 | // $orderby="order by dialer_lastcall asc"; | ||
| 1553 | $condition = substr($condition,0,stripos($condition, 'order by')); | 1878 | $condition = substr($condition,0,stripos($condition, 'order by')); |
| 1554 | } | 1879 | } |
| 1555 | //$condition = substr($campaign->where_cond,0,stripos($campaign->where_cond, 'order by')); | 1880 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;",$client); |
| 1556 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;"); | ||
| 1557 | if($limit>0){ | 1881 | if($limit>0){ |
| 1558 | $l=1; | 1882 | $l=1; |
| 1559 | foreach($tusers as $tuser){ | 1883 | foreach($tusers as $tuser){ |
| ... | @@ -1570,7 +1894,22 @@ public function show($id) | ... | @@ -1570,7 +1894,22 @@ public function show($id) |
| 1570 | } | 1894 | } |
| 1571 | } | 1895 | } |
| 1572 | }else{ | 1896 | }else{ |
| 1573 | $clientDetails=$wakka->getPersonshome("$roclientstr and filter_condition NOT IN ('2','3') order by dialer_lastcall asc limit 1;"); | 1897 | $tusers=$wakka->getPersonshome("filter_condition NOT IN ('2','3') and status='New' order by dialer_lastcall asc limit 1;",$client); |
| 1898 | if($limit>0){ | ||
| 1899 | $l=1; | ||
| 1900 | foreach($tusers as $tuser){ | ||
| 1901 | if(!isset($users[$tuser['id']])){ | ||
| 1902 | $users[$tuser['id']]=$tuser; | ||
| 1903 | $l++; | ||
| 1904 | |||
| 1905 | if($l>$limit) | ||
| 1906 | break; | ||
| 1907 | } | ||
| 1908 | } | ||
| 1909 | |||
| 1910 | $limit=$limit-sizeof($tusers); | ||
| 1911 | } | ||
| 1912 | |||
| 1574 | //print_r($clientDetails); | 1913 | //print_r($clientDetails); |
| 1575 | //print_r($clientDetails); | 1914 | //print_r($clientDetails); |
| 1576 | 1915 | ||
| ... | @@ -1664,7 +2003,7 @@ public function show($id) | ... | @@ -1664,7 +2003,7 @@ public function show($id) |
| 1664 | }*/ | 2003 | }*/ |
| 1665 | 2004 | ||
| 1666 | 2005 | ||
| 1667 | if($limit>0) | 2006 | /*if($limit>0) |
| 1668 | { | 2007 | { |
| 1669 | $tusers = array_filter($clientDetails, function($var){ | 2008 | $tusers = array_filter($clientDetails, function($var){ |
| 1670 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); | 2009 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); |
| ... | @@ -1682,8 +2021,8 @@ public function show($id) | ... | @@ -1682,8 +2021,8 @@ public function show($id) |
| 1682 | } | 2021 | } |
| 1683 | 2022 | ||
| 1684 | $limit=$limit-sizeof($tusers); | 2023 | $limit=$limit-sizeof($tusers); |
| 1685 | } | 2024 | }*/ |
| 1686 | for($p=15;$p>0;$p--) | 2025 | /*for($p=15;$p>0;$p--) |
| 1687 | { | 2026 | { |
| 1688 | // echo "2"; | 2027 | // echo "2"; |
| 1689 | if($limit>0) | 2028 | if($limit>0) |
| ... | @@ -1708,8 +2047,8 @@ public function show($id) | ... | @@ -1708,8 +2047,8 @@ public function show($id) |
| 1708 | $limit=$limit-sizeof($tusers); | 2047 | $limit=$limit-sizeof($tusers); |
| 1709 | } | 2048 | } |
| 1710 | } | 2049 | } |
| 1711 | } | 2050 | }*/ |
| 1712 | if($limit>0) | 2051 | /*if($limit>0) |
| 1713 | { | 2052 | { |
| 1714 | $tusers = array_filter($clientDetails, function($var){ | 2053 | $tusers = array_filter($clientDetails, function($var){ |
| 1715 | return ($var['status']=='New'&&$var['mobile']!=''); | 2054 | return ($var['status']=='New'&&$var['mobile']!=''); |
| ... | @@ -1727,9 +2066,9 @@ public function show($id) | ... | @@ -1727,9 +2066,9 @@ public function show($id) |
| 1727 | } | 2066 | } |
| 1728 | 2067 | ||
| 1729 | $limit=$limit-sizeof($tusers); | 2068 | $limit=$limit-sizeof($tusers); |
| 1730 | } | 2069 | }*/ |
| 1731 | 2070 | ||
| 1732 | if($limit>0) | 2071 | /*if($limit>0) |
| 1733 | { | 2072 | { |
| 1734 | $tusers = array_filter($clientDetails, function($var){ | 2073 | $tusers = array_filter($clientDetails, function($var){ |
| 1735 | //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted'])); | 2074 | //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted'])); |
| ... | @@ -1748,7 +2087,7 @@ public function show($id) | ... | @@ -1748,7 +2087,7 @@ public function show($id) |
| 1748 | } | 2087 | } |
| 1749 | 2088 | ||
| 1750 | $limit=$limit-sizeof($tusers); | 2089 | $limit=$limit-sizeof($tusers); |
| 1751 | } | 2090 | }*/ |
| 1752 | 2091 | ||
| 1753 | /*if($limit>0) | 2092 | /*if($limit>0) |
| 1754 | { | 2093 | { |
| ... | @@ -1769,7 +2108,7 @@ public function show($id) | ... | @@ -1769,7 +2108,7 @@ public function show($id) |
| 1769 | $limit=$limit-sizeof($tusers); | 2108 | $limit=$limit-sizeof($tusers); |
| 1770 | }*/ | 2109 | }*/ |
| 1771 | 2110 | ||
| 1772 | if($limit>0) | 2111 | /*if($limit>0) |
| 1773 | { | 2112 | { |
| 1774 | // echo "5"; | 2113 | // echo "5"; |
| 1775 | $tusers = array_filter($clientDetails, function($var){ | 2114 | $tusers = array_filter($clientDetails, function($var){ |
| ... | @@ -1787,9 +2126,24 @@ public function show($id) | ... | @@ -1787,9 +2126,24 @@ public function show($id) |
| 1787 | } | 2126 | } |
| 1788 | 2127 | ||
| 1789 | $limit=$limit-sizeof($tusers); | 2128 | $limit=$limit-sizeof($tusers); |
| 1790 | } | 2129 | }*/ |
| 1791 | } | 2130 | } |
| 1792 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; | 2131 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; |
| 2132 | // } | ||
| 1793 | return $tusers; | 2133 | return $tusers; |
| 1794 | } | 2134 | } |
| 2135 | |||
| 2136 | |||
| 2137 | public function getAvgTimeArray($campaign, $user) | ||
| 2138 | { | ||
| 2139 | $avgdisposecObj = CRMCall::select(DB::Raw('(avg(disposec))/1000 as avgdisposec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2140 | |||
| 2141 | $avgcallsecObj = CRMCall::select(DB::Raw('(avg(callsec))/1000 as avgcallsec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2142 | |||
| 2143 | $returnArray['avgdisposec'] = round($avgdisposecObj->avgdisposec); | ||
| 2144 | $returnArray['avgcallsec'] = round($avgdisposecObj->avgcallsec); | ||
| 2145 | |||
| 2146 | return $returnArray; | ||
| 2147 | } | ||
| 2148 | |||
| 1795 | } | 2149 | } | ... | ... |
| 1 | <?php namespace App\Http\Controllers; | ||
| 2 | |||
| 3 | use Auth; | ||
| 4 | use Input; | ||
| 5 | use Config; | ||
| 6 | use Session; | ||
| 7 | use DB; | ||
| 8 | use App\Services\FormBuilder; | ||
| 9 | use Illuminate\Http\Request; | ||
| 10 | use Response; | ||
| 11 | use App\Models\Disposition; | ||
| 12 | use App\Models\SubDisposition; | ||
| 13 | |||
| 14 | class DispositionController extends Controller { | ||
| 15 | |||
| 16 | |||
| 17 | public function __construct() | ||
| 18 | { | ||
| 19 | $this->middleware('auth'); | ||
| 20 | $this->middleware('module_access'); | ||
| 21 | } | ||
| 22 | |||
| 23 | public function index() | ||
| 24 | { | ||
| 25 | $data['dispositions']= Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 26 | ->select('disposition.id as dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 27 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 28 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 29 | ->groupBy('sub_disposition.dispo_id') | ||
| 30 | ->get(); | ||
| 31 | |||
| 32 | return view("layout.module.disposition.index", $data); | ||
| 33 | } | ||
| 34 | public function create() | ||
| 35 | { | ||
| 36 | return view('layout.module.disposition.create'); | ||
| 37 | } | ||
| 38 | public function store(Request $request) | ||
| 39 | { | ||
| 40 | $action = Input::get("action"); | ||
| 41 | |||
| 42 | if($action == 'isExists'){ | ||
| 43 | $disposition = Input::get("disposition"); | ||
| 44 | $code = Input::get("code"); | ||
| 45 | $exists=Disposition::where("name","=",$disposition)->orwhere("code","=",$code)->first(); | ||
| 46 | if($exists){ | ||
| 47 | $dispositionId = Input::get("dispoId"); | ||
| 48 | if($dispositionId == $exists->id){ | ||
| 49 | return "false"; | ||
| 50 | } | ||
| 51 | return "true"; | ||
| 52 | }else{ | ||
| 53 | return "false"; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | if($action == 'createDisposition'){ | ||
| 58 | $code = Input::get("code"); | ||
| 59 | $disposition = Input::get("disposition"); | ||
| 60 | $subDisposition = Input::get("subDisposition"); | ||
| 61 | $status = Input::get("status"); | ||
| 62 | |||
| 63 | $disposition = Disposition::create([ | ||
| 64 | 'code' => $code, | ||
| 65 | 'name' => $disposition, | ||
| 66 | 'status' => $status, | ||
| 67 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 68 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 69 | ]); | ||
| 70 | |||
| 71 | $dispoId = $disposition->id; | ||
| 72 | |||
| 73 | foreach ($subDisposition as $key => $value) { | ||
| 74 | $subDisposition = SubDisposition::create([ | ||
| 75 | 'dispo_id' => $dispoId, | ||
| 76 | 'name' => $value, | ||
| 77 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 78 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 79 | ]); | ||
| 80 | } | ||
| 81 | return; | ||
| 82 | |||
| 83 | } | ||
| 84 | |||
| 85 | if($action == 'updateDisposition'){ | ||
| 86 | $dispoId = Input::get("dispoId"); | ||
| 87 | $code = Input::get("code"); | ||
| 88 | $disposition = Input::get("disposition"); | ||
| 89 | $subDisposition = Input::get("subDisposition"); | ||
| 90 | $status = Input::get("status"); | ||
| 91 | |||
| 92 | Disposition::where('id', $dispoId) | ||
| 93 | ->update([ | ||
| 94 | 'code' => $code, | ||
| 95 | 'name' => $disposition, | ||
| 96 | 'status' => $status]); | ||
| 97 | |||
| 98 | SubDisposition::where('dispo_id', $dispoId)->delete(); | ||
| 99 | |||
| 100 | foreach ($subDisposition as $key => $value) { | ||
| 101 | $subDisposition = SubDisposition::create([ | ||
| 102 | 'dispo_id' => $dispoId, | ||
| 103 | 'name' => $value, | ||
| 104 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 105 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 106 | ]); | ||
| 107 | } | ||
| 108 | return; | ||
| 109 | |||
| 110 | } | ||
| 111 | } | ||
| 112 | public function show($id) | ||
| 113 | { | ||
| 114 | |||
| 115 | } | ||
| 116 | public function edit($id) | ||
| 117 | { | ||
| 118 | $data['disposition']= Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 119 | ->select('disposition.id AS dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 120 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 121 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 122 | ->groupBy('sub_disposition.dispo_id') | ||
| 123 | ->where('disposition.id','=',$id) | ||
| 124 | ->get()->first(); | ||
| 125 | |||
| 126 | return view('layout.module.disposition.edit',$data); | ||
| 127 | } | ||
| 128 | public function update($id) | ||
| 129 | { | ||
| 130 | |||
| 131 | } | ||
| 132 | public function destroy($id) | ||
| 133 | { | ||
| 134 | } | ||
| 135 | public function dashboard() | ||
| 136 | { | ||
| 137 | } | ||
| 138 | } |
| 1 | <?php namespace App\Http\Controllers; | ||
| 2 | |||
| 3 | use Auth; | ||
| 4 | use Input; | ||
| 5 | use Config; | ||
| 6 | use Session; | ||
| 7 | use DB; | ||
| 8 | use App\Services\FormBuilder; | ||
| 9 | use Illuminate\Http\Request; | ||
| 10 | use Response; | ||
| 11 | use App\Models\Disposition; | ||
| 12 | use App\Models\SubDisposition; | ||
| 13 | use App\Models\DispositionPlan; | ||
| 14 | use App\Models\DispositionPlanConfig; | ||
| 15 | |||
| 16 | class DispositionPlanController extends Controller { | ||
| 17 | |||
| 18 | |||
| 19 | public function __construct() | ||
| 20 | { | ||
| 21 | $this->middleware('auth'); | ||
| 22 | $this->middleware('module_access'); | ||
| 23 | } | ||
| 24 | |||
| 25 | public function index() | ||
| 26 | { | ||
| 27 | $data['dispositionPlan']= DispositionPlan::leftjoin('disposition_plan_config', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 28 | ->select('disposition_plan.id as dispositionPlanId', 'disposition_plan.name as name','disposition_plan.status AS status', | ||
| 29 | DB::raw('count(*) as totalDisposition, disposition_plan_config.id'), | ||
| 30 | DB::raw('GROUP_CONCAT(disposition_plan_config.disposition) as disposition, disposition_plan_config.disposition')) | ||
| 31 | ->groupBy('disposition_plan_config.dispo_plan_id') | ||
| 32 | //->where('status','active') | ||
| 33 | ->get(); | ||
| 34 | |||
| 35 | return view("layout.module.dispositionplan.index", $data); | ||
| 36 | } | ||
| 37 | public function create() | ||
| 38 | { | ||
| 39 | $data['dispositionEntities'] = Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 40 | ->select('disposition.id as dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 41 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 42 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 43 | ->groupBy('sub_disposition.dispo_id') | ||
| 44 | ->where('status','active') | ||
| 45 | ->get(); | ||
| 46 | |||
| 47 | return view('layout.module.dispositionplan.create', $data); | ||
| 48 | } | ||
| 49 | public function store(Request $request) | ||
| 50 | { | ||
| 51 | $action = Input::get("action"); | ||
| 52 | |||
| 53 | if($action == 'isExists'){ | ||
| 54 | $plan = Input::get("plan"); | ||
| 55 | $exists=DispositionPlan::where("name","=",$plan)->first(); | ||
| 56 | |||
| 57 | if($exists){ | ||
| 58 | $planId = Input::get("dispositionPlanId"); | ||
| 59 | if($planId == $exists->id){ | ||
| 60 | return "false"; | ||
| 61 | } | ||
| 62 | return "true"; | ||
| 63 | }else{ | ||
| 64 | return "false"; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | if($action == 'createDispositionPlan'){ | ||
| 69 | $plan = Input::get("plan"); | ||
| 70 | $dispositionList = Input::get("disposition"); | ||
| 71 | $subDisposition = Input::get("subDisposition"); | ||
| 72 | $status = Input::get("status"); | ||
| 73 | |||
| 74 | $dispositionPlan = DispositionPlan::create([ | ||
| 75 | 'name' => $plan, | ||
| 76 | 'status' => $status, | ||
| 77 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 78 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 79 | ]); | ||
| 80 | |||
| 81 | foreach ($dispositionList as $key => $disposition) { | ||
| 82 | $dispositionPlanConfig = DispositionPlanConfig::create([ | ||
| 83 | 'dispo_plan_id' => $dispositionPlan->id, | ||
| 84 | 'disposition' => $disposition, | ||
| 85 | 'sub_disposition' => implode(",", $subDisposition[$key]), | ||
| 86 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 87 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 88 | ]); | ||
| 89 | } | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | |||
| 93 | if($action == 'updateDispositionPlan'){ | ||
| 94 | $dispositionPlanId = Input::get("dispositionPlanId"); | ||
| 95 | $plan = Input::get("plan"); | ||
| 96 | $dispositionList = Input::get("disposition"); | ||
| 97 | $subDisposition = Input::get("subDisposition"); | ||
| 98 | $status = Input::get("status"); | ||
| 99 | |||
| 100 | DispositionPlan::where('id', $dispositionPlanId) | ||
| 101 | ->update(['name' => $plan, | ||
| 102 | 'status' => $status, | ||
| 103 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 104 | ]); | ||
| 105 | |||
| 106 | DispositionPlanConfig::where('dispo_plan_id', $dispositionPlanId)->delete(); | ||
| 107 | |||
| 108 | foreach ($dispositionList as $key => $disposition) { | ||
| 109 | $dispositionPlanConfig = DispositionPlanConfig::create([ | ||
| 110 | 'dispo_plan_id' => $dispositionPlanId, | ||
| 111 | 'disposition' => $disposition, | ||
| 112 | 'sub_disposition' => implode(",", $subDisposition[$key]), | ||
| 113 | 'created_at' => date("Y-m-d H:i:s"), | ||
| 114 | 'updated_at' => date("Y-m-d H:i:s") | ||
| 115 | ]); | ||
| 116 | } | ||
| 117 | return; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | public function show($id) | ||
| 121 | { | ||
| 122 | |||
| 123 | } | ||
| 124 | public function edit($id) | ||
| 125 | { | ||
| 126 | $data['dispositionEntities'] = Disposition::join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 127 | ->select('disposition.id as dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 128 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 129 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 130 | ->groupBy('sub_disposition.dispo_id') | ||
| 131 | ->where('status','active') | ||
| 132 | ->get(); | ||
| 133 | |||
| 134 | $data['dispositionPlan']= DispositionPlan::join('disposition_plan_config', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 135 | ->select('disposition_plan.id as dispositionPlanId', 'disposition_plan.name as name','disposition_plan.status AS status','disposition_plan_config.disposition as disposition','disposition_plan_config.sub_disposition as sub_disposition') | ||
| 136 | ->where('disposition_plan.id','=',$id) | ||
| 137 | ->get(); | ||
| 138 | |||
| 139 | |||
| 140 | return view('layout.module.dispositionplan.edit',$data); | ||
| 141 | } | ||
| 142 | public function update($id) | ||
| 143 | { | ||
| 144 | |||
| 145 | } | ||
| 146 | public function destroy($id) | ||
| 147 | { | ||
| 148 | } | ||
| 149 | public function dashboard() | ||
| 150 | { | ||
| 151 | } | ||
| 152 | } |
| 1 | <?php | ||
| 2 | namespace App\Http\Controllers; | ||
| 3 | use Illuminate\Http\Request; | ||
| 4 | use App\Http\Requests; | ||
| 5 | use App\Models\Pri; | ||
| 6 | use Validator; | ||
| 7 | |||
| 8 | class PriController extends Controller | ||
| 9 | { | ||
| 10 | public function pri(Request $request) | ||
| 11 | { | ||
| 12 | // $ab =escapeshellarg(`ls -al`); | ||
| 13 | // echo "<pre>$ab</pre>"; | ||
| 14 | $output = `ls -al`; | ||
| 15 | echo "<pre>$output</pre>"; | ||
| 16 | } | ||
| 17 | |||
| 18 | } |
| 1 | <?php | ||
| 2 | namespace App\Http\Controllers; | ||
| 3 | use Illuminate\Http\Request; | ||
| 4 | use App\Http\Requests; | ||
| 5 | use Auth; | ||
| 6 | use Log; | ||
| 7 | use DB; | ||
| 8 | class SmsController extends Controller | ||
| 9 | { | ||
| 10 | public $smsUrl = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; | ||
| 11 | //public $userarray = array("A21568","admin"); | ||
| 12 | public function sendSmsBasedOnSubDisposition($kstychCall) | ||
| 13 | { | ||
| 14 | //public $userarray = array("A21568","admin"); | ||
| 15 | //$users = $this->userarray; | ||
| 16 | //Log::info(Auth::user()->username." ^ ".$users[0]); | ||
| 17 | //Log::info(in_array(Auth::user()->username , $users)); | ||
| 18 | //if(in_array(Auth::user()->username , $users)){ | ||
| 19 | $msgText = $this->getSmsTemplate($kstychCall); | ||
| 20 | if( !empty($msgText) ) { | ||
| 21 | $msgText = $this->fillValuesInTemplate($msgText); | ||
| 22 | //Log::info($msgText); | ||
| 23 | $this->sendSmsRequest($kstychCall, $msgText); | ||
| 24 | } | ||
| 25 | //} | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | public function sendSmsRequest($kstychCall, $msgText) | ||
| 29 | { | ||
| 30 | $url = $this->smsUrl; | ||
| 31 | //Log::info($kstychCall['callnumber']); | ||
| 32 | $inputArray = [ | ||
| 33 | 'userId'=>'hdfcbalrt', | ||
| 34 | "pass"=>'hdfcbalrt25', | ||
| 35 | "appid"=>"hdfcbalrt", | ||
| 36 | "subappid"=>"hdfcbalrt", | ||
| 37 | "contenttype"=>"1", | ||
| 38 | "to"=>$kstychCall['callnumber'], | ||
| 39 | "from"=>"HDFCBK", | ||
| 40 | "text"=>$msgText, | ||
| 41 | "selfid"=>"true", | ||
| 42 | "alert"=>"1", | ||
| 43 | "dlrreq"=>"true", | ||
| 44 | "intflag"=>"false" | ||
| 45 | ]; | ||
| 46 | $query = http_build_query($inputArray); | ||
| 47 | $url .= $query; | ||
| 48 | try{ | ||
| 49 | $ch = curl_init(); | ||
| 50 | curl_setopt($ch, CURLOPT_URL, $url); | ||
| 51 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| 52 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 53 | $response = curl_exec($ch); | ||
| 54 | $number=$kstychCall['callnumber']; | ||
| 55 | $callid=intval($kstychCall['callid'])+0; | ||
| 56 | $serverip=env(app_ip); | ||
| 57 | $rmname=Auth::user()->fullname; | ||
| 58 | $subdispo=$kstychCall["usersubstatus"]; | ||
| 59 | DB::insert(DB::raw("insert into sms_log set server_ip='$serverip',call_id='$callid',rm_name='$rmname',subdispo='$subdispo',number='$number',message='$msgText',response='$response'")); | ||
| 60 | Log::useFiles(storage_path().'/logs/SMS_Messages_'.date("Y-m-d").'.log'); | ||
| 61 | Log::info('|'.env(app_ip).'|'.date('Y-m-d H:i:s', strtotime('+5 hours 30 minutes')).'|'.Auth::user()->fullname.'|'.$kstychCall['callnumber'].'|"'.$msgText.'"|'.$response.'|'); | ||
| 62 | //Log::info($response); | ||
| 63 | curl_close($ch); | ||
| 64 | } catch(Exception $e) { | ||
| 65 | Log::info($e->getMessage()); | ||
| 66 | } | ||
| 67 | } | ||
| 68 | public function getSmsTemplate($kstychCall) | ||
| 69 | { | ||
| 70 | $msgText = ""; | ||
| 71 | include( app_path() . '/Constants/SmsTemplate.php'); | ||
| 72 | if( in_array( $kstychCall["usersubstatus"] , $smsContactedSubdispositionsArr) ) { | ||
| 73 | $msgText = $smsTemplatesArr[SMS_THANKYOU]; | ||
| 74 | } else if( in_array( $kstychCall["usersubstatus"] , $smsNotContactedSubdispositionsArr) ) { | ||
| 75 | $msgText = $smsTemplatesArr[SMS_NOTCONTACTED]; | ||
| 76 | } | ||
| 77 | return $msgText; | ||
| 78 | } | ||
| 79 | public function fillValuesInTemplate($msgText) | ||
| 80 | { | ||
| 81 | if( !empty($msgText) ) | ||
| 82 | { | ||
| 83 | $msgText = str_replace("#name#", Auth::user()->fullname, $msgText); | ||
| 84 | //$msgText = str_replace("#number#", explode(":", Auth::user()->exten)[0], $msgText); | ||
| 85 | $exten = ''; | ||
| 86 | $extension = Auth::user()->exten; | ||
| 87 | if(!empty($extension)) | ||
| 88 | { | ||
| 89 | $extenArr = explode(":", $extension); | ||
| 90 | $exten = $extenArr[0]; | ||
| 91 | } | ||
| 92 | //Log::info($exten); | ||
| 93 | |||
| 94 | $msgText = str_replace("#number#", $exten, $msgText); | ||
| 95 | $msgText = str_replace("#date#", date('d-m-Y'), $msgText); | ||
| 96 | } | ||
| 97 | return $msgText; | ||
| 98 | } | ||
| 99 | } |
| ... | @@ -252,7 +252,7 @@ class UserController extends Controller { | ... | @@ -252,7 +252,7 @@ class UserController extends Controller { |
| 252 | if(isset($userdata["usergroup"]))$user->group=$userdata["usergroup"]; | 252 | if(isset($userdata["usergroup"]))$user->group=$userdata["usergroup"]; |
| 253 | 253 | ||
| 254 | $user->presence=0; | 254 | $user->presence=0; |
| 255 | 255 | if(isset($userdata["clientsownerlist"]))$user->clients=$userdata["clientsownerlist"]; | |
| 256 | if(isset($userdata["lteam"]))$user->lteam=$userdata["lteam"]; | 256 | if(isset($userdata["lteam"]))$user->lteam=$userdata["lteam"]; |
| 257 | if(isset($userdata["lteam2"]))$user->lteam2=$userdata["lteam2"]; | 257 | if(isset($userdata["lteam2"]))$user->lteam2=$userdata["lteam2"]; |
| 258 | if(isset($userdata["supervisor"]))$user->supervisor=$userdata["supervisor"]; | 258 | if(isset($userdata["supervisor"]))$user->supervisor=$userdata["supervisor"]; |
| ... | @@ -290,7 +290,7 @@ class UserController extends Controller { | ... | @@ -290,7 +290,7 @@ class UserController extends Controller { |
| 290 | if(isset($userdata["recclientsownerlist"]))$bbb['recclientsownerlist']=$userdata["recclientsownerlist"]; | 290 | if(isset($userdata["recclientsownerlist"]))$bbb['recclientsownerlist']=$userdata["recclientsownerlist"]; |
| 291 | if(isset($userdata["bdmclientsownerlist"]))$bbb['bdmclientsownerlist']=$userdata["bdmclientsownerlist"]; | 291 | if(isset($userdata["bdmclientsownerlist"]))$bbb['bdmclientsownerlist']=$userdata["bdmclientsownerlist"]; |
| 292 | $data['hrmsdata']=serialize($bbb); | 292 | $data['hrmsdata']=serialize($bbb); |
| 293 | 293 | //$user->clients=$userdata["clientsownerlist"]; | |
| 294 | $user->data=json_encode($data); | 294 | $user->data=json_encode($data); |
| 295 | 295 | ||
| 296 | $meta=$user->meta(); | 296 | $meta=$user->meta(); | ... | ... |
| ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; | ... | @@ -12,6 +12,7 @@ use App\Models\CRMCallArchive; |
| 12 | use App\Models\CRM; | 12 | use App\Models\CRM; |
| 13 | use App\Models\CRMCampaign; | 13 | use App\Models\CRMCampaign; |
| 14 | use App\Models\CRMList; | 14 | use App\Models\CRMList; |
| 15 | use App\Models\Cutoff; | ||
| 15 | use App\Jobs\KHRMSLib; | 16 | use App\Jobs\KHRMSLib; |
| 16 | use App\Models\Sipid; | 17 | use App\Models\Sipid; |
| 17 | use App\Models\Dialline; | 18 | use App\Models\Dialline; |
| ... | @@ -147,20 +148,33 @@ class DialerController extends Controller { | ... | @@ -147,20 +148,33 @@ class DialerController extends Controller { |
| 147 | 148 | ||
| 148 | $roclientstr=array(); | 149 | $roclientstr=array(); |
| 149 | $oclientlst=$wakka->clientsReadAccess(); | 150 | $oclientlst=$wakka->clientsReadAccess(); |
| 151 | //print_r($oclientlst); | ||
| 150 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 152 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 151 | |||
| 152 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 153 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 153 | |||
| 154 | $users=array();$searchresult=""; | 154 | $users=array();$searchresult=""; |
| 155 | if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1"); | 155 | $client=Input::get("client"); |
| 156 | else $users=$this->getCallSequencing(1); | 156 | if($client==''||$client==undefined){ |
| 157 | 157 | $client=""; | |
| 158 | } | ||
| 159 | //$client=$this->campaignlist($client); | ||
| 160 | if(!empty($kstychCall["previewcrmid"])){ | ||
| 161 | $users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' limit 1",$client);} | ||
| 162 | else{ | ||
| 163 | $users=$this->getCallSequencing(1); | ||
| 164 | } | ||
| 165 | //$wakka->setPersonKey($users[0]['id'],"status","Incall"); | ||
| 166 | if($users[0]['id']>0){ | ||
| 167 | Log::info("1----".$users[0]['id']); | ||
| 168 | if($client!=''){ | ||
| 169 | DB::table('records_'.$client)->where('id',$users[0]['id'])->update(['filter_condition'=>'2','modified'=>date("Y-m-d H:i:s")]); | ||
| 170 | } | ||
| 171 | } | ||
| 158 | if(!empty($users)) | 172 | if(!empty($users)) |
| 159 | { | 173 | { |
| 160 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; | 174 | $searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>"; |
| 161 | 175 | ||
| 162 | $searchresult.="<div id=internalid_matchlist></div><script> | 176 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 163 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 177 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 164 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 178 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 165 | }); | 179 | }); |
| 166 | </script>"; | 180 | </script>"; |
| ... | @@ -182,17 +196,14 @@ class DialerController extends Controller { | ... | @@ -182,17 +196,14 @@ class DialerController extends Controller { |
| 182 | $oclientlst=$wakka->clientsReadAccess(); | 196 | $oclientlst=$wakka->clientsReadAccess(); |
| 183 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} | 197 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!=""){$roclientstr[]="'$tclnt'";} |
| 184 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 198 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 185 | 199 | //Log::info("newcall-->> ".$roclientstr); | |
| 186 | $users=array();$callnumber=$kstychCall['callnumber']; | 200 | $client=Input::get("client"); |
| 187 | 201 | Log::info($client); | |
| 188 | $callnumber = trim($callnumber); | 202 | if($client==''||$client==undefined){ |
| 189 | 203 | $client=''; | |
| 190 | if($kstychDialer['mDialerState']=="Manual"){ | ||
| 191 | if((!preg_match('/^[0-9]*$/',$callnumber)) || strlen($callnumber)<6){ | ||
| 192 | return Response::make("<script>simpleNotification('error','topRight','Please enter a valid phone number');</script>"); | ||
| 193 | } | ||
| 194 | } | 204 | } |
| 195 | 205 | //$client=$this->campaignlist($client); | |
| 206 | $users=array();$callnumber=$kstychCall['callnumber']; | ||
| 196 | if($kstychCall['crmid']) | 207 | if($kstychCall['crmid']) |
| 197 | { | 208 | { |
| 198 | $crmid=$kstychCall['crmid']; | 209 | $crmid=$kstychCall['crmid']; |
| ... | @@ -204,13 +215,7 @@ class DialerController extends Controller { | ... | @@ -204,13 +215,7 @@ class DialerController extends Controller { |
| 204 | } | 215 | } |
| 205 | if($kstychDialer['mDialerState']=="Manual") | 216 | if($kstychDialer['mDialerState']=="Manual") |
| 206 | { | 217 | { |
| 207 | $callnumber=trim($callnumber); | 218 | |
| 208 | if(!preg_match('/^[1-9][0-9]*$/',$callnumber)){ | ||
| 209 | return Response::make("<script>simpleNotification('error','topRight','Only Digits are allowed');</script>"); | ||
| 210 | } | ||
| 211 | if(strlen($callnumber)<6){ | ||
| 212 | return Response::make("<script>simpleNotification('error','topRight','Enter a valid Number');</script>"); | ||
| 213 | } | ||
| 214 | if($crmid!="") | 219 | if($crmid!="") |
| 215 | { | 220 | { |
| 216 | $tusers=$wakka->getPersonIDs("(mobile like '%".substr($callnumber,-10)."' OR | 221 | $tusers=$wakka->getPersonIDs("(mobile like '%".substr($callnumber,-10)."' OR |
| ... | @@ -223,7 +228,7 @@ class DialerController extends Controller { | ... | @@ -223,7 +228,7 @@ class DialerController extends Controller { |
| 223 | altphone7 like '%".substr($callnumber,-10)."' OR | 228 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 224 | altphone8 like '%".substr($callnumber,-10)."' OR | 229 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 225 | altphone9 like '%".substr($callnumber,-10)."' OR | 230 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 226 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid $roclientstr "); | 231 | altphone10 like '%".substr($callnumber,-10)."') and id=$crmid ",$client); |
| 227 | 232 | ||
| 228 | 233 | ||
| 229 | } | 234 | } |
| ... | @@ -239,7 +244,7 @@ class DialerController extends Controller { | ... | @@ -239,7 +244,7 @@ class DialerController extends Controller { |
| 239 | altphone7 like '%".substr($callnumber,-10)."' OR | 244 | altphone7 like '%".substr($callnumber,-10)."' OR |
| 240 | altphone8 like '%".substr($callnumber,-10)."' OR | 245 | altphone8 like '%".substr($callnumber,-10)."' OR |
| 241 | altphone9 like '%".substr($callnumber,-10)."' OR | 246 | altphone9 like '%".substr($callnumber,-10)."' OR |
| 242 | altphone10 like '%".substr($callnumber,-10)."' $roclientstr"); | 247 | altphone10 like '%".substr($callnumber,-10)."'",$client); |
| 243 | 248 | ||
| 244 | } | 249 | } |
| 245 | 250 | ||
| ... | @@ -256,7 +261,7 @@ class DialerController extends Controller { | ... | @@ -256,7 +261,7 @@ class DialerController extends Controller { |
| 256 | altphone7 like '%$callnumber' OR | 261 | altphone7 like '%$callnumber' OR |
| 257 | altphone8 like '%$callnumber' OR | 262 | altphone8 like '%$callnumber' OR |
| 258 | altphone9 like '%$callnumber' OR | 263 | altphone9 like '%$callnumber' OR |
| 259 | altphone10 like '%$callnumber' ) and id in ($idstr) $roclientstr"); | 264 | altphone10 like '%$callnumber' ) and id in ($idstr)",$client); |
| 260 | 265 | ||
| 261 | if(!$users) | 266 | if(!$users) |
| 262 | { | 267 | { |
| ... | @@ -266,8 +271,9 @@ class DialerController extends Controller { | ... | @@ -266,8 +271,9 @@ class DialerController extends Controller { |
| 266 | 271 | ||
| 267 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") | 272 | if($kstychDialer['mDialerState']=="DialNext"||$kstychDialer['mDialerState']=="Progressive") |
| 268 | { | 273 | { |
| 269 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' $roclientstr limit 1"); | 274 | Log::info("crmid-->".$kstychCall['crmid']."--callnumber-->".$kstychCall['callnumber']); |
| 270 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1"); | 275 | if($kstychCall['crmid']!="")$users=$wakka->getPersons("id='".$kstychCall['crmid']."' limit 1",$client); |
| 276 | else if($kstychCall['callnumber']!="")$users=$wakka->getPersons("mobile='".$kstychCall['callnumber']."' $roclientstr limit 1",$client); | ||
| 271 | else $users=$this->getCallSequencing(1); | 277 | else $users=$this->getCallSequencing(1); |
| 272 | } | 278 | } |
| 273 | 279 | ||
| ... | @@ -281,6 +287,23 @@ class DialerController extends Controller { | ... | @@ -281,6 +287,23 @@ class DialerController extends Controller { |
| 281 | if(!isset($ppldata['department']))$ppldata['department']=""; | 287 | if(!isset($ppldata['department']))$ppldata['department']=""; |
| 282 | 288 | ||
| 283 | if($callnumber==""||intval($callnumber)<=0)$callnumber=$ppldata['mobile']; | 289 | if($callnumber==""||intval($callnumber)<=0)$callnumber=$ppldata['mobile']; |
| 290 | $callnumber = trim($callnumber); | ||
| 291 | |||
| 292 | if($kstychDialer['mDialerState']=="Manual"){ | ||
| 293 | if(!is_numeric($callnumber) || strlen($callnumber)<6){ | ||
| 294 | return Response::make("<script>simpleNotification('error','topRight','Please enter a valid phone number');</script>"); | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | if($kstychDialer['mDialerState']=="Progressive"){ | ||
| 299 | if(!is_numeric($callnumber) || strlen($callnumber)<6){ | ||
| 300 | Log::useFiles(storage_path().'/logs/Dialline_block_progressive.log'); | ||
| 301 | Log::info('Number='.$callnumber.' Campaign='.$ppldata['client']); | ||
| 302 | Log::info('PregMatch='.(!is_numeric($callnumber)).' StringLength='.strlen($callnumber)); | ||
| 303 | |||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 284 | if($callnumber!=""&&intval($callnumber)>0) | 307 | if($callnumber!=""&&intval($callnumber)>0) |
| 285 | { | 308 | { |
| 286 | $mastersdata=$wakka->getCompanyMaster($ppldata['client']); | 309 | $mastersdata=$wakka->getCompanyMaster($ppldata['client']); |
| ... | @@ -289,22 +312,24 @@ class DialerController extends Controller { | ... | @@ -289,22 +312,24 @@ class DialerController extends Controller { |
| 289 | 312 | ||
| 290 | $calleridarr=explode(":",$callerid);$dspan="1"; | 313 | $calleridarr=explode(":",$callerid);$dspan="1"; |
| 291 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} | 314 | if(isset($calleridarr[1])){$callerid=$calleridarr[0];$dspan=$calleridarr[1];} |
| 315 | /*$calleridarr=explode(":",env("non_open")); | ||
| 316 | $callerid=$calleridarr[0]; | ||
| 317 | $dspan =$calleridarr[1]; | ||
| 318 | }*/ | ||
| 292 | 319 | ||
| 293 | //see if user is online on this sipid | 320 | //see if user is online on this sipid |
| 294 | $sipid=Sipid::find($kstychDialer['phone']); | 321 | $sipid=Sipid::find($kstychDialer['phone']); |
| 295 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 322 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| 296 | { | 323 | { |
| 297 | 324 | ||
| 298 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | 325 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1")->where("server","=",env("app_ip")); |
| 299 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | 326 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); |
| 300 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); | 327 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); |
| 301 | 328 | ||
| 302 | if($dialline) | 329 | if($dialline) |
| 303 | { | 330 | { |
| 304 | //Log::info("before callconnected".$dialline->status." ^ ".$dialline->dchannel." ^ ".$dialline->dspan." ^ ".$callnumber." ^ ".$dialline->channel); | ||
| 305 | $dialline->status="Blocked"; | 331 | $dialline->status="Blocked"; |
| 306 | $dialline->save(); | 332 | $dialline->save(); |
| 307 | //Log::info("After diallineset".$dialline->status); | ||
| 308 | $nowts=microtime(true)*1000; | 333 | $nowts=microtime(true)*1000; |
| 309 | 334 | ||
| 310 | //get ts_Wait | 335 | //get ts_Wait |
| ... | @@ -333,11 +358,16 @@ class DialerController extends Controller { | ... | @@ -333,11 +358,16 @@ class DialerController extends Controller { |
| 333 | $tdata=array(); | 358 | $tdata=array(); |
| 334 | $crmcall->data=json_encode($tdata); | 359 | $crmcall->data=json_encode($tdata); |
| 335 | $crmcall->save(); | 360 | $crmcall->save(); |
| 361 | if($users[0]['id']>0){ | ||
| 362 | if($client!='')$records='records_'.$client;else $records='records'; | ||
| 336 | 363 | ||
| 364 | DB::table($records)->where('id',$users[0]['id'])->update(['filter_condition'=>'3','usr_id'=>Auth::user()->id]); | ||
| 365 | DB::table('records')->where('id',$users[0]['id'])->update(['usr_id'=>Auth::user()->id]); | ||
| 366 | } | ||
| 337 | //start actual calls | 367 | //start actual calls |
| 338 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); | 368 | $ppldata['dialer_lastcall']=date("Y-m-d H:i:s"); |
| 339 | $preppldata['peopledata'] = serialize($ppldata); | 369 | $preppldata['peopledata'] = serialize($ppldata); |
| 340 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata); | 370 | $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,$client); $wakka->setPerson($ppldata['peopledata']['id'],$preppldata,""); |
| 341 | 371 | ||
| 342 | $newqueue=new Kqueue(); | 372 | $newqueue=new Kqueue(); |
| 343 | $newqueue->userToConf($sipid); | 373 | $newqueue->userToConf($sipid); |
| ... | @@ -350,7 +380,7 @@ class DialerController extends Controller { | ... | @@ -350,7 +380,7 @@ class DialerController extends Controller { |
| 350 | 380 | ||
| 351 | 381 | ||
| 352 | $searchresult.="<div id=internalid_matchlist></div><script> | 382 | $searchresult.="<div id=internalid_matchlist></div><script> |
| 353 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | 383 | doAjax('record?action=quicksearch','maintextsearch_1_txt=".$users[0]['clientinternalid']."&maintextsearch_1_span=InternalID&client=$client','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ |
| 354 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | 384 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); |
| 355 | }); | 385 | }); |
| 356 | </script>"; | 386 | </script>"; |
| ... | @@ -370,7 +400,8 @@ class DialerController extends Controller { | ... | @@ -370,7 +400,8 @@ class DialerController extends Controller { |
| 370 | } | 400 | } |
| 371 | else | 401 | else |
| 372 | { | 402 | { |
| 373 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber"); | 403 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",$client); |
| 404 | $wakka->setPersonKey($users[0]['id'],"status","NoNumber","",""); | ||
| 374 | 405 | ||
| 375 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); | 406 | return Response::make($searchresult."<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); |
| 376 | } | 407 | } |
| ... | @@ -398,7 +429,7 @@ if($action=="addconfcall") | ... | @@ -398,7 +429,7 @@ if($action=="addconfcall") |
| 398 | $olddialline=Dialline::find($oldcrmcall->dialline_id); | 429 | $olddialline=Dialline::find($oldcrmcall->dialline_id); |
| 399 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; | 430 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; |
| 400 | 431 | ||
| 401 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | 432 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1")->where("server","=",env("app_ip")); |
| 402 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | 433 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); |
| 403 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); | 434 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); |
| 404 | 435 | ||
| ... | @@ -463,9 +494,118 @@ if($action=="addconfcall") | ... | @@ -463,9 +494,118 @@ if($action=="addconfcall") |
| 463 | return Response::make($retstr); | 494 | return Response::make($retstr); |
| 464 | } | 495 | } |
| 465 | 496 | ||
| 497 | if($action=="transfercall") | ||
| 498 | { | ||
| 499 | $retstr=""; | ||
| 500 | $callnumber=Input::get("confnumber"); | ||
| 501 | $callerid=""; | ||
| 502 | //see if user is online on this sipid | ||
| 503 | $sipid=Sipid::find($kstychDialer['phone']); | ||
| 504 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | ||
| 505 | { | ||
| 506 | $oldcrmcall=CRMCall::find($kstychCall['callid']); | ||
| 507 | if($oldcrmcall) | ||
| 508 | { | ||
| 509 | $olddialline=Dialline::find($oldcrmcall->dialline_id); | ||
| 510 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; | ||
| 511 | |||
| 512 | // $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | ||
| 513 | // if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | ||
| 514 | // $dialline=$dialline->orderBy('updated_at','ASC')->first(); | ||
| 515 | |||
| 516 | if($olddialline) | ||
| 517 | { | ||
| 518 | $callerid=$oldcrmcall->did; | ||
| 519 | |||
| 520 | // $dialline->status="transfer"; | ||
| 521 | // $dialline->channel=$olddialline->channel; | ||
| 522 | // $dialline->save(); | ||
| 523 | |||
| 524 | $nowts=microtime(true)*1000; | ||
| 525 | |||
| 526 | //start the call log | ||
| 527 | $crmcall=new CRMCall(); | ||
| 528 | $crmcall->number=$callnumber; | ||
| 529 | $crmcall->user_id=Auth::user()->id; | ||
| 530 | $crmcall->sipid_id=$sipid->id; | ||
| 531 | $crmcall->crm_id=$oldcrmcall->crm_id; | ||
| 532 | $crmcall->client=$oldcrmcall->client; | ||
| 533 | $crmcall->department=$oldcrmcall->department; | ||
| 534 | $crmcall->state='New'; | ||
| 535 | $crmcall->userstatus='Transfer'; | ||
| 536 | $crmcall->usersubstatus='Transfer'; | ||
| 537 | $crmcall->type='Transfer'; | ||
| 538 | //$crmcall->dialline_id=$dialline->id; | ||
| 539 | |||
| 540 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 541 | $crmcall->setTs('ts_Call',$nowts); | ||
| 542 | |||
| 543 | $crmcall->did=$callerid; | ||
| 544 | |||
| 545 | $tdata=array(); | ||
| 546 | $crmcall->data=json_encode($tdata); | ||
| 547 | $crmcall->save(); | ||
| 548 | |||
| 549 | |||
| 550 | $newqueue=new Kqueue(); | ||
| 551 | $newqueue->transferCall($sipid,$callnumber,$callerid,$crmcall,$olddialline); | ||
| 552 | //start actual calls | ||
| 553 | // $newqueue=new Kqueue(); | ||
| 554 | // $newqueue->userToConf($sipid); | ||
| 555 | // $newqueue=new Kqueue(); | ||
| 556 | // $newqueue->custToConf($sipid,$callnumber,$callerid,$crmcall,$dialline); | ||
| 557 | |||
| 558 | $retstr=$crmcall->id; | ||
| 559 | } | ||
| 560 | else | ||
| 561 | { | ||
| 562 | $retstr="Error : No Lines Free to Dial!"; | ||
| 563 | } | ||
| 564 | } | ||
| 565 | else | ||
| 566 | { | ||
| 567 | $retstr="Error : No calls to conference found!"; | ||
| 568 | } | ||
| 569 | } | ||
| 570 | else | ||
| 571 | { | ||
| 572 | $retstr="Error : You Are Not Connected!"; | ||
| 573 | } | ||
| 574 | |||
| 575 | return Response::make($retstr); | ||
| 576 | } | ||
| 577 | |||
| 578 | |||
| 466 | if($action=="hangupall") | 579 | if($action=="hangupall") |
| 467 | { | 580 | { |
| 468 | $res=0; | 581 | $res=0; |
| 582 | $aUser = Auth::user(); | ||
| 583 | If($aUser->current_dialmode == "Predictive"){ | ||
| 584 | $avgTimeArr = array(); | ||
| 585 | $user_id = $aUser->id; | ||
| 586 | $campaign = $aUser->sel_campaign; | ||
| 587 | |||
| 588 | $avgTimeArr = $this->getAvgTimeArray($campaign, $user_id); | ||
| 589 | |||
| 590 | $cutOffUsrArr = Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->get(); | ||
| 591 | |||
| 592 | if(count($cutOffUsrArr)){ | ||
| 593 | Cutoff::where('user_id', '=', $user_id)->where('c_name', '=', $campaign)->update( | ||
| 594 | ['hangup_time' => date('Y-m-d H:i:s'), | ||
| 595 | 'avg_dispo' => $avgTimeArr['avgdisposec'] | ||
| 596 | ]); | ||
| 597 | } | ||
| 598 | else | ||
| 599 | { | ||
| 600 | $cutoff = new Cutoff(); | ||
| 601 | $cutoff->user_id = $user_id; | ||
| 602 | $cutoff->c_name = $campaign; | ||
| 603 | $cutoff->hangup_time = date('Y-m-d H:i:s'); | ||
| 604 | $cutoff->avg_dispo = $avgTimeArr['avgdisposec']; | ||
| 605 | $cutoff->avg_ring = 0; | ||
| 606 | $cutoff->save(); | ||
| 607 | } | ||
| 608 | } | ||
| 469 | $callid=intval($kstychCall['callid'])+0; | 609 | $callid=intval($kstychCall['callid'])+0; |
| 470 | $crmcall=CRMCall::find($callid); | 610 | $crmcall=CRMCall::find($callid); |
| 471 | if($crmcall&&$crmcall->user_id==Auth::user()->id) | 611 | if($crmcall&&$crmcall->user_id==Auth::user()->id) |
| ... | @@ -527,6 +667,7 @@ if($action=="hangupall") | ... | @@ -527,6 +667,7 @@ if($action=="hangupall") |
| 527 | 667 | ||
| 528 | if($action=="closecall") | 668 | if($action=="closecall") |
| 529 | { | 669 | { |
| 670 | //echo "Manoj"; | ||
| 530 | $callid=intval($kstychCall['callid'])+0; | 671 | $callid=intval($kstychCall['callid'])+0; |
| 531 | $crmcall=CRMCall::find($callid); | 672 | $crmcall=CRMCall::find($callid); |
| 532 | if($crmcall&&$crmcall->user_id==Auth::user()->id) | 673 | if($crmcall&&$crmcall->user_id==Auth::user()->id) |
| ... | @@ -537,12 +678,18 @@ if($action=="closecall") | ... | @@ -537,12 +678,18 @@ if($action=="closecall") |
| 537 | { | 678 | { |
| 538 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); | 679 | $kstychCall["usercallback"]=date("Y-m-d H:i:s",strtotime($kstychCall["usercallback"].":00")+((Auth::user()->timezone)*60)); |
| 539 | } | 680 | } |
| 681 | if($kstychCall["userappointment"]!="") | ||
| 682 | { | ||
| 683 | $kstychCall["userappointment"]=date("Y-m-d H:i:s",strtotime($kstychCall["userappointment"].":00")+((Auth::user()->timezone)*60)); | ||
| 684 | } | ||
| 540 | 685 | ||
| 541 | $crmcall->setTs('ts_Close',$nowts); | 686 | $crmcall->setTs('ts_Close',$nowts); |
| 542 | 687 | ||
| 543 | $crmcall->userstatus =$kstychCall["userstatus"]; | 688 | $crmcall->userstatus =$kstychCall["userstatus"]; |
| 544 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; | 689 | $crmcall->usersubstatus =$kstychCall["usersubstatus"]; |
| 545 | $crmcall->usercallback =$kstychCall["usercallback"]; | 690 | $crmcall->usercallback =$kstychCall["usercallback"]; |
| 691 | $crmcall->userappointmentdate =$kstychCall["userappointment"]; | ||
| 692 | //$user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 546 | //$kstychCall["attempt"]=''; | 693 | //$kstychCall["attempt"]=''; |
| 547 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; | 694 | $crmcall->attempt = isset($kstychCall["attempt"]) ? $kstychCall["attempt"] : ' '; |
| 548 | $crmcall->call_flag="Z"; | 695 | $crmcall->call_flag="Z"; |
| ... | @@ -560,13 +707,15 @@ if($action=="closecall") | ... | @@ -560,13 +707,15 @@ if($action=="closecall") |
| 560 | { | 707 | { |
| 561 | $crmcall->crm_id=$kstychCall["crmid"]; | 708 | $crmcall->crm_id=$kstychCall["crmid"]; |
| 562 | 709 | ||
| 563 | $temparr=$wakka->getPerson($crmcall->crm_id); | 710 | $temparr=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 711 | Log::info("client---->in close1 --".$crmcall->client); | ||
| 564 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; | 712 | if(isset($temparr)&&isset($temparr['peopledata'])&&isset($temparr['peopledata']['client']))$crmcall->client=$temparr['peopledata']['client']; |
| 565 | } | 713 | } |
| 566 | } | 714 | } |
| 567 | 715 | ||
| 568 | if($crmcall->crm_id>0) | 716 | if($crmcall->crm_id>0) |
| 569 | { | 717 | { |
| 718 | //print_r("manoj1"); | ||
| 570 | if(is_array($kstychCall["userdata"])) | 719 | if(is_array($kstychCall["userdata"])) |
| 571 | { | 720 | { |
| 572 | foreach($kstychCall["userdata"] as $tcrmid=>$tuserdata) | 721 | foreach($kstychCall["userdata"] as $tcrmid=>$tuserdata) |
| ... | @@ -609,11 +758,14 @@ if($action=="closecall") | ... | @@ -609,11 +758,14 @@ if($action=="closecall") |
| 609 | $tcrmcall->save(); | 758 | $tcrmcall->save(); |
| 610 | 759 | ||
| 611 | 760 | ||
| 761 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 612 | 762 | ||
| 613 | $tuser=$wakka->getPerson($tcrmid); | 763 | $tuser=$wakka->getPerson($tcrmid,$crmcall->client); |
| 764 | Log::info("client in 2-->".$crmcall->client); | ||
| 614 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 765 | $tuser['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 615 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 766 | $tuser['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 616 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 767 | $tuser['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 768 | $tuser['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 617 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 769 | $tuser['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 618 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 770 | $tuser['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 619 | 771 | ||
| ... | @@ -622,28 +774,36 @@ if($action=="closecall") | ... | @@ -622,28 +774,36 @@ if($action=="closecall") |
| 622 | $tuser["resolution"]=$kstychCall["resolution"]; | 774 | $tuser["resolution"]=$kstychCall["resolution"]; |
| 623 | $tuser["satisfy"]=$kstychCall["satisfy"]; | 775 | $tuser["satisfy"]=$kstychCall["satisfy"]; |
| 624 | $tuser["final_call_assess"]=$kstychCall["final_call_assess"]; | 776 | $tuser["final_call_assess"]=$kstychCall["final_call_assess"]; |
| 625 | 777 | //print_r($tuser['peopledata']["status"]); | |
| 626 | $tuser['peopledata']["dialer_userdata"]=$kstychCall["userdata"][$tcrmid]; | 778 | $tuser['peopledata']["dialer_userdata"]=$kstychCall["userdata"][$tcrmid]; |
| 627 | if($tuser['peopledata']["status"]=='New' || $tuser['peopledata']["status"]=='NEW')$tuser['peopledata']["status"]="Called"; | 779 | if($tuser['peopledata']["status"]=='New' || $tuser['peopledata']["status"]=='NEW' || $tuser['peopledata']["status"]=='Incall')$tuser['peopledata']["status"]="Called"; |
| 628 | 780 | ||
| 781 | //Log::info("Manoj ".$tuser['peopledata']["status"]); | ||
| 782 | //print_r($tuser['peopledata']["status"]); | ||
| 629 | //for Supervisor Comments - By Manish | 783 | //for Supervisor Comments - By Manish |
| 630 | $tuser['agentcomments']=$kstychCall["agentcomments"]; | 784 | $tuser['agentcomments']=$kstychCall["agentcomments"]; |
| 631 | $tuser['supcomntid']=$kstychCall["supcomntid"]; | 785 | $tuser['supcomntid']=$kstychCall["supcomntid"]; |
| 632 | 786 | ||
| 633 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); | 787 | $tuser['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); |
| 634 | $wakka->setPerson($tcrmid,$tuser); | 788 | $wakka->setPerson($tcrmid,$tuser,$crmcall->client); |
| 789 | $wakka->setPerson($tcrmid,$tuser,""); | ||
| 635 | } | 790 | } |
| 636 | } | 791 | } |
| 637 | } | 792 | } |
| 638 | } | 793 | } |
| 639 | 794 | ||
| 640 | 795 | ||
| 641 | $user=$wakka->getPerson($crmcall->crm_id); | 796 | $user=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 797 | Log::info("client in 3 --".$crmcall->client); | ||
| 642 | if($user['peopledata']['id']==$crmcall->crm_id) | 798 | if($user['peopledata']['id']==$crmcall->crm_id) |
| 643 | { | 799 | { |
| 800 | if($crmcall->crm_id>0){ | ||
| 801 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 802 | } | ||
| 644 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; | 803 | $user['peopledata']["dialer_status"]=$kstychCall["userstatus"]; |
| 645 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; | 804 | $user['peopledata']["dialer_substatus"]=$kstychCall["usersubstatus"]; |
| 646 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; | 805 | $user['peopledata']["dialer_callback"]=$kstychCall["usercallback"]; |
| 806 | $user['peopledata']["dialer_appointment"]=$kstychCall["userappointment"]; | ||
| 647 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); | 807 | $user['peopledata']["dialer_remarks"]=str_replace("'","",$kstychCall["userremarks"]); |
| 648 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; | 808 | $user['peopledata']["dialer_flag"]=$kstychCall["userflag"]; |
| 649 | 809 | ||
| ... | @@ -668,26 +828,35 @@ if($action=="closecall") | ... | @@ -668,26 +828,35 @@ if($action=="closecall") |
| 668 | 828 | ||
| 669 | $user['peopledata']["dialer_userdata"]=$kstychCall["userdata"][$crmcall->crm_id]; | 829 | $user['peopledata']["dialer_userdata"]=$kstychCall["userdata"][$crmcall->crm_id]; |
| 670 | $user['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); | 830 | $user['peopledata']["dialer_lastcall"]=date("Y-m-d H:i:s"); |
| 671 | if($user['peopledata']["status"]=='New' || $user['peopledata']["status"]=='NEW')$user['peopledata']["status"]="Called"; | 831 | if($user['peopledata']["status"]=='New' || $user['peopledata']["status"]=='NEW' || $user['peopledata']["status"]=='Incall')$user['peopledata']["status"]="Called"; |
| 672 | //for Supervisor Comments - By Manish | 832 | //for Supervisor Comments - By Manish |
| 673 | $user['agentcomments']=$kstychCall["agentcomments"]; | 833 | $user['agentcomments']=$kstychCall["agentcomments"]; |
| 674 | $user['supcomntid']=$kstychCall["supcomntid"]; | 834 | $user['supcomntid']=$kstychCall["supcomntid"]; |
| 675 | 835 | ||
| 676 | $wakka->setPerson($crmcall->crm_id,$user); | 836 | $wakka->setPerson($crmcall->crm_id,$user,$crmcall->client); |
| 677 | 837 | $wakka->setPerson($crmcall->crm_id,$user,""); | |
| 678 | //update groupid if this is not groupid TODO move to config | 838 | //update groupid if this is not groupid TODO move to config |
| 679 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) | 839 | if($user['peopledata']['clientcode']!=$user['peopledata']['clientinternalid']) |
| 680 | { | 840 | { |
| 681 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1"); | 841 | Log::info("client in 4 -->".$crmcall->client); |
| 842 | $tusers=$wakka->getPersons(" clientinternalid='".$user['peopledata']['clientinternalid']."' limit 1",$crmcall->client); | ||
| 682 | 843 | ||
| 683 | if(!empty($tusers)) | 844 | if(!empty($tusers)) |
| 684 | { | 845 | { |
| 685 | $tppldata=unserialize($tusers[0]['peopledata']); | 846 | $tppldata=unserialize($tusers[0]['peopledata']); |
| 686 | if($tppldata['status']=='New')$wakka->setPersonKey($tusers[0]['id'],'status','Called'); | 847 | if($tppldata['status']=='New' || $tppldata['status']=='Incall'){ |
| 848 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",$crmcall->client); | ||
| 849 | $wakka->setPersonKey($tusers[0]['id'],'status','Called',"",""); | ||
| 850 | } | ||
| 851 | |||
| 852 | //print_r($tppldata['status']); | ||
| 853 | //Log::info($tppldata['status']); | ||
| 687 | //if($tppldata['dialer_status']=='') //TODO Config | 854 | //if($tppldata['dialer_status']=='') //TODO Config |
| 688 | { | 855 | { |
| 689 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"]); | 856 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",$crmcall->client); |
| 690 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"]); | 857 | $wakka->setPersonKey($tusers[0]['id'],'dialer_status',$user['peopledata']["dialer_status"],"",""); |
| 858 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",$crmcall->client); | ||
| 859 | $wakka->setPersonKey($tusers[0]['id'],'dialer_substatus',$user['peopledata']["dialer_substatus"],"",""); | ||
| 691 | } | 860 | } |
| 692 | } | 861 | } |
| 693 | } | 862 | } |
| ... | @@ -811,13 +980,24 @@ if($action=="kCallAction") | ... | @@ -811,13 +980,24 @@ if($action=="kCallAction") |
| 811 | 980 | ||
| 812 | if($action=="dialerstate") | 981 | if($action=="dialerstate") |
| 813 | { | 982 | { |
| 814 | $ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; | 983 | //$ready=0;if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait")$ready=1; |
| 984 | $ready=0;$perpareCall=0; | ||
| 985 | if($kstychDialer['mDialerState']=="Ready"&&$kstychCall['mCallState']=="Wait") | ||
| 986 | { | ||
| 987 | $ready=1; | ||
| 988 | } | ||
| 989 | |||
| 990 | if($kstychDialer['mDialerSubState']=="Predictive"&&$kstychCall['mCallState']=="Wait") | ||
| 991 | { | ||
| 992 | $perpareCall=1; | ||
| 993 | } | ||
| 815 | $nowts=microtime(true)*1000; | 994 | $nowts=microtime(true)*1000; |
| 816 | 995 | ||
| 817 | $sipid=Sipid::find($kstychDialer['phone']); | 996 | $sipid=Sipid::find($kstychDialer['phone']); |
| 818 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) | 997 | if($sipid&&$sipid->user==Auth::user()->id&&$sipid->status==1) |
| 819 | { | 998 | { |
| 820 | $sipid->ready=$ready; | 999 | $sipid->ready=$ready; |
| 1000 | $sipid->prepare_call=$perpareCall; | ||
| 821 | $sipid->save(); | 1001 | $sipid->save(); |
| 822 | 1002 | ||
| 823 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); | 1003 | $userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first(); |
| ... | @@ -826,6 +1006,71 @@ if($action=="dialerstate") | ... | @@ -826,6 +1006,71 @@ if($action=="dialerstate") |
| 826 | } | 1006 | } |
| 827 | return Response::make(""); | 1007 | return Response::make(""); |
| 828 | } | 1008 | } |
| 1009 | if($action=="usersel") | ||
| 1010 | { | ||
| 1011 | |||
| 1012 | $user = Auth::user(); | ||
| 1013 | $currDialerState = $kstychDialer['mDialerState']; | ||
| 1014 | //$client=Input::get("client"); | ||
| 1015 | if($kstychDialer['mDialerSubState'] != "") | ||
| 1016 | $currDialerState = $kstychDialer['mDialerSubState']; | ||
| 1017 | if($client!=""){ | ||
| 1018 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1019 | 'sel_campaign'=>$client, | ||
| 1020 | 'current_dialmode'=>$currDialerState | ||
| 1021 | ]); | ||
| 1022 | }else{ | ||
| 1023 | DB::table('users')->where('id', Auth::user()->id)->update([ | ||
| 1024 | 'current_dialmode'=>$currDialerState | ||
| 1025 | ]); | ||
| 1026 | |||
| 1027 | } | ||
| 1028 | |||
| 1029 | $campaigndata = Sipid::select("clients")->where("user", $user->id)->where("status", "=", 1)->first(); | ||
| 1030 | |||
| 1031 | if($campaigndata) | ||
| 1032 | { | ||
| 1033 | $campdata= json_decode($campaigndata->clients); | ||
| 1034 | if(Auth::user()->id!='1'){ | ||
| 1035 | $campdata->sel_campaign=$client; | ||
| 1036 | |||
| 1037 | Sipid::where("user",$user->id)->update(["clients"=>json_encode($campdata)]); | ||
| 1038 | } | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | return Response::make(""); | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | if($action=="sipcleanup") | ||
| 1045 | { | ||
| 1046 | $user = Auth::user(); | ||
| 1047 | |||
| 1048 | $sipid = Sipid::where("user", $user->id)->select('id')->first(); | ||
| 1049 | |||
| 1050 | Sipid::where("user", $user->id)->update([ | ||
| 1051 | "user" => 0, | ||
| 1052 | "status" => 0, | ||
| 1053 | "ready" => 0, | ||
| 1054 | "patched" => 0, | ||
| 1055 | "prepare_call" => 0, | ||
| 1056 | "confup" => 0, | ||
| 1057 | "clients" => "" | ||
| 1058 | ]); | ||
| 1059 | |||
| 1060 | $diallines = Dialline::where('status', '!=', 'Free')->where('conf', '=', "1000".$sipid->id); | ||
| 1061 | if($diallines){ | ||
| 1062 | $diallines=$diallines->get(); | ||
| 1063 | |||
| 1064 | foreach ($diallines as $dialline) { | ||
| 1065 | $newqueue=new Kqueue(); | ||
| 1066 | $newqueue->hangupChannelS($dialline->channel,$dialline->server); | ||
| 1067 | } | ||
| 1068 | } | ||
| 1069 | if(count($sipid)){ | ||
| 1070 | exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid->id.'"'); | ||
| 1071 | exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid->id.' all"'); | ||
| 1072 | } | ||
| 1073 | } | ||
| 829 | 1074 | ||
| 830 | if($action=="spychannel") | 1075 | if($action=="spychannel") |
| 831 | { | 1076 | { |
| ... | @@ -856,11 +1101,14 @@ if($action=="recarchive") | ... | @@ -856,11 +1101,14 @@ if($action=="recarchive") |
| 856 | } | 1101 | } |
| 857 | public function show($id) | 1102 | public function show($id) |
| 858 | { | 1103 | { |
| 1104 | //echo "show--->".$id; | ||
| 1105 | //exit(); | ||
| 859 | if($id=="bucketdata") | 1106 | if($id=="bucketdata") |
| 860 | { | 1107 | { |
| 1108 | //Log::info("ABCDDD----".Input::get("client")); | ||
| 861 | $client=Input::get("client",""); | 1109 | $client=Input::get("client",""); |
| 862 | $bucket=Input::get("bucket"); | 1110 | $bucket=Input::get("bucket"); |
| 863 | $currentstatus=Input::get("currentstatus"); | 1111 | //$currentstatus=Input::get("currentstatus"); |
| 864 | $legalstatus=Input::get("legalstatus"); | 1112 | $legalstatus=Input::get("legalstatus"); |
| 865 | $page=intval(Input::get('page'));if($page<1)$page=1; | 1113 | $page=intval(Input::get('page'));if($page<1)$page=1; |
| 866 | $skey=Input::get('skey'); | 1114 | $skey=Input::get('skey'); |
| ... | @@ -912,9 +1160,9 @@ public function show($id) | ... | @@ -912,9 +1160,9 @@ public function show($id) |
| 912 | $birthdate=date('m-d'); | 1160 | $birthdate=date('m-d'); |
| 913 | 1161 | ||
| 914 | $dbres=array(); | 1162 | $dbres=array(); |
| 915 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(20); | 1163 | if($bucket=="CurrentQueue")$dbres=$this->getCallSequencing(1); |
| 916 | else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); | 1164 | /*else if($bucket=="Priority")$dbres=$wakka->getPersons("priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) $owclientstr ORDER BY FIELD(priority,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) limit $bs,$bl"); |
| 917 | else if($bucket=="TotalData")$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); | 1165 | else if($bucket=="TotalData")//$dbres=$wakka->getPersons("1=1 and currentstatus='$currentstatus' and legalstatus='$legalstatus' and status!='Noqueue' $owclientstr limit $bs,$bl"); |
| 918 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); | 1166 | else if($bucket=="SearchData")$dbres=$wakka->getPersons("1=1 $roclientstrAll $skey limit $bs,$bl"); |
| 919 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1167 | else if($bucket=="NotCalled")$dbres=$wakka->getPersons("status='New' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 920 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); | 1168 | else if($bucket=="Called")$dbres=$wakka->getPersons("status='Called' $owclientstr limit $bs,$bl"); |
| ... | @@ -922,9 +1170,9 @@ public function show($id) | ... | @@ -922,9 +1170,9 @@ public function show($id) |
| 922 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1170 | else if($bucket=="Flagged-Called")$dbres=$wakka->getPersons("dialer_flag='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 923 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); | 1171 | else if($bucket=="Flagged-Notcalled")$dbres=$wakka->getPersons("mf_isa='VIP' and currentstatus='$currentstatus' and legalstatus='$legalstatus' $owclientstr limit $bs,$bl"); |
| 924 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); | 1172 | else if($bucket=="today-birthday")$dbres=$wakka->getPersons("DATE_FORMAT(DOB,'%m-%d')='$birthdate' and priority='11' $owclientstr limit $bs,$bl"); |
| 925 | 1173 | */ | |
| 926 | else if($bucket=="MissedCalls") | 1174 | else if($bucket=="MissedCalls") |
| 927 | { | 1175 | {/* |
| 928 | $udidlinesstr = array(); | 1176 | $udidlinesstr = array(); |
| 929 | foreach($didlinesstr as $didlinestr){ | 1177 | foreach($didlinesstr as $didlinestr){ |
| 930 | $didlinestrArr=explode(":",$didlinestr); | 1178 | $didlinestrArr=explode(":",$didlinestr); |
| ... | @@ -940,7 +1188,6 @@ public function show($id) | ... | @@ -940,7 +1188,6 @@ public function show($id) |
| 940 | $number_list=array(); | 1188 | $number_list=array(); |
| 941 | 1189 | ||
| 942 | foreach($mc as $key=>$tcall){ | 1190 | foreach($mc as $key=>$tcall){ |
| 943 | //Log::info($tcall); | ||
| 944 | $tccal=substr($tcall->number,-10); | 1191 | $tccal=substr($tcall->number,-10); |
| 945 | $mc_number=CRMCall::where('userstatus','!=','InboundDROP')->where ('created_at','>',$tcall->created_at)->where('number','like',"%".$tccal."%")->orderBy("id","DESC")->first(); | 1192 | $mc_number=CRMCall::where('userstatus','!=','InboundDROP')->where ('created_at','>',$tcall->created_at)->where('number','like',"%".$tccal."%")->orderBy("id","DESC")->first(); |
| 946 | 1193 | ||
| ... | @@ -954,12 +1201,8 @@ public function show($id) | ... | @@ -954,12 +1201,8 @@ public function show($id) |
| 954 | 1201 | ||
| 955 | if(count($number_list) > 0) { | 1202 | if(count($number_list) > 0) { |
| 956 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); | 1203 | $lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number) ORDER BY id DESC"); |
| 957 | //$lcalls=DB::select("SELECT * FROM crmcalls where id in (SELECT max(id) FROM crmcalls WHERE number IN ('" . implode("','", $number_list). "') GROUP BY number)"); | ||
| 958 | //$lcalls=$lcalls->orderBy("id","DESC"); | ||
| 959 | // Log::info($lcalls->id); | ||
| 960 | foreach($lcalls as $lcall) | 1204 | foreach($lcalls as $lcall) |
| 961 | { | 1205 | { |
| 962 | //Log::info($lcall); | ||
| 963 | if($lcall->userstatus=="InboundDROP") | 1206 | if($lcall->userstatus=="InboundDROP") |
| 964 | { | 1207 | { |
| 965 | if($lcall->crm_id>0) | 1208 | if($lcall->crm_id>0) |
| ... | @@ -981,18 +1224,15 @@ public function show($id) | ... | @@ -981,18 +1224,15 @@ public function show($id) |
| 981 | 1224 | ||
| 982 | if(!empty($reccrm_ids)) | 1225 | if(!empty($reccrm_ids)) |
| 983 | { | 1226 | { |
| 984 | //Log::info($dbres); | ||
| 985 | $recids_str = implode(",", $reccrm_ids); | 1227 | $recids_str = implode(",", $reccrm_ids); |
| 986 | $rec=$wakka->getPersonsMissedcall("id in ($recids_str)"); | 1228 | $rec=$wakka->getPersonsMissedcall("id in ($recids_str)"); |
| 987 | 1229 | ||
| 988 | //Log::info($dbres); | ||
| 989 | $dbres = array_merge($dbres,$rec); | 1230 | $dbres = array_merge($dbres,$rec); |
| 990 | //Log::info($dbres); | ||
| 991 | } | 1231 | } |
| 992 | } | 1232 | } |
| 993 | 1233 | ||
| 994 | 1234 | ||
| 995 | } | 1235 | */ } |
| 996 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1236 | else if($bucket=="CallsToday")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-d 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 997 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); | 1237 | else if($bucket=="CallsMonth")$dbres=$wakka->getPersons("dialer_lastcall>='".date("Y-m-01 00:00:00",time()+((Auth::user()->timezone)*60))."' $owclientstr limit $bs,$bl"); |
| 998 | 1238 | ||
| ... | @@ -1004,12 +1244,11 @@ public function show($id) | ... | @@ -1004,12 +1244,11 @@ public function show($id) |
| 1004 | $dbres=$wakka->getPersons("dialer_status='$bucket' $currentstatus2 $legalstatus2 $owclientstr limit $bs,$bl"); | 1244 | $dbres=$wakka->getPersons("dialer_status='$bucket' $currentstatus2 $legalstatus2 $owclientstr limit $bs,$bl"); |
| 1005 | } | 1245 | } |
| 1006 | 1246 | ||
| 1007 | $ccountsummary=array();$k=1;//Log::info(count($dbres)); | 1247 | $ccountsummary=array();$k=1; |
| 1008 | foreach($dbres as $dbrow) | 1248 | foreach($dbres as $dbrow) |
| 1009 | { | 1249 | { |
| 1010 | if(isset($dbrow['callid'])) | 1250 | if(isset($dbrow['callid'])) |
| 1011 | { | 1251 | { |
| 1012 | //Log::info($dbrow['callid']); | ||
| 1013 | $lastcall=CRMCall::find($dbrow['callid']); | 1252 | $lastcall=CRMCall::find($dbrow['callid']); |
| 1014 | $callcntmonth=CRMCall::where("number","=",$dbrow['mobile'])->where("created_at",">=",date("Y-m-01 H:i:s",time()+((Auth::user()->timezone)*60)))->count(); | 1253 | $callcntmonth=CRMCall::where("number","=",$dbrow['mobile'])->where("created_at",">=",date("Y-m-01 H:i:s",time()+((Auth::user()->timezone)*60)))->count(); |
| 1015 | } | 1254 | } |
| ... | @@ -1030,12 +1269,11 @@ public function show($id) | ... | @@ -1030,12 +1269,11 @@ public function show($id) |
| 1030 | $lasttime=$lastcall->created_at;if($lasttime=="0000-00-00 00:00:00")$lasttime="";else $lasttime=date("d-M-y H:i:s",strtotime($lasttime)-((Auth::user()->timezone)*60)); | 1269 | $lasttime=$lastcall->created_at;if($lasttime=="0000-00-00 00:00:00")$lasttime="";else $lasttime=date("d-M-y H:i:s",strtotime($lasttime)-((Auth::user()->timezone)*60)); |
| 1031 | $dispo=$lastcall->userstatus; | 1270 | $dispo=$lastcall->userstatus; |
| 1032 | $subdispo=$lastcall->usersubstatus; | 1271 | $subdispo=$lastcall->usersubstatus; |
| 1033 | $followup=$dbrow[dialer_callback];if($followup=="0000-00-00 00:00:00")$followup="";else $followup=date("d-M-y H:i:s",strtotime($followup)-(Auth::user()->timezone*60)); | 1272 | $followup=$dbrow['dialer_callback'];if($followup=="0000-00-00 00:00:00")$followup="";else $followup=date("d-M-y H:i:s",strtotime($followup)-(Auth::user()->timezone*60)); |
| 1034 | $remarks=$lastcall->userremarks; | 1273 | $remarks=$lastcall->userremarks; |
| 1035 | $did=$lastcall->did; | 1274 | $did=$lastcall->did; |
| 1036 | } | 1275 | } |
| 1037 | //Log::info($dbrow[firstname]); | 1276 | if(stristr($dbrow['firstname'], "_ETHNIC_CODE14") != "") |
| 1038 | if(stristr($dbrow[firstname], "_ETHNIC_CODE14") != "") | ||
| 1039 | { | 1277 | { |
| 1040 | $rows.="<tr style='background-color: #59ee7c;color:#ffffff;font-weight: bolder;font-size:115%'>"; | 1278 | $rows.="<tr style='background-color: #59ee7c;color:#ffffff;font-weight: bolder;font-size:115%'>"; |
| 1041 | } | 1279 | } |
| ... | @@ -1122,7 +1360,7 @@ public function show($id) | ... | @@ -1122,7 +1360,7 @@ public function show($id) |
| 1122 | $data.=" | 1360 | $data.=" |
| 1123 | <div style='clear:both'></div> | 1361 | <div style='clear:both'></div> |
| 1124 | 1362 | ||
| 1125 | <table class='table '> | 1363 | <table class='table' style='display:none'> |
| 1126 | <thead> | 1364 | <thead> |
| 1127 | <tr> | 1365 | <tr> |
| 1128 | <th></th> | 1366 | <th></th> |
| ... | @@ -1147,6 +1385,125 @@ public function show($id) | ... | @@ -1147,6 +1385,125 @@ public function show($id) |
| 1147 | </table>"; | 1385 | </table>"; |
| 1148 | return Response::make($data); | 1386 | return Response::make($data); |
| 1149 | } | 1387 | } |
| 1388 | if($id=="loadFollowupData") | ||
| 1389 | { | ||
| 1390 | $wakka = new KHRMSLib(); | ||
| 1391 | $user=Auth::user()->id; | ||
| 1392 | $role = Auth::user()->usertype; | ||
| 1393 | $client = Input::get("client"); | ||
| 1394 | $selection = Input::get("selection"); | ||
| 1395 | $setClient = ''; | ||
| 1396 | $count = 0; | ||
| 1397 | |||
| 1398 | /*$calllog = DB::table('records') | ||
| 1399 | ->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 1400 | ->select('records.firstname', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 1401 | ->where("crmcalls.user_id",$user) | ||
| 1402 | //->where("records.dialer_substatus","Follow Up") | ||
| 1403 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | ||
| 1404 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 1405 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 1406 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 1407 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 1408 | ->get();*/ | ||
| 1409 | |||
| 1410 | $calllog = DB::table('records') | ||
| 1411 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 1412 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') | ||
| 1413 | ->where("dialer_callback", "!=","0000-00-00 00:00:00"); | ||
| 1414 | |||
| 1415 | if($role == 'Supervisor'){ | ||
| 1416 | $userName = Auth::user()->username; | ||
| 1417 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | ||
| 1418 | $supervisorUsers = implode(",",$supervisorUsers); | ||
| 1419 | if(!empty($supervisorUsers)){ | ||
| 1420 | |||
| 1421 | if($selection == 'all'){ | ||
| 1422 | $setClient =''; | ||
| 1423 | }else{ | ||
| 1424 | $setClient = $client; | ||
| 1425 | $calllog = $calllog->where('client', '=', $client); | ||
| 1426 | } | ||
| 1427 | |||
| 1428 | $calllog = $calllog->whereIn("usr_id",[$supervisorUsers]) | ||
| 1429 | ->get(); | ||
| 1430 | |||
| 1431 | $count = count($calllog); | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | }else if($role == 'User'){ | ||
| 1435 | if($selection == 'all'){ | ||
| 1436 | $setClient =''; | ||
| 1437 | }else{ | ||
| 1438 | $setClient = $client; | ||
| 1439 | $calllog = $calllog->where('client', '=', $client); | ||
| 1440 | } | ||
| 1441 | $calllog = $calllog->where("usr_id",$user)->get(); | ||
| 1442 | |||
| 1443 | $count = count($calllog); | ||
| 1444 | } | ||
| 1445 | |||
| 1446 | $data['calllog'] = $calllog; | ||
| 1447 | $data['client'] = $setClient; | ||
| 1448 | $data['count'] = $count; | ||
| 1449 | return view("layout.module.dialer.followUp",$data); | ||
| 1450 | } | ||
| 1451 | if($id=="loadAppointmentData") | ||
| 1452 | { | ||
| 1453 | |||
| 1454 | $wakka = new KHRMSLib(); | ||
| 1455 | $user=Auth::user()->id; | ||
| 1456 | $role = Auth::user()->usertype; | ||
| 1457 | $client = Input::get("client"); | ||
| 1458 | $selection = Input::get("selection"); | ||
| 1459 | $setClient = ''; | ||
| 1460 | $count = 0; | ||
| 1461 | |||
| 1462 | $totalAppointmentCount = DB::table('records') | ||
| 1463 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') | ||
| 1464 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 1465 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); | ||
| 1466 | //print_r($totalAppointmentCount); | ||
| 1467 | if($role == 'Supervisor'){ | ||
| 1468 | $userName = Auth::user()->username; | ||
| 1469 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | ||
| 1470 | $userIds = []; | ||
| 1471 | //print_r($supervisorUsers); | ||
| 1472 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | ||
| 1473 | $supervisorUsers = implode(",",$userIds); | ||
| 1474 | //echo $supervisorUsers; | ||
| 1475 | if(!empty($supervisorUsers)){ | ||
| 1476 | |||
| 1477 | if($selection == 'all'){ | ||
| 1478 | $setClient =''; | ||
| 1479 | }else{ | ||
| 1480 | $setClient = $client; | ||
| 1481 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1482 | } | ||
| 1483 | |||
| 1484 | $totalAppointmentCount = $totalAppointmentCount->whereIn("usr_id",[$supervisorUsers]) | ||
| 1485 | ->get(); | ||
| 1486 | |||
| 1487 | $count = count($totalAppointmentCount); | ||
| 1488 | } | ||
| 1489 | |||
| 1490 | }else if($role == 'User'){ | ||
| 1491 | if($selection == 'all'){ | ||
| 1492 | $setClient =''; | ||
| 1493 | }else{ | ||
| 1494 | $setClient = $client; | ||
| 1495 | $totalAppointmentCount = $totalAppointmentCount->where('client', '=', $client); | ||
| 1496 | } | ||
| 1497 | $totalAppointmentCount = $totalAppointmentCount->where("usr_id",$user)->get(); | ||
| 1498 | |||
| 1499 | $count = count($totalAppointmentCount); | ||
| 1500 | } | ||
| 1501 | |||
| 1502 | $data['appointment'] = $totalAppointmentCount; | ||
| 1503 | $data['client'] = $setClient; | ||
| 1504 | $data['count'] = $count; | ||
| 1505 | return view("layout.module.dialer.appointment",$data); | ||
| 1506 | } | ||
| 1150 | if($id=="reports") | 1507 | if($id=="reports") |
| 1151 | { | 1508 | { |
| 1152 | return view("layout.module.dialer.reports",array()); | 1509 | return view("layout.module.dialer.reports",array()); |
| ... | @@ -1393,11 +1750,13 @@ public function show($id) | ... | @@ -1393,11 +1750,13 @@ public function show($id) |
| 1393 | //echo "OK"; | 1750 | //echo "OK"; |
| 1394 | } | 1751 | } |
| 1395 | 1752 | ||
| 1396 | private function getCallSequencing($limit) | 1753 | public function getCallSequencing($limit,$client=null) |
| 1397 | { | 1754 | { |
| 1755 | //Log::info("Inside getCall"); | ||
| 1398 | $wakka = new KHRMSLib(); | 1756 | $wakka = new KHRMSLib(); |
| 1399 | 1757 | ||
| 1400 | $roclientstr=array();$didlinesstr=array(); | 1758 | $roclientstr=array();$didlinesstr=array(); |
| 1759 | if($client==null){ | ||
| 1401 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; | 1760 | if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; |
| 1402 | $oclientlst=$wakka->clientsOwnerRWAccess(); | 1761 | $oclientlst=$wakka->clientsOwnerRWAccess(); |
| 1403 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | 1762 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") |
| ... | @@ -1413,14 +1772,106 @@ public function show($id) | ... | @@ -1413,14 +1772,106 @@ public function show($id) |
| 1413 | $client=Input::get("client"); | 1772 | $client=Input::get("client"); |
| 1414 | 1773 | ||
| 1415 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; | 1774 | if(!empty($roclientstr))$roclientstr="client='$client'";else $roclientstr=""; |
| 1416 | |||
| 1417 | $users=array(); | 1775 | $users=array(); |
| 1418 | 1776 | ||
| 1419 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} | 1777 | if(Auth::user()->usertype!="User"){$tusers=array();return $tusers;} |
| 1420 | $clientDetails=$wakka->getPersonshome("$roclientstr order by dialer_lastcall asc"); | 1778 | }else{ |
| 1779 | $roclientstr="client='$client'"; | ||
| 1780 | Log::info($roclientstr); | ||
| 1781 | } | ||
| 1782 | //$client=$this->campaignlist($client); | ||
| 1783 | if($client!='')$records='records_'.$client;else $records='records'; | ||
| 1784 | DB::table($records)->where('filter_condition','=','2')->where('modified','<',date('Y-m-d H:i:s',time()-(2*60)))->update(['filter_condition'=>'1']); | ||
| 1785 | |||
| 1786 | //if($client!=''){ | ||
| 1787 | $tusers=$wakka->getPersonshome("filter_condition IN('0','1','4') and $roclientstr and dialer_callback <'".date('Y-m-d H:i:s',time()+(15*60))."' and usr_id='".Auth::user()->id."' and dialer_substatus='Follow Up' limit 1;",$client); | ||
| 1788 | if(count($tusers)>0){ | ||
| 1789 | if($limit>0){ | ||
| 1790 | $l=1; | ||
| 1791 | foreach($tusers as $tuser){ | ||
| 1792 | if(!isset($users[$tuser['id']])){ | ||
| 1793 | $users[$tuser['id']]=$tuser; | ||
| 1794 | $l++; | ||
| 1421 | 1795 | ||
| 1796 | if($l>$limit) | ||
| 1797 | break; | ||
| 1798 | } | ||
| 1799 | } | ||
| 1422 | 1800 | ||
| 1423 | if($limit>0) | 1801 | $limit=$limit-sizeof($tusers); |
| 1802 | } | ||
| 1803 | } | ||
| 1804 | //Log::info("clients-->".$roclientstr); | ||
| 1805 | $campaign=DB::table("campaign_query")->where('campaign', '=', $client)->where('current_queue','=','selected')->first(); | ||
| 1806 | //Log::info($campaign); | ||
| 1807 | if($campaign) | ||
| 1808 | { | ||
| 1809 | if(stripos($campaign->where_cond,"order by")===false){ | ||
| 1810 | $orderby="order by dialer_lastcall asc"; | ||
| 1811 | }else{ | ||
| 1812 | $orderby =""; | ||
| 1813 | } | ||
| 1814 | $tusers=$wakka->getPersonshome("filter_condition IN ('1','0') and dialer_callback ='0000-00-00 00:00:00' and $campaign->where_cond $orderby limit 1;",$client); | ||
| 1815 | //print_r($tusers); | ||
| 1816 | if(count($tusers)>0){ | ||
| 1817 | if($limit>0){ | ||
| 1818 | $l=1; | ||
| 1819 | foreach($tusers as $tuser){ | ||
| 1820 | //Log::info($tuser); | ||
| 1821 | if(!isset($users[$tuser['id']])){ | ||
| 1822 | //Log::info("2-".$users[$tuser['id']]); | ||
| 1823 | $users[$tuser['id']]=$tuser; | ||
| 1824 | $l++; | ||
| 1825 | |||
| 1826 | if($l>$limit) | ||
| 1827 | break; | ||
| 1828 | } | ||
| 1829 | } | ||
| 1830 | |||
| 1831 | $limit=$limit-sizeof($tusers); | ||
| 1832 | } | ||
| 1833 | }else{ | ||
| 1834 | $condition=$campaign->where_cond; | ||
| 1835 | if(stripos($condition,"order by")!==false){ | ||
| 1836 | $condition = substr($condition,0,stripos($condition, 'order by')); | ||
| 1837 | } | ||
| 1838 | $tusers=$wakka->getPersonshome("filter_condition=4 and $condition order by dialer_lastcall asc limit 1;",$client); | ||
| 1839 | if($limit>0){ | ||
| 1840 | $l=1; | ||
| 1841 | foreach($tusers as $tuser){ | ||
| 1842 | if(!isset($users[$tuser['id']])){ | ||
| 1843 | $users[$tuser['id']]=$tuser; | ||
| 1844 | $l++; | ||
| 1845 | |||
| 1846 | if($l>$limit) | ||
| 1847 | break; | ||
| 1848 | } | ||
| 1849 | } | ||
| 1850 | |||
| 1851 | $limit=$limit-sizeof($tusers); | ||
| 1852 | } | ||
| 1853 | } | ||
| 1854 | }else{ | ||
| 1855 | $tusers=$wakka->getPersonshome("filter_condition NOT IN ('2','3') and status='New' order by dialer_lastcall asc limit 1;",$client); | ||
| 1856 | if($limit>0){ | ||
| 1857 | $l=1; | ||
| 1858 | foreach($tusers as $tuser){ | ||
| 1859 | if(!isset($users[$tuser['id']])){ | ||
| 1860 | $users[$tuser['id']]=$tuser; | ||
| 1861 | $l++; | ||
| 1862 | |||
| 1863 | if($l>$limit) | ||
| 1864 | break; | ||
| 1865 | } | ||
| 1866 | } | ||
| 1867 | |||
| 1868 | $limit=$limit-sizeof($tusers); | ||
| 1869 | } | ||
| 1870 | |||
| 1871 | //print_r($clientDetails); | ||
| 1872 | //print_r($clientDetails); | ||
| 1873 | |||
| 1874 | /*if($limit>0) | ||
| 1424 | { | 1875 | { |
| 1425 | $tusers = array_filter($clientDetails, function($var){ | 1876 | $tusers = array_filter($clientDetails, function($var){ |
| 1426 | return ($var['dialer_status']=='InboundDROP' && $var['dialer_lastcall']>'2018-09-11 00:00:00' && $var['dialer_lastcall']>date('Y-m-d H:i:s',time()-(7*24*60*60))); | 1877 | return ($var['dialer_status']=='InboundDROP' && $var['dialer_lastcall']>'2018-09-11 00:00:00' && $var['dialer_lastcall']>date('Y-m-d H:i:s',time()-(7*24*60*60))); |
| ... | @@ -1438,9 +1889,9 @@ public function show($id) | ... | @@ -1438,9 +1889,9 @@ public function show($id) |
| 1438 | } | 1889 | } |
| 1439 | 1890 | ||
| 1440 | $limit=$limit-sizeof($tusers); | 1891 | $limit=$limit-sizeof($tusers); |
| 1441 | } | 1892 | }*/ |
| 1442 | 1893 | ||
| 1443 | if($limit>0) | 1894 | /*if($limit>0) |
| 1444 | { | 1895 | { |
| 1445 | if(!empty($didlinesstr)) | 1896 | if(!empty($didlinesstr)) |
| 1446 | { | 1897 | { |
| ... | @@ -1480,7 +1931,7 @@ public function show($id) | ... | @@ -1480,7 +1931,7 @@ public function show($id) |
| 1480 | 1931 | ||
| 1481 | /* Changes For Missed Call - 14/02/17 */ | 1932 | /* Changes For Missed Call - 14/02/17 */ |
| 1482 | 1933 | ||
| 1483 | foreach($othermissedcalls as $othermissedcall) | 1934 | /*foreach($othermissedcalls as $othermissedcall) |
| 1484 | { | 1935 | { |
| 1485 | $crmnumber = substr($othermissedcall->number, -10); | 1936 | $crmnumber = substr($othermissedcall->number, -10); |
| 1486 | 1937 | ||
| ... | @@ -1503,19 +1954,19 @@ public function show($id) | ... | @@ -1503,19 +1954,19 @@ public function show($id) |
| 1503 | 1954 | ||
| 1504 | /* Changes For Missed Call - 14/02/17 */ | 1955 | /* Changes For Missed Call - 14/02/17 */ |
| 1505 | 1956 | ||
| 1506 | foreach($tusers as $tuser)if(!isset($users[$tuser['id']]))$users[$tuser['id']]=$tuser; | 1957 | /*foreach($tusers as $tuser)if(!isset($users[$tuser['id']]))$users[$tuser['id']]=$tuser; |
| 1507 | 1958 | ||
| 1508 | $limit=$limit-sizeof($tusers); | 1959 | $limit=$limit-sizeof($tusers); |
| 1509 | } | 1960 | } |
| 1510 | } | 1961 | }*/ |
| 1511 | 1962 | ||
| 1512 | 1963 | ||
| 1513 | if($limit>0) | 1964 | /*if($limit>0) |
| 1514 | { | 1965 | { |
| 1515 | $tusers = array_filter($clientDetails, function($var){ | 1966 | $tusers = array_filter($clientDetails, function($var){ |
| 1516 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); | 1967 | return ($var['dialer_callback']>'2018-09-11 00:00:00'&&strtotime($var['dialer_callback'])<strtotime(date('Y-m-d H:i:s',time()+(15*60)))&&($var['dialer_status']=='Contacted - FollowUp - Specific' || $var['dialer_substatus']=='Followup Call' || $var['dialer_status']=='Service Call - Inbound Follow up' || $var['dialer_status'])=='Productive Call - Sales Follow Up'); |
| 1517 | }); | 1968 | }); |
| 1518 | 1969 | // echo "1"; | |
| 1519 | $l=1; | 1970 | $l=1; |
| 1520 | foreach($tusers as $tuser){ | 1971 | foreach($tusers as $tuser){ |
| 1521 | if(!isset($users[$tuser['id']])){ | 1972 | if(!isset($users[$tuser['id']])){ |
| ... | @@ -1528,9 +1979,10 @@ public function show($id) | ... | @@ -1528,9 +1979,10 @@ public function show($id) |
| 1528 | } | 1979 | } |
| 1529 | 1980 | ||
| 1530 | $limit=$limit-sizeof($tusers); | 1981 | $limit=$limit-sizeof($tusers); |
| 1531 | } | 1982 | }*/ |
| 1532 | for($p=15;$p>0;$p--) | 1983 | /*for($p=15;$p>0;$p--) |
| 1533 | { | 1984 | { |
| 1985 | // echo "2"; | ||
| 1534 | if($limit>0) | 1986 | if($limit>0) |
| 1535 | { | 1987 | { |
| 1536 | $tusers = array_filter($clientDetails, function($var) use ($p){ | 1988 | $tusers = array_filter($clientDetails, function($var) use ($p){ |
| ... | @@ -1553,13 +2005,13 @@ public function show($id) | ... | @@ -1553,13 +2005,13 @@ public function show($id) |
| 1553 | $limit=$limit-sizeof($tusers); | 2005 | $limit=$limit-sizeof($tusers); |
| 1554 | } | 2006 | } |
| 1555 | } | 2007 | } |
| 1556 | } | 2008 | }*/ |
| 1557 | if($limit>0) | 2009 | /*if($limit>0) |
| 1558 | { | 2010 | { |
| 1559 | $tusers = array_filter($clientDetails, function($var){ | 2011 | $tusers = array_filter($clientDetails, function($var){ |
| 1560 | return ($var['status']=='New'&&$var['mobile']!=''); | 2012 | return ($var['status']=='New'&&$var['mobile']!=''); |
| 1561 | }); | 2013 | }); |
| 1562 | 2014 | // echo "3"; | |
| 1563 | $l=1; | 2015 | $l=1; |
| 1564 | foreach($tusers as $tuser){ | 2016 | foreach($tusers as $tuser){ |
| 1565 | if(!isset($users[$tuser['id']])){ | 2017 | if(!isset($users[$tuser['id']])){ |
| ... | @@ -1572,15 +2024,15 @@ public function show($id) | ... | @@ -1572,15 +2024,15 @@ public function show($id) |
| 1572 | } | 2024 | } |
| 1573 | 2025 | ||
| 1574 | $limit=$limit-sizeof($tusers); | 2026 | $limit=$limit-sizeof($tusers); |
| 1575 | } | 2027 | }*/ |
| 1576 | 2028 | ||
| 1577 | if($limit>0) | 2029 | /*if($limit>0) |
| 1578 | { | 2030 | { |
| 1579 | $tusers = array_filter($clientDetails, function($var){ | 2031 | $tusers = array_filter($clientDetails, function($var){ |
| 2032 | //return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party' || $var['dialer_status'=='Not Contacted'])); | ||
| 1580 | return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted'); | 2033 | return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted'); |
| 1581 | //return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted'); | ||
| 1582 | }); | 2034 | }); |
| 1583 | 2035 | // echo "4"; | |
| 1584 | $l=1; | 2036 | $l=1; |
| 1585 | foreach($tusers as $tuser){ | 2037 | foreach($tusers as $tuser){ |
| 1586 | if(!isset($users[$tuser['id']])){ | 2038 | if(!isset($users[$tuser['id']])){ |
| ... | @@ -1593,9 +2045,9 @@ public function show($id) | ... | @@ -1593,9 +2045,9 @@ public function show($id) |
| 1593 | } | 2045 | } |
| 1594 | 2046 | ||
| 1595 | $limit=$limit-sizeof($tusers); | 2047 | $limit=$limit-sizeof($tusers); |
| 1596 | } | 2048 | }*/ |
| 1597 | 2049 | ||
| 1598 | if($limit>0) | 2050 | /*if($limit>0) |
| 1599 | { | 2051 | { |
| 1600 | $tusers = array_filter($clientDetails, function($var){ | 2052 | $tusers = array_filter($clientDetails, function($var){ |
| 1601 | return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic'); | 2053 | return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic'); |
| ... | @@ -1612,10 +2064,11 @@ public function show($id) | ... | @@ -1612,10 +2064,11 @@ public function show($id) |
| 1612 | } | 2064 | } |
| 1613 | 2065 | ||
| 1614 | $limit=$limit-sizeof($tusers); | 2066 | $limit=$limit-sizeof($tusers); |
| 1615 | } | 2067 | }*/ |
| 1616 | 2068 | ||
| 1617 | if($limit>0) | 2069 | /*if($limit>0) |
| 1618 | { | 2070 | { |
| 2071 | // echo "5"; | ||
| 1619 | $tusers = array_filter($clientDetails, function($var){ | 2072 | $tusers = array_filter($clientDetails, function($var){ |
| 1620 | return ($var['status']=='Called'&&$var['dialer_status']=='AUTOWRAPUP'); | 2073 | return ($var['status']=='Called'&&$var['dialer_status']=='AUTOWRAPUP'); |
| 1621 | }); | 2074 | }); |
| ... | @@ -1631,9 +2084,24 @@ public function show($id) | ... | @@ -1631,9 +2084,24 @@ public function show($id) |
| 1631 | } | 2084 | } |
| 1632 | 2085 | ||
| 1633 | $limit=$limit-sizeof($tusers); | 2086 | $limit=$limit-sizeof($tusers); |
| 2087 | }*/ | ||
| 1634 | } | 2088 | } |
| 1635 | |||
| 1636 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; | 2089 | $tusers=array();foreach($users as $tuser)$tusers[]=$tuser; |
| 2090 | // } | ||
| 1637 | return $tusers; | 2091 | return $tusers; |
| 1638 | } | 2092 | } |
| 2093 | |||
| 2094 | |||
| 2095 | public function getAvgTimeArray($campaign, $user) | ||
| 2096 | { | ||
| 2097 | $avgdisposecObj = CRMCall::select(DB::Raw('(avg(disposec))/1000 as avgdisposec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2098 | |||
| 2099 | $avgcallsecObj = CRMCall::select(DB::Raw('(avg(callsec))/1000 as avgcallsec'))->where("client", "=", $campaign)->where("user_id", "=", $user)->orderby("id","desc")->limit(50)->where("type","!=","Inbound")->first(); | ||
| 2100 | |||
| 2101 | $returnArray['avgdisposec'] = round($avgdisposecObj->avgdisposec); | ||
| 2102 | $returnArray['avgcallsec'] = round($avgdisposecObj->avgcallsec); | ||
| 2103 | |||
| 2104 | return $returnArray; | ||
| 2105 | } | ||
| 2106 | |||
| 1639 | } | 2107 | } | ... | ... |
| ... | @@ -41,6 +41,8 @@ Route::group(['middleware' => ['web']], function () { | ... | @@ -41,6 +41,8 @@ Route::group(['middleware' => ['web']], function () { |
| 41 | Route::resource('user','UserController'); | 41 | Route::resource('user','UserController'); |
| 42 | Route::resource('group','GroupController'); | 42 | Route::resource('group','GroupController'); |
| 43 | Route::resource('role','RoleController'); | 43 | Route::resource('role','RoleController'); |
| 44 | Route::resource('dispositionPlan','DispositionPlanController'); | ||
| 45 | Route::resource('disposition','DispositionController'); | ||
| 44 | 46 | ||
| 45 | Route::resource('master','MasterController'); | 47 | Route::resource('master','MasterController'); |
| 46 | Route::resource('admin','AdminController'); | 48 | Route::resource('admin','AdminController'); | ... | ... |
This diff could not be displayed because it is too large.
| ... | @@ -575,6 +575,13 @@ $data.="</div><div style='width:49%;float:left'> | ... | @@ -575,6 +575,13 @@ $data.="</div><div style='width:49%;float:left'> |
| 575 | <label class=label-small_new style='width:25%;' title=''>Callback: </label> | 575 | <label class=label-small_new style='width:25%;' title=''>Callback: </label> |
| 576 | <input class='form_new form_new_amend datetimepicker_dthr' id='dialer_usercallback' name='dialer_usercallback'> | 576 | <input class='form_new form_new_amend datetimepicker_dthr' id='dialer_usercallback' name='dialer_usercallback'> |
| 577 | </p>"; | 577 | </p>"; |
| 578 | //if(Auth::user()->id==266){ | ||
| 579 | $data.="<p style='clear:both'> | ||
| 580 | <label class=label-small_new style='width:25%;' title=''>Appointmet Date: </label> | ||
| 581 | <input class='form_new form_new_amend datetimepicker_dthr' id='dialer_appointment' name='dialer_appointment'> | ||
| 582 | </p>"; | ||
| 583 | //} | ||
| 584 | |||
| 578 | /*$data.="<p style='clear:both'> | 585 | /*$data.="<p style='clear:both'> |
| 579 | <label class=label-small_new style='width:25%;' title=''>Call Remarks: </label> | 586 | <label class=label-small_new style='width:25%;' title=''>Call Remarks: </label> |
| 580 | <textarea id='dialer_userremarks' name='dialer_userremarks' style='width:70%' maxlength=250></textarea> | 587 | <textarea id='dialer_userremarks' name='dialer_userremarks' style='width:70%' maxlength=250></textarea> |
| ... | @@ -818,20 +825,69 @@ $data.="</fieldset></div> | ... | @@ -818,20 +825,69 @@ $data.="</fieldset></div> |
| 818 | var dialerdispoarray={};var dispoClassArray={}; | 825 | var dialerdispoarray={};var dispoClassArray={}; |
| 819 | dialerdispoarray['']='';\n"; | 826 | dialerdispoarray['']='';\n"; |
| 820 | 827 | ||
| 821 | $mastersdata=$gthis->getDispocampaignData($dataarr[client]); | 828 | // to get client corconfig |
| 822 | //$dispoarr=explode("~",$mastersdata['mvalue']); | 829 | /*$mastersdata= $gthis->getDispocampaignData($dataarr['client']); |
| 830 | $dispoarr = []; | ||
| 823 | 831 | ||
| 824 | if(empty($mastersdata)) | 832 | if(empty($mastersdata)) |
| 825 | { | 833 | { |
| 834 | // if client company is empty get data from campaign company | ||
| 826 | $mastersdata=$gthis->getCompanyMaster($client); | 835 | $mastersdata=$gthis->getCompanyMaster($client); |
| 827 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList']; | ||
| 828 | 836 | ||
| 837 | /* commented above code : now get data from dispostion table | ||
| 838 | if(empty($mastersdata['dialerDispoList'])){ | ||
| 839 | $mastersdata['dialerDispoList']=$gthis->HRCoreVars['dialerDispoList']; | ||
| 840 | }* | ||
| 841 | if(!empty($mastersdata['dialerDispoList'])){ | ||
| 829 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | 842 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); |
| 843 | } | ||
| 830 | }else{ | 844 | }else{ |
| 831 | $dispoarr=explode("~",$mastersdata['mvalue']); | 845 | $dispoarr=explode("~",$mastersdata['mvalue']); |
| 832 | } | 846 | } |
| 833 | 847 | ||
| 848 | if(count($dispoarr) > 0){ | ||
| 849 | foreach($dispoarr as $dispo) | ||
| 850 | { | ||
| 851 | if(!empty($dispo)) | ||
| 852 | { | ||
| 853 | $dispoprts=explode("|",$dispo); | ||
| 854 | if(sizeof($dispoprts)>=3) | ||
| 855 | { | ||
| 856 | $data.="dialerdispoarray['$dispoprts[1]']='$dispoprts[2]';dispoClassArray['$dispoprts[0]']='$dispoprts[1]';"; | ||
| 857 | } | ||
| 858 | } | ||
| 859 | } | ||
| 860 | }else{ | ||
| 861 | // get disposition from disposition table | ||
| 862 | $dispositionPlan = $gthis->getDispositionList(); | ||
| 863 | foreach ($dispositionPlan as $key => $value) { | ||
| 864 | $disposition = $value->disposition; | ||
| 865 | $subDisposition = $value->sunDispoName; | ||
| 866 | $data.="dialerdispoarray['$disposition']='$subDisposition';"; | ||
| 867 | } | ||
| 868 | }*/ | ||
| 869 | |||
| 870 | $mastersdata = DB::table('campaign_disposition_plan') | ||
| 871 | ->join('disposition_plan_config', 'campaign_disposition_plan.dispo_plan_id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 872 | ->join('disposition_plan', 'disposition_plan.id', '=', 'disposition_plan_config.dispo_plan_id') | ||
| 873 | ->select('disposition_plan_config.disposition as disposition ', 'disposition_plan_config.sub_disposition as subDisposition') | ||
| 874 | ->where("disposition_plan.status","active") | ||
| 875 | ->where("campaign","=",$dataarr['client']) | ||
| 876 | ->get(); | ||
| 834 | 877 | ||
| 878 | if(count($mastersdata) > 0){ | ||
| 879 | |||
| 880 | foreach ($mastersdata as $key => $value) { | ||
| 881 | $disposition = $value->disposition; | ||
| 882 | $subDisposition = $value->subDisposition; | ||
| 883 | $data.="dialerdispoarray['$disposition']='$subDisposition';"; | ||
| 884 | } | ||
| 885 | |||
| 886 | }else{ | ||
| 887 | // if client company is empty get data from campaign company | ||
| 888 | $mastersdata=$gthis->getCompanyMaster($client); | ||
| 889 | if(!empty($mastersdata['dialerDispoList'])){ | ||
| 890 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | ||
| 835 | foreach($dispoarr as $dispo) | 891 | foreach($dispoarr as $dispo) |
| 836 | { | 892 | { |
| 837 | if(!empty($dispo)) | 893 | if(!empty($dispo)) |
| ... | @@ -843,6 +899,16 @@ $data.="</fieldset></div> | ... | @@ -843,6 +899,16 @@ $data.="</fieldset></div> |
| 843 | } | 899 | } |
| 844 | } | 900 | } |
| 845 | } | 901 | } |
| 902 | }else{ | ||
| 903 | // get disposition from disposition table | ||
| 904 | $dispositionPlan = $gthis->getDispositionList(); | ||
| 905 | foreach ($dispositionPlan as $key => $value) { | ||
| 906 | $disposition = $value->disposition; | ||
| 907 | $subDisposition = $value->sunDispoName; | ||
| 908 | $data.="dialerdispoarray['$disposition']='$subDisposition';"; | ||
| 909 | } | ||
| 910 | } | ||
| 911 | } | ||
| 846 | 912 | ||
| 847 | $data.=" | 913 | $data.=" |
| 848 | 914 | ||
| ... | @@ -4033,8 +4099,8 @@ function validatePostData() | ... | @@ -4033,8 +4099,8 @@ function validatePostData() |
| 4033 | } | 4099 | } |
| 4034 | 4100 | ||
| 4035 | //client cannot be changed unless Admin | 4101 | //client cannot be changed unless Admin |
| 4036 | if(!$wakka->IsAdmin())if(trim($ppldata["client"])!=""&&$ppldata["client"]!=Input::get("client"))$message=" Client Cannot be changed, use Renew-Record"; | 4102 | //if(!$wakka->IsAdmin())if(trim($ppldata["client"])!=""&&$ppldata["client"]!=Input::get("client"))$message=" Client Cannot be changed, use Renew-Record"; |
| 4037 | 4103 | if(!$wakka->IsAdmin())if(trim($ppldata["client"])=="")$message=" Client Cannot be changed, use Renew-Record"; | |
| 4038 | if(Input::get('currentstatus')==$wakka->HRCoreVars['hrTriggerHoldStatus']) | 4104 | if(Input::get('currentstatus')==$wakka->HRCoreVars['hrTriggerHoldStatus']) |
| 4039 | { | 4105 | { |
| 4040 | $message="";//bypass checks for candidates | 4106 | $message="";//bypass checks for candidates |
| ... | @@ -4187,7 +4253,7 @@ function validatePostData() | ... | @@ -4187,7 +4253,7 @@ function validatePostData() |
| 4187 | $recruitdata["dirty"][$taskline['completecheck']]=1; | 4253 | $recruitdata["dirty"][$taskline['completecheck']]=1; |
| 4188 | } | 4254 | } |
| 4189 | $this->recruitdata=$recruitdata; | 4255 | $this->recruitdata=$recruitdata; |
| 4190 | $res=$wakka->setPerson($varid,$this->recruitdata); | 4256 | $res=$wakka->setPerson($varid,$this->recruitdata,''); |
| 4191 | 4257 | ||
| 4192 | } | 4258 | } |
| 4193 | } | 4259 | } | ... | ... |
| ... | @@ -13,7 +13,7 @@ class KHRMSLib | ... | @@ -13,7 +13,7 @@ class KHRMSLib |
| 13 | public $dblink; | 13 | public $dblink; |
| 14 | public $user=NULL; | 14 | public $user=NULL; |
| 15 | 15 | ||
| 16 | public $EMPCacheCols="currentstatus,legalstatus,firstname,lastname,mobile,emailid,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,candidatecategory,nextfollowupdate,passportno,joiningdate,client,designation,supervisor,contracttype,saltotal,ibannumber,servicestoppeddate,employeeexitstatus,exittype,dateofexit,abscondtype,abscondeddate,workflowstatus,status,clientinternalid,department,passportstatus,clientcode,laborcardpersonalid,dialer_status,dialer_substatus,dialer_callback,dialer_remarks,dialer_flag,dialer_lastcall,priority,crmlist_id,group,bttc,service_vs_product,resolution,satisfaction,final_call_assessment,question,mf_isa,DOB,other_information,agreementid,applied_amount,city,comp_code,company,completeddate,cust_id,cust_name,customer_name,disb_date,emi_hl,eqty_amt,foir,ins_amt,int_rate,irr,loan_amount,location,mf_amt,nth,offer_amt,outstanding,pf,ph_mob,ph_off,ph_res,pl_offer,proc_fee,product_flag,profile_new,rank,segment,tenure,tu_application_id,ucic_id,filler1,filler2,filler3,filler4,filler5,filler6,filler7,filler8,filler9,filler10,filler11,filler12,filler13,filler14,filler15"; | 16 | public $EMPCacheCols="mobile,emailid,altphone1,altphone2,altphone3,altphone4,altphone5,altphone6,altphone7,altphone8,altphone9,altphone10,client,status,clientinternalid,dialer_status,dialer_substatus,dialer_callback,dialer_remarks,dialer_flag,dialer_lastcall,priority,crmlist_id,group,bttc,service_vs_product,resolution,satisfaction,final_call_assessment,question,mf_isa,DOB,other_information,agreementid,applied_amount,city,comp_code,company,completeddate,cust_id,cust_name,customer_name,disb_date,emi_hl,eqty_amt,foir,ins_amt,int_rate,irr,loan_amount,location,mf_amt,nth,offer_amt,outstanding,pf,ph_mob,ph_off,ph_res,pl_offer,proc_fee,product_flag,profile_new,rank,segment,tenure,tu_application_id,ucic_id,filler1,filler2,filler3,filler4,filler5,filler6,filler7,filler8,filler9,filler10,filler11,filler12,filler13,filler14,filler15,dialer_appointment"; |
| 17 | 17 | ||
| 18 | public $USRCacheCols="id,username,password,fullname,email,status,organization,group,data,presence,timezone,invisible,usertype,diskuse,source,meta,lteam,lteam2,supervisor,created_at,updated_at,remember_token,passwordreset,number1,number2,exten,extencontext,manager"; | 18 | public $USRCacheCols="id,username,password,fullname,email,status,organization,group,data,presence,timezone,invisible,usertype,diskuse,source,meta,lteam,lteam2,supervisor,created_at,updated_at,remember_token,passwordreset,number1,number2,exten,extencontext,manager"; |
| 19 | 19 | ||
| ... | @@ -839,6 +839,11 @@ function popMail($userid) | ... | @@ -839,6 +839,11 @@ function popMail($userid) |
| 839 | if($tuser)if($tuser->moduleACL("admin",false,false,true))$res=true; | 839 | if($tuser)if($tuser->moduleACL("admin",false,false,true))$res=true; |
| 840 | return $res; | 840 | return $res; |
| 841 | } | 841 | } |
| 842 | function getSelClient() | ||
| 843 | { | ||
| 844 | |||
| 845 | return Auth::user()->sel_campaign; | ||
| 846 | } | ||
| 842 | 847 | ||
| 843 | function getPersonOld($empid) | 848 | function getPersonOld($empid) |
| 844 | { | 849 | { |
| ... | @@ -853,11 +858,29 @@ function popMail($userid) | ... | @@ -853,11 +858,29 @@ function popMail($userid) |
| 853 | } | 858 | } |
| 854 | else return FALSE; | 859 | else return FALSE; |
| 855 | } | 860 | } |
| 856 | function getPerson($empid) | 861 | |
| 862 | function getPersonIDsWithLike($key,$value,$client=""){ | ||
| 863 | if($client == ""){ | ||
| 864 | |||
| 865 | $records = "records"; | ||
| 866 | }else{ | ||
| 867 | $records = "records_$client"; | ||
| 868 | } | ||
| 869 | |||
| 870 | return $this->LoadAll("select id from $records where $key like '%$value%'"); | ||
| 871 | } | ||
| 872 | |||
| 873 | function getPerson($empid,$client) | ||
| 857 | { | 874 | { |
| 858 | /*if($this->getCount("records","id='$empid'")==1) | 875 | /*if($this->getCount("records","id='$empid'")==1) |
| 859 | {*/ | 876 | {*/ |
| 860 | if($empdata=$this->LoadSingle("select peopledata,modifylog,dirty from records where id='$empid';")) | 877 | if($client == ""){ |
| 878 | |||
| 879 | $records = "records"; | ||
| 880 | }else{ | ||
| 881 | $records = "records_$client"; | ||
| 882 | } | ||
| 883 | if($empdata=$this->LoadSingle("select peopledata,modifylog,dirty from $records where id='$empid';")) | ||
| 861 | { | 884 | { |
| 862 | //$empdata=$this->LoadSingle("select * from records where id='$empid';"); | 885 | //$empdata=$this->LoadSingle("select * from records where id='$empid';"); |
| 863 | $personarr['peopledata']=unserialize($empdata['peopledata']); | 886 | $personarr['peopledata']=unserialize($empdata['peopledata']); |
| ... | @@ -936,11 +959,11 @@ function popMail($userid) | ... | @@ -936,11 +959,11 @@ function popMail($userid) |
| 936 | else return FALSE; | 959 | else return FALSE; |
| 937 | } | 960 | } |
| 938 | 961 | ||
| 939 | function setPersonKey($empid,$key,$val,$username="") | 962 | function setPersonKey($empid,$key,$val,$username="",$client) |
| 940 | { | 963 | { |
| 941 | $cachestr='';if(in_array($key,$this->cachearray))$cachestr=" ,`$key`='$val' "; | 964 | $cachestr='';if(in_array($key,$this->cachearray))$cachestr=" ,`$key`='$val' "; |
| 942 | 965 | ||
| 943 | $personarr=$this->getPerson($empid); | 966 | $personarr=$this->getPerson($empid,$client); |
| 944 | if(is_array($personarr['peopledata'])) | 967 | if(is_array($personarr['peopledata'])) |
| 945 | { | 968 | { |
| 946 | if($personarr['peopledata'][$key]!=$val) | 969 | if($personarr['peopledata'][$key]!=$val) |
| ... | @@ -957,14 +980,14 @@ function popMail($userid) | ... | @@ -957,14 +980,14 @@ function popMail($userid) |
| 957 | } | 980 | } |
| 958 | $personarr['peopledata'][$key]=$val; | 981 | $personarr['peopledata'][$key]=$val; |
| 959 | 982 | ||
| 960 | $res=$this->setPerson($empid,$personarr); | 983 | $res=$this->setPerson($empid,$personarr,$client); |
| 961 | return $res; | 984 | return $res; |
| 962 | } | 985 | } |
| 963 | return true; | 986 | return true; |
| 964 | } | 987 | } |
| 965 | else return false; | 988 | else return false; |
| 966 | } | 989 | } |
| 967 | function setPerson($empid,&$personarr) | 990 | function setPerson($empid,&$personarr,$client) |
| 968 | { | 991 | { |
| 969 | //if($this->getCount("records","id='$empid'")==1&&is_array($personarr['peopledata'])) | 992 | //if($this->getCount("records","id='$empid'")==1&&is_array($personarr['peopledata'])) |
| 970 | if($empid!=""&&is_array($personarr['peopledata'])) | 993 | if($empid!=""&&is_array($personarr['peopledata'])) |
| ... | @@ -1018,14 +1041,18 @@ function popMail($userid) | ... | @@ -1018,14 +1041,18 @@ function popMail($userid) |
| 1018 | { | 1041 | { |
| 1019 | $setComntArr = array(); | 1042 | $setComntArr = array(); |
| 1020 | 1043 | ||
| 1021 | $setComntArr['clientcode']=$personarr['peopledata']['clientcode']; | 1044 | $setComntArr['clientcode']=$personarr['peopledata']['cust_id']; |
| 1022 | $setComntArr['agent']=Auth::user()->username; | 1045 | $setComntArr['agent']=Auth::user()->username; |
| 1023 | $setComntArr['agent_comments']=$personarr['agentcomments']; | 1046 | $setComntArr['agent_comments']=$personarr['agentcomments']; |
| 1024 | 1047 | ||
| 1025 | $this->setComment($setComntArr['clientcode'],$setComntArr); | 1048 | $this->setComment($setComntArr['clientcode'],$setComntArr); |
| 1026 | } | 1049 | } |
| 1027 | 1050 | if($client!=''){ | |
| 1028 | return $this->Query("update records set modified=now(),peopledata='$quoteP',modifylog='0',dirty='$quoteD' $cachestr where id='$empid' limit 1"); | 1051 | $recordsTable = 'records_'.$client; |
| 1052 | }else{ | ||
| 1053 | $recordsTable = 'records'; | ||
| 1054 | } | ||
| 1055 | return $this->Query("update $recordsTable set modified=now(),peopledata='$quoteP',modifylog='0',dirty='$quoteD' $cachestr where id='$empid' limit 1"); | ||
| 1029 | } | 1056 | } |
| 1030 | } | 1057 | } |
| 1031 | else return -1; | 1058 | else return -1; |
| ... | @@ -1144,11 +1171,16 @@ function popMail($userid) | ... | @@ -1144,11 +1171,16 @@ function popMail($userid) |
| 1144 | } | 1171 | } |
| 1145 | } | 1172 | } |
| 1146 | 1173 | ||
| 1147 | function getPersonIDs($wheresql) | 1174 | function getPersonIDs($wheresql,$client) |
| 1148 | { | 1175 | { |
| 1149 | return $this->LoadAll("select id from records where $wheresql"); | 1176 | if($client==""){ |
| 1177 | $recordsTable = "records"; | ||
| 1178 | }else{ | ||
| 1179 | $recordsTable = "records_".$client; | ||
| 1180 | } | ||
| 1181 | return $this->LoadAll("select id from $recordsTable where $wheresql"); | ||
| 1150 | } | 1182 | } |
| 1151 | function getPersonshome($wheresql) | 1183 | function getPersonshome($wheresql,$client) |
| 1152 | { | 1184 | { |
| 1153 | $sqlarr=""; | 1185 | $sqlarr=""; |
| 1154 | foreach($this->cachearray as $cachekey) | 1186 | foreach($this->cachearray as $cachekey) |
| ... | @@ -1158,10 +1190,14 @@ function popMail($userid) | ... | @@ -1158,10 +1190,14 @@ function popMail($userid) |
| 1158 | $sqlarr.=" ,`$cachekey`"; | 1190 | $sqlarr.=" ,`$cachekey`"; |
| 1159 | } | 1191 | } |
| 1160 | } | 1192 | } |
| 1161 | 1193 | if($client==""){ | |
| 1162 | return $this->LoadAll("select id".$sqlarr." from records where $wheresql;"); | 1194 | $recordsTable = "records"; |
| 1195 | }else{ | ||
| 1196 | $recordsTable = "records_".$client; | ||
| 1197 | } | ||
| 1198 | return $this->LoadAll("select id".$sqlarr." from $recordsTable where $wheresql;"); | ||
| 1163 | } | 1199 | } |
| 1164 | function getPersons($wheresql) | 1200 | function getPersons($wheresql,$client) |
| 1165 | { | 1201 | { |
| 1166 | $sqlarr=""; | 1202 | $sqlarr=""; |
| 1167 | foreach($this->cachearray as $cachekey) | 1203 | foreach($this->cachearray as $cachekey) |
| ... | @@ -1171,8 +1207,12 @@ function popMail($userid) | ... | @@ -1171,8 +1207,12 @@ function popMail($userid) |
| 1171 | $sqlarr.=" ,`$cachekey`"; | 1207 | $sqlarr.=" ,`$cachekey`"; |
| 1172 | } | 1208 | } |
| 1173 | } | 1209 | } |
| 1174 | 1210 | if($client==""){ | |
| 1175 | return $this->LoadAll("select id,created,modified,peopledata,modifylog,dirty".$sqlarr." from records where $wheresql;"); | 1211 | $recordsTable = "records"; |
| 1212 | }else{ | ||
| 1213 | $recordsTable = "records_".$client; | ||
| 1214 | } | ||
| 1215 | return $this->LoadAll("select id,created,modified,peopledata,modifylog,dirty".$sqlarr." from $recordsTable where $wheresql;"); | ||
| 1176 | } | 1216 | } |
| 1177 | 1217 | ||
| 1178 | function isWorkingEmployee(&$ppldata,$year,$month,$date=0) | 1218 | function isWorkingEmployee(&$ppldata,$year,$month,$date=0) |
| ... | @@ -1398,6 +1438,21 @@ function popMail($userid) | ... | @@ -1398,6 +1438,21 @@ function popMail($userid) |
| 1398 | //print_r($company); | 1438 | //print_r($company); |
| 1399 | return $companyar; | 1439 | return $companyar; |
| 1400 | } | 1440 | } |
| 1441 | |||
| 1442 | function getDispositionList(){ | ||
| 1443 | |||
| 1444 | $dispositionPlan = DB::table('disposition')->join('sub_disposition', 'disposition.id', '=', 'sub_disposition.dispo_id') | ||
| 1445 | ->select('disposition.id as dispoId', 'disposition.name as disposition','disposition.code as code','disposition.status AS status', | ||
| 1446 | DB::raw('count(*) as totalSubDispo, sub_disposition.id'), | ||
| 1447 | DB::raw('GROUP_CONCAT(sub_disposition.name) as sunDispoName, sub_disposition.name')) | ||
| 1448 | ->groupBy('sub_disposition.dispo_id') | ||
| 1449 | ->where('status','active') | ||
| 1450 | ->get(); | ||
| 1451 | |||
| 1452 | return $dispositionPlan; | ||
| 1453 | |||
| 1454 | } | ||
| 1455 | |||
| 1401 | function getEmailListforClient($tclient) | 1456 | function getEmailListforClient($tclient) |
| 1402 | { | 1457 | { |
| 1403 | $unameslist=array(); | 1458 | $unameslist=array(); |
| ... | @@ -1593,26 +1648,6 @@ function popMail($userid) | ... | @@ -1593,26 +1648,6 @@ function popMail($userid) |
| 1593 | } | 1648 | } |
| 1594 | function clientsReadAccess() | 1649 | function clientsReadAccess() |
| 1595 | { | 1650 | { |
| 1596 | /* $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | ||
| 1597 | $campaigns=array(); | ||
| 1598 | $now = new \DateTime(); | ||
| 1599 | foreach($companyarr as $tcompany){ | ||
| 1600 | $campaigns[]=$tcompany['mkey']; | ||
| 1601 | } | ||
| 1602 | foreach($companyarr as $tcompany){ | ||
| 1603 | $campaignstartdate = new \DateTime($tcompany['campaignstartdate']); | ||
| 1604 | $campaignenddate = new \DateTime($tcompany['campaignenddate']); | ||
| 1605 | |||
| 1606 | if(empty($tcompany['campaignstartdate']) || empty($tcompany['campaignenddate'])){ | ||
| 1607 | print_r($tcompany['mkey']); | ||
| 1608 | $campaigns[]=$tcompany['mkey']; | ||
| 1609 | }else{ | ||
| 1610 | if($campaignstartdate < $now and $campaignenddate > $now){ | ||
| 1611 | print_r($tcompany['mkey']); | ||
| 1612 | $campaigns[]=$tcompany['mkey']; | ||
| 1613 | } | ||
| 1614 | } | ||
| 1615 | }*/ | ||
| 1616 | $clientlst=array(); | 1651 | $clientlst=array(); |
| 1617 | if($this->GetBBBUserData("readotherdata")=="No") | 1652 | if($this->GetBBBUserData("readotherdata")=="No") |
| 1618 | { | 1653 | { |
| ... | @@ -1645,16 +1680,17 @@ function popMail($userid) | ... | @@ -1645,16 +1680,17 @@ function popMail($userid) |
| 1645 | } | 1680 | } |
| 1646 | $activeClientCampaign = array(); | 1681 | $activeClientCampaign = array(); |
| 1647 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | 1682 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); |
| 1683 | //$recordsArry=$this->LoadAll("select client from records group by client"); | ||
| 1684 | //$records=array(); | ||
| 1648 | $campaigns=array(); | 1685 | $campaigns=array(); |
| 1649 | $dashboarduser=Auth::user(); | 1686 | $dashboarduser=Auth::user(); |
| 1650 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | 1687 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; |
| 1651 | $timeoffset = $timeoffset*60; | 1688 | $timeoffset = $timeoffset*60; |
| 1652 | $now = strtotime(date("Y-m-d H:i:s"))-$timeoffset; | 1689 | $now = strtotime(date("H:i:s"))-$timeoffset; |
| 1653 | |||
| 1654 | foreach($companyarr as $tcompany){ | 1690 | foreach($companyarr as $tcompany){ |
| 1655 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); | 1691 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); |
| 1656 | $campaignenddate = strtotime($tcompany['campaignenddate']); | 1692 | $campaignenddate = strtotime($tcompany['campaignenddate']); |
| 1657 | if($tcompany['campaignstartdate'] == '0000-00-00 00:00:00' || $tcompany['campaignenddate'] == '0000-00-00 00:00:00'){ | 1693 | if($tcompany['campaignstartdate'] == '00:00:00' and $tcompany['campaignenddate'] == '00:00:00'){ |
| 1658 | $campaigns[]=$tcompany['mkey']; | 1694 | $campaigns[]=$tcompany['mkey']; |
| 1659 | }else{ | 1695 | }else{ |
| 1660 | if($campaignstartdate < $now and $campaignenddate > $now){ | 1696 | if($campaignstartdate < $now and $campaignenddate > $now){ |
| ... | @@ -1667,12 +1703,55 @@ function popMail($userid) | ... | @@ -1667,12 +1703,55 @@ function popMail($userid) |
| 1667 | $activeClientCampaign[]=$value; | 1703 | $activeClientCampaign[]=$value; |
| 1668 | } | 1704 | } |
| 1669 | } | 1705 | } |
| 1706 | /*$activeClientCampaign1=array(); | ||
| 1707 | foreach($recordsArry as $records){ | ||
| 1708 | if(in_array($records['client'],$activeClientCampaign)){ | ||
| 1709 | $activeClientCampaign1[]=$records['client']; | ||
| 1710 | }else{ | ||
| 1711 | continue; | ||
| 1712 | } | ||
| 1713 | }*/ | ||
| 1714 | //Log::info($activeClientCampaign1); | ||
| 1670 | return $activeClientCampaign; | 1715 | return $activeClientCampaign; |
| 1671 | } | 1716 | } |
| 1672 | function clientsOwnerRWAccess() | 1717 | function clientsOwnerRWAccess() |
| 1673 | { | 1718 | { |
| 1674 | $clientlst=array_unique(array_merge(explode(",",$this->GetBBBUserData("clientsownerlist")),explode(",",$this->GetBBBUserData("clientslist")))); | 1719 | $clientlst=array_unique(array_merge(explode(",",$this->GetBBBUserData("clientsownerlist")),explode(",",$this->GetBBBUserData("clientslist")))); |
| 1675 | return $clientlst; | 1720 | $activeClientCampaign = array(); |
| 1721 | $companyarr=$this->LoadAll("select * from hrms_masters where mtype='company' and status='active'"); | ||
| 1722 | //$recordsArry=$this->LoadAll("select client from records group by client"); | ||
| 1723 | //$records=array(); | ||
| 1724 | $campaigns=array(); | ||
| 1725 | $dashboarduser=Auth::user(); | ||
| 1726 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 1727 | $timeoffset = $timeoffset*60; | ||
| 1728 | $now = strtotime(date("H:i:s"))-$timeoffset; | ||
| 1729 | foreach($companyarr as $tcompany){ | ||
| 1730 | $campaignstartdate = strtotime($tcompany['campaignstartdate']); | ||
| 1731 | $campaignenddate = strtotime($tcompany['campaignenddate']); | ||
| 1732 | if($tcompany['campaignstartdate'] == '00:00:00' and $tcompany['campaignenddate'] == '00:00:00'){ | ||
| 1733 | $campaigns[]=$tcompany['mkey']; | ||
| 1734 | }else{ | ||
| 1735 | if($campaignstartdate < $now and $campaignenddate > $now){ | ||
| 1736 | $campaigns[]=$tcompany['mkey']; | ||
| 1737 | } | ||
| 1738 | } | ||
| 1739 | } | ||
| 1740 | foreach ($clientlst as $key => $value) { | ||
| 1741 | if(in_array($value, $campaigns)){ | ||
| 1742 | $activeClientCampaign[]=$value; | ||
| 1743 | } | ||
| 1744 | } | ||
| 1745 | /*$activeClientCampaign1=array(); | ||
| 1746 | foreach($recordsArry as $records){ | ||
| 1747 | if(in_array($records['client'],$activeClientCampaign)){ | ||
| 1748 | $activeClientCampaign1[]=$records['client']; | ||
| 1749 | }else{ | ||
| 1750 | continue; | ||
| 1751 | } | ||
| 1752 | }*/ | ||
| 1753 | return $activeClientCampaign; | ||
| 1754 | //return $clientlst; | ||
| 1676 | } | 1755 | } |
| 1677 | function generateRandomString($length = 10) | 1756 | function generateRandomString($length = 10) |
| 1678 | { | 1757 | { | ... | ... |
| ... | @@ -17,6 +17,8 @@ use PAMI\Message\Event\NewstateEvent; | ... | @@ -17,6 +17,8 @@ use PAMI\Message\Event\NewstateEvent; |
| 17 | use PAMI\Message\Event\OriginateResponseEvent; | 17 | use PAMI\Message\Event\OriginateResponseEvent; |
| 18 | use PAMI\Message\Event\HangupEvent; | 18 | use PAMI\Message\Event\HangupEvent; |
| 19 | use PAMI\Message\Event\UnknownEvent; | 19 | use PAMI\Message\Event\UnknownEvent; |
| 20 | use PAMI\Message\Event\DialBeginEvent; | ||
| 21 | use PAMI\Message\Event\DialEndEvent; | ||
| 20 | 22 | ||
| 21 | use PAMI\Message\Action\AGIAction; | 23 | use PAMI\Message\Action\AGIAction; |
| 22 | use PAMI\Message\Action\SIPNotifyAction; | 24 | use PAMI\Message\Action\SIPNotifyAction; |
| ... | @@ -30,6 +32,8 @@ use PAMI\Message\Action\RedirectAction; | ... | @@ -30,6 +32,8 @@ use PAMI\Message\Action\RedirectAction; |
| 30 | use PAMI\Message\Action\ConfbridgeMuteAction; | 32 | use PAMI\Message\Action\ConfbridgeMuteAction; |
| 31 | use PAMI\Message\Action\ConfbridgeUnmuteAction; | 33 | use PAMI\Message\Action\ConfbridgeUnmuteAction; |
| 32 | use PAMI\Message\Action\ActionMessage; | 34 | use PAMI\Message\Action\ActionMessage; |
| 35 | use PAMI\Message\Action\AttendedTransferAction; | ||
| 36 | use PAMI\Message\Action\BlindTransferAction; | ||
| 33 | 37 | ||
| 34 | use App\Models\Sipid; | 38 | use App\Models\Sipid; |
| 35 | use App\Models\User; | 39 | use App\Models\User; |
| ... | @@ -103,6 +107,8 @@ class KPAMIListen implements IEventListener | ... | @@ -103,6 +107,8 @@ class KPAMIListen implements IEventListener |
| 103 | else if ($event instanceof OriginateResponseEvent){$this->OriginateResponseEvent($event);} | 107 | else if ($event instanceof OriginateResponseEvent){$this->OriginateResponseEvent($event);} |
| 104 | else if ($event instanceof HangupEvent) {$this->HangupEvent($event);} | 108 | else if ($event instanceof HangupEvent) {$this->HangupEvent($event);} |
| 105 | else if ($event instanceof UnknownEvent) {$this->UnknownEvent($event);} | 109 | else if ($event instanceof UnknownEvent) {$this->UnknownEvent($event);} |
| 110 | else if ($event instanceof DialBeginEvent) {$this->DialBeginEvent($event);} | ||
| 111 | else if ($event instanceof DialEndEvent) {$this->DialEndEvent($event);} | ||
| 106 | //else var_dump($event); | 112 | //else var_dump($event); |
| 107 | 113 | ||
| 108 | } | 114 | } |
| ... | @@ -196,14 +202,16 @@ class KPAMIListen implements IEventListener | ... | @@ -196,14 +202,16 @@ class KPAMIListen implements IEventListener |
| 196 | if($crmcall->crm_id>0) | 202 | if($crmcall->crm_id>0) |
| 197 | { | 203 | { |
| 198 | $wakka = new KHRMSLib(); | 204 | $wakka = new KHRMSLib(); |
| 199 | $record=$wakka->getPerson($crmcall->crm_id); | 205 | $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); |
| 200 | if($record) | 206 | if($record) |
| 201 | { | 207 | { |
| 208 | DB::table('records_'.$crmcall->client)->where($crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 202 | $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; | 209 | $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; |
| 203 | $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; | 210 | $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; |
| 204 | $record["peopledata"]["dialer_callback"]=""; | 211 | $record["peopledata"]["dialer_callback"]=""; |
| 205 | $record["peopledata"]["dialer_remarks"]=""; | 212 | $record["peopledata"]["dialer_remarks"]=""; |
| 206 | $wakka->setPerson($crmcall->crm_id,$record); | 213 | $wakka->setPerson($crmcall->crm_id,$record,$crmcall->client); |
| 214 | $wakka->setPerson($crmcall->crm_id,$record,""); | ||
| 207 | } | 215 | } |
| 208 | 216 | ||
| 209 | } | 217 | } |
| ... | @@ -464,6 +472,7 @@ class KPAMIListen implements IEventListener | ... | @@ -464,6 +472,7 @@ class KPAMIListen implements IEventListener |
| 464 | $dialline->number=""; | 472 | $dialline->number=""; |
| 465 | $dialline->uniqueid=""; | 473 | $dialline->uniqueid=""; |
| 466 | $dialline->channel=""; | 474 | $dialline->channel=""; |
| 475 | $dialline->did=""; | ||
| 467 | $dialline->save(); | 476 | $dialline->save(); |
| 468 | } | 477 | } |
| 469 | 478 | ||
| ... | @@ -480,6 +489,102 @@ class KPAMIListen implements IEventListener | ... | @@ -480,6 +489,102 @@ class KPAMIListen implements IEventListener |
| 480 | $crmcall->save(); | 489 | $crmcall->save(); |
| 481 | } | 490 | } |
| 482 | } | 491 | } |
| 492 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 493 | { | ||
| 494 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 495 | if($crmcall) | ||
| 496 | { | ||
| 497 | $nowts=microtime(true)*1000; | ||
| 498 | |||
| 499 | $crmcall->setTs('ts_Recend',$nowts); | ||
| 500 | |||
| 501 | $crmcall->state=$eventname; | ||
| 502 | $crmcall->statuscode=$cause; | ||
| 503 | $crmcall->substatus=$causetxt; | ||
| 504 | |||
| 505 | |||
| 506 | if($crmcall->type=="Auto"&&$crmcall->user_id==0) | ||
| 507 | { | ||
| 508 | include( app_path() . '/Constants/gatewaydispo.php'); | ||
| 509 | foreach($gatewaydispoArry as $key=>$value){ | ||
| 510 | $gatewaydispo[]=$key; | ||
| 511 | } | ||
| 512 | if(in_array($cause, $gatewaydispo)){ | ||
| 513 | $gatewayStatus=$gatewaydispoArry[$cause]; | ||
| 514 | }else{ | ||
| 515 | $gatewayStatus="AutoDROP"; | ||
| 516 | } | ||
| 517 | $crmcall->userstatus=$gatewayStatus; | ||
| 518 | $crmcall->usersubstatus="AutoDROP"; | ||
| 519 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 520 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 521 | if($crmcall->crm_id>0) | ||
| 522 | { | ||
| 523 | $wakka = new KHRMSLib(); | ||
| 524 | $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); | ||
| 525 | if($record) | ||
| 526 | { | ||
| 527 | $record["peopledata"]["status"]="Called"; | ||
| 528 | $record["peopledata"]["dialer_status"]=$gatewayStatus; | ||
| 529 | $record["peopledata"]["dialer_substatus"]="AutoDROP"; | ||
| 530 | //$record["peopledata"]["dialer_lastcall"]=date("Y-m-d H:i:s"); | ||
| 531 | $wakka->setPerson($crmcall->crm_id,$record,$crmcall->client); | ||
| 532 | $wakka->setPerson($crmcall->crm_id,$record,""); | ||
| 533 | DB::table('records_'.$crmcall->client)->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 534 | } | ||
| 535 | } | ||
| 536 | } | ||
| 537 | if($crmcall->type=="AutoCall") | ||
| 538 | { | ||
| 539 | $crmcall->userstatus="AutoCall"; | ||
| 540 | $crmcall->usersubstatus="AutoCall"; | ||
| 541 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 542 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 543 | if($crmcall->crm_id>0) | ||
| 544 | { | ||
| 545 | $wakka = new KHRMSLib(); | ||
| 546 | $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); | ||
| 547 | if($record) | ||
| 548 | { | ||
| 549 | $record["peopledata"]["status"]="Called"; | ||
| 550 | $record["peopledata"]["dialer_status"]="AutoCall"; | ||
| 551 | $record["peopledata"]["dialer_substatus"]="AutoCall"; | ||
| 552 | $wakka->setPerson($crmcall->crm_id,$record,$crmcall->client); | ||
| 553 | $wakka->setPerson($crmcall->crm_id,$record,""); | ||
| 554 | } | ||
| 555 | } | ||
| 556 | } | ||
| 557 | |||
| 558 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 559 | if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall")) | ||
| 560 | { | ||
| 561 | $dialline->status="Free"; | ||
| 562 | $dialline->conf=""; | ||
| 563 | $dialline->number=""; | ||
| 564 | $dialline->uniqueid=""; | ||
| 565 | $dialline->channel=""; | ||
| 566 | $dialline->regexstr=""; | ||
| 567 | $dialline->did=""; | ||
| 568 | $dialline->save(); | ||
| 569 | |||
| 570 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 571 | |||
| 572 | if(!empty($tsip)) | ||
| 573 | { | ||
| 574 | $tsip->patched=0; | ||
| 575 | $tsip->save(); | ||
| 576 | } | ||
| 577 | |||
| 578 | $newqueue=new Kqueue(); | ||
| 579 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 580 | } | ||
| 581 | |||
| 582 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); | ||
| 583 | |||
| 584 | $crmcall->save(); | ||
| 585 | |||
| 586 | } | ||
| 587 | } | ||
| 483 | } | 588 | } |
| 484 | } | 589 | } |
| 485 | else | 590 | else |
| ... | @@ -569,6 +674,196 @@ class KPAMIListen implements IEventListener | ... | @@ -569,6 +674,196 @@ class KPAMIListen implements IEventListener |
| 569 | } | 674 | } |
| 570 | } | 675 | } |
| 571 | } | 676 | } |
| 677 | private function DialBeginEvent(EventMessage $event) | ||
| 678 | { | ||
| 679 | $eventname = "DialBegin"; | ||
| 680 | |||
| 681 | $channel=$event->getKey("Channel"); | ||
| 682 | $channelstate=$event->getKey("ChannelState"); | ||
| 683 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 684 | $accountcode=$event->getKey("AccountCode"); | ||
| 685 | $exten=$event->getKey("Exten"); | ||
| 686 | $priority=$event->getKey("Priority"); | ||
| 687 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 688 | |||
| 689 | $dchannel=$event->getKey("DestChannel"); | ||
| 690 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 691 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 692 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 693 | $dexten=$event->getKey("DestExten"); | ||
| 694 | $dpriority=$event->getKey("DestPriority"); | ||
| 695 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 696 | |||
| 697 | $dialstring=$event->getKey("DialString"); | ||
| 698 | |||
| 699 | if($accountcode!="") | ||
| 700 | { | ||
| 701 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 702 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 703 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 704 | |||
| 705 | $accountcodearr=explode("|",$accountcode); | ||
| 706 | if($accountcodearr[0]=="m") | ||
| 707 | { | ||
| 708 | if($accountcodearr[1]=="u") | ||
| 709 | { | ||
| 710 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 711 | if($sipid) | ||
| 712 | { | ||
| 713 | $data=json_decode($sipid->clients,true); | ||
| 714 | $data['channel']=$dchannel; | ||
| 715 | $sipid->clients=json_encode($data); | ||
| 716 | $sipid->save(); | ||
| 717 | |||
| 718 | $newqueue=new Kqueue(); | ||
| 719 | $newqueue->sipNotify($sipid,"dialerUI","dialstart","u","~~".base64_encode($dchannel)); | ||
| 720 | } | ||
| 721 | } | ||
| 722 | if($accountcodearr[1]=="c") | ||
| 723 | { | ||
| 724 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 725 | if($crmcall) | ||
| 726 | { | ||
| 727 | $nowts=microtime(true)*1000; | ||
| 728 | |||
| 729 | $crmcall->setTs('ts_Call',$nowts); | ||
| 730 | |||
| 731 | $crmcall->state=$eventname; | ||
| 732 | |||
| 733 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 734 | if($dialline) | ||
| 735 | { | ||
| 736 | $dialline->channel=$dchannel; | ||
| 737 | $dialline->save(); | ||
| 738 | } | ||
| 739 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 740 | |||
| 741 | $newqueue=new Kqueue(); | ||
| 742 | $newqueue->sipNotify($tsip,"dialerUI","dialstart","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | ||
| 743 | |||
| 744 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring"); | ||
| 745 | |||
| 746 | $crmcall->save(); | ||
| 747 | } | ||
| 748 | } | ||
| 749 | } | ||
| 750 | |||
| 751 | } | ||
| 752 | } | ||
| 753 | |||
| 754 | private function DialEndEvent(EventMessage $event) | ||
| 755 | { | ||
| 756 | $eventname = "DialEnd"; | ||
| 757 | |||
| 758 | $channel=$event->getKey("Channel"); | ||
| 759 | $channelstate=$event->getKey("ChannelState"); | ||
| 760 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 761 | $accountcode=$event->getKey("AccountCode"); | ||
| 762 | $exten=$event->getKey("Exten"); | ||
| 763 | $priority=$event->getKey("Priority"); | ||
| 764 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 765 | |||
| 766 | $dchannel=$event->getKey("DestChannel"); | ||
| 767 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 768 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 769 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 770 | $dexten=$event->getKey("DestExten"); | ||
| 771 | $dpriority=$event->getKey("DestPriority"); | ||
| 772 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 773 | |||
| 774 | $dialstatus=$event->getKey("DialStatus"); | ||
| 775 | |||
| 776 | if($accountcode!="") | ||
| 777 | { | ||
| 778 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 779 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 780 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 781 | |||
| 782 | $accountcodearr=explode("|",$accountcode); | ||
| 783 | if($accountcodearr[0]=="m") | ||
| 784 | { | ||
| 785 | if($accountcodearr[1]=="u") | ||
| 786 | { | ||
| 787 | if($dialstatus=="ANSWER") | ||
| 788 | { | ||
| 789 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 790 | if($sipid) | ||
| 791 | { | ||
| 792 | $sipid->confup=1; | ||
| 793 | $sipid->save(); | ||
| 794 | } | ||
| 795 | } | ||
| 796 | } | ||
| 797 | else if($accountcodearr[1]=="c") | ||
| 798 | { | ||
| 799 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 800 | if($crmcall) | ||
| 801 | { | ||
| 802 | $nowts=microtime(true)*1000; | ||
| 803 | |||
| 804 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 805 | |||
| 806 | $crmcall->state=$eventname; | ||
| 807 | $crmcall->status=$dialstatus; | ||
| 808 | |||
| 809 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 810 | if($dialline) | ||
| 811 | { | ||
| 812 | $dialline->channel=$channel; | ||
| 813 | $dialline->save(); | ||
| 814 | } | ||
| 815 | |||
| 816 | $recfile=$crmcall->newRecFilePath(); | ||
| 817 | |||
| 818 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 819 | |||
| 820 | //start recording | ||
| 821 | $newqueue=new Kqueue(); | ||
| 822 | $newqueue->recordChannel($tsip->server,$dchannel,$recfile); | ||
| 823 | |||
| 824 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 825 | |||
| 826 | //notify UI (only the sip id) | ||
| 827 | $newqueue=new Kqueue(); | ||
| 828 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 829 | |||
| 830 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 831 | |||
| 832 | $crmcall->save(); | ||
| 833 | } | ||
| 834 | } | ||
| 835 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 836 | { | ||
| 837 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 838 | if($crmcall) | ||
| 839 | { | ||
| 840 | $nowts=microtime(true)*1000; | ||
| 841 | |||
| 842 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 843 | |||
| 844 | $crmcall->state=$eventname; | ||
| 845 | $crmcall->status=$dialstatus; | ||
| 846 | $crmcall->uniqueid=$uniqueid; | ||
| 847 | |||
| 848 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 849 | if($dialline && $dialstatus=="ANSWER") | ||
| 850 | { | ||
| 851 | $dialline->channel=$dchannel; | ||
| 852 | $dialline->uniqueid=$uniqueid; | ||
| 853 | $dialline->status="Auto"; | ||
| 854 | $dialline->save(); | ||
| 855 | } | ||
| 856 | |||
| 857 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 858 | |||
| 859 | $crmcall->type="Auto"; | ||
| 860 | $crmcall->save(); | ||
| 861 | } | ||
| 862 | |||
| 863 | } | ||
| 864 | } | ||
| 865 | } | ||
| 866 | } | ||
| 572 | private function UnknownEvent(EventMessage $event) | 867 | private function UnknownEvent(EventMessage $event) |
| 573 | { | 868 | { |
| 574 | $eventname=$event->getKey("Event"); | 869 | $eventname=$event->getKey("Event"); |
| ... | @@ -742,7 +1037,7 @@ class KPAMIListen implements IEventListener | ... | @@ -742,7 +1037,7 @@ class KPAMIListen implements IEventListener |
| 742 | $dialline=Dialline::find($crmcall->dialline_id); | 1037 | $dialline=Dialline::find($crmcall->dialline_id); |
| 743 | if($dialline) | 1038 | if($dialline) |
| 744 | { | 1039 | { |
| 745 | $dialline->channel=$dchannel; | 1040 | $dialline->channel=$channel; |
| 746 | $dialline->save(); | 1041 | $dialline->save(); |
| 747 | } | 1042 | } |
| 748 | 1043 | ||
| ... | @@ -758,12 +1053,41 @@ class KPAMIListen implements IEventListener | ... | @@ -758,12 +1053,41 @@ class KPAMIListen implements IEventListener |
| 758 | 1053 | ||
| 759 | //notify UI (only the sip id) | 1054 | //notify UI (only the sip id) |
| 760 | $newqueue=new Kqueue(); | 1055 | $newqueue=new Kqueue(); |
| 761 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | 1056 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); |
| 1057 | |||
| 1058 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 1059 | |||
| 1060 | $crmcall->save(); | ||
| 1061 | } | ||
| 1062 | } | ||
| 1063 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 1064 | { | ||
| 1065 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 1066 | if($crmcall) | ||
| 1067 | { | ||
| 1068 | $nowts=microtime(true)*1000; | ||
| 1069 | |||
| 1070 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1071 | |||
| 1072 | $crmcall->state=$eventname; | ||
| 1073 | $crmcall->status=$dialstatus; | ||
| 1074 | $crmcall->uniqueid=$uniqueid; | ||
| 1075 | |||
| 1076 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 1077 | if($dialline && $dialstatus=="ANSWER") | ||
| 1078 | { | ||
| 1079 | $dialline->channel=$dchannel; | ||
| 1080 | $dialline->uniqueid=$uniqueid; | ||
| 1081 | $dialline->status="Auto"; | ||
| 1082 | $dialline->save(); | ||
| 1083 | } | ||
| 762 | 1084 | ||
| 763 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | 1085 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); |
| 764 | 1086 | ||
| 1087 | $crmcall->type="Auto"; | ||
| 765 | $crmcall->save(); | 1088 | $crmcall->save(); |
| 766 | } | 1089 | } |
| 1090 | |||
| 767 | } | 1091 | } |
| 768 | } | 1092 | } |
| 769 | } | 1093 | } |
| ... | @@ -1027,12 +1351,38 @@ class KPAMIListen implements IEventListener | ... | @@ -1027,12 +1351,38 @@ class KPAMIListen implements IEventListener |
| 1027 | 1351 | ||
| 1028 | private function redirectIncoming() | 1352 | private function redirectIncoming() |
| 1029 | { | 1353 | { |
| 1030 | 1354 | $diallines=Dialline::where('server','=',$this->sipip)->whereIn("status",["Inbound","Auto"])->where("conf","=","")->get(); | |
| 1031 | $diallines=Dialline::where('server','=',$this->sipip)->where("status","=","Inbound")->where("conf","=","")->get(); | ||
| 1032 | if($diallines) | 1355 | if($diallines) |
| 1033 | { | 1356 | { |
| 1034 | foreach($diallines as $dialline) | 1357 | foreach($diallines as $dialline) |
| 1035 | { | 1358 | { |
| 1359 | exec("/usr/sbin/asterisk -rx 'core show channels'",$allChnnlsArr); | ||
| 1360 | $cnt = 0; | ||
| 1361 | foreach($allChnnlsArr as $allChnnls) | ||
| 1362 | { | ||
| 1363 | if(stristr($allChnnls, substr(stripslashes($dialline->channel),0, 20))) | ||
| 1364 | { | ||
| 1365 | $cnt++; | ||
| 1366 | } | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | if($cnt == 0) | ||
| 1370 | { | ||
| 1371 | Log::useFiles(storage_path()."/logs/Predictive/predictive_".date("Y_m_d").".log"); | ||
| 1372 | Log::info($dialline); | ||
| 1373 | |||
| 1374 | $dialline->status="Free"; | ||
| 1375 | $dialline->conf=""; | ||
| 1376 | $dialline->number=""; | ||
| 1377 | $dialline->uniqueid=""; | ||
| 1378 | $dialline->src_channel=""; | ||
| 1379 | $dialline->channel=""; | ||
| 1380 | $dialline->regexstr=""; | ||
| 1381 | $dialline->save(); | ||
| 1382 | |||
| 1383 | continue; | ||
| 1384 | } | ||
| 1385 | |||
| 1036 | echo $dialline->number." waiting\n"; | 1386 | echo $dialline->number." waiting\n"; |
| 1037 | $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); | 1387 | $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); |
| 1038 | 1388 | ||
| ... | @@ -1080,15 +1430,15 @@ class KPAMIListen implements IEventListener | ... | @@ -1080,15 +1430,15 @@ class KPAMIListen implements IEventListener |
| 1080 | $sipids=array(); | 1430 | $sipids=array(); |
| 1081 | if($crmcall->client!="") | 1431 | if($crmcall->client!="") |
| 1082 | { | 1432 | { |
| 1083 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->client."%")->where("clients","like","%".$crmcall->did."%")->get(); | 1433 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->client."%")->where("clients","like","%".$crmcall->did."%")->orderBy("updated_at","desc")->get(); |
| 1084 | } | 1434 | } |
| 1085 | else if($crmcall->did!="") | 1435 | else if($crmcall->did!="") |
| 1086 | { | 1436 | { |
| 1087 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->did."%")->get(); | 1437 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->did."%")->orderBy("updated_at","desc")->get(); |
| 1088 | } | 1438 | } |
| 1089 | else | 1439 | else |
| 1090 | { | 1440 | { |
| 1091 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->get();//send to all? | 1441 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->orderBy("updated_at","desc")->get();//send to all? |
| 1092 | } | 1442 | } |
| 1093 | 1443 | ||
| 1094 | if(!empty($sipids)) | 1444 | if(!empty($sipids)) |
| ... | @@ -1099,7 +1449,30 @@ class KPAMIListen implements IEventListener | ... | @@ -1099,7 +1449,30 @@ class KPAMIListen implements IEventListener |
| 1099 | $first_r=0;$first_w=0;$first_a=0;$allsipids=array(); | 1449 | $first_r=0;$first_w=0;$first_a=0;$allsipids=array(); |
| 1100 | foreach($sipids as $sipid) | 1450 | foreach($sipids as $sipid) |
| 1101 | { | 1451 | { |
| 1102 | if($sipid->ready==1) | 1452 | //if($sipid->ready==1) |
| 1453 | if($sipid->ready==1&&$sipid->prepare_call==0&&$dialline->status=="Inbound") | ||
| 1454 | { | ||
| 1455 | $clientsarr=json_decode($sipid->clients,true); | ||
| 1456 | if($crmcall->client=="")$first_a=$sipid; | ||
| 1457 | else | ||
| 1458 | { | ||
| 1459 | if($clientsarr['a']!="")$clientaarr = explode(",", $clientsarr['a']); | ||
| 1460 | if(isset($clientsarr['a'])&&in_array($crmcall->client, $clientaarr))$first_a=$sipid; | ||
| 1461 | if($clientsarr['w']!="")$clientwarr = explode(",", $clientsarr['w']); | ||
| 1462 | if(isset($clientsarr['w'])&&in_array($crmcall->client, $clientwarr))$first_w=$sipid; | ||
| 1463 | if($clientsarr['r']!="")$clientrarr = explode(",", $clientsarr['r']); | ||
| 1464 | if(isset($clientsarr['r'])&&in_array($crmcall->client, $clientrarr))$first_r=$sipid; | ||
| 1465 | } | ||
| 1466 | } | ||
| 1467 | else | ||
| 1468 | { | ||
| 1469 | $allsipids[]=$sipid; | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | foreach($sipids as $sipid) | ||
| 1474 | { | ||
| 1475 | if($sipid->ready==1&&$sipid->prepare_call==1&&$dialline->status=="Auto") | ||
| 1103 | { | 1476 | { |
| 1104 | $clientsarr=json_decode($sipid->clients,true); | 1477 | $clientsarr=json_decode($sipid->clients,true); |
| 1105 | if($crmcall->client=="")$first_a=$sipid; | 1478 | if($crmcall->client=="")$first_a=$sipid; |
| ... | @@ -1163,8 +1536,13 @@ class KPAMIListen implements IEventListener | ... | @@ -1163,8 +1536,13 @@ class KPAMIListen implements IEventListener |
| 1163 | 1536 | ||
| 1164 | $dialline->conf="1000".$found->id; | 1537 | $dialline->conf="1000".$found->id; |
| 1165 | $dialline->save(); | 1538 | $dialline->save(); |
| 1539 | if($crmcall->crm_id>0){ | ||
| 1540 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$found->user]); | ||
| 1166 | 1541 | ||
| 1542 | } | ||
| 1167 | $found->ready=0; | 1543 | $found->ready=0; |
| 1544 | $found->prepare_call=0; | ||
| 1545 | $found->patched=1; | ||
| 1168 | $found->save(); | 1546 | $found->save(); |
| 1169 | 1547 | ||
| 1170 | $recfile=$crmcall->newRecFilePath(); | 1548 | $recfile=$crmcall->newRecFilePath(); |
| ... | @@ -1195,10 +1573,15 @@ class KPAMIListen implements IEventListener | ... | @@ -1195,10 +1573,15 @@ class KPAMIListen implements IEventListener |
| 1195 | { | 1573 | { |
| 1196 | foreach($allsipids as $tsip) | 1574 | foreach($allsipids as $tsip) |
| 1197 | { | 1575 | { |
| 1576 | //$newqueue=new Kqueue(); | ||
| 1577 | //$newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | ||
| 1578 | if($dialline->status!="Auto") | ||
| 1579 | { | ||
| 1198 | $newqueue=new Kqueue(); | 1580 | $newqueue=new Kqueue(); |
| 1199 | $newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | 1581 | $newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); |
| 1200 | } | 1582 | } |
| 1201 | } | 1583 | } |
| 1584 | } | ||
| 1202 | else | 1585 | else |
| 1203 | { | 1586 | { |
| 1204 | //play no users available | 1587 | //play no users available |
| ... | @@ -1319,7 +1702,11 @@ class KPAMIListen implements IEventListener | ... | @@ -1319,7 +1702,11 @@ class KPAMIListen implements IEventListener |
| 1319 | $redirect=new RedirectAction($data['fromext'], $data['toext'], $data['context'], 1); | 1702 | $redirect=new RedirectAction($data['fromext'], $data['toext'], $data['context'], 1); |
| 1320 | $res=$this->_client->send($redirect); | 1703 | $res=$this->_client->send($redirect); |
| 1321 | } | 1704 | } |
| 1322 | 1705 | else if($tqueue->key=="transfer") | |
| 1706 | { | ||
| 1707 | $attendedtransferaction=new AttendedTransferAction($data['channel'],$data['exten'],$data['context'],"1"); | ||
| 1708 | $res=$this->_client->send($attendedtransferaction); | ||
| 1709 | } | ||
| 1323 | $tqueue->delete(); | 1710 | $tqueue->delete(); |
| 1324 | } | 1711 | } |
| 1325 | } | 1712 | } | ... | ... |
application/app/Jobs/KPAMIListen2.php
0 → 100644
| 1 | <?php namespace App\Jobs; | ||
| 2 | |||
| 3 | use PAMI\Client\Impl\ClientImpl; | ||
| 4 | use PAMI\Listener\IEventListener; | ||
| 5 | use PAGI\Application\PAGIApplication; | ||
| 6 | use PAGI\Client\AbstractClient; | ||
| 7 | |||
| 8 | use PAMI\Message\Event\NewextenEvent; | ||
| 9 | use PAMI\Message\Event\AsyncAGIEvent; | ||
| 10 | use PAMI\Message\Event\EventMessage; | ||
| 11 | use PAMI\Message\Event\PeerStatusEvent; | ||
| 12 | use PAMI\Message\Event\ExtensionStatusEvent; | ||
| 13 | use PAMI\Message\Event\NewchannelEvent; | ||
| 14 | use PAMI\Message\Event\VarSetEvent; | ||
| 15 | use PAMI\Message\Event\NewCalleridEvent; | ||
| 16 | use PAMI\Message\Event\NewstateEvent; | ||
| 17 | use PAMI\Message\Event\OriginateResponseEvent; | ||
| 18 | use PAMI\Message\Event\HangupEvent; | ||
| 19 | use PAMI\Message\Event\UnknownEvent; | ||
| 20 | use PAMI\Message\Event\DialBeginEvent; | ||
| 21 | use PAMI\Message\Event\DialEndEvent; | ||
| 22 | |||
| 23 | use PAMI\Message\Action\AGIAction; | ||
| 24 | use PAMI\Message\Action\SIPNotifyAction; | ||
| 25 | use PAMI\Message\Action\OriginateAction; | ||
| 26 | use PAMI\Message\Action\CommandAction; | ||
| 27 | use PAMI\Message\Action\GetVarAction; | ||
| 28 | use PAMI\Message\Action\SetVarAction; | ||
| 29 | use PAMI\Message\Action\HangupAction; | ||
| 30 | use PAMI\Message\Action\MixMonitorAction; | ||
| 31 | use PAMI\Message\Action\RedirectAction; | ||
| 32 | use PAMI\Message\Action\ConfbridgeMuteAction; | ||
| 33 | use PAMI\Message\Action\ConfbridgeUnmuteAction; | ||
| 34 | use PAMI\Message\Action\ActionMessage; | ||
| 35 | use PAMI\Message\Action\AttendedTransferAction; | ||
| 36 | use PAMI\Message\Action\BlindTransferAction; | ||
| 37 | |||
| 38 | use App\Models\Sipid; | ||
| 39 | use App\Models\User; | ||
| 40 | use App\Models\UserLog; | ||
| 41 | use App\Models\CRMCall; | ||
| 42 | use App\Models\Kqueue; | ||
| 43 | use App\Models\Dialline; | ||
| 44 | use App\Jobs\KHRMSLib; | ||
| 45 | use DB; | ||
| 46 | use Config; | ||
| 47 | use Log; | ||
| 48 | |||
| 49 | class KPAMIListen implements IEventListener | ||
| 50 | { | ||
| 51 | private $_client; | ||
| 52 | private $_id; | ||
| 53 | private $_pamiOptions; | ||
| 54 | |||
| 55 | private $sipip=""; | ||
| 56 | |||
| 57 | public function __construct($sipip) | ||
| 58 | { | ||
| 59 | $this->sipip=$sipip; | ||
| 60 | |||
| 61 | $options = array('host' => $sipip,'port' => '5038','username' => 'kstychAMIAdmin','secret' => 'yb9738z_kstych','connect_timeout' => 10000,'read_timeout' => 10000,'scheme' => 'tcp://'); | ||
| 62 | $this->_pamiOptions = $options; | ||
| 63 | $this->_client = new ClientImpl($options); | ||
| 64 | $this->_id = $this->_client->registerEventListener($this); | ||
| 65 | |||
| 66 | Config::set('runtime.echosqllogs',Config::get("app.echosqllogs")); | ||
| 67 | } | ||
| 68 | |||
| 69 | public function run() | ||
| 70 | { | ||
| 71 | $pid1 = pcntl_fork(); | ||
| 72 | if(!$pid1) | ||
| 73 | { | ||
| 74 | DB::reconnect(); | ||
| 75 | while(true) | ||
| 76 | { | ||
| 77 | usleep(2000*1000); | ||
| 78 | $this->redirectIncoming(); | ||
| 79 | } | ||
| 80 | return; | ||
| 81 | } | ||
| 82 | |||
| 83 | $i=1; | ||
| 84 | DB::reconnect(); | ||
| 85 | $this->_client->open(); | ||
| 86 | while(true) | ||
| 87 | { | ||
| 88 | usleep(1000); | ||
| 89 | $this->_client->process(); | ||
| 90 | if($i++%100==0)$this->sendAMICommands();if($i>1000)$i=1; | ||
| 91 | } | ||
| 92 | $this->_client->close(); | ||
| 93 | } | ||
| 94 | |||
| 95 | public function handle(EventMessage $event) | ||
| 96 | { | ||
| 97 | //Log::info($event); | ||
| 98 | |||
| 99 | if ($event instanceof AsyncAGIEvent) {} | ||
| 100 | else if ($event instanceof PeerStatusEvent) {$this->PeerStatusEvent($event);} | ||
| 101 | else if ($event instanceof ExtensionStatusEvent) {$this->ExtensionStatusEvent($event);} | ||
| 102 | else if ($event instanceof NewchannelEvent) {$this->NewchannelEvent($event);} | ||
| 103 | else if ($event instanceof NewextenEvent) {$this->NewextenEvent($event);} | ||
| 104 | else if ($event instanceof VarSetEvent) {$this->VarSetEvent($event);} | ||
| 105 | else if ($event instanceof NewCalleridEvent) {$this->NewCalleridEvent($event);} | ||
| 106 | else if ($event instanceof NewstateEvent) {$this->NewstateEvent($event);} | ||
| 107 | else if ($event instanceof OriginateResponseEvent){$this->OriginateResponseEvent($event);} | ||
| 108 | else if ($event instanceof HangupEvent) {$this->HangupEvent($event);} | ||
| 109 | else if ($event instanceof UnknownEvent) {$this->UnknownEvent($event);} | ||
| 110 | else if ($event instanceof DialBeginEvent) {$this->DialBeginEvent($event);} | ||
| 111 | else if ($event instanceof DialEndEvent) {$this->DialEndEvent($event);} | ||
| 112 | //else var_dump($event); | ||
| 113 | |||
| 114 | } | ||
| 115 | |||
| 116 | |||
| 117 | private function PeerStatusEvent(EventMessage $event) | ||
| 118 | { | ||
| 119 | $status=0;$userstatus=0; | ||
| 120 | if($event->getPeerStatus()=="Registered"||$event->getPeerStatus()=="Reachable")$status=1; | ||
| 121 | $nowts=microtime(true)*1000; | ||
| 122 | |||
| 123 | $peerdata=explode("/",$event->getPeer()); | ||
| 124 | if(strtolower($peerdata[0])=="sip") | ||
| 125 | { | ||
| 126 | $id=intval($peerdata[1]); | ||
| 127 | if($id>0) | ||
| 128 | { | ||
| 129 | $sipid=Sipid::where('server','=',$this->sipip)->where('id','=',$id)->first(); | ||
| 130 | if($sipid&&$sipid->status!=$status) | ||
| 131 | { | ||
| 132 | $sipid->status=$status; | ||
| 133 | $data=json_decode($sipid->clients,true); | ||
| 134 | if($status==0) | ||
| 135 | { | ||
| 136 | if($sipid->confup==1) | ||
| 137 | { | ||
| 138 | if(isset($data['channel'])) | ||
| 139 | { | ||
| 140 | $newqueue=new Kqueue(); | ||
| 141 | $newqueue->hangupChannelS($data['channel'],$sipid->server); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | $sipid->ready=0;$sipid->confup=0;$sipid->clients=""; | ||
| 145 | } | ||
| 146 | else | ||
| 147 | { | ||
| 148 | if(isset($data['keepconf'])&&$data['keepconf']==1) | ||
| 149 | { | ||
| 150 | $newqueue=new Kqueue(); | ||
| 151 | $newqueue->userToConf($sipid); | ||
| 152 | } | ||
| 153 | } | ||
| 154 | $sipid->save(); | ||
| 155 | |||
| 156 | $user=User::find($sipid->user); | ||
| 157 | if($user) | ||
| 158 | { | ||
| 159 | $userstatus=0+intval(Sipid::where("user","=",$sipid->user)->max('status')); | ||
| 160 | |||
| 161 | if($user->presence!=$userstatus) | ||
| 162 | { | ||
| 163 | if($userstatus==1) | ||
| 164 | { | ||
| 165 | $userlog=new UserLog(); | ||
| 166 | $userlog->startLog($user); | ||
| 167 | $userlog->getLastTs($sipid->id,$nowts); | ||
| 168 | $userlog->save(); | ||
| 169 | } | ||
| 170 | else if($userstatus==0) | ||
| 171 | { | ||
| 172 | $userlog=UserLog::where('user_id','=',$user->id)->orderBy("id","DESC")->first(); | ||
| 173 | if($userlog) | ||
| 174 | { | ||
| 175 | $userlog->stopLog(); | ||
| 176 | $userlog->getLastTs($sipid->id,$nowts); | ||
| 177 | $userlog->save(); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | $user->presence=$userstatus; | ||
| 182 | $user->save(); | ||
| 183 | |||
| 184 | $frndlib=new KFriendLib(); | ||
| 185 | $noty=new KPushNotify(); | ||
| 186 | $noty->send($frndlib->myFrndList($user->id),"presence",$user->dispname(),$user->presence,$user->id); | ||
| 187 | } | ||
| 188 | |||
| 189 | |||
| 190 | //close any calls | ||
| 191 | if($status==0) | ||
| 192 | { | ||
| 193 | $crmcalls=CRMCall::where("sipid_id","=",$sipid->id)->where("user_id","=",$sipid->user)->whereRaw('ts_Dispo = ts_Close')->where('userstatus','=','')->where('created_at','>=',date('Y-m-d 00:00:00'))->get(); | ||
| 194 | foreach($crmcalls as $crmcall) | ||
| 195 | { | ||
| 196 | $crmcall->setTs('ts_Close',$nowts); | ||
| 197 | |||
| 198 | $crmcall->userstatus="FORCEDCLOSE"; | ||
| 199 | $crmcall->usersubstatus="FORCEDCLOSE"; | ||
| 200 | $crmcall->call_flag="Z"; | ||
| 201 | |||
| 202 | if($crmcall->crm_id>0) | ||
| 203 | { | ||
| 204 | $wakka = new KHRMSLib(); | ||
| 205 | $record=$wakka->getPerson($crmcall->crm_id,$crmcall->client); | ||
| 206 | if($record) | ||
| 207 | { | ||
| 208 | DB::table('records_'.$crmcall->client)->where($crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 209 | $record["peopledata"]["dialer_status"]="FORCEDCLOSE"; | ||
| 210 | $record["peopledata"]["dialer_substatus"]="FORCEDCLOSE"; | ||
| 211 | $record["peopledata"]["dialer_callback"]=""; | ||
| 212 | $record["peopledata"]["dialer_remarks"]=""; | ||
| 213 | $wakka->setPerson($crmcall->crm_id,$record,$crmcall->client); | ||
| 214 | $wakka->setPerson($crmcall->crm_id,$record,""); | ||
| 215 | } | ||
| 216 | |||
| 217 | } | ||
| 218 | |||
| 219 | $crmcall->saveRecFileSize(); | ||
| 220 | $crmcall->save(); | ||
| 221 | } | ||
| 222 | |||
| 223 | } | ||
| 224 | |||
| 225 | } | ||
| 226 | echo "Updated Sip: $sipid->id - $status Uid: $sipid->user - $userstatus\n"; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | } | ||
| 230 | } | ||
| 231 | |||
| 232 | |||
| 233 | private function ExtensionStatusEvent(EventMessage $event) | ||
| 234 | { | ||
| 235 | //echo "ExtensionStatusEvent : ".$event->getKey("Event")." -- ".$event->getKey("AccountCode")."\n"; | ||
| 236 | } | ||
| 237 | private function NewchannelEvent(EventMessage $event) | ||
| 238 | { | ||
| 239 | $eventname=$event->getKey("Event"); | ||
| 240 | $channel=$event->getKey("Channel"); | ||
| 241 | $channelstate=$event->getKey("ChannelState"); | ||
| 242 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 243 | $accountcode=$event->getKey("AccountCode"); | ||
| 244 | $context=$event->getKey("Context"); | ||
| 245 | $exten=$event->getKey("Exten"); | ||
| 246 | $priority=$event->getKey("Priority"); | ||
| 247 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 248 | |||
| 249 | $phonenumber=$event->getKey("CallerIDNum"); | ||
| 250 | $callerid=$event->getKey("CallerIDName"); | ||
| 251 | |||
| 252 | echo "$accountcode:NewchannelEvent : $context:$eventname $channelstate:$channelstatedesc $uniqueid $phonenumber $exten:$priority $channel\n"; | ||
| 253 | } | ||
| 254 | private function NewextenEvent(EventMessage $event) | ||
| 255 | { | ||
| 256 | $eventname=$event->getKey("Event"); | ||
| 257 | $channel=$event->getKey("Channel"); | ||
| 258 | $channelstate=$event->getKey("ChannelState"); | ||
| 259 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 260 | $accountcode=$event->getKey("AccountCode"); | ||
| 261 | $context=$event->getKey("Context"); | ||
| 262 | $exten=$event->getKey("Exten"); | ||
| 263 | $priority=$event->getKey("Priority"); | ||
| 264 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 265 | |||
| 266 | $phonenumber=$event->getKey("CallerIDNum"); | ||
| 267 | $callerid=$event->getKey("CallerIDName"); | ||
| 268 | |||
| 269 | //echo "$accountcode:NewextenEvent : $context:$eventname $channelstate:$channelstatedesc $uniqueid $phonenumber $exten:$priority $channel\n"; | ||
| 270 | if($context=="kstychDialerINB"&&$exten!="s"&&$priority=="1") | ||
| 271 | { | ||
| 272 | if(strtolower(substr($channel,0,4))=="sip/") | ||
| 273 | { | ||
| 274 | $dahdispan=''; | ||
| 275 | $dahdichannel=''; | ||
| 276 | echo "$context:$eventname $phonenumber $exten:$priority $dahdispan:$dahdichannel $uniqueid\n"; | ||
| 277 | $dialline=Dialline::where('server','=',$this->sipip)->where("dialstr","=",env("sip_dialstr"))->where("status","=","Free")->first(); | ||
| 278 | if($dialline) | ||
| 279 | { | ||
| 280 | $dialline->status='Inbound'; | ||
| 281 | $dialline->uniqueid=$uniqueid; | ||
| 282 | $dialline->number=$phonenumber; | ||
| 283 | $dialline->channel=$channel; | ||
| 284 | $dialline->save(); | ||
| 285 | |||
| 286 | $nowts=microtime(true)*1000; | ||
| 287 | |||
| 288 | //start the call log | ||
| 289 | $crmcall=new CRMCall(); | ||
| 290 | $crmcall->number=$phonenumber; | ||
| 291 | $crmcall->user_id=0;////// | ||
| 292 | $crmcall->sipid_id=0;////// | ||
| 293 | |||
| 294 | $crmcall->did=$exten; | ||
| 295 | |||
| 296 | $crmcall->crm_id=0; | ||
| 297 | $crmcall->client="."; | ||
| 298 | $crmcall->department=""; | ||
| 299 | |||
| 300 | $crmcall->state='Inbound'; | ||
| 301 | $crmcall->type="Inbound"; | ||
| 302 | $crmcall->status="ANSWER"; | ||
| 303 | $crmcall->uniqueid=$uniqueid; | ||
| 304 | $crmcall->dialline_id=$dialline->id; | ||
| 305 | |||
| 306 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 307 | |||
| 308 | $crmcall->group=$dialline->group; | ||
| 309 | |||
| 310 | $tdata=array(); | ||
| 311 | $tdata['uniqueid']=$uniqueid; | ||
| 312 | $tdata['inboundchannel']=$channel; | ||
| 313 | |||
| 314 | $crmcall->data=json_encode($tdata); | ||
| 315 | $crmcall->save(); | ||
| 316 | |||
| 317 | $userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get(); | ||
| 318 | |||
| 319 | if($userStatus=="[]") | ||
| 320 | { | ||
| 321 | |||
| 322 | $newqueue=new Kqueue(); | ||
| 323 | $newqueue->playbusyfile($dialline->channel,$dialline->server); | ||
| 324 | } | ||
| 325 | |||
| 326 | $callStat=CRMCall::where("did","like","%".substr($exten,-4)."%")->where("updated_at",">",date("Y-m-d"))->whereIn('state',['DialBegin', 'DialEnd'])->get(); | ||
| 327 | |||
| 328 | if($callStat!="[]") | ||
| 329 | { | ||
| 330 | |||
| 331 | $newqueue=new Kqueue(); | ||
| 332 | $newqueue->playbusyfile($dialline->channel,$dialline->server); | ||
| 333 | } | ||
| 334 | |||
| 335 | } | ||
| 336 | } | ||
| 337 | } | ||
| 338 | } | ||
| 339 | private function VarSetEvent(EventMessage $event) | ||
| 340 | { | ||
| 341 | $eventname=$event->getKey("Event"); | ||
| 342 | $channel=$event->getKey("Channel"); | ||
| 343 | $channelstate=$event->getKey("ChannelState"); | ||
| 344 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 345 | $accountcode=$event->getKey("AccountCode"); | ||
| 346 | $exten=$event->getKey("Exten"); | ||
| 347 | $priority=$event->getKey("Priority"); | ||
| 348 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 349 | |||
| 350 | $variable=$event->getKey("Variable"); | ||
| 351 | $value=$event->getKey("Value"); | ||
| 352 | |||
| 353 | if($accountcode!="") | ||
| 354 | { | ||
| 355 | //echo "$accountcode:VarSetEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $variable=$value\n"; | ||
| 356 | echo "$accountcode:$eventname $exten:$priority $variable=$value\n"; | ||
| 357 | |||
| 358 | if($variable=="DIALSTATUS") | ||
| 359 | { | ||
| 360 | $accountcodearr=explode("|",$accountcode); | ||
| 361 | if($accountcodearr[0]=="m") | ||
| 362 | { | ||
| 363 | if($accountcodearr[1]=="c") | ||
| 364 | { | ||
| 365 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 366 | if($crmcall) | ||
| 367 | { | ||
| 368 | $nowts=microtime(true)*1000; | ||
| 369 | |||
| 370 | $crmcall->status=$value; | ||
| 371 | |||
| 372 | $crmcall->addEventLog($nowts,"$accountcode:VarSetEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $variable=$value"); | ||
| 373 | |||
| 374 | $crmcall->save(); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | } | ||
| 381 | } | ||
| 382 | private function NewCalleridEvent(EventMessage $event) | ||
| 383 | { | ||
| 384 | $eventname=$event->getKey("Event"); | ||
| 385 | $channel=$event->getKey("Channel"); | ||
| 386 | $channelstate=$event->getKey("ChannelState"); | ||
| 387 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 388 | $accountcode=$event->getKey("AccountCode"); | ||
| 389 | $exten=$event->getKey("Exten"); | ||
| 390 | $priority=$event->getKey("Priority"); | ||
| 391 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 392 | |||
| 393 | //echo "$accountcode:NewCalleridEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 394 | } | ||
| 395 | private function NewstateEvent(EventMessage $event) | ||
| 396 | { | ||
| 397 | $eventname=$event->getKey("Event"); | ||
| 398 | $channel=$event->getKey("Channel"); | ||
| 399 | $channelstate=$event->getKey("ChannelState"); | ||
| 400 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 401 | $accountcode=$event->getKey("AccountCode"); | ||
| 402 | $exten=$event->getKey("Exten"); | ||
| 403 | $priority=$event->getKey("Priority"); | ||
| 404 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 405 | |||
| 406 | //echo "$accountcode:NewstateEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 407 | } | ||
| 408 | private function OriginateResponseEvent(EventMessage $event) | ||
| 409 | { | ||
| 410 | $eventname=$event->getKey("Event"); | ||
| 411 | $channel=$event->getKey("Channel"); | ||
| 412 | $actionid=$event->getKey("ActionID"); | ||
| 413 | $response=$event->getKey("Response"); | ||
| 414 | $accountcode=$event->getKey("AccountCode"); | ||
| 415 | $exten=$event->getKey("Exten"); | ||
| 416 | $reason=$event->getKey("Reason"); | ||
| 417 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 418 | |||
| 419 | //echo "$accountcode:OriginateResponseEvent : $eventname $actionid:$response $uniqueid $exten:$reason $channel\n"; | ||
| 420 | } | ||
| 421 | private function HangupEvent(EventMessage $event) | ||
| 422 | { | ||
| 423 | $eventname=$event->getKey("Event"); | ||
| 424 | $channel=$event->getKey("Channel"); | ||
| 425 | $channelstate=$event->getKey("ChannelState"); | ||
| 426 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 427 | $accountcode=$event->getKey("AccountCode"); | ||
| 428 | $exten=$event->getKey("Exten"); | ||
| 429 | $priority=$event->getKey("Priority"); | ||
| 430 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 431 | $context=$event->getKey("Context"); | ||
| 432 | |||
| 433 | $cause=$event->getKey("Cause"); | ||
| 434 | $causetxt=$event->getKey("Cause-txt"); | ||
| 435 | |||
| 436 | if($accountcode!="") | ||
| 437 | { | ||
| 438 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; | ||
| 439 | echo "$accountcode:$eventname $exten:$priority $cause:$causetxt\n"; | ||
| 440 | |||
| 441 | $accountcodearr=explode("|",$accountcode); | ||
| 442 | if($accountcodearr[0]=="m") | ||
| 443 | { | ||
| 444 | if($accountcodearr[1]=="u") | ||
| 445 | { | ||
| 446 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 447 | if($sipid) | ||
| 448 | { | ||
| 449 | $sipid->confup=0; | ||
| 450 | $sipid->save(); | ||
| 451 | } | ||
| 452 | } | ||
| 453 | else if($accountcodearr[1]=="c") | ||
| 454 | { | ||
| 455 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 456 | if($crmcall) | ||
| 457 | { | ||
| 458 | $nowts=microtime(true)*1000; | ||
| 459 | |||
| 460 | $crmcall->setTs('ts_Recend',$nowts); | ||
| 461 | |||
| 462 | $crmcall->state=$eventname; | ||
| 463 | $crmcall->statuscode=$cause; | ||
| 464 | $crmcall->substatus=$causetxt; | ||
| 465 | |||
| 466 | |||
| 467 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 468 | if($dialline) | ||
| 469 | { | ||
| 470 | $dialline->status="Free"; | ||
| 471 | $dialline->conf=""; | ||
| 472 | $dialline->number=""; | ||
| 473 | $dialline->uniqueid=""; | ||
| 474 | $dialline->channel=""; | ||
| 475 | $dialline->save(); | ||
| 476 | } | ||
| 477 | |||
| 478 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 479 | |||
| 480 | //$newqueue=new Kqueue(); | ||
| 481 | //$newqueue->playhangupfile($dialline->channel,$dialline->server); | ||
| 482 | |||
| 483 | $newqueue=new Kqueue(); | ||
| 484 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 485 | |||
| 486 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); | ||
| 487 | |||
| 488 | $crmcall->save(); | ||
| 489 | } | ||
| 490 | } | ||
| 491 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 492 | { | ||
| 493 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 494 | if($crmcall) | ||
| 495 | { | ||
| 496 | $nowts=microtime(true)*1000; | ||
| 497 | |||
| 498 | $crmcall->setTs('ts_Recend',$nowts); | ||
| 499 | |||
| 500 | $crmcall->state=$eventname; | ||
| 501 | $crmcall->statuscode=$cause; | ||
| 502 | $crmcall->substatus=$causetxt; | ||
| 503 | |||
| 504 | |||
| 505 | if($crmcall->type=="Auto"&&$crmcall->user_id==0) | ||
| 506 | { | ||
| 507 | $crmcall->userstatus="AutoDROP"; | ||
| 508 | $crmcall->usersubstatus="AutoDROP"; | ||
| 509 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 510 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 511 | if($crmcall->crm_id>0) | ||
| 512 | { | ||
| 513 | $wakka = new KHRMSLib(); | ||
| 514 | $record=$wakka->getPerson($crmcall->crm_id); | ||
| 515 | if($record) | ||
| 516 | { | ||
| 517 | $record["peopledata"]["status"]="Called"; | ||
| 518 | $record["peopledata"]["dialer_status"]="AutoDROP"; | ||
| 519 | $record["peopledata"]["dialer_substatus"]="AutoDROP"; | ||
| 520 | //$record["peopledata"]["dialer_lastcall"]=date("Y-m-d H:i:s"); | ||
| 521 | $wakka->setPerson($crmcall->crm_id,$record); | ||
| 522 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'4']); | ||
| 523 | } | ||
| 524 | } | ||
| 525 | } | ||
| 526 | if($crmcall->type=="Auto" && $crmcall->user_id>0) | ||
| 527 | { | ||
| 528 | $crmcall->userstatus="AutoCall"; | ||
| 529 | $crmcall->usersubstatus="AutoCall"; | ||
| 530 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 531 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 532 | if($crmcall->crm_id>0) | ||
| 533 | { | ||
| 534 | $wakka = new KHRMSLib(); | ||
| 535 | $record=$wakka->getPerson($crmcall->crm_id); | ||
| 536 | if($record) | ||
| 537 | { | ||
| 538 | $record["peopledata"]["status"]="Called"; | ||
| 539 | $record["peopledata"]["dialer_status"]="AutoCall"; | ||
| 540 | $record["peopledata"]["dialer_substatus"]="AutoCall"; | ||
| 541 | $wakka->setPerson($crmcall->crm_id,$record); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 547 | if($dialline && ($dialline->channel==$channel || $dialline->status== "AutoCall")) | ||
| 548 | { | ||
| 549 | $dialline->status="Free"; | ||
| 550 | $dialline->conf=""; | ||
| 551 | $dialline->number=""; | ||
| 552 | $dialline->uniqueid=""; | ||
| 553 | $dialline->channel=""; | ||
| 554 | $dialline->regexstr=""; | ||
| 555 | $dialline->save(); | ||
| 556 | |||
| 557 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 558 | |||
| 559 | if(!empty($tsip)) | ||
| 560 | { | ||
| 561 | $tsip->patched=0; | ||
| 562 | $tsip->save(); | ||
| 563 | } | ||
| 564 | |||
| 565 | $newqueue=new Kqueue(); | ||
| 566 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 567 | } | ||
| 568 | |||
| 569 | $crmcall->addEventLog($nowts,"$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt"); | ||
| 570 | |||
| 571 | $crmcall->save(); | ||
| 572 | |||
| 573 | } | ||
| 574 | } | ||
| 575 | } | ||
| 576 | } | ||
| 577 | else | ||
| 578 | { | ||
| 579 | echo "$context:$eventname $exten:$priority $cause:$causetxt $uniqueid\n"; | ||
| 580 | |||
| 581 | $crmcall=CRMCall::where("uniqueid","=",$uniqueid)->first(); | ||
| 582 | if($crmcall) | ||
| 583 | { | ||
| 584 | $nowts=microtime(true)*1000; | ||
| 585 | |||
| 586 | $crmcall->state=$eventname; | ||
| 587 | $crmcall->statuscode=$cause; | ||
| 588 | $crmcall->substatus=$causetxt; | ||
| 589 | |||
| 590 | if($crmcall->type=="Inbound"&&$crmcall->user_id==0)//InboundDROP | ||
| 591 | { | ||
| 592 | $userslist=User::where('exten','like' ,'%'.$crmcall->did.'%')->get(); | ||
| 593 | foreach ($userslist as $ulist) { | ||
| 594 | $crmcall->user_id=$ulist->id; | ||
| 595 | } | ||
| 596 | if($crmcall->client==".") | ||
| 597 | { | ||
| 598 | $wakka = new KHRMSLib(); | ||
| 599 | $users=$wakka->searchPhone("mobile",$crmcall->number); | ||
| 600 | |||
| 601 | if(!empty($users)) | ||
| 602 | { | ||
| 603 | $ppldata=unserialize($users[0]['peopledata']); | ||
| 604 | |||
| 605 | $crmcall->crm_id=$users[0]['id']; | ||
| 606 | $crmcall->number=$users[0]['mobile']; | ||
| 607 | $crmcall->client=($ppldata['client']?$ppldata['client']:""); | ||
| 608 | $crmcall->department=($ppldata['department']?$ppldata['department']:""); | ||
| 609 | |||
| 610 | $wakka->setPersonKey($crmcall->crm_id,"dialer_lastcall",date("Y-m-d H:i:s")); | ||
| 611 | echo $users[0]['id']." -- ID Found\n"; | ||
| 612 | } | ||
| 613 | else | ||
| 614 | { | ||
| 615 | $crmcall->crm_id=0; | ||
| 616 | $crmcall->client=""; | ||
| 617 | $crmcall->department=""; | ||
| 618 | echo "User Not Found!!\n"; | ||
| 619 | } | ||
| 620 | |||
| 621 | $crmcall->save(); | ||
| 622 | } | ||
| 623 | $crmcall->userstatus="InboundDROP"; | ||
| 624 | $crmcall->usersubstatus="InboundDROP"; | ||
| 625 | $crmcall->call_flag="Z"; | ||
| 626 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 627 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 628 | if($crmcall->crm_id>0) | ||
| 629 | { | ||
| 630 | $wakka = new KHRMSLib(); | ||
| 631 | $record=$wakka->getPerson($crmcall->crm_id); | ||
| 632 | if($record) | ||
| 633 | { | ||
| 634 | $record["peopledata"]["dialer_status"]="InboundDROP"; | ||
| 635 | $record["peopledata"]["dialer_substatus"]="InboundDROP"; | ||
| 636 | $wakka->setPerson($crmcall->crm_id,$record); | ||
| 637 | } | ||
| 638 | } | ||
| 639 | } | ||
| 640 | |||
| 641 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 642 | if($dialline) | ||
| 643 | { | ||
| 644 | $dialline->status="Free"; | ||
| 645 | $dialline->conf=""; | ||
| 646 | $dialline->number=""; | ||
| 647 | $dialline->uniqueid=""; | ||
| 648 | $dialline->channel=""; | ||
| 649 | $dialline->save(); | ||
| 650 | } | ||
| 651 | |||
| 652 | $crmcall->setTs('ts_Recend',$nowts); | ||
| 653 | $crmcall->save(); | ||
| 654 | |||
| 655 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 656 | if($tsip) | ||
| 657 | { | ||
| 658 | $newqueue=new Kqueue(); | ||
| 659 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 660 | } | ||
| 661 | } | ||
| 662 | } | ||
| 663 | } | ||
| 664 | private function DialBeginEvent(EventMessage $event) | ||
| 665 | { | ||
| 666 | $eventname = "DialBegin"; | ||
| 667 | |||
| 668 | $channel=$event->getKey("Channel"); | ||
| 669 | $channelstate=$event->getKey("ChannelState"); | ||
| 670 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 671 | $accountcode=$event->getKey("AccountCode"); | ||
| 672 | $exten=$event->getKey("Exten"); | ||
| 673 | $priority=$event->getKey("Priority"); | ||
| 674 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 675 | |||
| 676 | $dchannel=$event->getKey("DestChannel"); | ||
| 677 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 678 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 679 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 680 | $dexten=$event->getKey("DestExten"); | ||
| 681 | $dpriority=$event->getKey("DestPriority"); | ||
| 682 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 683 | |||
| 684 | $dialstring=$event->getKey("DialString"); | ||
| 685 | |||
| 686 | if($accountcode!="") | ||
| 687 | { | ||
| 688 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 689 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 690 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 691 | |||
| 692 | $accountcodearr=explode("|",$accountcode); | ||
| 693 | if($accountcodearr[0]=="m") | ||
| 694 | { | ||
| 695 | if($accountcodearr[1]=="u") | ||
| 696 | { | ||
| 697 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 698 | if($sipid) | ||
| 699 | { | ||
| 700 | $data=json_decode($sipid->clients,true); | ||
| 701 | $data['channel']=$dchannel; | ||
| 702 | $sipid->clients=json_encode($data); | ||
| 703 | $sipid->save(); | ||
| 704 | |||
| 705 | $newqueue=new Kqueue(); | ||
| 706 | $newqueue->sipNotify($sipid,"dialerUI","dialstart","u","~~".base64_encode($dchannel)); | ||
| 707 | } | ||
| 708 | } | ||
| 709 | if($accountcodearr[1]=="c") | ||
| 710 | { | ||
| 711 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 712 | if($crmcall) | ||
| 713 | { | ||
| 714 | $nowts=microtime(true)*1000; | ||
| 715 | |||
| 716 | $crmcall->setTs('ts_Call',$nowts); | ||
| 717 | |||
| 718 | $crmcall->state=$eventname; | ||
| 719 | |||
| 720 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 721 | if($dialline) | ||
| 722 | { | ||
| 723 | $dialline->channel=$dchannel; | ||
| 724 | $dialline->save(); | ||
| 725 | } | ||
| 726 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 727 | |||
| 728 | $newqueue=new Kqueue(); | ||
| 729 | $newqueue->sipNotify($tsip,"dialerUI","dialstart","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | ||
| 730 | |||
| 731 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring"); | ||
| 732 | |||
| 733 | $crmcall->save(); | ||
| 734 | } | ||
| 735 | } | ||
| 736 | } | ||
| 737 | |||
| 738 | } | ||
| 739 | } | ||
| 740 | |||
| 741 | private function DialEndEvent(EventMessage $event) | ||
| 742 | { | ||
| 743 | $eventname = "DialEnd"; | ||
| 744 | |||
| 745 | $channel=$event->getKey("Channel"); | ||
| 746 | $channelstate=$event->getKey("ChannelState"); | ||
| 747 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 748 | $accountcode=$event->getKey("AccountCode"); | ||
| 749 | $exten=$event->getKey("Exten"); | ||
| 750 | $priority=$event->getKey("Priority"); | ||
| 751 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 752 | |||
| 753 | $dchannel=$event->getKey("DestChannel"); | ||
| 754 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 755 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 756 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 757 | $dexten=$event->getKey("DestExten"); | ||
| 758 | $dpriority=$event->getKey("DestPriority"); | ||
| 759 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 760 | |||
| 761 | $dialstatus=$event->getKey("DialStatus"); | ||
| 762 | Log::info($accountcode); | ||
| 763 | if($accountcode!="") | ||
| 764 | { | ||
| 765 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 766 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 767 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 768 | |||
| 769 | $accountcodearr=explode("|",$accountcode); | ||
| 770 | if($accountcodearr[0]=="m") | ||
| 771 | { | ||
| 772 | if($accountcodearr[1]=="u") | ||
| 773 | { | ||
| 774 | if($dialstatus=="ANSWER") | ||
| 775 | { | ||
| 776 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 777 | if($sipid) | ||
| 778 | { | ||
| 779 | $sipid->confup=1; | ||
| 780 | $sipid->save(); | ||
| 781 | } | ||
| 782 | } | ||
| 783 | } | ||
| 784 | else if($accountcodearr[1]=="c") | ||
| 785 | { | ||
| 786 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 787 | if($crmcall) | ||
| 788 | { | ||
| 789 | $nowts=microtime(true)*1000; | ||
| 790 | |||
| 791 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 792 | |||
| 793 | $crmcall->state=$eventname; | ||
| 794 | $crmcall->status=$dialstatus; | ||
| 795 | |||
| 796 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 797 | if($dialline) | ||
| 798 | { | ||
| 799 | $dialline->channel=$channel; | ||
| 800 | $dialline->save(); | ||
| 801 | } | ||
| 802 | |||
| 803 | $recfile=$crmcall->newRecFilePath(); | ||
| 804 | |||
| 805 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 806 | |||
| 807 | //start recording | ||
| 808 | $newqueue=new Kqueue(); | ||
| 809 | $newqueue->recordChannel($tsip->server,$dchannel,$recfile); | ||
| 810 | |||
| 811 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 812 | |||
| 813 | //notify UI (only the sip id) | ||
| 814 | $newqueue=new Kqueue(); | ||
| 815 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 816 | |||
| 817 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 818 | |||
| 819 | $crmcall->save(); | ||
| 820 | } | ||
| 821 | } | ||
| 822 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 823 | { | ||
| 824 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 825 | if($crmcall) | ||
| 826 | { | ||
| 827 | $nowts=microtime(true)*1000; | ||
| 828 | |||
| 829 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 830 | |||
| 831 | $crmcall->state=$eventname; | ||
| 832 | $crmcall->status=$dialstatus; | ||
| 833 | $crmcall->uniqueid=$uniqueid; | ||
| 834 | |||
| 835 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 836 | if($dialline && $dialstatus=="ANSWER") | ||
| 837 | { | ||
| 838 | $dialline->channel=$dchannel; | ||
| 839 | $dialline->uniqueid=$uniqueid; | ||
| 840 | $dialline->status="Auto"; | ||
| 841 | $dialline->save(); | ||
| 842 | } | ||
| 843 | |||
| 844 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 845 | |||
| 846 | $crmcall->type="Auto"; | ||
| 847 | $crmcall->save(); | ||
| 848 | } | ||
| 849 | |||
| 850 | } | ||
| 851 | } | ||
| 852 | } | ||
| 853 | } | ||
| 854 | private function UnknownEvent(EventMessage $event) | ||
| 855 | { | ||
| 856 | $eventname=$event->getKey("Event"); | ||
| 857 | if($eventname=="NewConnectedLine") | ||
| 858 | { | ||
| 859 | $channel=$event->getKey("Channel"); | ||
| 860 | $channelstate=$event->getKey("ChannelState"); | ||
| 861 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 862 | $accountcode=$event->getKey("AccountCode"); | ||
| 863 | $exten=$event->getKey("Exten"); | ||
| 864 | $priority=$event->getKey("Priority"); | ||
| 865 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 866 | |||
| 867 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 868 | } | ||
| 869 | if($eventname=="LocalBridge") | ||
| 870 | { | ||
| 871 | $l1channel=$event->getKey("LocalOneChannel"); | ||
| 872 | $l1channelstate=$event->getKey("LocalOneChannelState"); | ||
| 873 | $l1channelstatedesc=$event->getKey("LocalOneChannelStateDesc"); | ||
| 874 | $l1accountcode=$event->getKey("LocalOneAccountCode"); | ||
| 875 | $l1exten=$event->getKey("LocalOneExten"); | ||
| 876 | $l1priority=$event->getKey("LocalOnePriority"); | ||
| 877 | $l1uniqueid=$event->getKey("LocalOneUniqueid"); | ||
| 878 | |||
| 879 | $l2channel=$event->getKey("LocalTwoChannel"); | ||
| 880 | $l2channelstate=$event->getKey("LocalTwoChannelState"); | ||
| 881 | $l2channelstatedesc=$event->getKey("LocalTwoChannelStateDesc"); | ||
| 882 | $l2accountcode=$event->getKey("LocalTwoAccountCode"); | ||
| 883 | $l2exten=$event->getKey("LocalTwoExten"); | ||
| 884 | $l2priority=$event->getKey("LocalTwoPriority"); | ||
| 885 | $l2uniqueid=$event->getKey("LocalTwoUniqueid"); | ||
| 886 | |||
| 887 | //echo "$l1accountcode:Unknown : $eventname $l1channelstate:$l1channelstatedesc $l1uniqueid $l1exten:$l1priority $l1channel\n"; | ||
| 888 | //echo "$l2accountcode:Unknown : $eventname $l2channelstate:$l2channelstatedesc $l2uniqueid $l2exten:$l2priority $l2channel\n"; | ||
| 889 | } | ||
| 890 | if($eventname=="DialBegin") | ||
| 891 | { | ||
| 892 | $channel=$event->getKey("Channel"); | ||
| 893 | $channelstate=$event->getKey("ChannelState"); | ||
| 894 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 895 | $accountcode=$event->getKey("AccountCode"); | ||
| 896 | $exten=$event->getKey("Exten"); | ||
| 897 | $priority=$event->getKey("Priority"); | ||
| 898 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 899 | |||
| 900 | $dchannel=$event->getKey("DestChannel"); | ||
| 901 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 902 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 903 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 904 | $dexten=$event->getKey("DestExten"); | ||
| 905 | $dpriority=$event->getKey("DestPriority"); | ||
| 906 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 907 | |||
| 908 | $dialstring=$event->getKey("DialString"); | ||
| 909 | |||
| 910 | if($accountcode!="") | ||
| 911 | { | ||
| 912 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 913 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 914 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstring\n"; | ||
| 915 | |||
| 916 | $accountcodearr=explode("|",$accountcode); | ||
| 917 | if($accountcodearr[0]=="m") | ||
| 918 | { | ||
| 919 | if($accountcodearr[1]=="u") | ||
| 920 | { | ||
| 921 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 922 | if($sipid) | ||
| 923 | { | ||
| 924 | $data=json_decode($sipid->clients,true); | ||
| 925 | $data['channel']=$dchannel; | ||
| 926 | $sipid->clients=json_encode($data); | ||
| 927 | $sipid->save(); | ||
| 928 | |||
| 929 | $newqueue=new Kqueue(); | ||
| 930 | $newqueue->sipNotify($sipid,"dialerUI","dialstart","u","~~".base64_encode($dchannel)); | ||
| 931 | } | ||
| 932 | } | ||
| 933 | if($accountcodearr[1]=="c") | ||
| 934 | { | ||
| 935 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 936 | if($crmcall) | ||
| 937 | { | ||
| 938 | $nowts=microtime(true)*1000; | ||
| 939 | |||
| 940 | $crmcall->setTs('ts_Call',$nowts); | ||
| 941 | |||
| 942 | $crmcall->state=$eventname; | ||
| 943 | |||
| 944 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 945 | if($dialline) | ||
| 946 | { | ||
| 947 | $dialline->channel=$dchannel; | ||
| 948 | $dialline->save(); | ||
| 949 | } | ||
| 950 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 951 | |||
| 952 | $newqueue=new Kqueue(); | ||
| 953 | $newqueue->sipNotify($tsip,"dialerUI","dialstart","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | ||
| 954 | |||
| 955 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstring"); | ||
| 956 | |||
| 957 | $crmcall->save(); | ||
| 958 | } | ||
| 959 | } | ||
| 960 | } | ||
| 961 | |||
| 962 | } | ||
| 963 | } | ||
| 964 | if($eventname=="DeviceStateChange") | ||
| 965 | { | ||
| 966 | $device=$event->getKey("Device"); | ||
| 967 | $state=$event->getKey("State"); | ||
| 968 | |||
| 969 | //echo ":Unknown : $eventname $device:$state\n"; | ||
| 970 | } | ||
| 971 | if($eventname=="DialEnd") | ||
| 972 | { | ||
| 973 | $channel=$event->getKey("Channel"); | ||
| 974 | $channelstate=$event->getKey("ChannelState"); | ||
| 975 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 976 | $accountcode=$event->getKey("AccountCode"); | ||
| 977 | $exten=$event->getKey("Exten"); | ||
| 978 | $priority=$event->getKey("Priority"); | ||
| 979 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 980 | |||
| 981 | $dchannel=$event->getKey("DestChannel"); | ||
| 982 | $dchannelstate=$event->getKey("DestChannelState"); | ||
| 983 | $dchannelstatedesc=$event->getKey("DestChannelStateDesc"); | ||
| 984 | $daccountcode=$event->getKey("DestAccountCode"); | ||
| 985 | $dexten=$event->getKey("DestExten"); | ||
| 986 | $dpriority=$event->getKey("DestPriority"); | ||
| 987 | $duniqueid=$event->getKey("DestUniqueid"); | ||
| 988 | |||
| 989 | $dialstatus=$event->getKey("DialStatus"); | ||
| 990 | Log::info('DialEnd===>'.$channel); | ||
| 991 | if($accountcode!="") | ||
| 992 | { | ||
| 993 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n"; | ||
| 994 | //echo "$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 995 | echo "$accountcode:$eventname $dexten:$dpriority $dchannel $dialstatus\n"; | ||
| 996 | |||
| 997 | $accountcodearr=explode("|",$accountcode); | ||
| 998 | if($accountcodearr[0]=="m") | ||
| 999 | { | ||
| 1000 | if($accountcodearr[1]=="u") | ||
| 1001 | { | ||
| 1002 | if($dialstatus=="ANSWER") | ||
| 1003 | { | ||
| 1004 | $sipid=Sipid::find($accountcodearr[2]); | ||
| 1005 | if($sipid) | ||
| 1006 | { | ||
| 1007 | $sipid->confup=1; | ||
| 1008 | $sipid->save(); | ||
| 1009 | } | ||
| 1010 | } | ||
| 1011 | } | ||
| 1012 | else if($accountcodearr[1]=="c") | ||
| 1013 | { | ||
| 1014 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 1015 | if($crmcall) | ||
| 1016 | { | ||
| 1017 | $nowts=microtime(true)*1000; | ||
| 1018 | |||
| 1019 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1020 | |||
| 1021 | $crmcall->state=$eventname; | ||
| 1022 | $crmcall->status=$dialstatus; | ||
| 1023 | |||
| 1024 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 1025 | if($dialline) | ||
| 1026 | { | ||
| 1027 | $dialline->channel=$channel; | ||
| 1028 | $dialline->save(); | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | $recfile=$crmcall->newRecFilePath(); | ||
| 1032 | |||
| 1033 | $tsip=Sipid::find($crmcall->sipid_id); | ||
| 1034 | |||
| 1035 | //start recording | ||
| 1036 | $newqueue=new Kqueue(); | ||
| 1037 | $newqueue->recordChannel($tsip->server,$dchannel,$recfile); | ||
| 1038 | |||
| 1039 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 1040 | |||
| 1041 | //notify UI (only the sip id) | ||
| 1042 | $newqueue=new Kqueue(); | ||
| 1043 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | ||
| 1044 | |||
| 1045 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 1046 | |||
| 1047 | $crmcall->save(); | ||
| 1048 | } | ||
| 1049 | } | ||
| 1050 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | ||
| 1051 | { | ||
| 1052 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 1053 | if($crmcall) | ||
| 1054 | { | ||
| 1055 | $nowts=microtime(true)*1000; | ||
| 1056 | |||
| 1057 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1058 | |||
| 1059 | $crmcall->state=$eventname; | ||
| 1060 | $crmcall->status=$dialstatus; | ||
| 1061 | $crmcall->uniqueid=$uniqueid; | ||
| 1062 | |||
| 1063 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 1064 | if($dialline && $dialstatus=="ANSWER") | ||
| 1065 | { | ||
| 1066 | $dialline->channel=$dchannel; | ||
| 1067 | $dialline->uniqueid=$uniqueid; | ||
| 1068 | $dialline->status="Auto"; | ||
| 1069 | $dialline->save(); | ||
| 1070 | } | ||
| 1071 | |||
| 1072 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 1073 | |||
| 1074 | $crmcall->type="Auto"; | ||
| 1075 | $crmcall->save(); | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | } | ||
| 1079 | } | ||
| 1080 | } | ||
| 1081 | } | ||
| 1082 | if($eventname=="SoftHangupRequest") | ||
| 1083 | { | ||
| 1084 | $channel=$event->getKey("Channel"); | ||
| 1085 | $channelstate=$event->getKey("ChannelState"); | ||
| 1086 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1087 | $accountcode=$event->getKey("AccountCode"); | ||
| 1088 | $exten=$event->getKey("Exten"); | ||
| 1089 | $priority=$event->getKey("Priority"); | ||
| 1090 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1091 | |||
| 1092 | $cause=$event->getKey("Cause"); | ||
| 1093 | |||
| 1094 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause\n"; | ||
| 1095 | } | ||
| 1096 | if($eventname=="HangupRequest") | ||
| 1097 | { | ||
| 1098 | $channel=$event->getKey("Channel"); | ||
| 1099 | $channelstate=$event->getKey("ChannelState"); | ||
| 1100 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1101 | $accountcode=$event->getKey("AccountCode"); | ||
| 1102 | $exten=$event->getKey("Exten"); | ||
| 1103 | $priority=$event->getKey("Priority"); | ||
| 1104 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1105 | |||
| 1106 | $cause=$event->getKey("Cause"); | ||
| 1107 | |||
| 1108 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause\n"; | ||
| 1109 | } | ||
| 1110 | if($eventname=="BridgeCreate") | ||
| 1111 | { | ||
| 1112 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1113 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1114 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1115 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1116 | $bridgename=$event->getKey("BridgeName"); | ||
| 1117 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1118 | |||
| 1119 | //echo ":Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt\n"; | ||
| 1120 | } | ||
| 1121 | if($eventname=="ConfbridgeStart") | ||
| 1122 | { | ||
| 1123 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1124 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1125 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1126 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1127 | $bridgename=$event->getKey("BridgeName"); | ||
| 1128 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1129 | |||
| 1130 | $conf=$event->getKey("Conference"); | ||
| 1131 | |||
| 1132 | //echo ":Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1133 | } | ||
| 1134 | if($eventname=="ConfbridgeEnd") | ||
| 1135 | { | ||
| 1136 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1137 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1138 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1139 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1140 | $bridgename=$event->getKey("BridgeName"); | ||
| 1141 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1142 | |||
| 1143 | $conf=$event->getKey("Conference"); | ||
| 1144 | |||
| 1145 | //echo ":Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1146 | } | ||
| 1147 | if($eventname=="BridgeDestroy") | ||
| 1148 | { | ||
| 1149 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1150 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1151 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1152 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1153 | $bridgename=$event->getKey("BridgeName"); | ||
| 1154 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1155 | |||
| 1156 | //echo ":Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt\n"; | ||
| 1157 | } | ||
| 1158 | if($eventname=="ConfbridgeJoin") | ||
| 1159 | { | ||
| 1160 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1161 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1162 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1163 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1164 | $bridgename=$event->getKey("BridgeName"); | ||
| 1165 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1166 | |||
| 1167 | $conf=$event->getKey("Conference"); | ||
| 1168 | |||
| 1169 | $channel=$event->getKey("Channel"); | ||
| 1170 | $channelstate=$event->getKey("ChannelState"); | ||
| 1171 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1172 | $accountcode=$event->getKey("AccountCode"); | ||
| 1173 | $exten=$event->getKey("Exten"); | ||
| 1174 | $priority=$event->getKey("Priority"); | ||
| 1175 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1176 | |||
| 1177 | $admin=$event->getKey("Admin"); | ||
| 1178 | |||
| 1179 | //echo "$accountcode:Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1180 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $admin\n\n"; | ||
| 1181 | } | ||
| 1182 | if($eventname=="BridgeEnter") | ||
| 1183 | { | ||
| 1184 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1185 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1186 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1187 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1188 | $bridgename=$event->getKey("BridgeName"); | ||
| 1189 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1190 | |||
| 1191 | $conf=$event->getKey("Conference"); | ||
| 1192 | |||
| 1193 | $channel=$event->getKey("Channel"); | ||
| 1194 | $channelstate=$event->getKey("ChannelState"); | ||
| 1195 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1196 | $accountcode=$event->getKey("AccountCode"); | ||
| 1197 | $exten=$event->getKey("Exten"); | ||
| 1198 | $priority=$event->getKey("Priority"); | ||
| 1199 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1200 | |||
| 1201 | $admin=$event->getKey("Admin"); | ||
| 1202 | |||
| 1203 | //echo "$accountcode:Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1204 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $admin\n\n"; | ||
| 1205 | } | ||
| 1206 | if($eventname=="BridgeLeave") | ||
| 1207 | { | ||
| 1208 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1209 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1210 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1211 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1212 | $bridgename=$event->getKey("BridgeName"); | ||
| 1213 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1214 | |||
| 1215 | $conf=$event->getKey("Conference"); | ||
| 1216 | |||
| 1217 | $channel=$event->getKey("Channel"); | ||
| 1218 | $channelstate=$event->getKey("ChannelState"); | ||
| 1219 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1220 | $accountcode=$event->getKey("AccountCode"); | ||
| 1221 | $exten=$event->getKey("Exten"); | ||
| 1222 | $priority=$event->getKey("Priority"); | ||
| 1223 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1224 | |||
| 1225 | //echo "$accountcode:Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1226 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel\n\n"; | ||
| 1227 | } | ||
| 1228 | if($eventname=="ConfbridgeLeave") | ||
| 1229 | { | ||
| 1230 | $bridgeuid=$event->getKey("BridgeUniqueid"); | ||
| 1231 | $bridgetype=$event->getKey("BridgeType"); | ||
| 1232 | $bridgetech=$event->getKey("BridgeTechnology"); | ||
| 1233 | $bridgecreator=$event->getKey("BridgeCreator"); | ||
| 1234 | $bridgename=$event->getKey("BridgeName"); | ||
| 1235 | $bridgechannelcnt=$event->getKey("BridgeNumChannels"); | ||
| 1236 | |||
| 1237 | $conf=$event->getKey("Conference"); | ||
| 1238 | |||
| 1239 | $channel=$event->getKey("Channel"); | ||
| 1240 | $channelstate=$event->getKey("ChannelState"); | ||
| 1241 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1242 | $accountcode=$event->getKey("AccountCode"); | ||
| 1243 | $exten=$event->getKey("Exten"); | ||
| 1244 | $priority=$event->getKey("Priority"); | ||
| 1245 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1246 | |||
| 1247 | $admin=$event->getKey("Admin"); | ||
| 1248 | |||
| 1249 | //echo "$accountcode:Unknown : $eventname $bridgeuid $bridgetype $bridgetech $bridgecreator:$bridgename $bridgechannelcnt $conf\n"; | ||
| 1250 | //echo "$accountcode:Unknown : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $admin\n\n"; | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | if($eventname=="DAHDIChannel") | ||
| 1254 | { | ||
| 1255 | $channel=$event->getKey("Channel"); | ||
| 1256 | $channelstate=$event->getKey("ChannelState"); | ||
| 1257 | $channelstatedesc=$event->getKey("ChannelStateDesc"); | ||
| 1258 | |||
| 1259 | $phonenumber=$event->getKey("CallerIDNum"); | ||
| 1260 | $callerid=$event->getKey("CallerIDName"); | ||
| 1261 | |||
| 1262 | $accountcode=$event->getKey("AccountCode"); | ||
| 1263 | $context=$event->getKey("Context"); | ||
| 1264 | $exten=$event->getKey("Exten"); | ||
| 1265 | $priority=$event->getKey("Priority"); | ||
| 1266 | $uniqueid=$event->getKey("Uniqueid"); | ||
| 1267 | |||
| 1268 | $dahdispan=$event->getKey("DAHDISpan"); | ||
| 1269 | $dahdichannel=$event->getKey("DAHDIChannel"); | ||
| 1270 | |||
| 1271 | if($context=="kstychDialerINB"&&$exten!="s") | ||
| 1272 | { | ||
| 1273 | echo "$context:$eventname $phonenumber $exten:$priority $dahdispan:$dahdichannel $uniqueid\n"; | ||
| 1274 | $dialline=Dialline::where('server','=',$this->sipip)->where("dspan","=",$dahdispan)->where("dchannel","=",$dahdichannel)->first(); | ||
| 1275 | if($dialline) | ||
| 1276 | { | ||
| 1277 | $dialline->status='Inbound'; | ||
| 1278 | $dialline->uniqueid=$uniqueid; | ||
| 1279 | $dialline->number=$phonenumber; | ||
| 1280 | $dialline->channel=$channel; | ||
| 1281 | $dialline->save(); | ||
| 1282 | |||
| 1283 | $nowts=microtime(true)*1000; | ||
| 1284 | |||
| 1285 | //start the call log | ||
| 1286 | $crmcall=new CRMCall(); | ||
| 1287 | $crmcall->number=$phonenumber; | ||
| 1288 | $crmcall->user_id=0;////// | ||
| 1289 | $crmcall->sipid_id=0;////// | ||
| 1290 | |||
| 1291 | $crmcall->did=$exten; | ||
| 1292 | |||
| 1293 | $crmcall->crm_id=0; | ||
| 1294 | $crmcall->client="."; | ||
| 1295 | $crmcall->department=""; | ||
| 1296 | |||
| 1297 | $crmcall->state='Inbound'; | ||
| 1298 | $crmcall->type="Inbound"; | ||
| 1299 | $crmcall->status="ANSWER"; | ||
| 1300 | $crmcall->uniqueid=$uniqueid; | ||
| 1301 | $crmcall->dialline_id=$dialline->id; | ||
| 1302 | |||
| 1303 | $crmcall->setTs('ts_Wait',$nowts); | ||
| 1304 | |||
| 1305 | $crmcall->group=$dialline->group; | ||
| 1306 | |||
| 1307 | $tdata=array(); | ||
| 1308 | $tdata['uniqueid']=$uniqueid; | ||
| 1309 | $tdata['inboundchannel']=$channel; | ||
| 1310 | |||
| 1311 | $crmcall->data=json_encode($tdata); | ||
| 1312 | $crmcall->save(); | ||
| 1313 | |||
| 1314 | $userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get(); | ||
| 1315 | |||
| 1316 | if($userStatus=="[]") | ||
| 1317 | { | ||
| 1318 | |||
| 1319 | $newqueue=new Kqueue(); | ||
| 1320 | $newqueue->playbusyfile($dialline->channel,$dialline->server); | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | $callStat=CRMCall::where("did","like","%".substr($exten,-4)."%")->where("updated_at",">",date("Y-m-d"))->whereIn('state',['DialBegin', 'DialEnd'])->get(); | ||
| 1324 | |||
| 1325 | if($callStat!="[]") | ||
| 1326 | { | ||
| 1327 | |||
| 1328 | $newqueue=new Kqueue(); | ||
| 1329 | $newqueue->playbusyfile($dialline->channel,$dialline->server); | ||
| 1330 | } | ||
| 1331 | } | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | } | ||
| 1335 | |||
| 1336 | } | ||
| 1337 | |||
| 1338 | |||
| 1339 | private function redirectIncoming() | ||
| 1340 | { | ||
| 1341 | |||
| 1342 | //$diallines=Dialline::where('server','=',$this->sipip)->where("status","=","Inbound")->where("conf","=","")->get(); | ||
| 1343 | $diallines=Dialline::where('server','=',$this->sipip)->whereIn("status",["Inbound","Auto"])->where("conf","=","")->get(); | ||
| 1344 | if($diallines) | ||
| 1345 | { | ||
| 1346 | foreach($diallines as $dialline) | ||
| 1347 | { | ||
| 1348 | echo $dialline->number." waiting\n"; | ||
| 1349 | $crmcall=CRMCall::where("uniqueid","like","%".$dialline->uniqueid."%")->first(); | ||
| 1350 | |||
| 1351 | if($crmcall) | ||
| 1352 | { | ||
| 1353 | echo "Callid : ".$crmcall->id." : $crmcall->did\n"; | ||
| 1354 | |||
| 1355 | $nowts=microtime(true)*1000; | ||
| 1356 | $crmcalldata=json_decode($crmcall->data,true); | ||
| 1357 | if(!isset($crmcalldata["userbusyfile"]))$crmcalldata["userbusyfile"]=0; | ||
| 1358 | $playnoroute=env('playnoroute',public_path("assets/sounds/astring")); | ||
| 1359 | $playnoroutelen=env('playnoroutelen',4); | ||
| 1360 | $playnouser=env('playnouser',public_path("assets/sounds/astring")); | ||
| 1361 | $playnouserlen=env('playnouserlen',4); | ||
| 1362 | $playuserbusy=env('playuserbusy',public_path("assets/sounds/astring")); | ||
| 1363 | $playuserbusylen=env('playuserbusylen',4); | ||
| 1364 | |||
| 1365 | if($crmcall->client==".") | ||
| 1366 | { | ||
| 1367 | $wakka = new KHRMSLib(); | ||
| 1368 | $users=$wakka->searchPhone("mobile",$crmcall->number); | ||
| 1369 | if(!empty($users)) | ||
| 1370 | { | ||
| 1371 | $ppldata=unserialize($users[0]['peopledata']); | ||
| 1372 | |||
| 1373 | $crmcall->crm_id=$users[0]['id']; | ||
| 1374 | $crmcall->number=$users[0]['mobile']; | ||
| 1375 | $crmcall->client=($ppldata['client']?$ppldata['client']:""); | ||
| 1376 | $crmcall->department=($ppldata['department']?$ppldata['department']:""); | ||
| 1377 | $crmcall->call_flag="C"; | ||
| 1378 | $wakka->setPersonKey($crmcall->crm_id,"dialer_lastcall",date("Y-m-d H:i:s")); | ||
| 1379 | echo $users[0]['id']." -- ID Found\n"; | ||
| 1380 | } | ||
| 1381 | else | ||
| 1382 | { | ||
| 1383 | $crmcall->crm_id=0; | ||
| 1384 | $crmcall->client=""; | ||
| 1385 | $crmcall->department=""; | ||
| 1386 | $crmcall->call_flag="C"; | ||
| 1387 | echo "User Not Found!!\n"; | ||
| 1388 | } | ||
| 1389 | $crmcall->save(); | ||
| 1390 | } | ||
| 1391 | |||
| 1392 | $sipids=array(); | ||
| 1393 | if($crmcall->client!="") | ||
| 1394 | { | ||
| 1395 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->client."%")->where("clients","like","%".$crmcall->did."%")->get(); | ||
| 1396 | } | ||
| 1397 | else if($crmcall->did!="") | ||
| 1398 | { | ||
| 1399 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->where("clients","like","%".$crmcall->did."%")->get(); | ||
| 1400 | } | ||
| 1401 | else | ||
| 1402 | { | ||
| 1403 | $sipids=Sipid::where('server','=',$this->sipip)->where("status","=","1")->get();//send to all? | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | if(!empty($sipids)) | ||
| 1407 | { | ||
| 1408 | echo "sipids found "; | ||
| 1409 | |||
| 1410 | //create map? | ||
| 1411 | $first_r=0;$first_w=0;$first_a=0;$allsipids=array(); | ||
| 1412 | foreach($sipids as $sipid) | ||
| 1413 | { | ||
| 1414 | //if($sipid->ready==1) | ||
| 1415 | if($sipid->ready==1&&$sipid->prepare_call==0&&$dialline->status=="Inbound") | ||
| 1416 | { | ||
| 1417 | $clientsarr=json_decode($sipid->clients,true); | ||
| 1418 | if($crmcall->client=="")$first_a=$sipid; | ||
| 1419 | else | ||
| 1420 | { | ||
| 1421 | if($clientsarr['a']!="")$clientaarr = explode(",", $clientsarr['a']); | ||
| 1422 | if(isset($clientsarr['a'])&&in_array($crmcall->client, $clientaarr))$first_a=$sipid; | ||
| 1423 | if($clientsarr['w']!="")$clientwarr = explode(",", $clientsarr['w']); | ||
| 1424 | if(isset($clientsarr['w'])&&in_array($crmcall->client, $clientwarr))$first_w=$sipid; | ||
| 1425 | if($clientsarr['r']!="")$clientrarr = explode(",", $clientsarr['r']); | ||
| 1426 | if(isset($clientsarr['r'])&&in_array($crmcall->client, $clientrarr))$first_r=$sipid; | ||
| 1427 | } | ||
| 1428 | } | ||
| 1429 | else | ||
| 1430 | { | ||
| 1431 | $allsipids[]=$sipid; | ||
| 1432 | } | ||
| 1433 | } | ||
| 1434 | |||
| 1435 | foreach($sipids as $sipid) | ||
| 1436 | { | ||
| 1437 | if($sipid->ready==1&&$sipid->prepare_call==1&&$dialline->status=="Auto") | ||
| 1438 | { | ||
| 1439 | $clientsarr=json_decode($sipid->clients,true); | ||
| 1440 | if($crmcall->client=="")$first_a=$sipid; | ||
| 1441 | else | ||
| 1442 | { | ||
| 1443 | if($clientsarr['a']!="")$clientaarr = explode(",", $clientsarr['a']); | ||
| 1444 | if(isset($clientsarr['a'])&&in_array($crmcall->client, $clientaarr))$first_a=$sipid; | ||
| 1445 | if($clientsarr['w']!="")$clientwarr = explode(",", $clientsarr['w']); | ||
| 1446 | if(isset($clientsarr['w'])&&in_array($crmcall->client, $clientwarr))$first_w=$sipid; | ||
| 1447 | if($clientsarr['r']!="")$clientrarr = explode(",", $clientsarr['r']); | ||
| 1448 | if(isset($clientsarr['r'])&&in_array($crmcall->client, $clientrarr))$first_r=$sipid; | ||
| 1449 | } | ||
| 1450 | } | ||
| 1451 | else | ||
| 1452 | { | ||
| 1453 | $allsipids[]=$sipid; | ||
| 1454 | } | ||
| 1455 | } | ||
| 1456 | |||
| 1457 | echo "Notifying Total ::".sizeof($allsipids)."\n"; | ||
| 1458 | |||
| 1459 | $found=false; | ||
| 1460 | if($first_a)$found=$first_a; | ||
| 1461 | else if($first_w)$found=$first_w; | ||
| 1462 | else if($first_r)$found=$first_r; | ||
| 1463 | |||
| 1464 | if($found) | ||
| 1465 | { | ||
| 1466 | $alreadyconf=Dialline::where('server','=',$this->sipip)->where("status","=","Inbound")->where("conf","=","1000".$found->id)->get(); | ||
| 1467 | if(sizeof($alreadyconf)>0) | ||
| 1468 | { | ||
| 1469 | echo $found->id." : Found but Already in Conf!!!\n"; | ||
| 1470 | $found=false; | ||
| 1471 | } | ||
| 1472 | } | ||
| 1473 | |||
| 1474 | if($found) | ||
| 1475 | { | ||
| 1476 | echo "sipids : $found->id \n"; | ||
| 1477 | |||
| 1478 | //get ts_Wait | ||
| 1479 | $userlog=UserLog::where('user_id','=',$found->user)->orderBy("id","DESC")->first(); | ||
| 1480 | $ts_Wait=$userlog->getLastTs($found->id,$nowts); | ||
| 1481 | $userlog->save(); | ||
| 1482 | |||
| 1483 | $crmcall->user_id=$found->user; | ||
| 1484 | $crmcall->sipid_id=$found->id; | ||
| 1485 | |||
| 1486 | if($ts_Wait<=$crmcall->ts_Wait) //user waiting | ||
| 1487 | { | ||
| 1488 | $crmcall->ts_Wait=$ts_Wait; | ||
| 1489 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1490 | } | ||
| 1491 | else //call waiting | ||
| 1492 | { | ||
| 1493 | $crmcall->ts_Wait-=($nowts-$ts_Wait); | ||
| 1494 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | $crmcall->save(); | ||
| 1498 | |||
| 1499 | $dialline->conf="1000".$found->id; | ||
| 1500 | $dialline->save(); | ||
| 1501 | if($crmcall->crm_id>0){ | ||
| 1502 | DB::table('records')->where('id',$crmcall->crm_id)->update(['filter_condition'=>'3','usr_id'=>$found->user]); | ||
| 1503 | |||
| 1504 | } | ||
| 1505 | $found->ready=0; | ||
| 1506 | $found->prepare_call=0; | ||
| 1507 | $found->patched=1; | ||
| 1508 | $found->save(); | ||
| 1509 | |||
| 1510 | $recfile=$crmcall->newRecFilePath(); | ||
| 1511 | |||
| 1512 | $crmcall->setTs('ts_Recstart',$nowts); | ||
| 1513 | $crmcall->save(); | ||
| 1514 | |||
| 1515 | //start recording | ||
| 1516 | $newqueue=new Kqueue(); | ||
| 1517 | $newqueue->recordChannel($dialline->server,$dialline->channel,$recfile); | ||
| 1518 | |||
| 1519 | $newqueue=new Kqueue(); | ||
| 1520 | $newqueue->userToConf($found); | ||
| 1521 | |||
| 1522 | $newqueue=new Kqueue(); | ||
| 1523 | $newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1"); | ||
| 1524 | |||
| 1525 | //notify UI (only the sip id) | ||
| 1526 | $newqueue=new Kqueue(); | ||
| 1527 | $newqueue->sipNotify($found,"dialerUI","dialstart","c",$crmcall->number); | ||
| 1528 | |||
| 1529 | $newqueue=new Kqueue(); | ||
| 1530 | $newqueue->sipNotify($found,"incomingCall",$crmcall->id,$crmcall->crm_id,$crmcall->number."@".$dialline->channel); | ||
| 1531 | } | ||
| 1532 | else | ||
| 1533 | { | ||
| 1534 | if(!empty($allsipids)) | ||
| 1535 | { | ||
| 1536 | foreach($allsipids as $tsip) | ||
| 1537 | { | ||
| 1538 | //$newqueue=new Kqueue(); | ||
| 1539 | //$newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | ||
| 1540 | if($dialline->status!="Auto") | ||
| 1541 | { | ||
| 1542 | $newqueue=new Kqueue(); | ||
| 1543 | $newqueue->sipNotify($tsip,"popupalert"," Incoming Calls",$crmcall->number."|".$crmcall->client,""); | ||
| 1544 | } | ||
| 1545 | } | ||
| 1546 | } | ||
| 1547 | else | ||
| 1548 | { | ||
| 1549 | //play no users available | ||
| 1550 | if($crmcalldata["userbusyfile"]<$nowts) | ||
| 1551 | { | ||
| 1552 | $crmcalldata["userbusyfile"]=$nowts+(($playnouserlen+2)*1000); | ||
| 1553 | $crmcall->data=json_encode($crmcalldata); | ||
| 1554 | $crmcall->save(); | ||
| 1555 | } | ||
| 1556 | |||
| 1557 | } | ||
| 1558 | //no ready user, send notifications | ||
| 1559 | } | ||
| 1560 | } | ||
| 1561 | else | ||
| 1562 | { | ||
| 1563 | //no users online | ||
| 1564 | //play no routes file | ||
| 1565 | if($crmcalldata["userbusyfile"]<$nowts) | ||
| 1566 | { | ||
| 1567 | $crmcalldata["userbusyfile"]=$nowts+(($playnoroutelen+2)*1000); | ||
| 1568 | $crmcall->data=json_encode($crmcalldata); | ||
| 1569 | $crmcall->save(); | ||
| 1570 | |||
| 1571 | //$newqueue=new Kqueue(); | ||
| 1572 | //$newqueue->playfile($playnoroute,$dialline->channel,"kstychDialerINB",$dialline->server); | ||
| 1573 | } | ||
| 1574 | } | ||
| 1575 | |||
| 1576 | } | ||
| 1577 | else | ||
| 1578 | { | ||
| 1579 | //$dialline->status='Free'; | ||
| 1580 | //$dialline->save(); | ||
| 1581 | } | ||
| 1582 | //if client was matched then find users by client | ||
| 1583 | //else find users by DID | ||
| 1584 | //ele everyone | ||
| 1585 | } | ||
| 1586 | |||
| 1587 | } | ||
| 1588 | |||
| 1589 | } | ||
| 1590 | |||
| 1591 | private function sendAMICommands() | ||
| 1592 | { | ||
| 1593 | $queues=Kqueue::where("type","=","SIP_".$this->sipip)->where("status","=","New")->take(5)->get(); | ||
| 1594 | if(!$queues->isEmpty())foreach($queues as $i=>$tqueue) | ||
| 1595 | { | ||
| 1596 | $data=json_decode($tqueue->data,true); | ||
| 1597 | |||
| 1598 | if($tqueue->key=="notify") | ||
| 1599 | { | ||
| 1600 | $notify = new SIPNotifyAction($data[0]); | ||
| 1601 | $notify->setVariable('kstych-Data', "$data[1]|$data[2]|$data[3]|$data[4]"); | ||
| 1602 | $res=$this->_client->send($notify); | ||
| 1603 | } | ||
| 1604 | else if($tqueue->key=="originate") | ||
| 1605 | { | ||
| 1606 | $originateMsg = new OriginateAction($data['fromext']); | ||
| 1607 | $originateMsg->setContext($data['context']); | ||
| 1608 | $originateMsg->setAsync(true); | ||
| 1609 | $originateMsg->setCallerId($data['callerid']); | ||
| 1610 | $originateMsg->setPriority('1'); | ||
| 1611 | $originateMsg->setExtension($data['toext']); | ||
| 1612 | $originateMsg->setAccount($data['account']); | ||
| 1613 | |||
| 1614 | if(!empty($data['VARS']))foreach($data['VARS'] as $key=>$val) | ||
| 1615 | { | ||
| 1616 | $originateMsg->setVariable($key,$val); | ||
| 1617 | } | ||
| 1618 | |||
| 1619 | $res=$this->_client->send($originateMsg); | ||
| 1620 | } | ||
| 1621 | else if($tqueue->key=="hangupchannel") | ||
| 1622 | { | ||
| 1623 | $hangup = new HangupAction($data['channel']); | ||
| 1624 | $res=$this->_client->send($hangup); | ||
| 1625 | } | ||
| 1626 | else if($tqueue->key=="recordchannel") | ||
| 1627 | { | ||
| 1628 | $mixmonitor=new MixMonitorAction($data['channel']); | ||
| 1629 | $mixmonitor->setFile($data['filepath']); | ||
| 1630 | $res=$this->_client->send($mixmonitor); | ||
| 1631 | } | ||
| 1632 | else if($tqueue->key=="redirectchannel") | ||
| 1633 | { | ||
| 1634 | $redirectchannel=new RedirectAction($data['channel'],$data['exten'],$data['context'],$data['priority']); | ||
| 1635 | $res=$this->_client->send($redirectchannel); | ||
| 1636 | } | ||
| 1637 | else if($tqueue->key=="channelmutemic") | ||
| 1638 | { | ||
| 1639 | $channelmutemic=new KPAMIChannelAudio($data['channel'],"in","on"); | ||
| 1640 | $res=$this->_client->send($channelmutemic); | ||
| 1641 | } | ||
| 1642 | else if($tqueue->key=="channelunmutemic") | ||
| 1643 | { | ||
| 1644 | $channelunmutemic=new KPAMIChannelAudio($data['channel'],"in","off"); | ||
| 1645 | $res=$this->_client->send($channelunmutemic); | ||
| 1646 | } | ||
| 1647 | else if($tqueue->key=="channelmutespeaker") | ||
| 1648 | { | ||
| 1649 | $channelmutespeaker=new KPAMIChannelAudio($data['channel'],"out","on"); | ||
| 1650 | $res=$this->_client->send($channelmutespeaker); | ||
| 1651 | } | ||
| 1652 | else if($tqueue->key=="channelunmutespeaker") | ||
| 1653 | { | ||
| 1654 | $channelunmutespeaker=new KPAMIChannelAudio($data['channel'],"out","off"); | ||
| 1655 | $res=$this->_client->send($channelunmutespeaker); | ||
| 1656 | } | ||
| 1657 | else if($tqueue->key=="astcommand") | ||
| 1658 | { | ||
| 1659 | $astcommand=new CommandAction($data['command']); | ||
| 1660 | $res=$this->_client->send($astcommand); | ||
| 1661 | } | ||
| 1662 | else if($tqueue->key=="Redirect") | ||
| 1663 | { | ||
| 1664 | $redirect=new RedirectAction($data['fromext'], $data['toext'], $data['context'], 1); | ||
| 1665 | $res=$this->_client->send($redirect); | ||
| 1666 | } | ||
| 1667 | else if($tqueue->key=="transfer") | ||
| 1668 | { | ||
| 1669 | $attendedtransferaction=new AttendedTransferAction($data['channel'],$data['exten'],$data['context'],"1"); | ||
| 1670 | $res=$this->_client->send($attendedtransferaction); | ||
| 1671 | } | ||
| 1672 | $tqueue->delete(); | ||
| 1673 | } | ||
| 1674 | } | ||
| 1675 | } | ||
| 1676 | |||
| 1677 | class KPAMIChannelAudio extends ActionMessage | ||
| 1678 | { | ||
| 1679 | public function __construct($channel, $direction, $state) | ||
| 1680 | { | ||
| 1681 | parent::__construct('MuteAudio'); | ||
| 1682 | $this->setKey('Channel', $channel); | ||
| 1683 | $this->setKey('Direction', $direction); | ||
| 1684 | $this->setKey('State', $state); | ||
| 1685 | } | ||
| 1686 | } |
application/app/Models/Cutoff.php
0 → 100644
application/app/Models/Disposition.php
0 → 100644
application/app/Models/DispositionPlan.php
0 → 100644
| ... | @@ -45,6 +45,59 @@ class Kqueue extends Model{ | ... | @@ -45,6 +45,59 @@ class Kqueue extends Model{ |
| 45 | $this->data=json_encode($odata); | 45 | $this->data=json_encode($odata); |
| 46 | $this->save(); | 46 | $this->save(); |
| 47 | } | 47 | } |
| 48 | public function autoCallOut($callnumber,$callerid,$crmcall,$dialline) | ||
| 49 | { | ||
| 50 | $dialstr = $dialline->dialstr; | ||
| 51 | $server = $dialline->server; | ||
| 52 | |||
| 53 | if($server != '') | ||
| 54 | { | ||
| 55 | $odata=array();$odata['VARS']=array(); | ||
| 56 | $odata['fromext']="Local/$callnumber@kstychDialerINB"; | ||
| 57 | $odata['context']="kstychDialer"; | ||
| 58 | $odata['callerid']=$callerid; | ||
| 59 | $odata['toext']="1002".$callnumber; | ||
| 60 | $odata['account']='m|a|'.$crmcall->id; | ||
| 61 | $odata['VARS']['dialstr']=$dialstr; | ||
| 62 | |||
| 63 | //originate conf | ||
| 64 | $this->type="SIP_".$server; | ||
| 65 | $this->key="originate"; | ||
| 66 | $this->status="New"; | ||
| 67 | $this->data=json_encode($odata); | ||
| 68 | $this->save(); | ||
| 69 | } | ||
| 70 | |||
| 71 | } | ||
| 72 | public function transferCall($sipid,$callnumber,$callerid,$crmcall,$dialline) | ||
| 73 | { | ||
| 74 | $dialstr = $dialline->dialstr; | ||
| 75 | $server = $dialline->server; | ||
| 76 | $channel = $dialline->channel; | ||
| 77 | if($server != '') | ||
| 78 | { | ||
| 79 | $odata=array();$odata['VARS']=array(); | ||
| 80 | /*$odata['fromext']="Local/1000".$sipid->id."@kstychDialer"; | ||
| 81 | $odata['context']="initiateTransfer"; | ||
| 82 | $odata['callerid']=$channel; | ||
| 83 | $odata['toext']="1003".$callnumber; | ||
| 84 | $odata['account']='m|t|'.$crmcall->id; | ||
| 85 | $odata['VARS']['dialstr']=$dialstr; | ||
| 86 | $odata['VARS']['chnl']=$channel; | ||
| 87 | $odata['VARS']['callnumber']=$callnumber;*/ | ||
| 88 | $odata['channel']=$channel; | ||
| 89 | $odata['exten']="1003".$callnumber; | ||
| 90 | $odata['context']="initiateTransfer"; | ||
| 91 | $odata['priority']=1; | ||
| 92 | //originate conf | ||
| 93 | $this->type="SIP_".$server; | ||
| 94 | $this->key="transfer"; | ||
| 95 | $this->status="New"; | ||
| 96 | $this->data=json_encode($odata); | ||
| 97 | $this->save(); | ||
| 98 | } | ||
| 99 | |||
| 100 | } | ||
| 48 | public function sipOriginate($sipid,$to,$context) | 101 | public function sipOriginate($sipid,$to,$context) |
| 49 | { | 102 | { |
| 50 | $odata=array();$odata['VARS']=array(); | 103 | $odata=array();$odata['VARS']=array(); | ... | ... |
application/app/Models/SubDisposition.php
0 → 100644
| ... | @@ -15,6 +15,8 @@ return [ | ... | @@ -15,6 +15,8 @@ return [ |
| 15 | 15 | ||
| 16 | 'log' => 'daily', | 16 | 'log' => 'daily', |
| 17 | 17 | ||
| 18 | 'log_max_files' => 30, | ||
| 19 | |||
| 18 | 20 | ||
| 19 | 'providers' => [ | 21 | 'providers' => [ |
| 20 | 22 | ||
| ... | @@ -113,6 +115,8 @@ return [ | ... | @@ -113,6 +115,8 @@ return [ |
| 113 | "submenu"=>["Campaign Management"=>["menuAction('campaign');"], | 115 | "submenu"=>["Campaign Management"=>["menuAction('campaign');"], |
| 114 | "Bulk Upload"=>["menuAction('campaign/bulkupload');"], | 116 | "Bulk Upload"=>["menuAction('campaign/bulkupload');"], |
| 115 | ]], | 117 | ]], |
| 118 | "dispositionPlan" => ["disp"=>"Disposition Plan","icon"=>"globe","dash"=>"","onclick"=>"menuAction('dispositionPlan');"], | ||
| 119 | "disposition" => ["disp"=>"Disposition List","icon"=>"globe","dash"=>"","onclick"=>"menuAction('disposition');"], | ||
| 116 | "Admin" => ["disp"=>"Admin","icon"=>"gear","dash"=>"", | 120 | "Admin" => ["disp"=>"Admin","icon"=>"gear","dash"=>"", |
| 117 | "submenu"=>["Masters"=>["showBlock('Masters');"], | 121 | "submenu"=>["Masters"=>["showBlock('Masters');"], |
| 118 | "Delete Record"=>["showBlock('DeletePerson');"], | 122 | "Delete Record"=>["showBlock('DeletePerson');"], |
| ... | @@ -150,7 +154,7 @@ return [ | ... | @@ -150,7 +154,7 @@ return [ |
| 150 | 'sipssldomain' => env('app_sipssldomain',env('app_domain','localhost')), | 154 | 'sipssldomain' => env('app_sipssldomain',env('app_domain','localhost')), |
| 151 | 'webdomain' => env('web_domain',env('app_domain','localhost')), | 155 | 'webdomain' => env('web_domain',env('app_domain','localhost')), |
| 152 | 'email' => env("app_emailid","[email protected]"), | 156 | 'email' => env("app_emailid","[email protected]"), |
| 153 | 'app_version' => "4.2.12", | 157 | 'app_version' => "4.2.14", |
| 154 | 'mytheme' => 'layout', | 158 | 'mytheme' => 'layout', |
| 155 | 'app_admin' => env('app_admin', 'admin'), | 159 | 'app_admin' => env('app_admin', 'admin'), |
| 156 | 'app_support_ids' => [1], | 160 | 'app_support_ids' => [1], | ... | ... |
| ... | @@ -323,7 +323,7 @@ function dailyTasks | ... | @@ -323,7 +323,7 @@ function dailyTasks |
| 323 | if [ $nowtime -eq "000" ] | 323 | if [ $nowtime -eq "000" ] |
| 324 | then | 324 | then |
| 325 | 325 | ||
| 326 | rm -f $app_path/application/storage/logs/laravel-*.log | 326 | ##rm -f $app_path/application/storage/logs/laravel-*.log |
| 327 | touch $app_path/application/storage/logs/laravel-$(date +%Y-%m-%d).log | 327 | touch $app_path/application/storage/logs/laravel-$(date +%Y-%m-%d).log |
| 328 | chmod -R 777 $app_path/application/storage | 328 | chmod -R 777 $app_path/application/storage |
| 329 | chmod -R 777 $app_path/custom/app | 329 | chmod -R 777 $app_path/custom/app |
| ... | @@ -352,6 +352,32 @@ function astPAMICheck | ... | @@ -352,6 +352,32 @@ function astPAMICheck |
| 352 | fi | 352 | fi |
| 353 | done | 353 | done |
| 354 | } | 354 | } |
| 355 | function createCall | ||
| 356 | { | ||
| 357 | echo "create" | ||
| 358 | AsteriskServers=$(echo $asterisk_slaves | tr "," "\n") | ||
| 359 | for server in $AsteriskServers | ||
| 360 | do | ||
| 361 | IFS=':' read -r -a ServerArr <<< "$server" | ||
| 362 | |||
| 363 | if ! screen -list | grep -q "CreateCall_$app_domain${ServerArr[0]}"; then | ||
| 364 | /usr/bin/screen -d -m -S CreateCall_$app_domain${ServerArr[0]} bash -c "cd $app_path/application/;php $app_path/application/artisan CreateCall" | ||
| 365 | fi | ||
| 366 | done | ||
| 367 | } | ||
| 368 | function hangUpCall | ||
| 369 | { | ||
| 370 | echo "hang" | ||
| 371 | AsteriskServers=$(echo $asterisk_slaves | tr "," "\n") | ||
| 372 | for server in $AsteriskServers | ||
| 373 | do | ||
| 374 | IFS=':' read -r -a ServerArr <<< "$server" | ||
| 375 | |||
| 376 | if ! screen -list | grep -q "HangUpCall_$app_domain${ServerArr[0]}"; then | ||
| 377 | /usr/bin/screen -d -m -S HangUpCall_$app_domain${ServerArr[0]} bash -c "cd $app_path/application/;php $app_path/application/artisan PredictiveCallHangUp" | ||
| 378 | fi | ||
| 379 | done | ||
| 380 | } | ||
| 355 | function waitForLock | 381 | function waitForLock |
| 356 | { | 382 | { |
| 357 | if [ ! -f /tmp/cronsh-$app_domain.lock ]; then | 383 | if [ ! -f /tmp/cronsh-$app_domain.lock ]; then |
| ... | @@ -412,6 +438,8 @@ if [ "$OSNAME" == "Fedora" ] && [ $OSVER -gt 21 ] ; then | ... | @@ -412,6 +438,8 @@ if [ "$OSNAME" == "Fedora" ] && [ $OSVER -gt 21 ] ; then |
| 412 | sshdCheck | 438 | sshdCheck |
| 413 | dailyTasks | 439 | dailyTasks |
| 414 | astPAMICheck | 440 | astPAMICheck |
| 441 | createCall | ||
| 442 | hangUpCall | ||
| 415 | fi | 443 | fi |
| 416 | clearLock | 444 | clearLock |
| 417 | cd $app_path/application;php artisan schedule:run | 445 | cd $app_path/application;php artisan schedule:run | ... | ... |
application/hangup_beep.gsm
deleted
100644 → 0
No preview for this file type
application/hangup_beep.mp3
deleted
100644 → 0
No preview for this file type
application/hangup_beep.wav
deleted
100644 → 0
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
| ... | @@ -12,7 +12,7 @@ astlogdir => /var/log/asterisk | ... | @@ -12,7 +12,7 @@ astlogdir => /var/log/asterisk |
| 12 | astsbindir => /usr/sbin | 12 | astsbindir => /usr/sbin |
| 13 | 13 | ||
| 14 | [options] | 14 | [options] |
| 15 | ;verbose = 3 | 15 | verbose = 9 |
| 16 | ;debug = 3 | 16 | ;debug = 3 |
| 17 | ;alwaysfork = yes ; Same as -F at startup. | 17 | ;alwaysfork = yes ; Same as -F at startup. |
| 18 | ;nofork = yes ; Same as -f at startup. | 18 | ;nofork = yes ; Same as -f at startup. | ... | ... |
application/public/assets/extras/data/asterisk/extensions.conf
100644 → 100755
| ... | @@ -35,7 +35,7 @@ exten => _1001XXX!,1,Dial(SIP/${EXTEN:4}) | ... | @@ -35,7 +35,7 @@ exten => _1001XXX!,1,Dial(SIP/${EXTEN:4}) |
| 35 | exten => _1001XXX!,n,Hangup | 35 | exten => _1001XXX!,n,Hangup |
| 36 | 36 | ||
| 37 | exten => _1002XXX!,1,MixMonitor(/var/spool/asterisk/astrec/${STRFTIME(${EPOCH},,%Y/%m/%d)}/out/outbound_${STRFTIME(${EPOCH},Asia/Kolkata,%Y%m%d-%H%M%S)}_${CALLERID(num)}_${EXTEN:4}_${UNIQUEID}.gsm,av(0)V(0)) | 37 | exten => _1002XXX!,1,MixMonitor(/var/spool/asterisk/astrec/${STRFTIME(${EPOCH},,%Y/%m/%d)}/out/outbound_${STRFTIME(${EPOCH},Asia/Kolkata,%Y%m%d-%H%M%S)}_${CALLERID(num)}_${EXTEN:4}_${UNIQUEID}.gsm,av(0)V(0)) |
| 38 | exten => _1002XXX!,2,Dial(${dialstr}${EXTEN:4},55,tTo) | 38 | exten => _1002XXX!,2,Dial(${dialstr}0${EXTEN:4},55,tTo) |
| 39 | exten => _1002XXX!,n,Hangup | 39 | exten => _1002XXX!,n,Hangup |
| 40 | 40 | ||
| 41 | [kstychDialerINB] | 41 | [kstychDialerINB] |
| ... | @@ -45,19 +45,20 @@ exten => _X!,n,MixMonitor(/var/spool/asterisk/astrec/${STRFTIME(${EPOCH},,%Y/%m/ | ... | @@ -45,19 +45,20 @@ exten => _X!,n,MixMonitor(/var/spool/asterisk/astrec/${STRFTIME(${EPOCH},,%Y/%m/ |
| 45 | exten => _X!,n,ConfBridge(${CHANNEL}) | 45 | exten => _X!,n,ConfBridge(${CHANNEL}) |
| 46 | exten => _X!,n,Hangup | 46 | exten => _X!,n,Hangup |
| 47 | 47 | ||
| 48 | [initiateTransfer] | ||
| 49 | exten => _1003XXXXXXXXXX!,1,Dial(SIP/GATEWAY/${EXTEN:4},30,tT) | ||
| 50 | exten => _1003XXXXXXXXXX!,n,Hangup | ||
| 51 | |||
| 52 | [confTransfer] | ||
| 53 | exten => _1004XXX!,1,ConfBridge(${CHANNEL}) | ||
| 54 | exten => _1004XXX!,n,Hangup | ||
| 55 | |||
| 48 | [kstychPlayFile] | 56 | [kstychPlayFile] |
| 49 | exten => 1001,1,Answer | 57 | exten => 1001,1,Answer |
| 50 | exten => 1001,n,Playback(silence/1) | 58 | exten => 1001,n,Playback(silence/1) |
| 51 | exten => 1001,n,Playback(/var/lib/asterisk/sounds/RM_not_available_unreachabl) | 59 | exten => 1001,n,Playback(/var/lib/asterisk/sounds/RM_not_available_unreachabl) |
| 52 | exten => 1001,n,Hangup | 60 | exten => 1001,n,Hangup |
| 53 | 61 | ||
| 54 | [kstychPlayHangFile] | ||
| 55 | exten => 3001,1,Answer | ||
| 56 | exten => 3001,n,Playback(silence/1) | ||
| 57 | exten => 3001,n,Playback(/var/lib/asterisk/sounds/hangup_beep) | ||
| 58 | exten => 3001,n,Hangup | ||
| 59 | |||
| 60 | |||
| 61 | ;[kstychAbsFile] | 62 | ;[kstychAbsFile] |
| 62 | ;exten => 2001,1,Answer | 63 | ;exten => 2001,1,Answer |
| 63 | ;exten => 2001,n,Playback(silence/1) | 64 | ;exten => 2001,n,Playback(silence/1) | ... | ... |
| ... | @@ -6,7 +6,7 @@ tcpenable=no ; Enable server for incoming TCP connections (de | ... | @@ -6,7 +6,7 @@ tcpenable=no ; Enable server for incoming TCP connections (de |
| 6 | tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces) | 6 | tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces) |
| 7 | transport=udp,ws,wss ; Set the default transports. The order determines the primary default transport. | 7 | transport=udp,ws,wss ; Set the default transports. The order determines the primary default transport. |
| 8 | srvlookup=yes ; Enable DNS SRV lookups on outbound calls | 8 | srvlookup=yes ; Enable DNS SRV lookups on outbound calls |
| 9 | realm=192.168.3.131 | 9 | realm=REPLACESERVERIP |
| 10 | 10 | ||
| 11 | allow = !all,ulaw,alaw,gsm,g723,g726,g729,h264,h263,ilbc,g726aal2,mpeg4,vp8 | 11 | allow = !all,ulaw,alaw,gsm,g723,g726,g729,h264,h263,ilbc,g726aal2,mpeg4,vp8 |
| 12 | 12 | ||
| ... | @@ -16,7 +16,7 @@ rtpkeepalive=60 ; Send keepalives in the RTP stream to keep NAT open | ... | @@ -16,7 +16,7 @@ rtpkeepalive=60 ; Send keepalives in the RTP stream to keep NAT open |
| 16 | notifyringing = yes ; Notify subscriptions on RINGING state (default: no) | 16 | notifyringing = yes ; Notify subscriptions on RINGING state (default: no) |
| 17 | notifyhold = yes ; Notify subscriptions on HOLD state (default: no) | 17 | notifyhold = yes ; Notify subscriptions on HOLD state (default: no) |
| 18 | limitonpeers = yes ; Apply call limits on peers only. This will improve | 18 | limitonpeers = yes ; Apply call limits on peers only. This will improve |
| 19 | externip=192.168.3.131 | 19 | externip=REPLACESERVERIP |
| 20 | localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks | 20 | localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks |
| 21 | localnet=10.0.0.0/255.0.0.0 ; Also RFC1918 | 21 | localnet=10.0.0.0/255.0.0.0 ; Also RFC1918 |
| 22 | localnet=172.16.0.0/12 ; Another RFC1918 with CIDR notation | 22 | localnet=172.16.0.0/12 ; Another RFC1918 with CIDR notation |
| ... | @@ -25,11 +25,22 @@ nat=force_rport,comedia ; Global NAT settings (Affects all | ... | @@ -25,11 +25,22 @@ nat=force_rport,comedia ; Global NAT settings (Affects all |
| 25 | qualify=yes ; By default, qualify all peers at 2000ms | 25 | qualify=yes ; By default, qualify all peers at 2000ms |
| 26 | limitonpeer = yes ; enable call limit on a per peer basis, different from limitonpeers | 26 | limitonpeer = yes ; enable call limit on a per peer basis, different from limitonpeers |
| 27 | icesupport = yes | 27 | icesupport = yes |
| 28 | stunaddr = 192.168.3.131:3478 | 28 | stunaddr = REPLACESERVERIP:3478 |
| 29 | alwaysauthreject = yes | 29 | alwaysauthreject = yes |
| 30 | 30 | ||
| 31 | rtcp_mux=yes | 31 | rtcp_mux=yes |
| 32 | turnaddr=192.168.3.131 | 32 | turnaddr=REPLACESERVERIP |
| 33 | turnusername=test | 33 | turnusername=test |
| 34 | turnpassword=1234 | 34 | turnpassword=1234 |
| 35 | 35 | ||
| 36 | [GATEWAY] | ||
| 37 | type=peer | ||
| 38 | host=10.3.180.33 | ||
| 39 | dtmfmode=inband ; the possibilities are inband , rfc2833, or info | ||
| 40 | disallow=all | ||
| 41 | allow=ulaw; because we have chosen inband for dtmf we need alaw or ulaw (G.711) | ||
| 42 | allow=alaw | ||
| 43 | context=SIPDialerINB | ||
| 44 | |||
| 45 | |||
| 46 | ... | ... |
| ... | @@ -61,7 +61,7 @@ kstychCall['supcomntid']=''; | ... | @@ -61,7 +61,7 @@ kstychCall['supcomntid']=''; |
| 61 | kstychCall['userdata']={}; | 61 | kstychCall['userdata']={}; |
| 62 | kstychCall['previewcrmid']=''; | 62 | kstychCall['previewcrmid']=''; |
| 63 | kstychCall['callWrapupTime']=180; | 63 | kstychCall['callWrapupTime']=180; |
| 64 | kstychCall['prograssiveDelay']=10; | 64 | kstychCall['prograssiveDelay']=20; |
| 65 | kstychCall['ts_now']=0; | 65 | kstychCall['ts_now']=0; |
| 66 | 66 | ||
| 67 | kstychCall['bttc_day']=''; | 67 | kstychCall['bttc_day']=''; |
| ... | @@ -560,6 +560,7 @@ function saveCloseDialerCall(flag) | ... | @@ -560,6 +560,7 @@ function saveCloseDialerCall(flag) |
| 560 | kstychCall['userstatus']=$('#dialer_userstatus').val(); | 560 | kstychCall['userstatus']=$('#dialer_userstatus').val(); |
| 561 | kstychCall['usersubstatus']=$('#dialer_usersubstatus').val(); | 561 | kstychCall['usersubstatus']=$('#dialer_usersubstatus').val(); |
| 562 | kstychCall['usercallback']=$('#dialer_usercallback').val(); | 562 | kstychCall['usercallback']=$('#dialer_usercallback').val(); |
| 563 | kstychCall['userappointment']=$('#dialer_appointment').val(); | ||
| 563 | kstychCall["attempt"]=$('#attempt').val();//attempt dropdown value insert | 564 | kstychCall["attempt"]=$('#attempt').val();//attempt dropdown value insert |
| 564 | 565 | ||
| 565 | //kstychCall['userremarks']=$('#dialer_userremarks').val(); | 566 | //kstychCall['userremarks']=$('#dialer_userremarks').val(); |
| ... | @@ -595,8 +596,12 @@ console.log(fullRem); | ... | @@ -595,8 +596,12 @@ console.log(fullRem); |
| 595 | { | 596 | { |
| 596 | kstychCall['userstatus']="AUTOWRAPUP"; | 597 | kstychCall['userstatus']="AUTOWRAPUP"; |
| 597 | kstychCall['usersubstatus']="AUTOWRAPUP"; | 598 | kstychCall['usersubstatus']="AUTOWRAPUP"; |
| 599 | |||
| 600 | |||
| 598 | $('#dialer_usercallback').val(""); | 601 | $('#dialer_usercallback').val(""); |
| 599 | kstychCall['usercallback']=""; | 602 | kstychCall['usercallback']=""; |
| 603 | $('#dialer_appointment').val(""); | ||
| 604 | kstychCall['userappointment']=""; | ||
| 600 | kstychCall['userremarks']=""; | 605 | kstychCall['userremarks']=""; |
| 601 | kstychCall['userflag']=""; | 606 | kstychCall['userflag']=""; |
| 602 | } | 607 | } |
| ... | @@ -606,6 +611,8 @@ console.log(fullRem); | ... | @@ -606,6 +611,8 @@ console.log(fullRem); |
| 606 | kstychCall['usersubstatus']="REDIAL"; | 611 | kstychCall['usersubstatus']="REDIAL"; |
| 607 | $('#dialer_usercallback').val(""); | 612 | $('#dialer_usercallback').val(""); |
| 608 | kstychCall['usercallback']=""; | 613 | kstychCall['usercallback']=""; |
| 614 | $('#dialer_appointment').val(""); | ||
| 615 | kstychCall['userappointment']=""; | ||
| 609 | kstychCall['userremarks']=""; | 616 | kstychCall['userremarks']=""; |
| 610 | kstychCall['userflag']=""; | 617 | kstychCall['userflag']=""; |
| 611 | 618 | ||
| ... | @@ -616,11 +623,13 @@ console.log(fullRem); | ... | @@ -616,11 +623,13 @@ console.log(fullRem); |
| 616 | kstychCall['userstatus']="NORECORD"; | 623 | kstychCall['userstatus']="NORECORD"; |
| 617 | kstychCall['usersubstatus']="NORECORD"; | 624 | kstychCall['usersubstatus']="NORECORD"; |
| 618 | kstychCall['usercallback']=""; | 625 | kstychCall['usercallback']=""; |
| 626 | kstychCall['userappointment']=""; | ||
| 619 | kstychCall['userremarks']=""; | 627 | kstychCall['userremarks']=""; |
| 620 | kstychCall['userflag']=""; | 628 | kstychCall['userflag']=""; |
| 621 | kstychCall["attempt"]=""; | 629 | kstychCall["attempt"]=""; |
| 622 | 630 | ||
| 623 | $('#dialer_usercallback').val(""); | 631 | $('#dialer_usercallback').val(""); |
| 632 | $('#dialer_appointment').val(""); | ||
| 624 | } | 633 | } |
| 625 | else | 634 | else |
| 626 | { | 635 | { |
| ... | @@ -678,6 +687,40 @@ console.log(fullRem); | ... | @@ -678,6 +687,40 @@ console.log(fullRem); |
| 678 | return; | 687 | return; |
| 679 | } | 688 | } |
| 680 | 689 | ||
| 690 | if(kstychCall['usersubstatus'].toLowerCase().indexOf("appointment")>-1||kstychCall['userstatus'].toLowerCase().indexOf("appointment")>-1) | ||
| 691 | { | ||
| 692 | if($('#dialer_appointment').val()=="") | ||
| 693 | { | ||
| 694 | //console.log("followup"); | ||
| 695 | simpleNotification('error','topRight',"Please select Appointment Date within one month in future"); | ||
| 696 | return; | ||
| 697 | } | ||
| 698 | } | ||
| 699 | else | ||
| 700 | { | ||
| 701 | if($('#dialer_appointment').val()!="") | ||
| 702 | { | ||
| 703 | simpleNotification('error','topRight',"You Cannot input Appointment date time in this Disposition"); | ||
| 704 | return; | ||
| 705 | } | ||
| 706 | } | ||
| 707 | |||
| 708 | var date3 = new Date($('#dialer_appointment').val()); | ||
| 709 | var diff = date3.getTime() - date1.getTime(); | ||
| 710 | if(diff<0||diff>30*24*60*60*1000) | ||
| 711 | { | ||
| 712 | simpleNotification('error','topRight',"Please select Appointment date within one month in future"); | ||
| 713 | return; | ||
| 714 | } | ||
| 715 | var hours = date3.getHours(); | ||
| 716 | var mins = date3.getMinutes(); | ||
| 717 | var fullhour=hours+(mins/60); | ||
| 718 | if(fullhour<9||fullhour>19) | ||
| 719 | { | ||
| 720 | simpleNotification('error','topRight',"Please select Appointment Time date within 9AM and 7PM"); | ||
| 721 | return; | ||
| 722 | } | ||
| 723 | |||
| 681 | } | 724 | } |
| 682 | 725 | ||
| 683 | if($("#recruitsavedata").length)$("#recruitsavedata").click();//TODO hold div in reset, or any error will be lost | 726 | if($("#recruitsavedata").length)$("#recruitsavedata").click();//TODO hold div in reset, or any error will be lost |
| ... | @@ -780,6 +823,8 @@ function showWrapUp() | ... | @@ -780,6 +823,8 @@ function showWrapUp() |
| 780 | kstychCall['usersubstatus']="WRAPUP"; | 823 | kstychCall['usersubstatus']="WRAPUP"; |
| 781 | $('#dialer_usercallback').val(""); | 824 | $('#dialer_usercallback').val(""); |
| 782 | kstychCall['usercallback']=""; | 825 | kstychCall['usercallback']=""; |
| 826 | kstychCall['usercallback']=""; | ||
| 827 | $('#dialer_appointment').val(""); | ||
| 783 | kstychCall['userremarks']=""; | 828 | kstychCall['userremarks']=""; |
| 784 | kstychCall['userflag']=""; | 829 | kstychCall['userflag']=""; |
| 785 | 830 | ||
| ... | @@ -812,9 +857,12 @@ function resetDialer() | ... | @@ -812,9 +857,12 @@ function resetDialer() |
| 812 | 857 | ||
| 813 | var dialerResetForceState=kstychDialer['mDialerState']; | 858 | var dialerResetForceState=kstychDialer['mDialerState']; |
| 814 | var dialerResetForceSubState=kstychDialer['mDialerSubState']; | 859 | var dialerResetForceSubState=kstychDialer['mDialerSubState']; |
| 815 | 860 | if(dialerResetForceSubState != "Predictive"){ | |
| 816 | dialerResetForceState="Progressive";//Hardcoded TODO change to config | 861 | dialerResetForceState="Progressive";//Hardcoded TODO change to config |
| 817 | dialerResetForceSubState=""; | 862 | dialerResetForceSubState=""; |
| 863 | } | ||
| 864 | //dialerResetForceState="Progressive";//Hardcoded TODO change to config | ||
| 865 | //dialerResetForceSubState=""; | ||
| 818 | 866 | ||
| 819 | if(kstychCall['userstatus']=="AUTOWRAPUP") | 867 | if(kstychCall['userstatus']=="AUTOWRAPUP") |
| 820 | { | 868 | { |
| ... | @@ -876,9 +924,19 @@ function resetCallArray() | ... | @@ -876,9 +924,19 @@ function resetCallArray() |
| 876 | 924 | ||
| 877 | kSetDData('C','previewcrmid',""); | 925 | kSetDData('C','previewcrmid',""); |
| 878 | kSetDData('C','callWrapupTime',180); | 926 | kSetDData('C','callWrapupTime',180); |
| 879 | kSetDData('C','prograssiveDelay',10); | 927 | kSetDData('C','prograssiveDelay',20); |
| 928 | |||
| 880 | } | 929 | } |
| 881 | 930 | ||
| 931 | function savedialermode(client) | ||
| 932 | { | ||
| 933 | var datastr="kstychCall="+JSON.stringify(kstychCall); | ||
| 934 | datastr+="&kstychDialer="+JSON.stringify(kstychDialer); | ||
| 935 | |||
| 936 | doAjax("dialer?action=usersel&client="+client,datastr,"","","singlefail","POST"); | ||
| 937 | } | ||
| 938 | |||
| 939 | |||
| 882 | function updateDialerState(objstr,key,val,key2,val2) | 940 | function updateDialerState(objstr,key,val,key2,val2) |
| 883 | { | 941 | { |
| 884 | if(objstr=="dialer") | 942 | if(objstr=="dialer") |
| ... | @@ -889,6 +947,9 @@ function updateDialerState(objstr,key,val,key2,val2) | ... | @@ -889,6 +947,9 @@ function updateDialerState(objstr,key,val,key2,val2) |
| 889 | { | 947 | { |
| 890 | if(!key2||key2=="")kSetDData("D","mDialerSubState",""); | 948 | if(!key2||key2=="")kSetDData("D","mDialerSubState",""); |
| 891 | 949 | ||
| 950 | $("#transferCallBtn").removeClass("show").addClass("hide"); | ||
| 951 | $("#transferHangBtn").removeClass("hide").addClass("show"); | ||
| 952 | |||
| 892 | if(val=="Paused") | 953 | if(val=="Paused") |
| 893 | { | 954 | { |
| 894 | resetCallArray(); | 955 | resetCallArray(); |
| ... | @@ -934,6 +995,8 @@ function updateDialerState(objstr,key,val,key2,val2) | ... | @@ -934,6 +995,8 @@ function updateDialerState(objstr,key,val,key2,val2) |
| 934 | 995 | ||
| 935 | updateDialerState(); | 996 | updateDialerState(); |
| 936 | }); | 997 | }); |
| 998 | //if(val2=="Predictive") | ||
| 999 | savedialermode(client); | ||
| 937 | } | 1000 | } |
| 938 | } | 1001 | } |
| 939 | if(objstr=="call") | 1002 | if(objstr=="call") |
| ... | @@ -1637,6 +1700,14 @@ recursiveDTMF(); | ... | @@ -1637,6 +1700,14 @@ recursiveDTMF(); |
| 1637 | charLen=0; | 1700 | charLen=0; |
| 1638 | } | 1701 | } |
| 1639 | 1702 | ||
| 1703 | function sendTHDTMFs(){ | ||
| 1704 | dtmfVal = "*2"; | ||
| 1705 | if(validateDTMF(dtmfVal) == false){simpleNotification("error","topRight", "Invalid DTMF");return;} | ||
| 1706 | |||
| 1707 | recursiveDTMF(); | ||
| 1708 | charLen=0; | ||
| 1709 | } | ||
| 1710 | |||
| 1640 | function recursiveDTMF() { | 1711 | function recursiveDTMF() { |
| 1641 | setTimeout(function(){ | 1712 | setTimeout(function(){ |
| 1642 | var dtmfKey = dtmfVal.charAt(charLen); | 1713 | var dtmfKey = dtmfVal.charAt(charLen); | ... | ... |
| ... | @@ -678,7 +678,13 @@ $(document).click(function(e){ | ... | @@ -678,7 +678,13 @@ $(document).click(function(e){ |
| 678 | }); | 678 | }); |
| 679 | 679 | ||
| 680 | window.onbeforeunload = function(){ | 680 | window.onbeforeunload = function(){ |
| 681 | if(kstychAppObject['user']['id']==0)return ; | 681 | //if(kstychAppObject['user']['id']==0)return ; |
| 682 | if(kstychAppObject['user']['id']==0) { | ||
| 683 | return ; | ||
| 684 | } | ||
| 685 | else { | ||
| 686 | doAjax("dialer?action=sipcleanup"); | ||
| 687 | } | ||
| 682 | if(lastvarUrl.indexOf("author")<0)return ; | 688 | if(lastvarUrl.indexOf("author")<0)return ; |
| 683 | else return 'Are you sure you want to leave?'; | 689 | else return 'Are you sure you want to leave?'; |
| 684 | }; | 690 | }; | ... | ... |
No preview for this file type
application/public/debugdump.txt
deleted
100644 → 0
application/public/sms_test.php
deleted
100755 → 0
| 1 | <?php | ||
| 2 | $url = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; | ||
| 3 | //$url = 'https://push3.maccesssmspush.com/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?userId=hdfcbalrt&pass=hdfcbalrt25&appid=hdfcbalrt&subappid=hdfcbalrt&contenttype=1&to=8074030875&from=HDFCBK&text=manoj&selfid=true&alert=1&dlrreq=true&intflag=false'; | ||
| 4 | $inputArray = ["userId"=>"hdfcbalrt","pass"=>"hdfcbalrt25","appid"=>"hdfcbalrt","subappid"=>"hdfcbalrt","contenttype"=>"1","to"=>"8074030875","from"=>"HDFCBK","text"=>"This%20is%20test%20SMS","selfid"=>"true","alert"=>"1","dlrreq"=>"true","intflag"=>"false"]; | ||
| 5 | $payload = json_encode($inputArray); | ||
| 6 | //$payload = json_encode($jsonBody); | ||
| 7 | $ch = curl_init(); | ||
| 8 | curl_setopt($ch, CURLOPT_COOKIE, ""); | ||
| 9 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | ||
| 10 | curl_setopt($ch, CURLOPT_URL, $url); | ||
| 11 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| 12 | curl_setopt($ch, CURLOPT_POST, 1); | ||
| 13 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); | ||
| 14 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 15 | curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', | ||
| 16 | 'AUTHORIZATIONKEY:' . $X_AUTH_T, | ||
| 17 | 'X-EMAIL:' . $X_EMAIL_T, 'Cache-Control:no-cache' | ||
| 18 | )); | ||
| 19 | $result=curl_exec($ch); | ||
| 20 | $errors=curl_error($ch); | ||
| 21 | $response = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
| 22 | var_dump($result); | ||
| 23 | curl_close($ch); | ||
| 24 | echo $errors."<br/>"; | ||
| 25 | |||
| 26 | echo $response; | ||
| 27 | ?> |
application/public/sms_test_1.php
deleted
100755 → 0
| 1 | <?php | ||
| 2 | //$url = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; | ||
| 3 | //$url = 'https://push3.maccesssmspush.com/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?userId=hdfcbalrt&pass=hdfcbalrt25&appid=hdfcbalrt&subappid=hdfcbalrt&contenttype=1&to=8074030875&from=HDFCBK&text=manoj&selfid=true&alert=1&dlrreq=true&intflag=false'; | ||
| 4 | |||
| 5 | |||
| 6 | $url = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; | ||
| 7 | $inputArray = ['userId'=>'hdfcbalrt',"pass"=>'hdfcbalrt25',"appid"=>"hdfcbalrt","subappid"=>"hdfcbalrt","contenttype"=>"1","to"=>"8074030875","from"=>"HDFCBK","text"=>"This is test Message","selfid"=>"true","alert"=>"1","dlrreq"=>"true","intflag"=>"false"]; | ||
| 8 | $query = http_build_query($inputArray); | ||
| 9 | $url .= $query; | ||
| 10 | |||
| 11 | //echo $url; | ||
| 12 | // exit; | ||
| 13 | |||
| 14 | try{ | ||
| 15 | $ch = curl_init(); | ||
| 16 | curl_setopt($ch, CURLOPT_URL, $url); | ||
| 17 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| 18 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 19 | // curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 5); | ||
| 20 | // curl_setopt($ch,CURLOPT_TIMEOUT, 15); | ||
| 21 | $response = curl_exec($ch); | ||
| 22 | //echo "Kumar"; | ||
| 23 | echo $response; | ||
| 24 | curl_close($ch); | ||
| 25 | } catch(Exception $e) { | ||
| 26 | //echo "Manoj"; | ||
| 27 | var_dump($e->getMessage()); | ||
| 28 | } | ||
| 29 | |||
| 30 | ?> | ||
| 31 |
| ... | @@ -37,7 +37,7 @@ class records_details extends Command { | ... | @@ -37,7 +37,7 @@ class records_details extends Command { |
| 37 | public function handle() | 37 | public function handle() |
| 38 | { | 38 | { |
| 39 | $nowts=time(); | 39 | $nowts=time(); |
| 40 | echo "\n".date('Y-m-d')."\n"; | 40 | echo "\n".date('Y-m-d H:i:s')."\n"; |
| 41 | $server_ip=env('app_ip'); | 41 | $server_ip=env('app_ip'); |
| 42 | $central_ip=env('central_ip'); | 42 | $central_ip=env('central_ip'); |
| 43 | $conn=''; | 43 | $conn=''; |
| ... | @@ -46,9 +46,9 @@ class records_details extends Command { | ... | @@ -46,9 +46,9 @@ class records_details extends Command { |
| 46 | $conn = array( | 46 | $conn = array( |
| 47 | 'driver' => 'mysql', | 47 | 'driver' => 'mysql', |
| 48 | 'host' => $central_ip, | 48 | 'host' => $central_ip, |
| 49 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | 49 | 'database' => env('CENTRAL_DB'), |
| 50 | 'username' => env('DB_USERNAME', 'root'), | 50 | 'username' => env('CENTRAL_USERNAME'), |
| 51 | 'password' => env('DB_PASSWORD', ''), | 51 | 'password' => env('CENTRAL_PASSWORD'), |
| 52 | 'charset' => 'utf8', | 52 | 'charset' => 'utf8', |
| 53 | 'collation' => 'utf8_unicode_ci', | 53 | 'collation' => 'utf8_unicode_ci', |
| 54 | 'prefix' => '', | 54 | 'prefix' => '', |
| ... | @@ -68,14 +68,25 @@ class records_details extends Command { | ... | @@ -68,14 +68,25 @@ class records_details extends Command { |
| 68 | } | 68 | } |
| 69 | $location=$serverclist[0]->location; | 69 | $location=$serverclist[0]->location; |
| 70 | 70 | ||
| 71 | echo ",".$server_ip; | 71 | echo ",".$server_ip; |
| 72 | $maxid=DB::connection("conn")->select(DB::raw("SELECT max(record_id) as maxid from records_details where server_ip='$server_ip'")); | ||
| 73 | |||
| 74 | $maxids=$maxid[0]->maxid; | ||
| 75 | |||
| 76 | $qlist=DB::select(DB::raw("SELECT id,created,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records` where id>'$maxids' and client != 'Inactive'")); | ||
| 77 | |||
| 78 | $countnumber=count($qlist); | ||
| 79 | $finalnumber=$countnumber/50; | ||
| 80 | $finalnumber=floor($finalnumber); | ||
| 72 | 81 | ||
| 73 | $qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`")); | ||
| 74 | $datainser=''; | 82 | $datainser=''; |
| 83 | $iii=1; | ||
| 84 | $kkk=1; | ||
| 85 | $shortinsert=""; | ||
| 75 | foreach($qlist as $qline) | 86 | foreach($qlist as $qline) |
| 76 | { | 87 | { |
| 77 | |||
| 78 | $record_id=$qline->id; | 88 | $record_id=$qline->id; |
| 89 | $created=$qline->created; | ||
| 79 | $clientcode=$qline->clientcode; | 90 | $clientcode=$qline->clientcode; |
| 80 | $client=$qline->client; | 91 | $client=$qline->client; |
| 81 | $status=$qline->status; | 92 | $status=$qline->status; |
| ... | @@ -86,18 +97,30 @@ class records_details extends Command { | ... | @@ -86,18 +97,30 @@ class records_details extends Command { |
| 86 | $question=$qline->question; | 97 | $question=$qline->question; |
| 87 | $firstname=$qline->firstname; | 98 | $firstname=$qline->firstname; |
| 88 | 99 | ||
| 100 | $shortinsert.="('$client', '$server_ip', '$record_id', '$clientcode', '$status', '$clientinternalid', '$location', '$mobile', '$question', '$firstname', '$priority', '$modified', '$created'),"; | ||
| 89 | 101 | ||
| 90 | DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'")); | ||
| 91 | 102 | ||
| 103 | if($kkk<=$finalnumber){ | ||
| 104 | if($iii%50==0){ | ||
| 92 | 105 | ||
| 106 | $shortinsert=substr($shortinsert,0,-1); | ||
| 107 | DB::connection("conn")->insert(DB::raw("INSERT INTO `records_details` (`client`, `server_ip`, `record_id`, `cust_id`, `records_status`, `group_id`, `location`, `mobile`, `question`,`firstname`, `priority`, `modified`, `created`) VALUES $shortinsert")); | ||
| 108 | |||
| 109 | $kkk++; | ||
| 93 | } | 110 | } |
| 94 | DB::connection("conn")->disconnect(); | 111 | }else{ |
| 112 | DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified',created='$created'")); | ||
| 113 | } | ||
| 114 | if($iii%50==0){ | ||
| 115 | $shortinsert=""; | ||
| 116 | } | ||
| 117 | $iii++; | ||
| 95 | 118 | ||
| 96 | } | 119 | } |
| 120 | echo "\n".date('Y-m-d H:i:s')."\n"; | ||
| 121 | DB::connection("conn")->disconnect(); | ||
| 122 | } | ||
| 97 | } | 123 | } |
| 98 | 124 | ||
| 99 | } | 125 | } |
| 100 | 126 | ||
| 101 | |||
| 102 | |||
| 103 | ... | ... |
| ... | @@ -6,11 +6,9 @@ use App\Models\User; | ... | @@ -6,11 +6,9 @@ use App\Models\User; |
| 6 | <audio id="ringbacktone" loop src="{!!url('/')!!}/assets/sounds/ringbacktone.wav"></audio> | 6 | <audio id="ringbacktone" loop src="{!!url('/')!!}/assets/sounds/ringbacktone.wav"></audio> |
| 7 | <audio id="incomingbeep" src="{!!url('/')!!}/assets/sounds/beep.wav"></audio> | 7 | <audio id="incomingbeep" src="{!!url('/')!!}/assets/sounds/beep.wav"></audio> |
| 8 | <audio id="dtmfTone" src="{!!url('/')!!}/assets/sounds/dtmf.wav"></audio> | 8 | <audio id="dtmfTone" src="{!!url('/')!!}/assets/sounds/dtmf.wav"></audio> |
| 9 | <audio id="hangup"> | ||
| 10 | <source src="{!!url('/')!!}/assets/sounds/hangup_beep.mp3" type="audio/mpeg"> | ||
| 11 | </audio> | ||
| 12 | <video class="video" style='display:none' id="video_remote" autoplay="autoplay"></video> | 9 | <video class="video" style='display:none' id="video_remote" autoplay="autoplay"></video> |
| 13 | <video class="video" style='display:none' id="video_local" autoplay="autoplay" muted="true"></video> | 10 | <video class="video" style='display:none' id="video_local" autoplay="autoplay" muted="true"></video> |
| 11 | |||
| 14 | <?php | 12 | <?php |
| 15 | $skin=Input::get("skin");if(Auth::check())if($skin=="")$skin=Auth::user()->dataval('skin'); | 13 | $skin=Input::get("skin");if(Auth::check())if($skin=="")$skin=Auth::user()->dataval('skin'); |
| 16 | $skinarr=User::getStyleColors($skin); | 14 | $skinarr=User::getStyleColors($skin); | ... | ... |
No preview for this file type
| ... | @@ -44,7 +44,7 @@ foreach($tmodules as $mname=>$marr) | ... | @@ -44,7 +44,7 @@ foreach($tmodules as $mname=>$marr) |
| 44 | <div class=wave-btn style='width:100%'> | 44 | <div class=wave-btn style='width:100%'> |
| 45 | <div class=pushy-submenu> | 45 | <div class=pushy-submenu> |
| 46 | <i class="fa fa-fw fa-{!!$marr['icon']!!}"></i> | 46 | <i class="fa fa-fw fa-{!!$marr['icon']!!}"></i> |
| 47 | <h5>{!!$marr['disp']!!}</h5> | 47 | <h5>{!!$marr['disp']!!} Manoj</h5> |
| 48 | <ul> | 48 | <ul> |
| 49 | <?php | 49 | <?php |
| 50 | foreach($marr['submenu'] as $submenu=>$submenuarr) | 50 | foreach($marr['submenu'] as $submenu=>$submenuarr) |
| ... | @@ -146,6 +146,10 @@ foreach($tmodules as $mname=>$marr) | ... | @@ -146,6 +146,10 @@ foreach($tmodules as $mname=>$marr) |
| 146 | <a href="#">{!!$marr['disp']!!}</a> | 146 | <a href="#">{!!$marr['disp']!!}</a> |
| 147 | </li> | 147 | </li> |
| 148 | <?php } $active="";} ?> | 148 | <?php } $active="";} ?> |
| 149 | |||
| 150 | <li class='homemenu' id=mainmenu > | ||
| 151 | <a href="http://10.3.177.14/{!!env('faqfolder_name')!!}" target="_blank">FAQ</a> | ||
| 152 | </li> | ||
| 149 | </ul> | 153 | </ul> |
| 150 | 154 | ||
| 151 | <div class="user-action pull-right" id=topmainusermenu > | 155 | <div class="user-action pull-right" id=topmainusermenu > |
| ... | @@ -242,8 +246,6 @@ foreach($tmodules as $mname=>$marr) | ... | @@ -242,8 +246,6 @@ foreach($tmodules as $mname=>$marr) |
| 242 | <?php } ?> | 246 | <?php } ?> |
| 243 | <div><a href="#" class="btn btn-primary" onclick="menuAction('message');return false;"><i class="fa fa-list"></i> <span>View all messages <?php if($messagescount>0)echo "($messagescount)"; ?></span></a></div> | 247 | <div><a href="#" class="btn btn-primary" onclick="menuAction('message');return false;"><i class="fa fa-list"></i> <span>View all messages <?php if($messagescount>0)echo "($messagescount)"; ?></span></a></div> |
| 244 | </ul> | 248 | </ul> |
| 245 | <input type="hidden" id="userLoginRole" value="{{Auth::user()->username}}"> | ||
| 246 | <input type="hidden" id="userExtension" value="{{isset(Auth::user()->exten)?(Auth::user()->exten):'0'}}"> | ||
| 247 | </li> | 249 | </li> |
| 248 | <li class="dropdown notif" style='height:35px'> | 250 | <li class="dropdown notif" style='height:35px'> |
| 249 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" style='height:35px' onclick='$("#topmenunotifucount").html("");'><i class="notif-block fa fa-bell"></i><span class="badge badge-info" id=topmenunotifucount><?php if(isset($meta['ncnt'])&&$meta['ncnt']>0)echo $meta['ncnt']; ?></span></a> | 251 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" style='height:35px' onclick='$("#topmenunotifucount").html("");'><i class="notif-block fa fa-bell"></i><span class="badge badge-info" id=topmenunotifucount><?php if(isset($meta['ncnt'])&&$meta['ncnt']>0)echo $meta['ncnt']; ?></span></a> | ... | ... |
| ... | @@ -23,8 +23,8 @@ | ... | @@ -23,8 +23,8 @@ |
| 23 | <input type="submit" name="upload" id="upload" class="btn btn-primary" value="Upload"> | 23 | <input type="submit" name="upload" id="upload" class="btn btn-primary" value="Upload"> |
| 24 | 24 | ||
| 25 | </div> | 25 | </div> |
| 26 | <div class="col-md-2"> | 26 | <div class="col-md-3"> |
| 27 | <!--- <span><a href="javascript:void(0)" id="downloadExcel">Sample excel format</a></span>---> | 27 | <span><a href="javascript:void(0)" id="downloadExcel">Sample excel format</a></span> |
| 28 | </div> | 28 | </div> |
| 29 | </form> | 29 | </form> |
| 30 | </div> | 30 | </div> |
| ... | @@ -69,8 +69,8 @@ $(document).ready(function(){ | ... | @@ -69,8 +69,8 @@ $(document).ready(function(){ |
| 69 | }); | 69 | }); |
| 70 | 70 | ||
| 71 | $('#downloadExcel').click(function(){ | 71 | $('#downloadExcel').click(function(){ |
| 72 | event.preventDefault(); | 72 | // window.open('campaign/sampleDataExcel'); |
| 73 | doAjax("campaign/sampleDataExcel","","","","","GET"); | 73 | window.open('campaign/sampleDataExcel?action=bulkupload'); |
| 74 | return false; | 74 | return false; |
| 75 | }); | 75 | }); |
| 76 | }); | 76 | }); | ... | ... |
| ... | @@ -79,6 +79,9 @@ $queryFields = explode(",", 'id,created,modified,currentstatus,legalstatus,first | ... | @@ -79,6 +79,9 @@ $queryFields = explode(",", 'id,created,modified,currentstatus,legalstatus,first |
| 79 | <li role="presentation"> | 79 | <li role="presentation"> |
| 80 | <a href="#disposition" aria-controls="sql" role="tab" data-toggle="tab">Disposition</a> | 80 | <a href="#disposition" aria-controls="sql" role="tab" data-toggle="tab">Disposition</a> |
| 81 | </li> | 81 | </li> |
| 82 | <li role="presentation"> | ||
| 83 | <a href="#switch" aria-controls="sql" role="tab" data-toggle="tab">Call Management</a> | ||
| 84 | </li> | ||
| 82 | </ul> | 85 | </ul> |
| 83 | <div class="tab-content"> | 86 | <div class="tab-content"> |
| 84 | <!-- <div role="tabpanel" class="tab-pane" id="ctCrm"> | 87 | <!-- <div role="tabpanel" class="tab-pane" id="ctCrm"> |
| ... | @@ -106,6 +109,10 @@ $queryFields = explode(",", 'id,created,modified,currentstatus,legalstatus,first | ... | @@ -106,6 +109,10 @@ $queryFields = explode(",", 'id,created,modified,currentstatus,legalstatus,first |
| 106 | <div role="tabpanel" class="tab-pane" id="disposition"> | 109 | <div role="tabpanel" class="tab-pane" id="disposition"> |
| 107 | @include("layout/module/campaign/campaignAssignToDisposition") | 110 | @include("layout/module/campaign/campaignAssignToDisposition") |
| 108 | </div> | 111 | </div> |
| 112 | <div role="tabpanel" class="tab-pane" id="switch"> | ||
| 113 | @include("layout/module/campaign/campaignCallSwitch") | ||
| 114 | </div> | ||
| 115 | |||
| 109 | </div> | 116 | </div> |
| 110 | </div> | 117 | </div> |
| 111 | </div> | 118 | </div> | ... | ... |
| ... | @@ -77,6 +77,9 @@ $dashboarduser=Auth::user(); | ... | @@ -77,6 +77,9 @@ $dashboarduser=Auth::user(); |
| 77 | <div class="col-md-2"> | 77 | <div class="col-md-2"> |
| 78 | <input type="submit" name="upload" id="upload" class="btn btn-primary" value="Upload"> | 78 | <input type="submit" name="upload" id="upload" class="btn btn-primary" value="Upload"> |
| 79 | </div> | 79 | </div> |
| 80 | <div class="col-md-2"> | ||
| 81 | <span><a href="javascript:void(0)" id="downloadExcel">Sample excel format</a></span> | ||
| 82 | </div> | ||
| 80 | </form> | 83 | </form> |
| 81 | </div> | 84 | </div> |
| 82 | </div> | 85 | </div> |
| ... | @@ -220,4 +223,8 @@ $(document).ready(function(){ | ... | @@ -220,4 +223,8 @@ $(document).ready(function(){ |
| 220 | } | 223 | } |
| 221 | 224 | ||
| 222 | }); | 225 | }); |
| 226 | $('#downloadExcel').click(function(){ | ||
| 227 | window.open('campaign/sampleDataExcel?action=upload'); | ||
| 228 | return false; | ||
| 229 | }); | ||
| 223 | </script> | 230 | </script> | ... | ... |
application/resources/views/layout/module/campaign/campaignAssignToDisposition.blade-2002.php
0 → 100755
| 1 | <style> | ||
| 2 | .list-group{ | ||
| 3 | padding: 5px; | ||
| 4 | margin: 0px; | ||
| 5 | overflow:auto; | ||
| 6 | width:100% | ||
| 7 | } | ||
| 8 | </style> | ||
| 9 | <div class="row"> | ||
| 10 | <div class="col-md-12"> | ||
| 11 | <div class="panel panel-info"> | ||
| 12 | <div class="panel-body"> | ||
| 13 | <div class="row" style="margin: 5px"> | ||
| 14 | <div class="col-md-2"> | ||
| 15 | <label>Select Disposition:</label> | ||
| 16 | </div> | ||
| 17 | <div class="col-md-6"> | ||
| 18 | <select id="disposition" class="form-control" onchange='subDisposition($(this).val());'> | ||
| 19 | <option value></option> | ||
| 20 | <?php if(isset($disposition)) | ||
| 21 | foreach($disposition as $kay => $val) | ||
| 22 | { | ||
| 23 | $code = $dispositionCode[$kay]; | ||
| 24 | echo "<option data-id='$code' data-text='$kay' value='$val'>$kay</option>"; | ||
| 25 | } ?> | ||
| 26 | </select> | ||
| 27 | |||
| 28 | </div> | ||
| 29 | </div> | ||
| 30 | <div class="row" style="margin: 5px"> | ||
| 31 | <div class="col-md-2"> | ||
| 32 | <label>Select Sub Disposition:</label> | ||
| 33 | </div> | ||
| 34 | <div class="col-md-6"> | ||
| 35 | <select id="subDisposition" class="select2multi" style='width:100%' multiple=""> | ||
| 36 | </select> | ||
| 37 | </select> | ||
| 38 | </div> | ||
| 39 | </div> | ||
| 40 | <div class="row"> | ||
| 41 | <div class="col-md-2"> | ||
| 42 | <button id="assigndesposition" class="btn btn-xs btn-info">Assign Disposition | ||
| 43 | </button> | ||
| 44 | </div> | ||
| 45 | <div class="col-md-8" id="error"> | ||
| 46 | </div> | ||
| 47 | </div> | ||
| 48 | |||
| 49 | </div> | ||
| 50 | </div> | ||
| 51 | </div> | ||
| 52 | |||
| 53 | <div class="col-sm-12"> | ||
| 54 | <div class="panel panel-info"> | ||
| 55 | <div class="panel-heading"><strong>Disposition List</strong></div> | ||
| 56 | <div class="panel-body" id=""> | ||
| 57 | <ul class="list-group"> | ||
| 58 | <?php foreach($dispositionList as $dispo => $val) { if(!empty($val)){ ?> | ||
| 59 | <li class="list-group-item list-group"> | ||
| 60 | <div class="col-sm-12"> | ||
| 61 | <div class="col-sm-3"><label><?php echo $dispo; ?></label></div> | ||
| 62 | <div class="col-sm-6"> | ||
| 63 | <?php $count = 0; | ||
| 64 | $subDisposition = explode(",", $val); | ||
| 65 | if(count($subDisposition) > 0){ | ||
| 66 | foreach ($subDisposition as $key => $value) { | ||
| 67 | if(!empty($value)){ | ||
| 68 | $count++; | ||
| 69 | echo "$count. ".$value. "<br>"; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | } | ||
| 73 | ?> | ||
| 74 | </div> | ||
| 75 | <div class="col-sm-2"><a class="innerAll" href="#" onclick="deleteDesposition('<?php echo $dispo; ?>');"> | ||
| 76 | <span class="btn btn-primary btn-xs"><i class="fa fa-trash-o"></i></span> | ||
| 77 | </a></div> | ||
| 78 | </div> | ||
| 79 | |||
| 80 | </li> | ||
| 81 | <?php }} ?> | ||
| 82 | </ul> | ||
| 83 | </div> | ||
| 84 | </div> | ||
| 85 | </div> | ||
| 86 | |||
| 87 | </div> | ||
| 88 | |||
| 89 | <script> | ||
| 90 | function subDisposition(dispo) | ||
| 91 | { | ||
| 92 | var dispolist = dispo.split(','); | ||
| 93 | /*var dispolist = []; | ||
| 94 | |||
| 95 | $.each( dispo, function( index, value ){ | ||
| 96 | dispolist = $.merge( dispolist, value.split(',') ); | ||
| 97 | });*/ | ||
| 98 | |||
| 99 | $("#subDisposition").select2("val", "Select"); | ||
| 100 | updateJSSelect('subDisposition',dispolist); | ||
| 101 | } | ||
| 102 | |||
| 103 | function deleteDesposition(key) | ||
| 104 | { | ||
| 105 | if (window.confirm('Are sure you want to delete disposition?')) | ||
| 106 | { | ||
| 107 | |||
| 108 | var selectCampaignField = $('#selectCampaignField').val(); | ||
| 109 | var postdata='disposition='+key; | ||
| 110 | postdata+='&selectCampaignField='+selectCampaignField; | ||
| 111 | |||
| 112 | doAjax("campaign/deleteAssignDisposition",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 113 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); | ||
| 114 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 115 | $("#subDisposition").select2("val", "Select"); | ||
| 116 | $('.nav-tabs a[href="#disposition"]').tab('show'); | ||
| 117 | }); | ||
| 118 | |||
| 119 | }); | ||
| 120 | }else{ | ||
| 121 | return false; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | |||
| 125 | $('#assigndesposition').click(function() | ||
| 126 | { | ||
| 127 | $("#error").html(''); | ||
| 128 | var code = $('#disposition').find(':selected').attr('data-id') | ||
| 129 | //var disposition = $("#disposition option:selected").text(); | ||
| 130 | var disposition = $('#disposition').find(':selected').attr('data-text') | ||
| 131 | var subDisposition = $('#subDisposition').val(); | ||
| 132 | var selectCampaignField = $('#selectCampaignField').val(); | ||
| 133 | //alert(selectCampaignField); | ||
| 134 | |||
| 135 | if(disposition&&selectCampaignField) | ||
| 136 | { | ||
| 137 | var postdata='disposition='+disposition; | ||
| 138 | postdata+='&code='+code; | ||
| 139 | postdata+='&disposition='+disposition; | ||
| 140 | postdata+='&subDisposition='+subDisposition; | ||
| 141 | postdata+='&selectCampaignField='+selectCampaignField; | ||
| 142 | doAjax("campaign/assigndisposition",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 143 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); | ||
| 144 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 145 | $("#subDisposition").select2("val", "Select"); | ||
| 146 | $('.nav-tabs a[href="#disposition"]').tab('show'); | ||
| 147 | }); | ||
| 148 | |||
| 149 | }); | ||
| 150 | } | ||
| 151 | else | ||
| 152 | { | ||
| 153 | $("#error").html('<p class="text-danger text-center">Please select the campaign and disposition.</p>'); | ||
| 154 | return false; | ||
| 155 | } | ||
| 156 | }); | ||
| 157 | |||
| 158 | </script> |
| ... | @@ -10,33 +10,26 @@ width:100% | ... | @@ -10,33 +10,26 @@ width:100% |
| 10 | <div class="col-md-12"> | 10 | <div class="col-md-12"> |
| 11 | <div class="panel panel-info"> | 11 | <div class="panel panel-info"> |
| 12 | <div class="panel-body"> | 12 | <div class="panel-body"> |
| 13 | <?php //echo "<pre>";print_r($selectedDispositionPlan); ?> | ||
| 13 | <div class="row" style="margin: 5px"> | 14 | <div class="row" style="margin: 5px"> |
| 14 | <div class="col-md-2"> | 15 | <div class="col-md-2"> |
| 15 | <label>Select Disposition:</label> | 16 | <label>Select Disposition Plan:</label> |
| 16 | </div> | 17 | </div> |
| 17 | <div class="col-md-6"> | 18 | <div class="col-md-6"> |
| 18 | <select id="disposition" class="form-control" onchange='subDisposition($(this).val());'> | 19 | <select id="dispositionPlan" class="form-control" style='width:100%' required=""> |
| 19 | <option value></option> | 20 | <option value>Select Disposition Plan</option> |
| 20 | <?php if(isset($disposition)) | 21 | <?php |
| 21 | foreach($disposition as $kay => $val) | 22 | if(isset($dispositionPlans)) |
| 22 | { | 23 | foreach($dispositionPlans as $kay => $val){ |
| 23 | $code = $dispositionCode[$kay]; | 24 | $sel= ''; |
| 24 | echo "<option data-id='$code' data-text='$kay' value='$val'>$kay</option>"; | 25 | if($val->id == $selectedDispositionPlan->planid)$sel='selected'; |
| 25 | } ?> | 26 | echo "<option value='$val->id' $sel>$val->name</option>"; |
| 27 | } | ||
| 28 | ?> | ||
| 26 | </select> | 29 | </select> |
| 27 | 30 | ||
| 28 | </div> | 31 | </div> |
| 29 | </div> | 32 | </div> |
| 30 | <div class="row" style="margin: 5px"> | ||
| 31 | <div class="col-md-2"> | ||
| 32 | <label>Select Sub Disposition:</label> | ||
| 33 | </div> | ||
| 34 | <div class="col-md-6"> | ||
| 35 | <select id="subDisposition" class="select2multi" style='width:100%' multiple=""> | ||
| 36 | </select> | ||
| 37 | </select> | ||
| 38 | </div> | ||
| 39 | </div> | ||
| 40 | <div class="row"> | 33 | <div class="row"> |
| 41 | <div class="col-md-2"> | 34 | <div class="col-md-2"> |
| 42 | <button id="assigndesposition" class="btn btn-xs btn-info">Assign Disposition | 35 | <button id="assigndesposition" class="btn btn-xs btn-info">Assign Disposition |
| ... | @@ -52,16 +45,17 @@ width:100% | ... | @@ -52,16 +45,17 @@ width:100% |
| 52 | 45 | ||
| 53 | <div class="col-sm-12"> | 46 | <div class="col-sm-12"> |
| 54 | <div class="panel panel-info"> | 47 | <div class="panel panel-info"> |
| 55 | <div class="panel-heading"><strong>Disposition List</strong></div> | 48 | <div class="panel-heading"><strong>Disposition Plan : <?php echo $selectedDispositionPlan->name; ?></strong></div> |
| 56 | <div class="panel-body" id=""> | 49 | <div class="panel-body" id=""> |
| 57 | <ul class="list-group"> | 50 | <ul class="list-group"> |
| 58 | <?php foreach($dispositionList as $key => $val) { if(!empty($val)){ ?> | 51 | <?php |
| 52 | foreach($dispositionList as $key => $val) { ?> | ||
| 59 | <li class="list-group-item list-group"> | 53 | <li class="list-group-item list-group"> |
| 60 | <div class="col-sm-12"> | 54 | <div class="col-sm-12"> |
| 61 | <div class="col-sm-3"><label><?php echo $key; ?></label></div> | 55 | <div class="col-sm-3"><label><?php echo $val->disposition; ?></label></div> |
| 62 | <div class="col-sm-6"> | 56 | <div class="col-sm-4"> |
| 63 | <?php $count = 0; | 57 | <?php $count = 0; |
| 64 | $subDisposition = explode(",", $val); | 58 | $subDisposition = explode(",", $val->subDisposition); |
| 65 | if(count($subDisposition) > 0){ | 59 | if(count($subDisposition) > 0){ |
| 66 | foreach ($subDisposition as $key => $value) { | 60 | foreach ($subDisposition as $key => $value) { |
| 67 | if(!empty($value)){ | 61 | if(!empty($value)){ |
| ... | @@ -72,13 +66,10 @@ width:100% | ... | @@ -72,13 +66,10 @@ width:100% |
| 72 | } | 66 | } |
| 73 | ?> | 67 | ?> |
| 74 | </div> | 68 | </div> |
| 75 | <div class="col-sm-2"><a class="innerAll" href="#" onclick="deleteDesposition('<?php echo $key; ?>');"> | ||
| 76 | <span class="btn btn-primary btn-xs"><i class="fa fa-trash-o"></i></span> | ||
| 77 | </a></div> | ||
| 78 | </div> | 69 | </div> |
| 79 | 70 | ||
| 80 | </li> | 71 | </li> |
| 81 | <?php }} ?> | 72 | <?php } ?> |
| 82 | </ul> | 73 | </ul> |
| 83 | </div> | 74 | </div> |
| 84 | </div> | 75 | </div> |
| ... | @@ -90,12 +81,6 @@ width:100% | ... | @@ -90,12 +81,6 @@ width:100% |
| 90 | function subDisposition(dispo) | 81 | function subDisposition(dispo) |
| 91 | { | 82 | { |
| 92 | var dispolist = dispo.split(','); | 83 | var dispolist = dispo.split(','); |
| 93 | /*var dispolist = []; | ||
| 94 | |||
| 95 | $.each( dispo, function( index, value ){ | ||
| 96 | dispolist = $.merge( dispolist, value.split(',') ); | ||
| 97 | });*/ | ||
| 98 | |||
| 99 | $("#subDisposition").select2("val", "Select"); | 84 | $("#subDisposition").select2("val", "Select"); |
| 100 | updateJSSelect('subDisposition',dispolist); | 85 | updateJSSelect('subDisposition',dispolist); |
| 101 | } | 86 | } |
| ... | @@ -125,32 +110,36 @@ width:100% | ... | @@ -125,32 +110,36 @@ width:100% |
| 125 | $('#assigndesposition').click(function() | 110 | $('#assigndesposition').click(function() |
| 126 | { | 111 | { |
| 127 | $("#error").html(''); | 112 | $("#error").html(''); |
| 128 | var code = $('#disposition').find(':selected').attr('data-id') | 113 | var plan = $('#dispositionPlan').val();//$('#dispositionPlan').find(':selected').text(); |
| 114 | var selectCampaignField = $('#selectCampaignField').val(); | ||
| 115 | |||
| 129 | //var disposition = $("#disposition option:selected").text(); | 116 | //var disposition = $("#disposition option:selected").text(); |
| 130 | var disposition = $('#disposition').find(':selected').attr('data-text') | 117 | /*var disposition = $('#disposition').find(':selected').attr('data-text') |
| 131 | var subDisposition = $('#subDisposition').val(); | 118 | var subDisposition = $('#subDisposition').val(); |
| 132 | var selectCampaignField = $('#selectCampaignField').val(); | 119 | var selectCampaignField = $('#selectCampaignField').val();*/ |
| 133 | //alert(selectCampaignField); | 120 | //alert(selectCampaignField); |
| 134 | 121 | ||
| 135 | if(disposition&&selectCampaignField) | 122 | //if(disposition&&selectCampaignField) |
| 136 | { | 123 | if(plan&&selectCampaignField){ |
| 137 | var postdata='disposition='+disposition; | 124 | var postdata='plan='+plan; |
| 125 | postdata+='&selectCampaignField='+selectCampaignField; | ||
| 126 | /*var postdata='disposition='+disposition; | ||
| 138 | postdata+='&code='+code; | 127 | postdata+='&code='+code; |
| 139 | postdata+='&disposition='+disposition; | 128 | postdata+='&disposition='+disposition; |
| 140 | postdata+='&subDisposition='+subDisposition; | 129 | postdata+='&subDisposition='+subDisposition; |
| 141 | postdata+='&selectCampaignField='+selectCampaignField; | 130 | postdata+='&selectCampaignField='+selectCampaignField;*/ |
| 131 | |||
| 142 | doAjax("campaign/assigndisposition",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | 132 | doAjax("campaign/assigndisposition",postdata,"campaignDetailsArea","","","GET",function(retrstr){ |
| 143 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); | 133 | simpleNotification('Success','topRight',"Campaign assign suceesfully!"); |
| 144 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET",function(retrstr){ | 134 | doAjax("campaign/show","campaign="+selectCampaignField,"campaignDetailsArea","","","GET",function(retrstr){ |
| 145 | $("#subDisposition").select2("val", "Select"); | 135 | $("#subDisposition").select2("val", "Select"); |
| 146 | $('.nav-tabs a[href="#disposition"]').tab('show'); | 136 | $('.nav-tabs a[href="#disposition"]').tab('show'); |
| 147 | }); | 137 | }); |
| 148 | |||
| 149 | }); | 138 | }); |
| 150 | } | 139 | |
| 151 | else | 140 | }else{ |
| 152 | { | 141 | simpleNotification('Error','topRight',"Please select disposition plan!"); |
| 153 | $("#error").html('<p class="text-danger text-center">Please select the campaign and disposition.</p>'); | 142 | $("#error").html('<p class="text-danger text-center">Please select disposition plan.</p>'); |
| 154 | return false; | 143 | return false; |
| 155 | } | 144 | } |
| 156 | }); | 145 | }); | ... | ... |
| 1 | |||
| 2 | <div class="row"> | ||
| 3 | <div class="col-md-12"> | ||
| 4 | <div class="panel panel-info"> | ||
| 5 | <div class="panel-body"> | ||
| 6 | <div class="row" style="margin: 5px"> | ||
| 7 | <p> | ||
| 8 | <div class="col-md-2"> | ||
| 9 | <label><h5>Call Switch:</h5></label> | ||
| 10 | </div> | ||
| 11 | <form> | ||
| 12 | <div class='col-md-2'> | ||
| 13 | <input type=radio id=line_switch2 class='switch-cls' name=line_switch value=open {{$campaignDetails->pri_line=='open'?"checked":""}}><label class='lbl-click'>Open Line</label> | ||
| 14 | </div> | ||
| 15 | <div class='col-md-2'> | ||
| 16 | <input type=radio id=line_switch class='switch-cls' name=line_switch value=non-open {{$campaignDetails->pri_line=='non-open'?"checked":""}}><label class='lbl-click'>140 Line</label> | ||
| 17 | </div> | ||
| 18 | </form> | ||
| 19 | </p> | ||
| 20 | |||
| 21 | </div> | ||
| 22 | </div> | ||
| 23 | </div> | ||
| 24 | </div> | ||
| 25 | </div> | ||
| 26 | <script> | ||
| 27 | $('.switch-cls').click(function(){ | ||
| 28 | if (window.confirm('Are you sure you want to Switch Line?')) | ||
| 29 | { | ||
| 30 | var selected = $("input[name='line_switch']:checked").val(); | ||
| 31 | var campaignField = $('#selectCampaignField').val(); | ||
| 32 | var data = 'select='+selected+'&campaignField='+campaignField; | ||
| 33 | doAjax("campaign/campaignpri",data,"","","","GET",function(retrstr){ | ||
| 34 | simpleNotification('Success','topRight',selected.charAt(0).toUpperCase()+selected.slice(1)+" Line Applied successfully!"); | ||
| 35 | }); | ||
| 36 | |||
| 37 | }else{ | ||
| 38 | return false; | ||
| 39 | } | ||
| 40 | }); | ||
| 41 | /*$('.lbl-click').click(function(){ | ||
| 42 | return false; | ||
| 43 | });*/ | ||
| 44 | /*if(typeof jQuery !='undefined'){ | ||
| 45 | alert(jQuery.fn.jquery); | ||
| 46 | }*/ | ||
| 47 | </script> |
| ... | @@ -28,7 +28,7 @@ | ... | @@ -28,7 +28,7 @@ |
| 28 | $('span').show(); | 28 | $('span').show(); |
| 29 | return false; | 29 | return false; |
| 30 | } | 30 | } |
| 31 | console.log(endtime); | 31 | //console.log(endtime); |
| 32 | if(endtime != "0"){ | 32 | if(endtime != "0"){ |
| 33 | var postdata='selectCampaignField='+selectCampaignField+'&starttime='+starttime+'&endtime='+endtime; | 33 | var postdata='selectCampaignField='+selectCampaignField+'&starttime='+starttime+'&endtime='+endtime; |
| 34 | doAjax("campaign/schedulecampaign",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | 34 | doAjax("campaign/schedulecampaign",postdata,"campaignDetailsArea","","","GET",function(retrstr){ | ... | ... |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i> Add Disposition | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | |||
| 10 | |||
| 11 | <form class="innerAll"> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="code">Code</label> | ||
| 16 | <div class="col-md-8 controls"> | ||
| 17 | <input class="form-control" id="code" type="text" value="" /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group"> | ||
| 22 | <label class="col-md-4 control-label" for="disposition">Disposition</label> | ||
| 23 | <div class="col-md-8 controls"> | ||
| 24 | <input class="form-control" id="disposition" type="text" value="" /> | ||
| 25 | </div> | ||
| 26 | </div> | ||
| 27 | |||
| 28 | |||
| 29 | <div class="control-group"> | ||
| 30 | <label class="col-md-4 control-label" for="subDisposition">Sub Disposition</label> | ||
| 31 | <div class="col-md-8 controls"> | ||
| 32 | <input class="form-control" id="subDisposition" type="text" value="" /> | ||
| 33 | </div> | ||
| 34 | </div> | ||
| 35 | |||
| 36 | <div class="form-actions"> | ||
| 37 | <button type="submit" class="btn btn-primary" onclick='createGroupForm();return false;'>Save changes</button> | ||
| 38 | </div> | ||
| 39 | </fieldset> | ||
| 40 | </form> | ||
| 41 | <script> | ||
| 42 | function createGroupForm() | ||
| 43 | { | ||
| 44 | var putdata="csrftoken={!!Session::token()!!}"; | ||
| 45 | putdata+="&code="+$("#code").val(); | ||
| 46 | putdata+="&disposition="+$("#disposition").val(); | ||
| 47 | putdata+="&subDisposition="+$("#subDisposition").val(); | ||
| 48 | |||
| 49 | /* | ||
| 50 | doAjax('campaign?action=createCampaign',putdata,'campaignformdiv','ajax_group_create','singlethis','POST');*/ | ||
| 51 | |||
| 52 | doAjax('campaign?action=createCampaign',putdata,'campaignformdiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 53 | doAjax("campaign/masters","" ,"campaignDetailsArea","","","GET",function(retrstr){ | ||
| 54 | simpleNotification('Success','topRight',"Disposition created suceesfully!"); | ||
| 55 | |||
| 56 | }); | ||
| 57 | }); | ||
| 58 | |||
| 59 | } | ||
| 60 | </script> |
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | <div class="form-group"> | 16 | <div class="form-group"> |
| 17 | <select class="form-control" id="selectCampaignField" onchange="campaignDetailsShow(this.value);return false;"> | 17 | <select class="form-control" id="selectCampaignField" onchange="campaignDetailsShow(this.value);return false;"> |
| 18 | <option value="">Select Campaign</option> | 18 | <option value="">Select Campaign</option> |
| 19 | <option value="all">All</option> | 19 | <!--<option value="all">All</option>---> |
| 20 | @foreach($campaignList as $campaign) | 20 | @foreach($campaignList as $campaign) |
| 21 | <option value="{{ $campaign->mkey }}">{{ $campaign->mkey }}</option> | 21 | <option value="{{ $campaign->mkey }}">{{ $campaign->mkey }}</option> |
| 22 | @endforeach | 22 | @endforeach | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 4 | |||
| 5 | $inputFileType = "Excel5"; | ||
| 6 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 7 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 8 | $baseRow = 2; | ||
| 9 | |||
| 10 | $objPHPExcel->getActiveSheet()->setCellValue('A1', "12"); | ||
| 11 | |||
| 12 | |||
| 13 | header('Content-Type: application/vnd.ms-excel'); | ||
| 14 | header('Content-Disposition: attachment;filename="Output.xls"'); | ||
| 15 | header('Cache-Control: max-age=0'); | ||
| 16 | |||
| 17 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 18 | $objWriter->save('php://output'); | ||
| 19 | |||
| 20 | return ; | ||
| 21 | |||
| 22 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -28,19 +28,19 @@ | ... | @@ -28,19 +28,19 @@ |
| 28 | </div> | 28 | </div> |
| 29 | 29 | ||
| 30 | <div class="col-sm-4 bot"> | 30 | <div class="col-sm-4 bot"> |
| 31 | <a href="javascript:;" onclick="menuAction("group");return false;" style="color:white;"> | 31 | <a href="javascript:;" onclick="menuAction('disposition');return false;" style="color:white;"> |
| 32 | <div class="new1"> | 32 | <div class="new1"> |
| 33 | <div class="icon"> <i class="fa fa-users"></i></div> | 33 | <div class="icon"> <i class="fa fa-users"></i></div> |
| 34 | Groups | 34 | Disposition List |
| 35 | </div> | 35 | </div> |
| 36 | </a> | 36 | </a> |
| 37 | </div> | 37 | </div> |
| 38 | 38 | ||
| 39 | <div class="col-sm-4 bot"> | 39 | <div class="col-sm-4 bot"> |
| 40 | <a href="javascript:;" onclick="menuAction("role");return false;" style="color:white;"> | 40 | <a href="javascript:;" onclick="menuAction('dispositionPlan');return false;" style="color:white;"> |
| 41 | <div class="new1"> | 41 | <div class="new1"> |
| 42 | <div class="icon"> <i class="fa fa-star"></i></div> | 42 | <div class="icon"> <i class="fa fa-star"></i></div> |
| 43 | Role | 43 | Dispositon Plan |
| 44 | </div> | 44 | </div> |
| 45 | </a> | 45 | </a> |
| 46 | </div> | 46 | </div> | ... | ... |
| ... | @@ -3,14 +3,14 @@ use App\Jobs\KHRMSLib; | ... | @@ -3,14 +3,14 @@ use App\Jobs\KHRMSLib; |
| 3 | use App\Models\CRMCall; | 3 | use App\Models\CRMCall; |
| 4 | 4 | ||
| 5 | $client=Input::get("client"); | 5 | $client=Input::get("client"); |
| 6 | /*$prevData=Input::get("prev"); | 6 | $prevData=Input::get("prev"); |
| 7 | $currentStatus = Input::get("currentStatus"); | 7 | $currentStatus = Input::get("currentStatus"); |
| 8 | $legalStatus = Input::get("legalStatus"); | 8 | $legalStatus = Input::get("legalStatus"); |
| 9 | if($currentStatus==""||$legalStatus==""|| $prevData==""){ | 9 | if($currentStatus==""||$legalStatus==""|| $prevData==""){ |
| 10 | $currentStatus="ACTIVE"; | 10 | $currentStatus="ACTIVE"; |
| 11 | $legalStatus="PRIMARY"; | 11 | $legalStatus="PRIMARY"; |
| 12 | $prevData="MTD"; | 12 | $prevData="MTD"; |
| 13 | }*/ | 13 | } |
| 14 | 14 | ||
| 15 | $wakka=new KHRMSLib(); | 15 | $wakka=new KHRMSLib(); |
| 16 | $dispoclassarr=array('NC'=>array(0,array()),'CC'=>array(0,array()),'CB'=>array(0,array()),'NA'=>array(0,array())); | 16 | $dispoclassarr=array('NC'=>array(0,array()),'CC'=>array(0,array()),'CB'=>array(0,array()),'NA'=>array(0,array())); |
| ... | @@ -31,7 +31,7 @@ use App\Models\CRMCall; | ... | @@ -31,7 +31,7 @@ use App\Models\CRMCall; |
| 31 | $roclientstr=array();$didlinesstr=array();if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; | 31 | $roclientstr=array();$didlinesstr=array();if(Auth::user()->exten!="")$didlinesstr[]=Auth::user()->exten; |
| 32 | 32 | ||
| 33 | $roclientlst=$wakka->clientsReadAccess(); | 33 | $roclientlst=$wakka->clientsReadAccess(); |
| 34 | 34 | //print_r($roclientlst); | |
| 35 | if(!empty($roclientlst))foreach($roclientlst as $tclnt)if($tclnt!="") | 35 | if(!empty($roclientlst))foreach($roclientlst as $tclnt)if($tclnt!="") |
| 36 | { | 36 | { |
| 37 | $roclientstr[]="'$tclnt'"; | 37 | $roclientstr[]="'$tclnt'"; |
| ... | @@ -72,7 +72,7 @@ use App\Models\CRMCall; | ... | @@ -72,7 +72,7 @@ use App\Models\CRMCall; |
| 72 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); | 72 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); |
| 73 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); | 73 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); |
| 74 | 74 | ||
| 75 | /*$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); | 75 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); |
| 76 | 76 | ||
| 77 | $countStatuses = array('New', 'Called'); | 77 | $countStatuses = array('New', 'Called'); |
| 78 | foreach ($countStatuses as $status) { | 78 | foreach ($countStatuses as $status) { |
| ... | @@ -111,7 +111,7 @@ use App\Models\CRMCall; | ... | @@ -111,7 +111,7 @@ use App\Models\CRMCall; |
| 111 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 111 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 112 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 112 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 113 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 113 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 114 | /*$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 114 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') | 117 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') |
| ... | @@ -122,12 +122,12 @@ use App\Models\CRMCall; | ... | @@ -122,12 +122,12 @@ use App\Models\CRMCall; |
| 122 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 122 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 123 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 123 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 124 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 124 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 125 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ | 125 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 126 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ | 126 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ |
| 127 | /*$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 127 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 128 | }*/ | 128 | } |
| 129 | 129 | ||
| 130 | /*if($prevData=='MTD'&&$legalStatus=='SECONDARY') | 130 | if($prevData=='MTD'&&$legalStatus=='SECONDARY') |
| 131 | { | 131 | { |
| 132 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 132 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 133 | 133 | ||
| ... | @@ -137,10 +137,10 @@ use App\Models\CRMCall; | ... | @@ -137,10 +137,10 @@ use App\Models\CRMCall; |
| 137 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 137 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 138 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 138 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 139 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 139 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 140 | /*$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 140 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 141 | }*/ | 141 | } |
| 142 | 142 | ||
| 143 | /*if($prevData=='YTD'&&$legalStatus=='SECONDARY') | 143 | if($prevData=='YTD'&&$legalStatus=='SECONDARY') |
| 144 | { | 144 | { |
| 145 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 145 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 146 | 146 | ||
| ... | @@ -150,7 +150,7 @@ use App\Models\CRMCall; | ... | @@ -150,7 +150,7 @@ use App\Models\CRMCall; |
| 150 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 150 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 151 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 151 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 152 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 152 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 153 | /*$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 153 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | $MissedCalls=0; | 156 | $MissedCalls=0; |
| ... | @@ -202,30 +202,278 @@ use App\Models\CRMCall; | ... | @@ -202,30 +202,278 @@ use App\Models\CRMCall; |
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | $recstoday=$wakka->getCount("records","dialer_lastcall>='".date("Y-m-d 00:00:00")."' $owclientstr"); | 204 | $recstoday=$wakka->getCount("records","dialer_lastcall>='".date("Y-m-d 00:00:00")."' $owclientstr"); |
| 205 | $recsmonth=$wakka->getCount("records","dialer_lastcall>='".date("Y-m-01 00:00:00")."' $owclientstr");*/ | 205 | $recsmonth=$wakka->getCount("records","dialer_lastcall>='".date("Y-m-01 00:00:00")."' $owclientstr"); |
| 206 | |||
| 207 | $user=Auth::user()->id; | ||
| 208 | $role = Auth::user()->usertype; | ||
| 209 | $userId = Auth::user()->id; | ||
| 210 | // role== user | ||
| 211 | // all | ||
| 212 | if($role == 'User'){ | ||
| 213 | |||
| 214 | $TotalCalled=$wakka->getCount("crmcalls","user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 215 | $contactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 216 | |||
| 217 | $calllog = DB::table('records') | ||
| 218 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 219 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 220 | ->where("records.usr_id",$userId) | ||
| 221 | //->where("records.dialer_substatus","Follow Up") | ||
| 222 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | ||
| 223 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 224 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 225 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 226 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 227 | ->get(); | ||
| 228 | |||
| 229 | // campaign | ||
| 230 | $campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 231 | |||
| 232 | $campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 233 | |||
| 234 | $campaignFollowupCount = DB::table('records') | ||
| 235 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 236 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 237 | ->where("records.usr_id",$userId) | ||
| 238 | //->where("records.dialer_substatus","Follow Up") | ||
| 239 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | ||
| 240 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 241 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 242 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 243 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 244 | ->where('records.client', '=', $client) | ||
| 245 | ->get(); | ||
| 246 | |||
| 247 | }else if($role == 'Supervisor'){ | ||
| 248 | //supervisor | ||
| 249 | |||
| 250 | $userName = Auth::user()->username; | ||
| 251 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | ||
| 252 | $userIds = []; | ||
| 253 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | ||
| 254 | $supervisorUsers = implode(",",$userIds); | ||
| 255 | |||
| 256 | $supervisorTotalCalled = 0; | ||
| 257 | $supervisorContacted = 0; | ||
| 258 | $supervisorCallLog = 0; | ||
| 259 | |||
| 260 | $supervisorCampaignTotalCalled = 0; | ||
| 261 | $supervisorCampaignContacted = 0; | ||
| 262 | $supervisorCampaignCallLog = 0; | ||
| 263 | |||
| 264 | |||
| 265 | if(!empty($supervisorUsers)){ | ||
| 266 | // all | ||
| 267 | $supervisorTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 268 | |||
| 269 | $supervisorContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 270 | |||
| 271 | |||
| 272 | $supervisorCallLog = $calllog = DB::table('records') | ||
| 273 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 274 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 275 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 276 | //->where("records.dialer_substatus","Follow Up") | ||
| 277 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | ||
| 278 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 279 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 280 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 281 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 282 | ->get(); | ||
| 283 | |||
| 284 | $supervisorCallLog = count($supervisorCallLog); | ||
| 285 | // campaign | ||
| 286 | |||
| 287 | $supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 288 | |||
| 289 | $supervisorCampaignContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | ||
| 290 | |||
| 291 | |||
| 292 | $supervisorCampaignCallLog = $calllog = DB::table('records') | ||
| 293 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 294 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 295 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 296 | //->where("records.dialer_substatus","Follow Up") | ||
| 297 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | ||
| 298 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 299 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 300 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 301 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 302 | ->where('records.client', '=', $client) | ||
| 303 | ->get(); | ||
| 304 | $supervisorCampaignCallLog = count($supervisorCampaignCallLog); | ||
| 305 | } | ||
| 306 | |||
| 307 | } | ||
| 308 | |||
| 206 | ?> | 309 | ?> |
| 310 | <?php if($role == 'User'){ ?> | ||
| 207 | 311 | ||
| 312 | <div class="container"> | ||
| 208 | 313 | ||
| 209 | <div class=col-md-3> | 314 | <div class="row"> |
| 210 | <div class=col-md-11> | ||
| 211 | <?php if(sizeof($roclientlst)>0){ ?> | 315 | <?php if(sizeof($roclientlst)>0){ ?> |
| 212 | <h5> | 316 | <div class="col-md-1" style="padding: 0px;margin: 6px;"> |
| 213 | Campaign | 317 | <h4>Campaign</h4> |
| 214 | <select class='form-control pull-right' id=tcampaign_select onchange='campaignSelect();' style='width:50%'> | 318 | </div> |
| 215 | <?php foreach($roclientlst as $c){$s="";if($c==$client)$s='selected';echo "<option value='$c' $s>$c</option>";} ?> | 319 | <div class=col-md-5> |
| 320 | <select class='form-control selcls' id=tcampaign_select onchange='campaignSelect();'> | ||
| 321 | <?php $s=""; $i = 0; | ||
| 322 | foreach($roclientlst as $c){ | ||
| 323 | $c=trim($c); | ||
| 324 | if(!empty($c)){ | ||
| 325 | //if($c==$client)$s='selected'; | ||
| 326 | if($i == 0)$s='selected'; | ||
| 327 | echo "<option value='$c' $s>$c</option>"; | ||
| 328 | } | ||
| 329 | } ?> | ||
| 216 | </select> | 330 | </select> |
| 217 | </h5> | 331 | </div> |
| 218 | <br> | 332 | <div class=col-md-5> |
| 219 | <!---<div class=col-md-6> | 333 | <select class=form-control id=data_select onchange='dataSelect();' style='display:none'> |
| 220 | <select class=form-control id=data_select onchange='dataSelect();'> | 334 | <?php foreach($dataSelect as $d){$s="";if($d==$prevData)$s='selected';echo "<option value='$d' $s>$d</option>";} ?> |
| 221 | <?php //foreach($dataSelect as $d){$s="";if($d==$prevData)$s='selected';echo "<option value='$d' $s>$d</option>";} ?> | ||
| 222 | </select> | 335 | </select> |
| 223 | </div> | 336 | </div> |
| 224 | <div style='clear:both'></div> | 337 | <div style='clear:both'></div> |
| 225 | <br> | 338 | <br> |
| 226 | <?php } ?> | 339 | <?php } ?> |
| 340 | </div> | ||
| 341 | |||
| 342 | |||
| 343 | <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | ||
| 344 | |||
| 345 | <div class="row"> | ||
| 346 | <div class="col-sm-4 bot"> | ||
| 347 | <div class="new1" style="color:white;"> | ||
| 348 | <div class="text"> | ||
| 349 | <var><?php echo $TotalCalled; ?></var> | ||
| 350 | </div> | ||
| 351 | Called | ||
| 352 | </div> | ||
| 353 | </div> | ||
| 354 | |||
| 355 | <div class="col-sm-4 bot"> | ||
| 356 | <div class="new1" style="color:white;"> | ||
| 357 | <div class="text"> | ||
| 358 | <var><?php echo $contactedTotalCalled; ?></var> | ||
| 359 | </div> | ||
| 360 | Contacted | ||
| 361 | </div> | ||
| 362 | </div> | ||
| 363 | |||
| 364 | <div class="col-sm-4 bot"> | ||
| 365 | <a href="javascript:;" onclick="loadFollowupData('all');" style="color:white;"> | ||
| 366 | <div class="new1" style="color:white;"> | ||
| 367 | <div class="text"> | ||
| 368 | <var><?php echo count($calllog); ?></var> | ||
| 369 | </div> | ||
| 370 | Follow Up | ||
| 371 | </div> | ||
| 372 | </a> | ||
| 373 | </div> | ||
| 374 | </div> | ||
| 375 | |||
| 376 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> | ||
| 377 | |||
| 378 | <div class="row"> | ||
| 379 | <div class="col-sm-4 bot"> | ||
| 380 | <div class="new1" style="color:white;"> | ||
| 381 | <div class="text"> | ||
| 382 | <var><?php echo $campaignTotalCalled; ?></var> | ||
| 383 | </div> | ||
| 384 | Called | ||
| 385 | </div> | ||
| 386 | </div> | ||
| 387 | |||
| 388 | <div class="col-sm-4 bot"> | ||
| 389 | <div class="new1" style="color:white;"> | ||
| 390 | <div class="text"> | ||
| 391 | <var><?php echo $campaignContactedTotalCalled; ?></var> | ||
| 392 | </div> | ||
| 393 | Contacted | ||
| 394 | </div> | ||
| 395 | </div> | ||
| 396 | |||
| 397 | <div class="col-sm-4 bot"> | ||
| 398 | <a href="javascript:;" onclick="loadFollowupData('campaign');" style="color:white;"> | ||
| 399 | <div class="new1" style="color:white;"> | ||
| 400 | <div class="text"> | ||
| 401 | <var><?php echo count($campaignFollowupCount); ?></var> | ||
| 402 | </div> | ||
| 403 | Follow Up | ||
| 404 | </div> | ||
| 405 | </a> | ||
| 406 | </div> | ||
| 407 | |||
| 408 | </div> | ||
| 409 | <!-- <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | ||
| 410 | <div class="row"> | ||
| 411 | <div class="col-sm-4"> | ||
| 412 | |||
| 413 | <div class="hero-widget well well-sm"> | ||
| 414 | <div class="text"> | ||
| 415 | <var><?php echo $TotalCalled; ?></var> | ||
| 416 | <label class="text-muted">Called</label> | ||
| 417 | </div> | ||
| 418 | </div> | ||
| 419 | </div> | ||
| 420 | <div class="col-sm-4"> | ||
| 421 | <div class="hero-widget well well-sm"> | ||
| 422 | <div class="text"> | ||
| 423 | <var ><?php echo $contactedTotalCalled; ?></var> | ||
| 424 | <label class="text-muted">Contacted</label> | ||
| 425 | </div> | ||
| 426 | </div> | ||
| 427 | </div> | ||
| 428 | <div class="col-sm-4"> | ||
| 429 | <div class="hero-widget well well-sm"> | ||
| 430 | <div class="text"> | ||
| 431 | <var><?php echo count($calllog); ?></var> | ||
| 432 | <label class="text-muted"> | ||
| 433 | <!-- <a href="#" onclick="menuAction('dialer/loadFollowupData');return false;">Follow Up</a>Follow Up | ||
| 434 | </label> | ||
| 435 | </div> | ||
| 436 | </div> | ||
| 437 | </div> | ||
| 227 | 438 | ||
| 228 | <h5> | 439 | </div> |
| 440 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> | ||
| 441 | |||
| 442 | <div class="row"> | ||
| 443 | <div class="col-sm-4"> | ||
| 444 | <div class="hero-widget well well-sm"> | ||
| 445 | <div class="text"> | ||
| 446 | <var><?php echo $campaignTotalCalled; ?></var> | ||
| 447 | <label class="text-muted">Called</label> | ||
| 448 | </div> | ||
| 449 | </div> | ||
| 450 | </div> | ||
| 451 | <div class="col-sm-4"> | ||
| 452 | <div class="hero-widget well well-sm"> | ||
| 453 | <div class="text"> | ||
| 454 | <var ><?php echo $campaignContactedTotalCalled; ?></var> | ||
| 455 | <label class="text-muted">Contacted</label> | ||
| 456 | </div> | ||
| 457 | </div> | ||
| 458 | </div> | ||
| 459 | <div class="col-sm-4"> | ||
| 460 | <div class="hero-widget well well-sm"> | ||
| 461 | <div class="text"> | ||
| 462 | <var><?php echo count($campaignFollowupCount); ?></var> | ||
| 463 | <label class="text-muted"><!-- <a href="#" onclick="menuAction('dialer/loadFollowupData');return false;">Follow Up</a>Follow Up</label> | ||
| 464 | </div> | ||
| 465 | </div> | ||
| 466 | </div> | ||
| 467 | |||
| 468 | |||
| 469 | </div> --> | ||
| 470 | </div> | ||
| 471 | |||
| 472 | |||
| 473 | <div class=col-md-3 style="display: none" > | ||
| 474 | <div class=col-md-11> | ||
| 475 | |||
| 476 | <!-- <h5> | ||
| 229 | Buckets | 477 | Buckets |
| 230 | <span class='label label-small label-default pull-right'> | 478 | <span class='label label-small label-default pull-right'> |
| 231 | <a href=# onclick="dialerLoadData('CallsMonth','','',1,'','');return false;" style='color:#fff;font-size:12px'> | 479 | <a href=# onclick="dialerLoadData('CallsMonth','','',1,'','');return false;" style='color:#fff;font-size:12px'> |
| ... | @@ -240,13 +488,13 @@ use App\Models\CRMCall; | ... | @@ -240,13 +488,13 @@ use App\Models\CRMCall; |
| 240 | 488 | ||
| 241 | </h5> | 489 | </h5> |
| 242 | <div style='clear:both'></div> | 490 | <div style='clear:both'></div> |
| 243 | <hr><br> | 491 | <hr><br>--> |
| 244 | <?php | 492 | <?php |
| 245 | //print_r($legalstatuses); | 493 | //print_r($legalstatuses); |
| 246 | //print_r($currentstatuses); | 494 | //print_r($currentstatuses); |
| 247 | 495 | ||
| 248 | ?> | 496 | ?> |
| 249 | <div class=col-md-6> | 497 | <!-- <div class=col-md-6> |
| 250 | <select class=form-control id=legalstatus_select onchange='bucketSelect();'> | 498 | <select class=form-control id=legalstatus_select onchange='bucketSelect();'> |
| 251 | <option value='PRIMARY'>PRIMARY</option> | 499 | <option value='PRIMARY'>PRIMARY</option> |
| 252 | <option value='SECONDARY'>SECONDARY</option> | 500 | <option value='SECONDARY'>SECONDARY</option> |
| ... | @@ -257,75 +505,83 @@ use App\Models\CRMCall; | ... | @@ -257,75 +505,83 @@ use App\Models\CRMCall; |
| 257 | <option value='ACTIVE'>ACTIVE</option> | 505 | <option value='ACTIVE'>ACTIVE</option> |
| 258 | <option value='PASSIVE'>PASSIVE</option> | 506 | <option value='PASSIVE'>PASSIVE</option> |
| 259 | </select> | 507 | </select> |
| 260 | </div> | 508 | </div> --> |
| 261 | <div style='clear:both'></div> | 509 | <div style='clear:both'></div> |
| 262 | |||
| 263 | <ul style="list-style:none"> | 510 | <ul style="list-style:none"> |
| 264 | <li class="notify_alert"> | 511 | <!-- <li class="notify_alert"> |
| 265 | <span><a href=# onclick="dialerLoadData('CurrentQueue','','',1,'','');return false;">CurrentQueue</a></span>---> | 512 | <span><a href=# onclick="dialerLoadData('CurrentQueue','','',1,'','');return false;">CurrentQueue</a></span> |
| 266 | <!--<span class="label label-small pull-right" > | 513 | <span class="label label-small pull-right" > |
| 267 | 0 | 514 | 0 |
| 268 | </span>--> | 515 | </span> |
| 269 | <!---</li> | 516 | </li> --> |
| 270 | <li class="notify_alert"> | 517 | <!-- <li class="notify_alert"> |
| 271 | <span><a href=# onclick="dialerLoadData('MissedCalls','','',1,'','');return false;">MissedCalls</a></span> | 518 | <span><a href=# onclick="dialerLoadData('MissedCalls','','',1,'','');return false;">MissedCalls</a></span> |
| 272 | <span class="label label-small label-primary pull-right" > | 519 | <span class="label label-small label-primary pull-right" > |
| 273 | {!!$MissedCalls!!} | 520 | {!!$MissedCalls!!} |
| 274 | </span> | 521 | </span> |
| 275 | </li> | 522 | </li> --> |
| 276 | <li class="notify_alert"> | 523 | <!-- <li class="notify_alert"> |
| 277 | <span><a href=# onclick="dialerLoadData('Priority','','',1,'','');return false;">Priority</a></span> | 524 | <span><a href=# onclick="dialerLoadData('Priority','','',1,'','');return false;">Priority</a></span> |
| 278 | <span class="label label-small label-info pull-right" > | 525 | <span class="label label-small label-info pull-right" > |
| 279 | {!!$Priority!!} | 526 | {!!$Priority!!} |
| 280 | </span> | 527 | </span> |
| 528 | </li> --> | ||
| 529 | <li class="notify_alert"> | ||
| 530 | <span><a href=# onclick="dialerLoadData('FollowUp,','','',1,'','');return false;">FollowUp</a></span> | ||
| 531 | <span class="label label-small label-default pull-right" > | ||
| 532 | {!!$FollowUp!!} | ||
| 533 | </span> | ||
| 281 | </li> | 534 | </li> |
| 282 | <li class="notify_alert"> | 535 | <li class="notify_alert"> |
| 283 | <span><a href=# onclick="dialerLoadData('TotalData','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">TotalData</a></span> | 536 | <!-- <span><a href=# onclick="dialerLoadData('TotalData','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">TotalData</a></span> --> |
| 537 | <span>TotalData</span> | ||
| 284 | <span class="label label-small label-default pull-right" > | 538 | <span class="label label-small label-default pull-right" > |
| 285 | {!!$TotalData!!} | 539 | {!!$TotalData!!} |
| 286 | </span> | 540 | </span> |
| 287 | </li> | 541 | </li> |
| 288 | <li class="notify_alert"> | 542 | <!-- <li class="notify_alert"> |
| 289 | <span><a href=# onclick="dialerLoadData('NotCalled','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">NotCalled</a></span> | 543 | <span><a href=# onclick="dialerLoadData('NotCalled','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">NotCalled</a></span> |
| 290 | <span class="label label-small label-default pull-right" > | 544 | <span class="label label-small label-default pull-right" > |
| 291 | {!!$NotCalled!!} | 545 | {!!$NotCalled!!} |
| 292 | </span> | 546 | </span> |
| 293 | </li> | 547 | </li> --> |
| 294 | <li class="notify_alert"> | 548 | <li class="notify_alert"> |
| 295 | <span><a href=# onclick="dialerLoadData('Called','','',1,'','');return false;">Called</a></span> | 549 | <!-- <span><a href=# onclick="dialerLoadData('Called','','',1,'','');return false;">Called</a></span> --> |
| 550 | <span>Called</span> | ||
| 296 | <span class="label label-small label-success pull-right" > | 551 | <span class="label label-small label-success pull-right" > |
| 297 | {!!$TotalCalled!!} | 552 | {!!$TotalCalled!!} |
| 298 | </span> | 553 | </span> |
| 299 | </li> | 554 | </li> |
| 300 | <li class="notify_alert"> | 555 | <li class="notify_alert"> |
| 301 | <span><a href=# onclick="return false;">Contacted</a></span> | 556 | <!-- <span><a href=# onclick="return false;">Contacted</a></span> --> |
| 557 | <span>Contacted</span> | ||
| 302 | <span class="label label-small label-success pull-right" id=contactedcnt_span> | 558 | <span class="label label-small label-success pull-right" id=contactedcnt_span> |
| 303 | 0 | 559 | 0 |
| 304 | </span> | 560 | </span> |
| 305 | </li> | 561 | </li> |
| 306 | <li class="notify_alert"> | 562 | <!-- <li class="notify_alert"> |
| 307 | <span><a href=# onclick="dialerLoadData('Flagged-Called','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Flagged-Called</a></span> | 563 | <span><a href=# onclick="dialerLoadData('Flagged-Called','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Flagged-Called</a></span> |
| 308 | <span class="label label-small label-success pull-right" > | 564 | <span class="label label-small label-success pull-right" > |
| 309 | {!!$Flagged!!} | 565 | {!!$Flagged!!} |
| 310 | </span> | 566 | </span> |
| 311 | </li> | 567 | </li> --> |
| 312 | <li class="notify_alert"> | 568 | <!-- <li class="notify_alert"> |
| 313 | <span><a href=# onclick="dialerLoadData('Flagged-Notcalled','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Flagged-NotCalled</a></span> | 569 | <span><a href=# onclick="dialerLoadData('Flagged-Notcalled','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Flagged-NotCalled</a></span> |
| 314 | <span class="label label-small label-warning pull-right" > | 570 | <span class="label label-small label-warning pull-right" > |
| 315 | {!!$NotCalledFlagged!!} | 571 | {!!$NotCalledFlagged!!} |
| 316 | </span> | 572 | </span> |
| 317 | </li> | 573 | </li> --> |
| 318 | <li class="notify_alert"> | 574 | <!-- <li class="notify_alert"> |
| 319 | <span><a href=# onclick="dialerLoadData('today-birthday','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Today Birthday</a></span> | 575 | <span><a href=# onclick="dialerLoadData('today-birthday','{!!$currentStatus!!}','{!!$legalStatus!!}',1,'','');return false;">Today Birthday</a></span> |
| 320 | <span class="label label-small label-warning pull-right" > | 576 | <span class="label label-small label-warning pull-right" > |
| 321 | {!!$todaybirthday!!} | 577 | {!!$todaybirthday!!} |
| 322 | </span> | 578 | </span> |
| 323 | </li> | 579 | </li> --> |
| 324 | 580 | ||
| 325 | <hr><br>---> | 581 | <hr><br> |
| 326 | 582 | ||
| 327 | <?php | 583 | <?php |
| 328 | /*if($prevData=='' ||$prevData=='MTD') | 584 | if($prevData=='' ||$prevData=='MTD') |
| 329 | { | 585 | { |
| 330 | foreach($dispoarr as $disp) { | 586 | foreach($dispoarr as $disp) { |
| 331 | 587 | ||
| ... | @@ -342,7 +598,7 @@ use App\Models\CRMCall; | ... | @@ -342,7 +598,7 @@ use App\Models\CRMCall; |
| 342 | if($disp['dialer_status']) | 598 | if($disp['dialer_status']) |
| 343 | { | 599 | { |
| 344 | ?> | 600 | ?> |
| 345 | <li class="notify_alert bucketliitem {!!$class!!}"> | 601 | <li class="notify_alert bucketliitem sdfsdf {!!$class!!}"> |
| 346 | <span><a href=# onclick="dialerLoadData('{!!$disp['dialer_status']!!}','{!!$disp['currentstatus']!!}','{!!$disp['legalstatus']!!}',1,'','');return false;">{!!$disp['dialer_status']!!}</a></span> | 602 | <span><a href=# onclick="dialerLoadData('{!!$disp['dialer_status']!!}','{!!$disp['currentstatus']!!}','{!!$disp['legalstatus']!!}',1,'','');return false;">{!!$disp['dialer_status']!!}</a></span> |
| 347 | <span class="label label-small label-success pull-right" > | 603 | <span class="label label-small label-success pull-right" > |
| 348 | {!!$disp['cnt']!!} | 604 | {!!$disp['cnt']!!} |
| ... | @@ -369,7 +625,7 @@ use App\Models\CRMCall; | ... | @@ -369,7 +625,7 @@ use App\Models\CRMCall; |
| 369 | if($disp['old_dialer_status']) | 625 | if($disp['old_dialer_status']) |
| 370 | { | 626 | { |
| 371 | ?> | 627 | ?> |
| 372 | <li class="notify_alert bucketliitem {!!$class!!}"> | 628 | <li class="notify_alert bucketliitem test {!!$class!!}"> |
| 373 | <span><a href=# onclick="dialerLoadData('{!!$disp['old_dialer_status']!!}','{!!$disp['currentstatus']!!}','{!!$disp['legalstatus']!!}',1,'','');return false;">{!!$disp['old_dialer_status']!!}</a></span> | 629 | <span><a href=# onclick="dialerLoadData('{!!$disp['old_dialer_status']!!}','{!!$disp['currentstatus']!!}','{!!$disp['legalstatus']!!}',1,'','');return false;">{!!$disp['old_dialer_status']!!}</a></span> |
| 374 | <span class="label label-small label-success pull-right" > | 630 | <span class="label label-small label-success pull-right" > |
| 375 | {!!$disp['cnt']!!} | 631 | {!!$disp['cnt']!!} |
| ... | @@ -382,16 +638,22 @@ use App\Models\CRMCall; | ... | @@ -382,16 +638,22 @@ use App\Models\CRMCall; |
| 382 | } | 638 | } |
| 383 | 639 | ||
| 384 | $contacted=$dispoclassarr['CC'][0]+$dispoclassarr['CB'][0]+$dispoclassarr['NC'][0]; | 640 | $contacted=$dispoclassarr['CC'][0]+$dispoclassarr['CB'][0]+$dispoclassarr['NC'][0]; |
| 385 | echo "<script>$('#contactedcnt_span').html('$contacted');</script>";*/ | 641 | echo "<script>$('#contactedcnt_span').html('$contacted');</script>"; |
| 386 | ?> | 642 | ?> |
| 387 | <!-- </ul> | 643 | </ul> |
| 388 | </div> | ||
| 389 | </div> | ||
| 390 | <div class=col-md-9 id=bucketlistdiv>--- --> | ||
| 391 | </div> | 644 | </div> |
| 392 | <div style='clear:both'></div> | 645 | </div> |
| 646 | <!-- <div class=col-md-9 id=bucketlistdiv></div> | ||
| 647 | --><div style='clear:both'></div> | ||
| 648 | <?php }else if($role == 'Admin'){ ?> | ||
| 649 | |||
| 650 | @include("layout/module/dashboard/adminHomePage") | ||
| 651 | |||
| 652 | <?php }else if($role == 'Supervisor'){ ?> | ||
| 393 | 653 | ||
| 654 | @include("layout/module/dashboard/supervisorHomePage") | ||
| 394 | 655 | ||
| 656 | <?php } ?> | ||
| 395 | 657 | ||
| 396 | <script> | 658 | <script> |
| 397 | 659 | ||
| ... | @@ -399,25 +661,32 @@ use App\Models\CRMCall; | ... | @@ -399,25 +661,32 @@ use App\Models\CRMCall; |
| 399 | $("#tcampaign_select").val('<?=$client?>'); | 661 | $("#tcampaign_select").val('<?=$client?>'); |
| 400 | <?php }?> | 662 | <?php }?> |
| 401 | 663 | ||
| 402 | <?php //if($prevData){ ?> | 664 | <?php if($prevData){ ?> |
| 403 | //$("#data_select").val('<?=$prevData?>'); | 665 | $("#data_select").val('<?=$prevData?>'); |
| 404 | <?php //}?> | 666 | <?php }?> |
| 405 | 667 | ||
| 406 | <?php //if($legalStatus){ ?> | 668 | <?php if($legalStatus){ ?> |
| 407 | //$("#legalstatus_select").val('<?=$legalStatus?>'); | 669 | $("#legalstatus_select").val('<?=$legalStatus?>'); |
| 408 | <?php //}?> | 670 | <?php }?> |
| 409 | 671 | ||
| 410 | <?php if($currentStatus){ ?> | 672 | <?php if($currentStatus){ ?> |
| 411 | $("#currentstatus_select").val('<?=$currentStatus?>'); | 673 | $("#currentstatus_select").val('<?=$currentStatus?>'); |
| 412 | <?php }?> | 674 | <?php }?> |
| 413 | 675 | ||
| 676 | function loadFollowupData(val) | ||
| 677 | { | ||
| 678 | var menu = "dialer/loadFollowupData"; | ||
| 679 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); | ||
| 680 | } | ||
| 681 | |||
| 682 | |||
| 414 | function campaignSelect() | 683 | function campaignSelect() |
| 415 | { | 684 | { |
| 416 | var dashlet="Dialer"; | 685 | var dashlet="Dialer"; |
| 417 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 686 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 418 | } | 687 | } |
| 419 | 688 | ||
| 420 | /*function dataSelect() | 689 | function dataSelect() |
| 421 | { | 690 | { |
| 422 | var currentStatus = $('#currentstatus_select').val(); | 691 | var currentStatus = $('#currentstatus_select').val(); |
| 423 | var legalStatus = $('#legalstatus_select').val(); | 692 | var legalStatus = $('#legalstatus_select').val(); |
| ... | @@ -427,13 +696,13 @@ function campaignSelect() | ... | @@ -427,13 +696,13 @@ function campaignSelect() |
| 427 | var dashlet="Dialer"; | 696 | var dashlet="Dialer"; |
| 428 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 697 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 429 | } | 698 | } |
| 430 | */ | 699 | |
| 431 | function bucketSelect() | 700 | function bucketSelect() |
| 432 | { | 701 | { |
| 433 | /*var activeclass='CLS_'+$('#currentstatus_select').val()+$('#legalstatus_select').val(); | 702 | /*var activeclass='CLS_'+$('#currentstatus_select').val()+$('#legalstatus_select').val(); |
| 434 | $('.bucketliitem').hide(); | 703 | $('.bucketliitem').hide(); |
| 435 | $('.'+activeclass).show();*/ | 704 | $('.'+activeclass).show();*/ |
| 436 | /*var currentStatus = $('#currentstatus_select').val(); | 705 | var currentStatus = $('#currentstatus_select').val(); |
| 437 | var legalStatus = $('#legalstatus_select').val(); | 706 | var legalStatus = $('#legalstatus_select').val(); |
| 438 | var prev = $("#data_select").val(); | 707 | var prev = $("#data_select").val(); |
| 439 | var client = $("#tcampaign_select").val(); | 708 | var client = $("#tcampaign_select").val(); |
| ... | @@ -441,14 +710,58 @@ function bucketSelect() | ... | @@ -441,14 +710,58 @@ function bucketSelect() |
| 441 | var dashlet="Dialer"; | 710 | var dashlet="Dialer"; |
| 442 | 711 | ||
| 443 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 712 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 444 | }*/ | ||
| 445 | } | 713 | } |
| 446 | //bucketSelect(); | 714 | //bucketSelect(); |
| 447 | 715 | ||
| 448 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) | 716 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) |
| 449 | { | 717 | { |
| 450 | 718 | ||
| 451 | //doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); | 719 | doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); |
| 452 | } | 720 | } |
| 453 | dialerLoadData('CurrentQueue','','',1,'',''); | 721 | dialerLoadData('CurrentQueue','','',1,'',''); |
| 454 | </script> | 722 | </script> |
| 723 | <style> | ||
| 724 | .hero-widget { text-align: center; padding-top: 20px; padding-bottom: 20px; text-shadow: 1px 1px 2px blue, 0 0 25px blue, 0 0 5px darkblue; } | ||
| 725 | .hero-widget .icon { display: block; font-size: 96px; line-height: 96px; margin-bottom: 10px; text-align: center; } | ||
| 726 | .hero-widget var { display: block; height: 64px; font-size: 64px; line-height: 64px; font-style: normal; } | ||
| 727 | .hero-widget label { font-size: 17px; } | ||
| 728 | .hero-widget .options { margin-top: 10px; } | ||
| 729 | .well { background-color : #040404 } | ||
| 730 | .acolor { color: #000000;} | ||
| 731 | |||
| 732 | .new1 .icon { display: block; font-size: 96px; line-height: 96px; margin-bottom: 10px; text-align: center; } | ||
| 733 | |||
| 734 | .bot { padding-bottom: 20px !important; } | ||
| 735 | .new1 var { display: block; height: 96px; font-size: 96px; line-height: 96px; font-style: normal; } | ||
| 736 | </style> | ||
| 737 | |||
| 738 | |||
| 739 | <style> | ||
| 740 | .new1 { | ||
| 741 | /*width: 200px; | ||
| 742 | height: auto;*/ | ||
| 743 | padding: 15px; | ||
| 744 | background-color: #f6f7fb; | ||
| 745 | box-shadow: 10px 10px 5px grey; | ||
| 746 | font-size:30px; | ||
| 747 | border: 2px solid red; | ||
| 748 | border-radius: 50px 20px; | ||
| 749 | text-align: center; | ||
| 750 | |||
| 751 | /* text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;*/ | ||
| 752 | text-shadow: 1px 1px 2px blue, 0 0 25px blue, 0 0 5px darkblue; | ||
| 753 | } | ||
| 754 | |||
| 755 | .selcls { | ||
| 756 | /* padding: 9px; */ | ||
| 757 | border: solid 1px #517B97; | ||
| 758 | outline: 0; | ||
| 759 | background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #CAD9E3), to(#FFFFFF)); | ||
| 760 | background: -moz-linear-gradient(top, #FFFFFF, #CAD9E3 1px, #FFFFFF 25px); | ||
| 761 | box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | ||
| 762 | -moz-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | ||
| 763 | -webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px; | ||
| 764 | |||
| 765 | } | ||
| 766 | |||
| 767 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -40,12 +40,14 @@ use App\Models\CRMCall; | ... | @@ -40,12 +40,14 @@ use App\Models\CRMCall; |
| 40 | $mastersdata=$wakka->getCompanyMaster($tclnt); | 40 | $mastersdata=$wakka->getCompanyMaster($tclnt); |
| 41 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | 41 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; |
| 42 | 42 | ||
| 43 | 43 | $dispoarr = []; | |
| 44 | if(empty($mastersdata['dialerDispoList']))$mastersdata['dialerDispoList']=$wakka->HRCoreVars['dialerDispoList']; | 44 | if(!empty($mastersdata['dialerDispoList'])){ |
| 45 | 45 | // $mastersdata['dialerDispoList']=$wakka->HRCoreVars['dialerDispoList']; | |
| 46 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); | 46 | $dispoarr=explode("~",$mastersdata['dialerDispoList']); |
| 47 | foreach($dispoarr as $dispo) | 47 | } |
| 48 | { | 48 | |
| 49 | if(count($dispoarr) > 0){ | ||
| 50 | foreach($dispoarr as $dispo){ | ||
| 49 | if(!empty($dispo)) | 51 | if(!empty($dispo)) |
| 50 | { | 52 | { |
| 51 | $dispoprts=explode("|",$dispo); | 53 | $dispoprts=explode("|",$dispo); |
| ... | @@ -58,6 +60,15 @@ use App\Models\CRMCall; | ... | @@ -58,6 +60,15 @@ use App\Models\CRMCall; |
| 58 | } | 60 | } |
| 59 | } | 61 | } |
| 60 | } | 62 | } |
| 63 | }else{ | ||
| 64 | $dispositionPlan = $wakka->getDispositionList(); | ||
| 65 | foreach ($dispositionPlan as $key => $value) { | ||
| 66 | $disposition = $value->disposition; | ||
| 67 | $subDisposition = $value->sunDispoName; | ||
| 68 | $data.="dialerdispoarray['$disposition']='$subDisposition';"; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 61 | } | 72 | } |
| 62 | foreach($didlinesstr as $k=>$dids) | 73 | foreach($didlinesstr as $k=>$dids) |
| 63 | { | 74 | { |
| ... | @@ -72,7 +83,7 @@ use App\Models\CRMCall; | ... | @@ -72,7 +83,7 @@ use App\Models\CRMCall; |
| 72 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); | 83 | //$currentstatuses=$wakka->LoadAll("select distinct currentstatus from records where currentstatus!='' $owclientstr"); |
| 73 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); | 84 | //$legalstatuses=$wakka->LoadAll("select distinct legalstatus from records where legalstatus!='' $owclientstr"); |
| 74 | 85 | ||
| 75 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); | 86 | //$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status"); |
| 76 | 87 | ||
| 77 | $countStatuses = array('New', 'Called'); | 88 | $countStatuses = array('New', 'Called'); |
| 78 | foreach ($countStatuses as $status) { | 89 | foreach ($countStatuses as $status) { |
| ... | @@ -103,59 +114,59 @@ use App\Models\CRMCall; | ... | @@ -103,59 +114,59 @@ use App\Models\CRMCall; |
| 103 | 114 | ||
| 104 | if($prevData=='MTD'&&$legalStatus!='SECONDARY') | 115 | if($prevData=='MTD'&&$legalStatus!='SECONDARY') |
| 105 | { | 116 | { |
| 106 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 117 | //$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 107 | 118 | ||
| 108 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 119 | //$TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 109 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 120 | //$NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 110 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 121 | //$TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 111 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 122 | //$Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 112 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 123 | //$Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 113 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 124 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 114 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 125 | //$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 115 | } | 126 | } |
| 116 | 127 | ||
| 117 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') | 128 | if($prevData=='YTD'&&$legalStatus!='SECONDARY') |
| 118 | { | 129 | { |
| 119 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status"); | 130 | /*$ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status"); |
| 120 | 131 | ||
| 121 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 132 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 122 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 133 | $NotCalled=$wakka->getCount("records","old_status='New' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 123 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 134 | $TotalCalled=$wakka->getCount("records","old_status='Called' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 124 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 135 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 125 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 136 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ |
| 126 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ | 137 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr");*/ |
| 127 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 138 | //$NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 128 | } | 139 | } |
| 129 | 140 | ||
| 130 | if($prevData=='MTD'&&$legalStatus=='SECONDARY') | 141 | if($prevData=='MTD'&&$legalStatus=='SECONDARY') |
| 131 | { | 142 | { |
| 132 | $dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 143 | /*$dispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 133 | 144 | ||
| 134 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 145 | $TotalData=$wakka->getCount("records","status IN ('New', 'Called','Noqueue') and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 135 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 146 | $NotCalled=$wakka->getCount("records","status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 136 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 147 | $TotalCalled=$wakka->getCount("records","status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 137 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 148 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 138 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 149 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 139 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 150 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 140 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 151 | // $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 141 | } | 152 | } |
| 142 | 153 | ||
| 143 | if($prevData=='YTD'&&$legalStatus=='SECONDARY') | 154 | if($prevData=='YTD'&&$legalStatus=='SECONDARY') |
| 144 | { | 155 | { |
| 145 | $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); | 156 | /* $ydispoarr=$wakka->LoadAll("select count(*) as cnt,currentstatus,legalstatus,old_dialer_status from records where 1=1 $owclientstr group by currentstatus,legalstatus,old_dialer_status having legalstatus='$legalStatus' and currentstatus='$currentStatus'"); |
| 146 | 157 | ||
| 147 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); | 158 | $TotalData=$wakka->getCount("records","old_status IN ('New', 'Called','Noqueue') and currentstatus='$currentStatus' and legalstatus='$legalStatus' $owclientstr"); |
| 148 | $NotCalled=$wakka->getCount("records","old_status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 159 | $NotCalled=$wakka->getCount("records","old_status='New' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 149 | $TotalCalled=$wakka->getCount("records","old_status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 160 | $TotalCalled=$wakka->getCount("records","old_status='Called' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 150 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 161 | $Priority=$wakka->getCount("records","priority in (1,2,3,4,5,6,7,8,9,10) and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 151 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 162 | $Flagged=$wakka->getCount("records","dialer_flag='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); |
| 152 | /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ | 163 | */ /*$NotCalledFlagged=$wakka->getCount("records"," priority='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 153 | $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr"); | 164 | /* $NotCalledFlagged=$wakka->getCount("records"," mf_isa='VIP' and (currentstatus='$currentStatus' and legalstatus='$legalStatus') $owclientstr");*/ |
| 154 | } | 165 | } |
| 155 | 166 | ||
| 156 | $MissedCalls=0; | 167 | $MissedCalls=0; |
| 157 | 168 | ||
| 158 | $udidlinesstr = array(); | 169 | /*$udidlinesstr = array(); |
| 159 | foreach($didlinesstr as $didlinestr){ | 170 | foreach($didlinesstr as $didlinestr){ |
| 160 | $didlinestrArr=explode(":",$didlinestr); | 171 | $didlinestrArr=explode(":",$didlinestr); |
| 161 | $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber')); | 172 | $udidlinesstr[] = substr($didlinestrArr[0], env('didnumber')); |
| ... | @@ -164,8 +175,8 @@ use App\Models\CRMCall; | ... | @@ -164,8 +175,8 @@ use App\Models\CRMCall; |
| 164 | $mc=CRMCall::where('userstatus','=','InboundDROP')->where('created_at','>','2018-09-11 00:00:00')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); | 175 | $mc=CRMCall::where('userstatus','=','InboundDROP')->where('created_at','>','2018-09-11 00:00:00')->where('created_at','>',date('Y-m-d H:i:s',time()-(7*24*60*60))); |
| 165 | $mc=$mc->where(function ($query) use($roclientlst,$udidlinesstr){ | 176 | $mc=$mc->where(function ($query) use($roclientlst,$udidlinesstr){ |
| 166 | $query->orWhereIn('client',$roclientlst)->orWhereIn('did',$udidlinesstr); | 177 | $query->orWhereIn('client',$roclientlst)->orWhereIn('did',$udidlinesstr); |
| 167 | }); | 178 | });*/ |
| 168 | $mc=$mc->get(); | 179 | /* $mc=$mc->get(); |
| 169 | 180 | ||
| 170 | $number_list=array(); | 181 | $number_list=array(); |
| 171 | foreach($mc as $key=>$tcall) | 182 | foreach($mc as $key=>$tcall) |
| ... | @@ -195,7 +206,7 @@ use App\Models\CRMCall; | ... | @@ -195,7 +206,7 @@ use App\Models\CRMCall; |
| 195 | $MissedCalls++; | 206 | $MissedCalls++; |
| 196 | } | 207 | } |
| 197 | } | 208 | } |
| 198 | } | 209 | }*/ |
| 199 | 210 | ||
| 200 | $callstoday=CRMCall::where("created_at",">=",date("Y-m-d 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); | 211 | $callstoday=CRMCall::where("created_at",">=",date("Y-m-d 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); |
| 201 | $callsmonth=CRMCall::where("created_at",">=",date("Y-m-01 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); | 212 | $callsmonth=CRMCall::where("created_at",">=",date("Y-m-01 00:00:00"))->where("user_id","=",Auth::user()->id)->count(); |
| ... | @@ -210,38 +221,50 @@ use App\Models\CRMCall; | ... | @@ -210,38 +221,50 @@ use App\Models\CRMCall; |
| 210 | // role== user | 221 | // role== user |
| 211 | // all | 222 | // all |
| 212 | if($role == 'User'){ | 223 | if($role == 'User'){ |
| 224 | $TotalCalled= 0; | ||
| 225 | $contactedTotalCalled=0; | ||
| 226 | $calllog = []; | ||
| 227 | $campaignTotalCalled=0; | ||
| 228 | $campaignContactedTotalCalled=0; | ||
| 229 | $campaignFollowupCount = []; | ||
| 230 | $totalAppointmentCount = []; | ||
| 231 | $campaignAppointmentCount = []; | ||
| 232 | |||
| 213 | 233 | ||
| 214 | $TotalCalled=$wakka->getCount("crmcalls","user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | 234 | //$TotalCalled=$wakka->getCount("crmcalls","user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 215 | $contactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); | 235 | $contactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 216 | 236 | ||
| 217 | $calllog = DB::table('records') | 237 | $calllog = DB::table('records') |
| 218 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 238 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 219 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 239 | ->where("usr_id",$userId) |
| 220 | ->where("records.usr_id",$userId) | 240 | ->where("dialer_callback", "!=","0000-00-00 00:00:00") |
| 221 | //->where("records.dialer_substatus","Follow Up") | 241 | ->get(); |
| 222 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 242 | |
| 223 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | 243 | $totalAppointmentCount = DB::table('records') |
| 224 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | 244 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') |
| 225 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | 245 | ->where("usr_id",$userId) |
| 226 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | 246 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") |
| 247 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 227 | ->get(); | 248 | ->get(); |
| 228 | 249 | ||
| 229 | // campaign | 250 | // campaign |
| 230 | $campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 251 | //$campaignTotalCalled=$wakka->getCount("crmcalls","user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 231 | 252 | ||
| 232 | $campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 253 | $campaignContactedTotalCalled=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id = $userId and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 233 | 254 | ||
| 234 | $campaignFollowupCount = DB::table('records') | 255 | $campaignFollowupCount = DB::table('records') |
| 235 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | 256 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_callback', 'status','dialer_lastcall','id','dialer_status','client') |
| 236 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 257 | ->where("usr_id",$userId) |
| 237 | ->where("records.usr_id",$userId) | 258 | ->where("dialer_callback", "!=","0000-00-00 00:00:00") |
| 238 | //->where("records.dialer_substatus","Follow Up") | 259 | ->where('client', '=', $client) |
| 239 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 260 | ->get(); |
| 240 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | 261 | |
| 241 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | 262 | $campaignAppointmentCount = DB::table('records') |
| 242 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | 263 | ->select('customer_name', 'cust_id', 'mobile', 'dialer_appointment', 'status','dialer_lastcall','id','dialer_status','client') |
| 243 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | 264 | ->where("usr_id",$userId) |
| 244 | ->where('records.client', '=', $client) | 265 | ->where("dialer_appointment", "!=","0000-00-00 00:00:00") |
| 266 | ->where('client', '=', $client) | ||
| 267 | ->where('dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 245 | ->get(); | 268 | ->get(); |
| 246 | 269 | ||
| 247 | }else if($role == 'Supervisor'){ | 270 | }else if($role == 'Supervisor'){ |
| ... | @@ -250,16 +273,20 @@ use App\Models\CRMCall; | ... | @@ -250,16 +273,20 @@ use App\Models\CRMCall; |
| 250 | $userName = Auth::user()->username; | 273 | $userName = Auth::user()->username; |
| 251 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); | 274 | $supervisorUsers=$wakka->LoadAll("select id from users where supervisor='$userName';"); |
| 252 | $userIds = []; | 275 | $userIds = []; |
| 276 | //print_r($supervisorUsers); | ||
| 253 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; | 277 | foreach ($supervisorUsers as $key => $value) $userIds[] = "'".$value['id']."'"; |
| 254 | $supervisorUsers = implode(",",$userIds); | 278 | $supervisorUsers = implode(",",$userIds); |
| 255 | 279 | ||
| 256 | $supervisorTotalCalled = 0; | 280 | $supervisorTotalCalled = 0; |
| 257 | $supervisorContacted = 0; | 281 | $supervisorContacted = 0; |
| 258 | $supervisorCallLog = 0; | 282 | $supervisorCallLog = 0; |
| 283 | $supervisorAppointmentCount = 0; | ||
| 284 | |||
| 259 | 285 | ||
| 260 | $supervisorCampaignTotalCalled = 0; | 286 | $supervisorCampaignTotalCalled = 0; |
| 261 | $supervisorCampaignContacted = 0; | 287 | $supervisorCampaignContacted = 0; |
| 262 | $supervisorCampaignCallLog = 0; | 288 | $supervisorCampaignCallLog = 0; |
| 289 | $supervisorcampaignAppointCount = 0; | ||
| 263 | 290 | ||
| 264 | 291 | ||
| 265 | if(!empty($supervisorUsers)){ | 292 | if(!empty($supervisorUsers)){ |
| ... | @@ -269,39 +296,55 @@ use App\Models\CRMCall; | ... | @@ -269,39 +296,55 @@ use App\Models\CRMCall; |
| 269 | $supervisorContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and created_at > '".date("Y-m-d 03:00:00")."'"); | 296 | $supervisorContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 270 | 297 | ||
| 271 | 298 | ||
| 299 | /* $supervisorUsers = explode(',',$supervisorUsers); | ||
| 300 | $supervisorUsers = implode(',',$supervisorUsers); | ||
| 272 | $supervisorCallLog = $calllog = DB::table('records') | 301 | $supervisorCallLog = $calllog = DB::table('records') |
| 273 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 274 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 302 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') |
| 275 | ->whereIn("records.usr_id",[$supervisorUsers]) | 303 | ->whereIn('recordss.usr_id',[$supervisorUsers]) |
| 276 | //->where("records.dialer_substatus","Follow Up") | 304 | ->where('records.dialer_callback', '!=','0000-00-00 00:00:00') |
| 277 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 305 | ->get();*/ |
| 278 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | 306 | |
| 279 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | 307 | $supervisorCallLog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00'"); |
| 280 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 281 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 282 | ->get(); | ||
| 283 | 308 | ||
| 284 | $supervisorCallLog = count($supervisorCallLog); | 309 | $supervisorCallLog = count($supervisorCallLog); |
| 310 | |||
| 311 | /*$supervisorAppointmentCount = DB::table('records') | ||
| 312 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_appointment', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 313 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 314 | //->where("records.dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 315 | ->where('records.dialer_appointment','>',date('Y-m-d H:i:s',time()-(7*24*60*60))) | ||
| 316 | ->get();*/ | ||
| 317 | $supervisorAppointmentCount = DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"'); | ||
| 318 | //print_r($supervisorAppointmentCount); | ||
| 319 | $supervisorAppointmentCount = count($supervisorAppointmentCount); | ||
| 285 | // campaign | 320 | // campaign |
| 286 | 321 | ||
| 287 | $supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 322 | $supervisorCampaignTotalCalled=$wakka->getCount("crmcalls","user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 288 | 323 | //print_r($supervisorCampaignTotalCalled); | |
| 289 | $supervisorCampaignContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); | 324 | $supervisorCampaignContacted=$wakka->getCount("crmcalls","userstatus='Contacted' and user_id IN ($supervisorUsers) and client = '$client' and created_at > '".date("Y-m-d 03:00:00")."'"); |
| 290 | 325 | ||
| 291 | 326 | ||
| 292 | $supervisorCampaignCallLog = $calllog = DB::table('records') | 327 | /* $supervisorCampaignCallLog = $calllog = DB::table('records') |
| 293 | //->join('crmcalls', 'records.dialer_callback', '=', 'crmcalls.usercallback') | ||
| 294 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | 328 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_callback', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') |
| 295 | ->whereIn("records.usr_id",[$supervisorUsers]) | 329 | ->whereIn("records.usr_id",[$supervisorUsers]) |
| 296 | //->where("records.dialer_substatus","Follow Up") | ||
| 297 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") | 330 | ->where("records.dialer_callback", "!=","0000-00-00 00:00:00") |
| 298 | //->where("crmcalls.usercallback", "!=","0000-00-00 00:00:00") | ||
| 299 | //->where("crmcalls.created_at", ">",date("Y-m-d 08:00:00")) | ||
| 300 | //->where("crmcalls_archive.usercallback", "=","records.dialer_callback") | ||
| 301 | //->where("records.dialer_lastcall", "<=","crmcalls_archive.usercallback") | ||
| 302 | ->where('records.client', '=', $client) | 331 | ->where('records.client', '=', $client) |
| 303 | ->get(); | 332 | ->get();*/ |
| 333 | $supervisorCampaignCallLog = $calllog = DB::select("select records.customer_name, records.cust_id, records.mobile, records.dialer_callback, records.status,records.dialer_lastcall,records.id,records.dialer_status,records.client from records where usr_id in (".$supervisorUsers.") and records.dialer_callback !='0000-00-00 00:00:00' and records.client ='$client'"); | ||
| 334 | |||
| 335 | //print_r( $supervisorCampaignCallLog); | ||
| 304 | $supervisorCampaignCallLog = count($supervisorCampaignCallLog); | 336 | $supervisorCampaignCallLog = count($supervisorCampaignCallLog); |
| 337 | //print_r( $supervisorCampaignCallLog); | ||
| 338 | |||
| 339 | /*$supervisorcampaignAppointCount = DB::table('records') | ||
| 340 | ->select('records.customer_name', 'records.cust_id', 'records.mobile', 'records.dialer_appointment', 'records.status','records.dialer_lastcall','records.id','records.dialer_status','records.client') | ||
| 341 | ->whereIn("records.usr_id",[$supervisorUsers]) | ||
| 342 | ->where("records.dialer_appointment", "!=","0000-00-00 00:00:00") | ||
| 343 | ->where('records.client', '=', $client) | ||
| 344 | ->where('records.dialer_appointment','>',date("Y-m-d H:i:s",time()-(7*24*60*60))) | ||
| 345 | ->get();*/ | ||
| 346 | $supervisorcampaignAppointCount = DB::select('select customer_name,cust_id,mobile,dialer_appointment,status,dialer_lastcall,client from records where usr_id in ('.$supervisorUsers.') and client = "'.$client.'" and dialer_appointment>"'.date("Y-m-d H:i:s",time()-(7*24*60*60)).'"'); | ||
| 347 | $supervisorcampaignAppointCount = count($supervisorcampaignAppointCount); | ||
| 305 | } | 348 | } |
| 306 | 349 | ||
| 307 | } | 350 | } |
| ... | @@ -322,8 +365,9 @@ use App\Models\CRMCall; | ... | @@ -322,8 +365,9 @@ use App\Models\CRMCall; |
| 322 | foreach($roclientlst as $c){ | 365 | foreach($roclientlst as $c){ |
| 323 | $c=trim($c); | 366 | $c=trim($c); |
| 324 | if(!empty($c)){ | 367 | if(!empty($c)){ |
| 368 | |||
| 325 | //if($c==$client)$s='selected'; | 369 | //if($c==$client)$s='selected'; |
| 326 | if($i == 0)$s='selected'; | 370 | if($c == $client)$s='selected'; |
| 327 | echo "<option value='$c' $s>$c</option>"; | 371 | echo "<option value='$c' $s>$c</option>"; |
| 328 | } | 372 | } |
| 329 | } ?> | 373 | } ?> |
| ... | @@ -343,14 +387,14 @@ use App\Models\CRMCall; | ... | @@ -343,14 +387,14 @@ use App\Models\CRMCall; |
| 343 | <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | 387 | <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> |
| 344 | 388 | ||
| 345 | <div class="row"> | 389 | <div class="row"> |
| 346 | <div class="col-sm-4 bot"> | 390 | <!--<div class="col-sm-4 bot"> |
| 347 | <div class="new1" style="color:white;"> | 391 | <div class="new1" style="color:white;"> |
| 348 | <div class="text"> | 392 | <div class="text"> |
| 349 | <var><?php echo $TotalCalled; ?></var> | 393 | <var><?php //echo $TotalCalled; ?></var> |
| 350 | </div> | 394 | </div> |
| 351 | Called | 395 | Called |
| 352 | </div> | 396 | </div> |
| 353 | </div> | 397 | </div>--> |
| 354 | 398 | ||
| 355 | <div class="col-sm-4 bot"> | 399 | <div class="col-sm-4 bot"> |
| 356 | <div class="new1" style="color:white;"> | 400 | <div class="new1" style="color:white;"> |
| ... | @@ -371,19 +415,29 @@ use App\Models\CRMCall; | ... | @@ -371,19 +415,29 @@ use App\Models\CRMCall; |
| 371 | </div> | 415 | </div> |
| 372 | </a> | 416 | </a> |
| 373 | </div> | 417 | </div> |
| 418 | <div class="col-sm-4 bot"> | ||
| 419 | <a href="javascript:;" onclick="loadAppointmentData('all');" style="color:white;"> | ||
| 420 | <div class="new1" style="color:white;"> | ||
| 421 | <div class="text"> | ||
| 422 | <var><?php echo count($totalAppointmentCount); ?></var> | ||
| 423 | </div> | ||
| 424 | Appointment Fixed | ||
| 425 | </div> | ||
| 426 | </a> | ||
| 427 | </div> | ||
| 374 | </div> | 428 | </div> |
| 375 | 429 | ||
| 376 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> | 430 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> |
| 377 | 431 | ||
| 378 | <div class="row"> | 432 | <div class="row"> |
| 379 | <div class="col-sm-4 bot"> | 433 | <!---<div class="col-sm-4 bot"> |
| 380 | <div class="new1" style="color:white;"> | 434 | <div class="new1" style="color:white;"> |
| 381 | <div class="text"> | 435 | <div class="text"> |
| 382 | <var><?php echo $campaignTotalCalled; ?></var> | 436 | <var><?php //echo $campaignTotalCalled; ?></var> |
| 383 | </div> | 437 | </div> |
| 384 | Called | 438 | Called |
| 385 | </div> | 439 | </div> |
| 386 | </div> | 440 | </div>--> |
| 387 | 441 | ||
| 388 | <div class="col-sm-4 bot"> | 442 | <div class="col-sm-4 bot"> |
| 389 | <div class="new1" style="color:white;"> | 443 | <div class="new1" style="color:white;"> |
| ... | @@ -404,6 +458,16 @@ use App\Models\CRMCall; | ... | @@ -404,6 +458,16 @@ use App\Models\CRMCall; |
| 404 | </div> | 458 | </div> |
| 405 | </a> | 459 | </a> |
| 406 | </div> | 460 | </div> |
| 461 | <div class="col-sm-4 bot"> | ||
| 462 | <a href="javascript:;" onclick="loadAppointmentData('campaign');" style="color:white;"> | ||
| 463 | <div class="new1" style="color:white;"> | ||
| 464 | <div class="text"> | ||
| 465 | <var><?php echo count($campaignAppointmentCount); ?></var> | ||
| 466 | </div> | ||
| 467 | Appointment Fixed | ||
| 468 | </div> | ||
| 469 | </a> | ||
| 470 | </div> | ||
| 407 | 471 | ||
| 408 | </div> | 472 | </div> |
| 409 | <!-- <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> | 473 | <!-- <div class="row"><div class="col-sm-4"><h4>Total</h4></div></div> |
| ... | @@ -656,7 +720,7 @@ use App\Models\CRMCall; | ... | @@ -656,7 +720,7 @@ use App\Models\CRMCall; |
| 656 | <?php } ?> | 720 | <?php } ?> |
| 657 | 721 | ||
| 658 | <script> | 722 | <script> |
| 659 | 723 | client = $('#tcampaign_select').val(); | |
| 660 | <?php if($client){?> | 724 | <?php if($client){?> |
| 661 | $("#tcampaign_select").val('<?=$client?>'); | 725 | $("#tcampaign_select").val('<?=$client?>'); |
| 662 | <?php }?> | 726 | <?php }?> |
| ... | @@ -679,11 +743,20 @@ function loadFollowupData(val) | ... | @@ -679,11 +743,20 @@ function loadFollowupData(val) |
| 679 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); | 743 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); |
| 680 | } | 744 | } |
| 681 | 745 | ||
| 746 | function loadAppointmentData(val) | ||
| 747 | { | ||
| 748 | var menu = "dialer/loadAppointmentData"; | ||
| 749 | doAjax(menu+"?client="+$("#tcampaign_select").val()+"&selection="+val,'','content','ajax_'+menu,'singlethis','GET'); | ||
| 750 | } | ||
| 751 | |||
| 682 | 752 | ||
| 683 | function campaignSelect() | 753 | function campaignSelect() |
| 684 | { | 754 | { |
| 685 | var dashlet="Dialer"; | 755 | var dashlet="Dialer"; |
| 756 | var client = $('#tcampaign_select').val(); | ||
| 757 | console.log(); | ||
| 686 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 758 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+$("#tcampaign_select").val(),"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 759 | savedialermode(client); | ||
| 687 | } | 760 | } |
| 688 | 761 | ||
| 689 | function dataSelect() | 762 | function dataSelect() |
| ... | @@ -695,6 +768,7 @@ function dataSelect() | ... | @@ -695,6 +768,7 @@ function dataSelect() |
| 695 | 768 | ||
| 696 | var dashlet="Dialer"; | 769 | var dashlet="Dialer"; |
| 697 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 770 | doAjax("dashboard/dashlet?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 771 | savedialermode(client); | ||
| 698 | } | 772 | } |
| 699 | 773 | ||
| 700 | function bucketSelect() | 774 | function bucketSelect() |
| ... | @@ -708,15 +782,16 @@ function bucketSelect() | ... | @@ -708,15 +782,16 @@ function bucketSelect() |
| 708 | var client = $("#tcampaign_select").val(); | 782 | var client = $("#tcampaign_select").val(); |
| 709 | 783 | ||
| 710 | var dashlet="Dialer"; | 784 | var dashlet="Dialer"; |
| 711 | |||
| 712 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); | 785 | doAjax("dashboard/status?module="+dashlet+"&client="+client+"&prev="+prev+"¤tStatus="+currentStatus+"&legalStatus="+legalStatus,"","DashletT-"+dashlet,"ajax_dashlet_"+dashlet,"singlefail","GET"); |
| 713 | } | 786 | } |
| 714 | //bucketSelect(); | 787 | //bucketSelect(); |
| 715 | 788 | ||
| 716 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) | 789 | function dialerLoadData(listname,currentstatus,legalstatus,page,skey,stxt) |
| 717 | { | 790 | { |
| 791 | //var client=$("#tcampaign_select").val(); | ||
| 718 | 792 | ||
| 719 | doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); | 793 | doAjax("dialer/bucketdata","client={!!$client!!}&bucket="+listname+"¤tstatus="+currentstatus+"&legalstatus="+legalstatus+'&page='+page+'&skey='+skey+'&stxt='+stxt,"bucketlistdiv","ajax_dialer_list","singlefail","GET"); |
| 794 | savedialermode("{!!$client!!}"); | ||
| 720 | } | 795 | } |
| 721 | dialerLoadData('CurrentQueue','','',1,'',''); | 796 | dialerLoadData('CurrentQueue','','',1,'',''); |
| 722 | </script> | 797 | </script> | ... | ... |
| ... | @@ -59,6 +59,17 @@ | ... | @@ -59,6 +59,17 @@ |
| 59 | </div> | 59 | </div> |
| 60 | </a> | 60 | </a> |
| 61 | </div> | 61 | </div> |
| 62 | |||
| 63 | <div class="col-sm-4 bot"> | ||
| 64 | <a href="javascript:;" onclick="loadAppointmentData('all');" style="color:white;"> | ||
| 65 | <div class="new1" style="color:white;"> | ||
| 66 | <div class="text"> | ||
| 67 | <var><?php echo $supervisorAppointmentCount; ?></var> | ||
| 68 | </div> | ||
| 69 | Appointment Fixed | ||
| 70 | </div> | ||
| 71 | </a> | ||
| 72 | </div> | ||
| 62 | </div> | 73 | </div> |
| 63 | 74 | ||
| 64 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> | 75 | <div class="row"><div class="col-sm-4"><h4>Campaign Wise</h4></div></div> |
| ... | @@ -93,5 +104,16 @@ | ... | @@ -93,5 +104,16 @@ |
| 93 | </a> | 104 | </a> |
| 94 | </div> | 105 | </div> |
| 95 | 106 | ||
| 107 | <div class="col-sm-4 bot"> | ||
| 108 | <a href="javascript:;" onclick="loadAppointmentData('campaign');" style="color:white;"> | ||
| 109 | <div class="new1" style="color:white;"> | ||
| 110 | <div class="text"> | ||
| 111 | <var><?php echo $supervisorcampaignAppointCount; ?></var> | ||
| 112 | </div> | ||
| 113 | Appointment Fixed | ||
| 114 | </div> | ||
| 115 | </a> | ||
| 116 | </div> | ||
| 117 | |||
| 96 | </div> | 118 | </div> |
| 97 | </div> | 119 | </div> | ... | ... |
| 1 | |||
| 2 | <?php | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\CRMCallArchive; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Models\UserLog; | ||
| 7 | use App\Jobs\KHRMSLib; | ||
| 8 | |||
| 9 | $wakka = new KHRMSLib(); | ||
| 10 | $dashboarduser=Auth::user(); | ||
| 11 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 12 | $timeoffset = $timeoffset*60; | ||
| 13 | |||
| 14 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9; | ||
| 15 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20; | ||
| 16 | |||
| 17 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") | ||
| 18 | : strtotime(date("Y-m-d")." 09:00:00"); | ||
| 19 | $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00") | ||
| 20 | : strtotime(date("Y-m-d")." 20:00:00"); | ||
| 21 | $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All"; | ||
| 22 | |||
| 23 | // testing input | ||
| 24 | //$logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-26 ".$logtime.":00:00");$logdateto = strtotime("2017-10-26 ".$logtimeto.":00:00");$campaign = 'All'; | ||
| 25 | // testing input | ||
| 26 | |||
| 27 | $alist=CRMCallArchive::where('user_id','!=',0)->where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 28 | $alist->orderBy('user_id', 'ASC')->orderBy('ts_Close', 'ASC'); | ||
| 29 | |||
| 30 | $userlog=UserLog::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 31 | |||
| 32 | if($campaign != 'All') $alist->where('client','=',$campaign); | ||
| 33 | |||
| 34 | $userarr=array(); | ||
| 35 | $allusers = DB::table('users as u1')->leftjoin('users AS u2', 'u2.username', '=', 'u1.supervisor') | ||
| 36 | ->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor') | ||
| 37 | ->where('u1.status','=','Active'); | ||
| 38 | |||
| 39 | $roclientstr=array();$didlinesstr=array(); | ||
| 40 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 41 | $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst); $oclientlst[0] = 'All'; | ||
| 42 | |||
| 43 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 44 | { | ||
| 45 | $roclientstr[]="$tclnt"; | ||
| 46 | |||
| 47 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 48 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 49 | } | ||
| 50 | |||
| 51 | $breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime"); | ||
| 52 | |||
| 53 | $reporthead=array_merge(array("#","RM","RM Code","Team Manager","Sessions","CallCount","TOS","Net Total","Wait","Call","Talk","Dispo","ProgressiveTotal","P-Call","P-Talk","P-Dispo","ManualTotal","M-Call","M-Talk","M-Dispo","IncomingTotal","I-Call","I-Talk","I-Dispo","PausedTotal"),$breaks); | ||
| 54 | $reportarray=array(); | ||
| 55 | |||
| 56 | $i=1; | ||
| 57 | if($dashboarduser->usertype != 'Admin') | ||
| 58 | { | ||
| 59 | $uidlist=array($dashboarduser->id); | ||
| 60 | $allusers=$allusers->where(function ($query) use($dashboarduser) { | ||
| 61 | $query->where('u1.supervisor','=',$dashboarduser->username) | ||
| 62 | ->orWhere('u1.lteam2','=',$dashboarduser->username) | ||
| 63 | ->orWhere('u1.lteam','=',$dashboarduser->username); | ||
| 64 | })->get(); | ||
| 65 | |||
| 66 | foreach($allusers as $tuser) | ||
| 67 | { | ||
| 68 | $uidlist[]=$tuser->id; | ||
| 69 | |||
| 70 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | $reportarray[$dashboarduser->id]=array("#"=>$i++,"RM"=>$dashboarduser->fullname,"RM Code"=>$dashboarduser->username,"Team Manager"=>$dashboarduser->supervisor); | ||
| 75 | $alist=$alist->whereIn('user_id',$uidlist); | ||
| 76 | |||
| 77 | /*$alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 78 | $query->orWhereIn('client',$roclientstr) | ||
| 79 | ->orWhereIn('did',$didlinesstr); | ||
| 80 | });*/ | ||
| 81 | |||
| 82 | $userlog=$userlog->whereIn('user_id',$uidlist); | ||
| 83 | }else{ | ||
| 84 | $allusers=$allusers->get(); | ||
| 85 | foreach($allusers as $tuser) | ||
| 86 | { | ||
| 87 | |||
| 88 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | // echo "<pre>"; print_r($allusers);exit; | ||
| 93 | |||
| 94 | $alist=$alist->get(); | ||
| 95 | $userlog=$userlog->get(); | ||
| 96 | $prev_close = 0; | ||
| 97 | |||
| 98 | // echo count($userlog);exit; | ||
| 99 | |||
| 100 | foreach($alist as $aline) | ||
| 101 | { | ||
| 102 | if($prev_user != $aline->user_id || $prev_close <= $aline->ts_Wait) | ||
| 103 | { | ||
| 104 | $userid=$aline->user_id; | ||
| 105 | |||
| 106 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 107 | $totaltime=$aline->callSec+$talktime+$aline->dispoSec; | ||
| 108 | |||
| 109 | $reportarray[$userid]["oncall"]+=$totaltime/1000; | ||
| 110 | // $reportarray[$userid]["Wait"]+=$aline->waitSec/1000; | ||
| 111 | $reportarray[$userid]["Call"]+=$aline->callSec/1000; | ||
| 112 | $reportarray[$userid]["Talk"]+=$talktime/1000; | ||
| 113 | $reportarray[$userid]["Dispo"]+=$aline->dispoSec/1000; | ||
| 114 | |||
| 115 | if($aline->type == 'Progressive') | ||
| 116 | { | ||
| 117 | $reportarray[$userid]["P-Call"]+=$aline->callSec/1000; | ||
| 118 | $reportarray[$userid]["P-Talk"]+=$talktime/1000; | ||
| 119 | $reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000; | ||
| 120 | $reportarray[$userid]["ProgressiveTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 121 | } | ||
| 122 | |||
| 123 | if($aline->type == 'Manual') | ||
| 124 | { | ||
| 125 | $reportarray[$userid]["M-Call"]+=$aline->callSec/1000; | ||
| 126 | $reportarray[$userid]["M-Talk"]+=$talktime/1000; | ||
| 127 | $reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000; | ||
| 128 | $reportarray[$userid]["ManualTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 129 | } | ||
| 130 | |||
| 131 | if($aline->type == 'Inbound') | ||
| 132 | { | ||
| 133 | $reportarray[$userid]["I-Call"]+=$aline->callSec/1000; | ||
| 134 | $reportarray[$userid]["I-Talk"]+=$talktime/1000; | ||
| 135 | $reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000; | ||
| 136 | $reportarray[$userid]["IncomingTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | $reportarray[$userid]["CallCount"]++; | ||
| 140 | $prev_close = $aline->ts_Close;//-ts_Wait | ||
| 141 | $prev_user = $aline->user_id;//-ts_Wait | ||
| 142 | } | ||
| 143 | |||
| 144 | function cmp($a, $b) { | ||
| 145 | return $a["ts"] - $b["ts"]; | ||
| 146 | } | ||
| 147 | $userLogin=array(); | ||
| 148 | foreach($userlog as $ulog) | ||
| 149 | { | ||
| 150 | $data=json_decode($ulog->data,true); | ||
| 151 | usort($data, "cmp"); | ||
| 152 | |||
| 153 | $lastSip = end($data); | ||
| 154 | $starttime = strtotime($ulog->startdate.' '.$ulog->starttime); | ||
| 155 | //echo "starttime:".$starttime; | ||
| 156 | $endtime = round($lastSip['ts']/1000); | ||
| 157 | //console.log($endtime); | ||
| 158 | //echo "End time:".$endtime; | ||
| 159 | $userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime); | ||
| 160 | //echo "Userlog:".$userLogin[$ulog->user_id]['duration']; | ||
| 161 | $userLogin[$ulog->user_id]['start'][] = $starttime; | ||
| 162 | $userLogin[$ulog->user_id]['end'][] = $endtime; | ||
| 163 | |||
| 164 | $prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000; | ||
| 165 | $previous="Paused-Paused"; | ||
| 166 | foreach($data as $sdata) | ||
| 167 | { | ||
| 168 | $pts=$sdata['ts']; | ||
| 169 | if(isset($sdata['states'])) | ||
| 170 | { | ||
| 171 | foreach($sdata['states'] as $ts=>$states) | ||
| 172 | { | ||
| 173 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 174 | |||
| 175 | if(!in_array($previous,$reporthead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-','Paused-WRAPUP'))) { | ||
| 176 | $previous = 'Paused'; | ||
| 177 | } | ||
| 178 | |||
| 179 | $reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000; | ||
| 180 | |||
| 181 | $prets=$ts; | ||
| 182 | $previous=$states[0].'-'.$states[1]; | ||
| 183 | } | ||
| 184 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 185 | $reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000; | ||
| 186 | $prets=$pts; | ||
| 187 | } | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | if(count($userLogin)) foreach ($userLogin as $userid => $value) | ||
| 192 | { | ||
| 193 | $break_time=0; | ||
| 194 | foreach ($breaks as $break) { | ||
| 195 | $break_time+=$reportarray[$userid][$break]; | ||
| 196 | $reportarray[$userid]["PausedTotal"]+=$reportarray[$userid][$break]; | ||
| 197 | } | ||
| 198 | $sessionsStr = ""; | ||
| 199 | for($i = 0; $i < count($value['start']); $i++){ | ||
| 200 | if($sessionsStr == ""){ | ||
| 201 | $sessionsStr .= date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 202 | }else{ | ||
| 203 | $sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 204 | } | ||
| 205 | } | ||
| 206 | $reportarray[$userid]["Sessions"]=$sessionsStr; | ||
| 207 | // $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset); | ||
| 208 | // $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset); | ||
| 209 | $reportarray[$userid]["TOS"]=$value['duration']; | ||
| 210 | $reportarray[$userid]["Net Total"]=$value['duration']-$break_time; | ||
| 211 | $reportarray[$userid]["Wait"]=$reportarray[$userid]["Net Total"]-$reportarray[$userid]['oncall']; | ||
| 212 | if($reportarray[$userid]["Wait"] < 0){ | ||
| 213 | $reportarray[$userid]["Net Total"] += abs($reportarray[$userid]["Wait"]); | ||
| 214 | $reportarray[$userid]["TOS"] += abs($reportarray[$userid]["Wait"]); | ||
| 215 | $reportarray[$userid]["Wait"] = 0; | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 219 | $highestColumn = sizeof($reporthead); | ||
| 220 | if(count($reportarray)) { | ||
| 221 | $outhead="<tr>";$outstr=""; | ||
| 222 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 223 | if($reporthead[$head] == "Sessions"){ | ||
| 224 | $outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>"; | ||
| 225 | }elseif($reporthead[$head] == "PausedTotal" || $reporthead[$head] == "ProgressiveTotal" || $reporthead[$head] == "ManualTotal" || $reporthead[$head] == "IncomingTotal"){ | ||
| 226 | $outhead.="<td class='warning'>".$reporthead[$head]."</td>"; | ||
| 227 | }elseif($reporthead[$head] == "Paused"){ | ||
| 228 | $outhead.="<td>ManualPaused</td>"; | ||
| 229 | }else{ | ||
| 230 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | $outhead.="</tr>"; | ||
| 234 | $utotalarr = array("RM"=>'Net Total'); | ||
| 235 | |||
| 236 | $reportRowNo = 1; | ||
| 237 | foreach($reportarray as $uid=>$uarr) | ||
| 238 | { | ||
| 239 | if(array_key_exists('TOS',$uarr) && array_key_exists('RM Code',$uarr)) | ||
| 240 | { | ||
| 241 | $outstr.="<tr>"; | ||
| 242 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 243 | if($head < 1){ | ||
| 244 | $data_str = $reportRowNo; $reportRowNo++; | ||
| 245 | }elseif($head < 5) { | ||
| 246 | // if($head < 6) { | ||
| 247 | $data_str = $uarr[$reporthead[$head]]; | ||
| 248 | } | ||
| 249 | elseif($head < 6) { | ||
| 250 | $data_str = $uarr[$reporthead[$head]]; | ||
| 251 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 252 | } | ||
| 253 | else { | ||
| 254 | $data_str = secToDuration(round($uarr[$reporthead[$head]])); | ||
| 255 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 256 | } | ||
| 257 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 258 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 259 | }else{ | ||
| 260 | $outstr.="<td>".$data_str."</td>"; | ||
| 261 | } | ||
| 262 | } | ||
| 263 | $outstr.="</tr>"; | ||
| 264 | } | ||
| 265 | } | ||
| 266 | $outstr.="<tr>"; | ||
| 267 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 268 | { | ||
| 269 | if($head < 6) { | ||
| 270 | $data_str = $utotalarr[$reporthead[$head]]; | ||
| 271 | } | ||
| 272 | else { | ||
| 273 | $data_str = secToDuration($utotalarr[$reporthead[$head]]); | ||
| 274 | } | ||
| 275 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 276 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 277 | }else{ | ||
| 278 | $outstr.="<td>".$data_str."</td>"; | ||
| 279 | } | ||
| 280 | } | ||
| 281 | $outstr.="</tr>"; | ||
| 282 | } else { | ||
| 283 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 284 | } | ||
| 285 | |||
| 286 | if(Input::has("dllogxls")) | ||
| 287 | { | ||
| 288 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 289 | |||
| 290 | $inputFileType = "Excel5"; | ||
| 291 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 292 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 293 | $baseRow = 2; | ||
| 294 | |||
| 295 | |||
| 296 | $highestColumn = sizeof($reporthead); | ||
| 297 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 298 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 299 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 300 | } | ||
| 301 | foreach($reportarray as $uid=>$uarr) | ||
| 302 | { | ||
| 303 | if(array_key_exists('TOS',$uarr) && array_key_exists('RM Code',$uarr)) | ||
| 304 | { | ||
| 305 | $row = $baseRow++; | ||
| 306 | $col = 0; | ||
| 307 | |||
| 308 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 309 | $excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]])); | ||
| 310 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 311 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 312 | } | ||
| 313 | $row++; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | |||
| 317 | //$row++; | ||
| 318 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 319 | $excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]])); | ||
| 320 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 321 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 322 | } | ||
| 323 | |||
| 324 | header('Content-Type: application/vnd.ms-excel'); | ||
| 325 | header('Content-Disposition: attachment;filename="AgentTime.xls"'); | ||
| 326 | header('Cache-Control: max-age=0'); | ||
| 327 | |||
| 328 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 329 | $objWriter->save('php://output'); | ||
| 330 | |||
| 331 | return ; | ||
| 332 | } | ||
| 333 | |||
| 334 | function secToDuration($sec) { | ||
| 335 | return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60); | ||
| 336 | } | ||
| 337 | ?> | ||
| 338 | |||
| 339 | <style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;} | ||
| 340 | /*#logtable.table thead tr{ | ||
| 341 | display:block; | ||
| 342 | } | ||
| 343 | |||
| 344 | #logtable.table tbody{ | ||
| 345 | display:block; | ||
| 346 | height:500px; | ||
| 347 | overflow:auto;//set tbody to auto | ||
| 348 | }*/ | ||
| 349 | </style> | ||
| 350 | |||
| 351 | <div class=innerAll> | ||
| 352 | <h4 style="float:left;width:50%;margin:10px 0;">Login Report <small>(Agent Time Report)</small></h4> | ||
| 353 | <div style="float:right;width:50%"> | ||
| 354 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button> | ||
| 355 | </div> | ||
| 356 | <div style="clear:both"></div> | ||
| 357 | <hr style="margin-bottom: 5px;"> | ||
| 358 | <div> | ||
| 359 | Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;"> | ||
| 360 | Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 361 | <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 362 | <?php | ||
| 363 | foreach (range(0,23) as $hour) { | ||
| 364 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 365 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 366 | } | ||
| 367 | ?> | ||
| 368 | </select> | ||
| 369 | To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' /> | ||
| 370 | <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 371 | <?php | ||
| 372 | foreach (range(0,23) as $hour) { | ||
| 373 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 374 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 375 | } | ||
| 376 | ?></select> | ||
| 377 | Campaign | ||
| 378 | <select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 379 | <?php foreach($oclientlst as $c){$s="";if($c==$campaign)$s='selected';echo "<option value='$c' $s>$c</option>";} ?> | ||
| 380 | </select> | ||
| 381 | </div> | ||
| 382 | |||
| 383 | <div style="clear:both"></div> | ||
| 384 | <hr style="margin:5px;"> | ||
| 385 | |||
| 386 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 387 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px; margin:0; border:1px solid #BBB;'> | ||
| 388 | <thead><?php echo $outhead; ?></thead> | ||
| 389 | <tbody id="logTableData"><?php echo $outstr; ?></tbody> | ||
| 390 | </table> | ||
| 391 | </div> | ||
| 392 | |||
| 393 | <div id=dialoglog></div> | ||
| 394 | </div> | ||
| 395 | |||
| 396 | <script> | ||
| 397 | $(document).ready(function() { | ||
| 398 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 399 | { | ||
| 400 | $('#dialoglog').dialog({ | ||
| 401 | autoOpen: false, | ||
| 402 | width: '70%', | ||
| 403 | buttons: { | ||
| 404 | "Ok": function() { | ||
| 405 | $(this).dialog("close"); | ||
| 406 | }, | ||
| 407 | "Cancel": function() { | ||
| 408 | $(this).dialog("close"); | ||
| 409 | } | ||
| 410 | } | ||
| 411 | }); | ||
| 412 | } | ||
| 413 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logTableData') },"2000"); | ||
| 414 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 415 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 416 | }); | ||
| 417 | |||
| 418 | function dataString() | ||
| 419 | { | ||
| 420 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val(); | ||
| 421 | } | ||
| 422 | function statusLogReloadFun(sortby) | ||
| 423 | { | ||
| 424 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 425 | var searchStr = dataString(); | ||
| 426 | doAjax('dialer/agenttime?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 427 | } | ||
| 428 | function dlAgentlogXls() | ||
| 429 | { | ||
| 430 | var searchStr = dataString(); | ||
| 431 | window.open('dialer/agenttime?dllogxls=1&'+searchStr); | ||
| 432 | return false; | ||
| 433 | } | ||
| 434 | </script> |
File mode changed
| 1 | <?php | ||
| 2 | $dashboarduser=Auth::user(); | ||
| 3 | $timeoffset=$dashboarduser->timezone*60; | ||
| 4 | ?> | ||
| 5 | <div class="container-fluid"> | ||
| 6 | <div class="layout-app"> | ||
| 7 | <div class="row"> | ||
| 8 | <div class="col-md-12"> | ||
| 9 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 10 | <div class="innerAll"> | ||
| 11 | <div> | ||
| 12 | <h4 id='tcampaign_select' value=<?php if(!empty($client)) echo $client; ?>>Appointment <?php if(!empty($client)) echo ": ".$client; ?></h4></div> | ||
| 13 | <hr style="margin-bottom: 10px;" /> | ||
| 14 | |||
| 15 | <table class='table' | ||
| 16 | <thead> | ||
| 17 | <tr> | ||
| 18 | <th></th> | ||
| 19 | <th></th> | ||
| 20 | <?php if(empty($client)) echo "<th>Campaign</th>" ?> | ||
| 21 | <th>Cust_ID</th> | ||
| 22 | <th>Name</th> | ||
| 23 | <th>Number</th> | ||
| 24 | <!-- <th>Type</th>--> | ||
| 25 | <th>LastCall</th> | ||
| 26 | <!-- <th>Disposition</th> ---> | ||
| 27 | <th>Appointment Date</th> | ||
| 28 | <!--- <th>Status</th> ---> | ||
| 29 | |||
| 30 | <!-- <th>Count</th> --> | ||
| 31 | <!--<th></th>--> | ||
| 32 | <!-- <th>DID</th> --> | ||
| 33 | </tr> | ||
| 34 | </thead> | ||
| 35 | <tbody> | ||
| 36 | <?php | ||
| 37 | if($count > 0){ | ||
| 38 | foreach ($appointment as $key => $value) { //echo "<pre>";print_r($value);exit;?> | ||
| 39 | <tr> | ||
| 40 | <td></td> | ||
| 41 | <td></td> | ||
| 42 | <?php if(empty($client)) echo "<td>$value->client</td>" ?> | ||
| 43 | <td><?php echo $value->cust_id; ?></td> | ||
| 44 | <td><?php echo $value->customer_name; ?></td> | ||
| 45 | <td><a href=# class='' onclick='dialerQuickOpen("<?php echo $value->id; ?>","<?php echo $value->mobile; ?>","Manual","",0);return false;'><?php echo $value->mobile; ?></a></td> | ||
| 46 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_lastcall)-$timeoffset); ?></td> | ||
| 47 | <!--<td><?php //echo $value->dialer_status; ?></td>--> | ||
| 48 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_appointment)-$timeoffset); ?></td> | ||
| 49 | <!--<td><?php //echo $value->status; ?></td>--> | ||
| 50 | </tr> | ||
| 51 | <?php } | ||
| 52 | }else{ ?> | ||
| 53 | <td colspan="9" align="center">No Record Available</td> | ||
| 54 | <?php } ?> | ||
| 55 | </table> | ||
| 56 | |||
| 57 | <div id="campaignDetailsArea"></div> | ||
| 58 | </div> | ||
| 59 | </div> | ||
| 60 | </div> | ||
| 61 | </div> | ||
| 62 | |||
| 63 | </div> | ||
| 64 | </div> |
| ... | @@ -176,12 +176,12 @@ foreach($alist_remark as $aline) | ... | @@ -176,12 +176,12 @@ foreach($alist_remark as $aline) |
| 176 | $remarkval[$aline->call_id]=$aline->fullremark; | 176 | $remarkval[$aline->call_id]=$aline->fullremark; |
| 177 | 177 | ||
| 178 | } | 178 | } |
| 179 | $clientcodearr=DB::table('records')->select('clientcode','id','currentstatus','legalstatus')->whereIn('id',$crm_id)->get(); | 179 | $clientcodearr=DB::table('records')->select('cust_id','id')->whereIn('id',$crm_id)->get(); |
| 180 | foreach ($clientcodearr as $clientid) | 180 | foreach ($clientcodearr as $clientid) |
| 181 | { | 181 | { |
| 182 | $clientcodeval[$clientid->id]=$clientid->clientcode; | 182 | $clientcodeval[$clientid->id]=$clientid->cust_id; |
| 183 | $currentstatusval[$clientid->id]=$clientid->currentstatus; | 183 | //$currentstatusval[$clientid->id]=$clientid->currentstatus; |
| 184 | $legalstatusval[$clientid->id]=$clientid->legalstatus; | 184 | //$legalstatusval[$clientid->id]=$clientid->legalstatus; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | if(Input::has("dllogxls")) | 187 | if(Input::has("dllogxls")) |
| ... | @@ -247,8 +247,8 @@ if(Input::has("dllogxls")) | ... | @@ -247,8 +247,8 @@ if(Input::has("dllogxls")) |
| 247 | $legalstatus=$user["peopledata"]["legalstatus"];*/ | 247 | $legalstatus=$user["peopledata"]["legalstatus"];*/ |
| 248 | 248 | ||
| 249 | $clientcode=$clientcodeval[$aline->crm_id]; | 249 | $clientcode=$clientcodeval[$aline->crm_id]; |
| 250 | $currentstatus=$currentstatusval[$aline->crm_id]; | 250 | // $currentstatus=$currentstatusval[$aline->crm_id]; |
| 251 | $legalstatus=$legalstatusval[$aline->crm_id]; | 251 | // $legalstatus=$legalstatusval[$aline->crm_id]; |
| 252 | } | 252 | } |
| 253 | $tpostdata=json_decode($aline->data,true); | 253 | $tpostdata=json_decode($aline->data,true); |
| 254 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-$timeoffset); | 254 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-$timeoffset); | ... | ... |
| ... | @@ -44,7 +44,7 @@ $reportarray=array(); | ... | @@ -44,7 +44,7 @@ $reportarray=array(); |
| 44 | foreach($newcalls as $newcall) | 44 | foreach($newcalls as $newcall) |
| 45 | { | 45 | { |
| 46 | $tcall=CRMCall::where('dialline_id','=',$newcall->id)->orderBy('id','DESC')->first(); | 46 | $tcall=CRMCall::where('dialline_id','=',$newcall->id)->orderBy('id','DESC')->first(); |
| 47 | $cust_id=DB::table('records')->select('clientcode','id','currentstatus','legalstatus')->where('id','=',$tcall->crm_id)->first(); | 47 | $cust_id=DB::table('records')->select('cust_id','id')->where('id','=',$tcall->crm_id)->first(); |
| 48 | $un="";$uid="";$us=""; | 48 | $un="";$uid="";$us=""; |
| 49 | if($tcall->user_id>0) | 49 | if($tcall->user_id>0) |
| 50 | { | 50 | { |
| ... | @@ -132,7 +132,7 @@ foreach($sipids as $sipid) | ... | @@ -132,7 +132,7 @@ foreach($sipids as $sipid) |
| 132 | 132 | ||
| 133 | $clidata=json_decode($sipid->clients,true); | 133 | $clidata=json_decode($sipid->clients,true); |
| 134 | $tcall=CRMCall::where('user_id','=',$sipid->user)->orderBy('id','DESC')->first(); | 134 | $tcall=CRMCall::where('user_id','=',$sipid->user)->orderBy('id','DESC')->first(); |
| 135 | $cust_id=DB::table('records')->select('clientcode','id','currentstatus','legalstatus')->where('id','=',$tcall->crm_id)->first(); | 135 | $cust_id=DB::table('records')->select('cust_id','id')->where('id','=',$tcall->crm_id)->first(); |
| 136 | 136 | ||
| 137 | $tuser=User::find($sipid->user); | 137 | $tuser=User::find($sipid->user); |
| 138 | $userlog=UserLog::where('user_id','=',$tuser->id)->orderBy("id","DESC")->first(); | 138 | $userlog=UserLog::where('user_id','=',$tuser->id)->orderBy("id","DESC")->first(); | ... | ... |
| ... | @@ -42,9 +42,10 @@ foreach($allusers as $user){ | ... | @@ -42,9 +42,10 @@ foreach($allusers as $user){ |
| 42 | <div class='container'> | 42 | <div class='container'> |
| 43 | 43 | ||
| 44 | <select id='dialmodeassign' class=select2multi multiple="" style="width: 30%;"> | 44 | <select id='dialmodeassign' class=select2multi multiple="" style="width: 30%;"> |
| 45 | <option value="Progressive">Ready</option> | 45 | <!--<option value="Progressive">Ready</option> |
| 46 | <option value="Manual">Manual</option> | 46 | <option value="Manual">Manual</option> |
| 47 | <option value="Incoming">Incoming</option> | 47 | <option value="Incoming">Incoming</option>--> |
| 48 | <?php foreach($callingmodeArr as $callingmode){;echo "<option value='$callingmode'>$callingmode</option>";} ?> | ||
| 48 | </select> | 49 | </select> |
| 49 | 50 | ||
| 50 | <select id='username' class=select2multi multiple="" style="width: 30%;"> | 51 | <select id='username' class=select2multi multiple="" style="width: 30%;"> | ... | ... |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i>Add Disposition | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | |||
| 10 | |||
| 11 | <form method="post" id="dispositionForm" class="innerAll"> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="disposition">Disposition Name</label> | ||
| 16 | <div class="col-md-8 controls tmar"> | ||
| 17 | <input class="form-control" id="disposition" name="disposition" type="text" value="" required /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group "> | ||
| 22 | <label class="col-md-4 control-label" for="code">Code</label> | ||
| 23 | <div class="col-md-8 controls tmar"> | ||
| 24 | <input class="form-control" id="code" name="code" type="text" value="" required /> | ||
| 25 | </div> | ||
| 26 | </div> | ||
| 27 | |||
| 28 | <!-- <div class="control-group"> | ||
| 29 | <label class="col-md-4 control-label" for="subDisposition">Sub Disposition</label> | ||
| 30 | <div class="col-md-8 controls tmar"> | ||
| 31 | <input class="form-control" id="subDisposition" name="subDisposition" type="text" required /> | ||
| 32 | </div> | ||
| 33 | </div> --> | ||
| 34 | |||
| 35 | <div class="control-group"> | ||
| 36 | <label class="col-md-4 control-label" for="status">Status</label> | ||
| 37 | <div class="col-md-8 controls tmar"> | ||
| 38 | <select class="form-control" id="" name="status" > | ||
| 39 | <option value="active">Active</option> | ||
| 40 | <option value="inactive">Inactive</option> | ||
| 41 | </select> | ||
| 42 | </div> | ||
| 43 | </div> | ||
| 44 | |||
| 45 | <div class="field_wrapper"> | ||
| 46 | <div class="row"> | ||
| 47 | <label class="col-md-4 control-label" for="subDisposition">Sub Disposition</label> | ||
| 48 | <div class="col-md-7 controls tmar"> | ||
| 49 | <input type="text" class="form-control" name="subDisposition[]" required/> | ||
| 50 | </div> | ||
| 51 | <div class="col-md-1 controls tmar"> | ||
| 52 | <a href="javascript:void(0);" class="add_button" title="Add field"><i class="fa fa-plus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 53 | </div> | ||
| 54 | </div> | ||
| 55 | </div> | ||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | <div class="form-actions"> | ||
| 61 | <!-- <button type="submit" class="btn btn-primary" onclick='createDisposition();return false;'>Save changes</button> --> | ||
| 62 | |||
| 63 | <input type="submit" name="save" id="save" class="btn btn-primary" value="Save changes"> | ||
| 64 | </div> | ||
| 65 | </fieldset> | ||
| 66 | </form> | ||
| 67 | <script> | ||
| 68 | $(document).ready(function(){ | ||
| 69 | |||
| 70 | //var maxField = 10; //Input fields increment limitation | ||
| 71 | var addButton = $('.add_button'); //Add button selector | ||
| 72 | var wrapper = $('.field_wrapper'); //Input field wrapper | ||
| 73 | var fieldHTML = '<div class="row"><label class="col-md-4 control-label" for="subDisposition"></label><div class="col-md-7 controls tmar"><input type="text" class="form-control" name="subDisposition[]" required /></div><div class="col-md-1 controls tmar"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a></div></div>'; //New input field html | ||
| 74 | |||
| 75 | //var x = 1; //Initial field counter is 1 | ||
| 76 | |||
| 77 | //Once add button is clicked | ||
| 78 | $(addButton).click(function(){ | ||
| 79 | //Check maximum number of input fields | ||
| 80 | //if(x < maxField){ | ||
| 81 | //x++; //Increment field counter | ||
| 82 | $(wrapper).append(fieldHTML); //Add field html | ||
| 83 | //} | ||
| 84 | }); | ||
| 85 | |||
| 86 | //Once remove button is clicked | ||
| 87 | $(wrapper).on('click', '.remove_button', function(e){ | ||
| 88 | e.preventDefault(); | ||
| 89 | $(this).parent('div').parent('div').remove(); //Remove field html | ||
| 90 | //x--; //Decrement field counter | ||
| 91 | }); | ||
| 92 | |||
| 93 | $('#dispositionForm').on('submit', function(event){ | ||
| 94 | event.preventDefault(); | ||
| 95 | var putdata = $('#dispositionForm').serialize(); | ||
| 96 | |||
| 97 | doAjax('disposition?action=isExists',putdata,'','','','POST',function(retrstr){ | ||
| 98 | if(retrstr.responseText == "true"){ | ||
| 99 | simpleNotification('Error','topRight',"Disposition Already Exists!"); | ||
| 100 | return false; | ||
| 101 | }else{ | ||
| 102 | doAjax('disposition?action=createDisposition',putdata,'dispositionFormDiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 103 | doAjax('disposition','','content','ajax_disposition','singlethis','GET',function(retrstr){ | ||
| 104 | simpleNotification('Success','topRight',"Disposition created suceesfully!"); | ||
| 105 | }); | ||
| 106 | }); | ||
| 107 | } | ||
| 108 | }); | ||
| 109 | }); | ||
| 110 | |||
| 111 | }); | ||
| 112 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i> Edit Disposition | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | <?php //echo "<prE>";print_r($dispositionPlan); ?> | ||
| 10 | <form method="post" id="dispositionForm" class="innerAll"> | ||
| 11 | <input class="form-control" name="dispoId" type="hidden" value="{!!$disposition->dispoId!!}" /> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="disposition">Disposition Name</label> | ||
| 16 | <div class="col-md-8 controls tmar"> | ||
| 17 | <input class="form-control" id="disposition" name="disposition" type="text" value="{!!$disposition->disposition!!}" required /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group "> | ||
| 22 | <label class="col-md-4 control-label" for="code">Code</label> | ||
| 23 | <div class="col-md-8 controls tmar"> | ||
| 24 | <input class="form-control" id="code" name="code" type="text" value="{!!$disposition->code!!}" required /> | ||
| 25 | </div> | ||
| 26 | </div> | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | <!-- <div class="control-group"> | ||
| 32 | <label class="col-md-4 control-label" for="subDisposition">Sub Disposition</label> | ||
| 33 | <div class="col-md-8 controls tmar"> | ||
| 34 | <input class="form-control" id="subDisposition" name="subDisposition" type="text" required /> | ||
| 35 | </div> | ||
| 36 | </div> --> | ||
| 37 | |||
| 38 | <div class="control-group"> | ||
| 39 | <label class="col-md-4 control-label" for="status">Status</label> | ||
| 40 | <div class="col-md-8 controls tmar"> | ||
| 41 | <select class="form-control" id="" name="status" > | ||
| 42 | <option value="{!!$disposition->status!!}">{!!$disposition->status!!}</option> | ||
| 43 | <option value="active">Active</option> | ||
| 44 | <option value="inactive">Inactive</option> | ||
| 45 | </select> | ||
| 46 | </div> | ||
| 47 | </div> | ||
| 48 | |||
| 49 | <?php $subDispo = explode(",", $disposition->sunDispoName); ?> | ||
| 50 | <div class="field_wrapper"> | ||
| 51 | <?php for ($i=0; $i < count($subDispo); $i++) { | ||
| 52 | if($i == 0){ ?> | ||
| 53 | <div class="row"> | ||
| 54 | <label class="col-md-4 control-label" for="subDisposition">Sub Disposition</label> | ||
| 55 | <div class="col-md-7 controls tmar"> | ||
| 56 | <input type="text" class="form-control" name="subDisposition[]" value="{!!$subDispo[$i]!!}" required/> | ||
| 57 | </div> | ||
| 58 | <div class="col-md-1 controls tmar"> | ||
| 59 | <a href="javascript:void(0);" class="add_button" title="Add field"><i class="fa fa-plus fa-3" aria-hidden="true"></i></a> | ||
| 60 | </div> | ||
| 61 | </div> | ||
| 62 | <?php }else{ | ||
| 63 | ?> | ||
| 64 | <div class="row"> | ||
| 65 | <label class="col-md-4 control-label" for="subDisposition"></label> | ||
| 66 | <div class="col-md-7 controls tmar"> | ||
| 67 | <input type="text" class="form-control" name="subDisposition[]" value="{!!$subDispo[$i]!!}" required /></div><div class="col-md-1 controls tmar"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 68 | </div> | ||
| 69 | </div> | ||
| 70 | <?php } | ||
| 71 | } ?> | ||
| 72 | </div> | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | <div class="form-actions"> | ||
| 78 | <!-- <button type="submit" class="btn btn-primary" onclick='createDisposition();return false;'>Save changes</button> --> | ||
| 79 | |||
| 80 | <input type="submit" name="save" id="save" class="btn btn-primary" value="Save changes"> | ||
| 81 | </div> | ||
| 82 | </fieldset> | ||
| 83 | </form> | ||
| 84 | <script> | ||
| 85 | $(document).ready(function(){ | ||
| 86 | //var maxField = 10; //Input fields increment limitation | ||
| 87 | var addButton = $('.add_button'); //Add button selector | ||
| 88 | var wrapper = $('.field_wrapper'); //Input field wrapper | ||
| 89 | var fieldHTML = '<div class="row"><label class="col-md-4 control-label" for="subDisposition"></label><div class="col-md-7 controls tmar"><input type="text" class="form-control" name="subDisposition[]" required /></div><div class="col-md-1 controls tmar"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a></div></div>'; //New input field html | ||
| 90 | |||
| 91 | //var x = 1; //Initial field counter is 1 | ||
| 92 | |||
| 93 | //Once add button is clicked | ||
| 94 | $(addButton).click(function(){ | ||
| 95 | //Check maximum number of input fields | ||
| 96 | //if(x < maxField){ | ||
| 97 | //x++; //Increment field counter | ||
| 98 | $(wrapper).append(fieldHTML); //Add field html | ||
| 99 | //} | ||
| 100 | }); | ||
| 101 | |||
| 102 | //Once remove button is clicked | ||
| 103 | $(wrapper).on('click', '.remove_button', function(e){ | ||
| 104 | e.preventDefault(); | ||
| 105 | $(this).parent('div').parent('div').remove(); //Remove field html | ||
| 106 | //x--; //Decrement field counter | ||
| 107 | }); | ||
| 108 | $('#dispositionForm').on('submit', function(event){ | ||
| 109 | event.preventDefault(); | ||
| 110 | var putdata = $('#dispositionForm').serialize(); | ||
| 111 | |||
| 112 | doAjax('disposition?action=isExists',putdata,'','','','POST',function(retrstr){ | ||
| 113 | if(retrstr.responseText == "true"){ | ||
| 114 | simpleNotification('Error','topRight',"Disposition Already Exists!"); | ||
| 115 | return false; | ||
| 116 | }else{ | ||
| 117 | doAjax('disposition?action=updateDisposition',putdata,'dispositionFormDiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 118 | doAjax('disposition','','content','ajax_disposition','singlethis','GET',function(retrstr){ | ||
| 119 | simpleNotification('Success','topRight',"Disposition updated suceesfully!"); | ||
| 120 | }); | ||
| 121 | }); | ||
| 122 | } | ||
| 123 | }); | ||
| 124 | |||
| 125 | }); | ||
| 126 | }); | ||
| 127 | |||
| 128 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -38,48 +38,71 @@ | ... | @@ -38,48 +38,71 @@ |
| 38 | 38 | ||
| 39 | <!-- Category Heading --> | 39 | <!-- Category Heading --> |
| 40 | <div class="heading-buttons bg-gray border-bottom innerR half"> | 40 | <div class="heading-buttons bg-gray border-bottom innerR half"> |
| 41 | <a href="#" class="btn btn-sm btn-inverse pull-right" onclick="doAjax('campaign/create','','campaignformdiv','ajax_group_create','singlethis','GET');return false"><i class="fa fa-plus fa-fw"></i>New Disposition</a> | 41 | <a href="#" class="btn btn-sm btn-inverse pull-right" onclick="doAjax('disposition/create','','dispositionFormDiv','ajax_group_create','singlethis','GET');return false"><i class="fa fa-plus fa-fw"></i>New Disposition</a> |
| 42 | <h4 class="innerTB margin-bottom-none">Dispositions</h4> | 42 | <h4 class="innerTB margin-bottom-none">Disposition List</h4> |
| 43 | <div class="clearfix"></div> | 43 | <div class="clearfix"></div> |
| 44 | </div> | 44 | </div> |
| 45 | <!-- End Category Heading --> | 45 | <!-- End Category Heading --> |
| 46 | 46 | ||
| 47 | <?php //echo $grouplist->render(); ?> | 47 | <?php //echo $grouplist->render(); ?> |
| 48 | <?php foreach ($dispositionList as $dispo) | 48 | <?php if(count($dispositions) > 0){ |
| 49 | { //print_r($dispo);exit(); | 49 | foreach ($dispositions as $dispo){ //echo "<pre>";print_r($dispo);exit(); |
| 50 | $tphoto="assets/images/people/avatar.jpg"; | 50 | $tphoto="assets/images/people/avatar.jpg"; |
| 51 | ?> | 51 | ?> |
| 52 | <!-- Category Listing --> | 52 | <!-- dispolist Listing --> |
| 53 | <div class="row innerAll half border-bottom bg-gray- hover"> | 53 | <div class="row innerAll half border-bottom bg-gray-hover"> |
| 54 | <div class="col-sm-8 col-xs-10"> | 54 | <div class="col-sm-2 col-xs-4"> |
| 55 | <ul class="media-list margin-none"> | 55 | <ul class="media-list margin-none"> |
| 56 | <li class="media"> | 56 | <li class="media"> |
| 57 | <a class="pull-left innerAll" href="#" onclick="editCampaign(' <?php echo $dispo['code']; ?>' , '<?php echo $dispo['disposition']; ?>', '<?php echo $dispo['disposition']; ?>');"> | 57 | <a class="pull-left innerAll" href="#" onclick="doAjax('disposition/{!!$dispo->dispoId!!}/edit','','dispositionFormDiv','ajax_group_create','singlethis','GET');return false;"> |
| 58 | <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> | 58 | <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> |
| 59 | </a> | 59 | </a> |
| 60 | <a class="pull-left innerAll" href="#" onclick="doAjax('group/{!!$tgroup->id!!}','','campaignformdiv','ajax_group_delete','singlethis','DELETE');return false;"> | 60 | <!-- <div class="media-body"> |
| 61 | <span class="btn btn-primary btn-xs"><i class="fa fa-trash-o"></i></span> | ||
| 62 | </a> | ||
| 63 | <div class="media-body"> | ||
| 64 | <div class="innerAll"> | 61 | <div class="innerAll"> |
| 65 | <h5 class=""><a href="#" class="media-heading text-primary">{!!$dispo['code']!!} : {{$dispo['disposition']}}</a></h5> | 62 | <h5 class=""><a href="#" class="media-heading text-primary" onclick="doAjax('disposition/{!!$dispo->dispoId!!}/edit','','dispositionFormDiv','ajax_group_create','singlethis','GET');return false;"> {!!$dispo->plan!!}</a></h5> |
| 66 | <div class="clearfix"></div> | 63 | <div class="clearfix"></div> |
| 67 | |||
| 68 | </div> | 64 | </div> |
| 69 | 65 | ||
| 70 | </div> | 66 | </div> --> |
| 71 | </li> | 67 | </li> |
| 72 | </ul> | 68 | </ul> |
| 73 | </div> | 69 | </div> |
| 74 | <div class="col-sm-3 col-xs-2"> | 70 | <div class="col-sm-4 col-xs-hidden"> |
| 71 | <div class="innerAll"> | ||
| 72 | <div class="media"> | ||
| 73 | <!-- <a href="#" class="pull-left"> | ||
| 74 | <img src="{!!$tphoto!!}" class="media-object" width=35px /> | ||
| 75 | </a> --> | ||
| 76 | <div class="media-body"> | ||
| 77 | <a href="#" class="text-small" title='{!!$dispo->created_at!!}' onclick="doAjax('disposition/{!!$dispo->dispoId!!}/edit','','dispositionFormDiv','ajax_group_create','singlethis','GET');return false;">{!!$dispo->code!!} : {!!$dispo->disposition!!}</a> | ||
| 78 | <div class="clearfix"></div> | ||
| 79 | <small> | ||
| 80 | @if($dispo->status=="active") | ||
| 81 | <span class="label label-success">{!!$dispo->status!!}</span> | ||
| 82 | @elseif($dispo->status=="inactive") | ||
| 83 | <span class="label label-warning">{!!$dispo->status!!}</span> | ||
| 84 | @endif | ||
| 85 | </small> | ||
| 86 | </div> | ||
| 87 | </div> | ||
| 88 | </div> | ||
| 89 | </div> | ||
| 90 | <div class="col-sm-3 col-xs-4"> | ||
| 75 | <div class="text-center"> | 91 | <div class="text-center"> |
| 76 | <p class="strong">Sub Disposition</p> | 92 | <p class="strong">Sub Disposition</p> |
| 77 | <span class="badge badge-primary badge-stroke" data-toggle="tooltip" data-title="Subscribed" data-placement ="right" data-container="body">{{$dispo['totalSubdisposition']}}</span> | 93 | <!-- <span class="badge badge-primary" data-toggle="tooltip" data-title="Published" data-placement="left" data-container="body">0</span> --> |
| 94 | <span class="badge badge-primary badge-stroke" data-toggle="tooltip" data-title="Subscribed" data-placement="right" data-container="body">{!!$dispo->totalSubDispo!!}</span> | ||
| 78 | </div> | 95 | </div> |
| 79 | </div> | 96 | </div> |
| 80 | 97 | ||
| 81 | </div> | 98 | </div> |
| 82 | <!-- // END Category Listing --> | 99 | <!-- // END Dispolist Listing --> |
| 100 | <?php } }else{?> | ||
| 101 | <div class="row innerAll half border-bottom bg-gray-hover"> | ||
| 102 | <div class="col-sm-6 col-xs-8" style="text-align: center;"> | ||
| 103 | <b>No data available</b> | ||
| 104 | </div> | ||
| 105 | </div> | ||
| 83 | <?php } ?> | 106 | <?php } ?> |
| 84 | <?php //echo $grouplist->render(); ?> | 107 | <?php //echo $grouplist->render(); ?> |
| 85 | 108 | ||
| ... | @@ -92,7 +115,7 @@ | ... | @@ -92,7 +115,7 @@ |
| 92 | <div class="col-md-6"> | 115 | <div class="col-md-6"> |
| 93 | 116 | ||
| 94 | <!-- col-separator --> | 117 | <!-- col-separator --> |
| 95 | <div class="col-separator col-separator-last" id=campaignformdiv> | 118 | <div class="col-separator col-separator-last" id=dispositionFormDiv> |
| 96 | </div> | 119 | </div> |
| 97 | <!-- // END col-separator --> | 120 | <!-- // END col-separator --> |
| 98 | 121 | ||
| ... | @@ -118,7 +141,16 @@ menuAction("group?page="+res[1]); | ... | @@ -118,7 +141,16 @@ menuAction("group?page="+res[1]); |
| 118 | return false; | 141 | return false; |
| 119 | }); | 142 | }); |
| 120 | 143 | ||
| 121 | function editCampaign(){ | 144 | $(document).ready(function(){ |
| 122 | doAjax('campaign/edit','','campaignformdiv','ajax_group_create','singlethis','GET');return false; | 145 | |
| 123 | } | 146 | }); |
| 124 | </script> | 147 | </script> |
| 148 | <style type="text/css"> | ||
| 149 | .tmar { | ||
| 150 | margin-top : 10px; | ||
| 151 | } | ||
| 152 | .iconsize { | ||
| 153 | font-size: 2em; | ||
| 154 | margin-top: 5px; | ||
| 155 | } | ||
| 156 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i> Edit Disposition Plan | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | <?php //echo "<prE>";print_r($dispositionPlan[0]->dispositionPlanId);exit(); ?> | ||
| 10 | <form method="post" id="dispositionForm" class="innerAll"> | ||
| 11 | <input class="form-control" name="dispositionPlanId" type="hidden" value="{!!$dispositionPlan[0]->dispositionPlanId!!}" /> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="plan">Disposition Plan Name</label> | ||
| 16 | <div class="col-md-8 controls tmar"> | ||
| 17 | <input class="form-control" id="plan" name="plan" type="text" value="{!!$dispositionPlan[0]->name!!}" required /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group"> | ||
| 22 | <label class="col-md-4 control-label" for="status">Status</label> | ||
| 23 | <div class="col-md-8 controls tmar"> | ||
| 24 | <select class="form-control" id="" name="status" required> | ||
| 25 | <option value="{!!$dispositionPlan[0]->status!!}">{!!$dispositionPlan[0]->status!!}</option> | ||
| 26 | <option value="active">Active</option> | ||
| 27 | <option value="inactive">Inactive</option> | ||
| 28 | </select> | ||
| 29 | </div> | ||
| 30 | </div> | ||
| 31 | |||
| 32 | <div class="control-group"> | ||
| 33 | <label class="col-md-12 control-label tmar" for="status">Disposition</label> | ||
| 34 | </div> | ||
| 35 | |||
| 36 | |||
| 37 | <div class="control-group field_wrapper"> | ||
| 38 | <?php foreach ($dispositionPlan as $key => $dispoList) { ?> | ||
| 39 | <?php //$dispositions = explode(",", $dispositionPlan[0]->dispositions); ?> | ||
| 40 | |||
| 41 | <?php //for ($i=0; $i < count($dispositions); $i++) { | ||
| 42 | if($key == 0){ ?> | ||
| 43 | |||
| 44 | <div class="row"> | ||
| 45 | <div class="col-md-11"> | ||
| 46 | <div class="panel panel-info"> | ||
| 47 | <div class="panel-body"> | ||
| 48 | <div class="row" style="margin: 5px"> | ||
| 49 | <div class="col-md-4"> | ||
| 50 | <label>Select Disposition:</label> | ||
| 51 | </div> | ||
| 52 | <?php $newFieldOption = ''; $data = ''; $subDispoList = ''; | ||
| 53 | if(isset($dispositionEntities)) | ||
| 54 | foreach($dispositionEntities as $dispositionEntity) | ||
| 55 | { | ||
| 56 | $s=''; | ||
| 57 | if($dispoList->disposition == $dispositionEntity->disposition){ | ||
| 58 | $s='selected'; | ||
| 59 | $subDispoList = $dispositionEntity->sunDispoName; | ||
| 60 | } | ||
| 61 | $data .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition' $s>$dispositionEntity->disposition</option>"; | ||
| 62 | |||
| 63 | $newFieldOption .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition'>$dispositionEntity->disposition</option>"; | ||
| 64 | } | ||
| 65 | ?> | ||
| 66 | <div class="col-md-8 controls tmar"> | ||
| 67 | <select class="form-control disposition" name="disposition[]" data-subDospoId="subDisposition1" required> | ||
| 68 | <option value></option> | ||
| 69 | <?php echo $data; ?> | ||
| 70 | </select> | ||
| 71 | </div> | ||
| 72 | </div> | ||
| 73 | |||
| 74 | <div class="row" style="margin: 5px"> | ||
| 75 | <div class="col-md-4"> | ||
| 76 | <label>Select Sub Disposition:</label> | ||
| 77 | </div> | ||
| 78 | <div class="col-md-8 controls tmar"> | ||
| 79 | <select name="subDisposition[0][]" id="subDisposition1" class="select2multi" style='width:100%' multiple="" required> | ||
| 80 | <?php | ||
| 81 | $selectedSubDisposition = explode(",", $dispoList->sub_disposition); | ||
| 82 | $subDisposition = explode(",", $subDispoList); | ||
| 83 | |||
| 84 | foreach ($subDisposition as $key => $subDispo) { | ||
| 85 | $seltext = ''; | ||
| 86 | foreach ($selectedSubDisposition as $key => $selSubDispo) { | ||
| 87 | if($selSubDispo == $subDispo){ | ||
| 88 | $seltext = 'selected'; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | echo "<option value='$subDispo' $seltext>$subDispo</option>"; | ||
| 92 | } | ||
| 93 | ?> | ||
| 94 | </select> | ||
| 95 | </div> | ||
| 96 | </div> | ||
| 97 | |||
| 98 | </div> | ||
| 99 | </div> | ||
| 100 | </div> | ||
| 101 | <div class="col-md-1"> | ||
| 102 | <a href="javascript:void(0);" class="add_button" title="Add field"><i class="fa fa-plus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 103 | </div> | ||
| 104 | </div> | ||
| 105 | |||
| 106 | <?php }else{ ?> | ||
| 107 | <div class="row"> | ||
| 108 | <div class="col-md-11"> | ||
| 109 | <div class="panel panel-info"> | ||
| 110 | <div class="panel-body"> | ||
| 111 | <div class="row" style="margin: 5px"> | ||
| 112 | <div class="col-md-4"> | ||
| 113 | <label>Select Disposition:</label> | ||
| 114 | </div> | ||
| 115 | <?php $data = ''; $subDispoList = ''; | ||
| 116 | if(isset($dispositionEntities)) | ||
| 117 | foreach($dispositionEntities as $dispositionEntity) | ||
| 118 | { | ||
| 119 | $s=''; | ||
| 120 | if($dispoList->disposition == $dispositionEntity->disposition){ | ||
| 121 | $s='selected'; | ||
| 122 | $subDispoList = $dispositionEntity->sunDispoName; | ||
| 123 | } | ||
| 124 | $data .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition' $s>$dispositionEntity->disposition</option>"; | ||
| 125 | } | ||
| 126 | ?> | ||
| 127 | <div class="col-md-8 controls tmar"> | ||
| 128 | <select class="form-control disposition" name="disposition[$key]" data-subDospoId="subDisposition<?php echo $key; ?>" required> | ||
| 129 | <option value></option> | ||
| 130 | <?php echo $data; ?> | ||
| 131 | </select> | ||
| 132 | </div> | ||
| 133 | </div> | ||
| 134 | |||
| 135 | <div class="row" style="margin: 5px"> | ||
| 136 | <div class="col-md-4"> | ||
| 137 | <label>Select Sub Disposition:</label> | ||
| 138 | </div> | ||
| 139 | <div class="col-md-8 controls tmar"> | ||
| 140 | <select name="subDisposition[$key][]" id="subDisposition<?php echo $key; ?>" class="select2multi" style='width:100%' multiple="" required> | ||
| 141 | <?php | ||
| 142 | $selectedSubDisposition = explode(",", $dispoList->sub_disposition); | ||
| 143 | $subDisposition = explode(",", $subDispoList); | ||
| 144 | |||
| 145 | foreach ($subDisposition as $key => $subDispo) { | ||
| 146 | $seltext = ''; | ||
| 147 | foreach ($selectedSubDisposition as $key => $selSubDispo) { | ||
| 148 | if($selSubDispo == $subDispo){ | ||
| 149 | $seltext = 'selected'; | ||
| 150 | } | ||
| 151 | } | ||
| 152 | echo "<option value='$subDispo' $seltext>$subDispo</option>"; | ||
| 153 | } | ||
| 154 | ?> | ||
| 155 | </select> | ||
| 156 | </div> | ||
| 157 | </div> | ||
| 158 | |||
| 159 | </div> | ||
| 160 | </div> | ||
| 161 | </div> | ||
| 162 | <div class="col-md-1"> | ||
| 163 | <a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 164 | </div> | ||
| 165 | </div> | ||
| 166 | |||
| 167 | <?php } | ||
| 168 | //} | ||
| 169 | } ?> | ||
| 170 | </div> | ||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | |||
| 175 | <div class="form-actions"> | ||
| 176 | <!-- <button type="submit" class="btn btn-primary" onclick='createDisposition();return false;'>Save changes</button> --> | ||
| 177 | |||
| 178 | <input type="submit" name="save" id="save" class="btn btn-primary" value="Save changes"> | ||
| 179 | </div> | ||
| 180 | </fieldset> | ||
| 181 | </form> | ||
| 182 | <script> | ||
| 183 | $(document).ready(function(){ | ||
| 184 | |||
| 185 | var i = 1; | ||
| 186 | var wrapper = $('.field_wrapper'); //Input field wrapper | ||
| 187 | |||
| 188 | $('.add_button').click(function(){ | ||
| 189 | i++; | ||
| 190 | var dispoOption = "<?php echo $newFieldOption; ?>"; | ||
| 191 | var fieldHTML = '<div class="row"><div class="col-md-11"><div class="panel panel-info"><div class="panel-body"><div class="row" style="margin: 5px"><div class="col-md-4"><label>Select Disposition:</label></div><div class="col-md-8 controls tmar"><select name="disposition[]" class="form-control disposition" data-subDospoId="subDisposition'+i+'" required><option value></option>'; | ||
| 192 | fieldHTML = fieldHTML + dispoOption; | ||
| 193 | fieldHTML = fieldHTML +'</select></div></div><div class="row" style="margin: 5px"><div class="col-md-4"> <label>Select Sub Disposition:</label></div><div class="col-md-8 controls tmar"><select name="subDisposition['+(i-1)+'][]" id="subDisposition'+i+'" class="select2multi" style="width:100%"" multiple="" required></select></div></div></div></div></div><div class="col-md-1"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a></div></div>'; //New input field html | ||
| 194 | |||
| 195 | $(wrapper).append(fieldHTML); | ||
| 196 | $(".select2multi").not('.kstych_init').addClass('kstych_init').select2({placeholder: "Select...",allowClear: true }); | ||
| 197 | }); | ||
| 198 | |||
| 199 | $(wrapper).on('click', '.remove_button', function(e){ | ||
| 200 | e.preventDefault(); | ||
| 201 | $(this).parent('div').parent('div').remove(); | ||
| 202 | }); | ||
| 203 | |||
| 204 | //$(".disposition").change(function(){ | ||
| 205 | $('body').on('click', '.disposition', function() { | ||
| 206 | |||
| 207 | var subDispositionId = $(this).attr('data-subDospoId'); | ||
| 208 | var subDispo = $(this).find(':selected').attr('data-text') //this.find(':selected').attr('data-text'); | ||
| 209 | var subdispolist = subDispo.split(','); | ||
| 210 | $("#"+subDispositionId).select2("val", "Select"); | ||
| 211 | updateJSSelect(subDispositionId,subdispolist); | ||
| 212 | |||
| 213 | }); | ||
| 214 | |||
| 215 | $('#dispositionForm').on('submit', function(event){ | ||
| 216 | event.preventDefault(); | ||
| 217 | var putdata = $('#dispositionForm').serialize(); | ||
| 218 | |||
| 219 | doAjax('dispositionPlan?action=isExists',putdata,'','','','POST',function(retrstr){ | ||
| 220 | if(retrstr.responseText == "true"){ | ||
| 221 | simpleNotification('Error','topRight',"Disposition plan Already Exists!"); | ||
| 222 | return false; | ||
| 223 | }else{ | ||
| 224 | doAjax('dispositionPlan?action=updateDispositionPlan',putdata,'dispositionPlanFormDiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 225 | doAjax('dispositionPlan','','content','ajax_dispositionPlan','singlethis','GET',function(retrstr){ | ||
| 226 | simpleNotification('Success','topRight',"Disposition plan updated suceesfully!"); | ||
| 227 | }); | ||
| 228 | }); | ||
| 229 | } | ||
| 230 | |||
| 231 | }); | ||
| 232 | }); | ||
| 233 | }); | ||
| 234 | </script> |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i>Add Disposition Plan | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | |||
| 10 | |||
| 11 | <form method="post" id="dispositionPlanForm" class="innerAll"> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="plan">Disposition Plan Name</label> | ||
| 16 | <div class="col-md-8 controls tmar"> | ||
| 17 | <input class="form-control" id="plan" name="plan" type="text" value="" required /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group"> | ||
| 22 | <label class="col-md-4 control-label" for="status">Status</label> | ||
| 23 | <div class="col-md-8 controls tmar"> | ||
| 24 | <select class="form-control" id="" name="status" required> | ||
| 25 | <option value="active">Active</option> | ||
| 26 | <option value="inactive">Inactive</option> | ||
| 27 | </select> | ||
| 28 | </div> | ||
| 29 | </div> | ||
| 30 | |||
| 31 | <div class="control-group"> | ||
| 32 | <label class="col-md-12 control-label tmar" for="status">Disposition</label> | ||
| 33 | </div> | ||
| 34 | |||
| 35 | <div class="control-group field_wrapper"> | ||
| 36 | <div class="row"> | ||
| 37 | <div class="col-md-11"> | ||
| 38 | <div class="panel panel-info"> | ||
| 39 | <div class="panel-body"> | ||
| 40 | <div class="row" style="margin: 5px"> | ||
| 41 | <div class="col-md-4"> | ||
| 42 | <label>Select Disposition:</label> | ||
| 43 | </div> | ||
| 44 | <?php $data = ''; | ||
| 45 | if(isset($dispositionEntities)) | ||
| 46 | foreach($dispositionEntities as $dispositionEntity) | ||
| 47 | { | ||
| 48 | $data .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition'>$dispositionEntity->disposition</option>"; | ||
| 49 | } | ||
| 50 | ?> | ||
| 51 | <div class="col-md-8 controls tmar"> | ||
| 52 | <select class="form-control disposition" name="disposition[]" data-subDospoId="subDisposition1" required> | ||
| 53 | <option value>Select ..</option> | ||
| 54 | <?php echo $data; ?> | ||
| 55 | </select> | ||
| 56 | </div> | ||
| 57 | </div> | ||
| 58 | |||
| 59 | <div class="row" style="margin: 5px"> | ||
| 60 | <div class="col-md-4"> | ||
| 61 | <label>Select Sub Disposition:</label> | ||
| 62 | </div> | ||
| 63 | <div class="col-md-8 controls tmar"> | ||
| 64 | <select name="subDisposition[0][]" id="subDisposition1" class="select2multi" style='width:100%' multiple=""> | ||
| 65 | </select> | ||
| 66 | </div> | ||
| 67 | </div> | ||
| 68 | |||
| 69 | </div> | ||
| 70 | </div> | ||
| 71 | </div> | ||
| 72 | <div class="col-md-1"> | ||
| 73 | <a href="javascript:void(0);" class="add_button" title="Add field"><i class="fa fa-plus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 74 | </div> | ||
| 75 | </div> | ||
| 76 | </div> | ||
| 77 | |||
| 78 | <div class="form-actions"> | ||
| 79 | |||
| 80 | <input type="submit" name="save" id="save" class="btn btn-primary" value="Save changes"> | ||
| 81 | </div> | ||
| 82 | </fieldset> | ||
| 83 | </form> | ||
| 84 | <script> | ||
| 85 | $(document).ready(function(){ | ||
| 86 | var i = 1; | ||
| 87 | var wrapper = $('.field_wrapper'); //Input field wrapper | ||
| 88 | |||
| 89 | $('body').on('click', '.add_button', function() { | ||
| 90 | i++; | ||
| 91 | var dispoOption = "<?php echo $data; ?>"; | ||
| 92 | var fieldHTML = '<div class="row"><div class="col-md-11"><div class="panel panel-info"><div class="panel-body"><div class="row" style="margin: 5px"><div class="col-md-4"><label>Select Disposition:</label></div><div class="col-md-8 controls tmar"><select name="disposition[]" class="form-control disposition" data-subDospoId="subDisposition'+i+'" required><option value>Select...</option>'; | ||
| 93 | fieldHTML = fieldHTML + dispoOption; | ||
| 94 | fieldHTML = fieldHTML +'</select></div></div><div class="row" style="margin: 5px"><div class="col-md-4"> <label>Select Sub Disposition:</label></div><div class="col-md-8 controls tmar"><select name="subDisposition['+(i-1)+'][]" id="subDisposition'+i+'" class="select2multi" style="width:100%"" multiple=""></select></div></div></div></div></div><div class="col-md-1"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a></div></div>'; //New input field html | ||
| 95 | |||
| 96 | $(wrapper).append(fieldHTML); | ||
| 97 | |||
| 98 | $(".select2multi").not('.kstych_init').addClass('kstych_init').select2({placeholder: "Select...",allowClear: true }); | ||
| 99 | }); | ||
| 100 | |||
| 101 | $(wrapper).on('click', '.remove_button', function(e){ | ||
| 102 | e.preventDefault(); | ||
| 103 | $(this).parent('div').parent('div').remove(); | ||
| 104 | }); | ||
| 105 | |||
| 106 | //$(".disposition").change(function(){ | ||
| 107 | $('body').on('click', '.disposition', function() { | ||
| 108 | |||
| 109 | var subDispositionId = $(this).attr('data-subDospoId'); | ||
| 110 | var subDispo = $(this).find(':selected').attr('data-text') //this.find(':selected').attr('data-text'); | ||
| 111 | var subdispolist = subDispo.split(','); | ||
| 112 | $("#"+subDispositionId).select2("val", "Select"); | ||
| 113 | updateJSSelect(subDispositionId,subdispolist); | ||
| 114 | |||
| 115 | }); | ||
| 116 | |||
| 117 | $('#dispositionPlanForm').on('submit', function(event){ | ||
| 118 | event.preventDefault(); | ||
| 119 | var putdata = $('#dispositionPlanForm').serialize(); | ||
| 120 | |||
| 121 | doAjax('dispositionPlan?action=isExists',putdata,'','','','POST',function(retrstr){ | ||
| 122 | if(retrstr.responseText == "true"){ | ||
| 123 | simpleNotification('Error','topRight',"Disposition plan Already Exists!"); | ||
| 124 | return false; | ||
| 125 | }else{ | ||
| 126 | doAjax('dispositionPlan?action=createDispositionPlan',putdata,'dispositionPlanFormDiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 127 | doAjax('dispositionPlan','','content','ajax_dispositionPlan','singlethis','GET',function(retrstr){ | ||
| 128 | simpleNotification('Success','topRight',"Disposition plan created suceesfully!"); | ||
| 129 | }); | ||
| 130 | }); | ||
| 131 | } | ||
| 132 | }); | ||
| 133 | }); | ||
| 134 | |||
| 135 | }); | ||
| 136 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <!-- Heading --> | ||
| 2 | <h5 class="innerAll margin-none bg-primary"> | ||
| 3 | <i class="fa fa-fw fa-pencil"></i> Edit Disposition Plan | ||
| 4 | <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false"> | ||
| 5 | <i class="fa fa-user fa-fw"></i> | ||
| 6 | |||
| 7 | </a> | ||
| 8 | </h5> | ||
| 9 | <?php //echo "<prE>";print_r($dispositionPlan[0]->dispositionPlanId);exit(); ?> | ||
| 10 | <form method="post" id="dispositionForm" class="innerAll"> | ||
| 11 | <input class="form-control" name="dispositionPlanId" type="hidden" value="{!!$dispositionPlan[0]->dispositionPlanId!!}" /> | ||
| 12 | <fieldset> | ||
| 13 | |||
| 14 | <div class="control-group"> | ||
| 15 | <label class="col-md-4 control-label" for="plan">Disposition Plan Name</label> | ||
| 16 | <div class="col-md-8 controls tmar"> | ||
| 17 | <input class="form-control" id="plan" name="plan" type="text" value="{!!$dispositionPlan[0]->name!!}" required /> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | |||
| 21 | <div class="control-group"> | ||
| 22 | <label class="col-md-4 control-label" for="status">Status</label> | ||
| 23 | <div class="col-md-8 controls tmar"> | ||
| 24 | <select class="form-control" id="" name="status" required> | ||
| 25 | <option value="{!!$dispositionPlan[0]->status!!}">{!!$dispositionPlan[0]->status!!}</option> | ||
| 26 | <option value="active">Active</option> | ||
| 27 | <option value="inactive">Inactive</option> | ||
| 28 | </select> | ||
| 29 | </div> | ||
| 30 | </div> | ||
| 31 | |||
| 32 | <div class="control-group"> | ||
| 33 | <label class="col-md-12 control-label tmar" for="status">Disposition</label> | ||
| 34 | </div> | ||
| 35 | |||
| 36 | |||
| 37 | <div class="control-group field_wrapper"> | ||
| 38 | <?php foreach ($dispositionPlan as $key => $dispoList) { ?> | ||
| 39 | <?php | ||
| 40 | if($key == 0){ ?> | ||
| 41 | |||
| 42 | <div class="row"> | ||
| 43 | <div class="col-md-11"> | ||
| 44 | <div class="panel panel-info"> | ||
| 45 | <div class="panel-body"> | ||
| 46 | <div class="row" style="margin: 5px"> | ||
| 47 | <div class="col-md-4"> | ||
| 48 | <label>Select Disposition:</label> | ||
| 49 | </div> | ||
| 50 | <?php $newFieldOption = ''; $data = ''; $subDispoList = ''; | ||
| 51 | if(isset($dispositionEntities)) | ||
| 52 | foreach($dispositionEntities as $dispositionEntity) | ||
| 53 | { | ||
| 54 | $s=''; | ||
| 55 | if($dispoList->disposition == $dispositionEntity->disposition){ | ||
| 56 | $s='selected'; | ||
| 57 | $subDispoList = $dispositionEntity->sunDispoName; | ||
| 58 | } | ||
| 59 | $data .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition' $s>$dispositionEntity->disposition</option>"; | ||
| 60 | |||
| 61 | $newFieldOption .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition'>$dispositionEntity->disposition</option>"; | ||
| 62 | } | ||
| 63 | ?> | ||
| 64 | <div class="col-md-8 controls tmar"> | ||
| 65 | <select class="form-control disposition" name="disposition[]" data-subDospoId="subDisposition0" required> | ||
| 66 | <option value></option> | ||
| 67 | <?php echo $data; ?> | ||
| 68 | </select> | ||
| 69 | </div> | ||
| 70 | </div> | ||
| 71 | |||
| 72 | <div class="row" style="margin: 5px"> | ||
| 73 | <div class="col-md-4"> | ||
| 74 | <label>Select Sub Disposition:</label> | ||
| 75 | </div> | ||
| 76 | <div class="col-md-8 controls tmar"> | ||
| 77 | <select name="subDisposition[0][]" id="subDisposition0" class="select2multi" style='width:100%' multiple="" required> | ||
| 78 | <?php | ||
| 79 | $selectedSubDisposition = explode(",", $dispoList->sub_disposition); | ||
| 80 | $subDisposition = explode(",", $subDispoList); | ||
| 81 | |||
| 82 | foreach ($subDisposition as $key => $subDispo) { | ||
| 83 | $seltext = ''; | ||
| 84 | foreach ($selectedSubDisposition as $key => $selSubDispo) { | ||
| 85 | if($selSubDispo == $subDispo){ | ||
| 86 | $seltext = 'selected'; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | echo "<option value='$subDispo' $seltext>$subDispo</option>"; | ||
| 90 | } | ||
| 91 | ?> | ||
| 92 | </select> | ||
| 93 | </div> | ||
| 94 | </div> | ||
| 95 | |||
| 96 | </div> | ||
| 97 | </div> | ||
| 98 | </div> | ||
| 99 | <div class="col-md-1"> | ||
| 100 | <a href="javascript:void(0);" class="add_button" title="Add field"><i class="fa fa-plus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 101 | </div> | ||
| 102 | </div> | ||
| 103 | |||
| 104 | <?php }else{ ?> | ||
| 105 | <div class="row"> | ||
| 106 | <div class="col-md-11"> | ||
| 107 | <div class="panel panel-info"> | ||
| 108 | <div class="panel-body"> | ||
| 109 | <div class="row" style="margin: 5px"> | ||
| 110 | <div class="col-md-4"> | ||
| 111 | <label>Select Disposition:</label> | ||
| 112 | </div> | ||
| 113 | <?php $data = ''; $subDispoList = ''; | ||
| 114 | if(isset($dispositionEntities)) | ||
| 115 | foreach($dispositionEntities as $dispositionEntity) | ||
| 116 | { | ||
| 117 | $s=''; | ||
| 118 | if($dispoList->disposition == $dispositionEntity->disposition){ | ||
| 119 | $s='selected'; | ||
| 120 | $subDispoList = $dispositionEntity->sunDispoName; | ||
| 121 | } | ||
| 122 | $data .= "<option data-id='$dispositionEntity->code' data-text='$dispositionEntity->sunDispoName' value='$dispositionEntity->disposition' $s>$dispositionEntity->disposition</option>"; | ||
| 123 | } | ||
| 124 | ?> | ||
| 125 | <div class="col-md-8 controls tmar"> | ||
| 126 | <select class="form-control disposition" name="disposition[<?php echo $key; ?>]" data-subDospoId="subDisposition<?php echo $key; ?>" required> | ||
| 127 | <option value></option> | ||
| 128 | <?php echo $data; ?> | ||
| 129 | </select> | ||
| 130 | </div> | ||
| 131 | </div> | ||
| 132 | |||
| 133 | <div class="row" style="margin: 5px"> | ||
| 134 | <div class="col-md-4"> | ||
| 135 | <label>Select Sub Disposition:</label> | ||
| 136 | </div> | ||
| 137 | <div class="col-md-8 controls tmar"> | ||
| 138 | <select name="subDisposition[<?php echo $key; ?>][]" id="subDisposition<?php echo $key; ?>" class="select2multi" style='width:100%' multiple="" required> | ||
| 139 | <?php | ||
| 140 | $selectedSubDisposition = explode(",", $dispoList->sub_disposition); | ||
| 141 | $subDisposition = explode(",", $subDispoList); | ||
| 142 | |||
| 143 | foreach ($subDisposition as $key => $subDispo) { | ||
| 144 | $seltext = ''; | ||
| 145 | foreach ($selectedSubDisposition as $key => $selSubDispo) { | ||
| 146 | if($selSubDispo == $subDispo){ | ||
| 147 | $seltext = 'selected'; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | echo "<option value='$subDispo' $seltext>$subDispo</option>"; | ||
| 151 | } | ||
| 152 | ?> | ||
| 153 | </select> | ||
| 154 | </div> | ||
| 155 | </div> | ||
| 156 | |||
| 157 | </div> | ||
| 158 | </div> | ||
| 159 | </div> | ||
| 160 | <div class="col-md-1"> | ||
| 161 | <a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a> | ||
| 162 | </div> | ||
| 163 | </div> | ||
| 164 | |||
| 165 | <?php } | ||
| 166 | //} | ||
| 167 | } ?> | ||
| 168 | </div> | ||
| 169 | |||
| 170 | |||
| 171 | |||
| 172 | |||
| 173 | <div class="form-actions"> | ||
| 174 | <!-- <button type="submit" class="btn btn-primary" onclick='createDisposition();return false;'>Save changes</button> --> | ||
| 175 | |||
| 176 | <input type="submit" name="save" id="save" class="btn btn-primary" value="Save changes"> | ||
| 177 | </div> | ||
| 178 | </fieldset> | ||
| 179 | </form> | ||
| 180 | <script> | ||
| 181 | $(document).ready(function(){ | ||
| 182 | |||
| 183 | var i = $('.disposition').length; | ||
| 184 | var wrapper = $('.field_wrapper'); //Input field wrapper | ||
| 185 | |||
| 186 | $('.add_button').click(function(){ | ||
| 187 | i++; | ||
| 188 | var dispoOption = "<?php echo $newFieldOption; ?>"; | ||
| 189 | var fieldHTML = '<div class="row"><div class="col-md-11"><div class="panel panel-info"><div class="panel-body"><div class="row" style="margin: 5px"><div class="col-md-4"><label>Select Disposition:</label></div><div class="col-md-8 controls tmar"><select name="disposition[]" class="form-control disposition" data-subDospoId="subDisposition'+i+'" required><option value></option>'; | ||
| 190 | fieldHTML = fieldHTML + dispoOption; | ||
| 191 | fieldHTML = fieldHTML +'</select></div></div><div class="row" style="margin: 5px"><div class="col-md-4"> <label>Select Sub Disposition:</label></div><div class="col-md-8 controls tmar"><select name="subDisposition['+(i-1)+'][]" id="subDisposition'+i+'" class="select2multi" style="width:100%"" multiple="" required></select></div></div></div></div></div><div class="col-md-1"><a href="javascript:void(0);" class="remove_button"><i class="fa fa-minus fa-3 iconsize" aria-hidden="true"></i></a></div></div>'; //New input field html | ||
| 192 | |||
| 193 | $(wrapper).append(fieldHTML); | ||
| 194 | |||
| 195 | $(".select2multi").not('.kstych_init').addClass('kstych_init').select2({placeholder: "Select...",allowClear: true }); | ||
| 196 | }); | ||
| 197 | |||
| 198 | $(wrapper).on('click', '.remove_button', function(e){ | ||
| 199 | e.preventDefault(); | ||
| 200 | $(this).parent('div').parent('div').remove(); | ||
| 201 | }); | ||
| 202 | |||
| 203 | //$(".disposition").change(function(){ | ||
| 204 | $('body').on('change', '.disposition', function() { | ||
| 205 | |||
| 206 | var subDispositionId = $(this).attr('data-subDospoId'); | ||
| 207 | var subDispo = $(this).find(':selected').attr('data-text') //this.find(':selected').attr('data-text'); | ||
| 208 | var subdispolist = subDispo.split(','); | ||
| 209 | $("#"+subDispositionId).select2("val", "Select"); | ||
| 210 | updateJSSelect(subDispositionId,subdispolist); | ||
| 211 | |||
| 212 | }); | ||
| 213 | |||
| 214 | $('#dispositionForm').on('submit', function(event){ | ||
| 215 | event.preventDefault(); | ||
| 216 | var putdata = $('#dispositionForm').serialize(); | ||
| 217 | |||
| 218 | doAjax('dispositionPlan?action=isExists',putdata,'','','','POST',function(retrstr){ | ||
| 219 | if(retrstr.responseText == "true"){ | ||
| 220 | simpleNotification('Error','topRight',"Disposition plan Already Exists!"); | ||
| 221 | return false; | ||
| 222 | }else{ | ||
| 223 | doAjax('dispositionPlan?action=updateDispositionPlan',putdata,'dispositionPlanFormDiv','ajax_group_create','singlethis','POST',function(retrstr){ | ||
| 224 | doAjax('dispositionPlan','','content','ajax_dispositionPlan','singlethis','GET',function(retrstr){ | ||
| 225 | simpleNotification('Success','topRight',"Disposition plan updated suceesfully!"); | ||
| 226 | }); | ||
| 227 | }); | ||
| 228 | } | ||
| 229 | |||
| 230 | }); | ||
| 231 | }); | ||
| 232 | }); | ||
| 233 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <style> | ||
| 2 | .heading-buttons h4{ | ||
| 3 | line-height:20px; | ||
| 4 | } | ||
| 5 | </style> | ||
| 6 | <div class="layout-app"><!-- row-app --> | ||
| 7 | |||
| 8 | <div class="row row-app"> | ||
| 9 | |||
| 10 | <!-- col --> | ||
| 11 | <div class="col-md-12"> | ||
| 12 | |||
| 13 | <!-- col-separator.box --> | ||
| 14 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 15 | |||
| 16 | <!-- col-table --> | ||
| 17 | <div class="col-table" id=authorworkspacediv> | ||
| 18 | <!-- Search Bar --> | ||
| 19 | <div class="input-group"> | ||
| 20 | <input type="text" class="form-control" placeholder="Search for Disposition..."> | ||
| 21 | <span class="input-group-btn"> | ||
| 22 | <button class="btn btn-primary rounded-none" type="button"><i class="fa fa-search"></i></button> | ||
| 23 | </span> | ||
| 24 | </div> | ||
| 25 | <div class="col-separator-h"></div> | ||
| 26 | <!-- End Search Bar --> | ||
| 27 | |||
| 28 | <div class="col-table-row"> | ||
| 29 | |||
| 30 | <div class="col-app col-unscrollable"> | ||
| 31 | |||
| 32 | <div class="col-app"> | ||
| 33 | |||
| 34 | <div class="row-app"> | ||
| 35 | |||
| 36 | <div class="col-md-6"> | ||
| 37 | <div class="col-separator"> | ||
| 38 | |||
| 39 | <!-- Category Heading --> | ||
| 40 | <div class="heading-buttons bg-gray border-bottom innerR half"> | ||
| 41 | <a href="#" class="btn btn-sm btn-inverse pull-right" onclick="doAjax('dispositionPlan/create','','dispositionPlanFormDiv','ajax_group_create','singlethis','GET');return false"><i class="fa fa-plus fa-fw"></i>New Disposition Plan</a> | ||
| 42 | <h4 class="innerTB margin-bottom-none">Disposition Plan</h4> | ||
| 43 | <div class="clearfix"></div> | ||
| 44 | </div> | ||
| 45 | <!-- End Category Heading --> | ||
| 46 | |||
| 47 | <?php //echo $grouplist->render(); ?> | ||
| 48 | <?php if(count($dispositionPlan) > 0){ | ||
| 49 | foreach ($dispositionPlan as $dispo){ //echo "<pre>";print_r($dispo);exit(); | ||
| 50 | $tphoto="assets/images/people/avatar.jpg"; | ||
| 51 | ?> | ||
| 52 | <!-- dispolist Listing --> | ||
| 53 | <div class="row innerAll half border-bottom bg-gray-hover"> | ||
| 54 | <div class="col-sm-6 col-xs-8"> | ||
| 55 | <ul class="media-list margin-none"> | ||
| 56 | <li class="media"> | ||
| 57 | <a class="pull-left innerAll" href="#" onclick="doAjax('dispositionPlan/{!!$dispo->dispositionPlanId!!}/edit','','dispositionPlanFormDiv','ajax_group_create','singlethis','GET');return false;"> | ||
| 58 | <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> | ||
| 59 | </a> | ||
| 60 | <!-- <a class="pull-left innerAll" href="#" onclick="doAjax('campaign/{!!$dispo->id!!}','','groupformdiv','ajax_group_delete','singlethis','DELETE');return false;"> | ||
| 61 | <span class="btn btn-primary btn-xs"><i class="fa fa-trash-o"></i></span> | ||
| 62 | </a> --> | ||
| 63 | <div class="media-body"> | ||
| 64 | <div class="innerAll"> | ||
| 65 | <h5 class=""><a href="#" class="media-heading text-primary" onclick="doAjax('dispositionPlan/{!!$dispo->dispositionPlanId!!}/edit','','dispositionPlanFormDiv','ajax_group_create','singlethis','GET');return false;"> {!!$dispo->name!!}</a></h5> | ||
| 66 | <div class="clearfix"></div> | ||
| 67 | <small> | ||
| 68 | @if($dispo->status=="active") | ||
| 69 | <span class="label label-success">{!!$dispo->status!!}</span> | ||
| 70 | @elseif($dispo->status=="inactive") | ||
| 71 | <span class="label label-warning">{!!$dispo->status!!}</span> | ||
| 72 | @endif | ||
| 73 | </small> | ||
| 74 | <!-- <small class="margin-none label label-inverse">Social</small> | ||
| 75 | <small class="margin-none label label-inverse">Learn</small> | ||
| 76 | <small class="margin-none label label-inverse">Author</small> | ||
| 77 | <small class="margin-none label label-inverse">Library</small> --> | ||
| 78 | |||
| 79 | </div> | ||
| 80 | |||
| 81 | </div> | ||
| 82 | </li> | ||
| 83 | </ul> | ||
| 84 | </div> | ||
| 85 | <!-- <div class="col-sm-3 col-xs-hidden"> | ||
| 86 | <div class="innerAll"> | ||
| 87 | <div class="media"> | ||
| 88 | <div class="media-body"> | ||
| 89 | <a href="#" class="text-small" title='{!!$dispo->created_at!!}' onclick="doAjax('dispositionPlan/{!!$dispo->dispoId!!}/edit','','dispositionPlanFormDiv','ajax_group_create','singlethis','GET');return false;">{!!$dispo->disposition!!}</a> | ||
| 90 | <div class="clearfix"></div> | ||
| 91 | <small> | ||
| 92 | @if($dispo->status=="active") | ||
| 93 | <span class="label label-success">{!!$dispo->status!!}</span> | ||
| 94 | @elseif($dispo->status=="inactive") | ||
| 95 | <span class="label label-warning">{!!$dispo->status!!}</span> | ||
| 96 | @endif | ||
| 97 | </small> | ||
| 98 | </div> | ||
| 99 | </div> | ||
| 100 | </div> | ||
| 101 | </div> --> | ||
| 102 | <div class="col-sm-3 col-xs-4"> | ||
| 103 | <div class="text-center"> | ||
| 104 | <p class="strong">Disposition</p> | ||
| 105 | <!-- <span class="badge badge-primary" data-toggle="tooltip" data-title="Published" data-placement="left" data-container="body">0</span> --> | ||
| 106 | <span class="badge badge-primary badge-stroke" data-toggle="tooltip" data-title="Subscribed" data-placement="right" data-container="body">{!!$dispo->totalDisposition!!}</span> | ||
| 107 | </div> | ||
| 108 | </div> | ||
| 109 | |||
| 110 | </div> | ||
| 111 | <!-- // END Dispolist Listing --> | ||
| 112 | <?php } }else{?> | ||
| 113 | <div class="row innerAll half border-bottom bg-gray-hover"> | ||
| 114 | <div class="col-sm-6 col-xs-8" style="text-align: center;"> | ||
| 115 | <b>No data available</b> | ||
| 116 | </div> | ||
| 117 | </div> | ||
| 118 | <?php } ?> | ||
| 119 | <?php //echo $grouplist->render(); ?> | ||
| 120 | |||
| 121 | </div> | ||
| 122 | <!-- // END col-separator --> | ||
| 123 | </div> | ||
| 124 | <!-- // END col --> | ||
| 125 | |||
| 126 | <!-- col --> | ||
| 127 | <div class="col-md-6"> | ||
| 128 | |||
| 129 | <!-- col-separator --> | ||
| 130 | <div class="col-separator col-separator-last" id=dispositionPlanFormDiv> | ||
| 131 | </div> | ||
| 132 | <!-- // END col-separator --> | ||
| 133 | |||
| 134 | </div> | ||
| 135 | <!-- // END col-table --> | ||
| 136 | |||
| 137 | </div> | ||
| 138 | <!-- // END col-separator.box --> | ||
| 139 | |||
| 140 | </div> | ||
| 141 | <!-- // END col --> | ||
| 142 | |||
| 143 | </div> | ||
| 144 | <!-- // END row-app --> | ||
| 145 | |||
| 146 | </div> | ||
| 147 | <script> | ||
| 148 | $(".pagination a").click(function(e){ | ||
| 149 | e.preventDefault(); | ||
| 150 | var url=$(this).attr("href"); | ||
| 151 | var res = url.split("page="); | ||
| 152 | menuAction("group?page="+res[1]); | ||
| 153 | return false; | ||
| 154 | }); | ||
| 155 | |||
| 156 | $(document).ready(function(){ | ||
| 157 | |||
| 158 | }); | ||
| 159 | </script> | ||
| 160 | <style type="text/css"> | ||
| 161 | .tmar { | ||
| 162 | margin-top : 10px; | ||
| 163 | } | ||
| 164 | .iconsize { | ||
| 165 | font-size: 2em; | ||
| 166 | margin-top: 5px; | ||
| 167 | } | ||
| 168 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | <?php | ||
| 2 | $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); | ||
| 3 | |||
| 4 | //error_reporting(E_ALL); | ||
| 5 | ini_set("memory_limit", -1); | ||
| 6 | |||
| 7 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 8 | $wakka->setUserTimezone(); | ||
| 9 | $themehome=$wakka->GetThemePath('/'); | ||
| 10 | $sindex[0]='salbasic'; | ||
| 11 | $sindex[1]='salhouserent'; | ||
| 12 | $sindex[2]='saltransport'; | ||
| 13 | $sindex[3]='salfood'; | ||
| 14 | $sindex[4]='saltelephone'; | ||
| 15 | $sindex[5]='salmedical'; | ||
| 16 | $sindex[6]='salelectricity'; | ||
| 17 | $sindex[7]='salother'; | ||
| 18 | $sindex[8]='saltotal'; | ||
| 19 | $sindex[9]='nettotal';$kformlib->HRFieldNames['nettotal']="Net Salary"; | ||
| 20 | |||
| 21 | if(Input::has("reportsubmit")) | ||
| 22 | { | ||
| 23 | if(Input::has("savedreportget")) | ||
| 24 | { | ||
| 25 | $filterstr="";$fieldsarr=""; | ||
| 26 | $rpt=Input::get("savedreportget"); | ||
| 27 | |||
| 28 | $userreports=$wakka->GetBBBUserData("UserSavedReports"); | ||
| 29 | if(isset($userreports[$rpt])) | ||
| 30 | { | ||
| 31 | $tarr=json_decode(base64_decode($userreports[$rpt]),true); | ||
| 32 | unset($tarr["_token"]); | ||
| 33 | Input::merge($tarr); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | $empid=Input::get("empid"); | ||
| 38 | $client=Input::get("client"); | ||
| 39 | $currentstatus=Input::get("currentstatus"); | ||
| 40 | $modfrom=explode(".",Input::get("modfrom")); | ||
| 41 | $modto=explode(".",Input::get("modto")); | ||
| 42 | $crefrom=explode(".",Input::get("crefrom")); | ||
| 43 | $creto=explode(".",Input::get("creto")); | ||
| 44 | $reporttmpl=Input::get("reporttmpl"); | ||
| 45 | $visacompany=Input::get("visacompany"); | ||
| 46 | |||
| 47 | $asalmonth=Input::get("asalmonth"); | ||
| 48 | $asalyear=Input::get("asalyear"); | ||
| 49 | |||
| 50 | $frcrefrom=explode(".",Input::get("frcrefrom")); | ||
| 51 | $frcreto=explode(".",Input::get("frcreto")); | ||
| 52 | $fieldbyrange=trim(Input::get("fieldbyrange")); | ||
| 53 | $filterbyfielddates=0; | ||
| 54 | if($fieldbyrange!=""&&sizeof($frcrefrom)==3&&sizeof($frcreto)==3) | ||
| 55 | { | ||
| 56 | $filterbyfielddates=1; | ||
| 57 | $frcrefrom=mktime(0, 0, 0, $frcrefrom[1], $frcrefrom[0], $frcrefrom[2]); | ||
| 58 | $frcreto=mktime(23, 59, 59, $frcreto[1], $frcreto[0], $frcreto[2]); | ||
| 59 | } | ||
| 60 | |||
| 61 | $ddprts=array(); | ||
| 62 | $datesdiffstr=Input::get("datesdiffstr"); | ||
| 63 | if(!empty($datesdiffstr)) | ||
| 64 | { | ||
| 65 | $ddprts=explode(",",$datesdiffstr);//datesdiffstr=servicestoppeddate,joiningdate,LT,180 ==> if(servicestopdate-joiningdate < 180) then ok,else not ok | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | //$finputarr=Input::get("fieldsarr"); | ||
| 70 | $finputarr=$_REQUEST['fieldsarr']; | ||
| 71 | if(is_array($finputarr))foreach($finputarr as $eachfield)$fieldsarr[]=$eachfield; | ||
| 72 | else {echo "Please Select List of fields In report.";return;} | ||
| 73 | |||
| 74 | $reporttype=Input::get("reporttype"); | ||
| 75 | $outputtype=Input::get("outputtype","XLS"); | ||
| 76 | |||
| 77 | if(sizeof($fieldsarr)==0){echo "Please Select List of fields In report.";return;} | ||
| 78 | if($reporttype==""){echo "Please Select a Report Type.";return;} | ||
| 79 | if($client==""&&$currentstatus==""&&$visacompany==''&&$modfrom[0]==''&&$crefrom[0]==''&&$empid==''&&$fieldbyrange==''){echo $client."Please Select atleast one of Client or Status or ModifyFrom or CreatedFrom.";return;} | ||
| 80 | |||
| 81 | if($reporttype=='Binary')$reporttype='|b'; | ||
| 82 | if($reporttype=='History')$reporttype='|h'; | ||
| 83 | if($reporttype=='Values')$reporttype=''; | ||
| 84 | |||
| 85 | |||
| 86 | $filterstr=array(); | ||
| 87 | |||
| 88 | if($empid!="") | ||
| 89 | { | ||
| 90 | $idarr=explode(',',$empid); | ||
| 91 | foreach($idarr as $tid)if(trim($tid)!='')$tarr[]="'$tid'"; | ||
| 92 | $empid=implode(",",$tarr); | ||
| 93 | |||
| 94 | $filterstr[]=" id in ($empid) "; | ||
| 95 | } | ||
| 96 | else | ||
| 97 | { | ||
| 98 | if($client!=""){$filterstr[]=getQueryFromList('client',$client);} | ||
| 99 | if($currentstatus!=""){$filterstr[]=getQueryFromList('currentstatus',$currentstatus);} | ||
| 100 | // if($visacompany!=""){$filterstr[]=getQueryFromList('visacompany',$visacompany);} | ||
| 101 | |||
| 102 | if($modfrom[0]!="")$filterstr[]=" modified>='$modfrom[2]-$modfrom[1]-$modfrom[0] 00:00:00' "; | ||
| 103 | if($modto[0]!="") $filterstr[]=" modified<='$modto[2]-$modto[1]-$modto[0] 23:59:59' "; | ||
| 104 | if($crefrom[0]!="")$filterstr[]=" created>='$crefrom[2]-$crefrom[1]-$crefrom[0] 00:00:00' "; | ||
| 105 | if($creto[0]!="") $filterstr[]=" created<='$creto[2]-$creto[1]-$creto[0] 23:59:59' "; | ||
| 106 | |||
| 107 | if($filterbyfielddates==1) | ||
| 108 | { | ||
| 109 | $filterstr[]=" modified>='".date('Y-m-d 00:00:00',$frcrefrom)."' "; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | $type = PHPExcel_Cell_DataType::TYPE_STRING; | ||
| 113 | |||
| 114 | if(!empty($filterstr))$filterstr=implode(" and ",$filterstr);else $filterstr=""; | ||
| 115 | |||
| 116 | if($filterstr=="")$filterstr="1"; | ||
| 117 | |||
| 118 | $savereportname=Input::get("savereportname"); | ||
| 119 | if($savereportname!="") | ||
| 120 | { | ||
| 121 | $userreports=$wakka->GetBBBUserData("UserSavedReports"); | ||
| 122 | $userreports[$savereportname]=base64_encode(json_encode(Input::all())); | ||
| 123 | $wakka->SetBBBUserData("UserSavedReports",$userreports); | ||
| 124 | } | ||
| 125 | |||
| 126 | $usersarr=$wakka->getPersons($filterstr); | ||
| 127 | |||
| 128 | $inputFileType = "Excel5"; | ||
| 129 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 130 | $objPHPExcel = $objReader->load("$themehome/uploads/sreports/blank.xls"); | ||
| 131 | $baseRow = 3; | ||
| 132 | $highestColumn = sizeof($fieldsarr); | ||
| 133 | |||
| 134 | $baserowArr=$fieldsarr; | ||
| 135 | $objPHPExcel->getActiveSheet()->setCellValue("A1", "id"); | ||
| 136 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 137 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head+1); | ||
| 138 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $baserowArr[$head]); | ||
| 139 | } | ||
| 140 | |||
| 141 | $objPHPExcel->getActiveSheet()->setCellValue("A2", "EMPID"); | ||
| 142 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 143 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head+1); | ||
| 144 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."2", $kformlib->HRFieldNames[$baserowArr[$head]]); | ||
| 145 | } | ||
| 146 | |||
| 147 | $skippedrows=0; | ||
| 148 | foreach($usersarr as $r => $userdata) | ||
| 149 | { | ||
| 150 | $ppldata=unserialize($userdata['peopledata']); | ||
| 151 | $logarr=unserialize($userdata['modifylog']); | ||
| 152 | |||
| 153 | |||
| 154 | $hrexclusiveflag=0;if(empty($ppldata['client']))$ppldata['client']='__'; | ||
| 155 | if(strstr($wakka->HRCoreVars['HRExclusiveClients'],$ppldata['client'])) | ||
| 156 | { | ||
| 157 | if(!$wakka->IsAdmin()) | ||
| 158 | { | ||
| 159 | if(!strstr($wakka->getManagerUsers($wakka->getUserListforClient($ppldata['client'])),$wakka->GetUserName())) | ||
| 160 | { | ||
| 161 | if(!strstr($wakka->GetBBBUserData("clientsownerlist"),$ppldata['client']))$hrexclusiveflag=1; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 166 | |||
| 167 | if(($wakka->GetBBBUserData("readotherdata")=="No"&&!$wakka->recordReadAccess($ppldata))||$hrexclusiveflag==1)$pass=0; | ||
| 168 | else | ||
| 169 | { | ||
| 170 | |||
| 171 | if($filterbyfielddates==1) | ||
| 172 | { | ||
| 173 | if(!isset($ppldata[$fieldbyrange])||trim($ppldata[$fieldbyrange])==""){$skippedrows++;continue;} | ||
| 174 | else | ||
| 175 | { | ||
| 176 | //$fieldbyrange $frcrefrom $frcreto | ||
| 177 | $tdt=explode(".",$ppldata[$fieldbyrange]); | ||
| 178 | if(sizeof($tdt)==3) | ||
| 179 | { | ||
| 180 | $tdt=mktime(0, 0, 0, intval($tdt[1]), intval($tdt[0]), intval($tdt[2])); | ||
| 181 | |||
| 182 | if(!($tdt>=$frcrefrom&&$tdt<=$frcreto)){$skippedrows++;continue;} | ||
| 183 | } | ||
| 184 | else {$skippedrows++;continue;} | ||
| 185 | } | ||
| 186 | } | ||
| 187 | if(sizeof($ddprts)>3) | ||
| 188 | { | ||
| 189 | $dddt1=explode(".",$ppldata[$ddprts[0]]); | ||
| 190 | $dddt2=explode(".",$ppldata[$ddprts[1]]); | ||
| 191 | $dddt1=mktime(0, 0, 0, intval($dddt1[1]), intval($dddt1[0]), intval($dddt1[2])); | ||
| 192 | $dddt2=mktime(0, 0, 0, intval($dddt2[1]), intval($dddt2[0]), intval($dddt2[2])); | ||
| 193 | |||
| 194 | if($ddprts[2]=="LT") | ||
| 195 | { | ||
| 196 | if($dddt1-$dddt2 < $ddprts[3]);else {$skippedrows++;continue;} | ||
| 197 | } | ||
| 198 | if($ddprts[2]=="GT") | ||
| 199 | { | ||
| 200 | if($dddt1-$dddt2 > $ddprts[3]);else {$skippedrows++;continue;} | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | |||
| 205 | $row = $baseRow + $r - $skippedrows;$rkey=0; | ||
| 206 | |||
| 207 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(0,$row)->setValueExplicit($userdata['id'], $type); | ||
| 208 | foreach($baserowArr as $key => $val) | ||
| 209 | { | ||
| 210 | $cellval=$wakka->getXlsVal($baserowArr[$key].$reporttype,$ppldata,$logarr); | ||
| 211 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($key+1,$row)->setValueExplicit($cellval, $type); | ||
| 212 | $rkey=$key+1; | ||
| 213 | } | ||
| 214 | //month data in report | ||
| 215 | if($asalyear>2000&&$asalmonth>0) | ||
| 216 | { | ||
| 217 | $saldata=$ppldata["salaryentries"][$asalyear][$asalmonth]; | ||
| 218 | $leavedata=$ppldata["leavesentries"][$asalyear][1][$asalmonth]; | ||
| 219 | |||
| 220 | |||
| 221 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(++$rkey,$row)->setValueExplicit($leavedata[0][2], $type); | ||
| 222 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey,1)->setValueExplicit("Annual Leaves", $type); | ||
| 223 | |||
| 224 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(++$rkey,$row)->setValueExplicit($leavedata[1][2], $type); | ||
| 225 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey,1)->setValueExplicit("Sick Leaves", $type); | ||
| 226 | |||
| 227 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(++$rkey,$row)->setValueExplicit($leavedata[2][2], $type); | ||
| 228 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey,1)->setValueExplicit("Meternity Leaves", $type); | ||
| 229 | |||
| 230 | for($i=0;$i<=9;$i++) | ||
| 231 | { | ||
| 232 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+1,"1")->setValueExplicit($kformlib->HRFieldNames[$sindex[$i]], $type); | ||
| 233 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+1,$row)->setValueExplicit($saldata[1][$i][1], $type); | ||
| 234 | |||
| 235 | $rkey=$rkey+1; | ||
| 236 | } | ||
| 237 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(++$rkey,$row)->setValueExplicit($wakka->getLOPAmt($ppldata,$asalyear,$asalmonth), $type); | ||
| 238 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey,1)->setValueExplicit("LOP Amount", $type); | ||
| 239 | |||
| 240 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(++$rkey,$row)->setValueExplicit($wakka->getNWDAmt($ppldata,$asalyear,$asalmonth), $type); | ||
| 241 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey,1)->setValueExplicit("NWD Amount", $type); | ||
| 242 | |||
| 243 | foreach($saldata[0] as $tadded) | ||
| 244 | { | ||
| 245 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+1,1)->setValueExplicit("Add/Ded Type", $type); | ||
| 246 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+2,1)->setValueExplicit("Value", $type); | ||
| 247 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+3,1)->setValueExplicit("Remarks", $type); | ||
| 248 | |||
| 249 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+1,$row)->setValueExplicit($tadded[0], $type); | ||
| 250 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+2,$row)->setValueExplicit($tadded[1], $type); | ||
| 251 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($rkey+3,$row)->setValueExplicit($tadded[2], $type); | ||
| 252 | |||
| 253 | $rkey+=3; | ||
| 254 | } | ||
| 255 | } | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | header('Content-Type: application/vnd.ms-excel'); | ||
| 260 | header('Content-Disposition: attachment;filename="MainReport.xls"'); | ||
| 261 | header('Cache-Control: max-age=0'); | ||
| 262 | |||
| 263 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 264 | $objWriter->save('php://output'); | ||
| 265 | return; | ||
| 266 | } | ||
| 267 | function getQueryFromList($key,$list) | ||
| 268 | { | ||
| 269 | $rstatusstr=array();$rstatuses=explode(",",$list); | ||
| 270 | foreach($rstatuses as $rstatus) | ||
| 271 | { | ||
| 272 | if($rstatus!='')$rstatusstr[]="'$rstatus'"; | ||
| 273 | } | ||
| 274 | return " ($key in (".implode(",",$rstatusstr).")) "; | ||
| 275 | } | ||
| 276 | ?> | ||
| 277 | <style> | ||
| 278 | .tab_bar_purple{ | ||
| 279 | border: 1px solid #EFEFEF; | ||
| 280 | height: 39px; | ||
| 281 | margin: 0 0 10px; | ||
| 282 | overflow: hidden; | ||
| 283 | position: relative; | ||
| 284 | } | ||
| 285 | .tab_bar_purple ul{ | ||
| 286 | list-style: none outside none; | ||
| 287 | margin: 0; | ||
| 288 | padding: 0; | ||
| 289 | background: none repeat scroll 0 0 #ac92ed; | ||
| 290 | } | ||
| 291 | .tab_bar_purple ul li{ | ||
| 292 | border: medium none; | ||
| 293 | height: 39px; | ||
| 294 | padding: 0; | ||
| 295 | display: block; | ||
| 296 | float: left; | ||
| 297 | } | ||
| 298 | .tab_bar_purple ul li a{ | ||
| 299 | background: none repeat scroll 0 0 rgba(0, 0, 0, 0); | ||
| 300 | height: 39px; | ||
| 301 | line-height: 39px; | ||
| 302 | display: block; | ||
| 303 | padding: 0 15px; | ||
| 304 | text-decoration: none; | ||
| 305 | color:#fff; | ||
| 306 | } | ||
| 307 | .tab_bar_purple .tabsbar-2{ | ||
| 308 | /*height: 39px;*/ | ||
| 309 | } | ||
| 310 | .tab_bar_purple ul li.active{ | ||
| 311 | background: none repeat scroll 0 0 #fff; | ||
| 312 | } | ||
| 313 | .tab_bar_purple ul li.active a{ | ||
| 314 | color:#967bdc; | ||
| 315 | } | ||
| 316 | .form_new{ | ||
| 317 | margin:0px; | ||
| 318 | } | ||
| 319 | .table_hrm_heading_purple{ | ||
| 320 | padding: 7px 9px; | ||
| 321 | text-align: center; | ||
| 322 | background-color: #D5C5FF; | ||
| 323 | border: 5px solid #fff; | ||
| 324 | font-weight: 600; | ||
| 325 | } | ||
| 326 | .table_hrm_heading_purple:first-child{ | ||
| 327 | border-left: 0px; | ||
| 328 | } | ||
| 329 | .table_hrm_cells{ | ||
| 330 | padding: 5px 7px; | ||
| 331 | color:#434a54; | ||
| 332 | } | ||
| 333 | .table_hrm_cells a{ | ||
| 334 | color:#434a54; | ||
| 335 | } | ||
| 336 | .table_hrm_celltext{ | ||
| 337 | border: 1px solid #ccd0d9; | ||
| 338 | border-color: #ccd0d9 !important; | ||
| 339 | border-radius: 3px !important; | ||
| 340 | padding: 3px 7px; | ||
| 341 | text-align: center; | ||
| 342 | } | ||
| 343 | .hasDatepicker{ | ||
| 344 | border: 1px solid #e2e2e4; | ||
| 345 | border-radius: 3px !important; | ||
| 346 | padding: 3px 10px; | ||
| 347 | margin: 0 10px; | ||
| 348 | width: 10%; | ||
| 349 | margin-left: 0px; | ||
| 350 | } | ||
| 351 | #saved_reprts{ | ||
| 352 | margin-right: 3px; | ||
| 353 | border: 1px solid #ccd0d9; | ||
| 354 | padding: 1% 0 1% 3%; | ||
| 355 | margin-bottom: 30px; | ||
| 356 | border-radius: 10px; | ||
| 357 | } | ||
| 358 | #saved_reprts legend{ | ||
| 359 | width:10% | ||
| 360 | } | ||
| 361 | .new-recruit_legend{ | ||
| 362 | font-size: 14px; | ||
| 363 | height: auto; | ||
| 364 | margin: 0 0 1%; | ||
| 365 | padding: 10px; | ||
| 366 | line-height: 25px; | ||
| 367 | } | ||
| 368 | </style> | ||
| 369 | |||
| 370 | <div class="layout-app"><!-- row-app --> | ||
| 371 | <div class="row row-app"> | ||
| 372 | |||
| 373 | <div class="col-md-12"> | ||
| 374 | |||
| 375 | <div class="col-separator col-separator-first col-unscrollable box" style='overflow:hidden'> | ||
| 376 | <div class=innerAll> | ||
| 377 | |||
| 378 | |||
| 379 | |||
| 380 | <div class="relativeWrap" > | ||
| 381 | <div class="tab_generic"> | ||
| 382 | |||
| 383 | <!-- Tabs Heading --> | ||
| 384 | <div class="tab_bar_purple tabsbar-2"> | ||
| 385 | <ul class="row row-merge"> | ||
| 386 | <li class=active><a href="#tabs-1" data-toggle="tab">Select Filters and Report format</a></li> | ||
| 387 | </ul> | ||
| 388 | </div> | ||
| 389 | <!-- // Tabs Heading END --> | ||
| 390 | |||
| 391 | <div class="tab-content"> | ||
| 392 | |||
| 393 | <div id=tabs-1 class="tab-pane active"> | ||
| 394 | <fieldset> | ||
| 395 | <legend class='task_legend'>Select Filters</legend> | ||
| 396 | <form method=post action='hr?action=MainReport' target=_BLANK name=reportform> | ||
| 397 | <input type=hidden name=_token value='<?php echo csrf_token(); ?>'> | ||
| 398 | <input type=hidden name=client id=client value=''> | ||
| 399 | <input type=hidden name=visacompany id=visacompany value=''> | ||
| 400 | <input type=hidden name=currentstatus id=currentstatus value=''> | ||
| 401 | <div id=reportformarrs></div> | ||
| 402 | |||
| 403 | <p> | ||
| 404 | <label class='label-small_new' style='width:15%'>Record Ids:</label> | ||
| 405 | <input class='form_new form_new_amend' id='empid' name='empid' type='text' value='' style='width:25%' /> | ||
| 406 | <span class=field_desc id='fd'></span><span class=validate_success></span><span class=validate_error></span> | ||
| 407 | </p> | ||
| 408 | <p> | ||
| 409 | <label class='label-small_new' style='width:15%'></label> | ||
| 410 | <b>-- OR --</b> | ||
| 411 | </p> | ||
| 412 | <p> | ||
| 413 | <label class='label-small_new' style='width:15%'>Company: </label> | ||
| 414 | <select name=client2 id=client2 multiple='' data-rel=chosen class=select2multi style='width:40%'> | ||
| 415 | <?php | ||
| 416 | $clients=$wakka->clientsReadAccess(); | ||
| 417 | sort($clients); | ||
| 418 | foreach($clients as $clientval){echo "<option value='$clientval'>$clientval</option>";} | ||
| 419 | ?> | ||
| 420 | </select> | ||
| 421 | </p> | ||
| 422 | <div class='clear:both'></div> | ||
| 423 | <!-- <p> | ||
| 424 | <label class='label-small_new' style='width:15%'>Visa Company: </label> | ||
| 425 | <select name=visacompany2 id=visacompany2 multiple='' data-rel=chosen class=select2multi style='width:40%'> | ||
| 426 | <?php | ||
| 427 | $clients=explode("~",$kformlib->FormSelectVals['visacompany']); | ||
| 428 | foreach($clients as $clientval){echo "<option value='$clientval'>$clientval</option>";} | ||
| 429 | ?> | ||
| 430 | </select> | ||
| 431 | </p>--> | ||
| 432 | <p> | ||
| 433 | <label class='label-small_new' style='width:15%'>Record Status: </label> | ||
| 434 | <select name=currentstatus2 id=currentstatus2 multiple='' data-rel=chosen class=select2multi style='width:40%'> | ||
| 435 | <?php | ||
| 436 | $clients=explode("~",$kformlib->FormSelectVals['currentstatus']); | ||
| 437 | foreach($clients as $clientval){echo "<option value='$clientval'>$clientval</option>";} | ||
| 438 | ?> | ||
| 439 | <?php if($wakka->IsAdmin()){ ?><option value='<?php echo $wakka->HRCoreVars["systemExitStatus"]; ?>'><?php echo $wakka->HRCoreVars["systemExitStatus"]; ?></option><?php } ?> | ||
| 440 | </select> | ||
| 441 | </p> | ||
| 442 | <p> | ||
| 443 | <label class='label-small_new' style='width:15%'>Record Modified From: </label> | ||
| 444 | <input size=7 id='modfrom' name='modfrom' type='text' value='' /> To: <input size=7 id='modto' name='modto' type='text' value='' /> | ||
| 445 | </p> | ||
| 446 | <p> | ||
| 447 | <label class='label-small_new' style='width:15%'>Record Created From: </label> | ||
| 448 | <input size=7 id='crefrom' name='crefrom' type='text' value='' /> To: <input size=7 id='creto' name='creto' type='text' value='' /> | ||
| 449 | </p> | ||
| 450 | <p> | ||
| 451 | <label class='label-small_new' style='width:15%'>For:</label><select class='form_hrm_select' id=fieldbyrange name=fieldbyrange><option></option> | ||
| 452 | <?php | ||
| 453 | $dtfields=explode(",",$kformlib->HRDateFilds); | ||
| 454 | foreach($dtfields as $tdtf)if(trim($tdtf)!="")echo "<option value='$tdtf'>".$kformlib->HRFieldNames[$tdtf]."</option>"; | ||
| 455 | ?> | ||
| 456 | </select> | ||
| 457 | </p> | ||
| 458 | |||
| 459 | <p> | ||
| 460 | <label class='label-small_new' style='width:15%'>Between:</label> | ||
| 461 | <input size=7 id='frcrefrom' name='frcrefrom' type='text' value='' /> To: <input size=7 id='frcreto' name='frcreto' type='text' value='' /> | ||
| 462 | </p> | ||
| 463 | |||
| 464 | <?php | ||
| 465 | $toarr=array(); | ||
| 466 | $optionsstr=""; | ||
| 467 | $fileids=explode(",",$kformlib->HRFiledsStr); | ||
| 468 | foreach($fileids as $fileid) | ||
| 469 | { | ||
| 470 | if(trim($fileid)!='') | ||
| 471 | { | ||
| 472 | if(strstr($kformlib->HRFileFieldsStr,$fileid))$ftype='File'; | ||
| 473 | else if(strstr($kformlib->HRDateFilds,$fileid))$ftype='Date'; | ||
| 474 | else if(strstr($kformlib->HRDropFilds,$fileid))$ftype='Dropdown'; | ||
| 475 | else $ftype='Text'; | ||
| 476 | $toarr[$fileid]=$kformlib->HRFieldNames[$fileid]." ($ftype)"; | ||
| 477 | } | ||
| 478 | } | ||
| 479 | //asort($toarr); | ||
| 480 | foreach($toarr as $key=>$opts)$optionsstr.="<option value='$key'>$opts</option>"; | ||
| 481 | ?> | ||
| 482 | |||
| 483 | <p><label class='label-small_new' style='width:15%;'>Fields: </label> | ||
| 484 | <select size=9 id=fieldsarr2 multiple='multiple' style='width:40%' class=select2multi><?php echo $optionsstr; ?></select><span style='margin-left: 20px;line-height: 30px;'>(Hold ctrl to select multiple)</span></p> | ||
| 485 | <p><label class='label-small_new' style='width:15%'>Report Type</label><select class='form_hrm_select' id=reporttype name=reporttype><option value='Values'>Values</option><option value='Binary'>Binary</option><option value='History'>History</option></select> | ||
| 486 | <select class='form_hrm_select' id=outputtype name=outputtype><option value='XLS'>XLS</option><option value='CSV'>CSV</option></select> | ||
| 487 | <select class='form_hrm_select' id='asalmonth' name='asalmonth'> | ||
| 488 | <option value=''></option> | ||
| 489 | <option value=1>Jan</option> | ||
| 490 | <option value=2>Feb</option> | ||
| 491 | <option value=3>Mar</option> | ||
| 492 | <option value=4>Apr</option> | ||
| 493 | <option value=5>May</option> | ||
| 494 | <option value=6>Jun</option> | ||
| 495 | <option value=7>Jul</option> | ||
| 496 | <option value=8>Aug</option> | ||
| 497 | <option value=9>Sep</option> | ||
| 498 | <option value=10>Oct</option> | ||
| 499 | <option value=11>Nov</option> | ||
| 500 | <option value=12>Dec</option> | ||
| 501 | </select> | ||
| 502 | <select class='form_hrm_select' id='asalyear' name='asalyear'> | ||
| 503 | <option value=''></option> | ||
| 504 | <?php for($i=date('Y')+1;$i>=1990;$i--)echo "<option value=$i>$i</option>"; ?> | ||
| 505 | </select> | ||
| 506 | |||
| 507 | </p> | ||
| 508 | |||
| 509 | <p> | ||
| 510 | <label class='label-small_new' style='width:15%'></label> | ||
| 511 | <input type=hidden name=reportsubmit value=reportsubmit> | ||
| 512 | <input class='form_new form_new_amend' style='width:355px' type=text name=savereportname id=savereportname placeholder='Name of the report to save'> | ||
| 513 | <input type=button class='btn btn-purple_outline' name=reportsubmit value="Generate Report" onclick="setRptSelection();return false;"> | ||
| 514 | <span class=field_desc id='fd'></span><span class=validate_success></span><span class=validate_error></span> | ||
| 515 | </p> | ||
| 516 | </form> | ||
| 517 | </fieldset> | ||
| 518 | |||
| 519 | |||
| 520 | <fieldset id='saved_reprts'><legend class='new-recruit_legend'>Saved Reports</legend> | ||
| 521 | <?php | ||
| 522 | $savedreports=$wakka->GetBBBUserData("UserSavedReports"); | ||
| 523 | if(is_array($savedreports))foreach($savedreports as $rname=>$rpts) | ||
| 524 | { | ||
| 525 | echo "<p><label class='label-small_new' style='width:15%'>$rname</label><a href='".url("/hr/MainReport?reportsubmit=1&savedreportget=$rname")."' class='btn btn-purple' target=_BLANK>Download</a> <a href=# title='Delete this entry' onclick='deletesavedreport(\"$rname\");return false;' style='margin-left: 50px;'><i class='fa fa-times-circle' style='color:#967bdc'>Delete</i></a></p>"; | ||
| 526 | } | ||
| 527 | ?> | ||
| 528 | |||
| 529 | </fieldset> | ||
| 530 | </div> | ||
| 531 | </div> | ||
| 532 | |||
| 533 | </div> | ||
| 534 | </div> | ||
| 535 | </div> | ||
| 536 | <!-- // Tabs END --> | ||
| 537 | |||
| 538 | |||
| 539 | |||
| 540 | </div> | ||
| 541 | </div> | ||
| 542 | </div> | ||
| 543 | |||
| 544 | </div> | ||
| 545 | </div><!-- // END row-app --> | ||
| 546 | |||
| 547 | <script> | ||
| 548 | $('#modfrom').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 549 | $('#modto').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 550 | $('#crefrom').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 551 | $('#creto').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 552 | |||
| 553 | $('#frcrefrom').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 554 | $('#frcreto').datepicker({dateFormat: 'dd.mm.yy',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 555 | |||
| 556 | function setRptSelection() | ||
| 557 | { | ||
| 558 | $("#client").val($("#client2").val()); | ||
| 559 | // $("#visacompany").val($("#visacompany2").val()); | ||
| 560 | $("#currentstatus").val($("#currentstatus2").val()); | ||
| 561 | |||
| 562 | $("#reportformarrs").html(""); | ||
| 563 | $("#fieldsarr2").select2("data").forEach(function(elem){$("#reportformarrs").append("<input type=hidden name=fieldsarr[] value='"+elem.id+"'>");}); | ||
| 564 | |||
| 565 | document.reportform.submit(); | ||
| 566 | } | ||
| 567 | // $("#client2").dropdownchecklist({icon:{}, width:300, maxDropHeight:300, emptyText:"Select.." }); | ||
| 568 | // $("#visacompany2").dropdownchecklist({icon:{}, width:300, maxDropHeight:300, emptyText:"Select.." }); | ||
| 569 | // $("#currentstatus2").dropdownchecklist({icon:{}, width:300, maxDropHeight:300, emptyText:"Select.." }); | ||
| 570 | |||
| 571 | function deletesavedreport(rname) | ||
| 572 | { | ||
| 573 | doAjax('hr?action=DeleteSavedReport&rname='+rname,'','searchresults'); | ||
| 574 | } | ||
| 575 | </script> |
| ... | @@ -39,6 +39,9 @@ $yemaxcarryleaves=base64_encode(Input::get("yemaxcarryleaves")); | ... | @@ -39,6 +39,9 @@ $yemaxcarryleaves=base64_encode(Input::get("yemaxcarryleaves")); |
| 39 | 39 | ||
| 40 | $trackerfields=base64_encode(Input::get("trackerfields")); | 40 | $trackerfields=base64_encode(Input::get("trackerfields")); |
| 41 | 41 | ||
| 42 | if(Input::get("autodial_pacing")){ | ||
| 43 | $autodial=base64_encode(Input::get("autodial_pacing")); | ||
| 44 | } | ||
| 42 | $developerparam=base64_encode(str_replace('\n',"\n",Input::get("developerparam"))); | 45 | $developerparam=base64_encode(str_replace('\n',"\n",Input::get("developerparam"))); |
| 43 | 46 | ||
| 44 | 47 | ||
| ... | @@ -74,7 +77,7 @@ $mvalue.="yrsickleaves~$yrsickleaves|"; | ... | @@ -74,7 +77,7 @@ $mvalue.="yrsickleaves~$yrsickleaves|"; |
| 74 | $mvalue.="yrannualleaves~$yrannualleaves|"; | 77 | $mvalue.="yrannualleaves~$yrannualleaves|"; |
| 75 | $mvalue.="yemaxcarryleaves~$yemaxcarryleaves|"; | 78 | $mvalue.="yemaxcarryleaves~$yemaxcarryleaves|"; |
| 76 | $mvalue.="developerparam~$developerparam|"; | 79 | $mvalue.="developerparam~$developerparam|"; |
| 77 | 80 | $mvalue.="autodialercampaign~$autodial|"; | |
| 78 | $mvalue.="trackerfields~$trackerfields|"; | 81 | $mvalue.="trackerfields~$trackerfields|"; |
| 79 | 82 | ||
| 80 | //if($wakka->getCount("hrms_masters","mkey='$client' and mtype='company'")==0)$companyarr=$wakka->Query("insert into hrms_masters set mvalue='',mkey='$client',mtype='company';"); | 83 | //if($wakka->getCount("hrms_masters","mkey='$client' and mtype='company'")==0)$companyarr=$wakka->Query("insert into hrms_masters set mvalue='',mkey='$client',mtype='company';"); | ... | ... |
| ... | @@ -11,7 +11,14 @@ if(Input::has('addcompany')) | ... | @@ -11,7 +11,14 @@ if(Input::has('addcompany')) |
| 11 | //$wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company';"); | 11 | //$wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company';"); |
| 12 | //$wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company',status='active';"); | 12 | //$wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company',status='active';"); |
| 13 | $wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company',status='active', campaignstartdate='$campaignstartdate', campaignenddate='$campaignenddate';"); | 13 | $wakka->Query("insert into hrms_masters set mvalue='',mkey='$company',mtype='company',status='active', campaignstartdate='$campaignstartdate', campaignenddate='$campaignenddate';"); |
| 14 | /*if(!(Schema::hasTable('records_'.$company))) | ||
| 15 | { | ||
| 16 | DB::statement("CREATE TABLE records_$company LIKE records;"); | ||
| 17 | DB::insert(DB::raw("Insert into records_$company SELECT * from records where client='$company'")); | ||
| 18 | //exit(); | ||
| 19 | }*/ | ||
| 14 | } | 20 | } |
| 21 | |||
| 15 | } | 22 | } |
| 16 | 23 | ||
| 17 | return; | 24 | return; |
| ... | @@ -109,6 +116,7 @@ if($client!="") | ... | @@ -109,6 +116,7 @@ if($client!="") |
| 109 | echo "<p><label class='label-small_new' style='width:15%'>AnnualMaxCarryLeaves :</label><input type=text class='form_new form_new_amend' name=yemaxcarryleaves id=yemaxcarryleaves value='".($mastersdata["yemaxcarryleaves"])."'></p>"; | 116 | echo "<p><label class='label-small_new' style='width:15%'>AnnualMaxCarryLeaves :</label><input type=text class='form_new form_new_amend' name=yemaxcarryleaves id=yemaxcarryleaves value='".($mastersdata["yemaxcarryleaves"])."'></p>"; |
| 110 | 117 | ||
| 111 | echo "<p><label class='label-small_new' style='width:15%'>Parameters</label><textarea rows=8 id='developerparam' style='font-size:12px;width:85%'>".($mastersdata["developerparam"])."</textarea></p>"; | 118 | echo "<p><label class='label-small_new' style='width:15%'>Parameters</label><textarea rows=8 id='developerparam' style='font-size:12px;width:85%'>".($mastersdata["developerparam"])."</textarea></p>"; |
| 119 | echo "<p><label class='label-small_new' style='width:15%'>Autodial Ratio</label><input type=text class='form_new form_new_amend' name='autodial_pacing' id='autodial_pacing' style='font-size:12px;width:15%' value='".($mastersdata["autodialercampaign"])."'></p>"; | ||
| 112 | 120 | ||
| 113 | 121 | ||
| 114 | 122 | ... | ... |
| ... | @@ -458,7 +458,7 @@ function saveCompanies() | ... | @@ -458,7 +458,7 @@ function saveCompanies() |
| 458 | 458 | ||
| 459 | 459 | ||
| 460 | vardata+="&developerparam="+encodeURIComponent($("#developerparam").val()); | 460 | vardata+="&developerparam="+encodeURIComponent($("#developerparam").val()); |
| 461 | 461 | vardata+="&autodial_pacing="+encodeURIComponent($("#autodial_pacing").val()); | |
| 462 | doAjax("hr?action=CompanyMaster", vardata, "searchresults"); | 462 | doAjax("hr?action=CompanyMaster", vardata, "searchresults"); |
| 463 | } | 463 | } |
| 464 | function loadCompanyMasters(companyname) | 464 | function loadCompanyMasters(companyname) | ... | ... |
| 1 | <?php | ||
| 2 | $url = 'https://push3.maccesssmspush.com/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; | ||
| 3 | //$url = 'https://push3.maccesssmspush.com/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?userId=hdfcbalrt&pass=hdfcbalrt25&appid=hdfcbalrt&subappid=hdfcbalrt&contenttype=1&to=8074030875&from=HDFCBK&text=manoj&selfid=true&alert=1&dlrreq=true&intflag=false'; | ||
| 4 | $inputArray = ['userId'=>'hdfcbalrt',"pass"=>'hdfcbalrt25',"appid"=>"hdfcbalrt","subappid"=>"hdfcbalrt","contenttype"=>"1","to"=>"8074030875","from"=>"HDFCBK","text"=>"Hi","selfid"=>"true","alert"=>"1","dlrreq"=>"true","intflag"=>"false"]; | ||
| 5 | $payload = json_encode($inputArray); | ||
| 6 | $payload = json_encode($jsonBody); | ||
| 7 | $ch = curl_init(); | ||
| 8 | curl_setopt($ch, CURLOPT_COOKIE, ""); | ||
| 9 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | ||
| 10 | curl_setopt($ch, CURLOPT_URL, $url); | ||
| 11 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| 12 | curl_setopt($ch, CURLOPT_POST, 1); | ||
| 13 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); | ||
| 14 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 15 | curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', | ||
| 16 | 'AUTHORIZATIONKEY:' . $X_AUTH_T, | ||
| 17 | 'X-EMAIL:' . $X_EMAIL_T, 'Cache-Control:no-cache' | ||
| 18 | )); | ||
| 19 | curl_exec($ch); | ||
| 20 | curl_close($ch); | ||
| 21 | ?> |
| 1 | <style> | ||
| 2 | |||
| 3 | .tab_bar_green{ | ||
| 4 | border: 1px solid #EFEFEF; | ||
| 5 | height: 39px; | ||
| 6 | margin: 0 0 10px; | ||
| 7 | overflow: hidden; | ||
| 8 | position: relative; | ||
| 9 | } | ||
| 10 | .tab_bar_green ul{ | ||
| 11 | list-style: none outside none; | ||
| 12 | margin: 0; | ||
| 13 | padding: 0; | ||
| 14 | background: none repeat scroll 0 0 #48cfae; | ||
| 15 | } | ||
| 16 | .tab_bar_green ul li{ | ||
| 17 | border: medium none; | ||
| 18 | height: 39px; | ||
| 19 | padding: 0; | ||
| 20 | display: block; | ||
| 21 | float: left; | ||
| 22 | } | ||
| 23 | .tab_bar_green ul li a{ | ||
| 24 | background: none repeat scroll 0 0 rgba(0, 0, 0, 0); | ||
| 25 | height: 39px; | ||
| 26 | line-height: 39px; | ||
| 27 | display: block; | ||
| 28 | padding: 0 15px; | ||
| 29 | text-decoration: none; | ||
| 30 | color:#fff; | ||
| 31 | font-weight:600; | ||
| 32 | } | ||
| 33 | .tab_bar_green .tabsbar-2{ | ||
| 34 | /*height: 39px;*/ | ||
| 35 | } | ||
| 36 | .tab_bar_green ul li.active{ | ||
| 37 | background: none repeat scroll 0 0 #fff; | ||
| 38 | } | ||
| 39 | .tab_bar_green ul li.active a{ | ||
| 40 | color:#36bc9b; | ||
| 41 | } | ||
| 42 | |||
| 43 | </style> | ||
| 44 | <?php | ||
| 45 | $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); | ||
| 46 | $kformlib->gthis=$wakka; | ||
| 47 | |||
| 48 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 49 | $themehome=$wakka->GetThemePath('/'); | ||
| 50 | $updatetime=time(); | ||
| 51 | function mkdir_r ($dir) | ||
| 52 | { | ||
| 53 | if (strlen($dir) == 0)return 0; | ||
| 54 | if (is_dir($dir))return 1; | ||
| 55 | elseif (dirname($dir) == $dir)return 1; | ||
| 56 | return (mkdir_r(dirname($dir)) and mkdir($dir,0777)); | ||
| 57 | } | ||
| 58 | |||
| 59 | print_r($_POST['ebulkuploadform']); | ||
| 60 | |||
| 61 | if(isset($_POST['ebulkuploadform'])&&$wakka->GetUser()) | ||
| 62 | { | ||
| 63 | $clientlst=$wakka->GetBBBUserData("clientslist"); | ||
| 64 | |||
| 65 | $isadmin=$wakka->IsAdmin(); | ||
| 66 | $username=$wakka->GetUserName(); | ||
| 67 | $triggers=Input::get("triggers"); | ||
| 68 | $tmpstr=explode(",",$kformlib->HRFiledsStr); | ||
| 69 | |||
| 70 | $success="";$message="";$successcnt=0;$duplicatecount=0; | ||
| 71 | $inputFileType = "Excel5"; | ||
| 72 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 73 | $objPHPExcel = $objReader->load($_FILES['empbulkfile']['tmp_name']); | ||
| 74 | $objWorksheet = $objPHPExcel->getActiveSheet(); | ||
| 75 | $highestColumn = PHPExcel_Cell::columnIndexFromString($objPHPExcel->getActiveSheet()->getHighestColumn()); | ||
| 76 | $highestrow=$objPHPExcel->getActiveSheet()->getHighestRow(); | ||
| 77 | |||
| 78 | $excelarray=array();$keys=array(); | ||
| 79 | for($i=1;$i<=$highestrow;$i++) | ||
| 80 | { | ||
| 81 | $excelarray[$i]=array(); | ||
| 82 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 83 | { | ||
| 84 | if($i==1) | ||
| 85 | { | ||
| 86 | $keys[$head]=trim($objWorksheet->getCellByColumnAndRow($head,$i)->getValue()); | ||
| 87 | } | ||
| 88 | else | ||
| 89 | { | ||
| 90 | $excelarray[$i][$keys[$head]]=trim($objWorksheet->getCellByColumnAndRow($head, $i)->getValue()); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | for($i=2;$i<=$highestrow;$i++) | ||
| 97 | { | ||
| 98 | if($excelarray[$i]["id"]!="") | ||
| 99 | { | ||
| 100 | if($excelarray[$i]["id"]=="CREATE") | ||
| 101 | { | ||
| 102 | $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s'))); | ||
| 103 | } | ||
| 104 | else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]); | ||
| 105 | |||
| 106 | if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1) | ||
| 107 | { | ||
| 108 | $empdata=$wakka->getPerson($excelarray[$i]["id"]); | ||
| 109 | $ppldata=$empdata["peopledata"]; | ||
| 110 | $createdlog=$empdata['modifylog']; | ||
| 111 | $fdirty=$empdata['dirty']; | ||
| 112 | |||
| 113 | $createdlog[$updatetime]=$username."::"; | ||
| 114 | $createdlog["updated"]=$updatetime; | ||
| 115 | $excelarray[$i]["DOB"]= date('Y-m-d', PHPExcel_Shared_Date::ExcelToPHP($excelarray[$i]["DOB"])); | ||
| 116 | |||
| 117 | $newdata=$ppldata; | ||
| 118 | if($isadmin||strstr($clientlst,$ppldata['client'])) | ||
| 119 | { | ||
| 120 | $editflag=0; | ||
| 121 | foreach($excelarray[$i] as $key => $value) | ||
| 122 | { | ||
| 123 | if(isset($kformlib->HRFieldNames[$key])) | ||
| 124 | { | ||
| 125 | if($value!="") | ||
| 126 | { | ||
| 127 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 128 | { | ||
| 129 | $value=str_replace("'"," ",$value); | ||
| 130 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 131 | |||
| 132 | $fdirty[$key]=1;$editflag=1; | ||
| 133 | |||
| 134 | if($triggers=='Yes') | ||
| 135 | { | ||
| 136 | $kformlib->empAnalytics($excelarray[$i]["id"],$ppldata,$key,$value,$ppldata[$key]); | ||
| 137 | $kformlib->empWorkflowTrigger($excelarray[$i]["id"],$ppldata['client'],$key,$value,$ppldata[$key],$ppldata,$newdata); | ||
| 138 | } | ||
| 139 | $newdata[$key]=$value; | ||
| 140 | } | ||
| 141 | //else $message.="same $excelarray[$i][id]:$key:$value, "; | ||
| 142 | } | ||
| 143 | //else $message.="empty $excelarray[$i][id]:$key, "; | ||
| 144 | } | ||
| 145 | else | ||
| 146 | { | ||
| 147 | // $message.="Invalid key :$key, "; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | if($editflag) | ||
| 151 | { | ||
| 152 | $empdata["peopledata"]=$newdata;$empdata['modifylog']=$createdlog;$empdata['dirty']=$fdirty;$wakka->setPerson($excelarray[$i]["id"],$empdata); | ||
| 153 | $success.=$excelarray[$i]["id"].",";$successcnt++; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | else | ||
| 157 | { | ||
| 158 | // $message.="No access to $excelarray[$i][id], "; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | // $message.="ID not found $excelarray[$i][id], "; | ||
| 164 | } | ||
| 165 | } | ||
| 166 | else | ||
| 167 | { | ||
| 168 | $message.="Incorrect ID '$excelarray[$i][id]', "; | ||
| 169 | } | ||
| 170 | } | ||
| 171 | @unlink($_FILES['empbulkfile']); | ||
| 172 | $success="Data Uploaded ($successcnt): ".$success.". Duplicate : $duplicatecount"; | ||
| 173 | print_r(Config::get('app.sqllog')); | ||
| 174 | ?> | ||
| 175 | |||
| 176 | |||
| 177 | <script> | ||
| 178 | var data=''; | ||
| 179 | data+="<?php if($success!="")echo "<div class='message success close'><h2>Success!</h2><p>$success</p></div>"; ?>"; | ||
| 180 | data+="<?php if($message!="")echo "<div class='message error close'><h2>Error!</h2><p>$message</p></div>"; ?>"; | ||
| 181 | parent.document.getElementById("ebulkuploadresult").innerHTML = data; | ||
| 182 | parent.messageCloseFun(); | ||
| 183 | </script> | ||
| 184 | |||
| 185 | <?php | ||
| 186 | return; | ||
| 187 | } | ||
| 188 | else if(isset($_POST['ebulkuploadformf'])&&$wakka->GetUser()) | ||
| 189 | { | ||
| 190 | if(false)$message="Other Bulk Uploads are Running, Please Wait for them to finish.."; | ||
| 191 | else | ||
| 192 | { | ||
| 193 | $clientlst=$wakka->GetBBBUserData("clientslist"); | ||
| 194 | |||
| 195 | $fileElementName=$_POST['filefieldname']; | ||
| 196 | if($fileElementName!=""&&strstr($kformlib->HRFileFieldsStr,$fileElementName)) | ||
| 197 | { | ||
| 198 | for($i=0;$i<20;$i++) | ||
| 199 | { | ||
| 200 | $fileElementNameI = "empbulkfilef$i"; | ||
| 201 | $varid=$_POST["empid$i"]; | ||
| 202 | if($varid!=""&&isset($_FILES[$fileElementNameI])) | ||
| 203 | { | ||
| 204 | |||
| 205 | if($wakka->getCount("records","id='$varid'")==1&&empty($_FILES[$fileElementNameI]['error'])&&$_FILES[$fileElementNameI]["size"]<=2*1024*1024) | ||
| 206 | { | ||
| 207 | |||
| 208 | $empdata=$wakka->getPerson($varid); | ||
| 209 | $createdlog=$empdata['modifylog']; | ||
| 210 | $ppldata=$empdata["peopledata"]; | ||
| 211 | if($wakka->IsAdmin()||strstr($clientlst,$ppldata['client'])) | ||
| 212 | { | ||
| 213 | |||
| 214 | $filename=explode(".",$_FILES[$fileElementNameI]['name']); | ||
| 215 | |||
| 216 | $filenameNew=$varid."_".$fileElementName.".".$filename[(sizeof($filename)-1)]; | ||
| 217 | $filenamePdf=$varid."_".$fileElementName.".pdf"; | ||
| 218 | if($fileElementName=="genericfileselect") | ||
| 219 | { | ||
| 220 | $filenameNew=$varid."_G_".str_replace(" ","_",$_POST['gr']).".".$filename[(sizeof($filename)-1)]; | ||
| 221 | $filenamePdf=$varid."_G_".str_replace(" ","_",$_POST['gr']).".pdf"; | ||
| 222 | } | ||
| 223 | $destfile = "$themehome/recruits/$varid/$filenameNew"; | ||
| 224 | $destfilepdf ="$themehome/recruits/$varid/$filenamePdf"; | ||
| 225 | |||
| 226 | if (!is_dir("$themehome/recruits/$varid"))mkdir_r("$themehome/recruits/$varid"); | ||
| 227 | if (!is_dir("$themehome/thumbs/$varid"))mkdir_r("$themehome/thumbs/$varid"); | ||
| 228 | |||
| 229 | //rename if exists | ||
| 230 | if(file_exists($destfilepdf))rename($destfilepdf, "$themehome/recruits/$varid/OLD__$filenamePdf"); | ||
| 231 | |||
| 232 | |||
| 233 | if(!move_uploaded_file($_FILES[$fileElementNameI]['tmp_name'], $destfile))$error="File cannot be uploaded to folder: $varid, "; | ||
| 234 | if($error=="") | ||
| 235 | { | ||
| 236 | if(strtolower($filename[(sizeof($filename)-1)])=="pdf")rename("$destfile","$destfile.pdf"); | ||
| 237 | else if(strtolower($filename[(sizeof($filename)-1)])=="txt")exec("convert -quality 200% -compress zip \"$destfile\" \"$destfile.pdf\""); | ||
| 238 | else exec("convert -quality 100% -units PixelsPerInch -density 200 -resize 200% -compress zip \"$destfile\" \"$destfile.pdf\""); | ||
| 239 | |||
| 240 | exec("convert -adjoin -quality 100% -units PixelsPerInch -density 100 -resize 100% -compress zip \"$themehome/recruits/$varid/OLD__$filenamePdf\" \"$destfile.pdf\" \"$destfilepdf\""); | ||
| 241 | exec("convert -quality 100% -delay 100 -thumbnail x400 \"$destfilepdf\" \"$themehome/thumbs/$varid/$filenamePdf.gif\""); | ||
| 242 | } | ||
| 243 | |||
| 244 | |||
| 245 | @unlink($_FILES[$fileElementNameI]); | ||
| 246 | if($filename[(sizeof($filename)-1)]!="pdf")@unlink("$destfile.pdf"); | ||
| 247 | else rename("$destfile.pdf","$destfile"); | ||
| 248 | if($filename[(sizeof($filename)-1)]!="pdf")if(file_exists($destfilepdf))@unlink($destfile); | ||
| 249 | |||
| 250 | $kformlib->empWorkflowTrigger($varid,$ppldata['client'],$fileElementName,$filenamePdf,$filename,$ppldata,$ppldata); | ||
| 251 | $wakka->setPersonKey($ppldata["id"],$fileElementName,$filenamePdf,$wakka->GetUserName()); | ||
| 252 | |||
| 253 | if($error=="")$success.="Done : $varid, "; | ||
| 254 | else $message.=$error; | ||
| 255 | |||
| 256 | } | ||
| 257 | else | ||
| 258 | { | ||
| 259 | $message.="No Access to $varid, "; | ||
| 260 | } | ||
| 261 | |||
| 262 | } | ||
| 263 | else $message.="Error Uploading for ID : $varid, "; | ||
| 264 | |||
| 265 | } | ||
| 266 | //else $message.="nothing $i ($varid,$fileElementNameI), "; | ||
| 267 | } | ||
| 268 | |||
| 269 | |||
| 270 | } | ||
| 271 | } | ||
| 272 | ?> | ||
| 273 | |||
| 274 | |||
| 275 | <script> | ||
| 276 | var data=''; | ||
| 277 | data+="<?php if($success!="")echo "<div class='message success close'><h2>Success!</h2><p>$success</p></div>"; ?>"; | ||
| 278 | data+="<?php if($message!="")echo "<div class='message error close'><h2>Error!</h2><p>$message</p></div>"; ?>"; | ||
| 279 | parent.document.getElementById("ebulkuploadresultf").innerHTML = data; | ||
| 280 | parent.messageCloseFun(); | ||
| 281 | </script> | ||
| 282 | |||
| 283 | <?php | ||
| 284 | return; | ||
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | else if(isset($_POST['useruploadform'])&&$wakka->GetUser()) | ||
| 289 | { | ||
| 290 | $clientlst=$wakka->GetBBBUserData("clientslist"); | ||
| 291 | |||
| 292 | $isadmin=$wakka->IsAdmin(); | ||
| 293 | $username=$wakka->GetUserName(); | ||
| 294 | $triggers=Input::get("triggers"); | ||
| 295 | $tmpstr=explode(",",$kformlib->HRFiledsStr); | ||
| 296 | |||
| 297 | $success="";$message="";$successcnt=0;$duplicatecount=0; | ||
| 298 | $inputFileType = "Excel5"; | ||
| 299 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 300 | $objPHPExcel = $objReader->load($_FILES['useruploadfile']['tmp_name']); | ||
| 301 | $objWorksheet = $objPHPExcel->getActiveSheet(); | ||
| 302 | $highestColumn = PHPExcel_Cell::columnIndexFromString($objPHPExcel->getActiveSheet()->getHighestColumn()); | ||
| 303 | $highestrow=$objPHPExcel->getActiveSheet()->getHighestRow(); | ||
| 304 | |||
| 305 | $excelarray=array();$keys=array(); | ||
| 306 | for($i=1;$i<=$highestrow;$i++) | ||
| 307 | { | ||
| 308 | $excelarray[$i]=array(); | ||
| 309 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 310 | { | ||
| 311 | if($i==1) | ||
| 312 | { | ||
| 313 | $keys[$head]=trim($objWorksheet->getCellByColumnAndRow($head,$i)->getValue()); | ||
| 314 | } | ||
| 315 | else | ||
| 316 | { | ||
| 317 | $excelarray[$i][$keys[$head]]=trim($objWorksheet->getCellByColumnAndRow($head, $i)->getValue()); | ||
| 318 | } | ||
| 319 | } | ||
| 320 | } | ||
| 321 | |||
| 322 | for($i=2;$i<=$highestrow;$i++) | ||
| 323 | { | ||
| 324 | if($excelarray[$i]["id"]!="") | ||
| 325 | { | ||
| 326 | if($excelarray[$i]["id"]=="CREATE") | ||
| 327 | { | ||
| 328 | $excelarray[$i]["id"]=$wakka->Query("insert into","","users",array('created_at'=>date('Y-m-d H:i:s'))); | ||
| 329 | } | ||
| 330 | else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]); | ||
| 331 | |||
| 332 | if($wakka->getCount("users","id='".$excelarray[$i]["id"]."'")==1) | ||
| 333 | { | ||
| 334 | $empdata=$wakka->getPersonUser($excelarray[$i]["id"]); | ||
| 335 | $ppldata=$empdata["peopledata"]; | ||
| 336 | |||
| 337 | $createdlog[$updatetime]=$username."::"; | ||
| 338 | $createdlog["updated"]=$updatetime; | ||
| 339 | |||
| 340 | $newdata=$ppldata; | ||
| 341 | foreach($excelarray[$i] as $key => $value) | ||
| 342 | { | ||
| 343 | if($value!="") | ||
| 344 | { | ||
| 345 | if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC | ||
| 346 | { | ||
| 347 | $value=str_replace("'"," ",$value); | ||
| 348 | if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).","; | ||
| 349 | |||
| 350 | $newdata[$key]=$value; | ||
| 351 | } | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 | $empdata["peopledata"]=$newdata; | ||
| 356 | $successcnt++; | ||
| 357 | |||
| 358 | $wakka->setPersonUser($excelarray[$i]["id"],$empdata); | ||
| 359 | $excelarray[$i]['modified']=date('Y-m-d H:i:s'); | ||
| 360 | |||
| 361 | } | ||
| 362 | else | ||
| 363 | { | ||
| 364 | // $message.="ID not found $excelarray[$i][id], "; | ||
| 365 | } | ||
| 366 | } | ||
| 367 | else | ||
| 368 | { | ||
| 369 | $message.="Incorrect ID '$excelarray[$i][id]', "; | ||
| 370 | } | ||
| 371 | |||
| 372 | } | ||
| 373 | @unlink($_FILES['empbulkfile']); | ||
| 374 | $success="Data Uploaded ($successcnt): ".$success.". Duplicate : $duplicatecount"; | ||
| 375 | print_r(Config::get('app.sqllog')); | ||
| 376 | ?> | ||
| 377 | |||
| 378 | |||
| 379 | <script> | ||
| 380 | var data=''; | ||
| 381 | data+="<?php if($success!="")echo "<div class='message success close'><h2>Success!</h2><p>$success</p></div>"; ?>"; | ||
| 382 | data+="<?php if($message!="")echo "<div class='message error close'><h2>Error!</h2><p>$message</p></div>"; ?>"; | ||
| 383 | parent.document.getElementById("userupload").innerHTML = data; | ||
| 384 | parent.messageCloseFun(); | ||
| 385 | </script> | ||
| 386 | |||
| 387 | <?php | ||
| 388 | return; | ||
| 389 | } | ||
| 390 | |||
| 391 | ?> | ||
| 392 | <?php if($wakka->GetUser()){ ?> | ||
| 393 | |||
| 394 | <div class="layout-app"><!-- row-app --> | ||
| 395 | <div class="row row-app"> | ||
| 396 | |||
| 397 | <div class="col-md-12"> | ||
| 398 | |||
| 399 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 400 | <div class=innerAll> | ||
| 401 | |||
| 402 | |||
| 403 | |||
| 404 | |||
| 405 | <div class="relativeWrap" > | ||
| 406 | <div class="tab_generic"> | ||
| 407 | |||
| 408 | <!-- Tabs Heading --> | ||
| 409 | <div class="tab_bar_green tabsbar-2"> | ||
| 410 | <ul class="row row-merge"> | ||
| 411 | <li class=active><a href="#tabs-1" data-toggle="tab">Bulk Upload</a></li> | ||
| 412 | <li><a href="#tabs-2" data-toggle="tab">Files Upload</a></li> | ||
| 413 | <li><a href="#tabs-3" data-toggle="tab">User Upload</a></li> | ||
| 414 | </ul> | ||
| 415 | </div> | ||
| 416 | <div class="tab-content"> | ||
| 417 | <div id=tabs-1 class="tab-pane active"> | ||
| 418 | |||
| 419 | <form method=post enctype='multipart/form-data' target=ebresultsf action="record?action=bulkupload"> | ||
| 420 | <input type=hidden name=_token value='<?php echo csrf_token(); ?>'> | ||
| 421 | <input type=hidden name=ebulkuploadform value='1'> | ||
| 422 | <fieldset> | ||
| 423 | <legend class='task_legend'>Bulk Upload Record Data</legend> | ||
| 424 | |||
| 425 | <p><b style="color: #fb6e52;">Instruction</b>(Works only if you have 'Write access" to the records)<br> | ||
| 426 | Please create an Excel-2003 format file with header as field-keys and rows containing record data. | ||
| 427 | <br> | ||
| 428 | <span style="color: #fb6e52;">Extream Care is should be taken during bulk upload as previous values will be overwritten and lost</span> | ||
| 429 | </p> | ||
| 430 | <p>Upload File</p> | ||
| 431 | <p>Triggers : <select name=triggers class='form-control' style='width:150px;display:inline'><option value='Yes'>Yes</option><option value='No'>No</option></select></p> | ||
| 432 | <div style='clear:both'></div> | ||
| 433 | <p><input type=file name=empbulkfile style='float:left'><input type=submit class='btn btn-green_outline' value="Bulk Update" style='float:left'></p> | ||
| 434 | <p> | ||
| 435 | <iframe name=ebresultsf id="ebresultsf" style='width:0px;height:0px;display:none'></iframe> | ||
| 436 | </p> | ||
| 437 | |||
| 438 | </fieldset> | ||
| 439 | </form> | ||
| 440 | <div id=ebulkuploadresult></div> | ||
| 441 | |||
| 442 | </div> | ||
| 443 | <div id=tabs-2 class="tab-pane"> | ||
| 444 | |||
| 445 | |||
| 446 | <form method=post enctype='multipart/form-data' target=ebresultsff action="record?action=bulkupload"> | ||
| 447 | <input type=hidden name=_token value='<?php echo csrf_token(); ?>'> | ||
| 448 | <input type=hidden name=ebulkuploadformf value='1'> | ||
| 449 | <fieldset> | ||
| 450 | <legend class='task_legend'>Bulk Upload Employee Files</legend> | ||
| 451 | <p><b style="color: #fb6e52;">Instruction</b>(Works only if you have 'Write access" to the records)<br> | ||
| 452 | You can upload 20 files at a time for each upload type, after that process can be repeated | ||
| 453 | <br> | ||
| 454 | </p> | ||
| 455 | <p><label class='label_new'>Select Field Name</label> | ||
| 456 | <select name=filefieldname class=form_hrm_select style='margin: 0 6px;width: 24%;'><option></option> | ||
| 457 | <?php | ||
| 458 | $dtfields=explode(",",$kformlib->HRFileFieldsStr); | ||
| 459 | foreach($dtfields as $tdtf)if(trim($tdtf)!="")echo "<option value='$tdtf'>".$kformlib->HRFieldNames[$tdtf]."</option>"; | ||
| 460 | ?></select> | ||
| 461 | </p> | ||
| 462 | |||
| 463 | <?php for($i=0;$i<20;$i++){ ?> | ||
| 464 | <p><label class='label_new' style='float: left'>Upload File For</label> | ||
| 465 | <input type=text name='empid<?php echo $i; ?>' placeholder=Employee-ID class='form_new mrgn' size=40 style='float: left'> <input type=file name='empbulkfilef<?php echo $i; ?>' style=' padding-top: 10px;'> | ||
| 466 | </p><div style='clear:both'></div> | ||
| 467 | <?php } ?> | ||
| 468 | |||
| 469 | <p style='float: right;margin-right: 40%;margin-top: 2%;'><label></label> | ||
| 470 | <input type=submit class='btn btn-green' value="Bulk Upload"> | ||
| 471 | </p> | ||
| 472 | <p><label></label> | ||
| 473 | <iframe name=ebresultsff id="ebresultsff" style='width:0px;height:0px;display:none'></iframe> | ||
| 474 | </p> | ||
| 475 | |||
| 476 | </fieldset> | ||
| 477 | </form> | ||
| 478 | <div id=ebulkuploadresultf></div> | ||
| 479 | |||
| 480 | </div> | ||
| 481 | |||
| 482 | <div id=tabs-3 class="tab-pane"> | ||
| 483 | |||
| 484 | <div style='clear:both'></div> | ||
| 485 | <br><br> | ||
| 486 | <a href='/exceldownload'><button class='btn btn-info' style='float:right'><i class="fa fa-download"></i> Extract</button></a> | ||
| 487 | <br><br> | ||
| 488 | <form method=post enctype='multipart/form-data' action="record?action=bulkupload" target=uploadresult> | ||
| 489 | <input type=hidden name=_token value='<?php echo csrf_token(); ?>'> | ||
| 490 | <input type=hidden name=useruploadform value='1'> | ||
| 491 | <p><input type=file name=useruploadfile style='float:left'> | ||
| 492 | <input type=submit class='btn btn-green_outline' value="User Upload" style='float:left'> <br></p> | ||
| 493 | <iframe name=uploadresult id="uploadresult" style='width:0px;height:0px;display:none'></iframe> | ||
| 494 | </form> | ||
| 495 | |||
| 496 | <div id=userupload></div> | ||
| 497 | |||
| 498 | </div> | ||
| 499 | |||
| 500 | </div> | ||
| 501 | |||
| 502 | </div> | ||
| 503 | </div> | ||
| 504 | </div> | ||
| 505 | |||
| 506 | </div> | ||
| 507 | </div><!-- // END row-app --> | ||
| 508 | |||
| 509 | <?php } ?> |
| ... | @@ -40,141 +40,43 @@ $searchkey3=trim(Input::get('maintextsearch_3_span')); | ... | @@ -40,141 +40,43 @@ $searchkey3=trim(Input::get('maintextsearch_3_span')); |
| 40 | $searchstr4=trim(Input::get('maintextsearch_4_txt')); | 40 | $searchstr4=trim(Input::get('maintextsearch_4_txt')); |
| 41 | $searchkey4=trim(Input::get('maintextsearch_4_span')); | 41 | $searchkey4=trim(Input::get('maintextsearch_4_span')); |
| 42 | 42 | ||
| 43 | $client=trim(Input::get('client')); | ||
| 43 | 44 | ||
| 44 | $uids=array(); | 45 | function getUidsByKey($wakka, $key, $value, $client) { |
| 45 | 46 | ||
| 46 | if($searchstr1!="") | 47 | $searchKeyArray = array( |
| 47 | { | 48 | "ID" =>'id', "FirstName" =>'firstname', "LastName" =>'lastname', |
| 48 | $key='';$tusers=array(); | 49 | "Client" =>'client', "Mobile" =>'mobile', "Email" =>'emailid', |
| 49 | if($searchkey1=="ID")$key='id'; | 50 | "Passport" =>'passportno', "IBAN" =>'ibannumber', "Status" =>'currentstatus', |
| 50 | if($searchkey1=="FirstName")$key='firstname'; | 51 | "InternalID"=>'clientinternalid', "ClientCode"=>'clientcode', "PersonalID"=>'laborcardpersonalid'); |
| 51 | if($searchkey1=="LastName")$key='lastname'; | ||
| 52 | if($searchkey1=="Client")$key='client'; | ||
| 53 | if($searchkey1=="Mobile")$key='mobile'; | ||
| 54 | if($searchkey1=="Email")$key='emailid'; | ||
| 55 | if($searchkey1=="Passport")$key='passportno'; | ||
| 56 | if($searchkey1=="IBAN")$key='ibannumber'; | ||
| 57 | if($searchkey1=="Status")$key='currentstatus'; | ||
| 58 | if($searchkey1=="PersonalID")$key='laborcardpersonalid'; | ||
| 59 | if($searchkey1=="InternalID")$key='clientinternalid'; | ||
| 60 | if($searchkey1=="ClientCode")$key='clientcode'; | ||
| 61 | 52 | ||
| 62 | if($key!='') | 53 | $key=$searchKeyArray[$key]; |
| 63 | { | ||
| 64 | if($key=='id')$uids=array(intval($searchstr1)); | ||
| 65 | else | ||
| 66 | { | ||
| 67 | $matchkeys=array(); | ||
| 68 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; | ||
| 69 | |||
| 70 | $res=$wakka->LoadAll("select distinct $key from records $prematchstr"); | ||
| 71 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr1))$matchkeys[]="'".$tres[$key]."'"; | ||
| 72 | |||
| 73 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; | ||
| 74 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2"); | ||
| 75 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | if($searchstr2!="") | ||
| 80 | { | ||
| 81 | $key='';$tusers=array(); | ||
| 82 | if($searchkey2=="ID")$key='id'; | ||
| 83 | if($searchkey2=="FirstName")$key='firstname'; | ||
| 84 | if($searchkey2=="LastName")$key='lastname'; | ||
| 85 | if($searchkey2=="Client")$key='client'; | ||
| 86 | if($searchkey2=="Mobile")$key='mobile'; | ||
| 87 | if($searchkey2=="Email")$key='emailid'; | ||
| 88 | if($searchkey2=="Passport")$key='passportno'; | ||
| 89 | if($searchkey2=="IBAN")$key='ibannumber'; | ||
| 90 | if($searchkey2=="Status")$key='currentstatus'; | ||
| 91 | if($searchkey2=="PersonalID")$key='laborcardpersonalid'; | ||
| 92 | if($searchkey2=="InternalID")$key='clientinternalid'; | ||
| 93 | if($searchkey2=="ClientCode")$key='clientcode'; | ||
| 94 | 54 | ||
| 55 | $uids=array(); | ||
| 95 | if($key!='') | 56 | if($key!='') |
| 96 | { | 57 | { |
| 97 | if($key=='id')$uids=array(intval($searchstr2)); | 58 | if($key=='id'){ |
| 98 | else | 59 | $uids=array(intval($value)); |
| 99 | { | ||
| 100 | $matchkeys=array(); | ||
| 101 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; | ||
| 102 | |||
| 103 | $res=$wakka->LoadAll("select distinct $key from records $prematchstr"); | ||
| 104 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr2))$matchkeys[]="'".$tres[$key]."'"; | ||
| 105 | |||
| 106 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; | ||
| 107 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2"); | ||
| 108 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; | ||
| 109 | } | ||
| 110 | } | 60 | } |
| 111 | } | ||
| 112 | if($searchstr3!="") | ||
| 113 | { | ||
| 114 | $key='';$tusers=array(); | ||
| 115 | if($searchkey3=="ID")$key='id'; | ||
| 116 | if($searchkey3=="FirstName")$key='firstname'; | ||
| 117 | if($searchkey3=="LastName")$key='lastname'; | ||
| 118 | if($searchkey3=="Client")$key='client'; | ||
| 119 | if($searchkey3=="Mobile")$key='mobile'; | ||
| 120 | if($searchkey3=="Email")$key='emailid'; | ||
| 121 | if($searchkey3=="Passport")$key='passportno'; | ||
| 122 | if($searchkey3=="IBAN")$key='ibannumber'; | ||
| 123 | if($searchkey3=="Status")$key='currentstatus'; | ||
| 124 | if($searchkey3=="PersonalID")$key='laborcardpersonalid'; | ||
| 125 | if($searchkey3=="InternalID")$key='clientinternalid'; | ||
| 126 | if($searchkey3=="ClientCode")$key='clientcode'; | ||
| 127 | |||
| 128 | if($key!='') | ||
| 129 | { | ||
| 130 | if($key=='id')$uids=array(intval($searchstr3)); | ||
| 131 | else | 61 | else |
| 132 | { | 62 | { |
| 133 | $matchkeys=array(); | 63 | if(!empty($value)){ |
| 134 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; | 64 | $tusers=$wakka->getPersonIDsWithLike($key, $value, $client); |
| 135 | |||
| 136 | $res=$wakka->LoadAll("select distinct $key from records $prematchstr"); | ||
| 137 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr3))$matchkeys[]="'".$tres[$key]."'"; | ||
| 138 | 65 | ||
| 139 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; | 66 | if(count($tusers))foreach($tusers as $tuser) $uids[]=$tuser['id']+0; |
| 140 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2"); | ||
| 141 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; | ||
| 142 | } | 67 | } |
| 143 | } | 68 | } |
| 69 | } | ||
| 70 | return $uids; | ||
| 144 | } | 71 | } |
| 145 | if($searchstr4!="") | ||
| 146 | { | ||
| 147 | $key='';$tusers=array(); | ||
| 148 | if($searchkey4=="ID")$key='id'; | ||
| 149 | if($searchkey4=="FirstName")$key='firstname'; | ||
| 150 | if($searchkey4=="LastName")$key='lastname'; | ||
| 151 | if($searchkey4=="Client")$key='client'; | ||
| 152 | if($searchkey4=="Mobile")$key='mobile'; | ||
| 153 | if($searchkey4=="Email")$key='emailid'; | ||
| 154 | if($searchkey4=="Passport")$key='passportno'; | ||
| 155 | if($searchkey4=="IBAN")$key='ibannumber'; | ||
| 156 | if($searchkey4=="Status")$key='currentstatus'; | ||
| 157 | if($searchkey4=="PersonalID")$key='laborcardpersonalid'; | ||
| 158 | if($searchkey4=="InternalID")$key='clientinternalid'; | ||
| 159 | if($searchkey4=="ClientCode")$key='clientcode'; | ||
| 160 | 72 | ||
| 161 | if($key!='') | 73 | $uids=array(); |
| 162 | { | 74 | if($searchstr1!="") $uids = getUidsByKey($wakka, $searchkey1, $searchstr1, $client); |
| 163 | if($key=='id')$uids=array(intval($searchstr4)); | 75 | if($searchstr2!="") $uids = getUidsByKey($wakka, $searchkey2, $searchstr2, $client); |
| 164 | else | 76 | if($searchstr3!="") $uids = getUidsByKey($wakka, $searchkey3, $searchstr3, $client); |
| 165 | { | 77 | if($searchstr4!="") $uids = getUidsByKey($wakka, $searchkey4, $searchstr4, $client); |
| 166 | $matchkeys=array(); | ||
| 167 | $prematchstr="";if(!empty($uids))$prematchstr="where id in (".implode(",",$uids).")"; | ||
| 168 | 78 | ||
| 169 | $res=$wakka->LoadAll("select distinct $key from records $prematchstr"); | ||
| 170 | foreach($res as $tres)if($tres[$key]!=''&&stristr($tres[$key],$searchstr4))$matchkeys[]="'".$tres[$key]."'"; | ||
| 171 | 79 | ||
| 172 | $prematchstr2="";if(!empty($uids))$prematchstr2="and id in (".implode(",",$uids).")"; | ||
| 173 | if(!empty($matchkeys))$tusers=$wakka->getPersonIDs("$key in (".implode(",",$matchkeys).") $prematchstr2"); | ||
| 174 | $uids=array();foreach($tusers as $tuser)if(isset($tuser['id']))$uids[]=$tuser['id']+0; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | } | ||
| 178 | $roclientstr=array(); | 80 | $roclientstr=array(); |
| 179 | if($wakka->GetBBBUserData("readotherdata")=="No") | 81 | if($wakka->GetBBBUserData("readotherdata")=="No") |
| 180 | { | 82 | { |
| ... | @@ -183,7 +85,7 @@ if($searchstr4!="") | ... | @@ -183,7 +85,7 @@ if($searchstr4!="") |
| 183 | } | 85 | } |
| 184 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; | 86 | if(!empty($roclientstr))$roclientstr="and client in (".implode(",",$roclientstr).")";else $roclientstr=""; |
| 185 | 87 | ||
| 186 | if(!empty($uids))$users=$wakka->getPersons("id in (".implode(",",$uids).") $roclientstr limit 200"); | 88 | if(!empty($uids))$users=$wakka->getPersons("id in (".implode(",",$uids).") $roclientstr limit 10;",$client); |
| 187 | 89 | ||
| 188 | if(!empty($users)) | 90 | if(!empty($users)) |
| 189 | { | 91 | { | ... | ... |
| ... | @@ -4,7 +4,7 @@ $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); | ... | @@ -4,7 +4,7 @@ $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]); |
| 4 | if($wakka->GetUser()) | 4 | if($wakka->GetUser()) |
| 5 | { | 5 | { |
| 6 | $varid=Input::get('varid'); | 6 | $varid=Input::get('varid'); |
| 7 | $recruitdata=$wakka->getPerson($varid); | 7 | $recruitdata=$wakka->getPerson($varid,""); |
| 8 | 8 | ||
| 9 | $config=array(); | 9 | $config=array(); |
| 10 | $config['varid']=$varid; | 10 | $config['varid']=$varid; | ... | ... |
| ... | @@ -5,11 +5,9 @@ $wakka->setUserTimezone(); | ... | @@ -5,11 +5,9 @@ $wakka->setUserTimezone(); |
| 5 | $themehome=$wakka->GetThemePath('/'); | 5 | $themehome=$wakka->GetThemePath('/'); |
| 6 | $varid=Input::get('varid'); | 6 | $varid=Input::get('varid'); |
| 7 | $bkvarid=Input::get('bkvarid'); | 7 | $bkvarid=Input::get('bkvarid'); |
| 8 | |||
| 9 | $edituser=0;$noreaduser=0;$oldbkrec=0; | 8 | $edituser=0;$noreaduser=0;$oldbkrec=0; |
| 10 | $isuser=$wakka->GetUser()?1:0; | 9 | $isuser=$wakka->GetUser()?1:0; |
| 11 | $recruitdata=array(); | 10 | $recruitdata=array(); |
| 12 | |||
| 13 | if($varid=="0") | 11 | if($varid=="0") |
| 14 | { | 12 | { |
| 15 | return; | 13 | return; |
| ... | @@ -74,7 +72,7 @@ if($varid!=""||$isuser) | ... | @@ -74,7 +72,7 @@ if($varid!=""||$isuser) |
| 74 | { | 72 | { |
| 75 | 73 | ||
| 76 | $varid=intval($varid); | 74 | $varid=intval($varid); |
| 77 | $recruitdata=$wakka->getPerson($varid); | 75 | $recruitdata=$wakka->getPerson($varid,""); |
| 78 | } | 76 | } |
| 79 | 77 | ||
| 80 | 78 | ... | ... |
| ... | @@ -85,6 +85,7 @@ $(document).ready(function(){ | ... | @@ -85,6 +85,7 @@ $(document).ready(function(){ |
| 85 | { | 85 | { |
| 86 | //doAjax('social/{!!Auth::user()->id!!}','show=wizard','welcome_wizard_body','ajax_wizard_show','singlefail','GET'); | 86 | //doAjax('social/{!!Auth::user()->id!!}','show=wizard','welcome_wizard_body','ajax_wizard_show','singlefail','GET'); |
| 87 | } | 87 | } |
| 88 | $('#transferButton').popover({title: "<b>Transfer Current Call</b>", content: '<div class="input-group"><input type="text" class="form-control" placeholder="Number" id=transfercalltxt><span class="input-group-btn"><button class="btn btn-default" type="button" onclick="transfercallconf();return false;" id="transferCallBtn"><i class="glyphicon glyphicon-transfer"></i></button><button class="btn btn-danger hide" type="button" onclick="sendTHDTMFs();return false;" id="transferHangBtn">×</button></span></div>', html: true, placement: "bottom"}); | ||
| 88 | }); | 89 | }); |
| 89 | 90 | ||
| 90 | function hrmsSearch() | 91 | function hrmsSearch() |
| ... | @@ -198,35 +199,39 @@ function createSearchRecordDiv(divid) | ... | @@ -198,35 +199,39 @@ function createSearchRecordDiv(divid) |
| 198 | 199 | ||
| 199 | <?php | 200 | <?php |
| 200 | $userdialmode=Auth::user()->dialmode_assign; | 201 | $userdialmode=Auth::user()->dialmode_assign; |
| 202 | $client=Auth::user()->sel_campaign; | ||
| 201 | $userdialmode=explode(",",$userdialmode); | 203 | $userdialmode=explode(",",$userdialmode); |
| 202 | //print_r($userdialmode); | 204 | //print_r($userdialmode); |
| 203 | if(in_array('Progressive',$userdialmode)) | 205 | if(in_array('Progressive',$userdialmode)) |
| 204 | { ?> | 206 | { ?> |
| 205 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Progressive");return false;'><b>Progressive</b></a></li> | 207 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Progressive");savedialermode(<?php echo $client; ?>);return false;'><b>Progressive</b></a></li> |
| 206 | <?php | 208 | <?php |
| 207 | } | 209 | } |
| 208 | if(in_array('Manual',$userdialmode)){?> | 210 | if(in_array('Manual',$userdialmode)){?> |
| 209 | 211 | ||
| 210 | 212 | ||
| 211 | <li id=dialerManualAllowLI><a href="#" onclick='updateDialerState("dialer","mDialerState","Manual");return false;'><b>Manual</b></a></li> | 213 | <li id=dialerManualAllowLI><a href="#" onclick='updateDialerState("dialer","mDialerState","Manual");savedialermode();return false;'><b>Manual</b></a></li> |
| 212 | 214 | ||
| 213 | 215 | ||
| 214 | <?php } if(in_array('Incoming',$userdialmode)){ ?> | 216 | <?php } if(in_array('Incoming',$userdialmode)){ ?> |
| 215 | <li style='background:#36bc9b'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Incoming");return false;'><b>Incoming</b></a></li> | 217 | <li style='background:#36bc9b'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Incoming");savedialermode();return false;'><b>Incoming</b></a></li> |
| 218 | |||
| 219 | <?php } if(in_array('Predictive',$userdialmode)){?> | ||
| 220 | <li style='background:#68cc9e'><a href="#" onclick='updateDialerState("dialer","mDialerState","Ready","mDialerSubState","Predictive");savedialermode();return false;'><b>Predictive</b></a></li> | ||
| 216 | <?php } ?> | 221 | <?php } ?> |
| 217 | <!--<li><a href="#" onclick='updateDialerState("dialer","mDialerState","DialNext");return false;'><b>DialNext</b></a></li>--> | 222 | <!--<li><a href="#" onclick='updateDialerState("dialer","mDialerState","DialNext");return false;'><b>DialNext</b></a></li>--> |
| 218 | 223 | ||
| 219 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","Manual");return false;'><b>Paused</b></a></li> | 224 | <li><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","Manual");savedialermode();return false;'><b>Paused</b></a></li> |
| 220 | 225 | ||
| 221 | 226 | ||
| 222 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","AgentBriefing");return false;'><b>AgentBriefing</b></a></li> | 227 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","AgentBriefing");savedialermode();return false;'><b>AgentBriefing</b></a></li> |
| 223 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeamMeeting");return false;'><b>TeamMeeting</b></a></li> | 228 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeamMeeting");savedialermode();return false;'><b>TeamMeeting</b></a></li> |
| 224 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","QualityFeedback");return false;'><b>QualityFeedback</b></a></li> | 229 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","QualityFeedback");savedialermode();return false;'><b>QualityFeedback</b></a></li> |
| 225 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","LunchBreak");return false;'><b>LunchBreak</b></a></li> | 230 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","LunchBreak");savedialermode();return false;'><b>LunchBreak</b></a></li> |
| 226 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeaBreak");return false;'><b>TeaBreak</b></a></li> | 231 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","TeaBreak");savedialermode();return false;'><b>TeaBreak</b></a></li> |
| 227 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","UtilityBreak");return false;'><b>UtilityBreak</b></a></li> | 232 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","UtilityBreak");savedialermode();return false;'><b>UtilityBreak</b></a></li> |
| 228 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","FloorAnnouncements");return false;'><b>FloorAnnouncements</b></a></li> | 233 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","FloorAnnouncements");savedialermode();return false;'><b>FloorAnnouncements</b></a></li> |
| 229 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","DownTime");return false;'><b>DownTime</b></a></li> | 234 | <li style='background:#ccc'><a href="#" onclick='updateDialerState("dialer","mDialerState","Paused","mDialerSubState","DownTime");savedialermode();return false;'><b>DownTime</b></a></li> |
| 230 | 235 | ||
| 231 | 236 | ||
| 232 | </ul> | 237 | </ul> |
| ... | @@ -234,9 +239,7 @@ function createSearchRecordDiv(divid) | ... | @@ -234,9 +239,7 @@ function createSearchRecordDiv(divid) |
| 234 | </div> | 239 | </div> |
| 235 | 240 | ||
| 236 | <input class="form-control" id="manualdialnumber_txt" style='width:200px' type="text" /> | 241 | <input class="form-control" id="manualdialnumber_txt" style='width:200px' type="text" /> |
| 237 | |||
| 238 | <span class="input-group-addon btn btn-default" id=manualdial_btn dialaction=dialnext onclick='updateDialerState("action",$(this).attr("dialaction"),$("#manualdialnumber_txt").val());'></span> | 242 | <span class="input-group-addon btn btn-default" id=manualdial_btn dialaction=dialnext onclick='updateDialerState("action",$(this).attr("dialaction"),$("#manualdialnumber_txt").val());'></span> |
| 239 | |||
| 240 | </div> | 243 | </div> |
| 241 | 244 | ||
| 242 | 245 | ||
| ... | @@ -255,9 +258,10 @@ function createSearchRecordDiv(divid) | ... | @@ -255,9 +258,10 @@ function createSearchRecordDiv(divid) |
| 255 | <i class='fa fa-fw fa-phone'></i> <span id=spandialer_num onclick='dialerDispNumberClick();return false;'></span> | 258 | <i class='fa fa-fw fa-phone'></i> <span id=spandialer_num onclick='dialerDispNumberClick();return false;'></span> |
| 256 | </a> | 259 | </a> |
| 257 | </div> | 260 | </div> |
| 258 | |||
| 259 | <div id=dialerToggleViewDiv style='float:right;margin-right:20px;'> | 261 | <div id=dialerToggleViewDiv style='float:right;margin-right:20px;'> |
| 260 | 262 | <?php if(Auth::user()->id=='1'){ ?> | |
| 263 | <button class="btn btn-circle btn-default" id="transferButton"><i class="glyphicon glyphicon-transfer"></i></button> | ||
| 264 | <?php } ?> | ||
| 261 | <button class="btn btn-circle btn-default" ><i class="fa fa-phone"></i></button> | 265 | <button class="btn btn-circle btn-default" ><i class="fa fa-phone"></i></button> |
| 262 | <i class="fa fa-long-arrow-left"></i> | 266 | <i class="fa fa-long-arrow-left"></i> |
| 263 | 267 | ||
| ... | @@ -365,6 +369,45 @@ function createSearchRecordDiv(divid) | ... | @@ -365,6 +369,45 @@ function createSearchRecordDiv(divid) |
| 365 | $("#topdialerconfcall").hide(); | 369 | $("#topdialerconfcall").hide(); |
| 366 | 370 | ||
| 367 | } | 371 | } |
| 372 | |||
| 373 | function transfercallconf() | ||
| 374 | { | ||
| 375 | var confnumber=$("#transfercalltxt").val(); | ||
| 376 | if(confnumber==''||confnumber.length<2) | ||
| 377 | { | ||
| 378 | simpleNotification('error','topRight',"Empty Number"); | ||
| 379 | return; | ||
| 380 | } | ||
| 381 | if(!kcallHasConnection(kstychCall['callnumber'])||kstychCall['ts_Dispo']>1) | ||
| 382 | { | ||
| 383 | simpleNotification('error','topRight',"No call to transfer"); | ||
| 384 | return; | ||
| 385 | } | ||
| 386 | |||
| 387 | $("#transferCallBtn").removeClass("show").addClass("hide"); | ||
| 388 | $("#transferHangBtn").removeClass("hide").addClass("show"); | ||
| 389 | |||
| 390 | var datastr="kstychCall="+JSON.stringify(kstychCall); | ||
| 391 | datastr+="&kstychDialer="+JSON.stringify(kstychDialer); | ||
| 392 | //kcallNewConnection(confnumber); | ||
| 393 | doAjax('dialer?action=transfercall&confnumber='+confnumber,datastr,'__fake__div__', 'ajax_confdial','singlefail','POST', function(retstr){ | ||
| 394 | if(retstr.responseText.indexOf('Error')<0) | ||
| 395 | { | ||
| 396 | // kcallSetConnection(confnumber,'callid',retstr.responseText); | ||
| 397 | // kcallSetConnection(confnumber,'ts_Call',getNowTS()); | ||
| 398 | |||
| 399 | updateDialerState(); | ||
| 400 | } | ||
| 401 | else | ||
| 402 | { | ||
| 403 | simpleNotification('error','topRight',retstr.responseText); | ||
| 404 | } | ||
| 405 | }); | ||
| 406 | |||
| 407 | $("#topdialerconfcall").hide(); | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 368 | </script> | 411 | </script> |
| 369 | </div> | 412 | </div> |
| 370 | </div> | 413 | </div> | ... | ... |
File mode changed
kickConf.php
0 → 100755
| 1 | #!/usr/bin/php | ||
| 2 | <?php | ||
| 3 | $db = mysqli_connect("localhost", "root", "yb9738z", "fullerton"); | ||
| 4 | |||
| 5 | for ($i=0; $i < 6; $i++) { | ||
| 6 | $sql = $db->query("SELECT d.conf FROM diallines d JOIN sipids s ON d.conf = concat('1000',s.id) WHERE s.status=0"); | ||
| 7 | $confs = $sql->fetch_all(); | ||
| 8 | |||
| 9 | foreach($confs as $conf){ | ||
| 10 | print_r($conf); | ||
| 11 | exec('/usr/sbin/asterisk -rx "confbridge kick '.$conf[0].' all"'); | ||
| 12 | } | ||
| 13 | |||
| 14 | $sql = $db->query("SELECT channel FROM diallines WHERE status IN ('Inbound','Auto') AND conf='' AND UNIX_TIMESTAMP(updated_at) <= (".time()." - 60)"); | ||
| 15 | $channels = $sql->fetch_all(); | ||
| 16 | |||
| 17 | foreach($channels as $channel){ | ||
| 18 | print_r($channel); | ||
| 19 | exec('/usr/sbin/asterisk -rx "confbridge kick '.$channel[0].' all"'); | ||
| 20 | } | ||
| 21 | |||
| 22 | $sipIdStr = "'0'"; | ||
| 23 | exec("/usr/sbin/asterisk -rx 'confbridge list'",$activeConfs); | ||
| 24 | foreach($activeConfs as $activeConf){ | ||
| 25 | $activeConfArr = explode(" ", preg_replace('!\s+!', ' ', $activeConf) ); | ||
| 26 | $sipConf = $activeConfArr[0]; | ||
| 27 | |||
| 28 | if(!empty($sipConf) && !(strpos($sipConf, '1000')===false) ){ | ||
| 29 | $sipIdStr .= ",'".substr($sipConf, 4)."'"; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | $sql = $db->query("select * from sipids where status=0 and id in ($sipIdStr)"); | ||
| 34 | $sipids = $sql->fetch_all(); | ||
| 35 | |||
| 36 | foreach($sipids as $sipid){ | ||
| 37 | print_r('1000'. $sipid[0]); | ||
| 38 | exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid[0].'"'); | ||
| 39 | exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid[0].' all"'); | ||
| 40 | } | ||
| 41 | |||
| 42 | usleep(1000*1000*9); | ||
| 43 | } | ||
| 44 | ?> |
-
Please register or sign in to post a comment