function enviarEmailsCartoesPrePagos()
 {
     $hoje = date("Y-m-d");
     $hojets = strtotime($hoje);
     $this->getById(2);
     $ultimoDiats = strtotime($this->data);
     $dia = date("Y-m-d", $ultimoDiats);
     $i = 1;
     $dia = date("Y-m-d", mktime(0, 0, 0, date("m", $ultimoDiats), date("d", $ultimoDiats) + $i, date("Y", $ultimoDiats)));
     $i = 2;
     $oPag = new Pagamento();
     $log = "";
     while (str_replace("-", "", $dia) <= str_replace("-", "", $hoje)) {
         $rs = $oPag->getRows(0, 999, array(), array("dataPagamento" => "='" . $dia . "'", "tipo" => "=2"));
         $log .= "Email de Cartões Pré-pagos para o dia: " . $this->convdata($dia, "mtn") . " <br/>";
         $j = 0;
         foreach ($rs as $key => $pagamento) {
             $log .= "Grupo: " . $pagamento->participante->grupo->nomePacote . " - Participante: " . $pagamento->participante->cliente->nomeCompleto . " - Valor: " . $pagamento->valorPagamento . " <br/>";
             $j++;
         }
         if ($j > 0) {
             $this->mail_html($this->destinatarios, $this->REMETENTE, 'Agendamento de Cartões de Crédito', $log);
         }
         $dia = date("Y-m-d", mktime(0, 0, 0, date("m", $ultimoDiats), date("d", $ultimoDiats) + $i, date("Y", $ultimoDiats)));
         $i++;
     }
     //fim do loop de dias
     $this->data = $hoje;
     $this->save();
 }
Example #2
0
 function get($pedido)
 {
     $mPag = new Pagamento();
     $pagamento = $mPag->select(array('num_pedido' => $pedido));
     if (!$pagamento or $pagamento->status != 'Aguardando Pagto') {
         header('Location: ' . BASE_URL);
     }
     include 'app/template/public/pagamento.php';
 }
 function alterarAbatimento()
 {
     $idPagamento = $this->md5_decrypt($_REQUEST['idPagamento']);
     $oPag = new Pagamento();
     $om = new Moeda();
     $oTipoP = new TipoPagamento();
     $oPag->getById($idPagamento);
     $this->getById($_REQUEST['id']);
     $valor = $this->money($_REQUEST['valor'], "bta");
     $oPartic = new Participante();
     $oPartic->getById($_REQUEST['participante']);
     $idMoedaGrupo = $oPag->participante->grupo->moeda->id;
     if ($idMoedaGrupo == $om->DOLLAR()) {
         $valorNovo = $oPag->CALCULA_DOLLAR($valor);
     } else {
         $valorNovo = $oPag->CALCULA_REAL($valor);
     }
     //validacao
     if ($idMoedaGrupo == $om->DOLLAR()) {
         $valorMaximo = $oPag->CALCULA_DOLLAR();
     } else {
         $valorMaximo = $oPag->CALCULA_REAL();
     }
     $total = $this->totalAbatimentos($idPagamento);
     $total = $total - $this->valor;
     if ($oTipoP->CARTAO() == $oPag->tipo->id && $oPag->codAutorizacao != "") {
         $_SESSION['tupi.mensagem'] = 61;
         header("Location:participante.abatimentos.php?idPagamento=" . $_REQUEST['idPagamento']);
         exit;
     }
     if (number_format($total + $valorNovo, 2, ".", "") > number_format($valorMaximo, 2, ".", "")) {
         $_SESSION['tupi.mensagem'] = 40;
         header("Location:participante.abatimentos.php?idPagamento=" . $_REQUEST['idPagamento']);
         exit;
     }
     //configurando o objeto
     $this->valor = $valorNovo;
     $this->pagamento = $oPag;
     $this->participante = $oPartic;
     $idAbatimento = $this->save();
     //FAZ A CONFERENCIA PARA MUDAR O STATUS DO PARTICIPANTE
     $oPartic->atualiza_status();
     $_SESSION['tupi.mensagem'] = 42;
 }
