$tpl->ID = $_REQUEST['idPagamento']; } switch($_REQUEST['idTipo']){ case $oTipoP->DINHEIRO() : $rsm = $oMoeda->getRows(); foreach($rsm as $key => $row){ $tpl->ID_MOEDA = $row->id; $tpl->LABEL_MOEDA = $row->descricao; if( $idMoedaEdita == $row->id) $tpl->SELECTED_MOEDA = 'selected="selected"'; $tpl->block("BLOCK_MOEDA"); $tpl->clear("SELECTED_MOEDA"); } $tpl->CAMBIO_MOEDA_REAL = $oPag->money($oPag->cotacaoMoedaReal,"atb"); $tpl->CAMBIO_DOLLAR_REAL = $oPag->money($oPag->cotacaoReal,"atb"); $tpl->VALOR_PAGAMENTO = $oPag->money($oPag->valorPagamento,"atb"); $tpl->block('BLOCK_PG_DINHEIRO'); break; case $oTipoP->CARTAO() : $tpl->COD_AUTORIZACAO = $oPag->codAutorizacao; $tpl->VALOR_PARCELA = $oPag->money($oPag->valorParcela,"atb"); $tpl->NUMERO_CARTAO = $oPag->numeroCartao; $tpl->CAMBIO_DOLLAR_REAL = $oPag->money($oPag->cotacaoReal,"atb"); $tpl->VALOR_PAGAMENTO = $oPag->money($oPag->valorPagamento,"atb"); if($oPag->bandeira != null) $idBandeiraEdita = $oPag->bandeira->id; $tpl->PARCELA_CARTAO = $oPag->parcela; $oband = new BandeiraCartao(); $rs = $oband->getRows(0,999,array(),array());
$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; $tpl->NOME_GRUPO = $grupo->nomePacote; $tpl->VALOR_CAMBIO = $pag->money($pag->cotacaoReal, "atb"); $tpl->FORMA_PAGAMENTO = $pag->tipo->descricao; if ($pag->tipo->id == $oTipoP->CHEQUE()) { $rsc = $cheque->getRows(0, 999, array(), array("pagamento" => " = " . $pag->id)); foreach ($rsc as $key => $cheque) { $tpl->EMISSOR = $cheque->emissor->nomeCompleto; $tpl->BANCO = $pag->banco->nome; $tpl->NR_CHEQUE = $cheque->numeroCheque;
$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 { $tpl->STATUS_ABAT = 'status-ok'; } $tpl->ID_PAGAMENTO_HASH = $oP->md5_encrypt($pagamento->id); $tpl->DEV_PAG = $pagamento->devolucao; $tpl->TIPO = $pagamento->tipo->descricao; $tpl->MOEDA = $pagamento->moeda->descricao; $tpl->MOEDA_CIFRAO = $pagamento->moeda->cifrao; $tpl->DATA = $oP->convdata($pagamento->dataPagamento, "mtn"); if ($pagamento->devolucao == 0) { $tpl->TRANZACAO = 'Crédito'; $tpl->VALOR = $oP->money($pagamento->valorPagamento, "atb"); $tpl->VALOR_DOLLAR = $oP->money($pagamento->CALCULA_DOLLAR(), "atb"); $totalDollar += $pagamento->CALCULA_DOLLAR(); $totalReal += $pagamento->CALCULA_REAL(); } else { $tpl->TRANZACAO = 'Débito'; $tpl->VALOR = $oP->money(-$pagamento->valorPagamento, "atb"); $tpl->VALOR_DOLLAR = $oP->money(-$pagamento->CALCULA_DOLLAR(), "atb"); $totalDollar -= $pagamento->CALCULA_DOLLAR(); $totalReal -= $pagamento->CALCULA_REAL(); } $tpl->CAMBIO = ($pagamento->cotacaoMoedaReal != 0 ? $pagamento->cotacaoMoedaReal . " - " : "") . $oP->money($pagamento->cotacaoReal, "atb"); if ($pagamento->obs == "Cancelamento de Inscrição - Multa Recisória") { $tpl->block("BLOCK_MULTA"); } else { $tpl->block("BLOCK_ACTIONS");
</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=' . $idParticHash . '">Pagamentos</a> <span class="divider">/</span> </li> <li> <a href="participante.abatimentos.php?idPagamento=' . $_REQUEST['idPagamento'] . '">Abatimentos</a> <span class="divider">/</span> </li> <li class="active">Editar Abatimento</li> </ul>'; } $tpl->NOME_GRUPO = $nomeGrupo; $tpl->MOEDA_GRUPO = $oPagamento->participante->grupo->moeda->descricao; $tpl->VALOR_TOTAL_PAG = $oPagamento->moeda->cifrao . " " . $oPagamento->money($valorPagamento, "atb"); $tpl->MOEDA_PAG = $oPagamento->moeda->descricao; //$tpl->CIFRAO_PAG = $oPagamento->moeda->cifrao; $tpl->ID_PAGAMENTO_HASH = $_REQUEST['idPagamento']; $tpl->ACAO = 'IncluirAbatimento'; //carrega dados do pagamento if (isset($_REQUEST['idAbatimento'])) { $oAbat = new Abatimento(); $oAbat->getById($oAbat->md5_decrypt($_REQUEST['idAbatimento'])); $tpl->ACAO = 'AlterarAbatimento'; $idPartic = $oAbat->participante->id; $idGrupo = $oAbat->participante->grupo->id; $ano = $oAbat->participante->grupo->ano; $tpl->VALOR_ABATIMENTO = $oAbat->money($oAbat->valor, "atb"); $tpl->ID = $oAbat->id; $rsPartic = $oParticipante->getRows(0, 999, array("id" => "asc"), array("grupo" => " = " . $idGrupo));
//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()); 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");
$rsPgt = $oP->getRows(0, 999, array(), array("participante" => "=" . $part->id, "cancelado" => "=0", "finalidade" => "=" . $oF->CANCELAMENTO())); foreach ($rsPgt as $keyPag => $p) { $CanceladoDollar += $p->CALCULA_DOLLAR(); $CanceladoReal += $p->CALCULA_REAL(); } //recupera o credito deixado para o cliente pelo cancelamento $rsCred = $oC->getRows(0, 999, array(), array("participante" => "=" . $part->id)); foreach ($rsCred as $keyCred => $cred) { $CreditoDollar += $cred->CALCULA_DOLLAR(); $CreditoReal += $cred->CALCULA_REAL(); echo $CreditoDollar . "credito dollar"; echo $CreditoReal . "credito real"; } $tpl->GRUPO = $oG->nomePacote; $tpl->PARTICIPANTE = $part->cliente->nomeCompleto; $tpl->RECEBIMENTO_DOLLAR = $oP->money($RecebDollar, "atb"); $tpl->RECEBIMENTO_REAL = $oP->money($RecebReal, "atb"); $tpl->DEVOLUCAO_DOLLAR = $oP->money($RecebDollar - ($CanceladoDollar + $CreditoDollar), "atb"); $tpl->DEVOLUCAO_REAL = $oP->money($RecebReal - ($CanceladoReal + $CreditoReal), "atb"); $tpl->block("BLOCK_ITEM_LISTA"); //soma os totalizadores $totalRecebDollar += $RecebDollar; $totalRecebReal += $RecebReal; $totalDevolucaoDollar += $RecebDollar - ($CanceladoDollar + $CreditoDollar); $totalDevolucaoReal += $RecebReal - ($CanceladoReal + $CreditoReal); } //fim do loop de participantes $tpl->TOTAL_PARTICIPANTE = $qtdParticipante; $tpl->TOTAL_R_DOLLAR = $om->money($totalRecebDollar, "atb"); $tpl->TOTAL_R_REAL = $om->money($totalRecebReal, "atb"); $tpl->TOTAL_DEVOLUCAO_DOLLAR = $om->money($totalDevolucaoDollar, "atb");