public function savePaymentAndDetails($data)
 {
     $Payment = Payment::savePaymentAndDetails($data);
     // saving the user to the database
     echo AppUtil::getReturnStatus("sucess", $Payment);
     // returning the updated or newly created user object
 }
Example #2
0
 public static function getNotes($taskId)
 {
     $task = Task::getNotes($taskId);
     if (sizeof($task) > 0) {
         echo AppUtil::getReturnStatus("sucess", $task);
     } else {
         echo AppUtil::getReturnStatus("fail", "Note Details not available");
     }
 }
 public static function isWorkorderAlreadyUploaded($workorderBlob)
 {
     try {
         if ($workorderBlob != null) {
             if (!Workorder::isWorkorderAlreadyUploaded($workorderBlob)) {
                 echo AppUtil::getReturnStatus("Successful", "Workorder not Already Uploaded");
             } else {
                 echo AppUtil::getReturnStatus("Unsuccessful", "Workorder Already Uploaded");
             }
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Invalid Parameters");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
     }
 }
Example #4
0
         $password = mt_rand(1000000, 9999999);
         $hash = sha1($password);
         $stmt = $conn->prepare("UPDATE logindetails SET password=:password where userName=:email");
         $stmt->bindParam(':email', $params->userName, PDO::PARAM_STR);
         $stmt->bindParam(':password', $hash, PDO::PARAM_STR);
         if (!$stmt->execute()) {
             echo AppUtil::getReturnStatus("unsuccessful", "Resetting password failed");
         } else {
             AppUtil::sendForgotPasswordMail($params->userName, $password);
             echo AppUtil::getReturnStatus("successful", $password);
         }
     } else {
         echo AppUtil::getReturnStatus("NotAvailable", "Username or date of birth not valid ");
     }
 } else {
     echo AppUtil::getReturnStatus("Unsuccessful", "Some Error Occured ");
 }
 /*$stmt = $conn->prepare("SELECT * FROM `logindetails` WHERE `userName`=:username AND `password`=:password");
 
     $stmt->bindParam(':username', $params->username, PDO::PARAM_STR);
     $pass=sha1($params->password);
     //echo $pass;
     $stmt->bindParam(':password',$pass , PDO::PARAM_STR);
 
     $stmt->execute();
     $result=$stmt->fetchAll(PDO::FETCH_ASSOC);
     $json;
     if (count($result) > 0) {
         // output data of each row
         $json = array(
             'result' => "true");
 public function updateLeaveApprovalStatus($userId, $data)
 {
     $db = Database::getInstance();
     $connect = $db->getConnection();
     $status = $data->status;
     $applicationId = $data->applicationId;
     try {
         $stmt = $connect->prepare("UPDATE leave_application_master SET\n                                         status=:status,\n                                         action_by=:actionBy,\n                                         action_date=NOW()\n                                         WHERE application_id=:applicationId");
         $stmt->bindParam(':status', $status);
         $stmt->bindParam(':actionBy', $userId);
         $stmt->bindParam(':applicationId', $applicationId);
         $connect->beginTransaction();
         HicreteLogger::logDebug("query: \n" . json_encode($stmt));
         HicreteLogger::logDebug("Data: \n" . json_encode($data));
         if ($stmt->execute()) {
             HicreteLogger::logInfo("Status Updated Successfully");
             echo AppUtil::getReturnStatus("success", "Status Updated Successfully");
             $connect->commit();
             return true;
         }
     } catch (Exception $e) {
         HicreteLogger::logFatal("Exception Occured Message:\n" . $e->getMessage());
         echo AppUtil::getReturnStatus("fail", "Exception While Updating Leave Approval");
     }
 }
 public static function getAmountPaidForInvoice($projId)
 {
     try {
         if ($projId != null) {
             $object = Invoice::getAmountPaidForInvoice($projId);
             if ($object != null) {
                 echo AppUtil::getReturnStatus("Successful", $object);
             } else {
                 echo AppUtil::getReturnStatus("Unsuccessful", "Unexpected Error Occurred While Retrieving Amount Paid For Invoice");
             }
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Invalid Parameters");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
     }
 }
Example #7
0
            echo AppUtil::getReturnStatus("fail", $message);
        }
        break;
    case 'getEmployeeDetails':
        $operationObject->getEmployeeDetails();
        break;
    case 'getNoOfLeaves':
        $operationObject->getNoOfLeaves($data);
        break;
    case 'getLeavesApproval':
        if (!$operationObject->getLeavesApproval($userId)) {
            $message = "Leave Approval details not available...!!!";
            echo AppUtil::getReturnStatus("fail", $message);
        }
        break;
    case 'LeaveApprovalAction':
        if (!$operationObject->updateLeaveApprovalStatus($userId, $data)) {
            $message = "Could not update status...!!!";
            echo AppUtil::getReturnStatus("fail", $message);
        }
        break;
}
?>







Example #8
0
 public static function modifyCostCenter($projectId, $segmentData, $costCentermaterials, $userId)
 {
     $db = Database::getInstance();
     $conn = $db->getConnection();
     $conn->beginTransaction();
     try {
         $stmt1 = $conn->prepare("DELETE FROM `budget_details` where projectid=:projectid");
         $stmt1->bindParam(':projectid', $projectId);
         if ($stmt1->execute()) {
             $stmt2 = $conn->prepare("DELETE FROM `material_budget_details` where projectid=:projectid");
             $stmt2->bindParam(':projectid', $projectId);
             if ($stmt2->execute()) {
                 $success = false;
                 HicreteLogger::logInfo("Creating cost center");
                 foreach ($segmentData as $segment) {
                     $budgetId = AppUtil::generateId();
                     $stmt = $conn->prepare("INSERT INTO `budget_details`(`budgetdetailsid`,`projectid`, `budgetsegmentid`, `allocatedbudget`, `alertlevel`, `createdby`, `creationdate`, `lastmodificationdate`, `lastmodifiedby`)\n                    VALUES (:budgetId,:projectId,:segmentId,:allocatedBudget,:alertLevel,:createdBy,now(),now(),:lastModifiedBy)");
                     $stmt->bindParam(':budgetId', $budgetId, PDO::PARAM_STR);
                     $stmt->bindParam(':projectId', $projectId, PDO::PARAM_STR);
                     $stmt->bindParam(':segmentId', $segment->budgetsegmentid, PDO::PARAM_STR);
                     $stmt->bindParam(':allocatedBudget', $segment->allocatedbudget, PDO::PARAM_INT);
                     $stmt->bindParam(':alertLevel', $segment->alertlevel, PDO::PARAM_STR);
                     $stmt->bindParam(':createdBy', $userId, PDO::PARAM_STR);
                     $stmt->bindParam(':lastModifiedBy', $userId, PDO::PARAM_STR);
                     HicreteLogger::logDebug("Query: \n" . json_encode($stmt));
                     if ($stmt->execute()) {
                         $success = true;
                     } else {
                         $success = false;
                     }
                 }
                 if ($costCentermaterials != null) {
                     foreach ($costCentermaterials as $material) {
                         $materialbudgetdetailsid = uniqid();
                         $stmtCostCenterMaterial = $conn->prepare("INSERT INTO `material_budget_details`(`materialbudgetdetailsid`,`projectid`,`materialid` ,`allocatedbudget`, `alertlevel`, `creadtedby`, `creationdate`, `lastmodificationdate`, `lastmodifiedby`)\n                    VALUES (:materialbudgetdetailsid,:projectId,:materialid,:allocatedBudget,:alertLevel,:creadtedby,now(),now(),:lastmodifiedby)");
                         $stmtCostCenterMaterial->bindParam(':materialbudgetdetailsid', $materialbudgetdetailsid, PDO::PARAM_STR);
                         $stmtCostCenterMaterial->bindParam(':projectId', $projectId, PDO::PARAM_STR);
                         $stmtCostCenterMaterial->bindParam(':materialid', $material->materialid, PDO::PARAM_STR);
                         $stmtCostCenterMaterial->bindParam(':allocatedBudget', $material->allocatedbudget, PDO::PARAM_INT);
                         $stmtCostCenterMaterial->bindParam(':alertLevel', $material->alertlevel, PDO::PARAM_STR);
                         $stmtCostCenterMaterial->bindParam(':creadtedby', $userId, PDO::PARAM_STR);
                         $stmtCostCenterMaterial->bindParam(':lastmodifiedby', $userId, PDO::PARAM_STR);
                         if ($stmtCostCenterMaterial->execute()) {
                             $success = true;
                         } else {
                             $success = false;
                         }
                     }
                 }
                 if ($success) {
                     $conn->commit();
                     $message = "Cost Center Updated successfully..!!!";
                     HicreteLogger::logInfo("Cost center Updated  successfully");
                     echo AppUtil::getReturnStatus("success", $message);
                 } else {
                     $conn->rollBack();
                     $message = "Could not create cost center..!!!";
                     HicreteLogger::logError("Error while creating cost center");
                     echo AppUtil::getReturnStatus("failure", $message);
                 }
             }
         } else {
             $conn->rollBack();
             $message = "Could not update cost center..!!!";
             HicreteLogger::logError("Error while updating cost center");
             echo AppUtil::getReturnStatus("failure", $message);
         }
     } catch (Exception $e) {
         $conn->rollBack();
         HicreteLogger::logError("Exception while updating cost center");
         echo AppUtil::getReturnStatus("failure", $e->getMessage());
     }
 }
 public static function getSiteTrackingProjectList()
 {
     try {
         $project = Project::getSiteTrackingProjectList();
         if ($project !== null) {
             echo AppUtil::getReturnStatus("Successful", $project);
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Database Error Occurred");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", "Unknown database error occurred");
     }
 }
 public function viewPermanentApplicators($data)
 {
     try {
         $db = Database::getInstance();
         $connect = $db->getConnection();
         $searchKeyword = "";
         $searchExpression = "";
         $json_response = array();
         if (isset($data->searchExpression)) {
             $searchExpression = $data->searchExpression;
         }
         if (isset($data->searchKeyword)) {
             $searchKeyword = '%' . $data->searchKeyword . '%';
         } else {
             $searchKeyword = '%' . "" . '%';
         }
         if ($searchExpression == 'applicator_name') {
             $stmt1 = $connect->prepare("SELECT * FROM applicator_master\n\t\t\t\t\t\t\tWHERE applicator_status='permanent' AND  applicator_name LIKE :searchKeyword");
             $stmt1->bindParam(':searchKeyword', $searchKeyword);
         } else {
             if ($searchExpression === 'applicator_city') {
                 $stmt1 = $connect->prepare("SELECT * FROM applicator_master\n\t\t\t\t\t\t\tWHERE applicator_status='permanent' AND  applicator_city LIKE :searchKeyword");
                 $stmt1->bindParam(':searchKeyword', $searchKeyword);
             } else {
                 if ($searchExpression == 'applicator_state') {
                     $stmt1 = $connect->prepare("SELECT * FROM applicator_master\n\t\t\t\t\t\t\tWHERE applicator_status='permanent' AND  applicator_state LIKE :searchKeyword");
                     $stmt1->bindParam(':searchKeyword', $searchKeyword);
                 } else {
                     $stmt1 = $connect->prepare("SELECT * FROM applicator_master\n\t\t\t\t\t\t\tWHERE applicator_status='permanent'");
                 }
             }
         }
         HicreteLogger::logDebug("Query:\n " . json_encode($stmt1));
         if ($stmt1->execute()) {
             HicreteLogger::logDebug("Row count:\n " . json_encode($stmt1->rowCount()));
             while ($result1 = $stmt1->fetch()) {
                 $applicator = array();
                 $applicator['applicator_master_id'] = $result1['applicator_master_id'];
                 $applicator['applicator_name'] = $result1['applicator_name'];
                 $applicator['applicator_contact'] = $result1['applicator_contact'];
                 $applicator['applicator_city'] = $result1['applicator_city'];
                 $applicator['applicator_state'] = $result1['applicator_state'];
                 array_push($json_response, $applicator);
             }
             if (sizeof($json_response) > 0) {
                 HicreteLogger::logInfo("Fetched successfully");
                 echo AppUtil::getReturnStatus("success", $json_response);
                 return true;
             } else {
                 HicreteLogger::logError("Fetched unsuccessful");
                 return false;
             }
         }
         return false;
     } catch (Exception $e) {
         HicreteLogger::logFatal("Exception Occured Message:\n" . $e->getMessage());
         return false;
     }
 }
 public static function isQuotationAlreadyUploaded($quotationBlob)
 {
     try {
         if ($quotationBlob != null) {
             if (!Quotation::isQuotationAlreadyUploaded($quotationBlob)) {
                 echo AppUtil::getReturnStatus("Successful", "Quotation not Already Uploaded");
             } else {
                 echo AppUtil::getReturnStatus("Unsuccessful", "Quotation Already Uploaded");
             }
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Invalid Parameters");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
     }
 }
Example #12
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: LENOVO
 * Date: 03/31/16
 * Time: 11:34 PM
 */
