VM暫存
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
4.7KB

  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class Vghtc_report_daily extends CI_Controller {
  4. public function __construct() {
  5. parent::__construct();
  6. $this->load->model('reports/Erpapidb_model','erpapidb');
  7. }
  8. public function index()
  9. {
  10. $post_data= $this->input->post(NULL, TRUE);
  11. $get_data= $this->input->get(NULL, TRUE);
  12. if($post_data){
  13. $month= isset($post_data['month']) ? $post_data['month']:'';
  14. }
  15. if($get_data){
  16. $month= isset($get_data['month']) ? $get_data['month']:'';
  17. }
  18. $dd=date('d',mktime(0,0,0,($month+1),0,date('Y')));
  19. $sel_in_lane=$this->erpapidb->sel_in_lane();
  20. if($month<10){
  21. $month0="0".$month;
  22. }else{
  23. $month0=$month;
  24. }
  25. for($i=1; $i<=$dd; $i++){
  26. $monthba=0;
  27. $dateba=0;
  28. $hourba=0;
  29. $alltatle=0;
  30. $dateba_lane_0=0;
  31. $dateba_lane_1=0;
  32. $dateba_lane_2=0;
  33. $dateba_lane_3=0;
  34. $dateba_lane_4=0;
  35. $dateba_lane_5=0;
  36. $dateba_lane_6=0;
  37. $dateba_lane_7=0;
  38. $dateba_lane_8=0;
  39. $dateba_lane_9=0;
  40. $dateba_lane_10=0;
  41. $dateba_lane_11=0;
  42. $dateba_lane_12=0;
  43. $dateba_lane_tatol000=0;
  44. if($i<10){
  45. $i0="0".$i;
  46. }else{
  47. $i0=$i;
  48. }
  49. $dateba_lane00[]=array();
  50. $start0=date('Y-'.$month0.'-'.$i0);
  51. for($j=-8; $j<=23-8; $j++){
  52. $stime0=date('H:i:s',($j*3600));
  53. $etime0=date('H:i:s',(($j+1)*3600));
  54. $stime=date('H:i',($j*3600));
  55. $etime=date('H:i',(($j+1)*3600));
  56. $start=date('Y-'.$month.'-'.$i.' '.$stime0);
  57. $end=date('Y-'.$month.'-'.$i.' '.$etime0);
  58. $sel_cario[]=array();
  59. $dateba0=0;
  60. $dateba_lane_tatol=0;
  61. foreach($sel_in_lane as $key => $value){
  62. $in_lane=$value['in_lane'];
  63. $name=$value['name'];
  64. $note=$value['note'];
  65. if($in_lane==2 or $in_lane==3 or $in_lane==8 or $in_lane==9 or $in_lane==10 or $in_lane==11){
  66. $sel_cario=$this->erpapidb->sel_cario($in_lane,$start,$end);
  67. }else{
  68. $sel_cario=$this->erpapidb->sel_cario_out($in_lane,$start,$end);
  69. }
  70. $sel_cario_count[$key]=count($sel_cario);
  71. $alltatle=$alltatle+$sel_cario_count[$key];
  72. $dateba0=$dateba0+$sel_cario_count[$key];
  73. $dateba_lane_tatol=$dateba_lane_tatol+$sel_cario_count[$key];
  74. if($in_lane==0){
  75. $dateba_lane_0=$dateba_lane_0+$sel_cario_count[$key];
  76. }elseif($in_lane==1){
  77. $dateba_lane_1=$dateba_lane_1+$sel_cario_count[$key];
  78. }elseif($in_lane==2){
  79. $dateba_lane_2=$dateba_lane_2+$sel_cario_count[$key];
  80. }elseif($in_lane==3){
  81. $dateba_lane_3=$dateba_lane_3+$sel_cario_count[$key];
  82. }elseif($in_lane==4){
  83. $dateba_lane_4=$dateba_lane_4+$sel_cario_count[$key];
  84. }elseif($in_lane==5){
  85. $dateba_lane_5=$dateba_lane_5+$sel_cario_count[$key];
  86. }elseif($in_lane==6){
  87. $dateba_lane_6=$dateba_lane_6+$sel_cario_count[$key];
  88. }elseif($in_lane==7){
  89. $dateba_lane_7=$dateba_lane_7+$sel_cario_count[$key];
  90. }elseif($in_lane==8){
  91. $dateba_lane_8=$dateba_lane_8+$sel_cario_count[$key];
  92. }elseif($in_lane==9){
  93. $dateba_lane_9=$dateba_lane_9+$sel_cario_count[$key];
  94. }elseif($in_lane==10){
  95. $dateba_lane_10=$dateba_lane_10+$sel_cario_count[$key];
  96. }elseif($in_lane==11){
  97. $dateba_lane_11=$dateba_lane_11+$sel_cario_count[$key];
  98. }elseif($in_lane==12){
  99. $dateba_lane_12=$dateba_lane_12+$sel_cario_count[$key];
  100. }
  101. }
  102. $sel_cario_tatal[$stime]=array(
  103. "stime" => $stime,
  104. "time" => $stime.'~'.$etime,
  105. "dateba0" => $dateba0,
  106. "sel_cario" => $sel_cario_count
  107. );
  108. }
  109. $dateba_lane00=array(
  110. "dateba_lane_0" => $dateba_lane_0,
  111. "dateba_lane_1" => $dateba_lane_1,
  112. "dateba_lane_2" => $dateba_lane_2,
  113. "dateba_lane_3" => $dateba_lane_3,
  114. "dateba_lane_4" => $dateba_lane_4,
  115. "dateba_lane_5" => $dateba_lane_5,
  116. "dateba_lane_6" => $dateba_lane_6,
  117. "dateba_lane_8" => $dateba_lane_8,
  118. "dateba_lane_9" => $dateba_lane_9,
  119. "dateba_lane_10" => $dateba_lane_10,
  120. "dateba_lane_11" => $dateba_lane_11,
  121. "dateba_lane_12" => $dateba_lane_12,
  122. );
  123. // "sel_cario_tatal" => $sel_cario_tatal
  124. // "dateba" => $alltatle,
  125. // "hourba" => $alltatle/24
  126. $this->front->sel_cario_tatal[$start0]=$sel_cario_tatal;
  127. $this->front->dateba_lane[$start0]=$dateba_lane00;
  128. $this->front->sel_in_lane[$start0]=$sel_in_lane;
  129. $dateba=$dateba+$dateba_lane_tatol;
  130. }
  131. $this->front->dateba=$dateba;
  132. $this->front->hourba=$dateba/24;
  133. $this->front->month=$month;
  134. $this->front->dd=$dd;
  135. $data=$this->front;
  136. $this->load->view('reports/vghtc_report_daily',$data);
  137. }
  138. }