break; case $oTT->TED(): $valorTEDd += @$p->CALCULA_DOLLAR(); $valorTED += @$p->CALCULA_REAL(); break; case $oTT->DOC(): $valorDOCd += @$p->CALCULA_DOLLAR(); $valorDOC += @$p->CALCULA_REAL(); break; } break; } } $tpl->DATA_INICIO = $oP->convdata($dataRelatorio, "mtn"); $tpl->DATA_FIM = $oP->convdata($dataFimRelatorio, "mtn"); $tpl->VALOR_ESPECIE_DOLLAR = $om->money($valorEspecied, "atb"); $tpl->VALOR_ESPECIE_REAL = $om->money($valorEspecie, "atb"); $tpl->VALOR_CHEQUE_DOLLAR = $om->money($valorChequed, "atb"); $tpl->VALOR_CHEQUE_REAL = $om->money($valorCheque, "atb"); $tpl->VALOR_CARTAO_DOLLAR = $om->money($valorCartaod, "atb"); $tpl->VALOR_CARTAO_REAL = $om->money($valorCartao, "atb"); $tpl->VALOR_DEBITO_DOLLAR = $om->money($valorDebitod, "atb"); $tpl->VALOR_DEBITO_REAL = $om->money($valorDebito, "atb"); $tpl->VALOR_TED_DOLLAR = $om->money($valorTEDd, "atb"); $tpl->VALOR_TED_REAL = $om->money($valorTED, "atb"); $tpl->VALOR_DOC_DOLLAR = $om->money($valorDOCd, "atb"); $tpl->VALOR_DOC_REAL = $om->money($valorDOC, "atb"); $tpl->VALOR_DEPOSITO_DOLLAR = $om->money($valorDepositod, "atb"); $tpl->VALOR_DEPOSITO_REAL = $om->money($valorDeposito, "atb"); $tpl->VALOR_TRANSFERENCIA_DOLLAR = $om->money($valorTransfd, "atb"); $tpl->VALOR_TRANSFERENCIA_REAL = $om->money($valorTransf, "atb");
$cont = 1; $totalGeralPagoReal = 0; $totalGeralPagoDollar = 0; $totalGeralPendente = 0; foreach ($rs as $key => $p) { $totalDollar = 0; $totalReal = 0; $tpl->ID = $cont; $tpl->NOME_PARTICIPANTE = $p->cliente->nomeCompleto; $tpl->STATUS = $p->status->descricao; $rsabats = $oAbat->getRows(0, 999, array(), array("participante" => "=" . $p->id)); foreach ($rsabats as $keyA => $abat) { $totalDollar += $abat->getValorDollar(); $totalReal += $abat->getValorReal(); } $tpl->VALOR_PAGO_REAL = $om->money($totalReal, "atb"); $tpl->VALOR_PAGO_DOLLAR = $om->money($totalDollar, "atb"); $totalGeralPagoReal += $totalReal; $totalGeralPagoDollar += $totalDollar; if ($ogrupo->moeda->id == $om->DOLLAR()) { $tpl->VALOR_PENDENTE = $om->money($p->valorTotal - $totalDollar, "atb"); $totalGeralPendente += $p->valorTotal - $totalDollar; $tpl->block("BLOCK_GRUPO_DOLLAR"); } else { $tpl->VALOR_PENDENTE = $om->money($p->valorTotal - $totalReal, "atb"); $totalGeralPendente += $p->valorTotal - $totalReal; } $tpl->block("BLOCK_ITEM_LISTA"); $cont++; } if ($ogrupo->moeda->id == $om->DOLLAR()) {
$valorDeposito += $p->CALCULA_REAL(); break; case $oTT->TED(): $valorTED += $p->CALCULA_REAL(); break; case $oTT->DOC(): $valorDOC += $p->CALCULA_REAL(); break; } break; } } //fim do loop de pagamentos } //fim do loop de participantes $tpl->CUSTO = $om->money($custoDollar, "atb"); $tpl->RECEBIMENTOS_DOLLAR = $om->money($recebimentoDollar + $valorChequed, "atb"); $tpl->RECEBIMENTOS_REAL = $om->money($recebimentoReal + $valorCheque, "atb"); $tpl->VALOR_CHEQUE = $om->money($valorCheque, "atb"); $tpl->VALOR_ESPECIE = $om->money($valorEspecie, "atb"); $tpl->VALOR_CARTAO = $om->money($valorCartao, "atb"); $tpl->VALOR_DEBITO = $om->money($valorDebito, "atb"); $tpl->VALOR_CREDITO = $om->money($valorCreditoCliente, "atb"); $tpl->VALOR_DEPOSITO = $om->money($valorDeposito, "atb"); $tpl->VALOR_TRANSFERENCIA = $om->money($valorTransf, "atb"); $tpl->VALOR_TED = $om->money($valorTED, "atb"); $tpl->VALOR_DOC = $om->money($valorDOC, "atb"); $custoDollarTotal += $custoDollar; $recebimentoDollarTotal += $recebimentoDollar + $valorChequed; $recebimentoRealTotal += $recebimentoReal + $valorCheque; $valorEspecieTotal += $valorEspecie;
} //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"); $totalGeralPagoReal += $p->valorPagamento; $tpl->block("BLOCK_ITEM_LISTA"); } $tpl->TOTAL_VALOR_PAGO_REAL = $om->money($totalGeralPagoReal, "atb"); include "tupi.template.finalizar.php";
$tpl->ID = $cont; $tpl->PARTICIPANTE = $p->cliente->nomeCompleto; $tpl->STATUS = $p->status->descricao; //calcula custo: $custo = $p->custoTotal; if ($oGrupo->moeda->id == $oMoeda->DOLLAR()) { $custoDollar = $custo; $custoReal = $custo * $oGrupo->cotacaoCusto; } else { $custoDollar = $custo / $oGrupo->cotacaoCusto; $custoReal = $custo; } $recebimentosDollar = $p->recuperaValorTodosAbatimentos($oMoeda->DOLLAR()); $recebimentosReal = $p->recuperaValorTodosAbatimentos($oMoeda->REAL()); //alimenta a primeira linha do relatorio $tpl->CAMBIO_CUSTO = $oMoeda->money($oGrupo->cotacaoCusto, "atb"); $tpl->CUSTO_DOLLAR = $oMoeda->money($custoDollar, "atb"); $tpl->CUSTO_REAL = $oMoeda->money($custoReal, "atb"); $tpl->RECEBIMENTOS_DOLLAR = $oMoeda->money($recebimentosDollar, "atb"); $tpl->RECEBIMENTOS_REAL = $oMoeda->money($recebimentosReal, "atb"); //SOMATORIOS DE VALORES $TOTAL_RECEBIMENTO_DOLLAR += $recebimentosDollar; $TOTAL_RECEBIMENTO_REAL += $recebimentosReal; $TOTAL_CUSTO_DOLLAR += $custoDollar; $TOTAL_CUSTO_REAL += $custoReal; //busca os pagamentos ativos do participante $rsAbat = $oAbatimento->getRows(0, 999, array(), array("participante" => "=" . $p->id)); foreach ($rsAbat as $keyAbat => $abat) { $pag = $abat->pagamento; $tipoPag = $pag->tipo->descricao; //somatorios dos valores
} //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"); $tpl->TOTAL_DEVOLUCAO_REAL = $om->money($totalDevolucaoReal, "atb"); //$tpl->DATA_ATUAL = date("d/m/Y"); $tpl->NOME_GRUPO = $oG->nomePacote; include "tupi.template.finalizar.php";
case $oTT->TRANSFERENCIA(): $TOTAL_TRANSF += $abat->getValorReal(); break; case $oTT->DEPOSITO(): $TOTAL_DEPOSITO += $abat->getValorReal(); break; case $oTT->TED(): $TOTAL_TED += $abat->getValorReal(); break; case $oTT->DOC(): $TOTAL_DOC += $abat->getValorReal(); break; } break; } $tpl->VALOR_ABAT_REAL = $oMoeda->money($abat->getValorReal(), "atb"); $tpl->VALOR_ABAT_DOLLAR = $oMoeda->money($abat->getValorDollar(), "atb"); $totalAbatParticipanteReal += $abat->getValorReal(); $totalAbatParticipanteDollar += $abat->getValorDollar(); if ($oPagamento->devolucao == 0) { $tpl->PAG_TRANSACAO = 'Crédito'; } else { $tpl->PAG_TRANSACAO = 'Débito'; } $tpl->N_PAG = $contPag; $tpl->PAG_PARTICIPANTE = $oPagamento->participante->cliente->nomeCompleto; $tpl->GRUPO = $oPagamento->participante->grupo->nomePacote; $tpl->TIPO = $oPagamento->tipo->descricao; $tpl->DATA_PAG = $oMoeda->convdata($oPagamento->dataPagamento, "mtn"); $tpl->MODEA = $oPagamento->moeda->descricao; $tpl->VALOR_REAL = $oMoeda->money($oPagamento->devolucao == 0 ? $oPagamento->CALCULA_REAL() : -$oPagamento->CALCULA_REAL(), "atb");