changes
This commit is contained in:
parent
689396126d
commit
6cb5b4b63c
|
@ -20,6 +20,12 @@ $if(letterhead)$
|
||||||
\ULCornerWallPaper{1}{letterhead.pdf}
|
\ULCornerWallPaper{1}{letterhead.pdf}
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
|
$if(draft)$
|
||||||
|
\usepackage{draftwatermark}
|
||||||
|
\SetWatermarkText{$drafttext$}
|
||||||
|
\SetWatermarkScale{1}
|
||||||
|
$endif$
|
||||||
|
|
||||||
% TYPOGRAPHY
|
% TYPOGRAPHY
|
||||||
%--------------------------------
|
%--------------------------------
|
||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
|
|
|
@ -84,6 +84,12 @@ def generate_receipt(skyldnere)
|
||||||
hash = {description: PRODUCTS[product], price: PRICES[product].to_i*amount, amount: amount}
|
hash = {description: PRODUCTS[product], price: PRICES[product].to_i*amount, amount: amount}
|
||||||
yaml["service"] << Hash[hash.map{ |k, v| [k.to_s, v] }]
|
yaml["service"] << Hash[hash.map{ |k, v| [k.to_s, v] }]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless Date.today.sunday?
|
||||||
|
yaml["draft"] = "true"
|
||||||
|
yaml["drafttext"] = "Udkast"
|
||||||
|
end
|
||||||
|
|
||||||
output = Hash[yaml.map{ |k, v| [k.to_s, v] }].to_yaml
|
output = Hash[yaml.map{ |k, v| [k.to_s, v] }].to_yaml
|
||||||
output += "---\n"
|
output += "---\n"
|
||||||
file = File.open("./pandoc/details.yml","w")
|
file = File.open("./pandoc/details.yml","w")
|
||||||
|
@ -109,6 +115,5 @@ def date_of_prev(day)
|
||||||
date - delta
|
date - delta
|
||||||
end
|
end
|
||||||
|
|
||||||
#partition = partition_rows(read_file("./log/matkant-#{Time.now.strftime('%Y%W')}.log"))
|
|
||||||
partition = partition_rows(read_db(db))
|
partition = partition_rows(read_db(db))
|
||||||
generate_receipt(partition)
|
generate_receipt(partition)
|
||||||
|
|
|
@ -11,6 +11,15 @@ log_dir = "./log/"
|
||||||
|
|
||||||
amount = 1.0 unless amount
|
amount = 1.0 unless amount
|
||||||
|
|
||||||
|
valid_products = []
|
||||||
|
db.query("SELECT * FROM products").each do |product|
|
||||||
|
valid_products << product['id']
|
||||||
|
end
|
||||||
|
|
||||||
|
unless valid_products.include? product
|
||||||
|
raise "Product not found in table\nValid products are: #{valid_products}"
|
||||||
|
end
|
||||||
|
|
||||||
statement = db.prepare("INSERT INTO transactions (buyer, product, amount) VALUES (?, ?, ?)")
|
statement = db.prepare("INSERT INTO transactions (buyer, product, amount) VALUES (?, ?, ?)")
|
||||||
result = statement.execute(person,product,amount)
|
result = statement.execute(person,product,amount)
|
||||||
puts result
|
puts result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user