|
@@ -203,7 +203,7 @@
|
203
|
203
|
var dateField = findChildObject(this, 'date');
|
204
|
204
|
submitButton.clicked.connect(function() {
|
205
|
205
|
var query = new QSqlQuery;
|
206
|
|
- var q = "INSERT INTO invoices VALUES (default, :invoice, :vendor, :date) RETURNING id";
|
|
206
|
+ var q = "INSERT INTO invoices (id, invoice, vendor, time) VALUES (default, :invoice, :vendor, :date) RETURNING id";
|
207
|
207
|
query.prepare(q);
|
208
|
208
|
query.bind(":invoice", invoiceField.text);
|
209
|
209
|
query.bind(":vendor", vendorField.currentText);
|
|
@@ -246,11 +246,11 @@
|
246
|
246
|
}
|
247
|
247
|
if(decafSelection.checked)
|
248
|
248
|
{
|
249
|
|
- q = "INSERT INTO decaf_coffees VALUES (default, :name, :reference, :unit, 0, 'Coffee: Unroasted', :origin, :region, :producer, :grade, :milling, :drying, :decafMethod) RETURNING id";
|
|
249
|
+ q = "INSERT INTO decaf_coffees (id, name, reference, unit, quantity, category, origin, region, producer, grade, milling, drying, decaf_method) VALUES (default, :name, :reference, :unit, 0, 'Coffee: Unroasted', :origin, :region, :producer, :grade, :milling, :drying, :decafMethod) RETURNING id";
|
250
|
250
|
}
|
251
|
251
|
else
|
252
|
252
|
{
|
253
|
|
- q = "INSERT INTO coffees VALUES (default, :name, :reference, :unit, 0, 'Coffee: Unroasted', :origin, :region, :producer, :grade, :milling, :drying) RETURNING id";
|
|
253
|
+ q = "INSERT INTO coffees (id, name, reference, unit, quantity, category, origin, region, producer, grade, milling, drying) VALUES (default, :name, :reference, :unit, 0, 'Coffee: Unroasted', :origin, :region, :producer, :grade, :milling, :drying) RETURNING id";
|
254
|
254
|
}
|
255
|
255
|
query.prepare(q);
|
256
|
256
|
query.bind(":name", nameEntry.currentText);
|
|
@@ -317,7 +317,7 @@
|
317
|
317
|
query.exec();
|
318
|
318
|
query.next();
|
319
|
319
|
var item_id = query.value(0);
|
320
|
|
- q = "INSERT INTO purchase VALUES(:time, :item, :quantity, :cost, :vendor)";
|
|
320
|
+ q = "INSERT INTO purchase (time, item, quantity, cost, vendor) VALUES(:time, :item, :quantity, :cost, :vendor)";
|
321
|
321
|
query.prepare(q);
|
322
|
322
|
query.bind(":time", dateField.date);
|
323
|
323
|
query.bind(":item", item_id);
|
|
@@ -333,14 +333,14 @@
|
333
|
333
|
}
|
334
|
334
|
query.bind(":vendor", vendorField.currentText);
|
335
|
335
|
query.exec();
|
336
|
|
- q = "INSERT INTO lb_bag_conversion VALUES(:item, :conversion)";
|
|
336
|
+ q = "INSERT INTO lb_bag_conversion (item, conversion) VALUES(:item, :conversion)";
|
337
|
337
|
query.prepare(q);
|
338
|
338
|
query.bind(":item", item_id);
|
339
|
339
|
var bagsEntry = findChildObject(current, 'bags');
|
340
|
340
|
var conversion = convertToPounds(parseFloat(quantityEntry.text), unitEntry.currentText) / Number(bagsEntry.text);
|
341
|
341
|
query.bind(":conversion", conversion);
|
342
|
342
|
query.exec();
|
343
|
|
- q = "INSERT INTO invoice_items VALUES(:id, 'PURCHASE', :item, :description, :cost)";
|
|
343
|
+ q = "INSERT INTO invoice_items (invoice_id, record_type, item_id, description, cost) VALUES(:id, 'PURCHASE', :item, :description, :cost)";
|
344
|
344
|
query.prepare(q);
|
345
|
345
|
query.bind(":id", invoiceNumber);
|
346
|
346
|
query.bind(":item", item_id);
|
|
@@ -356,7 +356,7 @@
|
356
|
356
|
query.exec();
|
357
|
357
|
var certifications = findChildObject(current, 'certdisplay');
|
358
|
358
|
var certlist = certifications.text.split(",");
|
359
|
|
- q = "INSERT INTO certifications VALUES (:item, :certification)";
|
|
359
|
+ q = "INSERT INTO certifications (item, certification) VALUES (:item, :certification)";
|
360
|
360
|
query.prepare(q);
|
361
|
361
|
query.bind(":item", item_id);
|
362
|
362
|
for(var j = 0; j < certlist.length; j++)
|
|
@@ -366,7 +366,7 @@
|
366
|
366
|
}
|
367
|
367
|
}
|
368
|
368
|
var descriptionArray = sqlToArray(feesTable.columnArray(0, 0));
|
369
|
|
- var q = "INSERT INTO invoice_items VALUES (:id, 'FEE', NULL, :description, :cost)";
|
|
369
|
+ var q = "INSERT INTO invoice_items (invoice_id, record_type, item_id, description, cost) VALUES (:id, 'FEE', NULL, :description, :cost)";
|
370
|
370
|
query.prepare(q);
|
371
|
371
|
query.bind(":id", invoiceNumber);
|
372
|
372
|
if(descriptionArray.length > 0)
|