Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/compta/facture/list.php
This commit is contained in:
Laurent Destailleur 2021-08-24 16:37:18 +02:00
commit 07ab352877
20 changed files with 148 additions and 94 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
@ -627,7 +627,7 @@ if (empty($action) || $action == 'view') {
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
$accountoshow = length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
} else {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
@ -648,7 +648,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$val["refsologest"].'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$langs->trans("Thirdparty").'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
@ -717,9 +717,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$date.'"'.$sep;
print '"'.$val["refsologest"].'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.$langs->trans("Thirdparty").'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").' NPR"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
@ -894,7 +894,7 @@ if (empty($action) || $action == 'view') {
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
} else {

View File

@ -609,7 +609,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$val["ref"].'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$langs->trans("Thirdparty").'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
@ -834,7 +834,7 @@ if (empty($action) || $action == 'view') {
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
} else {

View File

@ -106,10 +106,16 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">';
print getCustomerProposalPieChart($socid);
print '<br>';
print getCustomerOrderPieChart($socid);
print '<br>';
$tmp = getCustomerProposalPieChart($socid);
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getCustomerOrderPieChart($socid);
if ($tmp) {
print $tmp;
print '<br>';
}
/*
* Draft customer proposals

View File

@ -67,8 +67,11 @@ print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal');
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
print getCustomerProposalPieChart($socid);
print '<br>';
$tmp = getCustomerProposalPieChart($socid);
if ($tmp) {
print $tmp;
print '<br>';
}
/*
* Draft proposals

View File

@ -77,8 +77,11 @@ print load_fiche_titre($langs->trans("OrdersArea"), '', 'order');
print '<div class="fichecenter"><div class="fichethirdleft">';
print getCustomerOrderPieChart($socid);
print '<br>';
$tmp = getCustomerOrderPieChart($socid);
if ($tmp) {
print $tmp;
print '<br>';
}
/*

View File

@ -321,8 +321,8 @@ if (empty($reshook)) {
//var_dump($array_of_total_ht_per_vat_rate);exit;
foreach ($array_of_total_ht_per_vat_rate as $vatrate => $tmpvalue) {
$tmp_total_ht = $array_of_total_ht_per_vat_rate[$vatrate];
$tmp_total_ht_devise = $array_of_total_ht_devise_per_vat_rate[$vatrate];
$tmp_total_ht = price2num($array_of_total_ht_per_vat_rate[$vatrate]);
$tmp_total_ht_devise = price2num($array_of_total_ht_devise_per_vat_rate[$vatrate]);
if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
if ($object->type == $object::TYPE_DEPOSIT) {

View File

@ -293,7 +293,7 @@ class Facture extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>5),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>10),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>10),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>12),
//'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
@ -343,8 +343,8 @@ class Facture extends CommonInvoice
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295, 'isameasure'=>1),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300, 'isameasure'=>1),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>291, 'isameasure'=>1),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>292, 'isameasure'=>1),
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),

View File

@ -59,19 +59,33 @@ print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill');
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
print getNumberInvoicesPieChart('customers');
//print getCustomerInvoicePieChart($socid);
print '<br>';
print getCustomerInvoiceDraftTable($max, $socid);
$tmp = getNumberInvoicesPieChart('customers');
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getCustomerInvoiceDraftTable($max, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
print '</div>';
print '<div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
print getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
print '<br>';
print getCustomerInvoiceUnpaidOpenTable($max, $socid);
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
print '</div>';
print '</div>';

View File

@ -235,13 +235,13 @@ $arrayfields = array(
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166),
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180),
'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>190),
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>200),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>210),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>220), // Not enabled by default because slow
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>280),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>285),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>290),
'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>291),
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),

View File

@ -99,7 +99,8 @@ class FormMargin
$pv = $line->total_ht;
$pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
if ($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) {
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE && $object->situation_counter > 0)) {
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
} else {
$pa = $line->qty * $pa_ht;

View File

@ -679,7 +679,8 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $tmpinvoice->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
@ -807,7 +808,8 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $facturesupplierstatic->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
@ -883,7 +885,9 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '<table class="noborder centpercent">';
$result .= '<tr class="liste_titre">';
$result .= '<td colspan="4">'.$langs->trans("LastCustomersBills", $maxCount).'</td>';
$result .= '<th colspan="3">'.$langs->trans("LastCustomersBills", $maxCount).'</th>';
$result .= '<th class="right">'.$langs->trans("AmountTTC").'</th>';
$result .= '<th class="right"></th>';
$result .= '</tr>';
if ($num < 1) {
@ -917,7 +921,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.$filename;
$result .= '<tr width="20%" class="nowrap">';
$result .= '<tr class="nowrap">';
$result .= '<td class="oddeven">';
$result .= '<table class="nobordernopadding">';
@ -931,8 +935,9 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '</table>';
$result .= '</td>';
$result .= '<td>'.$companystatic->getNomUrl(1, 'customer').'</td>';
$result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer').'</td>';
$result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>';
$result .= '<td class="right amount">'.price($obj->total_ttc).'</td>';
$result .= '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
$result .= '</tr>';
@ -985,7 +990,9 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result = '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder centpercent">';
$result .= '<tr class="liste_titre">';
$result .= '<td colspan="4">'.$langs->trans("BoxTitleLastSupplierBills", $maxCount).'</td>';
$result .= '<th colspan="3">'.$langs->trans("BoxTitleLastSupplierBills", $maxCount).'</th>';
$result .= '<th class="right">'.$langs->trans("AmountTTC").'</th>';
$result .= '<th class="right"></th>';
$result .= '</tr>';
if ($num < 1) {
@ -1019,7 +1026,7 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.$filename;
$result .= '<tr width="20%" class="nowrap">';
$result .= '<tr class="nowrap">';
$result .= '<td class="oddeven">';
$result .= '<table class="nobordernopadding">';
@ -1033,8 +1040,12 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '</table>';
$result .= '</td>';
$result .= '<td>'.$companystatic->getNomUrl(1, 'supplier').'</td>';
$result .= '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
$result .= '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>';
$result .= '<td class="amount right">'.price($obj->total_ttc).'</td>';
$result .= '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
$result .= '</tr>';
@ -1341,7 +1352,8 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$societestatic->code_compta = $obj->code_compta;
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">';
print $facstatic->getNomUrl(1, '');
print '</td>';
print '<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1, 'supplier').'</td>';

View File

@ -174,8 +174,8 @@ foreach ($listofstatus as $status) {
print '<tr class="oddeven">';
print '<td><a href="list.php?search_status='.$status.'">'.$donstatic->LibStatut($status, 4).'</a></td>';
print '<td class="right">'.(!empty($nb[$status]) ? $nb[$status] : '&nbsp;').'</td>';
print '<td class="right">'.(!empty($nb[$status]) ?price($somme[$status], 'MT') : '&nbsp;').'</td>';
print '<td class="right">'.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : '&nbsp;').'</td>';
print '<td class="right nowraponall amount">'.(!empty($nb[$status]) ? price($somme[$status], 'MT') : '&nbsp;').'</td>';
print '<td class="right nowraponall">'.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : '&nbsp;').'</td>';
$totalnb += (!empty($nb[$status]) ? $nb[$status] : 0);
$total += (!empty($somme[$status]) ? $somme[$status] : 0);
print "</tr>";
@ -183,9 +183,9 @@ foreach ($listofstatus as $status) {
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td class="right">'.$totalnb.'</td>';
print '<td class="right">'.price($total, 'MT').'</td>';
print '<td class="right">'.($totalnb ?price(price2num($total / $totalnb, 'MT')) : '&nbsp;').'</td>';
print '<td class="right nowraponall">'.$totalnb.'</td>';
print '<td class="right nowraponall">'.price($total, 'MT').'</td>';
print '<td class="right nowraponall">'.($totalnb ?price(price2num($total / $totalnb, 'MT')) : '&nbsp;').'</td>';
print '</tr>';
print "</table>";
@ -233,7 +233,7 @@ if ($resql) {
print dolGetFirstLastname($obj->lastname, $obj->firstname);
print '</td>';
print '<td class="right nobordernopadding">';
print '<td class="right nobordernopadding nowraponall amount">';
print price($obj->amount, 1);
print '</td>';

View File

@ -223,10 +223,10 @@ class PaiementFourn extends Paiement
// If we want to closed paid invoices
if ($closepaidinvoices) {
$paiement = $invoice->getSommePaiement();
//$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes = 0;
//$deposits=$invoice->getSumDepositsUsed();
$deposits = 0;
$creditnotes=$invoice->getSumCreditNotesUsed();
//$creditnotes = 0;
$deposits=$invoice->getSumDepositsUsed();
//$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) {
@ -238,7 +238,7 @@ class PaiementFourn extends Paiement
// Insert one discount by VAT rate category
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch('', $invoice->id);
$discount->fetch('', 0, $invoice->id);
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
$discount->discount_type = 1; // Supplier discount
$discount->description = '(DEPOSIT)';

View File

@ -2478,7 +2478,7 @@ if ($action == 'create') {
$labelofbutton = $langs->trans('ReceiveProducts');
if ($conf->reception->enabled) {
$labelofbutton = $langs->trans("CreateReception");
if (!empty($object->linkedObjects)) {
if (!empty($object->linkedObjects['reception'])) {
foreach ($object->linkedObjects['reception'] as $element) {
if ($element->statut >= 0) {
$hasreception = 1;

View File

@ -58,19 +58,34 @@ print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'supplier_invo
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
print getNumberInvoicesPieChart('suppliers');
//print getPurchaseInvoicePieChart($socid);
print '<br>';
print getDraftSupplierTable($maxDraftCount, $socid);
$tmp = getNumberInvoicesPieChart('suppliers');
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getDraftSupplierTable($maxDraftCount, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
print '</div>';
print '<div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
print getPurchaseInvoiceLatestEditTable($maxLatestEditCount, $socid);
print '<br>';
print getPurchaseInvoiceUnpaidOpenTable($max, $socid);
$tmp = getPurchaseInvoiceLatestEditTable($maxLatestEditCount, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getPurchaseInvoiceUnpaidOpenTable($max, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
print '</div>';
print '</div>';

View File

@ -170,29 +170,29 @@ if (empty($user->socid)) {
$checkedtypetiers = 0;
$arrayfields = array(
'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'f.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1),
'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0),
'f.label'=>array('label'=>$langs->trans("Label"), 'checked'=>0),
'f.datef'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>-1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>1, 'position'=>50),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1, 'position'=>52),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110),
'f.ref'=>array('label'=>"Ref", 'checked'=>1),
'f.ref_supplier'=>array('label'=>"RefSupplier", 'checked'=>1),
'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.label'=>array('label'=>"Label", 'checked'=>0),
'f.datef'=>array('label'=>"DateInvoice", 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.town'=>array('label'=>"Town", 'checked'=>-1),
's.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>1, 'position'=>50),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>52),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>105),
'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>110),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1", 'position'=>100),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0, 'position'=>115),
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>115),
'u.login'=>array('label'=>"Author", 'checked'=>1),
'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0),
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
'dynamount_payed'=>array('label'=>"Paid", 'checked'=>0),
'rtp'=>array('label'=>"Rest", 'checked'=>0),
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
@ -200,9 +200,9 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), // Not enabled by default because slow
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';

View File

@ -1637,7 +1637,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
}
print '<td class="right">';
if ($candelete) {
if ($candelete || ($db->jdate($objp->dp) >= dol_now())) { // Test on date is to be able to delete a corrupted record with a date in future
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;token='.newToken().'&amp;id='.$object->id.'&amp;lineid='.$objp->rowid.'">';
print img_delete();
print '</a>';

View File

@ -60,7 +60,7 @@ class TaskStats extends Stats
$sql .= " COUNT(t.rowid), t.priority";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
if (!$user->rights->societe->client->voir && !$user->soc_id) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id);
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id);
}
$sql .= $this->buildWhere();
//$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all task not draft
@ -119,7 +119,7 @@ class TaskStats extends Stats
$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
if (!$user->rights->societe->client->voir && !$user->soc_id) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id);
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id);
}
$sql .= $this->buildWhere();
$sql .= " GROUP BY year";
@ -181,7 +181,7 @@ class TaskStats extends Stats
$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(t.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
if (!$user->rights->societe->client->voir && !$user->soc_id) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id);
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id);
}
$sql .= $this->buildWhere();
$sql .= " GROUP BY dm";

View File

@ -384,7 +384,7 @@ if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) {
// Define type of elements
$typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), $showempty, 0, 0, '', 0, 0, $disabled, '', 'maxwidth150onsmartphone');
$button = '<input type="submit" class="button buttonform" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$button = '<input type="submit" class="button buttonform small" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$param = '';
$param .= "&sref=".urlencode($sref);