Beispiel #1
0
        /// <summary>
        /// Returns a Data Set containing multiple Data Tables reresenting sub-reports table structures.
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static DataSet ACGReport(ReportParameters parameters)
        {
            OApplicationSetting appconfig = OApplicationSetting.Current;
            DataSet ACGDataSet = new DataSet("ACG Report");

            DateTime? filterYTD = parameters.GetDateTime("FILTER_YTD");
            DateTime YTD = (filterYTD != null) ? filterYTD.Value : DateTime.Now;

            Guid filterLocation = new Guid(parameters.GetString("FILTER_Location"));
            OLocation location = TablesLogic.tLocation.Load(filterLocation);
            DataTable LocationName = new DataTable();
            LocationName.Columns.Add("Location", typeof(string));
            LocationName.Rows.Add(location.ObjectName.ToUpper());
            LocationName.TableName = "Location";

            DataTable BudgetDetailSummaryRRAccounts = BudgetDetailSummaryReport(location, YTD, "Repairs & Replacements", true, 0);
            DataTable BudgetDetailSummaryMiscAccounts = BudgetDetailSummaryReport(location, YTD, "Miscellaneous", false, 0);
            DataTable BudgetDetailSummaryStatutoryAccounts = BudgetDetailSummaryReport(location, YTD, "Statutory Fee", true, 0);

            DataTable BudgetDetailSummary = BudgetDetailSummaryRRAccounts.Clone();
            BudgetDetailSummary.Merge(BudgetDetailSummaryRRAccounts);
            BudgetDetailSummary.Merge(BudgetDetailSummaryMiscAccounts);
            BudgetDetailSummary.Merge(BudgetDetailSummaryStatutoryAccounts);

            DataTable BudgetDetailSummaryTenancyAccount = BudgetDetailSummaryReport(location, YTD, "Tenancy Works", false, 0);
            BudgetDetailSummaryTenancyAccount.TableName = "BudgetDetailSummaryTenancyAccount";

            DataTable BudgetDetailSummaryTermContractAccount = BudgetDetailSummaryReport(location, YTD, "Term Contract", true, 0);
            BudgetDetailSummaryTermContractAccount.TableName = "BudgetDetailSummaryTermContractAccount";

            DataTable Capex = CapexReport(location, YTD);

            //DataTable PreventiveMaintenanceProgramme = PreventiveMaintenanceReport(YTD);
            DataTable PreventiveMaintenanceProgramme = new DataTable("PreventiveMaintenanceProgramme");

            DataTable ServiceContracts = ServiceContractsReport(location, YTD);

            DataTable ServiceToTenants = ServiceToTenantsReport(location, YTD);

            ACGDataSet.Tables.Add(BudgetDetailSummary);
            ACGDataSet.Tables.Add(Capex);
            ACGDataSet.Tables.Add(PreventiveMaintenanceProgramme);
            ACGDataSet.Tables.Add(ServiceContracts);
            ACGDataSet.Tables.Add(ServiceToTenants);
            ACGDataSet.Tables.Add(new DataTable("Dummy"));
            ACGDataSet.Tables.Add(LocationName);
            ACGDataSet.Tables.Add(BudgetDetailSummaryTenancyAccount);
            ACGDataSet.Tables.Add(BudgetDetailSummaryTermContractAccount);

            return ACGDataSet;
        }
Beispiel #2
0
        public static DataTable GetVendorReport(ReportParameters parameters)
        {
            DataTable dtReturn = new DataTable();
            dtReturn.Columns.Add("Vendor Name", typeof(string));
            dtReturn.Columns.Add("Vendor Type", typeof(string));
            dtReturn.Columns.Add("Vendor Classification", typeof(string));
            dtReturn.Columns.Add("Operation Address", typeof(string));
            dtReturn.Columns.Add("Operation Cellphone", typeof(string));
            dtReturn.Columns.Add("Operation Email", typeof(string));
            dtReturn.Columns.Add("Operation Phone", typeof(string));
            dtReturn.Columns.Add("Operation Contact Person", typeof(string));
            dtReturn.Columns.Add("Debarred", typeof(string));
            dtReturn.Columns.Add("Debarment Start", typeof(DateTime));
            dtReturn.Columns["Debarment Start"].ExtendedProperties["DataFormatString"] = "{0:dd-MMM-yyyy}";
            dtReturn.Columns.Add("Debarment End", typeof(DateTime));
            dtReturn.Columns["Debarment End"].ExtendedProperties["DataFormatString"] = "{0:dd-MMM-yyyy}";
            dtReturn.Columns.Add("Billing Location Contact Person", typeof(string));
            dtReturn.Columns.Add("Billing Location Address", typeof(string));
            dtReturn.Columns.Add("Billing Location Phone", typeof(string));
            dtReturn.Columns.Add("Billing Location Country", typeof(string));
            dtReturn.Columns.Add("Billing Location State", typeof(string));
            dtReturn.Columns.Add("Billing Location City", typeof(string));
            dtReturn.Columns.Add("Billing Location Cellphone", typeof(string));
            dtReturn.Columns.Add("Billing Location Email", typeof(string));
            dtReturn.Columns.Add("Billing Location Fax", typeof(string));
            dtReturn.Columns.Add("Operation Location Country", typeof(string));
            dtReturn.Columns.Add("Operation Location State", typeof(string));
            dtReturn.Columns.Add("Operating Location City", typeof(string));
            dtReturn.Columns.Add("Operation Location Fax", typeof(string));

            DataTable dt = TablesLogic.tVendor.SelectDistinct(
                    TablesLogic.tVendor.ObjectID,
                    TablesLogic.tVendor.ObjectName,
                    TablesLogic.tVendor.VendorClassification.ObjectName.As("VendorClassification"),
                    TablesLogic.tVendor.OperatingAddress,
                    TablesLogic.tVendor.OperatingCellPhone,
                    TablesLogic.tVendor.OperatingEmail,
                    TablesLogic.tVendor.OperatingPhone,
                    TablesLogic.tVendor.OperatingContactPerson,
                    TablesLogic.tVendor.IsDebarred,
                    TablesLogic.tVendor.DebarmentStartDate,
                    TablesLogic.tVendor.DebarmentEndDate,
                    TablesLogic.tVendor.BillingContactPerson,
                    TablesLogic.tVendor.BillingAddress,
                    TablesLogic.tVendor.BillingPhone,
                    TablesLogic.tVendor.BillingAddressCountry,
                    TablesLogic.tVendor.BillingAddressState,
                    TablesLogic.tVendor.BillingAddressCity,
                    TablesLogic.tVendor.BillingCellPhone,
                    TablesLogic.tVendor.BillingEmail,
                    TablesLogic.tVendor.BillingFax,
                    TablesLogic.tVendor.OperatingAddressCountry,
                    TablesLogic.tVendor.OperatingAddressState,
                    TablesLogic.tVendor.OperatingAddressCity,
                    TablesLogic.tVendor.OperatingFax)
                    .Where(
                    TablesLogic.tVendor.IsDeleted == 0
                    & (parameters.GetString("FILTER_DEBARRED") == "" ? Query.True : TablesLogic.tVendor.IsDebarred == parameters.GetString("FILTER_DEBARRED"))
                    & (parameters.GetString("FILTER_DEBARMENTSTARTFROM") == "" ? Query.True : TablesLogic.tVendor.DebarmentStartDate >= parameters.GetDateTime("FILTER_DEBARMENTSTARTFROM"))
                    & (parameters.GetString("FILTER_DEBARMENTSTARTTO") == "" ? Query.True : TablesLogic.tVendor.DebarmentStartDate <= parameters.GetDateTime("FILTER_DEBARMENTSTARTTO"))
                    & (parameters.GetString("FILTER_DEBARMENTENDFROM") == "" ? Query.True : TablesLogic.tVendor.DebarmentEndDate >= parameters.GetDateTime("FILTER_DEBARMENTENDFROM"))
                    & (parameters.GetString("FILTER_DEBARMENTENDTO") == "" ? Query.True : TablesLogic.tVendor.DebarmentEndDate <= parameters.GetDateTime("FILTER_DEBARMENTENDTO"))
                    & TablesLogic.tVendor.OperatingAddress.Like("%" + parameters.GetString("FILTER_OPERATIONADDRESS") + "%")
                    & TablesLogic.tVendor.BillingAddress.Like("%" + parameters.GetString("FILTER_BILLINGADDRESS") + "%")
                    & TablesLogic.tVendor.ObjectName.Like("%" + parameters.GetString("FILTER_VENDORNAME") + "%")
                    & (parameters.GetString("FILTER_VENDORTYPE") == "" ? Query.True : TablesLogic.tVendor.VendorTypes.ObjectID == parameters.GetString("FILTER_VENDORTYPE"))
                    & (parameters.GetString("FILTER_VENDORCLASSIFICATION") == "" ? Query.True : TablesLogic.tVendor.VendorClassificationID == parameters.GetString("FILTER_VENDORCLASSIFICATION"))
                   );

            foreach (DataRow row in dt.Rows)
            {
                DataRow returnRow = dtReturn.NewRow();
                returnRow["Vendor Name"] = row["ObjectName"];
                returnRow["Vendor Classification"] = row["VendorClassification"];
                returnRow["Operation Address"] = row["OperatingAddress"];
                returnRow["Operation Cellphone"] = row["OperatingCellPhone"];
                returnRow["Operation Email"] = row["OperatingEmail"];
                returnRow["Operation Phone"] = row["OperatingPhone"];
                returnRow["Operation Contact Person"] = row["OperatingContactPerson"];
                if (row["IsDebarred"].ToString() == "1")
                    returnRow["Debarred"] = "Yes";
                if (row["IsDebarred"].ToString() == "0")
                    returnRow["Debarred"] = "No";
                returnRow["Debarment Start"] = row["DebarmentStartDate"];
                returnRow["Debarment End"] = row["DebarmentEndDate"];
                returnRow["Billing Location Contact Person"] = row["BillingContactPerson"];
                returnRow["Billing Location Address"] = row["BillingAddress"];
                returnRow["Billing Location Phone"] = row["BillingPhone"];
                returnRow["Billing Location Country"] = row["BillingAddressCountry"];
                returnRow["Billing Location State"] = row["BillingAddressState"];
                returnRow["Billing Location City"] = row["BillingAddressCity"];
                returnRow["Billing Location Cellphone"] = row["BillingCellPhone"];
                returnRow["Billing Location Email"] = row["BillingEmail"];
                returnRow["Billing Location Fax"] = row["BillingFax"];
                returnRow["Operation Location Country"] = row["OperatingAddressCountry"];
                returnRow["Operation Location State"] = row["OperatingAddressState"];
                returnRow["Operating Location City"] = row["OperatingAddressCity"];
                returnRow["Operation Location Fax"] = row["OperatingFax"];

                OVendor vendortype = TablesLogic.tVendor[new Guid(row["ObjectID"].ToString())];

                string vendortypestring = "";
                foreach (OCode codename in vendortype.VendorTypes)
                {
                    vendortypestring = vendortypestring + codename.ObjectName + ", ";
                }
                if(vendortypestring != "")
                    returnRow["Vendor Type"] = vendortypestring.Remove(vendortypestring.Length - 2);

                dtReturn.Rows.Add(returnRow);
            }
            return dtReturn;
        }
