diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 68cfb061e16..1f75e6caf74 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2748,17 +2748,17 @@ class Commande extends CommonOrder * Update a line in database * * @param int $rowid Id of line to update - * @param string $desc Description de la ligne - * @param float $pu Prix unitaire + * @param string $desc Description of line + * @param float $pu Unit price * @param float $qty Quantity - * @param float $remise_percent Pourcentage de remise de la ligne + * @param float $remise_percent Percent of discount * @param float $txtva Taux TVA * @param float $txlocaltax1 Local tax 1 rate * @param float $txlocaltax2 Local tax 2 rate * @param string $price_base_type HT or TTC * @param int $info_bits Miscellaneous informations on line - * @param int $date_start Start date of the line - * @param int $date_end End date of the line + * @param int $date_start Start date of the line + * @param int $date_end End date of the line * @param int $type Type of line (0=product, 1=service) * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 7c975c94dee..9a4b58a26c6 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * * 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 diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index b3c9a903028..755c1f8421f 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * @@ -237,6 +237,12 @@ if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->tran if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->banque->configurer) +{ + $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; +} + // Lines of title fields print '
'; @@ -248,7 +254,7 @@ print ''; print ''; print ''; -print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1); if ($sall) @@ -415,10 +421,12 @@ print ''; -$total = array(); $found = 0; $i=0; +$total = array(); $found = 0; $i=0; $lastcurrencycode=''; $var=true; foreach ($accounts as $key=>$type) { + if ($i >= $limit) break; + $found++; $acc = new Account($db); @@ -427,6 +435,15 @@ foreach ($accounts as $key=>$type) $var = !$var; $solde = $acc->solde(1); + if (! empty($lastcurrencycode) && $lastcurrencycode != $acc->currency_code) + { + $lastcurrencycode='various'; // We found several different currencies + } + if ($lastcurrencycode != 'various') + { + $lastcurrencycode=$acc->currency_code; + } + print ''; // Ref @@ -486,7 +503,6 @@ foreach ($accounts as $key=>$type) if (! $i) $totalarray['nbfield']++; } - // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -565,7 +581,7 @@ foreach ($accounts as $key=>$type) if (! $found) print ''.$langs->trans("None").''; // Show total line -if (isset($totalarray['totalbalancefield'])) +if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before { print ''; $i=0; @@ -577,7 +593,7 @@ if (isset($totalarray['totalbalancefield'])) if ($num < $limit) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalbalancefield'] == $i) print ''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $key).''; + elseif ($totalarray['totalbalancefield'] == $i) print ''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).''; else print ''; } print ''; @@ -589,18 +605,6 @@ print ""; print "
"; -/* - * Buttons actions - */ - -print '
'."\n"; -if ($user->rights->banque->configurer) -{ - print ''.$langs->trans("NewFinancialAccount").''; -} -print '
'; - - llxFooter(); $db->close(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 196c14b285e..9708d8e6360 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2977,7 +2977,7 @@ else if ($id > 0 || ! empty($ref)) $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', ''); print '
'; print '
'; @@ -3430,7 +3430,8 @@ else if ($id > 0 || ! empty($ref)) print ''; - // List of payments + + // List of previous situation invoices $sign = 1; if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1; @@ -3541,9 +3542,11 @@ else if ($id > 0 || ! empty($ref)) print ''; } + + // List of payments already done + print ''; - // List of payments already done print ''; print ''; print ''; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index ebc90fca6c5..cdca425d5f6 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -138,45 +138,59 @@ if ($id > 0 || ! empty($ref)) $head = facture_prepare_head($object); + $totalpaye = $object->getSommePaiement(); + dol_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), 0, 'bill'); - /* - * Summary invoice for reminder - */ - print '
' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '' . $langs->trans('Date') . '
'; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - + // Invoice content + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; // Ref customer - print '
'; - print ''; - - // Customer - print ""; - print ''; - print "
'.$langs->trans('Ref').''; - $morehtmlref=''; - $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$object->id); - if ($result > 0) - { - $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; - } - if ($result < 0) - { - dol_print_error('',$discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print '
'; - print $langs->trans('RefCustomer'); - print ''; - print $object->ref_client; - print '
".$langs->trans("Company")."'.$object->thirdparty->getNomUrl(1,'compta').'
"; - + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_fiche_end(); print '
'; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 246e5595779..d6424309f87 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2013 Cédric Salvador @@ -99,7 +99,8 @@ if ($id > 0 || ! empty($ref)) $head = facture_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill'); - + $totalpaye = $object->getSommePaiement(); + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -108,51 +109,74 @@ if ($id > 0 || ! empty($ref)) $totalsize+=$file['size']; } + + // Invoice content + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); - + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Ref customer - print ''; - print ''; - - // Company - print ''; - - print ''; + print ''; print ''; print "
'.$langs->trans('Ref').''; - $morehtmlref=''; - $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$object->id); - if ($result > 0) - { - $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; - } - if ($result < 0) - { - dol_print_error('',$discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print '
'; - print $langs->trans('RefCustomer'); - print ''; - print $object->ref_client; - print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; + print "
\n"; + dol_fiche_end(); + $modulepart = 'facture'; $permission = $user->rights->facture->creer; $permtoedit = $user->rights->facture->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; - } else { diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 419cacf4cff..d52e7648418 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -31,6 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; $langs->load("companies"); $langs->load("bills"); +$id = GETPOST("facid","int"); +$ref=GETPOST("ref",'alpha'); + /* * View @@ -40,22 +43,78 @@ $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); -$fac = new Facture($db); -$fac->fetch($_GET["facid"]); -$fac->info($_GET["facid"]); +$object = new Facture($db); +$object->fetch($id, $ref); +$object->fetch_thirdparty(); -$soc = new Societe($db); -$soc->fetch($fac->socid); +$object->info($object->id); -$head = facture_prepare_head($fac); +$head = facture_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), 0, 'bill'); +$totalpaye = $object->getSommePaiement(); + +// Invoice content + +$linkback = '' . $langs->trans("BackToList") . ''; + +$morehtmlref='
'; +// Ref customer +$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + +$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + +dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); + +print '
'; +print '
'; + +print '
'; print '
'; -dol_print_object_info($fac); +dol_print_object_info($object); print '
'; print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 4b4b68a7cf4..9b939cf7c32 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * * 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 @@ -71,51 +71,69 @@ if ($id > 0 || ! empty($ref)) $object = new Facture($db); $object->fetch($id,$ref); - $soc = new Societe($db); - $soc->fetch($object->socid); + $object->fetch_thirdparty(); $head = facture_prepare_head($object); + + $totalpaye = $object->getSommePaiement(); + dol_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), 0, 'bill'); + // Invoice content - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; - $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - // Ref - print ''; - print ''; + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status - // Ref customer - print ''; - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); - // Company - print ''; - print ''; - - print "
'.$langs->trans('Ref').''; - $morehtmlref=''; - $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$object->id); - if ($result > 0) - { - $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; - } - if ($result < 0) - { - dol_print_error('',$discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print '
'; - print $langs->trans('RefCustomer'); - print ''; - print $object->ref_client; - print '
'.$langs->trans("Company").''.$soc->getNomUrl(1,'compta').'
"; - - print '
'; - - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + print '
'; + print '
'; + + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 879d5abfee4..ea886fbd65c 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -149,48 +149,63 @@ if ($object->id > 0) dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill'); - /* - * Facture - */ + // Invoice content + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->facture->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', ''); + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print '"; - - // Ref customer - print ''; - print ''; - - // Third party - print ''; - print ''; - print ''; - // Type - print '"; print ''; - // Montants - print ''; - print ''; - print ''; - print ''; - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj=="1") //Localtax1 - { - print ''; - print ''; - print ''; - } - if ($mysoc->localtax2_assuj=="1") //Localtax2 - { - print ''; - print ''; - print ''; - } - - - print ''; - print ''; - - // We can also use bcadd to avoid pb with floating points - // For example print 239.2 - 229.3 - 9.9; does not return 0. - //$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); - //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); - $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT'); - - print ''; - print ''; - - // Statut - print ''; - print ''; - print ''; - + print '
'.$langs->trans("Ref").''; - $morehtmlref=''; - $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$object->id); - if ($result > 0) - { - $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; - } - if ($result < 0) - { - dol_print_error('',$discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer'); - print '
'; - print '
'; - print $object->ref_client; - print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1,'compta'); - print '   ('.$langs->trans('OtherBills').')
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { @@ -407,50 +422,101 @@ if ($object->id > 0) print "
'.$langs->trans('AmountHT').''.price($object->total_ht).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('RemainderToPay').''.price($resteapayer).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans("RIB").''; print $object->thirdparty->display_rib(); print '
'; + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + + // Amount + print ''; + print ''; + + // Vat + print ''; + print ''; + + // Amount Local Taxes + if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 + { + print ''; + print ''; + } + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 + { + print ''; + print ''; + } + + // Revenue stamp + if ($selleruserevenustamp) // Test company use revenue stamp + { + print ''; + } + + // Total with tax + print ''; + + $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT'); + + // TODO Replace this by an include with same code to show already done payment visible in invoice card + print ''; + + print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) + { + print ''; + } + print '
'; + print $langs->trans('RevenueStamp'); + print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '
'; + print '
'; + if ($action == 'editrevenuestamp') { + print '
'; + print ''; + print ''; + print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); + // print ''; + print ' '; + print '
'; + } else { + print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency); + } + print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '
'.$langs->trans('RemainderToPay').''.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'
'; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 85de900725e..5d8377368ae 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -135,7 +135,8 @@ function societe_prepare_head(Societe $object) // Bank accounrs if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) { - $langs->load('banks'); + $langs->load("banks"); + $nbBankAccount=0; $head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id; $head[$h][1] = $langs->trans("BankAccounts"); diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index bb973369adc..40ee1a1690b 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -28,20 +28,24 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("interventions"); +$ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("Intervention"); ?> - getNomUrl(1); ?> - - datev,'day'); ?> - - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("Intervention"); ?> + getNomUrl(1); ?> + + datev,'day'); ?> + + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4bbc427a525..34bc05a7d42 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2375,7 +2375,7 @@ class CommandeFournisseur extends CommonOrder // Mise a jour info denormalisees au niveau facture - if ($result > 0) + if ($result >= 0) { $this->update_price('','auto'); $this->db->commit(); diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index e3570c5285e..97d29e3885b 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -451,7 +451,7 @@ class MultiCurrency extends CommonObject } /** - * Update rate in database + * Add new entry into llx_multicurrency_rate to historise * * @param double $rate rate value * @@ -459,15 +459,7 @@ class MultiCurrency extends CommonObject */ public function updateRate($rate) { - if (is_object($this->rate)) - { - $this->rate->rate = $rate; - return $this->rate->update(); - } - else - { - return $this->addRate($rate); - } + return $this->addRate($rate); } /** @@ -480,7 +472,7 @@ class MultiCurrency extends CommonObject $sql = 'SELECT cr.rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; - $sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)'; + $sql.= ' AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr2.fk_multicurrency = '.$this->id.')'; dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index af83c01986c..45da1eee13c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -588,9 +588,14 @@ div.myavailability { overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; }*/ +/* Style used for most tables */ .div-table-responsive { overflow-x: auto; - /*min-height: 0.01%;*/ + min-height: 0.01%; +} +/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ +div.fiche>form>div.div-table-responsive { + overflow-x: auto; min-height: 350px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 0d802a2c345..c95bd830059 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -587,15 +587,20 @@ div.myavailability { } /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ -.table-responsive { +/*.table-responsive { width: calc(100% - 330px); margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; -} +}*/ +/* Style used for most tables */ .div-table-responsive { overflow-x: auto; - /*min-height: 0.01%;*/ + min-height: 0.01%; +} +/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ +div.fiche>form>div.div-table-responsive { + overflow-x: auto; min-height: 350px; }