Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/mmishra/erp/controllers/ |
<?php
//if (!class_exists($erpController)) {
require_once __DIR__."/erp_controller.php";
//}
class iwdController extends erpController {
var $model;
public function __construct($model) {
// call parent constructor
// parent::__construct();
// initialize variables
$this->model = $model;
$this->model->tupleID = $this->tuple;
$this->userIP = $this->getIP(); // requires in log entry
$this->appURL = $_SERVER['REQUEST_URI']; // this is Request URI for log entry
$this->referer = $_SERVER['HTTP_REFERER']; // requires for log entry, not mandatory
// maintain erp activity log for inner contents
if ($_SESSION["loginID"] && strpos($this->appURL, 'inner')) {
$this->model->erpLog($this->userIP, $this->appURL, $this->referer);
} else if ($this->model->getMenuProtection($this->menu)) {
print("<h1>Session expired. Please sign-in again.</h1>");
exit;
}
}
public function __destruct() {
//'Destroying: ', $this->moduleID, PHP_EOL;
// log sql operation on corresponding table
// call $erpModel->erpSql($sql);
// print("Thanks.");
}
public function manageFeehead($action, $feeheadID) {
$this->model->tableID = 'iwd_feeheads';
$this->model->tupleID = $feeheadID;
switch ($action) {
case 'new':
case 'edit':
$this->editLock = '';
break;
case 'open':
case 'help':
case 'trash':
break;
case 'save':
// save record
$feeheadCode = strtoupper($_POST['feeheadCode']);
$feeheadName = ucwords($_POST['feeheadName']);
$accountType = $_POST['accountType'];
$paymentTerm = $_POST['paymentTerm'];
$this->model->saveFeehead($feeheadCode,$feeheadName,$accountType,$paymentTerm);
$this->model->sqlLog();
$this->errorText = 'Feehead record saved successfully.';
break;
case 'delete':
$this->model->deleteFeehead();
$this->model->sqlLog();
$this->errorText = 'Feehead record deleted successfully.';
break;
}
return $this->model->tupleID;
}
}
?>