Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Rui Strecht 2017-09-05 10:08:16 +01:00
commit 75ce9742e4
27 changed files with 293 additions and 246 deletions

View File

@ -1,16 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,7 +42,7 @@ $langs->load("hrm");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$id=32;
$rowid=GETPOST('rowid','alpha');
$code=GETPOST('code','alpha');
@ -108,11 +98,11 @@ $tabsqlsort[32]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[32]= "code,label,range_account,category_type,formula,position,country_id,country";
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country";
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -168,7 +158,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
foreach ($listfield as $f => $value)
{
if ($value == 'formula' && empty($_POST['formula'])) continue;
if (! isset($_POST[$value]) || $_POST[$value]=='')
if ($value == 'country') continue; // country_id required but not country
if (! isset($_POST[$value]) || $_POST[$value]=='')
{
$ok=0;
$fieldnamekey=$listfield[$f];
@ -183,11 +174,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
$ok=0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"]))
{
if ($_POST["code"]=='0')
@ -201,17 +187,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/
}
if (isset($_POST["country"]) && ($_POST["country"]=='0'))
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
{
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{
$_POST["country"]='';
}
else
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
// Clean some parameters
@ -253,14 +232,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0;
foreach ($listfieldinsert as $f => $value)
{
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
}
else if ($value == 'entity') {
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
@ -301,8 +277,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0;
foreach ($listfieldmodify as $field)
{
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
if ($field == 'fk_country' && $_POST['country'] > 0) {
$_POST[$listfieldvalue[$i]] = $_POST['country'];
}
else if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
@ -531,12 +507,10 @@ if ($id)
{
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field]=='country') {
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
@ -735,6 +709,7 @@ if ($id)
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td>';
}
else
{
@ -844,8 +819,8 @@ if ($id)
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
}
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
$i++;
}
}
@ -891,16 +866,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
{
if ($fieldlist[$field] == 'country')
{
if (in_array('region_id',$fieldlist))
{
print '<td>';
//print join(',',$fieldlist);
print '</td>';
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '<td>';
$fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
if ($context == 'add')
{
$fieldname='country_id';
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
else
{
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id')

View File

@ -338,7 +338,7 @@ class AccountancyCategory
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start
* @param string $date_end Date end
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @return integer Result in table
*/
public function getResult($cpt, $month, $date_start, $date_end, $sens)
@ -488,13 +488,19 @@ class AccountancyCategory
// calcule
/* I try to replace this with dol_eval()
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10;
public function calculate($input){
public function calculate($input)
{
global $langs;
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
$input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
@ -536,6 +542,8 @@ class AccountancyCategory
return 0;
}
*/
/**
* get cpts of category

View File

@ -724,7 +724,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$builddate = time();
$builddate=dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';

View File

@ -498,7 +498,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));

View File

@ -514,7 +514,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded");

View File

@ -535,7 +535,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$description .= $langs->trans("DepositsAreNotIncluded");

View File

@ -85,16 +85,15 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
}
$name=$langs->trans("PurchasesJournal");
$namelink='';
$periodlink='';
$exportlink='';
$builddate=time();
$builddate=dol_now();
$description=$langs->trans("DescPurchasesJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];

View File

@ -89,15 +89,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
}
$nom=$langs->trans("SellsJournal");
$namelink='';
$periodlink='';
$exportlink='';
$builddate=time();
$builddate=dol_now();
$description=$langs->trans("DescSellsJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];

View File

@ -115,7 +115,7 @@ if ($calc==0 || $calc==1) // Calculate on invoice for goods and services
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch;
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$builddate=time();
$builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description");
@ -133,7 +133,7 @@ if ($calc==2) // Invoice for goods, payment for services
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch;
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$builddate=time();
$builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description");
@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);

View File

@ -136,7 +136,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService");
@ -164,7 +164,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
else $description.=' '.$langs->trans("DepositsAreIncluded");
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService");
@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
$vatsup=$langs->trans("VATPaid");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
if($local==1){

View File

@ -34,15 +34,17 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$date_startmonth=GETPOST('date_startmonth','int');
$date_startday=GETPOST('date_startday','int');
$date_startyear=GETPOST('date_startyear','int');
$date_endmonth=GETPOST('date_endmonth','int');
$date_endday=GETPOST('date_endday','int');
$date_endyear=GETPOST('date_endyear','int');
$showaccountdetail = GETPOST('showaccountdetail','aZ09');
// Security check
$socid = GETPOST('socid','int');
@ -118,16 +120,33 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta",'alpha')) $modecompta=GETPOST("modecompta",'alpha');
$AccCat = new AccountancyCategory($db);
/*
* View
*/
$months = array(
$langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
llxHeader();
$form=new Form($db);
$namelink='';
$periodlink='';
$exportlink='';
@ -146,7 +165,7 @@ if ($modecompta=="CREANCES-DETTES")
$description=$langs->trans("RulesResultDue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
elseif ($modecompta=="RECETTES-DEPENSES")
@ -159,7 +178,7 @@ elseif ($modecompta=="RECETTES-DEPENSES")
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesResultInOut");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
elseif ($modecompta=="BOOKKEEPING")
@ -170,15 +189,17 @@ elseif ($modecompta=="BOOKKEEPING")
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$period.=' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesResultBookkeepingPredefined", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts"));
$builddate=time();
$description=$langs->trans("RulesResultBookkeepingPredefined");
$description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')';
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
$hselected = 'report';
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
@ -196,8 +217,8 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 's.nom, s.rowid','',$param,'',$sortfield,$sortorder,'width200 ');
print_liste_field_titre('');
print_liste_field_titre("Groups", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
if ($modecompta == 'BOOKKEEPING')
{
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder);
@ -220,7 +241,12 @@ if ($modecompta == 'BOOKKEEPING')
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f";
$sql.= ", ".MAIN_DB_PREFIX."accounting_account as aa";
$sql.= " WHERE f.numero_compte = aa.account_number";
$sql.= " AND pcg_type in ('EXPENSE','INCOME')";
//$sql.= " AND fk_statut in (1,2)";
$sql.= " AND (";
$sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
$sql.= " OR ";
$sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
$sql.= ")";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY name, socid, pcg_type, pcg_subtype";
@ -254,6 +280,39 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht += (isset($objp->amount)?$objp->amount:0);
$total_ttc += (isset($objp->amount)?$objp->amount:0);
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail == 'yes')
{
// TODO Get list of account for this group/subgroup
$cpts = array();
foreach($cpts as $i => $cpt)
{
print '<tr>';
print '<td> &nbsp; &nbsp; ' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
print '<td align="right">' . price($resultM) . '</td>';
}
print "</tr>\n";
}
}
$i++;
}
}

View File

@ -32,12 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$date_startmonth=GETPOST('date_startmonth','int');
$date_startday=GETPOST('date_startday','int');
$date_startyear=GETPOST('date_startyear','int');
$date_endmonth=GETPOST('date_endmonth','int');
$date_endday=GETPOST('date_endday','int');
$date_endyear=GETPOST('date_endyear','int');
$nbofyear=4;
@ -113,7 +113,6 @@ llxHeader();
$form=new Form($db);
$namelink='';
$exportlink='';
// Affiche en-tete du rapport
@ -129,7 +128,7 @@ if ($modecompta == 'CREANCES-DETTES')
$description.='<br>'.$langs->trans("RulesResultDue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.="<br>".$langs->trans("DepositsAreNotIncluded");
else $description.="<br>".$langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="RECETTES-DEPENSES") {
@ -141,7 +140,7 @@ else if ($modecompta=="RECETTES-DEPENSES") {
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesAmountWithTaxIncluded");
$description.='<br>'.$langs->trans("RulesResultInOut");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="BOOKKEEPING")
@ -152,14 +151,15 @@ else if ($modecompta=="BOOKKEEPING")
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesAmountOnInOutBookkeepingRecord", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory"));
$builddate=time();
$description=$langs->trans("RulesAmountOnInOutBookkeepingRecord");
$description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')';
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
$hselected='report';
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
@ -805,7 +805,7 @@ elseif ($modecompta == 'BOOKKEEPING') {
/*
* Donation get dunning paiement
* Request in mode BOOKKEEPING
*/
if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
@ -817,7 +817,11 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa";
$sql.= " WHERE b.numero_compte = aa.account_number AND b.entity = ".$conf->entity;
//$sql.= " AND fk_statut in (1,2)";
$sql.= " AND pcg_type in ('INCOME', 'EXPENSE')";
$sql.= " AND (";
$sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
$sql.= " OR ";
$sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
$sql.= ")";
//$sql.= " AND code_journal in ('VT', 'AC')";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'";
@ -825,7 +829,7 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
//print $sql;
dol_syslog("get donation payments");
dol_syslog("get bookkeeping record");
$result=$db->query($sql);
if ($result)
{

View File

@ -26,10 +26,10 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.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.'/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$langs->loadLangs(array('compta','bills','donation','salaries','accountancy'));
$error = 0;
@ -39,16 +39,16 @@ $cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
$cancel = GETPOST('cancel','alpha');
$showaccountdetail = GETPOST('showaccountdetail','aZ09');
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$date_startmonth=GETPOST('date_startmonth','int');
$date_startday=GETPOST('date_startday','int');
$date_startyear=GETPOST('date_startyear','int');
$date_endmonth=GETPOST('date_endmonth','int');
$date_endday=GETPOST('date_endday','int');
$date_endyear=GETPOST('date_endyear','int');
$nbofyear=1;
@ -136,6 +136,21 @@ $AccCat = new AccountancyCategory($db);
* View
*/
$months = array(
$langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
@ -158,7 +173,7 @@ if ($modecompta=="CREANCES-DETTES")
$description=$langs->trans("RulesResultDue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="RECETTES-DEPENSES") {
@ -170,7 +185,7 @@ else if ($modecompta=="RECETTES-DEPENSES") {
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesResultInOut");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="BOOKKEEPING")
@ -179,18 +194,18 @@ else if ($modecompta=="BOOKKEEPING")
$calcmode=$langs->trans("CalcModeBookkeeping");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$nomlink = '';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$period.=' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '. $form->selectyesno('simple_report',$simple_report,0);
$period.=' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0);
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
$exportlink = '';
$description=$langs->trans("RulesResultBookkeepingPersonalized", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory"));
$description=$langs->trans("RulesResultBookkeepingPersonalized").
$description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")).')';
//if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
//else $description.= $langs->trans("DepositsAreIncluded");
$builddate = time();
$builddate=dol_now();
}
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
@ -204,27 +219,13 @@ $moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("AccountingCategory").'</th>';
print '<th class="liste_titre"></th>';
print '<th class="liste_titre" align="right">'.$langs->trans("PreviousYear").'</th>';
print '<th class="liste_titre" align="right">'.$langs->trans("PreviousPeriod").'</th>';
print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="right">'.$langs->trans($v).'</th>';
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>';
}
print '</tr>';
@ -240,9 +241,6 @@ else if ($modecompta=="RECETTES-DEPENSES")
}
else if ($modecompta=="BOOKKEEPING")
{
// TODO
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
//All categories
$cats = $AccCat->getCats();
@ -250,16 +248,24 @@ else if ($modecompta=="BOOKKEEPING")
$j=1;
$sommes = array();
$totPerAccount = array();
foreach ($cats as $cat) // Loop on each group
{
if (!empty($cat['category_type'])) // category calculed
{
// When we enter here, $sommes was filled by group of accounts
$formula = $cat['formula'];
print "<tr>";
//print '<td colspan="2"><font color="blue">' . $cat['label'] . '</font></td>';
print '<td colspan="2">' . $cat['label'] . '</td>';
print '<tr class="liste_total">';
// Year NP
print '<td class="liste_total width200">';
print $cat['code'];
print '</td><td>';
print $cat['label'];
print '</td>';
$vars = array();
@ -271,11 +277,15 @@ else if ($modecompta=="BOOKKEEPING")
$result = strtr($formula, $vars);
//var_dump($result);
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
//var_dump($r);
$r = $AccCat->calculate($result);
print '<td class="liste_total right">' . price($r) . '</td>';
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
$code = $cat['code']; // code categorie de calcule
// Year N
$code = $cat['code']; // code of categorie ('VTE', 'MAR', ...)
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
@ -287,26 +297,31 @@ else if ($modecompta=="BOOKKEEPING")
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
print '<td class="liste_total right">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($months as $k => $v)
{
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
print '<td class="liste_total right">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
//var_dump($sommes);
}
else // normal category
{
@ -325,7 +340,9 @@ else if ($modecompta=="BOOKKEEPING")
print "<tr>";
// Column group
print '<td colspan="2">';
print '<td class="width200">';
print $cat['code'];
print '</td><td>';
print $cat['label'];
if (count($cpts) > 0)
{
@ -352,7 +369,8 @@ else if ($modecompta=="BOOKKEEPING")
$code = $cat['code'];
// Column N Previous and N
// Set value into column NPrevious, N and each month M ($totCat)
// This make 14 calls for each detail of account (NP, N and month m)
foreach($cpts as $i => $cpt)
{
// N-1
@ -376,6 +394,10 @@ else if ($modecompta=="BOOKKEEPING")
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
foreach($months as $k => $v)
{
@ -387,9 +409,12 @@ else if ($modecompta=="BOOKKEEPING")
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
}
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
@ -398,55 +423,29 @@ else if ($modecompta=="BOOKKEEPING")
}
print "</tr>\n";
//
foreach($cpts as $i => $cpt)
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail == 'yes')
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
foreach($cpts as $i => $cpt)
{
$resultNP=$totPerAccount[$cpt['account_number']]['NP'];
$resultN=$totPerAccount[$cpt['account_number']]['N'];
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
if ($simple_report == 'yes') {
print '<tr>';
print '<td> &nbsp; &nbsp; ' . length_accountg($cpt['account_number']) . '</td>';
print '<td></td>';
print ' &nbsp; &nbsp; ' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
// Make one call for each month
foreach($months as $k => $v)
{
$resultM=$totPerAccount[$cpt['account_number']]['M'][$k];
print '<td align="right">' . price($resultM) . '</td>';
}
}
if ($simple_report == 'yes') {
print "</tr>\n";
}
}

View File

@ -165,7 +165,7 @@ if ($modecompta=="CREANCES-DETTES") {
$description.= $langs->trans("DepositsAreIncluded");
}
$builddate=time();
$builddate=dol_now();
} else {
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
@ -175,7 +175,7 @@ if ($modecompta=="CREANCES-DETTES") {
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);

View File

@ -143,7 +143,7 @@ if ($modecompta=="CREANCES-DETTES") {
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} else {
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
@ -153,7 +153,7 @@ if ($modecompta=="CREANCES-DETTES") {
//$periodlink="<a href='".$_SERVER["PHP_SELF"]."?year=".($year-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year+1)."&modecompta=".$modecompta."'>".img_next()."</a>";
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
$moreparam=array();

View File

@ -173,7 +173,7 @@ if ($modecompta=="CREANCES-DETTES")
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} else {
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
@ -183,7 +183,7 @@ if ($modecompta=="CREANCES-DETTES")
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}

View File

@ -118,7 +118,7 @@ if ($modecompta=="CREANCES-DETTES")
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="RECETTES-DEPENSES")
@ -131,7 +131,7 @@ else if ($modecompta=="RECETTES-DEPENSES")
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="BOOKKEEPING")
@ -145,7 +145,7 @@ else if ($modecompta=="BOOKKEEPING")
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}

View File

@ -160,7 +160,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
. $langs->trans('AddExtraReport')
. '</input>'
. '<br>';
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices");
@ -204,7 +204,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
. $langs->trans('AddExtraReport')
. '</input>'
. '<br>';
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices");
@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')';
}
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");

View File

@ -152,7 +152,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
// Customers invoices
@ -192,7 +192,7 @@ if ($modetax==0) // Invoice for goods, payment for services
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
// Customers invoices
@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");

View File

@ -174,7 +174,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
$description.='<br>'.$langs->trans("DepositsAreIncluded");
}
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices");
@ -224,7 +224,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch;
$builddate=time();
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices");
@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')';
}
}
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");

View File

@ -3316,10 +3316,10 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
* @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix.
* @param string $moreattrib Add more attributes on th ("" by defaut, example: 'align="center"'). To add more css class, use param $prefix.
* @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id')
* @param string $sortorder Current sort order (Ex: 'asc,desc')
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '.
* @param string $disablesortlink 1=Disable sort link
* @param string $tooltip Tooltip
* @return string
@ -3342,7 +3342,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
//var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
// If field is used as sort criteria we use a specific css class liste_titre_sel
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';

View File

@ -24,10 +24,10 @@
/**
* Show header of a VAT report
* Show header of a report
*
* @param string $nom Name of report
* @param string $variante Link for alternate report
* @param string $reportname Name of report
* @param string $notused Not used
* @param string $period Period of report
* @param string $periodlink Link to switch period
* @param string $description Description
@ -38,13 +38,13 @@
* @param string $varlink Add a variable into the address of the page
* @return void
*/
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
function report_header($reportname,$notused,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
{
global $langs;
if (empty($hselected)) $hselected='report';
print "\n\n<!-- debut cartouche rapport -->\n";
print "\n\n<!-- start banner of report -->\n";
if(! empty($varlink)) $varlink = '?'.$varlink;
@ -53,23 +53,25 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
dol_fiche_head($head, 'report');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
foreach($moreparam as $key => $value)
{
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
}
print '<table width="100%" class="border">';
$variante = ($periodlink || $exportlink);
// Ligne de titre
print '<tr>';
print '<td width="110">'.$langs->trans("ReportName").'</td>';
if (! $variantexxx) print '<td colspan="3">';
else print '<td>';
print $nom;
if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
print '<td>';
print $reportname;
print '</td>';
if ($variante) print '<td></td>';
print '</tr>';
// Calculation mode
@ -77,10 +79,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
{
print '<tr>';
print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
if (! $variante) print '<td colspan="3">';
else print '<td>';
print '<td>';
print $calcmode;
if ($variante) print '</td><td colspan="2">'.$variante;
if ($variante) print '<td></td>';
print '</td>';
print '</tr>';
}
@ -88,35 +89,37 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
// Ligne de la periode d'analyse du rapport
print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>';
if (! $periodlink) print '<td colspan="3">';
else print '<td>';
print '<td>';
if ($period) print $period;
if ($periodlink) print '</td><td colspan="2">'.$periodlink;
if ($variante) print '<td>'.$periodlink.'</td>';
print '</td>';
print '</tr>';
// Ligne de description
print '<tr>';
print '<td>'.$langs->trans("ReportDescription").'</td>';
print '<td colspan="3">'.$description.'</td>';
print '<td>'.$description.'</td>';
if ($variante) print '<td></td>';
print '</tr>';
// Ligne d'export
print '<tr>';
print '<td>'.$langs->trans("GeneratedOn").'</td>';
if (! $exportlink) print '<td colspan="3">';
else print '<td>';
print dol_print_date($builddate);
if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
print '</td></tr>';
print '<td>';
print dol_print_date($builddate, 'dayhour');
print '</td>';
if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
print '</tr>';
print '</table>';
print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
dol_fiche_end();
print "\n<!-- fin cartouche rapport -->\n\n";
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print '<br>';
print "\n<!-- end banner of report -->\n\n";
}

View File

@ -31,9 +31,7 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account
JournalizationInLedgerStatus=Status of journalization
AlreadyInGeneralLedger=Already journalized in ledgers
NotYetInGeneralLedger=Not yet journalized in ledgers
PreviousYear=Previous year
SelectedPeriod=Selected period
GroupIsEmptyCheckSetup=Group is empty, check setup of the accounting group
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
DetailByAccount=Show detail by account
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
@ -152,7 +150,7 @@ Sens=Sens
Codejournal=Journal
NumPiece=Piece number
TransactionNumShort=Num. transaction
AccountingCategory=Accounting account groups
AccountingCategory=Personalized groups
GroupByAccountAccounting=Group by accounting account
AccountingAccountGroupsDesc=You can define here some groups of accounting account. It will be used in the report <b>%s</b> to show your income/expense with data grouped according to these groups.
ByAccounts=By accounts
@ -263,7 +261,7 @@ OptionModeProductSellDesc=Show all products with accounting account for sales.
OptionModeProductBuyDesc=Show all products with accounting account for purchases.
CleanFixHistory=Remove accountancy code from lines that not exists into charts of account
CleanHistory=Reset all bindings for selected year
PredefinedGroups=Predefined groups
WithoutValidAccount=Without valid dedicated account
WithValidAccount=With valid dedicated account
ValueNotIntoChartOfAccount=This value of accounting account does not exist into chart of account
@ -282,4 +280,4 @@ NoJournalDefined=No journal defined
Binded=Lines bound
ToBind=Lines to bind
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. It will be replaced by a more complete report in a next version.
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate.

View File

@ -883,7 +883,7 @@ DictionaryStaff=Staff
DictionaryAvailability=Delivery delay
DictionaryOrderMethods=Ordering methods
DictionarySource=Origin of proposals/orders
DictionaryAccountancyCategory=Accounting account groups
DictionaryAccountancyCategory=Personalized groups
DictionaryAccountancysystem=Models for chart of accounts
DictionaryAccountancyJournal=Accounting journals
DictionaryEMailTemplates=Emails templates

View File

@ -147,16 +147,17 @@ AnnualByCompanies=Income / Expenses, By predefined groups of account
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
SeeReportInBookkeepingMode=See report <b>%sBookeeping%s</b> for a calculation on bookkeeping table analysis
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
SeeReportInBookkeepingMode=See report <b>%sBookeeping%s</b> for a calculation on <b>bookkeeping table analysis</b>
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.<br>- It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used.
RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries. <br>- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.
RulesCADue=- It includes the client's due invoices whether they are paid or not. <br>- It is based on the validation date of these invoices.<br>
RulesCAIn=- It includes all the effective payments of invoices received from clients.<br>- It is based on the payment date of these invoices<br>
RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See <b>%s</b>)
RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See <b>%s</b>)
RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts <b>grouped by personalized groups</b> (See menu <b>%s</b> to define accounting account groups)
RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE"
RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE"
RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts <b>grouped by personalized groups</b>
SeePageForSetup=See menu <a href="%s">%s</a> for setup
DepositsAreNotIncluded=- Down payment invoices are nor included
DepositsAreIncluded=- Down payment invoices are included
LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF

View File

@ -129,6 +129,8 @@ Never=Never
Under=under
Period=Period
PeriodEndDate=End date for period
SelectedPeriod=Selected period
PreviousPeriod=Previous period
Activate=Activate
Activated=Activated
Closed=Closed

View File

@ -104,7 +104,7 @@ $exportlink = '';
$nom = $langs->trans("ReportThirdParty");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$description = $langs->trans("DescThirdPartyReport");
$builddate = time();
$builddate=dol_now();
$moreparam=array('action' => '');
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam);