コード例 #1
0
ファイル: FrmPayments.cs プロジェクト: L10Messi10/APCPOS
        private static async Task Xupdateproduct()
        {
            int curstock = 0;
            int totqty;

            await Conopen();

            Strsql                   = "Select * from tbl_Products where prod_number='" + prdid + "'";
            Sqlcmd.CommandText       = Strsql;
            Sqlcmd.Connection        = Cnn;
            Sqladapter.SelectCommand = Sqlcmd;
            Sqlreader                = Sqlcmd.ExecuteReader();
            if (Sqlreader.Read())
            {
                curstock = Convert.ToInt32(Sqlreader.GetValue(3).ToString());
            }
            Strsql = "";
            totqty = curstock - prdqty;
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Update tbl_Products set Prod_Stock=@Prod_Stock Where Prod_Number=@Prod_Number";
            Sqlcmd.Parameters.AddWithValue("@Prod_Stock", Convert.ToInt32(totqty));
            Sqlcmd.Parameters.AddWithValue("@Prod_Number", prdid);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Strsql = "";
            //prdqty = 0;
            //prdid = "";
        }
コード例 #2
0
        private async Task XupdateInfo()
        {
            UseWaitCursor = true;

            Sqlcmd.Parameters.Clear();
            await Conopen();

            Image temp = new Bitmap(bunifuPictureBox1.Image);
            var   strm = new MemoryStream();

            temp.Save(strm, System.Drawing.Imaging.ImageFormat.Jpeg);
            var imagebytearray = strm.ToArray();

            Strsql =
                "Update tbl_Users set u_Fname=@u_Fname, u_address=@u_address, u_c_num=@u_c_num, u_img=@u_img Where u_name=@u_name";
            Sqlcmd.Parameters.AddWithValue("@u_Fname", txtfname.Text);
            Sqlcmd.Parameters.AddWithValue("@u_address", textBox1.Text);
            Sqlcmd.Parameters.AddWithValue("@u_c_num", textBox2.Text);
            Sqlcmd.Parameters.AddWithValue("@u_img", imagebytearray);
            Sqlcmd.Parameters.AddWithValue("@u_name", username);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            _xinfoupdated = true;
            await XSaveTransactionLog();

            popup.Delay       = 5000;
            popup.TitleText   = @"Info updated";
            popup.ContentText = @"Your personal information has been successfully updated! You might need to restart the application to see the modified changes";
            popup.Popup();
            UseWaitCursor = false;
        }
コード例 #3
0
        private async Task Xaddmode()
        {
            Sqlcmd.Parameters.Clear();
            Image temp = new Bitmap(bunifuPictureBox1.Image);
            var   strm = new MemoryStream();

            temp.Save(strm,
                      ImageFormat.Jpeg);
            _imagebytearray = strm.ToArray();
            await Conopen();

            Strsql =
                "Insert into tbl_Products(Prod_Barcode, Prod_Name, Prod_Stock, Unit_Desc, Prod_Price,Prod_Img,production_Strt_date,cost_sale,cat_desc,prod_description,prod_FS,prod_exp_date) " +
                "Values(@Prod_Barcode, @Prod_Name, @Prod_Stock, @Unit_Desc, @Prod_Price, @Prod_Img,@production_Strt_date,@cost_sale,@cat_desc,@prod_description,@prod_FS,@prod_exp_date)";
            Sqlcmd.Parameters.AddWithValue("@Prod_Barcode",
                                           bunifuTextBox2.Text);
            Sqlcmd.Parameters.AddWithValue("@Prod_Name",
                                           bunifuTextBox1.Text);
            Sqlcmd.Parameters.AddWithValue("@Prod_Stock",
                                           bunifuTextBox3.Text);
            Sqlcmd.Parameters.AddWithValue("@Unit_Desc",
                                           cmbounit.Text);
            Sqlcmd.Parameters.AddWithValue("@Prod_Price",
                                           bunifuTextBox4.Value);
            Sqlcmd.Parameters.AddWithValue("@Prod_Img",
                                           _imagebytearray);
            Sqlcmd.Parameters.AddWithValue("@production_Strt_date",
                                           psdstartdate.Value);
            Sqlcmd.Parameters.AddWithValue("@cost_sale",
                                           cost.Value);
            Sqlcmd.Parameters.AddWithValue("@cat_desc",
                                           category.Text);
            Sqlcmd.Parameters.AddWithValue("@prod_description",
                                           txtdesciption.Text);
            Sqlcmd.Parameters.AddWithValue("@prod_FS",
                                           prodFS);
            Sqlcmd.Parameters.AddWithValue("@prod_exp_date",
                                           dateTimePicker1.Value);
            Sqlcmd.Connection = Cnn;
            //sqlcmd.CommandType = CommandType.Text;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            var a     = new T_Message();
            var frmok = new Frm_OK();

            a.Show(this);
            frmok.titletxt.Text = @"Success";
            frmok.msgtxt.Text   =
                @"Record has been successfully Added! Please refresh the products data to see modified changes.";
            frmok.OkDescription = "Success";
            frmok.ShowDialog(this);
            a.Hide();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            Close();
        }
