Subversion Repositories SmartDukaan

Rev

Rev 20076 | Rev 20083 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20076 Rev 20077
Line 18... Line 18...
18
		fputcsv($file, explode(',',$header));
18
		fputcsv($file, explode(',',$header));
19
		$callquery = "select c.* , a.name from callhistory c join agents a on c.agent_id = a.id where c.call_time > '".$newdate."' and c.agent_id> 2";
19
		$callquery = "select c.* , a.name from callhistory c join agents a on c.agent_id = a.id where c.call_time > '".$newdate."' and c.agent_id> 2";
20
		$result = $this->Callhistory->query($callquery);
20
		$result = $this->Callhistory->query($callquery);
21
 
21
 
22
		foreach ($result as $key => $row){
22
		foreach ($result as $key => $row){
-
 
23
			$phone = substr($row['c']['mobile_number'], 0, 4) . str_repeat("X", strlen($row['c']['mobile_number']) - 6) . substr($row['c']['mobile_number'], -2);			
23
			$content = $row['c']['id'].",".$row['c']['retailer_id'].",".$row['a']['name'].",".$row['c']['mobile_number'].",".$row['c']['call_type'].",".$row['c']['sms_verified'].",".$row['c']['call_time'].",".$row['c']['duration_sec'].",".$row['c']['call_disposition'].",".$row['c']['disposition_description'].",".$row['c']['created'];
24
			$content = $row['c']['id'].",".$row['c']['retailer_id'].",".$row['a']['name'].",".$phone.",".$row['c']['call_type'].",".$row['c']['sms_verified'].",".$row['c']['call_time'].",".$row['c']['duration_sec'].",".$row['c']['call_disposition'].",".$row['c']['disposition_description'].",".$row['c']['created'];
24
			$this->out($content);
25
			$this->out($content);
25
			echo "\n";
26
			echo "\n";
26
			fputcsv($file,explode(',',$content));
27
			fputcsv($file,explode(',',$content));
27
		}
28
		}
28
	
29
	
Line 31... Line 32...
31
		
32
		
32
		$Email = new CakeEmail();
33
		$Email = new CakeEmail();
33
		$Email->config('smtp')
34
		$Email->config('smtp')
34
		->from(array('help@profitmandi.com' => 'Admin at ProfitMandi'))
35
		->from(array('help@profitmandi.com' => 'Admin at ProfitMandi'))
35
		->to('naman.kumar@shop2020.in')
36
		->to('naman.kumar@shop2020.in')
-
 
37
		->cc('amit.gupta@shop2020.in')
36
		->attachments(array(
38
		->attachments(array(
37
				'callhistory.csv' => array(
39
				'callhistory.csv' => array(
38
						'file' => '../app/callhistory.csv',
40
						'file' => '../app/callhistory.csv',
39
						'mimetype' => 'text/csv',
41
						'mimetype' => 'text/csv',
40
						'contentId' => 'my-unique-id'
42
						'contentId' => 'my-unique-id'
41
				)))
43
				)))
42
		->subject('Callhistory Report');
44
		->subject('Callhistory Report');
43
		if($Email->send('Report'))
45
		if($Email->send('Callhistory Report'))
44
		{
46
		{
45
			$this->out('Email Sent..');
47
			$this->out('Email Sent..');
46
		} else  {
48
		} else  {
47
			$this->out('Email does not sent..');
49
			$this->out('Email does not sent..');
48
		}
50
		}