root/c3crm/sugarcrm/trunk/modules/Reports/ReportNames.php

Revision 439 (by jianting, 01/14/06 18:07:36)

Prospect 应该是 Campaign

<?php
 /**
  * Test array for the report class.
  **/
  //require_once("include/language/zh_cn.lang.php");
if(isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '')
{
	$current_language = $_SESSION['authenticated_user_language'];
}
else
{
	$current_language = $sugar_config['default_language'];
}
//require_once("modules/Reports/language/zh_cn.lang.php");
require_once("modules/Reports/language/$current_language.lang.php");
  global $app_list_strings;

  $ReportsQueryArray = array();
  $ReportsQueryArray["AccountReports"] = "select accounts.name,accounts.billing_address_city,case accounts.account_type WHEN 'Analyst' THEN '".$app_list_strings["account_type_dom"]["Analyst"]."' WHEN 'Competitor' THEN '".$app_list_strings["account_type_dom"]["Competitor"]."' WHEN 'Customer' THEN '".$app_list_strings["account_type_dom"]["Customer"]."' WHEN 'Integrator' THEN '".$app_list_strings["account_type_dom"]["Integrator"]."' WHEN 'Investor' THEN '".$app_list_strings["account_type_dom"]["Investor"]."' WHEN 'Partner' THEN '".$app_list_strings["account_type_dom"]["Partner"]."' WHEN 'Press' THEN '".$app_list_strings["account_type_dom"]["Press"]."' WHEN 'Prospect' THEN '".$app_list_strings["account_type_dom"]["Prospect"]."' WHEN 'Reseller' THEN '".$app_list_strings["account_type_dom"]["Reseller"]."' WHEN 'Other' THEN '".$app_list_strings["account_type_dom"]["Other"]."' end AS account_type,case accounts.industry WHEN 'Apparel' THEN '".$app_list_strings["industry_dom"]["Apparel"]."' WHEN 'Banking' THEN '".$app_list_strings["industry_dom"]["Banking"]."' WHEN 'Biotechnology' THEN '".$app_list_strings["industry_dom"]["Biotechnology"]."' WHEN 'Chemicals' THEN '".$app_list_strings["industry_dom"]["Chemicals"]."' WHEN 'Communications' THEN '".$app_list_strings["industry_dom"]["Communications"]."' WHEN 'Construction' THEN '".$app_list_strings["industry_dom"]["Construction"]."' WHEN 'Consulting' THEN '".$app_list_strings["industry_dom"]["Consulting"]."' WHEN 'Education' THEN '".$app_list_strings["industry_dom"]["Education"]."' WHEN 'Electronics' THEN '".$app_list_strings["industry_dom"]["Electronics"]."' WHEN 'Energy' THEN '".$app_list_strings["industry_dom"]["Energy"]."' WHEN 'Engineering' THEN '".$app_list_strings["industry_dom"]["Engineering"]."' WHEN 'Entertainment' THEN '".$app_list_strings["industry_dom"]["Entertainment"]."' WHEN 'Environmental' THEN '".$app_list_strings["industry_dom"]["Environmental"]."' WHEN 'Finance' THEN '".$app_list_strings["industry_dom"]["Finance"]."' WHEN 'Government' THEN '".$app_list_strings["industry_dom"]["Government"]."' WHEN 'Healthcare' THEN '".$app_list_strings["industry_dom"]["Healthcare"]."' WHEN 'Hospitality' THEN '".$app_list_strings["industry_dom"]["Hospitality"]."' WHEN 'Insurance' THEN '".$app_list_strings["industry_dom"]["Insurance"]."' WHEN 'Machinery' THEN '".$app_list_strings["industry_dom"]["Machinery"]."' WHEN 'Manufacturing' THEN '".$app_list_strings["industry_dom"]["Manufacturing"]."' WHEN 'Media' THEN '".$app_list_strings["industry_dom"]["Media"]."' WHEN 'Not For Profit' THEN '".$app_list_strings["industry_dom"]["Not For Profit"]."' WHEN 'Recreation' THEN '".$app_list_strings["industry_dom"]["Recreation"]."' WHEN 'Retail' THEN '".$app_list_strings["industry_dom"]["Retail"]."' WHEN 'Shipping' THEN '".$app_list_strings["industry_dom"]["Shipping"]."' WHEN 'Technology' THEN '".$app_list_strings["industry_dom"]["Technology"]."' WHEN 'Telecommunications' THEN '".$app_list_strings["industry_dom"]["Telecommunications"]."' WHEN 'Transportation' THEN '".$app_list_strings["industry_dom"]["Transportation"]."' WHEN 'Utilities' THEN '".$app_list_strings["industry_dom"]["Utilities"]."' WHEN 'Other' THEN '".$app_list_strings["industry_dom"]["Other"]."' WHEN 'Food & Beverage' THEN '".$app_list_strings["industry_dom"]["Food & Beverage"]."' end AS industry,accounts.phone_office,accounts.email1,accounts.website,users.first_name as user_first_name,users.last_name as user_last_name from accounts,users where accounts.assigned_user_id = users.id ";

  $ReportsQueryArray["LeadReports"] = "select leads.first_name,leads.last_name,leads.account_name, case leads.status WHEN 'New' THEN '".$app_list_strings["lead_status_dom"]["New"]."' WHEN 'Assigned' THEN '".$app_list_strings["lead_status_dom"]["Assigned"]."' WHEN 'In Process' THEN '".$app_list_strings["lead_status_dom"]["In Process"]."' WHEN 'Converted' THEN '".$app_list_strings["lead_status_dom"]["Converted"]."' WHEN 'Recycled' THEN '".$app_list_strings["lead_status_dom"]["Recycled"]."' WHEN 'Dead' THEN '".$app_list_strings["lead_status_dom"]["Dead"]."' end as status,case leads.lead_source WHEN 'Cold Call' THEN '".$app_list_strings["lead_source_dom"]["Cold Call"]."' WHEN 'Existing Customer' THEN '".$app_list_strings["lead_source_dom"]["Existing Customer"]."' WHEN 'Self Generated' THEN '".$app_list_strings["lead_source_dom"]["Self Generated"]."' WHEN 'Employee' THEN '".$app_list_strings["lead_source_dom"]["Employee"]."' WHEN 'Partner' THEN '".$app_list_strings["lead_source_dom"]["Partner"]."' WHEN 'Public Relations' THEN '".$app_list_strings["lead_source_dom"]["Public Relations"]."' WHEN 'Direct Mail' THEN '".$app_list_strings["lead_source_dom"]["Direct Mail"]."' WHEN 'Conference' THEN '".$app_list_strings["lead_source_dom"]["Conference"]."' WHEN 'Trade Show' THEN '".$app_list_strings["lead_source_dom"]["Trade Show"]."' WHEN 'Web Site' THEN '".$app_list_strings["lead_source_dom"]["Web Site"]."' WHEN 'Word of mouth' THEN '".$app_list_strings["lead_source_dom"]["Word of mouth"]."' WHEN 'Email' THEN '".$app_list_strings["lead_source_dom"]["Email"]."' WHEN 'Other' THEN '".$app_list_strings["lead_source_dom"]["Other"]."' end as lead_source,leads.phone_work,leads.phone_mobile,leads.email1,leads.primary_address_city,users.first_name as user_first_name,users.last_name as user_last_name from leads,users where leads.assigned_user_id=users.id  ";

  $ReportsQueryArray["OnlyContactReports"] = "select contacts.first_name , contacts.last_name,contacts.phone_mobile ,contacts.phone_work ,contacts.email1 ,contacts.primary_address_city ,case contacts.lead_source WHEN 'Cold Call' THEN '".$app_list_strings["lead_source_dom"]["Cold Call"]."' WHEN 'Existing Customer' THEN '".$app_list_strings["lead_source_dom"]["Existing Customer"]."' WHEN 'Self Generated' THEN '".$app_list_strings["lead_source_dom"]["Self Generated"]."' WHEN 'Employee' THEN '".$app_list_strings["lead_source_dom"]["Employee"]."' WHEN 'Partner' THEN '".$app_list_strings["lead_source_dom"]["Partner"]."' WHEN 'Public Relations' THEN '".$app_list_strings["lead_source_dom"]["Public Relations"]."' WHEN 'Direct Mail' THEN '".$app_list_strings["lead_source_dom"]["Direct Mail"]."' WHEN 'Conference' THEN '".$app_list_strings["lead_source_dom"]["Conference"]."' WHEN 'Trade Show' THEN '".$app_list_strings["lead_source_dom"]["Trade Show"]."' WHEN 'Web Site' THEN '".$app_list_strings["lead_source_dom"]["Web Site"]."' WHEN 'Word of mouth' THEN '".$app_list_strings["lead_source_dom"]["Word of mouth"]."' WHEN 'Email' THEN '".$app_list_strings["lead_source_dom"]["Email"]."' WHEN 'Other' THEN '".$app_list_strings["lead_source_dom"]["Other"]."' end AS lead_source,users.first_name as user_first_name,users.last_name as user_last_name from contacts inner join users on contacts.assigned_user_id=users.id";

  $ReportsQueryArray["ContactReports"] = "select contacts.first_name , contacts.last_name,accounts.name as accountname,contacts.phone_mobile ,contacts.phone_work ,contacts.email1 ,contacts.primary_address_city ,case contacts.lead_source WHEN 'Cold Call' THEN '".$app_list_strings["lead_source_dom"]["Cold Call"]."' WHEN 'Existing Customer' THEN '".$app_list_strings["lead_source_dom"]["Existing Customer"]."' WHEN 'Self Generated' THEN '".$app_list_strings["lead_source_dom"]["Self Generated"]."' WHEN 'Employee' THEN '".$app_list_strings["lead_source_dom"]["Employee"]."' WHEN 'Partner' THEN '".$app_list_strings["lead_source_dom"]["Partner"]."' WHEN 'Public Relations' THEN '".$app_list_strings["lead_source_dom"]["Public Relations"]."' WHEN 'Direct Mail' THEN '".$app_list_strings["lead_source_dom"]["Direct Mail"]."' WHEN 'Conference' THEN '".$app_list_strings["lead_source_dom"]["Conference"]."' WHEN 'Trade Show' THEN '".$app_list_strings["lead_source_dom"]["Trade Show"]."' WHEN 'Web Site' THEN '".$app_list_strings["lead_source_dom"]["Web Site"]."' WHEN 'Word of mouth' THEN '".$app_list_strings["lead_source_dom"]["Word of mouth"]."' WHEN 'Email' THEN '".$app_list_strings["lead_source_dom"]["Email"]."' WHEN 'Other' THEN '".$app_list_strings["lead_source_dom"]["Other"]."' end AS lead_source from contacts,accounts,accounts_contacts where contacts.id = accounts_contacts.contact_id and accounts_contacts.account_id=accounts.id ";

  $ReportsQueryArray["BugReports"] = "select bugs.id,case bugs.priority WHEN 'Urgent' THEN '".$app_list_strings["bug_priority_dom"]["Urgent"]."' WHEN 'High' THEN '".$app_list_strings["bug_priority_dom"]["High"]."' WHEN 'Medium' THEN '".$app_list_strings["bug_priority_dom"]["Medium"]."' WHEN 'Low' THEN '".$app_list_strings["bug_priority_dom"]["Low"]."' end as priority,case bugs.status WHEN 'New' THEN '".$app_list_strings["bug_status_dom"]["New"]."' WHEN 'Assigned' THEN '".$app_list_strings["bug_status_dom"]["Assigned"]."' WHEN 'Closed' THEN '".$app_list_strings["bug_status_dom"]["Closed"]."' WHEN 'Pending' THEN '".$app_list_strings["bug_status_dom"]["Pending"]."' WHEN 'Rejected' THEN '".$app_list_strings["bug_status_dom"]["Rejected"]."' end as status,case bugs.type WHEN 'Defect' THEN '".$app_list_strings["bug_type_dom"]["Defect"]."' WHEN 'Feature' THEN '".$app_list_strings["bug_type_dom"]["Feature"]."' end as type,case bugs.source WHEN 'Internal' THEN '".$app_list_strings["source_dom"]["Internal"]."' WHEN 'Forum' THEN '".$app_list_strings["source_dom"]["Forum"]."' WHEN 'Web' THEN '".$app_list_strings["source_dom"]["Web"]."' WHEN 'InboundEmail' THEN '".$app_list_strings["source_dom"]["InboundEmail"]."' end as source,bugs.found_in_release,bugs.name,accounts.name as accountsname from bugs,accounts_bugs,accounts where bugs.id=accounts_bugs.bug_id and accounts.id=accounts_bugs.account_id ";
  $ReportsQueryArray["CallReports"] = "select name,date_start,time_start,duration_hours*60+duration_minutes as duration,users.first_name ,users.last_name from calls,users where calls.assigned_user_id = users.id ";
  $ReportsQueryArray["MeetingReports"] = "select name,location,date_start,time_start,duration_hours*60+duration_minutes as duration,users.first_name ,users.last_name from meetings,users where meetings.assigned_user_id = users.id ";
  $ReportsQueryArray["TaskReports"] = "select name,date_due,time_due,date_start,time_start,case priority WHEN 'High' THEN '".$app_list_strings["task_priority_dom"]["High"]."' WHEN 'Medium' THEN '".$app_list_strings["task_priority_dom"]["Medium"]."' WHEN 'Low' THEN '".$app_list_strings["task_priority_dom"]["Low"]."' end as priority,users.first_name ,users.last_name from tasks,users where tasks.assigned_user_id = users.id ";
  $ReportsQueryArray["EmailReports"] = "select to_addrs,cc_addrs,bcc_addrs,from_addr,name,users.first_name ,users.last_name from emails,users where emails.assigned_user_id = users.id ";
  $ReportsQueryArray["OpportunityReports"] = "select opportunities.name,accounts.name as accountsname,opportunity_type,lead_source,currency_id,amount,date_closed,next_step,sales_stage,probability,users.first_name ,users.last_name from opportunities,users,accounts,accounts_opportunities where opportunities.assigned_user_id = users.id and accounts_opportunities.`account_id`=accounts.id and accounts_opportunities.`opportunity_id`=opportunities.id ";
  $ReportsQueryArray["CaseReports"] = "select cases.case_number,case cases.priority WHEN 'P1' THEN '".$app_list_strings["case_priority_dom"]["P1"]."' WHEN 'P2' THEN '".$app_list_strings["case_priority_dom"]["P2"]."' WHEN 'P3' THEN '".$app_list_strings["case_priority_dom"]["P3"]."' end as priority,case cases.status WHEN 'New' THEN '".$app_list_strings["case_status_dom"]["New"]."' WHEN 'Assigned' THEN '".$app_list_strings["case_status_dom"]["Assigned"]."' WHEN 'Closed' THEN '".$app_list_strings["case_status_dom"]["Closed"]."' WHEN 'Pending Input' THEN '".$app_list_strings["case_status_dom"]["Pending Input"]."' WHEN 'Rejected' THEN '".$app_list_strings["case_status_dom"]["Rejected"]."' WHEN 'Duplicate' THEN '".$app_list_strings["case_status_dom"]["Duplicate"]."' end status,cases.name,accounts.name as accountname,users.first_name ,users.last_name from cases,users,accounts where cases.assigned_user_id = users.id and cases.`account_id`=accounts.id ";
  $ReportsQueryArray["ProjectTaskReports"] = "select project_task.name,case project_task.status WHEN 'Not Started' THEN '".$app_list_strings["project_task_status_options"]["Not Started"]."' WHEN 'In Progress' THEN '".$app_list_strings["project_task_status_options"]["In Progress"]."' WHEN 'Completed' THEN '".$app_list_strings["project_task_status_options"]["Completed"]."' WHEN 'Pending Input' THEN '".$app_list_strings["project_task_status_options"]["Pending Input"]."' WHEN 'Deferred' THEN '".$app_list_strings["project_task_status_options"]["Deferred"]."' end as status,task_number,case project_task.priority WHEN 'High' THEN '".$app_list_strings["project_task_priority_options"]["High"]."' WHEN 'Medium' THEN '".$app_list_strings["project_task_priority_options"]["Medium"]."' WHEN 'Low' THEN '".$app_list_strings["project_task_priority_options"]["Low"]."' end as priority,order_number,percent_complete,date_start,time_start,date_due,time_due,milestone_flag,utilization,users.first_name ,users.last_name from project_task,users where project_task.assigned_user_id = users.id ";
  $ReportsQueryArray["CampaignReports"] = "select name,case Campaigns.status WHEN 'Planning' THEN '".$app_list_strings["campaign_status_dom"]["Planning"]."' WHEN 'Active' THEN '".$app_list_strings["campaign_status_dom"]["Active"]."' WHEN 'Inactive' THEN '".$app_list_strings["campaign_status_dom"]["Inactive"]."' WHEN 'Complete' THEN '".$app_list_strings["campaign_status_dom"]["Complete"]."' WHEN 'In Queue' THEN '".$app_list_strings["campaign_status_dom"]["In Queue"]."' WHEN 'Sending' THEN '".$app_list_strings["campaign_status_dom"]["Sending"]."' end as status,start_date,end_date,case Campaigns.campaign_type WHEN 'Telesales' THEN '".$app_list_strings["campaign_type_dom"]["Telesales"]."' WHEN 'Mail' THEN '".$app_list_strings["campaign_type_dom"]["Mail"]."' WHEN 'Email' THEN '".$app_list_strings["campaign_type_dom"]["Email"]."' WHEN 'Print' THEN '".$app_list_strings["campaign_type_dom"]["Print"]."' WHEN 'Web' THEN '".$app_list_strings["campaign_type_dom"]["Web"]."' WHEN 'Radio' THEN '".$app_list_strings["campaign_type_dom"]["Radio"]."' WHEN 'Television' THEN '".$app_list_strings["campaign_type_dom"]["Television"]."' end as campaign_type,budget,expected_revenue,objective,actual_cost,expected_cost,users.first_name ,users.last_name from Campaigns,users where Campaigns.assigned_user_id = users.id ";

$ReportsQueryArray["QuoteReports"] = "select quotes.quotenum,quotes.name,quotes.billtoaccountname as accountsname,case quotes.stage WHEN 'Draft' THEN '".$app_list_strings["stage_options"]["Draft"]."' WHEN 'Negotiation' THEN '".$app_list_strings["stage_options"]["Negotiation"]."' WHEN 'Delivered' THEN '".$app_list_strings["stage_options"]["Delivered"]."' WHEN 'On Hold' THEN '".$app_list_strings["stage_options"]["On Hold"]."' WHEN 'Confirmed' THEN '".$app_list_strings["stage_options"]["Confirmed"]."' WHEN 'Closed Accepted' THEN '".$app_list_strings["stage_options"]["Closed Accepted"]."' WHEN 'Closed Lost' THEN '".$app_list_strings["stage_options"]["Closed Lost"]."' WHEN 'Closed Dead' THEN '".$app_list_strings["stage_options"]["Closed Dead"]."' end as stage,quotes.validuntil,quotes.total,users.first_name,users.last_name from quotes,users where quotes.assigned_user_id = users.id ";
$ReportsQueryArray["ProductReports"] = "select pnum,name,type,quality,unit_price from products where products.deleted=0 ";

  //Stand Filter Array
  $filters = array ( "AccountReports"  => array ( "accounts.date_entered"  => "AccountReports_STARTDATE",
                                                  "accounts.date_modified" => "AccountReports_ENDDATE"
                                          ),
                     "LeadReports"  => array ( "leads.date_entered"  => "LeadReports_STARTDATE",
                                               "leads.date_modified" => "LeadReports_ENDDATE"
                                          ),
                     "ContactReports"  => array ( "contacts.date_entered"  => "ContactReports_STARTDATE",
                                               "contacts.date_modified" => "ContactReports_ENDDATE"
                                          ),
                     "OnlyContactReports"  => array ( "contacts.date_entered"  => "OnlyContactReports_STARTDATE",
                                               "contacts.date_modified" => "OnlyContactReports_ENDDATE"
                                          ),
                     "OpportunityReports"  => array ( "opportunities.date_entered"  => "OpportunityReports_STARTDATE",
                                               "opportunities.date_modified" => "OpportunityReports_ENDDATE"
                                          ),
                     "CaseReports"  => array ( "cases.date_entered"  => "CaseReports_STARTDATE",
                                               "cases.date_modified" => "CaseReports_ENDDATE"
                                          ),
                     "BugReports"  => array ( "bugs.date_entered"  => "BugReports_STARTDATE",
                                               "bugs.date_modified" => "BugReports_ENDDATE"
                                          ),
                     "CallReports"  => array ( "calls.date_entered"  => "CallReports_STARTDATE",
                                               "calls.date_modified" => "CallReports_ENDDATE"
                                          ),
                     "MeetingReports"  => array ( "meetings.date_entered"  => "MeetingReports_STARTDATE",
                                               "meetings.date_modified" => "MeetingReports_ENDDATE"
                                          ),
                     "TaskReports"  => array ( "tasks.date_entered"  => "TaskReports_STARTDATE",
                                               "tasks.date_modified" => "TaskReports_ENDDATE"
                                          ),
                     "EmailReports"  => array ( "emails.date_entered"  => "EmailReports_STARTDATE",
                                               "emails.date_modified" => "EmailReports_ENDDATE"
                                          ),
                     "ProjectTaskReports"  => array ( "project_task.date_entered"  => "ProjectTaskReports_STARTDATE",
                                                      "project_task.date_modified" => "ProjectTaskReports_ENDDATE"
                                          ),
                     "CampaignReports"  => array ( "Campaigns.date_entered"  => "CampaignReports_STARTDATE",
                                                   "Campaigns.date_modified" => "CampaignReports_ENDDATE"
                                          ),
					"ProductReports"  => array ( "products.date_entered"  => "ProductReports_STARTDATE",
                                                  "products.date_modified" => "ProductReports_ENDDATE"
                                          ),
					 "QuoteReports"  => array ( "quotes.date_entered"  => "QuoteReports_STARTDATE",
                                                  "quotes.date_modified" => "QuoteReports_ENDDATE"
                                          )
                );

?>
Note: See TracBrowser for help on using the browser.