Fix: Mauvaise valeur sauvegard si montant suprieur 1000
This commit is contained in:
parent
a12a2ea93d
commit
dbabaef6e3
@ -159,7 +159,7 @@ class BonPrelevement
|
||||
|
||||
$sql .= " VALUES (".$this->id;
|
||||
$sql .= ",".$client_id.",'".addslashes($client_nom)."'";
|
||||
$sql .= ",'".ereg_replace(",",".",$amount)."'";
|
||||
$sql .= ",'".price2num($amount)."'";
|
||||
$sql .= ", '$code_banque', '$code_guichet', '$number')";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@ -977,7 +977,7 @@ class BonPrelevement
|
||||
*/
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " SET amount = ".ereg_replace(",",".",$bonprev->total);
|
||||
$sql .= " SET amount = ".price2num($bonprev->total);
|
||||
$sql .= " WHERE rowid = ".$prev_id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -399,10 +399,10 @@ class Livre {
|
||||
$sql = "UPDATE ".OSC_DB_NAME.".products ";
|
||||
$sql .= "SET products_model = '".$this->ref."'";
|
||||
$sql .= ", products_image = '".$this->image."'";
|
||||
$sql .= ", products_price = ".ereg_replace(",",".",$this->price)."";
|
||||
$sql .= ", products_price = ".price2num($this->price)."";
|
||||
if ($this->frais_de_port)
|
||||
{
|
||||
$sql .= ", products_weight = ".ereg_replace(",",".",$this->price)."";
|
||||
$sql .= ", products_weight = ".price2num($this->price)."";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -445,7 +445,7 @@ class Livre {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."livre ";
|
||||
$sql .= " SET title = '" . trim($this->titre) ."'";
|
||||
$sql .= ", ref = '" . trim($this->ref) ."'";
|
||||
$sql .= ", prix = " . ereg_replace(",",".",$this->price)."";
|
||||
$sql .= ", prix = " . price2num($this->price)."";
|
||||
$sql .= ", annee = " . $this->annee ;
|
||||
$sql .= ", fk_editeur = " . $this->editeurid ;
|
||||
$sql .= ", description = '" . trim($this->description) ."'";
|
||||
|
||||
@ -64,10 +64,10 @@ class PaiementCharge {
|
||||
{
|
||||
$facid = $key;
|
||||
$value = trim($value);
|
||||
$amount = round(ereg_replace(",",".",$value), 2); // Un round est ok si nb avec '.'
|
||||
$amount = round(price2num($value), 2); // Un round est ok si nb avec '.'
|
||||
if (is_numeric($amount)) $total += $amount;
|
||||
}
|
||||
$total = ereg_replace(",",".",$total);
|
||||
$total = price2num($total);
|
||||
|
||||
if ($total > 0)
|
||||
{
|
||||
|
||||
@ -402,7 +402,7 @@ class Commande
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
||||
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."') ;";
|
||||
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
|
||||
@ -200,7 +200,7 @@ class ComptaExportPoivre extends ComptaExport
|
||||
$page->write_string($j, 3, stripslashes($this->line_out[$i][2]));
|
||||
$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
|
||||
$page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de factur
|
||||
$page->write($j, 6, ereg_replace(",",".",$this->line_out[$i][7]));
|
||||
$page->write($j, 6, price2num($this->line_out[$i][7]));
|
||||
$page->write_string($j, 7, 'D' ); // D pour débit
|
||||
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
|
||||
|
||||
@ -213,7 +213,7 @@ class ComptaExportPoivre extends ComptaExport
|
||||
|
||||
$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
|
||||
$page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de facture
|
||||
$page->write($j, 6, ereg_replace(",",".",$this->line_out[$i][6])); // Montant de TVA
|
||||
$page->write($j, 6, price2num($this->line_out[$i][6])); // Montant de TVA
|
||||
$page->write_string($j, 7, 'C'); // C pour crédit
|
||||
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
|
||||
|
||||
@ -227,7 +227,7 @@ class ComptaExportPoivre extends ComptaExport
|
||||
$page->write_string($j, 2, $this->line_out[$i][4]); // Code Comptable
|
||||
$page->write_string($j, 4, $this->line_out[$i][3]." Facture");
|
||||
$page->write_string($j, 5, $this->line_out[$i][5]);
|
||||
$page->write($j, 6, ereg_replace(",",".",round($this->line_out[$i][8], 2)));
|
||||
$page->write($j, 6, price2num(round($this->line_out[$i][8], 2)));
|
||||
$page->write_string($j, 7, 'C'); // C pour crédit
|
||||
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
|
||||
|
||||
@ -304,7 +304,7 @@ class ComptaExportPoivre extends ComptaExport
|
||||
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
|
||||
$page->write_string($j,5, $linep[$i][7]); // Numéro de facture
|
||||
|
||||
$page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
|
||||
$page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne
|
||||
$page->write_string($j,7,$debit);
|
||||
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));
|
||||
|
||||
@ -318,7 +318,7 @@ class ComptaExportPoivre extends ComptaExport
|
||||
$page->write_string($j,3, $linep[$i][2]);
|
||||
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
|
||||
$page->write_string($j,5, $linep[$i][7]); // Numéro de facture
|
||||
$page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
|
||||
$page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne
|
||||
$page->write_string($j,7, $credit);
|
||||
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));
|
||||
|
||||
|
||||
@ -415,7 +415,7 @@ class FactureRec
|
||||
$qty=1;
|
||||
}
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(",",".",$pu), 2);
|
||||
$price = round(price2num($pu), 2);
|
||||
$subprice = $price;
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
@ -425,13 +425,13 @@ class FactureRec
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet_rec (fk_facture,description,price,qty,tva_taux, fk_product, remise_percent, subprice, remise)";
|
||||
$sql .= " VALUES ('$facid', '$desc'";
|
||||
$sql .= ",".ereg_replace(",",".",$price);
|
||||
$sql .= ",".ereg_replace(",",".",$qty);
|
||||
$sql .= ",".ereg_replace(",",".",$txtva);
|
||||
$sql .= ",".price2num($price);
|
||||
$sql .= ",".price2num($qty);
|
||||
$sql .= ",".price2num($txtva);
|
||||
$sql .= ",'$fk_product'";
|
||||
$sql .= ",'".ereg_replace(",",".",$remise_percent)."'";
|
||||
$sql .= ",'".ereg_replace(",",".",$subprice)."'";
|
||||
$sql .= ",'".ereg_replace(",",".",$remise)."') ;";
|
||||
$sql .= ",'".price2num($remise_percent)."'";
|
||||
$sql .= ",'".price2num($subprice)."'";
|
||||
$sql .= ",'".price2num($remise)."') ;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
@ -458,7 +458,7 @@ class FactureRec
|
||||
$qty=1;
|
||||
}
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(",",".",$pu), 2);
|
||||
$price = round(price2num($pu), 2);
|
||||
$subprice = $price;
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
@ -471,11 +471,11 @@ class FactureRec
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc'";
|
||||
$sql .= ",price=".ereg_replace(",",".",$price);
|
||||
$sql .= ",subprice=".ereg_replace(",",".",$subprice);
|
||||
$sql .= ",remise=".ereg_replace(",",".",$remise);
|
||||
$sql .= ",remise_percent=".ereg_replace(",",".",$remise_percent);
|
||||
$sql .= ",qty=".ereg_replace(",",".",$qty);
|
||||
$sql .= ",price=".price2num($price);
|
||||
$sql .= ",subprice=".price2num($subprice);
|
||||
$sql .= ",remise=".price2num($remise);
|
||||
$sql .= ",remise_percent=".price2num($remise_percent);
|
||||
$sql .= ",qty=".price2num($qty);
|
||||
$sql .= " WHERE rowid = $rowid ;";
|
||||
|
||||
$result = $this->db->query( $sql);
|
||||
@ -536,11 +536,11 @@ class FactureRec
|
||||
$tvas = $calculs[5];
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET ";
|
||||
$sql .= " amount = ".ereg_replace(",",".",$this->amount_ht);
|
||||
$sql .= ", remise=".ereg_replace(",",".",$this->total_remise);
|
||||
$sql .= ", total=".ereg_replace(",",".",$this->total_ht);
|
||||
$sql .= ", tva=".ereg_replace(",",".",$this->total_tva);
|
||||
$sql .= ", total_ttc=".ereg_replace(",",".",$this->total_ttc);
|
||||
$sql .= " amount = ".price2num($this->amount_ht);
|
||||
$sql .= ", remise=".price2num($this->total_remise);
|
||||
$sql .= ", total=".price2num($this->total_ht);
|
||||
$sql .= ", tva=".price2num($this->total_tva);
|
||||
$sql .= ", total_ttc=".price2num($this->total_ttc);
|
||||
|
||||
$sql .= " WHERE rowid = $facid ;";
|
||||
|
||||
@ -578,7 +578,7 @@ class FactureRec
|
||||
|
||||
$this->remise_percent = $remise ;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET remise_percent = ".ereg_replace(",",".",$remise);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET remise_percent = ".price2num($remise);
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
|
||||
@ -80,7 +80,7 @@ if ($socidp)
|
||||
}
|
||||
if ($_GET["search_montant"])
|
||||
{
|
||||
$sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]);
|
||||
$sql .=" AND p.amount=".price2num($_GET["search_montant"]);
|
||||
}
|
||||
|
||||
if ($_GET["orphelins"]) // Option qui ne sert qu'au debogage
|
||||
|
||||
@ -78,10 +78,10 @@ if ($_POST["action"] == 'add_paiement')
|
||||
{
|
||||
$chid = $key;
|
||||
$value = trim($value);
|
||||
$amount = round(ereg_replace(",",".",$value), 2); // Un round est ok si nb avec '.'
|
||||
$amount = round(price2num($value), 2); // Un round est ok si nb avec '.'
|
||||
if (is_numeric($amount)) $total += $amount;
|
||||
}
|
||||
$total = ereg_replace(",",".",$total);
|
||||
$total = price2num($total);
|
||||
|
||||
// Insertion dans llx_bank
|
||||
$label = "Règlement charge";
|
||||
|
||||
@ -572,8 +572,8 @@ class Contrat
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$qty = ereg_replace(",",".",$qty);
|
||||
$pu = ereg_replace(",",".",$pu);
|
||||
$qty = price2num($qty);
|
||||
$pu = price2num($pu);
|
||||
|
||||
if ($fk_product > 0)
|
||||
{
|
||||
@ -591,7 +591,7 @@ class Contrat
|
||||
}
|
||||
|
||||
$remise = 0;
|
||||
$price = ereg_replace(",",".",round($pu, 2));
|
||||
$price = price2num(round($pu, 2));
|
||||
$subprice = $price;
|
||||
if (strlen($remise_percent) > 0)
|
||||
{
|
||||
@ -607,7 +607,7 @@ class Contrat
|
||||
if ($dateend > 0) { $sql.= ",date_fin_validite"; }
|
||||
$sql.= ") VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',";
|
||||
$sql.= ($fk_product>0 ? $fk_product : "null");
|
||||
$sql.= ",".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."'";
|
||||
$sql.= ",".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."'";
|
||||
if ($datestart > 0) { $sql.= ",".$this->db->idate($datestart); }
|
||||
if ($dateend > 0) { $sql.= ",".$this->db->idate($dateend); }
|
||||
$sql.= ");";
|
||||
@ -651,8 +651,8 @@ class Contrat
|
||||
$qty=trim($qty);
|
||||
$desc=trim($desc);
|
||||
$desc=trim($desc);
|
||||
$price = ereg_replace(",",".",$pu);
|
||||
$tvatx = ereg_replace(",",".",$tvatx);
|
||||
$price = price2num($pu);
|
||||
$tvatx = price2num($tvatx);
|
||||
$subprice = $price;
|
||||
$remise = 0;
|
||||
if (strlen($remise_percent) > 0)
|
||||
@ -670,12 +670,12 @@ class Contrat
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".addslashes($desc)."'";
|
||||
$sql .= ",price_ht='" . ereg_replace(",",".",$price)."'";
|
||||
$sql .= ",subprice='" . ereg_replace(",",".",$subprice)."'";
|
||||
$sql .= ",remise='" . ereg_replace(",",".",$remise)."'";
|
||||
$sql .= ",remise_percent='".ereg_replace(",",".",$remise_percent)."'";
|
||||
$sql .= ",price_ht='" . price2num($price)."'";
|
||||
$sql .= ",subprice='" . price2num($subprice)."'";
|
||||
$sql .= ",remise='" . price2num($remise)."'";
|
||||
$sql .= ",remise_percent='".price2num($remise_percent)."'";
|
||||
$sql .= ",qty='$qty'";
|
||||
$sql .= ",tva_tx='". ereg_replace(",",".",$tvatx)."'";
|
||||
$sql .= ",tva_tx='". price2num($tvatx)."'";
|
||||
|
||||
if ($datestart > 0) { $sql.= ",date_ouverture_prevue=".$this->db->idate($datestart); }
|
||||
else { $sql.=",date_ouverture_prevue=null"; }
|
||||
|
||||
@ -195,7 +195,7 @@ class Don
|
||||
$sql .= " fk_don_projet,";
|
||||
}
|
||||
$sql .= " note, fk_user_author, datedon, email)";
|
||||
$sql .= " VALUES (now(),".ereg_replace(",",".", $this->amount).", $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, ";
|
||||
$sql .= " VALUES (now(),".price2num($this->amount).", $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, ";
|
||||
if ($this->projetid)
|
||||
{
|
||||
$sql .= " $this->projetid,";
|
||||
|
||||
@ -332,7 +332,7 @@ class Expedition
|
||||
$p_qty = 1;
|
||||
}
|
||||
|
||||
$p_price = ereg_replace(",",".",$p_price);
|
||||
$p_price = price2num($p_price);
|
||||
|
||||
$price = $p_price;
|
||||
$subprice = $p_price;
|
||||
|
||||
@ -385,7 +385,7 @@ if (! $_GET['action'] && ! $_POST['action'])
|
||||
}
|
||||
if ($_GET["search_montant"])
|
||||
{
|
||||
$sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]);
|
||||
$sql .=" AND p.amount=".price2num($_GET["search_montant"]);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@ -547,7 +547,7 @@ class CommandeFournisseur
|
||||
$p_qty = 1;
|
||||
}
|
||||
|
||||
$p_price = ereg_replace(",",".",$p_price);
|
||||
$p_price = price2num($p_price);
|
||||
|
||||
$price = $p_price;
|
||||
$subprice = $p_price;
|
||||
@ -645,11 +645,11 @@ class CommandeFournisseur
|
||||
*
|
||||
*/
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur set";
|
||||
$sql .= " amount_ht ='".ereg_replace(",",".",$totalht)."'";
|
||||
$sql .= ", total_ht ='".ereg_replace(",",".",$totalht)."'";
|
||||
$sql .= ", tva ='".ereg_replace(",",".",$totaltva)."'";
|
||||
$sql .= ", total_ttc ='".ereg_replace(",",".",$totalttc)."'";
|
||||
$sql .= ", remise ='".ereg_replace(",",".",$total_remise)."'";
|
||||
$sql .= " amount_ht ='".price2num($totalht)."'";
|
||||
$sql .= ", total_ht ='".price2num($totalht)."'";
|
||||
$sql .= ", tva ='".price2num($totaltva)."'";
|
||||
$sql .= ", total_ttc ='".price2num($totalttc)."'";
|
||||
$sql .= ", remise ='".price2num($total_remise)."'";
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
|
||||
@ -120,7 +120,7 @@ class Product
|
||||
if (strlen($this->price)==0) $this->price = 0;
|
||||
if (strlen($this->envente)==0) $this->envente = 0; // deprecated
|
||||
if (strlen($this->status)==0) $this->status = 0;
|
||||
$this->price = ereg_replace(",",".",$this->price);
|
||||
$this->price = price2num($this->price);
|
||||
|
||||
dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid);
|
||||
|
||||
@ -263,13 +263,13 @@ class Product
|
||||
$sql_multiprix .= "WHERE date_price = now()";
|
||||
$sql_multiprix .= " and fk_product = ".$this->id;
|
||||
$sql_multiprix .= " and fk_user_author = ".$user->id;
|
||||
$sql_multiprix .= " and price = ".ereg_replace(",",".",$this->multiprices["$i"]);
|
||||
$sql_multiprix .= " and price = ".price2num($this->multiprices["$i"]);
|
||||
|
||||
$this->db->query($sql_multiprix);
|
||||
|
||||
// On ajoute nouveau tarif
|
||||
$sql_multiprix = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price_level,price) ";
|
||||
$sql_multiprix .= " VALUES(now(),".$this->id.",".$user->id.",".$i.",".ereg_replace(",",".",$this->multiprices["$i"]);
|
||||
$sql_multiprix .= " VALUES(now(),".$this->id.",".$user->id.",".$i.",".price2num($this->multiprices["$i"]);
|
||||
$sql_multiprix .= ")";
|
||||
if (! $this->db->query($sql_multiprix) )
|
||||
$queryError = true;
|
||||
@ -282,7 +282,7 @@ class Product
|
||||
$sql .= "WHERE date_price = now()";
|
||||
$sql .= " and fk_product = ".$this->id;
|
||||
$sql .= " and fk_user_author = ".$user->id;
|
||||
$sql .= " and price = ".ereg_replace(",",".",$this->price);
|
||||
$sql .= " and price = ".price2num($this->price);
|
||||
$sql .= " and envente = ".$this->envente;
|
||||
$sql .= " and tva_tx = ".$this->tva_tx;
|
||||
|
||||
@ -290,7 +290,7 @@ class Product
|
||||
|
||||
// On ajoute nouveau tarif
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
|
||||
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
|
||||
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($this->price).",".$this->envente.",".$this->tva_tx;
|
||||
$sql .= ")";
|
||||
if (! $this->db->query($sql) )
|
||||
$queryError = true;
|
||||
@ -310,7 +310,7 @@ class Product
|
||||
$sql .= "WHERE date_price = now()";
|
||||
$sql .= " and fk_product = ".$this->id;
|
||||
$sql .= " and fk_user_author = ".$user->id;
|
||||
$sql .= " and price = ".ereg_replace(",",".",$this->price);
|
||||
$sql .= " and price = ".price2num($this->price);
|
||||
$sql .= " and envente = ".$this->envente;
|
||||
$sql .= " and tva_tx = ".$this->tva_tx;
|
||||
|
||||
@ -318,7 +318,7 @@ class Product
|
||||
|
||||
// On ajoute nouveau tarif
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
|
||||
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
|
||||
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($this->price).",".$this->envente.",".$this->tva_tx;
|
||||
$sql .= ")";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
@ -404,7 +404,7 @@ class Product
|
||||
$sql .= " ,fk_product = ".$this->id;
|
||||
$sql .= " ,fk_soc = ".$id_fourn;
|
||||
$sql .= " ,fk_user = ".$user->id;
|
||||
$sql .= " ,price = ".ereg_replace(",",".",$buyprice);
|
||||
$sql .= " ,price = ".price2num($buyprice);
|
||||
$sql .= " ,quantity = ".$qty;
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
@ -419,7 +419,7 @@ class Product
|
||||
$sql .= " ,fk_product = ".$this->id;
|
||||
$sql .= " ,fk_soc = ".$id_fourn;
|
||||
$sql .= " ,fk_user = ".$user->id;
|
||||
$sql .= " ,price = ".ereg_replace(",",".",$buyprice);
|
||||
$sql .= " ,price = ".price2num($buyprice);
|
||||
$sql .= " ,quantity = ".$qty;
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
@ -463,7 +463,7 @@ class Product
|
||||
if (strlen(trim($this->price)) > 0 )
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
||||
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
|
||||
$sql .= " SET price = " . price2num($this->price);
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
@ -493,7 +493,7 @@ class Product
|
||||
if (strlen(trim($this->price)) > 0 )
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
||||
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
|
||||
$sql .= " SET price = " . price2num($this->price);
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
|
||||
@ -172,7 +172,7 @@ class Propal
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
|
||||
$sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".ereg_replace(",",".",$remise_percent)."','".ereg_replace(",",".",$subprice)."')";
|
||||
$sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".price2num($remise_percent)."','".price2num($subprice)."')";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
@ -230,7 +230,7 @@ class Propal
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
|
||||
$sql .= " (".$this->id.", 0,'". $p_qty."','". ereg_replace(",",".",$price)."','".$p_tva_tx."','".addslashes($p_desc)."','$remise_percent', '".ereg_replace(",",".",$subprice)."') ; ";
|
||||
$sql .= " (".$this->id.", 0,'". $p_qty."','". price2num($price)."','".$p_tva_tx."','".addslashes($p_desc)."','$remise_percent', '".price2num($subprice)."') ; ";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
@ -459,10 +459,10 @@ class Propal
|
||||
|
||||
// Met a jour en base
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
|
||||
$sql .= " price='". ereg_replace(",",".",$this->total_ht)."'";
|
||||
$sql .= ", tva='". ereg_replace(",",".",$this->total_tva)."'";
|
||||
$sql .= ", total='". ereg_replace(",",".",$this->total_ttc)."'";
|
||||
$sql .= ", remise='".ereg_replace(",",".",$this->remise)."'";
|
||||
$sql .= " price='". price2num($this->total_ht)."'";
|
||||
$sql .= ", tva='". price2num($this->total_tva)."'";
|
||||
$sql .= ", total='". price2num($this->total_ttc)."'";
|
||||
$sql .= ", remise='".price2num($this->remise)."'";
|
||||
$sql .=" WHERE rowid = $this->id";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
|
||||
@ -839,7 +839,7 @@ class Societe {
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$remise = ereg_replace(",",".",$remise);
|
||||
$remise = price2num($remise);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql .= " WHERE fk_soc = " . $this->id ." AND fk_facture IS NULL;";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user