diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 80befe3d433..d4f4b82a96b 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -210,7 +210,7 @@ if ($resql) print ' '; print ' '; print ''; - $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8); + $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1); print ''; print ''; print ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 5fb1d638a88..5c93c1e62db 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Marcos García * * 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 @@ -230,7 +231,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) */ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { - $sql = "SELECT f.ref, f.rowid, f.total_ht, f.tva as total_tva, f.total_ttc, f.type"; + $sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type"; $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid"; $sql.= ", s.code_fournisseur"; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 7396c625165..175ff6cf98f 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier - * Copyright (C) 2014 Rosana Romero + * Copyright (C) 2014-2016 Juanjo Menent * * 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 @@ -116,16 +116,11 @@ $product_static=new Product($db); $payment_static=new Paiement($db); $paymentfourn_static=new PaiementFourn($db); -//print_fiche_titre($langs->trans("VAT"),""); - -//$fsearch.='
'; $fsearch.=' '; $fsearch.=' '; -//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; -//$fsearch.=' '; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; -// Affiche en-tete du rapport + if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services { $nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); @@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice $nextyear=$year_start; $nextquarter=$q; if ($nextquarter < 4) $nextquarter++; else { $nextquarter=1; $nextyear++; } - //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); - //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); + + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; $builddate=time(); - //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); @@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services $nextyear=$year_start; $nextquarter=$q; if ($nextquarter < 4) $nextquarter++; else { $nextquarter=1; $nextyear++; } - //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded"); - //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); - //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $builddate=time(); - //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); @@ -203,16 +191,13 @@ if($local==1){ // VAT Received and paid - - $y = $year_current; $total = 0; $i=0; // Load arrays of datas -$x_coll= local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell', $local); -//$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell'); -$x_paye = local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy', $local); +$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell'); +$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy'); echo ''; @@ -230,14 +215,14 @@ if (! is_array($x_coll) || ! is_array($x_paye)) else { $x_both = array(); + //now, from these two arrays, get another array with one rate per line foreach(array_keys($x_coll) as $my_coll_rate) { - //foreach($x_coll[$my_coll_rate][localtax1_list]){ $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; - $x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat']; + $x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local]; $x_both[$my_coll_rate]['paye']['totalht'] = 0; - $x_both[$my_coll_rate]['paye']['vat'] = 0; + $x_both[$my_coll_rate]['paye']['localtax'.$local] = 0; $x_both[$my_coll_rate]['coll']['links'] = ''; $x_both[$my_coll_rate]['coll']['detail'] = array(); foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) @@ -303,9 +288,6 @@ else } //now we have an array (x_both) indexed by rates for coll and paye - - //print table headers for this quadri - incomes first - $x_coll_sum = 0; $x_coll_ht = 0; $x_paye_sum = 0; @@ -314,8 +296,6 @@ else $span=3; if ($modetax == 0) $span+=2; - //print ''; - if($conf->global->$calc ==0 || $conf->global->$calc == 2){ // Customers invoices print ''; @@ -345,8 +325,6 @@ else if($rate!=0){ print ""; - //print ''; - /**/ print ''; print ''."\n"; } @@ -400,9 +378,7 @@ else print price($fields['totalht']); if (price2num($fields['ftotal_ttc'])) { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; } print ''; } @@ -413,7 +389,6 @@ else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); print ''; @@ -491,7 +466,6 @@ else if($conf->global->$calc ==0 || $conf->global->$calc == 1){ echo '
'..')
'.$langs->trans("Rate").': '.vatrate($rate).'%'.$langs->trans("Rate").': '.vatrate($rate).'%
'; - //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; if ($fields['payment_amount'] && $fields['ftotal_ttc']) { $payment_static->id=$fields['payment_id']; @@ -424,7 +399,7 @@ else print $langs->trans("NotUsedForGoods"); } else { - print $fields['payment_amount']; + print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; } print '
'; //print table headers for this quadri - expenses now - //imprime les en-tete de tables pour ce quadri - maintenant les d�penses print ''; print ''; print ''; @@ -585,7 +559,7 @@ else } else { - print $fields['payment_amount']; + print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; } print ''; @@ -663,6 +637,5 @@ else $i++; } -$db->close(); - llxFooter(); +$db->close(); diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 2b7f76dedf9..4c094061ee4 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -180,7 +180,7 @@ class FormProjets continue; } - $labeltoshow=dol_trunc($obj->ref,18).' - '.$obj->title; + $labeltoshow=dol_trunc($obj->ref,18); //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 0a3c4942857..93b4b480dde 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García @@ -178,7 +178,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction } } - /** * Gets VAT to collect for the given year (and given quarter or month) * The function gets the VAT in split results, as the VAT declaration asks diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f316fb47980..a24091c4f97 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1014,6 +1014,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("withdrawals"); $langs->load("banks"); $langs->load("bills"); + $langs->load('categories'); // Bank-Caisse if (! empty($conf->banque->enabled)) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 7244711bb43..19055c2001e 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -369,18 +369,12 @@ if (! empty($usemargins) && $user->rights->margins->creer) jQuery(document).ready(function() { global->DISPLAY_MARGIN_RATES)) { ?> - $('#addline').click(function (e) { - return checkFreeLine(e, "np_marginRate"); - }); $("input[name='np_marginRate']:first").blur(function(e) { return checkFreeLine(e, "np_marginRate"); }); global->DISPLAY_MARK_RATES)) { ?> - $('#addline').click(function (e) { - return checkFreeLine(e, "np_markRate"); - }); $("input[name='np_markRate']:first").blur(function(e) { return checkFreeLine(e, "np_markRate"); }); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index a1b151d9391..26d96d8e201 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -299,9 +299,6 @@ if (! empty($conf->margin->enabled)) if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> - $('#savelinebutton').click(function (e) { - return checkEditLine(e, "np_marginRate"); - }); /* Disabled. We must be able to click on button 'cancel'. Check must be done only on button 'save'. $("input[name='np_marginRate']:first").blur(function(e) { return checkEditLine(e, "np_marginRate"); @@ -311,9 +308,6 @@ if (! empty($conf->margin->enabled)) if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> - $('#savelinebutton').click(function (e) { - return checkEditLine(e, "np_markRate"); - }); /* Disabled. We must be able to click on button 'cancel'. Check must be done only on button 'save'. $("input[name='np_markRate']:first").blur(function(e) { return checkEditLine(e, "np_markRate"); @@ -326,6 +320,7 @@ if (! empty($conf->margin->enabled)) /* If margin rate field empty, do nothing. */ /* Force content of price_ht to 0 or if a discount is set, recalculate it from margin rate */ + /* TODO This function seems no more used */ function checkEditLine(e, npRate) { var buying_price = $("input[name='buying_price']:first"); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 890772326ea..42418184c4f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1474,7 +1474,7 @@ class FactureFournisseur extends CommonInvoice if (! empty($this->total_ht)) $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 9c4a95c7c52..f41a4b4e69a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -666,7 +666,7 @@ class ProductFournisseur extends Product { global $langs; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index c877589851d..510ca2755be 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -245,7 +245,7 @@ if (! empty($conf->fournisseur->enabled)) /* * List of users allowed */ -$sql = "SELECT u.rowid, u.lastname, u.firstname"; +$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u,"; $sql.= " ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as rd"; @@ -278,6 +278,7 @@ if ($resql) $userstatic->id=$obj->rowid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; + $userstatic->email=$obj->email; print $userstatic->getNomUrl(1); print ''; print "
\n"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f70ca50c902..24506fb31a8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2213,7 +2213,11 @@ else // Delete if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer) { - print ''.$langs->trans('Delete').''; + if ($object->getSommePaiement()) { + print ''; + } else { + print ''.$langs->trans('Delete').''; + } } print ''; print '
'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 758885cef58..10b358f15dd 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -281,9 +281,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; + dol_fiche_head(); + print '
'.$elementsup.''.$productsup.'
'; - print ''; print '
'.$langs->trans('Payment').'
'.$langs->trans('Company').''; $supplierstatic->id=$obj->socid; $supplierstatic->name=$obj->name; @@ -311,6 +312,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print '
'; + dol_fiche_end(); $parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('paymentsupplierinvoices',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -337,7 +339,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $i = 0; print '
'; - print $langs->trans('Invoices').'
'; if(!empty($conf->global->FAC_AUTO_FILLJS)){ //Add js for AutoFill @@ -432,7 +433,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $preselectedchoice=$addwarning?'no':'yes'; print '
'; - $text=$langs->trans('ConfirmSupplierPayment',$totalpayment,$langs->trans("Currency".$conf->currency)); + $text=$langs->trans('ConfirmSupplierPayment', price($totalpayment),$langs->trans("Currency".$conf->currency)); if (GETPOST('closepaidinvoices')) { $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); diff --git a/htdocs/includes/nusoap/lib/nusoap.php b/htdocs/includes/nusoap/lib/nusoap.php index 403d74b13e9..6defe0e6004 100644 --- a/htdocs/includes/nusoap/lib/nusoap.php +++ b/htdocs/includes/nusoap/lib/nusoap.php @@ -2217,7 +2217,7 @@ class soap_transport_http extends nusoap_base { } $this->use_curl = $use_curl; preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - if (isset($rev[1])) $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); + $this->setHeader('User-Agent', $this->title.'/'.$this->version.(isset($rev[1])?' ('.$rev[1].')':'')); } /** diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index ce100d49390..4e5367dff39 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -109,7 +109,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta $marge_tx_ret=''; $marque_tx_ret=''; - if ($fk_pa > 0) { + if ($fk_pa > 0 && empty($paht)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $product = new ProductFournisseur($db); if ($product->fetch_product_fournisseur_price($fk_pa)) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 71742f261cf..cb49e491ac4 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -359,7 +359,7 @@ if ($id > 0 || ! empty($ref)) } print ''; - $totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT'); + $totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise), 'MT'); $total+=$totalline; print ''; print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency)); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 1be43fe94dd..c475dcbcae0 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -344,8 +344,7 @@ $langs->load("orders"); $langs->load("proposals"); $langs->load("margins"); -//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); -print '
'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'

'; +print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy'); print ''; print '';