コード例 #4
0
ファイル: FrmLogin.cs プロジェクト: L10Messi10/APCPOS
        private async Task XSignUp()
        {
            try
            {
                Sqlcmd.Parameters.Clear();
                Image        temp = new Bitmap(bunifuPictureBox2.Image);
                MemoryStream strm = new MemoryStream();
                temp.Save(strm, ImageFormat.Jpeg);
                byte[] imagebytearray = strm.ToArray();
                await Conopen();

                Strsql =
                    "Insert into tbl_Users(u_Fname, u_address, u_c_num, u_name, u_pass, Desig_Desc, u_img) " +
                    "Values(@u_Fname, @u_address, @u_c_num, @u_name, @u_pass,@Desig_Desc, @u_img)";
                Sqlcmd.Parameters.AddWithValue("@u_Fname", bunifuTextBox5.Text);
                Sqlcmd.Parameters.AddWithValue("@u_address", bunifuTextBox6.Text);
                Sqlcmd.Parameters.AddWithValue("@u_c_num", bunifuTextBox7.Text);
                Sqlcmd.Parameters.AddWithValue("@u_name", bunifuTextBox4.Text);
                Sqlcmd.Parameters.AddWithValue("@u_pass", bunifuTextBox3.Text);
                Sqlcmd.Parameters.AddWithValue("@Desig_Desc", cmbodesig.Text);
                Sqlcmd.Parameters.AddWithValue("@u_img", imagebytearray);
                Sqlcmd.Connection = Cnn;
                //sqlcmd.CommandType = CommandType.Text;
                Sqlcmd.CommandText = Strsql;
                Sqlcmd.ExecuteNonQuery();
                popup.TitleText   = @"Success";
                popup.Image       = Properties.Resources.check;
                popup.ContentText = @"You've successfully signed up, Your system application is pending for approval by the administrator.";
                popup.Popup();
                Sqlcmd.Dispose();
                Strsql = "";
                Cnn.Close();
                //Close();
                bunifuTextBox5.Text = "";
                bunifuTextBox6.Text = "";
                bunifuTextBox7.Text = "";
                bunifuTextBox4.Text = "";
                bunifuTextBox3.Text = "";
                cmbodesig.Items.Clear();
                bunifuPictureBox2.Image = null;
                label6.Text             = @"Not registered yet?";
                bunifuFlatButton4.Text  = @"Sign Up";
                panel3.Visible          = false;
                bunifuTransition1.ShowSync(panel1);
                Focus();
            }
            catch
            {
                popup.TitleText   = @"Warning";
                popup.Image       = Properties.Resources.warning;
                popup.ContentText = @"The user name is already taken, please enter another one and try signing up again!";
                popup.Popup();
                Focus();
                bunifuTextBox5.Focus();
            }
        }
