PHP Classes

File: clssalariu.php

Recommend this page to a friend!
  Classes of Birceanu Danut   Class Salariu   clssalariu.php   Download  
File: clssalariu.php
Role: Class source
Content type: text/plain
Description: Clasa SALARIU
Class: Class Salariu
Calculate salaries of Romanian employees
Author: By
Last change: fisierul cuprinde clasa salariu
Date: 17 years ago
Size: 6,643 bytes
 

Contents

Class file image Download
<?php

/* ++++++++++++++++++++++++++++++++
           CREAT LA DATA DE 2 MARTIE 2006
           CLASA SALARIU
    ++++++++++++++++++++++++++++++++
    Toate drepturile rezervate - DANUT BIRCEANU danut_birceanu@yahoo.com

    functia aproximare - face aproximarea la intreg, de ex daca avem 2,4=2 iar 2,6=3
    functia persoane - returneaza numarul de persoane introdus de utilizator 0, 1, 2, 3, >=4
    functia calc_deducere - returneaza deducerea in functie de brut in conformitate cu legea contabilitatii
    CAS=9,5%
    CASS=6,5%
    SOMAJ=1%
    functia afisare - afiseaza rezultatele pentru a vedea fluturasul
    functia calc_salariu - realizeaza toate calculele pentru a obtine salariul net.
*/

class SALARIU
{
  var
$sal_brut;
  var
$spor_vech;
  var
$adaos_imp;
  var
$adaos_neimp;
  var
$pers_intretinere;
  var
$deducere;
  var
$valoare_spor;
  var
$brut_total;
  var
$cas;
  var
$cass;
  var
$somaj;
  var
$impozabil;
  var
$impozit;
  var
$net;
  var
$afis;


     function
aproximare($numar)
     {
         if (
is_numeric($numar)){
    if(
$numar<>intval($numar)){
        if (((
$numar*10) %10)>=5){
            
$numar=intval($numar)+1;
           } else {
            
$numar=intval($numar);
        }
              }
         } else {
   
$numar=0;
         }

     return
$numar;
     }

      function
preluare_spor($spor_sal)
     {
         if (
is_numeric($spor_sal)){
    return
$spor_sal;
    } else {
    return
0;
         }
        
     }


     function
persoane($pers_intretinere)
     {
          if(
is_numeric($pers_intretinere)){
             
$pers_intretinere=$pers_intretinere;
    } else {
   
$pers_intretinere=4;
         }
         return
$pers_intretinere;
     }
    
