Rcriture de l'insertion dans la base des infos
This commit is contained in:
parent
1b7d8b69a4
commit
86774941a0
@ -68,46 +68,23 @@ class PaiementFourn
|
||||
|
||||
$label = "Règlement facture $this->facnumber - $this->societe";
|
||||
|
||||
// Portion de code qui mériterait de se baser sur la table des types
|
||||
// de paiement, mais comme cette portion est aussi en dur dans l'ajout
|
||||
// des factures clients, je fais pareil pour les factures fournisseurs
|
||||
switch ($this->paiementid)
|
||||
{
|
||||
case 1:
|
||||
$this->paiementid = 'TIP';
|
||||
break;
|
||||
case 2:
|
||||
$this->paiementid = 'VIR';
|
||||
break;
|
||||
case 3:
|
||||
$this->paiementid = 'PRE';
|
||||
break;
|
||||
case 4:
|
||||
$this->paiementid = 'LIQ';
|
||||
break;
|
||||
case 5:
|
||||
$this->paiementid = 'WWW';
|
||||
break;
|
||||
case 6:
|
||||
$this->paiementid = 'CB';
|
||||
break;
|
||||
case 7:
|
||||
$this->paiementid = 'CHQ';
|
||||
break;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, amount, author, label, fk_type, fk_account, num_chq)";
|
||||
$sql .= " VALUES (now(), '$this->datepaye', -$this->amount, '$this->author', '$label', '$this->paiementid', '$this->accountid', '$this->num_paiement')";
|
||||
$result = $this->db->query($sql);
|
||||
$account = new Account($this->db, $this->accountid);
|
||||
|
||||
$result = $account->addline($this->datepaye,
|
||||
$this->paiementid,
|
||||
$label,
|
||||
-$this->amount,
|
||||
$this->num_paiement);
|
||||
|
||||
|
||||
// Mise a jour fk_bank dans llx_paiement_fourn
|
||||
if ($result) {
|
||||
$this->bankid = $this->db->last_insert_id();
|
||||
if ($result)
|
||||
{
|
||||
$this->bankid = $this->db->last_insert_id();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn SET fk_bank=$this->bankid WHERE rowid=$this->id";
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn SET fk_bank=$this->bankid WHERE rowid=$this->id";
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user