[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 05/09: Default currency
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 05/09: Default currency |
Date: |
Sun, 17 Sep 2023 15:06:12 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1c727f960b912c34a0c5ebdac0c95e83d0344eb4
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Sep 15 19:12:03 2023 +0200
Default currency
For Sale , correct default currency remove hard coded EUR
---
include/class/acc_ledger_sale.class.php | 9 ++--
include/export/export_fiche_balance_pdf.php | 75 +++++++++++------------------
2 files changed, 33 insertions(+), 51 deletions(-)
diff --git a/include/class/acc_ledger_sale.class.php
b/include/class/acc_ledger_sale.class.php
index f742ce1b6..c8ca25eb4 100644
--- a/include/class/acc_ledger_sale.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -1051,7 +1051,8 @@ if ( $g_parameter->MY_TVA_USE=="Y") {
</td>
</tr>
EOF;
-
+ $sql_currency=new Currency_SQL($this->cn,$p_currency_code);
+ $iso_code=$sql_currency->getp("cr_code_iso");
if ($p_currency_code !=0) {
$r.=<<<EOF
@@ -1067,13 +1068,15 @@ EOF;
{$rate} {$p_currency_rate}
</td>
<td class="num">
- {$tot_eur} EUR
+ {$tot_eur} {$iso_code}
</td>
</tr>
EOF;
}
} else {
+ $sql_currency=new Currency_SQL($this->cn,$p_currency_code);
+ $iso_code=$sql_currency->getp("cr_code_iso");
// without VAT
$r.=<<<EOF
<tr class="highlight">
@@ -1102,7 +1105,7 @@ EOF;
{$rate} {$p_currency_rate}
</td>
<td class="num">
- {$tot_eur} EUR
+ {$tot_eur} {$iso_code}
</td>
</tr>
EOF;
diff --git a/include/export/export_fiche_balance_pdf.php
b/include/export/export_fiche_balance_pdf.php
index 0a0031527..8db11a6a3 100644
--- a/include/export/export_fiche_balance_pdf.php
+++ b/include/export/export_fiche_balance_pdf.php
@@ -32,10 +32,16 @@ $gDossier=dossier::id();
$cn=Dossier::connect();
$g_user->Check();
$g_user->check_dossier($gDossier);
-$name=$cn->get_value('select fd_label from fiche_def where
fd_id=$1',array($_GET['cat']));
+
+$http=new HttpInput();
+
+$cat = $http->get("cat");
+$histo = $http->get("histo");
+
+$name=$cn->get_value('select fd_label from fiche_def where
fd_id=$1',array($cat));
$pdf=new PDF($cn);
-$pdf->setDossierInfo(" Periode : ".$_GET['start']." - ".$_GET['end']);
+$pdf->setDossierInfo(" Periode : ".$http->get('start')." -
".$http->get('end'));
$pdf->AliasNbPages();
$pdf->AddPage();
@@ -46,9 +52,9 @@ $allcard=(isset($_GET['allcard']))?1:0;
/*
* Balance
*/
-if ( $_GET['histo'] == 4 || $_GET['histo']==5)
+if ($histo == 4 || $histo==5)
{
- $fd=new Fiche_Def($cn,$_REQUEST['cat']);
+ $fd=new Fiche_Def($cn,$http->request('cat'));
if ($allcard==1 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
{
$pdf->write_cell(0,10, "Cette catégorie n'ayant pas de poste comptable
n'a pas de balance");
@@ -64,7 +70,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
}
else
{
- $afiche[0]=array('fd_id'=>$_REQUEST['cat']);
+ $afiche[0]=array('fd_id'=>$http->request('cat'));
}
if ( $allcard==0 && empty($afiche))
@@ -96,26 +102,16 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$idx=0;$sum_deb=0;$sum_cred=0;bcscale(4);
for ($i=0;$i < count($aCard);$i++)
{
- if ( isDate($_REQUEST['start']) == null || isDate ($_REQUEST['end'])
== null ) exit;
- $filter= " (j_date >= to_date('".$_REQUEST['start']."','DD.MM.YYYY') ".
- " and j_date <=
to_date('".$_REQUEST['end']."','DD.MM.YYYY')) ";
+ if ( isDate($http->request('start')) == null || isDate
($http->request('end')) == null ) exit;
+ $filter= " (j_date >=
to_date('".$http->request('start')."','DD.MM.YYYY') ".
+ " and j_date <=
to_date('".$http->request('end')."','DD.MM.YYYY')) ";
$oCard=new Fiche($cn,$aCard[$i]['f_id']);
$solde=$oCard->get_solde_detail($filter);
if ( $solde['debit'] == 0 && $solde['credit']==0) continue;
/* only not purged card */
- if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit'])
continue;
-
- if ( $idx % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
- $idx++;
+ if ($histo == 5 && $solde['debit'] == $solde['credit']) continue;
+ $fill=$pdf->is_fill($idx);
+ $idx++;
$side='';
if(bcsub($solde['credit'],$solde['debit']) < 0) $side='Deb.';
if(bcsub($solde['credit'],$solde['debit']) > 0) $side='Cred.';
@@ -132,16 +128,8 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$pdf->write_cell(20,7,$side,0,0,'C',$fill);
$pdf->line_new();
}
- if ( $idx % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
+ $fill=$pdf->is_fill($idx);
+
$idx++;
// Sum by category
$pdf->write_cell(30,7,"",0,0,'L',$fill);
@@ -173,7 +161,7 @@ else
}
else
{
- $afiche[0] = array('fd_id' => $_REQUEST['cat']);
+ $afiche[0] = array('fd_id' => $http->request('cat'));
}
$fic=new Fiche($cn);
for ($e = 0; $e < count($afiche); $e++)
@@ -194,25 +182,25 @@ else
$fic = new Fiche($cn, $row_fiche['f_id']);
$letter = new Lettering_Card($cn);
$letter->set_parameter('quick_code',
$fic->strAttribut(ATTR_DEF_QUICKCODE));
- $letter->set_parameter('start', $_GET['start']);
- $letter->set_parameter('end', $_GET['end']);
+ $letter->set_parameter('start',$http->request('start'));
+ $letter->set_parameter('end',$http->request('end'));
// all
- if ($_GET['histo'] == 0)
+ if ($histo == 0)
{
$letter->get_all();
}
// lettered
- if ($_GET['histo'] == 1)
+ if ($histo == 1)
{
$letter->get_letter();
}
// unlettered
- if ($_GET['histo'] == 2)
+ if ($histo == 2)
{
$letter->get_unletter();
}
- if ($_GET['histo'] == 6)
+ if ($histo == 6)
{
$letter->get_letter_diff();
}
@@ -240,16 +228,7 @@ else
$prog=0;
for ($i = 0; $i < count($letter->content); $i++)
{
- if ($i % 2 == 0)
- {
- $pdf->SetFillColor(220, 221, 255);
- $fill = 1;
- }
- else
- {
- $pdf->SetFillColor(0, 0, 0);
- $fill = 0;
- }
+ $fill=$pdf->is_fill($i);
$pdf->SetFont('DejaVuCond', '', 7);
$row = $letter->content[$i];
$str_date = shrink_date($row['j_date_fmt']);
- [Noalyss-commit] [noalyss] branch master updated (b77ac34d8 -> 4bf2ca815), dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 07/09: Comptability PHP8.1, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 01/09: PHP8.1 deprecated, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 05/09: Default currency,
dwm <=
- [Noalyss-commit] [noalyss] 06/09: correct global g_parameter, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 02/09: compatibility PHP8.1, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 08/09: Remove dead code, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 03/09: Bug cannot update description in FOLLOW->event, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 04/09: Merge branch 'patch-230902', dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 09/09: task #2297: Suppression $_REQUEST dossier.class.php, dwm, 2023/09/17