Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
2e64db25
Commit
2e64db25
authored
7 years ago
by
Darkjeff
Browse files
Options
Downloads
Patches
Plain Diff
update sells journal
add in bookkeeping add export control
parent
34f3552d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/accountancy/journal/sellsjournal.php
+55
-94
55 additions, 94 deletions
htdocs/accountancy/journal/sellsjournal.php
with
55 additions
and
94 deletions
htdocs/accountancy/journal/sellsjournal.php
+
55
−
94
View file @
2e64db25
...
...
@@ -46,7 +46,7 @@ $langs->load("main");
$langs
->
load
(
"accountancy"
);
$id_journal
=
GETPOST
(
'id_journal'
,
'int'
);
$action
=
GETPOST
(
'action'
,
'a
Z09
'
);
$action
=
GETPOST
(
'action'
,
'a
lpha
'
);
$date_startmonth
=
GETPOST
(
'date_startmonth'
);
$date_startday
=
GETPOST
(
'date_startday'
);
...
...
@@ -54,6 +54,7 @@ $date_startyear = GETPOST('date_startyear');
$date_endmonth
=
GETPOST
(
'date_endmonth'
);
$date_endday
=
GETPOST
(
'date_endday'
);
$date_endyear
=
GETPOST
(
'date_endyear'
);
$in_bookkeeping
=
GETPOST
(
'in_bookkeeping'
);
$now
=
dol_now
();
...
...
@@ -113,6 +114,8 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql
.
=
" AND fd.product_type IN (0,1)"
;
if
(
$date_start
&&
$date_end
)
$sql
.
=
" AND f.datef >= '"
.
$db
->
idate
(
$date_start
)
.
"' AND f.datef <= '"
.
$db
->
idate
(
$date_end
)
.
"'"
;
if
(
$in_bookkeeping
==
'yes'
)
$sql
.
=
" AND (f.rowid NOT IN (SELECT fk_doc FROM "
.
MAIN_DB_PREFIX
.
"accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )"
;
$sql
.
=
" ORDER BY f.datef"
;
dol_syslog
(
'accountancy/journal/sellsjournal.php'
,
LOG_DEBUG
);
...
...
@@ -401,75 +404,17 @@ if ($action == 'writebookkeeping') {
$form
=
new
Form
(
$db
);
// Export
/*
if ($action == 'export_csv') {
if
(
$action
==
'export_csv'
)
{
$sep
=
$conf
->
global
->
ACCOUNTING_EXPORT_SEPARATORCSV
;
$sell_journal
=
$conf
->
global
->
ACCOUNTING_SELL_JOURNAL
;
include
DOL_DOCUMENT_ROOT
.
'/accountancy/tpl/export_journal.tpl.php'
;
$companystatic
=
new
Client
(
$db
);
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
$invoicestatic
=
new
Facture
(
$db
);
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($val["date"], '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . $sep;
print $val["ref"];
print "\n";
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount_static = new AccountingAccount($db);
if ($accountingaccount_static->fetch(null, $k, true)) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
print $val["ref"];
print "\n";
}
}
// TVA
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
// print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach
(
$tabfac
as
$key
=>
$val
)
{
$companystatic
->
id
=
$tabcompany
[
$key
][
'id'
];
$companystatic
->
name
=
$tabcompany
[
$key
][
'name'
];
...
...
@@ -481,12 +426,18 @@ $form = new Form($db);
$date
=
dol_print_date
(
$val
[
"date"
],
'day'
);
foreach
(
$tabttc
[
$key
]
as
$k
=>
$mt
)
{
print
'"'
.
$key
.
'"'
.
$sep
;
print
'"'
.
$date
.
'"'
.
$sep
;
print
'"'
.
$val
[
"ref"
]
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
32
)
)
.
'"'
.
$sep
;
print
'"'
.
length_accounta
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
print
'"'
.
$conf
->
global
->
ACCOUNTING_ACCOUNT_CUSTOMER
.
'"'
.
$sep
;
print
'"'
.
length_accounta
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print
'"'
.
$langs
->
trans
(
"Code_tiers"
)
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
16
)
)
.
' - '
.
$invoicestatic
->
ref
.
' - '
.
$langs
->
trans
(
"Code_tiers"
)
.
'"'
.
$sep
;
print
'"'
.
(
$mt
>=
0
?
price
(
$mt
)
:
''
)
.
'"'
.
$sep
;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print
'"'
.
(
$mt
<
0
?
price
(
-
$mt
)
:
''
)
.
'"'
.
$sep
;
print
'"'
.
$sell_journal
.
'"'
;
print
"
\n
"
;
}
...
...
@@ -495,33 +446,48 @@ $form = new Form($db);
$accountingaccount
=
new
AccountingAccount
(
$db
);
$accountingaccount
->
fetch
(
null
,
$k
,
true
);
if
(
$mt
)
{
print
'"'
.
$key
.
'"'
.
$sep
;
print
'"'
.
$date
.
'"'
.
$sep
;
print
'"'
.
$val
[
"ref"
]
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
32
)
)
.
'"'
.
$sep
;
print
'"'
.
length_accountg
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print
'"'
.
length_accountg
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print
" "
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$accountingaccount
->
label
,
32
)
)
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
16
)
)
.
' - '
.
dol_trunc
(
$accountingaccount
->
label
,
32
)
.
'"'
.
$sep
;
print
'"'
.
(
$mt
<
0
?
price
(
-
$mt
)
:
''
)
.
'"'
.
$sep
;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print
'"'
.
(
$mt
>=
0
?
price
(
$mt
)
:
''
)
.
'"'
.
$sep
;
print
'"'
.
$sell_journal
.
'"'
;
print
"
\n
"
;
}
}
// VAT
foreach
(
$tabtva
[
$key
]
as
$k
=>
$mt
)
{
if
(
$mt
)
{
print
'"'
.
$key
.
'"'
.
$sep
;
print
'"'
.
$date
.
'"'
.
$sep
;
print
'"'
.
$val
[
"ref"
]
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
32
)
)
.
'"'
.
$sep
;
print
'"'
.
length_accountg
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
print
'"'
.
length_accountg
(
html_entity_decode
(
$k
))
.
'"'
.
$sep
;
print
" "
.
$sep
;
print
'"'
.
$langs
->
trans
(
"VAT"
)
.
' - '
.
$def_tva
[
$key
]
.
'"'
.
$sep
;
print
'"'
.
utf8_decode
(
dol_trunc
(
$companystatic
->
name
,
16
)
)
.
' - '
.
$invoicestatic
->
ref
.
' - '
.
$langs
->
trans
(
"VAT"
)
.
'"'
.
$sep
;
print
'"'
.
(
$mt
<
0
?
price
(
-
$mt
)
:
''
)
.
'"'
.
$sep
;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print
'"'
.
(
$mt
>=
0
?
price
(
$mt
)
:
''
)
.
'"'
.
$sep
;
print
'"'
.
$sell_journal
.
'"'
;
print
"
\n
"
;
}
}
}
}
}
*/
if
(
empty
(
$action
)
||
$action
==
'view'
)
{
...
...
@@ -545,12 +511,6 @@ if (empty($action) || $action == 'view') {
journalHead
(
$nom
,
$nomlink
,
$period
,
$periodlink
,
$description
,
$builddate
,
$exportlink
,
array
(
'action'
=>
''
),
''
,
$varlink
);
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/
// Button to write into Ledger
if
(
empty
(
$conf
->
global
->
ACCOUNTING_ACCOUNT_CUSTOMER
)
||
$conf
->
global
->
ACCOUNTING_ACCOUNT_CUSTOMER
==
'-1'
)
{
print
img_warning
()
.
' '
.
$langs
->
trans
(
"SomeMandatoryStepsOfSetupWereNotDone"
);
...
...
@@ -563,6 +523,7 @@ if (empty($action) || $action == 'view') {
else
{
print
'<input type="button" class="butAction" value="'
.
$langs
->
trans
(
"WriteBookKeeping"
)
.
'" onclick="writebookkeeping();" />'
;
}
print
'<input type="button" class="butAction" value="'
.
$langs
->
trans
(
"Export"
)
.
'" onclick="launch_export();" />'
;
print
'</div>'
;
print
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment