function __construct($modello, $pratica)
 {
     $this->db = appUtils::getDb();
     $db = $this->db;
     $this->modello = $modello;
     $this->pratica = $pratica;
     $sql = "SELECT * FROM stp.e_modelli WHERE id=?";
     $ris = $db->fetchAssoc($sql, array($modello));
     $this->modello = $ris["nome"];
     $this->viste = explode(',', $ris["views"]);
     $this->funzioni = explode(',', $ris["functions"]);
     $this->modelliDir = DATA_DIR . DIRECTORY_SEPARATOR . "praticaweb" . DIRECTORY_SEPARATOR . "modelli" . DIRECTORY_SEPARATOR;
     $info = pathinfo($this->modello);
     $this->basename = $info["filename"];
     $this->extension = $info["extension"];
     $this->docName = str_pad(rand(0, 999999), 6, '0', STR_PAD_LEFT) . "-" . $this->modello;
     $this->actions = $ris["action"];
 }
<?php

require_once "login.php";
$id = $_REQUEST["id"];
$pratica = $_REQUEST["pratica"];
if ($pratica != "null" && $pratica) {
    $db = appUtils::getDB();
    $sql = "SELECT file_doc FROM stp.stampe WHERE id=?";
    $fName = $db->fetchColumn($sql, array($id));
    $pr = new pratica($pratica);
    $url = $pr->smb_documenti . $fName;
    print_debug($url . "\n", NULL, "documento");
} else {
    $db = appUtils::getDB();
    $sql = "SELECT nome FROM stp.e_modelli WHERE id=?";
    $fName = $db->fetchColumn($sql, array($id));
    $url = SMB_MODELLI . $fName;
}
//if (file_exists(DATA_DIR.implode(DIRECTORY_SEPARATOR,Array("praticaweb",'documenti')).DIRECTORY_SEPARATOR)) {
//    echo $url;exit;
//}
header("Content-type: application/vnd.ms-word");
@header("Location: {$url}");
Esempio n. 3
0
$pdf->Cell(60, 5, 'Prima rata 50% M', 1, 0, 'C');
$pdf->Cell(40, 5, $m[15] . ' ' . chr(128) . '', 1, 1, 'C');
$pdf->Ln(5);
$pdf->Cell(40, 5, '', 0, 0, 'L');
$pdf->Cell(60, 5, 'Seconda rata 50% M', 1, 0, 'C');
$pdf->Cell(40, 5, $m[15] . ' ' . chr(128) . '', 1, 1, 'C');
$pdf->Ln(5);
$pdf->Cell(40, 5, '', 0, 0, 'L');
$pdf->Cell(60, 5, 'Cessione comma f', 1, 0, 'C');
$pdf->Cell(40, 5, $m[19] . ' mq', 1, 1, 'C');
$pdf->Ln(10);
$pdf->Cell(10, 5, '', 0, 0, 'L');
$pdf->Cell(50, 5, 'Il Progettista o Direttore dei Lavori', 0, 0, 'C');
$pdf->Cell(50, 5, '', 0, 0, 'L');
$pdf->Cell(50, 5, 'Visto dell\'Ufficio tecnico comunele', 0, 1, 'C');
$pdf->Cell(10, 10, '', 0, 0, 'L');
$pdf->Cell(50, 15, '', 'B', 0, 'L');
$pdf->Cell(50, 5, '', 0, 0, 'L');
$pdf->Cell(50, 15, '', 'B', 0, 'L');
$pdf->Output($dest, "F");
$file = "<a href='" . $dest . "'>DOWNLOAD " . $file_n . "</a>";
$testo = "Creato il documento <img src=\"images/pdf.png\" border=0 onclick=\"window.open(\\'{$pr->url_documenti}{$file_n}\\');\">&nbsp;&nbsp;<a href=\"#\" onclick=\"window.open(\\'{$pr->url_documenti}{$file_n}\\');\">Calcolo Corrispettivo Monetario</a>";
//$testoview="Creato il documento <img src=\"images/pdf.gif\" border=0 onclick=\"window.open(\'$pr->url_documenti$dest\');\">&nbsp;&nbsp;<a href=\"#\" onclick=\"window.open(\'$pr->url_documenti$dest\');\">Calcolo Oneri</a>";
appUtils::addIter($idpratica, array("nota" => $testo, "nota_edit" => $testo));
$sql = "\nDELETE FROM oneri.c_monetario WHERE pratica={$pr->pratica};\t\t\nINSERT INTO oneri.c_monetario(pratica,totale_noscomputo,vol_progetto,vol_esistente,vol_indice,vol_differenza,sup_lotto,sup_cessione,sup_cessione_prop,sup_cessione_obbl,chk,uidins,tmsins) VALUES({$pr->pratica},{$m['14']},{$m['10']},{$m['9']},{$m['16']},{$m['17']},{$m['8']},({$m['11']}*{$m['18']})/100,({$m['11']}*{$m['18']})/100,{$m['18']},1,{$pr->userid}," . time() . ");";
$pr->db->sql_query($sql);
$pr->setCM();
$pr->setRateCM();
$pr->setFidiCM();
print json_encode(array("url" => $pr->url_documenti . $file_n, "label" => $file_n));
return;
        include_once "lib/stampe.word.class.php";
        list($sc, $f) = explode(".", $form);
        $schema = "stp";
        $doc = new wordDoc($id_modello, $idpratica);
        $doc->createDoc();
        $data = array('pratica' => $idpratica, 'modello' => $id_modello, 'file_doc' => $doc->docName, 'file_pdf' => $doc->docName, 'form' => $form, 'utente_doc' => $usr, 'utente_pdf' => $usr, 'data_creazione_doc' => 'NOW', 'data_creazione_pdf' => 'NOW');
        $db->insert('stp.stampe', $data);
        $lastid = appUtils::getLastId($db, 'stp.stampe');
        /*sql="INSERT INTO stp.stampe(pratica,modello,file_doc,file_pdf,form,utente_doc,utente_pdf,data_creazione_doc,data_creazione_pdf) VALUES($idpratica,$id_modello,$doc->docName,$doc->docName,'$form','$usr','$usr',now(),now())";
          if(!$db->sql_query($sql)) print_debug($sql);
          $lastid=$db->sql_nextid();*/
        $edit = "<img src=\"images/word.gif\" border=0 >&nbsp;&nbsp;<a target=\"documenti\" href=\"./openDocument.php?id={$lastid}&pratica={$idpratica}\" >{$doc->basename}</a>";
        $view = "Creato il Documento " . $doc->basename;
        $data = array('pratica' => $idpratica, 'data' => 'NOW', 'utente' => $usr, 'nota' => $view, 'uidins' => $_SESSION["USER_ID"], 'tmsins' => time(), 'nota_edit' => $edit, 'stampe' => $lastid, 'immagine' => 'word.png');
        $db->insert($schema_iter . '.iter', $data);
        /*$sql="INSERT INTO $schema_iter.iter(pratica,data,utente,nota,nota_edit,uidins,tmsins,stampe,immagine) VALUES($idpratica,'$today','$usr','$testoview','$testoedit',".$_SESSION["USER_ID"].",".time().",$lastid,'laserjet.gif');";
          $db->sql_query($sql);*/
        //Azioni da eseguire sulla stampa dei documenti
        $arrAct = explode(',', $doc->actions);
        $info = appUtils::getInfoPratica($idpratica);
        for ($i = 0; $i < count($arrAct); $i++) {
            switch ($arrAct[$i]) {
                case "fd":
                    appUtils::addTransition($idpratica, array("codice" => $arrAct[$i], "utente_fi" => $info['dirigente'], "utente_in" => $info['resp_proc'], "data" => "now()", "note" => $doc->basename));
                default:
                    break;
            }
        }
    }
}
$active_form = $is_cdu ? "cdu.iter?pratica={$idpratica}" : "pe.iter?pratica={$idpratica}&tipo=pratica";
Esempio n. 5
0
     $res = $db->fetchAll($sql);
     $result["data"] = $res;
     $result["success"] = 1;
     break;
 case "print":
     $id_modello = $_REQUEST["model"];
     foreach ($prms as $idpratica) {
         $r = $db->fetchAssoc("SELECT count(*) as duplicated,coalesce(Y.multiple,0) as multiple FROM stp.stampe X INNER JOIN stp.e_modelli Y ON(X.modello=Y.id) WHERE X.pratica=? and modello=? group by 2", array($idpratica, $id_modello), 0);
         list($duplicated, $multiple) = array_values($r);
         if (!$duplicated || $multiple) {
             include_once "../lib/stampe.word.class.php";
             $doc = new wordDoc($id_modello, $idpratica);
             $doc->createDoc();
             $data = array('pratica' => $idpratica, 'modello' => $id_modello, 'file_doc' => $doc->docName, 'file_pdf' => $doc->docName, 'form' => $form, 'utente_doc' => $usr, 'utente_pdf' => $usr, 'data_creazione_doc' => 'NOW', 'data_creazione_pdf' => 'NOW');
             $db->insert('stp.stampe', $data);
             $lastid = appUtils::getLastId($db, 'stp.stampe');
             $edit = "<img src=\"images/word.gif\" border=0 >&nbsp;&nbsp;<a target=\"documenti\" href=\"./openDocument.php?id={$lastid}&pratica={$idpratica}\" >{$doc->basename}</a>";
             $view = "Creato il Documento " . $doc->basename;
             $data = array('pratica' => $idpratica, 'data' => 'NOW', 'utente' => $usr, 'nota' => $view, 'uidins' => $_SESSION["USER_ID"], 'tmsins' => time(), 'nota_edit' => $edit, 'stampe' => $lastid, 'immagine' => 'word.png');
             $db->insert('pe.iter', $data);
             $result["data"][] = array("id" => $lastid, "pratica" => $idpratica, "name" => $doc->basename, "success" => 1);
         } else {
             if ($duplicated) {
                 $r = $db->fetchAssoc("SELECT id,data_creazione_doc FROM stp.stampe pratica=? and modello=? order by tmsins DESC LIMIT 1", array($idpratica, $id_modello), 0);
                 list($id, $data) = array_values($r);
                 $result["data"][] = array("id" => $id, "pratica" => $idpratica, "data" => $data, "success" => 0);
             }
         }
         $result["success"] = 1;
     }
     break;
