public static void DisplayInvoice(CsInvoice invoice) { string iQuery = string.Format(@" SELECT O.ORDERNO AS ORDERNO, O.ORDERCUSTOMERNO AS CUSTOMERNO, CONVERT(VARCHAR(11),CONVERT(DATE,O.ORDERDATE)) AS ORDERDATE, (C.FNAME + ' ' + C.LNAME) AS NAME, SUM(OI.ORDERITEMQTY) AS QTY, FORMAT(SUM(OI.ORDERITEMUPRICE * OI.ORDERITEMQTY),'C','EN-US') AS NET, FORMAT(SUM(OI.ORDERITEMUPRICE * OI.ORDERITEMQTY + OI.ORDERITEMTAX),'C','EN-US') AS GROSS FROM TBLORDER O JOIN TBLORDERITEM OI ON O.ORDERNO = OI.ORDERID JOIN TBLCUSTOMER C ON O.ORDERCUSTOMERNO = C.CUSTOMERID GROUP BY O.ORDERNO,O.ORDERCUSTOMERNO,(C.FNAME + ' ' + C.LNAME),O.ORDERDATE ORDER BY O.ORDERNO DESC;"); cmdString = new SqlCommand(iQuery, cntString); try { cntString.Open(); SqlDataAdapter da = new SqlDataAdapter(cmdString); DataSet ds = new DataSet(); da.Fill(ds); invoice.InvoiceList = ds.Tables[0]; } finally { cntString.Close(); } }
// WHOLE LIST public void InvoiceListView() { CsInvoice list = new CsInvoice(InvoiceTable); try { ConnectionClass.DisplayInvoice(list); InvoiceList.DataSource = list.InvoiceList; InvoiceList.DataBind(); } catch { TEST.Text = "Error Occured, Please try reloading page. Sorry for inconvenience"; } finally { } }