noalyss-commit
[Top][All Lists]
Advanced

[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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]