本文整理汇总了PHP中Functions::extractField方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::extractField方法的具体用法?PHP Functions::extractField怎么用?PHP Functions::extractField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::extractField方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculation_sheet_custom
public function calculation_sheet_custom($keys)
{
include_once APPPATH . "models/helperClasses/Calculation_Sheet.php";
$this->db->select("*");
$this->db->where(array('entryDate >=' => $keys['from_date'], 'entryDate <=' => $keys['to_date']));
if ($keys['company_id'] != 'all') {
$this->db->where('company_id', $keys['company_id']);
}
if ($keys['contractor_id'] != 'all') {
$this->db->where('contractor_id', $keys['contractor_id']);
}
if ($keys['product'] != 'all' && $keys['product'] != '') {
$this->db->where('product', $keys['product']);
}
if ($keys['product_type'] != 'all' && $keys['product_type'] != '') {
if ($_GET['product_type'] == 'black oil') {
$this->db->where('product_type', 'black oil');
}
if ($_GET['product_type'] == 'white oil') {
$this->db->where('product_type', 'white oil');
}
}
$result = $this->db->get('calculation_sheet_view')->result();
$calculation_sheet_white_oil = array();
foreach ($result as $record) {
array_push($calculation_sheet_white_oil, new Calculation_Sheet($record));
}
$grouped = Arrays::groupBy($calculation_sheet_white_oil, Functions::extractField('destination'), 'invoice_number');
ksort($grouped);
return $grouped;
}
示例2: pre_saved_sorting_columns
public function pre_saved_sorting_columns($module)
{
$result = $this->db->get_where('sort', array('view' => $module))->result();
if (sizeof($result) > 0) {
$grouped = Arrays::groupBy($result, Functions::extractField('sort_by'), 'priority');
return $grouped;
}
return null;
}
示例3: pre_saved_sorting_columns
public function pre_saved_sorting_columns($module)
{
$multiple_sorting_info = $this->multiple_sorting_info($module);
$objects = array();
foreach ($multiple_sorting_info as $record) {
array_push($objects, json_decode(json_encode($record), FALSE));
}
$grouped = Arrays::groupBy($objects, Functions::extractField('column_name'), 'column_priority');
return $grouped;
}
示例4: extractExpression
public static function extractExpression($selector, $accessPrivate = false)
{
if (is_callable($selector)) {
return $selector;
} elseif (!is_string($selector)) {
throw new Exception('Invalid selector: ' . $selector);
} elseif (preg_match('/\\(\\)|->/', $selector)) {
return Functions::extractFieldRecursively($selector, $accessPrivate);
} else {
return Functions::extractField($selector, $accessPrivate);
}
}
示例5: tanker_trips_expenses
function tanker_trips_expenses()
{
$this->db->select('voucher_journal.trip_id as trip_id, sum(voucher_entry.debit_amount) as amount, account_titles.title as title');
$this->db->join('voucher_journal', 'voucher_journal.trip_id = trips.id', 'left');
$this->db->join('voucher_entry', 'voucher_entry.journal_voucher_id = voucher_journal.id', 'left');
$this->db->join('account_titles', 'account_titles.id = voucher_entry.account_title_id', 'left');
$this->db->where('voucher_journal.tanker_id', $this->tankerId);
$this->db->where('trips.entryDate >=', $this->from);
$this->db->where('trips.entryDate <=', $this->to);
$this->db->where('account_titles.secondary_type', 'other_expense');
$this->db->where('voucher_journal.trip_id !=', 0);
$this->db->where('voucher_journal.active', 1);
$this->db->where('trips.active', 1);
$this->db->order_by('voucher_journal.trip_id');
$this->db->group_by('voucher_journal.trip_id, voucher_entry.account_title_id');
$result = $this->db->get('trips')->result();
return Arrays::groupBy($result, Functions::extractField('trip_id'), 'trip_id');
}
示例6: automatic_transactions_on_trip_edit
//.........这里部分代码省略.........
foreach ($result as $record) {
array_push($trip_detail_ids_related_to_voucher_id, $record->trip_detail_id);
}
/*************************************************************/
/********fetching trip_ids by trip_detail_ids***********/
$this->db->select('trip_id');
$this->db->distinct();
$this->db->from('trips_details');
$this->db->where_in('trips_details.id', $trip_detail_ids_related_to_voucher_id);
$result_3 = $this->db->get()->result();
$trip_ids_related_to_voucher_id = array();
foreach ($result_3 as $record_3) {
array_push($trip_ids_related_to_voucher_id, $record_3->trip_id);
}
/********************************************/
/*declaring variables of amounts to update*/
$total_customer_freight = 0;
$total_customer_freight_without_shortage = 0;
$total_shortage_amount = 0;
$total_contractor_freight = 0;
$total_contractor_freight_without_shortage = 0;
$total_company_commission = 0;
$total_company_wht = 0;
$total_service_charges = 0;
$total_contractor_commission = 0;
$grand_total_freight = 0;
/******************************************/
/**
* fetching white_oil and black_oil seprate trip ids
**/
$this->db->select('trip_id, trip_detail_id, product_type');
$this->db->where_in('trip_detail_id', $trip_detail_ids_related_to_voucher_id);
$raw_trip_ids_with_product_type = $this->db->get('trips_details_upper_layer_view')->result();
$grouped_by_product_type = Arrays::groupBy($raw_trip_ids_with_product_type, Functions::extractField('product_type'));
$black_oil_trip_ids = isset($grouped_by_product_type['black oil']) ? property_to_array('trip_detail_id', $grouped_by_product_type['black oil']) : [];
$white_oil_trip_ids = isset($grouped_by_product_type['white oil']) ? property_to_array('trip_detail_id', $grouped_by_product_type['white oil']) : [];
$black_oil_trip_ids = sizeof($black_oil_trip_ids) == 0 ? [0] : $black_oil_trip_ids;
$white_oil_trip_ids = sizeof($white_oil_trip_ids) == 0 ? [0] : $white_oil_trip_ids;
$this->db->select('*');
$this->db->where_in('trip_detail_id', $black_oil_trip_ids);
$black_oil_trips = $this->db->get('manage_accounts_black_oil_view')->result();
$this->db->select('*');
$this->db->where_in('trip_detail_id', $white_oil_trip_ids);
$white_oil_trips = $this->db->get('manage_accounts_white_oil_view')->result();
/**********************************************************/
foreach ($black_oil_trips as $detail) {
//here we will claculate the amounts needed to update
$customer_freight_amount = round($detail->customer_freight, 3);
$total_customer_freight += $customer_freight_amount;
$contractor_freight_amount = round($detail->net_payables, 3);
$total_contractor_freight += $contractor_freight_amount;
$contractor_commission_amount = $detail->contractor_commission_amount;
$total_contractor_commission += $contractor_commission_amount;
$company_commission_amount = round($detail->company_commission_amount, 3);
$total_company_commission += $company_commission_amount;
$wht_amount = $detail->wht_amount;
$total_company_wht += $wht_amount;
$service_charges = 0;
$service_charges = $detail->freight_amount_cmp - $detail->company_commission_amount - $detail->customer_freight - $detail->contractor_commission_amount - $detail->wht_amount - $detail->shortage_amount;
if ($service_charges > -0.1 && $service_charges < 0.1) {
$service_charges = 0;
}
$total_service_charges += $service_charges;
}
foreach ($white_oil_trips as $detail) {
//here we will claculate the amounts needed to update
示例7: calculation_sheet_custom
//.........这里部分代码省略.........
//var_dump($details_ids_with_destination_shortage);
/*--- Selecting every thing with decanding shortage vouchers -----*/
$this->select_calculation_sheet_stuff();
$this->db->from("trips");
$this->join_trips_with_every_thing();
$this->join_trips_details_and_decanding_shortage();
$this->db->where('trips.active', 1);
$this->db->where(array('trips.entryDate >=' => $keys['from_date'], 'trips.entryDate <=' => $keys['to_date']));
if ($keys['company_id'] != 'all') {
$this->db->where('trips.company_id', $keys['company_id']);
}
if ($keys['contractor_id'] != 'all') {
$this->db->where('trips.contractor_id', $keys['contractor_id']);
}
if ($keys['product'] != 'all' && $keys['product'] != '') {
$this->db->where('trips_details.product', $keys['product']);
}
if ($keys['product_type'] != 'all' && $keys['product_type'] != '') {
if ($_GET['product_type'] == 'black oil') {
$this->black_oil();
}
if ($_GET['product_type'] == 'white oil') {
$this->white_oil();
}
}
if (sizeof($details_ids_with_decanding_shortage) > 0) {
$this->db->where_in('trips_details.id', $details_ids_with_decanding_shortage);
}
$this->db->group_by('voucher_journal.id');
$this->db->order_by('trips_details.id');
$result = $this->db->get()->result();
$calculation_sheet_black_oil = array();
foreach ($result as $record) {
array_push($calculation_sheet_black_oil, new Calculation_Sheet($record));
}
/*--- Selecting every thing with destination shortage vouchers -----*/
$this->select_calculation_sheet_stuff();
$this->db->from("trips");
$this->join_trips_with_every_thing();
$this->join_trips_details_and_destination_shortage();
$this->db->where('trips.active', 1);
$this->db->where(array('trips.entryDate >=' => $keys['from_date'], 'trips.entryDate <=' => $keys['to_date']));
if ($keys['company_id'] != 'all') {
$this->db->where('trips.company_id', $keys['company_id']);
}
if ($keys['contractor_id'] != 'all') {
$this->db->where('trips.contractor_id', $keys['contractor_id']);
}
if ($keys['product'] != 'all' && $keys['product'] != '') {
$this->db->where('trips_details.product', $keys['product']);
}
if ($keys['product_type'] != 'all' && $keys['product_type'] != '') {
if ($_GET['product_type'] == 'black oil') {
$this->black_oil();
}
if ($_GET['product_type'] == 'white oil') {
$this->white_oil();
}
}
if (isset($keys['agent_type']) && isset($keys['agent_id'])) {
switch ($keys['agent_type']) {
case 'other_agents':
$this->db->where('voucher_entry.related_other_agent !=', 0);
if ($keys['agent_id'] != '') {
$this->db->where('voucher_entry.related_other_agent', $keys['agent_id']);
}
break;
case 'customers':
$this->db->where('voucher_entry.related_customer !=', 0);
if ($keys['agent_id'] != '') {
$this->db->where('voucher_entry.related_customer', $keys['agent_id']);
}
break;
case 'companies':
$this->db->where('voucher_entry.related_company !=', 0);
if ($keys['agent_id'] != '') {
$this->db->where('voucher_entry.related_company', $keys['agent_id']);
}
break;
case 'carriage_contractors':
$this->db->where('voucher_entry.related_contractor !=', 0);
if ($keys['agent_id'] != '') {
$this->db->where('voucher_entry.related_contractor', $keys['agent_id']);
}
break;
}
}
if (sizeof($details_ids_with_decanding_shortage) > 0) {
$this->db->where_in('trips_details.id', $details_ids_with_destination_shortage);
}
$this->db->group_by('voucher_journal.id');
$this->db->order_by('trips_details.id');
$result = $this->db->get()->result();
foreach ($result as $record) {
array_push($calculation_sheet_black_oil, new Calculation_Sheet($record));
}
$grouped = Arrays::groupBy($calculation_sheet_black_oil, Functions::extractField('destination'), 'invoice_number');
ksort($grouped);
return $grouped;
}
示例8: all_routes_freights
public function all_routes_freights($route_type = 'primary')
{
include_once APPPATH . "models/helperClasses/Route_Details.php";
switch ($route_type) {
case 'primary':
$this->db->where('routes.type', 1);
break;
case 'secondary':
$this->db->where('routes.type', 3);
break;
case 'secondary_local':
$this->db->where('routes.type', 4);
break;
default:
$this->db->where('routes.type', 1);
break;
}
$this->db->select('routes.id as route_id, freights.id as freight_id,
freights.startDate, freights.endDate, freights.freight,
routes.source, routes.destination, routes.product,
');
$this->db->from('routes');
$this->db->join('freights', 'freights.route_id = routes.id', 'left');
$this->db->where('routes.active', 1);
/*$this->db->join('cities as sourceCity','sourceCity.id = routes.source','left');
$this->db->join('cities as destinationCity','destinationCity.id = routes.destination','left');
$this->db->join('products','products.id = routes.product','left');*/
$this->db->order_by('freights.id', 'desc');
$results = $this->db->get()->result();
foreach ($results as &$record) {
$record->route = $record->source . "_" . $record->destination . "_" . $record->product;
}
$grouped = Arrays::groupBy($results, Functions::extractField('route'));
return $grouped;
}
示例9: groupRawReportByRoute
private function groupRawReportByRoute($report)
{
//adding extra_column
foreach ($report as &$record) {
$record->route_product_key = $record->source_id . "_" . $record->destination_id . "_" . $record->product_id;
}
// grouping by route_product_key and triming
return $this->trimm_expense_report(Arrays::groupBy($report, Functions::extractField('route_product_key')));
}
示例10: tankers_income_statement
public function tankers_income_statement($keys)
{
include_once APPPATH . "models/helperClasses/tankers_routes.php";
include_once APPPATH . "models/helperClasses/income_statement_row.php";
$this->db->select("voucher_journal.tanker_id, tankers.truck_number as tanker_number,\n SUM(voucher_entry.debit_amount) as total_expense,\n SUM(voucher_entry.credit_amount) as total_income,\n (SUM(voucher_entry.credit_amount) - SUM(voucher_entry.debit_amount)) as profit,\n account_titles.secondary_type,\n ");
$this->db->from('voucher_journal');
$this->db->join('voucher_entry', 'voucher_entry.journal_voucher_id = voucher_journal.id', 'left');
$this->db->join('account_titles', 'account_titles.id = voucher_entry.account_title_id', 'left');
$this->db->join('tankers', 'tankers.id = voucher_journal.tanker_id', 'left');
$this->db->where(array('voucher_journal.active' => 1, 'voucher_journal.ignored !=' => 1, 'voucher_journal.person_tid' => 'users.1', 'voucher_journal.tanker_id !=' => 0));
$where = "(account_titles.type = 'expense' OR account_titles.type = 'income')";
$this->db->where($where);
$this->db->group_by('voucher_journal.tanker_id, account_titles.secondary_type');
if ($keys['from'] != '') {
$this->db->where('voucher_journal.voucher_date >=', $keys['from']);
}
if ($keys['to'] != '') {
$this->db->where('voucher_journal.voucher_date <=', $keys['to']);
}
if ($keys['tanker_id'] != '') {
$this->db->where_in('voucher_journal.tanker_id', $keys['tanker_id']);
}
if ($keys['customer_id'] != '') {
$this->db->where('voucher_entry.related_customer', $keys['customer_id']);
}
//checking weather user demands Sorting or not
/*if(isset($keys['sort']) && $keys['sort'] != ''){
//$this->db->order_by($keys['sort']['sort_by'],$keys['sort']['order']);
//$this->db->order_by('voucher_journal.id',$keys['sort']['order']);
}else{
$this->db->order_by('voucher_journal.tanker_id','asc');
}*/
/////////////////////////////////////////////////////
$result = $this->db->get()->result();
$grouped = Arrays::groupBy($result, Functions::extractField('tanker_id'));
$income_statement = array();
foreach ($grouped as $group) {
$income_statement_row = new Income_Statement_Row();
foreach ($group as $record) {
$income_statement_row->tanker_id = $record->tanker_id;
$income_statement_row->tanker_number = $record->tanker_number;
if ($record->secondary_type == 'other_expense') {
$income_statement_row->other_expense = $record->total_expense;
}
if ($record->secondary_type == 'shortage_expense') {
$income_statement_row->shortage_expense = $record->total_expense;
}
$income_statement_row->total_income += $record->total_income;
$income_statement_row->secondary_type = $record->secondary_type;
}
$income_statement_row->profit = $income_statement_row->total_income - ($income_statement_row->shortage_expense + $income_statement_row->other_expense);
array_push($income_statement, $income_statement_row);
}
usort($income_statement, array("Sorting_Model", "sort_tanker_income_statement"));
/*Getting the routes information*/
$this->db->select("trips.tanker_id, source_cities.cityName as source, destination_cities.cityName as destination,\n COUNT(trips_details.source) as route_counter,\n ");
$this->db->from('trips');
$this->db->join('trips_details', 'trips_details.trip_id = trips.id', 'left');
$this->db->join('cities as source_cities', 'source_cities.id = trips_details.source', 'left');
$this->db->join('cities as destination_cities', 'destination_cities.id = trips_details.destination', 'left');
$this->db->group_by(array('trips.tanker_id', 'trips_details.source', 'trips_details.destination'));
$this->db->where(array('trips.active' => 1));
if ($keys['from'] != '') {
$this->db->where('trips.entryDate >=', $keys['from']);
}
if ($keys['to'] != '') {
$this->db->where('trips.entryDate <=', $keys['to']);
}
if ($keys['tanker_id'] != '') {
$this->db->where_in('trips.tanker_id', $keys['tanker_id']);
}
if ($keys['customer_id'] != '') {
$this->db->where('trips.customer_id', $keys['customer_id']);
}
$result = $this->db->get()->result();
$tankers_routes = new Tankers_Routes($result);
/**********************************/
return array('tankers_routes' => $tankers_routes, 'income_statement' => $income_statement);
}
示例11: __construct
public function __construct($statuses)
{
$this->statuses = Arrays::groupBy($statuses, Functions::extractField('trip_detail_id'));
}
示例12: groupShortageDataByTripDetailId
public function groupShortageDataByTripDetailId()
{
$shortagesData = Arrays::groupBy($this->getShortagesData(), Functions::extractField('trip_detail_id'));
return $shortagesData;
}