change duplicate query

This commit is contained in:
phyusin
2018-12-27 15:36:30 +06:30
parent 2bb602829e
commit 7a60ab91c5
3 changed files with 195 additions and 248 deletions

View File

@@ -78,12 +78,12 @@
<% if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' %>
<div class="row clearfix">
<%
if !@from.nil?
if !@from.nil? && @from != ""
from_date = DateTime.parse(@from).utc.getlocal.strftime("%d-%m-%Y")
else
from_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
end
if !@to.nil?
if !@to.nil? && @to != ""
to_date = DateTime.parse(@to).utc.getlocal.strftime("%d-%m-%Y")
else
to_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
@@ -385,7 +385,6 @@
var to = $("#to").val();
var from_time = $("#from_time").val();
var to_time = $("#to_time").val();
if(check(from,to,from_time,to_time)){
var params = '?';
if((from!='' && to!='') && (from_time!='' && to_time!='')){
@@ -398,7 +397,9 @@
});
function check(from,to,from_time,to_time){
var status = true;
var status = false;
var t_status = false;
if((from=='') && (to=='')){
status = false;
$('#fromErr').html("can't be blank");
@@ -418,18 +419,19 @@
}
if(((from_time=='') && (to_time=='')) || ((from_time!='') && (to_time!=''))){
status = true;
t_status = true;
$('#from_timeErr').html("");
$('#to_timeErr').html("");
}else if((from_time!='') && (to_time=='')){
status = false;
t_status = false;
$('#from_timeErr').html("");
$('#to_timeErr').html("can't be blank");
}else if((from_time=='') && (to_time!='')){
status = false;
t_status = false;
$('#from_timeErr').html("can't be blank");
$('#to_timeErr').html("");
}
if(status && t_status) status = true;
return status;
}
</script>