update report
This commit is contained in:
@@ -34,7 +34,7 @@ class BaseReportController < ActionController::Base
|
|||||||
to = params[:to]
|
to = params[:to]
|
||||||
day_ref = Time.now.utc.getlocal
|
day_ref = Time.now.utc.getlocal
|
||||||
|
|
||||||
if params[:report_type] == "daily_sale"
|
if params[:report_type] == "daily_sale" || params[:report_type] == "sale_item"
|
||||||
|
|
||||||
if from != "" && to != ""
|
if from != "" && to != ""
|
||||||
|
|
||||||
@@ -86,8 +86,6 @@ class BaseReportController < ActionController::Base
|
|||||||
else # end daily sale report
|
else # end daily sale report
|
||||||
if period_type.to_i == 1
|
if period_type.to_i == 1
|
||||||
|
|
||||||
if params[:from] && params[:to]
|
|
||||||
|
|
||||||
if params[:from] != "" && params[:to] !=""
|
if params[:from] != "" && params[:to] !=""
|
||||||
|
|
||||||
f_date = DateTime.parse(params[:from])
|
f_date = DateTime.parse(params[:from])
|
||||||
@@ -100,7 +98,6 @@ class BaseReportController < ActionController::Base
|
|||||||
from = day_ref.beginning_of_day.utc
|
from = day_ref.beginning_of_day.utc
|
||||||
to = day_ref.end_of_day.utc
|
to = day_ref.end_of_day.utc
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
case period.to_i
|
case period.to_i
|
||||||
when PERIOD["today"]
|
when PERIOD["today"]
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
else
|
else
|
||||||
# @crm_customers.destroy
|
# @crm_customers.destroy
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. But '}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. But ' }
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class Transactions::OrdersController < ApplicationController
|
|||||||
format.json { render json: @orders }
|
format.json { render json: @orders }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
|
|||||||
@@ -116,24 +116,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
@@ -145,12 +127,68 @@ $(function(){
|
|||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
function export_to(path)
|
var item = $('#item').val();
|
||||||
{
|
var payment_type = $('#payment_type');
|
||||||
var form_params = $("#frm_report").serialize();
|
|
||||||
window.location = path+"?"+ form_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(item == 'order'){
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
$("#item").val('sale');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Reset the form to pervious values
|
||||||
|
$("#branch").val(<%=params[:branch]%>);
|
||||||
|
$("#waiter").val("<%=params[:waiter]%>");
|
||||||
|
$("#cashier").val(<%=params[:cashier]%>);
|
||||||
|
$("#product").val(<%=params[:product]%>);
|
||||||
|
$("#singer").val(<%=params[:singer]%>);
|
||||||
|
$("#item").val('<%=params[:item]%>');
|
||||||
|
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||||
|
|
||||||
|
|
||||||
|
$("#from").val("<%=params[:from]%>");
|
||||||
|
$("#to").val("<%=params[:to]%>");
|
||||||
|
$("#sel_period").val(<%=params[:period]%>);
|
||||||
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
|
<% else %>
|
||||||
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
|
<% end %>
|
||||||
|
$(".btn-group button").removeClass("active");
|
||||||
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
|
$('#item').change(function(){
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user