Suite gestion des avoirs.
This commit is contained in:
parent
ea42bcc543
commit
a845921850
@ -90,7 +90,7 @@ class Skeleton_class
|
||||
$resql=$this->update($user, 1);
|
||||
if ($resql < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class Skeleton_class
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("Skeleton_class::create ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
@ -136,7 +136,7 @@ class Skeleton_class
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
$this->error=$this->db->lasterror().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ class Skeleton_class
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->error();
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dolibarr_syslog("Skeleton_class::fetch ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
@ -204,10 +204,11 @@ class Skeleton_class
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dolibarr_syslog("Skeleton_class::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
$this->error=$this->db->lasterror().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -34,6 +34,7 @@
|
||||
require('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
|
||||
@ -75,6 +76,7 @@ if ($_GET["projetid"])
|
||||
$NBLINES=4;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -178,9 +180,9 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET['facid']);
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($fac->socid);
|
||||
$result = $fac->set_valid($fac->id, $user, $soc);
|
||||
$fac->fetch_client();
|
||||
|
||||
$result = $fac->set_valid($fac->id, $user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
@ -311,6 +313,29 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||
}
|
||||
}
|
||||
|
||||
// Convertir en reduc
|
||||
if ($_POST['action'] == 'confirm_converttoreduc' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET['facid']);
|
||||
$fac->fetch_client();
|
||||
|
||||
$result=$fac->set_payed($user);
|
||||
|
||||
// TODO A completer
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result=$discount->create($user);
|
||||
|
||||
$langs->load("other");
|
||||
$mesg=$langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Insertion facture
|
||||
*/
|
||||
@ -620,8 +645,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
$ret=$fac->fetch($_POST['facid']);
|
||||
$soc = new Societe($db);
|
||||
$ret=$soc->fetch($fac->socid);
|
||||
$ret=$fac->fetch_client();
|
||||
|
||||
$date_start='';
|
||||
$date_end='';
|
||||
@ -666,9 +690,9 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
// multiprix
|
||||
if ($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
$pu = $prod->multiprices[$soc->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$soc->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$soc->price_level];
|
||||
$pu = $prod->multiprices[$fac->client->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$fac->client->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$fac->client->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -685,7 +709,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
|
||||
$tva_tx = get_default_tva($mysoc,$fac->client,$prod->tva_tx);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1057,11 +1081,12 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$propal = New Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$societe_id = $propal->socid;
|
||||
$propal->fetch_client();
|
||||
|
||||
$projetid=$propal->projetidp;
|
||||
$ref_client=$propal->ref_client;
|
||||
|
||||
$soc->fetch($societe_id);
|
||||
$soc=$propal->client;
|
||||
$cond_reglement_id = $propal->cond_reglement_id;
|
||||
$mode_reglement_id = $propal->mode_reglement_id;
|
||||
$remise_percent = $propal->remise_percent;
|
||||
@ -1071,11 +1096,12 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$commande = New Commande($db);
|
||||
$commande->fetch($_GET['commandeid']);
|
||||
$societe_id = $commande->socid;
|
||||
$projetid=$commande-> projet_id;
|
||||
$commande->fetch_client();
|
||||
|
||||
$projetid=$commande->projet_id;
|
||||
$ref_client=$commande->ref_client;
|
||||
|
||||
$soc->fetch($societe_id);
|
||||
$soc=$commande->client;
|
||||
$cond_reglement_id = $commande->cond_reglement_id;
|
||||
$mode_reglement_id = $commande->mode_reglement_id;
|
||||
$remise_percent = $commande->remise_percent;
|
||||
@ -1085,10 +1111,11 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$contrat = New Contrat($db);
|
||||
$contrat->fetch($_GET['contratid']);
|
||||
$societe_id = $contrat->societe->id;
|
||||
$contrat->fetch_client();
|
||||
|
||||
$projetid=$contrat->fk_projet;
|
||||
|
||||
$soc=$contrat->societe;
|
||||
$soc=$contrat->client;
|
||||
$cond_reglement_id = $soc->cond_reglement;
|
||||
$mode_reglement_id = $soc->mod_reglement;
|
||||
$remise_percent = $soc->remise_client;
|
||||
@ -1096,9 +1123,7 @@ if ($_GET['action'] == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
$societe_id=$socid;
|
||||
|
||||
$soc->fetch($societe_id);
|
||||
$soc->fetch($socid);
|
||||
$cond_reglement_id = $soc->cond_reglement;
|
||||
$mode_reglement_id = $soc->mode_reglement;
|
||||
$remise_percent = $soc->remise_client;
|
||||
@ -1290,7 +1315,7 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
$html->select_projects($societe_id, $projetid, 'projetid');
|
||||
$html->select_projects($soc->id, $projetid, 'projetid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1633,8 +1658,18 @@ else
|
||||
dolibarr_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la facture
|
||||
*/
|
||||
* Confirmation de la conversion de l'avoir en reduc
|
||||
*/
|
||||
if ($_GET['action'] == 'converttoreduc')
|
||||
{
|
||||
$text=$langs->trans('ConfirmConvertToReduc');
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la facture
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteBill');
|
||||
@ -1643,8 +1678,8 @@ else
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
if ($_GET['action'] == 'valid')
|
||||
{
|
||||
// on vérifie si la facture est en numérotation provisoire
|
||||
@ -1898,12 +1933,16 @@ else
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Liste des paiements ou remboursements
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.($fac->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Amount').'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($fac->type != 2)
|
||||
{
|
||||
// Liste des paiements
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans('Payments').'</td><td>'.$langs->trans('Type').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Amount').'</td><td> </td></tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -2364,7 +2403,7 @@ else
|
||||
$html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="pu" size="6"></td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="'.($fac->type==2?'-1':'1').'" size="2"></td>';
|
||||
print '<td align="right" nowrap><input type="text" name="remise_percent" size="1" value="'.$soc->remise_client.'">%</td>';
|
||||
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
@ -2398,7 +2437,7 @@ else
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="1" size="2"></td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="'.($fac->type==2?'-1':'1').'" size="2"></td>';
|
||||
print '<td align="right" nowrap><input type="text" name="remise_percent" size="1" value="'.$soc->remise_client.'">%</td>';
|
||||
print '<td align="center" valign="middle" rowspan="2" colspan="5"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
@ -2513,13 +2552,19 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
// Emettre remboursement
|
||||
/* Pas encore géré
|
||||
if ($fac->type == 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
// Emettre remboursement ou Convertir en reduc
|
||||
if ($fac->type == 2)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a>';
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a>';
|
||||
}
|
||||
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Classer 'payé'
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement &&
|
||||
@ -2545,8 +2590,6 @@ else
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
|
||||
// \todo
|
||||
// Ajouter bouton "Annuler et Créer facture remplacement"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
*
|
||||
@ -241,7 +241,14 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
|
||||
if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
|
||||
print_fiche_titre($title);
|
||||
|
||||
|
||||
// Bouchon
|
||||
if ($facture->type == 2)
|
||||
{
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Initialise donnees pour page de confirmation
|
||||
if ($_POST["action"] == 'add_paiement')
|
||||
{
|
||||
|
||||
@ -303,7 +303,7 @@ class Contrat extends CommonObject
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
|
||||
$this->socid = $result["fk_soc"];
|
||||
$this->societe->fetch($result["fk_soc"]);
|
||||
$this->societe->fetch($result["fk_soc"]); // TODO A virer car la societe doit etre chargé par appel de fetch_client()
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -61,7 +61,8 @@ class DiscountAbsolute
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql.= " WHERE rowid=".$rowid;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
dolibarr_syslog("DiscountAbsolute::fetch sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
@ -92,6 +93,62 @@ class DiscountAbsolute
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create in database
|
||||
* \param user User that create
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql .= " (datec, fk_soc, amount_ht, fk_user, description)";
|
||||
$sql .= " VALUES (now(),".$this->fk_soc.",'".$this->amount_ht."',".$user->id.",'".addslashes($this->desc)."')";
|
||||
|
||||
dolibarr_syslog("DiscountAbsolute::create sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except");
|
||||
return $rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("Skeleton_class::create ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Delete object in database
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_facture IS NULL";
|
||||
|
||||
dolibarr_syslog("DiscountAbsolute::delete sql=".$sql);
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Link the discount to a particular invoice
|
||||
* \param rowid Invoice id
|
||||
|
||||
@ -980,14 +980,14 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tag la facture comme validée + appel trigger BILL_VALIDATE
|
||||
* \param rowid Id de la facture à valider
|
||||
* \param user Utilisateur qui valide la facture
|
||||
* \param soc Objet societe
|
||||
* \param force_number Référence à forcer de la facture
|
||||
* \brief Tag la facture comme validée + appel trigger BILL_VALIDATE
|
||||
* \param rowid Id de la facture à valider
|
||||
* \param user Utilisateur qui valide la facture
|
||||
* \param soc Ne sert plus \\TODO A virer
|
||||
* \param force_number Référence à forcer de la facture
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function set_valid($rowid, $user, $soc, $force_number='')
|
||||
function set_valid($rowid, $user, $soc='', $force_number='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -996,6 +996,8 @@ class Facture extends CommonObject
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$this->fetch_client();
|
||||
|
||||
// Verification paramètres
|
||||
if ($this->type == 1) // si facture de remplacement
|
||||
{
|
||||
@ -1046,8 +1048,8 @@ class Facture extends CommonObject
|
||||
$numfa = $force_number;
|
||||
}
|
||||
else if ($facref == 'PROV')
|
||||
{
|
||||
$numfa = $this->getNextNumRef($soc);
|
||||
{
|
||||
$numfa = $this->getNextNumRef($this->client);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1200,9 +1202,7 @@ class Facture extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
// Classe la société rattachée comme client
|
||||
$soc=new Societe($this->db);
|
||||
$soc->id = $this->socid;
|
||||
$result=$soc->set_as_client();
|
||||
$result=$this->client->set_as_client();
|
||||
|
||||
$this->ref = $numfa;
|
||||
|
||||
@ -1357,6 +1357,13 @@ class Facture extends CommonObject
|
||||
$pu = price2num($pu);
|
||||
$txtva=price2num($txtva);
|
||||
|
||||
// Si facture de type avoir, le montant est forcé négatif
|
||||
if ($this->type == 2)
|
||||
{
|
||||
// $pu=-abs($pu);
|
||||
// $txtva=-abs($txtva);
|
||||
}
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
|
||||
@ -100,7 +100,7 @@ if ( $societe->fetch($socid) )
|
||||
|
||||
print "</table><br />";
|
||||
|
||||
print '<table width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" width="50%">';
|
||||
|
||||
$file = get_exdir($societe->id, 3) . "ca_genere-".$societe->id.".png";
|
||||
|
||||
@ -651,7 +651,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY ($col2x, $tab2_top + 0);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_ht + $object->remise)), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
|
||||
|
||||
// Remise globale
|
||||
if ($object->remise > 0)
|
||||
@ -666,7 +666,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("WithDiscountTotalHT"), 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_ht)), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht), 0, 'R', 1);
|
||||
|
||||
$index = 2;
|
||||
}
|
||||
@ -690,7 +690,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($tvaval)), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
if (! $this->atleastoneratenotnull)
|
||||
@ -700,7 +700,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_tva)), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
|
||||
}
|
||||
|
||||
$useborder=0;
|
||||
|
||||
@ -13,10 +13,10 @@ InvoiceStandardAsk=Standard invoice
|
||||
InvoiceStandardDesc=This kind of invoice is the common invoice.
|
||||
InvoiceReplacement=Replacement invoice. Must replace invoice with reference
|
||||
InvoiceReplacementAsk=Replacement invoice for invoice
|
||||
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to cancel and replace completely an invoice with no paiement already recevided.<br>Reference of canceled invoice is required.
|
||||
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to cancel and replace completely an invoice with no paiement already received.<br><br>Note: Only invoice with payment on it can be replaced. If not closed, it will be automatically closed to 'abandonned'.
|
||||
InvoiceAvoir=Credit note
|
||||
InvoiceAvoirAsk=Credit note to correct invoice
|
||||
InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to solve fact that an invoice has an higher amount that should be (all possible reasons) or a product returned after invoice was payed.
|
||||
InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to solve fact that an invoice has an amount that differs than amount really payed (because customer payed too much by error, or will not payed completely since he returned some products for example).<br><br>Note: Original invoice must already be closed ('payed' or 'payed partially') to allow creation of a credit note on it.
|
||||
ReplaceInvoice=Replace invoice %s
|
||||
ReplacementInvoice=Replacement invoice
|
||||
ReplacedByInvoice=Replaced by invoice %s
|
||||
@ -40,9 +40,12 @@ SupplierBill=Supplier invoice
|
||||
SupplierBills=suppliers invoices
|
||||
BillContacts=Invoice contacts
|
||||
Payment=Payment
|
||||
PaymentBack=Payment back
|
||||
Payments=Payments
|
||||
PaymentsBack=Payments back
|
||||
DeletePayment=Delete payment
|
||||
ConfirmDeletePayment=Are you sure you want to delete this payment ?
|
||||
ConfirmConvertToReduc=Do you want to convert this credit note into absolute discount ?<br>The amount of this credit note will so be saved among all discounts and could be used as a discount for a future invoice for this customer.
|
||||
ReceivedPayments=Received payments
|
||||
ReceivedCustomersPayments=Payments received from customers
|
||||
ReceivedCustomersPaymentsToValid=Received customers payments to validate
|
||||
@ -60,7 +63,7 @@ ClassifyPayedPartially=Classify 'Payed partially'
|
||||
ClassifyCanceled=Classify 'Abandonned'
|
||||
ClassifyClosed=Classify 'Closed'
|
||||
CreateBill=Create Invoice
|
||||
AddBill=Add invoice
|
||||
AddBill=Add invoice or credit note
|
||||
DeleteBill=Delete invoice
|
||||
SearchABill=Search an invoice
|
||||
CancelBill=Cancel an invoice
|
||||
@ -68,6 +71,7 @@ SendByMail=EMail
|
||||
SendRemindByMail=EMail reminder
|
||||
DoPayment=Do payment
|
||||
DoPaymentBack=Do payment back
|
||||
ConvertToReduc=Convert into future discount
|
||||
EnterPaymentReceivedFromCustomer=Enter payment received from customer
|
||||
EnterPaymentDueToCustomer=Make payment due to customer
|
||||
VAT=VAT
|
||||
@ -126,13 +130,13 @@ ConfirmClassifyPayedPartiallyReasonDiscountNoVat=Remainder to pay <b>(%s %s)</b>
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountVat=Remainder to pay <b>(%s %s)</b> is a discount granted because payment was made before term. Je récupère la TVA sur cet escompte sans avoir.
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomer=Bad customer
|
||||
ConfirmClassifyPayedPartiallyReasonProductReturned=Products partially returned
|
||||
ConfirmClassifyPayedPartiallyReasonOther=Debit irremediably not recoverable (other reason)
|
||||
ConfirmClassifyPayedPartiallyReasonOther=Amount abandonned for other reason
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountNoVatDesc=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: « escompte net de taxe »)
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountVatDesc=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
|
||||
ConfirmClassifyPayedPartiallyReasonAvoirDesc=Use this choice if all other does not suit
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomerDesc=This choice will be use for bad customers with no hope to be paied
|
||||
ConfirmClassifyPayedPartiallyReasonProductReturnedDesc=This choice is used when apyment is not complete because some of products were returned
|
||||
ConfirmClassifyPayedPartiallyReasonOtherDesc=Use this choice if all other does not suit
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomerDesc=A <b>bad customers</b> is a customer that refuse to pay his debt.
|
||||
ConfirmClassifyPayedPartiallyReasonProductReturnedDesc=This choice is used when payment is not complete because some of products were returned
|
||||
ConfirmClassifyPayedPartiallyReasonOtherDesc=Use this choice if all other does not suit, for example in following situation:<br>- payment not complete because some products were shipped back<br>- amount claimed too important because a discount was forgotten<br>In all cases, amount over-claimed must be corrected in accountancy system by creating a credit note.
|
||||
ConfirmCustomerPayment=Do you confirm this paiement input for <b>%s</b> %s ?
|
||||
ValidateBill=Validate invoice
|
||||
NumberOfBills=Nb of invoices
|
||||
@ -204,7 +208,7 @@ DiscountAlreadyCounted=Discount already counted
|
||||
BillAddress=Bill address
|
||||
HelpEscompte=This discount is a discount granted to customer because its paiement was made before term.
|
||||
HelpAbandonBadCustomer=This amount has been abandoned (customer said to be a bad customer) and is considered as an exceptionnal loose.
|
||||
HelpAbandonOther=This amount has been abandoned and is considered as an exceptionnal loose.
|
||||
HelpAbandonOther=This amount has been abandoned since it was an error. It must be corrected in accountancy system by creating a credit note.
|
||||
# PaymentConditions
|
||||
PaymentConditionShortRECEP=Immediate
|
||||
PaymentConditionRECEP=Immediate
|
||||
|
||||
@ -13,10 +13,10 @@ InvoiceStandardAsk=Facture standard
|
||||
InvoiceStandardDesc=Ce type de facture est la facture traditionnelle. On l'appelle aussi <b>facture de doit</b> (du verbe devoir).
|
||||
InvoiceReplacement=Facture de remplacement
|
||||
InvoiceReplacementAsk=Facture de remplacement de la facture
|
||||
InvoiceReplacementDesc=La <b>facture de remplacement</b> sert à annuler et remplacer une facture existante sur laquelle aucun paiement n'a encore eu lieu.<br>La référence de la facture qui doit être annulée est obligatoire.
|
||||
InvoiceReplacementDesc=La <b>facture de remplacement</b> sert à annuler et remplacer une facture existante sur laquelle aucun paiement n'a encore eu lieu.<br><br>Rem: Seule une facture sans aucun paiement peut être remplacée. Si cette dernière n'est pas fermée, elle le sera automatiquement au statut 'abandonnée'.
|
||||
InvoiceAvoir=Facture avoir
|
||||
InvoiceAvoirAsk=Facture avoir pour correction de la facture
|
||||
InvoiceAvoirDesc=La <b>facture d'avoir</b> est une facture négative destinée à compenser une facture comportant un montant supérieur à ce qui aurait du (toutes causes possibles) ou parce qu'un produit a été retourné après que la facture soit payée.
|
||||
InvoiceAvoirDesc=La <b>facture d'avoir</b> est une facture négative destinée à compenser un montant de facture qui diffère du montant réellement versé (suite à une trop versé par le client par erreur ou un manque non versé par le client suite à une retour produit par exemple).<br><br>Rem: Notons que la facture originale à corriger doit avoir fermé ('payée' ou 'payée partiellement') pour pouvoir faire l'avoir.
|
||||
ReplaceInvoice=Remplace la facture %s
|
||||
ReplacementInvoice=Remplacement facture
|
||||
ReplacedByInvoice=Remplacée par la facture %s
|
||||
@ -40,9 +40,12 @@ SupplierBill=Facture fournisseur
|
||||
SupplierBills=Factures fournisseurs
|
||||
BillContacts=Contacts facture
|
||||
Payment=Réglement
|
||||
PaymentBack=Remboursement
|
||||
Payments=Réglements
|
||||
PaymentsBack=Remboursements
|
||||
DeletePayment=Supprimer le paiement
|
||||
ConfirmDeletePayment=Etes vous sur de vouloir supprimer ce paiement ?
|
||||
ConfirmConvertToReduc=Voulez-vous convertir cet avoir en réduction future ?<br>Le montant de cet avoir sera alors stocké en réduction fixe en attente pour le client. Cette dernière pourra être utilisée pour réduire le montant d'une prochaine facture de ce client.
|
||||
ReceivedPayments=Réglements reçus
|
||||
ReceivedCustomersPayments=Réglements reçus du client
|
||||
ReceivedCustomersPaymentsToValid=Réglements clients reçus à valider
|
||||
@ -60,7 +63,7 @@ ClassifyPayedPartially=Classer 'Pay
|
||||
ClassifyCanceled=Classer 'Abandonnée'
|
||||
ClassifyClosed=Classer 'Fermée'
|
||||
CreateBill=Créer Facture
|
||||
AddBill=Créer facture
|
||||
AddBill=Créer facture ou avoir
|
||||
DeleteBill=Supprimer facture
|
||||
SearchABill=Rechercher une facture
|
||||
CancelBill=Annuler une facture
|
||||
@ -68,6 +71,7 @@ SendByMail=Envoyer
|
||||
SendRemindByMail=Envoyer rappel
|
||||
DoPayment=Émettre réglement
|
||||
DoPaymentBack=Émettre remboursement
|
||||
ConvertToReduc=Convertir en réduction future
|
||||
EnterPaymentReceivedFromCustomer=Saisie d'un réglement reçu du client
|
||||
EnterPaymentDueToCustomer=Réaliser réglement d'avoirs dus au client
|
||||
VAT=TVA
|
||||
@ -126,13 +130,13 @@ ConfirmClassifyPayedPartiallyReasonDiscountNoVat=Le reste
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountVat=Le reste à payer <b>(%s %s)</b> est un escompte
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomer=Mauvais payeur
|
||||
ConfirmClassifyPayedPartiallyReasonProductReturned=Produits en partie retournés
|
||||
ConfirmClassifyPayedPartiallyReasonOther=Créance définitivement abandonnée (tout autre cas)
|
||||
ConfirmClassifyPayedPartiallyReasonOther=Créance abandonnée pour autre raison
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountNoVatDesc=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «escompte net de taxe»)
|
||||
ConfirmClassifyPayedPartiallyReasonDiscountVatDesc=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: mention définissant l'escompte ou du genre «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
|
||||
ConfirmClassifyPayedPartiallyReasonAvoirDesc=Ce choix est le choix à prendre si les autres ne sont pas applicables
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomerDesc=Ce choix sera celui dans le cas d'un mauvais payeur
|
||||
ConfirmClassifyPayedPartiallyReasonBadCustomerDesc=Un <b>mauvais payeur</b> est un client qui refuse de régler sa dète.
|
||||
ConfirmClassifyPayedPartiallyReasonProductReturnedDesc=Ce choix sera celui dans le cas paiement incomplet suite à retour d'une partie des produits
|
||||
ConfirmClassifyPayedPartiallyReasonOtherDesc=Ce choix sera celui dans tout autre cas.<br>Par exemple, dans le cas d'un paiement partiel car une partie des produits a été retourné.
|
||||
ConfirmClassifyPayedPartiallyReasonOtherDesc=Ce choix sera celui dans tout autre cas, par exemple, dans les cas suivant:<br>- paiement partiel car une partie des produits a été retourné.<br>- trop réclamé suite à oubli d'une remise<br>Dans tous les cas, le trop réclamé doit etre régularisé en compta et envers le client par un avoir.
|
||||
ConfirmClassifyAbandonReasonOther=Autre
|
||||
ConfirmClassifyAbandonReasonOtherDesc=Ce choix sera celui dans tout autre cas. Par exemple suite à intention de créer une facture de remplacement.
|
||||
ConfirmCustomerPayment=Confirmez-vous la saisie de ce réglement de <b>%s</b> %s ?
|
||||
@ -206,7 +210,7 @@ DiscountAlreadyCounted=Remises fixes d
|
||||
BillAddress=Adresse de facturation
|
||||
HelpEscompte=Un <b>escompte</b> est une remise accordée, sur une facture donnée, à un client car ce dernier a réalisé son réglement bien avant l'échéance.
|
||||
HelpAbandonBadCustomer=Ce montant a été abandonné (client jugé mauvais payeur) et est considéré comme un perte exceptionnelle.
|
||||
HelpAbandonOther=Ce montant a été abandonné et est considéré comme un perte exceptionnelle.
|
||||
HelpAbandonOther=Ce montant a été abandonné car il s'agissait d'un trop réclamé (oubli de remise ou retour produit du client). Il doit être régularisé en compta par la saisie d'un avoir.
|
||||
# PaymentConditions
|
||||
PaymentConditionShortRECEP=A réception
|
||||
PaymentConditionRECEP=A réception de facture
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -30,6 +30,8 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||
|
||||
|
||||
/**
|
||||
\class Societe
|
||||
@ -961,20 +963,19 @@ class Societe
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
$remise = price2num($remise);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql .= " (datec, fk_soc, amount_ht, fk_user, description)";
|
||||
$sql .= " VALUES (now(),".$this->id.",'".$remise."',".$user->id.",'".addslashes($desc)."')";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fk_soc=$this->id;
|
||||
$discount->amount_ht=$remise;
|
||||
$discount->desc=$desc;
|
||||
$result=$discount->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except");
|
||||
$this->error=$discount->error;
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else return 0;
|
||||
@ -989,18 +990,10 @@ class Societe
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql.= " WHERE rowid = ".$id." AND fk_facture IS NULL";
|
||||
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$discount->fetch($id);
|
||||
$result=$discount->delete();
|
||||
return $result;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
\brief Script de mise a jour des contacts dans LDAP depuis base Dolibarr
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
// Test si mode CLI
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file=__FILE__;
|
||||
if (eregi('([^\\\/]+)$',$script_file,$reg)) $script_file=$reg[1];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user