From 4f04b8b22df167bc42e04ef674c636077ba266ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Apr 2006 15:09:44 +0000 Subject: [PATCH] New: task #3405 : Ajouter les remises clients aux commandes --- ChangeLog | 9 +- htdocs/commande/commande.class.php | 200 +++++---- htdocs/commande/fiche.php | 377 +++++++++++----- htdocs/compta/commande/fiche.php | 402 +++++++++++++----- htdocs/compta/facture.php | 2 +- htdocs/expedition/commande.php | 248 ++++++++--- htdocs/facture.class.php | 10 +- .../menus/barre_left/eldy_backoffice.php | 2 +- .../menus/barre_left/eldy_frontoffice.php | 2 +- htdocs/langs/en_US/admin.lang | 3 +- htdocs/langs/en_US/users.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 3 +- htdocs/propal.class.php | 3 +- mysql/migration/2.0.0-2.1.0.sql | 13 +- mysql/tables/llx_commande.sql | 5 +- 15 files changed, 923 insertions(+), 358 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce316a025af..18ba481038b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,16 +3,23 @@ English Dolibarr changelog ***** Changelog for 2.1 compared to 2.0.1 ***** +- Support credit note and discounts (relative and absolute) on + commercial proposal and invoices. - Added an export tool to export main dolibarr data. - Added product categories management. - Graphical enhancements (picto to describe all status). - New permissions (can restrict access for a commercial user to elements of its companies only). -- Lot of fixes after 2.0 release not fixed in 2.0.1 - Little enhancements to OSCommerce module. - Provide PDF generation for orders. +- Building a PDF document for invoices works like other modules. You + can change model just before generating the PDF. - Can make one payment for several supplier invoices. +- Code cleaner. +- Better compatibility with different PHP version or setup. +- Lot of fixes after 2.0 release not fixed in 2.0.1 + ***** Changelog for 2.0.1 compared to 2.0 ***** diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 48f3a2069b6..61e3522d5a4 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -48,6 +48,10 @@ class Commande var $mode_reglement_id; var $mode_reglement_code; var $adresse_livraison_id; + var $date; // Date commande + var $date_livraison; // Date livraison souhaitée + var $remise_percent; + var $remise_absolue; // Pour board var $nbtodo; @@ -82,6 +86,9 @@ class Commande $this->sources[4] = $langs->trans('OrderSource4'); $this->sources[5] = $langs->trans('OrderSource5'); + $this->remise = 0; + $this->remise_percent = 0; + $this->products = array(); } @@ -302,14 +309,18 @@ class Commande } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande ('; - $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client, model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison) '; + $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client,'; + $sql.= ' model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison,'; + $sql.= ' remise_absolue, remise_percent)'; $sql.= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.','; $sql.= ' '.$this->db->idate($this->date_commande).','; $sql.= ' '.$this->source.', '; $sql.= " '".addslashes($this->note)."', "; $sql.= " '".$this->ref_client."', '".$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\','; $sql.= " '".($this->date_livraison?$this->db->idate($this->date_livraison):'null').'\','; - $sql.= " '".$this->adresse_livraison_id."')"; + $sql.= " '".$this->adresse_livraison_id."',"; + $sql.= " '".$this->remise_absolue."',"; + $sql.= " '".$this->remise_percent."')"; dolibarr_syslog("Commande.class.php::create sql=$sql"); if ( $this->db->query($sql) ) @@ -629,10 +640,11 @@ class Commande */ function fetch($id) { - $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement'; - $sql .= ', '.$this->db->pdate('c.date_commande').' as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note, c.ref_client, c.model_pdf, c.date_livraison, c.fk_adresse_livraison'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql .= ' WHERE c.rowid = '.$id; + $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,'; + $sql.= ' '.$this->db->pdate('c.date_commande').' as date_commande, '.$this->db->pdate('c.date_livraison').' as date_livraison,'; + $sql.= ' c.fk_projet, c.remise_percent, c.remise_absolue, c.source, c.facture, c.note, c.ref_client, c.model_pdf, c.fk_adresse_livraison'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; + $sql.= ' WHERE c.rowid = '.$id; $result = $this->db->query($sql) ; if ( $result ) @@ -649,6 +661,7 @@ class Commande $this->total_ttc = $obj->total_ttc; $this->date = $obj->date_commande; $this->remise_percent = $obj->remise_percent; + $this->remise_absolue = $obj->remise_absolue; $this->source = $obj->source; $this->facturee = $obj->facture; $this->note = $obj->note; @@ -871,30 +884,129 @@ class Commande } } - /** - * - * - */ + /** + * \brief Applique une remise relative + * \param user User qui positionne la remise + * \param remise + * \return int <0 si ko, >0 si ok + */ function set_remise($user, $remise) { + $remise=trim($remise)?trim($remise):0; + if ($user->rights->commande->creer) { - $remise = ereg_replace(',','.',$remise); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET remise_percent = '.$remise; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - if ($this->db->query($sql) ) + $remise=price2num($remise); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET remise_percent = '.$remise; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; + + if ($this->db->query($sql)) { $this->remise_percent = $remise; - $this->update_price(); + $this->update_price($this->id); return 1; } else { - dolibarr_syslog('Commande::set_remise Erreur SQL'); + $this->error=$this->db->error(); + return -1; } } } -/** + + + /** + * \brief Applique une remise absolue + * \param user User qui positionne la remise + * \param remise + * \return int <0 si ko, >0 si ok + */ + function set_remise_absolue($user, $remise) + { + $remise=trim($remise)?trim($remise):0; + + if ($user->rights->commande->creer) + { + $remise=price2num($remise); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; + $sql.= ' SET remise_absolue = '.$remise; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; + + dolibarr_syslog("Commande::set_remise_absolue sql=$sql"); + + if ($this->db->query($sql)) + { + $this->remise_absolue = $remise; + $this->update_price($this->id); + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + } + + /** + * \brief Mets à jour le prix total de la proposition + * \return int <0 si ko, >0 si ok + */ + function update_price() + { + include_once DOL_DOCUMENT_ROOT . "/lib/price.lib.php"; + + /* + * Liste des produits a ajouter + */ + $sql = "SELECT price, qty, tva_tx FROM ".MAIN_DB_PREFIX."commandedet"; + $sql.= " WHERE fk_commande = ".$this->id; + if ( $this->db->query($sql) ) + { + $num = $this->db->num_rows(); + $i = 0; + + while ($i < $num) + { + $obj = $this->db->fetch_object(); + $products[$i][0] = $obj->price; + $products[$i][1] = $obj->qty; + $products[$i][2] = $obj->tva_tx; + $i++; + } + } + $calculs = calcul_price($products, $this->remise_percent, $this->remise_absolue); + + $this->total_remise = $calculs[3]; + $this->amount_ht = $calculs[4]; + $this->total_ht = $calculs[0]; + $this->total_tva = $calculs[1]; + $this->total_ttc = $calculs[2]; + $tvas = $calculs[5]; + + // Met a jour en base + $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET"; + $sql .= " total_ht='". price2num($this->total_ht)."'"; + $sql .= ", tva='". price2num($this->total_tva)."'"; + $sql .= ", total_ttc='".price2num($this->total_ttc)."'"; + $sql .= ", remise='".price2num($this->total_remise)."'"; + $sql .=" WHERE rowid = ".$this->id; + + if ( $this->db->query($sql) ) + { + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + + /** * \brief Définit une date de livraison * \param user Objet utilisateur qui modifie * \param date_livraison Date de livraison @@ -1146,61 +1258,7 @@ class Commande } } - /** - * Mettre à jour le prix - * - */ - function update_price() - { - include_once DOL_DOCUMENT_ROOT . '/lib/price.lib.php'; - /* - * Liste des produits a ajouter - */ - $sql = 'SELECT price, qty, tva_tx FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = $this->id"; - if ( $this->db->query($sql) ) - { - $num = $this->db->num_rows(); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object(); - $products[$i][0] = $obj->price; - $products[$i][1] = $obj->qty; - $products[$i][2] = $obj->tva_tx; - $i++; - } - } - $calculs = calcul_price($products, $this->remise_percent); - $totalht = $calculs[0]; - $totaltva = $calculs[1]; - $totalttc = $calculs[2]; - $total_remise = $calculs[3]; - - $this->remise = $total_remise; - $this->total_ht = $totalht; - $this->total_tva = $totaltva; - $this->total_ttc = $totalttc; - /* - * - */ - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande 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 .= " WHERE rowid = $this->id"; - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print 'Erreur mise à jour du prix