Beispiel #3
0
        public static DataTable GetContractReport(ReportParameters parameters)
        {
            DataTable dtReturn = new DataTable();
            dtReturn.Columns.Add("Contract Name", typeof(string));
            dtReturn.Columns["Contract Name"].ExtendedProperties["Width"] = "500px";
            dtReturn.Columns.Add("Contract Description", typeof(string));
            dtReturn.Columns["Contract Description"].ExtendedProperties["Width"] = "500px";
            dtReturn.Columns.Add("Contract Start Date", typeof(DateTime));
            dtReturn.Columns["Contract Start Date"].ExtendedProperties["DataFormatString"] = "{0:dd-MMM-yyyy}";
            dtReturn.Columns.Add("Contract End Date", typeof(DateTime));
            dtReturn.Columns["Contract End Date"].ExtendedProperties["DataFormatString"] = "{0:dd-MMM-yyyy}";
            dtReturn.Columns.Add("Contract Terms", typeof(string));
            dtReturn.Columns.Add("Contract Warranty", typeof(string));
            dtReturn.Columns.Add("Contract Sum($)", typeof(decimal));
            dtReturn.Columns.Add("Contract Manager", typeof(string));
            dtReturn.Columns.Add("Contact Person Name", typeof(string));
            dtReturn.Columns.Add("Contact Person Cellphone", typeof(string));
            dtReturn.Columns.Add("Contact Person Email", typeof(string));
            dtReturn.Columns.Add("Provide Adhoc Maintenance", typeof(string));
            dtReturn.Columns.Add("Locations", typeof(string));
            dtReturn.Columns["Locations"].ExtendedProperties["Width"] = "500px";
            dtReturn.Columns.Add("Type of Services", typeof(string));
            dtReturn.Columns["Type of Services"].ExtendedProperties["Width"] = "500px";
            dtReturn.Columns.Add("Provide Purchasing Agreement", typeof(string));
            dtReturn.Columns.Add("Materials Agreement", typeof(string));
            dtReturn.Columns["Materials Agreement"].ExtendedProperties["Width"] = "500px";
            dtReturn.Columns.Add("Service Agreement", typeof(string));
            dtReturn.Columns["Service Agreement"].ExtendedProperties["Width"] = "800px";
            dtReturn.Columns.Add("Vendor Name", typeof(string));
            dtReturn.Columns.Add("Vendor Type", typeof(string));
            dtReturn.Columns.Add("Vendor Classification", typeof(string));


            dtReturn.Columns.Add("Contact Person Fax", typeof(string));
            dtReturn.Columns.Add("Contact Person Phone", typeof(string));
            dtReturn.Columns.Add("Person 1 To Remind", typeof(string));
            dtReturn.Columns.Add("Person 2 To Remind", typeof(string));
            dtReturn.Columns.Add("Person 3 To Remind", typeof(string));
            dtReturn.Columns.Add("Person 4 To Remind", typeof(string));

            dtReturn.Columns.Add("Reminder Days 1", typeof(int));
            dtReturn.Columns.Add("Reminder Days 2", typeof(int));
            dtReturn.Columns.Add("Reminder Days 3", typeof(int));
            dtReturn.Columns.Add("Reminder Days 4", typeof(int));

            ExpressionCondition cond = GetAccessibleCondition(parameters.GetString("UserID"),true, TablesLogic.tContract.Locations.HierarchyPath, "");
            if (cond == null)
                cond = Query.False;

            DataTable dt = TablesLogic.tContract.SelectDistinct(TablesLogic.tContract.ObjectID,
                                TablesLogic.tContract.ObjectName,
                                TablesLogic.tContract.Description,
                                TablesLogic.tContract.ContractStartDate,
                                TablesLogic.tContract.ContractEndDate,
                                TablesLogic.tContract.Terms,
                                TablesLogic.tContract.Warranty,
                                TablesLogic.tContract.ContractSum,
                                TablesLogic.tContract.ContractManager.ObjectName.As("Manager"),
                                TablesLogic.tContract.ContactPerson,
                                TablesLogic.tContract.ContactCellphone,
                                TablesLogic.tContract.ContactPhone,
                                TablesLogic.tContract.ContactEmail,
                                TablesLogic.tContract.ContactFax,
                                TablesLogic.tContract.Reminder1User.ObjectName.As("User1"),
                                TablesLogic.tContract.Reminder2User.ObjectName.As("User2"),
                                TablesLogic.tContract.Reminder3User.ObjectName.As("User3"),
                                TablesLogic.tContract.Reminder4User.ObjectName.As("User4"),
                                TablesLogic.tContract.EndReminderDays1,
                                TablesLogic.tContract.EndReminderDays2,
                                TablesLogic.tContract.EndReminderDays3,
                                TablesLogic.tContract.EndReminderDays4,
                                TablesLogic.tContract.Vendor.ObjectName.As("Vendor"),
                                TablesLogic.tContract.Vendor.VendorClassification.ObjectName.As("VendorClassification"),
                                TablesLogic.tContract.ProvideMaintenance,
                                TablesLogic.tContract.ProvidePricingAgreement)
                        .Where(TablesLogic.tContract.IsDeleted == 0
                        & TablesLogic.tContract.ObjectName.Like("%" + parameters.GetString("FILTER_CONTRACTNAME") + "%")
                        & TablesLogic.tContract.Description.Like("%" + parameters.GetString("FILTER_DESCRIPTION") + "%")
                        & TablesLogic.tContract.Terms.Like("%" + parameters.GetString("FILTER_TERMS") + "%")
                         & TablesLogic.tContract.Insurance.Like("%" + parameters.GetString("FILTER_INSURANTCE") + "%")
                        & TablesLogic.tContract.Warranty.Like("%" + parameters.GetString("FILTER_WARRANTY") + "%")
                        & TablesLogic.tContract.Vendor.ObjectName.Like("%" + parameters.GetString("FILTER_VENDORNAME") + "%")
                        & (parameters.GetString("FILTER_CONTRACTSTARTFROM") == "" ? Query.True :
                            TablesLogic.tContract.ContractStartDate >= parameters.GetDateTime("FILTER_CONTRACTSTARTFROM"))
                         & (parameters.GetString("FILTER_CONTRACTSTARTTO") == "" ? Query.True :
                            TablesLogic.tContract.ContractStartDate < parameters.GetDateTime("FILTER_CONTRACTSTARTTO").Value.AddDays(1))
                        & (parameters.GetString("FILTER_CONTRACTENDFROM") == "" ? Query.True :
                            TablesLogic.tContract.ContractEndDate >= parameters.GetDateTime("FILTER_CONTRACTENDFROM"))
                         & (parameters.GetString("FILTER_CONTRACTENDTO") == "" ? Query.True :
                            TablesLogic.tContract.ContractEndDate < parameters.GetDateTime("FILTER_CONTRACTENDTO").Value.AddDays(1))
                         & (parameters.GetString("FILTER_CONTRACTSUMFROM") == "" ? Query.True :
                            TablesLogic.tContract.ContractSum >= parameters.GetDecimal("FILTER_CONTRACTSUMFROM"))
                        & (parameters.GetString("FILTER_CONTRACTSUMTO") == "" ? Query.True :
                           TablesLogic.tContract.ContractSum <= parameters.GetDecimal("FILTER_CONTRACTSUMTO"))
                        & (parameters.GetString("TreeviewID") == "" ? cond :
                            TablesLogic.tContract.Locations.HierarchyPath.Like(TablesLogic.tLocation.Load(new Guid(parameters.GetString("TreeviewID"))).HierarchyPath + "%"))
                        & (parameters.GetString("FILTER_CONTRACTEXPIRED") == "" ? Query.True :
                            TablesLogic.tContract.ContractEndDate <= DateTime.Now.AddMonths(parameters.GetInteger("FILTER_CONTRACTEXPIRED").Value))
                        & (parameters.GetString("FILTER_SHOWCLOSEDCONTRACT") == "" ? TablesLogic.tContract.CurrentActivity.ObjectName != "CONTRACT_CLOSED" :
                            Query.True)
                        & (parameters.GetString("FILTER_VENDORTYPE") == "" ? Query.True : TablesLogic.tContract.Vendor.VendorTypes.ObjectID == parameters.GetString("FILTER_VENDORTYPE"))
                        & (parameters.GetString("FILTER_VENDORCLASSIFICATION") == "" ? Query.True : TablesLogic.tContract.Vendor.VendorClassificationID == parameters.GetString("FILTER_VENDORCLASSIFICATION")));

            foreach (DataRow row in dt.Rows)
            {
                DataRow returnRow = dtReturn.NewRow();
                returnRow["Contract Name"] = row["ObjectName"];
                returnRow["Contract Description"] = row["Description"];
                returnRow["Contract Start Date"] = row["ContractStartDate"];
                returnRow["Contract End Date"] = row["ContractEndDate"];
                returnRow["Contract Terms"] = row["Terms"];
                returnRow["Contract Warranty"] = row["Warranty"];
                returnRow["Contract Sum($)"] = row["ContractSum"];
                returnRow["Contract Manager"] = row["Manager"];
                returnRow["Contact Person Name"] = row["ContactPerson"];
                returnRow["Contact Person Cellphone"] = row["ContactCellphone"];
                returnRow["Contact Person Email"] = row["ContactEmail"];


                returnRow["Contact Person Fax"] = row["ContactFax"];
                returnRow["Contact Person Phone"] = row["ContactPhone"];
                returnRow["Person 1 To Remind"] = row["User1"];
                returnRow["Person 2 To Remind"] = row["User2"];
                returnRow["Person 3 To Remind"] = row["User3"];
                returnRow["Person 4 To Remind"] = row["User4"];

                returnRow["Reminder Days 1"] = row["EndReminderDays1"];
                returnRow["Reminder Days 2"] = row["EndReminderDays2"];
                returnRow["Reminder Days 3"] = row["EndReminderDays3"];
                returnRow["Reminder Days 4"] = row["EndReminderDays4"];
                returnRow["Vendor Name"] = row["Vendor"];
                returnRow["Vendor Classification"] = row["VendorClassification"];

               
                OContract contract = TablesLogic.tContract[new Guid(row["ObjectID"].ToString())];


                string vendortypestring = "";
                foreach (OCode codename in contract.Vendor.VendorTypes)
                {
                    vendortypestring = vendortypestring + codename.ObjectName + ", ";
                }
                if (vendortypestring != "")
                    returnRow["Vendor Type"] = vendortypestring.Remove(vendortypestring.Length - 2);


                //Retrieve all locations, type of services,. of the contract
                if (row["ProvideMaintenance"] != DBNull.Value && row["ProvideMaintenance"].ToString() == "1")
                {
                    returnRow["Provide Adhoc Maintenance"] = Resources.Strings.General_Yes;

                    string locations = "";
                    foreach (OLocation loc in contract.Locations)
                    {
                        if (locations == "")
                            locations = loc.Path;
                        else
                            locations += ", " + loc.Path;
                    }
                    returnRow["Locations"] = locations;

                    string services = "";
                    foreach (OCode code in contract.TypeOfServices)
                    {
                        if (services == "")
                            services = code.Path;
                        else
                            services += ", " + code.Path;
                    }
                    returnRow["Type of Services"] = services;
                }
                else
                    returnRow["Provide Adhoc Maintenance"] = Resources.Strings.General_No;

                if (row["ProvidePricingAgreement"] != DBNull.Value && row["ProvidePricingAgreement"].ToString() == "1")
                {
                    returnRow["Provide Purchasing Agreement"] = Resources.Strings.General_Yes;
                    string materials = "";
                    foreach (OContractPriceMaterial contractMat in contract.ContractPriceMaterials)
                    {
                        if (materials == "")
                            materials = contractMat.Catalogue.Path;
                        else
                            materials += ", " + contractMat.Catalogue.Path;
                    }
                    returnRow["Materials Agreement"] = materials;

                    string services = "";
                    foreach (OContractPriceService contractSev in contract.ContractPriceServices)
                    {
                        if (services == "")
                            services = contractSev.FixedRate.Path;
                        else
                            services += ", " + contractSev.FixedRate.Path;
                    }
                    returnRow["Service Agreement"] = services;
                }
                else
                    returnRow["Provide Purchasing Agreement"] = Resources.Strings.General_No;

                dtReturn.Rows.Add(returnRow);
            }
            return dtReturn;



        }
