Doc, correct bug introduced by auto-correct
This commit is contained in:
parent
5ebd0c6f52
commit
9473dcbcbf
4 changed files with 349 additions and 353 deletions
|
|
@ -30,15 +30,15 @@ class Additional_Tax
|
|||
private $ac_rate;
|
||||
private $ac_accounting;
|
||||
|
||||
function __construct($tax_amount,$currency_amount,$currency_id,$ac_id,$ac_label,$ac_rate,$ac_accounting)
|
||||
function __construct($tax_amount, $currency_amount, $currency_id, $ac_id, $ac_label, $ac_rate, $ac_accounting)
|
||||
{
|
||||
$this->tax_amount=round($tax_amount,2);
|
||||
$this->currency_amount=round($currency_amount,4);
|
||||
$this->currency_id=$currency_id;
|
||||
$this->ac_id=$ac_id;
|
||||
$this->ac_label=$ac_label;
|
||||
$this->ac_rate=$ac_rate;
|
||||
$this->ac_accounting=$ac_accounting;
|
||||
$this->tax_amount = round($tax_amount, 2);
|
||||
$this->currency_amount = round($currency_amount, 4);
|
||||
$this->currency_id = $currency_id;
|
||||
$this->ac_id = $ac_id;
|
||||
$this->ac_label = $ac_label;
|
||||
$this->ac_rate = $ac_rate;
|
||||
$this->ac_accounting = $ac_accounting;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -97,14 +97,14 @@ class Additional_Tax
|
|||
return $this->ac_accounting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief create an array of Additional_Tax
|
||||
* @param $p_jrn_id
|
||||
* @param $sum_euro
|
||||
* @param $sum_currency
|
||||
* @return array
|
||||
*/
|
||||
static function get_by_operation($p_jrn_id,&$sum_euro,&$sum_currency)
|
||||
/**
|
||||
* @brief create an array of Additional_Tax
|
||||
* @param $p_jrn_id
|
||||
* @param $sum_euro
|
||||
* @param $sum_currency
|
||||
* @return array
|
||||
*/
|
||||
static function get_by_operation($p_jrn_id, &$sum_euro, &$sum_currency)
|
||||
{
|
||||
bcscale(4);
|
||||
global $cn;
|
||||
|
|
@ -128,23 +128,26 @@ class Additional_Tax
|
|||
left join operation_currency oc ON (oc.j_id=jt.j_id)
|
||||
where
|
||||
jr_id=$1", [$p_jrn_id]);
|
||||
$sum_currency=0;$sum_euro=0;
|
||||
if (empty($array)) { return array();}
|
||||
$nb=count($array);
|
||||
$a_additional_tax=array();
|
||||
for ($i=0;$i<$nb;$i++) {
|
||||
$a_additional_tax[]=new Additional_Tax($array[$i]['j_montant'],
|
||||
$array[$i]['oc_amount'],
|
||||
$array[$i]['currency_id'],
|
||||
$array[$i]['ac_id'],
|
||||
$array[$i]['ac_label'],
|
||||
$array[$i]['ac_rate'],
|
||||
$array[$i]['ac_accounting'],
|
||||
);
|
||||
$sum_euro=bcadd($sum_euro,$array[$i]['j_montant']);
|
||||
$sum_currency=bcadd($sum_currency,$array[$i]['oc_amount']);
|
||||
$sum_currency = 0;
|
||||
$sum_euro = 0;
|
||||
if (empty($array)) {
|
||||
return array();
|
||||
}
|
||||
$sum_euro=round($sum_euro,2);
|
||||
$nb = count($array);
|
||||
$a_additional_tax = array();
|
||||
for ($i = 0; $i < $nb; $i++) {
|
||||
$a_additional_tax[] = new Additional_Tax($array[$i]['j_montant'],
|
||||
$array[$i]['oc_amount'],
|
||||
$array[$i]['currency_id'],
|
||||
$array[$i]['ac_id'],
|
||||
$array[$i]['ac_label'],
|
||||
$array[$i]['ac_rate'],
|
||||
$array[$i]['ac_accounting'],
|
||||
);
|
||||
$sum_euro = bcadd($sum_euro, $array[$i]['j_montant']);
|
||||
$sum_currency = bcadd($sum_currency, $array[$i]['oc_amount']);
|
||||
}
|
||||
$sum_euro = round($sum_euro, 2);
|
||||
return $a_additional_tax;
|
||||
}
|
||||
|
||||
|
|
@ -155,21 +158,23 @@ class Additional_Tax
|
|||
* @param $sum_currency
|
||||
* @param int $decalage
|
||||
*/
|
||||
static function display_row($p_jrn_id,&$sum_euro,&$sum_currency,$decalage=0)
|
||||
static function display_row($p_jrn_id, &$sum_euro, &$sum_currency, $decalage = 0)
|
||||
{
|
||||
$a_additional_tax=Additional_Tax::get_by_operation($p_jrn_id,$sum_euro,$sum_currency);
|
||||
$nb=count($a_additional_tax);
|
||||
for ($i=0;$i<$nb;$i++) {
|
||||
$a_additional_tax = Additional_Tax::get_by_operation($p_jrn_id, $sum_euro, $sum_currency);
|
||||
$nb = count($a_additional_tax);
|
||||
for ($i = 0; $i < $nb; $i++) {
|
||||
echo '<tr>';
|
||||
|
||||
echo td($a_additional_tax[$i]->ac_accounting);
|
||||
echo td($a_additional_tax[$i]->ac_label." ( ".$a_additional_tax[$i]->ac_rate." %)");
|
||||
echo td(nbm($a_additional_tax[$i]->tax_amount),'class="num"');
|
||||
echo td("").td("").td("").td("");
|
||||
for ($e=0;$e<$decalage;$e++) { echo td("");}
|
||||
echo td(nbm($a_additional_tax[$i]->tax_amount),'class="num"');
|
||||
if ( $a_additional_tax[$i]->currency_id !=0 ) {
|
||||
echo td(nbm($a_additional_tax[$i]->currency_amount),'class="num"');
|
||||
echo td($a_additional_tax[$i]->ac_label . " ( " . $a_additional_tax[$i]->ac_rate . " %)");
|
||||
echo td(nbm($a_additional_tax[$i]->tax_amount), 'class="num"');
|
||||
echo td("") . td("") . td("") . td("");
|
||||
for ($e = 0; $e < $decalage; $e++) {
|
||||
echo td("");
|
||||
}
|
||||
echo td(nbm($a_additional_tax[$i]->tax_amount), 'class="num"');
|
||||
if ($a_additional_tax[$i]->currency_id != 0) {
|
||||
echo td(nbm($a_additional_tax[$i]->currency_amount), 'class="num"');
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -757,9 +757,9 @@ class HtmlInput
|
|||
|
||||
/**
|
||||
* return default if the value if the value doesn't exist in the array
|
||||
* @param $ind the index to check
|
||||
* @param $default the value to return
|
||||
* @param $array the array
|
||||
* @param $ind string the index to check
|
||||
* @param $default string the value to return
|
||||
* @param $array array the array
|
||||
*/
|
||||
static function default_value($ind, $default, $array)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -229,9 +229,9 @@ class HttpInput
|
|||
}
|
||||
/**
|
||||
* @brief Retrieve from $_REQUEST
|
||||
* @param $p_name name of the variable
|
||||
* @param $p_type type of the variable , opt. default string
|
||||
* @param $p_default default value is variable is not set
|
||||
* @param $p_name string name of the variable
|
||||
* @param $p_type string type of the variable , opt. default string
|
||||
* @param $p_default string default value is variable is not set
|
||||
* @throws Exception if invalid
|
||||
*/
|
||||
function request($p_name, $p_type="string", $p_default="")
|
||||
|
|
|
|||
|
|
@ -1,324 +1,315 @@
|
|||
<?php
|
||||
//This file is part of NOALYSS and is under GPL
|
||||
//see licence.txt
|
||||
global $div,$g_parameter,$cn,$access,$jr_id,$obj;
|
||||
global $div, $g_parameter, $cn, $access, $jr_id, $obj;
|
||||
?>
|
||||
|
||||
<?php require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php'; ?>
|
||||
<?php require_once NOALYSS_TEMPLATE . '/ledger_detail_top.php'; ?>
|
||||
<?php
|
||||
$tab_account=$div."account";
|
||||
$tab_rapprochement=$div."rapproch";
|
||||
$tab_receipt=$div."receipt";
|
||||
$tab_document=$div."document";
|
||||
$str_anc="";
|
||||
?>
|
||||
$tab_account = $div . "account";
|
||||
$tab_rapprochement = $div . "rapproch";
|
||||
$tab_receipt = $div . "receipt";
|
||||
$tab_document = $div . "document";
|
||||
$str_anc = "";
|
||||
?>
|
||||
<div class="content" style="padding:0px;">
|
||||
<?php
|
||||
$owner = new Noalyss_Parameter_Folder($cn);
|
||||
?>
|
||||
|
||||
<?php if ($access == 'W') : ?>
|
||||
<form class="print" onsubmit="return op_save(this);">
|
||||
<?php endif; ?>
|
||||
<?php if ($access == 'W') :
|
||||
echo '<form class="print" onsubmit="return op_save(this);">';
|
||||
endif; ?>
|
||||
|
||||
<?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
|
||||
<table style="width:100%">
|
||||
<tr><td>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
<?php
|
||||
$date = new IDate('p_date');
|
||||
$date->value = format_date($obj->det->jr_date);
|
||||
echo td(_('Date')) . td($date->input());
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<?php
|
||||
$date_ech = new IDate('p_ech');
|
||||
$date_ech->value = format_date($obj->det->jr_ech);
|
||||
echo td(_('Echeance')) . td($date_ech->input());
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php echo _("Date paiement")?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$date_paid = new IDate('p_date_paid');
|
||||
$date_paid->value = format_date($obj->det->jr_date_paid);
|
||||
echo $date_paid->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$bk = new Fiche($cn, $obj->det->array[0]['qs_client']);
|
||||
echo td(_('Client'));
|
||||
<?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
|
||||
echo td($view_card_detail);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$itext = new IText('npj');
|
||||
$itext->value = strip_tags($obj->det->jr_pj_number);
|
||||
echo td(_('Pièce')) . td($itext->input());
|
||||
?>
|
||||
</td>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$itext = new IText('lib');
|
||||
$itext->value = strip_tags($obj->det->jr_comment);
|
||||
$itext->size = 40;
|
||||
echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php echo _("Payé")?></td>
|
||||
<td>
|
||||
<?php
|
||||
$ipaid = new ICheckBox("ipaid", 'paid');
|
||||
$ipaid->selected = ($obj->det->jr_rapt == 'paid');
|
||||
echo $ipaid->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<td></td>
|
||||
<?php
|
||||
$date = new IDate('p_date');
|
||||
$date->value = format_date($obj->det->jr_date);
|
||||
echo td(_('Date')) . td($date->input());
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<?php
|
||||
$date_ech = new IDate('p_ech');
|
||||
$date_ech->value = format_date($obj->det->jr_ech);
|
||||
echo td(_('Echeance')) . td($date_ech->input());
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php echo _("Date paiement") ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$date_paid = new IDate('p_date_paid');
|
||||
$date_paid->value = format_date($obj->det->jr_date_paid);
|
||||
echo $date_paid->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$bk = new Fiche($cn, $obj->det->array[0]['qs_client']);
|
||||
echo td(_('Client'));
|
||||
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:50%;height:100%;vertical-align:top;text-align: center">
|
||||
<table style="width:99%;height:8rem;vertical-align:top;">
|
||||
<tr style="height: 5%">
|
||||
<td style="text-align:center;vertical-align: top">
|
||||
Note
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td style="text-align:center;vertical-align: top">
|
||||
<?php
|
||||
$inote = new ITextarea('jrn_note');
|
||||
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
|
||||
$inote->value = strip_tags($obj->det->note);
|
||||
echo $inote->input();
|
||||
?>
|
||||
$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
|
||||
echo td($view_card_detail);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$itext = new IText('npj');
|
||||
$itext->value = strip_tags($obj->det->jr_pj_number);
|
||||
echo td(_('Pièce')) . td($itext->input());
|
||||
?>
|
||||
</td>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$itext = new IText('lib');
|
||||
$itext->value = strip_tags($obj->det->jr_comment);
|
||||
$itext->size = 40;
|
||||
echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php echo _("Payé") ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$ipaid = new ICheckBox("ipaid", 'paid');
|
||||
$ipaid->selected = ($obj->det->jr_rapt == 'paid');
|
||||
echo $ipaid->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<table class="result" style="margin-left:4px">
|
||||
<?php
|
||||
bcscale(2);
|
||||
$total_htva = 0;
|
||||
$total_tvac = 0;
|
||||
$sum_prod_currency=0;
|
||||
echo th(_('Quick Code'));
|
||||
echo th(_('Description'));
|
||||
echo th(_('Prix/Un'), 'style="text-align:right"');
|
||||
echo th(_('Quantité'), 'style="text-align:right"');
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
echo th(_('Taux TVA'), 'style="text-align:right"');
|
||||
else
|
||||
echo th('');
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
{
|
||||
echo th(_('HTVA'), 'style="text-align:right"');
|
||||
echo th(_('TVA'), 'style="text-align:right"');
|
||||
echo th(_('TVAC'), 'style="text-align:right"');
|
||||
} else
|
||||
echo th(_('Total'), 'style="text-align:right"');
|
||||
/*
|
||||
* If not in EUR
|
||||
*/
|
||||
if ( $obj->det->currency_id != 0 ) {
|
||||
$currency=$obj->db->get_value("select cr_code_iso from currency where id=$1",
|
||||
[$obj->det->currency_id]);
|
||||
echo th($currency, 'style="text-align:right"');
|
||||
}
|
||||
if ($owner->MY_ANALYTIC != 'nu' /*&& $div == 'popup'*/)
|
||||
{
|
||||
$anc = new Anc_Plan($cn);
|
||||
$a_anc = $anc->get_list(" order by pa_id ");
|
||||
$x = count($a_anc);
|
||||
/* set the width of the col */
|
||||
/* add hidden variables pa[] to hold the value of pa_id */
|
||||
$str_anc.='<tr>'.
|
||||
'<th>'.
|
||||
_('Code').
|
||||
'</th>'.
|
||||
'<th>'.
|
||||
_('Poste').
|
||||
'</th>'.
|
||||
'<th>'.
|
||||
_('Montant').
|
||||
'</th>'.
|
||||
'<th colspan="' . $x . '">'
|
||||
. _('Compt. Analytique') .Anc_Plan::hidden($a_anc).
|
||||
'</th>'.
|
||||
'</tr>';
|
||||
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
for ($e = 0; $e < count($obj->det->array); $e++)
|
||||
{
|
||||
$row = '';
|
||||
$q = $obj->det->array[$e];
|
||||
$fiche = new Fiche($cn, $q['qs_fiche']);
|
||||
$qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
$view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" ');
|
||||
$row.=td($view_card_detail);
|
||||
if ($owner->MY_UPDLAB == 'Y')
|
||||
{
|
||||
$l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
|
||||
$hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
|
||||
$input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
|
||||
$input->css_size = "100%";
|
||||
} else
|
||||
{
|
||||
$input = new ISpan("e_march" . $q['j_id'] . "_label");
|
||||
$hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
|
||||
$input->value = $fiche->strAttribut(ATTR_DEF_NAME);
|
||||
}
|
||||
|
||||
$row.=td($input->input() . $hidden);
|
||||
$sym_tva = '';
|
||||
$pu = $q['qs_unit'];
|
||||
$row.=td(nbm($pu,4), 'class="num"');
|
||||
$row.=td(nbm($q['qs_quantite'],4), 'class="num"');
|
||||
$sym_tva = '';
|
||||
if ($owner->MY_TVA_USE == 'Y' && $q['qs_vat_code'] != '')
|
||||
{
|
||||
/* retrieve TVA symbol */
|
||||
$tva = new Acc_Tva($cn, $q['qs_vat_code']);
|
||||
$tva->load();
|
||||
$sym_tva = (h($tva->get_parameter('label')));
|
||||
// $sym_tva=$sym
|
||||
}
|
||||
|
||||
$row.=td($sym_tva, 'style="text-align:center"');
|
||||
|
||||
$htva = $q['qs_price'];
|
||||
|
||||
$row.=td(nbm($htva), 'class="num"');
|
||||
$tva_rounded=round($q['qs_vat'],2);
|
||||
$tvac = bcadd($htva, $tva_rounded);
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
{
|
||||
$class = "";
|
||||
if ($q['qs_vat_sided'] != 0)
|
||||
{
|
||||
$class = ' style="text-decoration:line-through"';
|
||||
$tvac = bcsub($tvac, $tva_rounded);
|
||||
}
|
||||
$row.=td(nbm($tva_rounded), 'class="num"' . $class);
|
||||
$row.=td(nbm($tvac), 'class="num"');
|
||||
}
|
||||
$total_tvac = bcadd($total_tvac, $tvac);
|
||||
$total_htva = bcadd($total_htva, $htva);
|
||||
/* Analytic accountancy */
|
||||
if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */ )
|
||||
{
|
||||
$poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
if ( $g_parameter->match_analytic($poste))
|
||||
{
|
||||
$anc_op = new Anc_Operation($cn);
|
||||
$anc_op->in_div=$div;
|
||||
$anc_op->j_id = $q['j_id'];
|
||||
$side=($q['j_debit'] == 'f')?'C':'D';
|
||||
echo HtmlInput::hidden('opanc[]', $anc_op->j_id);
|
||||
/* compute total price */
|
||||
bcscale(2);
|
||||
$str_anc.='<tr>';
|
||||
$str_anc.=td($qcode);
|
||||
$str_anc.=td($poste);
|
||||
$str_anc.=td(nbm($htva)." {$side}");
|
||||
$str_anc.=$anc_op->display_table(1, $htva, $div).'</tr>';
|
||||
// $row.=($div == 'popup') ? $anc_op->display_table(1, $htva, $div):"";
|
||||
} else
|
||||
{
|
||||
$row.=td('');
|
||||
}
|
||||
}
|
||||
$class=($e%2==0)?' class="even"':'class="odd"';
|
||||
/*
|
||||
* Display Currency in a column, if invoice not recorded in EUR
|
||||
*/
|
||||
if ( $obj->det->currency_id != 0 ) {
|
||||
$value=$obj->db->get_value("select oc_amount+oc_vat_amount from operation_currency where j_id=$1",[$q['j_id']]);
|
||||
$sum_prod_currency=bcadd($sum_prod_currency,$value,4);
|
||||
$row.=td(nbm(round($value,4),4),' class="num"');
|
||||
|
||||
}
|
||||
echo tr($row,$class);
|
||||
}
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
$row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
|
||||
else
|
||||
$row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
|
||||
/**
|
||||
* display additional tax if any + currency
|
||||
*/
|
||||
$sum_add_tax=0;$sum_add_tax_cur=0;
|
||||
Additional_Tax::display_row($jr_id,$sum_add_tax,$sum_add_tax_cur);
|
||||
print_r("sum_add_tax_cur $sum_add_tax_cur");
|
||||
$sum_prod_currency=bcadd($sum_prod_currency,$sum_add_tax_cur);
|
||||
|
||||
$total_tvac=bcadd($sum_add_tax,$total_tvac);
|
||||
if ($owner->MY_TVA_USE == 'N') {
|
||||
$total_htva=bcadd($sum_add_tax,$total_htva);
|
||||
}
|
||||
$row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
if ($owner->MY_TVA_USE == 'Y') {
|
||||
$row.=td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
|
||||
}
|
||||
|
||||
//Display total in currency
|
||||
if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
|
||||
{
|
||||
$row.= td(nbm($sum_prod_currency,2),' class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
}
|
||||
echo tr($row);
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
/*
|
||||
* Info about currency if not in euro
|
||||
*/
|
||||
<td style="width:50%;height:100%;vertical-align:top;text-align: center">
|
||||
<table style="width:99%;height:8rem;vertical-align:top;">
|
||||
<tr style="height: 5%">
|
||||
<td style="text-align:center;vertical-align: top">
|
||||
Note
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:center;vertical-align: top">
|
||||
<?php
|
||||
$inote = new ITextarea('jrn_note');
|
||||
$inote->style = ' class="itextarea" style="width:90%;height:100%;"';
|
||||
$inote->value = strip_tags($obj->det->note);
|
||||
echo $inote->input();
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<table class="result" style="margin-left:4px">
|
||||
<?php
|
||||
bcscale(2);
|
||||
$total_htva = 0;
|
||||
$total_tvac = 0;
|
||||
$sum_prod_currency = 0;
|
||||
echo th(_('Quick Code'));
|
||||
echo th(_('Description'));
|
||||
echo th(_('Prix/Un'), 'style="text-align:right"');
|
||||
echo th(_('Quantité'), 'style="text-align:right"');
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
echo th(_('Taux TVA'), 'style="text-align:right"');
|
||||
else
|
||||
echo th('');
|
||||
if ($owner->MY_TVA_USE == 'Y') {
|
||||
echo th(_('HTVA'), 'style="text-align:right"');
|
||||
echo th(_('TVA'), 'style="text-align:right"');
|
||||
echo th(_('TVAC'), 'style="text-align:right"');
|
||||
} else
|
||||
echo th(_('Total'), 'style="text-align:right"');
|
||||
/*
|
||||
* If not in EUR
|
||||
*/
|
||||
if ($obj->det->currency_id != 0) {
|
||||
$currency = $obj->db->get_value("select cr_code_iso from currency where id=$1",
|
||||
[$obj->det->currency_id]);
|
||||
echo th($currency, 'style="text-align:right"');
|
||||
}
|
||||
if ($owner->MY_ANALYTIC != 'nu' /*&& $div == 'popup'*/) {
|
||||
$anc = new Anc_Plan($cn);
|
||||
$a_anc = $anc->get_list(" order by pa_id ");
|
||||
$x = count($a_anc);
|
||||
/* set the width of the col */
|
||||
/* add hidden variables pa[] to hold the value of pa_id */
|
||||
$str_anc .= '<tr>' .
|
||||
'<th>' .
|
||||
_('Code') .
|
||||
'</th>' .
|
||||
'<th>' .
|
||||
_('Poste') .
|
||||
'</th>' .
|
||||
'<th>' .
|
||||
_('Montant') .
|
||||
'</th>' .
|
||||
'<th colspan="' . $x . '">'
|
||||
. _('Compt. Analytique') . Anc_Plan::hidden($a_anc) .
|
||||
'</th>' .
|
||||
'</tr>';
|
||||
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
for ($e = 0; $e < count($obj->det->array); $e++) {
|
||||
$row = '';
|
||||
$q = $obj->det->array[$e];
|
||||
$fiche = new Fiche($cn, $q['qs_fiche']);
|
||||
$qcode = $fiche->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
$view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" ');
|
||||
$row .= td($view_card_detail);
|
||||
if ($owner->MY_UPDLAB == 'Y') {
|
||||
$l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
|
||||
$hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
|
||||
$input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
|
||||
$input->css_size = "100%";
|
||||
} else {
|
||||
$input = new ISpan("e_march" . $q['j_id'] . "_label");
|
||||
$hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
|
||||
$input->value = $fiche->strAttribut(ATTR_DEF_NAME);
|
||||
}
|
||||
|
||||
$row .= td($input->input() . $hidden);
|
||||
$sym_tva = '';
|
||||
$pu = $q['qs_unit'];
|
||||
$row .= td(nbm($pu, 4), 'class="num"');
|
||||
$row .= td(nbm($q['qs_quantite'], 4), 'class="num"');
|
||||
$sym_tva = '';
|
||||
if ($owner->MY_TVA_USE == 'Y' && $q['qs_vat_code'] != '') {
|
||||
/* retrieve TVA symbol */
|
||||
$tva = new Acc_Tva($cn, $q['qs_vat_code']);
|
||||
$tva->load();
|
||||
$sym_tva = (h($tva->get_parameter('label')));
|
||||
// $sym_tva=$sym
|
||||
}
|
||||
|
||||
$row .= td($sym_tva, 'style="text-align:center"');
|
||||
|
||||
$htva = $q['qs_price'];
|
||||
|
||||
$row .= td(nbm($htva), 'class="num"');
|
||||
$tva_rounded = round($q['qs_vat'], 2);
|
||||
$tvac = bcadd($htva, $tva_rounded);
|
||||
if ($owner->MY_TVA_USE == 'Y') {
|
||||
$class = "";
|
||||
if ($q['qs_vat_sided'] != 0) {
|
||||
$class = ' style="text-decoration:line-through"';
|
||||
$tvac = bcsub($tvac, $tva_rounded);
|
||||
}
|
||||
$row .= td(nbm($tva_rounded), 'class="num"' . $class);
|
||||
$row .= td(nbm($tvac), 'class="num"');
|
||||
}
|
||||
$total_tvac = bcadd($total_tvac, $tvac);
|
||||
$total_htva = bcadd($total_htva, $htva);
|
||||
/* Analytic accountancy */
|
||||
if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */) {
|
||||
$poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
if ($g_parameter->match_analytic($poste)) {
|
||||
$anc_op = new Anc_Operation($cn);
|
||||
$anc_op->in_div = $div;
|
||||
$anc_op->j_id = $q['j_id'];
|
||||
$side = ($q['j_debit'] == 'f') ? 'C' : 'D';
|
||||
echo HtmlInput::hidden('opanc[]', $anc_op->j_id);
|
||||
/* compute total price */
|
||||
bcscale(2);
|
||||
$str_anc .= '<tr>';
|
||||
$str_anc .= td($qcode);
|
||||
$str_anc .= td($poste);
|
||||
$str_anc .= td(nbm($htva) . " {$side}");
|
||||
$str_anc .= $anc_op->display_table(1, $htva, $div) . '</tr>';
|
||||
// $row.=($div == 'popup') ? $anc_op->display_table(1, $htva, $div):"";
|
||||
} else {
|
||||
$row .= td('');
|
||||
}
|
||||
}
|
||||
$class = ($e % 2 == 0) ? ' class="even"' : 'class="odd"';
|
||||
/*
|
||||
* Display Currency in a column, if invoice not recorded in EUR
|
||||
*/
|
||||
if ($obj->det->currency_id != 0) {
|
||||
$value = $obj->db->get_value("select oc_amount+oc_vat_amount from operation_currency where j_id=$1", [$q['j_id']]);
|
||||
$sum_prod_currency = bcadd($sum_prod_currency, $value, 4);
|
||||
$row .= td(nbm(round($value, 4), 4), ' class="num"');
|
||||
|
||||
}
|
||||
echo tr($row, $class);
|
||||
}
|
||||
if ($owner->MY_TVA_USE == 'Y')
|
||||
$row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
|
||||
else
|
||||
$row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
|
||||
/**
|
||||
* display additional tax if any + currency
|
||||
*/
|
||||
$sum_add_tax = 0;
|
||||
$sum_add_tax_cur = 0;
|
||||
Additional_Tax::display_row($jr_id, $sum_add_tax, $sum_add_tax_cur);
|
||||
|
||||
$sum_prod_currency = bcadd($sum_prod_currency, $sum_add_tax_cur);
|
||||
|
||||
$total_tvac = bcadd($sum_add_tax, $total_tvac);
|
||||
if ($owner->MY_TVA_USE == 'N') {
|
||||
$total_htva = bcadd($sum_add_tax, $total_htva);
|
||||
}
|
||||
$row .= td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
if ($owner->MY_TVA_USE == 'Y') {
|
||||
$row .= td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
|
||||
}
|
||||
|
||||
//Display total in currency
|
||||
if ($obj->det->currency_id != "" && $obj->det->currency_id > 0) {
|
||||
$row .= td(nbm($sum_prod_currency, 2), ' class="num" style="font-style:italic;font-weight: bolder;"');
|
||||
}
|
||||
echo tr($row);
|
||||
?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
/*
|
||||
* Info about currency if not in euro
|
||||
*/
|
||||
// Add a row with currency and amount
|
||||
if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
|
||||
{
|
||||
$currency=new Acc_Currency($obj->db, $obj->det->currency_id);
|
||||
$four_space=" "." "." "." ";
|
||||
|
||||
echo $currency->get_code(),$four_space;
|
||||
echo _("Taux utilisé")," ", nbm($obj->det->currency_rate,4),$four_space;
|
||||
echo _("Taux Réf"), " ",nbm($obj->det->currency_rate_ref,4).$four_space;
|
||||
echo _("Montant en devise"), " ",nbm($sum_prod_currency,4).$four_space;
|
||||
if ($obj->det->currency_id != "" && $obj->det->currency_id > 0) {
|
||||
$currency = new Acc_Currency($obj->db, $obj->det->currency_id);
|
||||
$four_space = " " . " " . " " . " ";
|
||||
|
||||
echo $currency->get_code(), $four_space;
|
||||
echo _("Taux utilisé"), " ", nbm($obj->det->currency_rate, 4), $four_space;
|
||||
echo _("Taux Réf"), " ", nbm($obj->det->currency_rate_ref, 4) . $four_space;
|
||||
echo _("Montant en devise"), " ", nbm($sum_prod_currency, 4) . $four_space;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<?php
|
||||
require_once NOALYSS_TEMPLATE.'/ledger_detail_bottom.php';
|
||||
?>
|
||||
<?php
|
||||
require_once NOALYSS_TEMPLATE . '/ledger_detail_bottom.php';
|
||||
?>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue