public static function saveCustomer($data, $userId) { $custnum = AppUtil::generateId(); $object = array(); $t = time(); $current = date("Y-m-d", $t); $isDeleted = '0'; $pincode = ""; //echo "nside save customer"; //echo json_encode($data); //echo json_encode($data); $db = Database::getInstance(); $conn = $db->getConnection(); $stmt = $conn->prepare("SELECT `CustomerName` FROM `customer_master` WHERE `CustomerName`=:customerName"); $stmt->bindParam(':customerName', $data->customer_name, PDO::PARAM_STR); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($result) > 0) { return 2; } $stmt = $conn->prepare("INSERT INTO customer_master (CustomerId,CustomerName,Address,City,State,Country,Pincode,Mobileno,Landlineno,FaxNo,EmailId,isDeleted,CreationDate,CreatedBy,LastModificationDate,LastModifiedBy,VATNo,CSTNo,PAN,ServiceTaxNo) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); if ($stmt->execute([$custnum, $data->customer_name, $data->customer_address, $data->customer_city, $data->customer_state, $data->customer_country, $pincode, $data->customer_phone, $data->customer_landline, $data->customer_faxNo, $data->customer_emailId, $isDeleted, $current, $userId, $current, $userId, $data->customer_vatNo, $data->customer_cstNo, $data->customer_panNo, $data->customer_serviceTaxNo]) === TRUE) { //echo "\nit true"; return 1; } else { //echo "\n its false"; return 0; } $conn = null; }
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 }
public function getApps() { if ($this->apps == null) { $this->apps = AppUtil::getAppsByUid($this->id); } return $this->networks; }
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()); } }
public function saveUser($data) { $usernum = AppUtil::generateId(); try { $db = Database::getInstance(); $conn = $db->getConnection(); $conn->beginTransaction(); $stmt = $conn->prepare("INSERT INTO usermaster(UserId, FirstName, LastName, isDeleted) VALUES(?,?,?,?)"); if ($stmt->execute([$usernum, $data->FirstName, $data->LastName, 0]) === TRUE) { $conn->commit(); return "User created succesfully "; } else { return "Error in user creation"; } } catch (PDOException $e) { echo $e->getMessage(); $conn->rollBack(); } $conn = null; }
public static function saveTask($data) { if (!isset($_SESSION['token'])) { session_start(); } $userId = $_SESSION['token']; $taskId = AppUtil::generateId(); try { $db = Database::getInstance(); $conn = $db->getConnection(); $conn->beginTransaction(); $stmt = $conn->prepare("INSERT INTO task_master (TaskID,TaskName, TaskDescripion, ScheduleStartDate, ScheduleEndDate, CompletionPercentage, TaskAssignedTo, isCompleted, CreationDate, CreatedBy) VALUES(?,?,?,?,?,?,?,?,?,?)"); if ($stmt->execute([$taskId, $data->TaskName, $data->TaskDescripion, $data->ScheduleStartDate, $data->ScheduleEndDate, $data->CompletionPercentage, $data->TaskAssignedTo, $data->isCompleted, $data->CreationDate, $userId]) === TRUE) { $conn->commit(); return "Task created successfully"; } else { return "Task creation Failed.."; } } catch (PDOException $e) { echo $e->getMessage(); $conn->rollBack(); } $db = null; }
$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 static function saveQuotationDetailsAndTax($data) { $QuotationId = AppUtil::generateId(); $quotation = $data->Quotation; $quotationBasicDetails = $data->Details; $quotationTaxDetails = $data->taxDetails; $detailIdArray = []; $quotationIndex = []; $db = Database::getInstance(); $conn = $db->getConnection(); $conn->beginTransaction(); $date1 = new DateTime($quotation->DateOfQuotation); $quotationDate = $date1->format('Y-m-d'); $stmt = $conn->prepare("INSERT INTO quotation(QuotationId, QuotationTitle, RefNo, DateOfQuotation, Subject, ProjectId, CompanyId, QuotationBlob, isApproved, isDeleted) VALUES(?,?,?,?,?,?,?,?,?,?);"); if ($stmt->execute([$QuotationId, $quotation->QuotationTitle, $quotation->RefNo, $quotationDate, $quotation->Subject, $quotation->ProjectId, $quotation->CompanyId, $quotation->QuotationBlob, 0, 0]) === TRUE) { for ($i = 0; $i < sizeof($quotationBasicDetails); $i++) { $DetailId = AppUtil::generateId(); $stmt1 = $conn->prepare("INSERT INTO quotation_details(DetailID, QuotationId, Title, Description, Quantity, UnitRate, Amount, DetailNo,unit) VALUES(?,?,?,?,?,?,?,?,?)"); if ($stmt1->execute([$DetailId, $QuotationId, $quotationBasicDetails[$i]->quotationItem, $quotationBasicDetails[$i]->quotationDescription, $quotationBasicDetails[$i]->quotationQuantity, $quotationBasicDetails[$i]->quotationUnitRate, $quotationBasicDetails[$i]->amount, $i + 1, $quotationBasicDetails[$i]->quotationUnit]) === TRUE) { //$detailIdArray.push($DetailId); array_push($detailIdArray, $DetailId); array_push($quotationIndex, $i + 1); } else { $conn->rollBack(); return false; } } for ($tx = 0; $tx < sizeof($quotationTaxDetails); $tx++) { $TaxId = AppUtil::generateId(); $stmt2 = $conn->prepare("INSERT INTO quotation_tax_details(TaxID, QuotationId, TaxName, TaxPercentage, TaxAmount) VALUES(?,?,?,?,?)"); if ($stmt2->execute([$TaxId, $QuotationId, $quotationTaxDetails[$tx]->taxTitle, $quotationTaxDetails[$tx]->taxPercentage, $quotationTaxDetails[$tx]->amount]) === TRUE) { for ($s = 0; $s < sizeof($quotationTaxDetails[$tx]->taxArray); $s++) { for ($qut = 0; $qut < sizeof($quotationIndex); $qut++) { if ($quotationTaxDetails[$tx]->taxArray[$s] === $quotationIndex[$qut]) { $stmt3 = $conn->prepare("INSERT INTO quotation_tax_applicable_to(TaxID, DetailsID) VALUES(?,?)"); if ($stmt3->execute([$TaxId, $detailIdArray[$qut]]) === FALSE) { $conn->rollBack(); return false; } } } } } else { $conn->rollBack(); return false; } } } $conn->commit(); return 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()); } }
public static function getCustomerList() { try { $customer = Customer::getCustomerList(); echo AppUtil::getReturnStatus("Successful", $customer); } catch (Exception $e) { echo AppUtil::getReturnStatus("Unsuccessful", "Unknown database error occurred"); } }
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"); } }
<?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"); }
<?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 getXML() { $this->printHeader = false; $this->printFooter = false; $apps = AppUtil::getAppsByUid($_SESSION['uid']); fb("app", $apps); $reports = ReportUtil::getReportsByCid($this->cid, $this->startDate, $this->endDate, $this->numCat, $this->platform); fb("reports", $reports); $new_reports = $this->collapseReport($reports); if ($this->metricTypeSelected == "CTR") { $this->calculateCTR($new_reports); } fb("nr", $new_reports); $this->smarty->assign('reports', $new_reports); $this->smarty->assign('nets', $reports['nets']); $this->smarty->assign('dates', $new_reports['dates']); $this->smarty->assign('metric', strtolower($this->metricTypeSelected)); //fb("smarty",$this->smarty->get_template_vars()); return $this->smarty->fetch('../tpl/www/reports/applicationReportsXML.tpl'); // // foreach($houseAds as $houseAd) { // $houseAd->reports = ReportUtil::getReportsByCid($houseAd->id, $this->startDate, $this->endDate); // } // // $totals = array(); // $dates = array(); // for($i=$this->startDate; $i<=$this->endDate; $i=date('Y-m-d', strtotime('+1 day', strtotime($i)))) { // $dates[] = $i; // // foreach($houseAds as $houseAd) { // if(isset($totals[$i])) { // $totals[$i]['impressions'] += $houseAd->reports[$i]['impressions']; // $totals[$i]['clicks'] += $houseAd->reports[$i]['clicks']; // } // else { // $totals[$i]['impressions'] = $houseAd->reports[$i]['impressions']; // $totals[$i]['clicks'] = $houseAd->reports[$i]['clicks']; // } // } // } // // $this->smarty->assign('houseAds', $houseAds); // $this->smarty->assign('dates', $dates); // $this->smarty->assign('totals', $totals); // // return $this->smarty->fetch('../tpl/www/reports/houseAdReportsXML.tpl'); }
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 function __default() { $this->user->postGet(); $a = $this->user->getPref('msg_002'); if (empty($a)) { $msg_002 = "<span class='msg'>Learn about our upgraded <a target='_newtab' href='http://helpcenter.adwhirl.com/content/step-6-allocate-your-house-ads'>House Ads</a> functionality</span>"; $this->smarty->assign('message', $msg_002); $this->smarty->assign('msg_id', 'msg_002'); } $this->smarty->assign('returnPage', isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : null); $this->styleSheets[] = "/css/preview.css"; $this->jsFiles[] = "/js/jqsm135.js"; $this->displayFinalArrowInBreadcrumbs = true; $houseAds = HouseAdUtil::getHouseAdsByUid($_SESSION['uid']); $apps = AppUtil::getAppsByUid($this->user->id); $o = isset($_REQUEST['o']) ? $_REQUEST['o'] : 0; $o = intval($o); $haveMissingAd = false; // Assume we don't have the missing ad until we scan them all if (!empty($_REQUEST['n_cid'])) { foreach ($houseAds as $houseAd) { // if the current ad has the same id, we know we have the missing ad $haveMissingAd |= $houseAd->id == $_REQUEST['n_cid']; // Stop if we know we have the missing ad if ($haveMissingAd) { break; } } } else { $haveMissingAd = true; // no new ad id passed in, so all ads should be in the DB } if (!empty($_REQUEST['del_cid'])) { foreach ($houseAds as $idx => $houseAd) { if ($houseAd->id == $_REQUEST['del_cid']) { unset($houseAds[$idx]); } } } fb('haveMissingAd', $haveMissingAd); // Do we have all the ads? If not, let's add the missing one. if (!$haveMissingAd) { $houseAd = new HouseAd(); $houseAd->id = $_REQUEST['n_cid']; $houseAd->name = $_REQUEST['n_name']; $houseAd->type = intval($_REQUEST['n_type']); $houseAd->linkType = intval($_REQUEST['n_linkType']); $houseAds[] = $houseAd; fb("houseAd", $houseAd); } $fields = array('name', 'linkType', 'type'); $total = count($houseAds); if ($total <= 10) { $fields[] = 'numApp'; } $sortBy = isset($_REQUEST['sortBy']) ? $_REQUEST['sortBy'] : 'nameAsc'; if (substr($sortBy, -1) == '?') { $sortBy = substr($sortBy, 0, -1); } $isAsc = substr($sortBy, -3) == 'Asc'; $sortBy = substr($sortBy, 0, strlen($sortBy) - 3); foreach ($fields as $field) { $fname = $field; if ($field == $sortBy) { $val = $fname . ($isAsc ? 'Dsc' : 'Asc'); } else { $val = isset($_REQUEST[$fname]) ? $_REQUEST[$fname] : $field . 'Asc'; } $this->smarty->assign($fname, $val); } $itemsPerPage = 10; if ($sortBy == 'numApp' && $total <= 10) { $fname = 'numApp' . ($isAsc ? 'Asc' : 'Dsc'); foreach ($houseAds as $houseAd) { $houseAd->getApps(); } usort($houseAds, $fname); } else { if ($sortBy == 'numApp') { $sortBy = 'name'; $isAsc = 'true'; } usort($houseAds, makeSortFunction($sortBy, $isAsc)); $houseAds = array_slice($houseAds, $o, $itemsPerPage); foreach ($houseAds as $houseAd) { $houseAd->getApps(); } } $this->smarty->assign('appsCount', count($apps)); $this->smarty->assign('current_offset', $o); $this->smarty->assign('total', $total); $this->smarty->assign('itemsPerPage', $itemsPerPage); $this->subtitle = "House Ads"; $this->smarty->assign('linkLabels', HouseAd::$HOUSEAD_LINKTYPES); fb($houseAds); $this->smarty->assign('houseAds', $houseAds); $this->smarty->assign('houseAdTypes', HouseAd::$HOUSEAD_TYPES); fb("smarty", $this->smarty->get_template_vars()); return $this->smarty->fetch('../tpl/www/houseAds/houseAds.tpl'); }
public function getXML() { $this->printHeader = false; $this->printFooter = false; if ($this->aid != null) { $app = new App($this->aid); } else { $apps = AppUtil::getAppsByUid($this->user->id); $app = $apps['0']; } $reports = ReportUtil::getReportsByAid($app->id, $this->startDate, $this->endDate); fb("reports", $reports); $new_reports = $this->collapseReport($reports); fb("nr", $new_reports); $this->smarty->assign('reports', $new_reports); $this->smarty->assign('nets', $reports['nets']); $this->smarty->assign('dates', $new_reports['dates']); $this->smarty->assign('metric', 'impressions'); return $this->smarty->fetch('../tpl/www/reports/applicationReportsXML.tpl'); }
<?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"); }
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; }
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()); } }
public function CreateApplicatorFollowup($ApplicatorId, $data, $userId) { $FollowupId = AppUtil::generateId(); $t = time(); $current = date("Y-m-d", $t); $db = Database::getInstance(); $conn = $db->getConnection(); $conn->beginTransaction(); $stmt = $conn->prepare("INSERT INTO applicator_follow_up(date_of_follow_up,last_modification_date,last_modified_by,created_by,creation_date,enrollment_id, `followup_title`,`assignEmployeeId`)\n VALUES (:followupDate,NOW(),:lastModifiedBy,:createdBy,NOW(),:lastEnrollmentId ,:followupTitle ,:assignEmployeeId)"); $stmt->bindParam(':followupDate', $data->FollowupDate); $stmt->bindParam(':lastEnrollmentId', $ApplicatorId); $stmt->bindParam(':lastModifiedBy', $userId); $stmt->bindParam(':createdBy', $userId); $stmt->bindParam(':followupTitle', $data->FollowupTitle); $stmt->bindParam(':assignEmployeeId', $data->AssignEmployee); if ($stmt->execute()) { $conn->commit(); return true; } else { $conn->rollBack(); 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()); } }
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()); } }
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; }
public function edit() { $this->jsFiles[] = "/js/jqsm135.js"; $this->jsFiles[] = "/js/jquery.validate.min.js"; $this->needsHouseAd(); $this->jsFiles[] = "/js/ajaxupload.js"; $this->smarty->assign('returnPage', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); $apps = AppUtil::getAppsByUid($this->user->id); $appHouseAds = array(); foreach (AppHouseAdUtil::getAppHouseAdsByCid($this->houseAd->id) as $appHouseAd) { $appHouseAds[$appHouseAd->aid] = $appHouseAd; } foreach ($apps as $app) { if (array_key_exists($app->id, $appHouseAds)) { $app->ahid = $appHouseAds[$app->id]->id; } } $this->smarty->assign('apps', $apps); $hasiPhoneApp = false; $hasAndroidApp = false; foreach ($apps as $app) { $hasiPhoneApp |= $app->platform == 1; $hasAndroidApp |= $app->platform == 2; } $this->smarty->assign('hasNoiPhoneApp', !$hasiPhoneApp); $this->smarty->assign('hasNoAndroidApp', !$hasAndroidApp); $this->styleSheets[] = "/css/preview.css"; $this->smarty->assign('linkTypeOptions', HouseAd::$HOUSEAD_LINKTYPES); $this->smarty->assign('typeOptions', HouseAd::$HOUSEAD_TYPES); $this->smarty->assign('createOrEdit', 'edit'); $this->smarty->assign('appHouseAds', $appHouseAds); $this->breadcrumbs[] = array('text' => "Edit", 'link' => '/houseAds/ad/edit'); $this->smarty->assign('houseAd', $this->houseAd); fb("smarty", $this->smarty->get_template_vars()); return $this->smarty->fetch('../tpl/www/houseAds/create.tpl'); }
$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':
public function __default() { $this->user->postGet(); $b = $this->user->getPref('msg_003'); if (empty($b)) { $msg_003 = "<span class='msg'>NEW! AdWhirl now explicitly supports Millennial Media on Android – download the new <a target='_newtab' href='http://code.google.com/p/adwhirl/downloads/list'>AdWhirl Android SDK</a></span>"; $this->smarty->assign('message', $msg_003); $this->smarty->assign('msg_id', 'msg_003'); } else { $a = $this->user->getPref('msg_001'); if (empty($a)) { $msg_001 = "<span class='msg'>Learn about how you can add unlimited additional networks with <a target='_newtab' href='http://helpcenter.adwhirl.com/content/custom-events-and-generic-notifications'>Custom Events</a></span>"; $this->smarty->assign('message', $msg_001); $this->smarty->assign('msg_id', 'msg_001'); } } $this->smarty->assign('returnPage', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); $this->displayFinalArrowInBreadcrumbs = true; $o = isset($_REQUEST['o']) ? $_REQUEST['o'] : 0; $o = intval($o); $apps = AppUtil::getAppsByUid($this->user->id); $missingApp = false; $notMissingApp = false || empty($_REQUEST['n_aid']); if (!empty($_REQUEST['n_aid'])) { foreach ($apps as $app) { $missingApp |= $app->id != $_REQUEST['n_aid']; $notMissingApp |= $app->id == $_REQUEST['n_aid']; // echo $notMissingApp . "- " . $missingApp .'-'. $app->id . '-'. $_REQUEST['n_aid'] . '--'.($app->id == $_REQUEST['n_aid']) .'<br>'; } } if (!empty($_REQUEST['del_aid'])) { foreach ($apps as $idx => $app) { if ($app->id == $_REQUEST['del_aid']) { unset($apps[$idx]); } } } // fb('missingApp',$missingApp); // echo "NotMissingApp $notMissingApp <br>"; if (!$notMissingApp) { $app = new App(); $app->id = $_REQUEST['n_aid']; $app->name = $_REQUEST['n_name']; $app->platform = intval($_REQUEST['n_platform']); $apps[] = $app; fb("App", $app); } usort($apps, "sortAppsByName"); fb('apps', $apps); $total = count($apps); $itemsPerPage = 10; fb('apps', $apps); $apps = array_slice($apps, $o, $itemsPerPage); fb('apps', $apps); // array_pop($this->breadcrumbs); // $this->breadcrumbs[] = array("text"=>"App List","link"=>"/apps/apps"); $this->subtitle = "App List"; $this->smarty->assign('apps', $apps); $this->smarty->assign('current_offset', $o); $this->smarty->assign('total', $total); $this->smarty->assign('itemsPerPage', $itemsPerPage); fb("smarty", $this->smarty->get_template_vars()); return $this->smarty->fetch('../tpl/www/apps/apps.tpl'); }
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()); } }