コード例 #5
0
        private async Task XAddCustomer()
        {
            Sqlcmd.Parameters.Clear();
            Image temp = new Bitmap(bunifuPictureBox1.Image);
            var   strm = new MemoryStream();

            temp.Save(strm,
                      ImageFormat.Jpeg);
            _imagebytearray = strm.ToArray();
            await Conopen();

            Strsql =
                "Insert into tbl_customer(cus_ID, cus_fname, cus_lname, cus_prefix, cus_address, cus_home_phone, cus_mobile,cus_email,cus_dob,cus_notes,cus_img) " +
                "Values(@cus_ID, @cus_fname, @cus_lname, @cus_prefix, @cus_address, @cus_home_phone, @cus_mobile, @cus_email,@cus_dob,@cus_notes,@cus_img)";
            Sqlcmd.Parameters.AddWithValue("@cus_ID",
                                           _idNum);
            Sqlcmd.Parameters.AddWithValue("@cus_fname",
                                           txtfname.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_lname",
                                           txtlname.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_prefix",
                                           cmbprefix.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_address",
                                           txtaddress.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_home_phone",
                                           txthomephone.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_mobile",
                                           txtmobilephone.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_email",
                                           txtemail.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_dob",
                                           dateTimePicker1.Value);
            Sqlcmd.Parameters.AddWithValue("@cus_notes",
                                           txtnotes.Text);
            Sqlcmd.Parameters.AddWithValue("@cus_img",
                                           _imagebytearray);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            var a     = new T_Message();
            var frmok = new Frm_OK();

            a.Show(this);
            frmok.titletxt.Text = @"Success";
            frmok.msgtxt.Text   =
                @"Record has been successfully Added! Please refresh the customer data to see modified changes.";
            frmok.OkDescription = "Success";
            frmok.ShowDialog(this);
            a.Hide();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            XCustomerLoaded = false;
            Close();
        }
コード例 #6
0
ファイル: FrmNotification.cs プロジェクト: L10Messi10/APCPOS
        private async void bunifuImageButton9_Click(object sender, EventArgs e)
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql             = "Delete from tbl_notification";
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            await XLoadNotification();
        }
コード例 #7
0
        private async void numericUpDown1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                var ok = new Frm_OK();
                var a  = new T_Message();
                //try
                //{
                Sqlcmd.Parameters.Clear();
                await Conopen();

                Strsql =
                    "Update tbl_Transaction_Detail set Tran_D_Subtotal=@Tran_D_Subtotal, Disc=@Disc Where Prod_Number=@Prod_Number And Inv_Num=@Inv_Num";
                Sqlcmd.Parameters.AddWithValue("@Tran_D_Subtotal", Convert.ToSingle(lblnewamount.Text));
                Sqlcmd.Parameters.AddWithValue("@Disc", Convert.ToDecimal(lbldiscount.Text));
                Sqlcmd.Parameters.AddWithValue("@Inv_Num", inv_num);
                Sqlcmd.Parameters.AddWithValue("@Prod_Number", proid);
                Sqlcmd.Connection = Cnn;
                //sqlcmd.CommandType = CommandType.Text;
                Sqlcmd.CommandText = Strsql;
                Sqlcmd.ExecuteNonQuery();
                ok.OkDescription = "Success";
                ok.titletxt.Text = @"Success";
                ok.msgtxt.Text   = @"Discount has been successfully added!";
                a.Show(this);
                ok.ShowDialog();
                a.Hide();
                Sqlcmd.Dispose();
                Strsql = "";
                Cnn.Close();
                FillCart = true;
                Hide();
                //}
                //catch (Exception ex)
                //{
                //    a.Show(this);
                //    ok.titletxt.Text = @"Error";
                //    ok.msgtxt.Text = @"System has encountered an unexpected Error! Please contact the system developer relating to this problem.";
                //    ok.OkDescription = "Error";
                //    ok.ShowDialog(this);
                //    a.Hide();
                //    Focus();
                //    //call LogFile method and pass argument as Exception message, event name, control name, error line number, current form name
                //    LogFile(ex.Message, e.ToString(), ((Control)sender).Name, ex.LineNumber(), FindForm()?.Name);

                //}
            }
        }
コード例 #8
0
ファイル: FrmLogin.cs プロジェクト: L10Messi10/APCPOS
        public static async Task XUpdatelogindate()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Update tbl_Users set last_login=@last_login Where u_name=@u_name";
            Sqlcmd.Parameters.AddWithValue("@last_login", Now);
            Sqlcmd.Parameters.AddWithValue("@u_name", username);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
        }
