noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 09/30: New #0002216: Transformation d'une dép


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 09/30: New #0002216: Transformation d'une dépense Gestion en facture achat ou note de frais
Date: Sat, 3 Dec 2022 08:35:07 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit c9c245ee7e40aed072bf3de8a649304474b81b88
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Nov 19 18:29:47 2022 +0100

    New #0002216: Transformation d'une dépense Gestion en facture achat ou note 
de frais
---
 .../class/action_document_type_mtable.class.php    |  7 ++++++
 include/class/default_menu.class.php               | 15 +++++++++---
 include/class/document_option.class.php            | 17 ++++++++++++++
 include/compta_ach.inc.php                         | 14 +++++++++++
 include/compta_ven.inc.php                         |  4 ++--
 include/sql/patch/upgrade180.sql                   |  5 ++++
 .../template/action_document_type_mtable_input.php | 10 +++++++-
 include/template/follow_up_detail_display.php      | 27 ++++++++++++++++++----
 8 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/include/class/action_document_type_mtable.class.php 
b/include/class/action_document_type_mtable.class.php
index 0a4b68d65..b6b4f7b99 100644
--- a/include/class/action_document_type_mtable.class.php
+++ b/include/class/action_document_type_mtable.class.php
@@ -78,6 +78,7 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
         $this->other['detail_operation']=$http->request("detail_operation", 
"string", 0);
         $this->other['contact_multiple']=$http->request("det_contact_mul", 
"string", 0);
         $this->other['make_invoice']=$http->request("make_invoice", "string", 
0);
+        $this->other['make_feenote']=$http->request("make_feenote", "string", 
0);
         $this->other['followup_comment']=$http->request("followup_comment", 
"string", 0);
         
$this->other['editable_description']=$http->request("editable_description", 
"string", 0);
         $this->other['enable_followup']=$http->request("enable_followup", 
"string", 0);
@@ -272,6 +273,12 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
         $cn->exec_sql("insert into document_option 
(do_code,document_type_id,do_enable) values ($1,$2,$3) 
             on conflict on constraint document_option_un
             do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id, 
$this->other['make_invoice']]);
+
+        // Save make feenote
+        $cn->exec_sql("insert into document_option 
(do_code,document_type_id,do_enable) values ($1,$2,$3) 
+            on conflict on constraint document_option_un
+            do update set do_enable=$3 ", ["make_feenote", $object_sql->dt_id, 
$this->other['make_feenote']]);
+
         // Option for comments
             $cn->exec_sql("insert into document_option 
(do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4) 
                 on conflict on constraint document_option_un
diff --git a/include/class/default_menu.class.php 
b/include/class/default_menu.class.php
index 460eb79a2..cc8dc685a 100644
--- a/include/class/default_menu.class.php
+++ b/include/class/default_menu.class.php
@@ -49,15 +49,24 @@ class Default_Menu
             $idx = $tmenu->getp('md_code');
             $this->a_menu_def[$idx] = $tmenu->getp('me_code');
         }
