if ($action == 'ventil' && !empty($btn_ventil)) { print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; if (!empty($codeventil) && !empty($mesCasesCochees)) { print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; $mesCodesVentilChoisis = $codeventil; $cpt = 0; foreach ($mesCasesCochees as $maLigneCochee) { $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " WHERE rowid = " . $monId; $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, ''); dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>'; } else { print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>'; } $cpt++; } } else { print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; } print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; } /* * Customer Invoice lines
} $cpt++; } } else { $msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; } $msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; } } $form = new FormVentilation($db); // Defaut AccountingAccount RowId Product / Service // at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid // so we need to get those default value rowid first $accounting = new AccountingAccount($db); // TODO: we should need to check if result is a really exist accountaccount rowid..... $aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1); $aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1); $aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); $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_prodbuy = !empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"); $aacompta_servsell = !empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); $aacompta_prodsell = !empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_ref = ''; $search_label = ''; $search_desc = ''; } /* * View
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">'; print '</div>'; print '</form>'; } else { $linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>'; dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); print '<table class="border" width="100%">'; // Account number print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; print '<td>' . $accounting->account_number . '</td>'; print '<td align="right" width="25%">' . $linkback . '</td></tr>'; print '<tr><td>' . $langs->trans("Label") . '</td>'; print '<td colspan="2">' . $accounting->label . '</td></tr>'; $accp = new AccountingAccount($db); if (!empty($accounting->account_parent)) { $accp->fetch($accounting->account_parent, ''); } print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<td colspan="2">' . $accp->account_number . ' - ' . $accp->label . '</td></tr>'; print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<td colspan="2">' . $accounting->pcg_type . '</td></tr>'; print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>'; print '<tr><td>' . $langs->trans("Activated") . '</td>'; print '<td colspan="2">'; if (empty($accounting->active)) { print img_picto($langs->trans("Disabled"), 'switch_off'); } else { print img_picto($langs->trans("Activated"), 'switch_on'); } print '</td></tr>';
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; print "<td>" . length_accounta($k); print "</td><td>" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td>"; } print "</tr>"; // Product / Service foreach ($tabht[$key] as $k => $mt) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k); if ($mt) { print "<tr " . $bc[$var] . ">"; print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>" . length_accountg($k) . "</td>"; print "<td>" . $accountingaccount->label . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(-$mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "</tr>"; } } // VAT foreach ($tabtva[$key] as $k => $mt) { if ($mt) { print "<tr " . $bc[$var] . ">";
} if (!$sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { $sortorder = " DESC "; } } // Security check if ($user->societe_id > 0) { accessforbidden(); } if (!$user->rights->accounting->ventilation->dispatch) { accessforbidden(); } $formventilation = new FormVentilation($db); $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1); // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_ref = ''; $search_invoice = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; $search_account = ''; $search_vat = ''; } /* * View */ llxHeader('', $langs->trans("Ventilation"));
$offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortfield) { $sortfield = "aa.account_number"; } if (!$sortorder) { $sortorder = "ASC"; } if ($action == 'delete') { $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1); print $formconfirm; } $accounting = new AccountingAccount($db); if ($action == 'disable') { if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } $action = 'update'; if ($result < 0) { setEventMessage($accounting->error, 'errors'); } } else { if ($action == 'enable') { if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; if ($result < 0) { setEventMessage($accounting->error, 'errors'); }
} if (!$sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { $sortorder = " DESC "; } } // Security check if ($user->societe_id > 0) { accessforbidden(); } if (!$user->rights->accounting->ventilation->dispatch) { accessforbidden(); } $formventilation = new FormVentilation($db); $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT); $aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT); // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_ref = ''; $search_invoice = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; $search_account = ''; $search_vat = ''; } /* * View */ llxHeader('', $langs->trans("Ventilation"));