diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 317a674d6..d2983761e 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -220,7 +220,7 @@ class Acc_Ledger extends jrn_def_sql // Mark the operation invalid into the ledger // to avoid to nullify twice the same op. - $sql = "update jrn set jr_comment='Annule : '||jr_comment where jr_id=$1"; + $sql = "update jrn set jr_comment='extourne : '||jr_comment where jr_id=$1"; $Res = $this->db->exec_sql($sql, array($this->jr_id)); // Check return code @@ -287,7 +287,7 @@ class Acc_Ledger extends jrn_def_sql jr_internal ,jr_tech_per, jr_valid ) - select $1,jr_def_id,jr_montant,'Annulation '||jr_comment, + select $1,jr_def_id,jr_montant,jr_comment, to_date($2,'DD.MM.YYYY'),$3,$4, $5, true from @@ -326,6 +326,7 @@ class Acc_Ledger extends jrn_def_sql $Res = $this->db->exec_sql($sql); if ($Res == false) throw (new Exception(__FILE__ . __LINE__ . "SQL ERROR [ $sql ]")); + $this->db->commit(); } catch (Exception $e) { @@ -1518,7 +1519,9 @@ class Acc_Ledger extends jrn_def_sql if (trim(${'qc_' . $i}) == "" && trim(${'poste' . $i}) == "") continue; - $ret.="" . h(${"ld" . $i}) . HtmlInput::hidden('ld' . $i, ${'ld' . $i}) . ""; + $ret.="" . h(${"ld" . $i}) . HtmlInput::hidden('ld' . $i, ${'ld' . $i}) ; + $ret .=(isset(${"ck$i"})) ? HtmlInput::hidden('ck' . $i, ${'ck' . $i}) : ""; + $ret .= ""; if (isset(${"ck$i"})) { $ret.="" . nbm(${"amount" . $i}) . HtmlInput::hidden('amount' . $i, ${'amount' . $i}) . "" . td(""); @@ -1529,9 +1532,9 @@ class Acc_Ledger extends jrn_def_sql $ret.=td("") . "" . nbm(${"amount" . $i}) . HtmlInput::hidden('amount' . $i, ${'amount' . $i}) . ""; $total_cred = bcadd($total_cred, ${"amount" . $i}); } - $ret.=""; + /*$ret.=""; $ret.=(isset(${"ck$i"})) ? HtmlInput::hidden('ck' . $i, ${'ck' . $i}) : ""; - $ret.=""; + $ret.="";*/ // CA if ($g_parameter->MY_ANALYTIC != 'nu') // use of AA @@ -3903,7 +3906,7 @@ class Acc_Ledger extends jrn_def_sql public function select_depot($p_readonly, $p_repo) { global $g_parameter; - $r='
'; + $r=($p_readonly==false)?'
':'
'; // Show the available repository if ($g_parameter->MY_STOCK=='Y') { diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 208b73796..47b488561 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -78,10 +78,14 @@ if (isset($_POST['view_invoice'])) echo HtmlInput::hidden('ac', $_REQUEST['ac']); ?> '; - echo HtmlInput::submit("record", _("Enregistrement"), 'onClick="return verify_ca(\'\');"'); + + echo ''; + + echo HtmlInput::submit("record", _("Enregistrement"), 'onClick="return verify_ca(\'\');"'); echo HtmlInput::submit('correct', _("Corriger")); echo ''; echo '
'; /* tab_id */ echo '
'; ?> '; @@ -157,6 +170,33 @@ if (isset($_POST['record'])) echo '

'._('Document').'

'; echo $Ledger->doc; } + // extourne + if (isset($_POST['reverse_ck'])) + { + $p_date=HtmlInput::default_value_post('reverse_date', ''); + if (isDate($p_date)==$p_date) + { + // reverse the operation + try + { + $Ledger->reverse($p_date); + echo '

'; + echo _('Extourné au ').$p_date; + echo '

'; + } + catch (Exception $e) + { + echo '

'._('Opération non extournée'). + $e->getMessage(). + '

'; + } + } + else + { + // warning because date is invalid + echo '

'._('Date invalide, opération non extournée').'

'; + } + } echo $Ledger->button_new_operation(); echo '
'; return; diff --git a/include/compta_ods.inc.php b/include/compta_ods.inc.php index 8c3d44963..678cba017 100644 --- a/include/compta_ods.inc.php +++ b/include/compta_ods.inc.php @@ -100,6 +100,34 @@ elseif (isset($_POST['save'])) // show feedback echo '
'; echo '

' . $ledger->get_name() . '

'; echo '
'; echo $ledger->confirm($_POST, true); + // extourne + if (isset($_POST['reverse_ck'])) + { + $p_date=HtmlInput::default_value_post('reverse_date', ''); + if (isDate($p_date)==$p_date) + { + // reverse the operation + try + { + $ledger->reverse($p_date); + echo '

'; + echo _('Extourné au ').$p_date; + echo '

'; + } + catch (Exception $e) + { + echo '

'._('Opération non extournée'). + $e->getMessage(). + '

'; + + } + } + else + { + // warning because date is invalid + echo '

'._('Date invalide, opération non extournée').'

'; + } + } echo $ledger->button_new_operation(); } diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index 5f0e10f22..2b2a29546 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -87,10 +87,14 @@ $p_msg=""; echo HtmlInput::hidden('ac',$_REQUEST['ac']); ?>
+ select_depot(false, -1); @@ -99,6 +103,14 @@ $p_msg=""; echo Pre_operation::save_propose(); echo '
'; + + echo ''; + echo HtmlInput::hidden('ac',$_REQUEST['ac']); echo HtmlInput::submit("record",_("Enregistrement"),'onClick="return verify_ca(\'\');"'); echo HtmlInput::submit('correct',_("Corriger")); @@ -107,8 +119,9 @@ $p_msg=""; echo ''; /* tab_id */ ?> '; @@ -173,6 +186,34 @@ $p_msg=""; /* Save the additional information into jrn_info */ $obj=new Acc_Ledger_Info($cn); $obj->save_extra($Ledger->jr_id,$_POST); + // extourne + if (isset($_POST['reverse_ck'])) + { + $p_date=HtmlInput::default_value_post('reverse_date', ''); + if (isDate($p_date)==$p_date) + { + // reverse the operation + try + { + $Ledger->reverse($p_date); + echo '

'; + echo _('Extourné au ').$p_date; + echo '

'; + + } + catch (Exception $e) + { + echo '

'._('Opération non extournée'). + $e->getMessage(). + '

'; + } + } + else + { + // warning because date is invalid + echo '

'._('Date invalide, opération non extournée').'

'; + } + } echo $Ledger->button_new_operation(); diff --git a/include/operation_ods_confirm.inc.php b/include/operation_ods_confirm.inc.php index e9e7a23a1..c2f958687 100644 --- a/include/operation_ods_confirm.inc.php +++ b/include/operation_ods_confirm.inc.php @@ -41,11 +41,31 @@ echo '
'; echo HtmlInput::request_to_hidden(array('ac')); echo $ledger->confirm($_POST,false); -echo '
'; -echo Pre_operation::save_propose(); -echo '
'; + +?> +
+ + +
+ +
+ +
+'; ?> +