fix some feature on accountancy modules
This commit is contained in:
parent
f2c59405d4
commit
adccd5d04f
@ -145,6 +145,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||||
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||||
|
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||||
print '<br/><br/>';
|
print '<br/><br/>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/*
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@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) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -25,7 +24,6 @@
|
|||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
@ -46,7 +44,7 @@ $langs->load("accountancy");
|
|||||||
$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');
|
||||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
$chk_prod = GETPOST('chk_prod', 'array');
|
||||||
$account_number_buy = GETPOST('account_number_buy');
|
$account_number_buy = GETPOST('account_number_buy');
|
||||||
$account_number_sell = GETPOST('account_number_sell');
|
$account_number_sell = GETPOST('account_number_sell');
|
||||||
$changeaccount = GETPOST('changeaccount', 'array');
|
$changeaccount = GETPOST('changeaccount', 'array');
|
||||||
@ -55,11 +53,15 @@ $changeaccount_sell = GETPOST('changeaccount_sell','array');
|
|||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
|
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||||
|
$btn_changeaccount = GETPOST('changeaccount');
|
||||||
|
$btn_changetype = GETPOST('changetype');
|
||||||
|
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0)
|
||||||
|
$page = 0;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||||
@ -72,15 +74,14 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->
|
|||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="p.ref";
|
if (! $sortfield)
|
||||||
if (! $sortorder) $sortorder="ASC";
|
$sortfield = "p.ref";
|
||||||
|
if (! $sortorder)
|
||||||
|
$sortorder = "ASC";
|
||||||
|
|
||||||
// sales or purchase
|
// sales or purchase
|
||||||
|
|
||||||
//$accounting_product_mode = defined('ACCOUNTING_PRODUCT_MODE')?ACCOUNTING_PRODUCT_MODE:'ACCOUNTANCY_SELL';
|
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
if ($_POST["button"] == $langs->trans('Modify')) {
|
if (! empty($btn_changetype)) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$accounting_product_modes = array (
|
$accounting_product_modes = array (
|
||||||
@ -99,57 +100,52 @@ if ($action == 'update') {
|
|||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == $langs->trans("Change_Account"))
|
if (! empty($btn_changeaccount)) {
|
||||||
//todo check sql
|
$msg = '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
{
|
if (! empty($chk_prod)) {
|
||||||
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' : '') {
|
$accounting = new AccountingAccount($db);
|
||||||
$mesCodesVentilChoisis = $codeventil_buy ;
|
|
||||||
}
|
$msg .= '<div><font color="red">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||||
IF ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') {
|
|
||||||
$mesCodesVentilChoisis = $codeventil_sell;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cpt = 0;
|
$cpt = 0;
|
||||||
foreach ( $mesCasesCochees as $maLigneCochee )
|
foreach ( $chk_prod as $productid ) {
|
||||||
{
|
|
||||||
$maLigneCourante = explode("_", $maLigneCochee);
|
$accounting_account_id=GETPOST('codeventil_'.$productid);
|
||||||
$monId = $maLigneCourante[0];
|
|
||||||
$monNumLigne = $maLigneCourante[1];
|
$result=$accounting->fetch($accounting_account_id,null,1);
|
||||||
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
|
if ($result<0) {
|
||||||
|
//setEventMessage(null, $accounting->errors,'errors');
|
||||||
|
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||||
|
} else {
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||||
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||||
$sql .= " SET accountancy_code_buy = " . $monCompte;
|
$sql .= " SET accountancy_code_buy = " . $accounting->account_number;
|
||||||
}
|
}
|
||||||
IF ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||||
$sql .= " SET accountancy_code_sell = " . $monCompte;
|
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
|
||||||
}
|
}
|
||||||
$sql .= " WHERE rowid = " . $monId;
|
$sql .= " WHERE rowid = " . $productid;
|
||||||
|
|
||||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql))
|
if ($db->query($sql)) {
|
||||||
{
|
$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||||
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
|
||||||
} else {
|
} else {
|
||||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
|
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cpt ++;
|
$cpt ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
$msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
||||||
|
}
|
||||||
|
$msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</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)
|
||||||
@ -165,10 +161,10 @@ $form = new FormVentilation($db);
|
|||||||
// so we need to get those default value rowid first
|
// so we need to get those default value rowid first
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||||
$aarowid_servbuy = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||||
$aarowid_prodbuy = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
|
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||||
$aarowid_servsell = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||||
$aarowid_prodsell = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||||
|
|
||||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
@ -190,8 +186,6 @@ llxHeader('', $langs->trans("Accounts"));
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$(\'#select-all\').click(function(event) {
|
$(\'#select-all\').click(function(event) {
|
||||||
@ -209,7 +203,6 @@ print '<script type="text/javascript">
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
$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 .= " WHERE (";
|
$sql .= " WHERE (";
|
||||||
@ -220,8 +213,7 @@ IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
|||||||
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||||
$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 . "))";
|
||||||
}
|
} else {
|
||||||
ELSE {
|
|
||||||
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL ";
|
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL ";
|
||||||
$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 . "))";
|
||||||
@ -229,9 +221,6 @@ $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell !=
|
|||||||
|
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||||
@ -265,54 +254,48 @@ print '<table class="noborder" width="100%">';
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||||
print "</tr>\n";
|
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 '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_sell') . '</td>';
|
||||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSell'));
|
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSell'));
|
||||||
print "</td></tr>\n";
|
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 '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_buy') . '</td>';
|
||||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuy')) . "</td></tr>\n";
|
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuy')) . "</td></tr>\n";
|
||||||
|
|
||||||
print "</table>\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 /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
if (! empty($msg)) {
|
||||||
|
print $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 '<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 ' ';
|
print ' ';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
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' : '') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
print '<th align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
print '<th align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||||
|
} else {
|
||||||
|
print '<th align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||||
|
print '<th align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||||
}
|
}
|
||||||
else {
|
// print_liste_field_titre('');
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>' . '</td>';
|
||||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
|
||||||
}
|
|
||||||
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 '</tr>';
|
print '</tr>';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" size="20" 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_label" value="' . $search_label . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||||
|
|
||||||
print '<td class="liste_titre" colspan="3"> </td>';
|
print '<td class="liste_titre" colspan="2"> </td>';
|
||||||
print '<td align="right" colspan="4" class="liste_titre">';
|
print '<td align="right" 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 ' ';
|
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")) . '">';
|
||||||
@ -335,7 +318,6 @@ print "<br>\n";
|
|||||||
$compta_prodsell_id = $aarowid_servsell;
|
$compta_prodsell_id = $aarowid_servsell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$compta_prodbuy = $obj->accountancy_code_buy;
|
$compta_prodbuy = $obj->accountancy_code_buy;
|
||||||
|
|
||||||
if ($obj->product_type == 0) {
|
if ($obj->product_type == 0) {
|
||||||
@ -346,7 +328,6 @@ print "<br>\n";
|
|||||||
$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]>";
|
||||||
@ -372,17 +353,16 @@ print "<br>\n";
|
|||||||
|
|
||||||
// acountingaccount buy
|
// acountingaccount buy
|
||||||
|
|
||||||
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||||
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>';
|
||||||
// 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_prodbuy_id, 'codeventil[]', 1);
|
print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
} else {
|
||||||
Else {
|
|
||||||
|
|
||||||
// acountingaccount sel
|
// acountingaccount sel
|
||||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||||
@ -390,29 +370,25 @@ print "<br>\n";
|
|||||||
// 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_'.$product_static->id, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checkbox select
|
// Checkbox select
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $obj->rowid . '"/></td>';
|
print '<input type="checkbox" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br><div align="center"><input type="submit" class="butAction" name="action" value="' . $langs->trans("Change_Account") . '"></div>';
|
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Change_Account") . '"></div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -65,8 +65,10 @@ class AccountingAccount extends CommonObject
|
|||||||
* @param string $account_number Account number
|
* @param string $account_number Account number
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $account_number = null)
|
function fetch($rowid = null, $account_number = null, $limittocurentchart=0)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
if ($rowid || $account_number) {
|
if ($rowid || $account_number) {
|
||||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
||||||
@ -75,7 +77,9 @@ class AccountingAccount extends CommonObject
|
|||||||
} elseif ($account_number) {
|
} elseif ($account_number) {
|
||||||
$sql .= " account_number = '" . $account_number . "'";
|
$sql .= " account_number = '" . $account_number . "'";
|
||||||
}
|
}
|
||||||
|
if (!empty($limittocurentchart)) {
|
||||||
|
$sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')';
|
||||||
|
}
|
||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -101,7 +105,8 @@ class AccountingAccount extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
$this->error="Error " . $this->db->lasterror();
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Ventilation page from customers invoices
|
* \brief Ventilation page from customers invoices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
@ -58,8 +57,9 @@ $search_vat = GETPOST('search_vat','alpha');
|
|||||||
// Getpost Order and column and limit page
|
// Getpost Order and column and limit page
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0)
|
||||||
|
$page = 0;
|
||||||
|
|
||||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||||
@ -70,7 +70,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
|||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
|
if (! $sortfield)
|
||||||
|
$sortfield = "f.datef, f.facnumber, l.rowid";
|
||||||
|
|
||||||
if (! $sortorder) {
|
if (! $sortorder) {
|
||||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||||
@ -91,8 +92,7 @@ $aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
|||||||
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
|
||||||
{
|
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -101,6 +101,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))
|
|||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -163,7 +164,6 @@ if ($action == 'ventil') {
|
|||||||
* Customer Invoice lines
|
* Customer Invoice lines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
|
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod";
|
||||||
$sql .= " , aa.rowid as aarowid";
|
$sql .= " , aa.rowid as aarowid";
|
||||||
@ -177,8 +177,7 @@ $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
|||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||||
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_invoice)))
|
if (strlen(trim($search_invoice))) {
|
||||||
{
|
|
||||||
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
|
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
@ -190,16 +189,13 @@ if (strlen(trim($search_label))) {
|
|||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_amount)))
|
if (strlen(trim($search_amount))) {
|
||||||
{
|
|
||||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_account)))
|
if (strlen(trim($search_account))) {
|
||||||
{
|
|
||||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat)))
|
if (strlen(trim($search_vat))) {
|
||||||
{
|
|
||||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +228,7 @@ if ($result) {
|
|||||||
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);
|
||||||
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
|
||||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||||
@ -244,14 +240,12 @@ if ($result) {
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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="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="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_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"><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="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="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"> </td>';
|
print '<td align="right" class="liste_titre" colspan="4">';
|
||||||
print '<td class="liste_titre"> </td>';
|
|
||||||
print '<td align="right" colspan="2" 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 ' ';
|
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")) . '">';
|
||||||
@ -280,20 +274,21 @@ if ($result) {
|
|||||||
$code_sell_p_notset = 'color:red';
|
$code_sell_p_notset = 'color:red';
|
||||||
if ($objp->type == 1) {
|
if ($objp->type == 1) {
|
||||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
}
|
} elseif ($objp->type == 0) {
|
||||||
elseif ($objp->type == 0) {
|
|
||||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($objp->type_l == 1) {
|
if ($objp->type_l == 1) {
|
||||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
|
if ($objp->aarowid == '')
|
||||||
}
|
$objp->aarowid_suggest = $aarowid_s;
|
||||||
elseif ($objp->type_l == 0) {
|
} elseif ($objp->type_l == 0) {
|
||||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
|
if ($objp->aarowid == '')
|
||||||
|
$objp->aarowid_suggest = $aarowid_p;
|
||||||
}
|
}
|
||||||
if ($objp->code_sell_l <> $objp->code_sell_p) $code_sell_p_l_differ = 'color:red';
|
if ($objp->code_sell_l != $objp->code_sell_p)
|
||||||
|
$code_sell_p_l_differ = 'color:red';
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
@ -318,6 +313,10 @@ if ($result) {
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->total_ht);
|
print price($objp->total_ht);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
|
print '<td style="' . $code_vat_differ . '" align="center">';
|
||||||
|
print price($objp->tva_tx_line);
|
||||||
|
print '</td>';
|
||||||
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
||||||
if ($objp->code_sell_l == $objp->code_sell_p) {
|
if ($objp->code_sell_l == $objp->code_sell_p) {
|
||||||
print $objp->code_sell_l;
|
print $objp->code_sell_l;
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Ventilation page from suppliers invoices
|
* \brief Ventilation page from suppliers invoices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
@ -60,8 +59,8 @@ $sortfield = GETPOST('sortfield','alpha');
|
|||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
|
|
||||||
$page = GETPOST('page');
|
$page = GETPOST('page');
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0)
|
||||||
|
$page = 0;
|
||||||
|
|
||||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||||
@ -72,7 +71,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
|||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
|
if (! $sortfield)
|
||||||
|
$sortfield = "f.datef, f.ref, l.rowid";
|
||||||
if (! $sortorder) {
|
if (! $sortorder) {
|
||||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||||
$sortorder = " DESC ";
|
$sortorder = " DESC ";
|
||||||
@ -170,8 +170,7 @@ if ($action == 'ventil') {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.tva_tx as tva_tx_line, ";
|
||||||
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.tva_tx, ";
|
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod";
|
||||||
$sql .= " , aa.rowid as aarowid";
|
$sql .= " , aa.rowid as aarowid";
|
||||||
$sql .= " , f.datef";
|
$sql .= " , f.datef";
|
||||||
@ -185,8 +184,7 @@ $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
|||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
|
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
|
||||||
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_invoice)))
|
if (strlen(trim($search_invoice))) {
|
||||||
{
|
|
||||||
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
|
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
@ -198,12 +196,10 @@ if (strlen(trim($search_label))) {
|
|||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_amount)))
|
if (strlen(trim($search_amount))) {
|
||||||
{
|
|
||||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_account)))
|
if (strlen(trim($search_account))) {
|
||||||
{
|
|
||||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
@ -245,7 +241,6 @@ if ($result) {
|
|||||||
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_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>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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="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="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||||
@ -288,8 +283,6 @@ if ($result) {
|
|||||||
$code_buy_p_notset = 'color:red';
|
$code_buy_p_notset = 'color:red';
|
||||||
if ($objp->type == 1) {
|
if ($objp->type == 1) {
|
||||||
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($objp->type == 0) {
|
elseif ($objp->type == 0) {
|
||||||
@ -299,14 +292,16 @@ if ($result) {
|
|||||||
|
|
||||||
if ($objp->type_l == 1) {
|
if ($objp->type_l == 1) {
|
||||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
|
if ($objp->aarowid == '')
|
||||||
}
|
$objp->aarowid_suggest = $aarowid_s;
|
||||||
elseif ($objp->type_l == 0) {
|
} elseif ($objp->type_l == 0) {
|
||||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
|
if ($objp->aarowid == '')
|
||||||
|
$objp->aarowid_suggest = $aarowid_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objp->code_buy_l <> $objp->code_buy_p) $code_buy_p_l_differ = 'color:red';
|
if ($objp->code_buy_l != $objp->code_buy_p)
|
||||||
|
$code_buy_p_l_differ = 'color:red';
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
@ -336,7 +331,8 @@ if ($result) {
|
|||||||
print price($objp->price);
|
print price($objp->price);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||||
|
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
print '<td style="' . $code_vat_differ . '" align="center">';
|
print '<td style="' . $code_vat_differ . '" align="center">';
|
||||||
print price($objp->tva_tx_line);
|
print price($objp->tva_tx_line);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user