/**
  * Отображение формы задания названия группы в кампании
  *
  * @param string $campaign_type тип создаваемой кампании
  */
 public function index($campaign_type)
 {
     $error_message = '';
     $this->review_mode = $this->input->post('review_mode');
     $this->new_campaign->init_storage($this->id_xml);
     $this->set_campaign_type($campaign_type);
     $this->setCurrentStep(uri_string());
     if (count($this->new_campaign->get_sites_channels(array('status' => 'old'))) + count($this->new_campaign->get_sites_channels(array('status' => 'new'))) == 0) {
         $this->next_step = uri_string();
         $error_message = __('At least one Site/Channel is required');
     }
     $cost = $this->new_campaign->get_sites_channels_new_cost();
     $ballance = $this->entity->ballance($this->user_id);
     $temp = $cost - $ballance;
     if ($temp > 0) {
         $this->next_step = uri_string();
         $error_message = __('You can not create a new campaign, because you have insufficient funds in the account. Make a deposit and then try again.');
     }
     if (is_null($this->next_step)) {
         $this->next_step = $this->get_next_step_controller();
     }
     $form = array("id" => $campaign_type, "name" => "set_pricing_form", "vars" => array('REVIEW_MODE' => $this->review_mode, 'HIDE_OLD_SITES_CHANNELS' => $this->hide_old_sites_channels ? 'style="display:none;"' : '', 'NUMBERFORMAT' => get_number_format(), 'MONEYFORMAT' => get_money_format(), 'CAMPAIGN_TYPE' => $campaign_type, 'ERROR_MESSAGE' => '' != $error_message ? $this->parser->parse('advertiser/manage_ads/campaigns/creation/set_pricing/error.html', array('ERROR' => $error_message), FALSE) : '', 'CAMPAIGN_SCHEME' => $this->load->view('advertiser/manage_ads/campaigns/campaign_scheme.html', '', TRUE)), "view" => "advertiser/manage_ads/campaigns/creation/set_pricing/body.html", "redirect" => $this->next_step, "fields" => array("daily_impressions" => array("display_name" => __("Daily Impressions"), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => "positive|integer")));
     $content = $this->form->get_form_content('modify', $form, $this->input, $this);
     $this->_set_content($content);
     $this->_display();
 }
 /**
  * показывает форму для изменения платежного шлюза
  *
  * @param $id - идентификатор редактируемой новости, если null - создание новости
  * @return ничего не возвращает
  */
 public function index($id = null)
 {
     if (!is_null($id)) {
         $this->payment_gateway_id = $id;
         $this->info = $this->payment_gateways->get_edit_info($id);
     } else {
         redirect('admin/manage_payment_gateways');
     }
     $form = array("name" => 'edit_payment_gateway_form', "id" => $this->payment_gateway_id, "vars" => array('ACCOUNT_ID_1_TITLE' => $this->info->account_id_1_title, 'ACCOUNT_ID_2_TITLE' => $this->info->account_id_2_title, 'ACCOUNT_ID_3_TITLE' => $this->info->account_id_3_title, 'GATEWAY_NAME' => $this->payment_gateways->get_name($this->payment_gateway_id), 'MONEYFORMAT' => get_money_format(), 'NUMBERFORMAT' => get_number_format()), "view" => "admin/settings/manage_payment_gateways/edit.html", "redirect" => 'admin/edit_payment_gateways/edit_complete', 'kill' => array($this->info->use_textarea ? 'useinput' : 'usetextarea'), "fields" => array("account_id1" => array("display_name" => __($this->info->account_id_1_title), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => $this->info->validation_rules_1), "used_for" => array("display_name" => __("Used For"), "id_field_type" => "string", "form_field_type" => "select", "validation_rules" => "required"), "fund_comm" => array("display_name" => __("Fund Commission"), "id_field_type" => "integer", "form_field_type" => "text", "validation_rules" => "integer|non_negative"), "withdraw_comm" => array("display_name" => __("Withdraw Commission"), "id_field_type" => "integer", "form_field_type" => "text", "validation_rules" => "float|non_negative"), "minimal_payment" => array("display_name" => __("Minimal payment"), "id_field_type" => "float", "form_field_type" => "text", "validation_rules" => "float[2]|non_negative")));
     if ($this->publishers_is_enabled) {
         switch ($this->info->possibility_mode) {
             case 'deposit':
                 $form['fields']['used_for']['options'] = array('deposit' => __('Deposit'));
                 $form['fields']['used_for']['default'] = 'deposit';
                 break;
             case 'withdraw':
                 $form['fields']['used_for']['options'] = array('withdraw' => __('Withdraw'));
                 $form['fields']['used_for']['default'] = 'withdraw';
                 break;
             case 'all':
                 $form['fields']['used_for']['options'] = array('deposit' => __('Deposit'), 'withdraw' => __('Withdraw'), 'both' => __('Deposit & Withdraw'));
                 $form['fields']['used_for']['default'] = 'both';
         }
     } else {
         $form['fields']['used_for']['options'] = array('deposit' => __('Deposit'));
         $form['fields']['used_for']['default'] = 'deposit';
     }
     if ($this->info->use_account_id_2) {
         $form['fields']['account_id2'] = array("display_name" => __($this->info->account_id_2_title), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => $this->info->validation_rules_2);
         $form['vars']['ACCOUNT_ID_2_VISIBLE'] = '';
         if ($this->info->max_2) {
             $form['fields']['account_id2']['max'] = $this->info->max_2;
         }
     } else {
         $form['vars']['ACCOUNT_ID_2_VISIBLE'] = 'style="display:none"';
     }
     if ($this->info->use_account_id_3) {
         $form['fields']['account_id3'] = array("display_name" => __($this->info->account_id_3_title), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => $this->info->validation_rules_3);
         $form['vars']['ACCOUNT_ID_3_VISIBLE'] = '';
         if ($this->info->max_3) {
             $form['fields']['account_id3']['max'] = $this->info->max_3;
         }
     } else {
         $form['vars']['ACCOUNT_ID_3_VISIBLE'] = 'style="display:none"';
     }
     if ($this->info->max_1) {
         $form['fields']['account_id1']['max'] = $this->info->max_1;
     }
     $this->_set_content($this->form->get_form_content("modify", $form, $this->input, $this));
     $this->_display();
 }
 /**
  * Отображение формы выбора сайтов/каналов группы в кампании
  *
  * @param string $campaign_type тип создаваемой кампании
  */
 public function index($campaign_type)
 {
     $this->set_campaign_type($campaign_type);
     $this->setCurrentStep(uri_string());
     $this->review_mode = $this->input->post('review_mode');
     $add_site_channel = $this->session->userdata('add_site_channel');
     if (FALSE !== $add_site_channel) {
         $add_site_channel = json_decode($add_site_channel);
         if ('cpm_flatrate' == $add_site_channel->program_type) {
             $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->load->model('channel_program');
                     $default_program = $this->channel_program->get_default_program(array('id_site_channel' => $site_channel_info->id_site_channel));
                     if (!is_null($default_program)) {
                         $this->new_campaign->init_storage($this->id_xml);
                         $this->new_campaign->add_site_channel(array('id_site_channel' => $site_channel_info->id_site_channel, 'id_program' => $default_program['id_program'], 'cost' => $default_program['cost'], 'volume' => $default_program['volume'], 'ad_type' => $default_program['ad_type'], 'is_autorenew' => 'false'), FALSE);
                         //не перезаписывать настройки ранее добавленного сайта-канала
                         $this->new_campaign->save_data();
                         $this->_set_notification(sprintf(__('Channel „%s“ at site „%s (%s)“ choosed by you in Site Directory was successfully appended to „Recently added channels“ list'), type_to_str($channel_info->name, 'encode'), type_to_str($site_info->name, 'encode'), $site_info->url));
                     } else {
                         $this->_set_notification(sprintf(__('Due to error channel „%s“ at site „%s (%s)“ choosed by you in Site Directory was not appended to „Recently added channels“ list'), type_to_str($channel_info->name, 'encode'), type_to_str($site_info->name, 'encode'), $site_info->url), 'error');
                     }
                 } else {
                     $this->_set_notification(sprintf(__('Due to error channel „%s“ at site „%s (%s)“ choosed by you in Site Directory was not appended to „Recently added channels“ list'), type_to_str($channel_info->name, 'encode'), type_to_str($site_info->name, 'encode'), $site_info->url), 'error');
                 }
             }
         }
         $this->session->unset_userdata('add_site_channel');
     }
     $categories_tree = $this->category_model->get_html_tree();
     $form_data = array('name' => 'choose_sites_channels_form', 'view' => 'advertiser/manage_ads/campaigns/creation/step_choose_sites_channels/body.html', 'redirect' => $this->get_next_step_controller(), 'vars' => array('REVIEW_MODE' => $this->review_mode, 'NEXT_STEP_CONTROLLER' => $this->get_next_step_controller(), 'HIDE_OLD_SITES_CHANNELS' => $this->hide_old_sites_channels ? 'style="display:none;"' : '', 'CATEGORIES_TREE' => $categories_tree, 'MONEYFORMAT' => get_money_format(), 'NUMBERFORMAT' => get_number_format(), 'CAMPAIGN_SCHEME' => $this->load->view('advertiser/manage_ads/campaigns/campaign_scheme.html', '', TRUE)), "fields" => array("dummy" => array("id_field_type" => "hidden", "form_field_type" => "text")));
     $content = $this->form->get_form_content('create', $form_data, $this->input, $this);
     $this->_set_content($content);
     $this->_display();
 }
Example #4
0
 /**
  * функция по умолчанию, отображает формы для внесения платежей
  *
  * @return ничего не возвращает
  */
 public function index()
 {
     $LOG =& load_class('Log');
     $LOG->write_log('ERROR', 'Add Funds Index');
     $this->_set_title(implode(self::TITLE_SEP, array(__("Advertiser"), __("Add Funds"))));
     $this->_set_help_index("advertiser_add_funds");
     $this->load->model('payment_gateways', '', TRUE);
     //      $list = $this->payment_gateways->get_list(array('name' => TRUE, 'filter' => 'enabled'));
     $list = $this->payment_gateways->get_list(array('fields' => array('id_gateway', 'name', 'fund_comm', 'minimal_payment'), 'filter' => 'enabled', 'deposit' => 'true'));
     $forms = '';
     $options = '';
     $this->load->library("form");
     $select_id = $this->input->post('id');
     if (is_array($list)) {
         $row = current($list);
         include APPPATH . "controllers/common/gateways/paypal.php";
         if (!isset($this->content['paypalNEEDAGREE'])) {
             $this->content['paypalNEEDAGREE'] = '';
         }
     }
     $vars = array('GATEWAYFORMS' => $forms, 'LIST' => $options, 'MONEYFORMAT' => get_money_format(), 'NUMBERFORMAT' => get_number_format());
     $this->_set_content($this->parser->parse('advertiser/add_funds/form.html', $vars, TRUE));
     $this->_display();
 }
Example #5
0
function draw_office_plan($office, $fact_array)
{
    global $db_rs;
    // Массив для средних показателей по всей компании;
    $full_sum_out_plan = array();
    $full_sum_out_fact = array();
    $full_sum_out_plan_complete = array();
    $full_count_out_plan = array();
    $full_count_out_fact = array();
    $full_count_out_plan_complete = array();
    $full_round_check_plan = array();
    $full_round_check_fact = array();
    $full_round_check_plan_complete = array();
    $full_count_in_plan = array();
    $full_count_in_fact = array();
    $full_count_in_plan_complete = array();
    // Если офис не указан, выводим все офисы;
    // Получаме все офисы которым стоит план;
    $sql = "SELECT * FROM `money_plan` WHERE `month_plan` = '" . date('m/Y') . "' " . ($office == '' ? '' : "AND `office` = '" . $office . "'") . ";";
    $office_array = $db_rs->all($sql);
    /*if(count($office_array) == 0){
            $sql = "SELECT * FROM `money_plan` WHERE `month_plan` = '".date('m/Y', strtotime("-1 months", strtotime(date('Y-m-d H:i:s'))))."' ".($office == '' ? '' : "AND `office` = '".$office."'").";";
            $office_array = $db_rs->all($sql);
        }
    */
    $html = '';
    $html .= '<table style="font-size: 0.8em; width: 800px;background-color: #d8d8d8;">';
    $html .= '<tr align="center"><td></td><td>План</td><td colspan="2">Факт</td><td colspan="2">Прогноз</td></tr>';
    foreach ($office_array as $key => $office) {
        /*
         * План по офису;
         * */
        // План на выдачу;
        $tech_out_money = $office['sum_out_tech'];
        // План по кличеству выдачи;
        $count_out_tech = $office['count_out_tech'];
        // Средний чек пвыдачи;
        $avr_out_tech_check = $office['avr_out_tech_check'];
        // Прием кол-во;
        $count_in_tech = $office['count_in_tech'];
        /*
        // Быстрые продажи;
        $fast_sale = $office['sales'];
        // Количество продаж;
        $fast_sale_count = $office['sales_count'];
        */
        /*
         *  Забираем данные из факта по этому офису
         * */
        $office_data = array();
        foreach ($fact_array as $fact) {
            if ($fact['code'] == $office['office']) {
                $office_data['take_sum'] = $fact['take_sum'];
                $office_data['take_count'] = $fact['out_tech_with_money_count'];
                $office_data['count_in_tech'] = $fact['in_tech_count'];
                break;
            }
        }
        /*
         * Далее считаем прогноз;
         * */
        // Сколько дней прошло с начала месяца;
        $days_from_start = (strtotime(date('Y-m-d')) - strtotime(date('Y-m') . '-01')) / 86400 + 1;
        // Сколько дней осталось до конца месяца;
        $day_to_finish = (strtotime("+1 month", strtotime(date('Y-m'))) - strtotime(date('Y-m-d'))) / 86400 - 1;
        /*
         * Высчитываем прогноз для каждой статьи;
         * */
        $tech_out_money_forecast = $office_data['take_sum'] + round($office_data['take_sum'] / $days_from_start * $day_to_finish);
        $tech_out_count_forecast = $office_data['take_count'] + round($office_data['take_count'] / $days_from_start * $day_to_finish);
        $tech_in_count_forecast = $office_data['count_in_tech'] + round($office_data['count_in_tech'] / $days_from_start * $day_to_finish);
        $avr_out_tech_check_forecast = $office_data['take_count'] + round($office_data['take_count'] / $days_from_start * $day_to_finish);
        $avr_out_tech_check_forecast = $tech_out_money_forecast / $avr_out_tech_check_forecast;
        /*
        $fast_sale_forecast = $office_data['sale_sum'] + round(($office_data['sale_sum'] / $days_from_start) * $day_to_finish);
        $fast_sale_count_forecast = $office_data['sale_count'] + round(($office_data['sale_count'] / $days_from_start) * $day_to_finish);
        */
        /*
        echo $days_from_start.'<br>';
        echo $day_to_finish.'<br>';
        */
        /**
                Вывод ля информареа
        */
        /*
                $html .= '<b>'.get_office_name($office['office']).'</b><br>';
                $html .= '</div>';
                $html .= '</div>';
                $html .= '</div>';
                $html .= '</div>';
        */
        /**
                Вывод для страницы - табличный вывод;
        */
        $html .= '<tr>';
        $html .= '<td colspan="6" align="center"><b>' . get_office_name($office['office']) . '</b></td>';
        $html .= '</tr>';
        $full_sum_out_plan[] = $tech_out_money;
        $full_sum_out_fact[] = $office_data['take_sum'];
        $full_sum_out_plan_complete[] = round($office_data['take_sum'] * 100 / $tech_out_money, 0);
        $html .= '<tr>';
        $html .= '<td>Сумма выдачи</td>';
        $html .= '<td><div class="money_plan" title="План">' . get_money_format($tech_out_money) . ' р.</div></td>';
        $html .= '<td><div class="money_fact" title="Факт">' . get_money_format($office_data['take_sum']) . ' р.</div></td>';
        $html .= '<td><div class="plan_percent" title="% выполнения">' . round($office_data['take_sum'] * 100 / $tech_out_money, 0) . '%</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . get_money_format($tech_out_money_forecast) . ' р.</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($tech_out_money_forecast * 100 / $tech_out_money, 0) . '%</div></td>';
        $html .= '</tr>';
        $full_count_out_plan[] = $count_out_tech;
        $full_count_out_fact[] = $office_data['take_count'];
        $full_count_out_plan_complete[] = round($office_data['take_count'] * 100 / $count_out_tech, 0);
        $html .= '<tr>';
        $html .= '<td>Кол-во выдачи</td>';
        $html .= '<td><div class="money_plan" title="План">' . $count_out_tech . '</div></td>';
        $html .= '<td><div class="money_fact" title="Факт">' . $office_data['take_count'] . '</div></td>';
        $html .= '<td><div class="plan_percent" title="% выполнения">' . round($office_data['take_count'] * 100 / $count_out_tech, 0) . '%</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . $tech_out_count_forecast . '</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($tech_out_count_forecast * 100 / $count_out_tech, 0) . '%</div></td>';
        $html .= '</tr>';
        $full_round_check_plan[] = $avr_out_tech_check;
        $full_round_check_fact[] = round($office_data['take_sum'] / $office_data['take_count']);
        $full_round_check_plan_complete[] = round($office_data['take_sum'] / $office_data['take_count'] * 100 / $avr_out_tech_check, 0);
        $html .= '<tr>';
        $html .= '<td>Средний чек выдачи</td>';
        $html .= '<td><div class="money_plan" title="План">' . get_money_format($avr_out_tech_check) . ' р.</div></td>';
        $html .= '<td><div class="money_fact" title="Факт">' . get_money_format(round($office_data['take_sum'] / $office_data['take_count'])) . ' р.</div></td>';
        $html .= '<td><div class="plan_percent" title="% выполнения">' . round($office_data['take_sum'] / $office_data['take_count'] * 100 / $avr_out_tech_check, 0) . '%</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . get_money_format($avr_out_tech_check_forecast) . ' р.</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($avr_out_tech_check_forecast * 100 / $avr_out_tech_check, 0) . '%</div></td>';
        $html .= '</tr>';
        $full_count_in_plan[] = $count_in_tech;
        $full_count_in_fact[] = $office_data['count_in_tech'];
        $full_count_in_plan_complete[] = round($office_data['count_in_tech'] * 100 / $count_in_tech, 0);
        $html .= '<tr>';
        $html .= '<td>Кол-во приёма</td>';
        $html .= '<td><div class="money_plan" title="План">' . $count_in_tech . '</div></td>';
        $html .= '<td><div class="money_fact" title="Факт">' . $office_data['count_in_tech'] . '</div></td>';
        $html .= '<td><div class="plan_percent" title="% выполнения">' . round($office_data['count_in_tech'] * 100 / $count_in_tech, 0) . '%</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . $tech_in_count_forecast . '</div></td>';
        $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($tech_in_count_forecast * 100 / $count_in_tech, 0) . '%</div></td>';
        $html .= '</tr>';
        /*
        $html .= '<div style="font-size: 0.8em;">Быстрые продажи <div class="money_plan" title="План">'.get_money_format($fast_sale).' р.</div><div class="money_fact" title="Факт">'.get_money_format($office_data['sale_sum']).' р.</div><div class="plan_percent" title="% выполнения">'.round($office_data['sale_sum']*100/$fast_sale, 0).'%</div><div class="forecast_plan_percent" title="Прогноз выполнения">'.get_money_format($fast_sale_forecast).' р.</div><div class="forecast_plan_percent" title="Прогноз %">'.round($fast_sale_forecast*100/$fast_sale, 0).'%</div></div>';
        $html .= '<div style="font-size: 0.8em;">Количество продаж <div class="money_plan" title="План">'.$fast_sale_count.'</div><div class="money_fact" title="Факт">'.$office_data['sale_count'].'</div><div class="plan_percent" title="% выполнения">'.round($office_data['sale_count']*100/$fast_sale_count, 0).'%</div><div class="forecast_plan_percent" title="Прогноз выполнения">'.$fast_sale_count_forecast.'</div><div class="forecast_plan_percent" title="Прогноз %">'.round($fast_sale_count_forecast*100/$fast_sale_count, 0).'%</div></div>';
        */
        if ($key != count($office_array) - 1) {
            ///$html .= '<br>';
        }
    }
    // Сколько дней прошло с начала месяца;
    $days_from_start = (strtotime(date('Y-m-d')) - strtotime(date('Y-m') . '-01')) / 86400 + 1;
    // Сколько дней осталось до конца месяца;
    $day_to_finish = (strtotime("+1 month", strtotime(date('Y-m'))) - strtotime(date('Y-m-d'))) / 86400 - 1;
    $average_tech_out_money_forecast = array_sum($full_sum_out_fact) + round(array_sum($full_sum_out_fact) / $days_from_start * $day_to_finish);
    $average_tech_out_count_forecast = array_sum($full_count_out_fact) + round(array_sum($full_count_out_fact) / $days_from_start * $day_to_finish);
    $average_tech_in_count_forecast = array_sum($full_count_in_fact) + round(array_sum($full_count_in_fact) / $days_from_start * $day_to_finish);
    $average_avr_out_tech_check_forecast = array_sum($full_count_out_fact) / count($full_count_out_fact) + round(array_sum($full_count_out_fact) / count($full_count_out_fact) / $days_from_start * $day_to_finish);
    $average_avr_out_tech_check_forecast = $average_tech_out_money_forecast / count($full_sum_out_fact) / $average_avr_out_tech_check_forecast;
    // Выводим средние показатели по всей компании;
    $html .= '<tr>';
    $html .= '<td colspan="6" align="center"><b>Показатели по всей компании</b></td>';
    $html .= '</tr>';
    $html .= '<tr align="center"><td></td><td>План</td><td colspan="2">Факт</td><td colspan="2">Прогноз</td></tr>';
    $html .= '<tr>';
    $html .= '<td>Сумма выдачи</td>';
    $html .= '<td><div class="money_plan" title="План">' . get_money_format(array_sum($full_sum_out_plan)) . ' р.</div></td>';
    $html .= '<td><div class="money_fact" title="Факт">' . get_money_format(array_sum($full_sum_out_fact)) . ' р.</div></td>';
    $html .= '<td><div class="plan_percent" title="% выполнения">' . round(array_sum($full_sum_out_plan_complete) / count($full_sum_out_plan_complete)) . '%</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . get_money_format($average_tech_out_money_forecast) . ' р.</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($average_tech_out_money_forecast * 100 / array_sum($full_sum_out_plan)) . '%</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td>Кол-во выдачи</td>';
    $html .= '<td><div class="money_plan" title="План">' . array_sum($full_count_out_plan) . '</div></td>';
    $html .= '<td><div class="money_fact" title="Факт">' . array_sum($full_count_out_fact) . '</div></td>';
    $html .= '<td><div class="plan_percent" title="% выполнения">' . round(array_sum($full_count_out_plan_complete) / count($full_count_out_plan_complete)) . '%</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . $average_tech_out_count_forecast . '</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($average_tech_out_count_forecast * 100 / array_sum($full_count_out_plan)) . '%</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td>Средний чек выдачи</td>';
    $html .= '<td><div class="money_plan" title="План">' . get_money_format(array_sum($full_round_check_plan) / count($full_round_check_plan)) . ' р.</div></td>';
    $html .= '<td><div class="money_fact" title="Факт">' . get_money_format(array_sum($full_round_check_fact) / count($full_round_check_fact)) . ' р.</div></td>';
    $html .= '<td><div class="plan_percent" title="% выполнения">' . round(array_sum($full_round_check_plan_complete) / count($full_round_check_plan_complete)) . '%</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . get_money_format($average_avr_out_tech_check_forecast) . ' р.</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($average_avr_out_tech_check_forecast * 100 / (array_sum($full_round_check_plan) / count($full_round_check_plan))) . '%</div></td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td>Кол-во приёма</td>';
    $html .= '<td><div class="money_plan" title="План">' . array_sum($full_count_in_plan) . '</div></td>';
    $html .= '<td><div class="money_fact" title="Факт">' . array_sum($full_count_in_fact) . '</div></td>';
    $html .= '<td><div class="plan_percent" title="% выполнения">' . round(array_sum($full_count_in_plan_complete) / count($full_count_in_plan_complete)) . '%</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз выполнения">' . $average_tech_in_count_forecast . '</div></td>';
    $html .= '<td><div class="forecast_plan_percent" title="Прогноз %">' . round($average_tech_in_count_forecast * 100 / array_sum($full_count_in_plan)) . '%</div></td>';
    $html .= '</tr>';
    $html .= '</table>';
    $html .= '
                <script>
                    $(\'.money_plan\').tipsy();
                    $(\'.money_fact\').tipsy();
                    $(\'.plan_percent\').tipsy();
                    $(\'.forecast_plan_percent\').tipsy();
                </script>
            ';
    return $html;
}
Example #6
0
             if ($good_price <= 1000) {
                 $user_prize = 100;
             }
         } else {
             $user_prize = 0;
         }
     }
     $html .= '<tr>';
     $html .= '<td class="' . $class . '" align="center">' . $sales['id'] . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . get_local_date_time($sales['date']) . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . get_office_name($sales['office']) . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . get_user_full_name('', $sales['user_full_name']) . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . $good_name . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . get_money_format($sales['item_price3']) . 'р.</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . ($sales['stock'] == '1' ? 'Да' : 'Нет') . '</td>';
     $html .= '<td class="' . $class . ' inf_row" align="center">' . get_money_format($user_prize) . 'р.</td>';
     $html .= '</tr>';
     // Считаем суммы тоже;
     //$sums['sales_count'] += $sales['sales_count'];
     //$sums['sales_sum'] += $sales['sales_sum'];
     //$sums['sales_profit'] += $sales['sales_profit'];
 }
 /*
             $html .= '<tr>';
             $html .= '<td class="row_top">ИТОГО</td>';
             $html .= '<td class="row_top inf_row">'.$sums['sales_count'].'</td>';
             $html .= '<td class="row_top inf_row">'.$sums['sales_sum'].'</td>';
             $html .= '<td class="row_top inf_row">'.$sums['sales_profit'].'</td>';
             $html .= '</tr>';
 */
 $html .= '</table>';
 /**
  * Отображение формы выбора сайтов/каналов группы в кампании
  *
  * @param string $campaign_type тип создаваемой кампании
  */
 public function index($campaign_type)
 {
     $this->set_campaign_type($campaign_type);
     $this->setCurrentStep(uri_string());
     $this->review_mode = $this->input->post('review_mode');
     $this->new_campaign->init_storage($this->id_xml);
     $add_site_channel = $this->session->userdata('add_site_channel');
     if (FALSE !== $add_site_channel) {
         $add_site_channel = json_decode($add_site_channel);
         if ('cpc' == $add_site_channel->program_type) {
             $id_site = type_cast($add_site_channel->site_code, 'textcode');
             $site_info = $this->site->get_info($id_site);
             if (!is_null($site_info)) {
                 if (FALSE != $this->new_campaign->add_site($id_site)) {
                     $places = $this->new_campaign->get_places();
                     if (false !== ($index = array_search('allsites', $places))) {
                         unset($places[$index]);
                     }
                     if (!in_array('sites', $places)) {
                         $places[] = 'sites';
                     }
                     $this->new_campaign->set_places($places);
                     $this->new_campaign->save_data();
                     $this->_set_notification(sprintf(__('Site &bdquo;%s (%s)&ldquo; choosed by you in Site Directory was successfully appended to &bdquo;Added Sites&ldquo; list'), type_to_str($site_info->name, 'encode'), $site_info->url));
                 } else {
                     $this->_set_notification(sprintf(__('Due to error site &bdquo;%s (%s)&ldquo; choosed by you in Site Directory was not appended to &bdquo;Added Sites&ldquo; list'), type_to_str($site_info->name, 'encode'), $site_info->url), 'error');
                 }
             }
         }
         $this->session->unset_userdata('add_site_channel');
     }
     $categories_tree = $this->category_model->get_html_tree();
     if (is_null($this->next_step)) {
         $hide_navbar = false;
         $this->next_step = $this->get_next_step_controller();
     } else {
         $hide_navbar = true;
     }
     $form_data = array('id' => $campaign_type, 'name' => 'select_sites_form', 'view' => 'advertiser/manage_ads/campaigns/creation/select_sites/body.html', 'redirect' => $this->next_step, 'vars' => array('REVIEW_MODE' => $this->review_mode, 'CATEGORIES_TREE' => $categories_tree, 'MONEYFORMAT' => get_money_format(), 'NUMBERFORMAT' => get_number_format()), "fields" => array("dummy" => array("id_field_type" => "hidden", "form_field_type" => "text"), "sites_range" => array("id_field_type" => "string", "form_field_type" => "radio")));
     if ($hide_navbar) {
         $form_data['vars']['PROGRESS_BAR'] = '';
     }
     $places = $this->new_campaign->get_places();
     $all_places = array_merge(array('allsites'), $this->plugins->run('getPlace', $this));
     /*
      * По умолчанию places установлено как allsites,
      * но нужно поставить все галочки на этой странице,
      * поэтому если в плэйсах только оллсайт - убираем его и
      * заполняем всеми доступными местами
      */
     if ((!isset($this->edit_step) || !$this->edit_step) && count($places) == 1 && in_array('allsites', $places)) {
         $places = $all_places;
         $this->new_campaign->set_places($places);
         $this->new_campaign->save_data();
     }
     $sites = $this->new_campaign->get_sites();
     $sites_count = count($sites);
     $plugin_places = $this->plugins->run('getPlaceHtml', $this);
     $plugin_places_html = implode($plugin_places);
     $this->places_count = count($plugin_places) + 1;
     $allplaces = count($places) == count($all_places) && $sites_count == 0 ? 'true' : 'false';
     $content = $this->form->get_form_content('modify', $form_data, $this->input, $this);
     $content = str_replace('<%PLUGINPLACES%>', $plugin_places_html, $content);
     $content = str_replace('<%YOUR_BID_VALUE%>', type_to_str($this->new_campaign->get_default_bid('text'), 'float'), $content);
     $content = str_replace('<%YOUR_BID_IMAGE_VALUE%>', type_to_str($this->new_campaign->get_default_bid('image'), 'float'), $content);
     $content = str_replace('<%SITESCHECKED%>', in_array('sites', $places) || in_array('allsites', $places) ? 'checked="checked"' : '', $content);
     $content = str_replace('<%SEARCHESCHECKED%>', in_array('searches', $places) ? 'checked="checked"' : '', $content);
     /* PLUGINS */
     $content = str_replace('<%DOMAINSCHECKED%>', in_array('domains', $places) || $this->checkAllPlace($places) ? 'checked="checked"' : '', $content);
     $content = str_replace('<%INTEXTCHECKED%>', in_array('intext', $places) || $this->checkAllPlace($places) ? 'checked="checked"' : '', $content);
     $content = str_replace('<%ALLSITESCHECKED%>', $sites_count ? '' : 'checked="checked"', $content);
     $content = str_replace('<%CHOOSEDSITESCHECKED%>', $sites_count ? 'checked="checked"' : '', $content);
     $content = str_replace('<%ALLPLACES%>', $allplaces, $content);
     // есть ли сайты
     $network_sites = $this->new_campaign->get_sites();
     $content = str_replace('<%HAVESITES_NETWORK%>', count($network_sites) ? 'true' : 'false', $content);
     $content = str_replace('<%HAVESITES_NETWORK_QTY%>', count($network_sites), $content);
     $content = str_replace('<%HAVESITES_INTEXT%>', 'false', $content);
     $content = str_replace('<%HAVESITES_INTEXT_QTY%>', 0, $content);
     $daily_budget = $this->new_campaign->get_daily_budget();
     if (is_null($daily_budget)) {
         $daily_budget = __('undefined');
     } else {
         $daily_budget = type_to_str($daily_budget, 'float');
     }
     $this->_set_content($content);
     $this->_display();
 }
Example #8
0
$html .= '<tr>';
$html .= '<td class="row_top">Статус</td>';
$html .= '<td class="row_top inf_row">Количество заказов</td>';
$html .= '<td class="row_top inf_row">Сумма</td>';
$html .= '</tr>';
// Суммы;
$orders_count = 0;
$order_sum = 0;
foreach ($snapshot_data as $key => $date_item) {
    if ($key % 2 != 0) {
        $class = 'row_1';
    } else {
        $class = 'row_2';
    }
    $html .= '<tr>';
    $html .= '<td class="' . $class . ' " align="center">' . $date_item['status_name'] . ' (' . $date_item['status_id'] . ')' . '</td>';
    $html .= '<td class="' . $class . ' inf_row" align="center">' . $date_item['count'] . '</td>';
    $html .= '<td class="' . $class . ' inf_row" align="center">' . get_money_format($date_item['sum']) . ' р.</td>';
    $html .= '</tr>';
    $orders_count += $date_item['count'];
    $order_sum += $date_item['sum'];
}
// Итого:
$html .= '<tr>';
$html .= '<td class="row_top inf_row" style="text-align: right;">Итого:</td>';
$html .= '<td class="row_top inf_row">' . $orders_count . '</td>';
$html .= '<td class="row_top inf_row">' . get_money_format($order_sum) . ' р.</td>';
$html .= '</tr>';
$html .= '</table>';
$html = $systems->excel_export($html, 'orders_analytics_excel_export') . $html;
echo $html;
Example #9
0
$doc_number = $db_rs->one($sql);
$credit_pay = 0;
if ($doc_number != '') {
    $credit_pay = 1;
}
// Стоимость без скидки;
// Если у нас была скидка, то нам надо вычесть ее стоимость;
$work_summ = $warranty_data['summa'] - $warranty_data['summ_det'];
if ($rko_doc_data != '' && $credit_pay == 0) {
    // Скидку мы посчитали выше;
} else {
    $discount_sum = 0;
}
$numm_sum = get_money_format($warranty_data['summa']);
// Итоговая сумма к оплате;
$itog_sum = get_money_format($warranty_data['summa'] - $discount_sum);
// Сумма прописью;
$itog_sum_text = num2str($warranty_data['summa'] - $discount_sum);
?>
<style>
    body, html{
        font-family: 'Arial';
        /*page-break-inside: avoid;*/
        font-size: 0.8em;
    }
    table{
        font-size: 0.9em;
    }
    td{
        padding: 5px 5px 5px 5px;
    }
Example #10
0
 private function draw_office_plan($office, $fact_array)
 {
     global $db_rs;
     // Если офис не указан, выводим все офисы;
     // Получаме все офисы которым стоит план;
     $sql = "SELECT * FROM `money_plan` WHERE `month_plan` = '" . date('m/Y') . "' " . ($office == '' ? '' : "AND `office` = '" . $office . "'") . ";";
     $office_array = $db_rs->all($sql);
     $html = '';
     foreach ($office_array as $key => $office) {
         /*
          * План по офису;
          * */
         // План на выдачу;
         $tech_out_money = $office['sum_out_tech'];
         // План по кличеству выдачи;
         $count_out_tech = $office['count_out_tech'];
         // Средний чек пвыдачи;
         $avr_out_tech_check = $office['avr_out_tech_check'];
         // Прием кол-во;
         $count_in_tech = $office['count_in_tech'];
         /*
         // Быстрые продажи;
         $fast_sale = $office['sales'];
         // Количество продаж;
         $fast_sale_count = $office['sales_count'];
         */
         /*
          *  Забираем данные из факта по этому офису
          * */
         $office_data = array();
         foreach ($fact_array as $fact) {
             if ($fact['code'] == $office['office']) {
                 $office_data['take_sum'] = $fact['take_sum'];
                 $office_data['take_count'] = $fact['out_tech_with_money_count'];
                 $office_data['count_in_tech'] = $fact['in_tech_count'];
                 break;
             }
         }
         /*
         echo $days_from_start.'<br>';
         echo $day_to_finish.'<br>';
         */
         $html .= get_office_name($office['office']) . ':' . "\n";
         // Сумма выдачи;
         $html .= 'Сумма выдачи - ' . get_money_format($tech_out_money) . ' р. / ' . get_money_format($office_data['take_sum']) . ' р. / ' . round($office_data['take_sum'] * 100 / $tech_out_money, 0) . '%' . "\n";
         // Кол-во выдачи;
         $html .= 'Кол-во выдачи - ' . $count_out_tech . ' / ' . $office_data['take_count'] . ' / ' . round($office_data['take_count'] * 100 / $count_out_tech, 0) . '%' . "\n";
         // Средний чек выдачи;
         $html .= 'Средний чек выдачи - ' . get_money_format($avr_out_tech_check) . ' р. / ' . get_money_format(round($office_data['take_sum'] / $office_data['take_count'])) . ' р. / ' . round($office_data['take_sum'] / $office_data['take_count'] * 100 / $avr_out_tech_check, 0) . '%' . "\n";
         // Кол-во принятой техники;
         $html .= 'Кол-во приёма - ' . $count_in_tech . ' / ' . $office_data['count_in_tech'] . ' / ' . round($office_data['count_in_tech'] * 100 / $count_in_tech, 0) . '%' . "\n";
         if ($key != count($office_array) - 1) {
             $html .= "\n";
         }
     }
     write_log($html, 'bot');
     return $html;
 }
Example #11
0
 //$discount_finish = strtotime(date('2016-07-13 21:00:00'));
 //if($current_date >= $discount_start && $current_date <= $discount_finish){
 // Проверяем был ли код при приеме;
 $sql = "SELECT `50cent_promo` FROM `handlings` WHERE `numm` = '" . $item['numm'] . "';";
 $promo = $db_rs->one($sql);
 if ($promo != '0' && $promo != '') {
     $numm_discount = 50;
 }
 //}
 $html .= '<tr class="' . $tr_class . '" title="' . ($tr_class == 'search_result_disabled' ? 'Этот заказ нельзя выбрать, так как его статус не позволяет сделать это' : '') . '">';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' " id="take_search_result_table_td" align="center">' . $item['numm'] . '</td>';
 // Полулчаем статус апппарата;
 $sql = "SELECT `name` FROM `status` WHERE `id` = '" . $item['status'] . "';";
 $status = $db_rs->one($sql);
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $status . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" style="width: 150px;" id="take_search_result_table_td" align="center"><b>' . get_money_format($item['summa']) . ' р.</b></td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $item['tu'] . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $item['torg'] . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $item['model'] . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $item['ser_no'] . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . ($item['fam_z'] . ' ' . $item['name_z'] . ' ' . $item['otch_z']) . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">' . $item['a1'] . '</td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center"><img src="templates/images/icons/info.png" class="show_numm_info" numm_id="' . $item['numm'] . '" title="Посмотреть подробную информацию о заказе" width="20px;" /></td>';
 $html .= '<td discount="' . $numm_discount . '" numm="' . $item['numm'] . '" class="' . $class . ' inf_row" id="take_search_result_table_td" align="center">';
 // Получаем проведенные работы;
 $sql = "SELECT * FROM `works` WHERE `numm` = '" . $item['numm'] . "';";
 $works = $db->all($sql);
 $print_works = '';
 foreach ($works as $work) {
     // Что делалось;
     $name = str_replace(array('[', ']'), '', $work['name']);
Example #12
0
 public function show_rko_cards_table($rko_array, $session_marker, $body_only = '')
 {
     global $systems, $db_rs;
     write_log('Запуск функции вывода списка РКО', 'rko');
     $html = '';
     if (count($rko_array) == 0) {
         $html .= '<div class="page_caption">Список РКО пуст</div><br><br>';
     }
     if ($body_only == '') {
         // Вывод таблицы  сданнными;
         $html .= '<table style="max-width: 80em;">';
         $html .= '<thead>';
         $html .= '<tr>';
         $html .= '<td class="row_top">Номер РКО' . $this->sort_arrows('id', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Автор РКО' . $this->sort_arrows('author_user_id', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Исполнитель РКО' . $this->sort_arrows('receive_user_id', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Офис создания' . $this->sort_arrows('office', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Текст основания' . $this->sort_arrows('reason', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Дата создания' . $this->sort_arrows('create_date', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Дата последних изменених' . $this->sort_arrows('date_last_update', $session_marker) . '</td>';
         $html .= '<td class="row_top inf_row">Сумма' . $this->sort_arrows('sum', $session_marker) . '</td>';
         $html .= '</tr>';
         $html .= '</thead>';
         $html .= '<tbody>';
     }
     foreach ($rko_array as $rko) {
         // Цвет блока зависит от состояние документа РКО;
         $style = '';
         write_log('1', 'rko');
         // Новый документ;
         if ($rko['status'] == '1') {
             $style = 1;
         }
         // Согласованный документ;
         if ($rko['status'] == '2') {
             $style = 4;
         }
         // Несогласованный документ;
         if ($rko['status'] == '3') {
             $style = 2;
         }
         // Проведенный документ;
         if ($rko['status'] == '4') {
             $style = 3;
         }
         write_log('2', 'rko');
         // Проверяем есть ли уведомления по этому документу;
         // Получаем ID родителя;
         $sql = "SELECT `id` FROM `menu_translate` WHERE `db_name` = 'rko';";
         $parent_id = $db_rs->one($sql);
         $sql = "SELECT COUNT(`id`) as `count` FROM `notifications` WHERE `parent_id` = '" . $parent_id . "' AND `doc_id` = '" . $rko['id'] . "' AND `user_id` = '" . $_SESSION['user_id'] . "' AND `status` = 1;";
         $noti_count = $db_rs->one($sql);
         if ($noti_count > 0) {
             $add_noti_count = '<span class="countList">' . $noti_count . '</span>';
         } else {
             $add_noti_count = '';
         }
         $html .= '<tr onclick="show_rko_window(' . $rko['id'] . ', \'new\')" class="notification_type_' . $style . '" style="cursor:pointer; border:1px solid black;">';
         $html .= '<td align="center" style="border-top: 1px solid black;position: relative;">' . $add_noti_count . $rko['id'] . '</td>';
         $html .= '<td style="width: 227px; border-top: 1px solid black;">' . $systems->get_user_avatar_and_full_name($rko['author_user_id']) . '</td>';
         $html .= '<td style="width: 227px; border-top: 1px solid black;">' . $systems->get_user_avatar_and_full_name($rko['receive_user_id']) . '</td>';
         $html .= '<td align="center" style="border-top: 1px solid black;">' . get_office_name($rko['office']) . '</td>';
         $html .= '<td align="center" style="border-top: 1px solid black;">' . mb_strimwidth($rko['reason'], 0, 60, '...') . '</td>';
         $html .= '<td align="center" style="border-top: 1px solid black;">' . get_local_date_time($rko['create_date'], 1) . '</td>';
         $html .= '<td align="center" style="border-top: 1px solid black;">' . get_local_date_time($rko['date_last_update'], 1) . '</td>';
         $html .= '<td align="center" style="width: 100px; border-top: 1px solid black;">' . get_money_format($rko['sum']) . ' руб.</td>';
         $html .= '</tr>';
     }
     if ($body_only == '') {
         $html .= '</tbody>';
         $html .= '</table>';
     }
     return $html;
 }
Example #13
0
                $html .= '<td class="' . $class . ' inf_row" align="right">' . get_money_format($field_12) . ' руб.</td>';
            }
            $html .= '</tr>';
        }
        $html .= '<tr>';
        $html .= '<td class="row_top" align="right"><b>Итого:</b></td>';
        $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_2_sum) . ' руб.</td>';
        //$html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_3_sum) . ' руб.</td>';
        $html .= '<td class="row_top inf_row" align="right">' . $field_4_sum . ' шт.</td>';
        $html .= '<td class="row_top inf_row" align="right">' . $field_5_sum . ' шт.</td>';
        $html .= '<td class="row_top inf_row" align="right">' . $field_6_sum . ' шт.</td>';
        $html .= '<td class="row_top inf_row" align="right">' . $field_7_sum . ' шт.</td>';
        //$html .= '<td class="row_top inf_row" align="right">' . $field_8_sum . ' шт.</td>';
        // Ситаем средний чек выдачи;
        $field_9_round = $field_9_sum['sum'] / $field_9_sum['count'];
        $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_9_round) . ' руб.</td>';
        // Ситаем средний чек продажи;
        $field_13_round = $field_13_sum['sum'] / $field_13_sum['count'];
        //$html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_13_round) . ' руб.</td>';
        if ($_SESSION['department_id'] == 2 || $_SESSION['department_id'] == 12) {
            $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_10_sum) . ' руб.</td>';
            $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_11_sum) . ' руб.</td>';
            $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_14_sum) . ' руб.</td>';
            $html .= '<td class="row_top inf_row" align="right">' . get_money_format($field_12_sum) . ' руб.</td>';
        }
        $html .= '</tr>';
        $html .= '</table>';
        $html = $systems->excel_export($html, 'money_excel_export') . $html;
        echo $html;
    }
}
Example #14
0
                    $sum_array[$month]['filed2'] += $out_numm_count;
                } else {
                    $sum_array[$month]['filed2'] = $out_numm_count;
                }
                if (isset($sum_array[$month]['filed3'])) {
                    $sum_array[$month]['filed3'] += $out_with_money;
                } else {
                    $sum_array[$month]['filed3'] = $out_with_money;
                }
                if (isset($sum_array[$month]['filed4'])) {
                    $sum_array[$month]['filed4'] += $out_money;
                } else {
                    $sum_array[$month]['filed4'] = $out_money;
                }
            }
            $html .= '</tr>';
        }
        /*
         * Показываем суммы по столбцам;
         * */
        $html .= '<tr>';
        $html .= '<td align="right" class="row_top">Итого:</td>';
        foreach ($data_months as $month) {
            $html .= '<td align="center" class="row_top" style="border-left: 1px solid black">' . $sum_array[$month]['filed1'] . '</td><td align="center" class="row_top">' . $sum_array[$month]['filed2'] . '</td><td align="center" class="row_top">' . $sum_array[$month]['filed3'] . '</td><td align="center" class="row_top">' . get_money_format($sum_array[$month]['filed4']) . ' р.</td><td align="center" class="row_top">' . get_money_format($sum_array[$month]['filed4'] / $sum_array[$month]['filed3']) . ' р.</td>';
        }
        $html .= '</tr>';
        $html .= '</table>';
        $html = $systems->excel_export($html, 'out_report_excel_export') . $html;
        echo $html;
    }
}
 /**
  * показывает форму для изменения канала или его создания
  *
  * @param $id_channel - идентификатор канала
  * @param $program_type - тип программы
  * @return ничего не возвращает
  */
 private function manage($id_channel = null, $program_type = null, $id_program = null)
 {
     $error_flag = false;
     $error_message = '';
     if (!is_null($id_program)) {
         //Пробуем запустить процесс редактирования прайса
         $program_owner = $this->channel_program->get_program_owner($id_program);
         if (!$error_flag && is_numeric($program_owner) && $this->user_id != $program_owner) {
             $error_message = 'Access denied';
             $error_flag = true;
         }
         $info = $this->channel_program->get_info($id_program);
         if (!$error_flag && is_null($info)) {
             $error_message = 'Channel program is not found!';
             $error_flag = true;
         }
         if (!is_null($info)) {
             $id_channel = $info->id_channel;
             $program_type = $info->program_type;
             $mode = "modify";
             $this->program_id = $id_program;
         }
     } else {
         //Проверка прав на создание прайса в канале
         if (!$error_flag && $this->user_id != $this->channel->get_channel_owner($id_channel)) {
             $error_message = 'Access denied';
             $error_flag = true;
         }
         if (!$error_flag && !in_array($program_type, $this->supported_program_types)) {
             $error_message = 'Unsupported program type';
             $error_flag = true;
         }
         $mode = "create";
     }
     if ($error_flag) {
         $data = array('MESSAGE' => __($error_message), 'REDIRECT' => $this->site_url . $this->index_page . $this->role . '/manage_sites_channels');
         $content = $this->parser->parse('common/errorbox.html', $data, FALSE);
         $this->_set_content($content);
         $this->_display();
         return;
     }
     $channel_info = $this->channel->get_info($id_channel);
     $channel_info->ad_type = explode(',', $channel_info->ad_type);
     switch ($program_type) {
         case 'CPM':
             switch ($mode) {
                 case 'create':
                     $form_title = __('Create CPM prices for channel');
                     break;
                 case 'modify':
                     $form_title = __('Edit CPM prices for channel');
                     break;
             }
             $volume_title = 'Impressions';
             break;
         case 'Flat_Rate':
             switch ($mode) {
                 case 'create':
                     $form_title = __('Create Flat Rate prices for channel');
                     break;
                 case 'modify':
                     $form_title = __('Edit Flat Rate prices for channel');
                     break;
             }
             $program_type = 'flat_rate';
             $volume_title = 'Days';
             break;
     }
     $this->ad_type = $channel_info->ad_type;
     $form = array("id" => $this->program_id, "name" => "channel_program_form", "view" => "common/manage_channel_prices/channel_program_form.html", "vars" => array('AD_TYPE' => json_encode($this->ad_type), 'FORM_TITLE' => $form_title, 'VOLUME_TITLE' => type_to_str($volume_title, 'encode'), 'ID_CHANNEL' => $id_channel, 'CHANNEL_NAME' => type_to_str($channel_info->name, 'encode')), "fields" => array("title" => array("display_name" => __("Title"), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => "required", "max" => 35), "volume" => array("display_name" => __($volume_title), "id_field_type" => "string", "form_field_type" => "text", "validation_rules" => "trim|required|integer|positive", "max" => 9), "type" => array("id_field_type" => "string", "form_field_type" => "hidden", "validation_rules" => "required", "default" => $program_type), "id_channel" => array("id_field_type" => "int", "form_field_type" => "hidden", "validation_rules" => "required|integer", "default" => $id_channel)));
     $adTypeLabels = array();
     if (in_array(Sppc_Channel::AD_TYPE_TEXT, $channel_info->ad_type)) {
         $form['fields']['cost_text'] = array("display_name" => __("Cost Text Ad"), "id_field_type" => "float", "form_field_type" => "text", "validation_rules" => "required|float[2]|positive");
         $adTypeLabels[] = __('Text');
         $form['vars']['COST_IMAGE_AD_TEXT'] = '';
     }
     if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $channel_info->ad_type)) {
         $form['fields']['cost_image'] = array("display_name" => __("Cost Image Only Ad"), "id_field_type" => "float", "form_field_type" => "text", "validation_rules" => "required|float[2]|positive");
         if (in_array(Sppc_Channel::AD_TYPE_TEXT, $channel_info->ad_type)) {
             $form['fields']['cost_image']['validation_rules'] = null;
         }
         $adTypeLabels[] = __('Image');
         $form['vars']['COST_IMAGE_AD_TEXT'] = __('Cost Image Only Ad');
     }
     switch ($mode) {
         case 'create':
             $form['vars']['APPLY_BTN_CAPTION'] = __("Create");
             $form['redirect'] = $this->role . "/edit_channel_program/create_complete/" . $id_channel;
             break;
         case 'modify':
             $form['vars']['APPLY_BTN_CAPTION'] = __("Save");
             $form['redirect'] = $this->role . "/edit_channel_program/edit_complete/" . $id_channel;
             break;
     }
     if (!in_array(Sppc_Channel::AD_TYPE_TEXT, $channel_info->ad_type)) {
         $this->max_ad_slots = 1;
         $slotsPreview = 'slots_' . $channel_info->id_dimension . '_1';
     } else {
         $this->max_ad_slots = $channel_info->max_ad_slots;
         $slotsPreview = 'slots_' . $channel_info->id_dimension;
     }
     $form['vars']['AD_TYPE_STRING'] = implode(', ', $adTypeLabels);
     $form['vars']['AD_TYPE'] = json_encode($channel_info->ad_type);
     $form['vars']['CHANNEL_DIMENSIONS'] = $channel_info->width . '&times;' . $channel_info->height;
     $form['vars']['DIMENSION_NAME'] = $channel_info->dimension_name;
     $form['vars']['ID_DIMENSION'] = $channel_info->id_dimension;
     $form['vars']['SLOTS_PREVIEW'] = $slotsPreview;
     $form['vars']['MAX_AD_SLOTS'] = $this->max_ad_slots;
     $form['vars']['MONEYFORMAT'] = get_money_format();
     $form['vars']['NUMBERFORMAT'] = get_number_format();
     $this->_set_content($this->form->get_form_content($mode, $form, $this->input, $this));
     $this->_display();
 }
Example #16
0
 $current_status = $db->one($sql);
 if ($current_status == '12') {
     // Ничего не делаем, заказ у нас уже выдан иди те на хуй;
 } else {
     // Проверяем какие данные нам передали и сохраняем их в базе;
     // Пишем в DVJ информацию о согласовании;
     // Получим базовы данные для заказаы;
     $sql = "SELECT `place_h`, `sogl_summ`, `status` FROM `remont` WHERE `numm` = '" . $_POST['save_sogl_result'] . "';";
     $numm_data = $db->row($sql);
     // О боксе;
     if ($numm_data['place_h'] != $new_box && $new_box != '-1') {
         dvj_write($_POST['save_sogl_result'], 'Изменение бокса на: ' . $new_box);
     }
     // О сумме согласования;
     if ($numm_data['sogl_summ'] != $_POST['sogl_summ']) {
         dvj_write($_POST['save_sogl_result'], 'Установлена новая согласованная сумма: ' . get_money_format($_POST['sogl_summ']) . ' р.');
     }
     // О статусе;
     if ($numm_data['status'] != $_POST['status'] && $_POST['status'] != '-1') {
         // Получаем текст название нового статус;
         $sql = "SELECT `name` FROM `status` WHERE `id` = '" . $_POST['status'] . "';";
         $new_status_text = $db_rs->one($sql);
         $new_dvj_str = 'Смена статуса через согласование на *' . $new_status_text . '*' . $_POST['status'] . ".";
         dvj_write($_POST['save_sogl_result'], $new_dvj_str);
     } else {
         dvj_write($_POST['save_sogl_result'], 'Повторная установка статуса заказа.');
     }
     $sql = "UPDATE `remont` SET  `saveds` = NOW() " . ($new_box != '-1' && $new_box != '' ? ", `place_h` = '" . $new_box . "'" : "") . ($_POST['status'] != '-1' && $_POST['status'] != '' ? ", `status` = '" . $_POST['status'] . "'" : "") . ($_POST['sogl_summ'] != '' ? ", `sogl_summ` = '" . $_POST['sogl_summ'] . "'" : "") . " WHERE `numm` = '" . $_POST['save_sogl_result'] . "' ;";
     write_log($sql, 'sogl_action');
     // ОБновляем данные в базе у заказа;
     $db->query($sql);