mmsc_app/app/views/admin/navision/show.html.haml
Nicolas Bally a6aa1f6074 Initial
2020-05-25 11:40:11 +02:00

91 lines
2.2 KiB
Plaintext

%table.table
%tr
-@table_header.each do |th|
%th=th
-@table.each do |tr|
%tr
-tr.each do |td|
%td=td
-if false
- client = TinyTds::Client.new(username: 'test', password: '@Chatenois!2017', host: '40.89.153.193', appname: "SQL4PS" , port: 1534, database: "JIPE")
-if false
-dimensions = client.execute("SELECT TOP 500 * FROM dbo.[JIPE$Purch_ Inv_ Header]")
-dimensions_results = []
-dimensions.each do |d|
-dimensions_results << d
-dimensions.cancel
-r = client.execute("SELECT TOP 500 * FROM dbo.[JIPE$Purch_ Inv_ Header] WHERE [Document Date] >= '2019-06-01' AND [Document Date] < '2019-06-30';")
=r.count
-if r.count > 0
%table.table.table-striped
%tr
-ic = 0
-r.each do |row|
-ic += 1
-if ic == 1
-row.each do |k,v|
%th
=k
-r.each do |row|
%tr
-row.each do |k,v|
%td
-if v.class == String
=v.encode("UTF-8", :invalid => :replace, :undef => :replace)
-else
=v
-r.cancel
-if false
%table.table
-SComptaAccount.group(:code).order(:code).each do |sca|
%tr
%td=sca.code
%td=sca.name
%td
-sca = SComptaAccount.where(:code => sca.code, :zone => "FRANCE").first
=sca.account
%td
=sca.zone
-client = TinyTds::Client.new(username: 'test', password: '@Chatenois!2017', host: '40.89.153.193', appname: "SQL4PS" , port: 1534, database: "JIPE")
%table.table
-SComptaAccount.where("id >= 172").order(:code).each do |sca|
%tr
%td=sca.code
%td=sca.name
%td
=sca.account
-if false
-a = client.execute("SELECT TOP 1000 * FROM dbo.[JIPE$VAT Posting Setup] WHERE [VAT Prod_ Posting Group] = '#{sca.code}' AND [VAT Bus_ Posting Group] = '#{sca.zone}';")
-a.count
-a.cancel
-a.each do |aa|
-sca.account = aa["Purchase VAT Account"]
-sca.save
%td
=sca.zone
SELECT TOP 1000 * FROM dbo.[JIPE$VAT Posting Setup] WHERE [VAT Prod_ Posting Group] = 'NORM2014' AND [VAT Bus_ Posting Group] = '';