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
613bb9f2
Commit
613bb9f2
authored
19 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
New: Il est possible de choisir le compte de débit lors d'une saisie de paiement de TVA.
parent
ac55764f
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/compta/tva/fiche.php
+67
-40
67 additions, 40 deletions
htdocs/compta/tva/fiche.php
htdocs/tva.class.php
+37
-6
37 additions, 6 deletions
htdocs/tva.class.php
with
104 additions
and
46 deletions
htdocs/compta/tva/fiche.php
+
67
−
40
View file @
613bb9f2
...
...
@@ -21,7 +21,8 @@
*
*/
/** \file htdocs/compta/tva/fiche.php
/**
\file htdocs/compta/tva/fiche.php
\brief Page des règlements de TVA
\version $Revision$
*/
...
...
@@ -29,55 +30,82 @@
require
(
"./pre.inc.php"
);
require
(
"../../tva.class.php"
);
$langs
->
load
(
"compta"
);
$mesg
=
''
;
/**
* Action ajout paiement tva
*/
if
(
$_POST
[
"action"
]
==
'add'
&&
$_POST
[
"cancel"
]
<>
$langs
->
trans
(
"Cancel"
))
{
$tva
=
new
Tva
(
$db
);
$tva
->
add_payement
(
mktime
(
12
,
0
,
0
,
$_POST
[
"datevmonth"
],
$_POST
[
"datevday"
],
$_POST
[
"datevyear"
]
),
mktime
(
12
,
0
,
0
,
$_POST
[
"datepmonth"
],
$_POST
[
"datepday"
],
$_POST
[
"datepyear"
]
),
$_POST
[
"amount"
]
);
Header
(
"Location: reglement.php"
);
$tva
=
new
Tva
(
$db
);
$db
->
begin
();
$tva
->
label
=
$langs
->
trans
(
"VATPayment"
);
$tva
->
accountid
=
$_POST
[
"accountid"
];
$tva
->
paymenttype
=
$_POST
[
"paiementtype"
];
$tva
->
datev
=
mktime
(
12
,
0
,
0
,
$_POST
[
"datevmonth"
],
$_POST
[
"datevday"
],
$_POST
[
"datevyear"
]);
$tva
->
datep
=
mktime
(
12
,
0
,
0
,
$_POST
[
"datepmonth"
],
$_POST
[
"datepday"
],
$_POST
[
"datepyear"
]);
$tva
->
amount
=
$_POST
[
"amount"
];
$ret
=
$tva
->
add_payement
(
$user
);
if
(
$ret
>
0
)
{
$db
->
commit
();
Header
(
"Location: reglement.php"
);
}
else
{
$db
->
rollback
();
$message
=
$langs
->
trans
(
"Error"
);
$_GET
[
"action"
]
=
"create"
;
}
}
llxHeader
();
/*
*
*
*/
$html
=
new
Form
(
$db
);
// Formulaire saisie tva
if
(
$_GET
[
"action"
]
==
'create'
)
{
print
"<form action=
\"
fiche.php
\"
method=
\"
post
\"
>
\n
"
;
print
'<input type="hidden" name="action" value="add">'
;
print
'<div class="titre">
Nouveau réglement TVA
</div><br>'
;
print
"<form action=
\"
fiche.php
\"
method=
\"
post
\"
>
\n
"
;
print
'<input type="hidden" name="action" value="add">'
;
print
'<div class="titre">
'
.
$langs
->
trans
(
"NewVATPayment"
)
.
'
</div><br>'
;
print
'<table class="border" width="100%">'
;
print
"<tr>"
;
print
'<td>'
.
$langs
->
trans
(
"DatePayment"
)
.
'</td><td>'
;
print
$html
->
select_date
(
""
,
"datev"
);
print
'</td></tr>'
;
print
'<td>'
.
$langs
->
trans
(
"DateValue"
)
.
'</td><td>'
;
print
$html
->
select_date
(
""
,
"datep"
);
print
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Amount"
)
.
'</td><td><input name="amount" size="10" value=""></td></tr>'
;
print
'<tr><td> </td><td><input type="submit" value="'
.
$langs
->
trans
(
"Save"
)
.
'"> '
;
print
'<input type="submit" name="cancel" value="'
.
$langs
->
trans
(
"Cancel"
)
.
'"></td></tr>'
;
print
'</table>'
;
print
'</form>'
;
if
(
$message
)
print
'<br>'
.
$message
.
'</br>'
;
print
'<table class="border" width="100%">'
;
print
"<tr>"
;
print
'<td>'
.
$langs
->
trans
(
"DatePayment"
)
.
'</td><td>'
;
print
$html
->
select_date
(
""
,
"datev"
);
print
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"DateValue"
)
.
'</td><td>'
;
print
$html
->
select_date
(
""
,
"datep"
);
print
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Type"
)
.
'</td><td>'
;
$html
->
select_types_paiements
(
$charge
->
paiementtype
,
"paiementtype"
);
print
"</td>
\n
"
;
print
'<tr><td>Compte à créditer :</td><td>'
;
$html
->
select_comptes
(
$charge
->
accountid
,
"accountid"
,
0
,
"courant=1"
);
// Affiche liste des comptes courant
print
'</td></tr>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"Amount"
)
.
'</td><td><input name="amount" size="10" value=""></td></tr>'
;
print
'<tr><td> </td><td><input type="submit" value="'
.
$langs
->
trans
(
"Save"
)
.
'"> '
;
print
'<input type="submit" name="cancel" value="'
.
$langs
->
trans
(
"Cancel"
)
.
'"></td></tr>'
;
print
'</table>'
;
print
'</form>'
;
}
...
...
@@ -89,9 +117,8 @@ if ($_GET["action"] == 'create')
// Aucune action
$db
->
close
();
llxFooter
(
"<em>Dernière modification
$Date
$ révision
$Revision
$</em>"
);
llxFooter
(
'$Date$ - $Revision$'
);
?>
This diff is collapsed.
Click to expand it.
htdocs/tva.class.php
+
37
−
6
View file @
613bb9f2
...
...
@@ -192,17 +192,48 @@ class Tva
* \brief Ajoute un paiement de TVA
*/
function
add_payement
(
$
datep
,
$datev
,
$amount
)
function
add_payement
(
$
user
)
{
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"tva (datep, datev, amount) "
;
$sql
.
=
" VALUES ('"
.
$this
->
db
->
idate
(
$datep
)
.
"',"
;
$sql
.
=
"'"
.
$this
->
db
->
idate
(
$datev
)
.
"',"
.
ereg_replace
(
","
,
"."
,
$amount
)
.
")"
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"tva (datep, datev, amount"
;
if
(
$this
->
note
)
$sql
.
=
", note"
;
if
(
$this
->
label
)
$sql
.
=
", label"
;
$sql
.
=
") "
;
$sql
.
=
" VALUES ('"
.
$this
->
db
->
idate
(
$this
->
datep
)
.
"',"
;
$sql
.
=
"'"
.
$this
->
db
->
idate
(
$this
->
datev
)
.
"',"
.
ereg_replace
(
","
,
"."
,
$this
->
amount
);
if
(
$this
->
note
)
$sql
.
=
", '"
.
addslashes
(
$this
->
note
)
.
"'"
;
if
(
$this
->
label
)
$sql
.
=
", '"
.
addslashes
(
$this
->
label
)
.
"'"
;
$sql
.
=
")"
;
$result
=
$this
->
db
->
query
(
$sql
);
if
(
$result
)
{
return
1
;
$this
->
id
=
$this
->
db
->
last_insert_id
(
MAIN_DB_PREFIX
.
"tva"
);
if
(
$this
->
id
>
0
)
{
// Insertion dans llx_bank
$acc
=
new
Account
(
$this
->
db
,
$this
->
accountid
);
$bank_line_id
=
$acc
->
addline
(
$this
->
db
->
idate
(
$this
->
datep
),
$this
->
paymenttype
,
$this
->
label
,
-
abs
(
$this
->
amount
),
''
,
''
,
$user
);
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi la ligne de tva qui a gnr l'criture bancaire
if
(
$bank_line_id
)
{
// $tva->update_fk_bank($bank_line_id);
}
// Mise a jour liens (pour chaque charge concerne par le paiement)
//foreach ($paiement->amounts as $key => $value)
//{
// $chid = $key;
// $fac = new Facture($db);
// $fac->fetch($chid);
// $fac->fetch_client();
// $acc->add_url_line($bank_line_id, $paiement_id, DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', "(paiement)");
// $acc->add_url_line($bank_line_id, $fac->client->id, DOL_URL_ROOT.'/compta/fiche.php?socid=', $fac->client->nom);
//}
}
return
$this
->
id
;
}
else
{
...
...
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