225 lines
10 KiB
Plaintext
225 lines
10 KiB
Plaintext
|
|
.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
|
%table{:style => "width:100%;"}
|
|
%tr
|
|
%td{:style => "width:30px;"}
|
|
.take
|
|
=ic :arrows
|
|
%td
|
|
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
|
%label Produit :
|
|
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
|
|
|
|
|
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
|
|
|
:javascript
|
|
$( function() {
|
|
|
|
$('.p_product_ref_autocomplete_input').autocomplete({
|
|
source: function( request, response ) {
|
|
$.ajax( {
|
|
url: "/admin/p_product_refs/autocomplete.json",
|
|
dataType: "json",
|
|
data: {
|
|
search: request.term,
|
|
p_customer_id: $(".p_customer_id").val()
|
|
},
|
|
success: function(data){
|
|
|
|
arr = jQuery.map( data, function( item ) {
|
|
return {
|
|
label: item.member_label,
|
|
value: item.member_label,
|
|
id: item.id
|
|
}
|
|
});
|
|
|
|
response(arr)
|
|
|
|
}
|
|
|
|
} );
|
|
},
|
|
minLength: 2,
|
|
select: function( event, ui ) {
|
|
|
|
$(this).next(".p_product_ref_id").val(ui.item.id)
|
|
|
|
form = $(this).closest(".price_line_form")
|
|
|
|
|
|
|
|
$.ajax( {
|
|
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
|
dataType: "json",
|
|
data: {
|
|
type: "price",
|
|
qte: form.find(".input_price_line_qte").val(),
|
|
p_customer_id: $(".p_customer_id").val()
|
|
},
|
|
success: function (data) {
|
|
form.find(".input_price_line_price_u_ht").val(data.price);
|
|
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
|
form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
|
|
form.find(".input_price_line_weight_u").val(data.weight);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
//return false
|
|
}
|
|
});
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
%table.top_td{:style => "width:100%;margin-top:5px;"}
|
|
%tr
|
|
%td{:style => "width:30px"}
|
|
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
|
%td
|
|
-form.object.forced_price = true if form.object.ct_u_price_ht
|
|
|
|
-if form.object.forced_price and form.object.p_product_ref
|
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
|
|
-else
|
|
=qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
|
|
|
|
%div{:style => ("display:none;" if !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
|
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "input_price_line_forced_price"}
|
|
.forced_price_wrapper{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
|
|
|
%td
|
|
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
|
|
%td
|
|
=qi_js_field(form, :price_line, :weight_u, :label => "Poids U :")
|
|
|
|
|
|
%td
|
|
=#qi_js_field(form, :price_line, :tva_account_id, :label => "Compte TVA :")
|
|
%label Taux de TVA :
|
|
%br
|
|
=select_tag :tva_account_id, options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :class => "input_price_line_tva_account_id", :disabled => true
|
|
|
|
= #f.input :tva_account_id, :collection => @price_document.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
|
|
|
|
|
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
|
|
|
%td
|
|
=#qi_js_field(form, :price_line, :tot_line_ht, :label => "Prix total :")
|
|
|
|
=qi_js_field(form, :price_line, :weight_tot, :label => "Poids :")
|
|
-if false
|
|
%tr
|
|
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_market_percent, :label => "marché (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_market_ht, :label => false)
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_qte_percent, :label => "quantité (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_qte_ht, :label => false)
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_delay_percent, :label => "délais (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_delay_ht, :label => false)
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_enrobage_percent, :label => "enrobage (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_enrobage_ht, :label => false)
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_ecole_percent, :label => "école (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_ecole_ht, :label => false)
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :discount_comptant_percent, :label => "comptant (%) :")
|
|
%br
|
|
=qi_js_field(form, :price_line, :discount_comptant_ht, :label => false)
|
|
|
|
|
|
%tr
|
|
%td
|
|
=qi_js_field(form, :price_line, :tot_discount_ht, :label => "Total réduction :")
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :tot_amount_ht, :label => "Total HT :")
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :tot_amount_tva, :label => "TVA :")
|
|
|
|
%td
|
|
=qi_js_field(form, :price_line, :tot_amount_ttc, :label => "Total TTC :")
|
|
|
|
|
|
= form.hidden_field :position, :class => "price_line_position_input"
|
|
|
|
|
|
-if false
|
|
|
|
= form.input :line_type, :label => "line_type :"
|
|
= form.input :ac_accounting_zone_id, :label => "ac_accounting_zone_id :"
|
|
= form.input :cc_accounting_zone_id, :label => "cc_accounting_zone_id :"
|
|
= form.input :ac_accounting_zone_name, :label => "ac_accounting_zone_name :"
|
|
= form.input :cc_accounting_zone_name, :label => "cc_accounting_zone_name :"
|
|
= form.input :ac_tva_account_id, :label => "ac_tva_account_id :"
|
|
= form.input :cc_tva_account_id, :label => "cc_tva_account_id :"
|
|
= form.input :ac_tva_account_value, :label => "ac_tva_account_value :"
|
|
= form.input :cc_tva_account_value, :label => "cc_tva_account_value :"
|
|
= form.input :p_product_id, :label => "p_product_id :"
|
|
= form.input :p_product_variante_id, :label => "p_product_variante_id :"
|
|
= form.input :p_product_alt_id, :label => "p_product_alt_id :"
|
|
= form.input :p_product_alt_variante_id, :label => "p_product_alt_variante_id :"
|
|
= form.input :custom_ref, :label => "custom_ref :"
|
|
= form.input :ac_ref, :label => "ac_ref :"
|
|
= form.input :cc_ref, :label => "cc_ref :"
|
|
= form.input :custom_title, :label => "custom_title :"
|
|
= form.input :ac_title, :label => "ac_title :"
|
|
= form.input :cc_title, :label => "cc_title :"
|
|
= form.input :custom_description, :label => "custom_description :"
|
|
= form.input :ac_description, :label => "ac_description :"
|
|
= form.input :cc_description, :label => "cc_description :"
|
|
= form.input :custom_u_price_ht, :label => "custom_u_price_ht :"
|
|
= form.input :ac_price_u_ht, :label => "ac_price_u_ht :"
|
|
= form.input :cc_price_u_ht, :label => "cc_price_u_ht :"
|
|
= form.input :ac_price_u_tva, :label => "ac_price_u_tva :"
|
|
= form.input :cc_price_u_tva, :label => "cc_price_u_tva :"
|
|
= form.input :ac_price_u_ttc, :label => "ac_price_u_ttc :"
|
|
= form.input :cc_price_u_ttc, :label => "cc_price_u_ttc :"
|
|
= form.input :qte, :label => "qte :"
|
|
= form.input :ac_tot_line_ht, :label => "ac_tot_line_ht :"
|
|
= form.input :cc_tot_line_ht, :label => "cc_tot_line_ht :"
|
|
= form.input :ac_tot_line_tva, :label => "ac_tot_line_tva :"
|
|
= form.input :cc_tot_line_tva, :label => "cc_tot_line_tva :"
|
|
= form.input :ac_tot_line_ttc, :label => "ac_tot_line_ttc :"
|
|
= form.input :cc_tot_line_ttc, :label => "cc_tot_line_ttc :"
|
|
= form.input :ac_tot_discount_ht, :label => "ac_tot_discount_ht :"
|
|
= form.input :cc_tot_discount_ht, :label => "cc_tot_discount_ht :"
|
|
= form.input :ac_tot_discount_tva, :label => "ac_tot_discount_tva :"
|
|
= form.input :cc_tot_discount_tva, :label => "cc_tot_discount_tva :"
|
|
= form.input :ac_tot_discount_ttc, :label => "ac_tot_discount_ttc :"
|
|
= form.input :cc_tot_discount_ttc, :label => "cc_tot_discount_ttc :"
|
|
= form.input :ac_tot_amount_ht, :label => "ac_tot_amount_ht :"
|
|
= form.input :cc_tot_amount_ht, :label => "cc_tot_amount_ht :"
|
|
= form.input :ac_tot_amount_tva, :label => "ac_tot_amount_tva :"
|
|
= form.input :cc_tot_amount_tva, :label => "cc_tot_amount_tva :"
|
|
= form.input :ac_tot_amount_ttc, :label => "ac_tot_amount_ttc :"
|
|
= form.input :cc_tot_amount_ttc, :label => "cc_tot_amount_ttc :"
|
|
= form.input :p_customer_id, :label => "p_customer_id :"
|
|
|