|
|
@@ -7,7 +7,7 @@ Lib::loadClass('ProjectKosztorysCennik');
|
|
|
Lib::loadClass('UI');
|
|
|
Lib::loadClass('Response');
|
|
|
|
|
|
-class Route_UrlAction_ProjektyKosztorysBase extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
|
+class Route_ProjektyKosztorysBase extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
|
|
|
|
public $_model = array();
|
|
|
|
|
|
@@ -17,37 +17,6 @@ class Route_UrlAction_ProjektyKosztorysBase extends RouteBase {// TODO: UrlActio
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function przedmiarAction() {
|
|
|
- // TODO: check if user is allowed to run this action
|
|
|
- UI::gora();
|
|
|
- if (1 != V::get('_print', '', $_GET)) UI::menu();
|
|
|
- try {
|
|
|
- $idProject = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
|
|
|
- $idCompany = V::get('ID_COMPANY', 0, $_REQUEST, 'int');
|
|
|
- if (!$idProject) throw new Exception("Wrong param in 'ID_PROJECT' - expected integer!");
|
|
|
- $this->panel($idProject, $idCompany);
|
|
|
- $this->przedmiar($idProject, $idCompany);
|
|
|
- } catch (Exception $e) {
|
|
|
- UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
- }
|
|
|
- UI::dol();
|
|
|
- }
|
|
|
-
|
|
|
- public function zestawienieSwMikRurAction() {
|
|
|
- UI::gora();
|
|
|
- if (1 != V::get('_print', '', $_GET)) UI::menu();
|
|
|
- try {
|
|
|
- $idProject = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
|
|
|
- $idCompany = V::get('ID_COMPANY', 0, $_REQUEST, 'int');
|
|
|
- if (!$idProject) throw new Exception("Wrong param in 'ID_PROJECT' - expected integer!");
|
|
|
- $this->panel($idProject, $idCompany);
|
|
|
- $this->zestawienieSwMikRur($idProject, $idCompany);
|
|
|
- } catch (Exception $e) {
|
|
|
- UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
- }
|
|
|
- UI::dol();
|
|
|
- }
|
|
|
-
|
|
|
public function ofertaAdminAction() {
|
|
|
// TODO: check if user is allowed to run this action
|
|
|
UI::gora();
|
|
|
@@ -721,32 +690,35 @@ SQL_FUN;
|
|
|
if (User::get('ADM_ADMIN_LEVEL') > 6 || 'Pracownik' != User::getType()) return;// Only for workers with admin level < 6
|
|
|
if (1 == V::get('_print', '', $_GET)) return;// print mode
|
|
|
$task = V::get('_task', '', $_GET);
|
|
|
- ?>
|
|
|
-<div class="jumbotron">
|
|
|
- <div class="container">
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-12">
|
|
|
- <?php if ($idProject > 0) : ?>
|
|
|
- <a class="btn btn-default" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>">Kosztorys</a>
|
|
|
- <a class="btn btn-default" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_task=przedmiar&_print=1" target="_blank">Przedmiar</a>
|
|
|
- <a class="btn btn-default" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_task=zestawienieSwMikRur&_print=1" target="_blank">zestawienie (światłowód i mikrorurki)</a>
|
|
|
- <a class="btn btn-warning" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_task=oferta">oferta</a>
|
|
|
- <a class="btn btn-warning" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_task=ofertaAdmin">oferta (Admin)</a>
|
|
|
- <a class="btn btn-warning" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_task=ofertaCompany">oferta company</a>
|
|
|
- <?php endif; ?>
|
|
|
- <a class="btn btn-default" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=ofertaDefaultAdmin" target="_blank">oferta domyślna (Admin)</a>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-12">
|
|
|
-<?php
|
|
|
- switch ($task) {
|
|
|
- case 'oferta': break;
|
|
|
- case '': ?><a class="btn btn-link" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_print=1" target="_blank"><i class="glyphicon glyphicon-print"></i> Wydruk Kosztorysu</a><?php break;
|
|
|
- }
|
|
|
+
|
|
|
+ //
|
|
|
+ UI::startTag('div', ['class'=>'jumbotron']);
|
|
|
+ UI::startTag('div', ['class'=>'container']);
|
|
|
+ UI::startTag('div');
|
|
|
+ UI::startTag('div', ['class'=>'btn-group']);
|
|
|
+ if ($idProject > 0) {
|
|
|
+ $activeRoute = V::get('_route', '', $_GET);
|
|
|
+ $route = 'UrlAction_ProjektyKosztorys'; UI::link('default', "Kosztorys", "index.php?_route={$route}&ID_PROJECT={$idProject}", ['className'=>['active'=>($route == $activeRoute)]]);
|
|
|
+ UI::link('default', "Przedmiar", "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT={$idProject}&_task=przedmiar&_print=1");
|
|
|
+ UI::link('default', "Przedmiar", "index.php?_route=UrlAction_ProjektyPrzedmiarKosztorys&ID_PROJECT={$idProject}&_print=1");
|
|
|
+ UI::link('default', "zestawienie (światłowód i mikrorurki)", "index.php?_route=UrlAction_ProjektyZestawienieSwMikRurKosztorys&ID_PROJECT={$idProject}&_print=1");
|
|
|
+ // UI::link('warning', "oferta", "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT={$idProject}&_task=oferta", ['target'=>'_blank']);
|
|
|
+ // UI::link('warning', "oferta (Admin)", "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT={$idProject}&_task=ofertaAdmin", ['target'=>'_blank']);
|
|
|
+ // UI::link('warning', "oferta company", "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT={$idProject}&_task=ofertaCompany", ['target'=>'_blank']);
|
|
|
+ $route = 'UrlAction_ProjektyZamowieniaKosztorys'; UI::link('default', "Zamówienia", "index.php?_route={$route}&ID_PROJECT={$idProject}", ['className'=>['active'=>($route == $activeRoute)]]);
|
|
|
+ }
|
|
|
+ UI::link('default', "oferta domyślna (Admin)", "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=ofertaDefaultAdmin", ['target'=>'_blank']);
|
|
|
+ UI::endTag('div');// .btn-group
|
|
|
+ UI::endTag('div');
|
|
|
+ UI::startTag('div');
|
|
|
+ switch ($task) {
|
|
|
+ case 'oferta': break;
|
|
|
+ case '': ?><a class="btn btn-link" href="index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&ID_PROJECT=<?php echo $idProject; ?>&_print=1" target="_blank"><i class="glyphicon glyphicon-print"></i> Wydruk Kosztorysu</a><?php break;
|
|
|
+ }
|
|
|
+ UI::endTag('div');
|
|
|
+ UI::endTag('div');// .container
|
|
|
+ UI::endTag('div');// .jumbotron
|
|
|
?>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
<br>
|
|
|
<?php if ('ofertaAdmin' == $task) : ?>
|
|
|
<form action="" method="get" class="form-inline">
|
|
|
@@ -1073,7 +1045,7 @@ SQL_FUN;
|
|
|
// $defCennik = [ $id_zasob => [ 'price' => $price, 'ID', 'id_zasob', 'id_company', 'id_project', 'unit', 'quantity' ] ]
|
|
|
$cennik = ProjectKosztorysCennik::getCennik($idProject, $idCompany);
|
|
|
$workCennik = ProjectKosztorysCennik::getWorkCennik($idProject, $idCompany);
|
|
|
- $data = $this->getData($idProject, $admin = false);
|
|
|
+ $data = $this->getKosztorysData($idProject, $idOrder = 0, $admin = false);
|
|
|
foreach ($data['summary'] as $idLayer => $layData) {
|
|
|
foreach ($layData['data'] as $typeData) {
|
|
|
if (!$typeData['idType']) continue;
|
|
|
@@ -1119,227 +1091,6 @@ SQL_FUN;
|
|
|
return $this->_model[$idProject];
|
|
|
}
|
|
|
|
|
|
- public function fetchBudynki($idProject) {
|
|
|
- return DB::getPDO()->fetchAll("
|
|
|
- select b.*
|
|
|
- from BUILDINGS b
|
|
|
- where b.ID_PROJECT = '{$idProject}'
|
|
|
- ");
|
|
|
- }
|
|
|
- public function fetchProject($idProject) {
|
|
|
- $rows = DB::getPDO()->fetchAll("
|
|
|
- select p.*
|
|
|
- from IN7_MK_BAZA_DYSTRYBUCJI p
|
|
|
- where p.ID = '{$idProject}'
|
|
|
- ");
|
|
|
- return reset($rows);
|
|
|
- }
|
|
|
-
|
|
|
- public function zestawienieSwMikRur($idProject) {
|
|
|
- $idCompany = 0;
|
|
|
- $admin = false;
|
|
|
- $companyAdmin = false;
|
|
|
- $model = $this->getModel($idProject);
|
|
|
- //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
-
|
|
|
- $projCost = $this->getProjectCostByCennik($idProject, $idCompany);
|
|
|
- //DBG::_(true, true, "projCost", $projCost, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'projCost');
|
|
|
-?>
|
|
|
-<div class="container">
|
|
|
- <h1></h1>
|
|
|
- <table class="table">
|
|
|
- <tr>
|
|
|
- <th><?php echo $schema['nr']; ?></th>
|
|
|
- <th><?php echo $schema['title']; ?></th>
|
|
|
- <th><?php echo $schema['ownerName']; ?></th>
|
|
|
- <th style="text-align:right"><?php echo $schema['cost_total']; ?></th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><?php echo $model->idProject; ?></td>
|
|
|
- <td><?php echo $model->title; ?></td>
|
|
|
- <td><?php echo $model->ownerName; ?></td>
|
|
|
- <td style="text-align:right"><?php echo number_format($projCost['cost_total'], 2, ',', ' '); ?></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- <?php $args = $viewLayerDataArgs;
|
|
|
- $idProject = $args['idProject'];
|
|
|
- $idCompany = V::get('idCompany', 0, $args);
|
|
|
- $admin = V::get('admin', false, $args);
|
|
|
- $companyAdmin = V::get('companyAdmin', false, $args);
|
|
|
- $projCosts = V::get('projCosts', array(), $args);
|
|
|
-
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
- $conf = $schema['config'];
|
|
|
- DBG::_('DBG', '>1', "conf", $conf, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
-
|
|
|
- $summaryTypeCost = V::get('sub_costs', array(), $projCosts);
|
|
|
- $subProjCost = V::get('sub_proj', array(), $projCosts);
|
|
|
-
|
|
|
- $data = $this->getData($idProject, $admin);
|
|
|
- $dataSummary = $data['summary'];
|
|
|
- $dataSubProj = $data['by_project'];
|
|
|
- // $dataSubProj = array();
|
|
|
- // foreach ($data['by_project'] as $idSubProj => $subProjData) {
|
|
|
- // if ($idProject != $idSubProj) $dataSubProj[$idSubProj] = $subProjData;
|
|
|
- // }
|
|
|
- DBG::_('DBG', '>1', "data", $data, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
-
|
|
|
- $defCennik = ProjectKosztorysCennik::getDefaultCennik($idCompany);
|
|
|
- $cennik = ProjectKosztorysCennik::getCennik($idProject, $idCompany);
|
|
|
- $workCennik = ProjectKosztorysCennik::getWorkCennik($idProject, $idCompany);
|
|
|
- $additionalCosts = array();
|
|
|
- $additionalCosts[] = array();
|
|
|
- $additionalCosts[] = array();
|
|
|
- $additionalCosts[] = array();
|
|
|
- $additionalSummaryTypeCost = array();
|
|
|
-?>
|
|
|
-<style type="text/css">
|
|
|
-/* Print Styles */
|
|
|
-@media print {
|
|
|
- body { font-size:10px; }
|
|
|
- th, td { font-size:10px; }
|
|
|
- h1 { font-size:2em; }
|
|
|
- h2 { font-size:1.6em; }
|
|
|
- h3 { font-size:1.4em; }
|
|
|
- h4 { font-size:1.2em; }
|
|
|
-}
|
|
|
-</style>
|
|
|
-<?php if (!empty($dataSubProj)) : ?>
|
|
|
- <table class="table table-bordered">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>ID PROJ.</th>
|
|
|
- <th>ID BUDYNKU</th>
|
|
|
- <th>WŁAŚCICIEL</th>
|
|
|
- <th>ADRES</th>
|
|
|
- <th>KONTAKT</th>
|
|
|
- <th>NR DZIAŁKI</th>
|
|
|
- <th>DŁ. ŚWIATŁOWODU</th>
|
|
|
- <th>DŁ. MIKRORURKI DO KLIENTA</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <?php foreach ($dataSubProj as $idSubProj => $subProjData) : ?>
|
|
|
- <?php
|
|
|
- // 22460 Światłowód
|
|
|
- // 22467 Mikrokanalizacja do klienta
|
|
|
- $sumSwiatlo = 0;
|
|
|
- if (!empty($subProjData[22460])) foreach ($subProjData[22460] as $swiatlo) {
|
|
|
- $sumSwiatlo += $swiatlo['ilosc'];
|
|
|
- }
|
|
|
- $sumMikroRur = 0;
|
|
|
- if (!empty($subProjData[22467])) foreach ($subProjData[22467] as $mikroRur) {
|
|
|
- $sumMikroRur += $mikroRur['ilosc'];
|
|
|
- }
|
|
|
- ?>
|
|
|
- <?php $budynki = $this->fetchBudynki($idSubProj); ?>
|
|
|
- <?php $proj = $this->fetchProject($idSubProj); ?>
|
|
|
- <?php if (empty($budynki)) : ?>
|
|
|
- <tr>
|
|
|
- <td><?php echo $idSubProj; ?></td>
|
|
|
- <td>brak</td>
|
|
|
- <td><?php echo $proj['IN_NAME']; ?></td>
|
|
|
- <td><?php echo $proj['M_DISTRIBUTOR_ADDRESS']; ?></td>
|
|
|
- <td><?php echo $proj['M_DISTRIBUTOR_CONTACT']; ?></td>
|
|
|
- <td><?php echo $proj['INWDZ__obreby_i_nr_dzialek']; ?></td>
|
|
|
- <td><?php echo $sumSwiatlo; ?></td>
|
|
|
- <td><?php echo $sumMikroRur; ?></td>
|
|
|
- </tr>
|
|
|
- <?php else : ?>
|
|
|
- <?php foreach ($budynki as $bud) : ?>
|
|
|
- <tr>
|
|
|
- <td><?php echo $idSubProj; ?></td>
|
|
|
- <td><?php echo $bud['ID']; ?></td>
|
|
|
- <td><?php echo $proj['IN_NAME']; ?></td>
|
|
|
- <td><?php echo $proj['M_DISTRIBUTOR_ADDRESS']; ?></td>
|
|
|
- <td><?php echo $proj['M_DISTRIBUTOR_CONTACT']; ?></td>
|
|
|
- <td><?php echo $proj['INWDZ__obreby_i_nr_dzialek']; ?></td>
|
|
|
- <td><?php echo $sumSwiatlo; ?></td>
|
|
|
- <td><?php echo $sumMikroRur; ?></td>
|
|
|
- </tr>
|
|
|
- <?php endforeach; ?>
|
|
|
- <?php endif; ?>
|
|
|
- <?php endforeach; ?>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
-<?php endif; ?>
|
|
|
-<?php
|
|
|
- DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- }
|
|
|
-
|
|
|
- public function kosztorys($idProject) {
|
|
|
- $idCompany = 0;
|
|
|
- $admin = false;
|
|
|
- $companyAdmin = false;
|
|
|
- $priceEditJs = (1 != V::get('_print', '', $_GET));
|
|
|
- $model = $this->getModel($idProject);
|
|
|
- //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
-
|
|
|
- $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
|
|
|
- //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'projCosts', 'priceEditJs');
|
|
|
- UI::setTitleJsTag("Kosztorys wstępny robót telekomunikacyjnych [{$idProject}]");
|
|
|
-?>
|
|
|
-<div class="container">
|
|
|
- <h1>Kosztorys wstępny robót telekomunikacyjnych</h1>
|
|
|
- <table class="table">
|
|
|
- <tr>
|
|
|
- <th><?php echo $schema['nr']; ?></th>
|
|
|
- <th><?php echo $schema['title']; ?></th>
|
|
|
- <th><?php echo $schema['ownerName']; ?></th>
|
|
|
- <th style="text-align:right"><?php echo $schema['cost_total']; ?></th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><?php echo $model->idProject; ?></td>
|
|
|
- <td><?php echo $model->title; ?></td>
|
|
|
- <td><?php echo $model->ownerName; ?></td>
|
|
|
- <td style="text-align:right"><?php echo number_format($projCosts['cost_total'], 2, ',', ' '); ?></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- <?php $this->viewLayersData($viewLayerDataArgs); ?>
|
|
|
-</div>
|
|
|
-<?php
|
|
|
- DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- }
|
|
|
-
|
|
|
- public function przedmiar($idProject) {
|
|
|
- $idCompany = 0;
|
|
|
- $admin = false;
|
|
|
- $companyAdmin = false;
|
|
|
- $model = $this->getModel($idProject);
|
|
|
- //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
-
|
|
|
- $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
|
|
|
- //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- $hidePrices = true;
|
|
|
- $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'hidePrices');
|
|
|
- UI::setTitleJsTag("Przedmiar robót telekomunikacyjnych [{$idProject}]");
|
|
|
-?>
|
|
|
-<div class="container">
|
|
|
- <h1>Przedmiar robót telekomunikacyjnych</h1>
|
|
|
- <table class="table">
|
|
|
- <tr>
|
|
|
- <th><?php echo $schema['nr']; ?></th>
|
|
|
- <th><?php echo $schema['title']; ?></th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><?php echo $model->idProject; ?></td>
|
|
|
- <td><?php echo $model->title; ?></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- <?php $this->viewLayersData($viewLayerDataArgs); ?>
|
|
|
-</div>
|
|
|
-<?php
|
|
|
- DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- }
|
|
|
-
|
|
|
public function oferta($args) {
|
|
|
$idProject = $args['idProject'];
|
|
|
$idCompany = V::get('idCompany', 0, $args);
|
|
|
@@ -1388,7 +1139,7 @@ SQL_FUN;
|
|
|
$summaryTypeCost = V::get('sub_costs', array(), $projCosts);
|
|
|
$subProjCost = V::get('sub_proj', array(), $projCosts);
|
|
|
|
|
|
- $data = $this->getData($idProject, $admin);
|
|
|
+ $data = $this->getKosztorysData($idProject, $idOrder = 0, $admin);
|
|
|
$dataSummary = $data['summary'];
|
|
|
$dataSubProj = $data['by_project'];
|
|
|
// $dataSubProj = array();
|
|
|
@@ -1488,11 +1239,7 @@ SQL_FUN;
|
|
|
<?php if ($showPrices) : ?>
|
|
|
<td
|
|
|
<?php if ($priceEditJs) : ?>
|
|
|
- <?php
|
|
|
- $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=zasob";
|
|
|
- $onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '{$updateProjektyOferta}' })";
|
|
|
- ?>
|
|
|
- onClick="<?= $onClick; ?>"
|
|
|
+ onClick="return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '<?= "{$priceEditJs}&idType={$idType}&unitType=zasob"; ?>' })"
|
|
|
class="type_price-<?= $typePrice; ?>"
|
|
|
<?php endif; ?>
|
|
|
style="padding:3px 6px; text-align:right">
|
|
|
@@ -1504,11 +1251,7 @@ SQL_FUN;
|
|
|
</td>
|
|
|
<td
|
|
|
<?php if ($priceEditJs) : ?>
|
|
|
- <?php
|
|
|
- $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=robocizna";
|
|
|
- $onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '{$updateProjektyOferta}' })";
|
|
|
- ?>
|
|
|
- onClick="<?= $onClick; ?>"
|
|
|
+ onClick="return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '<?= "{$priceEditJs}&idType={$idType}&unitType=robocizna"; ?>' })"
|
|
|
<?php endif; ?>
|
|
|
style="padding:3px 6px; text-align:right">
|
|
|
<?php if ($admin || $companyAdmin) : ?>
|
|
|
@@ -1700,9 +1443,10 @@ SQL_FUN;
|
|
|
<?php endif; ?>
|
|
|
<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">
|
|
|
<script src="static/sweetalert2.min.js"></script>
|
|
|
+<?php if ($priceEditJs) : ?>
|
|
|
<script>
|
|
|
(function(){
|
|
|
- var _updateProjektyOfertaSaveLink = '<?= Request::getPathUri(); ?>index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject=<?= $idProject; ?>';
|
|
|
+ var _updateProjektyOfertaSaveLink = '<?= $priceEditJs ?>';
|
|
|
|
|
|
jQuery(document).on('p5UIBtnAjax:Kosztorys:updateProjektyOferta:click', function(e, n, payload) {
|
|
|
<?php if (DBG::isActive()) : ?>console.log('event p5UIBtnAjax:Kosztorys:updateProjektyOferta:click', n, payload);<?php endif; ?>
|
|
|
@@ -1783,52 +1527,10 @@ SQL_FUN;
|
|
|
|
|
|
})();
|
|
|
</script>
|
|
|
+<?php endif; ?>
|
|
|
<?php
|
|
|
}
|
|
|
|
|
|
- public function updateProjektyOfertaAjaxAction() {
|
|
|
- $args = array();
|
|
|
- $args['idProject'] = V::get('idProject', 0, $_GET, 'int');
|
|
|
- $args['idType'] = V::get('idType', 0, $_GET, 'int');
|
|
|
- $args['unitType'] = V::get('unitType', '', $_GET, 'word');
|
|
|
- Response::sendTryCatchJson(array($this, 'updateProjektyOfertaAjax'), $args);
|
|
|
- }
|
|
|
- public function updateProjektyOfertaAjax($args) {
|
|
|
- $idProject = V::get('idProject', 0, $args, 'int');
|
|
|
- $idType = V::get('idType', 0, $args, 'int');
|
|
|
- $unitType = V::get('unitType', '', $args, 'word');
|
|
|
- if (empty($idProject) || $idProject <= 0) throw new Exception("Wrong param idProject");
|
|
|
- if (empty($idType) || $idType <= 0) throw new Exception("Wrong param idType");
|
|
|
- if (empty($unitType) || !in_array($unitType, array('zasob', 'robocizna'))) throw new Exception("Wrong param unitType");
|
|
|
- $response = array();
|
|
|
- if (DBG::isActive()) $response['_idProject'] = $idProject;
|
|
|
- if (DBG::isActive()) $response['_idType'] = $idType;
|
|
|
- $jednostka = '';
|
|
|
- if ('robocizna' == $unitType) $jednostka = 'ROBOCIZNA';
|
|
|
- else if ('zasob' == $unitType) {
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
- foreach ($schema['config']['layer'] as $idLayer => $layData) {
|
|
|
- if (array_key_exists($idType, $layData['type'])) $jednostka = $layData['jednostka'];
|
|
|
- }
|
|
|
- }
|
|
|
- if (DBG::isActive()) $response['_unit'] = $jednostka;
|
|
|
-
|
|
|
- $reqJson = Request::getRequestJson();
|
|
|
- if (!empty($reqJson)) {
|
|
|
- if (!array_key_exists('price', $reqJson)) throw new Exception("Missing param price");
|
|
|
- $price = V::get('price', 0, $reqJson, 'float');
|
|
|
- ProjectKosztorysCennik::updatePriceProjectCennik($idType, $idProject, $price, $jednostka);
|
|
|
- }
|
|
|
- $response['id'] = $idType;
|
|
|
- $response['unitType'] = $unitType;
|
|
|
- $response['label'] = ProjectKosztorysCennik::getTypeLabel($idType);
|
|
|
- if ('robocizna' != $unitType) $response['defaultPrice'] = ProjectKosztorysCennik::getPriceDefaultCennik($idType);
|
|
|
- $response['price'] = ProjectKosztorysCennik::getPrice($idType, $idProject, $idCompany = 0, $jednostka);
|
|
|
- $response['msg'] = "";
|
|
|
- $response['type'] = "success";
|
|
|
- return $response;
|
|
|
- }
|
|
|
-
|
|
|
public function checkGeomDuplicate() {
|
|
|
// TODO: for every schema.layer
|
|
|
$sqlTblName = 'Rozdzielcza_Kabel_Swiatlowodowy_wsg84';
|
|
|
@@ -1838,7 +1540,7 @@ SQL_FUN;
|
|
|
";
|
|
|
}
|
|
|
|
|
|
- public function getData($idProject, $idOrder = 0, $admin = 0) {// TODO: before was: ($idProject, $admin = 0)
|
|
|
+ public function getKosztorysData($idProject, $idOrder = 0, $admin = 0) {// TODO: before was: ($idProject, $admin = 0)
|
|
|
static $_data = null;
|
|
|
if (null === $_data) {
|
|
|
$idSubProject = $this->getModel($idProject)->getSubProjectIds();
|