diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2465afff22..b76db5a6d47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3004,7 +3004,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou $cursymbolafter.=($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); } } - $output=$cursymbolbefore.$output.$end.$cursymbolafter; + $output=$cursymbolbefore.$output.$end.($cursymbolafter?' ':'').$cursymbolafter; return $output; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 99e9cca639c..ceb9a56b946 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -105,7 +105,7 @@ class FactureFournisseur extends CommonInvoice var $fk_incoterms; var $location_incoterms; var $libelle_incoterms; //Used into tooltip - + var $extraparams=array(); /** @@ -428,9 +428,9 @@ class FactureFournisseur extends CommonInvoice //Incoterms $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; + $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->socid = $obj->socid; @@ -1408,7 +1408,7 @@ class FactureFournisseur extends CommonInvoice */ function info($id) { - $sql = 'SELECT c.rowid, datec, tms as datem,'; + $sql = 'SELECT c.rowid, datec, tms as datem, '; $sql.= ' fk_user_author, fk_user_valid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c'; $sql.= ' WHERE c.rowid = '.$id; @@ -1434,7 +1434,7 @@ class FactureFournisseur extends CommonInvoice } $this->date_creation = $obj->datec; $this->date_modification = $obj->datem; - //$this->date_validation = $obj->datev; Should be stored in log table + //$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders) } $this->db->free($result); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 28fbe44fc9f..135592b9c7c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1964,8 +1964,9 @@ else $alreadypaid=$object->getSommePaiement(); print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; - print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).' '; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); if ($calculationrule == 'totalofround') $calculationrulenum=1; @@ -1982,16 +1983,16 @@ else if ($societe->localtax1_assuj=="1") //Localtax1 { print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; } if ($societe->localtax2_assuj=="1") //Localtax2 { print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; } - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).' '; + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; // Project if (! empty($conf->projet->enabled)) diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index aaee42e9add..7348f3b7590 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2014 Laurent Destailleur + * Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -200,6 +200,30 @@ if ($id > 0 || ! empty($ref)) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print ""; dol_fiche_end(); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index c7219c6e415..e6fed653421 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -168,6 +168,30 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print '
'; print ''; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index e45833c53f1..7033d555c0e 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -31,11 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; $langs->load('bills'); -$facid = isset($_GET["facid"])?$_GET["facid"]:''; +$id = GETPOST("facid",'int'); // Security check if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture'); +$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); @@ -45,22 +45,22 @@ $result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture llxHeader(); -$fac = new FactureFournisseur($db); -$fac->fetch($_GET["facid"]); -$fac->info($_GET["facid"]); +$object = new FactureFournisseur($db); +$object->fetch($id); +$object->info($id); $soc = new Societe($db); -$soc->fetch($fac->socid); +$soc->fetch($object->socid); -$head = facturefourn_prepare_head($fac); +$head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill'); print '
'; -dol_print_object_info($fac); +dol_print_object_info($object); print '
'; print ''; -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 7d68a3c5a95..3a4528d827e 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -139,6 +139,30 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print ""; print '
';