'.$sql; - return -1; - } - } /** * \brief Mets à jour une ligne de commande * \param rowid Id de la ligne de facture diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0de26af413e..359a7bce538 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -89,13 +89,14 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) $commande->note = $_POST['note']; $commande->source = $_POST['source_id']; $commande->projetid = $_POST['projetid']; + $commande->remise_absolue = $_POST['remise_absolue']; $commande->remise_percent = $_POST['remise_percent']; $commande->ref_client = $_POST['ref_client']; $commande->modelpdf = $_POST['model']; $commande->cond_reglement_id = $_POST['cond_reglement_id']; - $commande->mode_reglement_id = $_POST['mode_reglement_id']; - $commande->date_livraison = $datelivraison; - $commande->adresse_livraison_id = $_POST['adresse_livraison_id']; + $commande->mode_reglement_id = $_POST['mode_reglement_id']; + $commande->date_livraison = $datelivraison; + $commande->adresse_livraison_id = $_POST['adresse_livraison_id']; $commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']); $commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']); @@ -172,6 +173,22 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer) if ($result < 0) dolibarr_print_error($db,$commande->error); } +if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->facture->creer) +{ + $commande = new Commande($db); + $commande->fetch($_REQUEST['id']); + $result = $commande->set_remise($user, $_POST['remise_percent']); + $_GET['id']=$_REQUEST['id']; +} + +if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->facture->creer) +{ + $commande = new Commande($db); + $commande->fetch($_REQUEST['id']); + $result = $commande->set_remise_absolue($user, $_POST['remise_absolue']); + $_GET['id']=$_REQUEST['id']; +} + if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) { /* @@ -209,8 +226,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POST['save'] == $langs->trans('Save')) { $commande = new Commande($db,'',$_POST['id']); - if (! $commande->fetch($_POST['id']) > 0) - dolibarr_print_error($db); + if (! $commande->fetch($_POST['id']) > 0) dolibarr_print_error($db); + $result = $commande->update_line($_POST['elrowid'], $_POST['eldesc'], $_POST['elprice'], @@ -314,7 +331,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print_titre($langs->trans('CreateOrder')); if ($mesg) print $mesg.'
'; - + $new_commande = new Commande($db); if ($propalid) @@ -332,7 +349,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) } $resql = $db->query($sql); if ( $resql ) - { + { $num = $db->num_rows($resql); if ($num) { @@ -340,9 +357,8 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) $soc = new Societe($db); $soc->fetch($obj->idp); - - $nbrow=8; - if ($conf->projet->enabled) $nbrow++; + + $nbrow=7; print '

