New #0002216: Transformation d'une dépense Gestion en facture achat ou note de frais
This commit is contained in:
parent
f43666dcb7
commit
c9c245ee7e
8 changed files with 88 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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">';
|
||||
|
|
|
|||
5
include/sql/patch/upgrade180.sql
Normal file
5
include/sql/patch/upgrade180.sql
Normal file
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
?>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue