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
ec0282a2
Commit
ec0282a2
authored
9 years ago
by
Phf
Browse files
Options
Downloads
Patches
Plain Diff
New add multicurrency display on supplier payment
parent
d320aebe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/fourn/facture/paiement.php
+80
-6
80 additions, 6 deletions
htdocs/fourn/facture/paiement.php
with
80 additions
and
6 deletions
htdocs/fourn/facture/paiement.php
+
80
−
6
View file @
ec0282a2
...
@@ -65,7 +65,12 @@ if (! $sortorder) $sortorder="DESC";
...
@@ -65,7 +65,12 @@ if (! $sortorder) $sortorder="DESC";
if
(
!
$sortfield
)
$sortfield
=
"p.rowid"
;
if
(
!
$sortfield
)
$sortfield
=
"p.rowid"
;
$optioncss
=
GETPOST
(
'optioncss'
,
'alpha'
);
$optioncss
=
GETPOST
(
'optioncss'
,
'alpha'
);
$amounts
=
array
();
$amounts
=
array
();
array
();
$amountsresttopay
=
array
();
$addwarning
=
0
;
$multicurrency_amounts
=
array
();
$multicurrency_amountsresttopay
=
array
();
// Security check
// Security check
if
(
$user
->
societe_id
>
0
)
if
(
$user
->
societe_id
>
0
)
...
@@ -144,6 +149,34 @@ if (empty($reshook))
...
@@ -144,6 +149,34 @@ if (empty($reshook))
$formquestion
[
$i
++
]
=
array
(
'type'
=>
'hidden'
,
'name'
=>
$key
,
'value'
=>
$_POST
[
$key
]);
$formquestion
[
$i
++
]
=
array
(
'type'
=>
'hidden'
,
'name'
=>
$key
,
'value'
=>
$_POST
[
$key
]);
}
}
elseif
(
substr
(
$key
,
0
,
21
)
==
'multicurrency_amount_'
)
{
$cursorfacid
=
substr
(
$key
,
21
);
$multicurrency_amounts
[
$cursorfacid
]
=
price2num
(
trim
(
GETPOST
(
$key
)));
$multicurrency_totalpayment
+=
$multicurrency_amounts
[
$cursorfacid
];
if
(
!
empty
(
$multicurrency_amounts
[
$cursorfacid
]))
$atleastonepaymentnotnull
++
;
$result
=
$tmpinvoice
->
fetch
(
$cursorfacid
);
if
(
$result
<=
0
)
dol_print_error
(
$db
);
$multicurrency_amountsresttopay
[
$cursorfacid
]
=
price2num
(
$tmpinvoice
->
total_ttc
-
$tmpinvoice
->
getSommePaiement
(
1
));
if
(
$multicurrency_amounts
[
$cursorfacid
])
{
// Check amount
if
(
$multicurrency_amounts
[
$cursorfacid
]
&&
(
abs
(
$multicurrency_amounts
[
$cursorfacid
])
>
abs
(
$multicurrency_amountsresttopay
[
$cursorfacid
])))
{
$addwarning
=
1
;
$formquestion
[
'text'
]
=
img_warning
(
$langs
->
trans
(
"PaymentHigherThanReminderToPaySupplier"
))
.
' '
.
$langs
->
trans
(
"HelpPaymentHigherThanReminderToPaySupplier"
);
}
// Check date
if
(
$datepaye
&&
(
$datepaye
<
$tmpinvoice
->
date
))
{
$langs
->
load
(
"errors"
);
//$error++;
setEventMessages
(
$langs
->
transnoentities
(
"WarningPaymentDateLowerThanInvoiceDate"
,
dol_print_date
(
$datepaye
,
'day'
),
dol_print_date
(
$tmpinvoice
->
date
,
'day'
),
$tmpinvoice
->
ref
),
null
,
'warnings'
);
}
}
$formquestion
[
$i
++
]
=
array
(
'type'
=>
'hidden'
,
'name'
=>
$key
,
'value'
=>
GETPOST
(
$key
,
'int'
));
}
}
}
// Check parameters
// Check parameters
...
@@ -163,7 +196,7 @@ if (empty($reshook))
...
@@ -163,7 +196,7 @@ if (empty($reshook))
}
}
}
}
if
(
empty
(
$totalpayment
)
&&
empty
(
$atleastonepaymentnotnull
))
if
(
empty
(
$totalpayment
)
&&
empty
(
$multicurrency_totalpayment
)
&&
empty
(
$atleastonepaymentnotnull
))
{
{
setEventMessages
(
$langs
->
transnoentities
(
'ErrorFieldRequired'
,
$langs
->
trans
(
'PaymentAmount'
)),
null
,
'errors'
);
setEventMessages
(
$langs
->
transnoentities
(
'ErrorFieldRequired'
,
$langs
->
trans
(
'PaymentAmount'
)),
null
,
'errors'
);
$error
++
;
$error
++
;
...
@@ -174,6 +207,13 @@ if (empty($reshook))
...
@@ -174,6 +207,13 @@ if (empty($reshook))
setEventMessages
(
$langs
->
transnoentities
(
'ErrorFieldRequired'
,
$langs
->
transnoentities
(
'Date'
)),
null
,
'errors'
);
setEventMessages
(
$langs
->
transnoentities
(
'ErrorFieldRequired'
,
$langs
->
transnoentities
(
'Date'
)),
null
,
'errors'
);
$error
++
;
$error
++
;
}
}
// Check if payments in both currency
if
(
$totalpayment
>
0
&&
$multicurrency_totalpayment
>
0
)
{
setEventMessages
(
$langs
->
transnoentities
(
'ErrorPaymentInBothCurrency'
),
null
,
'errors'
);
$error
++
;
}
}
}
/*
/*
...
@@ -206,6 +246,7 @@ if (empty($reshook))
...
@@ -206,6 +246,7 @@ if (empty($reshook))
$paiement
=
new
PaiementFourn
(
$db
);
$paiement
=
new
PaiementFourn
(
$db
);
$paiement
->
datepaye
=
$datepaye
;
$paiement
->
datepaye
=
$datepaye
;
$paiement
->
amounts
=
$amounts
;
// Array of amounts
$paiement
->
amounts
=
$amounts
;
// Array of amounts
$paiement
->
multicurrency_amounts
=
$multicurrency_amounts
;
$paiement
->
paiementid
=
$_POST
[
'paiementid'
];
$paiement
->
paiementid
=
$_POST
[
'paiementid'
];
$paiement
->
num_paiement
=
$_POST
[
'num_paiement'
];
$paiement
->
num_paiement
=
$_POST
[
'num_paiement'
];
$paiement
->
note
=
$_POST
[
'comment'
];
$paiement
->
note
=
$_POST
[
'comment'
];
...
@@ -344,8 +385,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
...
@@ -344,8 +385,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
/*
/*
* Autres factures impayees
* Autres factures impayees
*/
*/
$sql
=
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef as df'
;
$sql
=
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc,
f.multicurrency_total_ttc,
f.datef as df'
;
$sql
.
=
', SUM(pf.amount) as am'
;
$sql
.
=
', SUM(pf.amount) as
am, SUM(pf.multicurrency_amount) as multicurrency_
am'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'facture_fourn as f'
;
$sql
.
=
' FROM '
.
MAIN_DB_PREFIX
.
'facture_fourn as f'
;
$sql
.
=
' LEFT JOIN '
.
MAIN_DB_PREFIX
.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'
;
$sql
.
=
' LEFT JOIN '
.
MAIN_DB_PREFIX
.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'
;
$sql
.
=
" WHERE f.entity = "
.
$conf
->
entity
;
$sql
.
=
" WHERE f.entity = "
.
$conf
->
entity
;
...
@@ -378,9 +419,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
...
@@ -378,9 +419,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print
'<td>'
.
$langs
->
trans
(
'RefSupplier'
)
.
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
'RefSupplier'
)
.
'</td>'
;
print
'<td align="center">'
.
$langs
->
trans
(
'Date'
)
.
'</td>'
;
print
'<td align="center">'
.
$langs
->
trans
(
'Date'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'AmountTTC'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'AmountTTC'
)
.
'</td>'
;
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
$langs
->
trans
(
'MulticurrencyAmountTTC'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'AlreadyPaid'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'AlreadyPaid'
)
.
'</td>'
;
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
$langs
->
trans
(
'MulticurrencyAlreadyPaid'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'RemainderToPay'
)
.
'</td>'
;
print
'<td align="right">'
.
$langs
->
trans
(
'RemainderToPay'
)
.
'</td>'
;
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
$langs
->
trans
(
'MulticurrencyRemainderToPay'
)
.
'</td>'
;
print
'<td align="center">'
.
$langs
->
trans
(
'PaymentAmount'
)
.
'</td>'
;
print
'<td align="center">'
.
$langs
->
trans
(
'PaymentAmount'
)
.
'</td>'
;
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="center">'
.
$langs
->
trans
(
'MulticurrencyPaymentAmount'
)
.
'</td>'
;
print
'</tr>'
;
print
'</tr>'
;
$var
=
True
;
$var
=
True
;
...
@@ -408,14 +453,39 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
...
@@ -408,14 +453,39 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print
'<td align="center"><b>!!!</b></td>'
;
print
'<td align="center"><b>!!!</b></td>'
;
}
}
print
'<td align="right">'
.
price
(
$objp
->
total_ttc
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$objp
->
total_ttc
)
.
'</td>'
;
// Multicurrency
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
price
(
$objp
->
multicurrency_total_ttc
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$objp
->
am
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$objp
->
am
)
.
'</td>'
;
// Multicurrency
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
price
(
$objp
->
multicurrency_am
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$objp
->
total_ttc
-
$objp
->
am
)
.
'</td>'
;
print
'<td align="right">'
.
price
(
$objp
->
total_ttc
-
$objp
->
am
)
.
'</td>'
;
// Multicurrency
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
print
'<td align="right">'
.
price
(
$objp
->
multicurrency_total_ttc
-
$objp
->
multicurrency_am
)
.
'</td>'
;
print
'<td align="center">'
;
print
'<td align="center">'
;
$namef
=
'amount_'
.
$objp
->
facid
;
$namef
=
'amount_'
.
$objp
->
facid
;
if
(
!
empty
(
$conf
->
global
->
FAC_AUTO_FILLJS
))
if
(
!
empty
(
$conf
->
global
->
FAC_AUTO_FILLJS
))
print
img_picto
(
"Auto fill"
,
'rightarrow'
,
"class='AutoFillAmout' data-rowname='"
.
$namef
.
"' data-value='"
.
(
$objp
->
total_ttc
-
$objp
->
am
)
.
"'"
);
print
img_picto
(
"Auto fill"
,
'rightarrow'
,
"class='AutoFillAmout' data-rowname='"
.
$namef
.
"' data-value='"
.
(
$objp
->
total_ttc
-
$objp
->
am
)
.
"'"
);
print
'<input type="text" size="8" name="'
.
$namef
.
'" value="'
.
GETPOST
(
$namef
)
.
'">'
;
print
'<input type="text" size="8" name="'
.
$namef
.
'" value="'
.
GETPOST
(
$namef
)
.
'">'
;
print
"</td></tr>
\n
"
;
print
"</td>"
;
// Multicurrency
if
(
!
empty
(
$conf
->
multicurrency
->
enabled
))
{
print
'<td align="center">'
;
$namef
=
'multicurrency_amount_'
.
$objp
->
facid
;
if
(
!
empty
(
$conf
->
global
->
FAC_AUTO_FILLJS
))
print
img_picto
(
"Auto fill"
,
'rightarrow'
,
"class='AutoFillAmout' data-rowname='"
.
$namef
.
"' data-value='"
.
(
$objp
->
multicurrency_total_ttc
-
$objp
->
multicurrency_am
)
.
"'"
);
print
'<input type="text" size="8" class="multicurrency_amount" name="'
.
$namef
.
'" value="'
.
GETPOST
(
$namef
)
.
'">'
;
print
"</td>"
;
}
print
"</tr>
\n
"
;
$total
+=
$objp
->
total_ht
;
$total
+=
$objp
->
total_ht
;
$total_ttc
+=
$objp
->
total_ttc
;
$total_ttc
+=
$objp
->
total_ttc
;
$totalrecu
+=
$objp
->
am
;
$totalrecu
+=
$objp
->
am
;
...
@@ -455,7 +525,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
...
@@ -455,7 +525,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$preselectedchoice
=
$addwarning
?
'no'
:
'yes'
;
$preselectedchoice
=
$addwarning
?
'no'
:
'yes'
;
print
'<br>'
;
print
'<br>'
;
$text
=
$langs
->
trans
(
'ConfirmSupplierPayment'
,
$totalpayment
,
$langs
->
trans
(
"Currency"
.
$conf
->
currency
));
if
(
!
empty
(
$totalpayment
))
$text
=
$langs
->
trans
(
'ConfirmSupplierPayment'
,
$totalpayment
,
$langs
->
trans
(
"Currency"
.
$conf
->
currency
));
if
(
!
empty
(
$multicurrency_totalpayment
))
{
$text
.
=
'<br />'
.
$langs
->
trans
(
'ConfirmSupplierPayment'
,
$multicurrency_totalpayment
,
$langs
->
trans
(
"paymentInInvoiceCurrency"
));
}
if
(
GETPOST
(
'closepaidinvoices'
))
if
(
GETPOST
(
'closepaidinvoices'
))
{
{
$text
.
=
'<br>'
.
$langs
->
trans
(
"AllCompletelyPayedInvoiceWillBeClosed"
);
$text
.
=
'<br>'
.
$langs
->
trans
(
"AllCompletelyPayedInvoiceWillBeClosed"
);
...
...
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