Example #4
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     if (!Yii::app()->user->isAdmin()) {
         $this->redirect(array('../index.php/venda'));
     }
     $totalProdutos = Produto::model()->getTotal();
     $totalVendasHoje = Venda::model()->getTotalVendaHoje();
     $totalVendasPrazoHoje = Venda::model()->getTotalvendasPrazoHoje();
     $totalCliente = Cliente::model()->getTotal();
     $totalPagamentos = Pagamento::model()->getToalPagamentosDia();
     $totalFornecedores = Fornecedor::model()->getTotal();
     $totalVendasVista = $totalVendasHoje - $totalVendasPrazoHoje;
     $data = array('totalProdutos' => $totalProdutos, 'totalVendaHoje' => $totalVendasHoje, 'totalVendasPrazoHoje' => $totalVendasPrazoHoje, 'totalCliente' => $totalCliente, 'totalPagamentos' => $totalPagamentos, 'totalFornecedores' => $totalFornecedores, 'totalVendasVista' => $totalVendasVista, 'itensMaisVendidos' => Produto::model()->getItensMaisVendidos());
     $this->render('index', $data);
 }
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorio";
include "tupi.template.inicializar.php";
$codAcesso = 34;
include "tupi.seguranca.php";
//titulo do relatorio
$tpl->TITULO = "Relatório Mensal de Forma de Pagamento";
$tpl->DATA_RELATORIO = "Data/Hora:" . date("d/m/Y h:i:s");
$oC = new Cheque();
$om = new Moeda();
$oP = new Pagamento();
$oTP = new TipoPagamento();
$oTT = new TipoTransferencia();
$dataRelatorio = $_REQUEST['ano'] . "-" . $_REQUEST['mes'] . "-01";
$dataFimRelatorio = $oP->ultimoDiaMes($dataRelatorio);
$filtro = array("dataPagamento" => "between '" . $dataRelatorio . "' and '" . $dataFimRelatorio . "'", "cancelado" => "=0");
$rs = $oP->getRows(0, 9999, array(), $filtro);
$rsCheques = $oC->pesquisa($dataRelatorio, $dataFimRelatorio, "", 0);
//$tpl->DATA_ATUAL = date("d/m/Y");
$valorEspecie = 0;
$valorCartao = 0;
$valorCheque = 0;
$valorTED = 0;
$valorDOC = 0;
$valorTransf = 0;
$valorDeposito = 0;
$valorDebito = 0;
//dollar
$valorEspecied = 0;
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorioHorizontal";
include "tupi.template.inicializar.php";
$codAcesso = 36;
include "tupi.seguranca.php";
//titulo do relatorio
$tpl->TITULO = "Relatório Geral por período";
$tpl->DATA_RELATORIO = "Data/Hora:" . date("d/m/Y h:i:s");
//declara as classes
$om = new Moeda();
$oP = new Pagamento();
$oTP = new TipoPagamento();
$oTT = new TipoTransferencia();
$oG = new Grupo();
$oPartic = new Participante();
$oC = new Cheque();
//TOTAIS GERAL
$custoDollarTotal = 0;
$recebimentoDollarTotal = 0;
$recebimentoRealTotal = 0;
$valorEspecieTotal = 0;
$valorCartaoTotal = 0;
$valorDebitoTotal = 0;
$valorChequeTotal = 0;
$valorTEDTotal = 0;
$valorDOCTotal = 0;
$valorTransfTotal = 0;
$valorDepositoTotal = 0;
$valorCreditoClienteTotal = 0;
 function recuperaValorTodosPagamentos($idMoeda)
 {
     $oPagamento = new Pagamento();
     $om = new Moeda();
     $total = 0;
     $rs = $oPagamento->getRows(0, 999, array(), array("participante" => "=" . $this->id, "cancelado" => "=0"));
     foreach ($rs as $key => $pag) {
         if ($idMoeda == $om->DOLLAR()) {
             $total += $pag->CALCULA_DOLLAR();
         } else {
             $total += $pag->CALCULA_REAL();
         }
     }
     return $total;
 }
    <a href="home.php">Home</a> <span class="divider">/</span>
    </li>
    <li>
    <a href="grupos.andamento.php">Grupos</a> <span class="divider">/</span>
    </li>

    <li class="active">Lista de Participantes</li>
    </ul>';
}
//configura o grupo na pagina
$oGrupo = new Grupo();
$idGrupo = $oGrupo->md5_decrypt($_REQUEST['idGrupo']);
$oGrupo->getById($idGrupo);
$tpl->NOME_GRUPO = $oGrupo->nomePacote;
$tpl->ID_GRUPO_HASH = $_REQUEST['idGrupo'];
$oP = new Pagamento();
$oA = new Abatimento();
$oParticipante = new Participante();
$strBusca = isset($_REQUEST['busca']) ? str_replace(".", "", str_replace("-", "", $_REQUEST['busca'])) : "";
$totalParticipantes = $oParticipante->recuperaTotal($idGrupo, $strBusca);
$pagina = isset($_REQUEST['pagina']) ? $_REQUEST['pagina'] : 1;
$configPaginacao = $oParticipante->paginar($totalParticipantes, $pagina);
$rsPartic = $oParticipante->pesquisa($configPaginacao['primeiroRegistro'], $configPaginacao['quantidadePorPagina'], $idGrupo, $strBusca);
$tpl->MODELO_CONTRATO = $oGrupo->modeloContrato;
$tpl->MODELO_FICHA = $oGrupo->modeloFicha;
if ($configPaginacao['totalPaginas'] > 1) {
    $tpl->block("BLOCK_PAGINACAO");
}
$tpl->TOTAL_PAGINAS = $configPaginacao['totalPaginas'];
$tpl->PAGINA_ANTERIOR = $configPaginacao['paginaAnterior'];
$tpl->PROXIMA_PAGINA = $configPaginacao['proximaPagina'];
<?
include("../tupi.inicializar.php");
include("../tupi.template.inicializar.php"); 
$oTipoP = new TipoPagamento();
$oMoeda = new moeda();
$oBanco = new Banco();
$oTipot = new TipoTransferencia();
$oPag = new Pagamento();
$oCred = new Credito();
$oCliente = new Cliente();
$oCheque = new Cheque();
$oCarne = new Carne();
$oParticipante = new Participante();
$oParticipante->getById($_REQUEST['idParticipante']);
$tpl->ID_PARTICIPANTE_REP = $_REQUEST['idParticipante'];
$tpl->ID_TIPO = $_REQUEST['idTipo'];
$idMoedaEdita = 0;
$idBancoEdita = 0;
$idBandeiraEdita = 0;
$idTipoTransf = 0;
$idCredito = 0;
$tpl->CAMBIO_DOLLAR_REAL = 0;
$tpl->COD_AUTORIZACAO = "";
$tpl->DATA_COMPENSACAO = "";
$tpl->NUMERO_CHEQUE = "";
$tpl->CAMBIO_MOEDA_REAL = 0;