     function
calc_deducere($brut,$pers)
     {
    if(
$pers==0) $ded_stas=250;
    if(
$pers==1) $ded_stas=350;
    if(
$pers==2) $ded_stas=450;
    if(
$pers==3) $ded_stas=550;
    if(
$pers=='>=4') $ded_stas=650;
    if (
$brut<1001){
       
$ded=$ded_stas;
       } elseif(
$brut>1000 and $brut<3001) {
            
$primul_intreg=$ded_stas*(1-($brut-1000)/2000);
                      
$v1=intval($primul_intreg);
             
$primul_intreg=number_format($primul_intreg, 2, '.', ',');
                      
$v1=number_format($v1, 2, '.', ',');

             if ((
$v1>=$primul_intreg) and (($primul_intreg % 10) == 0)){
                   
$ded_stas=intval($primul_intreg);
                         } else {
                   
$ded_stas=(intval($v1/10)+1)*10;
            };
    } else {
       
$ded_stas=0;
    };
       return
$ded_stas;
     }
    
    
     function
afisare()
     {
          if(
$this->sal_brut>=310){
              echo
"<hr><font color=maroon size=2><b>Fluturas</b></font><table border=0 width=300>";
    echo
"<tr><td align=right width=150 bgcolor=C0C0C0><font color=blue size=2 face=arial><b>BRUT</b></td><td align=right bgcolor=c0c0c0><font color=blue size=3 face=arial><b>$this->sal_brut</td></tr>";
              if (
$this->spor_vech>0) echo "<tr><td align=right width=150 bgcolor=CCCCCC><font color=black size=2 face=arial><b>SPOR ($this->spor_vech %)</b></td><td align=right bgcolor=CCCCCC><font color=black size=3 face=arial><b>$this->valoare_spor</td></tr>";
              if (
$this->adaos_imp>0) echo "<tr><td align=right width=150 bgcolor=CCCCCC><font color=black size=2 face=arial><b>ADAOS (imp)</b></td><td align=right bgcolor=CCCCCC><font color=black size=3 face=arial><b>$this->adaos_imp</td></tr>";
    if (
$this->adaos_neimp>0) echo "<tr><td align=right width=150 bgcolor=CCCCCC><font color=black size=2 face=arial><b>ADAOS (neimp)</b></td><td align=right bgcolor=CCCCCC><font color=black size=3 face=arial><b>$this->adaos_neimp</td></tr>";
              if (
$this->sal_brut<>$this->brut_total) echo "<tr><td align=right width=150 bgcolor=CCCCCC><font color=black size=2 face=arial><b>BRUT (impozabil) </b></td><td align=right bgcolor=CCCCCC><font color=black size=3 face=arial><b>$this->brut_total</td></tr>";
              echo
"<tr><td align=right width=150 bgcolor=C0C0C0><font color=red size=2 face=arial><b>CAS (9,5 %)</b></td><td align=right bgcolor=c0c0c0><font color=red size=3 face=arial><b>$this->cas</td></tr>";
    echo
"<tr><td align=right width=150 bgcolor=CCCCCC><font color=red size=2 face=arial><b>CASS (6,5 %)</b></td><td align=right bgcolor=cCcCcC><font color=red size=3 face=arial><b>$this->cass</td></tr>";
              echo
"<tr><td align=right width=150 bgcolor=C0C0C0><font color=red size=2 face=arial><b>SOMAJ (1 %)</b></td><td align=right bgcolor=c0c0c0><font color=red size=3 face=arial><b>$this->somaj</td></tr>";
    echo
"<tr><td align=right width=150 bgcolor=CCCCCC><font color=black size=2 face=arial><b>DEDUCERE</b></td><td align=right bgcolor=cCcCcC><font color=black size=3 face=arial><b>$this->deducere</td></tr>";
              echo
"<tr><td align=right width=150 bgcolor=CCCCCC><font color=red size=2 face=arial><b>IMPOZIT (16 %)</b></td><td align=right bgcolor=cCcCcC><font color=red size=3 face=arial><b>$this->impozit</td></tr>";
              echo
"<tr><td align=right width=150 bgcolor=C0C0C0><font color=maroon size=2 face=arial><b>NET </b></td><td align=right bgcolor=c0c0c0><font color=maroon size=3 face=arial><b>$this->net</td></tr>";
              echo
"</table>";
          } else {
    echo
"<hr><font color=red size=3 face=arial><b>Introduceti valorile pentru care doriti calcularea salariului !!!</font>";
          };
     }


     function
calc_salariu($salariu, $spor, $adaos_neimp, $adaos_imp, $pers_intretinere){
         
$this->sal_brut=$this->aproximare($salariu);
         
$this->spor_vech=$this->preluare_spor($spor);
         
$this->adaos_neimp=$this->aproximare($adaos_neimp);
         
$this->adaos_imp=$this->aproximare($adaos_imp);
         
$this->pers_intretinere=$this->persoane($pers_intretinere);
         
$this->valoare_spor=$this->aproximare(($this->sal_brut*$this->spor_vech)/100);
         
$this->brut_total=$this->sal_brut+$this->valoare_spor+$this->adaos_imp;
         
$this->cas=$this->aproximare($this->brut_total*0.095);
         
$this->cass=$this->aproximare($this->brut_total*0.065);
         
$this->somaj=$this->aproximare($this->brut_total*0.01);
         
$this->deducere=$this->calc_deducere($this->brut_total,$this->pers_intretinere);
         
$this->impozabil=$this->brut_total-$this->cas-$this->cass-$this->somaj-$this->deducere;
         
$this->impozit=$this->aproximare($this->impozabil*0.16);
         
$this->net=$this->brut_total+$this->adaos_neimp-$this->cas-$this->cass-$this->somaj-$this->impozit;
         
$this->afis=$this->afisare();
     }
  
}

?>