Bug #2065 : non - assujetti , vente ne fonctionnent pas, problème devise

This commit is contained in:
sparkyx 2021-09-07 14:12:35 +02:00
parent 69424956b5
commit d94d05ec0e
5 changed files with 83 additions and 88 deletions

View file

@ -102,17 +102,17 @@ function CurrencyUpdateCode(p_dossier,p_code,p_update)
*/
function CurrencyCompute(p_rate,p_update)
{
var tvac=$('tvac').innerHTML;
var tvac=1;
if ($('tvac')) {
tvac=$('tvac').innerHTML;
}
console.log("tvac= "+tvac);
if ( isNaN(tvac)) {
console.log("tva is nan" + tvac);
tvac=1;
}
var rate=$(p_rate).value;
console.log("rate = "+rate);
if ( isNaN(rate)) {
console.log("rate is nan" + rate);
rate=1;
}
var tot=tvac/rate;
@ -132,20 +132,14 @@ function CurrencyComputeMisc(p_rate,p_update)
var debAmount=$('totalDeb').innerHTML;
var credAmount=$('totalCred').innerHTML;
console.log("debAmount= "+debAmount);
console.log("credAmount= "+credAmount);
if ( isNaN(debAmount)) {
console.log("debAmount is nan" + debAmount);
debAmount=0;
}
if ( isNaN(credAmount)) {
console.log("credAmount is nan" + credAmount);
credAmount=0;
}
var rate=$(p_rate).value;
console.log("rate = "+rate);
if ( isNaN(rate) || parseFloat(rate) == 0) {
console.log("rate is nan" + rate);
rate=1;
}
var totDeb=debAmount/rate;
@ -170,7 +164,7 @@ function CurrencyComputeMisc(p_rate,p_update)
function LedgerCurrencyUpdate(p_dossier,p_code,p_update,p_rate,p_eur_amount)
{
// Hide or show the row of the table with the amount in EUR
if ($(p_code).value != -1) {
if ($(p_code).value != 0) {
$('row_currency').show();
}else {
$('row_currency').hide();

View file

@ -289,7 +289,6 @@ function compute_number(value)
points dans le nombre et eval() lève une exception*/
try
{
console.debug("value = "+value);
retval = eval(value);
} catch (e)
{
@ -4025,7 +4024,7 @@ function check_file_size(p_object,p_max_size)
function check_receipt_size(p_max_size,p_info)
{
document.getElementById(p_info).style.display="inline";
console.debug ("param p_max_file_size"+p_max_size);
var f=document.getElementById("receipt_id");
if ( f && f.files[0] && f.files[0].size > parseFloat(p_max_size)) {
document.getElementById("receipt_info_id").innerHTML=content[78];

View file

@ -351,7 +351,7 @@ if ($op=='upgradeCore')
$progress->set_value(5);
$core->download();
$progress->set_value(55);
if ( DEBUGNOALYSS > 0 )
if ( DEBUGNOALYSS == 0 )
{
$core->install();
}

View file

@ -1404,10 +1404,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"1"
;
$Quantity=new INum();
$Quantity->prec=4;
$Quantity->setReadOnly(false);
$Quantity->size=9;
$Quantity->javascript="onchange=\"format_number(this);clean_tva($i);compute_ledger($i)\"";
$Quantity->javascript="onchange=\"format_number(this,4);clean_tva($i);compute_ledger($i)\"";
$array[$i]['quantity']=$Quantity->input("e_quant".$i,$quant);
}

View file

@ -430,6 +430,8 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$price_euro/* Price /unit */
));
} else {
$tva_item_currency=0;
$r = $this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10) ", array(null, /* 1 */
$j_id, /* 2 */
${'e_march' . $i}, /* 3 */
@ -977,77 +979,79 @@ class Acc_Ledger_Sale extends Acc_Ledger {
// Format amount
$tot_amount=nbm($tot_amount);
$tot_tva=nbm($tot_tva);
$rate=_("Taux ");
if ( $g_parameter->MY_TVA_USE=="Y") {
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
{$str_tot} {$str_code}
</td>
<td class="num">
{$tot_tva}
</td>
<td class="num">
{$tot_amount}
</td>
<td class="num">
{$tot} {$str_code}
</td>
</tr>
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
{$str_tot} {$str_code}
</td>
<td class="num">
{$tot_tva}
</td>
<td class="num">
{$tot_amount}
</td>
<td class="num">
{$tot} {$str_code}
</td>
</tr>
EOF;
if ($p_currency_code !=0) {
$rate=_("Taux ");
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
</td>
<td class="num">
</td>
<td class="num">
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot_eur} EUR
</td>
</tr>
if ($p_currency_code !=0) {
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
</td>
<td class="num">
</td>
<td class="num">
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot_eur} EUR
</td>
</tr>
EOF;
}
} else {
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
{$str_tot} {$str_code}
</td>
<td class="num">
</td>
<td class="num">
</td>
<td class="num">
{$tot}
</td>
</tr>
<tr class="highlight">
{$decalage}
<td>
</td>
<td>
</td>
<td>
}
} else {
// without VAT
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
{$str_tot} {$str_code}
</td>
<td class="num">
</td>
<td class="num">
</td>
<td class="num">
{$tot}
</td>
</tr>
<tr class="highlight">
{$decalage}
<td>
</td>
<td>
</td>
<td>
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot} {$str_code}
</td>
</tr>
</td>
<td class="num">
{$tot_eur} EUR
</td>
</tr>
EOF;
}
$r.='</table>';
@ -1468,13 +1472,12 @@ EOF;
}
// quantity
//--
$quant = (isset(${"e_quant$i"})) ? ${"e_quant$i"} : "1"
;
$quant = (isset(${"e_quant$i"})) ? ${"e_quant$i"} : "1";
$Quantity = new INum();
$Quantity->prec=4;
$Quantity->setReadOnly(false);
$Quantity->size = 8;
$Quantity->javascript = "onchange=\"format_number(this);clean_tva($i);compute_ledger($i);\"";
$Quantity->javascript = "onchange=\"format_number(this,4);clean_tva($i);compute_ledger($i);\"";
$array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant);
}// foreach article
$f_type = _('Client');