示例#1
0
         $result = array("doc" => "", "band" => false);
     } else {
         if ($_GET['email'] == 'no') {
             $result = array("band" => true, "documento" => $obj->Output());
         } else {
             global $sesion;
             $email = new TMail();
             $cotizacion = new TCotizacion($_GET['id']);
             $email->setTema("Su cotización");
             $email->setDestino($cotizacion->cliente->getEmail(), utf8_decode($cotizacion->cliente->getNombre()));
             $datos = array();
             $datos['nombreCompleto'] = $cotizacion->cliente->getNombre();
             $datos['ligaActualizacionDatosCliente'] = $ini["sistema"]["url"] . "?mod=clienteDatos&data=" . base64_encode($cotizacion->cliente->getId());
             $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/cotizacion.txt"), $datos)));
             $email->adjuntar($documento);
             $result = array("doc" => $documento, "band" => $email->send(), "email" => $cotizacion->cliente->getEmail());
         }
     }
     print json_encode($result);
     break;
 case 'autocompleteRopa':
     $db = TBase::conectaDB();
     $rs = $db->Execute("select * from ropa a join item b using(idItem) where descripcion like '%" . $_GET['term'] . "%' or marca like '%" . $_GET['term'] . "%' or nombre like '%" . $_GET['term'] . "%'");
     $datos = array();
     while (!$rs->EOF) {
         $el = array();
         $el['id'] = $rs->fields['idItem'];
         $el['label'] = $rs->fields['nombre'] . ' Marca: ' . $rs->fields['marca'];
         $el['identificador'] = $rs->fields['idItem'];
         array_push($datos, $el);
         $rs->moveNext();
示例#2
0
         } else {
             if ($_POST['enviar'] == 'no') {
                 $result = array("doc" => $documento, "band" => true);
             } else {
                 global $sesion;
                 $email = new TMail();
                 $consultorio = new TConsultorio($_POST['consultorio']);
                 $email->setTema("Reporte " . utf8_decode($consultorio->getClave() . " " . $consultorio->getNombre()));
                 $email->setDestino($consultorio->supervisor->getEmail(), utf8_decode($consultorio->supervisor->getNombreCompleto()));
                 $doctor = new TDoctor($_POST['usuario'] == '' ? $sesion['usuario'] : $_POST['usuario']);
                 $datos = array();
                 $datos['nombreCompleto'] = $consultorio->supervisor->getNombreCompleto();
                 $datos['nombreDoctor'] = $doctor->getNombreCompleto();
                 $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/reporteDoctor.txt"), $datos)));
                 $email->adjuntar($documento);
                 $result = array("doc" => $documento, "band" => $email->send(), "emailSupervisor" => $consultorio->supervisor->getEmail());
             }
         }
         print json_encode($result);
         break;
     case 'generalExcel2':
         #Este incluye todas las consultas realizadas en un mes
         require_once getcwd() . "/repositorio/excel/general.php";
         $doc = new RReporte();
         $doc->setMes($_POST['mes']);
         $doc->setAnio($_POST['anio']);
         $documento = $doc->output();
         $result = array("doc" => $documento, "band" => $documento != '');
         print json_encode($result);
         break;
 }
