[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 16/24: Additional Tax : export operation PDF
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 16/24: Additional Tax : export operation PDF |
Date: |
Tue, 12 Jul 2022 07:05:34 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 867838d11c8813cde485e4d4358b694ada5f00c6
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue May 31 13:48:53 2022 +0200
Additional Tax : export operation PDF
---
include/class/additional_tax.class.php | 57 ++++++++++++++++++++++++++++++++++
include/class/pdf_operation.class.php | 34 +++++++++++++++++++-
2 files changed, 90 insertions(+), 1 deletion(-)
diff --git a/include/class/additional_tax.class.php
b/include/class/additional_tax.class.php
index d26d05447..baecba6d0 100644
--- a/include/class/additional_tax.class.php
+++ b/include/class/additional_tax.class.php
@@ -40,6 +40,63 @@ class Additional_Tax
$this->ac_rate=$ac_rate;
$this->ac_accounting=$ac_accounting;
}
+
+ /**
+ * @return float
+ */
+ public function getTaxAmount(): float
+ {
+ return $this->tax_amount;
+ }
+
+ /**
+ * @return float
+ */
+ public function getCurrencyAmount(): float
+ {
+ return $this->currency_amount;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCurrencyId()
+ {
+ return $this->currency_id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAcId()
+ {
+ return $this->ac_id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAcLabel()
+ {
+ return $this->ac_label;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAcRate()
+ {
+ return $this->ac_rate;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAcAccounting()
+ {
+ return $this->ac_accounting;
+ }
+
/**
* @brief create an array of Additional_Tax
* @param $p_jrn_id
diff --git a/include/class/pdf_operation.class.php
b/include/class/pdf_operation.class.php
index 0fa19b09c..2b3e859b6 100644
--- a/include/class/pdf_operation.class.php
+++ b/include/class/pdf_operation.class.php
@@ -203,13 +203,19 @@ class PDF_Operation extends PDF {
$sum_amount=bcadd($sum_amount,$row["qs_price"]);
$sum_vat=bcadd($sum_vat,$row["qs_vat"]);
}
+ /* print addition Tax */
+ $a=$b=0;
+ $sum_other_tax=$this->print_other_tax();
+
$this->pdf->SetFont('DejaVu', 'B', 6);
$this->pdf->write_cell($width[0],6,"");
$this->pdf->write_cell($width[1],6,"");
$this->pdf->write_cell($width[2],6,"");
$this->pdf->write_cell($width[3],6,nbm($sum_amount,2),"",0,"R");
- $this->pdf->write_cell($width[4],6,"");
+ $this->pdf->write_cell($width[4],6,nbm($sum_other_tax,2),"",0,"R"); //
additional tax
$this->pdf->write_cell($width[5],6,nbm($sum_vat,2),"",0,"R");
+ // add sum_other_ax to total
+ $sum_amount=bcadd($sum_other_tax,$sum_amount);
$this->pdf->write_cell($width[6],6,nbm(bcadd($sum_amount,$sum_vat),2),"",0,"R");
$this->pdf->line_new(4);
@@ -248,6 +254,10 @@ class PDF_Operation extends PDF {
$sum_amount=bcadd($sum_amount,$row["qp_price"]);
$sum_vat=bcadd($sum_vat,$row["qp_vat"]);
}
+ /* print addition Tax */
+ $a=$b=0;
+ $sum_other_tax=$this->print_other_tax();
+
$this->pdf->SetFont('DejaVu', 'B', 6);
$this->pdf->write_cell($width[0],6,"");
$this->pdf->write_cell($width[1],6,"");
@@ -255,6 +265,8 @@ class PDF_Operation extends PDF {
$this->pdf->write_cell($width[3],6,nbm($sum_amount,2),"",0,"R");
$this->pdf->write_cell($width[4],6,"");
$this->pdf->write_cell($width[5],6,nbm($sum_vat,2),"",0,"R");
+ $this->pdf->write_cell($width[4],6,nbm($sum_other_tax,2),"",0,"R"); //
additional tax
+ $sum_amount=bcadd($sum_other_tax,$sum_amount);
$this->pdf->write_cell($width[6],6,nbm(bcadd($sum_amount,$sum_vat),2),"",0,"R");
$this->pdf->line_new(10);
@@ -264,6 +276,26 @@ class PDF_Operation extends PDF {
$this->pdf->write_cell(60,8,$p_section,"1");
$this->pdf->line_new(8);
}
+ private function print_other_tax()
+ {
+ $width=array(10,80,25,25,25,25);
+ $aOther_tax=Additional_Tax::get_by_operation($this->jr_id,$a,$b);
+ $total=0;
+ foreach ($aOther_tax as $other_tax)
+ {
+ $amount=$other_tax->getTaxAmount();
+ $total=bcadd($amount,$total,2);
+ $this->pdf->write_cell($width[0],6,"");
+ $this->pdf->write_cell($width[1],6,$other_tax->getAcLabel(). "
".$other_tax->getAcRate()."%");
+
+ $this->pdf->write_cell($width[3],6,"");
+ $this->pdf->write_cell($width[2],6,nbm($amount,2),"",0,"R");
+ $this->pdf->write_cell($width[4],6,"");
+ $this->pdf->write_cell($width[5],6,$total,"",0,"R");
+ $this->pdf->line_new(6);
+ }
+ return $total;
+ }
private function print_acc_writing(){
$obj1=new Acc_Operation($this->cn);
$obj1->set_id($this->jr_id);
- [Noalyss-commit] [noalyss] 02/24: remove direct access to $_POST and extract, (continued)
- [Noalyss-commit] [noalyss] 02/24: remove direct access to $_POST and extract, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 03/24: ISelect->display fails if this->value if null, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 06/24: Bug when ledger badly parametrized, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 08/24: Merge branch 'devel', Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 05/24: Security : management , profile access, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 09/24: Supplemental TAX : manage parameter A ledger can have only 1 supplemental tax, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 13/24: code documentation, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 10/24: New : 2178 Additional Tax : input in purchase and sale ledger - tax with positive amount - tax with negative amount - tax in currency, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 11/24: Nouveau #0002178: Cotisation de solidarité Impression : Listing (HTML, CSV et PDF) Impression : Extended (HTML, CSV et PDF) Negatif amount and currency, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 14/24: Additional Tax : database changes, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 16/24: Additional Tax : export operation PDF,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 17/24: Additional Tax : automatic compute, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 23/24: Bug : supplemental tax cannot be deleted, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 19/24: Cosmetic : waiting box if confirmed, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 04/24: Remove unauthorized profile, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 07/24: cosmetic, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 12/24: Additional Tax : input in purchase and sale ledger - tax with positive amount - tax with negative amount - tax currency - Reverse operation - Correct in operation detail the amount of linked operation, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 18/24: Additional tax : remains when correct operation Cosmetic, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 20/24: Cosmetic : restore administration, we set the max filesize, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 22/24: Doc, correct bug introduced by auto-correct, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 15/24: Additional Tax : security, Dany De Bontridder, 2022/07/12