//total cash void getCashSale() { DataTable result; con = new db(); string query = "SELECT DISTINCT order_details.shift_no, (SELECT group_concat(DISTINCT order_details.order_id) FROM order_details) as order_id, (SELECT SUM(od.subtotal) FROM order_details od LEFT JOIN paymentdetails p ON p.orders_id = od.order_id WHERE date(od.added) = date(CURDATE()) AND od.online = 1 AND od.shift_no = order_details.shift_no AND p.orders_id IS NULL) AS cardsale FROM order_details LEFT JOIN paymentdetails ON paymentdetails.orders_id = order_details.order_id WHERE paymentdetails.orders_id IS NULL AND order_details.online = 1 AND date(order_details.added) = date(CURDATE())"; con.MysqlQuery(query); result = con.QueryEx(); con.conClose(); if (result != null) { foreach (DataRow cash in result.Rows) { _totalcashsale = _totalcashsale + double.Parse(cash["cardsale"].ToString()); } } }
//void ORDER private void btn_void_Click(object sender, EventArgs e) { string orid = ""; if (dataGridView_cart.SelectedCells.Count > 0) { Form_auth frmauth = new Form_auth(); frmauth.ShowDialog(); if (authproceed) { if (managerPassword) { //canceled order db con = new db(); string query = ""; query = "UPDATE `order_details` SET `online`='0' WHERE order_id = '" + SessionData.newOrderId + "'"; con.MysqlQuery(query); con.NonQueryEx(); con.conClose(); userLog(authid, "void order: " + SessionData.newOrderId); dataGridView2.Rows.Clear(); dataGridView2.Refresh(); loadOrderDetails(); resetAll(); dataGridView_cart.Rows.Clear(); dataGridView_cart.Refresh(); printVoidReceipt(); } else { MessageBox.Show("Authentication Faild!"); } } } else { MessageBox.Show("Empty Cart!"); } }
void processBotOrders(int orderid, string tabel, string std) { DataTable botorders; con = new db(); string query = "select order_details.*,products.name from order_details join products on products.id = order_details.product_id where order_details.item_type = '2' and order_details.order_id ='" + orderid + "' AND order_details.print_status=0"; con.MysqlQuery(query); botorders = con.QueryEx(); SessionData.SetStward(std); if (botorders.Rows.Count > 0) { //print bot orders Botprint botprint = new Botprint(orderid, botorders, tabel); botprint.print(botprinter);//BOT PRINTER // botprint.print("BOT");//BOT PRINTER updateOrderPrintStatus(orderid); } con.conClose(); }
//get guest count void getGuestCount() { DataTable result; con = new db(); string query = "SELECT (IF(SUM(orders.guest) IS NULL,0,SUM(orders.guest))) AS guestcount FROM order_details JOIN orders ON orders.id = order_details.order_id WHERE date(order_details.added) = date(CURDATE())"; con.MysqlQuery(query); result = con.QueryEx(); con.conClose(); if (result == null) { _guestCount = 0; } else { _guestCount = int.Parse(result.Rows[0][0].ToString()); } }
public Form_ChangeGuestTable(long orderid) { InitializeComponent(); _orderid = orderid; searchTabel(); DataTable order; label4.Text = _orderid.ToString(); db con = new db(); con.MysqlQuery("select tabel from orders where id = '" + _orderid + "'"); order = con.QueryEx(); con.conClose(); if (order.Rows.Count > 0) { label3.Text = order.Rows[0][0].ToString(); } }
//CREATE IMAGELITS // Create and return imagelist for both categories and products private ImageList populateImageList() { string table = "categories"; string query = "SELECT * FROM " + table + " WHERE online = 1"; if (!populateFolder.Equals("categories")) { table = "products"; query = "SELECT * FROM " + table + " WHERE online = 1 AND category_id = '" + category_id + "'"; } else { table = "categories"; query = "SELECT * FROM " + table + " WHERE online = 1"; } con = new db(); //ImageList ImageList imgList = new ImageList(); imgList.Images.Clear(); DataTable iamges; con.MysqlQuery(query); iamges = con.QueryEx(); imgList.ImageSize = new Size(180, 180); imgList.ColorDepth = ColorDepth.Depth32Bit; foreach (DataRow row in iamges.Rows) // Loop over the rows. { try { imgList.Images.Add(Image.FromFile(@"c:/xampp/htdocs/mpos/images/" + populateFolder + "/" + row["image"].ToString())); } catch (Exception w) { MessageBox.Show(w.Message); } } con.conClose(); return(imgList); }
void checkOrders() { DataTable orders; con = new db(); string query = "SELECT orders.*,users.username FROM `orders` JOIN users ON users.id=orders.user_id JOIN order_details ON order_details.order_id = orders.id WHERE (SELECT COUNT(order_details.id) FROM order_details WHERE order_details.print_status = 0 AND order_details.order_id=orders.id) > 0 "; con.MysqlQuery(query); orders = con.QueryEx(); if (orders.Rows.Count > 0) { for (int i = 0; i < orders.Rows.Count; i++) { DataRow dr = orders.Rows[i]; int orderid = int.Parse(dr["id"].ToString()); string tabel = dr["tabel"].ToString(); processBotOrders(orderid, tabel, dr["username"].ToString()); processKotOrders(orderid, tabel, dr["username"].ToString()); } } con.conClose(); }