Patch Accounting Expert Module

This commit is contained in:
aspangaro 2014-09-06 09:50:42 +02:00
parent ec47bc05b5
commit f9dc25cf3f
18 changed files with 93 additions and 78 deletions

View File

@ -47,31 +47,33 @@ $accounting = new AccountingAccount($db);
// Action
if ($action == 'add')
{
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
$res = $accounting->create($user);
if ($res == 0) {
} else {
if ($res == - 3) {
$_error = 1;
$action = "create";
}
if ($res == - 4) {
$_error = 2;
$action = "create";
if (! GETPOST('cancel', 'alpha')) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
$res = $accounting->create($user);
if ($res == 0) {
} else {
if ($res == - 3) {
$_error = 1;
$action = "create";
}
if ($res == - 4) {
$_error = 2;
$action = "create";
}
}
}
Header("Location: account.php");

View File

@ -61,7 +61,7 @@ if ($_POST["action"] == 'import') {
$accounting = new AccountingAccount($db);
$monLabel = GETPOST('intitule' . $maLigneCochee);
$monLabel = GETPOST('label' . $maLigneCochee);
$monParentAccount = GETPOST('AccountParent' . $maLigneCochee);
$monType = GETPOST('pcgType' . $maLigneCochee);
$monSubType = GETPOST('pcgSubType' . $maLigneCochee);
@ -146,7 +146,7 @@ if ($result) {
print '</td>';
print '<td align="left">';
print '<input name="intitule" size="30" value="">';
print '<input name="label" size="30" value="">';
print '</td>';
// Colonne choix du compte
@ -164,7 +164,7 @@ if ($result) {
// Colonne choix ligne a ventiler
$checked = ('intitule' == 'O') ? ' checked=checked' : '';
$checked = ('label' == 'O') ? ' checked=checked' : '';
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>';

View File

@ -76,7 +76,7 @@ $y = $year_current;
$var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width=150>' . $langs->trans("Intitule") . '</td><td align="center">' . $langs->trans("JanuaryMin") . '</td><td align="center">' . $langs->trans("FebruaryMin") . '</td><td align="center">' . $langs->trans("MarchMin") . '</td><td align="center">' . $langs->trans("AprilMin") . '</td><td align="center">' . $langs->trans("MayMin") . '</td><td align="center">' . $langs->trans("JuneMin") . '</td><td align="center">' . $langs->trans("JulyMin") . '</td><td align="center">' . $langs->trans("AugustMin") . '</td><td align="center">' . $langs->trans("SeptemberMin") . '</td><td align="center">' . $langs->trans("OctoberMin") . '</td><td align="center">' . $langs->trans("NovemberMin") . '</td><td align="center">' . $langs->trans("DecemberMin") . '</td><td align="center"><b>Total</b></td></tr>';
print '<tr class="liste_titre"><td width=150>' . $langs->trans("Label") . '</td><td align="center">' . $langs->trans("JanuaryMin") . '</td><td align="center">' . $langs->trans("FebruaryMin") . '</td><td align="center">' . $langs->trans("MarchMin") . '</td><td align="center">' . $langs->trans("AprilMin") . '</td><td align="center">' . $langs->trans("MayMin") . '</td><td align="center">' . $langs->trans("JuneMin") . '</td><td align="center">' . $langs->trans("JulyMin") . '</td><td align="center">' . $langs->trans("AugustMin") . '</td><td align="center">' . $langs->trans("SeptemberMin") . '</td><td align="center">' . $langs->trans("OctoberMin") . '</td><td align="center">' . $langs->trans("NovemberMin") . '</td><td align="center">' . $langs->trans("DecemberMin") . '</td><td align="center"><b>Total</b></td></tr>';
$sql = "SELECT bk.numero_compte AS 'compte',";
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',";

View File

@ -26,7 +26,7 @@
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("accounting");

View File

@ -91,9 +91,9 @@ else if ($action == 'export_csv') {
else {
llxHeader('', $langs->trans("Accounting") . ' - ' . $langs->trans("Bookkeeping"));
llxHeader('', $langs->trans("Bookkeeping"));
/*
/*
* List
*/

View File

@ -57,8 +57,8 @@ class AccountancySystem
$now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " (date_creation, fk_user_author, numero,intitule)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->intitule . "')";
$sql .= " (date_creation, fk_user_author, numero, label)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -47,16 +47,23 @@ if (! $user->rights->accounting->access)
* Actions
*/
if ($action == 'ventil' && $user->rights->accounting->access) {
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id;
if ($action == 'ventil' && $user->rights->accounting->access)
{
if (! GETPOST('cancel', 'alpha'))
{
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id;
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql) {
setEventMessage($db->lasterror(), 'errors');
}
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql) {
setEventMessage($db->lasterror(), 'errors');
}
} else {
header("Location: ./lines.php");
exit();
}
}
llxHeader("", "", "FicheVentilation");
@ -101,7 +108,8 @@ if (! empty($id)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">';
print_fiche_titre($langs->trans("Ventilation"));
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup');
print '<table class="border" width="100%">';
@ -119,9 +127,11 @@ if (! empty($id)) {
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
print '</td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="' . $langs->trans("Update") . '"></td></tr>';
print '</table>';
print '<br><center><input class="button" type="submit" value="' . $langs->trans("Save") . '"> &nbsp; &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></center';
print '</form>';
} else {
print "Error";

View File

@ -28,6 +28,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
@ -118,7 +119,7 @@ $var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Intitule") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
@ -169,7 +170,7 @@ if ($resql) {
while ( $i < $num ) {
$row = $db->fetch_row($resql);
print '<tr><td>' . $row[0] . '</td>';
print '<tr><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -27,9 +27,9 @@
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
// Langs
$langs->load("compta");

View File

@ -264,7 +264,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $compte->intitule;
$bookkeeping->label_compte = $compte->label;
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);

View File

@ -244,7 +244,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $compte->intitule;
$bookkeeping->label_compte = $compte->label;
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);

View File

@ -34,7 +34,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';

View File

@ -27,6 +27,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
@ -93,7 +94,7 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
$textprevyear = "<a href=\"index.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>";
$textnextyear = " <a href=\"index.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>";
print_fiche_titre($langs->trans("VentilationComptableSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print_fiche_titre($langs->trans("AccountingVentilationSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>';
@ -104,7 +105,7 @@ $var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td align="left">' . $langs->trans("Account") . '</td>';
print '<td align="left">' . $langs->trans("Intitule") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
print '<td align="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td align="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td align="center">' . $langs->trans("MarchMin") . '</td>';
@ -157,7 +158,7 @@ if ($resql) {
$row = $db->fetch_row($resql);
print '<tr><td>' . $row[0] . '</td>';
print '<tr><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -868,13 +868,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read);
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
$newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier');
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read);
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
if (! empty($conf->fournisseur->enabled))
{
$newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier');
if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read);
if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
}
$newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookeeping');
if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire);
if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire);
$newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping');
if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire);
if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire);
}
// Rapports

View File

@ -35,5 +35,5 @@ CREATE TABLE llx_accounting_bookkeeping
fk_user_author integer NOT NULL,
import_key varchar(14),
code_journal varchar(10) DEFAULT NULL,
piece_num integer NOT NULL
piece_num integer NOT NULL
) ENGINE=innodb;

View File

@ -20,6 +20,7 @@ Selectmodelcsv=Select a model of export
Modelcsv_normal=Classic export
Modelcsv_CEGID=Export towards CEGID Expert
BackToChartofaccounts=Return chart of accounts
Back=Return
Definechartofaccounts=Define a chart of accounts
Selectchartofaccounts=Select a chart of accounts
@ -46,9 +47,9 @@ WriteBookKeeping=Record accounts in general ledger
Bookkeeping=General ledger
AccountBalanceByMonth=Account balance by month
VentilationComptable=Accounting ventilation
VentilationComptableSupplier=Accounting ventilation supplier
Intitule=Label
AccountingVentilation=Accounting ventilation
AccountingVentilationSupplier=Accounting ventilation supplier
AccountingVentilationCustomer=Accounting ventilation customer
Line=Line
CAHTF=Total purchase supplier HT

View File

@ -22,6 +22,7 @@ Selectmodelcsv=Seleccione una plantilla de exportación
Modelcsv_normal=Exportación clásica
Modelcsv_CEGID=Exportar a Cegid Expert
BackToChartofaccounts=Volver al plan contable
Back=Volver
Definechartofaccounts=Definir la contabilidad
Selectchartofaccounts=Seleccione un plan contable
@ -49,14 +50,9 @@ WriteBookKeeping=Registrar los asientos en el libro mayor
Bookkeeping=libro mayor
AccountBalanceByMonth=Saldo Mensual
VentilationComptable=desglose de Contabilidad
VentilationComptableSupplier=Proveedor de cuentas de ventilación
Intitule=título
Line=línea
VentilationComptable=desglose de Contabilidad
VentilationComptableSupplier=Contabilización compras
Intitule=título
AccountingVentilation=desglose de Contabilidad
AccountingVentilationSupplier=Proveedor de cuentas de ventilación
AccountingVentilationCustomer=Cliente de cuentas de ventilación
Line=línea
Ventilate=contabilizar

View File

@ -20,6 +20,7 @@ Selectmodelcsv=Sélectionnez un modèle d'export
Modelcsv_normal=Export classique
Modelcsv_CEGID=Export vers CEGID Expert
BackToChartofaccounts=Retour plan comptable
Back=Retour
Definechartofaccounts=Définir un plan comptable
Selectchartofaccounts=Sélectionnez un plan comptable
@ -46,9 +47,9 @@ WriteBookKeeping=Comptabiliser les écritures dans le grand livre
Bookkeeping=Grand livre
AccountBalanceByMonth=Balance mensuelle
VentilationComptable=Ventilation comptable
VentilationComptableSupplier=Ventilation comptable fournisseur
Intitule=Intitulé
AccountingVentilation=Ventilation comptable
AccountingVentilationSupplier=Ventilation comptable fournisseur
AccountingVentilationCustomer=Ventilation comptable client
Line=Ligne
CAHTF=Total achat fournisseur HT