示例#3
0
 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // get the form data into an active record Note
         $object = $this->form->getData('Note');
         $logged = Member::newFromLogin(TSession::getValue('login'));
         $object->id_user = $logged->id;
         $object->register_date = date('Y-m-d');
         $object->register_time = date('H:i');
         // form validation
         $this->form->validate();
         // stores the object
         $object->store();
         $issue = new Issue($object->id_issue);
         $project = new Project($issue->id_project);
         $member = new Member($issue->id_user);
         // who has opened the issue
         // read email configuration file
         $ini = parse_ini_file('app/config/email.ini');
         $members = $project->getMembers(array('MEMBER', 'MANAGER'));
         $members = array_merge($members, array($member));
         // merge the logged user
         $mail_template = file_get_contents('app/resources/note.html');
         $mail_template = str_replace('{DESCRIPTION}', $issue->description, $mail_template);
         $mail_template = str_replace('{OPENER}', $member->name . ' ' . $issue->register_date . ' ' . $issue->issue_time, $mail_template);
         $mail_template = str_replace('{NOTE}', $object->note, $mail_template);
         $mail_template = str_replace('{MEMBER}', $logged->name . ' ' . $object->register_date . ' ' . $object->register_time, $mail_template);
         $mail = new TMail();
         $mail->setFrom($ini['from'], $ini['name']);
         $mail->setSubject(_t('Note') . ' #' . $issue->id . ': ' . $issue->title);
         $mail->setHtmlBody($mail_template);
         foreach ($members as $member) {
             $emails = explode(',', $member->email);
             foreach ($emails as $email) {
                 $mail->addAddress(trim($email), $member->name);
                 // echo "{$email}, {$member-> name} <br>";
             }
         }
         $mail->SetUseSmtp();
         $mail->SetSmtpHost($ini['host'], $ini['port']);
         $mail->SetSmtpUser($ini['user'], $ini['pass']);
         $mail->setReplyTo($ini['repl']);
         $mail->send();
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         // reload the listing
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // get the form data into an active record Release
         $object = $this->form->getData('Release');
         $sendmail = $object->sendmail == 'Y';
         unset($object->sendmail);
         // form validation
         $this->form->validate();
         // stores the object
         $object->store();
         if ($sendmail) {
             // read email configuration file
             $ini = parse_ini_file('app/config/email.ini');
             $project = new Project($object->id_project);
             $members = $project->getMembers();
             foreach ($members as $member) {
                 $emails = explode(',', $member->email);
                 foreach ($emails as $email) {
                     $mail = new TMail();
                     $mail->setFrom($ini['from'], $ini['name']);
                     $mail->setSubject(_t('Release') . ': ' . $object->name);
                     $mail->setHtmlBody($object->description);
                     $mail->addAddress(trim($email), $member->name);
                     $mail->SetUseSmtp();
                     $mail->SetSmtpHost($ini['host'], $ini['port']);
                     $mail->SetSmtpUser($ini['user'], $ini['pass']);
                     $mail->setReplyTo($ini['repl']);
                     $mail->send();
                     echo "{$email}, {$member->name}<br>";
                 }
             }
         }
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         // reload the listing
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
 public function onEnviaEmail()
 {
     try {
         TTransaction::open('atividade');
         $object = $this->form->getData('Ticket');
         $vars['tipo_origens'] = $object->tipo_origens;
         $vars['codigo_cadastro_origem'] = $object->codigo_cadastro_origem;
         $vars['solicitante_id'] = $object->solicitante_id;
         $this->onChangeOrigem($vars);
         $this->onChangeTipoOrigem($vars);
         $this->onSetarValoresCombo($vars);
         $status = $object->status_ticket->nome;
         $solicitante = new Pessoa($object->solicitante_id);
         $cliente = $solicitante->pessoa_nome;
         $email1 = $solicitante->email1;
         $empresa = $solicitante->origem_nome;
         $responsavel = new Pessoa($object->responsavel_id);
         $colaborador = $responsavel->pessoa_nome;
         $email2 = $responsavel->email1;
         $table = new TTable();
         $table->border = 0;
         $table1 = new TTable();
         $table1->border = 1;
         $table2 = new TTable();
         $table2->border = 1;
         $table3 = new TTable();
         $table3->border = 1;
         $table4 = new TTable();
         $table4->border = 1;
         $imagem = new TImage('app/images/tecbiz.jpg');
         $imagem->height = 63;
         $imagem->width = 96;
         $row = $table->addRow();
         $cell = $row->addCell($imagem);
         $cell->style = 'width: 100px;';
         $cell = $row->addCell("Prezado <br /> {$cliente} do(a) {$empresa} <br /> Foi registrado um ticket com sua solicitação conforme os dados a seguir:");
         $cell->style = 'width: 700px;';
         $row = $table->addRow();
         $row->addCell('<span style="color: DarkOliveGreen;"><b><u>Inicial:</b></u></span>');
         $row = $table1->addRow();
         $cell = $row->addCell('<b>No. Ticket:</b>');
         $cell->style = 'width: 200px;';
         $cell = $row->addCell($object->id);
         $cell->style = 'width: 600px;';
         $row = $table1->addRow();
         $row->addCell('<b>Título Ticket:</b>');
         $row->addCell($object->titulo);
         $row = $table1->addRow();
         $row->addCell('<b>Data/Hora:</b>');
         $row->addCell(date('d/m/Y H:i'));
         $row = $table1->addRow();
         $row->addCell('<b>Status:</b>');
         $row->addCell($status);
         $row = $table1->addRow();
         $row->addCell('<b>Solicitante:</b>');
         $row->addCell($cliente);
         $row = $table1->addRow();
         $row->addCell('<b>Colaborador TecBiz:</b>');
         $row->addCell($colaborador);
         $row = $table->addRow();
         $cell = $row->addCell($table1);
         $cell->colspan = 2;
         $row = $table->addRow();
         $row->addCell('<span style="color: DarkOliveGreen;"><b><u>Solicitação:</b></u></span>');
         $row = $table2->addRow();
         $cell = $row->addCell('<b>Descrição:</b>');
         $cell->style = 'width: 200px;';
         $cell = $row->addCell($object->solicitacao_descricao);
         $cell->style = 'width: 520px;';
         $cell = $row->addCell($object->data_cadastro);
         $cell->style = 'width: 80px;';
         $row = $table->addRow();
         $cell = $row->addCell($table2);
         $cell->colspan = 2;
         $row = $table->addRow();
         $row->addCell('<span style="color: DarkOliveGreen;"><b><u>Orçamento:</b></u></span>');
         $row = $table3->addRow();
         $cell = $row->addCell('<b>Horas orçadas:</b>');
         $cell->style = 'width: 200px;';
         $cell = $row->addCell($object->orcamento_horas);
         $cell->style = 'width: 600px;';
         $row = $table3->addRow();
         $row->addCell('<b>Valor Hora:</b>');
         $row->addCell('R$ ' . $object->orcamento_valor_hora);
         $row = $table3->addRow();
         $row->addCell('<b>Valor Total:</b>');
         $row->addCell('R$ ' . $object->valor_total);
         $row = $table3->addRow();
         $row->addCell('<b>Forma de pagamento:</b>');
         $row->addCell($object->forma_pagamento);
         $row = $table3->addRow();
         $row = $table->addRow();
         $cell = $row->addCell($table3);
         $cell->colspan = 2;
         $row = $table4->addRow();
         $cell = $row->addCell('<span style="color: red;"><b>Importante:</b></span> Para dar seguimento a esta solicitação será necessário a aprovação da descrição e orçamento deste Ticket');
         $cell->style = 'width: 800px;';
         $row = $table->addRow();
         $cell = $row->addCell($table4);
         $cell->colspan = 2;
         TTransaction::close();
         $ini = parse_ini_file('app/config/email.ini');
         $mail = new TMail();
         $mail->setFrom($ini['from'], $ini['name']);
         $mail->setSubject('TecBiz criou um ticket para voce');
         $mail->setHtmlBody($table);
         $mail->addAddress($email1);
         $mail->addCC($email2);
         $mail->addBCC('*****@*****.**');
         // Se tiver anexo
         if (isset($target_file)) {
             $mail->addAttach($target_file);
         }
         $mail->SetUseSmtp();
         $mail->SetSmtpHost($ini['host'], $ini['port']);
         $mail->SetSmtpUser($ini['user'], $ini['pass']);
         $mail->setReplyTo($ini['repl']);
         $mail->send();
         new TMessage('info', 'Email enviado com sucesso');
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
     $this->form->setData($object);
 }
 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // get the form data into an active record Issue
         $object = $this->form->getData('Issue');
         $member = Member::newFromLogin(TSession::getValue('login'));
         // standard values
         $object->id_user = $member->id;
         $object->id_status = 1;
         // NEW
         // form validation
         $this->form->validate();
         // stores the object
         $object->store();
         // have attachments
         if ($object->file) {
             $target_folder = 'attach/' . $object->id;
             $target_file = $target_folder . '/' . $object->file;
             @mkdir($target_folder);
             rename('tmp/' . $object->file, $target_file);
         }
         $project = new Project($object->id_project);
         // read email configuration file
         $ini = parse_ini_file('app/config/email.ini');
         $members = $project->getMembers(array('MEMBER', 'MANAGER'));
         $members = array_merge($members, array($member));
         // merge the logged user
         $mail_template = file_get_contents('app/resources/ticket_open.html');
         $mail_template = str_replace('{DESCRIPTION}', $object->description, $mail_template);
         $mail_template = str_replace('{OPENER}', $member->name . ' ' . $object->register_date . ' ' . $object->issue_time, $mail_template);
         $mail = new TMail();
         $mail->setFrom($ini['from'], $ini['name']);
         $mail->setSubject(_t('Issue') . ' #' . $object->id . ': ' . $object->title . ' (' . $object->status . ')');
         $mail->setHtmlBody($mail_template);
         foreach ($members as $member) {
             $emails = explode(',', $member->email);
             foreach ($emails as $email) {
                 $mail->addAddress(trim($email), $member->name);
                 // echo "{$email}, {$member-> name} <br>";
             }
         }
         if (isset($target_file)) {
             $mail->addAttach($target_file);
         }
         $mail->SetUseSmtp();
         $mail->SetSmtpHost($ini['host'], $ini['port']);
         $mail->SetSmtpUser($ini['user'], $ini['pass']);
         $mail->setReplyTo($ini['repl']);
         $mail->send();
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         // reload the listing
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage() . '<br>' . _t('Try again'));
         // undo all pending operations
         TTransaction::rollback();
     }
 }
