Fix: Error in price when adding a product in contract with base type that is with tax.
This commit is contained in:
parent
d371bd7fe4
commit
c3adbb11fe
@ -68,7 +68,7 @@ class Contrat extends CommonObject
|
||||
var $fk_projet;
|
||||
|
||||
var $lignes=array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
@ -178,7 +178,7 @@ class Contrat extends CommonObject
|
||||
function cloture($user,$langs='',$conf='')
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Load lines
|
||||
$this->fetch_lignes();
|
||||
|
||||
@ -199,7 +199,7 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($ok)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -368,14 +368,14 @@ class Contrat extends CommonObject
|
||||
$ligne->fk_user_author = $objp->fk_user_author;
|
||||
$ligne->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$ligne->fk_user_cloture = $objp->fk_user_cloture;
|
||||
|
||||
|
||||
$ligne->ref = $objp->ref;
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->label = $objp->label; // For backward compatibility
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
|
||||
$ligne->description = $objp->description;
|
||||
|
||||
|
||||
$ligne->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$ligne->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
||||
@ -385,7 +385,7 @@ class Contrat extends CommonObject
|
||||
$ligne->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$ligne->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
|
||||
|
||||
$this->lignes[] = $ligne;
|
||||
//dolibarr_syslog("1 ".$ligne->desc);
|
||||
//dolibarr_syslog("2 ".$ligne->product_desc);
|
||||
@ -428,7 +428,7 @@ class Contrat extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
$ligne = new ContratLigne($this->db);
|
||||
$ligne->id = $objp->rowid;
|
||||
$ligne->fk_contrat = $objp->fk_contrat;
|
||||
@ -447,7 +447,7 @@ class Contrat extends CommonObject
|
||||
$ligne->total_ttc = $objp->total_ttc;
|
||||
$ligne->fk_product = 0;
|
||||
$ligne->info_bits = $objp->info_bits;
|
||||
|
||||
|
||||
$ligne->fk_user_author = $objp->fk_user_author;
|
||||
$ligne->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$ligne->fk_user_cloture = $objp->fk_user_cloture;
|
||||
@ -605,13 +605,13 @@ class Contrat extends CommonObject
|
||||
$sql.= " AND tc.element='".$this->element."'";
|
||||
$sql.= " AND ec.element_id=".$this->id;
|
||||
*/
|
||||
|
||||
|
||||
$sql = "SELECT ec.rowid as ecrowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql.= " WHERE ec.fk_c_type_contact = tc.rowid";
|
||||
$sql.= " AND tc.element='".$this->element."'";
|
||||
$sql.= " AND ec.element_id=".$this->id;
|
||||
|
||||
|
||||
dolibarr_syslog("Contrat::delete element_contact sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
@ -654,7 +654,7 @@ class Contrat extends CommonObject
|
||||
$sql = "SELECT cdl.rowid as cdlrowid ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet_log as cdl, ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " WHERE cdl.fk_contratdet=cd.rowid AND cd.fk_contrat=".$this->id;
|
||||
|
||||
|
||||
dolibarr_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
@ -675,7 +675,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$sql= "DELETE FROM ".MAIN_DB_PREFIX."contratdet_log ";
|
||||
$sql.= " WHERE ".MAIN_DB_PREFIX."contratdet_log.rowid IN (".implode(",",$tab_resql).")";
|
||||
|
||||
|
||||
dolibarr_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
@ -706,7 +706,7 @@ class Contrat extends CommonObject
|
||||
// Delete contrat
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
dolibarr_syslog("Contrat::delete contrat sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
@ -762,7 +762,7 @@ class Contrat extends CommonObject
|
||||
if ($this->statut == 0 || ($this->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED))
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
@ -781,7 +781,7 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
@ -794,11 +794,11 @@ class Contrat extends CommonObject
|
||||
// \TODO A virer
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$remise = 0;
|
||||
$price = price2num(round($pu, 2));
|
||||
$price = price2num(round($pu_ht, 2));
|
||||
if (strlen($remise_percent) > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
$remise = round(($pu_ht * $remise_percent / 100), 2);
|
||||
$price = $pu_ht - $remise;
|
||||
}
|
||||
|
||||
// Insertion dans la base
|
||||
@ -814,7 +814,7 @@ class Contrat extends CommonObject
|
||||
$sql.= ($fk_product>0 ? $fk_product : "null").",";
|
||||
$sql.= " '".$qty."',";
|
||||
$sql.= " '".$txtva."',";
|
||||
$sql.= " ".price2num($remise_percent).",".price2num($pu).",";
|
||||
$sql.= " ".price2num($remise_percent).",".price2num($pu_ht).",";
|
||||
$sql.= " ".price2num($total_ht).",".price2num($total_tva).",".price2num($total_ttc).",";
|
||||
$sql.= " '".$info_bits."',";
|
||||
$sql.= " ".price2num($price).",".price2num( $remise); // \TODO A virer
|
||||
@ -1155,7 +1155,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " WHERE fk_contrat =".$this->id;
|
||||
if ($statut >= 0) $sql.= " AND statut = '$statut'";
|
||||
|
||||
|
||||
dolibarr_syslog("Contrat::array_detail() sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1226,7 +1226,7 @@ class Contrat extends CommonObject
|
||||
global $conf, $user;
|
||||
|
||||
$now=gmmktime();
|
||||
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
if ($mode == 'inactives')
|
||||
{
|
||||
@ -1360,11 +1360,14 @@ class ContratLigne
|
||||
var $remise_percent;
|
||||
var $remise;
|
||||
var $fk_remise_except;
|
||||
var $subprice;
|
||||
|
||||
var $subprice; // Unit price HT
|
||||
var $price_ht;
|
||||
|
||||
var $total_ht;
|
||||
var $total_tva;
|
||||
var $total_ttc;
|
||||
|
||||
var $info_bits;
|
||||
var $fk_user_author;
|
||||
var $fk_user_ouverture;
|
||||
@ -1567,7 +1570,7 @@ class ContratLigne
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$this->fk_contrat=trim($this->fk_contrat);
|
||||
$this->fk_product=trim($this->fk_product);
|
||||
@ -1589,7 +1592,7 @@ class ContratLigne
|
||||
$this->fk_user_ouverture=trim($this->fk_user_ouverture);
|
||||
$this->fk_user_cloture=trim($this->fk_user_cloture);
|
||||
$this->commentaire=trim($this->commentaire);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* 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
|
||||
@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/fiche.php
|
||||
* \ingroup contrat
|
||||
@ -44,6 +44,7 @@ $result=restrictedArea($user,'contrat',$contratid,'contrat');
|
||||
|
||||
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -61,7 +62,7 @@ if ($_POST["action"] == 'confirm_active' && $_POST["confirm"] == 'yes' && $user-
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$mesg=$contrat->error;
|
||||
$mesg=$contrat->error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +78,7 @@ if ($_POST["action"] == 'confirm_closeline' && $_POST["confirm"] == 'yes' && $us
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$mesg=$contrat->error;
|
||||
$mesg=$contrat->error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
exit;
|
||||
}
|
||||
$ret=$contrat->fetch_client();
|
||||
|
||||
|
||||
$date_start='';
|
||||
$date_end='';
|
||||
// Si ajout champ produit libre
|
||||
@ -211,8 +212,6 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
}
|
||||
}
|
||||
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
@ -252,7 +251,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$desc = $prod->description;
|
||||
$desc.= $prod->description && $_POST['desc'] ? "\n" : "";
|
||||
$desc.= $_POST['desc'];
|
||||
@ -260,6 +259,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
else
|
||||
{
|
||||
$pu_ht=$_POST['pu'];
|
||||
$price_base_type = 'HT';
|
||||
$tva_tx=eregi_replace('\*','',$_POST['tva_tx']);
|
||||
$tva_npr=eregi('\*',$_POST['tva_tx'])?1:0;
|
||||
$desc=$_POST['desc'];
|
||||
@ -267,7 +267,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
|
||||
$info_bits=0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
|
||||
// Insert line
|
||||
$result = $contrat->addline(
|
||||
$desc,
|
||||
@ -282,7 +282,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
||||
$pu_ttc,
|
||||
$info_bits
|
||||
);
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
/*
|
||||
@ -308,10 +308,10 @@ if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && ! $_PO
|
||||
if ($contratline->fetch($_POST["elrowid"]))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
if ($date_start_real_update == '') $date_start_real_update=$contratline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$contratline->date_cloture;
|
||||
|
||||
|
||||
$contratline->description=$_POST["eldesc"];
|
||||
$contratline->price_ht=$_POST["elprice"];
|
||||
$contratline->subprice=$_POST["elprice"];
|
||||
@ -324,7 +324,7 @@ if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && ! $_PO
|
||||
$contratline->date_fin_validite=$date_end_update;
|
||||
$contratline->date_cloture=$date_end_real_update;
|
||||
$contratline->fk_user_cloture=$user->id;
|
||||
|
||||
|
||||
$result=$contratline->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -334,7 +334,7 @@ if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && ! $_PO
|
||||
{
|
||||
dolibarr_print_error($db,'Failed to update contrat_det');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -471,7 +471,7 @@ if ($_GET["action"] == 'create')
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input type="text" maxlength="30" name="ref" size="20"></td></tr>';
|
||||
|
||||
|
||||
// Customer
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
@ -485,7 +485,7 @@ if ($_GET["action"] == 'create')
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Commercial suivi
|
||||
print '<tr><td width="20%" nowrap>'.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").'</td><td>';
|
||||
print $form->select_users('','commercial_suivi_id',1,'');
|
||||
@ -507,7 +507,7 @@ if ($_GET["action"] == 'create')
|
||||
$form->select_array("projetid",$proj->liste_array($soc->id),0,1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'"></textarea></td></tr>';
|
||||
|
||||
@ -516,7 +516,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'"></textarea></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
@ -595,7 +595,7 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
@ -606,7 +606,7 @@ else
|
||||
/* *************************************************************************** */
|
||||
{
|
||||
$now=gmmktime();
|
||||
|
||||
|
||||
$id = $_GET["id"];
|
||||
if ($id > 0)
|
||||
{
|
||||
@ -620,13 +620,13 @@ else
|
||||
}
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
|
||||
$nbofservices=sizeof($contrat->lignes);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $contrat->user_author_id;
|
||||
$author->fetch();
|
||||
|
||||
|
||||
$commercial_signature = new User($db);
|
||||
$commercial_signature->id = $contrat->commercial_signature_id;
|
||||
$commercial_signature->fetch();
|
||||
@ -741,12 +741,12 @@ else
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
|
||||
|
||||
$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1);
|
||||
$colorb='333333';
|
||||
|
||||
$arrayothercontracts=$contrat->getListOfContracts('others');
|
||||
|
||||
|
||||
/*
|
||||
* Lignes de contrats
|
||||
*/
|
||||
@ -791,7 +791,7 @@ else
|
||||
$var=true;
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
$var=!$var;
|
||||
|
||||
if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
|
||||
@ -855,7 +855,7 @@ else
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Dates de en service prevues et effectives
|
||||
@ -863,7 +863,7 @@ else
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="6">';
|
||||
|
||||
|
||||
// Date planned
|
||||
print $langs->trans("DateStartPlanned").': ';
|
||||
if ($objp->date_debut) {
|
||||
@ -879,10 +879,10 @@ else
|
||||
if ($objp->statut == 4 && $objp->date_fin < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); }
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ligne en mode update
|
||||
else
|
||||
@ -926,21 +926,21 @@ else
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
if ($contrat->statut > 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td colspan="6"><hr></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -960,11 +960,11 @@ else
|
||||
$formquestion=array(
|
||||
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
|
||||
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
|
||||
|
||||
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
|
||||
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation de la validation activation
|
||||
*/
|
||||
@ -987,8 +987,8 @@ else
|
||||
$dateactend = dolibarr_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("CloseService"),$langs->trans("ConfirmCloseService",dolibarr_print_date($dateactend,"%A %d %B %Y")),"confirm_closeline");
|
||||
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Area with activation info
|
||||
if ($contrat->statut > 0)
|
||||
{
|
||||
@ -1012,7 +1012,7 @@ else
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
|
||||
|
||||
print '<td>';
|
||||
// Si pas encore active
|
||||
if (! $objp->date_debut_reelle) {
|
||||
@ -1077,7 +1077,7 @@ else
|
||||
print '<td>'.$langs->trans("DateEndPlanned").'</td><td>';
|
||||
print $html->select_date($dateactend,"end",$usehm,$usehm,'',"active");
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="center" rowspan="2" valign="middle">';
|
||||
print '<input type="submit" class="button" name="activate" value="'.$langs->trans("Activate").'"><br>';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
@ -1139,16 +1139,16 @@ else
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '</td>'; // End td if line is 1
|
||||
|
||||
|
||||
print '</tr>';
|
||||
print '<tr><td style="border-right: 1px solid #'.$colorb.'"> </td></tr>';
|
||||
$cursorline++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
* Ajouter une ligne produit/service
|
||||
*/
|
||||
@ -1157,7 +1157,7 @@ else
|
||||
{
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
||||
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td>'.$langs->trans("Service").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
@ -1191,7 +1191,7 @@ else
|
||||
print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$contrat->societe->remise_client.'">%</td>';
|
||||
print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="8">';
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
@ -1200,11 +1200,11 @@ else
|
||||
$form->select_date('',"date_end",$usehm,$usehm,1,"addligne");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
$var=!$var;
|
||||
|
||||
|
||||
// Service libre
|
||||
print '<form name="addligne_sl" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="addligne">';
|
||||
@ -1232,18 +1232,18 @@ else
|
||||
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addligne_sl");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//print '</td><td align="center" class="tab" style="padding: 4px; border-right: 1px solid #'.$colorb.'; border-top: 1px solid #'.$colorb.'; border-bottom: 1px solid #'.$colorb.';">';
|
||||
|
||||
//print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -1279,7 +1279,7 @@ else
|
||||
// print '<a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a>';
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
/**
|
||||
\brief Permet de calculer les parts total HT, TVA et TTC d'une ligne de
|
||||
facture, propale, commande ou autre depuis:
|
||||
quantity, unit price, remise_percent_ligne, txtva, remise_percent_global
|
||||
quantity, unit price, remise_percent_ligne, txtva, remise_percent_global, price_base_type, info_bits
|
||||
\param qty Quantity
|
||||
\param pu Prix unitaire (HT ou TTC selon price_base_type)
|
||||
\param remise_percent_ligne Remise ligne
|
||||
@ -41,7 +41,7 @@
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $remise_percent_global=0, $price_base_type='HT', $info_bits=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$result=array();
|
||||
|
||||
//dolibarr_syslog("price.lib::calcul_price_total $qty, $pu, $remise_percent_ligne, $txtva, $price_base_type $info_bits");
|
||||
@ -53,11 +53,11 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $remise_pe
|
||||
$tot_avec_remise = $tot_avec_remise_ligne * ( 1 - ($remise_percent_global / 100));
|
||||
$result[0] = price2num($tot_avec_remise, 'MT');
|
||||
$result[2] = price2num($tot_avec_remise * ( 1 + ( (($info_bits & 1)?0:$txtva) / 100)), 'MT'); // Selon TVA NPR ou non
|
||||
$result2bis= price2num($tot_avec_remise * ( 1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result2bis= price2num($tot_avec_remise * ( 1 + ( $txtva / 100)), 'MT'); // Si TVA consideree normale (non NPR)
|
||||
$result[1] = $result2bis - $result[0];
|
||||
$result[3] = price2num($pu, 'MU');
|
||||
$result[5] = price2num($pu * ( 1 + ((($info_bits & 1)?0:$txtva) / 100)), 'MU'); // Selon TVA NPR ou non
|
||||
$result5bis= price2num($pu * ( 1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result5bis= price2num($pu * ( 1 + ($txtva / 100)), 'MU'); // Si TVA consideree normale (non NPR)
|
||||
$result[4] = $result5bis - $result[3];
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user