public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReport1_Bill rpt = new CrystalReport1_Bill();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnSell_Click(object sender, EventArgs e)
        {
            try
            {
                noOfAllQty = 0;//All Quantity Start Zero

                epCash.Clear();
                epSubTotal.Clear();
                epTotal.Clear();

                if (txtCash.Text != "0.00" && txtTotal.Text != "0.00" && txtSubTotal.Text != "0.00")
                {
                    if (decimal.Parse(txtCash.Text) >= decimal.Parse(txtTotal.Text))
                    {
                        SqlDataReader dr = objInvo.checkExistInvoice(lblInvoiceNo.Text);
                        if (!dr.Read())
                        {
                            //COPY tblInvoiceItems VALUE TO tblInvoBillItem
                            String     copyData = "INSERT INTO tblInvoBillItem SELECT * FROM tblInvoiceItems";
                            SqlCommand cmd      = new SqlCommand(copyData, ConnectionDB.connection());
                            cmd.ExecuteNonQuery();


                            //TOTAL ALL QUANTITY CALCULATE
                            String         sql = "SELECT noOfQty FROM tblInvoiceItems";
                            SqlDataAdapter get = new SqlDataAdapter(sql, ConnectionDB.connection());
                            DataTable      ns  = new DataTable();
                            get.Fill(ns);
                            for (int i = 0; i < ns.Rows.Count; i++)
                            {
                                string qty = ns.Rows[i]["noOfQty"].ToString();
                                noOfAllQty += int.Parse(qty);
                            }


                            //INSERT INVOICE DETAILS
                            objInvo.newInvoce(
                                lblInvoiceNo.Text,
                                DateTime.Today,
                                lblSel.Text,
                                decimal.Parse(txtSubTotal.Text),
                                decimal.Parse(txtTax.Text),
                                decimal.Parse(txtTotal.Text),
                                noOfAllQty,
                                decimal.Parse(txtCash.Text),
                                decimal.Parse(txtChange.Text)
                                );


                            //SELL ITEM REMOVE STOCK
                            String         isql = "SELECT * FROM tblInvoiceItems";
                            SqlDataAdapter iget = new SqlDataAdapter(isql, ConnectionDB.connection());
                            DataTable      idt  = new DataTable();
                            iget.Fill(idt);
                            for (int i = 0; i < idt.Rows.Count; i++)
                            {
                                int nowAllQty = 0;
                                //decimal subtotal = 0.0M;

                                string item_no      = idt.Rows[i]["ItmNo"].ToString();
                                int    noOfQuantity = int.Parse(idt.Rows[i]["noOfQty"].ToString());

                                string        csql = "SELECT * FROM tbl_Item WHERE itemNo='" + item_no + "'";
                                SqlCommand    cmdi = new SqlCommand(csql, ConnectionDB.connection());
                                SqlDataReader dr1  = cmdi.ExecuteReader();
                                while (dr1.Read() == true)
                                {
                                    int     stock_noOfQty       = int.Parse(dr1["noOfQty"].ToString());
                                    decimal old_OneQtySellPrice = decimal.Parse(dr1["OneQtySellPrice"].ToString());

                                    //now stock item
                                    nowAllQty = stock_noOfQty - noOfQuantity;

                                    //stock update
                                    objInvo.update_Quntity(item_no, nowAllQty);

                                    //success
                                    picBxSucc.Visible    = true;
                                    lblSucc.Visible      = true;
                                    picBxNotSucc.Visible = false;
                                    lblNotSucc.Visible   = false;

                                    //reset();
                                }
                            }
                        }
                        billPrint();
                        btnSell.Enabled = false;


                        //frmFinalBill frmBill = new frmFinalBill();
                        //frmBill.ShowDialog();


                        CrystalReport1_Bill objCrystal = new CrystalReport1_Bill();
                        objCrystal.PrintToPrinter(1, false, 0, 0);


                        btnSell.Enabled = true;
                        reset();
                    }
                    else
                    {
                        MessageBox.Show("Please fully payement!", "BILL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    if (txtCash.Text == "0.00")
                    {
                        epCash.SetError(txtCash, "Can not be null.");
                    }
                    if (txtTotal.Text == "0.00")
                    {
                        epSubTotal.SetError(txtSubTotal, "Can not be null.");
                    }
                    if (txtSubTotal.Text == "0.00")
                    {
                        epTotal.SetError(txtTotal, "Can not be null.");
                    }
                    picBxSucc.Visible    = false;
                    lblSucc.Visible      = false;
                    picBxNotSucc.Visible = true;
                    lblNotSucc.Visible   = true;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }