Skip to content
Snippets Groups Projects
Commit 6d9bec9d authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

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

parents 71246c86 9865b0da
No related branches found
No related tags found
No related merge requests found
......@@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/customer/list.php
* \ingroup Accountancy
* \brief Ventilation page from customers invoices
* \file htdocs/accountancy/customer/list.php
* \ingroup Advanced accountancy
* \brief Ventilation page from customers invoices
*/
require '../../main.inc.php';
......@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
......@@ -105,7 +106,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
print '<script type="text/javascript">
......@@ -128,31 +128,33 @@ print '<script type="text/javascript">
/*
* Action
*/
if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil) && ! empty($mesCasesCochees)) {
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil;
$cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) {
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
......@@ -164,7 +166,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/*
* Customer Invoice lines
*/
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
......@@ -224,16 +225,16 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
......@@ -247,40 +248,39 @@ if ($result) {
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print '</tr>';
// We add search filter
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td align="right" class="liste_titre" colspan="4">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$facture_static = new Facture($db);
$product_static = new Product($db);
$form = new Form($db);
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$objp->code_sell_l = '';
$objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$code_sell_p_l_differ = '';
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
......@@ -304,9 +304,9 @@ if ($result) {
}
if ($objp->code_sell_l != $objp->code_sell_p)
$code_sell_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
......@@ -316,14 +316,14 @@ if ($result) {
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
......@@ -339,10 +339,10 @@ if ($result) {
if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l;
} else {
print $langs->trans("Purchase") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p;
print $langs->trans("Buy") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p;
}
print '</td>';
print '<td align="center">';
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
......@@ -353,7 +353,7 @@ if ($result) {
print '</tr>';
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
print '</form>';
......
......@@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/supplier/list.php
* \ingroup Accountancy
* \brief Ventilation page from suppliers invoices
* \file htdocs/accountancy/customer/list.php
* \ingroup Advanced accountancy
* \brief Ventilation page from suppliers invoices
*/
require '../../main.inc.php';
......@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
......@@ -132,32 +133,34 @@ print '<script type="text/javascript">
/*
* Action
*/
if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil;
$cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) {
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
......@@ -169,7 +172,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/*
* Supplier Invoice Lines
*/
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
......@@ -255,7 +257,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment