noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
invoice.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*/
19// Copyright Author Dany De Bontridder danydb@aevalys.eu 18/08/24
20/*!
21 * \file
22 * \brief display the next invoice to be paid or late for customer or supplier
23 */
24namespace Noalyss\Widget;
25/*!
26 * \class
27 * \brief display the next invoice to be paid or late for customer or supplier
28 */
29class Invoice extends Widget
30{
31 /**
32 * @brief return the constant array Tiers
33 * @return array
34 */
35 static function getConstantTiers() : array
36 {
37 return ['S' => _("Fournisseurs"), "C" => _("Clients")];;
38 }
39 /**
40 * @brief return the constant array Limit
41 * @return array
42 */
43 static function getConstantLimit() :array {
44 return ['P' => _("Prochaines factures"), "R" => "facture en retard",'T'=>_("Aujourd'hui")];
45 }
46
47 /**
48 * @brief let choice what to display
49 * @return void
50 */
51 function input_parameter()
52 {
53 $tiers = new \ISelect('tiers');
55 $tiers->value=[];
56 foreach ($aTiers as $key=>$value) {
57 $tiers->value[]=['value'=>$key,'label'=>$value];
58 }
59 $time_limit = new \ISelect('time_limit');
61 $time_limit->value=[];
62 foreach ($aLimit as $key=>$value) {
63 $time_limit->value[]=['value'=>$key,'label'=>$value];
64 }
65
66 $input = _("Factures ") . $tiers->input() . " " . _("échéance") . " " . $time_limit->input();
67 $this->make_form($input);
68
69 }
70
71 /**
72 * @brief display the parameter
73 * @return void
74 */
76 {
77 $aParam = $this->get_parameter();
79 $aLimit = Invoice::getConstantLimit();
80 echo '<span class="widget_param">'.$aTiers[$aParam['tiers']] . " " . $aLimit[$aParam["time_limit"]].'</span>';
81 }
82
83 /**
84 * @brief display the widget
85 * @return void
86 * @throws \Exception
87 */
88 function display()
89 {
90 $this->open_div();
91 $aParam = $this->get_parameter();
92 $aTiers = Invoice::getConstantTiers();
93 $aLimit = Invoice::getConstantLimit();
94 $title = $aTiers[$aParam['tiers']] . " " . $aLimit[$aParam["time_limit"]];
95
96 $this->title($title);
97
98 $acc_ledger = new \Acc_Ledger($this->db, 0);
99
100 $ledger_type = 'ACH';
101 if ($aParam['tiers'] == 'C') {
102 $ledger_type = 'VEN';
103 }
104
105 switch ($aParam['time_limit']) {
106 case 'P':
107 $array = $acc_ledger->get_operation_date(date('d.m.Y'), $ledger_type, '>');
108 break;
109 case 'R':
110 $array = $acc_ledger->get_operation_date(date('d.m.Y'), $ledger_type, '<');
111 break;
112 case 'T':
113 $array = $acc_ledger->get_operation_date(date('d.m.Y'), $ledger_type, '=');
114 break;
115 }
116 include "invoice-display.php";
117 $this->close_div();
118
119
120 }
121}
_("actif, passif,charge,...")
display the next invoice to be paid or late for customer or supplier
Definition invoice.php:30
display_parameter()
display the parameter
Definition invoice.php:75
static getConstantTiers()
return the constant array Tiers
Definition invoice.php:35
input_parameter()
let choice what to display
Definition invoice.php:51
static getConstantLimit()
return the constant array Limit
Definition invoice.php:43
display()
display the widget
Definition invoice.php:88
Main class for widget.
Definition widget.php:32
get_parameter()
get the parameter of the widget and returns an array
Definition widget.php:345
open_div()
output the DIV HTML with class and id for the widget
Definition widget.php:157
make_form($html_input)
open a form with the DOMID "widget_code"_param, it appears once only for each widget in the dialog bo...
Definition widget.php:287
$anc_filter title
$SecUser db