|
@@ -44,16 +44,15 @@
|
|
|
<span class="caption-subject bold uppercase">Lista de cortes de caja</span>
|
|
<span class="caption-subject bold uppercase">Lista de cortes de caja</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="actions">
|
|
<div class="actions">
|
|
|
- <% if current_user.usertype == "G" %>
|
|
|
|
|
- <% if can? :create, CashOut %>
|
|
|
|
|
- <%= link_to new_open_cash_register_path, :remote => true, :class => 'btn btn bold green margin-top pull-right', :title => "Abrir caja registradora" do %> Abrir caja <i class="fa fa-plus"></i>
|
|
|
|
|
- <% end %> <br>
|
|
|
|
|
- <%= link_to get_open_cash_registers_path, remote: true, data: { toggle: "modal", target: "#get_open_cash_register" }, :class=>"btn bold green pull-right", :title=>"Realizar corte de caja", :style=> "margin-top:10px" do %> Realizar corte de caja <i class="fa fa-plus"></i>
|
|
|
|
|
- <% end %>
|
|
|
|
|
|
|
+ <% if current_user.usertype == "G" %>
|
|
|
|
|
+ <% if can? :create, CashOut %>
|
|
|
|
|
+ <%= link_to new_open_cash_register_path, :remote => true, :class => 'btn btn bold green margin-top pull-right', :title => "Abrir caja registradora" do %> Abrir caja <i class="fa fa-plus"></i><% end %> <br>
|
|
|
|
|
+ <%= link_to get_open_cash_registers_path, remote: true, data: { toggle: "modal", target: "#get_open_cash_register" }, :class=>"btn bold green pull-right", :title=>"Realizar corte de caja", :style=> "margin-top:10px" do %> Realizar corte de caja <i class="fa fa-plus"></i>
|
|
|
<% end %>
|
|
<% end %>
|
|
|
- <% end %>
|
|
|
|
|
- <% if current_user.usertype == "A" %>
|
|
|
|
|
- <%= link_to opened_cash_registers_path, {:class=>"btn bold green pull-right"} do %> <i class="fa fa-search"></i>  Ver cajas abiertas <% end %>
|
|
|
|
|
|
|
+ <% end %>
|
|
|
|
|
+ <% end %>
|
|
|
|
|
+ <% if current_user.usertype == "A" %>
|
|
|
|
|
+ <%= link_to opened_cash_registers_path, {:class=>"btn bold green pull-right"} do %> <i class="fa fa-search"></i>  Ver cajas abiertas <% end %>
|
|
|
<% end %>
|
|
<% end %>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -71,22 +70,22 @@
|
|
|
<%= label_tag :begin_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Desde
|
|
<%= label_tag :begin_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Desde
|
|
|
<% end %>
|
|
<% end %>
|
|
|
<div class="col-sm-2" style="padding-left:0px;padding-right:0px;">
|
|
<div class="col-sm-2" style="padding-left:0px;padding-right:0px;">
|
|
|
- <div class='input-group date' id='begin_date'>
|
|
|
|
|
- <input id="start" type='text' class="form-control"/>
|
|
|
|
|
- <span class="input-group-addon">
|
|
|
|
|
- <span class="glyphicon glyphicon-calendar"></span>
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class='input-group date' id='begin_date'>
|
|
|
|
|
+ <input id="start" type='text' class="form-control" value="<%= l(Date.today.beginning_of_month, format: '%d/%m/%Y') %>" />
|
|
|
|
|
+ <span class="input-group-addon">
|
|
|
|
|
+ <span class="glyphicon glyphicon-calendar"></span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<%= label_tag :end_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Hasta
|
|
<%= label_tag :end_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Hasta
|
|
|
<% end %>
|
|
<% end %>
|
|
|
<div class="col-sm-2" style="padding-left:0px;padding-right:0px;">
|
|
<div class="col-sm-2" style="padding-left:0px;padding-right:0px;">
|
|
|
- <div class='input-group date' id='end_date'>
|
|
|
|
|
- <input id="end" type='text' class="form-control"/>
|
|
|
|
|
- <span class="input-group-addon">
|
|
|
|
|
- <span class="glyphicon glyphicon-calendar"></span>
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class='input-group date' id='end_date'>
|
|
|
|
|
+ <input id="end" type='text' class="form-control" value="<%= l(Date.today.end_of_month, format: '%d/%m/%Y') %>" />
|
|
|
|
|
+ <span class="input-group-addon">
|
|
|
|
|
+ <span class="glyphicon glyphicon-calendar"></span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<button class="btn btn-icon-only blue pull-right" onclick="cashOutByPointsaleDate()">
|
|
<button class="btn btn-icon-only blue pull-right" onclick="cashOutByPointsaleDate()">
|
|
|
<i class="fa fa-search"></i>
|
|
<i class="fa fa-search"></i>
|
|
@@ -134,11 +133,9 @@
|
|
|
<%= link_to cash_out, {:class=>"btn btn-icon-only default filtros", :title=>"Ver corte de caja"} do %>
|
|
<%= link_to cash_out, {:class=>"btn btn-icon-only default filtros", :title=>"Ver corte de caja"} do %>
|
|
|
<i class="fa fa-search"></i>
|
|
<i class="fa fa-search"></i>
|
|
|
<% end %>
|
|
<% end %>
|
|
|
-
|
|
|
|
|
<%= link_to print_cash_out_receipt_path(cash_out.id, format: 'pdf'), {:class=>"btn btn-icon-only default", :target => "blank"} do %>
|
|
<%= link_to print_cash_out_receipt_path(cash_out.id, format: 'pdf'), {:class=>"btn btn-icon-only default", :target => "blank"} do %>
|
|
|
<i class="fa fa-print"></i>
|
|
<i class="fa fa-print"></i>
|
|
|
<% end %>
|
|
<% end %>
|
|
|
-
|
|
|
|
|
</td>
|
|
</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
<% end %>
|
|
<% end %>
|
|
@@ -159,15 +156,15 @@
|
|
|
</div>
|
|
</div>
|
|
|
<script>
|
|
<script>
|
|
|
$(document).on("page:change", function() {
|
|
$(document).on("page:change", function() {
|
|
|
- $('#begin_date').datetimepicker({
|
|
|
|
|
|
|
+ $('#start').datetimepicker({
|
|
|
icons: {
|
|
icons: {
|
|
|
date: "fa fa-calendar"
|
|
date: "fa fa-calendar"
|
|
|
},
|
|
},
|
|
|
format: "DD/MM/YYYY",
|
|
format: "DD/MM/YYYY",
|
|
|
defaultDate: moment().startOf('month').toDate()
|
|
defaultDate: moment().startOf('month').toDate()
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- $('#end_date').datetimepicker({
|
|
|
|
|
|
|
+ $('#end').datetimepicker({
|
|
|
icons: {
|
|
icons: {
|
|
|
date: "fa fa-calendar"
|
|
date: "fa fa-calendar"
|
|
|
},
|
|
},
|
|
@@ -177,21 +174,29 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function cashOutByPointsaleDate() {
|
|
function cashOutByPointsaleDate() {
|
|
|
- var start = moment($("#begin_date").data("date"), "DD-MM-YYYY").format('YYYY-MM-DD');
|
|
|
|
|
- var end = moment($("#end_date").data("date"), "DD-MM-YYYY").format('YYYY-MM-DD');
|
|
|
|
|
|
|
+ if ($("#start").val() && $("#end").val()) {
|
|
|
|
|
+ var start = moment($("#start").data("date"), "DD-MM-YYYY").format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
+ var end = moment($("#end").data("date"), "DD-MM-YYYY").format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var start = null;
|
|
|
|
|
+ var end = null;
|
|
|
|
|
+ }
|
|
|
var pointsale = $('#pointsale').val();
|
|
var pointsale = $('#pointsale').val();
|
|
|
|
|
+ if(pointsale == ""){
|
|
|
|
|
+ pointsale = null;
|
|
|
|
|
+ }
|
|
|
App.blockUI({
|
|
App.blockUI({
|
|
|
- target: $("#cash_outs_table"),
|
|
|
|
|
- animate: true
|
|
|
|
|
|
|
+ target: $("#cash_outs_table"),
|
|
|
|
|
+ animate: true
|
|
|
});
|
|
});
|
|
|
$.ajax({
|
|
$.ajax({
|
|
|
type: "get",
|
|
type: "get",
|
|
|
url: '/find_cash_outs_by_date/' + pointsale + '/' + start + '/' + end,
|
|
url: '/find_cash_outs_by_date/' + pointsale + '/' + start + '/' + end,
|
|
|
dataType: 'script',
|
|
dataType: 'script',
|
|
|
success: function(data) {
|
|
success: function(data) {
|
|
|
- window.setTimeout(function() {
|
|
|
|
|
- App.unblockUI($("#cash_outs_table"));
|
|
|
|
|
- }, 100);
|
|
|
|
|
|
|
+ window.setTimeout(function() {
|
|
|
|
|
+ App.unblockUI($("#cash_outs_table"));
|
|
|
|
|
+ }, 100);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|