diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 5c1f8c01..7dc29463 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -532,7 +532,7 @@ class ReceiptBillPdf < Prawn::Document break; end end - if sale_data.payment_status == "foc" + if sale_data.payment_status == "foc" || sale_data.payment_status == "waste" || sale_data.payment_status == "spoile" y_position = cursor stroke_horizontal_rule @@ -540,12 +540,19 @@ class ReceiptBillPdf < Prawn::Document bounding_box([self.label_width,y_position], :width =>self.item_description_width) do move_down 70 stroke_horizontal_rule - end + end - bounding_box([self.label_width,y_position], :width =>self.item_description_width) do - move_down 73 - text "Acknowledged By" , :size => self.item_font_size,:align => :center - end + if sale_data.payment_status == "foc" + bounding_box([self.label_width,y_position], :width =>self.item_description_width) do + move_down 73 + text "Acknowledged By" , :size => self.item_font_size,:align => :center + end + elsif sale_data.payment_status == "waste" || sale_data.payment_status == "spoile" + bounding_box([self.label_width,y_position], :width =>self.item_description_width) do + move_down 73 + text "Approved By" , :size => self.item_font_size,:align => :center + end + end end end diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index c9b681b8..99120a0b 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -14,7 +14,7 @@
- <%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10', :onChange => "total_customer();" }%> + <%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10', :onkeyup => "total_customer();" }%>
@@ -332,10 +332,34 @@ var cashier_type = "<%= @cashier_type %>"; case 'num': var input_value = $(this).attr("data-value"); if (original_value == "0.0"){ - $('.addfocus').val(input_value); + var value = $('.addfocus').val(input_value); + if ($("#survey_child").hasClass('addfocus')){ + var child = $("#survey_child").val()+value; + var adult = $("#survey_adult").val() || 0; + var result = parseInt(child) + parseInt(adult); + $("#survey_total_customer").val(result); + } + if ($("#survey_adult").hasClass('addfocus')){ + var adult = $("#survey_adult").val()+value; + var child = $("#survey_child").val() || 0; + var result = parseInt(child) + parseInt(adult); + $("#survey_total_customer").val(result); + } } else{ - $('.addfocus').val(original_value + '' + input_value); + var value = $('.addfocus').val(original_value + '' + input_value); + if ($("#survey_child").hasClass('addfocus')){ + var child = $("#survey_child").val()+value; + var adult = $("#survey_adult").val() || 0; + var result = parseInt(child) + parseInt(adult); + $("#survey_total_customer").val(result); + } + if ($("#survey_adult").hasClass('addfocus')){ + var adult = $("#survey_adult").val()+value; + var child = $("#survey_child").val() || 0; + var result = parseInt(child) + parseInt(adult); + $("#survey_total_customer").val(result); + } } break; @@ -351,7 +375,18 @@ var cashier_type = "<%= @cashier_type %>"; break; case 'clr': - $('.addfocus').val(""); + $('.addfocus').val(""); + if($("#survey_child").hasClass('addfocus')){ + $("#survey_child").val(""); + var adult = $("#survey_adult").val() || 0; + var result = parseInt(adult); + $("#survey_total_customer").val(result); + }else if($("#survey_adult").hasClass('addfocus')){ + $("#survey_adult").val(""); + var child = $("#survey_child").val() || 0; + var result = parseInt(child); + $("#survey_total_customer").val(result); + } break; } event.handled = true; @@ -464,4 +499,6 @@ var cashier_type = "<%= @cashier_type %>"; var result = parseInt(child) + parseInt(adult); $("#survey_total_customer").val(result); } + + \ No newline at end of file