<?php

/**
 * This is a class file used for paysclae operations.
 *
 * PHP version 5
 *
 * @category Admin_Tool
 * @package  Admin_Tool
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  Aum Infosys
 * @version  CVS:1.0.1
 * @link     http://auminfosys.com/
 * @filesource
 */

/**
 * This is a class named payscaleMgmt.
 *
 * @category School Management System
 * @package  School Management System
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  Aum Infosys
 * @version  Release: 1.0.1
 * @link     http://auminfosys.com/
 *
 */



class payscaleMgmt
{
    /**
     * @var public $payscale_id This is the Payscale Id feteched from the database(cms_payscalemaster  ).
     */

    public $payscale_id;

    /**
     * @var public $current_payscale This is the Current payscale feteched from the database(cms_payscalemaster  ).
     */

    public $current_payscale;

    /**
     * @var public $current_payscale This is the Payband feteched from the database(cms_payscalemaster  ).
     */

    public $payband;

    /**
     * @var public $gradepay This is the grade pay.
     */

    public $gradepay;


    public $payscale_count;



    function payscaleMgmt()
    {
        $this->bullet = "<font size='2'>&raquo;</font>";
        $this->bullet = htmlentities($this->bullet);
        $this->payscale_count = 0;
    }


    /**
     * This is a function for getting the all records with/without condition
     *
     * @param integer $limit This is the limit of number or records.
     * @param integer $start This is the starting location of records.
     * @param string  $condition This is the condition for fetching records.	 
     * @param string  $order_field This is the field for fetching records orderby.	 
     * @param string  $order_type This is the order direction to fetch records orderby.	 	 
     *
     * @return Mix Result Set
     */
    function getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
    {
        $this->school_count = 0;

        $qry = "SELECT * FROM cms_payscalemaster  where 1=1 ";

        if ($condition != "") {
            $qry .= $condition;
        }

        if ($order_field != "" && $order_type != "") {
            $qry .= " order by $order_field $order_type";
        }

        if (intval($limit) > 0 && intval($start) >= 0) {
            $qry .= " Limit $start , $limit";
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            $this->payscale_count = dbRows($out);
            return $out;
        }
        return $out;
    }

    /**
     * This is a function for adding new record for Subject.
     *
     * @return void The redirect file name and the message are passed.
     *
     */
    function add()
    {
        $Qry1 = "";

        $Qry1 .= "current_payscale='" . Escape($this->current_payscale) . "',";
        $Qry1 .= "payband='" . Escape($this->payband) . "',";
        $Qry1 .= "gradepay='" . Escape($this->gradepay) . "',";
        //	$Qry1 .= "blnBackup = '0',";

        if ($Qry1 != "") {
            $Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
            $qry = "insert into cms_payscalemaster  set " . $Qry1 . " ";

             //  echo $qry; exit;	
            dbQuery($qry);
            $this->payscale_id = dbInsertedId();
        }
    }

    /**
     * This is a function for editing a Subject record.
     *
     * @return void The redirect file name and the message are passed.
     *
     */
    function edit()
    {
        $Qry1 = "";

        $Qry1 .= "payscale_id='" . Escape($this->payscale_id) . "',";
        $Qry1 .= "current_payscale='" . Escape($this->current_payscale) . "',";
        $Qry1 .= "payband='" . Escape($this->payband) . "',";
        //	$Qry1 .= "blnBackup = '0',";
        $Qry1 .= "gradepay='" . Escape($this->gradepay) . "',";
        if ($Qry1 != "") {
            $Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
            $qry = "update cms_payscalemaster  set " . $Qry1 . " where payscale_id=" . $this->payscale_id;

            dbQuery($qry);
        }
    }
    /**
     * This is a function for deleting the subject record.
     *
     * @return void The redirect file name and the message are passed.
     *
     */
    function delete()
    {
        $qry = "delete from  cms_payscalemaster  
             	where payscale_id in (" . $this->payscale_id . ") ";
        dbQuery($qry);
    }

}
?>