/** * Delete entries * * @param array|string $where SQL WHERE clause(s) * @return int|string */ public function delete($id) { $model_activities = new Production_Model_Activity(); if ($model_activities->fetchHaveActivities($id)) { die("esta compañia tiene actividades relacionanadas"); } $model_permission_production = new Production_Model_Permissionproduction(); $model_permission_production->delete_production($id); //delete resource $table = $this->getTable(); $table->delete('id = ' . (int) $id); }
/** * Delete entries * * @param array|string $where SQL WHERE clause(s) * @return int|string */ public function delete($id) { //check the integration TODO the views and resource check $model_production = new Production_Model_Activity(); if ($model_production->fetchHaveContactClient($id)) { // die("client company"); $this->inLitter("id =" . $id); return true; // die("esta contacto esta usado como contacto cliente de una actividad"); } if ($model_production->fetchHaveContactCompany($id)) { // die("own company"); $this->inLitter("id =" . $id); return true; // die("esta contacto esta usado como contacto propio de una actividad"); } // die("va borrar"); $table = $this->getTable(); $table->delete('id = ' . (int) $id); }
function consultAction() { //get the page of the table $this->production = new Zend_Session_Namespace('production'); if ($this->production->id == null) { return $this->_helper->_redirector->gotoSimple('index', 'production', 'production'); } $page = $this->_getParam('page', 1); //get the dates for the table $model = new Production_Model_Production(); $data = $model->fetchEntryProduction(); $this->production->client_company = $data["client_companies_id"]; $this->production->own_company = $data["companies_id"]; $this->production->own_company_name = $data["own_company_name"]; $this->production->client_company_name = $data["client_company_name"]; $this->view->production = $data; //send information to the view $this->view->title = "Production Consult"; //get the dates for the table Activity $model = new Production_Model_Activity(); // Zend_Debug::dump($_SESSION); // die(); //TODO cambiar hardcode por roles que pueden verse if ($_SESSION['gpms']['role'] == "Encargado Actividad" or $_SESSION['gpms']['role'] == "public") { $data_activities = $model->fetchOwnActivities(); } else { $data_activities = $model->fetchActivities(); } if ($data_activities) { $paginator = Zend_Paginator::factory($data_activities); $production = Zend_Registry::get('production'); $paginator->setItemCountPerPage($production->paginator); $paginator->setCurrentPageNumber($page); $paginator->setPageRange($production->paginator); $this->view->paginator = $paginator; } else { $this->view->paginator = null; } //get the dates for permission $page = $this->_getParam('page', 1); //get the dates for the table $model_permission = new Production_Model_Permissionproduction(); $data_permission = $model_permission->fetchUserPermissionproductions(); //paginator if ($data) { $paginator2 = Zend_Paginator::factory($data_permission); $production = Zend_Registry::get('production'); $paginator2->setItemCountPerPage($production->paginator); $paginator2->setCurrentPageNumber($page); $paginator2->setPageRange($production->paginator); $this->view->paginator2 = $paginator2; } else { $this->view->paginator = null; } //send information to the view }
/** * Calculate the final price of one item * * @return Zend_Db_Table_Rowset_Abstract */ public function calculateFinalPrice($resources_activities_id, $price, $facturaction_type_id, $quantity) { //por hora //comprobar que es por hora el facturation_type //TODO quitar hardcode if ($facturaction_type_id == '32') { //calcular la diferencia de horas entre las fechas //restar las horas que no se trabajaron $model_activity = new Production_Model_Activity(); $hours = $model_activity->hours_activity($resources_activities_id); //multiplicar por el precio de la hora $final_price = $hours * (int) $price * $quantity; //multiplicar por el iva // $final_price=$final_price+$final_price/(int)$iva_type; return $final_price; } //por hora //comprobar que es por hora el facturation_type //TODO quitar hardcode if ($facturaction_type_id == '33') { return $price * $quantity; } }
public function permissionAction() { //check if the user select a production $this->production = new Zend_Session_Namespace('production'); if ($this->production->id == null) { return $this->_helper->_redirector->gotoSimple('index', 'production', 'production'); } $users_activity = explode(",", $_SESSION["production"]["activity_users"]); $model = new Production_Model_Activity(); $this->view->activity_users = $model->fetchUsersActivities($users_activity); }