if ($community_properties_obj->add()) { $community_reports_obj = new Dynamo("community_reports"); $complex_reports_obj = new Dynamo("complex_reports"); $complex_reports_array = $complex_reports_obj->getOneWhere("property_id = " . $complex_properties_array["id"]); $_REQUEST['date_reported'] = date("Y-m-d H:i:s"); $_REQUEST['status_id'] = $_REQUEST['is_submitted'] = $_REQUEST['is_saved'] = $_REQUEST['is_closed'] = 0; $_REQUEST['report_id'] = $community_report_id = $community_reports_obj->getMaxId(); if ($community_reports_obj->add()) { $community_report_rooms_obj = new Dynamo("community_report_rooms"); $community_report_rooms_max_id = $community_report_rooms_obj->getMaxId(); $complex_report_rooms_obj = new Dynamo("complex_report_rooms"); $complex_report_rooms_array = $complex_report_rooms_obj->getAll("WHERE report_id = " . $complex_reports_array["id"] . " ORDER BY id"); if (count($complex_report_rooms_array) > 0) { $query = "INSERT INTO community_report_rooms (`id`,`report_id`,`room_template_id`,`name`,`date_created`,`created_by`) VALUES"; $complex_report_room_items_obj = new Dynamo("complex_report_room_items"); $complex_report_room_items_array = $complex_report_room_items_obj->getAll("WHERE report_id = " . $complex_report_rooms_array[0]["report_id"] . " ORDER BY id"); $community_report_room_items_obj = new Dynamo("community_report_room_items"); $community_report_room_items_max_id = $community_report_room_items_obj->getMaxId(); if (count($complex_report_room_items_array) > 0) { $query2 = "INSERT INTO community_report_room_items (`id`,`report_id`,`room_id`,`room_template_item_id`,`name`,`status_id`,`date_created`) VALUES"; } for ($i = 0; $i < count($complex_report_rooms_array); $i++) { $query .= "({$community_report_rooms_max_id}," . $_REQUEST['report_id'] . "," . $complex_report_rooms_array[$i]["room_template_id"] . ",'" . addslashes(stripslashes($complex_report_rooms_array[$i]["name"])) . "',NOW()," . $_SESSION['user_id'] . "),"; for ($j = 0; $j < count($complex_report_room_items_array); $j++) { if ($complex_report_room_items_array[$j]["room_id"] == $complex_report_rooms_array[$i]["id"]) { $query2 .= "({$community_report_room_items_max_id}," . $_REQUEST['report_id'] . ",{$community_report_rooms_max_id}," . $complex_report_room_items_array[$j]["room_template_item_id"] . ",'" . addslashes(stripslashes($complex_report_room_items_array[$j]["name"])) . "'," . $complex_report_room_items_array[$j]["status_id"] . ",NOW()),"; $community_report_room_items_max_id += 1; } } $community_report_rooms_max_id += 1; }
<button class="btn btn-primary">Create Property</button> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> </div> </form> </div> <?php $complex_subcontractors_assign_object = new Dynamo("complex_subcontractors_assign"); $complex_subcontractors_assign_array = $complex_subcontractors_assign_object->getAll("WHERE property_id = " . $_REQUEST['id']); $community_subcontractors_ids_assign_array = array(); for ($i = 0; $i < count($complex_subcontractors_assign_array); $i++) { $community_subcontractors_ids_assign_array[$complex_subcontractors_assign_array[$i]['work_category_id']][] = $complex_subcontractors_assign_array[$i]['sub_contractor_id']; } $work_categories_object = new Dynamo("work_categories"); $work_categories_array = $work_categories_object->getAll("ORDER BY id"); $sub_contractors_object = new Dynamo("sub_contractors"); $sub_contractors_array = $sub_contractors_object->getAll("INNER JOIN sub_contractor_work_category ON sub_contractors.id = sub_contractor_work_category.sub_contractor_id ORDER BY sub_contractors.first_name"); $work_sub_contractors_array = array(); for ($i = 0; $i < count($sub_contractors_array); $i++) { if (!is_array($community_subcontractors_ids_assign_array[$sub_contractors_array[$i]['work_category_id']])) { $community_subcontractors_ids_assign_array[$sub_contractors_array[$i]['work_category_id']] = array(); } if (in_array($sub_contractors_array[$i]['id'], $community_subcontractors_ids_assign_array[$sub_contractors_array[$i]['work_category_id']])) { $selected = " checked='checked'"; } else { $selected = ""; } $work_sub_contractors_array[$sub_contractors_array[$i]['work_category_id']] .= "<label style='float:left;width:150px;padding-right:20px;white-space:nowrap'><input type=\"checkbox\" class=\"sub_contractor_id_sub\" name='' value='" . $sub_contractors_array[$i]['id'] . "'" . $selected . " /> " . $sub_contractors_array[$i]['first_name'] . " " . $sub_contractors_array[$i]['last_name'] . "</label>"; } ?> <div id="editSubcontractorsModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
$query = "DELETE FROM community_report_rooms WHERE report_id IN ({$string_community_report})"; $community_reports_obj->customExecuteQuery($query); $query = "DELETE FROM community_report_room_items WHERE report_id IN({$string_community_report})"; $community_reports_obj->customExecuteQuery($query); } $query = "DELETE FROM community_properties WHERE id = " . $_GET['id']; $community_reports_obj->customExecuteQuery($query); $query = "DELETE FROM community_reports WHERE property_id = " . $_GET['id']; $community_reports_obj->customExecuteQuery($query); $query = "DELETE FROM community_subcontractors_assign WHERE property_id = " . $_GET['id']; $community_reports_obj->customExecuteQuery($query); } $community_properties_object = new Dynamo("community_properties"); $list_community_properties = array(); if ($community_properties_object) { $list_community_properties = $community_properties_object->getAll(); } ?> <div class="pull-left"><h4>Community List</h4></div> <div class="pull-right"><a href="add_community.html" class="btn btn-warning"><i class="icon-plus icon-white"></i> Add Community</a></div> <div class="clearfix"></div> <div id="status-message"></div> <table class="common-table"> <tr> <th>Community Name</th> <th>Date Created</th> <th></th> <?php if ($_SESSION['user_type'] == 1) {
$complex_reports_obj = new Dynamo("complex_reports"); $complex_reports_array = $complex_reports_obj->getAll("WHERE property_id = " . $complexPropertyId); $community_reports_obj = new Dynamo("community_reports"); $complex_report_rooms_obj = new Dynamo("complex_report_rooms"); $community_report_rooms_obj = new Dynamo("community_report_rooms"); $complex_report_room_items_obj = new Dynamo("complex_report_room_items"); $community_report_room_items_obj = new Dynamo("community_report_room_items"); if (count($complex_reports_array) > 0) { $query = "INSERT INTO community_reports(`id`,`property_id`,`date_reported`,`status_id`,`reported_by`,`is_submitted`,`is_saved`,`is_closed`) VALUES"; $community_reports_id = $community_reports_obj->getMaxId(); $community_report_rooms_id = $community_report_rooms_obj->getMaxId(); $community_report_room_items_id = $community_report_room_items_obj->getMaxId(); for ($i = 0; $i < count($complex_reports_array); $i++) { $query .= "({$community_reports_id},{$propertyId},NOW(),0,{$userId},0,0,0),"; $complex_report_rooms_array = $complex_report_rooms_obj->getAll("WHERE report_id = " . $complex_reports_array[$i]["id"]); $complex_report_room_items_array = $complex_report_room_items_obj->getAll("WHERE report_id = " . $complex_reports_array[$i]["id"]); if (count($complex_report_rooms_array) > 0) { //add report rooms if (trim($query2) == '') { $query2 = "INSERT INTO community_report_rooms(`id`,`report_id`,`room_template_id`,`name`,`date_created`,`created_by`) VALUES"; } //add report room items if (count($complex_report_room_items_array) > 0 && trim($query3) == '') { $query3 = "INSERT INTO community_report_room_items(`id`,`report_id`,`room_id`,`room_template_item_id`,`name`,`status_id`,`date_created`) VALUES"; } for ($j = 0; $j < count($complex_report_rooms_array); $j++) { $query2 .= "({$community_report_rooms_id},{$community_reports_id}," . $complex_report_rooms_array[$j]['room_template_id'] . ",'" . addslashes(stripslashes($complex_report_rooms_array[$j]['name'])) . "',NOW(),{$userId}),"; if (count($complex_report_room_items_array) > 0) { for ($k = 0; $k < count($complex_report_room_items_array); $k++) { if ($complex_report_rooms_array[$j]['id'] == $complex_report_room_items_array[$k]['room_id']) { $query3 .= "({$community_report_room_items_id},{$community_reports_id},{$community_report_rooms_id}," . $complex_report_room_items_array[$k]['room_template_item_id'] . ",'" . addslashes(stripslashes($complex_report_room_items_array[$k]['name'])) . "',2,NOW()),";
<?php require_once dirname(dirname(dirname(__FILE__))) . '/modules/Property.class.php'; require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; $propertyObj = new Property(); $listProperties = array(); if ($propertyObj) { $listProperties = $propertyObj->getArchivedProperties(false); } $report_images = new Dynamo("report_images"); $array_property_images = $report_images->getAll("WHERE property_image = 1"); if (count($array_property_images) > 0) { $array_property_images2 = array(); for ($i = 0; $i < count($array_property_images); $i++) { $array_property_images2[$array_property_images[$i]['property_id']] = $array_property_images[$i]; } $array_property_images = $array_property_images2; } ?> <div class="pull-left"><h4>Archived Properties</h4></div> <div class="pull-right"> <form id="searchPropertyForm" method="POST" onsubmit="return false"> <input type="text" name="searchProperties" id="searchProperties" class="input-large search-query" placeholder="Search Archived Properties" /> <div id="loading_search_archives_image"><img src="images/loading.gif" /></div><div class="clearfix"></div> <input type="hidden" id="baseName" name="baseName" value="<?php echo __BASENAME__; ?> " /> </form> </div>
if (trim($_GET['reportId']) != '') { $report_id = $_REQUEST['report_id'] = $_GET['reportId']; $image_filename = $report_id . "_" . $imageId . "." . $array_file[count($array_file) - 1]; } else { if (trim($_GET['propertyId']) != '') { $_REQUEST['report_id'] = ''; $image_filename = $property_id . "_" . $imageId . "." . $array_file[count($array_file) - 1]; } } $result = $uploader->save(dirname(dirname(__FILE__)) . '/images/report_uploads/' . $image_filename); if ($result) { $_REQUEST['image_name'] = $image_filename; $_REQUEST['date'] = date("Y-m-d H:i:s", time()); $_REQUEST['user_id'] = $_SESSION['user_id']; $array_images_exist = array(); $array_images_exist = $report_images->getAll("WHERE property_id = " . $property_id); if (count($array_images_exist) > 0) { $_REQUEST['property_image'] = 0; } else { $_REQUEST['property_image'] = 1; } $report_images->add(); ?> {error:"true",filename:"<?php print $_REQUEST['image_name']; ?> "} <?php } else { ?> {error:"false"}
$community_subcontractors_assign_array = $community_subcontractors_assign_object->getAll("WHERE property_id = " . $community_properties_array['id']); //if there are reports there must be rooms if (count($community_reports_array) > 0) { $report_id = $community_reports_array['id']; $community_report_rooms_object = new Dynamo("community_report_rooms"); $report_rooms_object = new Dynamo("report_rooms"); //fetch all the report rooms $community_report_rooms = $community_report_rooms_object->getAll("WHERE report_id = " . $report_id . " ORDER BY id"); $community_report_room_items_object = new Dynamo("community_report_room_items"); $report_room_items_object = new Dynamo("report_room_items"); //fetch the room items $community_report_room_items_array = $community_report_room_items_object->getAll("WHERE report_id = " . $report_id . " ORDER BY room_id"); //fetch comments $community_report_room_item_comments_object = new Dynamo("community_report_room_item_comments"); $report_room_item_comments_object = new Dynamo("report_room_item_comments"); $community_report_room_item_comments_array = $community_report_room_item_comments_object->getAll("WHERE report_id = " . $report_id); } } $tools = new Tools(); for ($i = 0; $i < count($property_array); $i++) { //$next_property_id = $properties_object->getMaxId(); $query = "SHOW TABLE STATUS LIKE 'properties'"; $property_table_array = $properties_object->customFetchQuery($query); $next_property_id = $property_table_array[0]['Auto_increment']; $_REQUEST['name'] = addslashes(stripslashes($property_array[$i]->name)); $_REQUEST['address'] = addslashes(stripslashes($property_array[$i]->lot_address)); $_REQUEST['map_link'] = addslashes(stripslashes($property_array[$i]->map_link)); //$tools->convertArrayToRequest($community_properties_array); $query = "INSERT INTO properties (`id`,`name`,`address`,`city`,`map_link`,`estimates_multiplier`,`zip`,\n\t\t\t`property_type`,`job_type`,`community`,`date_created`,`status`,`created_by`,`emails`,`estimates_emails`)\n\t\t\tVALUES('" . $next_property_id . "','" . $_REQUEST['name'] . "','" . $_REQUEST['address'] . "','" . addslashes(stripslashes($community_properties_array["city"])) . "'\n\t\t\t,\"" . $_REQUEST['map_link'] . "\",\"" . $community_properties_array["estimates_multiplier"] . "\",\"" . $community_properties_array["zip"] . "\"," . $community_properties_array["property_type"] . "\n\t\t\t," . $community_properties_array["job_type"] . ",'" . addslashes(stripslashes($community_properties_array["community"])) . "',NOW()\n\t\t\t," . $community_properties_array["status"] . "," . $_SESSION['user_id'] . ",\"" . $community_properties_array["emails"] . "\",\"" . $community_properties_array["estimates_emails"] . "\")"; //end test area //add properties
<?php if (!isset($_SESSION)) { session_start(); } require_once dirname(dirname(__FILE__)) . '/modules/Dynamo.class.php'; if (trim($_REQUEST['image_name']) != '') { if (stristr($_REQUEST['image_name'], "/")) { $array_url = explode("/", $_REQUEST['image_name']); $image_name = $array_url[count($array_url) - 1]; } else { $image_name = $_REQUEST['image_name']; } $report_images = new Dynamo("report_images"); $array_image = $report_images->getAll("WHERE image_name = \"{$image_name}\""); $array_image = $array_image[0]; if (count($array_image) > 0) { $report_images->customExecuteQuery("UPDATE report_images SET property_image = 0 WHERE property_id = " . $array_image["property_id"]); $report_images->customExecuteQuery("UPDATE report_images SET property_image = 1 WHERE id = " . $array_image["id"]); } }
<?php if (!isset($_SESSION)) { session_start(); } define('__ROOT__', dirname(dirname(__FILE__))); define('__BASENAME__', basename(__ROOT__)); require_once __ROOT__ . '/modules/Dynamo.class.php'; $result['success'] = false; $result['message'] = ''; $room_template_estimates_obj = new Dynamo("room_template_estimates"); $unitsObj = new Dynamo("units"); $units_array = $unitsObj->getAll(); if (trim($_POST['roomTemplateItemsId']) != '') { $array_room_template_estimates = $room_template_estimates_obj->getAll("WHERE room_template_items_id = " . $_POST['roomTemplateItemsId'] . " ORDER BY item_name"); if (count($array_room_template_estimates) > 0) { $result['success'] = true; //$result['message'] = $array_room_template_estimates; $result['message'] = '<div id="accordion" class="panel-group">'; for ($i = 0; $i < count($array_room_template_estimates); $i++) { $result['message'] .= '<div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a href="#panel' . ($i + 1) . '" data-parent="#accordion" data-toggle="collapse" class="accordion-toggle collapsed"><i class="glyphicon glyphicon-plus"></i>' . $array_room_template_estimates[$i]['item_name'] . '</a> </h4> </div> <div class="panel-collapse collapse" id="panel' . ($i + 1) . '" style="height: 0px;"> <div class="panel-body"> <div class="estimatestemplate_row"> <div class="estimatestemplate_left">
} else { break; } } $daily_logs_images_object = new Dynamo("daily_logs_images"); //image upload if (trim($_FILES['image_name']['name'][0]) != '') { for ($i = 0; $i < count($_FILES['image_name']['name']); $i++) { $filename = $_FILES['image_name']['name'][$i] = strtolower($_FILES['image_name']['name'][$i]); $file_ext = strrchr($filename, '.'); $whitelist = array(".jpg", ".jpeg", ".gif", ".png"); if (!in_array($file_ext, $whitelist)) { die("Please upload either a jpeg, gif or png"); } $_FILES['image_name']['name'][$i] = $tools->replaceBadCharactersImage($_FILES['image_name']['name'][$i]); $arrayCheckImageExists = $daily_logs_images_object->getAll("WHERE image_name = \"" . addslashes($_FILES['image_name']['name'][$i]) . "\""); if (count($arrayCheckImageExists) > 0) { $_FILES['image_name']['name'][$i] = str_replace(".", time() . ".", $_FILES['image_name']['name'][$i]); } if (trim($_FILES['image_name']['name'][$i]) != '') { $_FILES['image_name']['name'][$i] = strtolower($_FILES['image_name']['name'][$i]); } if (move_uploaded_file($_FILES['image_name']['tmp_name'][$i], "images/daily_log_uploads/" . $_FILES['image_name']['name'][$i])) { $query = "INSERT INTO daily_logs_images (`daily_logs_id`,`image_name`,`timestamp`) VALUES(" . $_REQUEST['daily_logs_id'] . ",\"" . addslashes($_FILES['image_name']['name'][$i]) . "\",NOW())"; $daily_logs_images_object->customExecuteQuery($query); } } } } ?> <script type="text/javascript">
} </script> </td> </tr>'; } $result['message'] .= '</table>'; } $result['message'] .= '</div> </div> </div> </div>'; } $result['message'] .= '</div>'; //subcontractors if (count($subcontractor_array) > 0) { $subcontractors_assign_array_copy = $subcontractors_assign_obj->getAll("WHERE property_id = " . $_REQUEST['propertyId'] . " AND work_category_id = " . $room_template_items_array[0]['work_category_id']); $subcontractors_assign_array = array(); if (count($subcontractors_assign_array_copy) > 0) { for ($i = 0; $i < count($subcontractors_assign_array_copy); $i++) { $subcontractors_assign_array[$subcontractors_assign_array_copy[$i]['sub_contractor_id']] = $subcontractors_assign_array_copy[$i]; } } $result['message'] .= '<table><tr><td colspan="2"><br />'; $result['message'] .= '<strong style="font-size:15px;color:#353535;">Please select the subcontractors you\'d like to use:</strong><br />'; $result['message'] .= '<input type="hidden" name="work_category_id" id="work_category_id" value="' . $room_template_items_array[0]['work_category_id'] . '" />'; for ($i = 0; $i < count($subcontractor_array); $i++) { $result['message'] .= '<label><input type="checkbox" name="subcontractor_id" class="subcontractor_id" value="' . $subcontractor_array[$i]['sub_contractor_id'] . '"' . ($subcontractors_assign_array[$subcontractor_array[$i]['sub_contractor_id']] ? " checked=\"checked\"" : "") . ' /> ' . $subcontractor_array[$i]['first_name'] . " " . $subcontractor_array[$i]['last_name'] . "</label>"; } $result['message'] .= '<br /></td></tr></table>'; } $result['message'] .= '<script type="text/javascript">
<?php if (!isset($_SESSION)) { session_start(); } define('__ROOT__', dirname(dirname(__FILE__))); define('__BASENAME__', basename(__ROOT__)); require_once __ROOT__ . '/modules/Room.class.php'; require_once __ROOT__ . '/modules/Dynamo.class.php'; $id = !isset($_POST['id']) ? "" : $_POST['id']; $roomObj = new Room(); $roomObj->deleteCommunityRoom($id); if (trim($_POST['reportId']) != '') { $array_report_rooms = array(); $community_report_rooms_obj = new Dynamo("community_report_rooms"); $array_report_rooms = $community_report_rooms_obj->getAll("WHERE report_id = " . $_POST['reportId']); if (count($array_report_rooms) <= 0) { $query = "DELETE FROM community_reports WHERE id = " . $_POST['reportId']; $community_report_rooms_obj->customExecuteQuery($query); } }
$daily_logs_images_object->customExecuteQuery($query); } } } } //image upload if (trim($_FILES['image_name']['name'][0]) != '') { for ($i = 0; $i < count($_FILES['image_name']['name']); $i++) { $filename = $_FILES['image_name']['name'][$i] = strtolower($_FILES['image_name']['name'][$i]); $file_ext = strrchr($filename, '.'); $whitelist = array(".jpg", ".jpeg", ".gif", ".png"); if (!in_array($file_ext, $whitelist)) { die("Please upload either a jpeg, gif or png"); } $_FILES['image_name']['name'][$i] = $tools->replaceBadCharactersImage($_FILES['image_name']['name'][$i]); $arrayCheckImageExists = $daily_logs_images_object->getAll("WHERE image_name = \"" . addslashes($_FILES['image_name']['name'][$i]) . "\""); if (count($arrayCheckImageExists) > 0) { $_FILES['image_name']['name'][$i] = str_replace(".", time() . ".", $_FILES['image_name']['name'][$i]); } if (trim($_FILES['image_name']['name'][$i]) != '') { $_FILES['image_name']['name'][$i] = strtolower($_FILES['image_name']['name'][$i]); } if (move_uploaded_file($_FILES['image_name']['tmp_name'][$i], "images/daily_log_uploads/" . $_FILES['image_name']['name'][$i])) { $query = "INSERT INTO daily_logs_images (`daily_logs_id`,`image_name`,`timestamp`) VALUES(" . $_REQUEST['daily_logs_id'] . ",\"" . addslashes($_FILES['image_name']['name'][$i]) . "\",NOW())"; $daily_logs_images_object->customExecuteQuery($query); } } } ?> <script type="text/javascript"> window.onload = function() {
if (!$propertyInfo) { echo "No property found."; return; } $reportObj = new Report(); $reportInfo = $reportObj->getReportDetails($reportId, false); if ($_SESSION['user_type'] == 5) { $subcontractors_assign_obj = new Dynamo("subcontractors_assign"); $subcontractor_array = $subcontractors_assign_obj->getAll("WHERE property_id = " . $propertyId . " AND sub_contractor_id = " . $_SESSION['user_id']); $subcontractor_work_category_ids_array = array(); for ($i = 0; $i < count($subcontractor_array); $i++) { $subcontractor_work_category_ids_array[] = $subcontractor_array[$i]['work_category_id']; } } $report_images = new Dynamo("report_images"); $array_report_images_count = $report_images->getAll("WHERE property_id = " . $propertyId); $array_report_images = $report_images->getAllWithId_default("WHERE property_id = " . $propertyId, 'room_item_id'); for ($i = 0; $i < count($array_report_images_count); $i++) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['count'] += 1; if ($array_report_images_count[$i]['image_name'] != $array_report_images[$array_report_images_count[$i]['room_item_id']]['image_name']) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['extra_images'] .= $array_report_images_count[$i]['image_name'] . ","; } } ?> <!-- ADD REPORT --> <form method="POST" class="form-horizontal" id="addReportForm" onSubmit="return false"> <input type="hidden" id="_BASENAME" name="baseName" value="<?php echo __BASENAME__; ?> " /> <input type="hidden" id="_USERID" name="userId" value="<?php
$estimatesArray = $estimates_obj->getAll("WHERE property_id = " . $propertyId . " AND is_saved = 1"); $estimatesArray = $estimatesArray[0]; $reportObj = new Report(); $estimatesObj = new Estimates(); $usersObj = new Dynamo("users"); $array_users = $usersObj->getAllWithId_default(false, "id"); $subContractorsObj = new Dynamo("sub_contractors"); $array_sub_contractors = $subContractorsObj->getAllWithId_default(false, "id"); $companiesObj = new Dynamo("companies"); $array_companies = $companiesObj->getAllWithId_default(false, "id"); $dailyLogsObj = new Dynamo("daily_logs"); /*$reportObj = new Report(); $reports = $reportObj->getReportsSummary($propertyId, false,$array_users,$array_sub_contractors,$array_companies);**/ $reports = $reportObj->getReportsSummary($propertyId, false, $array_users, $array_sub_contractors, $array_companies); $estimates = $estimatesObj->getEstimatesSummary($propertyId, false, $array_users, $array_companies); $daily_logs = $dailyLogsObj->getAll("WHERE property_id = " . $propertyId . " ORDER BY timestamp DESC"); $array_reports_estimates = array(); for ($i = 0; $i < count($reports); $i++) { $reports[$i]['report'] = true; $array_reports_estimates[strtotime($reports[$i]['dateReported'])] = $reports[$i]; } for ($i = 0; $i < count($estimates); $i++) { $array_reports_estimates[strtotime($estimates[$i]['dateReported'])] = $estimates[$i]; } for ($i = 0; $i < count($daily_logs); $i++) { if ($daily_logs[$i]['closed'] == 1) { $isClosed = 1; $isSaved = 0; $isSubmitted = 1; } else { $isClosed = 0;
<?php require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; $units = new Dynamo("units"); $unitsArray = array(); if ($units) { $unitsArray = $units->getAll(); } ?> <div class="pull-left"><h4>Units</h4></div> <div class="pull-right"><a href="add_unit.html" class="btn btn-warning"><i class="icon-plus icon-white"></i> Add Unit</a></div> <div class="clearfix"></div> <div id="status-message"></div> <div class="container"> <?php if (count($unitsArray) > 0) { foreach ($unitsArray as $unit) { $id = $unit['id']; $estimate_unit = $unit['estimate_unit']; ?> <div class="row property-list-row" id="templateRow_<?php echo $id; ?> "> <div class="pull-left"> <h2><?php echo stripslashes($estimate_unit); ?> </h2>
$query = "DELETE FROM complex_report_rooms WHERE report_id IN ({$string_community_report})"; $complex_reports_obj->customExecuteQuery($query); $query = "DELETE FROM community_report_room_items WHERE report_id IN({$string_community_report})"; $complex_reports_obj->customExecuteQuery($query); } $query = "DELETE FROM complex_properties WHERE id = " . $_GET['id']; $complex_reports_obj->customExecuteQuery($query); $query = "DELETE FROM complex_reports WHERE property_id = " . $_GET['id']; $complex_reports_obj->customExecuteQuery($query); $query = "DELETE FROM complex_subcontractors_assign WHERE property_id = " . $_GET['id']; $complex_reports_obj->customExecuteQuery($query); } $complex_properties_object = new Dynamo("complex_properties"); $list_complex_properties = array(); if ($complex_properties_object) { $list_complex_properties = $complex_properties_object->getAll(); } ?> <div class="pull-left"><h4>Complex List</h4></div> <div class="pull-right"><a href="add_complexes.html" class="btn btn-warning"><i class="icon-plus icon-white"></i> Add Complex</a></div> <div class="clearfix"></div> <div id="status-message"></div> <table class="common-table"> <?php if (count($list_complex_properties) > 0) { ?> <tr> <th>Complex Name</th> <th>Date Created</th>
if (!$propertyInfo) { echo "No property found."; return; } $reportObj = new Report(); $reportInfo = $reportObj->getReportDetails($reportId, false); if ($_SESSION['user_type'] == 5) { $subcontractors_assign_obj = new Dynamo("subcontractors_assign"); $subcontractor_array = $subcontractors_assign_obj->getAll("WHERE property_id = " . $propertyId . " AND sub_contractor_id = " . $_SESSION['user_id']); $subcontractor_work_category_ids_array = array(); for ($i = 0; $i < count($subcontractor_array); $i++) { $subcontractor_work_category_ids_array[] = $subcontractor_array[$i]['work_category_id']; } } $report_images = new Dynamo("report_images"); $array_report_images_count = $report_images->getAll("WHERE property_id = " . $reportInfo['propertyId']); $array_report_images = $report_images->getAllWithId_default("WHERE property_id = " . $reportInfo['propertyId'], 'room_item_id'); for ($i = 0; $i < count($array_report_images_count); $i++) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['count'] += 1; if ($array_report_images_count[$i]['image_name'] != $array_report_images[$array_report_images_count[$i]['room_item_id']]['image_name']) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['extra_images'] .= $array_report_images_count[$i]['image_name'] . ","; } } ?> <!-- ADD REPORT --> <form method="POST" class="form-horizontal" id="addReportForm" onSubmit="return false"> <input type="hidden" id="_BASENAME" name="baseName" value="<?php echo __BASENAME__; ?> " /> <input type="hidden" id="_USERID" name="userId" value="<?php
<?php require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; if (trim($_REQUEST['id']) != '') { $work_categories = new Dynamo("work_categories"); $work_category = $work_categories->getOne(); $parent_work_categories = $work_categories->getAll("WHERE parent_id = 0"); if (count($work_category) > 0) { ?> <form method="POST" class="form-horizontal" id="workCategoryForm"> <input type="hidden" id="baseName" name="baseName" value="<?php echo __BASENAME__; ?> " /> <input type="hidden" id="id" name="id" value="<?php print $work_category['id']; ?> " /> <input type="hidden" id="date_created" name="date_created" value="<?php print $work_category['date_created']; ?> " /> <div class="pull-left"><h4>Edit Work Category</h4></div> <div class="pull-right"><button class="btn btn-warning" type="submit">Submit Changes</button> <a href="work_categories.html" class="btn btn-default">Cancel</a></div> <div class="clearfix"></div> <div id="status-message"></div> <?php if (count($parent_work_categories) > 0) { ?> <div class="control-group">
$copy_from_report = true; } } if (count($estimateInfo['rooms']) > 0) { $estimates_obj = new Dynamo("estimates"); $room_templates_obj = new Dynamo("room_templates"); $estimate_rooms_obj = new Dynamo("estimate_rooms"); $estimate_room_items_obj = new Dynamo("estimate_room_items"); $estimate_room_items_units_obj = new Dynamo("estimate_room_items_units"); $room_template_items_obj = new Dynamo("room_template_items"); //get previous room item units if (!$copy_from_report) { $estimate_room_items_units_array = $estimate_room_items_units_obj->getAll("WHERE estimate_id = " . $estimatesId); } $estimatesId = $_REQUEST['estimatesId'] = $estimates_obj->getMaxId(); $room_template_items_array = $room_template_items_obj->getAll(); $query = "INSERT INTO estimates (`id`,`property_id`,`date_created`,`reported_by`,`is_submitted`,`is_saved`,`is_closed`) \n\t\tVALUES(" . $_REQUEST['estimatesId'] . "," . $estimateInfo['propertyId'] . ",NOW()," . $_SESSION['user_id'] . ",1,0,2)"; $estimates_obj->customExecuteQuery($query); if (count($estimateInfo['rooms']) > 0) { $query = "INSERT INTO estimate_rooms VALUES"; $query2 = "INSERT INTO estimate_room_items (`id`,`estimate_id`,`room_id`,`room_template_item_id`,`name`,`date_created`) VALUES"; if (count($estimate_room_items_units_array) > 0) { $query3 = "INSERT INTO estimate_room_items_units VALUES"; } $query_first = false; $query_second = false; $query_third = false; $maxIdEstimateRooms = $estimate_rooms_obj->getMaxId(); $estimateRoomMaxId = $estimate_room_items_obj->getMaxId(); $estimateRoomItemsUnitsMaxId = $estimate_room_items_units_obj->getMaxId(); for ($i = 0; $i < count($estimateInfo['rooms']); $i++) {
$_REQUEST['created_by'] = $_REQUEST['userId']; $_REQUEST['emails'] = $_REQUEST['emails']; $community_properties_array = $community_properties_object->getOne(); $_REQUEST['date_created'] = $community_properties_array["date_created"]; if ($community_properties_object->edit()) { $result['success'] = true; $result['message'] = 'Community successfully edited!'; if (trim($_REQUEST['data']) != '') { $_REQUEST['property_id'] = $_REQUEST['id']; $_REQUEST['date_reported'] = date("Y-m-d H:i:s", time()); $_REQUEST['status_id'] = 0; $_REQUEST['user_id'] = $_REQUEST['created_by'] = $_REQUEST['reported_by'] = $_REQUEST['userId']; $_REQUEST['is_submitted'] = 0; $_REQUEST['is_saved'] = 0; $_REQUEST['is_closed'] = 0; $community_reports_array = $community_reports_object->getAll("WHERE property_id = " . $_REQUEST['property_id']); if (count($community_reports_array) <= 0 || !is_array($community_reports_array)) { $report_id = $_REQUEST['report_id'] = $community_reports_object->getMaxId(); if (!$community_reports_object->add()) { $result['success'] = false; $result['message'] = 'Sorry, there has been a problem processing your request.'; } } else { $community_reports_array = $community_reports_array[0]; $report_id = $_REQUEST['report_id'] = $community_reports_array['id']; } $array_data = json_decode($_REQUEST['data']); if (count($array_data) > 0) { $community_report_rooms_object->deleteCustom("WHERE report_id = " . $report_id); $community_report_room_items_object->deleteCustom("WHERE report_id = " . $report_id); $community_report_room_item_comments->deleteCustom("WHERE report_id = " . $report_id);
exit;*/ $roomObj = new Room(); $listRoomTemplates = $roomObj->getRoomTemplates(false); $reportObj = new Report(); if ($propertyId != 0) { $propertyObj = new Property(); $propertyInfo = $propertyObj->getPropertyInfo($propertyId, false); if (!$propertyInfo) { echo "No property found."; return; } $reportId = $reportObj->getPreviousReportId($propertyId, false); $reportInfo = $reportObj->getReportDetails($reportId, false); } $complex_properties_obj = new Dynamo("complex_properties"); $complex_properties_array = $complex_properties_obj->getAll("ORDER BY id"); ?> <div id="community_left"> <form method="POST" class="form-horizontal" id="addPropertyForm" onsubmit="return false;"> <input type="hidden" id="baseName" name="baseName" value="<?php echo __BASENAME__; ?> " /> <input type="hidden" id="userId" name="userId" value="<?php echo $_SESSION['user_id']; ?> " /> <div class="pull-left"><h4>Add Community</h4></div> <div class="clearfix"></div> <div id="status-message"></div>
<?php require_once 'config/main.config.php'; require_once 'modules/Dynamo.class.php'; require_once 'modules/attach_mailer_class.php'; require_once 'mpdf/mpdf60/mpdf.php'; $subcontractor_emails_obj = new Dynamo("subcontractor_emails"); $array_emails = $subcontractor_emails_obj->getAll("WHERE sent = 0"); $users_obj = new Dynamo("users"); $companyAdminArray = $users_obj->getAll("WHERE user_type = 2 AND is_active = 1"); $email_message = ''; for ($i = 0; $i < count($array_emails); $i++) { $email_message .= "<h2 style='color:#666;'>Subcontractor Report #" . ($i + 1) . "</h2>"; $email_message .= $array_emails[$i]['emailBody']; } $companyAdminEmails = ''; for ($i = 0; $i < count($companyAdminArray); $i++) { $companyAdminEmails .= $companyAdminArray[$i]['email'] . ","; } if (trim($email_message) != '' && trim($companyAdminEmails) != '') { $companyAdminEmails = substr($companyAdminEmails, 0, -1); $host_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname(dirname($_SERVER['PHP_SELF'])), '/\\'); $pdf_file = "mpdf/pdfs/sub_contractor_report.pdf"; @unlink($pdf_file); @shell_exec("rm -rf " . $pdf_file); $emailBody_pdf = str_replace("<img src='{$host_url}", "<img src='", str_replace("<img src='{$host_url}/", "<img src='", str_replace("<img src=\"{$host_url}/", "<img src=\"", $email_message))); preg_match_all("/<img src=[\"\\'](.*?)[\"\\']/i", $emailBody_pdf, $array); for ($i = 0; $i < count($array[1]); $i++) { if (!file_exists($array[1][$i])) { $emailBody_pdf = str_replace($array[1][$i], "", $emailBody_pdf); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; $sub_contractors = new Dynamo("sub_contractors"); $work_categories = new Dynamo("work_categories"); if ($_SESSION['user_type'] == 5) { $readonly = true; } else { $readonly = false; } $work_categories_array = $work_categories->getAll("WHERE parent_id = 0"); $sub_contractor_work_category = new Dynamo("sub_contractor_work_category"); if (trim($_REQUEST['id']) != '') { $array_sub_contractor = $sub_contractors->getOne(); if (count($array_sub_contractor) > 0) { $array_sub_work = $sub_contractor_work_category->getAllWithId_default("WHERE sub_contractor_id = " . $_REQUEST['id'], "work_category_id"); ?> <form method="POST" class="form-horizontal" id="addSubContractorForm" onSubmit="return false;"> <input type="hidden" id="baseName" name="baseName" value="<?php echo __BASENAME__; ?> " /> <input type="hidden" id="id" name="id" value="<?php print $_REQUEST['id']; ?> " /> <div class="pull-left"><h4>View SubContractor</h4></div> <div class="pull-right"><button class="btn btn-warning" type="submit">Submit Changes</button> <?php if ($_SESSION['user_type'] != 5) { ?>
<?php require_once dirname(dirname(dirname(__FILE__))) . '/modules/Report.class.php'; require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; $reportId = isset($_GET['reportId']) ? $_GET['reportId'] : 0; if ($reportId != 0) { $reportObj = new Report(); $usersObj = new Dynamo("users"); $array_users = $usersObj->getAllWithId_default(false, "id"); $subContractorsObj = new Dynamo("sub_contractors"); $array_sub_contractors = $subContractorsObj->getAllWithId_default(false, "id"); $reportInfo = $reportObj->getReportDetails($reportId, false, $array_users, $array_sub_contractors); $report_images = new Dynamo("report_images"); $array_report_images_count = $report_images->getAll("WHERE property_id = " . $reportInfo['propertyId']); $array_report_images = $report_images->getAllWithId_default("WHERE property_id = " . $reportInfo['propertyId'], 'room_item_id'); for ($i = 0; $i < count($array_report_images_count); $i++) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['count'] += 1; if ($array_report_images_count[$i]['image_name'] != $array_report_images[$array_report_images_count[$i]['room_item_id']]['image_name']) { $array_report_images[$array_report_images_count[$i]['room_item_id']]['extra_images'] .= $array_report_images_count[$i]['image_name'] . ","; } } $main_image_array = $report_images->getAll("WHERE property_image = 1 AND property_id = " . $reportInfo['propertyId']); if (count($main_image_array) > 0) { $main_image_array = $main_image_array[0]; } ?> <form method="POST" class="form-horizontal" id="addReportForm" onsubmit="return false"> <input type="hidden" id="_BASENAME" name="baseName" value="<?php echo __BASENAME__; ?>
?> </textarea></p> <p>RENTAL EQUIPMENT & MATERIAL DELIVERIES/RETURNS<br /> <p><textarea name="rental_equipment_material_deliveries" id="rental_equipment_material_deliveries" class="textarea_daily_log" disabled><?php if (count($daily_logs_array) > 0) { print $daily_logs_array["rental_equipment_material_deliveries"]; } ?> </textarea></p> <p>GENERAL COMMENTS<br /> <p><textarea name="general_comments" id="general_comments" class="textarea_daily_log" disabled><?php if (count($daily_logs_array) > 0) { print $daily_logs_array["general_comments"]; } ?> </textarea></p> <p> <div style="width:75%;margin:0 auto;text-align:left;"> <?php $daily_logs_images_array = $daily_logs_images_object->getAll("WHERE daily_logs_id = " . $_REQUEST["daily_logs_id"] . " ORDER BY timestamp"); for ($i = 0; $i < count($daily_logs_images_array); $i++) { print "<div style='float:left;padding:10px;'><a href='images/daily_log_uploads/" . $daily_logs_images_array[$i]["image_name"] . "'><img src='images/daily_log_uploads/" . $daily_logs_images_array[$i]["image_name"] . "' style='height:100px;margin-right:5px;margin-bottom:5px;' /></a>\n\t\t\t\t\t<textarea name='image_" . $daily_logs_images_array[$i]['id'] . "' placeholder='ADD IMAGE NOTE' style='width:150px;' disabled='disabled'>" . $daily_logs_images_array[$i]["image_notes"] . "</textarea> \n\t\t\t\t\t</div>"; } if (count($daily_logs_images_array) > 0) { print "<div class='clear'></div>"; } ?> </div> </p> </div> <form>
require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php'; require_once dirname(dirname(dirname(__FILE__))) . '/modules/Tools.class.php'; $estimatesId = isset($_GET['estimatesId']) ? $_GET['estimatesId'] : 0; if ($estimatesId != 0) { $estimates_obj = new Dynamo("estimates"); $estimatesArray = $estimates_obj->getAll("WHERE id = " . $estimatesId); $estimatesArray = $estimatesArray[0]; $propertyId = $estimatesArray['property_id']; $arrayOtherEstimates = array(); $arrayOtherEstimates = $estimates_obj->getAll("WHERE id > " . $estimatesId . " AND property_id = " . $propertyId); $users_obj = new Dynamo("users"); $userArray = $users_obj->getAll("WHERE id = " . $estimatesArray['reported_by']); $userArray = $userArray[0]; if (trim($estimatesArray["property_id"]) != '') { $properties_obj = new Dynamo("properties"); $propertyArray = $properties_obj->getAll("WHERE id = " . $propertyId); $propertyArray = $propertyArray[0]; $estimates_multiplier = $propertyArray['estimates_multiplier']; if (!isset($estimates_multiplier) || $estimates_multiplier == 0 || $estimates_multiplier < 0) { $estimates_multiplier = 1; } $estimate_room_items_units_obj = new Dynamo("estimate_room_items_units"); $query = "SELECT eu.estimate_id,eu.units,er.room_template_id,eu.scope,re.item_name,(eu.price_per_unit*{$estimates_multiplier}) AS price_per_unit,re.unit_of_measure,eri.name,er.name AS estimate_room_name,(eu.units * eu.price_per_unit * {$estimates_multiplier}) AS total_cost\n\t\tFROM estimate_room_items_units eu \n\t\tINNER JOIN work_category_estimates re ON eu.work_category_estimates_id = re.id\n\t\tINNER JOIN estimate_room_items eri ON eri.id = eu.estimate_room_items_id\n\t\tINNER JOIN estimate_rooms er ON eri.room_id = er.id\n\t\tWHERE eu.estimate_id = " . $estimatesId . " AND eu.units != 0 ORDER BY er.room_template_id,eu.estimate_room_items_id,er.name"; $estimate_room_items_units_array = $estimate_room_items_units_obj->customFetchQuery($query); $estimatesEmailBody = "<table border='1' bordercolor='#D0D7E5' style='border:1px solid #D0D7E5;color:#fff;' cellpadding='0' cellspacing='0'>"; $email_sub_body = ''; $cost = 0; $total_cost = 0; $unitsObj = new Dynamo("units"); $unitsArray = $unitsObj->getAllWithId(); for ($i = 0; $i < count($estimate_room_items_units_array); $i++) {
$user_properties_obj->customExecuteQuery($query); $user_properties_id = $user_properties_obj->getMaxId(); if (count($_POST['propertyId']) > 0) { $query = "INSERT INTO user_properties (`id`,`user_id`,`property_id`,`timestamp`) VALUES"; for ($i = 0; $i < count($_POST['propertyId']); $i++) { $query .= "({$user_properties_id}," . $_GET['userId'] . "," . $_POST['propertyId'][$i] . ",NOW()),"; } $query = substr($query, 0, -1); $user_properties_obj->customExecuteQuery($query); } } $users_obj = new Dynamo("users"); $userArray = $users_obj->getAll("WHERE id = " . $_GET['userId']); $userArray = $userArray[0]; $properties_obj = new Dynamo("properties"); $propertyArray = $properties_obj->getAll("WHERE status = 1"); $userPropertiesArray = $user_properties_obj->getAll("WHERE user_id = " . $_GET['userId']); $userPropertyArray = array(); for ($i = 0; $i < count($userPropertiesArray); $i++) { $userPropertyArray[] = $userPropertiesArray[$i]['property_id']; } ?> <form method="POST" class="form-horizontal" id="addUserForm"> <div class="pull-left"><h4>Assign Properties to <?php print $userArray["first_name"] . " " . $userArray["last_name"]; ?> </h4></div> <div class="pull-right"><button class="btn btn-warning" type="submit">Submit Changes</button> <a href="users.html" class="btn btn-default">Cancel</a></div> <div class="clearfix"></div> <div id="status-message"></div>