diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index c3d907df45f..e4c8774916f 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -411,7 +411,7 @@ if ($socid > 0) print load_fiche_titre($langs->trans("CustomerDiscounts"), '', ''); } - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql.= " rc.datec as dc, rc.description,"; $sql.= " rc.fk_facture_source,"; $sql.= " u.login, u.rowid as user_id,"; @@ -433,10 +433,18 @@ if ($socid > 0) print ''; print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; - print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("ConsumedBy").''; + print ''.$langs->trans("AmountHT").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountHT").''; + } + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountTTC").''; + } print ''.$langs->trans("DiscountOfferedBy").''; print ' '; print ''; @@ -455,7 +463,7 @@ if ($socid > 0) print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -464,7 +472,7 @@ if ($socid > 0) } elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -473,7 +481,7 @@ if ($socid > 0) } elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -482,14 +490,22 @@ if ($socid > 0) } else { - print ''; + print ''; print $obj->description; print ''; } print ''.$langs->trans("NotConsumed").''; print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ht).''; + } + print ''.vatrate($obj->tva_tx, true).''; print ''.price($obj->amount_ttc).''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ttc).''; + } print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -497,7 +513,7 @@ if ($socid > 0) { print ''; print 'rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).''; - print '   '; + //print '   '; print 'rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; } @@ -550,7 +566,7 @@ if ($socid > 0) /* * Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture) */ - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql.= " rc.datec as dc, rc.description,"; $sql.= " rc.fk_invoice_supplier_source,"; $sql.= " u.login, u.rowid as user_id,"; @@ -572,10 +588,18 @@ if ($socid > 0) print ''; print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; - print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("ConsumedBy").''; + print ''.$langs->trans("AmountHT").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountHT").''; + } + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountTTC").''; + } print ''.$langs->trans("DiscountOfferedBy").''; print ' '; print ''; @@ -594,7 +618,7 @@ if ($socid > 0) print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -603,7 +627,7 @@ if ($socid > 0) } elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -612,7 +636,7 @@ if ($socid > 0) } elseif (preg_match('/\(EXCESS PAID\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -621,14 +645,22 @@ if ($socid > 0) } else { - print ''; + print ''; print $obj->description; print ''; } print ''.$langs->trans("NotConsumed").''; print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ht).''; + } + print ''.vatrate($obj->tva_tx, true).''; print ''.price($obj->amount_ttc).''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ttc).''; + } print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -636,7 +668,7 @@ if ($socid > 0) { print ''; print 'rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).''; - print '   '; + //print '   '; print 'rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; } @@ -700,7 +732,7 @@ if ($socid > 0) } // Remises liees a lignes de factures - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql.= " rc.fk_facture_source,"; $sql.= " u.login, u.rowid as user_id,"; @@ -745,10 +777,18 @@ if ($socid > 0) print ''; print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; - print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("ConsumedBy").''; + print ''.$langs->trans("AmountHT").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountHT").''; + } + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountTTC").''; + } print ''.$langs->trans("Author").''; print ' '; print ''; @@ -788,7 +828,7 @@ if ($socid > 0) print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -797,7 +837,7 @@ if ($socid > 0) } elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -806,7 +846,7 @@ if ($socid > 0) } elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) { - print ''; + print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -815,14 +855,22 @@ if ($socid > 0) } else { - print ''; + print ''; print $obj->description; print ''; } print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''; print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ht).''; + } + print ''.vatrate($obj->tva_tx, true).''; print ''.price($obj->amount_ttc).''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ttc).''; + } print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -854,7 +902,7 @@ if ($socid > 0) } // Remises liees a lignes de factures - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql.= " rc.fk_invoice_supplier_source,"; $sql.= " u.login, u.rowid as user_id,"; @@ -899,10 +947,18 @@ if ($socid > 0) print ''; print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; - print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("ConsumedBy").''; + print ''.$langs->trans("AmountHT").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountHT").''; + } + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.$langs->trans("MulticurrencyAmountTTC").''; + } print ''.$langs->trans("Author").''; print ' '; print ''; @@ -942,7 +998,7 @@ if ($socid > 0) print ''.dol_print_date($db->jdate($obj->dc),'dayhour').''; if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -951,7 +1007,7 @@ if ($socid > 0) } elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -960,7 +1016,7 @@ if ($socid > 0) } elseif (preg_match('/\(EXCESS PAID\)/',$obj->description)) { - print ''; + print ''; $facturefournstatic->id=$obj->fk_invoice_supplier_source; $facturefournstatic->ref=$obj->ref; $facturefournstatic->type=$obj->type; @@ -969,14 +1025,22 @@ if ($socid > 0) } else { - print ''; + print ''; print $obj->description; print ''; } print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''; print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ht).''; + } + print ''.vatrate($obj->tva_tx, true).''; print ''.price($obj->amount_ttc).''; + if (! empty($conf->multicurrency->enabled)) + { + print ''.price($obj->multicurrency_amount_ttc).''; + } print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print '';