false, $form['protoc'] ); } } $_SESSION['print_request'] = $ultimo_id; header("Location: invsta_docacq.php"); exit; } } } // Se viene inviata la richiesta di conferma fornitore if ($_POST['hidden_req']=='clfoco') { $anagrafica = new Anagrafica(); if (preg_match("/^id_([0-9]+)$/",$form['clfoco'],$match)) { $fornitore = $anagrafica->getPartnerData($match[1],1); } else { $fornitore = $anagrafica->getPartner($form['clfoco']); } if (substr($form['tipdoc'],0,1) != 'A') { $result = gaz_dbi_get_row($gTables['imball'],"codice",$fornitore['imball']); $form['imball']=$result['descri']; } $result = gaz_dbi_get_row($gTables['portos'],"codice",$fornitore['portos']); $form['portos']=$result['descri']; $result = gaz_dbi_get_row($gTables['spediz'],"codice",$fornitore['spediz']); $form['spediz']=$result['descri']; $form['destin']=$fornitore['destin']; $form['id_des']=$fornitore['id_des']; $id_des = $anagrafica->getPartner($form['id_des']); $form['search']['id_des']=substr($id_des['ragso1'],0,10);
$msg .= "0+"; } } } else { // controllo che l'articolo ci sia gia' $rs_articolo = gaz_dbi_dyn_query('codice', $gTables['assist'], "codice = ".$form['codice'],"codice DESC",0,1); $rs = gaz_dbi_fetch_array($rs_articolo); if ($rs) { $msg .= "2+"; } } $msg .= (empty($form["codice"]) ? "5+" : ''); $msg .= (empty($form["descrizione"]) ? "6+" : ''); if (empty($msg)) { if (preg_match("/^id_([0-9]+)$/",$form['clfoco'],$match)) { $new_clfoco = $anagrafica->getPartnerData($match[1],1); $form['clfoco']=$anagrafica->anagra_to_clfoco($new_clfoco,$admin_aziend['mascli']); } // aggiorno il db if ($toDo == 'insert') { gaz_dbi_table_insert('assist',$form); } elseif ($toDo == 'update') { gaz_dbi_table_update('assist',$form['ref_code'],$form); } header("Location: ".$form['ritorno']); exit; } } elseif (isset($_POST['Return'])) { // torno indietro header("Location: ".$form['ritorno']); exit; }
$last_rigbro_id = gaz_dbi_last_id(); if (isset($form["row_$i"])) { //se รจ un rigo testo lo inserisco il contenuto in body_text bodytextInsert(array('table_name_ref'=>'rigbro','id_ref'=>$last_rigbro_id,'body_text'=>$form["row_$i"],'lang_id'=>$admin_aziend['id_language'])); gaz_dbi_put_row($gTables['rigbro'], 'id_rig', $last_rigbro_id, 'id_body_text', gaz_dbi_last_id()); } } $_SESSION['print_request']=$ultimo_id; header("Location: invsta_broven.php"); exit; } } // Se viene inviata la richiesta di conferma cliente if ($_POST['hidden_req']=='clfoco') { $anagrafica = new Anagrafica(); if (preg_match("/^id_([0-9]+)$/",$form['clfoco'],$match)) { $cliente = $anagrafica->getPartnerData($match[1],1); } else { $cliente = $anagrafica->getPartner($form['clfoco']); } $result = gaz_dbi_get_row($gTables['imball'],"codice",$cliente['imball']); $form['imball']=$result['descri']; if (($form['net_weight'] - $form['gross_weight']) >= 0) { $form['gross_weight'] += $result['weight']; } $result = gaz_dbi_get_row($gTables['portos'],"codice",$cliente['portos']); $form['portos']=$result['descri']; $result = gaz_dbi_get_row($gTables['spediz'],"codice",$cliente['spediz']); $form['spediz']=$result['descri']; $form['destin']=$cliente['destin']; $form['id_agente']=$cliente['id_agente']; if ($form['id_agente'] > 0) { // carico la provvigione standard
$form['oggetto'] = $_POST['oggetto']; $form['c_a'] = $_POST['c_a']; $form['corpo'] = $_POST['corpo']; if (isset($_POST['signature'])) { $form['signature'] = 'checked'; } else { $form['signature'] = ''; } //--- variabili temporanee foreach($_POST['search'] as $k=>$v){ $form['search'][$k]=$v; } if ($_POST['hidden_req']=='clfoco') { $anagrafica = new Anagrafica(); if (preg_match("/^id_([0-9]+)$/",$form['clfoco'],$match)) { $partner = $anagrafica->getPartnerData($match[1],1); } else { $partner = $anagrafica->getPartner($form['clfoco']); } /* $anagrafica = new Anagrafica(); $partner = $anagrafica->getPartner($form['clfoco']); $form['cerca_partner'] = substr($partner['ragso1'],0,4); $form['clfoco'] = 0; */ $form['hidden_req']=''; } if (isset($_POST['ins'])) { // Se viene inviata la richiesta di conferma totale ... $datemi = date("Ymd",mktime(0,0,0,$form['mesemi'],$form['gioemi'],$form['annemi'])); if (!checkdate( $form['mesemi'], $form['gioemi'], $form['annemi'])) { $msg .= "10+"; } if ($form['clfoco'] == 0) {
function setXMLvars($gTables, $tesdoc, $testat, $tableName, $ecr = false) { $this->gTables = $gTables; $admin_aziend = gaz_dbi_get_row($gTables['aziend'], 'codice', $_SESSION['enterprise_id']); $this->azienda = $admin_aziend; $this->pagame = gaz_dbi_get_row($gTables['pagame'], "codice", $tesdoc['pagame']); $this->banapp = gaz_dbi_get_row($gTables['banapp'], "codice", $tesdoc['banapp']); $anagrafica = new Anagrafica(); $this->banacc = $anagrafica->getPartner($this->pagame['id_bank']); $this->vettor = gaz_dbi_get_row($gTables['vettor'], "codice", $tesdoc['vettor']); $this->tableName = $tableName; $this->intesta1 = $admin_aziend['ragso1']; $this->intesta1bis = $admin_aziend['ragso2']; $this->intesta2 = $admin_aziend['indspe'] . ' ' . sprintf("%05d", $admin_aziend['capspe']) . ' ' . $admin_aziend['citspe'] . ' (' . $admin_aziend['prospe'] . ')'; $this->intesta3 = 'Tel.' . $admin_aziend['telefo'] . ' '; $this->aziendTel = $admin_aziend['telefo']; $this->aziendFax = $admin_aziend['fax']; $this->codici = ''; if ($admin_aziend['codfis'] != '') { $this->codici .= 'C.F. ' . $admin_aziend['codfis'] . ' '; } if ($admin_aziend['pariva']) { $this->codici .= 'P.I. ' . $admin_aziend['pariva'] . ' '; } if ($admin_aziend['rea']) { $this->codici .= 'R.E.A. ' . $admin_aziend['rea']; } if ($tesdoc['template'] == 'FatturaImmediata') { $this->sempl_accom = true; } else { $this->sempl_accom = false; } $this->intesta4 = $admin_aziend['e_mail']; $this->intesta5 = $admin_aziend['sexper']; if ($admin_aziend['sexper'] == 'G') { $this->TipoRitenuta = 'RT02'; } else { $this->TipoRitenuta = 'RT01'; } $this->colore = $admin_aziend['colore']; $this->decimal_quantity = $admin_aziend['decimal_quantity']; $this->decimal_price = $admin_aziend['decimal_price']; $this->logo = $admin_aziend['image']; $this->link = $admin_aziend['web_url']; $this->perbollo = 0; $this->iva_bollo = gaz_dbi_get_row($gTables['aliiva'], "codice", $admin_aziend['taxstamp_vat']); $this->client = $anagrafica->getPartner($tesdoc['clfoco']); $this->cliente1 = $this->client['ragso1']; $this->cliente2 = $this->client['ragso2']; $this->cliente3 = $this->client['indspe']; if (!empty($this->client['citspe'])) { $this->cliente4 = sprintf("%05d", $this->client['capspe']) . ' ' . strtoupper($this->client['citspe']) . ' ' . strtoupper($this->client['prospe']); } else { $this->cliente4 = ''; } $country = gaz_dbi_get_row($gTables['country'], "iso", $this->client['country']); if ($this->client['country'] != 'IT') { $this->cliente4b = strtoupper($country['istat_name']); } else { $this->cliente4b = ''; } if (!empty($this->client['pariva'])) { $this->cliente5 = 'P.I. ' . $this->client['pariva'] . ' '; } else { $this->cliente5 = ''; } if (!empty($this->client['pariva'])) { //se c'e' la partita iva if (!empty($this->client['codfis']) and $this->client['codfis'] == $this->client['pariva']) { $this->cliente5 = 'C.F. e P.I. ' . $this->client['codfis']; } elseif (!empty($this->client['codfis']) and $this->client['codfis'] != $this->client['pariva']) { $this->cliente5 = 'C.F. ' . $this->client['codfis'] . ' P.I. ' . $this->client['pariva']; } else { //per es. se non c'e' il codice fiscale $this->cliente5 = ' P.I. ' . $this->client['pariva']; } } else { //se NON c'e' la partita iva $this->cliente5 = ''; if (!empty($this->client['codfis'])) { $this->cliente5 = 'C.F. ' . $this->client['codfis']; } } // variabile e' sempre un array $this->id_agente = gaz_dbi_get_row($gTables['agenti'], 'id_agente', $tesdoc['id_agente']); $this->rs_agente = $anagrafica->getPartner($this->id_agente['id_fornitore']); $this->name_agente = substr($this->rs_agente['ragso1'] . " " . $this->rs_agente['ragso2'], 0, 47); if (isset($tesdoc['id_des']) and $tesdoc['id_des'] > 0) { $this->partner_dest = $anagrafica->getPartnerData($tesdoc['id_des']); $this->destinazione = substr($this->partner_dest['ragso1'] . " " . $this->partner_dest['ragso2'], 0, 45); $this->destinazione .= "\n" . substr($this->partner_dest['indspe'], 0, 45); $this->destinazione .= "\n" . substr($this->partner_dest['capspe'] . " " . $this->partner_dest['citspe'] . " (" . $this->partner_dest['prospe'] . ")", 0, 45); } else { if (isset($tesdoc['destin']) and is_array($tesdoc['destin'])) { $this->destinazione = $tesdoc['destin']; } elseif (isset($tesdoc['destin']) and is_string($tesdoc['destin'])) { $destino = preg_split("/[\r\n]+/i", $tesdoc['destin'], 3); $this->destinazione = substr($destino[0], 0, 45); foreach ($destino as $key => $value) { if ($key == 1) { $this->destinazione .= "\n" . substr($value, 0, 45) . "\n"; } elseif ($key > 1) { $this->destinazione .= substr(preg_replace("/[\r\n]+/i", ' ', $value), 0, 45); } } } else { $this->destinazione = ''; } } $this->clientSedeLegale = trim($this->client['sedleg']) != '' ? preg_split("/\n/", trim($this->client['sedleg'])) : array(); $this->client = $anagrafica->getPartner($tesdoc['clfoco']); $this->tesdoc = $tesdoc; $this->expense_pervat = gaz_dbi_get_row($gTables['aliiva'], "codice", $this->tesdoc['expense_vat']); $this->min = substr($tesdoc['initra'], 14, 2); $this->ora = substr($tesdoc['initra'], 11, 2); $this->day = substr($tesdoc['initra'], 8, 2); $this->month = substr($tesdoc['initra'], 5, 2); $this->year = substr($tesdoc['initra'], 0, 4); $this->trasporto = $tesdoc['traspo']; $this->testat = $testat; $this->ddt_data = false; $this->TipoDocumento = 'TD01'; // <TipoDocumento> 2.1.1.1 $this->docRelNum = $this->tesdoc["numdoc"]; // Numero del documento relativo $this->docRelDate = $this->tesdoc["datemi"]; // Data del documento relativo switch ($tesdoc["tipdoc"]) { case "FAD": $this->ddt_data = true; $this->docRelNum = $this->tesdoc["numfat"]; $this->docRelDate = $this->tesdoc["datfat"]; break; case "FAI": $this->docRelNum = $this->tesdoc["numfat"]; $this->docRelDate = $this->tesdoc["datfat"]; break; case "FNC": $this->TipoDocumento = 'TD04'; // <TipoDocumento> 2.1.1.1 $this->docRelNum = $this->tesdoc["numfat"]; $this->docRelDate = $this->tesdoc["datfat"]; break; case "FND": $this->TipoDocumento = 'TD05'; // <TipoDocumento> 2.1.1.1 $this->docRelNum = $this->tesdoc["numfat"]; $this->docRelDate = $this->tesdoc["datfat"]; break; case "FAP": $this->TipoDocumento = 'TD06'; // <TipoDocumento> 2.1.1.1 $this->docRelNum = $this->tesdoc["numfat"]; $this->docRelDate = $this->tesdoc["datfat"]; break; case "DDT": case "DDL": case "DDR": default: $this->ddt_data = true; $this->docRelNum = $this->tesdoc["numdoc"]; // Numero del documento relativo $this->docRelDate = $this->tesdoc["datemi"]; // Data del documento relativo } $this->protoc = $this->tesdoc["protoc"]; $this->seziva = $this->tesdoc["seziva"]; // aggiungo l'eventuale intermediario in caso di installazione "da commercialista" $intermediary_code = gaz_dbi_get_row($gTables['config'], 'variable', 'intermediary'); if ($intermediary_code['cvalue'] > 0) { $intermediary = gaz_dbi_get_row($gTables['aziend'], 'codice', $intermediary_code['cvalue']); $this->IdCodice = $intermediary['codfis']; $this->Intermediary = $intermediary['codice']; } else { $this->IdCodice = $admin_aziend['codfis']; $this->Intermediary = false; } $this->totimp_body = 0; $this->totimp_decalc = 0; $this->totimp_doc = 0; }