コード例 #9
0
        private async Task XupdateSecurity()
        {
            try
            {
                UseWaitCursor = true;
                Sqlcmd.Parameters.Clear();
                await Conopen();

                Strsql =
                    "Update tbl_Users set u_name=@u_name, u_pass=@u_pass Where u_name=@u_nam";
                Sqlcmd.Parameters.AddWithValue("@u_name", textBox4.Text);
                Sqlcmd.Parameters.AddWithValue("@u_pass", textBox7.Text);
                Sqlcmd.Parameters.AddWithValue("@u_nam", username);
                Sqlcmd.Connection  = Cnn;
                Sqlcmd.CommandText = Strsql;
                Sqlcmd.ExecuteNonQuery();
                Sqlcmd.Dispose();
                Strsql       = "";
                username     = textBox4.Text;
                userpassword = textBox7.Text;
                Cnn.Close();
                _xinfoupdated = false;
                await XSaveTransactionLog();

                popup.TitleText   = @"Security updated";
                popup.ContentText = @"Your security information has been successfully updated!";
                popup.Popup();
                UseWaitCursor = false;
                Close();
            }
            catch
            {
                UseWaitCursor     = false;
                textBox5.Text     = "";
                textBox6.Text     = "";
                textBox7.Text     = "";
                popup.TitleText   = @"User name";
                popup.ContentText = @"The user name you entered is already taken, please enter another user name and try saving the data again!";
                popup.Popup();
                textBox4.Focus();
            }
        }
コード例 #10
0
ファイル: ListUsers.cs プロジェクト: L10Messi10/APCPOS
        private async void temporaryBlockedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            approvedToolStripMenuItem.Checked         = false;
            blockedToolStripMenuItem.Checked          = false;
            temporaryBlockedToolStripMenuItem.Checked = true;
            UseWaitCursor = true;
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Update tbl_Users set approval_stat=@approval_stat Where U_ID=@U_ID";
            Sqlcmd.Parameters.AddWithValue("@approval_stat", "3");
            Sqlcmd.Parameters.AddWithValue("@U_ID", lblid.Text);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            UseWaitCursor = false;
        }
コード例 #11
0
ファイル: FrmAddToCart.cs プロジェクト: L10Messi10/APCPOS
        private async Task XSaveTransactionDetails()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Insert into tbl_Transaction_Detail(Inv_Num, Prod_Number, Qty, Sell_price, Tran_D_Subtotal) " +
                "Values(@Inv_Num, @Prod_Number, @Qty, @Sell_price, @Tran_D_Subtotal)";
            Sqlcmd.Parameters.AddWithValue("@Inv_Num",
                                           inv_num);
            Sqlcmd.Parameters.AddWithValue("@Prod_Number",
                                           lblprodID.Text);
            Sqlcmd.Parameters.AddWithValue("@Qty",
                                           numericUpDown1.Value);
            Sqlcmd.Parameters.AddWithValue("@Sell_price",
                                           label9.Text);
            Sqlcmd.Parameters.AddWithValue("@Tran_D_Subtotal",
                                           label6.Text);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Cnn.Close();
            Strsql = string.Empty;
            //*****************update products table for stock************************
            //*****************There might be an error here in case the clients selects and save the same product at the same time**********
            //Sqlcmd.Parameters.Clear();
            //await Conopen();
            //Strsql =
            //    "Update tbl_Products set Prod_Stock=@Prod_Stock Where Prod_Number=@Prod_Number";
            //Sqlcmd.Parameters.AddWithValue("@Prod_Stock", Convert.ToDouble(label4.Text));
            //Sqlcmd.Parameters.AddWithValue("@Prod_Number", lblprodID.Text);
            //Sqlcmd.Connection = Cnn;
            //Sqlcmd.CommandText = Strsql;
            //Sqlcmd.ExecuteNonQuery();
            //Sqlcmd.Dispose();
            //Strsql = "";
            //Cnn.Close();
        }
