Skip to content

Commit

Permalink
fix: mask to date input editar_orc_aprovado
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiservice committed Jul 30, 2017
1 parent 92b353f commit 5e21f57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion modulos/tecnico/orcamento/aprovados/contratos.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<TD><?php echo $row['prazo_exec_orc']; ?> dia(s)</TD>
<TD><?= ($row['data_aprovada'] == "0000-00-00" ? "--" : date('d/m/Y', strtotime($row['data_aprovada'])) ); ?></TD>
<TD><?= ($row['data_inicio'] == "0000-00-00" ? "--" : date('d/m/Y', strtotime($row['data_inicio'])) ); ?></TD>
<TD><?= ($row['data_inicio'] == "0000-00-00" ? "--" : date('d/m/Y', Formatar::addToDate($row['data_aprovada'], "12", "m")) ); ?></TD>
<TD><?= ($row['data_inicio'] == "0000-00-00" ? "--" : date('d/m/Y', Formatar::addToDate($row['data_inicio'], "12", "m")) ); ?></TD>

</tr>

Expand Down
27 changes: 15 additions & 12 deletions modulos/tecnico/orcamento/aprovados/editar_orc_aprovado.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<h2><?php include_once 'orcamento/includes/nav_wizard.php'; ?> -><a href="?id_menu=orcamento/aprovados/acompanhar_orcamentos">Aprovados</a> -> Atualizar</h2>
</div>
<hr>

<!--
MAscaras em campos
-->
<?php require '../../includes/javascripts/mascaras_campos_valores_monetario.php'; ?>

<?php
$id_orc = filter_input(INPUT_GET, 'id_orc', FILTER_VALIDATE_INT);
Expand Down Expand Up @@ -198,10 +201,10 @@ function VerificaData(digData, idData) {
var data = digData;
var tam = data.length;

var dia = data.substr(0, 2)
var mes = data.substr(3, 2)
var ano = data.substr(6, 4)
if (tam == 10) {
var dia = data.substr(0, 2);
var mes = data.substr(3, 2);
var ano = data.substr(6, 4);
if (tam === 10) {

if ((ano > 1900) || (ano < 2100)) {
switch (mes) {
Expand All @@ -216,7 +219,7 @@ function VerificaData(digData, idData) {
//alert("A Data " + data + " OK!");
return true;
}
break
break;
case '04':
case '06':
case '09':
Expand All @@ -226,26 +229,26 @@ function VerificaData(digData, idData) {
//alert("A Data " + data + " OK!");
return true;
}
break
break;
case '02':
/* Validando ano Bissexto / fevereiro / dia */
if ((ano % 4 == 0) || (ano % 100 == 0) || (ano % 400 == 0)) {
if ((ano % 4 === 0) || (ano % 100 === 0) || (ano % 400 === 0)) {
bissexto = 1;
}
if ((bissexto == 1) && (dia <= 29)) {
if ((bissexto === 1) && (dia <= 29)) {
//alert("A Data " + data + " OK!");
return true;
}
if ((bissexto != 1) && (dia <= 28)) {
if ((bissexto !== 1) && (dia <= 28)) {
//alert("A Data " + data + " OK!");
return true;
}
break
break;
}
}
}

if (ano == 0000 && mes == 00 && dia == 00) {
if (ano === 0000 && mes === 00 && dia === 00) {

return true;
} else
Expand Down

0 comments on commit 5e21f57

Please sign in to comment.