1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-25 06:55:05 +01:00
openstamanager/templates/interventi/init.php

15 lines
1.4 KiB
PHP
Raw Normal View History

<?php
include_once __DIR__.'/../../core.php';
$module_name = 'Interventi';
// carica intervento
$query = 'SELECT in_interventi.*, (SELECT nome FROM co_contratti WHERE id=in_interventi.id_contratto) AS nome_contratto, (SELECT numero FROM co_contratti WHERE id=in_interventi.id_contratto) AS numero_contratto, (SELECT numero FROM co_preventivi WHERE id=in_interventi.id_preventivo) AS numero_preventivo, (SELECT SUM(prezzo_dirittochiamata) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_dirittochiamata`, (SELECT SUM(km) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_km`, (SELECT SUM(ore*prezzo_ore_unitario) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_ore_consuntivo`, (SELECT SUM(prezzo_km_consuntivo) FROM in_interventi_tecnici GROUP BY idintervento HAVING idintervento=in_interventi.id) AS `tot_km_consuntivo`, in_interventi.descrizione AS `descrizione_intervento`, richiesta, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=in_interventi.idtipointervento) AS tipointervento FROM in_interventi INNER JOIN in_tipiintervento ON in_interventi.idtipointervento=in_tipiintervento.idtipointervento WHERE id='.prepare($id_record);
$records = $dbo->fetchArray($query);
2017-09-21 15:51:39 +02:00
$costi_intervento = get_costi_intervento($id_record);
$id_cliente = $records[0]['idanagrafica'];
$id_sede = $records[0]['idsede'];