示例#1
0
$nivelAutorizacao = GetAuthorizationLevel($dataConnector->mysqlConnection, $functionalities["gerenciamentoLeituras"]);
if ($nivelAutorizacao <= 1) {
    DisplayNotAuthorizedWarning();
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$readingDAO = new ReadingDAO($dataConnector->mysqlConnection);
$readingDAO->showErrors = 1;
$counterDAO = new CounterDAO($dataConnector->mysqlConnection);
$counterDAO->showErrors = 1;
$equipmentDAO = new EquipmentDAO($dataConnector->sqlserverConnection);
$equipmentDAO->showErrors = 1;
$equipment = $equipmentDAO->RetrieveRecord($equipmentCode);
$capacity = $equipment->capacity;
$serialNumber = $equipment->manufacturerSN . " ( " . $equipment->internalSN . " ) ";
$clientName = new Text(BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $equipment->customer));
$id = 0;
$reading = new ReadingDTO();
if (isset($_REQUEST["id"]) && $_REQUEST["id"] != 0) {
    $id = $_REQUEST["id"];
    $reading = $readingDAO->RetrieveRecord($id);
}
?>

    <h1>Administração - Leitura - <?php 
echo $serialNumber;
?>
</h1><br/>
    <h1><?php 
echo str_pad('_', 52, '_', STR_PAD_LEFT);
?>
示例#2
0
        <br/>
        <a href="<?php 
echo $root . '/logout.php';
?>
" >
            Sair
        </a>
    </div>

    <!--  MENU LATERAL ALTERNATIVO
    <div style="width:260px; height:800px; float:left;" >
        <hr noshade="noshade" style="width:260px; color:white;" />
        <?php 
foreach ($contractArray as $contract) {
    $contractNum = str_pad($contract->numero, 5, '0', STR_PAD_LEFT);
    $clientName = new Text(BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $contract->pn));
    $contractStatus = ContractDAO::GetStatusAsText($contract->status);
    $subContractArray = $subContractDAO->RetrieveRecordArray("contrato_id=" . $contract->id);
    $typeEnumeration = "";
    foreach ($subContractArray as $subContract) {
        if (!empty($typeEnumeration)) {
            $typeEnumeration .= ', ';
        }
        $typeEnumeration .= $subContract->siglaTipoContrato;
    }
    $contractTypes = new Text($typeEnumeration);
    $tags = $contractNum . ' ' . $clientName->Truncate(50) . ' ' . $contractTypes->Truncate(20) . ' ' . $contractStatus;
    echo '<a style="float:left; text-align:center;" class="contractIcon" rel="' . $contract->id . '" rev="' . $tags . '" >';
    echo '<img src="' . $pathImg . '/document.png" alt="" style="width:50px; height:50px;" /><br/>';
    echo $contractNum;
    echo '</a>';
示例#3
0
                            <a href="<?php 
    echo 'Frontend/' . $currentDir . '/editar.php?id=' . $billing->id;
    ?>
" >
                                <?php 
    echo str_pad($billing->id, 5, '0', STR_PAD_LEFT);
    ?>
                            </a>
                        </td>
                        <td >
                            <a href="<?php 
    echo 'Frontend/' . $currentDir . '/editar.php?id=' . $billing->id;
    ?>
" >
                                <?php 
    $clientName = new Text(BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $mailing->businessPartnerCode));
    echo $clientName->Truncate(35);
    ?>
                            </a>
                        </td>
                        <td>
                            <?php 
    if ($mailing->contrato_id == 0) {
        echo 'Agrupar equipmts. do cliente';
    } else {
        $contract = $contractDAO->RetrieveRecord($mailing->contrato_id);
        $numero = str_pad($contract->numero, 5, '0', STR_PAD_LEFT);
        $status = ContractDAO::GetStatusAsText($contract->status);
        echo $numero . '(' . $status . ')';
    }
    ?>
