Hi all,
I am brand new to this and have the following code...
-------------------------------------------------------------
function view_index() {
var self = this;
DATABASE(function(err, connection){
if(err != null) {
self.throw500(err);
return;
}
connection.query('SELECT
view5142_store.name, view5142_ticket.date, SUM(view5142_ticket.guest_count) AS guest_count, SUM(view5142_ticket.entree_count) AS entree_count, SUM(view5142_ticket.bev_count) AS bev_count, SUM(view5142_ticket.items) AS item_sales, SUM(view5142_ticket.discount) AS total_discounts, SUM(view5142_ticket.hash) AS hash_sales, SUM(view5142_ticket.hash_discount) AS hash_discount, SUM(view5142_ticket.tip) AS total_tips, SUM(view5142_ticket.tax1) as total_tax, COUNT(view5142_ticket.date) AS total_checks FROM view5142_store INNER JOIN view5142_ticket ON view5142_store.mid = view5142_ticket.store_mid WHERE view5142_ticket.date = "2015-12-02" GROUP BY
view5142_store.name, view5142_ticket.date',
function(err, rows) {
connection.release();
if (err != null) {
self.view500(err);
return;
}
//return rows;
self.view('index', rows);
});
connection.query('SELECT
view5142_store.name FROM view5142_store',
function(err, rows1) {
//connection.release();
if (err != null) {
self.view500(err);
return;
}
self.view('index', rows1);
console.log(rows1);
});
});
}
-------------------------------------------------------------
What I am trying to do is return 1 array with the guest counts, sales, etc and another array of labor dollars (I know the 2nd one returns the store name right now, just wanted a quick thing to test).
The goal is to be able to access them like so..
@{model[0].item_sales}
@{model2[0].name}