// CUSTOMER

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["OrderNum"] != null && !IsPostBack)
            {
                lblONum.Text = Session["OrderNum"].ToString();
                orderNum     = lblONum.Text;

                CsReceipt recept = new CsReceipt(orderNum, reTable, toTable);
                ConnectionClass.DisplayReceipt(recept);


                GridView1.DataSource = recept.ReceiptTable;
                GridView1.DataBind();


                lblTQty.Text   = recept.TotalTable.Rows[0][0].ToString();
                lblTAmt.Text   = recept.TotalTable.Rows[0][1].ToString();
                lblTTax.Text   = recept.TotalTable.Rows[0][2].ToString();
                lblGTotal.Text = recept.TotalTable.Rows[0][3].ToString();

                CsReceiptInfo info = new CsReceiptInfo(orderNum, ceTable);
                ConnectionClass.ViewCustomer(info);

                lblCInfo.Text = info.CustomerInfo.Rows[0][2].ToString() + " " +
                                info.CustomerInfo.Rows[0][3].ToString();
                lblDate.Text = info.CustomerInfo.Rows[0][1].ToString();
            }
        }
        public static void ViewCustomer(CsReceiptInfo vinfo)
        {
            string iQuery = string.Format(@"
SELECT TOP 1
O.ORDERCUSTOMERNO AS CUSTOMERNO,
CONVERT(VARCHAR(11),CONVERT(DATE,O.ORDERDATE)) AS ORDERDATE,
(C.FNAME + ' ' + C.LNAME) AS NAME,
C.Email AS EMAIL
FROM TBLORDER O 
JOIN TBLORDERITEM OI ON O.ORDERNO = OI.ORDERID
JOIN TBLCUSTOMER C ON O.ORDERCUSTOMERNO = C.CUSTOMERID
WHERE O.ORDERNO = ('{0}')", vinfo.OrderNum);

            cmdString = new SqlCommand(iQuery, cntString);


            try
            {
                cntString.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmdString);
                DataSet        ds = new DataSet();
                da.Fill(ds);
                vinfo.CustomerInfo = ds.Tables[0];
            }
            catch
            {
            }
            finally
            {
                cntString.Close();
            }
        }