$dataConnector->OpenConnection();
if ($dataConnector->mysqlConnection == null || $dataConnector->sqlserverConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$serviceCallDAO = new ServiceCallDAO($dataConnector->mysqlConnection);
$serviceCallDAO->showErrors = 1;
$equipmentDAO = new EquipmentDAO($dataConnector->sqlserverConnection);
$equipmentDAO->showErrors = 1;
// Busca os dados do chamado
$serviceCall = $serviceCallDAO->RetrieveRecord($serviceCallId);
// Recupera dados do cartão de equipamento
$equipment = $equipmentDAO->RetrieveRecord($serviceCall->codigoCartaoEquipamento);
// Busca os dados do cliente
$clientName = BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $serviceCall->businessPartnerCode);
?>

    <script type='text/javascript'>
        $(document).ready(function() {
            <?php 
if (isset($sendToPrinter)) {
    echo 'window.print();';
}
?>
        });
    </script>

    <div style="width:99%;height:99%; margin-top:12px; margin-left:auto; margin-right:auto; border:1px solid black;" id="pageBorder" >
        <div style="width:96%; margin-top:12px; margin-left:auto; margin-right:auto; border:1px solid black;" >
            <img src="http://www.datacount.com.br/Datacount/images/logo.png" alt="Datacopy Trade" style="width:150px; height:50px; margin-top:10px; margin-left: 10px; margin-right: 10px; float:left;" />