-        $this->code = explode(',', 'code_follow,code_invoice');
+        $this->code = explode(',', 'code_follow,code_invoice,code_feenote',);
     }
 
     function input_value()
     {
         $code_invoice = new IText('code_invoice', 
$this->a_menu_def['code_invoice']);
         $code_follow = new IText('code_follow', 
$this->a_menu_def['code_follow']);
-        echo '<p>' . _('Code pour création facture depuis gestion') . 
$code_invoice->input() . '</p>';
-        echo '<p>' . _('Code pour appel gestion') . $code_follow->input() . 
'</p>';
+        $code_feenote = new IText('code_feenote', 
$this->a_menu_def['code_feenote']);
+        echo '<div class="form-group">';
+        echo '<div class="form-text">' .'<label for="code_invoice">'._('Code 
AD pour création facture depuis gestion').
+        "</label>"."</div>". '<div class="form-text">' .$code_invoice->input() 
. '</div>';
+
+        echo '<div class="form-text">' .'<label for="code_follow">'._('Code AD 
pour appel gestion').
+        "</label>"."</div>". '<div class="form-text">' .$code_follow->input() 
. '</div>';
+
+        echo '<div class="form-text">' .'<label for="code_feenote">'._('Code 
AD pour création note de frais ou facture achat').
+        "</label>"."</div>". '<div class="form-text">' .$code_feenote->input() 
. '</div>';
+        echo '</div>';
     }
 
     private function check_code($p_string)
diff --git a/include/class/document_option.class.php 
b/include/class/document_option.class.php
index 9716de352..cf00f2aa5 100644
--- a/include/class/document_option.class.php
+++ b/include/class/document_option.class.php
@@ -117,6 +117,23 @@ class Document_Option
         }
         return $return;
     }
+    /**
+     * returns true if the operation_detail is enable, otherwise false
+     *
+     * @param int $p_document_type Document_Type.dt_id
+     * @return boolean
+     */
+    static function is_enable_make_feenote($p_document_type)
+    {
+        $return=false;
+        $cn=Dossier::connect();
+        if ($cn->get_value("select do_enable from document_option where 
document_type_id=$1 and do_code = $2",
+                [$p_document_type, 'make_feenote'])=='1')
+        {
+            $return=true;
+        }
+        return $return;
+    }
     /**
      * Returns true if we can add a comment , or false if it is not possible
      * @param integer $p_id is the action_gestion.ag_id
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index 59768647d..73677f8ef 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -239,6 +239,20 @@ try
         echo 'compute_all_ledger();';
         echo '</script>';
     }
+    else if (isset($_GET['create_feenote']))
+    {
+        $array=$Ledger->convert_from_follow($http->get('ag_id',"number"));
+        echo HtmlInput::hidden("ledger_type", "VEN");
+        echo HtmlInput::hidden("ac",$http->get('ac'));
+        echo HtmlInput::hidden("sa", "p");
+        echo $Ledger->input($array);
+        echo '<div class="content">';
+        echo 
$Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
+        echo '</div>';
+        echo '<script>';
+        echo 'compute_all_ledger();';
+        echo '</script>';
+    }
     else
     {
         echo $Ledger->input($array);
diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php
index 954f8bea4..abcce1167 100644
--- a/include/compta_ven.inc.php
+++ b/include/compta_ven.inc.php
@@ -255,9 +255,9 @@ try
     }
     else if (isset($_GET['create_invoice']))
     {
-        $array=$Ledger->convert_from_follow($_GET ['ag_id']);
+        $array=$Ledger->convert_from_follow($http->get('ag_id',"number"));
         echo HtmlInput::hidden("ledger_type", "VEN");
-        echo HtmlInput::hidden("ac", $_REQUEST['ac']);
+        echo HtmlInput::hidden("ac", $http->get('ac'));
         echo HtmlInput::hidden("sa", "p");
         echo $Ledger->input($array);
         echo '<div class="content">';
diff --git a/include/sql/patch/upgrade180.sql b/include/sql/patch/upgrade180.sql
new file mode 100644
index 000000000..0ba2b9712
--- /dev/null
+++ b/include/sql/patch/upgrade180.sql
@@ -0,0 +1,5 @@
+begin;
+insert into menu_default (md_code,me_code)values 
('code_feenote','COMPTA/MENUACH/ACH');
+
+insert into version (val,v_description) values (181,'Make feenote from 
Management');
+commit;
diff --git a/include/template/action_document_type_mtable_input.php 
b/include/template/action_document_type_mtable_input.php
index 16924b848..f988b90a1 100644
--- a/include/template/action_document_type_mtable_input.php
+++ b/include/template/action_document_type_mtable_input.php
@@ -94,7 +94,15 @@ echo $i->input();
 echo _("Création de facture");
 ?>
         </li> 
-        
+        <li>
+<?php
+$i=new ICheckBox("make_feenote",1);
+if ( Document_Option::is_enable_make_feenote($table->dt_id)) $i->set_check(1); 
else $i->set_check(0);
+echo $i->input();
+echo _("Création de note de frais ou facture Achat");
+?>
+        </li>
+
         <li>
             <?php
             $description=new ICheckBox("editable_description",1);
diff --git a/include/template/follow_up_detail_display.php 
b/include/template/follow_up_detail_display.php
index d562377f0..f05ebe47e 100644
--- a/include/template/follow_up_detail_display.php
+++ b/include/template/follow_up_detail_display.php
@@ -193,17 +193,34 @@ $menu=new Default_Menu();
         
     <?php echo HtmlInput::button('actualiser', _('Recalculer'), ' 
onClick="compute_all_ledger();"'); ?>
     </div>
-    <script>compute_all_ledger()</script>    
+    <script>compute_all_ledger()</script>
+    <div class="row">
+
     <?php
     if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)):
         ?>
-        <p id="follow_up_detail_invoice">
+        <div id="follow_up_detail_invoice" class="col m-3">
             <?php
             $query=http_build_query(array('gDossier'=>Dossier::id(), 
'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 
'ac'=>$menu->get('code_invoice')));
-            echo HtmlInput::button_anchor(_("Transformer en facture"), 
"do.php?".$query, "create_invoice",
+            echo HtmlInput::button_anchor(_("Transformer en Facture de 
Vente"), "do.php?".$query, "create_invoice",
                     '  target="_blank" ', "button");
             ?>
-        </p>
+        </div>
+        <?php
+    endif;
+    ?>
+
+    <?php
+    if (Document_Option::is_enable_make_feenote($p_follow_up->dt_id)):
+        ?>
+        <div id="follow_up_detail_feenote" class="col m-3">
+            <?php
+            $query=http_build_query(array('gDossier'=>Dossier::id(), 
'ag_id'=>$p_follow_up->ag_id, 'create_feenote'=>1, 
'ac'=>$menu->get('code_feenote')));
+            echo HtmlInput::button_anchor(_("Transformer en Note de frais ou 
Facture Achat"), "do.php?".$query, "create_feenote",
+                    '  target="_blank" ', "button");
+            ?>
+        </div>
         <?php
     endif;
-    ?>
\ No newline at end of file
+    ?>
+</div>



reply via email to

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