Announcement

Collapse
No announcement yet.

Fatal error Maximum execution time of 300 seconds

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Can younshare this conde?
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #17
      How I said for now I have more than 10027 lines of code and I need to add many more, but I can show you some part of it, by the way I tried splitting the code in PHP methods and I think it is working.

      $sql = "SELECT * FROM hojas_temp WHERE usuario ='".[glo_usuario]."'" ;

      sc_select(dsorigen,$sql) ; // selecciona el documento a asentar
      foreach({dsorigen} as $camporigen) // recorre el dataset
      {
      switch ([glo_dia_ini])
      {
      case 'Mon':
      if($camporigen[10]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[11]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      else if ($camporigen[12]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +2 day"));
      }
      else if ($camporigen[13]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +3 day"));
      }
      else if ($camporigen[14]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +4 day"));
      }
      else if ($camporigen[15]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +5 day"));
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +6 day"));
      }
      break;

      case 'Tue':
      if ($camporigen[11]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[12]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      else if ($camporigen[13]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +2 day"));
      }
      else if ($camporigen[14]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +3 day"));
      }
      else if ($camporigen[15]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +4 day"));
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +5 day"));
      }
      break;

      case 'Wed':
      if ($camporigen[12]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[13]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      else if ($camporigen[14]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +2 day"));
      }
      else if ($camporigen[15]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +3 day"));
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +4 day"));
      }
      break;

      case 'Thu':
      if ($camporigen[13]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[14]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      else if ($camporigen[15]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +2 day"));
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +3 day"));
      }
      break;

      case 'Fri':
      if ($camporigen[14]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[15]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +2 day"));
      }
      break;

      case 'Sat':
      if ($camporigen[15]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      else if ($camporigen[16]!= "0")
      {
      $camporigen[6] = date("Y/m/d", strtotime("[glo_fecha_ini] +1 day"));
      }
      break;

      case 'Sun':
      if ($camporigen[16]!= "0")
      {
      $camporigen[6] = [glo_fecha_ini] ;
      }
      break;
      }


      $insert_table = 'hojas'; // Table name


      $realmas1= date("Y/m/d", strtotime("$camporigen[6] +1 day"));
      $realmas2= date("Y/m/d", strtotime("$camporigen[6] +2 day"));
      $realmas3= date("Y/m/d", strtotime("$camporigen[6] +3 day"));
      $realmas4= date("Y/m/d", strtotime("$camporigen[6] +4 day"));
      $realmas5= date("Y/m/d", strtotime("$camporigen[6] +5 day"));
      $realmas6= date("Y/m/d", strtotime("$camporigen[6] +6 day"));

      //--------MIERCOLES-----------
      if (($camporigen[10]== '0')and ($camporigen[11]== '0')and ($camporigen[12]== '0')and ($camporigen[13]=='0')and ($camporigen[14]=='0')and ($camporigen[15]=='0')and ($camporigen[16]=='0'))
      {
      $insert_fields = array( // Field list, add as many as needed
      'fecha_reg' => "'$camporigen[1]'",
      'usuario' => "'$camporigen[2]'",
      'departamento' => "'$camporigen[3]'",
      'fecha_inicial' => "'$camporigen[4]'",
      'fecha_final' => "'$camporigen[5]'",
      'fecha_real' => "'$camporigen[6]'",
      'actividad' => "'$camporigen[7]'",
      'division' => "'$camporigen[8]'",
      'oco' => "'$camporigen[9]'",
      'lunes' => "'$camporigen[10]'",
      'martes' => "'$camporigen[11]'",
      'miercoles' => "'$camporigen[12]'",
      'jueves' => "'$camporigen[13]'",
      'viernes' => "'$camporigen[14]'",
      'sabado' => "'$camporigen[15]'",
      'domingo' => "'$camporigen[16]'",
      'total_horas' => "'$camporigen[17]'",
      'observacion' => "'$camporigen[18]'",
      );

      $insert_sql = 'INSERT INTO ' . $insert_table
      . ' (' . implode(', ', array_keys($insert_fields)) . ')'
      . ' VALUES (' . implode(', ', array_values($insert_fields)) . ')';

      sc_exec_sql($insert_sql);
      }

      Comment

      Working...
      X