public function FiltrarEst($Cond) { $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="2"; $tama1 = $oNivel->LeerNumCar(); $pos1=(25-$tama1)+1; $oNivel->nivel="1"; $tama2 = $oNivel->LeerNumCar(); $pos2=(25-$tama2)+1; global $db; //$db->debug=true; $Rs = $db->Execute("select substr(codestpro1,{$pos2},{$tama2}) as codestpro1,substr(codestpro2,{$pos1},{$tama1}) as codestpro2,denestpro2 from {$this->_table} where {$Cond} and {$this->_table}.codemp='{$this->codemp}'"); return $Rs; }
public function FiltrarEst($Cond) { $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="5"; $tama1 = $oNivel->LeerNumCar(); $pos1=(25-$tama1)+1; global $db; $Rs = $db->Execute("select codestpro1,codestpro2,codestpro3,codestpro4,substr(codestpro5,{$pos1},{$tama1}) as codestpro5,denestpro5 from {$this->_table} where {$Cond} and {$this->_table}.codemp='{$this->codemp}'"); return $Rs; }
public function FiltrarEst() { $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="1"; $tama = $oNivel->LeerNumCar(); $pos=(25-$tama)+1; global $db; $Rs = $db->Execute("select estcla,fecha_ini,fecha_fin,costototal,responsable,substr(codestpro1,{$pos},{$tama}) as codestpro1,denestpro1 from {$this->_table} where {$this->_table}.codemp='{$this->codemp}'"); return $Rs; }
public function FiltrarEst() { $oNivel=new ConfNivelDao(); $oNivel->tipo="PL"; $oNivel->nivel="1"; $tama = $oNivel->LeerNumCar(); $pos=(25-$tama)+1; global $db; $Rs = $db->Execute("select substr(codest1,{$pos},{$tama}) as codest1,denest1 from {$this->_table} where {$this->_table}.codemp='{$this->codemp}'"); return $Rs; }
public function crearcondicionplan($conSelect,$conFrom,$conWhere) { global $db; $oNiveles = new ConfNivelDao(); $nivelPlan = $oNiveles->ObtenerNivelPlan(); $nivelPro = $oNiveles->ObtenerNivelProg(); switch($nivelPlan) { case '1': $conSelect .=",p1.codest1,p1.denest1"; $conFrom.=",spe_estpro1 as p1"; $conWhere.="and p1.codest1=i.codest1 and p1.codest1='{$this->codest1}'"; break; case '2': $conSelect .=",p1.codest1,p1.denest1,p2.codest2,p2.denest2"; $conFrom.=",spe_estpro1 as p1,spe_estpro2 as p2"; $conWhere.=" and p2.codest1=i.codest1 and p2.codest2=i.codest2 and p2.codest1='{$this->codest1}' and p2.codest2='{$this->codest2}'"; break; case '3': $conSelect .=",p1.codest1,p1.denest1,p2.codest2,p2.denest2,p3.codest3,p3.denest3"; $conFrom.=",spe_estpro1 as p1,spe_estpro2 as p2,spe_estpro3 as p3"; $conWhere.=" and p3.codest1=i.codest1 and p3.codest2=i.codest2 and p3.codest3=i.codest3 and p2.codest1=i.codest1 and p2.codest2=i.codest2 and p3.codest1='{$this->codest1}' and p3.codest2='{$this->codest2}' and p3.codest3='{$this->codest3}' and p1.codest1=i.codest1"; break; case '4': $conSelect.=",p1.codest1,p1.denest1,p2.codest2,p2.denest2,p3.codest3,p3.denest3, p4.codest4,p4.denest4"; $conFrom.=",spe_estpro1 as p1,spe_estpro2 as p2,spe_estpro3 as p3,spe_estpro4 as p4"; $conWhere.=" and p4.codest1=i.codest1 and p4.codest2=i.codest2 and p4.codest3=i.codest3 and p4.codest4=i.codest4 and p3.codest1=i.codest1 and p3.codest2=i.codest2 and p3.codest3=i.codest3 and p2.codest1=i.codest1 and p2.codest2=i.codest2 and p1.codest1=i.codest1 and p4.codest1='{$this->codest1}' and p4.codest2='{$this->codest2}' and p4.codest3='{$this->codest3}' and p4.codest4='{$this->codest4}'"; break; case '5': $conSelect .=",i.codinte,p1.codest1,p1.denest1,p2.codest2,p2.denest2,p3.codest3,p3.denest3,p4.codest4,p4.denest4,p5.codest5,p5.denest5"; $conFrom.=",spe_estpro1 as p1,spe_estpro2 as p2,spe_estpro3 as p3,spe_estpro4 as p4,spe_estpro5 as p5"; $conWhere.=" and p5.codest1=i.codest1 and p5.codest2=i.codest2 and p5.codest3=i.codest3 and p5.codest4=i.codest4 and p5.codest5=i.codest5 and p4.codest1=i.codest1 and p4.codest2=i.codest2 and p4.codest3=i.codest3 and p4.codest4=i.codest4 and p3.codest1=i.codest1 and p3.codest2=i.codest2 and p3.codest3=i.codest3 and p2.codest1=i.codest1 and p2.codest2=i.codest2 and p1.codest1=i.codest1 and p5.codest1='{$this->codest1}' and p5.codest2='{$this->codest2}' and p5.codest3='{$this->codest3}' and p5.codest4='{$this->codest4}' and p5.codest5='{$this->codest5}"; break; } switch($nivelPro) { case '1': $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="1"; $tama = $oNivel->LeerNumCar(); $pos=(25-$tama)+1; $conSelect .=",substr(codestpro1,{$pos},{$tama}) as codigo,e1.denestpro1 as Descripcion"; $conFrom.=",sfp_estpro1 as e1"; $conWhere.="and e1.codestpro1=i.codestpro1"; break; case '2': $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="2"; $tama1 = $oNivel->LeerNumCar(); $pos1=(25-$tama1)+1; $oNivel->nivel="1"; $tama2 = $oNivel->LeerNumCar(); $pos2=(25-$tama2)+1; $strcon = $db->Concat("substr(e2.codestpro1,{$pos2},{$tama2})","'-'","substr(e2.codestpro2,{$pos1},{$tama1})"); $conSelect .=",{$strcon} as codigo,e2.denestpro2 as Descripcion "; $conFrom.=",sfp_estpro1 as e1,sfp_estpro2 as e2"; $conWhere.=" and e2.codestpro1=i.codestpro1 and e2.codestpro2=i.codestpro2 and e1.codestpro1=i.codestpro1 "; break; case '3': $oNivel=new ConfNivelDao(); $oNivel->tipo="PR"; $oNivel->nivel="2"; $tama1 = $oNivel->LeerNumCar(); $pos1=(25-$tama1)+1; $oNivel->nivel="1"; $tama2 = $oNivel->LeerNumCar(); $pos2=(25-$tama2)+1; $oNivel->nivel="3"; $tama3 = $oNivel->LeerNumCar(); $pos3=(25-$tama3)+1; $strcon = $db->Concat("substr(e2.codestpro1,{$pos2},{$tama2})","'-'","substr(e2.codestpro2,{$pos1},{$tama1})","'-'","substr(e3.codestpro3,{$pos3},{$tama3})"); $conSelect .=",{$strcon} as codigo, e2.codestpro2,e2.denestpro2,e1.denestpro1,e1.codestpro1,e3.codestpro3,e3.denestpro3 as descripcion"; $conFrom.=",sfp_estpro1 as e1,sfp_estpro2 as e2,sfp_estpro3 as e3"; $conWhere.=" and e3.codestpro1=i.codestpro1 and e3.codestpro2=i.codestpro2 and e3.codestpro3=i.codestpro3 and e2.codestpro1=i.codestpro1 and e2.codestpro2=i.codestpro2 and e1.codestpro1=i.codestpro1"; break; case '4': $conSelect.=",e1.codestpro1,e1.denestpro1,e2.codestpro2,e2.denestpro2,e3.codestpro3,e3.denestpro3,e4.codestpro4,e4.denestpro4"; $conFrom.=",sfp_estpro1 as e1,sfp_estpro2 as e2,sfp_estpro3 as e3,sfp_estpro4 as e4"; $conWhere.=" and e4.codestpro1=i.codestpro1 and e4.codestpro2=i.codestpro2 and e4.codestpro3=i.codestpro3 and e4.codestpro4=i.codestpro4 and e3.codestpro1=i.codestpro1 and e3.codestpro2=i.codestpro2 and e3.codestpro3=i.codestpro3 and e2.codestpro1=i.codestpro1 and e2.codestpro2=i.codestpro2 and e1.codestpro1=i.codestpro1"; break; case '5': $conSelect .=",e1.codestpro1,e1.denestpro1,e2.codestpro2,e2.denestpro2,e3.codestpro3,e3.denestpro3,e4.codestpro4,e4.denestpro4,e5.codestpro5,e5.denestpro5"; $conFrom.=",sfp_estpro1 as e1,sfp_estpro2 as e2,sfp_estpro3 as e3,sfp_estpro4 as e4,sfp_estpro5 as e5"; $conWhere.=" and e5.codestpro1=i.codestpro1 and e5.codestpro2=i.codestpro2 and e5.codestpro3=i.codestpro3 and e5.codestpro4=i.codestpro4 and e5.codestpro5=i.codestpro5 and e4.codestpro1=i.codestpro1 and e4.codestpro2=i.codestpro2 and e4.codestpro3=i.codestpro3 and e4.codestpro4=i.codestpro4 and e3.codestpro1=i.codestpro1 and e3.codestpro2=i.codestpro2 and e3.codestpro3=i.codestpro3 and e2.codestpro1=i.codestpro1 and e2.codestpro2=i.codestpro2 and e1.codestpro1=i.codestpro1"; break; } $condicion="{$conSelect} {$conFrom} {$conWhere}"; return $condicion; }