コード例 #12
0
ファイル: FrmAddToCart.cs プロジェクト: L10Messi10/APCPOS
        private async Task XSaveTransaction()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Insert into tbl_Transaction(Inv_Num, Inv_date, Inv_time, u_name) " +
                "Values(@Inv_Num, @Inv_date, @Inv_time, @u_name)";
            Sqlcmd.Parameters.AddWithValue("@Inv_Num",
                                           inv_num);
            Sqlcmd.Parameters.AddWithValue("@Inv_date",
                                           Today);
            Sqlcmd.Parameters.AddWithValue("@Inv_time",
                                           Now.ToString("h:mm:ss tt"));
            Sqlcmd.Parameters.AddWithValue("@u_name",
                                           username);
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Cnn.Close();
            Strsql = string.Empty;
        }
コード例 #13
0
        private async Task XSaveTransactionLog()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Insert into tbl_logs(u_name, action, log_date, log_time) " +
                "Values(@u_name, @action, @log_date, @log_time)";
            Sqlcmd.Parameters.AddWithValue("@u_name",
                                           username);
            Sqlcmd.Parameters.AddWithValue("@action",
                                           _xinfoupdated ? _updatedinfo : _updatedsecurity);
            Sqlcmd.Parameters.AddWithValue("@log_date",
                                           Today);
            Sqlcmd.Parameters.AddWithValue("@log_time",
                                           Now.ToString("h:mm:ss tt"));
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Cnn.Close();
            Strsql = string.Empty;
        }
コード例 #14
0
ファイル: FrmLogin.cs プロジェクト: L10Messi10/APCPOS
        public static async Task XSaveLog()
        {
            logaction = @"" + username + " has logged in the system.";
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql =
                "Insert into tbl_logs(u_name, action, log_date, log_time) " +
                "Values(@u_name, @action, @log_date, @log_time)";
            Sqlcmd.Parameters.AddWithValue("@u_name",
                                           username);
            Sqlcmd.Parameters.AddWithValue("@action",
                                           logaction);
            Sqlcmd.Parameters.AddWithValue("@log_date",
                                           Now.ToString("G"));
            Sqlcmd.Parameters.AddWithValue("@log_time",
                                           Now.ToString("h:mm:ss tt"));
            Sqlcmd.Connection  = Cnn;
            Sqlcmd.CommandText = Strsql;
            Sqlcmd.ExecuteNonQuery();
            Sqlcmd.Dispose();
            Cnn.Close();
            Strsql = string.Empty;
        }
