";
+
+ $TotalStock = $TotalStock + $UpdatedStock;
+
+ }
+
+ die(json_encode(array('History' =>$HTML,'AvalStock'=>$TotalStock)));
+
+}
+
+
+/**
+ * To load pagenotfound view
+ */
+ function pageNotFound()
+
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';
+
+
+
+ $this->loadViews("404", $this->global, NULL, NULL);
+
+ }
+
+}
+
+
+
?>
\ No newline at end of file
diff --git a/application/controllers/user.php b/application/controllers/user.php
old mode 100644
new mode 100755
index 47fce54a..cb559e4d
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -11,7 +11,7 @@ require APPPATH . '/libraries/BaseController.php';
*/
class user extends BaseController
{
- /**
+ /**
* Default constructor of the class
*/
public function __construct()
@@ -19,7 +19,8 @@ class user extends BaseController
parent::__construct();
$this->load->model('user_model');
$this->load->model('dahsboard_Model');
- $this->load->library('form_validation');
+ $this->load->library('form_validation');
+
$this->isLoggedIn();
}
@@ -28,335 +29,741 @@ class user extends BaseController
*/
public function index()
{
- $this->global['pageTitle'] = 'Resico : Dashboard';
+ $this->global['pageTitle'] = 'Resico : Dashboard';
- $this->load->model('employeedetails_model');
+ $this->load->model('employeedetails_model');
+
+
$this->load->model('dahsboard_Model');
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
$data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder();
- $data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
-
- $data['pendingpo']=$this->dahsboard_Model->pendingpo();
-
- // $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount();
- // $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount();
- // $data['totalimportamount']=$this->dahsboard_Model->totalimportamount();
- // $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount();
-
- $data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
-
- $data['details']=$this->dahsboard_Model->reqdetail();
-
- $data['pending_details']=$this->dahsboard_Model->req_pending();
- // $data['list']=$this->dahsboard_Model->req_list();
-
+
+ //print_r( $data['totalpurchaseorder']);
+ $data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
+ $data['pendingpo']=$this->dahsboard_Model->pendingpo();
+ // $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount();
+ // $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount();
+ // $data['totalimportamount']=$this->dahsboard_Model->totalimportamount();
+ // $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount();
+
+
+ // $data['totalservicepo']=$this->dahsboard_Model->totalservicepo();
+ // $data['totalrevenuepo']=$this->dahsboard_Model->totalrevenuepo();
+ $data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
+ //$data['totalcapitalpo']=$this->dahsboard_Model->totalcapitalpo();
+
+ $data['details']=$this->dahsboard_Model->reqdetail();
+
+ $data['pending_details']=$this->dahsboard_Model->req_pending();
+ // $data['list']=$this->dahsboard_Model->req_list();
+
$data['serviceprogress']=$this->dahsboard_Model->serviceprogress();
$data['revenueprogress']=$this->dahsboard_Model->revenueprogress();
$data['importprogress']=$this->dahsboard_Model->importprogress();
$data['capitalprogress']=$this->dahsboard_Model->capitalprogress();
-
- //month-wise area chart
+ //month-wise area chart
$data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount();
$data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount();
$data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount();
- $data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount();
+ $data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount();
+
+
+ //dashboard pie chart
+ $data['importbudgt'] = $this->dahsboard_Model->importbudgt();
+ $data['importbal'] = $this->dahsboard_Model->importbal();
+ $data['servicebudgt'] = $this->dahsboard_Model->servicebudgt();
+ $data['servicebal'] = $this->dahsboard_Model->servicebal();
+ $data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt();
+ $data['revenuebal'] = $this->dahsboard_Model->revenuebal();
+ $data['capitalbud'] = $this->dahsboard_Model->capitalbud();
+ $data['capitalbal'] = $this->dahsboard_Model->capitalbal();
- //dashboard pie chart
- $data['importbudgt'] = $this->dahsboard_Model->importbudgt();
- $data['importbal'] = $this->dahsboard_Model->importbal();
- $data['servicebudgt'] = $this->dahsboard_Model->servicebudgt();
- $data['servicebal'] = $this->dahsboard_Model->servicebal();
- $data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt();
- $data['revenuebal'] = $this->dahsboard_Model->revenuebal();
- $data['capitalbud'] = $this->dahsboard_Model->capitalbud();
- $data['capitalbal'] = $this->dahsboard_Model->capitalbal();
- $data['totemp']=$this->dahsboard_Model->totemp();
- $data['totloan']=$this->dahsboard_Model->totloan();
- $data['totpay']=$this->dahsboard_Model->totpay();
- $data['totrec']=$this->dahsboard_Model->totrec();
- $data['emplist']=$this->dahsboard_Model->emplist();
+ /* HR DASHBOARD Controller Start*/
+ $data['totemp'] = $this->dahsboard_Model->totemp();
+ $data['totloan'] = $this->dahsboard_Model->totloan();
+ $data['totpay'] = $this->dahsboard_Model->totpay();
+ $data['totrec'] = $this->dahsboard_Model->totrec();
+ $data['emplist'] = $this->dahsboard_Model->emplist();
+
/* yesterday absent list count in employee*/
$dates = date('Y-m');
- $date = $dates.'-01';
- $dat = date('d',strtotime("-1 days"));
- $WH = 'WH'.date('j',strtotime("-1 days"));
- $yesterday = $this->dahsboard_Model->attyesterday($WH,$date);
-
- $values=0;
- foreach ($yesterday as $weekda => $value) {
- if($value[$WH] == 0){
- $values++;
- }
-
- }
-
- $data['values'] = $values;
-
- /*Today absent list count in employee*/
- $dates = date('Y-m');
- $date = $dates.'-01';
- $dat = date('d');
- $WH = 'WH'.date('j');
- $yesterday = $this->dahsboard_Model->attyesterday($WH,$date);
- $values=0;
+ $date = $dates . '-01';
+ // echo $date;
+ $dat = date('d', strtotime("-1 days"));
+ //echo $date;
+ $WH = 'WH' . date('j', strtotime("-1 days"));
+
+ //echo($WH);
+ $yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
+ //print_r($yesterday);die;
+ $values = 0;
foreach ($yesterday as $weekda => $value) {
- if($value[$WH] == 0){
- $values++;
+
+ if ($value[$WH] == 0) {
+
+ $values++;
}
- }
-
- $data['today'] = $values;
- $this->loadViews("dashboard", $this->global, $data , NULL);
-}
-function attendancemonth()
-{
-
- $date = date('Y-m');
-
- $dates = $date.'-01';
- $EmpID= $this->input->post('id');
- $monthabs = $this->dahsboard_Model->attendance($EmpID,$dates);
- $persent_month = date('t');
- $values=0;
- $weekdays = array();
- $date = date('d');
-
- for($i=1;$i<=$persent_month;$i++)
- {
- $weekdays[] = 'WH'.$i;
- }
-
- foreach ($monthabs as $weekda ) {
- foreach ($weekda as $key => $value) {
- foreach ($weekdays as $weeks) {
- if($weeks == $key)
- {
- if($value != 0){
- $values++;
- }
- }
-
- }
}
- }
-
- $year = date('Y');
- $current_month = date('m');
- $CUR_month = date('t');
-
- $data['values'] = $values;
- $data['present_percentage'] = round(($values/$date)*100);
- $data['CUR_month'] = $date;
-
- echo json_encode($data);
-
-}
+ // echo $values;
+ $data['values'] = $values;
-public function getFinancialStartDate() {
- $CURMONTH = date('n');
- $CURYEAR = date('Y');
- $FINYEAR = 0;
- if($CURMONTH >= 4 ) {
- $FINYEAR = $CURYEAR;
- }else {
- $FINYEAR = $CURYEAR-1;
+
+ /*Today absent list count in employee*/
+ $dates = date('Y-m');
+ //echo $date;
+ $date = $dates . '-01';
+
+ $dat = date('d');
+ //echo $date;
+
+ $WH = 'WH' . date('j');
+ //echo $WH;die;
+
+ $yesterday = $this->dahsboard_Model->attyesterday($WH, $date);
+ //print_r($yesterday);die;
+
+
+ //$absEmp =array($absEmp);
+ $values = 0;
+ $absEmp = array();
+ //echo $value; die;
+ foreach ($yesterday as $weekda => $value) {
+
+ if ($value[$WH] == 0) {
+
+ $values++;
+ $absendId = $value['EmpID'];
+ $absendName = $value['FirstName'];
+
+
+ $absEmp [] = $absendId . "-" . $absendName; //absend empid and name list
+
+
+ // foreach($absEmp as $value => $absentEmpName){
+
+ // echo $absentEmpName; die;
+
+ // }
+
+ }
+
+
+ }
+
+ //print_r($absentName);die;
+ $data['today'] = $values;
+ $data['absname'] = $absEmp;
+ // function todayEmployeeSalaylist()
+ //{
+
+ $date = date('Y-m');
+ //echo $date; die;
+ $date = $date . '-01';
+ $dat = date('d');
+
+ //echo $dat; die;
+ $WH = 'WH' . date('j');
+ $OT = 'OT' . date('j');
+
+ $CUR_month = date('t');
+ // echo $CUR_month; die;
+
+ $toDayEmployee = $this->dahsboard_Model->dayAllPersentEmpSalary($WH, $OT, $date);
+ //$EmpID = $toDayEmployee[0]->EmpID;
+
+ // print_r($toDayEmployee); die;
+
+ $EmpID = 0;
+
+ $employeeSalary = 0;
+
+ foreach ($toDayEmployee as $value) {
+ $values = 0;
+ $totalothour = 0;
+ if ($value[$WH] != 0) {
+ $totalothour = $value[$OT];
+ //echo $totalothour;die;
+ $values = 1;
+
+ //print_r($values); die;
+ $Empid = $value['EmpID'];
+ //echo $Empid; die;
+
+ $totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
+ //print_r($totalEmployeePersent);die;
+
+ $HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
+ $Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
+ $totalsalary = $totalEmployeePersent[0]->TotalSalary;
+ $dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
+
+
+ $Food_Allowances = $dayFoodAmt * $values;
+
+ $daySalary = $Basic_Pay / $CUR_month;
+ /**per day salary working hour**/
+ //echo $daySalary.' ';
+
+ $dayHra = $HRA_Amount / $CUR_month;
+ /** per day hra amount **/
+ //echo $dayHra.' ';
+ $onehoursSalary = ($daySalary + $dayHra) / 8;
+ /**one hour salay ot calculation**/
+ if ($totalothour != 0) /** if ot not equal zero **/ {
+ $totSalayOT = $totalothour * $onehoursSalary;
+ } else {
+ $totSalayOT = 0;
+ }
+ $currentDaySalary = $daySalary * $values;
+ /** current day salary working days calculation**/
+
+
+ $currentDayHra = $dayHra * $values;
+ /** total working days hra calculations**/
+ // echo $currentDayHra.' ';
+ $currentDatePF = $currentDaySalary + $currentDayHra;
+ /** current date pf calculation**/
+ if ($totalsalary <= 20000) {
+
+ $esiAmount = $currentDatePF * 1.75 / 100;
+ /** esiamount not elgiable for 20000 **/
+ } else {
+ $esiAmount = 0;
+ }
+ $pfAmount = $currentDaySalary * 12 / 100;
+ /** pf amount per day**/
+
+ //echo $totalothour;die;
+ $salaryInCurrentday = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
+
+ $employeeSalary += round($salaryInCurrentday);
+
+ }
+
+ }
+
+
+ //$salaryInCurrentday++;
+
+
+ $data['employeeSalary'] = $employeeSalary;
+
+
+ // }
+
+ // function monthTodayEmployeeSalaylist()
+ // {
+
+ $date = date('Y-m');
+ //echo $date; die;
+ $date = $date . '-01';
+ $dat = date('d');
+
+ // $currentdaydates =date('d');
+ $working = array();
+ $overtime = array();
+ for ($i = 1; $i <= $dat; $i++) //echo $dat; die;
+ {
+ $Working [] = 'WH' . $i;
+ $overtime [] = 'OT' . $i;
+
+ $CUR_month = date('t');
+ // echo $CUR_month; die;
+ }
+ //print_r($WH);die;
+ $WH = implode(",", $Working);
+ $OT = implode(",", $overtime);
+ $salarycurrentdate = array();
+ $toDayEmployee = $this->dahsboard_Model->dayAllPersentEmpSalary($WH, $OT, $date);
+ //$EmpID = $toDayEmployee[0]->EmpID;
+ //
+
+
+ // print_r($toDayEmployee); die;
+
+ $employeeSalary = 0;
+
+ // for($i=1;$i<=$dat;$i++)
+ // {
+
+ $totalSalary = 0;
+ $working = explode(",", $WH);
+ $overtime = explode(",", $OT);
+ foreach ($toDayEmployee as $value) {
+ $values = 0;
+ foreach ($working as $work) {
+// foreach ($overtime as $extra) {
+
+ if ($value[$work] != 0 || $value['OT' . substr($work, 2)] != 0) {
+ $totalothour = $value['OT' . substr($work, 2)];
+ //echo $totalothour;
+ $values = 1;
+
+ //print_r($values); die;
+ $Empid = $value['EmpID'];
+ //echo $Empid;
+
+ $totalEmployeePersent = $this->dahsboard_Model->persentEmployeeDetails($Empid);
+ //print_r($totalEmployeePersent);
+
+ $HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
+ $Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
+ $totalsalary = $totalEmployeePersent[0]->TotalSalary;
+ $dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
+
+
+ $Food_Allowances = $dayFoodAmt * $values;
+
+ $daySalary = $Basic_Pay / $CUR_month;
+ /**per day salary working hour**/
+ //echo $daySalary.' ';
+
+ $dayHra = $HRA_Amount / $CUR_month;
+ /** per day hra amount **/
+ //echo $dayHra.' ';
+ $onehoursSalary = ($daySalary + $dayHra) / 8;
+ /**one hour salay ot calculation**/
+ if ($totalothour != 0) /** if ot not equal zero **/ {
+ $totSalayOT = $totalothour * $onehoursSalary;
+ } else {
+ $totSalayOT = 0;
+ }
+ $currentDaySalary = $daySalary * $values;
+ /** current day salary working days calculation**/
+
+
+ $currentDayHra = $dayHra * $values;
+ /** total working days hra calculations**/
+ // echo $currentDayHra.' ';
+ $currentDatePF = $currentDaySalary + $currentDayHra;
+ /** current date pf calculation**/
+ if ($totalsalary <= 20000) {
+
+ $esiAmount = $currentDatePF * 1.75 / 100;
+ /** esiamount not elgiable for 20000 **/
+ } else {
+ $esiAmount = 0;
+ }
+ $pfAmount = $currentDaySalary * 12 / 100;
+ /** pf amount per day**/
+
+ //echo $totalothour;die;
+ $salaryInCurrentday = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
+
+
+ $totalSalarys = $totalSalary + $salaryInCurrentday;
+
+ $totalSalary = round($totalSalarys);
+// $salarycurrentdate[] = $salaryInCurrentday;;
+ }
+
+// }
+ //print_r($salarycurrentdate);
+// $currentmonthsalary = array_sum($salarycurrentdate);
+// $totalSalary = $totalSalary + $salarycurrentdate;
+ // $salaryInCurrentday++;
+// echo $totalSalary;
+ //print_r($currentmonthsalary);
+
+ }
+ }
+ $data['totalSalary'] = $totalSalary;
+ //}
+
+
+ $this->loadViews("dashboard", $this->global, $data, NULL);
}
-
- $dateInString = $FINYEAR.'-4-1';
- $result = date_create($dateInString);
- return $result;
- }
-
- public function getFinancialEndDate() {
- $CURMONTH = date('n');
- $CURYEAR = date('Y');
- $FINYEAR = 0;
- if($CURMONTH < 4 ) {
- $FINYEAR = $CURYEAR;
- }else {
- $FINYEAR = $CURYEAR+1;
+
+
+
+
+
+ public function getFinancialStartDate()
+ {
+ $CURMONTH = date('n');
+ $CURYEAR = date('Y');
+ $FINYEAR = 0;
+ if ($CURMONTH >= 4)
+ {
+ $FINYEAR = $CURYEAR;
+ } else
+ {
+ $FINYEAR = $CURYEAR - 1;
+ }
+
+ $dateInString = $FINYEAR . '-4-1';
+ $result = date_create($dateInString);
+ return $result;
}
-
- $dateInString = $FINYEAR.'-3-31';
- $result = date_create($dateInString);
- return $result;
- }
-
- function attendanceyear()
- {
- $CURMONTH = date('m');
- $CURDATE = date('d');
-
-
- $EmpID= $this->input->post('id');
- $day = array();
-
-
- $datejoin=$this->dahsboard_Model->joindate($EmpID);
-
+
+ public function getFinancialEndDate()
+ {
+ $CURMONTH = date('n');
+ $CURYEAR = date('Y');
+ $FINYEAR = 0;
+ if ($CURMONTH < 4)
+ {
+ $FINYEAR = $CURYEAR;
+ } else
+ {
+ $FINYEAR = $CURYEAR + 1;
+ }
+
+ $dateInString = $FINYEAR . '-3-31';
+ $result = date_create($dateInString);
+ return $result;
+ }
+
+function monthattendance()
+{
+
+ $date = date('Y-m');
+ //echo $date;
+ $dates = $date . '-01';
+ $EmpID = $this->input->post('id');
+ // echo $EmpID;die;
+ $monthabs = $this->dahsboard_Model->attendance($EmpID, $dates);
+ $persent_month = date('t');//current month of days 31
+ $values = array();
+ $otvalues = array();
+
+ $weekdays = array();
+ $otHours = array();
+ $date = date('j');//current month current date
+
+
+ $CURDATE =date('d');//current month current date
+
+ $CUR_month = date('t'); //current month of days 31
+
+
+ $CURYEAR = date('Y');
+ $CURMONTH = date('m');
+
+ $datejoin = $this->dahsboard_Model->joindate($EmpID);
$DateofJoiningInString = $datejoin[0]->DateofJoining;
$DateofJoining = date_create($DateofJoiningInString);
-
-
-
- $finStart = $this->getFinancialStartDate();
- $finEnd = $this->getFinancialEndDate();
-
-
- $JoinedMonth = date_format($DateofJoining,"n");
-
- if($DateofJoining >= $finStart && $DateofJoining <= $finEnd) {
-
- $JoinedMonthAttendance = $this->dahsboard_Model->getAllAttendance($EmpID,$JoinedMonth);
-
-
- $doj_month =date_format($DateofJoining,"n");
- $doj_year= date_format($DateofJoining,"Y");
- $doj_day= date_format($DateofJoining,"j");
-
- $joinedMonthDaysCount = cal_days_in_month(CAL_GREGORIAN, $doj_month, $doj_year);
- $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day;
-
-
-
- $joinedMonthDays =0;
- for($j=$doj_day;$j<=$joinedMonthDaysCount;$j++)
- {
- $weekdays[] = 'WH'.$j;
- }
- foreach ($JoinedMonthAttendance as $day ) {
- //print_r($weekda);
- foreach ($day as $key => $value) {
- foreach ($weekdays as $weeks) {
-
- if($weeks == $key)
- {
- if($value!= 0){
-
- $joinedMonthDays++;
- }
- }
-
- }
-
-
- }
- }
-
-
-
-
- $result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
- $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH);
-
- //print_r($yearabs);exit();
- $TotalNoofDays = $result[0]->TotalWorkingDays;
- $DaysWorked = $result[0]->DaysWorked;
-
-
- $values=0;
-
- $weekdays = array();
- $date = date('d');
-
- $Work= array_sum($weekdays);
-
- for($j=1;$j<=$date;$j++)
- {
- $weekdays[] = 'WH'.$j;
- }
- foreach ($yearabs as $day ) {
- //print_r($weekda);
- foreach ($day as $key => $value) {
- foreach ($weekdays as $weeks) {
-
- if($weeks == $key)
- {
- if($value != 0){
-
- $values++;
- }
- }
-
- }
-
-
- }
- }
-
-
- $TotalNoofDays = $TotalNoofDays+$CURDATE + $joinedMonthWorkingDayCount ;
- $DaysWorked = $DaysWorked+$values+$joinedMonthDays;
-
- $final_res = round(($DaysWorked /$TotalNoofDays) * 100);
- $data['workeds']=$DaysWorked;
- $data['yeardata'] = $final_res;
- $data['totaldays'] = $TotalNoofDays;
-
-
- echo json_encode($data);
-
-
- }else {
- $result = $this->dahsboard_Model->attendanceyear($EmpID, 4);
- $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH);
-
-
- $TotalNoofDays = $result[0]->TotalWorkingDays;
- $DaysWorked = $result[0]->DaysWorked;
-
-
- $values=0;
-
- $weekdays = array();
- $date = date('d');
-
- $Work= array_sum($weekdays);
-
- for($j=1;$j<=$date;$j++)
- {
- $weekdays[] = 'WH'.$j;
- }
- foreach ($yearabs as $day ) {
- //print_r($weekda);
- foreach ($day as $key => $value) {
- foreach ($weekdays as $weeks) {
-
- if($weeks == $key)
- {
- if($value != 0){
-
- $values++;
- }
- }
-
- }
-
-
- }
- }
-
- $TotalNoofDays = $TotalNoofDays+$CURDATE;
- $DaysWorked = $DaysWorked+$values;
-
- $final_res = round(($DaysWorked /$TotalNoofDays) * 100);
- $data['workeds']=$DaysWorked;
- $data['yeardata'] = $final_res;
- $data['totaldays'] = $TotalNoofDays;
-
- echo json_encode($data);
- }
- }
+ $doj_month = date_format($DateofJoining, "n");
+ $doj_year = date_format($DateofJoining, "Y");
+ $doj_day = date_format($DateofJoining, "j");
+ //echo $doj_day;
+ for ($i = 1; $i <= $persent_month; $i++)
+ {
+ $weekdays[] = 'WH' . $i;
+ $otHours[] = 'OT' . $i;
+ }
+
+ foreach ($monthabs as $weekda)
+ {
+ //print_r($weekda);
+ foreach ($weekda as $key => $value)
+ {
+ //print_r($key);
+ foreach ($weekdays as $weeks)
+ {
+ if ($weeks == $key)
+ {
+ //print_r($key);
+ if ($value != 0)
+ {
+ //echo $value;
+ $values[] = $value;
+
+ }
+ //echo $values;
+ }
+
+ }
+ foreach ($otHours as $ot)
+ {
+ if ($ot == $key)
+ {
+ if ($value != 0)
+ {
+ $otvalues [] = $value;
+
+ }
+
+ }
+ }
+
+ }
+ }
+
+
+ $totalothour = array_sum($otvalues);
+ $totalwhhour = sizeof($values);
+ //echo $totalwhhour;
+ if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
+ {
+ //echo $doj_day;
+ $month['CUR_month'] = $CURDATE - $doj_day + 1;
+ //print_r($month);
+ }
+ else
+ {
+ $month['CUR_month'] = $date;
+ }
+
+ if ($totalwhhour != 0)
+ {
+ // //echo $values;
+ // $currentDateSalary = $this->dahsboard_Model->daysalary($EmpID, $dates);
+ // $HRA_Amount = $currentDateSalary[0]->HRA_Amount;
+ // $Basic_Pay = $currentDateSalary[0]->Basic_Pay;
+ // $totalsalary = $currentDateSalary[0]->TotalSalary;
+ // $dayFoodAmt = $currentDateSalary[0]->Food_Allowances;
+
+ // $Food_Allowances = $dayFoodAmt * $values;
+
+ // $daySalary = $Basic_Pay / $CUR_month;
+
+ // $onehoursSalary = $daySalary / 8;
+
+ // if ($totalothour != 0)
+ // {
+ // $totSalayOT = $totalothour * $onehoursSalary;
+ // }
+ // else
+ // {
+ // $totSalayOT = 0;
+ // }
+ // $currentDaySalary = $daySalary * $values;
+
+ // $dayHra = $HRA_Amount / $CUR_month;
+
+ // $currentDayHra = $dayHra * $values;
+
+ // $currentDatePF = $currentDaySalary + $currentDayHra;
+
+ // if ($totalsalary <= 20000)
+ // {
+ // $esiAmount = $currentDatePF * 1.75 / 100;
+
+ // }
+ // else
+ // {
+ // $esiAmount = 0;
+ // }
+ // $pfAmount = $currentDaySalary * 12 / 100;
+
+ // $salaryInCurrentday = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
+
+ $year = date('Y');
+ $current_month = date('m');
+
+ $month['values'] = $totalwhhour;
+ //$data['salaryInCurrentday'] = round($salaryInCurrentday);
+ $month['present_percentage'] = round(($totalwhhour / $month['CUR_month']) * 100);
+
+ }
+
+ else {
+
+ $month['values'] = 0;
+ //$data['salaryInCurrentday'] = 0;
+ $month['present_percentage'] = 0;
+
+ }
+ echo json_encode($month);
+ }
+
+
+function attendanceyear()
+{
+ //echo "hai";die;
+ $CURMONTH = date('m');
+ $CURDATE = date('d');
+ $CURYEAR = date('Y');
+ $EmpID = $this->input->post('id');
+ // $month = $this->monthattendance($EmpID);
+ // echo json_encode($month);
+ $day = array();
+ $datejoin = $this->dahsboard_Model->joindate($EmpID);
+ $DateofJoiningInString = $datejoin[0]->DateofJoining;
+ $DateofJoining = date_create($DateofJoiningInString);
+ $doj_month = date_format($DateofJoining, "n");
+ $doj_year = date_format($DateofJoining, "Y");
+ $doj_day = date_format($DateofJoining, "j");
+ $finStart = $this->getFinancialStartDate();
+ $finEnd = $this->getFinancialEndDate();
+
+ $JoinedMonth = date_format($DateofJoining, "n");
+ // echo $JoinedMonth; die;
+
+ if ($DateofJoining >= $finStart && $DateofJoining <= $finEnd)
+ {
+ $JoinedMonthAttendance = $this->dahsboard_Model->getAllAttendances($EmpID,$JoinedMonth);
+ $joinedMonthDaysCount = cal_days_in_month(CAL_GREGORIAN, $doj_month, $doj_year);
+
+ if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
+ {
+ $joinedMonthWorkingDayCount = $CURDATE - $doj_day +1;
+ }
+ else
+ {
+ $joinedMonthWorkingDayCount = $joinedMonthDaysCount - $doj_day;
+ }
+
+ $joinedMonthDays = 0;
+ for ($j = $doj_day; $j <= $joinedMonthDaysCount; $j++)
+ {
+ $weekdays[] = 'WH' . $j;
+ }
+ foreach ($JoinedMonthAttendance as $day)
+ {
+ foreach ($day as $key => $value)
+ {
+ foreach ($weekdays as $weeks)
+ {
+ if ($weeks == $key)
+ {
+ if ($value != 0)
+ {
+ //echo $value;
+ $joinedMonthDays++;
+ }
+ }
+
+ }
+ }
+
+ }
+
+ // echo $joinedMonthWorkingDayCount;die;
+
+ $result = $this->dahsboard_Model->attendanceyear($EmpID, $JoinedMonth + 1);
+ $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
+ $TotalNoofDays = $result[0]->TotalWorkingDays;
+ $DaysWorked = $result[0]->DaysWorked;
+
+ // echo $DaysWorked; die;
+ // print_r($DaysWorked);die;
+ $values = 0;
+ $weekdays = array();
+ $date = date('d');
+
+ $Work = array_sum($weekdays);
+
+ for ($j = 1; $j <= $date; $j++)
+ {
+ $weekdays[] = 'WH' . $j;
+ }
+
+ foreach ($yearabs as $day)
+ {
+ foreach ($day as $key => $value)
+ {
+ foreach ($weekdays as $weeks)
+ {
+ if ($weeks == $key)
+ {
+ if ($value != 0)
+ {
+ $values++;
+ }
+ }
+
+ }
+ }
+ }
+
+ $DaysWorked = 0;
+ if ($CURMONTH == $doj_month && $CURYEAR == $doj_year)
+ {
+ $TotalNoofDays = $TotalNoofDays + $joinedMonthWorkingDayCount;
+ $DaysWorked = $joinedMonthDays;
+ }
+ else
+ {
+ $TotalNoofDays = $TotalNoofDays + $CURDATE + $joinedMonthWorkingDayCount;
+ $DaysWorked = $DaysWorked + $joinedMonthDays + $values;
+ }
+
+ // $DaysWorked = $DaysWorked + $joinedMonthDays + $values;
+//echo $TotalNoofDays.'-'.$DaysWorked;
+
+
+ $final_res = round(($DaysWorked / $TotalNoofDays) * 100);
+ // echo "------";
+ //echo $final_res;exit();
+ $data['workeds'] = $DaysWorked;
+ $data['yeardata'] = $final_res;
+ $data['totaldays'] = $TotalNoofDays;
+
+ }
+
+ else
+ {
+ $result = $this->dahsboard_Model->attendanceyear($EmpID, 4);
+ $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID, $CURMONTH);
+ $TotalNoofDays = $result[0]->TotalWorkingDays;
+ $DaysWorked = $result[0]->DaysWorked;
+
+
+ $values = 0;
+
+ $weekdays = array();
+ $date = date('d');
+
+ $Work = array_sum($weekdays);
+
+ for ($j = 1; $j <= $date; $j++)
+ {
+ $weekdays[] = 'WH' . $j;
+ }
+ foreach ($yearabs as $day)
+ {
+ foreach ($day as $key => $value)
+ {
+ foreach ($weekdays as $weeks)
+ {
+ if ($weeks == $key)
+ {
+ if ($value != 0)
+ {
+
+ $values++;
+ }
+ }
+
+ }
+ }
+ }
+
+ $TotalNoofDays = $TotalNoofDays + $CURDATE;
+ $DaysWorked = $DaysWorked + $values;
+ $final_res = round(($DaysWorked / $TotalNoofDays) * 100);
+ // echo "------";
+ //echo $final_res;exit();
+ $data['workeds'] = $DaysWorked;
+ $data['yeardata'] = $final_res;
+ $data['totaldays'] = $TotalNoofDays;
+
+ // $month = $this->monthattendance();
+
+ // $data['values'] = $values;
+ // $data['salaryInCurrentday'] = round($salaryInCurrentday);
+ // $data['present_percentage'] = round(($values / $data['CUR_month']) * 100);
+
+ //print_r($data);die;
+
+ }
+
+ echo json_encode($data);
+
+}
+
+/****************HR DASHBOART Controller END **************************************/
-
/**
- * To load the user list
+ * This function is used to load the user list
*/
function userListing()
{
@@ -398,7 +805,7 @@ public function getFinancialStartDate() {
}
/**
- * To check whether email already exist or not
+ * This function is used to check whether email already exist or not
*/
function checkEmailExists()
{
@@ -414,29 +821,29 @@ public function getFinancialStartDate() {
if(empty($result)){ echo("true"); }
else { echo("false"); }
}
-
- /**
- * Validation for Employee Dropdown
+ /* Validation for Employee Dropdown
*/
function Employee_validate($selectValue)
- {
- if($selectValue == '0')
- {
- $this->form_validation->set_message('Employee_validate', 'Please Select Employee.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
- }
-
- /**
- * Validation for Role Dropdown
- */
- function Role_validate($selectValue)
+{
+ //echo 'select_validate method called';
+ // 'none' is the first option and the text says something like "-Choose one-"
+ if($selectValue == '0')
{
- if($selectValue == '0')
+ $this->form_validation->set_message('Employee_validate', 'Please Select Employee.');
+ return false;
+ }
+ else // user picked something
+ {
+ return true;
+ }
+}
+ /* Validation for Employee Dropdown
+ */
+ function Role_validate($selectValue)
+{
+ //echo 'select_validate method called';
+ // 'none' is the first option and the text says something like "-Choose one-"
+ if($selectValue == '0')
{
$this->form_validation->set_message('Role_validate', 'Please Select Role.');
return false;
@@ -458,8 +865,8 @@ public function getFinancialStartDate() {
else
{
- $this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
- $this->form_validation->set_rules('role','role','trim|callback_Role_validate');
+ $this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
+ $this->form_validation->set_rules('role','role','trim|callback_Role_validate');
$this->form_validation->set_rules('password','Password','required|max_length[20]');
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
@@ -473,10 +880,12 @@ public function getFinancialStartDate() {
$EmpID = $this->input->post('EmpList');
$roleId = $this->input->post('role');
$password = $this->input->post('password');
- $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+ $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$Createddt = $dt->format('Y-m-d H:i:s');
+
$email = $this->input->post('MailID');
+
$userInfo = array('email'=>$email,'EmpID'=>$EmpID,'password'=>getHashedPassword($password),'roleId'=>$roleId,'createdBy'=>$this->vendorId,'createdDtm'=>$Createddt);
$result = $this->user_model->addNewUser($userInfo);
@@ -486,13 +895,13 @@ public function getFinancialStartDate() {
redirect('userListing','refresh');
echo "";
-
- }
+
+ }
else
{
redirect('userListing','refresh');
- echo "";
+ echo "";
}
}
@@ -500,8 +909,8 @@ public function getFinancialStartDate() {
}
- /**
- * For editing purpose and it has oldest values only.
+ /**
+ * To store edited user information
*/
function editOld($UserId = '')
{
@@ -517,17 +926,27 @@ public function getFinancialStartDate() {
}
$Uid = $_GET['UID'];
+
+
+
$data['roles'] = $this->user_model->getUserRoles();
+
+ //print_r($data);
+
$data['EmpList'] = $this->user_model->GetEmployeeDetails($Uid);
+ //print_r($data);
$data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid);
+ // $data['userInfo'] = $this->user_model->getUserInfo($userId);
+
$this->global['pageTitle'] = 'Resico : Edit User';
+
$this->loadViews("editOld", $this->global, $data, NULL);
}
}
- /**
+ /**
* To store edited user information
*/
function editUser()
@@ -540,7 +959,7 @@ public function getFinancialStartDate() {
{
$userId = $this->input->post('EmpList');
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
- $this->form_validation->set_rules('role','role','trim|callback_Role_validate');
+ $this->form_validation->set_rules('role','role','trim|callback_Role_validate');
$this->form_validation->set_rules('password','Password','required|max_length[20]');
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
@@ -553,12 +972,19 @@ public function getFinancialStartDate() {
$EmpID = $this->input->post('EmpList');
$role = $this->input->post('role');
$password = $this->input->post('password');
- $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+ $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updatedDate = $dt->format('Y-m-d H:i:s');
-
- $userInfo = array();
+
+ // echo $EmpID;
+
+ $userInfo = array();
+
+
$userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate);
+
+
+
$result = $this->user_model->editUser($userInfo, $EmpID);
if($result == true)
@@ -570,8 +996,7 @@ public function getFinancialStartDate() {
$this->session->set_flashdata('error', 'User updation failed');
}
- redirect('userListing');
-
+ redirect('userListing');
}
}
}
@@ -584,17 +1009,19 @@ public function getFinancialStartDate() {
{
echo 'Delete';
$Uid = $this->input->post('id');
- $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
- $updatedDate = $dt->format('Y-m-d H:i:s');
-
- $userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate);
- $result = $this->user_model->deleteUser($Uid, $userInfo);
- echo 'Succssfully change the user status to InAcive';
+ $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+ $updatedDate = $dt->format('Y-m-d H:i:s');
+
+ $userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate);
+
+ $result = $this->user_model->deleteUser($Uid, $userInfo);
+
+ echo 'Succssfully change the user status to InAcive';
}
- /**
+ /**
* To load the change password screen
*/
function loadChangePass()
@@ -647,7 +1074,7 @@ public function getFinancialStartDate() {
}
}
- /**
+ /**
* To load pagenotfound view
*/
function pageNotFound()
diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php
index c4601f2b..fa235190 100644
--- a/application/models/assetdetails_model.php
+++ b/application/models/assetdetails_model.php
@@ -5,7 +5,7 @@ class assetdetails_model extends CI_Model
/**
* To get the Asset data for listing
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns asset information)
*/
function assetListing()
{
@@ -103,7 +103,7 @@ class assetdetails_model extends CI_Model
/**
* To get the PO lineitem details for revenue po.
* @param $line : This is PO lineitem number
- * @return $result : result of the query (returns po lineitem details)
+ * @return $result : result of the query (returns revenue po lineitem details)
*/
function getlineitemre($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
@@ -126,7 +126,7 @@ class assetdetails_model extends CI_Model
/**
* To get the PO lineitem details for service po.
* @param $line : This is PO lineitem number
- * @return $result : This is result of the query (returns po lineitem details)
+ * @return $result : This is result of the query (returns service po lineitem details)
*/
function getlineitemser($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
@@ -149,7 +149,7 @@ class assetdetails_model extends CI_Model
/**
* To get the PO lineitem details for import po.
* @param $line : This is PO lineitem number
- * @return $result : result of the query (returns po lineitem details)
+ * @return $result : result of the query (returns import po lineitem details)
*/
function getlineitemimport($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
@@ -171,8 +171,8 @@ class assetdetails_model extends CI_Model
/**
* To get the PO lineitem details for capital po.
- * @param $line : To get PO lineitem number from the controller
- * @return $result : This is result of the query (returns po lineitem details)
+ * @param $line : This is PO lineitem number
+ * @return $result : result of the query (returns po capital lineitem details)
*/
function getlineitemcap($line){
@@ -195,7 +195,7 @@ class assetdetails_model extends CI_Model
/**
* To get the PO lineitem details revalant po.
* @param $type : This is PO type
- * @return $result : result of the query (returns po lineitem detail)
+ * @return $result : result of the query (returns po type and lineitem no)
*/
function gettyp($type)
{
@@ -232,8 +232,8 @@ class assetdetails_model extends CI_Model
/**
* To Store the asset information
- * @param $asset : This have all the asset details datas.
- * @return $Asset_Code : This will return how many value are inserted (return as number/count)
+ * @param $asset : This will have all asset datas
+ * @return $Asset_Code : This will return how many value are inserted (return as number(counts))
*/
function addNewasset($asset)
{
@@ -266,7 +266,7 @@ class assetdetails_model extends CI_Model
/**
* To Stored edited Asset details from respective Asset Code
- * @param $asset : This have all the information of asset
+ * @param $asset : This will have all the edited asset information
* @param $Asset_Code : This is asset code
*/
function editasset($asset, $Asset_Code)
@@ -278,7 +278,7 @@ class assetdetails_model extends CI_Model
/**
* To Store edited Asset details in respective Asset Code
- * @param $asset : This have all the information of asset details
+ * @param $asset : This will have all edited aseet information
* @param $Asset_Code : This is asset code
*
* Note : This function Temporary not in use
diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php
index f4e5c608..68e829f4 100755
--- a/application/models/cashbook_model.php
+++ b/application/models/cashbook_model.php
@@ -3,8 +3,8 @@
class cashbook_model extends CI_Model
{
/**
- * To get Account status
- * @return array $r->result() : result of the query
+ * To get Account Type
+ * @return array $r->result() : result of the query (returns active account code)
*/
function getAccounTypes()
{
@@ -16,7 +16,7 @@ class cashbook_model extends CI_Model
/**
* To get Account status
- * @param number $data : This will have all the information of asset details.
+ * @param number $data : This will have all the income and expense information.
* @return array $r : This will return how many value are inserted (return as number/count)
*/
function saveIncomeExpense($data)
@@ -29,7 +29,7 @@ class cashbook_model extends CI_Model
/**
* To get Income and expense List
* @param number $i : Optional : This is incomeandexpense's id
- * @return array $r->result() : result of the query
+ * @return array $r->result() : result of the query (returns account information)
*/
function getIncomeExpenseList($i="")
{
@@ -49,7 +49,7 @@ class cashbook_model extends CI_Model
/**
* To get Company details
- * @return array $r->result() : result of the query
+ * @return array $r->result() : result of the query (returns company information)
*/
function getCompany()
{
@@ -60,7 +60,7 @@ class cashbook_model extends CI_Model
/**
* To get Account Information
* @param number $i
- * @return array $r->result() : result of the query
+ * @return array $r->result() : result of the query (returns account name and incomeandexpense information)
*/
function getAccounutInfo($i)
{
@@ -74,7 +74,7 @@ class cashbook_model extends CI_Model
/**
* To get Account Information
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns account information)
*/
function Selectcash()
{
diff --git a/application/models/companydetailsmodel.php b/application/models/companydetailsmodel.php
index e94e013a..d69e4126 100644
--- a/application/models/companydetailsmodel.php
+++ b/application/models/companydetailsmodel.php
@@ -57,7 +57,7 @@ class companydetailsmodel extends CI_Model
* To update the company related files information
* @param number $compID : This is company ID
* @param array $Comp : This have all the modified company datas
- * @return array $this->db->last_query() : This will return changes in last executed query
+ * @return array $this->db->last_query() : This will return changes in last executed query (return as counts in number)
*/
function Updatecompany($Comp, $CompID)
{
@@ -85,7 +85,7 @@ class companydetailsmodel extends CI_Model
/**
* To get the Company Information for listing
- * @return array $result : This is result of the query
+ * @return array $result : result of the query (returns company information)
*/
function companylisting()
{
@@ -101,7 +101,7 @@ class companydetailsmodel extends CI_Model
/**
* To get the paymentterms information for companydetails
- * @return array $result : This is result of the query
+ * @return array $result : result of the query(return paymentment information)
*/
function getPaymentTerms()
{
@@ -170,13 +170,13 @@ class companydetailsmodel extends CI_Model
}
- if($count == 0 )
+ if($count == 0 )// for insertion
{
$i = $this->db->insert('T_Bank_Details', $Bank);
return $i;
}
- elseif($count == 1)
+ elseif($count == 1)//for updation
{
$this->db->where('Bank_name',$bankname);
$this->db->where('IFSC',$bankifsc);
diff --git a/application/models/configmodel.php b/application/models/configmodel.php
index 22e2aeff..a3e9d549 100644
--- a/application/models/configmodel.php
+++ b/application/models/configmodel.php
@@ -5,7 +5,7 @@ class configmodel extends CI_Model
/**
* To get the Config listing
- * @return array $result : This is result of the query
+ * @return array $result : result of the query(returns config information)
*/
function Configlisting()
{
@@ -20,7 +20,7 @@ class configmodel extends CI_Model
/**
* To store config master information by configid
* @param number $config : This will have all the config information
- * @var $insert_id : This will return how many value are inserted (return as number/count)
+ * @var $insert_id : This will return how many value are inserted (return as count in numbers)
* @return array $res->result_array() :This will return maximum of Configid for config lineitem table
*/
function addconfigmaster($config)
@@ -38,7 +38,7 @@ class configmodel extends CI_Model
/**
* To store config details information
* @param number $configvalue : This will have all the config information
- * @return array $insert_id : This will return how many value are inserted (return as number/count)
+ * @return number $insert_id : This will return how many value are inserted (return as count in numbers)
*/
function addconfigdetails($configvalue)
{
@@ -169,7 +169,7 @@ class configmodel extends CI_Model
* To get costcenter department information by using department code and costcenter id
* @param number $Depcode : Optional : This is department code
* @param number $CostCode : Optional : This is cost code
- * @return array $query->result_array() : This is result of the query (config master information)
+ * @return array $query->result_array() : result of the query (returns cost master information)
*/
function checkDeptCostExists($DepCode='',$CostCode='')
{
@@ -189,7 +189,7 @@ class configmodel extends CI_Model
/**
* To get the Config value from configuration table
* @param number @ConfigID : This is ConfigID
- * @return array $result : This is result of the query
+ * @return array $result : result of the query (returns config information)
*/
function getConfigValue($ConfigID)
{
diff --git a/application/models/costcenter_model.php b/application/models/costcenter_model.php
index 96f6c047..2fe7a263 100644
--- a/application/models/costcenter_model.php
+++ b/application/models/costcenter_model.php
@@ -5,7 +5,7 @@ class costcenter_model extends CI_Model
/**
* To get the Cost listing
- * @return array $result : This is result of the query
+ * @return array $result : result of the query (returns )
*/
function CostListing()
{
@@ -200,7 +200,6 @@ class costcenter_model extends CI_Model
* @param number $Year : This is Budget year
* @return array $query->result_array() : This is result of the query
*/
-
function GetCostCenterBudgetByYear($CostCenterCode,$Year)
{
diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php
index 78966dc7..0c50b998 100755
--- a/application/models/dahsboard_model.php
+++ b/application/models/dahsboard_model.php
@@ -4,7 +4,7 @@ class dahsboard_Model extends CI_Model
{
- /* HR DASHBOART Model START*/
+ /* HR DASHBOART Model START*/
function totemp()
{
@@ -55,10 +55,15 @@ $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Detai
}
- function attyesterday($WH,$date)
+ function attyesterday($WH,$date)
{
//echo 'model' . $WH.'-'.$date;
- $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
+ // $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
+
+
+$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att
+join T_Employee_Details as a on a.EmpID= att.EmpID
+where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
$query = $this->db->query($sql,array($date));
// print_r($query->result());
//echo count($query->result());
@@ -89,10 +94,30 @@ function attendance($EmpID,$dates)
function getAllAttendance($EmpID,$CURMONTH)
{
$sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?";
+
+// $sql=" select T_Attendance.*,emp.FirstName from T_Attendance
+// join T_Employee_Details emp on T_Attendance.EmpID = emp.EmpID
+// where T_Attendance.EmpID = ? and month(Month_Year)= ? ";
+
+
$query = $this->db->query($sql,array($EmpID,$CURMONTH));
return $query->result();
}
+
+function getAllAttendances($EmpID,$JoinedMonth)
+{
+ //$sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?";
+
+ $sql=" select T_Attendance.*,emp.FirstName from T_Attendance
+join T_Employee_Details emp on T_Attendance.EmpID = emp.EmpID
+where T_Attendance.EmpID = ? and month(Month_Year)= ? ";
+
+
+ $query = $this->db->query($sql,array($EmpID,$JoinedMonth));
+
+ return $query->result();
+}
function joindate($EmpID)
{
$sql="select DateofJoining from T_Employee_Details where EmpID =? ";
@@ -160,7 +185,13 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
function totalpurchaseorder(){
- $sql="select count(PONO) as totalpurchaseorder from T_PurchaseOrder_Master where Status != 'ST030'";
+ $sql="select count(PONO) as totalpurchaseorder from T_PurchaseOrder_Master pm where Status != 'ST030'
+ and case
+ when (month(pm.PODate) >=4) then
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
+ else
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
+ end";
$query = $this->db->query($sql);
return $query->result();
@@ -168,7 +199,13 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
function totalordervalue(){
- $sql="select sum(totalordervalue) as totalordervalue from T_PurchaseOrder_Master where Status != 'ST030'";
+ $sql="select sum(totalordervalue) as totalordervalue from T_PurchaseOrder_Master pm where Status != 'ST030'
+ and case
+ when (month(pm.PODate) >=4) then
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
+ else
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
+ end";
$query = $this->db->query($sql);
return $query->result();
@@ -176,7 +213,13 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
function pendingpo(){
- $sql="select count(PONO) as pending from T_PurchaseOrder_Master where status='ST020' and Status != 'ST030'";
+ $sql="select count(PONO) as pending from T_PurchaseOrder_Master pm where status='ST020' and Status != 'ST030'
+ and case
+ when (month(pm.PODate) >=4) then
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
+ else
+ (YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
+ end";
$query = $this->db->query($sql);
return $query->result();
@@ -184,7 +227,13 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
function req_pending(){
- $sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM T_Requestion_Master where Status = 'ST002';";
+ $sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM T_Requestion_Master pm where Status = 'ST002'
+ and case
+ when (month(pm.ReqDate) >=4) then
+ (YEAR(pm.ReqDate) = YEAR(CURRENT_DATE) and MONTH(pm.ReqDate) >= 4 ) or ( YEAR(pm.ReqDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.ReqDate) <= 3 )
+ else
+ (YEAR(pm.ReqDate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.ReqDate) >= 4 ) or ( YEAR(pm.ReqDate) = YEAR(CURRENT_DATE) and MONTH(pm.ReqDate) <= 3 )
+ end";
$query = $this->db->query($sql);
return $query->result();
@@ -477,12 +526,23 @@ function servicebudgt ()
}
function servicebal ()
{
- $sql="SELECT ROUND(sum(BudgetAmount)-(SELECT
-ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
-as Util_Amount
+ $sql="SELECT Cost_Center_Budget.CostCenterCode as Cost_Center_Code, CostCenterName as Cost_Center_Name,group_concat(distinct Dept_Details.DepartmentName) as Dept_Name,Cost_Center_Budget.BudgetType as BudgetType,Cost_Center_Budget.BudgetYear as BudgetYear,
+case Cost_Center_Budget.BudgetType
+when 'SERVICE'
+then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
+end as service
from T_CostCenter_Budget Cost_Center_Budget
-join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
-WHERE Cost_Center_Budget.BudgetType='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
+left join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
+left JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.Status !='ST030'
+left JOIN T_Revenue_Tax T_Rev_Tax on PO_Line_Item.LineItemNo=T_Rev_Tax.LineItemNo
+JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mast.CostCenterCode
+JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode
+JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode
+left JOIN T_Service_Tax st on st.LineItemNo = PO_Line_Item.LineItemNo
+WHERE Cost_Center_Budget.BudgetType = po.POType and date(po.PODate) >= '2017-04-01' and date(po.PODate) <= '2018-03-31'
+group by
+Cost_Center_Budget.BudgetType
+";
$query = $this->db->query($sql);
return $query->result();
}
@@ -1249,7 +1309,7 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) ";
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) ";
if ($cname!= ''){
@@ -1328,7 +1388,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where
-pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) ";
+pm.Status != 'ST030' ";
if ($cname!= ''){
@@ -1384,9 +1444,11 @@ if ($cname!= ''){
}
-
+$sql.="and pm.PONO in (select PONO from T_IGR_Master) ";
$sql.="group by pono,material_name,category,supplier_name";
-//ho $sql;
+// echo $m;
+// echo $sid;
+//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
@@ -1400,7 +1462,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master)
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master)
group by month(created_date)";
$query = $this->db->query($sql);
return $query->result();
@@ -1419,7 +1481,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate)= ? and year(pm.PODate) = ?
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate)= ? and year(pm.PODate) = ?
group by supplier_name,material_name";
$query = $this->db->query($sql,array($month,$year));
return $query->result();
@@ -1432,7 +1494,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and date(pm.PODate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31'
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and date(pm.PODate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31'
group by supplier_name,material_name";
$query = $this->db->query($sql,array());
return $query->result();
@@ -1482,7 +1544,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where
-pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) ";
+pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) ";
if ($cname!= ''){
@@ -1551,7 +1613,9 @@ FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) ";
+left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
+left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) ";
if ($cname!= ''){
@@ -1573,6 +1637,51 @@ if ($cname!= ''){
return $query->result();
}
+ function i_consolidate_month($m=null,$cname=null,$prod=null,$fa=null,$aa=null){
+
+ $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name,
+sum(pl.Quantity) as quantity,
+sum(pl.Quantity * pl.Rate) as total
+FROM T_PurchaseOrder_Master pm
+join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
+join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
+join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
+left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
+left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
+monthname(pm.PODate) = '".$m."' and sd.SupplierName = '".$cname."' and mm.MaterialName = '".$prod."' ";
+if ($fa and $aa != ''){
+
+ $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
+
+ }
+ $sql.= "group by supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function i_consolidate_year($cname=null,$prod=null,$fa=null,$aa=null){
+
+ $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name,
+sum(pl.Quantity) as quantity,
+sum(pl.Quantity * pl.Rate) as total
+FROM T_PurchaseOrder_Master pm
+join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
+join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
+join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
+left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
+left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName = '".$cname."' and mm.MaterialName = '".$prod."' ";
+if ($fa and $aa != ''){
+
+ $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
+
+ }
+ $sql.= "group by supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
function ireport_cumulative(){
$sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
@@ -1581,7 +1690,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@@ -1595,7 +1704,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
month(pm.PODate) = month(current_date())
group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
@@ -1605,7 +1714,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
date(pm.PODate) = current_date()
group by supplier_name,material_name
) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name
@@ -1621,7 +1730,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
return $query->result();
@@ -1633,7 +1742,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@@ -1652,7 +1761,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
date(pm.PODate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
@@ -1666,7 +1775,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@@ -1680,7 +1789,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
month(pm.PODate) = month(current_date())
group by category
) as month on month.category=year.category
@@ -1690,7 +1799,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
date(pm.PODate) = current_date()
group by category
) as today on today.category=month.category
@@ -1705,7 +1814,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@@ -1725,7 +1834,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
month(pm.PODate) = month(current_date()) and mm.Category = '".$cat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
@@ -1738,7 +1847,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
date(pm.PODate) = current_date() and mm.Category = '".$cat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
@@ -1779,7 +1888,7 @@ FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) ";
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) ";
if ($cname!= ''){
@@ -1810,7 +1919,7 @@ FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
monthname(pm.PODate) = '".$m."' and mm.Category = '".$cat."' ";
if ($fa and $aa != ''){
@@ -1831,7 +1940,7 @@ FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
+where pm.Status != 'ST030' and pm.PONO in (select PONO from T_IGR_Master) and
mm.Category = '".$cat."' ";
if ($fa and $aa != ''){
@@ -1869,15 +1978,49 @@ if ($fa and $aa != ''){
function monthexpensereport()
{
- $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month,ac.name FROM t_income_expense as tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='PAYMENT' and month(tinc.date)= month(current_date()) group by account_code order by total desc limit 10 ";
- $query = $this->db->query($sql);
- return $query->result();
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then sum(tinc.total)
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then sum(tinc.total)
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ tinc.total,tinc.towhom,tinc.description,monthname(tinc.date)as month,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where month(tinc.date)= month(current_date())group by tinc.account_code";
+ $query = $this->db->query($sql);
+ return $query->result();
}
function yearexpensereport()
{
- $sql="SELECT date_format(date,'%d-%m-%Y')as date,type,sum(total)as total,towhom,description,account_code,monthname(date)as month FROM t_income_expense where type='PAYMENT' and year(date)= year(current_date()) group by month order by total desc limit 10 ";
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.total
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.total
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ date_format(date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month FROM t_income_expense tinc where year(date)= year(current_date()) group by month order by total desc limit 10 ";
$query = $this->db->query($sql);
return $query->result();
@@ -1907,11 +2050,28 @@ if ($fa and $aa != ''){
return $query->result();
}
- function departmentwise($sid='',$d='')
+ function departmentwise($sid='',$d='',$c='')
{
- $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.total
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.total
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM
t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code
- WHERE tinc.type='PAYMENT' and account_code = '$sid' and monthname(date)='$d'";
+ WHERE account_code = '$sid' and monthname(date)='$d' and tinc.type='$c'";
$query = $this->db->query($sql);
//print_r($this->db->last_query());
//echo $sql;
@@ -1920,9 +2080,26 @@ if ($fa and $aa != ''){
}
function yearmonthwise($sid='')
{
- $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,monthname(tinc.date)as month,tinc.description,tinc.towhom,tinc.account_code,ac.name FROM t_income_expense tinc
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then sum(tinc.total)
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then sum(tinc.total)
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.account_code,sum(tinc.total)as total,monthname(tinc.date)as month,tinc.description,tinc.towhom,tinc.account_code,ac.name FROM t_income_expense tinc
join t_accountcode ac on ac.code=tinc.account_code
- WHERE tinc.type='PAYMENT' and monthname(date) = ? group by account_code";
+ WHERE monthname(date) = ? group by tinc.account_code";
$query = $this->db->query($sql,array($sid));
//print_r($this->db->last_query());
return $query->result();
@@ -1956,12 +2133,33 @@ function INRSymbol()
}
function today()
{
- $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,tac.name FROM t_income_expense tinc
- LEFT JOIN t_accountcode tac ON tac.code = tinc.account_code
- WHERE DATE(date) = CURRENT_DATE";
- $query = $this->db->query($sql);
- return $query->result();
- }
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.total
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.total
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ tinc.total,tinc.towhom,tinc.description,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code WHERE DATE(date) = CURRENT_DATE";
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ // $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,tac.name FROM t_income_expense tinc
+ // LEFT JOIN t_accountcode tac ON tac.code = tinc.account_code
+ // WHERE DATE(date) = CURRENT_DATE";
+ // $query = $this->db->query($sql);
+ // return $query->result();
+ //}
//for menu link in monthly payments//
function monthlypayments()
{
@@ -1971,12 +2169,30 @@ function INRSymbol()
return $query->result();
}
- function departmentmenu()
+ function departmentmenu($fdate,$tdate)
{
- $sql="SELECT tinc.type,sum(tinc.total)as total,tinc.account_code,ac.name FROM t_income_expense tinc
- join t_accountcode ac on ac.code=tinc.account_code
- group by account_code";
+ $fdate= date("Y-m-d",strtotime($fdate));
+ $tdate=date("Y-m-d",strtotime($tdate));
+ $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.total
+ end,'0') as expense,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.total
+ end, '0') as income,
+ ifnull(case
+ when tinc.type = 'PAYMENT'
+ then tinc.towhom
+ end,'-') as paymentname,
+ ifnull(case
+ when tinc.type = 'RECEIPT'
+ then tinc.towhom
+ end, '-') as receiptname,
+ tinc.total,tinc.towhom,tinc.description,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.date >= '".$fdate."' and tinc.date <= '".$tdate."'";
$query = $this->db->query($sql);
+ //echo $fdate;
//print_r($this->db->last_query());
return $query->result();
diff --git a/application/models/department_model.php b/application/models/department_model.php
index 0f778cab..38478b71 100644
--- a/application/models/department_model.php
+++ b/application/models/department_model.php
@@ -5,7 +5,7 @@ class department_model extends CI_Model
/**
* This function is used to get the user listing count
- * @return array $result : This is result of the query
+ * @return array $result : result of the query(returns Department details)
*/
function departmentListing()
{
@@ -21,7 +21,7 @@ class department_model extends CI_Model
/**
* To get Department information by id
* @param array $department : This will have all the department datas
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns as count in numbers)
*/
function addNewdepartment($department)
{
@@ -54,7 +54,7 @@ class department_model extends CI_Model
/**
* To get department details
* @param number $DEPCode : Optional : this is department code
- * @return array $result : result of the query
+ * @return array $result : result of the query
*/
function getDeptInfo($DEPCode='')
{
@@ -66,8 +66,8 @@ class department_model extends CI_Model
}
/**
- * To store edited department details
- * @param array $department : This wil have all edited department datas
+ * To store edited department details repective depcode
+ * @param array $department : This will have all edited department datas
* @param number $DEPCode : This is department code
**/
function Updatedepartment($department, $DEPCode)
diff --git a/application/models/employeedetails_model.php b/application/models/employeedetails_model.php
index 07ddd30c..5438fb8d 100644
--- a/application/models/employeedetails_model.php
+++ b/application/models/employeedetails_model.php
@@ -7,7 +7,7 @@ class employeedetails_model extends CI_Model
/**
* To get the employee listing
- * @return array $result : result of the query
+ * @return array $result : result of the query(returns as employee details)
*/
function employeeListing()
{
@@ -24,7 +24,7 @@ class employeedetails_model extends CI_Model
/**
* To get the role data for employee
- * @return array $query->result() : result of the query
+ * @return array $query->result() : result of the query (returns as roles information)
*/
function getUserRoles()
{
@@ -38,14 +38,14 @@ class employeedetails_model extends CI_Model
/**
* To get the Config value from configuration table
- * @return array $query->result() : This is result of the query
+ * @return array $query->result() : result of the query (returns as config information)
*/
function getConfigValue($ConfigID )
{
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
- $this->db->where('Config_id ',$ConfigID );
+ $this->db->where('Config_id ',$ConfigID );
$query = $this->db->get();
return $query->result();
@@ -68,7 +68,7 @@ class employeedetails_model extends CI_Model
/**
* To store employee details
* @param array $Employee : This will have all the employee datas
- * @return number $EmpID : This will return how many value are inserted (return as number/count)
+ * @return number $EmpID : This will return how many value are inserted (return as count in number)
*/
function addNewemployee($Employee)
{
@@ -96,7 +96,7 @@ class employeedetails_model extends CI_Model
/**
* To get employee details
* @param number $EmpID : This is employee id
- * @return array $result : result of the query
+ * @return array $result : result of the query(returns employee information with department name)
*/
function viewemployee( $EmpID)
{
@@ -114,7 +114,7 @@ class employeedetails_model extends CI_Model
/**
* To get the Employee department on respective Employee
* @param number $EmployeeID : this is employee Id
- * @return array $query->result_array() : result of the query
+ * @return array $query->result_array() : result of the query (return department name)
**/
function GetEmployeeDepartment($EmployeeID)
{
@@ -127,9 +127,9 @@ class employeedetails_model extends CI_Model
/**
* To check respective Employee emailid already exists or not
- * @param number $empid : this is employee Id
- * @param number $email : this is employee's emailid
- * @return array $query->result_array() : result of the query
+ * @param number $empid : Optional :this is employee Id
+ * @param number $email : Optional :this is employee's emailid
+ * @return array $query->result_array() : result of the query (returns employee email id)
**/
function checkMailExists($email='',$Empid='')
{
@@ -148,10 +148,10 @@ class employeedetails_model extends CI_Model
}
/**
- * To check respective Employee aadhar no already exists or not
- * @param number $Empid : this is employee Id
+ * To get respective Employee aadhar no
+ * @param number $Empid : Optional : this is employee Id
* @param number $AadharNo : this is employee's aadhar no
- * @return array $query->result_array() : result of the query
+ * @return array $query->result_array() : result of the query (returns employee aadhar no)
**/
function checkAadharExists($AadharNo,$Empid='')
{
@@ -170,10 +170,10 @@ class employeedetails_model extends CI_Model
}
/**
- * To check respective Employee's panno already exists or not
- * @param number $Empid : this is employee Id
- * @param number $AadharNo : this is employee's pan no
- * @return array $query->result_array() : result of the query
+ * To get respective Employee's panno
+ * @param number $Empid : Optional : this is employee Id
+ * @param number $PANNo : this is employee's pan no
+ * @return array $query->result_array() : result of the query (returns employee pan no)
**/
function checkPANExists($PANNo,$Empid='')
{
@@ -192,9 +192,9 @@ class employeedetails_model extends CI_Model
}
/**
- * To check respective Employee's profile pic already exists or not
+ * To get respective Employee's profile pic name
* @param number $pic : this is employee profile pic (pic name)
- * @return array $query->result_array() : result of the query
+ * @return array $query->result_array() : result of the query (returns profilepic name)
**/
function checkPhotoExists($Pic)
{
@@ -211,7 +211,7 @@ class employeedetails_model extends CI_Model
/**
* To get employee's count
- * @return array $query->result_array() : result of the query
+ * @return array $query->result_array() : result of the query (returns employees count)
**/
function getEmployeeCount( )
{
@@ -225,7 +225,7 @@ class employeedetails_model extends CI_Model
/**
* To get bank details
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns bank details)
**/
function getBankDetails()
{
diff --git a/application/models/emppaydate_model.php b/application/models/emppaydate_model.php
index 723d4f88..63720bb8 100644
--- a/application/models/emppaydate_model.php
+++ b/application/models/emppaydate_model.php
@@ -5,7 +5,7 @@ class emppaydate_model extends CI_Model
/**
* To get the employee pay listing
- * @return array $result : This is result of the query
+ * @return array $result : result of the query (returns employee payment details)
*/
function emppayListing()
{
@@ -19,7 +19,7 @@ class emppaydate_model extends CI_Model
/**
* To delete the employee pay datas
- * @return array $query : This is result of the query
+ * @return array $query : result of the query
*/
function deleteEmployeePay($EmpID)
{
@@ -32,8 +32,8 @@ class emppaydate_model extends CI_Model
/**
* To store the employee payments datas
- * @param $emppay
- * @return array $paydataid :
+ * @param $emppay : This will have all the employee pay details
+ * @return array $paydataid : result of the query (returns as count in number)
*/
function addNewemppay($emppay)
{
@@ -49,9 +49,9 @@ class emppaydate_model extends CI_Model
/**
* To store the employees loan information
- * @param string $string :
- * @param array $dataarray :
- * @return array $loanid :
+ * @param string $string : This have 'add' or 'edit'
+ * @param array $dataarray : This will have all employee's loan information
+ * @return array $loanid : result of the query (returns as counts in number)
*/
function addLoanInfo($dataarray,$string)
{
@@ -72,8 +72,8 @@ class emppaydate_model extends CI_Model
/**
* To get the employees payment information
- * @param string $paydataid:
- * @return array $loanid :
+ * @param string $paydataid : This is pay data id
+ * @return array $query->result() : result of the query (returns employee payment details with loan information)
*/
function getUserInfo($paydataid)
{
@@ -88,7 +88,7 @@ class emppaydate_model extends CI_Model
/**
* To store edited emppay information
- * @param array $emppaydatas :
+ * @param array $emppaydatas : This will have all edited employee payment details
*/
function editemppay($emppaydatas)
{
@@ -102,7 +102,7 @@ class emppaydate_model extends CI_Model
/**
* To view emppay information
- * @param number $emppaydata : This will have all edited emppay details
+ * @param number $emppaydata : This will have all edited employee payment details
* @param array $paydateid : This is paydate id
*/
function viewemppay($emppaydata, $paydateid)
@@ -115,4 +115,4 @@ class emppaydate_model extends CI_Model
}
-?>
+?>
\ No newline at end of file
diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php
index 20e08ff6..da39b79f 100644
--- a/application/models/inwardgateregister_model.php
+++ b/application/models/inwardgateregister_model.php
@@ -5,7 +5,7 @@ class inwardgateregister_model extends CI_Model
/**
* To get the IGR details for listing
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns igr informations)
*/
function igrListing()
{
@@ -23,7 +23,7 @@ class inwardgateregister_model extends CI_Model
/**
* To get the po details
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns po information)
*/
function getpurchaseorder()
{
@@ -46,8 +46,8 @@ class inwardgateregister_model extends CI_Model
/**
* To get the po details for revalant Po
- * @param number $PO : this is po number
- * @return array $query->result() : result of the query
+ * @param number $PO : This is po number
+ * @return array $query->result() : result of the query (returns po details)
*/
function viewpurchaseorder($PO)
{
@@ -68,9 +68,9 @@ class inwardgateregister_model extends CI_Model
/**
* To store the igr master details
- * @param array $igrM : This will have all igr master details
- * @var number $insert_id :
- * @return array $query->result() : result of the query
+ * @param array $igrM : This will have all igr master details
+ * @var number $insert_id : This will have insertion count
+ * @return array $query->result() : result of the query (returns igr no based on count value)
*/
function addigrM($igrM)
{
@@ -92,9 +92,9 @@ class inwardgateregister_model extends CI_Model
/**
* To store the igr child details
- * @param array $igrD : This will have all igr child details
- * @var number $insert_id :
- * @return array $query->result() : result of the query
+ * @param array $igrD : This will have all igr child details
+ * @var number $insert_id : This will have insertion count
+ * @return array $query->result() : result of the query (returns igr lineitem no based on count value)
*/
function addigrD($igrD)
{
@@ -115,14 +115,13 @@ class inwardgateregister_model extends CI_Model
/**
* To get igr details for revalant IGRNO
- * @param number $IGRNO : This is IGRNO
- * @return array $result : result of the query
+ * @param number $IGRNO : This is IGRNO
+ * @return array $result : result of the query (returns igr details)
*/
function viewigr($IGRNO)
{
$this->db->distinct();
$this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
- $this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
$this->db->from('T_IGR_Master igr');
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO');
$this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO');
@@ -140,9 +139,9 @@ class inwardgateregister_model extends CI_Model
/**
* To store edited po lineitem details
- * @param number $PONO : This is PONO
+ * @param number $PONO : This is PONO
* @param number $MaterialCode : This material code
- * @param array $Lineitem : This will have all edited po lineitem details
+ * @param array $Lineitem : This will have all edited po lineitem details
*/
function UpdatePOLineItem($LineItem,$PONO,$MaterialCode)
{
@@ -155,14 +154,15 @@ class inwardgateregister_model extends CI_Model
/**
* To store edited po master details
- * @param number $PONO : This is PONO
- * @var array $POStatus : for updation operation : this will have igrcreated's const value and updater' id
+ * @param number $PONO : This is PONO
+ * @var $query : this will have igr created po no
+ * @var array $POStatus : for updation operation : this will have igrcreated's const value and updater' id
* @param number $updatedBy : This is updater's id
- * @param array $Lineitem : This will have all edited po lineitem details
+ * @param array $Lineitem : This will have all edited po lineitem details
*/
function UpdatePOMaster($PONO,$updatedBy)
{
- $this->db->select('*');
+ $this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',IGR_CREATED);
@@ -180,9 +180,9 @@ class inwardgateregister_model extends CI_Model
/**
* To get po lineitem details for recieved qty
- * @param number $PONO : This is PONO
+ * @param number $PONO : This is PONO
* @param number $MaterialCode : This is material code
- * @return array $result : result of the query
+ * @return array $result : result of the query (returns po received quantity )
*/
function getPOLineItemReceivedQty($PONO,$MaterialCode)
{
diff --git a/application/models/login_model.php b/application/models/login_model.php
index 0f547995..dcb0ea1c 100644
--- a/application/models/login_model.php
+++ b/application/models/login_model.php
@@ -5,7 +5,7 @@ class Login_model extends CI_Model
/**
* To check the login credentials of the user
- * @param string $email : This is email of the user
+ * @param string $email : This is email of the user
* @param string $password : This is encrypted password of the user
*/
function loginMe($email, $password)
diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php
index f2bbfcc6..3b87370d 100755
--- a/application/models/monthlypay_model.php
+++ b/application/models/monthlypay_model.php
@@ -5,8 +5,8 @@ class monthlypay_model extends CI_Model
/**
* To get monthwise payment list
- * @param date $current : This is current month and year
- * @return array $result : This is result of the query
+ * @param date $current : This is current month and year
+ * @return array $result : result of the query (returns monthly payment details)
*/
function monthlyListing($current="")
{
@@ -27,9 +27,9 @@ class monthlypay_model extends CI_Model
/**
* To get employee payment details
- * @param date $current : Optional
- * @param array $s : Optional
- * @return array $result : This is result of the query
+ * @param date $current - Optional
+ * @param array $s - Optional
+ * @return array $result : result of the query (return as active employee details)
*/
function getEmpPayDetails($current="",$s="")
{
@@ -46,8 +46,8 @@ class monthlypay_model extends CI_Model
/**
* To get employee payment month wise details
- * @param date $current : Optional : This is current month and year value
- * @return array $result : This is result of the query
+ * @param date $current - Optional : This is current month and year value
+ * @return array $result : result of the query (return employee payment details)
*/
function getEmpPayDetailsforMonthInputs($current="")
{
@@ -69,8 +69,8 @@ class monthlypay_model extends CI_Model
/**
* To get public holiday details for attendances
- * @param date $current : Optional : This is current month and year value
- * @return array $query->result() : result of the query
+ * @param date $current - Optional : This is current month and year value
+ * @return array $query->result() : result of the query (returns public holiday information)
*/
function getPublicHoldays($current="")
{
@@ -94,8 +94,8 @@ class monthlypay_model extends CI_Model
/**
* To declare date is holiday
- * @param date $Date : This is date
- * @return array $query->result() : result of the query
+ * @param date $Date : This is date
+ * @return array $query->result() : result of the query (returns public holiday rowcount)
*/
function checkHoliday($Date)
{
@@ -108,9 +108,9 @@ class monthlypay_model extends CI_Model
/**
* To store holiday date
- * @param array $data : This is date
+ * @param array $data : This is date
* @param string $String : it has 'i' and 'u' ('i' handles insertion and 'u' handles updation)
- * @return array $i : result of the query
+ * @return array $i : result of the query (returns as count in number)
*/
function saveHolidays($data,$string)
{
@@ -132,8 +132,8 @@ class monthlypay_model extends CI_Model
/**
* To delete holiday date
- * @param date $d : This is date
- * @return $this->db->affected_rows() : result of the query
+ * @param date $d : This is date
+ * @return $this->db->affected_rows() : result of the query (return as count in number)
*/
function deleteHoliday($d)
{
@@ -145,8 +145,8 @@ class monthlypay_model extends CI_Model
/**
* To get details for attendances
- * @param date $current : Optional : This is date
- * @return $result : result of the query
+ * @param date $current - Optional : This is date
+ * @return $result : result of the query(return as monthwise attendances datas)
*/
function monthlyAttendance($current="")
{
@@ -166,8 +166,8 @@ class monthlypay_model extends CI_Model
/**
* To store attendances Information (its handles insertion and updation operation)
* @param array $data : this will have all attendances inforamtion
- * @var number $res : gets count
- * @return array $i : result of the query
+ * @var number $res : gets count
+ * @return array $i : result of the query (returns as count in numbers)
*/
function saveMonthlyData_model($data)
{
@@ -208,11 +208,12 @@ class monthlypay_model extends CI_Model
}
/**
- * To store cashbook Information (its insertion and updation operation)
- * @param array $monthattendance : this will have all cashbook details
- * @param number $Month_Year :
- * @param number $EmpID :
- * @return array $this->db->affected_rows() : result of the query
+ * To store attendances data (its handle both insertion and updation operation)
+ * @param array $monthattendance : this will have attendances information
+ * @param number $Month_Year : this have month and date value
+ * @param number $EmpID : this is empid
+ * @var $isExist : exists value count
+ * @return array $this->db->affected_rows() : result of the query (returns as count in numbers)
*/
function saveAttendance($monthattendance,$Month_Year,$EmpID)
{
@@ -241,8 +242,11 @@ class monthlypay_model extends CI_Model
}
}
-
-function addNewmonthlisting($m_list)
+ /**
+ * To store employees monthly payment datas
+ * @param array $m_list : this will have all employee monthlypayment details
+ */
+ function addNewmonthlisting($m_list)
{
$this->db->trans_start();
$this->db->insert('T_Monthly_Pay_Inputs', $asset);
@@ -252,13 +256,19 @@ function addNewmonthlisting($m_list)
$this->db->trans_complete();
return $m_list;
- }
- function getUserInfo($EmpID,$month_year)
+ }
+
+ /**
+ * To get employee monthly payment details
+ * @param number $month_year : this have month and date value
+ * @param number $EmpID : this is empid
+ * @return array $query->result() : result of the query (returns as count in numbers)
+ */
+ function getUserInfo($EmpID,$month_year)
{
$this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->from('T_Monthly_Pay_Inputs');
$this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID');
-
$this->db->where('T_Monthly_Pay_Inputs.EmpID', $EmpID);
$this->db->where('T_Monthly_Pay_Inputs.Month_Year', $month_year);
$query = $this->db->get();
@@ -266,22 +276,26 @@ function addNewmonthlisting($m_list)
return $query->result();
}
-
+ /**
+ * To store edited employee monthly payment details
+ * @param number $monthdata : this will have all the edited employee monthly payment details
+ * @param number $EmpID : this is employee Id
+ */
function editmonth($monthdata, $EmpID)
{
$monthyear=$monthdata['Month_Year'];
-
-
-
$this->db->where('EmpID' ,$EmpID);
-
$this->db->where('Month_Year',$monthyear);
$this->db->update('T_Monthly_Pay_Inputs',$monthdata);
return TRUE;
}
-
+ /**
+ * To store edited monthyear data
+ * @param number $monthdata : this will have edited monthyear data
+ * @param number $EmpID : this is employee Id
+ */
function viewmonth($monthdata, $employeeid)
{
$this->db->order_by('Month_Year');
@@ -292,54 +306,69 @@ function addNewmonthlisting($m_list)
}
- /*permission form model */
- function emplist()
- {
+ /* permissionslip models */
+
+ /**
+ * To get employee list of permission slip
+ * @return array $query->result() : result of the query (returns employee details with department name)
+ */
+ function emplist()
+ {
- $sql="select Emp.EmpID,CONCAT(FirstName,' ',LastName)as name ,Emp.Departmentcode, Dep.DepartmentName FROM T_Employee_Details as Emp
-join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsActive = 1;";
- $query =$this->db->query($sql);
- return $query->result();
+ $sql="select Emp.EmpID,CONCAT(FirstName,' ',LastName)as name ,Emp.Departmentcode, Dep.DepartmentName FROM T_Employee_Details as Emp
+ join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsActive = 1;";
+ $query =$this->db->query($sql);
+ return $query->result();
+ }
+ /**
+ * To store permissionslip datas
+ * @param array $Permissiondata : this will have all permissionslip data
+ * @return numbers $Permission : result of the query (returns as count in numbers)
+ */
+ function addper($Permissiondata)
+ {
+
+ $this->db->trans_start();
+ $this->db->insert('T_Permission', $Permissiondata);
+ $Permission = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return $Permission;
+ }
- }
+ /**
+ * To get the permission data for list
+ * @return array $query->result() : result of the query (returns permission slip details)
+ */
+ function perlist()
+ {
- function addper($Permissiondata)
- {
-
- $this->db->trans_start();
- $this->db->insert('T_Permission', $Permissiondata);
+ $this->db->select('*');
+ $this->db->from('T_Permission');
+ $query =$this->db->get();
+ return $query->result();
+
+ }
+
+ /**
+ * To get permitted employee list
+ * @param number $SNO : this is sno
+ * @return array $query->result() : result of the query (returns permitted employee details)
+ */
+
+ function pdf($SNO)
+ {
+ $this->db->select('per.*,emp.FirstName,LastName,dep.DepartmentName');
+ $this->db->from('T_Permission per');
+ $this->db->join('T_Employee_Details emp','emp.EmpID = per.EmpID');
+ $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode');
+ $this->db->where('per.SNO',$SNO );
+ $query =$this->db->get();
+ return $query->result();
+ }
- $Permission = $this->db->affected_rows();
-
- $this->db->trans_complete();
-
- return $Permission;
-
- }
-
- function perlist()
- {
-
- $this->db->select('*');
- $this->db->from('T_Permission');
- $query =$this->db->get();
- return $query->result();
-
- }
-
- function pdf($SNO)
- {
- $this->db->select('per.*,emp.FirstName,LastName,dep.DepartmentName');
- $this->db->from('T_Permission per');
- $this->db->join('T_Employee_Details emp','emp.EmpID = per.EmpID');
- $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode');
- $this->db->where('per.SNO',$SNO );
- $query =$this->db->get();
- return $query->result();
- }
-
+ /* Ends permissionslip models */
diff --git a/application/models/mrir_model.php b/application/models/mrir_model.php
index a6608a3b..9b06d934 100644
--- a/application/models/mrir_model.php
+++ b/application/models/mrir_model.php
@@ -2,9 +2,11 @@
class mrir_model extends CI_Model
{
- /* This function is used to get the user listing count*/
-
- /* This function is used to display the IGR in dropdown box*/
+
+ /**
+ * To display the IGR in dropdown box
+ * @return array $res->result() : result of the query (returns Igrno)
+ **/
function getIGRNOonly()
{
$this->db->select('IGRNO');
@@ -14,12 +16,10 @@ class mrir_model extends CI_Model
return $res->result();
}
- /**
- * This function is used to get the user listing count
- * @param string $searchText : This is optional search text
- * @param number $page : This is pagination offset
- * @param number $segment : This is pagination limit
- * @return array $result : This is result
+
+ /**
+ * To get mrircreated the igr list
+ * @return array $result : result of the query (returns mrircreated igr details)
*/
function ViewigrListing()
{
@@ -36,12 +36,16 @@ class mrir_model extends CI_Model
return $result;
}
- /* This function is used to get the igr value (button link)*/
+
+ /**
+ * To get the igr value repective igrno (for button link)
+ * @param number $Igrno : this is igrno
+ * @return array $result : result of the query (returns igr details )
+ */
function get_IGR($IgrNo)
- {
+ {
$this->db->distinct();
$this->db->select('IGRM.DeliveryChellanDate,IGRM.CreatedDate,IGRM.IGRNO,IGRM.VehicleNo,IGRM.DeliveryChellanOrInvoiceNo,IGRM.CourierNo,IGRM.PONO,IGRD.MaterialCode,IGRD.QuantityAsPerInvoice,POMR.ServiceDescription,POMR.PODate,POMR.DeliveryDate,POMR.CreatedBy,SUPP.SupplierName,SUPP.Address,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity,ED.FirstName');
- //$this->db->select("DATE_FORMAT(IGRM.DeliveryChellanDate, '%d %m %Y') as DCdate");
$this->db->from('T_IGR_Master IGRM');
$this->db->join('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO');
$this->db->join('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
@@ -53,57 +57,66 @@ class mrir_model extends CI_Model
$this->db->where('IGRM.IGRNO',$IgrNo);
$query = $this->db->get();
- $result = $query->result();
- //print_r($this->db->last_query());
+ $result = $query->result();
return $result;
}
-function ViewDistributionList()
- {
+
+ /**
+ * To get the mrir aprroved details
+ * @return array $query->result() : result of the query (returns mrir approved details )
+ */
+ function ViewDistributionList()
+ {
$subQuery = 'Select distinct ReqLine.MaterialCode, MR.PONO, REQ.ReqNo,MM.MaterialName,MM.UOM,
-EMP.FirstName,DD.DEPCode,DD.DepartmentName,ReqLine.Quantity as RequestedQty,POL.Quantity
-as OrderedQuantity ,(MD.ActualQuantityReceived) as ActualReceivedqty,(MD.QuantityAccepted) as
-AcceptedQty,REQ.ReqDate, ReqLine.Status as ReqStatus,
- st.StatusCode as ReqStatus,st.StatusName,
-ReqLine.Remarks
-from T_Requestion_Details ReqLine join T_PurchaseOrder_LineItem POL
-on ReqLine.ReqNo = POL.ReqNo and ReqLine.MaterialCode = POL.MaterialCode
- join T_Requestion_Master REQ on REQ.ReqNo = ReqLine.ReqNo
- join T_PurchaseOrder_Master POMast on POMast.PONO=POL.PONO
-join T_Status st on ReqLine.Status = st.StatusCode
-join T_MRIR_Master MR on MR.PONO = POL.PONO join T_MRIR_Details MD
-on MD.MRIRNO = MR.MRIRNO and ReqLine.MaterialCode = MD.MaterialCode join T_MaterialMaster MM on
-MM.MaterialCode = ReqLine.MaterialCode join
-T_Employee_Details EMP on EMP.EmpID = REQ.Requestedby join
-T_DepartmentDetails DD on DD.DEPCode = EMP.Departmentcode where
-POL.status in (?,?)
- and ReqLine.Status not in(?) and POMast.status not in(?)
- group by ReqLine.MaterialCode ,POL.PONO';
+ EMP.FirstName,DD.DEPCode,DD.DepartmentName,ReqLine.Quantity as RequestedQty,POL.Quantity
+ as OrderedQuantity ,(MD.ActualQuantityReceived) as ActualReceivedqty,(MD.QuantityAccepted) as
+ AcceptedQty,REQ.ReqDate, ReqLine.Status as ReqStatus,st.StatusCode as ReqStatus,st.StatusName,
+ ReqLine.Remarks
+ from T_Requestion_Details ReqLine
+ join T_PurchaseOrder_LineItem POL on ReqLine.ReqNo = POL.ReqNo and ReqLine.MaterialCode = POL.MaterialCode
+ join T_Requestion_Master REQ on REQ.ReqNo = ReqLine.ReqNo
+ join T_PurchaseOrder_Master POMast on POMast.PONO=POL.PONO
+ join T_Status st on ReqLine.Status = st.StatusCode
+ join T_MRIR_Master MR on MR.PONO = POL.PONO join T_MRIR_Details MD on MD.MRIRNO = MR.MRIRNO and ReqLine.MaterialCode = MD.MaterialCode
+ join T_MaterialMaster MM on MM.MaterialCode = ReqLine.MaterialCode
+ join T_Employee_Details EMP on EMP.EmpID = REQ.Requestedby
+ join T_DepartmentDetails DD on DD.DEPCode = EMP.Departmentcode
+ where POL.status in (?,?) and ReqLine.Status not in(?) and POMast.status not in(?)
+ group by ReqLine.MaterialCode ,POL.PONO';
+
$query = $this->db->query($subQuery,array(MRIR_APPROVED,PARTIAL_MRIRAPPROVED,REQITEM_NEW,PO_AMENDED));
- //print_r($this->db->last_query());
return $query->result();
- }
- /* This function is used to list the MRIR value*/
- function view_mrir()
- {
- $this->db->distinct();
- $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,TMM.MRIRStatus,ST.StatusName,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.StoreInchargeID,TMD.QualityInchargeID,TMD.PlantInchargeID,TMD.UpdateBY,POM.PODate,POM.POType,POM.CreatedBy,ED.FirstName as UpdatedbyName,ED1.FirstName as CreatedByName');
- $this->db->from ('T_MRIR_Master TMM');
- $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO');
- $this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
- $this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
- $this->db->join ('T_PurchaseOrder_Master POM','TMM.PONO=POM.PONO');
- $this->db->join ('tbl_users user','user.userid=TMD.UpdateBY','left');
- $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
- $this->db->join ('tbl_users user1','user1.userid = POM.CreatedBy','left');
- $this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left');
- $this->db->join ('T_Status ST','ST.StatusCode = TMM.MRIRStatus');
- //$this->db->where('POM.status !=',PO_AMENDED);
- $this->db->order_by ('TMM.MRIRNO','desc');
- $query = $this->db->get();
- return $query->result();
-
- }
+ }
+
+ /**
+ * To list the MRIR value
+ * @return $query->result() : result of the query(returns as mrir details)
+ */
+ function view_mrir()
+ {
+ $this->db->distinct();
+ $this->db->select('TMM.MRIRNO,TMM.PONO,TMM.IGRNO,TMM.MRIRStatus,ST.StatusName,IGRM.DeliveryChellanOrInvoiceNo,IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.StoreInchargeID,TMD.QualityInchargeID,TMD.PlantInchargeID,TMD.UpdateBY,POM.PODate,POM.POType,POM.CreatedBy,ED.FirstName as UpdatedbyName,ED1.FirstName as CreatedByName');
+ $this->db->from ('T_MRIR_Master TMM');
+ $this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO');
+ $this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
+ $this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
+ $this->db->join ('T_PurchaseOrder_Master POM','TMM.PONO=POM.PONO');
+ $this->db->join ('tbl_users user','user.userid=TMD.UpdateBY','left');
+ $this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
+ $this->db->join ('tbl_users user1','user1.userid = POM.CreatedBy','left');
+ $this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left');
+ $this->db->join ('T_Status ST','ST.StatusCode = TMM.MRIRStatus');
+ $this->db->order_by ('TMM.MRIRNO','desc');
+
+ $query = $this->db->get();
+ return $query->result();
+ }
+
+ /**
+ * To get the status name and code
+ * @return array $query->result() : result of the query(returns as status code and status name)
+ */
function getStatus()
{
$this->db->select('StatusCode,StatusName');
@@ -112,40 +125,46 @@ POL.status in (?,?)
$query = $this->db->get();
return $query->result();
}
- /* This function is used to list the MRIR value*/
+ /**
+ * To list the MRIR approved datas for billing
+ * @return array $query->result() : result of the query (returns approved mrir details )
+ **/
function view_mrir_Billing()
{
$this->db->distinct();
$this->db->select('TMM.MRIRNO,TMM.PONO, TMM.IGRNO,IGRM.DeliveryChellanOrInvoiceNo,
-IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.QualityInchargeID,
-TMD.PlantInchargeID,TMD.UpdateBY, POM.PODate,POM.POType,POM.ReleasedBy,ED2.FirstName as StoreinchargeName,
-ED.FirstName as UpdatedbyName,ED1.FirstName as ReleasedbyName,MM.MaterialCode,MM.MaterialName,
-MM.UOM, POL.Quantity,IGRD.QuantityAsPerInvoice, TMD.ActualQuantityReceived,TMD.QuantityAccepted,
-TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
+ IGRM.DeliveryChellanDate,IGRM.VehicleNo,IGRM.CourierNo,TMD.QualityInchargeID,
+ TMD.PlantInchargeID,TMD.UpdateBY, POM.PODate,POM.POType,POM.ReleasedBy,ED2.FirstName as StoreinchargeName,
+ ED.FirstName as UpdatedbyName,ED1.FirstName as ReleasedbyName,MM.MaterialCode,MM.MaterialName,
+ MM.UOM, POL.Quantity,IGRD.QuantityAsPerInvoice, TMD.ActualQuantityReceived,TMD.QuantityAccepted,
+ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->from ('T_MRIR_Master TMM');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO');
$this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
$this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO and IGRD.MaterialCode = TMD.MaterialCode');
$this->db->join ('T_PurchaseOrder_Master POM','POM.PONO=IGRM.PONO');
- $this->db->join ('T_PurchaseOrder_LineItem POL','POL.PONO=POM.PONO and TMD.MaterialCode = POL.MaterialCode');
- $this->db->join('T_PurchaseOrder_AdvanceRequest PUADV','POM.PONO=PUADV.PONO','left');
+ $this->db->join ('T_PurchaseOrder_LineItem POL','POL.PONO=POM.PONO and TMD.MaterialCode = POL.MaterialCode');
+ $this->db->join('T_PurchaseOrder_AdvanceRequest PUADV','POM.PONO=PUADV.PONO','left');
$this->db->join ('tbl_users user','user.userid=TMD.UpdateBY');
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID');
$this->db->join ('tbl_users user1','user1.userid = POM.ReleasedBy');
$this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID');
$this->db->join ('tbl_users user2','user2.userid=TMD.StoreInchargeID');
- $this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID');
- $this->db->join ('T_MaterialMaster MM','MM.MaterialCode = IGRD.MaterialCode and POL.MaterialCode = MM.MaterialCode');
- $this->db->join ('T_Status ST','ST.StatusCode = TMD.MRIRStatus');
- $this->db->where('TMM.MRIRStatus',MRIR_APPROVED);
+ $this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID');
+ $this->db->join ('T_MaterialMaster MM','MM.MaterialCode = IGRD.MaterialCode and POL.MaterialCode = MM.MaterialCode');
+ $this->db->join ('T_Status ST','ST.StatusCode = TMD.MRIRStatus');
+ $this->db->where('TMM.MRIRStatus',MRIR_APPROVED);
$this->db->order_by('TMM.UpdatedOn','desc');
$query = $this->db->get();
- //print_r($this->db->last_query());
+
return $query->result();
}
- /* This function is used to get the MRIR value for edit*/
+ /**
+ * To get the MRIR details respective Mrirno for edit
+ * @return array $result : result of the query(returnss mrir details )
+ **/
function edit_mrir($MrirNo)
{
$this->db->distinct();
@@ -154,10 +173,8 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO');//to get IGRNO,PONO,MRIRNO,mrirdate,
$this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO = TMM.IGRNO');//to get actualquantity,deliverydate,Invoicedate,vechileno,courierno,igrdate,
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO = POMR.PONO');//to get podate,deliverydate,servicedescription
- // $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO');//to get receivedquantity,quantity
$this->db->join('T_PurchaseOrder_LineItem Line','TMM.PONO=Line.PONO and TMD.MaterialCode=Line.MaterialCode');
$this->db->join('T_CostCenter_Master COST','Line.CostCenterCode=COST.CostCenterCode');
- //$this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO = IGRM.IGRNO');//to get invoicequantity
$this->db->join('T_IGR_Details IGRD','IGRD.IGRNO = TMM.IGRNO and TMD.MaterialCode=IGRD.MaterialCode');
$this->db->join ('T_MaterialMaster MM','TMD.MaterialCode = MM.MaterialCode');
$this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID = SUPP.SupplierID');//to get suppliername,supplieraddress
@@ -168,10 +185,10 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->join ('tbl_users user2','user2.userid=IGRM.CreatedBy');//to get igrraisedby
$this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID');
$this->db->where('TMM.MRIRNO',$MrirNo);
- $this->db->group_by('TMM.MRIRNO,TMD.MaterialCode');
+ $this->db->group_by('TMM.MRIRNO,TMD.MaterialCode');
$query = $this->db->get();
$result = $query->result();
- //print_r( $this->db->last_query());
+
return $result;
}
diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php
index 30a3b42c..1cdb22e3 100755
--- a/application/models/purchaseorder_model.php
+++ b/application/models/purchaseorder_model.php
@@ -787,11 +787,11 @@ function GetPOType($ReqNo)
function GetRevenuePurchaseOrderDetailsForPDF($PONO = '')
{
- $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,ReqNo,Mat.MaterialCode,Mat.MaterialName,POMaster.PaymentOtherDescription,
+ $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,ReqNo,Mat.MaterialCode,Mat.MaterialName,POMaster.PaymentOtherDescription,LineItem.ServiceMaterialDescription,
Mat.UOM,Mat.HSNCODE,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue ,
ROUND(((AfterSGST + AfterCGST +
AfterIGST)) ,2)as Taxamount,AdvanceAmount,
- TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address,sup.SupplierID,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,LineItem.AmendedDetails as LineAmend,Payment.PaymentTerms
+ TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address,sup.SupplierID,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,LineItem.AmendedDetails as LineAmend,Payment.PaymentTerms,
FROM T_PurchaseOrder_LineItem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
@@ -842,7 +842,7 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '')
// join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
// where LineItem.PONO =?';
- $subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails,LineItem.Per,
+ $subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails,LineItem.Per,LineItem.ServiceMaterialDescription,
Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount ,
ProductPrice,Tax.*,LineItem.CostCenterCode ,Date(ReqMast.ReqDate) as ReqDate,POMaster.*,sup.SupplierName,sup.Address,LineItem.AmendedDetails as LineAmend,AdvanceAmount, Pay.PaymentTerms as Pay,ROUND((Quantity *Rate),2 ) as BasicValue,HSNCODE,sup.EmailAddress,sup.SupplierID,sup.PAN,sup.ContactNumber,sup.GSTNO
FROM T_PurchaseOrder_LineItem LineItem
@@ -962,7 +962,7 @@ where LineItem.PONO =?';
function GetImportPurchaseOrderDetails($PONO = '')
{
- $subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,
+ $subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ReceivedQuantity,
QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,
diff --git a/application/models/store_model.php b/application/models/store_model.php
index a45b09bb..9a57018c 100644
--- a/application/models/store_model.php
+++ b/application/models/store_model.php
@@ -1,81 +1,81 @@
-db->select('st.*,st.Remarks as storeremarks,MM.*');
- $this->db->from('T_Store_Stockdetails st ');
- $this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
-
-
- $query = $this->db->get();
- //print_r($this->db->last_query());
-
- $result = $query->result();
- return $result;
- }
-
- // function viewStock()
- // {
- // $this->db->distinct();
- // $this->db->select('st.*,st.Remarks as storeremarks,MM.*,RDet.DeliveredQuantity');
- // $this->db->from('T_Store_Stockdetails st ');
- // $this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
- // $this->db->join('T_Requestion_Details RDet','st.MaterialCode=RDet.MaterialCode and MM.MaterialCode=RDet.MaterialCode');
-
- // $query = $this->db->get();
-
- // $result = $query->result();
- // //print_r($this->db->last_query());
- // return $result;
- // }
- function GetAllMaterialList()
- {
-
- $subQuery = 'select MM.* from T_MaterialMaster MM where MaterialCode not in(select MaterialCode from T_Store_Stockdetails)';
- $query = $this->db->query($subQuery);
- return $query->result();
- }
- function GetConfigValue($ConfigID)
- {
- $this->db->select('ConfigValue');
- $this->db->from('T_ConfigDetails');
- $this->db->where('Config_ID',$ConfigID);
- $query = $this->db->get();
-
- $result = $query->result();
- return $result;
- }
- function addStock($StockDetails)
- {
-
- $this->db->trans_start();
- $this->db->insert('T_Store_Stockdetails', $StockDetails);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- }
-
- function UpdateStock($StockDetails,$MaterialCode)
- {
- $this->db->where('MaterialCode',$MaterialCode);
- $this->db->update('T_Store_Stockdetails',$StockDetails);
-
- }
-
- function GetStockHisory($MaterialCode)
- {
- $this->db->select('Quantity,ActualQuantity,Remarks,updatedOn');
- $this->db->from('T_Store_Stockdetails_History');
- $this->db->where('MaterialCode',$MaterialCode);
- $query = $this->db->get();
-
- $result = $query;
- return $result->result_array();
- }
-
-}
-
+db->select('st.*,st.Remarks as storeremarks,MM.*');
+ $this->db->from('T_Store_Stockdetails st ');
+ $this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
+
+
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+
+ $result = $query->result();
+ return $result;
+ }
+
+ // function viewStock()
+ // {
+ // $this->db->distinct();
+ // $this->db->select('st.*,st.Remarks as storeremarks,MM.*,RDet.DeliveredQuantity');
+ // $this->db->from('T_Store_Stockdetails st ');
+ // $this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
+ // $this->db->join('T_Requestion_Details RDet','st.MaterialCode=RDet.MaterialCode and MM.MaterialCode=RDet.MaterialCode');
+
+ // $query = $this->db->get();
+
+ // $result = $query->result();
+ // //print_r($this->db->last_query());
+ // return $result;
+ // }
+ function GetAllMaterialList()
+ {
+
+ $subQuery = 'select MM.* from T_MaterialMaster MM where MaterialCode not in(select MaterialCode from T_Store_Stockdetails)';
+ $query = $this->db->query($subQuery);
+ return $query->result();
+ }
+ function GetConfigValue($ConfigID)
+ {
+ $this->db->select('ConfigValue');
+ $this->db->from('T_ConfigDetails');
+ $this->db->where('Config_ID',$ConfigID);
+ $query = $this->db->get();
+
+ $result = $query->result();
+ return $result;
+ }
+ function addStock($StockDetails)
+ {
+
+ $this->db->trans_start();
+ $this->db->insert('T_Store_Stockdetails', $StockDetails);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ }
+
+ function UpdateStock($StockDetails,$MaterialCode)
+ {
+ $this->db->where('MaterialCode',$MaterialCode);
+ $this->db->update('T_Store_Stockdetails',$StockDetails);
+
+ }
+
+ function GetStockHisory($MaterialCode)
+ {
+ $this->db->select('Quantity,ActualQuantity,Remarks,updatedOn');
+ $this->db->from('T_Store_Stockdetails_History');
+ $this->db->where('MaterialCode',$MaterialCode);
+ $query = $this->db->get();
+
+ $result = $query;
+ return $result->result_array();
+ }
+
+}
+
\ No newline at end of file
diff --git a/application/views/Mrirprintpdf.php b/application/views/Mrirprintpdf.php
index 4d832786..447d789c 100644
--- a/application/views/Mrirprintpdf.php
+++ b/application/views/Mrirprintpdf.php
@@ -71,13 +71,13 @@
?>
-
-
+ -->
+