From 1ffbc1cfb7483e213ad77e9dba17d6125a39cd55 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 11 Sep 2003 16:30:46 +0000 Subject: [PATCH] Modif des fichiers php3 en php --- .../compta/bank/{account.php3 => account.php} | 0 .../compta/bank/{budget.php3 => budget.php} | 0 htdocs/compta/bank/{categ.php3 => categ.php} | 0 .../compta/bank/{config.php3 => config.php} | 0 .../{functions.lib.php3 => functions.lib.php} | 0 htdocs/compta/bank/{ligne.php3 => ligne.php} | 0 .../compta/bank/{releve.php3 => releve.php} | 0 .../compta/bank/{search.php3 => search.php} | 0 .../compta/voyage/{bilan.php3 => bilan.php} | 0 .../{reduc.class.php3 => reduc.class.php} | 0 .../compta/voyage/{reduc.php3 => reduc.php} | 0 .../compta/voyage/{voyage.php3 => voyage.php} | 0 ...ailFile.class.php3 => CMailFile.class.php} | 0 htdocs/propal.class.php3 | 597 ------------------ 14 files changed, 597 deletions(-) rename htdocs/compta/bank/{account.php3 => account.php} (100%) rename htdocs/compta/bank/{budget.php3 => budget.php} (100%) rename htdocs/compta/bank/{categ.php3 => categ.php} (100%) rename htdocs/compta/bank/{config.php3 => config.php} (100%) rename htdocs/compta/bank/{functions.lib.php3 => functions.lib.php} (100%) rename htdocs/compta/bank/{ligne.php3 => ligne.php} (100%) rename htdocs/compta/bank/{releve.php3 => releve.php} (100%) rename htdocs/compta/bank/{search.php3 => search.php} (100%) rename htdocs/compta/voyage/{bilan.php3 => bilan.php} (100%) rename htdocs/compta/voyage/{reduc.class.php3 => reduc.class.php} (100%) rename htdocs/compta/voyage/{reduc.php3 => reduc.php} (100%) rename htdocs/compta/voyage/{voyage.php3 => voyage.php} (100%) rename htdocs/lib/{CMailFile.class.php3 => CMailFile.class.php} (100%) delete mode 100644 htdocs/propal.class.php3 diff --git a/htdocs/compta/bank/account.php3 b/htdocs/compta/bank/account.php similarity index 100% rename from htdocs/compta/bank/account.php3 rename to htdocs/compta/bank/account.php diff --git a/htdocs/compta/bank/budget.php3 b/htdocs/compta/bank/budget.php similarity index 100% rename from htdocs/compta/bank/budget.php3 rename to htdocs/compta/bank/budget.php diff --git a/htdocs/compta/bank/categ.php3 b/htdocs/compta/bank/categ.php similarity index 100% rename from htdocs/compta/bank/categ.php3 rename to htdocs/compta/bank/categ.php diff --git a/htdocs/compta/bank/config.php3 b/htdocs/compta/bank/config.php similarity index 100% rename from htdocs/compta/bank/config.php3 rename to htdocs/compta/bank/config.php diff --git a/htdocs/compta/bank/functions.lib.php3 b/htdocs/compta/bank/functions.lib.php similarity index 100% rename from htdocs/compta/bank/functions.lib.php3 rename to htdocs/compta/bank/functions.lib.php diff --git a/htdocs/compta/bank/ligne.php3 b/htdocs/compta/bank/ligne.php similarity index 100% rename from htdocs/compta/bank/ligne.php3 rename to htdocs/compta/bank/ligne.php diff --git a/htdocs/compta/bank/releve.php3 b/htdocs/compta/bank/releve.php similarity index 100% rename from htdocs/compta/bank/releve.php3 rename to htdocs/compta/bank/releve.php diff --git a/htdocs/compta/bank/search.php3 b/htdocs/compta/bank/search.php similarity index 100% rename from htdocs/compta/bank/search.php3 rename to htdocs/compta/bank/search.php diff --git a/htdocs/compta/voyage/bilan.php3 b/htdocs/compta/voyage/bilan.php similarity index 100% rename from htdocs/compta/voyage/bilan.php3 rename to htdocs/compta/voyage/bilan.php diff --git a/htdocs/compta/voyage/reduc.class.php3 b/htdocs/compta/voyage/reduc.class.php similarity index 100% rename from htdocs/compta/voyage/reduc.class.php3 rename to htdocs/compta/voyage/reduc.class.php diff --git a/htdocs/compta/voyage/reduc.php3 b/htdocs/compta/voyage/reduc.php similarity index 100% rename from htdocs/compta/voyage/reduc.php3 rename to htdocs/compta/voyage/reduc.php diff --git a/htdocs/compta/voyage/voyage.php3 b/htdocs/compta/voyage/voyage.php similarity index 100% rename from htdocs/compta/voyage/voyage.php3 rename to htdocs/compta/voyage/voyage.php diff --git a/htdocs/lib/CMailFile.class.php3 b/htdocs/lib/CMailFile.class.php similarity index 100% rename from htdocs/lib/CMailFile.class.php3 rename to htdocs/lib/CMailFile.class.php diff --git a/htdocs/propal.class.php3 b/htdocs/propal.class.php3 deleted file mode 100644 index 760057ddd3d..00000000000 --- a/htdocs/propal.class.php3 +++ /dev/null @@ -1,597 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ - -class Propal -{ - var $id; - var $db; - var $socidp; - var $contactid; - var $projetidp; - var $author; - var $ref; - var $datep; - var $remise; - var $products; - var $products_qty; - var $note; - - var $price; - - Function Propal($DB, $soc_idp="", $propalid=0) - { - $this->db = $DB ; - $this->socidp = $soc_idp; - $this->id = $propalid; - $this->products = array(); - $this->remise = 0; - } - /* - * - * - * - */ - Function add_product($idproduct, $qty) - { - if ($idproduct > 0) - { - $i = sizeof($this->products); - $this->products[$i] = $idproduct; - if (!$qty) - { - $qty = 1 ; - } - $this->products_qty[$i] = $qty; - } - } - /* - * - * - */ - Function insert_product($idproduct, $qty) - { - if ($this->statut == 0) - { - $prod = new Product($this->db, $idproduct); - if ($prod->fetch($idproduct) > 0) - { - - $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx, description) VALUES "; - $sql .= " (".$this->id.",". $idproduct.",". $qty.",". $prod->price.",".$prod->tva_tx.",'".addslashes($prod->label)."') ; "; - - if ($this->db->query($sql) ) - { - - $this->update_price($this->id); - - return 1; - } - else - { - return -1; - } - } - else - { - return -2; - } - } - } - /* - * - * - */ - Function insert_product_generic($p_desc, $p_price, $p_qty, $p_tva_tx=19.6) - { - if ($this->statut == 0) - { - $p_price = ereg_replace(",",".",$p_price); - $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx, description) VALUES "; - $sql .= " (".$this->id.", 0,". $p_qty.",". $p_price.",".$p_tva_tx.",'".$p_desc."') ; "; - - if ($this->db->query($sql) ) - { - - if ($this->update_price($this->id) > 0) - { - return 1; - } - else - { - return -1; - } - } - else - { - print $this->db->error(); - print "
".$sql; - return -2; - } - } - } - /* - * - * - */ - Function fetch_client() - { - $client = new Societe($this->db); - $client->fetch($this->socidp); - $this->client = $client; - - } - /* - * - * - */ - Function delete_product($idligne) - { - if ($this->statut == 0) - { - $sql = "DELETE FROM llx_propaldet WHERE rowid = $idligne"; - - if ($this->db->query($sql) ) - { - - $this->update_price($this->id); - - return 1; - } - else - { - return 0; - } - } - } - /* - * - * - * - */ - Function create() - { - /* - * Insertion dans la base - */ - $sql = "INSERT INTO llx_propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf) "; - $sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0, $this->datep, now(), '$this->ref', $this->author, '$this->note','$this->modelpdf')"; - $sqlok = 0; - - if ( $this->db->query($sql) ) - { - - $this->id = $this->db->last_insert_id(); - - $sql = "SELECT rowid FROM llx_propal WHERE ref='$this->ref';"; - if ( $this->db->query($sql) ) - { - /* - * Insertion du detail des produits dans la base - */ - if ( $this->db->num_rows() ) - { - $propalid = $this->db->result( 0, 0); - $this->db->free(); - - for ($i = 0 ; $i < sizeof($this->products) ; $i++) - { - $prod = new Product($this->db, $this->products[$i]); - $prod->fetch($this->products[$i]); - - $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx) VALUES "; - $sql .= " ($propalid,".$this->products[$i].",".$this->products_qty[$i].",$prod->price,$prod->tva_tx);"; - - if (! $this->db->query($sql) ) - { - print $sql . '
' . $this->db->error() .'
'; - } - } - /* - * - */ - $this->update_price($this->id); - /* - * Affectation au projet - */ - if ($this->projetidp) - { - $sql = "UPDATE llx_propal SET fk_projet=$this->projetidp WHERE ref='$this->ref';"; - $this->db->query($sql); - } - } - } - else - { - print $this->db->error() . '
'.$sql; - } - } - else - { - print $this->db->error() . '
'.$sql; - } - return $this->id; - } - /* - * - * - */ - Function update_price($rowid) - { - $totalht=0; - $totaltva=0; - $totalttc=0; - $total_remise=0; - - /* - * Remise - */ - $sql = "SELECT remise_percent FROM llx_propal WHERE rowid = $rowid"; - if ( $this->db->query($sql) ) - { - $remise_percent = $this->db->result(0, 0); - $this->db->free(); - - /* - * Total des produits a ajouter - */ - $sql = "SELECT price, qty, tva_tx FROM llx_propaldet WHERE fk_propal = $rowid"; - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($i); - - $lprice = ($obj->qty * $obj->price); - - if ($remise_percent > 0) - { - $lremise = ($lprice * $remise_percent / 100); - $total_remise = $total_remise + $lremise; - $lprice = $lprice - $lremise; - } - - $totalht = $totalht + $lprice; - $totaltva = $totaltva + (tva(($lprice), $obj->tva_tx)); - $i++; - } - - $this->db->free(); - - /* - * Calcul TVA - */ - $totalttc = $totalht + $totaltva; - /* - * - */ - $sql = "UPDATE llx_propal set price=$totalht, tva=$totaltva, total=$totalttc, remise=$total_remise WHERE rowid = $rowid"; - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print "Erreur mise à jour du prix

".$sql; - return -1; - } - } - } - - } - - /* - * - * - * - */ - Function fetch($rowid) - { - - $sql = "SELECT ref,total,price,remise,tva,fk_soc,fk_soc_contact,".$this->db->pdate(datep)."as dp, model_pdf, note, fk_statut, remise_percent"; - $sql .= " FROM llx_propal WHERE rowid=$rowid;"; - - if ($this->db->query($sql) ) - { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object(0); - - $this->id = $rowid; - $this->datep = $obj->dp; - $this->date = $obj->dp; - $this->ref = $obj->ref; - $this->price = $obj->price; - $this->remise = $obj->remise; - $this->remise_percent = $obj->remise_percent; - $this->total = $obj->total; - $this->total_ht = $obj->price; - $this->total_tva = $obj->tva; - $this->total_ttc = $obj->total; - $this->socidp = $obj->fk_soc; - $this->contactid = $obj->fk_soc_contact; - $this->modelpdf = $obj->model_pdf; - $this->note = $obj->note; - - if ($obj->fk_statut == 0) - { - $this->brouillon = 1; - } - - $this->lignes = array(); - $this->db->free(); - - $this->ref_url = ''.$this->ref.''; - - /* - * Lignes - */ - - $sql = "SELECT d.qty, p.description, p.ref, p.price, d.tva_tx, p.rowid"; - $sql .= " FROM llx_propaldet as d, llx_product as p"; - $sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = p.rowid"; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows(); - $i = 0; - - while ($i < $num) - { - $objp = $this->db->fetch_object($i); - $ligne = new PropaleLigne(); - $ligne->desc = stripslashes($objp->description); - $ligne->qty = $objp->qty; - $ligne->ref = $objp->ref; - $ligne->tva_tx = $objp->tva_tx; - $ligne->price = $objp->price; - $ligne->product_id = $objp->rowid; - $this->lignes[$i] = $ligne; - $i++; - } - - $this->db->free(); - } - else - { - print $this->db->error(); - } - - /* - * Lignes - */ - - $sql = "SELECT d.qty, d.description, d.price, d.tva_tx, d.rowid"; - $sql .= " FROM llx_propaldet as d"; - $sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = 0"; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows(); - $j = 0; - - while ($j < $num) - { - $objp = $this->db->fetch_object($i); - $ligne = new PropaleLigne(); - $ligne->desc = stripslashes($objp->description); - $ligne->qty = $objp->qty; - $ligne->ref = $objp->ref; - $ligne->tva_tx = $objp->tva_tx; - $ligne->price = $objp->price; - $ligne->product_id = $objp->rowid; - $this->lignes[$i] = $ligne; - $i++; - $j++; - } - - $this->db->free(); - } - else - { - print $this->db->error(); - } - - - } - return 1; - } - else - { - print $this->db->error(); - return 0; - } - } - /* - * - * - * - */ - Function valid($user) - { - - if ($user->rights->propale->valider) - { - - $sql = "UPDATE llx_propal SET fk_statut = 1, date_valid=now(), fk_user_valid=$user->id"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - if ($this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - } - } - } - /* - * - * - * - */ - Function set_remise($user, $remise) - { - if ($user->rights->propale->creer) - { - - $sql = "UPDATE llx_propal SET remise_percent = ".ereg_replace(",",".",$remise); - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - if ($this->db->query($sql) ) - { - $this->update_price($this->id); - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - } - } - } - /* - * - * - * - */ - Function set_pdf_model($user, $modelpdf) - { - if ($user->rights->propale->creer) - { - - $sql = "UPDATE llx_propal SET model_pdf = '$modelpdf'"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - if ($this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - return 0; - } - } - } - /* - * - * - * - */ - Function cloture($userid, $statut, $note) - { - $sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$userid"; - - $sql .= " WHERE rowid = $this->id;"; - - if ($this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - } - } - /* - * - * - * - */ - Function reopen($userid) - { - $sql = "UPDATE llx_propal SET fk_statut = 0"; - - $sql .= " WHERE rowid = $this->id;"; - - if ($this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - } - } - /* - * - * - */ - Function liste_array ($brouillon=0, $user='') - { - $ga = array(); - - $sql = "SELECT rowid, ref FROM llx_propal"; - if ($brouillon = 1) - { - $sql .= " WHERE fk_statut = 0"; - if ($user) - { - $sql .= " AND fk_user_author".$user; - } - } - else - { - if ($user) - { - $sql .= " WHERE fk_user_author".$user; - } - } - - $sql .= " ORDER BY datep DESC"; - - if ($this->db->query($sql) ) - { - $nump = $this->db->num_rows(); - - if ($nump) - { - $i = 0; - while ($i < $nump) - { - $obj = $this->db->fetch_object($i); - - $ga[$obj->rowid] = $obj->ref; - $i++; - } - } - return $ga; - } - else - { - print $this->db->error(); - } - } -} - -class PropaleLigne -{ - Function PropaleLigne() - { - } -} -?>