| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/merenda/mnova21/modulos/cardapios/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: RalpAlves
* Date: 04/03/15
* Time: 14:02
*/
$v_cod = $_GET['cod_card'];
if (isset($_GET['id_prep'])) {
$id_prp = $_GET['id_prep'];
}
mysql_select_db($banco, conexao);
$rs_cardapio = mysql_query("SELECT * FROM v_lista_cardapio where cdp_id = $v_cod");
$resulta = mysql_fetch_array($rs_cardapio);
$_codigo = $resulta['cdp_id'];
$rs_tipo_cardapio = mysql_query("SELECT * FROM tipoescola");
$rs_tipo_refeicao = mysql_query("SELECT * FROM tiporefeicao order by trf_refeicao");
$rs_nutricionista = mysql_query("SELECT * FROM nutricionista order by nut_nome");
$rs_card_r = mysql_query("SELECT * FROM v_lista_cardapio_refeicao where ref_cdp_id = $v_cod ORDER BY pre_nmpreparacao");
$rs_tota_r = mysql_query("SELECT * FROM v_lista_cardapio_tot where ref_cdp_id = $v_cod");
$semana = mysql_query("SELECT * FROM semana");
$card_semana = mysql_query("SELECT * FROM v_lista_cardapio_semana where cdp_id=$v_cod");
?>
<head id="Head1">
<meta charset="utf-8"/>
<title>SGAE | Merenda</title>
<link href="Styles/Site.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="img/favicon.png"/>
<link href="Styles/smoothness/jquery-ui-1.8.24.custom.css" rel="stylesheet" type="text/css"/>
<script src="Scripts/jquery-1.8.2.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
<link href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="Styles/bootstrap.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
function excluir_registro(e) {
if (!confirm('Deseja realmente excluir este registro?')) {
if (window.event)
window.event.returnValue = false; else
e.preventDefault();
}
}
</script>
<script type="text/javascript">
function limpar_registro(e) {
if (!confirm('Deseja realmente limpar esta preparação?')) {
if (window.event)
window.event.returnValue = false; else
e.preventDefault();
}
}
</script>
<script type="text/javascript" language="javascript">
function CarregaCard(codCon) {
$.ajax({
type: "GET", url: './modulos/cardapio/cardapio_div.php?&id_card=' + codCon, dataType: "html", success: function (resultado) {
$('#data_cardapio').html(resultado);
/*alert(resultado)*/
}
});
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#tabela').DataTable({
"pagingType": "full_numbers", "lengthMenu": [[8, 25, 50, -1], [8, 25, 50, "Todos"]], stateSave: true, "oLanguage": {
"sProcessing": "Processando. Aguarde...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "NENHUM REGISTRO ENCONTRADO!",
"sInfo": "Mostrando _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered": "(de _MAX_ registros no total)",
"sInfoPostFix": "",
"sSearch": "<em class='fa fa-search' title='pesquisar'></em>",
"sUrl": "",
"oPaginate": {
"sFirst": "<em class='fa fa-angle-double-left' title='primeiro registro'>",
"sPrevious": "<em class='fa fa-arrow-circle-left' title='registro anterior'></em>",
"sNext": "<em class='fa fa-arrow-circle-right' title='próximo registro'></em>",
"sLast": "<em class='fa fa-angle-double-right ' title='último registro'>"
}
}
});
});
</script>
</head>
<div id="data_cardapio" class="col-md-offset-4"></div>
<form id="form1" name="form1" method="post" action="?page=./cardapio/cardapio_crud&var_acao=editar">
<div class="container">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">
<button type="button" name="bt_novo" class="btn botao_esquerda" title="voltar" onclick=location.href='?page=./cardapio/cardapio'>
<i class="fa fa-arrow-left"></i></button>
<span style="font-size:20px;"> Cardapio | Edição </span>
<button type="submit" name="bt_novo" class="btn botao_direita" title="salvar"><i class="fa fa-check"></i></button>
<a href="modulos/cardapio/rel_cardapio_ficha.php?id=<?=$v_cod?>" target='_blank'>
<i class="glyphicon glyphicon-print text-print botao_centro" title="gerar PDF"></i>
</a>
</div>
</div>
</div>
</div>
<!--
EDICAO DE CARDAPIO
-->
<div id="id_form" class="container">
<div class="">
<div class="col-md-2">
ID<br>
<input type="text" name="txt_id" readonly class="form-control" value="<?php echo $v_cod ?>">
</div>
<div class="col-md-4">
Cardápio<br>
<input type="text" name="txt_cardapio" class="form-control lm" value="<?php echo utf8_encode($resulta['cdp_nmcardapio']); ?>">
</div>
<div class="col-md-2">
Tipo cardápio<br>
<select name="txt_tipo_cardapio" class="form-control">
<?php while ($_tip = mysql_fetch_array($rs_tipo_cardapio)) {
if ($resulta['cdp_tipoescola']==$_tip['tpe_id']) {
$selected = 'selected';
} else {
$selected = '';
}
?>
<option value="<?=$_tip['tpe_id']?>" <?php echo $selected; ?>><?=$_tip['tpe_tipoescola']?></option>
<?php } ?>
</select>
</div>
<div class="col-md-2">
Data inicial<br>
<input type="text" name="txt_data_i" class="form-control" value="<?php echo $resulta['cdp_dtinic'] ?>" onKeyup="formataData(this,event);" maxlength="10">
</div>
<div class="col-md-2">
Data final
<input type="text" name="txt_data_f" class="form-control" value="<?php echo $resulta['cdp_dtfim'] ?>" onKeyup="formataData(this,event);" maxlength="10">
</div>
<div class="col-md-6">
Nutricionista<br>
<select name="txt_nutricionista" class="form-control">
<?php while ($_nutri = mysql_fetch_array($rs_nutricionista)) {
if ($resulta['cdp_nut_id']==$_nutri['nut_id']) {
$selected = 'selected';
} else {
$selected = '';
}
?>
<option value="<?=$_nutri['nut_id']?>" <?php echo $selected; ?>><?=$_nutri['nut_nome']?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</form>
<div class="container">
<hr>
<form id="form1" name="form1" method="post" action="?page=./cardapio/cardapio_crud&var_acao=add_semana">
<div class="col-md-6">
Dia da semana<br>
<input type="hidden" name="txt_id_cardapio" value="<?php echo $v_cod ?>">
<select name="txt_cardapio_semana" class="form-control">
<?php while ($_semana = mysql_fetch_array($semana)) { ?>
<option value="<?=$_semana['id_cod_semana']?>"><?=$_semana['semana']?></option>
<?php } ?>
</select>
</div>
<div class="col-md-2">
<br>
<button type="submit" name="bt_novo" class="form-control btn botao_esquerda" title="salvar dia da semana"><i class="fa fa-check"></i></button>
</div>
</form>
<div class="col-md-4">
<br>
<table class="tabe1 table table-striped table-hover dt-responsive' cellspacing='0' width='100%' border='0'">
<thead>
<tr>
<th>ID</th>
<th>Semana</th>
<th></th>
</tr>
</thead>
<tbody><?php
while ($cs = mysql_fetch_array($card_semana)) {
echo "<tr>";
echo "<td>" . $cs['id_semana'] . "</td>";
echo "<td>" . $cs['semana'] . "</td>";
$v_sem = $cs['id_semana'];
$v_cdp_id = $cs['cdp_id'];
echo "<td><a href='?page=cardapio/cardapio_crud&id_card=$v_cdp_id&id_cardapio_semana=$v_sem&var_acao=del_semana'> <em class='fa fa-trash text-red' title='Excluir semana' onclick='excluir_registro(event);'/></a></td>";
}
echo "</table>";
?></tbody>
</table>
</div>
</div>
<br>
<!--REFEICAO-->
<div class="container">
<div class="panel with-nav-tabs panel-primary">
<div class="panel-heading">
Refeição
</div>
<div class="panel-body">
<div class="tab-content">
<form id="form1" name="form1" id="cad_produto" method="post" action="?page=./cardapio/cardapio_crud&var_acao=cadastrar_refeicao">
<div class="tab-pane" id="produtos">
<div class="panel-body">
<!-- <div class="col-md-1">-->
<!-- ID Card.<br>-->
<input type="hidden" name="txt_id_card" value="<?php echo $v_cod ?>">
<!-- </div>-->
<div class="col-md-2">
Data<br>
<input type="text" name="txt_data_ref" class="form-control" value="<?=date('d/m/Y')?>" onKeyup="formataData(this,event);" maxlength="10" required>
</div>
<div class="col-md-3">
Refeição<br>
<select name="txt_refeicao_card" autofocus id="txt_refeicao_card" class="form-control">
<?php while ($_ref = mysql_fetch_array($rs_tipo_refeicao)) { ?>
<option
value="<?php echo $_ref['trf_id'] ?>"><?php echo utf8_encode($_ref['trf_refeicao']) ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-1">
Hora 1
<input type="text" name="txt_hora_1" value="00:00" class="form-control lm" onKeyup="formataHora(this,event);" maxlength="5">
</div>
<div class="col-md-1">
Hora 2
<input type="text" name="txt_hora_2" value="00:00" class="form-control lm" onKeyup="formataHora(this,event);" maxlength="5">
</div>
<div class="col-md-1">
Hora 3
<input type="text" name="txt_hora_3" value="00:00" class="form-control lm" onKeyup="formataHora(this,event);" maxlength="5">
</div>
<div class="col-md-1" title="quantidade de vezes servida no dia">
Servida
<input type="number" name="txt_qtd_dia" value="1" class="form-control lm">
</div>
<div class="col-md-1">
<br>
<button type='submit' name='bt_cad_prod' class='btn' title="Adiconar refeição ao cardápio">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
<table class="tabe1 table table-striped table-hover dt-responsive' cellspacing='0' width='100%' border='0'">
<thead>
<tr>
<th>ID</th>
<th>Data</th>
<th>Refeição</th>
<th>Hora 1</th>
<th>Hora 2</th>
<th>Hora 3</th>
<th>Servida</th>
<th></th>
<th>Preparação</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
while ($row_rsResult = mysql_fetch_array($rs_card_r)) {
echo "<tr>";
$card_id = $row_rsResult['pre_id'];
echo "<td>" . $row_rsResult['ref_id'] . "</td>";
echo "<td>" . $row_rsResult['ref_data'] . "</td>";
echo "<td>" . utf8_encode($row_rsResult['trf_refeicao']) . "</td>";
echo "<td>" . $row_rsResult['ref_horario'] . "</td>";
echo "<td>" . $row_rsResult['ref_horario2'] . "</td>";
echo "<td>" . $row_rsResult['ref_horario3'] . "</td>";
echo "<td>" . $row_rsResult['ref_qtd_dia'] . "</td>";
echo "<td class='centro'><a style='font-size: 12px; color: #000000' class='label label-primary' href='#' title='ver itens da preparação' onclick='CarregaCard($card_id);'>" . $row_rsResult['pre_id'] . "</a></td>";
echo "<td>" . $row_rsResult['pre_nmpreparacao'] . "</td>";
$cod_cardapio = $row_rsResult['ref_cdp_id'];
$cod_refeicao = $row_rsResult['ref_id'];
if (empty($row_rsResult['pre_nmpreparacao'])) {
echo "<td><a href=\"javascript: window.open('modulos/cardapio/cardapio_ref_prep.php?cod_cardapio=$cod_cardapio&cod_refeicao=$cod_refeicao&var_acao=incluir_preparacao','programas','menubar=no,
resizable=no,width=600,height=270,location=no,toolbar=no,top=100,directories=no,fullscreen=no,left=200')\">
<img src='img/novo.png' width='16' title='Incluir preparação'/></a></td>";
} else {
echo "<td><a href='?page=cardapio/cardapio_crud&cod_cardapio=$cod_cardapio&cod_refe=$cod_refeicao&cod_prep=$cod_prepara&var_acao=limpar_preparacao'>
<em class='fa fa-times-circle-o' title='Limpar preparação' onclick='limpar_registro(event);'/></a></td>";
}
echo "<td><a href='?page=cardapio/cardapio_crud&cod_cardapio=$cod_cardapio&cod_refeicao=$cod_refeicao&var_acao=excluir_refeicao'> <em class='fa fa-trash text-red' title='Excluir refeição' onclick='excluir_registro(event);'/></a></td>";
echo "</tr>";
}
$registros = mysql_num_rows($rs_card_r);
echo "<table>";
echo "<tr>";
echo "<td>Refeições: $registros</td>";
echo "</tr>";
echo "</table>";
?></tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
<!--TOTAIS-->
<div class="panel-body"></div>
<div class="container">
<div class="panel panel-primary">
<div class="panel-heading">
Totais do cardápio
</div>
<div class="panel-body">
<div class="tab-content">
<table class='tabe1 table table-striped table-hover dt-responsive' cellspacing='0' width='100%' border='0'>
<thead>
<tr>
<!--<th>Per Capita</th>-->
<th>Energia</th>
<th>Carboidrato</th>
<th>Proteínas</th>
<th>Lipidios</th>
<th>Fibras</th>
<th>Vit.A</th>
<th>Vit.C</th>
<th>Cálcio</th>
<th>Ferro</th>
<th>Magnésio</th>
<th>Zinco</th>
<th>Sódio</th>
</tr>
</thead>
<tbody>
<?php
while ($row_totais = mysql_fetch_array($rs_tota_r)) {
echo "<tr>";
/*echo "<td>" . number_format($row_totais['percapta'], 2, ',', '.') . "</td>";*/
echo "<td>" . number_format($row_totais['energia'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['carboidrato'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['proteinas'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['lipidios'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['fibras'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['vit_a'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['vit_c'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['calcio'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['ferro'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['magnesio'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['zinco'], 2, ',', '.') . "</td>";
echo "<td>" . number_format($row_totais['sodio'], 2, ',', '.') . "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</html>