coton_app/app/assets/javascripts/sheet_prices.coffee
Nicolas Bally 03a728c372 suite
2019-03-27 16:28:05 +01:00

20 lines
761 B
CoffeeScript

@udpate_sheet_lines = ->
$(".p_sheet_line_field").each ->
price = parseFloat($(this).find(".price").data("price"))
price_tot = 0
qte_tot = 0
$(this).find(".color_line").each ->
qte = 0
$(this).find("input.qte").each ->
qte += parseFloat($(this).val()) if parseFloat($(this).val())
price_color = qte * price
$(this).find(".price_color_tot").html(accounting.formatMoney(price_color))
$(this).find(".qte_color_tot").html(qte)
qte_tot += qte
$(this).find(".qte_tot").html(qte_tot)
$(this).find(".price_tot").html(accounting.formatMoney(qte_tot*price))
$(this).find(".price_tot").attr("data-price",qte_tot*price)
$(this).find(".price_tot").data("price",qte_tot*price)