change json format

This commit is contained in:
phyusin
2018-10-16 15:40:50 +06:30
parent 94debfdde9
commit b8f96a1f87
6 changed files with 108 additions and 16 deletions

View File

@@ -0,0 +1,15 @@
if @status == true
json.status :true
json.session_token @employee.token_session
json.name @employee.token_session
json.role @employee.role
if @error_message
json.error_message @error_message
json.terminals do
json.array! @terminals, :id, :name, :is_active, :is_currently_login
end
end
else
json.status :false
json.error_message @error_message
end

View File

@@ -0,0 +1,26 @@
if @status == true
#show invoice number and stuff
json.status @status
json.sale_id @sale_id
sale = Sale.find(@sale_id)
json.sale_items sale.sale_items do |sale_item|
json.sale_item_id sale_item.sale_item_id
json.sale_id sale_item.sale_id
json.product_code sale_item.product_code
json.item_instance_code sale_item.item_instance_code
json.product_name sale_item.product_name
json.product_alt_name sale_item.product_alt_name
json.account_id sale_item.account_id
json.status sale_item.status
json.remark sale_item.remark
json.qty sale_item.qty
json.unit_price sale_item.unit_price
json.taxable_price sale_item.taxable_price
json.price sale_item.price
json.is_taxable sale_item.is_taxable
end
else
json.status @status
json.error_message @error_message
end

View File

@@ -0,0 +1,34 @@
if @status == true
json.status true
json.message @message
# json.shift_sale @shift_sale do |shift|
# json.id shift.id
# json.cashier_terminal_id shift.cashier_terminal_id
# json.shift_started_at shift.shift_started_at.strftime("%Y-%m-%d %H:%m:%s")
# json.shift_closed_at shift.shift_closed_at.strftime("%Y-%m-%d %H:%m:%s")
# json.employee_id shift.employee_id
# json.opening_balance shift.opening_balance
# json.closing_balance shift.closing_balance
# json.total_revenue shift.total_revenue
# json.total_discounts shift.total_discounts
# json.total_taxes shift.total_taxes
# json.grand_total shift.grand_total
# json.nett_sales shift.nett_sales
# json.cash_sales shift.cash_sales
# json.credit_sales shift.credit_sales
# json.other_sales shift.other_sales
# json.commercial_taxes shift.commercial_taxes
# json.cash_in shift.cash_in
# json.cash_out shift.cash_out
# json.dining_count shift.dining_count
# json.takeaway_count shift.takeaway_count
# json.member_count shift.member_count
# json.total_rounding shift.total_rounding
# json.total_receipt shift.total_receipt
# json.total_void shift.total_void
# end
else
json.status false
json.error_message @error_message
end