'; print ''; @@ -359,60 +375,94 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // Reference client print ''.$langs->trans('RefCustomer').''; print ''; - print ''; + print ''; print ''; // Client - print ''.$langs->trans('Customer').''.$soc->nom_url.''; + print ''.$langs->trans('Customer').''.img_object($langs->trans("ShowCompany"),'company').' '.$soc->nom_url.''; print ''; print ''.$langs->trans('Date').''; $html->select_date('','re','','','',"crea_commande"); print ''; - + // Date de livraison print "".$langs->trans("DateDelivery").""; if ($conf->global->DATE_LIVRAISON_WEEK_DELAY) { - $tmpdte = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + $tmpdte = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $html->select_date($tmpdte,'liv_','','',1,"crea_commande"); } else { $html->select_date(-1,'liv_','','',1,"crea_commande"); - } - print ""; - - // Adresse de livraison - print ''.$langs->trans('DeliveryAddress').''; - $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socidp'],'adresse_livraison_id'); - - if ($numaddress==0) - { - print '   id.'&action=create>'.$langs->trans("AddAddress").''; - } - - print ''; - - - // Conditions de réglement - print ''.$langs->trans('PaymentConditions').''; - $html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1); - print ''; - - // Mode de réglement - print ''.$langs->trans('PaymentMode').''; - $html->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); - print ''; + } + print ""; + // Adresse de livraison + print ''.$langs->trans('DeliveryAddress').''; + $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socidp'],'adresse_livraison_id'); + + if ($numaddress==0) + { + print '   id.'&action=create>'.$langs->trans("AddAddress").''; + } + + print ''; + + + // Conditions de réglement + print ''.$langs->trans('PaymentConditions').''; + $html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1); + print ''; + + // Mode de réglement + print ''.$langs->trans('PaymentMode').''; + $html->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); + print ''; + + // Remise relative + $relative_discount=$soc->remise_client; + print ''.$langs->trans("CustomerRelativeDiscount").''; + print ''; + print ' %'; + print ''.img_info().' '; + if ($relative_discount) + { + print $langs->trans("CompanyHasRelativeDiscount",$relative_discount); + } + else + { + print $langs->trans("CompanyHasNoRelativeDiscount"); + } + print ''; + + // Remise avoirs + $absolute_discount=$soc->getCurrentDiscount(); + print ''.$langs->trans("CustomerAbsoluteDiscount").''; + print ''; + print ' '.$langs->trans("Currency".$conf->monnaie); + print ''.img_info().' '; + if ($absolute_discount) + { + print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); + } + else + { + print $langs->trans("CompanyHasNoAbsoluteDiscount"); + } + print ''; + + + // Projet if ($conf->projet->enabled) { print ''.$langs->trans('Project').''; $numprojet=$html->select_projects($soc->id,$projetid,'projetidp'); - if ($numprojet==0) - { - print '   id.'&action=create>'.$langs->trans("AddProject").''; - } + if ($numprojet==0) + { + print '   id.'&action=create>'.$langs->trans("AddProject").''; + } print ''; } @@ -427,7 +477,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) $liste=$model->liste_modeles($db); $html->select_array("model",$liste,$conf->global->COMMANDE_ADDON_PDF); print ""; - + if ($propalid > 0) { $amount = ($obj->price); @@ -459,9 +509,9 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print ''; // multiprix if($conf->global->PRODUIT_MULTIPRICES == 1) - print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); + print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level); else - print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); + print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size); print ''; print ''; print '%'; @@ -472,12 +522,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) } /* - * - */ + * + */ print ''; - print '
'; print ''; + print ''; + if ($propalid) { /* @@ -649,16 +700,8 @@ else // Ref print ''.$langs->trans('Ref').''; - print ''.$commande->ref.''; - print ''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; - if ($commande->source == 0) - { - // Si source = propal - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print ''; + print ''.$commande->ref.''; + print ''; // Ref commande client print ''; @@ -667,7 +710,7 @@ else print ''; if ($_GET['action'] != 'refcdeclient') print ''.img_edit($langs->trans('Edit')).''; print ''; - print ''; + print ''; if ($user->rights->commande->creer && $_GET['action'] == 'refcdeclient') { print '
'; @@ -680,41 +723,30 @@ else { print $commande->ref_client; } - print ''; - print ''.$langs->trans('Note').' :
'; - if ($commande->brouillon == 1 && $user->rights->commande->creer) - { - print ''; - print ''; - print '
'; - print '
'; - print '
'; - } - else - { - print nl2br($commande->note); - } - print ''; print ''; // Société - print ''.$langs->trans('Customer').''; + print ''.$langs->trans('Company').''; print ''; print ''.$soc->nom.''; print ''; - // Statut - print ''.$langs->trans('Status').''; - print ''.$commande->getLibStatut(4).''; - print ''; - print ''.$langs->trans('Date').''; print ''.dolibarr_print_date($commande->date,'%A %d %B %Y').''; + print ''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; + if ($commande->source == 0) + { + // Si source = propal + $propal = new Propal($db); + $propal->fetch($commande->propale_id); + print ' -> '.$propal->ref.''; + } + print ''; print ''; - // date de livraison + // Date de livraison print ''; print ''; + print ''; + print ''; + print ''; - // adresse de livraison + // Adresse de livraison print ''; print ''; print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; } @@ -305,9 +391,12 @@ if ($_GET["id"] > 0) print '\n"; - print ''; + print ''; + print ''; + print ''; print ''; + $total = $total + ($objp->qty * $objp->price); $i++; } $db->free($resql); @@ -316,6 +405,119 @@ if ($_GET["id"] > 0) { dolibarr_print_error($db); } + + /* + * Lignes de remise + */ + + // Remise relative + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($_GET['action'] != 'editrelativediscount') + { + if (1 == 2 && $commande->brouillon && $user->rights->facture->creer) + { + print ''; + } + else + { + print ''; + } + if (1 == 2 && $commande->brouillon && $user->rights->facture->creer && $commande->remise_percent) + { + print ''; + } + else + { + print ''; + } + print ''; + } + else + { + print ''; + } + print ''; + print ''; + + // Remise absolue + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($_GET['action'] != 'editabsolutediscount') + { + if (1 == 2 && $commande->brouillon && $user->rights->facture->creer) + { + print ''; + } + else + { + print ''; + } + if (1 == 2 && $commande->brouillon && $user->rights->facture->creer && $commande->remise_absolue) + { + print ''; + } + else + { + print ''; + } + print ''; + } + else + { + print ''; + } + print ''; + print ''; + + print '
'; print $langs->trans('DateDelivery'); @@ -733,12 +765,28 @@ else } else { - print dolibarr_print_date($commande->date_livraison,'%a %d %B %Y'); + print dolibarr_print_date($commande->date_livraison,'%A %d %B %Y'); } - print '
'.$langs->trans('NotePublic').' :
'; + if ($commande->brouillon == 1 && $user->rights->commande->creer) + { + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + } + else + { + print nl2br($commande->note); + } + + print '
'; print ''; - // Conditions et modes de réglement + // Conditions et modes de réglement print ''; print ''; print ''; - print ''; + print ''; + print ''; + print ''; print ''; } $var=true; @@ -943,10 +976,13 @@ else print ''; + print ''; } else { - print ''; + print ''; + print ''; + print ''; } print ''; } @@ -979,7 +1015,7 @@ else print ''; print ''; print ''; - print ''; print ''; print ''; @@ -995,6 +1031,117 @@ else dolibarr_print_error($db); } + /* + * Lignes de remise + */ + + // Remise relative + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($_GET['action'] != 'editrelativediscount') + { + if ($commande->brouillon && $user->rights->facture->creer) + { + print ''; + } + else + { + print ''; + } + if ($commande->brouillon && $user->rights->facture->creer && $commande->remise_percent) + { + print ''; + } + else + { + print ''; + } + print ''; + } + else + { + print ''; + } + print ''; + print ''; + + // Remise absolue + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($_GET['action'] != 'editabsolutediscount') + { + if ($commande->brouillon && $user->rights->facture->creer) + { + print ''; + } + else + { + print ''; + } + if ($commande->brouillon && $user->rights->facture->creer && $commande->remise_absolue) + { + print ''; + } + else + { + print ''; + } + print ''; + } + else + { + print ''; + } + print ''; + print ''; + /* * Ajouter une ligne */ @@ -1009,6 +1156,7 @@ else print ''; print ''; print ''; + print ''; print ''; // Ajout produit produits/services personalisés @@ -1028,7 +1176,7 @@ else print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -1052,7 +1200,7 @@ else print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -1171,6 +1319,7 @@ else */ //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); $html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); + /* * Liste des factures */ diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 3cbc97c4da7..d3e80f27f26 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -127,113 +127,197 @@ if ($_GET["id"] > 0) /* * Commande */ + $nbrow=8; + if ($conf->projet->enabled) $nbrow++; - $nbrow=8; - if ($conf->projet->enabled) $nbrow++; + print '
'; print $langs->trans('DeliveryAddress'); @@ -758,7 +806,7 @@ else } print '
'; print ''; - if ($user->rights->commande->creer && $_GET['action'] == 'setdiscount') - { - print ''; - } - else - { - print ''; - } - print ''; - // Total HT print ''; print ''; @@ -853,8 +878,14 @@ else print ''; print ''; + // Statut + print ''; + print ''; + print ''; + print '
'; print $langs->trans('PaymentConditions'); @@ -817,29 +865,6 @@ else // Lignes de 3 colonnes - print '
'; - print ''; - if ($_GET['action'] != 'setdiscount' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('GlobalDiscount').''; - print ''.img_edit($langs->trans('Edit')).'
'; - print '
'; - print '
'; - print ''; - print '%'; - print '
'; - print ''; - print ''.$commande->remise_percent.'%
'.$langs->trans('TotalHT').''.price($commande->total_ht).'
'.$langs->trans('TotalTTC').''.price($commande->total_ttc).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'

'; - + print "\n"; + /* * Lignes de commandes */ @@ -887,7 +918,9 @@ else print '
'.$langs->trans('Qty').''.$langs->trans('Discount').''.$langs->trans('AmountHT').'     
'; print img_delete(); print '      
%'; + print ''; print '
'; + print $langs->trans('CustomerRelativeDiscount'); + if ($commande->brouillon) print ' ('.($soc->remise_client?$langs->trans("CompanyHasRelativeDiscount",$soc->remise_client):$langs->trans("CompanyHasNoRelativeDiscount")).')'; + print '   '; + if ($_GET['action'] == 'editrelativediscount') + { + print '%'; + } + else + { + print $commande->remise_percent?$commande->remise_percent.'%':' '; + } + print ''; + if ($_GET['action'] != 'editrelativediscount') print $commande->remise_percent?'-'.price($commande->remise_percent*$total/100):$langs->trans("DiscountNone"); + else print ' '; + print 'id.'">'.img_edit($langs->trans('SetRelativeDiscount'),1).' rowid.'">'; + print img_delete(); + print '  
'; + print $langs->trans('CustomerAbsoluteDiscount'); + if ($commande->brouillon) print ' ('.($avoir_en_cours?$langs->trans("CompanyHasAbsoluteDiscount",$avoir_en_cours,$langs->trans("Currency".$conf->monnaie)):$langs->trans("CompanyHasNoAbsoluteDiscount")).')'; + print '    '; + if ($_GET['action'] == 'editabsolutediscount') + { + print '-'; + } + else + { + print $commande->remise_absolue?'-'.price($commande->remise_absolue):$langs->trans("DiscountNone"); + } + print 'id.'">'.img_edit($langs->trans('SetAbsoluteDiscount'),1).' rowid.'">'; + print img_delete(); + print '  
    
%
 %
'; - print '
'; + // Ref + print ''; + print ''; + print ''; - // Reference - print '"; - print ''; - print '"; - - // Ref cde client - print ''; - print ''; - print ''; - print ''; - - // Client - print ""; - print ''; - print ''; - - // Statut - print ''; - print "\n"; - print ''; - - // Date - print ''; - print "\n"; - print ''; - - // Projet - if ($conf->projet->enabled) - { - print ''; - $langs->load("projects"); - print ''; + print ''; + + // Total TTC + print ''; + print ''; + + // Statut + print ''; + print ''; + print ''; + + print '
'.$langs->trans('Ref').''.$commande->ref.'
'.$langs->trans("Ref")."'.$commande->ref.''.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ; - if ($commande->source == 0) - { - // Propale - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $commande->ref_client; - print ''.$langs->trans('Note').' :
'; - if ($commande->brouillon == 1 && $user->rights->commande->creer) - { - print '
'; - print ''; - print '
'; - print '
'; - print '
'; - } - else - { - print nl2br($commande->note); - } - print '
".$langs->trans("Customer")."'; - print ''.$soc->nom.''; - print '
'.$langs->trans("Status").'".$commande->getLibStatut(4)."
'.$langs->trans("Date").'".dolibarr_print_date($commande->date,"%A %d %B %Y")."
'; - print ''; + print ''; + + + // Société + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + // Date de livraison + print ''; + print ''; + print ''; + + + // Adresse de livraison + print ''; + + // Conditions et modes de réglement + print ''; + print ''; + + // Projet + if ($conf->projet->enabled) { - $html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"projetid"); + $langs->load('projects'); + print ''; } - else - { - $html->form_project($_SERVER["PHP_SELF"]."?id=$commande->id",$commande->fk_soc,$commande->projetid,"none"); - } - print ""; - print ''; - } - - // Lignes de 3 colonnes - - // Discount - print ''; - // Total HT - print ''; - print ''; - print ''; + // Lignes de 3 colonnes - // Total VAT - print ''; - print ''; - - // Total TTC - print ''; - print ''; + // Total HT + print ''; + print ''; + print ''; - print '
'; - print $langs->trans("Project"); + // Ref commande client + print '
'; + print ''; - //if ($_GET["action"] != "classer") print ''; + if ($_GET['action'] != 'refcdeclient') print ''; print '
'; + print $langs->trans('RefCustomer').''; print 'id.'">'.img_edit($langs->trans("SetProject")).''.img_edit($langs->trans('Edit')).'
'; - print '
'; - if ($_GET["action"] == "classer") + print ''; + if ($user->rights->commande->creer && $_GET['action'] == 'refcdeclient') + { + print '
'; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $commande->ref_client; + } + print '
'.$langs->trans('Company').''; + print ''.$soc->nom.'
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'%A %d %B %Y').''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; + if ($commande->source == 0) + { + // Si source = propal + $propal = new Propal($db); + $propal->fetch($commande->propale_id); + print ' -> '.$propal->ref.''; + } + print '
'; + print ''; + + if (1 == 2 && $_GET['action'] != 'editdate_livraison' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DateDelivery'); + print 'id.'">'.img_edit($langs->trans('SetDateDelivery'),1).'
'; + print '
'; + if ($_GET['action'] == 'editdate_livraison') + { + print '
'; + print ''; + $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison"); + print ''; + print '
'; + } + else + { + print dolibarr_print_date($commande->date_livraison,'%A %d %B %Y'); + } + print '
'.$langs->trans('NotePublic').' :
'; + if ($commande->brouillon == 1 && $user->rights->commande->creer) + { + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + } + else + { + print nl2br($commande->note); + } + + print '
'; + print ''; + + if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print 'soc_id.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; + print '
'; + + if ($_GET['action'] == 'editdelivery_adress') + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); + } + else + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); + } + print '
'; + print ''; + + if ($_GET['action'] != 'editconditions' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentConditions'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if ($_GET['action'] == 'editconditions') + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id'); + } + else + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); + } + print '
'; + print ''; + if ($_GET['action'] != 'editmode' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print '
'; + if ($_GET['action'] == 'editmode') + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id'); + } + else + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none'); + } + print '
'; + print ''; + if ($_GET['action'] != 'classer') print ''; + print '
'; + print $langs->trans('Project'); + print ''.img_edit($langs->trans('SetProject')).'
'; + print '
'; + if ($_GET['action'] == 'classer') + { + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid'); + } + else + { + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none'); + } + print '
'.$langs->trans("GlobalDiscount").''; - print $commande->remise_percent.'% '; - print '
'.$langs->trans("TotalHT").''.price($commande->total_ht).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("TotalVAT").''.price($commande->total_tva).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans("TotalTTC").''.price($commande->total_ttc).''.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('TotalHT').''.price($commande->total_ht).''.$langs->trans('Currency'.$conf->monnaie).'
'; + // Total TVA + print '
'.$langs->trans('TotalVAT').''.price($commande->total_tva).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('TotalTTC').''.price($commande->total_ttc).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'
'; /* * Lignes de commandes @@ -263,7 +347,9 @@ if ($_GET["id"] > 0) print '
'.$langs->trans('Qty').''.$langs->trans('Discount').''.$langs->trans('AmountHT').'     
'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."     
'; + print $langs->trans('CustomerRelativeDiscount'); + if ($commande->brouillon) print ' ('.($soc->remise_client?$langs->trans("CompanyHasRelativeDiscount",$soc->remise_client):$langs->trans("CompanyHasNoRelativeDiscount")).')'; + print '   '; + if ($_GET['action'] == 'editrelativediscount') + { + print '%'; + } + else + { + print $commande->remise_percent?$commande->remise_percent.'%':' '; + } + print ''; + if ($_GET['action'] != 'editrelativediscount') print $commande->remise_percent?'-'.price($commande->remise_percent*$total/100):$langs->trans("DiscountNone"); + else print ' '; + print 'id.'">'.img_edit($langs->trans('SetRelativeDiscount'),1).' rowid.'">'; + print img_delete(); + print '  
'; + print $langs->trans('CustomerAbsoluteDiscount'); + if ($commande->brouillon) print ' ('.($avoir_en_cours?$langs->trans("CompanyHasAbsoluteDiscount",$avoir_en_cours,$langs->trans("Currency".$conf->monnaie)):$langs->trans("CompanyHasNoAbsoluteDiscount")).')'; + print '    '; + if ($_GET['action'] == 'editabsolutediscount') + { + print '-'; + } + else + { + print $commande->remise_absolue?'-'.price($commande->remise_absolue):$langs->trans("DiscountNone"); + } + print 'id.'">'.img_edit($langs->trans('SetAbsoluteDiscount'),1).' rowid.'">'; + print img_delete(); + print '  
'; print ''; @@ -334,7 +536,7 @@ if ($_GET["id"] > 0) print ''.$langs->trans("CreateBill").''; } - if ($user->rights->commande->creer) + if ($commande->statut > 0 && $user->rights->commande->creer) { print ''.$langs->trans("ClassifyBilled").''; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a9bc9bd0c5d..5aa2e072fe7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -718,7 +718,7 @@ if ($_GET['action'] == 'create') print ''.$langs->trans('Ref').''.$langs->trans('Draft').''; // Societe - print ''.$langs->trans('Company').''.$soc->nom_url.''; + print ''.$langs->trans('Company').''.img_object($langs->trans("ShowCompany"),'company').' '.$soc->nom_url.''; print ''; // Date facture diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 0060322b24f..26528b95aa1 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -35,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); +$langs->load("bills"); $user->getrights('commande'); $user->getrights('expedition'); @@ -134,59 +135,204 @@ if ($_GET["id"] > 0) } // Onglet commande - print ''; + $nbrow=8; + if ($conf->projet->enabled) $nbrow++; - // Ref - print ''; - print ''; - print ''; - - // Ref commande client - print ''; - $nbrow=3; - print ''; - print ''; + print '
'.$langs->trans('Ref').''.$commande->ref.''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; - if ($commande->source == 0) - { - // Si source = propal - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print '
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $commande->ref_client; - print ''.$langs->trans('Note').' :
'; - print nl2br($commande->note); - print '
'; - // Société - print ''; - print ''; - print ''; + // Ref + print ''; + print ''; + print ''; - // Statut - print ''; - print ''; - print ''; - - // Date - print ''; - print ''; - print ''; - - print '
'.$langs->trans('Customer').''; - print ''.$soc->nom.'
'.$langs->trans('Ref').''.$commande->ref.'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'%A %d %B %Y').'
'; + // Ref commande client + print ''; + print ''; + if ($_GET['action'] != 'refcdeclient') print ''; + print '
'; + print $langs->trans('RefCustomer').''; + print ''.img_edit($langs->trans('Edit')).'
'; + print ''; + if ($user->rights->commande->creer && $_GET['action'] == 'refcdeclient') + { + print '
'; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $commande->ref_client; + } + print ''; + print ''; + + + // Société + print ''.$langs->trans('Company').''; + print ''; + print ''.$soc->nom.''; + print ''; + + print ''.$langs->trans('Date').''; + print ''.dolibarr_print_date($commande->date,'%A %d %B %Y').''; + print ''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; + if ($commande->source == 0) + { + // Si source = propal + $propal = new Propal($db); + $propal->fetch($commande->propale_id); + print ' -> '.$propal->ref.''; + } + print ''; + print ''; + + // Date de livraison + print ''; + print ''; + + if ($_GET['action'] != 'editdate_livraison' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DateDelivery'); + print 'id.'">'.img_edit($langs->trans('SetDateDelivery'),1).'
'; + print ''; + if ($_GET['action'] == 'editdate_livraison') + { + print '
'; + print ''; + $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison"); + print ''; + print '
'; + } + else + { + print dolibarr_print_date($commande->date_livraison,'%A %d %B %Y'); + } + print ''; + print ''.$langs->trans('NotePublic').' :
'; + if ($commande->brouillon == 1 && $user->rights->commande->creer) + { + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + } + else + { + print nl2br($commande->note); + } + + print ''; + print ''; + + + // Adresse de livraison + print ''; + print ''; + + if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print 'soc_id.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; + print ''; + + if ($_GET['action'] == 'editdelivery_adress') + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id); + } + else + { + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id); + } + print ''; + + // Conditions et modes de réglement + print ''; + print ''; + + if ($_GET['action'] != 'editconditions' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentConditions'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print ''; + if ($_GET['action'] == 'editconditions') + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id'); + } + else + { + $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); + } + print ''; + print ''; + print ''; + if ($_GET['action'] != 'editmode' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print ''; + if ($_GET['action'] == 'editmode') + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id'); + } + else + { + $html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none'); + } + print ''; + + // Projet + if ($conf->projet->enabled) + { + $langs->load('projects'); + print ''; + print ''; + if ($_GET['action'] != 'classer') print ''; + print '
'; + print $langs->trans('Project'); + print ''.img_edit($langs->trans('SetProject')).'
'; + print ''; + if ($_GET['action'] == 'classer') + { + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid'); + } + else + { + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none'); + } + print ''; + } + + // Lignes de 3 colonnes + + // Total HT + print ''.$langs->trans('TotalHT').''; + print ''.price($commande->total_ht).''; + print ''.$langs->trans('Currency'.$conf->monnaie).''; + + // Total TVA + print ''.$langs->trans('TotalVAT').''.price($commande->total_tva).''; + print ''.$langs->trans('Currency'.$conf->monnaie).''; + + // Total TTC + print ''.$langs->trans('TotalTTC').''.price($commande->total_ttc).''; + print ''.$langs->trans('Currency'.$conf->monnaie).''; + + // Statut + print ''.$langs->trans('Status').''; + print ''.$commande->getLibStatut(4).''; + print ''; + + print '
'; + /** * Lignes de commandes avec quantité livrées et reste à livrer * */ - echo '
'; + echo '
'; $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as l "; @@ -270,7 +416,7 @@ if ($_GET["id"] > 0) if (! $num) { - print $langs->trans("None").'
'; + print $langs->trans("NoArticleOfTypeProduct").'
'; } } @@ -289,7 +435,8 @@ if ($_GET["id"] > 0) { print '
'; - if (! $conf->stock->enabled && $reste_a_livrer_total > 0 && $commande->brouillon == 0 && $user->rights->expedition->creer) + // Bouton expedier sans gestion des stocks + if (! $conf->stock->enabled && $reste_a_livrer_total > 0 && ! $commande->brouillon && $user->rights->expedition->creer) { print ''.$langs->trans("NewSending").''; } @@ -298,11 +445,8 @@ if ($_GET["id"] > 0) } - - /** - * Formulaire nouvelle expedition depuis un entrepot - */ - if ($conf->stock->enabled && $reste_a_livrer_total > 0 && $commande->brouillon == 0 && $user->rights->expedition->creer) + // Bouton expedier avec gestion des stocks + if ($conf->stock->enabled && $reste_a_livrer_total > 0 && ! $commande->brouillon && $user->rights->expedition->creer) { print '
'; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index dcb557315ca..9060717941c 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -124,7 +124,7 @@ class Facture $this->amount = $_facrec->amount; $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; - $this->remise_absolue = $_facrec->remise; + $this->remise = $_facrec->remise; } // Definition de la date limite @@ -1154,9 +1154,7 @@ class Facture } $this->db->free($result); - /* - * - */ + $calculs = calcul_price($products, $this->remise_percent, $this->remise_absolue); $this->total_remise = $calculs[3]; $this->amount_ht = $calculs[4]; @@ -1222,7 +1220,7 @@ class Facture } /** - * \brief Applique une remise relative sur facture + * \brief Applique une remise relative * \param user User qui positionne la remise * \param remise * \return int <0 si ko, >0 si ok @@ -1255,7 +1253,7 @@ class Facture /** - * \brief Applique une remise absolue sur facture + * \brief Applique une remise absolue * \param user User qui positionne la remise * \param remise * \return int <0 si ko, >0 si ok diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index a780bf63447..ed509b3f4fc 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -117,7 +117,7 @@ class MenuLeft { $langs->load("users"); $newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup")); - if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/index.php", $langs->trans("GlobalSetup")); + if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/index.php", $langs->trans("CompanySetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes")); diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index c0cf571a152..67cbf9c152a 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -121,7 +121,7 @@ class MenuLeft { $langs->load("admin"); $newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup")); - if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/index.php", $langs->trans("GlobalSetup")); + if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/index.php", $langs->trans("CompanySetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes")); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6e048909f24..9a957f334a0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -10,7 +10,8 @@ ExternalUser=External user InternalUsers=Internal users ExternalUsers=External users GlobalSetup=Global setup -GUISetup=GUI setup +CompanySetup=Company/Fundation setup +GUISetup=Display setup ErrorModuleRequirePHPVersion=Error, this module require PHP version %s or higher DictionnarySetup=Dictionnary setup DisableJavascript=Disable javascript functions diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 52bd08810de..bd32f4b73c0 100755 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -13,7 +13,7 @@ AvailableRights=Available permissions OwnedRights=Owned permissions GroupRights=Group permissions UserRights=User permissions -UserGUISetup=User setup +UserGUISetup=User display setup DisableUser=Disable DisableAUser=Disable a user DeleteUser=Delete diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7118ca396f4..07113ba6cb2 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -10,7 +10,8 @@ ExternalUser=Utilisateur externe InternalUsers=Utilisateurs internes ExternalUsers=Utilisateurs externes GlobalSetup=Général -GUISetup=Interface +CompanySetup=Institution +GUISetup=Affichage ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou supérieure de PHP DictionnarySetup=Dictionnaires DisableJavascript=Désactiver les fonctions javascript diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 1fb24089f8f..ff7cd090884 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -473,7 +473,8 @@ class Propal /* * Liste des produits a ajouter */ - $sql = "SELECT price, qty, tva_tx FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id"; + $sql = "SELECT price, qty, tva_tx FROM ".MAIN_DB_PREFIX."propaldet"; + $sql.= " WHERE fk_propal = ".$this->id; if ( $this->db->query($sql) ) { $num = $this->db->num_rows(); diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index fe0ea49eb54..048673a88f1 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -19,6 +19,8 @@ alter table llx_facture add column remise_absolue real DEFAULT 0 after remise_pe alter table llx_propal add column note_public text after note; alter table llx_propal add column remise_absolue real DEFAULT 0 after remise_percent; +alter table llx_commande add column remise_absolue real DEFAULT 0 after remise_percent; + ALTER TABLE llx_societe ADD mode_reglement INT( 11 ) DEFAULT NULL ; ALTER TABLE llx_societe ADD cond_reglement INT( 11 ) DEFAULT '1' NOT NULL ; ALTER TABLE llx_societe ADD tva_assuj tinyint DEFAULT '1'; @@ -148,6 +150,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (29 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (292, 5, '0','0','VAT Rate 0',1); +update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON'; +update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON'; + + alter table llx_propal_model_pdf rename to llx_document_model; alter table llx_document_model add column type varchar(20) NOT NULL after nom; update llx_document_model set type='propal' where type=''; @@ -158,9 +164,6 @@ insert into llx_document_model(nom,type) values('rouget','shipping'); delete from llx_document_model where nom='adytek'; delete from llx_document_model where nom='rouge' and type='order'; delete from llx_document_model where nom='azur' and type='order'; +delete from llx_document_model where nom='orange' and type='propal'; - -update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON'; -update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON'; - -alter table llx_actioncomm add column fk_commande integer after propalrowid; \ No newline at end of file +alter table llx_actioncomm add column fk_commande integer after propalrowid; diff --git a/mysql/tables/llx_commande.sql b/mysql/tables/llx_commande.sql index 86bcb4ec156..afe9acc5a87 100644 --- a/mysql/tables/llx_commande.sql +++ b/mysql/tables/llx_commande.sql @@ -40,6 +40,7 @@ create table llx_commande fk_statut smallint default 0, amount_ht real default 0, remise_percent real default 0, + remise_absolue real default 0, remise real default 0, tva real default 0, total_ht real default 0, @@ -48,10 +49,10 @@ create table llx_commande note_public text, model_pdf varchar(50), - facture tinyint default 0, + facture tinyint default 0, fk_cond_reglement integer, -- condition de réglement fk_mode_reglement integer, -- mode de réglement - date_livraison date default NULL, + date_livraison date default NULL, fk_adresse_livraison integer, -- adresse de livraison UNIQUE INDEX (ref)