noalyss Version-9
acc_tax_purchase_sale.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * 1/03/20
19*/
20/**
21 * @file
22 * @brief Compute , display additional tax for Sale and Purchase,
23 *
24 */
25// Copyright Author Dany De Bontridder danydb@noalyss.eu 2022
26
28{
29 private $jrn_tax_sql;
30
31 function __construct($p_cn, $p_id = -1)
32 {
33 $this->jrn_tax_sql = new Jrn_Tax_SQL($p_cn, $p_id);
34 }
35
36 /**
37 * @return Jrn_Tax_SQL
38 */
39 public function getJrnTaxSql(): Jrn_Tax_SQL
40 {
41 return $this->jrn_tax_sql;
42 }
43
44 /**
45 * @param Jrn_Tax_SQL $jrn_tax_sql
46 */
48 {
49 $this->jrn_tax_sql = $jrn_tax_sql;
50 return $this;
51 }
52
53 /**
54 * @brief retrieve Jrn_Tax_SQL thx its jr_id
55 * @param $p_jrid
56 */
57 public function get_by_operation_id($p_jrid)
58 {
59 $jt_id= $this->jrn_tax_sql->get_cn()->get_value(
60 "select jt_id from jrn_tax where jr_id=$1",
61 [$p_jrid]);
62 $jt_id=(empty($jt_id))?-1:$jt_id;
63 $this->jrn_tax_sql->set("jt_id",$jt_id);
64 if ($jt_id == -1 ) return;
65 $this->jrn_tax_sql->load();
66 }
67
68 /**
69 * @brief display in detail
70 */
71 public function display()
72 {
73 echo_warning(__FILE__.":".__LINE__.__CLASS__."::".__FUNCTION__."not implemented");
74 }
75 public function save()
76 {
77 if ($this->jrn_tax_sql->get("jt_id") == -1 ) {
78 $this->jrn_tax_sql->insert();
79 return;
80 }
81 $this->jrn_tax_sql->update();
82 }
83
84}
echo_warning($p_string)
warns
Definition: ac_common.php:589
setJrnTaxSql(Jrn_Tax_SQL $jrn_tax_sql)
get_by_operation_id($p_jrid)
retrieve Jrn_Tax_SQL thx its jr_id
ORM of the table public.jrn_tax.