$tpl->NOME_EMISSOR = $oParticipante->cliente->nomeCompleto."-".$oParticipante->cliente->id;
if(isset($_REQUEST['idPagamento']) && strlen($_REQUEST['idPagamento']) > 0){
$oPag->getById($_REQUEST['idPagamento']);
$idMoedaEdita = $oPag->moeda->id;	
Example #10
0
 /**
  * Busca todas as despesas de um determinado m�s
  *
  * @param long $mes
  * @param long $ano
  * 
  * @return array
  */
 function busca_mes($mes, $ano, $id_estudio = FALSE)
 {
     $colecao = array();
     $timestamp_inicio = mktime(0, 0, 1, $mes, 1, $ano);
     $timestamp_fim = mktime(23, 59, 59, $mes + 1, 0, $ano);
     $data_inicio = date(FORMATO_DATA_MYSQL, $timestamp_inicio);
     $data_fim = date(FORMATO_DATA_MYSQL, $timestamp_fim);
     $this->db->select($this->get_table_name() . '.id,' . $this->get_fields());
     $this->db->from($this->get_table_name());
     $this->db->join('aluno', 'aluno.id = ' . $this->get_table_name() . '.id_aluno');
     if (FALSE !== $id_estudio) {
         $this->db->where('aluno.id_estudio', $id_estudio);
     }
     $this->db->where('data_pagamento >=', $data_inicio);
     $this->db->where('data_pagamento <=', $data_fim);
     $query = $this->db->get();
     if ($query->num_rows() > 0) {
         foreach ($query->result_array() as $row) {
             $pagamento = new Pagamento();
             $pagamento->populate($row);
             array_push($colecao, $pagamento);
         }
     }
     return $colecao;
 }
    </li>
	<li>
    <a href="participante.lista.php?idGrupo=' . $_REQUEST['idGrupo'] . '">Participantes</a> <span class="divider">/</span>
    </li>
    <li class="active">Pagamentos</li>
    </ul>';
}
//configura o grupo na pagina
$oGrupo = new Grupo();
$idGrupo = $oGrupo->md5_decrypt($_REQUEST['idGrupo']);
$oGrupo->getById($idGrupo);
$tpl->NOME_GRUPO = $oGrupo->nomePacote;
$tpl->ID_GRUPO_HASH = $_REQUEST['idGrupo'];
$tpl->ID_HASH = $_REQUEST['idParticipante'];
$tpl->CIFRAO_GRUPO = $oGrupo->moeda->cifrao;
$oP = new Pagamento();
$oA = new Abatimento();
$oParticipante = new Participante();
$idPartic = $oParticipante->md5_decrypt($_REQUEST['idParticipante']);
$oParticipante->getById($idPartic);
$rsPag = $oP->getRows(0, 999, array("id" => "asc"), array("participante" => " = " . $idPartic, "cancelado" => "=0"));
$tpl->NOME_PARTICIPANTE = $oParticipante->cliente->nomeCompleto;
$totalReal = 0;
$totalDollar = 0;
//$tpl->ID_PARTICIPANTE_HASH = $_REQUEST['idParticipante'];
foreach ($rsPag as $key => $pagamento) {
    $totalAbatMoedaGrupo = $oA->totalAbatimentos($pagamento->id);
    $totalAbatMoedaPagamento = $pagamento->CALCULA_MOEDA($totalAbatMoedaGrupo, $pagamento->participante->grupo->moeda->id);
    if ($pagamento->devolucao == 0) {
        $tpl->STATUS_ABAT = $totalAbatMoedaPagamento < $pagamento->valorPagamento ? 'status-alert' : 'status-ok';
    } else {
Example #12
0
 public static function saidaAcumulada($data)
 {
     $db = new DBAL();
     $valor = 0;
     if ($data != "") {
         if (sizeof($data) < "10") {
             $plusMonth = explode("-", $data)[0] . "-" . sprintf("%02d", explode("-", $data)[1] + 1);
             $qb = $GLOBALS['orm']->createQueryBuilder();
             $pagamentos = $qb->select('p')->from('Pagamento', 'p')->where("p.dtPagamento <= '{$plusMonth}'")->getQuery()->getResult();
         } else {
             $qb = $GLOBALS['orm']->createQueryBuilder();
             $pagamentos = $qb->select('p')->from('Pagamento', 'p')->where("p.dtPagamento <= '{$data}'")->getQuery()->getResult();
         }
         foreach ($pagamentos as $pagamento) {
             if ($pagamento->getPedido()->getTpPedido() == 'C') {
                 $valor += $pagamento->getVlPagamento();
             }
         }
     } else {
         $pagamentos = Pagamento::findAll();
         foreach ($pagamentos as $pagamento) {
             if ($pagamento->getPedido()->getTpPedido() == 'C') {
                 $valor += $pagamento->getVlPagamento();
             }
         }
     }
     return $valor;
 }
<?php

include "tupi.inicializar.php";
include "tupi.template.inicializar.php";
$codAcesso = 13;
include "tupi.seguranca.php";
$oMoeda = new Moeda();
$oPagamento = new Pagamento();
$idPagamento = $oPagamento->md5_decrypt($_REQUEST['idPagamento']);
$oPagamento->getById($idPagamento);
$nomePartic = $oPagamento->participante->cliente->nomeCompleto;
$nomeGrupo = $oPagamento->participante->grupo->nomePacote;
$idGrupo = $oPagamento->md5_encrypt($oPagamento->participante->grupo->id);
$idPartic = $oPagamento->md5_encrypt($oPagamento->participante->id);
$valorPagamento = $oPagamento->valorPagamento;
if (!isset($_REQUEST['ajax'])) {
    $tpl->BREADCRUMB = '    <ul class="breadcrumb">
    <li>
    <a href="home.php">Home</a> <span class="divider">/</span>
    </li>
    <li>
    <a href="grupos.andamento.php">Grupos</a> <span class="divider">/</span>
    </li>
	<li>
    <a href="participante.lista.php?idGrupo=' . $idGrupo . '">Participantes</a> <span class="divider">/</span>
    </li>
	<li>
    <a href="participante.pagamentos.php?idGrupo=' . $idGrupo . '&idParticipante=' . $idPartic . '">Pagamentos</a> <span class="divider">/</span>
    </li>
    <li class="active">Abatimentos</li>
    </ul>';
Example #14
0
 /**
  * Salva un ordine sul DB
  * @param $elenco array di articoli che fanno parte dell'ordine
  * @param $cliente id cliente che ha effettuato l'ordine
  * @param Pagamento $pay il metodo di ordine scelto dal cliente
  * @param float $subtotale il prezzo dell'ordine
  * @return boolean true se il salvataggio va a buon fine, false altrimenti
  */
 public function salvaOrdine($elenco, $cliente_id, Pagamento $pay, $subtotale)
 {
     $mysqli = Db::getInstance()->connectDb();
     if (!isset($mysqli)) {
         error_log("[salvaOrdine] impossibile inizializzare il database");
         $mysqli->close();
         return false;
     }
     $stmt = $mysqli->stmt_init();
     $stmt2 = $mysqli->stmt_init();
     $insert_ordine = "insert into ordini (id, data_creazione, subtotale, cliente_id) \n            values (default, NOW(), ?, ?)";
     $insert_articoli = 'insert into articoli values
         (default, ?, ?, ?, ?, ?)';
     //stmt tab ordini
     $stmt->prepare($insert_ordine);
     if (!$stmt) {
         error_log("[salvaOrdine] impossibile" . " inizializzare il prepared statement");
         $mysqli->close();
         return false;
     }
     //stmt tab articoli
     $stmt2->prepare($insert_articoli);
     if (!$stmt2) {
         error_log("[salvaOrdine] impossibile" . " inizializzare il prepared statement 2");
         $mysqli->close();
         return false;
     }
     //stmt tab ordini
     if (!$stmt->bind_param('di', floatval($subtotale), intval($cliente_id))) {
         error_log("[salvaOrdine] impossibile" . " effettuare il binding in input stmt");
         $mysqli->close();
         return false;
     }
     //var stmt tab articoli
     $articolo_size = '';
     $articolo_qty = 0;
     $articolo_prezzo = 0.0;
     $articolo_pizza_id = 0;
     $ordine_id = 0;
     //stmt tab articoli
     if (!$stmt2->bind_param('sidii', $articolo_size, $articolo_qty, $articolo_prezzo, $articolo_pizza_id, $ordine_id)) {
         error_log("[salvaOrdine] impossibile" . " effettuare il binding in input stmt2");
         $mysqli->close();
         return false;
     }
     // inizio transazione
     $mysqli->autocommit(false);
     //        echo 'attuale:' . $pay->getSaldo() . '<br>';
     if ($pay->getSaldo() >= $subtotale) {
         PagamentoFactory::instance()->aggiornaSaldoPagamento($pay, $pay->getSaldo() - $subtotale);
         //        echo 'nuovo:' . $pay->getSaldo() . '<br>';
     } else {
         $mysqli->rollback();
         $mysqli->close();
         return false;
     }
     //stmt tab ordini
     if (!$stmt->execute()) {
         error_log("[salvaOrdine] impossibile" . " eseguire lo statement");
         $mysqli->rollback();
         $mysqli->close();
         return false;
     }
     //stmt tab articoli
     foreach ($elenco as $articolo) {
         $articolo_size = $articolo->getSize();
         $articolo_qty = $articolo->getQty();
         $articolo_prezzo = $articolo->getPrezzoArticolo();
         $articolo_pizza_id = $articolo->getPizza()->getId();
         $ordine_id = $stmt->insert_id;
         if (!$stmt2->execute()) {
             error_log("[salvaOrdine] impossibile" . " eseguire lo statement 2");
             $mysqli->rollback();
             $mysqli->close();
             return false;
         }
     }
     // tutto ok, posso rendere persistente il salvataggio
     $mysqli->commit();
     $mysqli->autocommit(true);
     $mysqli->close();
     return true;
 }
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorioHorizontal";
include "tupi.template.inicializar.php";
$codAcesso = 37;
include "tupi.seguranca.php";
//titulo do relatorio
$tpl->TITULO = "Relatório de desistentes por período";
$tpl->DATA_RELATORIO = "Data/Hora:" . date("d/m/Y h:i:s");
//declara as classes
$om = new Moeda();
$oP = new Pagamento();
$oTP = new TipoPagamento();
$oTT = new TipoTransferencia();
$oG = new Grupo();
$oPartic = new Participante();
$oF = new FinalidadePagamento();
$oC = new Credito();
$oG->getById($oG->md5_decrypt($_REQUEST['idGrupo']));
$totalRecebDollar = 0;
$totalRecebReal = 0;
$totalDevolucaoDollar = 0;
$totalDevolucaoReal = 0;
$qtdParticipante = 0;
//recupera os participantes
$rsPartic = $oPartic->getRows(0, 999, array(), array("grupo" => "=" . $oG->id, "status" => "=" . $oPartic->STATUS_DESISTENTE()));
foreach ($rsPartic as $keyPart => $part) {
    $qtdParticipante++;
    $RecebDollar = 0;
    $RecebReal = 0;
<?php

include "tupi.inicializar.php";
$codAcesso = 13;
include "tupi.seguranca.php";
//classes
$oParticipante = new Participante();
$oPagamento = new Pagamento();
$oAbatimento = new Abatimento();
//inclusao de perfil
if (isset($_REQUEST['acao'])) {
    if ($_REQUEST['acao'] == "Incluir") {
        $oParticipante->incluir();
        header("Location:participante.lista.php?idGrupo=" . $_REQUEST['idGrupo']);
    }
    if ($_REQUEST['acao'] == "IncluirPorId") {
        $oParticipante->incluirPorId();
        header("Location:participante.lista.php?idGrupo=" . $_REQUEST['idGrupo']);
    }
    if ($_REQUEST['acao'] == "Cancelar") {
        $oParticipante->cancelar();
        header("Location:participante.lista.php?idGrupo=" . $_REQUEST['idGrupo']);
    }
    if ($_REQUEST['acao'] == "Excluir") {
        $oParticipante->excluir();
        header("Location:participante.lista.php?idGrupo=" . $_REQUEST['idGrupo']);
    }
    if ($_REQUEST['acao'] == "Editar") {
        $oParticipante->editar();
        header("Location:participante.lista.php?idGrupo=" . $_REQUEST['idGrupo']);
    }
Example #17
0
                            <td class="text-right"><?php 
echo toBRL(Pagamento::saidaDia(isset($_GET['d']) ? $_GET['d'] : ''));
?>
</td>
                        </tr>
                        <tr>
                            <td class="text-right"><strong>Total acumulado</strong></td>
                            <td class="text-right"><?php 
echo toBRL(Pagamento::entradaAcumulada(isset($_GET['d']) ? $_GET['d'] : ''));
?>
</td>
                            <td class="text-right"><?php 
echo toBRL(Pagamento::saidaAcumulada(isset($_GET['d']) ? $_GET['d'] : ''));
?>
</td>
                        </tr>
                        <tr>
                            <td class="text-right"><strong>Total em caixa</strong></td>
                            <td colspan="2" class="text-center"><?php 
echo toBRL(Pagamento::totalDia(isset($_GET['d']) ? $_GET['d'] : ''));
?>
</td>
                        </tr>
                    </tfoot>

                </table>

            </div>
        </div>
    </div>
</div>
Example #18
0
            $pedidos = $pessoa->getPedidos();
            foreach ($pedidos as $pedido) {
                if ($pedido->getTpPedido() == 'C') {
                    if ($pedido->getStPagamento() == 'PN') {
                        $pagamento = array("nrPagamento" => count($pedido->getPagamentos()) + 1, "dtPagamento" => date('Y-m-d', time()), "vlPagamento" => $pedido->getVlRestante(), "tpPagamento" => $_REQUEST['tp'], "idPedido" => $pedido->getIdPedido());
                        Pagamento::persistPagamento($pagamento);
                    }
                }
            }
            echo json_encode(true);
            break;
        case 'QuitarVendas':
            $pessoa = Pessoa::find($id);
            $pedidos = $pessoa->getPedidos();
            foreach ($pedidos as $pedido) {
                if ($pedido->getTpPedido() == 'V') {
                    if ($pedido->getStPagamento() == 'PN') {
                        $pagamento = array("nrPagamento" => count($pedido->getPagamentos()) + 1, "dtPagamento" => date('Y-m-d', time()), "vlPagamento" => $pedido->getVlRestante(), "tpPagamento" => $_REQUEST['tp'], "idPedido" => $pedido->getIdPedido());
                        Pagamento::persistPagamento($pagamento);
                    }
                }
            }
            echo json_encode(true);
            break;
        default:
            break;
            // default
    }
} catch (Exception $e) {
    echo json_encode(array('exception' => $e->getMessage(), 'trace' => $e->getTraceAsString()));
}
<?php

include "tupi.inicializar.php";
include "tupi.template.inicializar.php";
$codAcesso = 13;
include "tupi.seguranca.php";
$oMoeda = new Moeda();
$oPagamento = new Pagamento();
$oParticipante = new Participante();
$oGrupo = new Grupo();
$idPagamento = $oPagamento->md5_decrypt($_REQUEST['idPagamento']);
$oPagamento->getById($idPagamento);
$nomeGrupo = $oPagamento->participante->grupo->nomePacote;
$idGrupo = $oPagamento->md5_encrypt($oPagamento->participante->grupo->id);
$idParticHash = $oPagamento->md5_encrypt($oPagamento->participante->id);
$valorPagamento = $oPagamento->valorPagamento;
$idPartic = 0;
$idGrupo = 0;
$ano = 0;
if (!isset($_REQUEST['ajax'])) {
    $tpl->BREADCRUMB = '    <ul class="breadcrumb">
    <li>
    <a href="home.php">Home</a> <span class="divider">/</span>
    </li>
    <li>
    <a href="grupos.andamento.php">Grupos</a> <span class="divider">/</span>
    </li>
	<li>
    <a href="participante.lista.php?idGrupo=' . $idGrupo . '">Participantes</a> <span class="divider">/</span>
    </li>
	<li>
$om = new Moeda();
$oAbat = new Abatimento();
$ogrupo->getById($ogrupo->md5_decrypt($_REQUEST['idGrupo']));
$tpl->COD_GRUPO = str_pad($ogrupo->id, 7, "0", STR_PAD_LEFT);
$tpl->NOME_GRUPO = $ogrupo->nomePacote;
$tpl->VALOR_GRUPO = $ogrupo->money($ogrupo->getValorTotal(0), "atb");
$tpl->CIFRAO_GRUPO = $ogrupo->moeda->cifrao;
$tpl->MOEDA_GRUPO_PLURAL = $ogrupo->moeda->plural;
//pacote opcional
if ($ogrupo->possuiPacoteOpcional == 1) {
    $tpl->NOME_GRUPO_OPCIONAL = $ogrupo->nomePacoteOpcional;
    $tpl->VALOR_GRUPO_OPCIONAL = $ogrupo->money($ogrupo->getValorTotalOpcional(), "atb");
    $tpl->block("BLOCK_OPCIONAL");
}
//recupera pagamentos cartoes
$oPag = new Pagamento();
$oTipoPag = new TipoPagamento();
$rs = $oPag->getPagamentos($ogrupo->id, $oTipoPag->CARTAO());
$totalGeralPagoReal = 0;
foreach ($rs as $key => $p) {
    $totalReal = 0;
    $tpl->CODIGO = $p->codAutorizacao;
    $tpl->NUMERO_CARTAO = $p->numeroCartao;
    $tpl->VALOR_PARCELA = $oPag->money($p->valorParcela, "atb");
    $tpl->NOME_PARTICIPANTE = $p->participante->cliente->nomeCompleto;
    $tpl->VALOR_PAGO_REAL = $oPag->money($p->valorPagamento, "atb");
    $tpl->DATA = $oPag->convdata($p->dataPagamento, "mtn");
    $totalGeralPagoReal += $p->valorPagamento;
    $tpl->block("BLOCK_ITEM_LISTA");
}
$rs = $oPag->getPagamentos($ogrupo->id, $oTipoPag->DEBITO());
 /**
  * Aggiorna il saldo di un metodo di pagamento
  * @param $nuovo_saldo il saldo da aggiornare
  * @return int il numero di righe modificate
  */
 public function aggiornaSaldoPagamento(Pagamento $pay, $nuovo_saldo)
 {
     $floatVal = filter_var($nuovo_saldo, FILTER_VALIDATE_FLOAT, FILTER_NULL_ON_FAILURE);
     if (!isset($floatVal)) {
         return null;
     }
     $query = "update pagamenti set saldo = ? where id = ?";
     $mysqli = Db::getInstance()->connectDb();
     if (!isset($mysqli)) {
         error_log("[aggiornaSaldoPagamento] impossibile inizializzare il database");
         $mysqli->close();
         return 0;
     }
     $stmt = $mysqli->stmt_init();
     $stmt->prepare($query);
     if (!$stmt) {
         error_log("[aggiornaSaldoPagamento] impossibile" . " inizializzare il prepared statement");
         echo 'impossibile inizializzare il prepared statement';
         return 0;
     }
     if (!$stmt->bind_param('di', $floatVal, $pay->getId())) {
         error_log("[aggiornaSaldoPagamento] impossibile" . " effettuare il binding in input");
         echo 'impossibile effettuare il binding in input';
         return 0;
     }
     if (!$stmt->execute()) {
         error_log("[aggiornaSaldoPagamento] impossibile eseguire lo statement");
         echo 'impossibile eseguire lo statement';
         return 0;
     }
     $n = $stmt->affected_rows;
     $pay->setSaldo($floatVal);
     $stmt->close();
     $mysqli->close();
     return $n;
 }
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorio";
include "tupi.template.inicializar.php";
$codAcesso = 39;
include "tupi.seguranca.php";
//titulo do relatorio
$tpl->TITULO = "Relatório de Inscrições por Período";
$tpl->DATA_RELATORIO = "Data/Hora:" . date("d/m/Y h:i:s");
//declara as classes
$ol = new Participante();
$om = new Moeda();
$op = new Pagamento();
$dataRelatorio = $ol->convdata($_REQUEST['dataInicio'], "ntm");
$dataFimRelatorio = $ol->convdata($_REQUEST['dataFim'], "ntm");
$rsLogs = $ol->participantesPeriodo($dataRelatorio, $dataFimRelatorio);
$total = 0;
$totalReal = 0;
foreach ($rsLogs as $key => $log) {
    $rsPag = $op->primeiroPagamentoCliente($log->id);
    if (count($rsPag) > 0) {
        $pag = $rsPag[0];
        $tpl->PARTICIPANTE = $log->cliente->nomeCompleto;
        $tpl->DATA = $log->convdata($log->dataInscricao, "mtn");
        $tpl->GRUPO = $log->grupo->nomePacote;
        if ($log->grupo->moeda->id == $om->DOLLAR()) {
            if ($log->pacoteOpcional == 1) {
                $tpl->VALOR_DOLLAR = $log->grupo->moeda->cifrao . " " . $log->money($log->grupo->valorAdesao + $log->grupo->valorAdesaoOpcional, "atb");
                $tpl->VALOR_REAL = "R\$ " . $log->money(($log->grupo->valorAdesao + $log->grupo->valorAdesaoOpcional) * $pag->cotacaoReal, "atb");
                $total += $log->grupo->valorAdesao + $log->grupo->valorAdesaoOpcional;
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorio";
include "tupi.template.inicializar.php";
$codAcesso = 13;
include "tupi.seguranca.php";
$pag = new Pagamento();
$cheque = new Cheque();
$moeda = new Moeda();
$pag->getById($pag->md5_decrypt($_REQUEST['idPagamento']));
$cliente = $pag->participante->cliente;
$grupo = $pag->participante->grupo;
$moeda = $pag->moeda;
$oTipoP = new TipoPagamento();
if ($cliente->sexo == "F") {
    $tpl->ARTIGO = "a";
    $tpl->SENHOR = "Sra.";
} else {
    $tpl->ARTIGO = "o";
    $tpl->SENHOR = "Sr.";
}
$tpl->NUMERO = str_pad($pag->id, 6, "0", STR_PAD_LEFT);
$tpl->NOME_COMPLETO = $cliente->nomeCompleto;
$tpl->VALOR = $pag->money($pag->CALCULA_REAL(), "atb");
//$velhos = array("Reais", "REAIS", "REAL", "Real");
//$novos   = array($moeda->plural, strtoupper($moeda->plural), strtoupper($moeda->descricao),$moeda->descricao);
$extenso = $pag->extenso($pag->money($pag->CALCULA_REAL(), "atb"), true);
$tpl->VALOR_EXTENSO = $extenso;
$tpl->REFERENTE = $pag->obs;
$tpl->FINALIDADE = $pag->finalidade->descricao;
<?php

include "tupi.inicializar.php";
$codTemplate = "relatorioHorizontal";
include "tupi.template.inicializar.php";
$codAcesso = 38;
include "tupi.seguranca.php";
set_time_limit(0);
$oGrupo = new Grupo();
$oMoeda = new Moeda();
$oPagamento = new Pagamento();
$oAbatimento = new Abatimento();
$oTP = new TipoPagamento();
$oTT = new TipoTransferencia();
$oCheque = new Cheque();
$oGrupo->getById($oGrupo->md5_decrypt($_REQUEST['idGrupo']));
$tpl->COD_GRUPO = str_pad($oGrupo->id, 7, "0", STR_PAD_LEFT);
$tpl->NOME_GRUPO = $oGrupo->nomePacote;
$tpl->DATA_RELATORIO = "Data/Hora:" . date("d/m/Y h:i:s");
//recupera participantes aprovados
$opartic = new Participante();
$rs = $opartic->participantesGrupo($oGrupo->id);
$cont = 1;
foreach ($rs as $key => $p) {
    $possuiCheques = 0;
    $tpl->ID = $cont;
    $tpl->PARTICIPANTE = $p->cliente->nomeCompleto;
    $tpl->STATUS = $p->status->descricao;
    //calcula custo:
    $custo = $p->custoTotal;
    $cotCustpo = $oGrupo->cotacaoCusto == 0 ? 1 : $oGrupo->cotacaoCusto;
Example #25
0
 private function registraPagamento($valorPagamento, $idVenda)
 {
     $modelPagamento = new Pagamento();
     $modelPagamento->id_venda = $idVenda;
     $modelPagamento->valor = $valorPagamento;
     if (!$modelPagamento->save()) {
         throw new Exception("Não foi possível registrar o pagamento desta venda");
     }
     return $modelPagamento;
 }
    </li>
    <li>
    <a href="grupos.andamento.php">Grupos</a> <span class="divider">/</span>
    </li>
	<li>
    <a href="participante.lista.php?idGrupo=' . $_REQUEST['idGrupo'] . '">Participantes</a> <span class="divider">/</span>
    </li>
	<li>
    <a href="participante.pagamentos.php?idGrupo=' . $_REQUEST['idGrupo'] . '&idParticipante=' . $_REQUEST['idParticipante'] . '">Pagamentos</a> <span class="divider">/</span>
    </li>
    <li class="active">Edita Pagamento</li>
    </ul>';
}
//configura o grupo na pagina
$oGrupo = new Grupo();
$oPagamento = new Pagamento();
$idGrupo = $oGrupo->md5_decrypt($_REQUEST['idGrupo']);
$oGrupo->getById($idGrupo);
$tpl->NOME_GRUPO = $oGrupo->nomePacote;
$tpl->ID_GRUPO = $_REQUEST['idGrupo'];
$tpl->ID_PARTICIPANTE = $_REQUEST['idParticipante'];
$tpl->ID_PARTICIPANTE_REP = $oGrupo->md5_decrypt($_REQUEST['idParticipante']);
$oPartic = new Participante();
$oPartic->getById($oPartic->md5_decrypt($_REQUEST['idParticipante']));
$tpl->NOME_PARTICIPANTE = $oPartic->cliente->nomeCompleto;
$tpl->ACAO = 'IncluirPagamento';
$tpl->DEV = $_REQUEST['dev'];
$otp = new TipoPagamento();
$rs = $otp->getRows();
$ofin = new FinalidadePagamento();
$rsf = $ofin->getRows();
Example #27
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/PagamentoDAO.php';
include_once '../Pagamento.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(7, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$pagamento = new Pagamento();
$DAO = new PagamentoDAO();
//Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $pagamento->setTaxa($_POST['taxa']);
    $pagamento->setCmat_real($_POST['cmat_real']);
    $pagamento->setVetec_real($_POST['Vetec_real']);
    $pagamento->setCmat_iene($_POST['cmat_iene']);
    $pagamento->setVetec_iene($_POST['Vetec_iene']);
    $pagamento->setCmat_fiscal($_POST['cmat_fiscal']);
    $pagamento->setVetec_fiscal($_POST['Vetec_fiscal']);
    $pagamento->setCmat_pgmt($_POST['cmat_pgmt']);
    $pagamento->setVetec_pgmt($_POST['Vetec_pgmt']);
    $pagamento->setChodai_iene($_POST['chodai_iene']);
    $pagamento->setYec_iene($_POST['yec_iene']);
    $pagamento->setChodai_invoice($_POST['chodai_invoice']);
    $pagamento->setYec_invoice($_POST['yec_invoice']);
    $resultado = $DAO->Gravar($pagamento);
    if ($resultado != 0) {
        echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
Example #28
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/PagamentoDAO.php';
include_once '../Pagamento.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(76, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$pagamento = new Pagamento();
$DAO = new PagamentoDAO();
$pagamento->setId(limpaTexto($_GET['id']));
// Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') {
    $pagamento->setId($_POST['id']);
    $pagamento->setTaxa($_POST['taxa']);
    $pagamento->setCmat_real($_POST['cmat_real']);
    $pagamento->setVetec_real($_POST['Vetec_real']);
    $pagamento->setCmat_iene($_POST['cmat_iene']);
    $pagamento->setVetec_iene($_POST['Vetec_iene']);
    $pagamento->setCmat_fiscal($_POST['cmat_fiscal']);
    $pagamento->setVetec_fiscal($_POST['Vetec_fiscal']);
    $pagamento->setCmat_pgmt($_POST['cmat_pgmt']);
    $pagamento->setVetec_pgmt($_POST['Vetec_pgmt']);
    $pagamento->setChodai_iene($_POST['chodai_iene']);
    $pagamento->setYec_iene($_POST['yec_iene']);
    $pagamento->setChodai_invoice($_POST['chodai_invoice']);
    $pagamento->setYec_invoice($_POST['yec_invoice']);
    $Cmat_real = $pagamento->getCmat_real();