示例#7
0
                    $datos['comentario1'] = $reporte->getCampo1();
                    $datos['comentario2'] = $reporte->getCampo2();
                    $datos['comentario3'] = $reporte->getCampo3();
                    $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/ubicacion.txt"), $datos)));
                    $email->adjuntar($img);
                    $email->send();
                    $rs->moveNext();
                }
                $result = array("doc" => $documento, "band" => true);
                echo json_encode($result);
                break;
            case 'solicitarUbicacionMail':
                $db = TBase::conectaDB();
                $email = new TMail();
                $usuario = new TUsuario($_GET['user']);
                $origen = new TUsuario($_GET['solicita']);
                $datos = json_decode(file_get_contents("data.json"));
                foreach ($datos as $key => $val) {
                    $config[$key] = $val;
                }
                $email->setTema(utf8_decode("Solicitud de ubicación"));
                $email->setDestino($usuario->getEmail(), utf8_decode($usuario->getNombre()));
                $datos = array();
                $datos['nombreCompleto'] = $usuario->getNombre();
                $datos['direccionReportar'] = $config['web'] . "/?mod=reportarUbicacion&usuario=" . base64_encode($usuario->getId()) . "&solicita=" . base64_encode($origen->getId());
                $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/ubicar.txt"), $datos)));
                echo json_encode(array("band" => $email->send()));
                break;
        }
        break;
}