Browse Source

bugfix in cashout receipt, reserved sales total calculation

chemi ledon 6 years ago
parent
commit
f6618b2cf9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/controllers/cash_outs_controller.rb

+ 1 - 1
app/controllers/cash_outs_controller.rb

@@ -122,7 +122,7 @@ class CashOutsController < ApplicationController
       all_sales = Sale.where("open_cash_register_id = (?) and status != 1", @cash_out.open_cash_register_id)
       @cash_sales = CashRegistersMove.where("open_cash_register_id = (?) and move_type = '1' and status = 1 and sale_id IN (?)", @cash_out.open_cash_register_id, all_sales.where(saletype: 1).pluck(:id)).sum(:quantity)
       @credit_sales = CashRegistersMove.where("open_cash_register_id = (?) and move_type = '1' and status = 1 and concept = 3", @cash_out.open_cash_register_id).sum(:quantity)
-      @reserved_sales = CashRegistersMove.where("open_cash_register_id = (?) and move_type = '1' and status = 1 and sale_id IN (?)", @cash_out.open_cash_register_id, all_sales.where(saletype: 2).pluck(:id)).sum(:quantity)
+      @reserved_sales = CashRegistersMove.where("open_cash_register_id = (?) and move_type = '1' and status = 1 and concept IN (4, 6, 7)", @cash_out.open_cash_register_id).sum(:quantity)
       @details.each do |detail|
         detail["price_sale"] = Product.find(detail['product_id']).get_price_sale(@pointsale.id)