Beispiel #4
0
        /// <summary>
        /// caller history report
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static DataTable CallerHistoryReport(ReportParameters parameters)
        {
            DataTable table = new DataTable();
            table.Columns.Add("Location");
            table.Columns.Add("Equipment");
            table.Columns.Add("Created Date", typeof(DateTime));
            table.Columns.Add("Name");
            table.Columns.Add("CellPhone");
            table.Columns.Add("Email");
            table.Columns.Add("Fax");
            table.Columns.Add("Phone");
            table.Columns.Add("Priority");
            table.Columns.Add("Work Description");
            table.Columns.Add("Work Type");
            table.Columns.Add("Type of service");
            table.Columns.Add("Fault Type");
            table.Columns.Add("Cost");
            table.Columns.Add("Chargeable Amount");
            table.Columns.Add("Status");
            table.Columns.Add("Rejection Reason");


            //string strLocationHirachyPath = LocationHirachyPath(parameters.GetString("TreeviewID"));
            DateTime? FILTER_STARTDATEFROM = parameters.GetDateTime("FILTER_STARTDATEFROM");
            DateTime? FILTER_STARTDATETO = parameters.GetDateTime("FILTER_STARTDATETO");
            DateTime? FILTER_ENDDATEFROM = parameters.GetDateTime("FILTER_ENDDATEFROM");
            DateTime? FILTER_ENDDATETO = parameters.GetDateTime("FILTER_ENDDATETO");
            DataTable tempTable = TablesLogic.tWork.Select(
                TablesLogic.tWork.ObjectID,
                TablesLogic.tWork.LocationID,
                TablesLogic.tWork.CreatedDateTime,
                TablesLogic.tWork.CallerName,
                TablesLogic.tWork.CallerCellPhone,
                TablesLogic.tWork.CallerEmail,
                TablesLogic.tWork.CallerFax,
                TablesLogic.tWork.CallerPhone,
                TablesLogic.tWork.Priority,
                TablesLogic.tWork.WorkDescription,
                TablesLogic.tWork.TypeOfWork.ObjectName,
                TablesLogic.tWork.TypeOfService.ObjectName,
                TablesLogic.tWork.TypeOfProblem.ObjectName,
                TablesLogic.tWork.CurrentActivity.ObjectName)
                .Where(TablesLogic.tWork.IsDeleted == 0 &
                //  & TablesLogic.tWork.Location.HierarchyPath.Like(strLocationHirachyPath + "%")
              (parameters.GetString("TreeviewID") == "" ? GetAccessibleCondition(parameters.GetString("UserID"),true, TablesLogic.tWork.Location.HierarchyPath, "") :
               TablesLogic.tWork.Location.HierarchyPath.Like(TablesLogic.tLocation.Load(new Guid(parameters.GetString("TreeviewID"))).HierarchyPath + "%"))
                & (FILTER_STARTDATEFROM <= DateTime.Parse("1/1/1855") ? Query.True :
                TablesLogic.tWork.CreatedDateTime >= parameters.GetDateTime("FILTER_STARTDATEFROM"))
                & (FILTER_STARTDATETO <= DateTime.Parse("1/1/1855") ? Query.True :
                TablesLogic.tWork.CreatedDateTime < parameters.GetDateTime("FILTER_STARTDATETO").Value.AddDays(1))
                & TablesLogic.tWork.CallerName.Like("%" + parameters.GetString("FILTER_CALLERNAME") + "%")
                );
            
            
            foreach (DataRow row in tempTable.Rows)
            {
                OWork work = TablesLogic.tWork[new Guid(row["ObjectID"].ToString())];
                
                switch (parameters.GetInteger("FILTER_CHARGEABLEAMOUNT"))
                {
                    case 1: if ((parameters.GetDecimal("FILTER_COST") == null ? true : work.TotalActualCost == parameters.GetDecimal("FILTER_COST")) && work.TotalChargeOut < 2000)
                            table.Rows.Add(new object[] { row[1].ToString()==null?"":LocationPath(new Guid(row[1].ToString())),
                            row[2].ToString()==""?"":EquipmentPath(new Guid(row[2].ToString())), 
                            row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13],
                            work.TotalActualCost, work.TotalChargeOut, TranslateWorkStatusToString(row[14].ToString()), row[14].ToString()=="WORK_REJECTED" ? row[15].ToString() : ""});
                        break;
                    case 2: if ((parameters.GetDecimal("FILTER_COST") == null ? true : work.TotalActualCost == parameters.GetDecimal("FILTER_COST")) && work.TotalChargeOut <= 5000 && work.TotalChargeOut >= 2000)
                            table.Rows.Add(new object[] { row[1].ToString()==null?"":LocationPath(new Guid(row[1].ToString())),
                            row[2].ToString()==""?"":EquipmentPath(new Guid(row[2].ToString())), 
                            row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13],
                            work.TotalActualCost, work.TotalChargeOut, TranslateWorkStatusToString(row[14].ToString()), row[14].ToString()=="WORK_REJECTED" ? row[15].ToString() : ""});
                        break;
                    case 3: if ((parameters.GetDecimal("FILTER_COST") == null ? true : work.TotalActualCost == parameters.GetDecimal("FILTER_COST")) && work.TotalChargeOut > 5000)
                            table.Rows.Add(new object[] { row[1].ToString()==null?"":LocationPath(new Guid(row[1].ToString())),
                            row[2].ToString()==""?"":EquipmentPath(new Guid(row[2].ToString())), 
                            row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13],
                            work.TotalActualCost, work.TotalChargeOut, TranslateWorkStatusToString(row[14].ToString()), row[14].ToString()=="WORK_REJECTED" ? row[15].ToString() : ""});
                        break;
                    default: if (parameters.GetDecimal("FILTER_COST") == null ? true : work.TotalActualCost == parameters.GetDecimal("FILTER_COST"))
                            table.Rows.Add(new object[] { row[1].ToString()==null?"":LocationPath(new Guid(row[1].ToString())),
                            row[2].ToString()==""?"":EquipmentPath(new Guid(row[2].ToString())), 
                            row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13],
                            work.TotalActualCost, work.TotalChargeOut, TranslateWorkStatusToString(row[14].ToString()), row[14].ToString()=="WORK_REJECTED" ? row[15].ToString() : ""});
                        break;
                }
                
          }
            return table;
        }