// 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 DisplayReceipt(CsReceipt receipt)
        {
            string aQuery = string.Format
                                (@"SELECT orderItemID AS CODE,ITEMNAME AS 'ITEM NAME', 
PRICE='$'+ CONVERT(VARCHAR,OrderItemUPrice),
orderItemQty AS 'QTY',
AMOUNT='$'+ CONVERT(VARCHAR,OrderItemPrice),
TAX='$'+ CONVERT(VARCHAR,OrderItemTax)
FROM TBLORDERITEM JOIN TBLITEM ON ORDERITEMID = ITEMID WHERE ORDERID=('{0}');

SELECT SUM(OrderitemQty) AS TOTALQTY,
TOTALAMOUNT='$'+ CONVERT(VARCHAR,SUM(OrderItemPrice)),
TOTALTAX='$'+ CONVERT(VARCHAR,SUM(OrderItemTax)),
GRANDTOTAL='$'+CONVERT(VARCHAR,(SUM(orderitemtax) + SUM(orderItemPrice))),
CONVERT(VARCHAR(20),GETDATE() AT TIME ZONE 'UTC' AT TIME ZONE 'Eastern Standard Time',100) AS ORDERDATE
FROM tblOrderItem WHERE ORDERID = ('{0}')", receipt.OrderNum);

            cmdString = new SqlCommand(aQuery, cntString);

            try
            {
                cntString.Open();
                SqlDataAdapter da = new SqlDataAdapter(cmdString);
                DataSet        ds = new DataSet();
                da.Fill(ds);

                receipt.ReceiptTable = ds.Tables[0];
                receipt.TotalTable   = ds.Tables[1];
            }

            finally
            {
                cntString.Close();
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ONUM"] != null && Session["CNAME"] != null && !IsPostBack)
            {
                lblONum.Text  = Session["ONUM"].ToString();
                lblCName.Text = Session["CNAME"].ToString();
                lblCNum.Text  = Session["CNUM"].ToString();

                Cnum = Session["CNUM"].ToString();

                orderNum = lblONum.Text;

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


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

                    CsCustomer thisCustomer = new CsCustomer(Cnum, CFname, CLname, CAddress, Ccity, Cprovince, CPcode,
                                                             CPhone, CEmail, CNote, CRDate, Clv);
                    ConnectionClass.GetCustomerDetail(thisCustomer);

                    lblCEmail.Text = thisCustomer.cEmail;

                    lblOrderDate.Text = recept.TotalTable.Rows[0][4].ToString();
                    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();
                }

                catch
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('error');</script>");
                }
                finally
                {
                }
            }



            else
            {
                //ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('No Order');</script>");
            }
        }