Exemplo n.º 1
0
 public function index()
 {
     //$this->get_current_step(uri_string());
     $this->setCurrentStep(uri_string());
     $code = $this->input->post('id');
     $id_campaign = type_cast($code, 'textcode');
     $this->load->model('languages');
     $this->load->model('countries');
     $this->load->model('campaigns', '', TRUE);
     $this->load->model('schedule', '', TRUE);
     $info = $this->campaigns->info($id_campaign);
     if ('cpm_flatrate' == $info['id_campaign_type']) {
         $this->content['CPM_FLATRATE'] = array(array());
     } else {
         $this->content['CPM_FLATRATE'] = array();
     }
     //Рекламодатель может выбирать для рекламы только те страны, которые не заблокированы в системе? тогда get_list(array('filter' => 'enabled'))
     $this->targeting_all_list->countries = $this->countries->get_list(array('filter' => 'enabled'));
     $this->targeting_all_list->languages = $this->languages->get_list(array('filter' => 'enabled'));
     $tmp = $this->campaigns->get_list(array('id_advertiser' => $this->user_id));
     $campaigns_list[''] = __("Select campaign to load targeting from");
     foreach ($tmp as $key => $value) {
         $campaigns_list[type_to_str($key, 'textcode')] = type_to_str($value, 'encode');
     }
     unset($tmp);
     $campaign = type_to_str($this->campaigns->name(type_cast($code, 'textcode')), 'encode');
     $form = array("id" => $code, "name" => "name_date_form", "view" => "advertiser/manage_ads/campaigns/create_step_main.html", 'redirect' => 'advertiser/edit_campaign/success', 'REVIEW_MODE' => false, "vars" => array('CAMPAIGN_SCHEME' => $this->load->view('advertiser/manage_ads/campaigns/campaign_scheme.html', '', TRUE), 'NUMBERFORMAT' => get_number_format(), 'TIME_HOURS_FORMAT' => substr_count(get_time_format(), 'A') > 0 ? '12' : '24', 'TARGETING_ALL_LIST' => json_encode($this->targeting_all_list), 'CAMPAIGNS_LIST' => json_encode($campaigns_list), 'TIMEZONE' => sprintf(__("Scheduling runs at server time. Server is set for <b>%s</b> time zone. At the moment server time is <b>%s</b>."), gmdate('T') . date('P'), date('H:i')), 'PROGRESS_BAR' => '<h1><a href="<%SITEURL%><%INDEXPAGE%>advertiser/manage_ads">' . __('Manage Ads') . ' </a> &rarr; ' . __('Edit Campaign') . ': <span class="green i">&bdquo;' . $campaign . '&ldquo;</span></h1>'), "fields" => array("campaign_name" => array("display_name" => __("Campaign Name"), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => "required", "max" => 50), "targeting" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "schedule" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "id_targeting_group" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "id_targeting_group_temp" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "targeting_type" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required")));
     $content = $this->form->get_form_content('modify', $form, $this->input, $this);
     $this->_set_content($content);
     $this->_display();
 }
 public function index($campaign_type)
 {
     $this->load->model('languages');
     $this->load->model('countries');
     $this->load->model('campaigns');
     if ('cpm_flatrate' == $campaign_type) {
         $this->content['CPM_FLATRATE'] = array(array());
     } else {
         $this->content['CPM_FLATRATE'] = array();
     }
     $add_site_channel = $this->session->userdata('add_site_channel');
     if (FALSE !== $add_site_channel) {
         $this->load->model('site');
         $add_site_channel = json_decode($add_site_channel);
         if ($campaign_type == $add_site_channel->program_type) {
             switch ($add_site_channel->program_type) {
                 case 'cpc':
                     $id_site = type_cast($add_site_channel->site_code, 'textcode');
                     $site_info = $this->site->get_info($id_site);
                     if (!is_null($site_info)) {
                         $this->_set_notification(sprintf(__('Site &bdquo;%s (%s)&ldquo; choosed by you in Site Directory will be added on &bdquo;Select Sites&ldquo; step'), type_to_str($site_info->name, 'encode'), $site_info->url));
                     }
                     break;
                 case 'cpm_flatrate':
                     $this->load->model('channel');
                     $id_site = type_cast($add_site_channel->site_code, 'textcode');
                     $id_channel = type_cast($add_site_channel->channel_code, 'textcode');
                     $site_info = $this->site->get_info($id_site);
                     $channel_info = $this->channel->get_info($id_channel);
                     if (!is_null($site_info) && !is_null($channel_info)) {
                         $this->load->model('sites_channels');
                         $site_channel_info = $this->sites_channels->get_id_site_channel($id_site, $id_channel);
                         if (!is_null($site_channel_info)) {
                             $this->_set_notification(sprintf(__('Channel &bdquo;%s&ldquo; at site &bdquo;%s (%s)&ldquo; choosed by you in Site Directory will be added on &bdquo;Select Sites/Channels&ldquo; step'), type_to_str($channel_info->name, 'encode'), type_to_str($site_info->name, 'encode'), $site_info->url));
                         }
                     }
                     break;
             }
         }
     }
     //Рекламодатель может выбирать для рекламы только те страны, которые не заблокированы в системе? тогда get_list(array('filter' => 'enabled'))
     $this->targeting_all_list->countries = $this->countries->get_list(array('filter' => 'enabled'));
     $this->targeting_all_list->languages = $this->languages->get_list(array('filter' => 'enabled'));
     $this->set_campaign_type($campaign_type);
     //$this->get_current_step(uri_string());
     $this->setCurrentStep(uri_string());
     $tmp = $this->campaigns->get_list(array('id_advertiser' => $this->user_id));
     $this->review_mode = $this->input->post('review_mode');
     if ($this->review_mode) {
         $form_caption = __('Edit Campaign');
     } else {
         $form_caption = __('Create Campaign');
     }
     $form = array("id" => $campaign_type, "name" => "name_date_form", "view" => "advertiser/manage_ads/campaigns/create_step_main.html", "redirect" => $this->get_next_step_controller(), "vars" => array('TARGETING_ALL_LIST' => json_encode($this->targeting_all_list), 'NUMBERFORMAT' => get_number_format(), 'TIME_HOURS_FORMAT' => substr_count(get_time_format(), 'A') > 0 ? '12' : '24', 'FORM_CAPTION' => $form_caption, 'REVIEW_MODE' => $this->review_mode, 'TIMEZONE' => sprintf(__("Scheduling runs at server time. Server is set for <b>%s</b> time zone. At the moment server time is <b>%s</b>."), gmdate('T') . date('P'), date('H:i')), 'CAMPAIGN_SCHEME' => $this->load->view('advertiser/manage_ads/campaigns/campaign_scheme.html', '', TRUE)), "fields" => array("campaign_name" => array("display_name" => __("Campaign Name"), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => "required", "max" => 50), "targeting" => array("id_field_type" => "string", "form_field_type" => "hidden"), "schedule" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "id_targeting_group" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "id_targeting_group_temp" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required"), "targeting_type" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required")));
     $content = $this->form->get_form_content('modify', $form, $this->input, $this);
     $this->_set_content($content);
     $this->_display();
 }
Exemplo n.º 3
0
 /**
  * переводит значение заданного типа в строку
  *
  * @param mixed $data значение, которое нужно сконвертировать
  * @param string $type тип данных ('bool','date')
  * @param int $precision_default задание точного количества знаков после запятой
  * @return string полученная строка, представляющая данные
  */
 function type_to_str($data, $type, $precision_default = -1)
 {
     switch ($type) {
         case 'encode':
             return htmlentities($data, ENT_QUOTES, 'utf-8');
         case 'translate':
             return __($data);
         case "integer":
             /**
              * Локально пустые значения спокойно форматируется зендом в 0,
              * но на сервере, на orbitscipts.com? после форматирования пустого значение,
              * оно так и остаётся пустое. Я не знаю почему. 
              */
             if (is_null($data) || $data == '') {
                 $data = 0;
             }
             $res = Zend_Locale_Format::toInteger($data, array('locale' => get_instance()->locale));
             return $res;
         case "float":
             $precision = 2;
             /**
              * Определние нужной точности для денег
              */
             if ($precision_default < 0) {
                 $vals = explode('.', strval((double) $data));
                 if (isset($vals[1])) {
                     $len = strlen($vals[1]);
                     if ($len > 3) {
                         $precision = 4;
                     } elseif ($len > 2) {
                         $precision = 3;
                     }
                 }
             } else {
                 $precision = $precision_default;
             }
             return number_format($data, $precision, '.', '');
             //return Zend_Locale_Format::toFloat($data, array('locale'=> get_instance()->locale));
         //return Zend_Locale_Format::toFloat($data, array('locale'=> get_instance()->locale));
         case 'procent':
             return type_to_str($data, 'float', 2) . ' %';
         case "money":
             //return str_replace('%', type_to_str($data, 'float'), get_format('money'));
             if (is_null($data)) {
                 $data = 0;
             }
             /**
              * @todo Возможно прийдётся определять тип валюты как-то глобально, 
              *  когда понадобится использовать что-нибудь отличное от доллара. 
              */
             try {
                 $currency = new Zend_Currency(get_instance()->locale, 'USD');
             } catch (Zend_Currency_Exception $e) {
                 $currency = new Zend_Currency(get_instance()->default_locale, 'USD');
             }
             $precision = 2;
             /**
              * Определние нужной точности для денег
              */
             $vals = explode('.', strval((double) $data));
             if (isset($vals[1])) {
                 $len = strlen($vals[1]);
             }
             $currency->setFormat(array('precision' => $precision));
             try {
                 $value = trim($currency->toCurrency($data));
                 /**
                  * проверка preg_matchем нужна потмоу что, например в китайском валюта отображается
                  * как: US$0.00 
                  */
                 if (get_instance()->locale != 'en_US' && preg_match('|^[0-9,\\.\\$\\s\\xc2\\xa0]+$|', $value, $matches)) {
                     $value = '$' . trim(str_replace('$', '', $value));
                 }
             } catch (Exception $e) {
                 $value = '0.00';
             }
             return $value;
         case "nonzeromoney":
             if ($data == 0) {
                 return "—";
             }
             return type_to_str($data, "money");
         case "mysqldate":
             $data = mktime(0, 0, 0, substr($data, 5, 2), substr($data, 8, 2), substr($data, 0, 4));
             return date(get_date_format(), $data);
         case "mysqlfloat":
             //return str_replace(',','.',$data);
             return number_format($data, 8, '.', '');
         case 'databasedate':
             return date("Y-m-d", $data);
         case 'databasedatetime':
             return date("Y-m-d H:i:s", $data);
         case "date":
             if ($data == 0 || is_null($data)) {
                 return '';
             }
             return date(get_date_format(), $data);
         case "datetime":
             $res = date(get_date_format(), $data) . ' ' . date(get_time_format(), $data);
             return $res;
         case "bool":
             return $data ? "true" : "false";
         case 'textcode':
             $num = (int) ($data ^ 67894523);
             $text = '';
             while ($num) {
                 $text .= chr(ord('a') + $num % 26);
                 $num = (int) ($num / 26);
             }
             return $text;
         case "impressions":
             if ($data < 1000) {
                 return __('< 1 K');
             }
             if ($data < 5000) {
                 return __('1~5 K');
             }
             if ($data < 10000) {
                 return __('5~10 K');
             }
             if ($data < 50000) {
                 return __('10~50 K');
             }
             if ($data < 100000) {
                 return __('50~100 K');
             } else {
                 return __('> 100 K');
             }
         case "clicks":
             if ($data < 100) {
                 return __('< 100');
             }
             if ($data < 900) {
                 return '~ ' . round($data / 100) * 100;
             } else {
                 return '~ ' . round($data / 1000) . ' K';
             }
         case "mime":
             return '=?UTF-8?B?' . base64_encode($data) . '?=';
         default:
             return $data;
     }
 }
Exemplo n.º 4
0
                $postername = $db->select_single_value("xebura_VENUE", "AF_VENUE_NAME", " WHERE AF_VENUE_ID='" . $news_rows['AF_NEWS_POSTER_ID'] . "'");
                break;
            case 8:
                $postername = $db->select_single_value("xebura_BUYER", "AF_BUYER_COMPANYNAME", " WHERE AF_BUYER_ID='" . $news_rows['AF_NEWS_POSTER_ID'] . "'");
                break;
            default:
                $postername = "Unknown";
                break;
        }
        $temp['title'] = ucwords(html_script_escape($news_rows['AF_NEWS_TITLE']));
        $temp['news'] = truncate(ucfirst(html_script_escape(nl2br($news_rows['AF_NEWS_DESC']))), 50);
        $temp['poster'] = member_type($poster_aid);
        $temp['postername'] = ucwords(html_script_escape($postername));
        $postername = '';
        $temp['date'] = get_date_format($news_rows['AF_NEWS_DATE']);
        $temp['time'] = get_time_format($news_rows['AF_NEWS_TIME']);
        $posted_to_mid = $news_rows['AF_NEWS_POSTEDTO_MID'];
        $temp['posted_to_cid'] = encode($posted_to_mid);
        $posted_to_mid = '';
        if ($i == 0) {
            $news_last_update = $temp['date'];
        }
        $my_con_news[$i++] = $temp;
    }
}
$smarty->assign("NEWS_LASTUPDATED", $news_last_update);
$smarty->assign("NUM_CON_NEWS", $NUM_CON_NEWS);
$smarty->assign("my_con_news", $my_con_news);
$smarty->assign("has_con_news", $has_con_news);
/* End of force feed details. */
/* Get total booking YTD */
Exemplo n.º 5
0
 function detailed_commissions($start_date, $end_date, $employee_id, $sale_type, $employee_type, $export_excel = 0, $offset = 0)
 {
     $this->check_action_permission('view_employees');
     $start_date = rawurldecode($start_date);
     $end_date = rawurldecode($end_date);
     $this->load->model('reports/Detailed_commissions');
     $model = $this->Detailed_commissions;
     $model->setParams(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type, 'employee_type' => $employee_type, 'offset' => $offset, 'export_excel' => $export_excel));
     $this->Sale->create_sales_items_temp_table(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type));
     $config = array();
     $config['base_url'] = site_url("reports/detailed_commissions/" . rawurlencode($start_date) . '/' . rawurlencode($end_date) . "/{$employee_id}/{$sale_type}/{$employee_type}/{$export_excel}");
     $config['total_rows'] = $model->getTotalRows();
     $config['per_page'] = $this->config->item('number_of_items_per_page') ? (int) $this->config->item('number_of_items_per_page') : 20;
     $config['uri_segment'] = 9;
     $this->pagination->initialize($config);
     $headers = $model->getDataColumns();
     $report_data = $model->getData();
     $summary_data = array();
     $details_data = array();
     foreach ($report_data['summary'] as $key => $row) {
         $summary_data_row = array();
         $summary_data_row[] = array('data' => anchor('sales/edit/' . $row['sale_id'], lang('common_edit') . ' ' . $row['sale_id'], array('target' => '_blank')), 'align' => 'left');
         $summary_data_row[] = array('data' => date(get_date_format() . '-' . get_time_format(), strtotime($row['sale_time'])), 'align' => 'left');
         $summary_data_row[] = array('data' => to_quantity($row['items_purchased']), 'align' => 'left');
         $summary_data_row[] = array('data' => $row['customer_name'], 'align' => 'left');
         $summary_data_row[] = array('data' => to_currency($row['subtotal']), 'align' => 'right');
         $summary_data_row[] = array('data' => to_currency($row['total']), 'align' => 'right');
         $summary_data_row[] = array('data' => to_currency($row['tax']), 'align' => 'right');
         if ($this->has_profit_permission) {
             $summary_data_row[] = array('data' => to_currency($row['profit']), 'align' => 'right');
         }
         $summary_data_row[] = array('data' => to_currency($row['commission']), 'align' => 'right');
         $summary_data_row[] = array('data' => $row['payment_type'], 'align' => 'right');
         $summary_data_row[] = array('data' => $row['comment'], 'align' => 'right');
         $summary_data[$key] = $summary_data_row;
         foreach ($report_data['details'][$key] as $drow) {
             $details_data_row = array();
             $details_data_row[] = array('data' => isset($drow['item_name']) ? $drow['item_name'] : $drow['item_kit_name'], 'align' => 'left');
             $details_data_row[] = array('data' => $drow['category'], 'align' => 'left');
             $details_data_row[] = array('data' => $drow['serialnumber'], 'align' => 'left');
             $details_data_row[] = array('data' => $drow['description'], 'align' => 'left');
             $details_data_row[] = array('data' => to_quantity($drow['quantity_purchased']), 'align' => 'left');
             $details_data_row[] = array('data' => to_currency($drow['subtotal']), 'align' => 'right');
             $details_data_row[] = array('data' => to_currency($drow['total']), 'align' => 'right');
             $details_data_row[] = array('data' => to_currency($drow['tax']), 'align' => 'right');
             if ($this->has_profit_permission) {
                 $details_data_row[] = array('data' => to_currency($drow['profit']), 'align' => 'right');
             }
             $details_data_row[] = array('data' => to_currency($drow['commission']), 'align' => 'right');
             $details_data_row[] = array('data' => $drow['discount_percent'] . '%', 'align' => 'left');
             $details_data[$key][] = $details_data_row;
         }
     }
     $employee_info = $this->Employee->get_info($employee_id);
     $data = array("title" => $employee_info->first_name . ' ' . $employee_info->last_name . ' ' . lang('reports_report'), "subtitle" => date(get_date_format(), strtotime($start_date)) . '-' . date(get_date_format(), strtotime($end_date)), "headers" => $model->getDataColumns(), "summary_data" => $summary_data, "details_data" => $details_data, "overall_summary_data" => $model->getSummaryData(), "export_excel" => $export_excel, "pagination" => $this->pagination->create_links());
     $this->load->view("reports/tabular_details", $data);
 }
Exemplo n.º 6
0
}
?>

<?php 
echo lang('sales_total');
?>
: <?php 
echo $this->config->item('round_cash_on_sales') && $is_sale_cash_payment ? str_replace('&#8209;', '-', to_currency(round_to_nearest_05($total))) : str_replace('&#8209;', '-', to_currency($total));
?>

<?php 
foreach ($payments as $payment_id => $payment) {
    ?>

<?php 
    echo isset($show_payment_times) && $show_payment_times ? date(get_date_format() . ' ' . get_time_format(), strtotime($payment['payment_date'])) : lang('sales_payment');
    ?>
  <?php 
    if ($is_integrated_credit_sale || sale_has_partial_credit_card_payment()) {
        $splitpayment = explode(':', $payment['payment_type']);
        echo $splitpayment[0];
        ?>
: <?php 
        echo $payment['card_issuer'] . ' ' . $payment['truncated_card'];
        ?>
 <?php 
    } else {
        $splitpayment = explode(':', $payment['payment_type']);
        echo $splitpayment[0];
        ?>
 <?php 
Exemplo n.º 7
0
 function suspend($suspend_type = 1)
 {
     $data['cart'] = $this->sale_lib->get_cart();
     $data['subtotal'] = $this->sale_lib->get_subtotal();
     $data['taxes'] = $this->sale_lib->get_taxes();
     $data['total'] = $this->sale_lib->get_total();
     $data['receipt_title'] = lang('sales_receipt');
     $data['transaction_time'] = date(get_date_format() . ' ' . get_time_format());
     $customer_id = $this->sale_lib->get_customer();
     $employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
     $sold_by_employee_id = $this->sale_lib->get_sold_by_employee_id();
     $comment = $this->sale_lib->get_comment();
     $comment = $this->sale_lib->get_comment();
     $show_comment_on_receipt = $this->sale_lib->get_comment_on_receipt();
     $emp_info = $this->Employee->get_info($employee_id);
     //Alain Multiple payments
     $data['payments'] = $this->sale_lib->get_payments();
     $data['amount_change'] = $this->sale_lib->get_amount_due() * -1;
     $data['balance'] = $this->sale_lib->get_payment_amount(lang('sales_store_account'));
     $data['employee'] = $emp_info->first_name . ' ' . $emp_info->last_name;
     if ($customer_id != -1) {
         $cust_info = $this->Customer->get_info($customer_id);
         $data['customer'] = $cust_info->first_name . ' ' . $cust_info->last_name . ($cust_info->company_name == '' ? '' : ' - ' . $cust_info->company_name) . ($cust_info->account_number == '' ? '' : ' - ' . $cust_info->account_number);
     }
     $total_payments = 0;
     foreach ($data['payments'] as $payment) {
         $total_payments += $payment['payment_amount'];
     }
     $sale_id = $this->sale_lib->get_suspended_sale_id();
     //SAVE sale to database
     $sale_id = $this->Sale->save($data['cart'], $customer_id, $employee_id, $sold_by_employee_id, $comment, $show_comment_on_receipt, $data['payments'], $sale_id, $suspend_type, '', '', $this->config->item('change_sale_date_when_suspending') ? date('Y-m-d H:i:s') : FALSE, $data['balance']);
     $data['sale_id'] = $this->config->item('sale_prefix') . ' ' . $sale_id;
     if ($data['sale_id'] == $this->config->item('sale_prefix') . ' -1') {
         $data['error_message'] = lang('sales_transaction_failed');
     }
     $this->sale_lib->clear_all();
     if ($this->config->item('show_receipt_after_suspending_sale')) {
         redirect('sales/receipt/' . $sale_id);
     } else {
         $this->_reload(array('success' => lang('sales_successfully_suspended_sale')));
     }
 }
Exemplo n.º 8
0
echo lang("employees_employee");
?>
</td><td width="15%"><?php 
echo lang("items_in_out_qty");
?>
</td><td width="45%"><?php 
echo lang("items_remarks");
?>
</td></tr></thead>
								<tbody>
									<?php 
foreach ($this->Inventory->get_inventory_data_for_item($item_info->item_id)->result_array() as $row) {
    ?>
										<tr  align="center">
											<td><?php 
    echo date(get_date_format() . ' ' . get_time_format(), strtotime($row['trans_date']));
    ?>
</td>
											<td>
												<?php 
    $person_id = $row['trans_user'];
    $employee = $this->Employee->get_info($person_id);
    echo $employee->first_name . " " . $employee->last_name;
    ?>
											</td>
											<td align="right"><?php 
    echo to_quantity($row['trans_inventory']);
    ?>
</td>
											
											<?php 
Exemplo n.º 9
0
					<?php 
}
?>
				</tr>
				</thead>
				<tbody>
				<?php 
foreach ($suspended_sales as $suspended_sale) {
    ?>
					<tr>
						<td><?php 
    echo $suspended_sale['sale_id'];
    ?>
</td>
						<td><?php 
    echo date(get_date_format() . ' @ ' . get_time_format(), strtotime($suspended_sale['sale_time']));
    ?>
</td>
						<td><?php 
    echo $suspended_sale['suspended'] == 1 ? lang('sales_layaway') : lang('sales_estimate');
    ?>
</td>
						<td>
							<?php 
    if (isset($suspended_sale['customer_id'])) {
        $customer = $this->Customer->get_info($suspended_sale['customer_id']);
        $company_name = $customer->company_name;
        if ($company_name) {
            echo $customer->first_name . ' ' . $customer->last_name . ' (' . $customer->company_name . ')';
        } else {
            echo $customer->first_name . ' ' . $customer->last_name;
 /**
  * Отображение страницы с предпросмотром созданных объявлений
  *
  * @param string $campaign_type тип создаваемой кампании
  */
 public function index($campaign_type)
 {
     $tmp = $this->campaigns->get_list(array('id_advertiser' => $this->user_id));
     $campaigns_list[''] = __("Select campaign to load targeting from");
     foreach ($tmp as $key => $value) {
         $campaigns_list[type_to_str($key, 'textcode')] = type_to_str($value, 'encode');
     }
     //Рекламодатель может выбирать для рекламы только те страны, которые не заблокированы в системе? тогда get_list(array('filter' => 'enabled'))
     $this->targeting_all_list->countries = $this->countries->get_list(array('filter' => 'enabled'));
     $error_message = '';
     $this->set_campaign_type($campaign_type);
     $this->setCurrentStep(uri_string());
     if (!$this->input->post('confirm_creation')) {
         $targeting_id = $this->new_campaign->get_targeting();
         $targeting_id_temp = $this->new_campaign->get_targeting(true);
         $this->targeting_groups->copy($targeting_id, $targeting_id_temp);
     }
     //изменение типа таргетинга в случае необходимости
     $this->set_targeting_type();
     $this->new_campaign->init_storage($this->id_xml);
     $ads_list = $this->new_campaign->get_ads_list();
     $ads_preview = '';
     $this->db->select('cs.*, ft.name title_font_name, ft2.name text_font_name, ft3.name url_font_name', false);
     $this->db->from('color_schemes cs');
     $this->db->join('fonts ft', 'ft.id_font = cs.title_id_font');
     $this->db->join('fonts ft2', 'ft2.id_font = cs.text_id_font');
     $this->db->join('fonts ft3', 'ft3.id_font = cs.url_id_font');
     $query = $this->db->get();
     $row = $query->row();
     foreach ($ads_list as $ad_id => $ad) {
         if ('text' == $ad->ad_type) {
             if ('cpa' != $campaign_type) {
                 $ad_preview = $this->parser->parse('common/text_ad_example.html', array('TITLE' => type_to_str($ad->title, 'encode'), 'DESCRIPTION' => type_to_str($ad->description1, 'encode'), 'DESCRIPTION2' => type_to_str($ad->description2, 'encode'), 'DISPLAY_URL' => $ad->display_url, 'DESTINATION_URL' => $ad->destination_protocol . "://" . $ad->destination_url, 'BACKGROUND_COLOR' => $row->background_color, 'BORDER_COLOR' => $row->border_color, 'TITLE_COLOR' => $row->title_color, 'TITLE_FONT_NAME' => $row->title_font_name, 'TITLE_FONT_SIZE' => $row->title_font_size, 'TITLE_FONT_STYLE' => $row->title_font_style, 'TITLE_FONT_WEIGHT' => $row->title_font_weight, 'TEXT_COLOR' => $row->text_color, 'TEXT_FONT_NAME' => $row->text_font_name, 'TEXT_FONT_SIZE' => $row->text_font_size, 'TEXT_FONT_STYLE' => $row->text_font_style, 'TEXT_FONT_WEIGHT' => $row->text_font_weight, 'URL_COLOR' => $row->url_color, 'URL_FONT_NAME' => $row->url_font_name, 'URL_FONT_SIZE' => $row->url_font_size, 'URL_FONT_STYLE' => $row->url_font_style, 'URL_FONT_WEIGHT' => $row->url_font_weight), FALSE);
             } else {
                 $ad_preview = $this->parser->parse('common/text_ad_cpa_example.html', array('TITLE' => type_to_str($ad->title, 'encode'), 'QUESTION' => type_to_str($ad->description1, 'encode'), 'QUESTION2' => type_to_str($ad->description2, 'encode'), 'EMAIL_TITLE' => $ad->email_title), FALSE);
             }
         } elseif ('image' == $ad->ad_type) {
             list($img_w, $img_h, $type, $attr) = getimagesize($this->config->item('path_to_campaign_creation_images') . $ad->image_id);
             if (13 == $type) {
                 //Для флэша используем специальный шаблон
                 $ad_preview = $this->parser->parse('common/image_ad_swf_example.html', array('TITLE' => type_to_str($ad->title, 'encode'), 'ID_IMAGE' => $ad->image_id, 'ID_SWF_CONTAINER' => str_replace('.', '', $ad->image_id), 'IMG_W' => $img_w, 'IMG_H' => $img_h, 'BGCOLOR' => $ad->bgcolor, 'DISPLAY_URL' => $ad->display_url, 'DESTINATION_URL' => $ad->destination_protocol . "://" . $ad->destination_url), FALSE);
             } else {
                 $ad_preview = $this->parser->parse('common/image_ad_example.html', array('TITLE' => type_to_str($ad->title, 'encode'), 'ID_IMAGE' => $ad->image_id, 'DISPLAY_URL' => $ad->display_url, 'DESTINATION_URL' => $ad->destination_protocol . "://" . $ad->destination_url), FALSE);
             }
         }
         $ads_preview .= $this->parser->parse('advertiser/manage_ads/campaigns/creation/review_selections/ad_box.html', array('AD_PREVIEW' => $ad_preview, 'AD_ID' => $ad_id), FALSE);
     }
     $campaign_main_info = $this->new_campaign->get_name_date();
     //определение настроек таргетинга
     $targeting_info = new Campaign_Targeting();
     $id_targeting = $this->new_campaign->get_targeting(true);
     $targeting_type = $this->new_campaign->get_targeting_type();
     $targeting_group_countries = $this->targeting_groups->get_group_list($id_targeting, 'countries');
     foreach ($targeting_group_countries as $country) {
         $targeting_info->countries[] = $country['value'];
     }
     if (0 == count($targeting_info->countries)) {
         foreach ($this->targeting_all_list->countries as $iso => $country) {
             $targeting_info->countries[] = $iso;
         }
     }
     $group_name = $this->new_campaign->get_group_name();
     $schedule = $this->new_campaign->get_schedule();
     if ('cpm_flatrate' == $campaign_type) {
         $added_sites_channels = $this->new_campaign->get_sites_channels(array('status' => 'all'));
         $added_sites_channels_ids = array();
         foreach ($added_sites_channels as $key => $value) {
             $added_sites_channels_ids[] = $key;
         }
         if (count($added_sites_channels_ids) > 0) {
             $this->load->model('channel');
             $params = array('fields' => 'id_site_channel, channels.ad_type, channels.name as channel_name,' . ' sites.url as site_url, sites.name as site_name, sites.id_site,' . ' channels.id_channel, dimensions.name as dimension_name, channels.id_dimension,' . ' dimensions.width, dimensions.height', 'disable_site_ordering' => true, 'order_by' => 'site_url', 'order_direction' => 'asc', 'site_channel_id_filter' => $added_sites_channels_ids);
             $sites_channels_array = $this->channel->get_sites_channels($params);
         } else {
             $error_message = __("At least one channel must be added to campaign.");
             $sites_channels_array = array();
         }
         $this->table_builder->clear();
         $this->table_builder->insert_empty_cells = false;
         $data_rows_conut = sizeof($sites_channels_array);
         $this->table_builder->add_attribute('class', 'xTable');
         $this->table_builder->set_cell_content(0, 0, __('Site'));
         $this->table_builder->set_cell_content(0, 1, __('Channel'));
         $this->table_builder->add_row_attribute(0, 'class', 'th');
         $this->table_builder->add_col_attribute(0, 'class', 'simpleTitle');
         $this->table_builder->add_col_attribute(1, 'class', 'simpleTitle');
         $row_counter = 0;
         for ($i = 0; $i < $data_rows_conut; $i++) {
             $row_counter++;
             $this->table_builder->set_cell_content($row_counter, 0, type_to_str($sites_channels_array[$i]['site_name'], 'encode') . ' (<a target="_blank" href="http://' . $sites_channels_array[$i]['site_url'] . '">' . $sites_channels_array[$i]['site_url'] . '</a>)');
             $this->table_builder->set_cell_content($row_counter, 1, type_to_str($sites_channels_array[$i]['channel_name'], 'encode'));
         }
         if (0 == $data_rows_conut) {
             $this->table_builder->set_cell_content(1, 0, __('Records not found'));
             $this->table_builder->cell(1, 0)->add_attribute('colspan', 2);
             $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata');
         }
         $channels_table = $this->table_builder->get_html();
         // Проверяем, все ли нормально у кампании?
         $error_message = $this->new_campaign->check_ads();
         if ('' == $error_message && $this->input->post('confirm_creation')) {
             $id_campaign = $this->create_campaign('cpm_flatrate');
             if (is_numeric($id_campaign)) {
                 redirect('advertiser/manage_ads/campaign/' . type_to_str($id_campaign, 'textcode'));
                 return;
             }
             $error_message = $id_campaign;
         }
         $data = array('ERROR_MESSAGE' => '' != $error_message ? $this->parser->parse('advertiser/manage_ads/campaigns/creation/review_selections/error.html', array('ERROR' => $error_message), FALSE) : '', 'CAMPAIGN_NAME' => htmlentities($campaign_main_info['name'], ENT_COMPAT, "utf-8"), 'TARGETING_INFO' => json_encode($targeting_info), 'SCHEDULE' => json_encode($schedule), 'TARGETING_ALL_LIST' => json_encode($this->targeting_all_list), 'CAMPAIGNS_LIST' => json_encode($campaigns_list), 'GROUP_NAME' => htmlentities($group_name, ENT_COMPAT, "utf-8"), 'CAMPAIGN_COST' => type_to_str($this->new_campaign->get_campaign_cost(), 'money'), 'ACTIVE_TARGETING_TYPE' => $targeting_type, 'CHANNELS_PREVIEW' => $channels_table, 'EDIT_CAMP_MAIN_URL' => 'advertiser/create_campaign_step_main/index/cpm_flatrate', 'EDIT_GROUP_MAIN_URL' => 'advertiser/create_campaign_step_group_name/index/cpm_flatrate', 'EDIT_SITES_CHANNELS_URL' => 'advertiser/create_campaign_step_choose_sites_channels/index/cpm_flatrate', 'EDIT_SET_PRICING_URL' => 'advertiser/create_campaign_step_set_pricing/index/cpm_flatrate', 'EDIT_AD_URL' => 'advertiser/create_campaign_step_create_ad/index/cpm_flatrate', 'ADS_PREVIEW' => $ads_preview, 'CAMPAIGN_SCHEME' => $this->load->view('advertiser/manage_ads/campaigns/campaign_scheme.html', '', TRUE), 'NUMBERFORMAT' => get_number_format(), 'TARGETING_GROUP_ID_ENCODED' => type_to_str($id_targeting, 'textcode'), 'TIMEZONE' => sprintf(__("Scheduling runs at server time. Server is set for <b>%s</b> time zone. At the moment server time is <b>%s</b>."), gmdate('T') . date('P'), date('H:i')), 'TIME_HOURS_FORMAT' => substr_count(get_time_format(), 'A') > 0 ? '12' : '24');
         $this->_set_content($this->parser->parse('advertiser/manage_ads/campaigns/creation/review_selections/body.html', $data, FALSE));
     }
     $this->_display();
 }
Exemplo n.º 11
0
 function receipt($receiving_id)
 {
     //Before changing the recv session data, we need to save our current state in case they were in the middle of a recv
     $this->receiving_lib->save_current_recv_state();
     $receiving_info = $this->Receiving->get_info($receiving_id)->row_array();
     $this->receiving_lib->copy_entire_receiving($receiving_id);
     $data['cart'] = $this->receiving_lib->get_cart();
     $data['total'] = $this->receiving_lib->get_total();
     $data['receipt_title'] = lang('receivings_receipt');
     $data['transaction_time'] = date(get_date_format() . ' ' . get_time_format(), strtotime($receiving_info['receiving_time']));
     $supplier_id = $this->receiving_lib->get_supplier();
     $emp_info = $this->Employee->get_info($receiving_info['employee_id']);
     $data['payment_type'] = $receiving_info['payment_type'];
     $data['employee'] = $emp_info->first_name . ' ' . $emp_info->last_name;
     if ($supplier_id != -1) {
         $supplier_info = $this->Supplier->get_info($supplier_id);
         $data['supplier'] = $supplier_info->company_name;
         if ($supplier_info->first_name || $supplier_info->last_name) {
             $data['supplier'] .= ' (' . $supplier_info->first_name . ' ' . $supplier_info->last_name . ')';
         }
     }
     $data['receiving_id'] = 'RECV ' . $receiving_id;
     $current_location_id = $this->Employee->get_logged_in_employee_current_location_id();
     $current_location = $this->Location->get_info($receiving_info['location_id']);
     $data['transfer_from_location'] = $current_location->name;
     if ($receiving_info['transfer_to_location_id'] > 0) {
         $transfer_to_location = $this->Location->get_info($receiving_info['transfer_to_location_id']);
         $data['transfer_to_location'] = $transfer_to_location->name;
     }
     $this->load->view("receivings/receipt", $data);
     $this->receiving_lib->clear_all();
     //Restore previous state saved above
     $this->receiving_lib->restore_current_recv_state();
 }
    ?>
</th>
								</tr>
							</thead>
							<tbody>
								<?php 
    $amount_due = false;
    foreach ($data['store_account_transactions'] as $transaction) {
        ?>
								<tr>
									<td><?php 
        echo $transaction['sno'];
        ?>
</td>
									<td><?php 
        echo date(get_date_format() . ' ' . get_time_format(), strtotime($transaction[$date_column]));
        ?>
</td>
									<td><?php 
        echo $transaction['sale_id'] ? anchor('sales/receipt/' . $transaction['sale_id'], $this->config->item('sale_prefix') . ' ' . $transaction['sale_id'], array('target' => '_blank')) : '-';
        ?>
</td>
									<td><?php 
        echo $transaction['transaction_amount'] > 0 ? to_currency($transaction['transaction_amount']) : to_currency(0);
        ?>
</td>
									<td><?php 
        echo $transaction['transaction_amount'] < 0 ? to_currency($transaction['transaction_amount'] * -1) : to_currency(0);
        ?>
</td>
									<td><?php 
Exemplo n.º 13
0
		
		
		
		<div id="user-nav" class="hidden-print hidden-xs">
			<ul class="btn-group ">
				<li class="btn  hidden-xs"><a title="" href="<?php 
echo site_url('login/switch_user');
?>
" data-toggle="modal" data-target="#myModal" ><i class="icon fa fa-user fa-2x"></i> <span class="text">	<?php 
echo lang('common_welcome') . " <b> {$user_info->first_name} {$user_info->last_name}! </b>";
?>
</span></a></li>
				<li class="btn  hidden-xs disabled" >
					<a title="" href="" onclick="return false;"><i class="icon fa fa-clock-o fa-2x"></i> <span class="text">
					<?php 
echo date(get_time_format());
?>
					<?php 
echo date(get_date_format());
?>
					</span></a>
				</li>
				<?php 
if ($this->Employee->has_module_permission('config', $this->Employee->get_logged_in_employee_info()->person_id)) {
    ?>
					<li class="btn "><?php 
    echo anchor("config", '<i class="icon fa fa-cog"></i><span class="text">' . lang("common_settings") . '</span>');
    ?>
</li>
				<?php 
}
Exemplo n.º 14
0
echo lang('common_delete');
?>
</th>
				</tr>
				</thead>
				<tbody>
				<?php 
foreach ($suspended_receivings as $suspended_receiving) {
    ?>
					<tr>
						<td><?php 
    echo $suspended_receiving['receiving_id'];
    ?>
</td>
						<td><?php 
    echo date(get_date_format() . ' @ ' . get_time_format(), strtotime($suspended_receiving['receiving_time']));
    ?>
</td>
						<td>
							<?php 
    if (isset($suspended_receiving['supplier_id'])) {
        $supplier = $this->Supplier->get_info($suspended_receiving['supplier_id']);
        echo $supplier->company_name . ' (' . $supplier->first_name . ' ' . $supplier->last_name . ')';
    } else {
        ?>
								&nbsp;
							<?php 
    }
    ?>
						</td>
						<td><?php