Esempio n. 6
0
<?php

require_once '../login.php';
echo "<p>TEST</p>";
print_array(appUtils::getVincoli(33798));
Esempio n. 7
0
include_once "../login.php";
error_reporting(E_ERROR);
$db = appUtils::getDB();
$result = array();
$action = isset($_REQUEST["action"]) && $_REQUEST["action"] ? $_REQUEST["action"] : "";
switch ($action) {
    case "nuovi_oneri":
        $data_inizio = $_REQUEST["inizio"];
        $sqlData = "SELECT code,zona,c_1,c_2,c_3,c_4,c_5,c_6,c_7,c_8,c_9,c_10,c_11,c_12,c_13,c_14,c_15,c_16,c_17,c_18,c_19,c_20,'{$data_inizio}'::date as inizio_validita FROM oneri.tabella_b WHERE inizio_validita = (SELECT max(inizio_validita) from oneri.tabella_b)";
        $data = $db->fetchAll($sqlData);
        foreach ($data as $v) {
            $db->insert("oneri.tabella_b", $v);
        }
        break;
    case "checkModelli":
        $value = isset($_REQUEST["id"]) && $_REQUEST["id"] ? $_REQUEST["id"] : "%";
        $sql = "SELECT id,nome FROM stp.e_modelli WHERE id::varchar ilike ?";
        $res = $db->fetchAll($sql, array($value), 0);
        for ($i = 0; $i < count($res); $i++) {
            $nome = $res[$i]["nome"];
            $text = appUtils::unzip(MODELLI, $nome);
            $err = appUtils::getDocxErrors($text);
            $result[$res[$i]["id"]] = $err;
        }
        break;
    default:
        break;
}
print json_encode($result);
return;
if ($modo == 'new' && $azione == 'Aggiungi') {
    $parametro = $_REQUEST['parametro'];
    $conforme = $_REQUEST['conforme'];
    $valore = addslashes($_REQUEST['valore']);
    $sql = "insert into pe.parametri_prog (parametro,pratica,valore,conforme,chk,uidins,tmsins) values ({$parametro},{$idpratica},'{$valore}',{$conforme},1," . $_SESSION["USER_ID"] . "," . time() . ");";
    $db->sql_query($sql);
} elseif ($modo == 'new' && $azione == 'Salva') {
    $sql = "SELECT id,nome FROM pe.e_parametri WHERE default_ins=1;";
    $db->sql_query($sql);
    $ris = $db->sql_fetchrowset();
    for ($i = 0; $i < count($ris); $i++) {
        $sql = "insert into pe.parametri_prog (parametro,pratica,conforme,chk,uidins,tmsins) values (" . $ris[$i]["id"] . ",{$idpratica},1,1," . $_SESSION["USER_ID"] . "," . time() . ");";
        //echo "<p>$sql</p>";
        $db->sql_query($sql);
    }
} elseif ($prm && $azione == 'Salva') {
    $vals = $_POST['valore'];
    $conformita = $_POST['conforme'];
    foreach ($vals as $key => $val) {
        $conf = $conformita[$key] ? '1' : '0';
        $v = strlen($val) ? "'{$val}'" : 'null';
        $sql = "UPDATE pe.parametri_prog SET valore={$v},conforme={$conf} WHERE id={$key}";
        $db->sql_query($sql);
    }
    /*Parametri Calcolati*/
    appUtils::setPrmProgCalcolati($idpratica, $vals);
    $modo = 'view';
} elseif ($_REQUEST['azione'] == 'Elimina') {
    $sql = $prm ? "DELETE FROM pe.parametri_prog WHERE id=" . $_REQUEST['id'] . ";" : "DELETE FROM pe.parametri_prog WHERE pratica={$idpratica};";
    $db->sql_query($sql);
}
 static function addTransition($pratica, $prms)
 {
     $db = self::getDb();
     $userid = appUtils::getUserId();
     $initVal = array("pratica" => $pratica, 'codice' => null, 'utente_in' => $userid, 'utente_fi' => null, 'data' => "now", 'stato_in' => null, 'stato_fi' => null, 'note' => null, 'tmsins' => time(), 'uidins' => $userid);
     foreach ($initVal as $key => $val) {
         $params[$key] = in_array($key, array_keys($prms)) && $prms[$key] ? $prms[$key] : $val;
     }
     $params['note'] = $params['note'] ? $db->quote($params['note']) : $params['note'];
     $cod = $params['codice'];
     if ($db->insert("pe.wf_transizioni", $params)) {
         switch ($cod) {
             case "ardp":
             case "aitec":
             case "aiamm":
             case "aipre":
             case "aiagi":
             case "ailav":
                 self::addRole($pratica, substr($cod, 1), $params['utente_fi'], $params['data']);
                 break;
             case "rardp":
             case "raitec":
             case "raiamm":
                 self::delRole($pratica, substr($cod, 2));
                 self::addRole($pratica, substr($cod, 2), $params['utente_fi'], $params['data']);
                 break;
             default:
                 break;
         }
     }
 }