<?php 
defined('BASEPATH') OR exit ('No direct script access allowed');

class Notifica_pagamento_model extends CI_model
{
    
    public function sms_problema_pagamento()
    {
        $query = $this->db->query("SELECT a.email , a.id_fic, a.ddd_celular, a.celular, a.ddd_telefone, a.telefone,it.transacao ,count(it.transacao)
                                    FROM pedido p
                                    JOIN item_pedido it ON ( p.transacao = it.transacao )
                                    JOIN aluno a ON (p.id_aluno = a.id_fic)
                                    WHERE p.valor <> it.valor
                                    AND p.situacao =3
                                    AND p.reponsavel =4
                                    AND p.data_alteracao>'2018-10-11'
                                    group by it.transacao
                                    having count(it.transacao) in (1,2,3,4,5,6)
                                    ORDER BY count(it.transacao) ASC");
        
        return $query->result_array();
    }

}