private void reprintBtn_Click(object sender, EventArgs e) { DialogResult diagRes = MessageBox.Show("Do you want to reprint receipt?", "Confirmation", MessageBoxButtons.YesNo); if (diagRes == DialogResult.No) { return; } try { //MessageBox.Show(this.get_selected_row() + ""); var _selected_id = this.get_selected_row(); if (_selected_id == -1) { return; } MDB_Sale saleObjModel = this.getThisSale(_selected_id); List <MDB_SingleItemSale> itemsListForReceipt = Newtonsoft.Json.JsonConvert.DeserializeObject <List <MDB_SingleItemSale> >(saleObjModel.json_sales); GINCOTEXFiscalPrinter printer = new GINCOTEXFiscalPrinter(itemsListForReceipt, saleObjModel); printer.PRINT_NOW(); //update printed counts saleController.addPrintCountToSale(_selected_id); //refresh the list var li = saleController.get_my_sales_list(); currentTransctionsList = new SortableBindingList <MDB_Sale>(li); salesDataGridView.DataSource = this.currentTransctionsList; }catch (Exception ex) { MessageBox.Show(ex.Message); } }
// //paying attemp 2 --paying: private void paymentAttemp() { //current user MDB_UserModel workerObj = this.saleController.getCurrentUser(); if (customerNameTxt.Text == "") { customerNameTxt.Text = "CASH"; } try{ MDB_Sale model = new MDB_Sale { trans_no = commonUtil.getRandomReceiptTransNo(), customer_id = -1, store_id = -1, worker_id = workerObj.id, sales_count = cashSummary.counts, description = "", payment_method = paymentModeTxt.Text, amt_req = cashSummary.total_overall, amt_paid = Convert.ToSingle(paidAmtTxt.Text), amt_change = Convert.ToSingle(changeAmtLbl.Text), amt_vat = printReceiptCheckBox.Checked == true ? cashSummary.total_tax : 0,//VAT added if receipt printed amt_discount = cashSummary.total_discount, source = "OFFICE", customer_name = customerNameTxt.Text, customer_phone = customerPhoneTxt.Text, paid = paymentModeTxt.Text == "CASH" ? 1 : 0, printed = printReceiptCheckBox.Checked == true? 1 : 0, paid_date = saleController.getCurrentDate(), created_date = saleController.getCurrentDate(), created_time = Convert.ToDouble(saleController.getCurrentCompactedTimeIn24()), created_datetime = saleController.getCurrentDateAndTimeIn24(), //remarks = remarks, json_sales = Newtonsoft.Json.JsonConvert.SerializeObject(this.itemsListForReceipt), }; //save int res = saleController.saveThisTransaction(model, this.itemsListForReceipt); if (res != 0) { MessageBox.Show("FAIL TO SAVE ORDER", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //fiscal printer / normal thermal printer //printing option if (printReceiptCheckBox.Checked == true) { //GThermalPrinter printer = new GThermalPrinter(itemsListForReceipt, model); //printer.PRINT_NOW(); GINCOTEXFiscalPrinter printer = new GINCOTEXFiscalPrinter(itemsListForReceipt, model); printer.PRINT_NOW(); } //return back //this.SendPushNotificationCommandToKitchenDepartment(); ReceiptGenDepartment.Connecter_in_internal_order_status_results(0); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); //MessageBox.Show("FAIL TO RECEIVE ORDER", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }