AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.80
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/public_html/lrsys_apps/gasch/application/plugins/module_pcp/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_apps/gasch/application/plugins/module_pcp/controllers/p-plan.php
<?php
_auth();
$dir = "module_pcp"; //diretório do plugin criado, dentro da pasta plugins
$controller_path = '?ng='.$dir.'/'.$controller.'/';

$url = array();
$url['add']= $controller_path.'add';
$url['edit']= $controller_path.'edit';
$url['list']= $controller_path.'list/';
$url['delete']= $controller_path.'delete';

$ui->assign('jsvar', '
_L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
_L[\'Save\'] = \'' . $_L['Save'] . '\';
_L[\'OK\'] = \'' . $_L['OK'] . '\';
 _L[\'Remove\'] = \'' . $_L['Remove'] . '\';
_L[\'Select\'] = \'' . $_L['Select'] . '\';
_L[\'Cancel\'] = \'' . $_L['Cancel'] . '\';
_L[\'Add New Unit\'] = \'' . $_L['Add New Unit'] . '\';
_L[\'Unit Name\'] = \'' . $_L['Unit Name'] . '\';
_L[\'Unit Initials\'] = \'' . $_L['Unit Initials'] . '\';
_L[\'Add New Location\'] = \'' . $_L['Add New Location'] . '\';
_L[\'Location\'] = \'' . $_L['Location'] . '\';
_L[\'Add New Category\'] = \'' . $_L['Add New Category'] . '\';
_L[\'Category\'] = \'' . $_L['Category'] . '\';
_L[\'Parent Category\'] = \'' . $_L['Parent Category'] . '\';
_L[\'Select Category\'] = \'' . $_L['Select Category'] . '\';
_L[\'Add New Packing\'] = \'' . $_L['Add New Packing'] . '\';
_L[\'Add New Tag\'] = \'' . $_L['Add New Tag'] . '\';
_L[\'Group Tags\'] = \'' . $_L['Group Tags'] . '\';
_L[\'Tags\'] = \'' . $_L['Tags'] . '\';
_L[\'Manufacturer Name\'] = \'' . $_L['Manufacturer Name'] . '\';
_L[\'Code\'] = \'' . $_L['Code'] . '\';');

$css_arr = array(
  'modal',
  'dp/dist/datepicker.min',
  's2/css/select2.min',
  'ibilling/picker/picker',
  'ibilling/clockpicker/clockpicker',
  'redactor/redactor',
  'c3/c3.min');

$js_arr = array(
  's2/js/select2.min',
  'ibilling/picker/picker',
  'ibilling/clockpicker/clockpicker',
  'ibilling/picker/time',
  'modal',
  'numeric', '/../../theme/lrsys/lib/jquery.maskMoney.min',
  'dp/dist/datepicker.min',
  'c3/c3.min',
  'c3/d3.min');

$ui->assign('xheader', Asset::css($css_arr).
  '<link rel="stylesheet" type="text/css" href="' .$_pd. '/assets/css/default.css"  />');

$ui->assign('_application_menu', $dir);
$ui->assign('_title', $_L['Pcp module'].' - '. $config['CompanyName']);
$action = $routes['2'];
$user = User::_info();
$ui->assign('user', $user);
$ui->assign('url', $url);

switch ($action) {

    case 'list':

    $ui->assign('xfooter', Asset::js($js_arr).
      '<script type="text/javascript" src="' .$_pd. '/assets/js/'.$controller.'/list.js"></script>'.
      '<script type="text/javascript" src="' .$_pd. '/assets/js/default.js"></script>'
    );

        $filter = array();
        $filter['items_per_page'] = 10;

        if($_SERVER['REQUEST_METHOD'] == 'POST') {
          $filter['search'] = filter_var(_post('search'), FILTER_SANITIZE_STRING);
          $filter['id_equipament'] = filter_var(_post('id_equipament'), FILTER_SANITIZE_STRING);
          $filter['id_product'] = filter_var(_post('id_product'), FILTER_SANITIZE_STRING);
          $filter['items_per_page'] = filter_var(_post('items_per_page'), FILTER_SANITIZE_STRING);
        } else {
          if($i = array_search('search', $routes))
            $filter['search'] = filter_var($routes[$i+1], FILTER_SANITIZE_STRING);
          if($i = array_search('id_equipament', $routes))
            $filter['id_equipament'] = filter_var($routes[$i+1], FILTER_SANITIZE_STRING);
          if($i = array_search('id_product', $routes))
            $filter['id_product'] = filter_var($routes[$i+1], FILTER_SANITIZE_STRING);
        }


        $sql = "SELECT m.*, p.description as product_name from module_pcp_production_plan m INNER JOIN sys_items p ON p.id = m.product_id ";
        $where = " WHERE m.id > 0";

        if(isset($filter['search']) && $filter['search'] != '') {
          $where .= " AND m.name LIKE '%".$filter['search']."%'";
        }

        // die($filter['id_product']);

        // Filtra por Equipamento
        if(isset($filter['id_product']) && $filter['id_product'] != "") {
          $where .= " AND m.product_id = ".$filter['id_product'];
        }

        $order = " ORDER BY m.product_id DESC" ;
        $query = $sql.$where.$order;

        $page = isset($routes['3']) ? $routes['3'] : 1;

        $paginator = new ModulePaginator('module_pcp_production_steps', $query, $filter);
        $records = $paginator->setItemsPerPage($filter['items_per_page'])
          ->setCurrentPageNumber($page)
          ->run();

        $pcp = new Pcp();
        $stock_forecast = $pcp->forecastByStock();

        $ui->assign('records', $records);
        $ui->assign('paginator', $paginator);
        $ui->assign('filter', $filter);
        $ui->assign('stock_forecast', $stock_forecast);


        $ui->assign('_st', $_L['Pcp_steps list_title']);
        $ui->assign('_include', $controller.'/'.$action);
        $ui->display('wrapper.tpl');
    break;

    case 'add':
      $ui->assign('xfooter', Asset::js($js_arr).
        '<script type="text/javascript" src="' .$_pd. '/assets/js/'.$controller.'/'.$action.'.js"></script>'.
        '<script type="text/javascript" src="' .$_pd. '/assets/js/default.js"></script>'
      );

      if($_SERVER['REQUEST_METHOD'] === 'POST') {

        $params = array(
          'name' => _post('name'),
          'product_id' => _post('product_id'),
          'production_qtd' => _post('production_qtd'),
          'obs' => _post('obs')
        );

        $model = Model::factory('ProductionPlan')->create($params);

        if($model->saveOrUpdate()) {
          r2(U . $dir.'/'.$controller.'/list', 's', $_L['Pcp_plan flash add_success']);
        } else {
          r2(U . $dir.'/'.$controller.'/list', 'e', $_L['Pcp_plan flash add_fail']);
        }

      }

      $ui->assign('_st', $_L['Pcp_steps list_title']);
      $ui->assign('_include', $controller.'/'.$action);
      $ui->display('wrapper.tpl');

    break;
    case 'edit':

    $ui->assign('xfooter', Asset::js($js_arr).
      '<script type="text/javascript" src="' .$_pd. '/assets/js/'.$controller.'/'.$action.'.js"></script>'.
      '<script type="text/javascript" src="' .$_pd. '/assets/js/default.js"></script>'
    );

    $id = $routes[3];



    if($id) {

      if($_SERVER['REQUEST_METHOD'] === 'POST') {

        $params = array(
          'name' => _post('name'),
          'product_id' => _post('product_id'),
          'production_qtd' => _post('production_qtd'),
          'obs' => _post('obs')
        );

        $model = Model::factory('ProductionPlan')->find_one($id);

        if($model->saveOrUpdate($params)) {
          r2(U . $dir.'/'.$controller.'/list', 's', $_L['Pcp_plan flash add_success']);
        } else {
          r2(U . $dir.'/'.$controller.'/list', 'e', $_L['Pcp_plan flash add_fail']);
        }

      }
    }

    $plan = Model::factory('ProductionPlan')->where('id',$id)->findArray()[0];
    $product = new Pcp($plan['product_id']);
    // var_dump($product->getSubItems()[0]['struct']);die();


//
    $ui->assign('plan', $plan);
    $ui->assign('info', $product->getProduct()->as_array());
    $ui->assign('struct', $product->getItemStruct());
    $ui->assign('subitems', $product->getSubItems());
    $ui->assign('steps', $product->getListSteps());
    $ui->assign('product', $product);
    $ui->assign('_st', $_L['Pcp_plan list_title']);
    $ui->assign('_include', $controller.'/add');
    $ui->display('wrapper.tpl');


    break;

    case 'delete':
    $id = $routes[3];
    $plan = Model::factory('ProductionPlan')->find_one($id);

    if($plan->delete()) {
      r2(U . $dir.'/'.$controller.'/list', 's', $_L['Pcp_plan flash add_success']);
    } else {
      r2(U . $dir.'/'.$controller.'/list', 'e', $_L['Pcp_plan flash add_fail']);
    }

    break;


	default:
        echo 'action not defined';
}

Anon7 - 2022
AnonSec Team