コード例 #15
0
ファイル: FrmPayments.cs プロジェクト: L10Messi10/APCPOS
        private async void printReceiptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_payments < AmountDue)
            {
                //    var msg = new T_Message();
                //    var ok = new Frm_OK();
                //    ok.OkDescription = "Error";
                //    ok.msgtxt.Text = @"Insufficient amount! Please check and try again!";
                //    ok.titletxt.Text = @"Error";
                //    msg.Show(this);
                //    ok.ShowDialog();
                //    msg.Close();
                //    Focus();
                //PopupNotifier popup=new PopupNotifier();
                popup.TitleText   = "Error";
                popup.ContentText = "Insufficient amount! Please check and try again!";
                popup.Popup();
            }
            else
            {
                var tQuestion = new T_Question();
                var question  = new Frm_Question();
                question.titletxt.Text = @"Confirmation";
                question.msgtxt.Text   = @"This action will save this transaction. Do you want to continue this transaction?";
                tQuestion.Show(this);
                question.ShowDialog();
                tQuestion.Close();
                Focus();
                if (question.DialogResult != DialogResult.Yes)
                {
                    return;
                }
                //*******Print receipt********************
                UseWaitCursor = true;
                if (!Hascustomer)
                {
                    Sqlcmd.Parameters.Clear();
                    await Conopen();

                    Strsql =
                        "Update tbl_Transaction set inv_amnt_due=@inv_amnt_due, inv_tax=@inv_tax,inv_tax_tot=@inv_tax_tot,Inv_Money_Render=@Inv_Money_Render, Inv_Change=@Inv_Change, Inv_total=@Inv_total, Inv_Num_of_items=@Inv_Num_of_items, tran_stat=@tran_stat Where Inv_Num=@Inv_Num";
                    Sqlcmd.Parameters.AddWithValue("@inv_amnt_due",
                                                   Convert.ToSingle(lblsubtotal.Text));
                    Sqlcmd.Parameters.AddWithValue("@inv_tax",
                                                   Convert.ToSingle(lbltax.Text));
                    Sqlcmd.Parameters.AddWithValue("@inv_tax_tot",
                                                   Convert.ToSingle(lbltotaltax.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Money_Render",
                                                   Convert.ToSingle(numericUpDown1.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Change",
                                                   Convert.ToSingle(lblchange.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_total",
                                                   Convert.ToSingle(AmountDue));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Num_of_items",
                                                   Convert.ToInt32(Totitems));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Num",
                                                   lblinvoice.Text);
                    Sqlcmd.Parameters.AddWithValue("@tran_stat",
                                                   "Cash");
                    Sqlcmd.Connection  = Cnn;
                    Sqlcmd.CommandText = Strsql;
                    Sqlcmd.ExecuteNonQuery();
                    Sqlcmd.Dispose();
                    Strsql = "";
                    Cnn.Close();
                    //*********retrieve product sold to deduct to products table
                    await XretriveProduct();

                    popup.TitleText   = @"Success";
                    popup.ContentText = @"Transaction successful!";
                    popup.Popup();
                    var frmReports = new FrmReports {
                        StrReport = "Receipt", PrintWhere = ("{V_Receipt.Inv_Num} ='" + lblinvoice.Text + "'")
                    };
                    frmReports.ShowDialog();
                    frmReports.Close();
                    timer1.Stop();
                    NewTrans         = true;
                    FillCart         = true;
                    CustomerRetrieve = false;
                    CustomerId       = null;
                    Hascustomer      = false;
                    UseWaitCursor    = false;
                    Dispose();
                }
                else
                {
                    Sqlcmd.Parameters.Clear();
                    await Conopen();

                    Strsql =
                        "Update tbl_Transaction set inv_amnt_due=@inv_amnt_due, inv_tax=@inv_tax,inv_tax_tot=@inv_tax_tot,Inv_Money_Render=@Inv_Money_Render, Inv_Change=@Inv_Change, Inv_total=@Inv_total, Inv_Num_of_items=@Inv_Num_of_items, tran_stat=@tran_stat, cus_ID=@cus_ID Where Inv_Num=@Inv_Num";
                    Sqlcmd.Parameters.AddWithValue("@inv_amnt_due",
                                                   Convert.ToSingle(lblsubtotal.Text));
                    Sqlcmd.Parameters.AddWithValue("@inv_tax",
                                                   Convert.ToSingle(lbltax.Text));
                    Sqlcmd.Parameters.AddWithValue("@inv_tax_tot",
                                                   Convert.ToSingle(lbltotaltax.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Money_Render",
                                                   Convert.ToSingle(numericUpDown1.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Change",
                                                   Convert.ToSingle(lblchange.Text));
                    Sqlcmd.Parameters.AddWithValue("@Inv_total",
                                                   Convert.ToSingle(AmountDue));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Num_of_items",
                                                   Convert.ToInt32(Totitems));
                    Sqlcmd.Parameters.AddWithValue("@Inv_Num",
                                                   lblinvoice.Text);
                    Sqlcmd.Parameters.AddWithValue("@tran_stat",
                                                   "Cash");
                    Sqlcmd.Parameters.AddWithValue("@cus_ID",
                                                   CustomerId);
                    Sqlcmd.Connection  = Cnn;
                    Sqlcmd.CommandText = Strsql;
                    Sqlcmd.ExecuteNonQuery();
                    Sqlcmd.Dispose();
                    Strsql = "";
                    Cnn.Close();
                    //*********retrieve product sold to deduct to products table
                    await XretriveProduct();

                    popup.TitleText   = @"Success";
                    popup.ContentText = @"Transaction successful!";
                    popup.Popup();
                    var frmReports = new FrmReports {
                        StrReport = "Receipt_Customer", PrintWhere = ("{V_Receipt_Customer.Inv_Num} ='" + lblinvoice.Text + "'")
                    };
                    frmReports.ShowDialog();
                    frmReports.Close();
                    timer1.Stop();
                    NewTrans         = true;
                    FillCart         = true;
                    CustomerRetrieve = false;
                    CustomerId       = null;
                    Hascustomer      = false;
                    UseWaitCursor    = false;
                    Dispose();
                }
            }
        }