Beispiel #1
0
        //
        //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);
            }
        }