require_once '../../php/appUtil.php';
$target_dir = "../../upload/Workorders/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$file = $_FILES['file'];
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
    echo AppUtil::getReturnStatus("Successful", "Workorder Uploaded Successfully");
} else {
    echo AppUtil::getReturnStatus("Unsuccessful", "Error Occurred while uploading workorder");
}
 public static function getCustomerList()
 {
     try {
         $customer = Customer::getCustomerList();
         echo AppUtil::getReturnStatus("Successful", $customer);
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", "Unknown database error occurred");
     }
 }
Example #14
0
        ProjectController::getCompaniesForProject($data->data);
        break;
    case "getExcludedCompaniesForProject":
        ProjectController::getExcludedCompaniesForProject($data->data);
        break;
    case "closeProject":
        echo json_encode(ProjectController::closeProject($data->data));
        break;
    case "getCompaniesForProject":
        ProjectController::getCompaniesForProject($data->data);
        break;
    case "getProjectList":
        ProjectController::getProjectList();
        break;
    case "getSiteTrackingProjectList":
        ProjectController::getSiteTrackingProjectList();
        break;
    case "getInvoiceOfProject":
        ProjectController::getInvoicesByProject($data->projectId);
        break;
    case "getProjectSiteFollowup":
        if (isset($data->projectId)) {
            ProjectController::getProjectSiteFollowup($data->projectId);
        } else {
            echo AppUtil::getReturnStatus("fail", "Please select project");
        }
        break;
    case "getProjectListWithoutCostCenter":
        ProjectController::getProjectListWithoutCostCenter();
        break;
}
Example #15
0
        Expense::addMaterialExpense($data->projectId, $data->materialsExpense, $userId);
        break;
    case 'getBillApproval':
        Expense::getBillApproval();
        break;
    case 'getBillDetails':
        Expense::getBillDetails($data);
        break;
    case 'updateBillStatus':
        Expense::updateBillStatus($data, $userId);
        break;
    case 'getProjectListForExpense':
        Expense::getProjectsForExpense();
        break;
    case 'deleteSegment':
        try {
            $status = Expense::deleteSegment($data->segmentId);
            if ($status == 2) {
                echo AppUtil::getReturnStatus("Unsuccessful", "Budget Segment is used in costcenter..Can not Delete");
            } else {
                if ($status == 1) {
                    echo AppUtil::getReturnStatus("Success", "Budget Segment deleted successfully");
                } else {
                    echo AppUtil::getReturnStatus("Unsuccessful", "Budget Segment can not be deleted");
                }
            }
        } catch (Exception $e) {
            echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
        }
        break;
}
Example #16
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: LENOVO
 * Date: 03/31/16
 * Time: 11:34 PM
 */
