diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 52e7cfd40b8e0df401ea862c09d870873122823d..6447e1b8663209f19c6f75a33247182ffaf6dc7a 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -158,9 +158,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { llxHeader('', $langs->trans("Ventilation")); // 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, l.product_type as type_l, l.tva_tx as tva_tx_line,"; +$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,"; +$sql .= " l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,"; $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"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -251,11 +252,11 @@ if ($result) { // 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="10" name="search_ref" value="' . $search_ref . '"></td>'; - print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>'; - print '<td class="liste_titre"><input type="text" class="flat" size="10" 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"><input type="text" class="flat" size="6" name="search_invoice" value="' . $search_invoice . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_ref" value="' . $search_ref . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_label" value="' . $search_label . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_desc" value="' . $search_desc . '"></td>'; + print '<td class="liste_titre" align="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>'; print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>'; @@ -278,35 +279,33 @@ if ($result) { $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 { - $code_sell_p_notset = 'color:red'; - if ($objp->type == 1) { - $objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - } elseif ($objp->type == 0) { - $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) { - $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 : ''); if ($objp->aarowid == '') { $objp->aarowid_suggest = $aarowid_s; } } 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 : ''); 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 == -1) $objp->code_sell_l=''; + if (! empty($objp->code_sell)) { + $objp->code_sell_p = $objp->code_sell; // Code on product + } else { + $code_sell_p_notset = 'color:orange'; + } + if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red'; + + // $objp->code_sell_p is now code of product/service + // $objp->code_sell_l is now default code of product/service + print '<tr '. $bc[$var].'>'; // Ref Invoice @@ -327,9 +326,9 @@ if ($result) { print '</td>'; - print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>'; + print '<td>' . 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>'; + print '<td>' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>'; print '<td align="right">'; print price($objp->total_ht); @@ -344,13 +343,11 @@ if ($result) { // Accounting account suggested print '<td align="center" style="' . $code_sell_p_notset . '">'; - if ($objp->code_sell_l == $objp->code_sell_p) { // Test if there is a difference between code by default and code on product - if ($objp->code_sell_l > 0) print $objp->code_sell_l; - else print $langs->trans("Unknown"); - } else { - print $langs->trans("Default") . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); - print '<br>'; - print $langs->trans("Product") . ' = ' . ($objp->code_sell_p > 0 ? length_accountg($objp->code_sell_p) : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); + if ($objp->product_id > 0) + { + print '<br>'; + print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_sell_p) ? $langs->trans("Unknown") : length_accountg($objp->code_sell_p)); } print '</td>'; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 804097c6d33bc4837c41f2b6420a171be298c73e..86d7fdae9c9b7a2c4aefcd4911c32ea01fc87c5a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -164,9 +164,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { llxHeader('', $langs->trans("SuppliersVentilation")); // Supplier Invoice Lines -$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; -$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 = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef,"; +$sql .= " l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; +$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 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; @@ -256,10 +257,10 @@ if ($result) { print "</tr>\n"; 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_ref" value="' . $search_ref . '"></td>'; - print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>'; - print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_desc" value="' . $search_desc . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_invoice" value="' . $search_invoice . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_ref" value="' . $search_ref . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_label" value="' . $search_label . '"></td>'; + print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>'; print '<td class="liste_titre"></td>'; @@ -286,37 +287,31 @@ if ($result) { $objp->code_buy_l = ''; $objp->code_buy_p = ''; $objp->aarowid_suggest = ''; - $code_buy_p_l_differ = ''; $code_buy_p_notset = ''; - $objp->aarowid_suggest = $objp->aarowid; - if (! empty($objp->code_buy)) { - $objp->code_buy_p = $objp->code_buy; - } else { - $code_buy_p_notset = 'color:red'; - if ($objp->type == 1) { - $objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - } - - elseif ($objp->type == 0) { - $objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - } - } 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 : ''); if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s; } 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 : ''); 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 == -1) $objp->code_buy_l=''; + if (! empty($objp->code_buy)) { + $objp->code_buy_p = $objp->code_buy; + } else { + $code_buy_p_notset = 'color:orange'; + } + if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red'; + + // $objp->code_buy_p is now code of product/service + // $objp->code_buy_l is now default code of product/service + print '<tr '. $bc[$var].'>'; // Ref Invoice @@ -335,11 +330,11 @@ if ($result) { print ' '; print '</td>'; - print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>'; + print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; // TODO: we should set a user defined value to adjust user square / wide screen size $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; - print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>'; + print '<td>' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>'; print '<td align="right">'; print price($objp->price); @@ -354,13 +349,11 @@ if ($result) { // Accounting account suggested print '<td align="center" style="' . $code_buy_p_notset . '">'; - if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product - if ($objp->code_buy_l > 0) print $objp->code_buy_l; - else print $langs->trans("Unknown"); - } else { - print $langs->trans("Default") . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); + if ($objp->product_id > 0) + { print '<br>'; - print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? length_accountg($objp->code_buy_p) : $langs->trans("Unknown")); + print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_buy_p) ? $langs->trans("Unknown") : length_accountg($objp->code_buy_p)); } print '</td>'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1619884c36f160f5ce26440f3f6a8bdf8f710e9c..cae29217cdbc481875baf7a54375034e78a22eb8 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -8,7 +8,11 @@ ACCOUNTING_EXPORT_AMOUNT=Export amount ACCOUNTING_EXPORT_DEVISE=Export currency Selectformat=Select the format for the file ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name - +ThisService=This service +ThisProduct=This product +DefaultForService=Default for service +DefaultForProduct=Default for product +CantSuggest=Can't suggest AccountancySetupDoneFromAccountancyMenu=Most setup of the accountancy is done from the menu %s ConfigAccountingExpert=Configuration of the module accounting expert Journalization=Journalization @@ -49,7 +53,7 @@ ChangeAndLoad=Change and load Addanaccount=Add an accounting account AccountAccounting=Accounting account AccountAccountingShort=Account -AccountAccountingSuggest=Accounting account suggest +AccountAccountingSuggest=Accounting account suggested MenuDefaultAccounts=Default accounts MenuVatAccounts=Vat accounts MenuTaxAccounts=Tax accounts