Exemple #1
0
 public int FillByWhere(PurchasedProducts.SalesDetailDataTable dataTable, string where)
 {
     try
     {
         if (this._commandCollection == null)
         {
             this.InitCommandCollection();
         }
         this._commandCollection[0].CommandText  = @"select sih.invoicenumber,cus.name as CustomerName,soh.OrderDate as InvoiceDate,
                                             prd.Description as  ProductName,sod.OrderQty as Quantity,sod.UnitPrice,
                                             sum(sod.unitpricediscount) as Discount,
                                             sum(sod.linetotal)as LineTotal
                                             from SalesOrderHeader soh
                                             join salesorderdetail sod on sod.salesorderid=soh.salesorderid
                                             join product prd on prd.productid=sod.productid
                                             join Customer cus on cus.customerid=soh.customerid
                                             join salesterritory ter on cus.territoryid=ter.territoryid
                                             join salesinvoiceheader sih on soh.salesorderid=sih.saleorderid
                                             join productsubcategory sub on sub.productsubcategoryid=prd.productsubcategoryid
                                             join productcategory cat on cat.productcategoryid=sub.productcategoryid";
         this._commandCollection[0].CommandText += " where soh.status not in(1,6) and " + where;
         //where soh.OrderDate>='07/01/2008' and soh.orderdate <='07/31/2008'
         this._commandCollection[0].CommandText   += @" group by sih.invoicenumber,cus.name,soh.OrderDate,prd.description,sod.OrderQty,sod.UnitPrice
                                                  order by cus.name desc";
         this._commandCollection[0].CommandTimeout = 120;
         return(this.Fill(dataTable));
     }
     catch (Exception ex)
     {
         throw(ex);
     }
 }
 private void rptView_Drillthrough(object sender, DrillthroughEventArgs e)
 {
     try
     {
         LocalReport DetailReport = (LocalReport)e.Report;
         MICS.Reports.PurchasedProducts.SalesDetailDataTable r = new PurchasedProducts.SalesDetailDataTable();
         MICS.Reports.PurchasedProductsTableAdapters.SalesDetailsTableAdapter ad = new MICS.Reports.PurchasedProductsTableAdapters.SalesDetailsTableAdapter();
         ad.SetTimeOut = 120;
         ReportParameterInfoCollection p = DetailReport.GetParameters();
         string name       = p[0].Name;
         string ParamValue = p[0].Values[0];
         ad.FillByWhere(this.PurchasedProducts.SalesDetail, ParamValue);
         DetailReport.DataSources.Add(new ReportDataSource("PurchasedProducts_SalesDetail", ad.GetData()));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }