Update product account
choose between code sell or code buy cleaning code need some tests
This commit is contained in:
parent
977b12fac0
commit
b185cfb85f
@ -3,8 +3,8 @@
|
|||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.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.'/accountancy/class/accountingaccount.class.php';
|
||||||
@ -41,7 +42,7 @@ $langs->load("compta");
|
|||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
// Search & action GETPOST
|
//search & action GETPOST
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||||
@ -74,6 +75,81 @@ $offset = $limit * $page;
|
|||||||
if (! $sortfield) $sortfield="p.ref";
|
if (! $sortfield) $sortfield="p.ref";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
|
// sales or purchase
|
||||||
|
|
||||||
|
//$accounting_product_mode = defined('ACCOUNTING_PRODUCT_MODE')?ACCOUNTING_PRODUCT_MODE:'ACCOUNTANCY_SELL';
|
||||||
|
|
||||||
|
if ($action == 'update') {
|
||||||
|
if ($_POST["button"] == $langs->trans('Modify')) {
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$accounting_product_modes = array(
|
||||||
|
'ACCOUNTANCY_SELL',
|
||||||
|
'ACCOUNTANCY_BUY'
|
||||||
|
);
|
||||||
|
|
||||||
|
$accounting_product_mode = GETPOST('accounting_product_mode','alpha');
|
||||||
|
|
||||||
|
if (in_array($accounting_product_mode,$accounting_product_modes)) {
|
||||||
|
|
||||||
|
if (!dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == $langs->trans("Change_Account"))
|
||||||
|
{
|
||||||
|
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>';
|
||||||
|
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||||
|
$mesCodesVentilChoisis = $codeventil_buy ;
|
||||||
|
}
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') {
|
||||||
|
$mesCodesVentilChoisis = $codeventil_sell;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cpt = 0;
|
||||||
|
foreach ( $mesCasesCochees as $maLigneCochee )
|
||||||
|
{
|
||||||
|
$maLigneCourante = explode("_", $maLigneCochee);
|
||||||
|
$monId = $maLigneCourante[0];
|
||||||
|
$monNumLigne = $maLigneCourante[2];
|
||||||
|
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
|
||||||
|
|
||||||
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||||
|
$sql .= " SET accountancy_code_buy = " . $monCompte;
|
||||||
|
}
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') {
|
||||||
|
$sql .= " SET accountancy_code_sell = " . $monCompte;
|
||||||
|
}
|
||||||
|
$sql .= " WHERE rowid = " . $monId;
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||||
|
if ($db->query($sql))
|
||||||
|
{
|
||||||
|
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$cpt ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
||||||
|
}
|
||||||
|
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -109,77 +185,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||||||
//debug move header to top
|
//debug move header to top
|
||||||
llxHeader('', $langs->trans("Accounts"));
|
llxHeader('', $langs->trans("Accounts"));
|
||||||
|
|
||||||
|
|
||||||
//TODO: modify to update all selected product with a sell account
|
|
||||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_sell")) {
|
|
||||||
//print_r ($changeaccount);
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
|
|
||||||
$sql1 .= " SET p.accountancy_code_sell=" . $account_number_sell;
|
|
||||||
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
|
|
||||||
|
|
||||||
dol_syslog('accountancy/customer/lines.php::changeaccount product sell sql= ' . $sql1);
|
|
||||||
print_r ($sql1);
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
}
|
|
||||||
if (! $error) {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
|
||||||
} else {
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//TODO: modify to update all selected product with a buy account
|
|
||||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_buy")) {
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
|
|
||||||
$sql1 .= " SET p.accountancy_code_buy=" . $account_number_buy;
|
|
||||||
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
|
|
||||||
print_r ($sql1);
|
|
||||||
dol_syslog('accountancy/customer/lines.php::changeaccount product buy sql= ' . $sql1);
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
}
|
|
||||||
if (! $error) {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
|
||||||
} else {
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
//DEBUG elarifr
|
|
||||||
//llxHeader('', $langs->trans("Accounts"));
|
|
||||||
|
|
||||||
//For updating account export
|
|
||||||
print '<script type="text/javascript">
|
|
||||||
|
|
||||||
function launch_export() {
|
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
|
||||||
}
|
|
||||||
</script>';
|
|
||||||
|
|
||||||
//TODO For select box
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$(\'#select-all\').click(function(event) {
|
$(\'#select-all\').click(function(event) {
|
||||||
@ -197,40 +208,18 @@ print '<script type="text/javascript">
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
/*
|
|
||||||
* Action
|
|
||||||
*/
|
|
||||||
//TODO
|
|
||||||
/*
|
|
||||||
if ($action == 'ventil') {
|
|
||||||
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
|
||||||
if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) {
|
|
||||||
if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
|
||||||
}
|
|
||||||
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//do we really need to exclude old product not tosell / tobuy ?
|
|
||||||
//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
|
|
||||||
//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
|
|
||||||
//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1";
|
|
||||||
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||||
//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa";
|
|
||||||
$sql .= " WHERE (";
|
$sql .= " WHERE (";
|
||||||
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||||
|
|
||||||
//Search on correct pcg version
|
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||||
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
|
|
||||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||||
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
|
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
//Add search filter like
|
//Add search filter like
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
@ -253,57 +242,57 @@ if ($result) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans('OptionMode').'</td><td>'.$langs->trans('Description').'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('Accountancy_code_sell').'</td>';
|
||||||
|
print '<td colspan="2">'.nl2br($langs->trans('OptionModeProductSell'));
|
||||||
|
print "</td></tr>\n";
|
||||||
|
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('Accountancy_code_buy').'</td>';
|
||||||
|
print '<td colspan="2">'.nl2br($langs->trans('OptionModeProductBuy'))."</td></tr>\n";
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
|
||||||
|
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
||||||
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
|
||||||
print ' ';
|
print ' ';
|
||||||
|
|
||||||
|
|
||||||
//DEBUG
|
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post"><br />';
|
|
||||||
// print '<input type="hidden" name="action" value="ventil">';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr>';
|
|
||||||
print '<td width="33%">';
|
|
||||||
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
|
|
||||||
print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1);
|
|
||||||
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_buy") . '"/></div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td width="33%">';
|
|
||||||
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
|
|
||||||
print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1);
|
|
||||||
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_sell") . '"/></div>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td width="33%">';
|
|
||||||
//TODO change button
|
|
||||||
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
// print '<td align="left">' . $langs->trans("Ref") . '</td>';
|
|
||||||
// print '<td align="left">' . $langs->trans("Label") . '</td>';
|
|
||||||
// print '<td align="left">' . $langs->trans("Description") . '</td>';
|
|
||||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||||
|
}
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
// print_liste_field_titre('');
|
|
||||||
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -314,24 +303,19 @@ if ($result) {
|
|||||||
print '<td class="liste_titre" colspan="3"> </td>';
|
print '<td class="liste_titre" colspan="3"> </td>';
|
||||||
print '<td align="right" colspan="4" class="liste_titre">';
|
print '<td align="right" colspan="4" class="liste_titre">';
|
||||||
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 '<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 '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
|
||||||
print ' ';
|
print ' ';
|
||||||
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 '<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 '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// print '<td class="liste_titre" colspan="2"> </td>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
|
|
||||||
while ( $i < min($num_lines, 250) ) {
|
while ( $i < min($num_lines, 250) ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
$compta_prodsell = $obj->accountancy_code_sell;
|
$compta_prodsell = $obj->accountancy_code_sell;
|
||||||
if (empty($compta_prodsell)) {
|
|
||||||
if ($obj->product_type == 0) {
|
if ($obj->product_type == 0) {
|
||||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
$compta_prodsell_id = $aarowid_prodsell;
|
$compta_prodsell_id = $aarowid_prodsell;
|
||||||
@ -339,11 +323,10 @@ if ($result) {
|
|||||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
$compta_prodsell_id = $aarowid_servsell;
|
$compta_prodsell_id = $aarowid_servsell;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$compta_prodbuy = $obj->accountancy_code_buy;
|
$compta_prodbuy = $obj->accountancy_code_buy;
|
||||||
if (empty($compta_prodbuy)) {
|
|
||||||
if ($obj->product_type == 0) {
|
if ($obj->product_type == 0) {
|
||||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||||
@ -351,14 +334,11 @@ if ($result) {
|
|||||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
$compta_prodbuy_id = $aarowid_servbuy;
|
$compta_prodbuy_id = $aarowid_servbuy;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
//debug
|
|
||||||
print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '</td>';
|
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
@ -372,7 +352,6 @@ print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_p
|
|||||||
else
|
else
|
||||||
print '- ';
|
print '- ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="left">' . $obj->label . '</td>';
|
print '<td align="left">' . $obj->label . '</td>';
|
||||||
//TODO ADJUST DESCRIPTION SIZE
|
//TODO ADJUST DESCRIPTION SIZE
|
||||||
// print '<td align="left">' . $obj->description . '</td>';
|
// print '<td align="left">' . $obj->description . '</td>';
|
||||||
@ -381,6 +360,8 @@ print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_p
|
|||||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||||
|
|
||||||
//acountingaccount buy
|
//acountingaccount buy
|
||||||
|
|
||||||
|
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||||
//TODO: replace by select
|
//TODO: replace by select
|
||||||
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||||
@ -389,36 +370,38 @@ print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_p
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
|
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
|
||||||
//acountingaccount sel
|
//acountingaccount sel
|
||||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||||
|
|
||||||
//TODO: replace by select
|
//TODO: replace by select
|
||||||
//TODO: we shoul set a user defined value to adjust user square / wide screen size
|
//TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||||
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
|
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//action edit & select box
|
}
|
||||||
print '<td align="center">' . $obj->rowid . '</td>';
|
|
||||||
print '<td><a href="./card.php?id=' . $obj->rowid . '">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>';
|
|
||||||
//Checkbox select
|
//Checkbox select
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" name="changeaccount[]" value="' . $obj->rowid . '"/></td>';
|
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $obj->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
print '</table>';
|
||||||
|
print '<br><div align="center"><input type="submit" class="butAction" name="action" value="' . $langs->trans("Change_Account") . '"></div>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
} else {
|
} else {
|
||||||
// print $db->error();
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table></form>";
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
Loading…
Reference in New Issue
Block a user