function bogfor($id, $webservice) { echo "<!--function bogfor start-->"; global $regnaar; global $fakturadate; global $valutakurs; global $pbs; global $mail_fakt; global $db; global $brugernavn; global $momssats; global $retur; # $fp=fopen("../temp/ordrefunc.log","a"); # $linje="select * from ordrer where id = $id"; # fwrite($fp,$linje."\n"); $query = db_select("select * from ordrer where id = {$id}", __FILE__ . " linje " . __LINE__); $row = db_fetch_array($query); $konto_id = $row['konto_id']; $ordredate = $row['ordredate']; $levdate = $row['levdate']; $fakturadate = $row['fakturadate']; $nextfakt = $row['nextfakt']; $art = $row['art']; $kred_ord_id = $row['kred_ord_id']; $valuta = $row['valuta']; $art = $row['art']; $fakturanr = $row['fakturanr']; $procenttillag = $row['procenttillag'] * 1; $momssats = $row['momssats']; #cho $row['sum']." -> ".$row['moms']."<br>"; if ($art == 'PO') { $sum = $row['sum']; $moms = afrund($row['moms'], 2); #cho "Moms $moms<br>"; $betaling = $row['felt_1']; $betalt = $row['felt_2']; $betaling2 = $row['felt_3']; $betalt2 = $row['felt_4']; $betalingsbet = $row['betalingsbet']; if ($betalingsbet == 'Kontant') { $konto_id = '0'; } $r = db_fetch_array(db_select("select box2 from grupper where art='OreDif'", __FILE__ . " linje " . __LINE__)); $difkto = $r['box2']; } if ($row['status'] > '2') { return "invoice allready created for order id {$id}"; } #cho "procenttillag $procenttillag<br>"; if ($procenttillag) { $sum = 0; $q = db_select("select * from ordrelinjer where ordre_id='{$id}' order by posnr", __FILE__ . " linje " . __LINE__); while ($r = db_fetch_array($q)) { if ($r['vare_id']) { $linjesum = $r['antal'] * $r['pris']; if ($r['rabat']) { $linjesum -= $linjesum * $r['rabat'] / 100; } $linjesum -= $linjesum * (100 - $r['procent']) / 100; $sum += $linjesum; } $posnr = $r['posnr']; } $posnr++; $tillag = $sum / 100 * $procenttillag; $qtxt = "select box13 from grupper where art = 'DIV' and kodenr = '3'"; #cho "$qtxt<br>"; $r = db_fetch_array(db_select($qtxt, __FILE__ . " linje " . __LINE__)); list($tmp, $procentvare) = explode(chr(9), $r['box13']); #cho "box13 $r[box13] -> $procentvare<br>"; if ($procentvare) { $qtxt = "select * from varer where varenr = '{$procentvare}'"; #cho "$qtxt<br>"; $r = db_fetch_array(db_select($qtxt, __FILE__ . " linje " . __LINE__)); if ($r['id']) { #cho "$id,$r[varenr],1,$r[beskrivelse],$tillag,0,100,$art,'',$posnr,'','','on','percent',''<br>"; $tmp = str_replace('$procenttillæg;', $procenttillag, $r['beskrivelse']); opret_ordrelinje($id, $r['id'], $r['varenr'], 1, $tmp, $tillag, 0, 100, $art, '', $posnr, '', '', 'on', 'percent', ''); #20140426 $r = db_fetch_array(db_select("select max(id) as linje_id from ordrelinjer where ordre_id='{$id}'", __FILE__ . " linje " . __LINE__)); db_modify("update ordrelinjer set leveres='1' where id='{$r['linje_id']}'", __FILE__ . " linje " . __LINE__); levering($id, '', '', ''); $sum += $tillag; #cho "update ordrer set sum=sum+$tillag, moms=moms+$tillag/100*$momssats where id = '$id'<br>"; db_modify("update ordrer set sum=sum+{$tillag}, moms=moms+{$tillag}/100*{$momssats} where id = '{$id}'", __FILE__ . " linje " . __LINE__); #xit; } else { return 'Manglende vare til procenttillæg'; } } else { return 'Manglende vare til procenttillæg -- ' . $procentvare; } } # $x=0; # $saet=array(); $diff = 0; $saetsum = 0; $saetmoms = 0; $q = db_select("select * from ordrelinjer where ordre_id='{$id}' order by saet", __FILE__ . " linje " . __LINE__); $art == 'DO' ? $dan_kn = 1 : ($dan_kn = 0); while ($r = db_fetch_array($q)) { if ($r['vare_id'] && $r['antal'] >= 0) { $dan_kn = 0; } # if ($r['saet'] && in_array($r['saet'],$saet) { # $saetsum[$x]+=$r['pris']*$r['antal']-($r['pris']*$r['antal']*$r['rabat']/100); # } elseif ($r['saet']) { if ($r['saet']) { $tmp = $r['pris'] * $r['antal'] - $r['pris'] * $r['antal'] * $r['rabat'] / 100; $saetsum += $tmp; if (!$r['momsfri'] && $momssats) { $saetmoms += $tmp * $momssats / 100; } } } if ($saetsum) { $r = db_fetch_array(db_select("select box2 from grupper where art='OreDif'", __FILE__ . " linje " . __LINE__)); $difkto = $r['box2']; $tmp = afrund($saetsum + $saetmoms, 2); $diff = $tmp - pos_afrund($tmp, $difkto); # if (afrund($diff,2)) saet_afrund($id,$saetsum,$saetmoms,$difkto); } # $q=db_select("select * from ordrelinjer where ordre_id='$id' order by posnr",__FILE__ . " linje " . __LINE__); # while ($r = db_fetch_array($q)) #cho "Ordrelinje $r[posnr] $r[ordre_id] $r[vare_id] $r[varenr] $r[beskrivelse] >$r[projekt]< $r[bogf_konto]<br>"; #xit; $query = db_select("select box1, box2, box3, box4 from grupper where art='RA' and kodenr='{$regnaar}'", __FILE__ . " linje " . __LINE__); if ($row = db_fetch_array($query)) { $year = $row['box2'] * 1; $month = $row['box1'] * 1; #20130411-2 if ($month < 10) { $month = "0" . $month; } #20130411-2 $aarstart = str_replace(" ", "", $year . $month); $year = $row['box4'] * 1; $month = $row['box3'] * 1; if ($month < 10) { $month = "0" . $month; } $aarslut = str_replace(" ", "", $year . $month); } $query = db_select("select * from ordrer where id = '{$id}'", __FILE__ . " linje " . __LINE__); $row = db_fetch_array($query); if (!$fakturadate) { if ($webservice) { return "missing invoicedate for order {$id}"; } else { print "<meta http-equiv=\"refresh\" content=\"0;URL=../debitor/fakturadato.php?id={$id}&pbs={$pbs}&mail_fakt={$mail_fakt}&returside=bogfor.php\">"; exit; } } if ($valuta && $valuta != 'DKK') { if ($r = db_fetch_array(db_select("select valuta.kurs as kurs, grupper.box3 as difkto from valuta, grupper where grupper.art='VK' and grupper.box1='{$valuta}' and valuta.gruppe=" . nr_cast("grupper.kodenr") . " and valuta.valdate <= '{$fakturadate}' order by valuta.valdate desc", __FILE__ . " linje " . __LINE__))) { $valutakurs = $r['kurs'] * 1; $difkto = $r['difkto'] * 1; if (!db_fetch_array(db_select("select id from kontoplan where kontonr='{$difkto}' and regnskabsaar='{$regnaar}'", __FILE__ . " linje " . __LINE__))) { if ($webservice) { return "Kontonr {$difkto} (kursdiff) eksisterer ikke"; } else { return "Kontonr {$difkto} (kursdiff) eksisterer ikke"; } } } else { $tmp = dkdato($fakturadate); return "Der er ikke nogen valutakurs for {$valuta} den {$tmp} (fakturadatoen)."; } } else { $valuta = 'DKK'; $valutakurs = 100; } if (!$levdate) { if ($webservice) { return "Missing deliverydate"; } else { return "Leveringsdato SKAL udfyldes"; } } if ($levdate < $ordredate) { if ($webservice) { return "Deliverydate prior to orderdate"; } else { return "Leveringsdato er før ordredato"; } } if ($fakturadate < $levdate) { if ($webservice) { return "Invoicedate prior to orderdate"; } else { return "Fakturadato er før leveringsdato"; } } if ($nextfakt && $nextfakt <= $fakturadate) { if ($webservice) { return "Next_invoicedate prior to invoicedate"; } else { return "Genfaktureringsdato skal være efter fakturadato"; } } list($year, $month, $day) = explode('-', $fakturadate); $year = trim($year); $ym = $year . $month; if ($art != 'PO' && !$webservice && ($ym < $aarstart || $ym > $aarslut)) { print "<BODY onLoad=\"javascript:alert('Fakturadato udenfor regnskabsår')\">"; print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id={$id}\">"; exit; } if ($valuta && $valuta != 'DKK') { if ($r = db_fetch_array(db_select("select valuta.kurs from valuta, grupper where grupper.art='VK' and grupper.box1='{$valuta}' and valuta.gruppe=" . nr_cast("grupper.kodenr") . " and valuta.valdate <= '{$ordredate}' order by valuta.valdate desc", __FILE__ . " linje " . __LINE__))) { $valutakurs = $r['kurs']; } else { $tmp = dkdato($ordredate); return "Der er ikke nogen valutakurs for {$valuta} den {$ordredate} (ordredatoen)"; } } $qtxt = "select * from ordrelinjer where pris != '0' and m_rabat != '0' and rabat = '0' and ordre_id='{$id}'"; if ($r = db_fetch_array(db_select($qtxt, __FILE__ . " linje " . __LINE__))) { $rabatkontonr = $r['bogf_konto']; $rabatvareid = $r['id']; $rabatvarenr = $r['varenr']; if ($r = db_fetch_array(db_select("select box2 from grupper where art = 'DIV' and kodenr='3'", __FILE__ . " linje " . __LINE__))) { if ($rabatvareid = $r['box2'] * 1) { $r = db_fetch_array(db_select("select varenr from varer where id = '{$rabatvareid}'", __FILE__ . " linje " . __LINE__)); $rabatvarenr = $r['varenr']; } # else $fejl="Manglende varenummer for rabat (Indstillinger -> Diverse -> Ordrerelaterede valg)"; } # else $fejl="Manglende varenummer for rabat (Indstillinger -> Diverse -> Ordrerelaterede valg)"; } #exit; if (!$fejl) { #ransaktion("begin"); 20130506 if ($art != "PO") { $fakturanr = 1; # select max kan ikke bruges da fakturanr felt ikke er numerisk; $q = db_select("select fakturanr from ordrer where art = 'DO' or art = 'DK'", __FILE__ . " linje " . __LINE__); while ($r = db_fetch_array($q)) { if ($fakturanr <= $r['fakturanr'] * 1) { $fakturanr = $r['fakturanr'] + 1; } } $r = db_fetch_array(db_select("select box1 from grupper where art = 'RB' and kodenr='1'", __FILE__ . " linje " . __LINE__)); if ($fakturanr < $r['box1']) { $fakturanr = $r['box1']; } if ($fakturanr < 1) { $fakturanr = 1; } $ny_id = array(); $x = 0; $q = db_select("select * from ordrelinjer where pris != '0' and m_rabat != '0' and rabat = '0' and ordre_id='{$id}'", __FILE__ . " linje " . __LINE__); while ($r = db_fetch_array($q)) { $x++; $linje_id[$x] = $r['id'] * 1; $linje_m_rabat[$x] = $r['m_rabat']; $linje_pris[$x] = $r['pris']; $linje_rabatart[$x] = $r['rabatart']; $linje_varenr[$x] = $r['varenr']; $linje_posnr[$x] = $r['posnr']; } $linjeantal = $x; for ($x = 1; $x <= $linjeantal; $x++) { $ny_id[$x] = copy_row("ordrelinjer", $linje_id[$x]); $pris = $linje_m_rabat[$x]; $pris *= -1; $rabatpct = afrund($linje_m_rabat[$x] * 100 / $linje_pris[$x], 2); $linje_rabatart[$x] == 'amount' ? $beskrivelse = findtekst(466, $sprog_id) : ($beskrivelse = findtekst(467, $sprog_id)); $beskrivelse = str_replace('$rabatpct', $rabatpct, $beskrivelse); #cho "update ordrelinjer set posnr=posnr+0.1,varenr='$rabatvarenr',vare_id='$rabatvareid',pris='$pris',kostpris='0',m_rabat='0',beskrivelse='$beskrivelse',bogf_konto='$rabatkontonr',kdo='on' where id=$ny_id[$x]<br>"; #exit; db_modify("update ordrelinjer set posnr=posnr+0.1,varenr='{$rabatvarenr}',vare_id='{$rabatvareid}',pris='{$pris}',kostpris='0',m_rabat='0',beskrivelse='{$beskrivelse}',bogf_konto='{$rabatkontonr}',kdo='on' where id={$ny_id[$x]}", __FILE__ . " linje " . __LINE__); $r = db_fetch_array(db_select("select * from ordrelinjer where id='{$ny_id[$x]}'", __FILE__ . " linje " . __LINE__)); #cho "$r[id],$r[ordre_id],$r[posnr],$r[varenr],$r[vare_id],$r[pris],$r[kostpris],$r[m_rabat],$r[beskrivelse],$r[bogf_konto]<br>--<br>"; } } else { # Så er det en POS ordre #cho "$konto_id==0 && $sum+$moms=!$betalt<br>"; $diff = 0; if ($betaling == 'Kontant' && !$betaling2) { $tmp1 = afrund($sum + $moms, 2); $tmp2 = pos_afrund($sum + $moms, $difkto); if ($afrunding = $tmp2 - $tmp1) { #cho "A $afrunding $tmp2-$tmp1<br>"; if ($moms) { $afrundingsmoms = afrund($afrunding * ($moms * 100 / $sum) / 100, 2); $afrunding = afrund($afrunding - $afrundingsmoms, 2); $sum += $afrunding; $moms += $afrundingsmoms; } #cho "A1 $afrunding $tmp2-$tmp1<br>"; # $diff=1; $diff = $afrunding; } } if (afrund($sum + $moms, 2) + $retur != $betalt) { #20140613 $returdiff = afrund($sum + $moms, 2) + $retur - $betalt; if (afrund($returdiff, 2) == 0.01) { $moms = $moms - 0.01; } elseif (afrund($returdiff, 2) == -0.01) { $moms = $moms + 0.01; } db_modify("update ordrer set sum = '{$sum}',moms='{$moms}' where id = '{$id}'", __FILE__ . " linje " . __LINE__); } $a = afrund($sum + $moms, 2); #20131111 + næste 3 linjer rettet grundet php fejl?? $b = afrund($betalt + $betalt2, 2); if ($konto_id == 0 && $a != $b) { # $retur=$a-$b; Hentes fra global. $tmp2 = afrund($retur, 2); $tmp1 = pos_afrund($retur, $difkto); #cho "B $afrunding $tmp2-$tmp1<br>"; if ($afrunding = afrund($tmp2 - $tmp1, 2)) { #cho "B $afrunding $tmp2-$tmp1<br>"; if ($moms) { $afrundingsmoms = afrund($afrunding * ($moms * 100 / $sum) / 100, 2); $afrunding = afrund($afrunding - $afrundingsmoms, 2); $sum += $afrunding; $moms += $afrundingsmoms; } $diff += $afrunding; } } #xit; #cho "DK $difkto && DI $diff && AF $afrunding Moms $moms<br>"; $diff = afrund($diff, 2); #20140613 if ($difkto && $diff) { $linje_posnr[$x] += 0.1; # #cho "POI insert into ordrelinjer (posnr,antal,pris,rabat,procent,ordre_id,bogf_konto,beskrivelse,projekt) values ('0','1', '$diff', 0,100, '$id', '$difkto','Afrunding','$projekt')<br>"; db_modify("insert into ordrelinjer (posnr,antal,pris,rabat,procent,ordre_id,bogf_konto,beskrivelse,projekt) values ('0','1', '{$diff}', 0,100, '{$id}', '{$difkto}','Afrunding','{$projekt}')", __FILE__ . " linje " . __LINE__); db_modify("update ordrer set sum = '{$sum}',moms='{$moms}' where id = '{$id}'", __FILE__ . " linje " . __LINE__); } } #cho "A select * from ordrer where id='$id'<br>"; $q = db_select("select * from ordrer where id='{$id}'", __FILE__ . " linje " . __LINE__); $r = db_fetch_array($q); #cho "Sum $r[sum] $r[moms]<br>"; batch_kob($id, $art); #cho "B select * from ordrer where id='$id'<br>"; $q = db_select("select * from ordrer where id='{$id}'", __FILE__ . " linje " . __LINE__); $r = db_fetch_array($q); #cho "Sum $r[sum] $r[moms]<br>"; batch_salg($id); #cho "D select * from ordrer where id='$id'<br>"; $q = db_select("select * from ordrer where id='{$id}'", __FILE__ . " linje " . __LINE__); $r = db_fetch_array($q); #cho "Sum $r[sum] $r[moms]<br>"; #cho "update ordrer set status=3, fakturanr=$fakturanr, valutakurs=$valutakurs where id=$id<br>"; $tidspkt = date("H:i"); db_modify("update ordrer set status='3', fakturanr='{$fakturanr}', tidspkt='{$tidspkt}', valutakurs='{$valutakurs}' where id='{$id}'", __FILE__ . " linje " . __LINE__); if ($afd) { db_modify("update ordrer set felt_5='{$afd}' where id='{$id}'", __FILE__ . " linje " . __LINE__); } $r = db_fetch_array(db_select("select box5 from grupper where art='DIV' and kodenr='3'", __FILE__ . " linje " . __LINE__)); $straksbogfor = $r['box5']; $svar = momsupdat($id); if ($art == 'PO' && !$konto_id) { $r = db_fetch_array(db_select("select box9 from grupper where art='POS' and kodenr='1'", __FILE__ . " linje " . __LINE__)); $straksbogfor = $r['box9']; } #$linje="Straksbogfor $straksbogfor ($id,$webservice)<br>"; #fwrite($fp,$linje."\n"); if ($dan_kn) { db_modify("update ordrer set art = 'DK' where id = '{$id}'", __FILE__ . " linje " . __LINE__); } if ($straksbogfor) { $svar = bogfor_nu($id, $webservice); } #$linje="Svar $svar<br>"; #fwrite($fp,$linje."\n"); if ($svar != "OK") { return $svar; exit; } else { # exit; #ransaktion("commit"); 20130506 } } elseif (!$svar) { $svar = $fejl; } echo "<!--function bogfor s**t-->"; return $svar; }
function bogfor($id, $webservice) { global $regnaar; global $fakturadate; global $valutakurs; global $pbs; global $mail_fakt; global $db; global $brugernavn; $query = db_select("select * from ordrer where id = {$id}", __FILE__ . " linje " . __LINE__); $row = db_fetch_array($query); $ordredate = $row['ordredate']; $levdate = $row['levdate']; $fakturadate = $row['fakturadate']; $nextfakt = $row['nextfakt']; $art = $row['art']; $kred_ord_id = $row['kred_ord_id']; $valuta = $row['valuta']; $art = $row['art']; if ($row['status'] != 2) { return "invoice allready created for order id {$id}"; # print "<BODY onLoad=\"javascript:alert('Fakturerering er allerede udført')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } $query = db_select("select box1, box2, box3, box4 from grupper where art='RA' and kodenr='{$regnaar}'", __FILE__ . " linje " . __LINE__); if ($row = db_fetch_array($query)) { # $year=substr(str_replace(" ","",$row['box2']),-2);#aendret 060308 - grundet mulighed for fakt i aar 2208 $year = trim($row['box2']); $aarstart = str_replace(" ", "", $year . $row['box1']); # $year=substr(str_replace(" ","",$row['box4']),-2); $year = trim($row['box4']); $aarslut = str_replace(" ", "", $year . $row['box3']); } $query = db_select("select * from ordrer where id = '{$id}'", __FILE__ . " linje " . __LINE__); $row = db_fetch_array($query); if (!$fakturadate) { return "missing invoicedate for order {$id}"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=fakturadato.php?id=$id&pbs=$pbs&mail_fakt=$mail_fakt&returside=bogfor.php\">"; #exit; } if ($valuta && $valuta != 'DKK') { if ($r = db_fetch_array(db_select("select valuta.kurs as kurs, grupper.box3 as difkto from valuta, grupper where grupper.art='VK' and grupper.box1='{$valuta}' and valuta.gruppe=" . nr_cast("grupper.kodenr") . " and valuta.valdate <= '{$fakturadate}' order by valuta.valdate desc", __FILE__ . " linje " . __LINE__))) { $valutakurs = $r['kurs'] * 1; $difkto = $r['difkto'] * 1; if (!db_fetch_array(db_select("select id from kontoplan where kontonr='{$difkto}' and regnskabsaar='{$regnaar}'", __FILE__ . " linje " . __LINE__))) { if ($webservice) { return "Kontonr {$difkto} (kursdiff) eksisterer ikke"; } else { return "Kontonr {$difkto} (kursdiff) eksisterer ikke"; # print "<BODY onLoad=\"javascript:alert('Kontonr $difkto (kursdiff) eksisterer ikke')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } } } else { $tmp = dkdato($fakturadate); return "Der er ikke nogen valutakurs for {$valuta} den {$tmp} (fakturadatoen)."; # print "<BODY onLoad=\"javascript:alert('Der er ikke nogen valutakurs for $valuta den $tmp (fakturadatoen).')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } } else { $valuta = 'DKK'; $valutakurs = 100; } if (!$levdate) { return "Missing deliverydate"; # print "<BODY onLoad=\"javascript:alert('Leveringsdato SKAL udfyldes')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } if ($levdate < $ordredate) { return "Deliverydate prior to orderdate"; # print "<BODY onLoad=\"javascript:alert('Leveringsdato er før ordredato')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } if ($fakturadate < $levdate) { return "Invoicedate prior to orderdate"; # print "<BODY onLoad=\"javascript:alert('Fakturadato er før leveringsdato')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } if ($nextfakt && $nextfakt <= $fakturadate) { return "Next_invoicedate prior to invoicedate"; # print "<BODY onLoad=\"javascript:alert('Genfaktureringsdato skal være efter fakturadato')\">"; # print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id=$id\">"; # exit; } list($year, $month, $day) = split('-', $fakturadate); $year = trim($year); $ym = $year . $month; if (!$webservice && ($ym < $aarstart || $ym > $aarslut)) { print "<BODY onLoad=\"javascript:alert('Fakturadato udenfor regnskabsår')\">"; print "<meta http-equiv=\"refresh\" content=\"0;URL=ordre.php?id={$id}\">"; exit; } if ($valuta && $valuta != 'DKK') { if ($r = db_fetch_array(db_select("select valuta.kurs from valuta, grupper where grupper.art='VK' and grupper.box1='{$valuta}' and valuta.gruppe=" . nr_cast("grupper.kodenr") . " and valuta.valdate <= '{$ordredate}' order by valuta.valdate desc", __FILE__ . " linje " . __LINE__))) { $valutakurs = $r['kurs']; } else { $tmp = dkdato($ordredate); return "Der er ikke nogen valutakurs for {$valuta} den {$ordredate} (ordredatoen)"; } } if (!$fejl) { transaktion("begin"); $fakturanr = 1; $query = db_select("select fakturanr from ordrer where art = 'DO' or art = 'DK'", __FILE__ . " linje " . __LINE__); while ($row = db_fetch_array($query)) { if ($fakturanr <= $row[fakturanr]) { $fakturanr = $row[fakturanr] + 1; } } if ($fakturanr == 1) { $query = db_select("select box1 from grupper where art = 'RB' order by kodenr", __FILE__ . " linje " . __LINE__); if ($row = db_fetch_array($query)) { $fakturanr = $row[box1] * 1; } } if ($fakturanr < 1) { $fakturanr = 1; } batch_kob($id, $art); batch_salg($id); db_modify("update ordrer set status=3, fakturanr={$fakturanr}, valutakurs={$valutakurs} where id={$id}", __FILE__ . " linje " . __LINE__); $r = db_fetch_array(db_select("select box5 from grupper where art='DIV' and kodenr='3'", __FILE__ . " linje " . __LINE__)); $svar = momsupdat($id); if ($r['box5'] == 'on') { $svar = bogfor_nu($id, $webservice); } if ($svar != "OK") { return $svar; exit; } else { transaktion("commit"); } } return $svar; }