facture prefix
This commit is contained in:
parent
b007034348
commit
5060975e20
@ -1542,6 +1542,29 @@ class Bdd {
|
||||
}
|
||||
return $total < 0;
|
||||
}
|
||||
|
||||
private function getProduitDevisById($produitDevisId){
|
||||
$sql = "SELECT * FROM ".$this->tableprefix."produit_devis as produit_devis
|
||||
WHERE produit_devis.id = ?;";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$produitDevisId]);;
|
||||
|
||||
if(!empty($result)){
|
||||
return $result[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getFactureByDevisId($devisId){
|
||||
$sql = "SELECT * FROM ".$this->tableprefix."facture as facture
|
||||
WHERE facture.id_devis = ?";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$devisId]);
|
||||
if(!empty($result)){
|
||||
return $result[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE
|
||||
@ -1610,7 +1633,29 @@ class Bdd {
|
||||
} else if(strcmp($table, "ligne_trajet")==0 && (strcmp($column, "id_devis")==0 || strcmp($column, "date")==0 || strcmp($column, "id_lieu")==0 || strcmp($column, "rang")==0)) {
|
||||
$ligne_trajet = json_decode($this->getOneTrajetdetails($id, $idNextcloud))[0];
|
||||
$this->update_lieu_date_devis_rang_ligneTrajet($ligne_trajet, $column, htmlentities(rtrim($data)), $idNextcloud);
|
||||
} else {
|
||||
}
|
||||
else if(strcmp($table,"produit_devis") == 0 && (strcmp($column,"quantite") == 0)){
|
||||
$sql = "UPDATE ".$this->tableprefix.$table." SET $column = ? WHERE `id` = ?";
|
||||
$this->execSQLNoData($sql, array(trim(string: $data), $id));
|
||||
$produitDevis = $this->getProduitDevisById($id);
|
||||
if($produitDevis){
|
||||
$devisId = $produitDevis['devis_id'];
|
||||
$devis = json_decode($this->getOneDevis($devisId, $idNextcloud))[0];
|
||||
if($devis){
|
||||
$facture = $this->getFactureByDevisId($devisId);
|
||||
$isDevisNegative = $this->isDevisNegative($devisId,$devis->clientid);
|
||||
if($isDevisNegative){
|
||||
$factureNumber = $facture["facture_number"];
|
||||
$facturePrefix = "AVO";
|
||||
$facturationDatetime = new Datetime($facture["date"]);
|
||||
$fullFactureNumber = DateHelpers::GetFullFactureOrDevisNumberByDate($facturationDatetime,$factureNumber,$facturePrefix);
|
||||
$sql = "UPDATE ".$this->tableprefix."facture SET `num`= ? WHERE `id` = ?";
|
||||
$this->execSQLNoData($sql, array($fullFactureNumber, $facture['id']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql = "UPDATE ".$this->tableprefix.$table." SET $column = ? WHERE `id` = ?";
|
||||
$this->execSQLNoData($sql, array(trim($data), $id));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user