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
08ad7594
Commit
08ad7594
authored
14 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Add an example for hook integration in pdf
parent
ff17dfd9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+9
-15
9 additions, 15 deletions
htdocs/includes/modules/propale/pdf_propale_azur.modules.php
htdocs/lib/pdf.lib.php
+85
-0
85 additions, 0 deletions
htdocs/lib/pdf.lib.php
with
94 additions
and
15 deletions
htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+
9
−
15
View file @
08ad7594
...
@@ -258,38 +258,32 @@ class pdf_propale_azur extends ModelePDFPropales
...
@@ -258,38 +258,32 @@ class pdf_propale_azur extends ModelePDFPropales
if
(
empty
(
$conf
->
global
->
MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT
))
if
(
empty
(
$conf
->
global
->
MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT
))
{
{
$vat_rate
=
pdf_getlinevatrate
(
$object
,
$i
,
$outputlangs
);
$vat_rate
=
pdf_getlinevatrate
(
$object
,
$i
,
$outputlangs
);
$pdf
->
SetXY
(
$this
->
posxtva
,
$curY
);
$pdf
->
SetXY
(
$this
->
posxtva
,
$curY
);
$pdf
->
MultiCell
(
$this
->
posxup
-
$this
->
posxtva
-
1
,
4
,
$vat_rate
,
0
,
'R'
);
$pdf
->
MultiCell
(
$this
->
posxup
-
$this
->
posxtva
-
1
,
4
,
$vat_rate
,
0
,
'R'
);
}
}
// Prix unitaire HT avant remise
// Prix unitaire HT avant remise
$up_excl_tax
=
pdf_getlineupexcltax
(
$object
,
$i
,
$outputlangs
);
$pdf
->
SetXY
(
$this
->
posxup
,
$curY
);
$pdf
->
SetXY
(
$this
->
posxup
,
$curY
);
$pdf
->
MultiCell
(
$this
->
posxqty
-
$this
->
posxup
-
1
,
4
,
price
(
$object
->
lines
[
$i
]
->
subprice
)
,
0
,
'R'
,
0
);
$pdf
->
MultiCell
(
$this
->
posxqty
-
$this
->
posxup
-
1
,
4
,
$up_excl_tax
,
0
,
'R'
,
0
);
// Quantity
// Quantity
$qty
=
pdf_getlineqty
(
$object
,
$i
,
$outputlangs
);
$pdf
->
SetXY
(
$this
->
posxqty
,
$curY
);
$pdf
->
SetXY
(
$this
->
posxqty
,
$curY
);
if
(
$object
->
lines
[
$i
]
->
special_code
!=
3
)
$pdf
->
MultiCell
(
$this
->
posxdiscount
-
$this
->
posxqty
-
1
,
4
,
$
object
->
lines
[
$i
]
->
qty
,
0
,
'R'
);
$pdf
->
MultiCell
(
$this
->
posxdiscount
-
$this
->
posxqty
-
1
,
4
,
$qty
,
0
,
'R'
);
// Remise sur ligne
// Remise sur ligne
$pdf
->
SetXY
(
$this
->
posxdiscount
,
$curY
);
$pdf
->
SetXY
(
$this
->
posxdiscount
,
$curY
);
if
(
$object
->
lines
[
$i
]
->
remise_percent
&&
$object
->
lines
[
$i
]
->
special_code
!=
3
)
if
(
$object
->
lines
[
$i
]
->
remise_percent
)
{
{
$pdf
->
MultiCell
(
$this
->
postotalht
-
$this
->
posxdiscount
-
1
,
4
,
dol_print_reduction
(
$object
->
lines
[
$i
]
->
remise_percent
,
$outputlangs
),
0
,
'R'
);
$remise_percent
=
pdf_getlineremisepercent
(
$object
,
$i
,
$outputlangs
);
$pdf
->
MultiCell
(
$this
->
postotalht
-
$this
->
posxdiscount
-
1
,
4
,
$remise_percent
,
0
,
'R'
);
}
}
// Total HT ligne
// Total HT ligne
$total_excl_tax
=
pdf_getlinetotalexcltax
(
$object
,
$i
,
$outputlangs
);
$pdf
->
SetXY
(
$this
->
postotalht
,
$curY
);
$pdf
->
SetXY
(
$this
->
postotalht
,
$curY
);
if
(
$object
->
lines
[
$i
]
->
special_code
==
3
)
$pdf
->
MultiCell
(
26
,
4
,
$total_excl_tax
,
0
,
'R'
,
0
);
{
// Ligne produit en option
$pdf
->
MultiCell
(
26
,
4
,
$outputlangs
->
transnoentities
(
"Option"
),
0
,
'R'
,
0
);
}
else
{
$total
=
price
(
$object
->
lines
[
$i
]
->
total_ht
);
$pdf
->
MultiCell
(
26
,
4
,
$total
,
0
,
'R'
,
0
);
}
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$tvaligne
=
$object
->
lines
[
$i
]
->
total_tva
;
$tvaligne
=
$object
->
lines
[
$i
]
->
total_tva
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/pdf.lib.php
+
85
−
0
View file @
08ad7594
...
@@ -520,4 +520,89 @@ function pdf_getlinevatrate($object,$i,$outputlangs)
...
@@ -520,4 +520,89 @@ function pdf_getlinevatrate($object,$i,$outputlangs)
}
}
}
}
/**
* Return line unit price excluding tax
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
*/
function
pdf_getlineupexcltax
(
$object
,
$i
,
$outputlangs
)
{
if
(
!
empty
(
$object
->
hooks
)
&&
$object
->
lines
[
$i
]
->
product_type
==
9
&&
!
empty
(
$object
->
lines
[
$i
]
->
special_code
))
{
// TODO add hook function
}
else
{
return
price
(
$object
->
lines
[
$i
]
->
subprice
);
}
}
/**
* Return line quantity
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
*/
function
pdf_getlineqty
(
$object
,
$i
,
$outputlangs
)
{
if
(
$object
->
lines
[
$i
]
->
special_code
!=
3
)
{
if
(
!
empty
(
$object
->
hooks
)
&&
$object
->
lines
[
$i
]
->
product_type
==
9
&&
!
empty
(
$object
->
lines
[
$i
]
->
special_code
))
{
// TODO add hook function
}
else
{
return
$object
->
lines
[
$i
]
->
qty
;
}
}
}
/**
* Return line remise percent
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
*/
function
pdf_getlineremisepercent
(
$object
,
$i
,
$outputlangs
)
{
if
(
$object
->
lines
[
$i
]
->
special_code
!=
3
)
{
if
(
!
empty
(
$object
->
hooks
)
&&
$object
->
lines
[
$i
]
->
product_type
==
9
&&
!
empty
(
$object
->
lines
[
$i
]
->
special_code
))
{
// TODO add hook function
}
else
{
return
dol_print_reduction
(
$object
->
lines
[
$i
]
->
remise_percent
,
$outputlangs
);
}
}
}
/**
* Return line total excluding tax
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
*/
function
pdf_getlinetotalexcltax
(
$object
,
$i
,
$outputlangs
)
{
if
(
$object
->
lines
[
$i
]
->
special_code
==
3
)
{
return
$outputlangs
->
transnoentities
(
"Option"
);
}
else
{
if
(
!
empty
(
$object
->
hooks
)
&&
$object
->
lines
[
$i
]
->
product_type
==
9
&&
!
empty
(
$object
->
lines
[
$i
]
->
special_code
))
{
// TODO add hook function
}
else
{
return
price
(
$object
->
lines
[
$i
]
->
total_ht
);
}
}
}
?>
?>
\ No newline at end of file
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