Merge remote-tracking branch 'uptream/develop' into 7.0-f2
# Conflicts: # htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
commit
c4d2ca661f
31
README.md
31
README.md
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||||
|
|
||||||
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
|
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||||
|
|
||||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||||
|
|
||||||
@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
|||||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||||
|
|
||||||
### Install from composer
|
### Install from composer
|
||||||
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
|
|
||||||
|
|
||||||
|
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
curl -sS https://getcomposer.org/installer | php
|
curl -sS https://getcomposer.org/installer | php
|
||||||
mv composer.phar /usr/local/bin/composer
|
mv composer.phar /usr/local/bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
|
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
|
||||||
|
|
||||||
|
You can then create a new project
|
||||||
|
|
||||||
|
```bash
|
||||||
composer create-project dolibarr/dolibarr erp
|
composer create-project dolibarr/dolibarr erp
|
||||||
|
```
|
||||||
|
|
||||||
### Simple setup
|
### Simple setup
|
||||||
|
|
||||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
|
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||||
|
|
||||||
- DoliWamp for Windows
|
- DoliWamp for Windows
|
||||||
- DoliDeb for Debian or Ubuntu
|
- DoliDeb for Debian or Ubuntu
|
||||||
@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
|
|||||||
|
|
||||||
### Advanced setup
|
### Advanced setup
|
||||||
|
|
||||||
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
|
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||||
|
|
||||||
- Uncompress the downloaded archive
|
- Uncompress the downloaded archive
|
||||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
|
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
|
||||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
|
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
|
||||||
- From your browser, go to the dolibarr "install/" page
|
- From your browser, go to the dolibarr "install/" page
|
||||||
|
|
||||||
The URL will depends on choices made in the first step:
|
The URL will depends on choices made in the first step:
|
||||||
@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
|||||||
## UPGRADING
|
## UPGRADING
|
||||||
|
|
||||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||||
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
|
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
|
||||||
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
|
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||||
|
|
||||||
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||||
|
|
||||||
|
|
||||||
## WHAT'S NEW
|
## WHAT'S NEW
|
||||||
@ -172,7 +179,7 @@ Administrator, user, developer and translator's documentations are available alo
|
|||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
See [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) file
|
||||||
|
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|||||||
@ -69,8 +69,8 @@ $arrayfields=array(
|
|||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -264,8 +264,8 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
|
||||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
|
||||||
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -458,6 +458,10 @@ $titlepicto='title_setup';
|
|||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||||
|
|
||||||
|
if ($id == 32)
|
||||||
|
{
|
||||||
|
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||||
|
}
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
|
|||||||
@ -336,17 +336,18 @@ class AccountancyCategory
|
|||||||
*
|
*
|
||||||
* @param int $cpt Id accounting account
|
* @param int $cpt Id accounting account
|
||||||
* @param string $month Specifig month - Can be empty
|
* @param string $month Specifig month - Can be empty
|
||||||
* @param string $year Specific year
|
* @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
|
* @return integer Result in table
|
||||||
*/
|
*/
|
||||||
public function getResult($cpt, $month, $year, $sens) {
|
public function getResult($cpt, $month, $date_start, $date_end, $sens)
|
||||||
|
{
|
||||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
||||||
$sql .= " AND YEAR(t.doc_date) = " . $year;
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
|
||||||
if (! empty($month)) {
|
if (! empty($month)) {
|
||||||
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,6 +138,9 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step,
|
|||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
|
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
|
||||||
print '<hr>';
|
print '<hr>';
|
||||||
|
|||||||
@ -1,302 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
|
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/report/result.php
|
|
||||||
* \ingroup Advanced accountancy
|
|
||||||
* \brief Page for accounting result
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
// Class
|
|
||||||
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 . '/accountancy/class/accountancycategory.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|
||||||
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
// Langs
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
$mesg = '';
|
|
||||||
$action = GETPOST('action','aZ09');
|
|
||||||
$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');
|
|
||||||
|
|
||||||
|
|
||||||
// Filter
|
|
||||||
$year = GETPOST('year','int');
|
|
||||||
if ($year == 0) {
|
|
||||||
$year_current = strftime("%Y", time());
|
|
||||||
$year_start = $year_current;
|
|
||||||
} else {
|
|
||||||
$year_current = $year;
|
|
||||||
$year_start = $year;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($cat_id == 0){
|
|
||||||
$cat_id = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
accessforbidden();
|
|
||||||
if (! $user->rights->accounting->comptarapport->lire)
|
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
$AccCat = new AccountancyCategory($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxheader('', $langs->trans('ReportInOut'));
|
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
|
||||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
|
||||||
|
|
||||||
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
|
|
||||||
$nomlink = '';
|
|
||||||
$periodlink = '';
|
|
||||||
$exportlink = '';
|
|
||||||
$builddate = time();
|
|
||||||
$description = '';
|
|
||||||
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
|
|
||||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
|
||||||
|
|
||||||
$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("Account").'</th>';
|
|
||||||
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
|
|
||||||
print '<th class="liste_titre" align="center">N-1</th>';
|
|
||||||
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//All categories
|
|
||||||
$cats = $AccCat->getCats();
|
|
||||||
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
|
||||||
|
|
||||||
$j=1;
|
|
||||||
$sommes = array();
|
|
||||||
|
|
||||||
foreach($cats as $cat ){
|
|
||||||
if(!empty($cat['category_type'])){ // category calculed
|
|
||||||
|
|
||||||
$formula = $cat['formula'];
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
|
||||||
|
|
||||||
$vars = array();
|
|
||||||
|
|
||||||
// Previous Fiscal year (N-1)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['NP'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
|
|
||||||
|
|
||||||
$r = $AccCat->calculate($result);
|
|
||||||
|
|
||||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
|
||||||
$code = $cat['code']; // code categorie de calcule
|
|
||||||
$sommes[$code]['NP'] += $r;
|
|
||||||
|
|
||||||
// Current fiscal year (N)
|
|
||||||
if (is_array($sommes) && ! empty($sommes)){
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['N'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
|
|
||||||
$r = $AccCat->calculate($result);
|
|
||||||
|
|
||||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
|
||||||
$sommes[$code]['N'] += $r;
|
|
||||||
|
|
||||||
// Detail by month
|
|
||||||
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) . '</td>';
|
|
||||||
$sommes[$code]['M'][$k] += $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
|
|
||||||
}else{ // normal category
|
|
||||||
|
|
||||||
$totCat = array();
|
|
||||||
$totCat['M'] = array();
|
|
||||||
|
|
||||||
// get cpts of category
|
|
||||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
|
||||||
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
|
||||||
|
|
||||||
foreach($cpts as $i => $cpt){
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$code = $cat['code'];
|
|
||||||
|
|
||||||
// N-1
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
|
||||||
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultNP=0;
|
|
||||||
} else {
|
|
||||||
$resultNP=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
//N
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultN=0;
|
|
||||||
} else {
|
|
||||||
$resultN=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
$totCat['NP'] += $resultNP;
|
|
||||||
$totCat['N'] += $resultN;
|
|
||||||
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultM=0;
|
|
||||||
} else {
|
|
||||||
$resultM=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
$totCat['M'][$k] += $resultM;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
|
||||||
print '<td align="right">' . price($totCat['N']) . '</td>';
|
|
||||||
|
|
||||||
foreach($totCat['M'] as $k => $v){
|
|
||||||
print '<td align="right">' . price($v) . '</td>';
|
|
||||||
}
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
foreach($cpts as $i => $cpt){
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$code = $cat['code'];
|
|
||||||
|
|
||||||
// N-1
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
|
||||||
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultNP=0;
|
|
||||||
} else {
|
|
||||||
$resultNP=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
//N
|
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
|
||||||
if ($return < 0) {
|
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
|
||||||
$resultN=0;
|
|
||||||
} else {
|
|
||||||
$resultN=$AccCat->sdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sommes[$code]['NP'] += $resultNP;
|
|
||||||
$sommes[$code]['N'] += $resultN;
|
|
||||||
print '<tr'. $bc[$var].'>';
|
|
||||||
if ($simple_report == 'yes') {
|
|
||||||
print '<td>' . 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, $year_current, $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') {
|
|
||||||
print '<td align="right">' . price($resultM) . '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -84,8 +84,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nom=$langs->trans("PurchasesJournal");
|
$name=$langs->trans("PurchasesJournal");
|
||||||
$nomlink='';
|
$namelink='';
|
||||||
$periodlink='';
|
$periodlink='';
|
||||||
$exportlink='';
|
$exportlink='';
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
@ -93,7 +93,8 @@ $description=$langs->trans("DescPurchasesJournal").'<br>';
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
else $description.= $langs->trans("DepositsAreIncluded");
|
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);
|
$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($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
|
|
||||||
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|||||||
@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nom=$langs->trans("SellsJournal");
|
$nom=$langs->trans("SellsJournal");
|
||||||
$nomlink='';
|
$namelink='';
|
||||||
$periodlink='';
|
$periodlink='';
|
||||||
$exportlink='';
|
$exportlink='';
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
@ -97,7 +97,7 @@ $description=$langs->trans("DescSellsJournal").'<br>';
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
else $description.= $langs->trans("DepositsAreIncluded");
|
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);
|
$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($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services
|
|||||||
$productsup=$langs->trans("Description");
|
$productsup=$langs->trans("Description");
|
||||||
$amountsup=$langs->trans("AmountHT");
|
$amountsup=$langs->trans("AmountHT");
|
||||||
}
|
}
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
|
|
||||||
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
|
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
|
||||||
|
|||||||
@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
|||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
}
|
}
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
|
|
||||||
if($local==1){
|
if($local==1){
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/resultat/clientfourn.php
|
* \file htdocs/compta/resultat/clientfourn.php
|
||||||
|
* \ingroup compta, accountancy
|
||||||
* \brief Page reporting
|
* \brief Page reporting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -34,10 +35,7 @@ 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/tax.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
|
$langs->loadLangs(array('compta','bills','donation','salaries'));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("donation");
|
|
||||||
$langs->load("salaries");
|
|
||||||
|
|
||||||
$date_startmonth=GETPOST('date_startmonth');
|
$date_startmonth=GETPOST('date_startmonth');
|
||||||
$date_startday=GETPOST('date_startday');
|
$date_startday=GETPOST('date_startday');
|
||||||
@ -60,11 +58,11 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
|||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield='s.nom, s.rowid';
|
//if (! $sortfield) $sortfield='s.nom, s.rowid';
|
||||||
if (! $sortorder) $sortorder='ASC';
|
if (! $sortorder) $sortorder='ASC';
|
||||||
|
|
||||||
// Date range
|
// Date range
|
||||||
$year=GETPOST("year");
|
$year=GETPOST('year','int');
|
||||||
if (empty($year))
|
if (empty($year))
|
||||||
{
|
{
|
||||||
$year_current = strftime("%Y",dol_now());
|
$year_current = strftime("%Y",dol_now());
|
||||||
@ -77,7 +75,8 @@ if (empty($year))
|
|||||||
}
|
}
|
||||||
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
// Quarter
|
|
||||||
|
// We define date_start and date_end
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
{
|
{
|
||||||
$q=GETPOST("q")?GETPOST("q"):0;
|
$q=GETPOST("q")?GETPOST("q"):0;
|
||||||
@ -105,14 +104,19 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO We define q
|
|
||||||
|
|
||||||
}
|
// $date_start and $date_end are defined. We force $start_year and $nbofyear
|
||||||
|
$tmps=dol_getdate($date_start);
|
||||||
|
$start_year = $tmps['year'];
|
||||||
|
$tmpe=dol_getdate($date_end);
|
||||||
|
$year_end = $tmpe['year'];
|
||||||
|
$nbofyear = ($year_end - $start_year) + 1;
|
||||||
|
//var_dump($start_year." ".$end_year." ".$nbofyear);
|
||||||
|
|
||||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
|
||||||
$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->ACCOUNTING_MODE);
|
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||||
|
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
|
||||||
|
if (GETPOST("modecompta",'alpha')) $modecompta=GETPOST("modecompta",'alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -123,7 +127,7 @@ llxHeader();
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$nomlink='';
|
$namelink='';
|
||||||
$periodlink='';
|
$periodlink='';
|
||||||
$exportlink='';
|
$exportlink='';
|
||||||
|
|
||||||
@ -133,34 +137,50 @@ $total_ttc=0;
|
|||||||
// Affiche en-tete de rapport
|
// Affiche en-tete de rapport
|
||||||
if ($modecompta=="CREANCES-DETTES")
|
if ($modecompta=="CREANCES-DETTES")
|
||||||
{
|
{
|
||||||
$name=$langs->trans("AnnualByCompaniesDueDebtMode");
|
$name=$langs->trans("AnnualByCompanies");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</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);
|
$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>';
|
$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("RulesResultDue");
|
$description=$langs->trans("RulesResultDue");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
else $description.= $langs->trans("DepositsAreIncluded");
|
else $description.= $langs->trans("DepositsAreIncluded");
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
else {
|
elseif ($modecompta=="RECETTES-DEPENSES")
|
||||||
$name=$langs->trans("AnnualByCompaniesInputOutputMode");
|
{
|
||||||
|
$name=$langs->trans("AnnualByCompanies");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</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);
|
||||||
|
$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();
|
||||||
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
}
|
||||||
|
elseif ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
$name=$langs->trans("AnnualByCompanies");
|
||||||
|
$calcmode=$langs->trans("CalcModeBookkeeping");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
|
$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',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=$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>';
|
$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");
|
$description=$langs->trans("RulesResultBookkeepingPredefined", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts"));
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
$hselected = 'report';
|
$hselected = 'report';
|
||||||
|
|
||||||
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
@ -177,21 +197,82 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear;
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print_liste_field_titre("Name", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Groups"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
|
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder);
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
if ($modecompta == 'BOOKKEEPING')
|
||||||
|
{
|
||||||
|
$sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, aa.pcg_subtype, sum(f.credit - f.debit) as amount";
|
||||||
|
$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')";
|
||||||
|
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";
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
$oldpcgtype = '';
|
||||||
|
|
||||||
|
dol_syslog("get bookkeeping entries", LOG_DEBUG);
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
if ($objp->pcg_type != $oldpcgtype)
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="4">'.$objp->pcg_type.'</td></tr>';
|
||||||
|
$oldpcgtype = $objp->pcg_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>'.$objp->pcg_type.($objp->pcg_subtype != 'XXXXXX'?' - '.$objp->pcg_subtype:'').($objp->name?' ('.$objp->name.')':'')."</td>\n";
|
||||||
|
print '<td align="right">'.price($objp->amount)."</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$total_ht += (isset($objp->amount)?$objp->amount:0);
|
||||||
|
$total_ttc += (isset($objp->amount)?$objp->amount:0);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="4" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
* Factures clients
|
* Factures clients
|
||||||
*/
|
*/
|
||||||
print '<tr><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc";
|
$sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||||
@ -203,9 +284,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " AND f.type IN (0,1,2,3,5)";
|
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
else
|
elseif ($modecompta == 'RECETTES-DEPENSES')
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||||
@ -220,15 +301,15 @@ else
|
|||||||
$sql.= " AND f.fk_soc = s.rowid";
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
$sql.= " GROUP BY s.nom, s.rowid";
|
$sql.= " GROUP BY name, socid";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
dol_syslog("get customer invoices", LOG_DEBUG);
|
dol_syslog("get customer invoices", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -248,13 +329,13 @@ if ($result) {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On ajoute les paiements clients anciennes version, non lie par paiement_facture
|
// On ajoute les paiements clients anciennes version, non lie par paiement_facture
|
||||||
if ($modecompta != 'CREANCES-DETTES')
|
if ($modecompta == 'RECETTES-DEPENSES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
|
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
@ -298,27 +379,27 @@ if ($modecompta != 'CREANCES-DETTES')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_ttc == 0)
|
if ($total_ttc == 0)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven"><td> </td>';
|
print '<tr class="oddeven"><td> </td>';
|
||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right">'.price($total_ht).'</td>';
|
print '<td colspan="3" align="right">'.price($total_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price($total_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price($total_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Suppliers invoices
|
* Suppliers invoices
|
||||||
*/
|
*/
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc";
|
$sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
@ -330,9 +411,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " AND f.type IN (0,1,2,3)";
|
$sql.= " AND f.type IN (0,1,2,3)";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
else
|
elseif ($modecompta == 'RECETTES-DEPENSES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
|
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
|
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
|
||||||
@ -343,19 +424,20 @@ else
|
|||||||
$sql.= " WHERE p.rowid = pf.fk_paiementfourn ";
|
$sql.= " WHERE p.rowid = pf.fk_paiementfourn ";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
|
||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
|
||||||
$sql .= " GROUP BY s.nom, s.rowid";
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("SuppliersInvoices").'</td></tr>';
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
|
$sql .= " GROUP BY name, socid";
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
print '<tr><td colspan="4">'.$langs->trans("SuppliersInvoices").'</td></tr>';
|
||||||
$subtotal_ttc = 0;
|
|
||||||
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
$subtotal_ht = 0;
|
||||||
$result = $db->query($sql);
|
$subtotal_ttc = 0;
|
||||||
if ($result) {
|
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
@ -388,25 +470,25 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales non deductibles
|
* Charges sociales non deductibles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -414,9 +496,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " AND c.deductible = 0";
|
$sql.= " AND c.deductible = 0";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
else
|
elseif ($modecompta == 'RECETTES-DEPENSES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -426,20 +508,21 @@ else
|
|||||||
$sql.= " AND c.deductible = 0";
|
$sql.= " AND c.deductible = 0";
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
$sql.= " GROUP BY c.libelle, c.id";
|
$sql.= " GROUP BY c.libelle, c.id";
|
||||||
$newsortfield = $sortfield;
|
$newsortfield = $sortfield;
|
||||||
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id';
|
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id';
|
||||||
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
||||||
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
||||||
$sql.= $db->order($newsortfield, $sortorder);
|
|
||||||
|
|
||||||
dol_syslog("get social contributions deductible=0", LOG_DEBUG);
|
$sql.= $db->order($newsortfield, $sortorder);
|
||||||
$result=$db->query($sql);
|
|
||||||
$subtotal_ht = 0;
|
dol_syslog("get social contributions deductible=0", LOG_DEBUG);
|
||||||
$subtotal_ttc = 0;
|
$result=$db->query($sql);
|
||||||
if ($result) {
|
$subtotal_ht = 0;
|
||||||
|
$subtotal_ttc = 0;
|
||||||
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num) {
|
if ($num) {
|
||||||
@ -464,24 +547,24 @@ if ($result) {
|
|||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales deductibles
|
* Charges sociales deductibles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -490,9 +573,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
}
|
}
|
||||||
else
|
elseif ($modecompta == 'RECETTES-DEPENSES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -503,19 +586,19 @@ else
|
|||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
}
|
}
|
||||||
$sql.= " GROUP BY c.libelle, c.id";
|
$sql.= " GROUP BY c.libelle, c.id";
|
||||||
$newsortfield = $sortfield;
|
$newsortfield = $sortfield;
|
||||||
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id';
|
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id';
|
||||||
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
||||||
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
||||||
$sql.= $db->order($newsortfield, $sortorder);
|
$sql.= $db->order($newsortfield, $sortorder);
|
||||||
|
|
||||||
dol_syslog("get social contributions deductible=1", LOG_DEBUG);
|
dol_syslog("get social contributions deductible=1", LOG_DEBUG);
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num) {
|
if ($num) {
|
||||||
@ -541,17 +624,17 @@ if ($result) {
|
|||||||
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($mysoc->tva_assuj == 'franchise') // Non assujetti
|
if ($mysoc->tva_assuj == 'franchise') // Non assujetti
|
||||||
{
|
{
|
||||||
// Total
|
// Total
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="4"> </td>';
|
print '<td colspan="4"> </td>';
|
||||||
@ -566,22 +649,25 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujetti
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="4"> </td>';
|
print '<td colspan="4"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Salaries
|
* Salaries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($conf->salaries->enabled))
|
if (! empty($conf->salaries->enabled))
|
||||||
{
|
{
|
||||||
|
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
|
||||||
|
|
||||||
|
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')
|
||||||
|
{
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$column = 'p.datev';
|
$column = 'p.datev';
|
||||||
} else {
|
} else {
|
||||||
$column = 'p.datep';
|
$column = 'p.datep';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
|
|
||||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
||||||
@ -595,6 +681,7 @@ if (! empty($conf->salaries->enabled))
|
|||||||
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ht') $newsortfield = 'amount';
|
||||||
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
if ($newsortfield == 'amount_ttc') $newsortfield = 'amount';
|
||||||
$sql.= $db->order($newsortfield, $sortorder);
|
$sql.= $db->order($newsortfield, $sortorder);
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog("get payment salaries");
|
dol_syslog("get payment salaries");
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
@ -641,14 +728,17 @@ if (! empty($conf->salaries->enabled))
|
|||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
/*
|
||||||
* Expense
|
* Expense
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($conf->expensereport->enabled))
|
if (! empty($conf->expensereport->enabled))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')
|
||||||
|
{
|
||||||
$langs->load('trips');
|
$langs->load('trips');
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||||
@ -670,8 +760,6 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
$column='pe.datep';
|
$column='pe.datep';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("ExpenseReport").'</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
{
|
{
|
||||||
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||||
@ -681,6 +769,9 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
$newsortfield = $sortfield;
|
$newsortfield = $sortfield;
|
||||||
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.ref';
|
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.ref';
|
||||||
$sql.= $db->order($newsortfield, $sortorder);
|
$sql.= $db->order($newsortfield, $sortorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td colspan="4">'.$langs->trans("ExpenseReport").'</td></tr>';
|
||||||
|
|
||||||
dol_syslog("get expense report outcome");
|
dol_syslog("get expense report outcome");
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
@ -719,19 +810,21 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
|
|
||||||
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Donations
|
* Donations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($conf->don->enabled))
|
if (! empty($conf->don->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="4">'.$langs->trans("Donations").'</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("Donations").'</td></tr>';
|
||||||
|
|
||||||
|
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')
|
||||||
|
{
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
@ -750,6 +843,7 @@ if (! empty($conf->don->enabled))
|
|||||||
}
|
}
|
||||||
if (! empty($date_start) && ! empty($date_end))
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
||||||
$newsortfield = $sortfield;
|
$newsortfield = $sortfield;
|
||||||
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm';
|
if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm';
|
||||||
@ -802,18 +896,21 @@ if (! empty($conf->don->enabled))
|
|||||||
print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>';
|
print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>';
|
||||||
print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>';
|
print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
/*
|
||||||
* VAT
|
* VAT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<tr><td colspan="4">'.$langs->trans("VAT").'</td></tr>';
|
print '<tr><td colspan="4">'.$langs->trans("VAT").'</td></tr>';
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($conf->tax->enabled && ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES'))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
// TVA a payer
|
// TVA a payer
|
||||||
$amount=0;
|
$amount=0;
|
||||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount";
|
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount";
|
||||||
@ -910,9 +1007,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
print "<td align=\"right\"> </td>\n";
|
print "<td align=\"right\"> </td>\n";
|
||||||
print "<td align=\"right\">".price($amount)."</td>\n";
|
print "<td align=\"right\">".price($amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// VAT really already paid
|
// VAT really already paid
|
||||||
$amount=0;
|
$amount=0;
|
||||||
$sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount";
|
$sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount";
|
||||||
@ -1002,16 +1099,17 @@ else
|
|||||||
print "<td align=\"right\">".price($amount)."</td>\n";
|
print "<td align=\"right\">".price($amount)."</td>\n";
|
||||||
print "<td align=\"right\">".price($amount)."</td>\n";
|
print "<td align=\"right\">".price($amount)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mysoc->tva_assuj != 'franchise') // Assujetti
|
||||||
if ($mysoc->tva_assuj != 'franchise') // Assujetti
|
{
|
||||||
{
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
print '<td colspan="3" align="right"> </td>';
|
print '<td colspan="3" align="right"> </td>';
|
||||||
print '<td colspan="3" align="right">'.price(price2num($subtotal_ttc,'MT')).'</td>';
|
print '<td colspan="3" align="right">'.price(price2num($subtotal_ttc,'MT')).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = "balanceclient";
|
$action = "balanceclient";
|
||||||
|
|||||||
@ -22,33 +22,87 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/resultat/index.php
|
* \file htdocs/compta/resultat/index.php
|
||||||
|
* \ingroup compta, accountancy
|
||||||
* \brief Page reporting result
|
* \brief Page reporting result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||||
|
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');
|
||||||
|
|
||||||
$year_start=GETPOST('year_start');
|
|
||||||
$year_current = strftime("%Y",time());
|
|
||||||
$nbofyear=4;
|
$nbofyear=4;
|
||||||
if (! $year_start) {
|
|
||||||
$year_start = $year_current - ($nbofyear-1);
|
// Date range
|
||||||
$year_end = $year_current;
|
$year=GETPOST('year','int');
|
||||||
|
if (empty($year))
|
||||||
|
{
|
||||||
|
$year_current = strftime("%Y",dol_now());
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year_current - ($nbofyear - 1);
|
||||||
|
} else {
|
||||||
|
$year_current = $year;
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year - ($nbofyear - 1);
|
||||||
}
|
}
|
||||||
else {
|
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$year_end=$year_start + ($nbofyear-1);
|
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
|
// We define date_start and date_end
|
||||||
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
|
{
|
||||||
|
$q=GETPOST("q")?GETPOST("q"):0;
|
||||||
|
if ($q==0)
|
||||||
|
{
|
||||||
|
// We define date_start and date_end
|
||||||
|
$year_end=$year_start + ($nbofyear - 1);
|
||||||
|
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
if (! GETPOST('month'))
|
||||||
|
{
|
||||||
|
if (! GETPOST("year") && $month_start > $month_current)
|
||||||
|
{
|
||||||
|
$year_start--;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$month_end=$month_start-1;
|
||||||
|
if ($month_end < 1) $month_end=12;
|
||||||
|
else $year_end++;
|
||||||
|
}
|
||||||
|
else $month_end=$month_start;
|
||||||
|
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||||
|
}
|
||||||
|
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||||
|
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||||
|
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||||
|
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $date_start and $date_end are defined. We force $start_year and $nbofyear
|
||||||
|
$tmps=dol_getdate($date_start);
|
||||||
|
$start_year = $tmps['year'];
|
||||||
|
$tmpe=dol_getdate($date_end);
|
||||||
|
$year_end = $tmpe['year'];
|
||||||
|
$nbofyear = ($year_end - $start_year) + 1;
|
||||||
|
//var_dump($start_year." ".$end_year." ".$nbofyear);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
||||||
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
|
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
|
||||||
|
|
||||||
|
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
|
||||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||||
$modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->ACCOUNTING_MODE);
|
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
|
||||||
|
if (GETPOST("modecompta",'alpha')) $modecompta=GETPOST("modecompta",'alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -59,17 +113,18 @@ llxHeader();
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$nomlink='';
|
$namelink='';
|
||||||
$exportlink='';
|
$exportlink='';
|
||||||
|
|
||||||
// Affiche en-tete du rapport
|
// Affiche en-tete du rapport
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("AnnualSummaryDueDebtMode");
|
$name=$langs->trans("AnnualSummaryDueDebtMode");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$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>":"");
|
$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("RulesAmountWithTaxIncluded");
|
$description=$langs->trans("RulesAmountWithTaxIncluded");
|
||||||
$description.='<br>'.$langs->trans("RulesResultDue");
|
$description.='<br>'.$langs->trans("RulesResultDue");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.="<br>".$langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.="<br>".$langs->trans("DepositsAreNotIncluded");
|
||||||
@ -77,23 +132,36 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
else {
|
else if ($modecompta=="RECETTES-DEPENSES") {
|
||||||
$nom=$langs->trans("AnnualSummaryInputOutputMode");
|
$name=$langs->trans("AnnualSummaryInputOutputMode");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$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>":"");
|
$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("RulesAmountWithTaxIncluded");
|
$description=$langs->trans("RulesAmountWithTaxIncluded");
|
||||||
$description.='<br>'.$langs->trans("RulesResultInOut");
|
$description.='<br>'.$langs->trans("RulesResultInOut");
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
$name=$langs->trans("AnnualSummaryDueDebtMode");
|
||||||
|
$calcmode=$langs->trans("CalcModeBookkeeping");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
$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();
|
||||||
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
$hselected='report';
|
$hselected='report';
|
||||||
|
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
@ -103,10 +171,13 @@ if (! empty($conf->accounting->enabled))
|
|||||||
/*
|
/*
|
||||||
* Factures clients
|
* Factures clients
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||||
@ -114,9 +185,11 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " AND f.fk_statut IN (1,2)";
|
$sql.= " AND f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
else
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
{
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||||
@ -127,17 +200,20 @@ else
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||||
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
||||||
$sql.= " AND pf.fk_facture = f.rowid";
|
$sql.= " AND pf.fk_facture = f.rowid";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
if ($socid) $sql.= " AND f.fk_soc = $socid";
|
}
|
||||||
$sql.= " GROUP BY dm";
|
|
||||||
$sql.= " ORDER BY dm";
|
|
||||||
|
|
||||||
//print $sql;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
dol_syslog("get customers invoices", LOG_DEBUG);
|
if ($socid) $sql.= " AND f.fk_soc = $socid";
|
||||||
$result=$db->query($sql);
|
$sql.= " GROUP BY dm";
|
||||||
if ($result)
|
$sql.= " ORDER BY dm";
|
||||||
{
|
|
||||||
|
//print $sql;
|
||||||
|
dol_syslog("get customers invoices", LOG_DEBUG);
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -148,14 +224,21 @@ if ($result)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
}
|
}
|
||||||
|
|
||||||
// On ajoute les paiements clients anciennes version, non lies par paiement_facture
|
if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
if ($modecompta != 'CREANCES-DETTES')
|
|
||||||
{
|
{
|
||||||
|
// On ajoute les paiements clients anciennes version, non lies par paiement_facture
|
||||||
|
if ($modecompta != 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
@ -165,6 +248,8 @@ if ($modecompta != 'CREANCES-DETTES')
|
|||||||
$sql.= " AND p.fk_bank = b.rowid";
|
$sql.= " AND p.fk_bank = b.rowid";
|
||||||
$sql.= " AND b.fk_account = ba.rowid";
|
$sql.= " AND b.fk_account = ba.rowid";
|
||||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= " ORDER BY dm";
|
$sql.= " ORDER BY dm";
|
||||||
|
|
||||||
@ -189,6 +274,15 @@ if ($modecompta != 'CREANCES-DETTES')
|
|||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,31 +292,38 @@ if ($modecompta != 'CREANCES-DETTES')
|
|||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
else
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
{
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
$sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
$sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
|
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
|
||||||
$sql.= " WHERE f.rowid = pf.fk_facturefourn";
|
$sql.= " WHERE f.rowid = pf.fk_facturefourn";
|
||||||
$sql.= " AND p.rowid = pf.fk_paiementfourn";
|
$sql.= " AND p.rowid = pf.fk_paiementfourn";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
}
|
||||||
$sql.= " GROUP BY dm";
|
|
||||||
|
|
||||||
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
$result=$db->query($sql);
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
if ($result)
|
$sql.= " GROUP BY dm";
|
||||||
{
|
|
||||||
|
dol_syslog("get suppliers invoices", LOG_DEBUG);
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -238,19 +339,28 @@ if ($result)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TVA
|
* TVA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
// TVA a payer
|
// TVA a payer
|
||||||
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
@ -258,6 +368,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
dol_syslog("get vat to pay", LOG_DEBUG);
|
dol_syslog("get vat to pay", LOG_DEBUG);
|
||||||
@ -289,6 +401,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
dol_syslog("get vat to receive back", LOG_DEBUG);
|
dol_syslog("get vat to receive back", LOG_DEBUG);
|
||||||
@ -313,13 +427,16 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
// TVA reellement deja payee
|
// TVA reellement deja payee
|
||||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||||
$sql.= " WHERE amount > 0";
|
$sql.= " WHERE amount > 0";
|
||||||
$sql.= " AND t.entity = ".$conf->entity;
|
$sql.= " AND t.entity = ".$conf->entity;
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
dol_syslog("get vat really paid", LOG_DEBUG);
|
dol_syslog("get vat really paid", LOG_DEBUG);
|
||||||
@ -349,6 +466,8 @@ else {
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||||
$sql.= " WHERE amount < 0";
|
$sql.= " WHERE amount < 0";
|
||||||
$sql.= " AND t.entity = ".$conf->entity;
|
$sql.= " AND t.entity = ".$conf->entity;
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
dol_syslog("get vat really received back", LOG_DEBUG);
|
dol_syslog("get vat really received back", LOG_DEBUG);
|
||||||
@ -373,23 +492,33 @@ else {
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales non deductibles
|
* Charges sociales non deductibles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
$sql.= " AND c.deductible = 0";
|
$sql.= " AND c.deductible = 0";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
else
|
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||||
{
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -397,13 +526,16 @@ else
|
|||||||
$sql.= " WHERE p.fk_charge = cs.rowid";
|
$sql.= " WHERE p.fk_charge = cs.rowid";
|
||||||
$sql.= " AND cs.fk_type = c.id";
|
$sql.= " AND cs.fk_type = c.id";
|
||||||
$sql.= " AND c.deductible = 0";
|
$sql.= " AND c.deductible = 0";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY c.libelle, dm";
|
}
|
||||||
|
|
||||||
dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
$result=$db->query($sql);
|
$sql.= " GROUP BY c.libelle, dm";
|
||||||
if ($result) {
|
|
||||||
|
dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$var=false;
|
$var=false;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -420,9 +552,15 @@ if ($result) {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales deductibles
|
* Charges sociales deductibles
|
||||||
@ -430,16 +568,20 @@ if ($result) {
|
|||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
$sql.= " AND c.deductible = 1";
|
$sql.= " AND c.deductible = 1";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
else
|
$sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||||
{
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
@ -447,13 +589,16 @@ else
|
|||||||
$sql.= " WHERE p.fk_charge = cs.rowid";
|
$sql.= " WHERE p.fk_charge = cs.rowid";
|
||||||
$sql.= " AND cs.fk_type = c.id";
|
$sql.= " AND cs.fk_type = c.id";
|
||||||
$sql.= " AND c.deductible = 1";
|
$sql.= " AND c.deductible = 1";
|
||||||
}
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
$sql.= " GROUP BY c.libelle, dm";
|
}
|
||||||
|
|
||||||
dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
$result=$db->query($sql);
|
$sql.= " GROUP BY c.libelle, dm";
|
||||||
if ($result) {
|
|
||||||
|
dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$var=false;
|
$var=false;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -470,68 +615,73 @@ if ($result) {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
}
|
}
|
||||||
$action = "balance";
|
|
||||||
$object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
|
|
||||||
$parameters["mode"] = $modecompta;
|
|
||||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
|
||||||
$hookmanager->initHooks(array('externalbalance'));
|
|
||||||
$reshook=$hookmanager->executeHooks('addReportInfo',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Salaries
|
* Salaries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($conf->salaries->enabled))
|
if (! empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') $column = 'p.datev';
|
||||||
$column = 'p.datev';
|
if ($modecompta == "RECETTES-DEPENSES") $column = 'p.datep';
|
||||||
} else {
|
|
||||||
$column = 'p.datep';
|
|
||||||
}
|
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "payment_salary as p";
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql .= " WHERE p.entity = " . $conf->entity;
|
||||||
$sql.= " GROUP BY p.label, dm";
|
$sql .= " GROUP BY p.label, dm";
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||||
|
|
||||||
dol_syslog("get social salaries payments");
|
dol_syslog("get social salaries payments");
|
||||||
$result=$db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$var=false;
|
$var = false;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num) {
|
||||||
{
|
while ($i < $num) {
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
|
if (! isset($decaiss[$obj->dm]))
|
||||||
|
$decaiss[$obj->dm] = 0;
|
||||||
$decaiss[$obj->dm] += $obj->amount;
|
$decaiss[$obj->dm] += $obj->amount;
|
||||||
|
|
||||||
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
|
if (! isset($decaiss_ttc[$obj->dm]))
|
||||||
|
$decaiss_ttc[$obj->dm] = 0;
|
||||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
$decaiss_ttc[$obj->dm] += $obj->amount;
|
||||||
|
|
||||||
$i++;
|
$i ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif ($modecompta == "BOOKKEEPING")
|
||||||
|
{
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->expensereport->enabled))
|
|
||||||
|
/*
|
||||||
|
* Expense reports
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
$langs->load('trips');
|
$langs->load('trips');
|
||||||
|
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
$sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
@ -540,8 +690,10 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
$column='p.date_valid';
|
$column='p.date_valid';
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||||
|
|
||||||
} else {
|
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||||
$sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
$sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
@ -551,6 +703,8 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
$sql.= " AND p.fk_statut>=5";
|
$sql.= " AND p.fk_statut>=5";
|
||||||
|
|
||||||
$column='pe.datep';
|
$column='pe.datep';
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
@ -579,12 +733,18 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
elseif ($modecompta == 'BOOKKEEPING') {
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Donation get dunning paiement
|
* Donation get dunning paiement
|
||||||
*/
|
*/
|
||||||
if (! empty($conf->don->enabled))
|
|
||||||
|
if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
|
||||||
{
|
{
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
$subtotal_ttc = 0;
|
$subtotal_ttc = 0;
|
||||||
@ -594,15 +754,20 @@ if (! empty($conf->don->enabled))
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
$sql.= " AND fk_statut in (1,2)";
|
$sql.= " AND fk_statut in (1,2)";
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
else {
|
elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||||
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
|
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||||
$sql.= " WHERE p.entity = ".getEntity('donation');
|
$sql.= " WHERE p.entity = ".getEntity('donation');
|
||||||
$sql.= " AND fk_statut >= 2";
|
$sql.= " AND fk_statut >= 2";
|
||||||
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
|
||||||
|
|
||||||
dol_syslog("get donation payments");
|
dol_syslog("get donation payments");
|
||||||
@ -633,6 +798,72 @@ if (! empty($conf->don->enabled))
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif ($modecompta == 'BOOKKEEPING') {
|
||||||
|
// Nothing from this table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Donation get dunning paiement
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
|
||||||
|
{
|
||||||
|
$subtotal_ht = 0;
|
||||||
|
$subtotal_ttc = 0;
|
||||||
|
|
||||||
|
$sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount";
|
||||||
|
$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 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)."'";
|
||||||
|
$sql.= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm";
|
||||||
|
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
|
dol_syslog("get donation payments");
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$var=false;
|
||||||
|
$i = 0;
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
|
||||||
|
$encaiss[$obj->dm] += $obj->debit;
|
||||||
|
|
||||||
|
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
|
||||||
|
$encaiss_ttc[$obj->dm] += $obj->credit;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$action = "balance";
|
||||||
|
$object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
|
||||||
|
$parameters["mode"] = $modecompta;
|
||||||
|
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||||
|
$hookmanager->initHooks(array('externalbalance'));
|
||||||
|
$reshook=$hookmanager->executeHooks('addReportInfo',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show result array
|
* Show result array
|
||||||
|
|||||||
461
htdocs/compta/resultat/result.php
Normal file
461
htdocs/compta/resultat/result.php
Normal file
@ -0,0 +1,461 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016-2017 Jamal Elbaz <jamelbaz@gmail.com>
|
||||||
|
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/compta/resultat/result.php
|
||||||
|
* \ingroup compta, accountancy
|
||||||
|
* \brief Page for accounting result
|
||||||
|
*/
|
||||||
|
|
||||||
|
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';
|
||||||
|
|
||||||
|
$langs->loadLangs(array('compta','bills','donation','salaries'));
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$mesg = '';
|
||||||
|
$action = GETPOST('action','aZ09');
|
||||||
|
$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');
|
||||||
|
|
||||||
|
|
||||||
|
$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');
|
||||||
|
|
||||||
|
$nbofyear=1;
|
||||||
|
|
||||||
|
// Date range
|
||||||
|
$year=GETPOST('year','int');
|
||||||
|
if (empty($year))
|
||||||
|
{
|
||||||
|
$year_current = strftime("%Y",dol_now());
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year_current - ($nbofyear - 1);
|
||||||
|
} else {
|
||||||
|
$year_current = $year;
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year - ($nbofyear - 1);
|
||||||
|
}
|
||||||
|
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
|
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
|
// We define date_start and date_end
|
||||||
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
|
{
|
||||||
|
$q=GETPOST("q")?GETPOST("q"):0;
|
||||||
|
if ($q==0)
|
||||||
|
{
|
||||||
|
// We define date_start and date_end
|
||||||
|
$year_end=$year_start + ($nbofyear - 1);
|
||||||
|
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
if (! GETPOST('month'))
|
||||||
|
{
|
||||||
|
if (! GETPOST("year") && $month_start > $month_current)
|
||||||
|
{
|
||||||
|
$year_start--;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$month_end=$month_start-1;
|
||||||
|
if ($month_end < 1) $month_end=12;
|
||||||
|
else $year_end++;
|
||||||
|
}
|
||||||
|
else $month_end=$month_start;
|
||||||
|
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||||
|
}
|
||||||
|
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||||
|
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||||
|
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||||
|
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($date_start < dol_time_plus_duree($date_end, -1, 'y')) || ($date_start > $date_end))
|
||||||
|
{
|
||||||
|
$date_end = dol_time_plus_duree($date_start - 1, 1, 'y');
|
||||||
|
}
|
||||||
|
|
||||||
|
// $date_start and $date_end are defined. We force $start_year and $nbofyear
|
||||||
|
$tmps=dol_getdate($date_start);
|
||||||
|
$start_year = $tmps['year'];
|
||||||
|
$tmpe=dol_getdate($date_end);
|
||||||
|
$year_end = $tmpe['year'];
|
||||||
|
$nbofyear = ($year_end - $start_year) + 1;
|
||||||
|
|
||||||
|
$date_start_previous = dol_time_plus_duree($date_start, -1, 'y');
|
||||||
|
$date_end_previous = dol_time_plus_duree($date_end, -1, 'y');
|
||||||
|
|
||||||
|
//var_dump($date_start." ".$date_end." ".$date_start_previous." ".$date_end_previous." ".$nbofyear);
|
||||||
|
|
||||||
|
|
||||||
|
if($cat_id == 0){
|
||||||
|
$cat_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
|
||||||
|
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||||
|
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
|
||||||
|
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
accessforbidden();
|
||||||
|
if (! $user->rights->accounting->comptarapport->lire)
|
||||||
|
accessforbidden();
|
||||||
|
|
||||||
|
$AccCat = new AccountancyCategory($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxheader('', $langs->trans('ReportInOut'));
|
||||||
|
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year - 1) . '">' . img_previous() . '</a>';
|
||||||
|
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year + 1) . '">' . img_next() . '</a>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Affiche en-tete de rapport
|
||||||
|
if ($modecompta=="CREANCES-DETTES")
|
||||||
|
{
|
||||||
|
$name=$langs->trans("AnnualByAccountDueDebtMode");
|
||||||
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">','</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='<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("RulesResultDue");
|
||||||
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
|
else $description.= $langs->trans("DepositsAreIncluded");
|
||||||
|
$builddate=time();
|
||||||
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES") {
|
||||||
|
$name=$langs->trans("AnnualByAccountInputOutputMode");
|
||||||
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">','</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);
|
||||||
|
//$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();
|
||||||
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups");
|
||||||
|
$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.=' '.$langs->trans("DetailByAccount").' '. $form->selectyesno('simple_report',$simple_report,0);
|
||||||
|
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
|
||||||
|
$exportlink = '';
|
||||||
|
$description=$langs->trans("RulesResultBookkeepingPersonalized", $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();
|
||||||
|
}
|
||||||
|
|
||||||
|
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
|
||||||
|
|
||||||
|
|
||||||
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
|
{
|
||||||
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$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("SelectedPeriod").'</th>';
|
||||||
|
foreach($months as $k => $v){
|
||||||
|
print '<th class="liste_titre" align="right">'.$langs->trans($v).'</th>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
if ($modecompta == 'CREANCES-DETTES')
|
||||||
|
{
|
||||||
|
//if (! empty($date_start) && ! empty($date_end))
|
||||||
|
// $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
|
//if (! empty($date_start) && ! empty($date_end))
|
||||||
|
// $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||||
|
|
||||||
|
$j=1;
|
||||||
|
$sommes = array();
|
||||||
|
|
||||||
|
foreach ($cats as $cat) // Loop on each group
|
||||||
|
{
|
||||||
|
if (!empty($cat['category_type'])) // category calculed
|
||||||
|
{
|
||||||
|
$formula = $cat['formula'];
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
//print '<td colspan="2"><font color="blue">' . $cat['label'] . '</font></td>';
|
||||||
|
print '<td colspan="2">' . $cat['label'] . '</td>';
|
||||||
|
|
||||||
|
$vars = array();
|
||||||
|
|
||||||
|
// Previous Fiscal year (N-1)
|
||||||
|
foreach($sommes as $code => $det){
|
||||||
|
$vars[$code] = $det['NP'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = strtr($formula, $vars);
|
||||||
|
|
||||||
|
|
||||||
|
$r = $AccCat->calculate($result);
|
||||||
|
|
||||||
|
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
|
||||||
|
$code = $cat['code']; // code categorie de calcule
|
||||||
|
$sommes[$code]['NP'] += $r;
|
||||||
|
|
||||||
|
// Current fiscal year (N)
|
||||||
|
if (is_array($sommes) && ! empty($sommes)){
|
||||||
|
foreach($sommes as $code => $det){
|
||||||
|
$vars[$code] = $det['N'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = strtr($formula, $vars);
|
||||||
|
|
||||||
|
$r = $AccCat->calculate($result);
|
||||||
|
|
||||||
|
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
|
||||||
|
$sommes[$code]['N'] += $r;
|
||||||
|
|
||||||
|
// Detail by month
|
||||||
|
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>';
|
||||||
|
$sommes[$code]['M'][$k] += $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else // normal category
|
||||||
|
{
|
||||||
|
$totCat = array();
|
||||||
|
$totCat['NP'] = 0;
|
||||||
|
$totCat['N'] = 0;
|
||||||
|
$totCat['M'] = array();
|
||||||
|
foreach($months as $k => $v)
|
||||||
|
{
|
||||||
|
$totCat['M'][$k] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get cpts of category/group
|
||||||
|
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
|
||||||
|
// Column group
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $cat['label'];
|
||||||
|
if (count($cpts) > 0)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
foreach($cpts as $cpt)
|
||||||
|
{
|
||||||
|
if ($i > 5)
|
||||||
|
{
|
||||||
|
print '...)';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($i > 0) print ', ';
|
||||||
|
else print ' (';
|
||||||
|
print $cpt['account_number'];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($i <= 5) print ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' - <span class="warning">'.$langs->trans("GroupIsEmptyCheckSetup").'</span>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
$code = $cat['code'];
|
||||||
|
|
||||||
|
// Column N Previous and N
|
||||||
|
foreach($cpts as $i => $cpt)
|
||||||
|
{
|
||||||
|
// N-1
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totCat['NP'] += $resultNP;
|
||||||
|
$totCat['N'] += $resultN;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$totCat['M'][$k] += $resultM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
||||||
|
print '<td align="right">' . price($totCat['N']) . '</td>';
|
||||||
|
|
||||||
|
foreach($totCat['M'] as $k => $v){
|
||||||
|
print '<td align="right">' . price($v) . '</td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
//
|
||||||
|
foreach($cpts as $i => $cpt)
|
||||||
|
{
|
||||||
|
// N-1
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
|
||||||
|
|
||||||
|
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> ' . 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') {
|
||||||
|
print '<td align="right">' . price($resultM) . '</td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($simple_report == 'yes') {
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -27,7 +27,7 @@ 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/tax.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
@ -143,12 +143,14 @@ foreach($allparams as $key => $value) {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
// Show report header
|
// Show report header
|
||||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
|
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
|
||||||
|
|
||||||
if ($modecompta=="CREANCES-DETTES") {
|
if ($modecompta=="CREANCES-DETTES") {
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
@ -176,14 +178,17 @@ if ($modecompta=="CREANCES-DETTES") {
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
}
|
}
|
||||||
|
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$name=array();
|
||||||
|
|
||||||
// SQL request
|
// SQL request
|
||||||
$catotal=0;
|
$catotal=0;
|
||||||
$catotal_ht=0;
|
$catotal_ht=0;
|
||||||
|
|||||||
@ -131,12 +131,11 @@ foreach($allparams as $key => $value) {
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
// Show report header
|
// Show report header
|
||||||
if ($modecompta=="CREANCES-DETTES") {
|
if ($modecompta=="CREANCES-DETTES") {
|
||||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</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);
|
$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);
|
||||||
@ -147,7 +146,7 @@ if ($modecompta=="CREANCES-DETTES") {
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
} else {
|
} else {
|
||||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&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);
|
$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);
|
||||||
@ -160,14 +159,16 @@ if ($modecompta=="CREANCES-DETTES") {
|
|||||||
$moreparam=array();
|
$moreparam=array();
|
||||||
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||||
|
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$name=array();
|
||||||
|
|
||||||
// Show array
|
// Show array
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
// Extra parameters management
|
// Extra parameters management
|
||||||
|
|||||||
@ -32,7 +32,7 @@ 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.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
@ -165,7 +165,7 @@ $formother = new FormOther($db);
|
|||||||
// Show report header
|
// Show report header
|
||||||
if ($modecompta=="CREANCES-DETTES")
|
if ($modecompta=="CREANCES-DETTES")
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</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);
|
$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);
|
||||||
@ -176,7 +176,7 @@ if ($modecompta=="CREANCES-DETTES")
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
} else {
|
} else {
|
||||||
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&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);
|
$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);
|
||||||
@ -187,14 +187,16 @@ if ($modecompta=="CREANCES-DETTES")
|
|||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$name=array();
|
||||||
|
|
||||||
// Show Array
|
// Show Array
|
||||||
$catotal=0;
|
$catotal=0;
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
|
|||||||
@ -25,21 +25,69 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||||
|
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');
|
||||||
|
|
||||||
$year_start=GETPOST("year_start");
|
|
||||||
$year_current = strftime("%Y",time());
|
|
||||||
$nbofyear=4;
|
$nbofyear=4;
|
||||||
if (! $year_start) {
|
|
||||||
$year_start = $year_current - ($nbofyear-1);
|
// Date range
|
||||||
$year_end = $year_current;
|
$year=GETPOST('year','int');
|
||||||
|
if (empty($year))
|
||||||
|
{
|
||||||
|
$year_current = strftime("%Y",dol_now());
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year_current - ($nbofyear - 1);
|
||||||
|
} else {
|
||||||
|
$year_current = $year;
|
||||||
|
$month_current = strftime("%m",dol_now());
|
||||||
|
$year_start = $year - ($nbofyear - 1);
|
||||||
}
|
}
|
||||||
else {
|
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$year_end=$year_start + ($nbofyear-1);
|
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
|
// We define date_start and date_end
|
||||||
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
|
{
|
||||||
|
$q=GETPOST("q")?GETPOST("q"):0;
|
||||||
|
if ($q==0)
|
||||||
|
{
|
||||||
|
// We define date_start and date_end
|
||||||
|
$year_end=$year_start + ($nbofyear - 1);
|
||||||
|
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
if (! GETPOST('month'))
|
||||||
|
{
|
||||||
|
if (! GETPOST("year") && $month_start > $month_current)
|
||||||
|
{
|
||||||
|
$year_start--;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$month_end=$month_start-1;
|
||||||
|
if ($month_end < 1) $month_end=12;
|
||||||
|
else $year_end++;
|
||||||
|
}
|
||||||
|
else $month_end=$month_start;
|
||||||
|
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||||
|
}
|
||||||
|
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||||
|
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||||
|
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||||
|
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
$userid=GETPOST('userid','int');
|
$userid=GETPOST('userid','int');
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
|
||||||
|
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
|
||||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||||
|
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
|
||||||
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
|
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -55,16 +103,17 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
// Affiche en-tete du rapport
|
// Affiche en-tete du rapport
|
||||||
if ($modecompta=="CREANCES-DETTES")
|
if ($modecompta=="CREANCES-DETTES")
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("SalesTurnover");
|
$name=$langs->trans("SalesTurnover");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$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_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
$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("RulesCADue");
|
$description=$langs->trans("RulesCADue");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
@ -74,11 +123,11 @@ if ($modecompta=="CREANCES-DETTES")
|
|||||||
}
|
}
|
||||||
else if ($modecompta=="RECETTES-DEPENSES")
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("SalesTurnover");
|
$name=$langs->trans("SalesTurnover");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$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_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
$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("RulesCAIn");
|
||||||
$description.= $langs->trans("DepositsAreIncluded");
|
$description.= $langs->trans("DepositsAreIncluded");
|
||||||
@ -87,23 +136,24 @@ else if ($modecompta=="RECETTES-DEPENSES")
|
|||||||
}
|
}
|
||||||
else if ($modecompta=="BOOKKEEPING")
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("BookkeepingTurnover");
|
$name=$langs->trans("SalesTurnover");
|
||||||
$calcmode=$langs->trans("CalcModeBookkeeping");
|
$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("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>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$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_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
$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("RulesCABookkeeping");
|
$description=$langs->trans("RulesCADue");
|
||||||
$description.= $langs->trans("DepositsAreIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||||
|
else $description.= $langs->trans("DepositsAreIncluded");
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
$moreparam=array();
|
$moreparam=array();
|
||||||
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
|
|||||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
|
|||||||
@ -133,7 +133,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
|||||||
// Affiche en-tete du rapport
|
// Affiche en-tete du rapport
|
||||||
if ($modetax==1) // Calculate on invoice for goods and services
|
if ($modetax==1) // Calculate on invoice for goods and services
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("VATReportByQuartersInDueDebtMode");
|
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
$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=$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);
|
||||||
@ -172,7 +172,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
|||||||
}
|
}
|
||||||
if ($modetax==0) // Invoice for goods, payment for services
|
if ($modetax==0) // Invoice for goods, payment for services
|
||||||
{
|
{
|
||||||
$nom=$langs->trans("VATReportByQuartersInInputOutputMode");
|
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
$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=$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);
|
||||||
@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services
|
|||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
|
|
||||||
}
|
}
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
|
|||||||
@ -146,7 +146,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
|||||||
|
|
||||||
// Affiche en-tete du rapport
|
// Affiche en-tete du rapport
|
||||||
if ($modetax==1) { // Calculate on invoice for goods and services
|
if ($modetax==1) { // Calculate on invoice for goods and services
|
||||||
$nom=$langs->trans("VATReportByQuartersInDueDebtMode");
|
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
$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=$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);
|
||||||
@ -195,7 +195,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($modetax==0) { // Invoice for goods, payment for services
|
if ($modetax==0) { // Invoice for goods, payment for services
|
||||||
$nom=$langs->trans("VATReportByQuartersInInputOutputMode");
|
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
$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=$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);
|
||||||
@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
|
|||||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
$vatcust=$langs->trans("VATReceived");
|
$vatcust=$langs->trans("VATReceived");
|
||||||
$vatsup=$langs->trans("VATPaid");
|
$vatsup=$langs->trans("VATPaid");
|
||||||
|
|||||||
@ -628,9 +628,10 @@ class Form
|
|||||||
* @param string $htmloption Options html on select object
|
* @param string $htmloption Options html on select object
|
||||||
* @param integer $maxlength Max length for labels (0=no limit)
|
* @param integer $maxlength Max length for labels (0=no limit)
|
||||||
* @param string $morecss More css class
|
* @param string $morecss More css class
|
||||||
|
* @param string $usecodeaskey 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||||
* @return string HTML string with select
|
* @return string HTML string with select
|
||||||
*/
|
*/
|
||||||
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300')
|
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300',$usecodeaskey='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -684,11 +685,11 @@ class Form
|
|||||||
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
|
||||||
{
|
{
|
||||||
$foundselected=true;
|
$foundselected=true;
|
||||||
$out.= '<option value="'.$row['rowid'].'" selected>';
|
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.= '<option value="'.$row['rowid'].'">';
|
$out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
|
||||||
}
|
}
|
||||||
$out.= dol_trunc($row['label'],$maxlength,'middle');
|
$out.= dol_trunc($row['label'],$maxlength,'middle');
|
||||||
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';
|
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';
|
||||||
|
|||||||
@ -304,7 +304,7 @@ class FormActions
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.=$form->selectarray($htmlname, $arraylist, $selected);
|
$out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
|
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
|
||||||
|
|||||||
@ -3284,11 +3284,12 @@ function dol_print_error_email($prefixcode, $errormessage='')
|
|||||||
* @param string $sortfield Current field used to sort
|
* @param string $sortfield Current field used to sort
|
||||||
* @param string $sortorder Current sort order
|
* @param string $sortorder Current sort order
|
||||||
* @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.
|
||||||
|
* @param string $tooltip Tooltip
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="")
|
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
|
||||||
{
|
{
|
||||||
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix);
|
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix, 0, $tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3305,11 +3306,12 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
|
|||||||
* @param string $sortorder Current sort order (Ex: 'asc,desc')
|
* @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.
|
||||||
* @param string $disablesortlink 1=Disable sort link
|
* @param string $disablesortlink 1=Disable sort link
|
||||||
|
* @param string $tooltip Tooltip
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0)
|
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $form;
|
||||||
//print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder<br>\n";
|
//print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder<br>\n";
|
||||||
|
|
||||||
$sortorder=strtoupper($sortorder);
|
$sortorder=strtoupper($sortorder);
|
||||||
@ -3350,7 +3352,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.=$langs->trans($name);
|
if ($tooltip) $out.=$form->textwithpicto($langs->trans($name), $langs->trans($tooltip));
|
||||||
|
else $out.=$langs->trans($name);
|
||||||
|
|
||||||
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field
|
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field
|
||||||
{
|
{
|
||||||
|
|||||||
@ -249,10 +249,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
-- Balance
|
-- Balance
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
||||||
-- Reports
|
-- Reports
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPredefinedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPersonalizedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
|
||||||
|
|||||||
@ -1118,11 +1118,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
// Reports
|
// Reports
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
|
|
||||||
$newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
|
$newmenu->add("/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
|
||||||
|
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByPredefinedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByPersonalizedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,6 @@
|
|||||||
-- Categories compte de résultat Français
|
-- Categories compte de résultat Français
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE', 'Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VTE', 'Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR', 'Coût achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'MAR', 'Coût achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'MARGE', 'Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
|
||||||
@ -203,3 +203,30 @@ ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
|
|||||||
|
|
||||||
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
|
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
|
||||||
|
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_KO' where name = 'PAYPAL_MESSAGE_KO';
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_CREDITOR' where name = 'PAYPAL_CREDITOR';
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_CSS_URL' where name = 'PAYPAL_CSS_URL';
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NEWFORMTEXT';
|
||||||
|
UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO';
|
||||||
|
|
||||||
|
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'PROD';
|
||||||
|
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE';
|
||||||
|
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
|
||||||
|
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS';
|
||||||
|
|
||||||
|
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8;
|
||||||
|
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;
|
||||||
|
|||||||
@ -31,6 +31,10 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account
|
|||||||
JournalizationInLedgerStatus=Status of journalization
|
JournalizationInLedgerStatus=Status of journalization
|
||||||
AlreadyInGeneralLedger=Already journalized in ledgers
|
AlreadyInGeneralLedger=Already journalized in ledgers
|
||||||
NotYetInGeneralLedger=Not yet 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
|
||||||
|
DetailByAccount=Show detail by account
|
||||||
|
|
||||||
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
|
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
|
||||||
MainAccountForSuppliersNotDefined=Main accounting account for suppliers not defined in setup
|
MainAccountForSuppliersNotDefined=Main accounting account for suppliers not defined in setup
|
||||||
@ -150,7 +154,10 @@ NumPiece=Piece number
|
|||||||
TransactionNumShort=Num. transaction
|
TransactionNumShort=Num. transaction
|
||||||
AccountingCategory=Accounting account groups
|
AccountingCategory=Accounting account groups
|
||||||
GroupByAccountAccounting=Group by accounting account
|
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 your groups.
|
||||||
ByAccounts=By accounts
|
ByAccounts=By accounts
|
||||||
|
ByPredefinedAccountGroups=By predefined groups
|
||||||
|
ByPersonalizedAccountGroups=By personalized groups
|
||||||
NotMatch=Not Set
|
NotMatch=Not Set
|
||||||
DeleteMvt=Delete Ledger lines
|
DeleteMvt=Delete Ledger lines
|
||||||
DelYear=Year to delete
|
DelYear=Year to delete
|
||||||
@ -180,8 +187,9 @@ ListAccounts=List of the accounting accounts
|
|||||||
UnknownAccountForThirdparty=Unknown third party account. We will use %s
|
UnknownAccountForThirdparty=Unknown third party account. We will use %s
|
||||||
UnknownAccountForThirdpartyBlocking=Unknown third party account. Blocking error
|
UnknownAccountForThirdpartyBlocking=Unknown third party account. Blocking error
|
||||||
|
|
||||||
Pcgtype=Class of account
|
Pcgtype=Group of account
|
||||||
Pcgsubtype=Subclass of account
|
Pcgsubtype=Subgroup of account
|
||||||
|
PcgtypeDesc=Group and subgroup of account are used as predefined 'filter' and 'grouping' criterias for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as group for accounting account products to build the expense/income report.
|
||||||
|
|
||||||
TotalVente=Total turnover before tax
|
TotalVente=Total turnover before tax
|
||||||
TotalMarge=Total sales margin
|
TotalMarge=Total sales margin
|
||||||
|
|||||||
@ -134,6 +134,7 @@ CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
|
|||||||
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
|
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
|
||||||
CalcModeDebt=Mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
|
CalcModeDebt=Mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
|
||||||
CalcModeEngagement=Mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>
|
CalcModeEngagement=Mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>
|
||||||
|
CalcModeBookkeeping=Analysis of <b>data journalized in Bookkeeping Ledger table</b>
|
||||||
CalcModeLT1= Mode <b>%sRE on customer invoices - suppliers invoices%s</b>
|
CalcModeLT1= Mode <b>%sRE on customer invoices - suppliers invoices%s</b>
|
||||||
CalcModeLT1Debt=Mode <b>%sRE on customer invoices%s</b>
|
CalcModeLT1Debt=Mode <b>%sRE on customer invoices%s</b>
|
||||||
CalcModeLT1Rec= Mode <b>%sRE on suppliers invoices%s</b>
|
CalcModeLT1Rec= Mode <b>%sRE on suppliers invoices%s</b>
|
||||||
@ -142,15 +143,20 @@ CalcModeLT2Debt=Mode <b>%sIRPF on customer invoices%s</b>
|
|||||||
CalcModeLT2Rec= Mode <b>%sIRPF on suppliers invoices%s</b>
|
CalcModeLT2Rec= Mode <b>%sIRPF on suppliers invoices%s</b>
|
||||||
AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary
|
AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary
|
||||||
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary
|
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary
|
||||||
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
|
AnnualByCompanies=Income / Expenses, By predefined groups of account
|
||||||
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
|
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
|
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
|
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
|
||||||
RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included
|
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.
|
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.
|
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>
|
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>
|
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)
|
||||||
DepositsAreNotIncluded=- Down payment invoices are nor included
|
DepositsAreNotIncluded=- Down payment invoices are nor included
|
||||||
DepositsAreIncluded=- Down payment invoices are included
|
DepositsAreIncluded=- Down payment invoices are included
|
||||||
LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF
|
LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF
|
||||||
@ -225,3 +231,4 @@ ImportDataset_tax_vat=Vat payments
|
|||||||
ErrorBankAccountNotFound=Error: Bank account not found
|
ErrorBankAccountNotFound=Error: Bank account not found
|
||||||
FiscalPeriod=Accounting period
|
FiscalPeriod=Accounting period
|
||||||
ListSocialContributionAssociatedProject=List of social contributions associated with the project
|
ListSocialContributionAssociatedProject=List of social contributions associated with the project
|
||||||
|
DeleteFromCat=Remove from accounting group
|
||||||
|
|||||||
@ -10,7 +10,7 @@ ToComplete=To complete
|
|||||||
YourEMail=Email to receive payment confirmation
|
YourEMail=Email to receive payment confirmation
|
||||||
Creditor=Creditor
|
Creditor=Creditor
|
||||||
PaymentCode=Payment code
|
PaymentCode=Payment code
|
||||||
PayBoxDoPayment=Go on payment
|
PayBoxDoPayment=Pay with Credit or Debit Card (Paybox)
|
||||||
ToPay=Do payment
|
ToPay=Do payment
|
||||||
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
|
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
|
||||||
Continue=Next
|
Continue=Next
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Dolibarr language file - Source file is en_US - paypal
|
# Dolibarr language file - Source file is en_US - paypal
|
||||||
PaypalSetup=PayPal module setup
|
PaypalSetup=PayPal module setup
|
||||||
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
|
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
|
||||||
PaypalOrCBDoPayment=Pay with credit card or Paypal
|
PaypalOrCBDoPayment=Pay with Paypal (Credit Card or Paypal)
|
||||||
PaypalDoPayment=Pay with Paypal
|
PaypalDoPayment=Pay with Paypal
|
||||||
PAYPAL_API_SANDBOX=Mode test/sandbox
|
PAYPAL_API_SANDBOX=Mode test/sandbox
|
||||||
PAYPAL_API_USER=API username
|
PAYPAL_API_USER=API username
|
||||||
@ -11,14 +11,14 @@ PAYPAL_SSLVERSION=Curl SSL Version
|
|||||||
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
|
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
|
||||||
PaypalModeIntegral=Integral
|
PaypalModeIntegral=Integral
|
||||||
PaypalModeOnlyPaypal=PayPal only
|
PaypalModeOnlyPaypal=PayPal only
|
||||||
PAYPAL_CSS_URL=Optionnal URL of CSS style sheet on payment page
|
ONLINE_PAYMENT_CSS_URL=Optionnal URL of CSS style sheet on online payment page
|
||||||
ThisIsTransactionId=This is id of transaction: <b>%s</b>
|
ThisIsTransactionId=This is id of transaction: <b>%s</b>
|
||||||
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
|
PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail
|
||||||
PredefinedMailContentLink=You can click on the secure link below to make your payment (PayPal) if it is not already done.\n\n%s\n\n
|
PredefinedMailContentLink=You can click on the secure link below to make your payment (PayPal) if it is not already done.\n\n%s\n\n
|
||||||
YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode
|
YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
|
||||||
NewOnlinePaymentReceived=New online payment received
|
NewOnlinePaymentReceived=New online payment received
|
||||||
NewOnlinePaymentFailed=New online payment tried but failed
|
NewOnlinePaymentFailed=New online payment tried but failed
|
||||||
PAYPAL_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
ONLINE_PAYMENT_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||||
ReturnURLAfterPayment=Return URL after payment
|
ReturnURLAfterPayment=Return URL after payment
|
||||||
ValidationOfOnlinePaymentFailed=Validation of online payment failed
|
ValidationOfOnlinePaymentFailed=Validation of online payment failed
|
||||||
PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error
|
PaymentSystemConfirmPaymentPageWasCalledButFailed=Payment confirmation page was called by payment system returned an error
|
||||||
|
|||||||
@ -12,7 +12,7 @@ YourEMail=Email to receive payment confirmation
|
|||||||
STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
STRIPE_PAYONLINE_SENDEMAIL=EMail to warn after a payment (success or not)
|
||||||
Creditor=Creditor
|
Creditor=Creditor
|
||||||
PaymentCode=Payment code
|
PaymentCode=Payment code
|
||||||
StripeDoPayment=Go on payment
|
StripeDoPayment=Pay with Credit or Debit Card (Stripe)
|
||||||
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
|
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
|
||||||
Continue=Next
|
Continue=Next
|
||||||
ToOfferALinkForOnlinePayment=URL for %s payment
|
ToOfferALinkForOnlinePayment=URL for %s payment
|
||||||
|
|||||||
@ -69,6 +69,7 @@ class MyObject extends CommonObject
|
|||||||
* 'position' is the sort order of field.
|
* 'position' is the sort order of field.
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'help' is a string visible as a tooltip on field
|
||||||
* 'comment' is not used. You can store here any text of your choice.
|
* 'comment' is not used. You can store here any text of your choice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ class MyObject extends CommonObject
|
|||||||
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1),
|
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
|
||||||
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000),
|
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
|
|||||||
@ -53,15 +53,15 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",GETPOST('PAYBOX_PBX_IDENTIFIANT','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",GETPOST('PAYBOX_PBX_IDENTIFIANT','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_CREDITOR",GETPOST('PAYBOX_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_CSS_URL",GETPOST('PAYBOX_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_OK",GETPOST('PAYBOX_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_KO",GETPOST('ONLINE_PAYMENT_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -170,35 +170,35 @@ print '</td></tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("VendorName").'</td><td>';
|
print $langs->trans("VendorName").'</td><td>';
|
||||||
print '<input size="64" type="text" name="PAYBOX_CREDITOR" value="'.$conf->global->PAYBOX_CREDITOR.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
|
||||||
print '<br>'.$langs->trans("Example").': '.$mysoc->name;
|
print '<br>'.$langs->trans("Example").': '.$mysoc->name;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||||
print '<input size="64" type="text" name="PAYBOX_CSS_URL" value="'.$conf->global->PAYBOX_CSS_URL.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||||
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
|
print '<br>'.$langs->trans("Example").': http://mysite/mycss.css';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageOK").'</td><td>';
|
print $langs->trans("MessageOK").'</td><td>';
|
||||||
$doleditor=new DolEditor('PAYBOX_MESSAGE_OK',$conf->global->PAYBOX_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageKO").'</td><td>';
|
print $langs->trans("MessageKO").'</td><td>';
|
||||||
$doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
|
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||||
print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
|
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -52,11 +52,11 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_SSLVERSION",GETPOST('PAYPAL_SSLVERSION','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "PAYPAL_SSLVERSION",GETPOST('PAYPAL_SSLVERSION','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_CREDITOR",GETPOST('PAYPAL_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_CSS_URL",GETPOST('PAYPAL_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST('PAYPAL_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST('PAYPAL_SECURITY_TOKEN','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
@ -64,11 +64,11 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST('PAYPAL_ADD_PAYMENT_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST('PAYPAL_MESSAGE_OK'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -202,14 +202,14 @@ print '</td></tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("VendorName").'</td><td>';
|
print $langs->trans("VendorName").'</td><td>';
|
||||||
print '<input size="64" type="text" name="PAYPAL_CREDITOR" value="'.$conf->global->PAYPAL_CREDITOR.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
|
||||||
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||||
print '<input size="64" type="text" name="PAYPAL_CSS_URL" value="'.$conf->global->PAYPAL_CSS_URL.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||||
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -222,21 +222,21 @@ print '</td></tr>';
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageOK").'</td><td>';
|
print $langs->trans("MessageOK").'</td><td>';
|
||||||
$doleditor=new DolEditor('PAYPAL_MESSAGE_OK',$conf->global->PAYPAL_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageKO").'</td><td>';
|
print $langs->trans("MessageKO").'</td><td>';
|
||||||
$doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
|
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||||
print '<input size="32" type="email" name="PAYPAL_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYPAL_PAYONLINE_SENDEMAIL.'">';
|
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -355,7 +355,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
|
|||||||
if (! empty($desc)) $nvpstr = $nvpstr . "&DESC=" . urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
|
if (! empty($desc)) $nvpstr = $nvpstr . "&DESC=" . urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC
|
||||||
|
|
||||||
|
|
||||||
$_SESSION["Payment_Amount"] = $paymentAmount;
|
$_SESSION["FinalPaymentAmt"] = $paymentAmount;
|
||||||
$_SESSION["currencyCodeType"] = $currencyCodeType;
|
$_SESSION["currencyCodeType"] = $currencyCodeType;
|
||||||
$_SESSION["PaymentType"] = $paymentType;
|
$_SESSION["PaymentType"] = $paymentType;
|
||||||
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR ']; // Payer ip
|
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR ']; // Payer ip
|
||||||
|
|||||||
@ -164,7 +164,7 @@ print '<!-- Form to sign -->'."\n";
|
|||||||
|
|
||||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
// Define logo and logosmall
|
// Define logo and logosmall
|
||||||
$logosmall=$mysoc->logo_small;
|
$logosmall=$mysoc->logo_small;
|
||||||
|
|||||||
@ -162,7 +162,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -171,9 +171,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
|
|||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='PAYBOX_CREDITOR_'.$suffix;
|
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR;
|
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||||
|
|
||||||
// Check link validity
|
// Check link validity
|
||||||
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
@ -194,7 +194,7 @@ print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">';
|
|||||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">';
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">';
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a Paybox payment -->'."\n";
|
print '<!-- Form to send a Paybox payment -->'."\n";
|
||||||
print '<!-- PAYBOX_CREDITOR = '.$conf->global->PAYPAL_CREDITOR.' -->'."\n";
|
print '<!-- ONLINE_PAYMENT_CREDITOR = '.$conf->global->ONLINE_PAYMENT_CREDITOR.' -->'."\n";
|
||||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||||
print '<!-- urlok = '.$urlok.' -->'."\n";
|
print '<!-- urlok = '.$urlok.' -->'."\n";
|
||||||
print '<!-- urlko = '.$urlko.' -->'."\n";
|
print '<!-- urlko = '.$urlko.' -->'."\n";
|
||||||
@ -202,14 +202,14 @@ print "\n";
|
|||||||
|
|
||||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
// Define logo and logosmall
|
// Define logo and logosmall
|
||||||
$logosmall=$mysoc->logo_small;
|
$logosmall=$mysoc->logo_small;
|
||||||
$logo=$mysoc->logo;
|
$logo=$mysoc->logo;
|
||||||
$paramlogo='PAYBOX_LOGO_'.$suffix;
|
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||||
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||||
// Define urllogo
|
// Define urllogo
|
||||||
$urllogo='';
|
$urllogo='';
|
||||||
@ -234,11 +234,11 @@ if ($urllogo)
|
|||||||
|
|
||||||
// Output introduction text
|
// Output introduction text
|
||||||
$text='';
|
$text='';
|
||||||
if (! empty($conf->global->PAYBOX_NEWFORM_TEXT))
|
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||||
{
|
{
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYBOX_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||||
else $text.=$conf->global->PAYBOX_NEWFORM_TEXT."<br>\n";
|
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
|
|||||||
@ -82,7 +82,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
|
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -156,7 +156,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
|||||||
|
|
||||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>\n";
|
||||||
|
|
||||||
if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
|
|||||||
|
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -105,7 +105,7 @@ $fulltag = $FULLTAG;
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$payment
|
|||||||
|
|
||||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
|
print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n";
|
||||||
|
|
||||||
if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||||
|
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
@ -127,9 +127,9 @@ if ($result < 0) { $error++; $errors=$interface->errors; }
|
|||||||
|
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||||
{
|
{
|
||||||
$sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
|||||||
@ -16,8 +16,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For paypal test: https://developer.paypal.com/
|
* For Paypal test: https://developer.paypal.com/
|
||||||
* For paybox test: ???
|
* For Paybox test: ???
|
||||||
|
* For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +53,7 @@ $langs->load("companies");
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("paybox"); // File with generic data
|
$langs->load("paybox"); // File with generic data
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','aZ09');
|
||||||
|
|
||||||
// Input are:
|
// Input are:
|
||||||
// type ('invoice','order','contractline'),
|
// type ('invoice','order','contractline'),
|
||||||
@ -160,6 +161,7 @@ if (! empty($conf->paypal->enabled))
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
$PAYPAL_API_OK="";
|
$PAYPAL_API_OK="";
|
||||||
if ($urlok) $PAYPAL_API_OK=$urlok;
|
if ($urlok) $PAYPAL_API_OK=$urlok;
|
||||||
$PAYPAL_API_KO="";
|
$PAYPAL_API_KO="";
|
||||||
@ -180,29 +182,6 @@ if (! empty($conf->paypal->enabled))
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check security token
|
|
||||||
$valid=true;
|
|
||||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
|
|
||||||
{
|
|
||||||
if ($SOURCE && $REF) $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . $SOURCE . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical
|
|
||||||
else $token = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$token = $conf->global->PAYPAL_SECURITY_TOKEN;
|
|
||||||
}
|
|
||||||
if ($SECUREKEY != $token) $valid=false;
|
|
||||||
|
|
||||||
if (! $valid)
|
|
||||||
{
|
|
||||||
print '<div class="error">Bad value for key.</div>';
|
|
||||||
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$validpaymentmethod['paypal']='valid';
|
$validpaymentmethod['paypal']='valid';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +194,21 @@ if (! empty($conf->paybox->enabled))
|
|||||||
$validpaymentmethod['paybox']='valid';
|
$validpaymentmethod['paybox']='valid';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add check of other payment mode
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
$langs->load("stripe");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php';
|
||||||
|
/* already included into /stripe/config.php
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
||||||
|
*/
|
||||||
|
|
||||||
|
$validpaymentmethod['stripe']='valid';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check security token
|
// Check security token
|
||||||
@ -242,9 +235,18 @@ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($validpaymentmethod))
|
||||||
|
{
|
||||||
|
print 'No active payment module (Paypal, Stripe, Paybox, ...)';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common variables
|
||||||
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
$creditor=$mysoc->name;
|
||||||
|
$paramcreditor='ONLINE_PAYMENT_CREDITOR';
|
||||||
|
$paramcreditorlong='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||||
|
if (! empty($conf->global->$paramcreditorlong)) $creditor=$conf->global->$paramcreditorlong;
|
||||||
|
else if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -252,7 +254,6 @@ if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'dopayment')
|
if ($action == 'dopayment')
|
||||||
{
|
{
|
||||||
if ($paymentmethod == 'paypal')
|
if ($paymentmethod == 'paypal')
|
||||||
@ -312,7 +313,7 @@ if ($action == 'dopayment')
|
|||||||
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
||||||
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
||||||
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
||||||
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
|
||||||
|
|
||||||
// A redirect is added if API call successfull
|
// A redirect is added if API call successfull
|
||||||
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
||||||
@ -320,6 +321,162 @@ if ($action == 'dopayment')
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($paymentmethod == 'paybox')
|
||||||
|
{
|
||||||
|
$PRICE=price2num(GETPOST("newamount"),'MT');
|
||||||
|
$email=GETPOST("email");
|
||||||
|
|
||||||
|
$origfulltag=GETPOST("fulltag",'alpha');
|
||||||
|
|
||||||
|
$mesg='';
|
||||||
|
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
|
||||||
|
elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
|
||||||
|
elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email);
|
||||||
|
elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
|
||||||
|
elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok;
|
||||||
|
elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko;
|
||||||
|
|
||||||
|
if (empty($mesg))
|
||||||
|
{
|
||||||
|
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
|
||||||
|
|
||||||
|
print_paybox_redirect($PRICE, $conf->currency, $email, $urlok, $urlko, $FULLTAG);
|
||||||
|
|
||||||
|
session_destroy();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($paymentmethod == 'stripe')
|
||||||
|
{
|
||||||
|
if (GETPOST('newamount')) $amount = GETPOST('newamount');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($action == 'charge')
|
||||||
|
{
|
||||||
|
// Correct the amount according to unit of currency
|
||||||
|
// See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support
|
||||||
|
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||||
|
if (! in_array($currency, $arrayzerounitcurrency)) $amount=$amount * 100;
|
||||||
|
|
||||||
|
dol_syslog("POST keys : ".join(',', array_keys($_POST)), LOG_DEBUG, 0, '_stripe');
|
||||||
|
dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe');
|
||||||
|
|
||||||
|
$stripeToken = GETPOST("stripeToken",'alpha');
|
||||||
|
$email = GETPOST("stripeEmail",'alpha');
|
||||||
|
|
||||||
|
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||||
|
dol_syslog("stripeEmail = ".$stripeEmail, LOG_DEBUG, 0, '_stripe');
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
|
||||||
|
$customer = \Stripe\Customer::create(array(
|
||||||
|
'email' => $email,
|
||||||
|
'description' => ($email?'Customer for '.$email:null),
|
||||||
|
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
|
||||||
|
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
|
||||||
|
));
|
||||||
|
// TODO Add 'business_vat_id' ?
|
||||||
|
|
||||||
|
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||||
|
$charge = \Stripe\Charge::create(array(
|
||||||
|
'customer' => $customer->id,
|
||||||
|
'amount' => price2num($amount, 'MU'),
|
||||||
|
'currency' => $currency,
|
||||||
|
'description' => 'Stripe payment: '.$FULLTAG,
|
||||||
|
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name),
|
||||||
|
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
|
||||||
|
));
|
||||||
|
} catch(\Stripe\Error\Card $e) {
|
||||||
|
// Since it's a decline, \Stripe\Error\Card will be caught
|
||||||
|
$body = $e->getJsonBody();
|
||||||
|
$err = $body['error'];
|
||||||
|
|
||||||
|
print('Status is:' . $e->getHttpStatus() . "\n");
|
||||||
|
print('Type is:' . $err['type'] . "\n");
|
||||||
|
print('Code is:' . $err['code'] . "\n");
|
||||||
|
// param is '' in this case
|
||||||
|
print('Param is:' . $err['param'] . "\n");
|
||||||
|
print('Message is:' . $err['message'] . "\n");
|
||||||
|
|
||||||
|
$error++;
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
$action='';
|
||||||
|
} catch (\Stripe\Error\RateLimit $e) {
|
||||||
|
// Too many requests made to the API too quickly
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
} catch (\Stripe\Error\InvalidRequest $e) {
|
||||||
|
// Invalid parameters were supplied to Stripe's API
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
} catch (\Stripe\Error\Authentication $e) {
|
||||||
|
// Authentication with Stripe's API failed
|
||||||
|
// (maybe you changed API keys recently)
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
} catch (\Stripe\Error\ApiConnection $e) {
|
||||||
|
// Network communication with Stripe failed
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
} catch (\Stripe\Error\Base $e) {
|
||||||
|
// Display a very generic error to the user, and maybe send
|
||||||
|
// yourself an email
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Something else happened, completely unrelated to Stripe
|
||||||
|
$error++;
|
||||||
|
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
|
||||||
|
setEventMessages($e->getMessage(), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION["onlinetoken"] = $stripeToken;
|
||||||
|
$_SESSION["FinalPaymentAmt"] = $amount;
|
||||||
|
$_SESSION["currencyCodeType"] = $currency;
|
||||||
|
$_SESSION["paymentType"] = '';
|
||||||
|
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
|
||||||
|
$_SESSION['payerID'] = is_object($customer)?$customer->id:'';
|
||||||
|
$_SESSION['TRANSACTIONID'] = is_object($charge)?$charge->id:'';
|
||||||
|
|
||||||
|
dol_syslog("Action charge stripe result=".$error." ip=".$_SESSION['ipaddress'], LOG_DEBUG, 0, '_stripe');
|
||||||
|
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe');
|
||||||
|
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe');
|
||||||
|
dol_syslog("Now call the redirect to paymentok or paymentko", LOG_DEBUG, 0, '_stripe');
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
header("Location: ".$urlko);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: ".$urlok);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,7 +485,7 @@ if ($action == 'dopayment')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -345,19 +502,17 @@ if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', '
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->paypal->enabled))
|
|
||||||
{
|
|
||||||
// Common variables
|
|
||||||
$creditor=$mysoc->name;
|
|
||||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
|
||||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
|
||||||
|
|
||||||
if (! empty($PAYPAL_API_SANDBOX))
|
// Show sandbox warning
|
||||||
{
|
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_API_SANDBOX))
|
||||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
|
{
|
||||||
}
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning');
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->stripe->enabled) && empty($conf->global->STRIPE_LIVE))
|
||||||
|
{
|
||||||
|
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<span id="dolpaymentspan"></span>'."\n";
|
print '<span id="dolpaymentspan"></span>'."\n";
|
||||||
print '<div class="center">'."\n";
|
print '<div class="center">'."\n";
|
||||||
@ -370,32 +525,35 @@ print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
|||||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a payment -->'."\n";
|
print '<!-- Form to send a payment -->'."\n";
|
||||||
|
print '<!-- creditor = '.$creditor.' -->'."\n";
|
||||||
// Additionnal information for each payment system
|
// Additionnal information for each payment system
|
||||||
if (! empty($conf->paypal->enabled))
|
if (! empty($conf->paypal->enabled))
|
||||||
{
|
{
|
||||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||||
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
|
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
|
||||||
print '<!-- creditor = '.$creditor.' -->'."\n";
|
|
||||||
}
|
}
|
||||||
if (! empty($conf->paybox->enabled))
|
if (! empty($conf->paybox->enabled))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
// TODO Add others
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n";
|
||||||
|
}
|
||||||
print '<!-- urlok = '.$urlok.' -->'."\n";
|
print '<!-- urlok = '.$urlok.' -->'."\n";
|
||||||
print '<!-- urlko = '.$urlko.' -->'."\n";
|
print '<!-- urlko = '.$urlko.' -->'."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
// Define logo and logosmall
|
// Define logo and logosmall
|
||||||
$logosmall=$mysoc->logo_small;
|
$logosmall=$mysoc->logo_small;
|
||||||
$logo=$mysoc->logo;
|
$logo=$mysoc->logo;
|
||||||
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||||
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||||
// Define urllogo
|
// Define urllogo
|
||||||
$urllogo='';
|
$urllogo='';
|
||||||
@ -420,11 +578,11 @@ if ($urllogo)
|
|||||||
|
|
||||||
// Output introduction text
|
// Output introduction text
|
||||||
$text='';
|
$text='';
|
||||||
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
|
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||||
{
|
{
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||||
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
|
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
@ -1067,25 +1225,27 @@ if ($action != 'dopayment')
|
|||||||
|
|
||||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
|
||||||
{
|
{
|
||||||
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
|
print '<br><input class="button buttonpayment buttonpaymentpaypal" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
|
||||||
}
|
}
|
||||||
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
|
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
|
||||||
{
|
{
|
||||||
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
|
print '<br><input class="button buttonpayment buttonpaymentpaypal" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->paybox->enabled))
|
if (! empty($conf->paybox->enabled))
|
||||||
{
|
{
|
||||||
|
print '<br><input class="button buttonpayment buttonpaymentpaybox" type="submit" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Other methods
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
print '<br><input class="button buttonpayment buttonpaymentstripe" type="submit" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error_email('ERRORNEWPAYMENTPAYPAL');
|
dol_print_error_email('ERRORNEWPAYMENT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1101,6 +1261,183 @@ print '</div>'."\n";
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add more content on page for some services
|
||||||
|
if (preg_match('/^dopayment/',$action))
|
||||||
|
{
|
||||||
|
|
||||||
|
// Strip
|
||||||
|
if (GETPOST('dopayment_stripe','alpha'))
|
||||||
|
{
|
||||||
|
// Simple checkout
|
||||||
|
/*
|
||||||
|
print '<script src="https://checkout.stripe.com/checkout.js"
|
||||||
|
class="stripe-button"
|
||||||
|
data-key="'.$stripe['publishable_key'].'"
|
||||||
|
data-amount="'.$ttc.'"
|
||||||
|
data-currency="'.$conf->currency.'"
|
||||||
|
data-description="'.$ref.'">
|
||||||
|
</script>';
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Personalized checkout
|
||||||
|
print '<style>
|
||||||
|
/**
|
||||||
|
* The CSS shown here will not be introduced in the Quickstart guide, but shows
|
||||||
|
* how you can use CSS to style your Element s container.
|
||||||
|
*/
|
||||||
|
.StripeElement {
|
||||||
|
background-color: white;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
box-shadow: 0 1px 3px 0 #e6ebf1;
|
||||||
|
-webkit-transition: box-shadow 150ms ease;
|
||||||
|
transition: box-shadow 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.StripeElement--focus {
|
||||||
|
box-shadow: 0 1px 3px 0 #cfd7df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.StripeElement--invalid {
|
||||||
|
border-color: #fa755a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.StripeElement--webkit-autofill {
|
||||||
|
background-color: #fefde5 !important;
|
||||||
|
}
|
||||||
|
</style>';
|
||||||
|
|
||||||
|
print '
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">';
|
||||||
|
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
|
print '<input type="hidden" name="dopayment_stripe" value="1">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="charge">'."\n";
|
||||||
|
print '<input type="hidden" name="tag" value="'.$TAG.'">'."\n";
|
||||||
|
print '<input type="hidden" name="source" value="'.$SOURCE.'">'."\n";
|
||||||
|
print '<input type="hidden" name="ref" value="'.$REF.'">'."\n";
|
||||||
|
print '<input type="hidden" name="fulltag" value="'.$FULLTAG.'">'."\n";
|
||||||
|
print '<input type="hidden" name="suffix" value="'.$suffix.'">'."\n";
|
||||||
|
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||||
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
|
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
|
||||||
|
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
|
||||||
|
|
||||||
|
print '
|
||||||
|
<table id="dolpaymenttable" summary="Payment form" class="center">
|
||||||
|
<tbody><tr><td class="textpublicpayment">
|
||||||
|
|
||||||
|
<div class="form-row left">
|
||||||
|
<label for="card-element">
|
||||||
|
Credit or debit card
|
||||||
|
</label>
|
||||||
|
<div id="card-element">
|
||||||
|
<!-- a Stripe Element will be inserted here. -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Used to display form errors -->
|
||||||
|
<div id="card-errors" role="alert"></div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<button class="button" id="buttontopay">'.$langs->trans("ToPay").'</button>
|
||||||
|
<img id="hourglasstopay" class="hidden" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/working.gif'.'">
|
||||||
|
</td></tr></tbody></table>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://js.stripe.com/v2/"></script>
|
||||||
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">';
|
||||||
|
?>
|
||||||
|
|
||||||
|
// Create a Stripe client
|
||||||
|
var stripe = Stripe('<?php echo $stripe['publishable_key']; ?>');
|
||||||
|
|
||||||
|
// Create an instance of Elements
|
||||||
|
var elements = stripe.elements();
|
||||||
|
|
||||||
|
// Custom styling can be passed to options when creating an Element.
|
||||||
|
// (Note that this demo uses a wider set of styles than the guide below.)
|
||||||
|
var style = {
|
||||||
|
base: {
|
||||||
|
color: '#32325d',
|
||||||
|
lineHeight: '24px',
|
||||||
|
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
|
||||||
|
fontSmoothing: 'antialiased',
|
||||||
|
fontSize: '16px',
|
||||||
|
'::placeholder': {
|
||||||
|
color: '#aab7c4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
invalid: {
|
||||||
|
color: '#fa755a',
|
||||||
|
iconColor: '#fa755a'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create an instance of the card Element
|
||||||
|
var card = elements.create('card', {style: style});
|
||||||
|
|
||||||
|
// Add an instance of the card Element into the `card-element` <div>
|
||||||
|
card.mount('#card-element');
|
||||||
|
|
||||||
|
// Handle real-time validation errors from the card Element.
|
||||||
|
card.addEventListener('change', function(event) {
|
||||||
|
var displayError = document.getElementById('card-errors');
|
||||||
|
if (event.error) {
|
||||||
|
displayError.textContent = event.error.message;
|
||||||
|
} else {
|
||||||
|
displayError.textContent = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
var form = document.getElementById('payment-form');
|
||||||
|
console.log(form);
|
||||||
|
form.addEventListener('submit', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
stripe.createToken(card).then(function(result) {
|
||||||
|
if (result.error) {
|
||||||
|
// Inform the user if there was an error
|
||||||
|
var errorElement = document.getElementById('card-errors');
|
||||||
|
errorElement.textContent = result.error.message;
|
||||||
|
} else {
|
||||||
|
// Send the token to your server
|
||||||
|
stripeTokenHandler(result.token);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function stripeTokenHandler(token) {
|
||||||
|
// Insert the token ID into the form so it gets submitted to the server
|
||||||
|
var form = document.getElementById('payment-form');
|
||||||
|
var hiddenInput = document.createElement('input');
|
||||||
|
hiddenInput.setAttribute('type', 'hidden');
|
||||||
|
hiddenInput.setAttribute('name', 'stripeToken');
|
||||||
|
hiddenInput.setAttribute('value', token.id);
|
||||||
|
form.appendChild(hiddenInput);
|
||||||
|
|
||||||
|
// Submit the form
|
||||||
|
jQuery('#buttontopay').hide();
|
||||||
|
jQuery('#hourglasstopay').show();
|
||||||
|
console.log("submit");
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print '</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
htmlPrintOnlinePaymentFooter($mysoc,$langs);
|
||||||
|
|
||||||
llxFooter('', 'public');
|
llxFooter('', 'public');
|
||||||
|
|||||||
@ -51,6 +51,7 @@ $langs->load("bills");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("paybox");
|
$langs->load("paybox");
|
||||||
$langs->load("paypal");
|
$langs->load("paypal");
|
||||||
|
$langs->load("stripe");
|
||||||
|
|
||||||
if (! empty($conf->paypal->enabled))
|
if (! empty($conf->paypal->enabled))
|
||||||
{
|
{
|
||||||
@ -59,7 +60,12 @@ if (! empty($conf->paypal->enabled))
|
|||||||
$PAYPALPAYERID=GETPOST('PAYERID');
|
$PAYPALPAYERID=GETPOST('PAYERID');
|
||||||
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
|
||||||
}
|
}
|
||||||
// TODO Other payment method
|
if (! empty($conf->paybox->enabled))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
$FULLTAG=GETPOST('FULLTAG');
|
$FULLTAG=GETPOST('FULLTAG');
|
||||||
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
|
||||||
@ -106,7 +112,7 @@ $object = new stdClass(); // For triggers
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_syslog("Callback url when a PayPal payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
|
dol_syslog("Callback url when an online payment is canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
$tracepost = "";
|
$tracepost = "";
|
||||||
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||||
@ -122,7 +128,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION['FinalPaymentAmt'];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -135,28 +141,9 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->paypal->enabled))
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
$sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
{
|
|
||||||
$sendemail = $conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Send an email
|
|
||||||
if (! empty($conf->paybox->enabled))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
|
|
||||||
{
|
|
||||||
$sendemail = $conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Send an email
|
|
||||||
if (! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL))
|
|
||||||
{
|
|
||||||
$sendemail = $conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
@ -204,7 +191,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -217,7 +204,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
|||||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||||
|
|
||||||
if (! empty($conf->global->PAYMENT_MESSAGE_KO)) print $conf->global->PAYMENT_MESSAGE_KO;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,21 +67,6 @@ if (! empty($conf->paypal->enabled))
|
|||||||
if ($urlok) $PAYPAL_API_OK=$urlok;
|
if ($urlok) $PAYPAL_API_OK=$urlok;
|
||||||
$PAYPAL_API_KO="";
|
$PAYPAL_API_KO="";
|
||||||
if ($urlko) $PAYPAL_API_KO=$urlko;
|
if ($urlko) $PAYPAL_API_KO=$urlko;
|
||||||
if (empty($PAYPAL_API_USER))
|
|
||||||
{
|
|
||||||
dol_print_error('',"Paypal setup param PAYPAL_API_USER not defined");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (empty($PAYPAL_API_PASSWORD))
|
|
||||||
{
|
|
||||||
dol_print_error('',"Paypal setup param PAYPAL_API_PASSWORD not defined");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (empty($PAYPAL_API_SIGNATURE))
|
|
||||||
{
|
|
||||||
dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$PAYPALTOKEN=GETPOST('TOKEN');
|
$PAYPALTOKEN=GETPOST('TOKEN');
|
||||||
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
|
||||||
@ -143,14 +128,14 @@ $object = new stdClass(); // For triggers
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_syslog("Callback url when a payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
|
dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"])?dol_escape_htmltag($_SERVER["QUERY_STRING"]):'')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"])?dol_escape_htmltag($_SERVER["SCRIPT_URI"]):''), LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
$tracepost = "";
|
$tracepost = "";
|
||||||
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
||||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -166,6 +151,8 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
|
|||||||
|
|
||||||
if (! empty($conf->paypal->enabled))
|
if (! empty($conf->paypal->enabled))
|
||||||
{
|
{
|
||||||
|
if ($paymentmethod == 'paypal')
|
||||||
|
{
|
||||||
if ($PAYPALTOKEN)
|
if ($PAYPALTOKEN)
|
||||||
{
|
{
|
||||||
// Get on url call
|
// Get on url call
|
||||||
@ -175,7 +162,7 @@ if (! empty($conf->paypal->enabled))
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -227,8 +214,18 @@ if (! empty($conf->paypal->enabled))
|
|||||||
{
|
{
|
||||||
dol_print_error('','$PAYPALTOKEN not defined');
|
dol_print_error('','$PAYPALTOKEN not defined');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->paybox->enabled))
|
||||||
|
{
|
||||||
|
if ($paymentmethod == 'paybox') $ispaymentok = true; // We call this page only if payment is ok
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->stripe->enabled))
|
||||||
|
{
|
||||||
|
if ($paymentmethod == 'stripe') $ispaymentok = true; // We call this page only if payment is ok
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($ispaymentok)
|
if ($ispaymentok)
|
||||||
@ -240,9 +237,10 @@ if ($ispaymentok)
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
@ -254,14 +252,10 @@ if ($ispaymentok)
|
|||||||
|
|
||||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||||
if (! empty($conf->global->PAYMENT_MESSAGE_OK)) print $conf->global->PAYMENT_MESSAGE_OK;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||||
|
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->global->PAYMENTONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYMENTONLINE_SENDEMAIL;
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
// TODO Remove local option to keep only the generic one ?
|
|
||||||
if ($paymentmethod == 'paypal' && ! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
|
||||||
if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL;
|
|
||||||
if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
@ -333,7 +327,7 @@ else
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
@ -16,7 +16,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For test: https://developer.paypal.com/
|
* For paypal test: https://developer.paypal.com/
|
||||||
|
* For paybox test: ???
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,7 +243,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
|||||||
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
||||||
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
//$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE;
|
||||||
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
//$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE;
|
||||||
//$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
|
//$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE;
|
||||||
|
|
||||||
// A redirect is added if API call successfull
|
// A redirect is added if API call successfull
|
||||||
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
|
||||||
@ -258,7 +259,7 @@ if (GETPOST('action','aZ09') == 'dopayment')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -267,9 +268,9 @@ llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'online
|
|||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='PAYPAL_CREDITOR_'.$suffix;
|
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR;
|
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||||
|
|
||||||
// Check link validity
|
// Check link validity
|
||||||
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
if (! empty($SOURCE) && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', '')))
|
||||||
@ -306,14 +307,14 @@ print "\n";
|
|||||||
|
|
||||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
// Define logo and logosmall
|
// Define logo and logosmall
|
||||||
$logosmall=$mysoc->logo_small;
|
$logosmall=$mysoc->logo_small;
|
||||||
$logo=$mysoc->logo;
|
$logo=$mysoc->logo;
|
||||||
$paramlogo='PAYBOX_LOGO_'.$suffix;
|
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||||
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||||
// Define urllogo
|
// Define urllogo
|
||||||
$urllogo='';
|
$urllogo='';
|
||||||
@ -338,11 +339,11 @@ if ($urllogo)
|
|||||||
|
|
||||||
// Output introduction text
|
// Output introduction text
|
||||||
$text='';
|
$text='';
|
||||||
if (! empty($conf->global->PAYPAL_NEWFORM_TEXT))
|
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||||
{
|
{
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if (preg_match('/^\((.*)\)$/',$conf->global->PAYPAL_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||||
else $text.=$conf->global->PAYPAL_NEWFORM_TEXT."<br>\n";
|
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
|
|||||||
@ -91,7 +91,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
|
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
|
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -166,7 +166,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
|||||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||||
|
|
||||||
if (! empty($conf->global->PAYPAL_MESSAGE_KO)) print $conf->global->PAYPAL_MESSAGE_KO;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -114,7 +114,7 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
|
|||||||
|
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -135,7 +135,7 @@ if ($PAYPALTOKEN)
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ if ($PAYPALTOKEN)
|
|||||||
|
|
||||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||||
if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
@ -180,9 +180,9 @@ if ($PAYPALTOKEN)
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||||
{
|
{
|
||||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
@ -264,9 +264,9 @@ if ($PAYPALTOKEN)
|
|||||||
if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email."<br>\n";
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
|
||||||
{
|
{
|
||||||
$sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
$sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
$from=$conf->global->MAILING_EMAIL_FROM;
|
$from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
|||||||
@ -183,9 +183,9 @@ if (! empty($conf->global->STRIPE_SECURITY_TOKEN))
|
|||||||
|
|
||||||
// Common variables
|
// Common variables
|
||||||
$creditor=$mysoc->name;
|
$creditor=$mysoc->name;
|
||||||
$paramcreditor='STRIPE_CREDITOR_'.$suffix;
|
$paramcreditor='ONLINE_PAYMENT_CREDITOR_'.$suffix;
|
||||||
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
|
||||||
else if (! empty($conf->global->STRIPE_CREDITOR)) $creditor=$conf->global->STRIPE_CREDITOR;
|
else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->global->ONLINE_PAYMENT_CREDITOR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ if ($action == 'charge')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION["onlinetoken"] = $stripeToken;
|
$_SESSION["onlinetoken"] = $stripeToken;
|
||||||
$_SESSION["Payment_Amount"] = $amount;
|
$_SESSION["FinalPaymentAmt"] = $amount;
|
||||||
$_SESSION["currencyCodeType"] = $currency;
|
$_SESSION["currencyCodeType"] = $currency;
|
||||||
$_SESSION["paymentType"] = '';
|
$_SESSION["paymentType"] = '';
|
||||||
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
|
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
|
||||||
@ -328,7 +328,7 @@ if ($action == 'charge')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -369,14 +369,14 @@ print "\n";
|
|||||||
|
|
||||||
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n";
|
||||||
|
|
||||||
// Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo)
|
// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
// Define logo and logosmall
|
// Define logo and logosmall
|
||||||
$logosmall=$mysoc->logo_small;
|
$logosmall=$mysoc->logo_small;
|
||||||
$logo=$mysoc->logo;
|
$logo=$mysoc->logo;
|
||||||
$paramlogo='STRIPE_LOGO_'.$suffix;
|
$paramlogo='PAYMENT_LOGO_'.$suffix;
|
||||||
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||||
else if (! empty($conf->global->STRIPE_LOGO)) $logosmall=$conf->global->STRIPE_LOGO;
|
else if (! empty($conf->global->PAYMENT_LOGO)) $logosmall=$conf->global->PAYMENT_LOGO;
|
||||||
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
|
||||||
// Define urllogo
|
// Define urllogo
|
||||||
$urllogo='';
|
$urllogo='';
|
||||||
@ -401,11 +401,11 @@ if ($urllogo)
|
|||||||
|
|
||||||
// Output introduction text
|
// Output introduction text
|
||||||
$text='';
|
$text='';
|
||||||
if (! empty($conf->global->STRIPE_NEWFORM_TEXT))
|
if (! empty($conf->global->PAYMENT_NEWFORM_TEXT))
|
||||||
{
|
{
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if (preg_match('/^\((.*)\)$/',$conf->global->STRIPE_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n";
|
||||||
else $text.=$conf->global->STRIPE_NEWFORM_TEXT."<br>\n";
|
else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n";
|
||||||
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
$text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
if (empty($text))
|
if (empty($text))
|
||||||
|
|||||||
@ -92,7 +92,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL;
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
|
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
{
|
{
|
||||||
@ -140,7 +140,7 @@ if (! empty($_SESSION['ipaddress'])) // To avoid to make action twice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -153,7 +153,7 @@ print '<span id="dolpaymentspan"></span>'."\n";
|
|||||||
print '<div id="dolpaymentdiv" align="center">'."\n";
|
print '<div id="dolpaymentdiv" align="center">'."\n";
|
||||||
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
|
||||||
|
|
||||||
if (! empty($conf->global->STRIPE_MESSAGE_KO)) print $conf->global->STRIPE_MESSAGE_KO;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO;
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
|
|||||||
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_stripe');
|
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_stripe');
|
||||||
|
|
||||||
$head='';
|
$head='';
|
||||||
if (! empty($conf->global->STRIPE_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->STRIPE_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||||
|
|
||||||
$conf->dol_hide_topmenu=1;
|
$conf->dol_hide_topmenu=1;
|
||||||
$conf->dol_hide_leftmenu=1;
|
$conf->dol_hide_leftmenu=1;
|
||||||
@ -105,7 +105,7 @@ if ($ispaymentok)
|
|||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType'];
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
$ipaddress = $_SESSION['ipaddress'];
|
$ipaddress = $_SESSION['ipaddress'];
|
||||||
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
$TRANSACTIONID = $_SESSION['TRANSACTIONID'];
|
||||||
@ -120,10 +120,10 @@ if ($ispaymentok)
|
|||||||
|
|
||||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||||
if (! empty($conf->global->STRIPE_MESSAGE_OK)) print $conf->global->STRIPE_MESSAGE_OK;
|
if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK;
|
||||||
|
|
||||||
$sendemail = '';
|
$sendemail = '';
|
||||||
if (! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL;
|
if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;
|
||||||
|
|
||||||
// Send an email
|
// Send an email
|
||||||
if ($sendemail)
|
if ($sendemail)
|
||||||
|
|||||||
@ -55,15 +55,15 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_CREDITOR",GETPOST('STRIPE_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_CSS_URL",GETPOST('STRIPE_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_OK",GETPOST('STRIPE_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK",GETPOST('ONLINE_PAYMENT_MESSAGE_OK','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_MESSAGE_KO",GETPOST('STRIPE_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO",GETPOST('ONLINE_PAYMENT_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
$result=dolibarr_set_const($db, "STRIPE_PAYONLINE_SENDEMAIL",GETPOST('STRIPE_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL",GETPOST('ONLINE_PAYMENT_SENDEMAIL'),'chaine',0,'',$conf->entity);
|
||||||
if (! $result > 0) $error++;
|
if (! $result > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -184,31 +184,31 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("VendorName").'</td><td>';
|
print $langs->trans("VendorName").'</td><td>';
|
||||||
print '<input size="64" type="text" name="STRIPE_CREDITOR" value="'.$conf->global->STRIPE_CREDITOR.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$conf->global->ONLINE_PAYMENT_CREDITOR.'">';
|
||||||
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||||
print '<input size="64" type="text" name="STRIPE_CSS_URL" value="'.$conf->global->STRIPE_CSS_URL.'">';
|
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';
|
||||||
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
print ' '.$langs->trans("Example").': http://mysite/mycss.css';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageOK").'</td><td>';
|
print $langs->trans("MessageOK").'</td><td>';
|
||||||
$doleditor=new DolEditor('STRIPE_MESSAGE_OK',$conf->global->STRIPE_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_OK',$conf->global->ONLINE_PAYMENT_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("MessageKO").'</td><td>';
|
print $langs->trans("MessageKO").'</td><td>';
|
||||||
$doleditor=new DolEditor('STRIPE_MESSAGE_KO',$conf->global->STRIPE_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
$doleditor=new DolEditor('ONLINE_PAYMENT_MESSAGE_KO',$conf->global->ONLINE_PAYMENT_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("STRIPE_PAYONLINE_SENDEMAIL").'</td><td>';
|
print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").'</td><td>';
|
||||||
print '<input size="32" type="email" name="STRIPE_PAYONLINE_SENDEMAIL" value="'.$conf->global->STRIPE_PAYONLINE_SENDEMAIL.'">';
|
print '<input size="32" type="email" name="ONLINE_PAYMENT_SENDEMAIL" value="'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'">';
|
||||||
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
print ' '.$langs->trans("Example").': myemail@myserver.com';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -343,6 +343,26 @@ input.smallpadd { /* Used for timesheet input */
|
|||||||
input.buttongen {
|
input.buttongen {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
input.buttonpayment {
|
||||||
|
width: 300px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
|
input.buttonpaymentpaypal {
|
||||||
|
background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 5px 4px;
|
||||||
|
}
|
||||||
|
input.buttonpaymentpaybox {
|
||||||
|
background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png',1) ?>);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 5px 4px;
|
||||||
|
}
|
||||||
|
input.buttonpaymentstripe {
|
||||||
|
background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png',1) ?>);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 5px 3px;
|
||||||
|
}
|
||||||
span.timesheetalreadyrecorded input {
|
span.timesheetalreadyrecorded input {
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: solid 1px rgba(0,0,0,0.4);
|
border-bottom: solid 1px rgba(0,0,0,0.4);
|
||||||
@ -1224,21 +1244,6 @@ div#id-top {
|
|||||||
display:none;
|
display:none;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||||
/*-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.4);
|
|
||||||
box-shadow: 0 0 6px rgba(0,0,0,0.4); */
|
|
||||||
/*
|
|
||||||
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
|
|
||||||
*/
|
|
||||||
/*<?php if ($disableimages) { ?>
|
|
||||||
height: 34px;
|
|
||||||
<?php } else { ?>
|
|
||||||
height: <?php print $heightmenu2; ?>px;
|
|
||||||
<?php } ?>*/
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,15 +1315,6 @@ ul.tmenu { /* t r b l */
|
|||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */
|
ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */
|
||||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>);
|
|
||||||
/*
|
|
||||||
background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%);
|
|
||||||
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) );
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
li.tmenu, li.tmenusel {
|
li.tmenu, li.tmenusel {
|
||||||
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
|
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user