diff --git a/vendor/print/financial_movements/financial_movements_datagrid.php b/vendor/print/financial_movements/financial_movements_datagrid.php
index 52f2494..b9513f0 100644
--- a/vendor/print/financial_movements/financial_movements_datagrid.php
+++ b/vendor/print/financial_movements/financial_movements_datagrid.php
@@ -142,7 +142,7 @@ try{
$header .= '
PAGAMENTO | ';
$header .= ' DESCRIÇÃO | ';
$header .= ' CNS | ';
- $header .= ' Observação | ';
+ $header .= ' OBSERVAÇÃO | ';
$header .= ' VALOR R$ | ';
$header .= ' MULTA R$ | ';
$header .= ' TAXAS R$ | ';
@@ -193,7 +193,7 @@ try{
$body .= ' '.$Result->cns.' | ';
$body .= ' '.( isset($Result->note) ? $Result->note : '' ).' | ';
$body .= ' '.number_format($Result->movement_value, 2, ',', '.').' | ';
- $body .= ' '.( isset($Result->movement_value_paid) ? number_format(($Result->movement_value_paid-$Result->movement_value), 2, ',', '.') : '').' | ';
+ $body .= ' - '.( isset($Result->movement_value_paid) ? number_format(($Result->movement_value_paid-$Result->movement_value), 2, ',', '.') : '').' | ';
$body .= ' '.( isset($Result->movement_value_registration_tariff) ? number_format($Result->movement_value_registration_tariff+$Result->movement_value_settlement_tariff, 2, ',', '.') : '').' | ';
$body .= ' '.( isset($Result->movement_value_paid) ? number_format(($Result->movement_value_paid+($Result->movement_value_registration_tariff+$Result->movement_value_settlement_tariff)), 2, ',', '.') : number_format($Result->movement_value, 2, ',', '.')).' | ';
$body .= ' ';
diff --git a/vendor/print/financial_movements/financial_movements_datagrid_plan.php b/vendor/print/financial_movements/financial_movements_datagrid_plan.php
new file mode 100644
index 0000000..49007b9
--- /dev/null
+++ b/vendor/print/financial_movements/financial_movements_datagrid_plan.php
@@ -0,0 +1,265 @@
+verifyToken()){
+
+ /** Instânciamento de classes */
+ $FinancialMovements = new FinancialMovements();
+ $FinancialMovementsValidate = new FinancialMovementsValidate();
+
+ /** Parametros de filtro por company */
+ $companyId = isset($_SESSION['USERSCOMPANYID']) ? (int)$_SESSION['USERSCOMPANYID'] : 0;
+
+ /** Parametros de entrada */
+ $search = isset($_POST['search']) ? (string)filter_input(INPUT_POST,'search', FILTER_SANITIZE_SPECIAL_CHARS) : '';
+ $type = isset($_POST['type']) ? (string)filter_input(INPUT_POST,'type', FILTER_SANITIZE_SPECIAL_CHARS) : '';
+ $status = isset($_POST['status']) ? (int)filter_input(INPUT_POST,'status', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
+ $dateStart = isset($_POST['dateStart']) ? (string)filter_input(INPUT_POST,'dateStart', FILTER_SANITIZE_SPECIAL_CHARS) : '';
+ $dateEnd = isset($_POST['dateEnd']) ? (string)filter_input(INPUT_POST,'dateEnd', FILTER_SANITIZE_SPECIAL_CHARS) : '';
+ $printType = isset($_POST['printType']) ? (int)filter_input(INPUT_POST,'printType', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
+ $orientation = null;
+ $dir = 'temp/';
+
+ /** Controles */
+ $i=0;
+ $total = '0.00';
+ $totalGeneral = '0.00';
+ $totalReceivables = '0.00';
+ $totalOutputs = '0.00';
+ $totalEntries = '0.00';
+ $qtdeOutputs = '0.00';
+ $qtdeEntries = '0.00';
+ $totalOutputsPaid = '0.00';
+ $totalEntriesPaid = '0.00';
+ $header = null;
+ $totalFees = '0.00';
+
+ /** Verifica se existe consulta informada para validar os campos */
+
+ /** Verifica se a consulta foi informada */
+ if( !empty($search) ){
+
+ /** Valida os campos de entrada */
+ $FinancialMovementsValidate->setSearch($search);
+ }
+
+ /** Verifica se o tipo da consulta foi informada */
+ if( !empty($type) ){
+
+ $FinancialMovementsValidate->setType($type);
+ }
+
+ /** Verifica se o status da consulta foi informada */
+ if( $status > 0 ){
+
+ $FinancialMovementsValidate->setStatusSearch($status);
+ }
+
+ /** Verifica se a data inicial da consulta foi informada */
+ if( !empty($dateStart) ){
+
+ $FinancialMovementsValidate->setDateStart($dateStart);
+ }
+
+ /** Verifica se a data final da consulta foi informada */
+ if( !empty($dateEnd) ){
+
+ $FinancialMovementsValidate->setDateEnd($dateEnd);
+ }
+
+ /** Verifico a existência de erros */
+ if (!empty($FinancialMovementsValidate->getErrors())) {
+
+ /** Mensagem de erro */
+ throw new Exception($FinancialMovementsValidate->getErrors(), 0);
+
+ } else {
+
+ /** Consulta a quantidade de registros */
+ $NumberRecords = $FinancialMovements->Count($companyId,
+ $FinancialMovementsValidate->getSearch(),
+ $FinancialMovementsValidate->getType(),
+ $FinancialMovementsValidate->getStatusSearch(),
+ $FinancialMovementsValidate->getDateStart(),
+ $FinancialMovementsValidate->getDateEnd())->qtde;
+
+ /** Verifico a quantidade de registros localizados */
+ if ($NumberRecords > 0){
+
+ /** Aumenta o uso de memória */
+ ini_set('memory_limit','512M');
+
+
+ /**Carrega a biblioteca par agerar o arquivo*/
+ chdir('library/Excel/phpxls');
+ require_once 'Writer.php';
+ chdir('..');
+
+ /**Instancia da classe*/
+ $workbook = new Spreadsheet_Excel_Writer(date("Y-m-d").'-'.rand(999,99999).'.xls');
+
+ /**Defino o header da planilha*/
+ $header =& $workbook->addFormat();
+ $header->setBottom(2);//thick
+ $header->setBold();
+ $header->setBgColor('black');
+ $header->setFgColor(22);
+ $header->setColor('black');
+ $header->setFontFamily('Arial');
+ $header->setSize(8);
+ $header->setAlign('center');
+
+ //Criação da página
+ $worksheet =& $workbook->addWorksheet("Lista");
+
+ //Defino o body da planilha
+ $body =& $workbook->addFormat();
+ $body->setColor('black');
+ $body->setFontFamily('Arial');
+ $body->setSize(8);
+
+ //Definições das colunas
+ $worksheet->setColumn(0,0,30);//Coluna inicial, coluna final, largura
+ $worksheet->setColumn(1,1,30);
+ $worksheet->setColumn(2,2,5);
+ $worksheet->setColumn(3,3,10);
+ $worksheet->setColumn(4,5,12);
+
+ //Escrevendo o header da planilha
+ $worksheet->write(0, 0, "REFERÊNCIA", $header);//Linha, coluna, label, parametros
+ $worksheet->write(0, 1, "VENCIMENTO", $header);
+ $worksheet->write(0, 2, "PAGAMENTO", $header);
+ $worksheet->write(0, 3, "DESCRIÇÃO", $header);
+ $worksheet->write(0, 4, "CNS", $header);
+ $worksheet->write(0, 4, "OBSERVAÇÃO", $header);
+ $worksheet->write(0, 4, "VALOR R$", $header);
+ $worksheet->write(0, 4, "MULTA R$", $header);
+ $worksheet->write(0, 4, "TAXAS R$", $header);
+ $worksheet->write(0, 4, "TOTAL R$", $header);
+
+ $line=1;//Linha inicial
+ $col=0;//Coluna inicial
+
+
+
+ /** Consulta as movimentações cadastradas*/
+ $FinancialMovementsResult = $FinancialMovements->All($companyId, 0, 0,
+ $FinancialMovementsValidate->getSearch(),
+ $FinancialMovementsValidate->getType(),
+ $FinancialMovementsValidate->getStatusSearch(),
+ $FinancialMovementsValidate->getDateStart(),
+ $FinancialMovementsValidate->getDateEnd());
+
+ foreach($FinancialMovementsResult as $FinancialMovementsKey => $Result){
+
+
+ /** Calcula o total de taxas */
+ $totalFees += $Result->movement_value_registration_tariff+$Result->movement_value_settlement_tariff;
+
+
+ $body .= ' ';
+ $body .= ' | '.$Result->movement_reference.' | ';
+ $body .= ' '.date('d/m/Y', strtotime($Result->movement_date_scheduled)).' | ';
+ $body .= ' '.(isset($Result->movement_date_paid) ? date('d/m/Y', strtotime($Result->movement_date_paid)) : ($Main->CheckDay($Result->movement_date_scheduled) > 1 ? $Main->diffDate($Result->movement_date_scheduled, date('Y-m-d')).' dia(s) de atraso' : '')).' | ';
+ $body .= ' '.$Result->description.' | ';
+ $body .= ' '.$Result->cns.' | ';
+ $body .= ' '.( isset($Result->note) ? $Result->note : '' ).' | ';
+ $body .= ' '.number_format($Result->movement_value, 2, ',', '.').' | ';
+ $body .= ' '.( isset($Result->movement_value_paid) ? number_format(($Result->movement_value_paid-$Result->movement_value), 2, ',', '.') : '').' | ';
+ $body .= ' '.( isset($Result->movement_value_registration_tariff) ? number_format($Result->movement_value_registration_tariff+$Result->movement_value_settlement_tariff, 2, ',', '.') : '').' | ';
+ $body .= ' '.( isset($Result->movement_value_paid) ? number_format(($Result->movement_value_paid+($Result->movement_value_registration_tariff+$Result->movement_value_settlement_tariff)), 2, ',', '.') : number_format($Result->movement_value, 2, ',', '.')).' | ';
+ $body .= '
';
+ $i++;
+
+ /** Contabiliza o total geral */
+ $totalGeneral += isset($Result->movement_value_paid) ? $Result->movement_value_paid : $Result->movement_value;
+ }
+
+ $body .= ' ';
+ $body .= '';
+
+ $body .= '
';
+ $body .= 'Total R$ '.number_format($totalGeneral, 2, ',', '.').'
';
+ $body .= 'Total Taxas R$ '.number_format($totalFees, 2, ',', '.').'
';
+ $body .= 'Total Geral R$ '.number_format(($totalGeneral-$totalFees), 2, ',', '.').'
';
+
+ /** Acrescenta os dados ao corpo do relatório */
+ $mpdf->WriteHTML($body);
+
+ /** Nome que será dado ao relatório */
+ $nameFile = 'IMPRESSAO-RELATORIO-MOVIMENTACAO-FINANCEIRA-'. date('d-m-Y-H-i-s').'.pdf';
+
+ /** Salva o relatório em uma pasta temporária */
+ $mpdf->Output($dir.$nameFile);
+
+ /** Verifica se o arquivo foi gerado com sucesso */
+ if(is_file($dir.$nameFile)){
+
+ /** Se não houver erros
+ * envio o relatório para a tela
+ */
+ $result = [
+
+ 'cod' => 98,
+ 'title' => 'Visualizando o arquivo do boleto',
+ 'file' => $dir.$nameFile
+
+ ];
+
+ /** Envio **/
+ echo json_encode($result);
+
+ /** Paro o procedimento **/
+ exit;
+
+ } else {
+
+ /** Informo */
+ throw new InvalidArgumentException('Não foi possivel gerar o relatório', 0);
+ }
+
+ } else {
+
+ /** Informo */
+ throw new InvalidArgumentException('Não há registros a serem listados', 0);
+ }
+
+ }
+
+ /** Caso o token de acesso seja inválido, informo */
+ }else{
+
+ /** Informa que o usuário precisa efetuar autenticação junto ao sistema */
+ $authenticate = true;
+
+ /** Informo */
+ throw new InvalidArgumentException('Sua sessão expirou é necessário efetuar nova autenticação junto ao sistema', 0);
+ }
+
+}catch(Exception $exception){
+
+ /** Preparo o formulario para retorno **/
+ $result = [
+
+ 'cod' => 0,
+ 'message' => ''.$exception->getMessage().'
',
+ 'title' => 'Atenção',
+ 'type' => 'exception',
+ 'authenticate' => $authenticate
+
+ ];
+
+ /** Envio **/
+ echo json_encode($result);
+
+ /** Paro o procedimento **/
+ exit;
+}
\ No newline at end of file