Finishing works
This commit is contained in:
parent
8800bf8b25
commit
029fa1ed8a
@ -81,7 +81,7 @@ $formventilation = new FormVentilation($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_expensereport = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -122,7 +122,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -231,7 +231,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
|
|||||||
@ -21,15 +21,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/list.php
|
* \file htdocs/accountancy/expensereport/list.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Ventilation page from suppliers invoices
|
* \brief Ventilation page from expense reports
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
@ -38,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
$langs->load("trips");
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
@ -47,8 +47,7 @@ $action = GETPOST('action');
|
|||||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||||
|
|
||||||
// Search Getpost
|
// Search Getpost
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
$search_expensereport = GETPOST('search_expensereport', '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');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
@ -66,7 +65,7 @@ $offset = $limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield)
|
if (! $sortfield)
|
||||||
$sortfield = "f.datef, f.ref, l.rowid";
|
$sortfield = "er.date_create, er.ref, erd.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";
|
||||||
@ -86,11 +85,6 @@ $formventilation = 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.....
|
|
||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
@ -98,7 +92,7 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
|||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
@ -130,17 +124,17 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||||
$sql .= " WHERE rowid = " . $monId;
|
$sql .= " WHERE rowid = " . $monId;
|
||||||
|
|
||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '');
|
$accountventilated->fetch($monCompte, '');
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
|
dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$ok++;
|
$ok++;
|
||||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
$msg.= '<div><font color="green">' . $langs->trans("LineOfExpenseReport") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||||
} else {
|
} else {
|
||||||
$ko++;
|
$ko++;
|
||||||
$msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
$msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||||
@ -161,43 +155,39 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
// Supplier Invoice Lines
|
// Expense report 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 = "SELECT er.ref, er.rowid as erid, er.date_debut, erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.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 .= " f.id as fees_id, f.label as fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " , aa.rowid as aarowid";
|
$sql .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
|
$sql .= " AND (er.ref like '%" . $search_expensereport . "%')";
|
||||||
}
|
|
||||||
if (strlen(trim($search_ref))) {
|
|
||||||
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
|
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= " AND (p.label like '%" . $search_label . "%')";
|
$sql .= " AND (f.label like '%" . $search_label . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
$sql .= " AND (erd.comments like '%" . $search_desc . "%')";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_amount))) {
|
if (strlen(trim($search_amount))) {
|
||||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
$sql .= " AND erd.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 (erd.tva_tx like '" . $search_vat . "%')";
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
@ -211,7 +201,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/list.php');
|
dol_syslog('accountancy/expensereport/list.php');
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
@ -231,33 +221,31 @@ if ($result) {
|
|||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
|
||||||
$center='<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
$center='<div class="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit);
|
print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit);
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.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("TypeFees"), $_SERVER["PHP_SELF"], "f.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"], "erd.comments", "", $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"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
print_liste_field_titre('', '', '', '', '', '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_expensereport" value="' . $search_expensereport . '"></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_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="10" 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="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||||
@ -266,13 +254,12 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td align="right" class="liste_titre">';
|
print '<td align="right" class="liste_titre">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(1);
|
$searchpicto=$form->showFilterAndCheckAddButtons(1);
|
||||||
print $searchpitco;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$facturefourn_static = new FactureFournisseur($db);
|
$expensereport_static = new ExpenseReport($db);
|
||||||
$productfourn_static = new ProductFournisseur($db);
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$var = True;
|
$var = True;
|
||||||
@ -280,88 +267,38 @@ if ($result) {
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
// product_type: 0 = service ? 1 = product
|
|
||||||
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
|
|
||||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
|
||||||
$objp->code_buy_l = '';
|
|
||||||
$objp->code_buy_p = '';
|
|
||||||
$objp->aarowid_suggest = '';
|
$objp->aarowid_suggest = '';
|
||||||
$code_buy_p_l_differ = '';
|
|
||||||
|
|
||||||
$code_buy_p_notset = '';
|
|
||||||
|
|
||||||
$objp->aarowid_suggest = $objp->aarowid;
|
$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"));
|
|
||||||
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"));
|
|
||||||
if ($objp->aarowid == '')
|
|
||||||
$objp->aarowid_suggest = $aarowid_p;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($objp->code_buy_l != $objp->code_buy_p)
|
|
||||||
$code_buy_p_l_differ = 'color:red';
|
|
||||||
|
|
||||||
print '<tr '. $bc[$var].'>';
|
print '<tr '. $bc[$var].'>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Expense report
|
||||||
$facturefourn_static->ref = $objp->ref;
|
$expensereport_static->ref = $objp->ref;
|
||||||
$facturefourn_static->id = $objp->facid;
|
$expensereport_static->id = $objp->erid;
|
||||||
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
|
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
// Ref Supplier Invoice
|
// Fees label
|
||||||
$productfourn_static->ref = $objp->product_ref;
|
|
||||||
$productfourn_static->id = $objp->product_id;
|
|
||||||
$productfourn_static->type = $objp->type;
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($productfourn_static->id)
|
print dol_trunc($objp->fees_label, 24);
|
||||||
print $productfourn_static->getNomUrl(1);
|
|
||||||
else
|
|
||||||
print ' ';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
|
// Fees description -- Can be null
|
||||||
|
|
||||||
// TODO: we should set a user defined value to adjust user square / wide screen size
|
// TODO: we should set a user defined value to adjust user square / wide screen size
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$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->comments, $trunclength)) . '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->price);
|
print price($objp->price);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
print '<td align="right">';
|
||||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
|
||||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
|
||||||
print price($objp->tva_tx_line);
|
print price($objp->tva_tx_line);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Accounting account suggested
|
// Accounting account suggested
|
||||||
print '<td align="center" style="' . $code_buy_p_notset . '">';
|
print '<td align="center">';
|
||||||
if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product
|
print length_accountg(html_entity_decode($objp->code_buy));
|
||||||
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 ? $objp->code_buy_l : $langs->trans("Unknown"));
|
|
||||||
print '<br>';
|
|
||||||
print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? $objp->code_buy_p : $langs->trans("Unknown"));
|
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Colonne choix du compte
|
// Colonne choix du compte
|
||||||
|
|||||||
@ -178,9 +178,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,14 +420,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("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[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
@ -474,16 +474,16 @@ if (empty($action) || $action == 'view') {
|
|||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $expensereportstatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -498,14 +498,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $expensereportstatic->ref . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -527,8 +527,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $expensereportstatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ CAHTF=Total purchase supplier before tax
|
|||||||
TotalExpenseReport=Total expense report
|
TotalExpenseReport=Total expense report
|
||||||
InvoiceLines=Lines of invoices to bind
|
InvoiceLines=Lines of invoices to bind
|
||||||
InvoiceLinesDone=Bound lines of invoices
|
InvoiceLinesDone=Bound lines of invoices
|
||||||
|
ExpenseReportLines=Lines of expense reports to bind
|
||||||
ExpenseReportLinesDone=Bound lines of expense reports
|
ExpenseReportLinesDone=Bound lines of expense reports
|
||||||
IntoAccount=Bind line with the accounting account
|
IntoAccount=Bind line with the accounting account
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ Processing=Processing
|
|||||||
EndProcessing=Process terminated.
|
EndProcessing=Process terminated.
|
||||||
SelectedLines=Selected lines
|
SelectedLines=Selected lines
|
||||||
Lineofinvoice=Line of invoice
|
Lineofinvoice=Line of invoice
|
||||||
|
LineOfExpenseReport=Line of expense report
|
||||||
NoAccountSelected=No accounting account selected
|
NoAccountSelected=No accounting account selected
|
||||||
VentilatedinAccount=Binded successfully to the accounting account
|
VentilatedinAccount=Binded successfully to the accounting account
|
||||||
NotVentilatedinAccount=Not bound to the accounting account
|
NotVentilatedinAccount=Not bound to the accounting account
|
||||||
@ -160,6 +162,7 @@ ChangeAccount=Change the product/service accounting account for selected lines w
|
|||||||
Vide=-
|
Vide=-
|
||||||
DescVentilSupplier=Consult here the list of supplier invoice lines bound or not yet bound to a product accounting account
|
DescVentilSupplier=Consult here the list of supplier invoice lines bound or not yet bound to a product accounting account
|
||||||
DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account
|
DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account
|
||||||
|
DescVentilTodoExpenseReport=Bind expense report lines not already bound with a fee accounting account
|
||||||
DescVentilExpenseReport=Consult here the list of expense report lines bound (or not) to a fee accounting account
|
DescVentilExpenseReport=Consult here the list of expense report lines bound (or not) to a fee accounting account
|
||||||
DescVentilExpenseReportMore=In most cases, if you use configured fees, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button <strong>"%s"</strong>. If account was not set on fees dictionary or if you still has some lines not bound to any account, you will have to make a manual binding from the menu "<strong>%s</strong>".
|
DescVentilExpenseReportMore=In most cases, if you use configured fees, the application will be able to make all the binding between your expense report lines and the accounting account of your chart of accounts, just in one click with the button <strong>"%s"</strong>. If account was not set on fees dictionary or if you still has some lines not bound to any account, you will have to make a manual binding from the menu "<strong>%s</strong>".
|
||||||
DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account
|
DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user