require_once '../../php/appUtil.php';
$target_dir = "../../upload/Invoices/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$file = $_FILES['file'];
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
    echo AppUtil::getReturnStatus("Successful", "Invoice Uploaded Successfully");
} else {
    echo AppUtil::getReturnStatus("Unsuccessful", "Error Occurred while uploading Invoice");
}
Example #17
0
$opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
//echo json_encode($data);
switch ($data->operation) {
    case 'getQuotationFollow':
        if (isset($data->quotationId)) {
            QuotationController::getQuotationFollow($data->quotationId);
        } else {
            // $Quotation = Quotation::loadAllQuotationFollowup();
            echo AppUtil::getReturnStatus("fail", "Please select Quotation");
        }
        break;
    case 'getInvoiceFollowups':
        if (isset($data->invoiceId)) {
            InvoiceController::getInvoiceFollowups($data->invoiceId);
        } else {
            echo AppUtil::getReturnStatus("fail", "Please select invoice");
        }
        break;
    case 'getPaymentFollowup':
        FollowupController::getPaymentFollowup($userId);
        break;
    case 'getQuotationFollowup':
        FollowupController::getQuotationFollowup($userId);
        break;
    case 'getSitetrackingFollowup':
        FollowupController::getSitetrackingFollowup($userId);
        break;
    case 'getApplicatorFollowup':
        FollowupController::getApplicatorFollowup($userId);
        break;
    case 'UpdatePaymentFollowup':
Example #18
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: LENOVO
 * Date: 03/31/16
 * Time: 11:34 PM
 */
require_once '../../php/appUtil.php';
$target_dir = "../../upload/Quotations/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$file = $_FILES['file'];
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
    echo AppUtil::getReturnStatus("Successful", "File Uploaded Successfully");
} else {
    echo AppUtil::getReturnStatus("Unsuccessful", "Error Occurred while uploading Quoatation");
}
 public function ConductApplicatorFollowup($followupId, $data)
 {
     try {
         if (Followup::ConductApplicatorFollowup($followupId, $data)) {
             echo AppUtil::getReturnStatus("Successful", "Conduction Successful");
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Database Error Occurred");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
     }
 }
Example #20
0
 public static function CancelTempAccessRequest($requestId)
 {
     try {
         $db = Database::getInstance();
         $conn = $db->getConnection();
         HicreteLogger::logInfo("Adding temporary request");
         $stmt = $conn->prepare("UPDATE `tempaccessrequest` SET `status`='Cancel' WHERE `requestId`=:requestId");
         $stmt->bindParam(':requestId', $requestId, PDO::PARAM_STR);
         HicreteLogger::logDebug("Query:\n " . json_encode($stmt));
         if ($stmt->execute()) {
             HicreteLogger::logInfo("Access request added");
             echo AppUtil::getReturnStatus("Successful", "Access Request Added");
         } else {
             HicreteLogger::logError("Unknown databse error occured");
             echo AppUtil::getReturnStatus("Unsuccessful", "Unknown database error occurred");
         }
     } catch (Exception $e) {
         HicreteLogger::logFatal("Exception Occured Message:\n" . $e->getMessage());
         echo AppUtil::getReturnStatus("Exception", $e->getMessage());
     }
 }
Example #21
0
 public static function getCompanyList($userId)
 {
     $db = Database::getInstance();
     $conn = $db->getConnection();
     try {
         $stmt = $conn->prepare("SELECT `companyId` ,`companyName` FROM `companymaster`");
         HicreteLogger::logDebug("Query:\n " . json_encode($stmt));
         if ($stmt->execute()) {
             HicreteLogger::logDebug("Count:\n " . json_encode($stmt->rowCount()));
             $result = $stmt->fetchAll();
             echo AppUtil::getReturnStatus("Successful", $result);
         } else {
             echo AppUtil::getReturnStatus("Failure", "Database Error Occurred");
         }
     } catch (Exceptio $e) {
         echo AppUtil::getReturnStatus("Exception", $e . getMessage());
     }
 }