function BuildReportTable($startColumn, $startRow)
{
    global $dataConnector;
    global $objPhpExcel;
    global $contractArray;
    global $model;
    global $searchMethod;
    $contractDAO = new ContractDAO($dataConnector->mysqlConnection);
    $contractDAO->showErrors = 1;
    $subContractDAO = new SubContractDAO($dataConnector->mysqlConnection);
    $subContractDAO->showErrors = 1;
    $contractItemDAO = new ContractItemDAO($dataConnector->mysqlConnection);
    $contractItemDAO->showErrors = 1;
    $equipmentDAO = new EquipmentDAO($dataConnector->sqlserverConnection);
    $equipmentDAO->showErrors = 1;
    $equipmentModelDAO = new EquipmentModelDAO($dataConnector->mysqlConnection);
    $equipmentModelDAO->showErrors = 1;
    $salesPersonDAO = new SalesPersonDAO($dataConnector->sqlserverConnection);
    $salesPersonDAO->showErrors = 1;
    // Define o titulo da tabela
    $currentRow = $startRow;
    $activeSheet = $objPhpExcel->getActiveSheet();
    $activeSheet->setCellValue($startColumn . $startRow, 'CONTRATOS');
    $styleArray = array('font' => array('bold' => true, 'size' => 16));
    $activeSheet->getStyle($startColumn . $startRow . ':' . $startColumn . $startRow)->applyFromArray($styleArray);
    // Cria o cabeçalho da tabela
    $colNum = ord($startColumn);
    $headers = array('Número', 'Cliente', 'Detalhes', 'Assinatura', 'Encerramento', 'Inicio do Atendimento', 'Fim do Atendimento', 'Parcela', 'Vendedor', 'Status', 'Global(S OU N)');
    $offset = 0;
    foreach ($headers as $header) {
        $activeSheet->getColumnDimension(chr($colNum + $offset))->setWidth(25);
        $offset++;
    }
    $activeSheet->getColumnDimension(chr($colNum + 1))->setWidth(50);
    $activeSheet->getColumnDimension(chr($colNum + 2))->setWidth(50);
    $currentRow++;
    InsereLinhaPlanilha($currentRow, $startColumn, $headers, PHPExcel_Style_Color::COLOR_YELLOW, 30, PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
    // Busca os modelos de equipamento cadastrados no sistema
    $modelArray = array(0 => "");
    $equipmentModelArray = $equipmentModelDAO->RetrieveRecordArray();
    foreach ($equipmentModelArray as $modelDTO) {
        $modelArray[$modelDTO->id] = $modelDTO->modelo;
    }
    // Busca os vendedores cadastrados no sistema
    $retrievedArray = $salesPersonDAO->RetrieveRecordArray();
    $salesPersonArray = array();
    foreach ($retrievedArray as $salesPersonDTO) {
        $salesPersonArray[$salesPersonDTO->slpCode] = $salesPersonDTO->slpName;
    }
    // Gera as linhas da tabela
    $identifierArray = array();
    $LFCR = chr(10) . chr(13);
    foreach ($contractArray as $contract) {
        if (array_key_exists($contract->id, $identifierArray)) {
            continue;
        }
        // contrato repetido, pula para o próximo registro
        $clientName = BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $contract->pn);
        $salesPersonName = $salesPersonArray[$contract->vendedor];
        $details = "";
        $subContractArray = $subContractDAO->RetrieveRecordArray("contrato_id=" . $contract->id);
        foreach ($subContractArray as $subContract) {
            if (!empty($details)) {
                $details = $details . $LFCR;
            }
            $details = $details . $subContract->siglaTipoContrato;
            $itemArray = $contractItemDAO->RetrieveRecordArray("subContrato_id=" . $subContract->id);
            foreach ($itemArray as $contractItem) {
                $equipment = $equipmentDAO->RetrieveRecord($contractItem->codigoCartaoEquipamento);
                $installationDate = empty($equipment->installationDate) ? '' : $equipment->installationDate->format('d/m/Y');
                // filtra apenas os items ativos e emprestados
                if ($equipment->status == 'A' || $equipment->status == 'L') {
                    if (!empty($details)) {
                        $details = $details . $LFCR;
                    }
                    $equipmentModel = "";
                    if (array_key_exists($equipment->model, $modelArray)) {
                        $equipmentModel = $modelArray[$equipment->model];
                    }
                    $details = $details . $equipmentModel . ' Série ' . $equipment->manufacturerSN . ' Data Instalação ' . $installationDate;
                }
            }
        }
        if ($searchMethod == 1 || $searchMethod == 2) {
            if (!empty($model)) {
                $modelMatched = false;
                if (strpos($details, $model)) {
                    $modelMatched = true;
                }
                if (!$modelMatched) {
                    continue;
                }
            }
        }
        $currentRow++;
        $row = array();
        $row[0] = str_pad($contract->numero, 5, '0', STR_PAD_LEFT);
        $row[1] = $clientName;
        $row[2] = $details;
        $row[3] = $contract->dataAssinatura;
        $row[4] = $contract->dataEncerramento;
        $row[5] = $contract->inicioAtendimento;
        $row[6] = $contract->fimAtendimento;
        $row[7] = $contract->parcelaAtual . '/' . $contract->quantidadeParcelas;
        $row[8] = $salesPersonName;
        $row[9] = $contractDAO->GetStatusAsText($contract->status);
        $row[10] = $contract->global == 0 ? 'N' : 'S';
        InsereLinhaPlanilha($currentRow, $startColumn, $row);
        $identifierArray[$contract->id] = $contract->numero;
    }
}
    echo 'Falha no envio. A extensão Open SSL não está habilitada no PHP.';
    exit;
}
error_reporting(E_ALL);
// manage php errors
$from = trim($user);
$to = trim($recipients);
$toArray = explode(",", $recipients);
$subj = 'Solicitação de peças para equipamento';
$content = '<br/><h1>SOLICITAÇÃO DE PEÇAS</h1>';
$content = $content . '<div style="clear:both;"><br/><br/></div>';
$content = $content . 'Número da solicitação: ' . str_pad($partRequestId, 5, '0', STR_PAD_LEFT) . '<br/>';
$content = $content . 'Chamado de Serviço: ' . str_pad($serviceCall->id, 5, '0', STR_PAD_LEFT) . '<br/>';
$content = $content . 'Data do Chamado: ' . $serviceCall->dataAbertura . '<br/>';
$content = $content . 'Técnico: ' . $technicianName . '<br/>';
$content = $content . 'Cliente: ' . BusinessPartnerDAO::GetClientName($dataConnector->sqlserverConnection, $serviceCall->businessPartnerCode) . '<br/>';
$content = $content . 'Equipamento: ' . $shortDescription . '<br/>';
$content = $content . 'Modelo: ' . $model . '<br/><br/>';
$content = $content . '<h3>Itens</h3> <div style="border:1px solid black; min-height:100px;" >' . $pecas . '</div><br/><br/>';
$content = $content . '<h3>Revisões</h3><br/>' . $revisions;
$message = MIME::message($content, 'text/html', null, 'UTF-8');
// compose message in MIME format
$mess = MIME::compose(null, $message);
// standard mail message RFC2822
$body = 'From: ' . $from . "\r\n" . 'To: ' . $to . "\r\n" . 'Subject: ' . $subj . "\r\n" . $mess['header'] . "\r\n\r\n" . $mess['content'];
$conn = SMTP::connect($host, $port, $user, $pass, $vssl) or die('Falha na conexão - ' . print_r($_RESULT));
$sent = SMTP::send($conn, array($toArray[0]), $body, $from);
if ($sent) {
    echo 'Email enviado com sucesso!';
} else {
    echo 'Falha no envio - ' . print_r($_RESULT);