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
f32b27e8
Commit
f32b27e8
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Better management of vat with code
parent
f40afcf0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/expensereport/card.php
+10
-18
10 additions, 18 deletions
htdocs/expensereport/card.php
htdocs/expensereport/class/expensereport.class.php
+5
-2
5 additions, 2 deletions
htdocs/expensereport/class/expensereport.class.php
with
15 additions
and
20 deletions
htdocs/expensereport/card.php
+
10
−
18
View file @
f32b27e8
...
...
@@ -1080,11 +1080,10 @@ if (empty($reshook))
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if
(
empty
(
$vatrate
))
$vatrate
=
"0.000"
;
$object_ligne
->
vatrate
=
price2num
(
$vatrate
);
$object_ligne
->
fk_projet
=
$fk_projet
;
if
(
!
GETPOST
(
'fk_c_type_fees'
)
>
0
)
if
(
!
(
GETPOST
(
'fk_c_type_fees'
)
>
0
)
)
{
$error
++
;
setEventMessages
(
$langs
->
trans
(
"ErrorFieldRequired"
,
$langs
->
transnoentitiesnoconv
(
"Type"
)),
null
,
'errors'
);
...
...
@@ -1949,7 +1948,7 @@ else
// Fetch Lines of current expense report
$sql
=
'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,'
;
$sql
.
=
' fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'
;
$sql
.
=
' fde.tva_tx as vatrate,
fde.vat_src_code,
fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'
;
$sql
.
=
' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'
;
$sql
.
=
' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'expensereport_det as fde'
;
...
...
@@ -2028,7 +2027,7 @@ else
// print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper(empty($objp->type_fees_libelle)?'OTHER':$objp->type_fees_libelle)).'</td>';
print
'<td style="text-align:center;">'
.
(
$langs
->
trans
((
$objp
->
type_fees_code
))
==
$objp
->
type_fees_code
?
$objp
->
type_fees_libelle
:
$langs
->
trans
((
$objp
->
type_fees_code
)))
.
'</td>'
;
print
'<td style="text-align:left;">'
.
$objp
->
comments
.
'</td>'
;
print
'<td style="text-align:right;">'
.
vatrate
(
$objp
->
vatrate
,
true
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
vatrate
(
$objp
->
vatrate
.
(
$objp
->
vat_src_code
?
' ('
.
$objp
->
vat_src_code
.
')'
:
''
)
,
true
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
price
(
$objp
->
value_unit
)
.
'</td>'
;
print
'<td style="text-align:right;">'
.
$objp
->
qty
.
'</td>'
;
...
...
@@ -2082,24 +2081,25 @@ else
// Add comments
print
'<td>'
;
print
'<textarea name="comments" class="flat_ndf centpercent">'
.
$objp
->
comments
.
'</textarea>'
;
print
'<textarea name="comments" class="flat_ndf centpercent">'
.
dol_escape_htmltag
(
$objp
->
comments
)
.
'</textarea>'
;
print
'</td>'
;
// VAT
print
'<td style="text-align:right;">'
;
$seller
=
$mysoc
;
$buyer
=
new
Societe
(
$db
);
print
$form
->
load_tva
(
'vatrate'
,
(
isset
(
$_POST
[
"vatrate"
])
?
$_POST
[
"vatrate"
]
:
$objp
->
vatrate
),
$seller
,
$buyer
,
0
,
0
,
''
,
false
,
1
);
$selectedvat
=
(
GETPOST
(
"vatrate"
,
'alpha'
)
?
GETPOST
(
"vatrate"
,
'alpha'
)
:
$objp
->
vatrate
.
(
$objp
->
vat_src_code
?
' ('
.
$objp
->
vat_src_code
.
')'
:
''
));
print
$form
->
load_tva
(
'vatrate'
,
$selectedvat
,
$seller
,
$buyer
,
0
,
0
,
''
,
false
,
1
);
print
'</td>'
;
// Unit price
print
'<td style="text-align:right;">'
;
print
'<input type="text" min="0" class="maxwidth100" name="value_unit" value="'
.
$objp
->
value_unit
.
'" />'
;
print
'<input type="text" min="0" class="maxwidth100" name="value_unit" value="'
.
dol_escape_htmltag
(
$objp
->
value_unit
)
.
'" />'
;
print
'</td>'
;
// Quantity
print
'<td style="text-align:right;">'
;
print
'<input type="
number
" min="0" class="maxwidth
10
0" name="qty" value="'
.
$objp
->
qty
.
'" />'
;
print
'<input type="
text
" min="0" class="maxwidth
5
0" name="qty" value="'
.
$objp
->
qty
.
'" />'
;
// We must be able to enter decimal qty
print
'</td>'
;
if
(
$action
!=
'editline'
)
...
...
@@ -2120,13 +2120,6 @@ else
$db
->
free
(
$resql
);
}
else
{
/* print '<table width="100%">';
print '<tr><td><div class="error" style="display:block;">'.$langs->trans("AucuneLigne").'</div></td></tr>';
print '</table>';*/
}
//print '</div>';
// Add a line
if
((
$object
->
fk_statut
==
0
||
$object
->
fk_statut
==
99
)
&&
$action
!=
'editline'
&&
$user
->
rights
->
expensereport
->
creer
)
...
...
@@ -2143,7 +2136,6 @@ else
print
'<td colspan="3"></td>'
;
print
'</tr>'
;
print
'<tr '
.
$bc
[
true
]
.
'>'
;
print
'<td></td>'
;
...
...
@@ -2180,12 +2172,12 @@ else
// Unit price
print
'<td align="right">'
;
print
'<input type="text" class="right maxwidth50" name="value_unit" value="'
.
$value_unit
.
'">'
;
print
'<input type="text" class="right maxwidth50" name="value_unit" value="'
.
(
GETPOST
(
'value_unit'
,
'alpha'
)
?
GETPOST
(
'value_unit'
,
'alpha'
)
:
dol_escape_htmltag
(
$value_unit
))
.
'">'
;
print
'</td>'
;
// Quantity
print
'<td align="right">'
;
print
'<input type="
number
" min="0" class="right maxwidth50" name="qty" value="'
.
(
$qty
?
$qty
:
1
)
.
'">'
;
print
'<input type="
text
" min="0" class="right maxwidth50" name="qty" value="'
.
(
$qty
?
$qty
:
1
)
.
'">'
;
// We must be able to enter decimal qty
print
'</td>'
;
if
(
$action
!=
'editline'
)
...
...
This diff is collapsed.
Click to expand it.
htdocs/expensereport/class/expensereport.class.php
+
5
−
2
View file @
f32b27e8
...
...
@@ -2058,7 +2058,7 @@ class ExpenseReportLine
function
fetch
(
$rowid
)
{
$sql
=
'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,'
;
$sql
.
=
' fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'
;
$sql
.
=
' fde.tva_tx as vatrate,
fde.vat_src_code,
fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'
;
$sql
.
=
' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'
;
$sql
.
=
' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'expensereport_det as fde'
;
...
...
@@ -2087,6 +2087,7 @@ class ExpenseReportLine
$this
->
projet_ref
=
$objp
->
projet_ref
;
$this
->
projet_title
=
$objp
->
projet_title
;
$this
->
vatrate
=
$objp
->
vatrate
;
$this
->
vat_src_code
=
$objp
->
vat_src_code
;
$this
->
total_ht
=
$objp
->
total_ht
;
$this
->
total_tva
=
$objp
->
total_tva
;
$this
->
total_ttc
=
$objp
->
total_ttc
;
...
...
@@ -2121,11 +2122,12 @@ class ExpenseReportLine
$sql
=
'INSERT INTO '
.
MAIN_DB_PREFIX
.
'expensereport_det'
;
$sql
.
=
' (fk_expensereport, fk_c_type_fees, fk_projet,'
;
$sql
.
=
' tva_tx, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)'
;
$sql
.
=
' tva_tx,
vat_src_code,
comments, qty, value_unit, total_ht, total_tva, total_ttc, date)'
;
$sql
.
=
" VALUES ("
.
$this
->
fk_expensereport
.
","
;
$sql
.
=
" "
.
$this
->
fk_c_type_fees
.
","
;
$sql
.
=
" "
.
(
$this
->
fk_projet
>
0
?
$this
->
fk_projet
:
'null'
)
.
","
;
$sql
.
=
" "
.
$this
->
vatrate
.
","
;
$sql
.
=
" '"
.
$this
->
db
->
escape
(
$this
->
vat_src_code
)
.
"',"
;
$sql
.
=
" '"
.
$this
->
db
->
escape
(
$this
->
comments
)
.
"',"
;
$sql
.
=
" "
.
$this
->
qty
.
","
;
$sql
.
=
" "
.
$this
->
value_unit
.
","
;
...
...
@@ -2196,6 +2198,7 @@ class ExpenseReportLine
$sql
.
=
",total_tva="
.
$this
->
total_tva
.
""
;
$sql
.
=
",total_ttc="
.
$this
->
total_ttc
.
""
;
$sql
.
=
",tva_tx="
.
$this
->
vatrate
;
$sql
.
=
",vat_src_code='"
.
$this
->
db
->
escape
(
$this
->
vat_src_code
)
.
"'"
;
if
(
$this
->
fk_c_type_fees
)
$sql
.
=
",fk_c_type_fees="
.
$this
->
fk_c_type_fees
;
else
$sql
.
=
",fk_c_type_fees=null"
;
if
(
$this
->
fk_projet
)
$sql
.
=
",fk_projet="
.
$this
->
fk_projet
;
...
...
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