当前位置: 首页>>代码示例>>PHP>>正文


PHP transaktion函数代码示例

本文整理汇总了PHP中transaktion函数的典型用法代码示例。如果您正苦于以下问题:PHP transaktion函数的具体用法?PHP transaktion怎么用?PHP transaktion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了transaktion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: singleupdate

function singleupdate($string)
{
    $webservice = '1';
    list($s_id, $tmp) = explode(chr(9), $string);
    if (!$s_id) {
        return '1' . chr(9) . "Missing session ID";
    }
    #	include("../includes/select.php");
    include "../includes/connect.php";
    include "../includes/online.php";
    $linje = NULL;
    $tabels = array('grupper', 'varianter', 'variant_typer', 'shop_ordrer', 'shop_varer', 'adresser', 'shop_adresser');
    $singleupdate = str_replace($s_id, "", $string);
    $singleupdate = str_replace(chr(9), "", $singleupdate);
    $singleupdate = str_replace(chr(10), "", $singleupdate);
    $singleupdate = str_replace(chr(13), "", $singleupdate);
    #	$singleupdate=str_replace(" ","",$singleupdate);
    $singleupdate = strtolower($singleupdate);
    list($table, $tmp) = explode("set", $singleupdate, 2);
    $table = trim($table);
    #if ($table!='adresser')	return('1'.chr(9).$table);
    if (!in_array($table, $tabels)) {
        return '1' . chr(9) . 'Updating ' . $table . ' is not accepted';
    }
    #if ($table!='adresser')	return('1'.chr(9).$svar.":".$singleupdate);
    transaktion('begin');
    $svar = db_modify("update {$table} {$singleupdate}", __FILE__ . " linje " . __LINE__);
    list($fejl, $svar) = explode(chr(9), $svar);
    if ($fejl) {
        return $fejl . chr(9) . $svar;
    } else {
        transaktion('commit');
        return '0' . chr(9) . $id;
    }
}
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:35,代码来源:singleupdate.php

示例2: opdat_1_0

function opdat_1_0($under_nr, $lap_nr)
{
    global $version;
    global $db;
    global $db_id;
    global $regnskab;
    global $regnaar;
    $s_id = session_id();
    if ($lap_nr < 2) {
        transaktion("begin");
        $x = 0;
        /*		
        		$query=db_select("SELECT id FROM formularer where formular = 6",__FILE__ . " linje " . __LINE__); 
        		while ($row = db_fetch_array($query)) {$x++;}
        		if ($x<=1) {
        			 $fp=fopen("../importfiler/formular.txt","r");
        			 if ($fp) {
        				while (!feof($fp)) {
        					list($formular, $art, $beskrivelse, $justering, $xa, $ya, $xb, $yb, $str, $color, $font, $fed, $kursiv, $side) = split(chr(9), fgets($fp));
        					if ($formular==6) {
        						$justering=trim($justering); $form=trim($font); $fed=trim($fed); $kursiv=trim($kursiv); $side=trim($side);
        						$xa= $xa*1; $ya= $ya*1; $xb= $xb*1; $yb=$yb*1; $str=$str*1; $color=$color*1;
        						db_modify("insert into formularer (formular, art, beskrivelse, xa, ya, xb, yb, justering, str, color, font, fed, kursiv, side) values ('$formular', '$art', '$beskrivelse', '$xa', '$ya', '$xb', '$yb', '$justering', '$str', '$color', '$font', '$fed', '$kursiv', '$side')",__FILE__ . " linje " . __LINE__); 
        					}
        				}
        			}
        			fclose($fp);
        		}
        */
        $query = db_select("SELECT id, box1 FROM grupper where art = 'DG'", __FILE__ . " linje " . __LINE__);
        while ($row = db_fetch_array($query)) {
            if (strlen(trim($row['box1'])) == 1) {
                $box1 = 'S' . trim($row['box1']);
                db_modify("UPDATE grupper set box1 = '{$box1}' where id = {$row['id']}", __FILE__ . " linje " . __LINE__);
            }
        }
        $query = db_select("SELECT id, box1 FROM grupper where art = 'KG'", __FILE__ . " linje " . __LINE__);
        while ($row = db_fetch_array($query)) {
            if (strlen(trim($row['box1'])) == 1) {
                $box1 = 'K' . trim($row['box1']);
                db_modify("UPDATE grupper set box1 = '{$box1}' where id = {$row['id']}", __FILE__ . " linje " . __LINE__);
            }
        }
        db_modify("ALTER TABLE kontoplan ADD genvej varchar", __FILE__ . " linje " . __LINE__);
        $x = 0;
        $query = db_select("SELECT kodenr FROM grupper where art = 'LG' order by kodenr", __FILE__ . " linje " . __LINE__);
        while ($row = db_fetch_array($query)) {
            $x++;
            $lagernr[$x] = $row[kodenr];
        }
        $lagerantal = $x;
        $x = 0;
        $query = db_select("SELECT id FROM varer order by id", __FILE__ . " linje " . __LINE__);
        while ($row = db_fetch_array($query)) {
            $x++;
            $vare_id[$x] = $row[id];
        }
        $vareantal = $x;
        for ($y = 1; $y <= $lagerantal; $y++) {
            for ($x = 1; $x <= $vareantal; $x++) {
                $z = 0;
                $query = db_select("SELECT rest FROM batch_kob where vare_id={$vare_id[$x]} and lager={$lagernr[$y]}", __FILE__ . " linje " . __LINE__);
                while ($row = db_fetch_array($query)) {
                    $z = $z + $row[rest];
                }
                db_modify("UPDATE lagerstatus set beholdning={$z} where vare_id = {$x} and lager = {$y}", __FILE__ . " linje " . __LINE__);
            }
        }
        db_modify("UPDATE grupper set box1 = '1.0.2' where art = 'VE'", __FILE__ . " linje " . __LINE__);
        transaktion("commit");
    }
    if ($lap_nr <= 6) {
        transaktion("begin");
        db_modify("ALTER TABLE adresser ADD kontoansvarlig integer", __FILE__ . " linje " . __LINE__);
        db_modify("UPDATE grupper set box1 = '1.0.7' where art = 'VE'", __FILE__ . " linje " . __LINE__);
        transaktion("commit");
    }
    if ($lap_nr <= 7) {
        include "../includes/connect.php";
        include "../includes/online.php";
        $filnavn = "../temp/{$db}.sql";
        $fp = fopen($filnavn, "w");
        fwrite($fp, "CREATE TABLE openpost (id serial NOT NULL, konto_id integer, konto_nr varchar, faktnr varchar, amount numeric, refnr integer, beskrivelse varchar, udlignet varchar, transdate date, kladde_id integer, bilag_id integer,forfaldsdate date,betal_id varchar, PRIMARY KEY (id));\n");
        fclose($fp);
        echo "<br>export PGPASSWORD={$sqpass}\npsql {$db} -h {$sqhost} -U {$squser} < {$filnavn} > ../temp/NULL\n<br>";
        system("export PGPASSWORD={$sqpass}\npsql {$db} -h {$sqhost} -U {$squser} < {$filnavn} > ../temp/NULL\n");
        transaktion('begin');
        db_modify("ALTER TABLE openpost ADD udlign_id integer", __FILE__ . " linje " . __LINE__);
        db_modify("ALTER TABLE openpost ADD udlign_date date", __FILE__ . " linje " . __LINE__);
        db_modify("UPDATE openpost SET udlign_id = '0'", __FILE__ . " linje " . __LINE__);
        include "../includes/autoudlign.php";
        autoudlign('0');
        db_modify("UPDATE grupper set box1 = '1.0.8' where art = 'VE'", __FILE__ . " linje " . __LINE__);
        transaktion('commit');
    }
    if ($lap_nr <= 8) {
        transaktion('begin');
        db_modify("ALTER TABLE grupper ADD box9 varchar", __FILE__ . " linje " . __LINE__);
        db_modify("ALTER TABLE grupper ADD box10 varchar", __FILE__ . " linje " . __LINE__);
        db_modify("CREATE TABLE provision (id serial NOT NULL, gruppe_id integer, ansat_id integer, provision numeric, PRIMARY KEY (id))", __FILE__ . " linje " . __LINE__);
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:opdat_1.0.php

示例3: opdat_0

function opdat_0($version, $dbver)
{
    global $db_id;
    global $s_id;
    global $backup;
    include "../includes/connect.php";
    include "../includes/online.php";
    include "../includes/db_query.php";
    $returside = "../index/logud.php";
    $db = trim($db);
    if (!$backup) {
        system("pg_dump -h {$sqhost} -U {$squser} -W {$sqpass} -f '../temp/{$db}.sql' {$db}");
        print "<table align=center valign=center cellpadding=1 cellspacing=1 border=0\theight=100% width=100%><tbody>";
        print "<tr><td>";
        print "<table align=center valign=center cellpadding=1 cellspacing=1 border=0\theight=25% width=50%><tbody>";
        print "<tr><td align=center>{$font} Systemet opdateres . . . . . .<br></td></tr>";
        print "<tr><td align=center>{$font} Backup foretages . . . . . .<br></td></tr>";
        print "<tr><td align=center><br></td></tr>";
        print "<tr><td align=center>{$font} H&oslash;jreklik her: <a href='../temp/{$db}.sql'>{$db}.sql</a></td></tr>";
        print "<tr><td align=center>{$font} V&aelig;lg \"gem link som\" (eller \"save link as\")</td></tr>";
        print "<tr><td align=center>{$font} og gem backup'en et passende sted</td></tr>";
        print "<tr><td><br></td></tr>";
        print "<tr><td align=center><a href=../includes/opdat_0.php?version={$version}&dbver={$dbver}&backup=OK accesskey=F>{$font} Forts&aelig;t</a><br></td></tr>";
        print "</tbody></table>";
        print "</td></tr>";
        print "</tbody></table>";
        print "<br>";
    }
    if (!$dbver) {
        echo "Variablen dbver ikke sat - kontakt systemansvarlig!!";
        exit;
    }
    if ($dbver < 0.23) {
        transaktion("begin");
        db_modify("ALTER TABLE kladdeliste add bogforingsdate date");
        db_modify("UPDATE grupper set box1 = '0.23' where art = 'VE'");
        transaktion("commit");
    }
    if ($dbver < 0.24) {
        transaktion("begin");
        $x = 0;
        $maxval = 0;
        $query = db_select("SELECT * FROM ordrelinjer");
        while ($row = db_fetch_array($query)) {
            $x++;
            $id[$x] = $row[id];
            $varenr[$x] = $row['varenr'];
            $text[$x] = $row['text'];
            $posnr[$x] = $row['posnr'] * 1;
            $pris[$x] = $row['pris'] * 1;
            $rabat[$x] = $row['rabat'] * 1;
            $lev_varenr[$x] = $row['lev_varenr'];
            $ordre_id[$x] = $row['ordre_id'] * 1;
            $serienr[$x] = $row['serienr'];
            $antal[$x] = $row['antal'] * 1;
            $bogf_konto[$x] = $row['bogf_konto'] * 1;
            if ($maxval < $id[$x]) {
                $maxval = $id[$x];
            }
        }
        $linjeantal = $x;
        db_modify("DROP TABLE ordrelinjer");
        db_modify("CREATE TABLE ordrelinjer (id serial NOT NULL, varenr varchar, text r varchar, posnr smallint, pris numeric, rabat numeric, lev_varenr varchar, ordre_id integer, serienr varchar, antal numeric, bogf_konto integer, PRIMARY KEY (id))");
        for ($x = 1; $x <= $linjeantal; $x++) {
            db_modify("INSERT INTO ordrelinjer (id, varenr, text, posnr, pris, rabat, lev_varenr, ordre_id, serienr, antal, bogf_konto) values ({$id[$x]}, '{$varenr[$x]}', '{$text[$x]}', '{$posnr[$x]}', '{$pris[$x]}', '{$rabat[$x]}', '{$lev_varenr[$x]}', '{$ordre_id[$x]}', '{$serienr[$x]}', '{$antal[$x]}', '{$bogf_konto[$x]}')");
        }
        if ($maxval >= 1) {
            db_modify("select pg_catalog.setval('ordrelinjer_id_seq', {$maxval}, true)");
        }
        db_modify("CREATE TABLE batch_kob (id serial NOT NULL, kobsdate date, vare_id integer, ordre_id integer, pris numeric, antal integer, rest integer, PRIMARY KEY (id))");
        db_modify("CREATE TABLE batch_salg (id serial NOT NULL, salgsdate date, batch_kob_id integer, vare_id integer, ordre_id integer, pris numeric, antal integer, PRIMARY KEY (id))");
        db_modify("CREATE TABLE serienr (id serial NOT NULL, vare_id integer, kobsordre_id integer, salgsordre_id integer, serienr varchar, PRIMARY KEY (id))");
        db_modify("UPDATE grupper set box1 = '0.24' where art = 'VE'");
        transaktion("commit");
    }
    if ($dbver < 0.26) {
        transaktion("begin");
        db_modify("ALTER TABLE ordrelinjer ADD vare_id integer");
        db_modify("ALTER TABLE ordrer ADD kred_ord_id integer");
        db_modify("UPDATE grupper set box1 = '0.26' where art = 'VE'");
        transaktion("commit");
    }
    if ($dbver < 0.27) {
        transaktion("begin");
        print "Opdaterer til ver. 0.27<br>";
        db_modify("ALTER TABLE varer ADD samlevare varchar");
        db_modify("ALTER TABLE varer ADD delvare varchar");
        db_modify("ALTER TABLE ordrer ADD lev_adr text");
        db_modify("CREATE TABLE styklister (id serial NOT NULL, vare_id integer, indgaar_i integer, antal integer, PRIMARY KEY (id))");
        db_modify("UPDATE grupper set box1 = '0.27' where art = 'VE'");
        transaktion("commit");
    }
    if ($dbver < 0.29) {
        transaktion("begin");
        print "Opdaterer til ver. 0.29<br>";
        db_modify("ALTER TABLE brugere ADD rettigheder varchar");
        db_modify("UPDATE brugere set rettigheder='1111111111'");
        db_modify("ALTER TABLE styklister ADD posnr integer");
        transaktion("commit");
        include "../includes/connect.php";
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:opdat_0.php

示例4: invoice

function invoice($string)
{
    $webservice = '1';
    $fp = fopen("../temp/invoice.log", "w");
    list($s_id, $tmp) = explode(chr(9), $string);
    if (!$s_id) {
        return '1' . chr(9) . "Missing session ID";
    }
    #	include("../includes/select.php");
    include "../includes/connect.php";
    include "../includes/online.php";
    include "../includes/std_func.php";
    include "../includes/ordrefunc.php";
    include "../includes/formfunk.php";
    $linje = NULL;
    $ordre_id = str_replace($s_id, "", $string);
    $ordre_id = str_replace(chr(9), "", $ordre_id);
    $ordre_id = str_replace(chr(10), "", $ordre_id);
    $ordre_id = str_replace(chr(13), "", $ordre_id);
    #	$ordre_id=str_replace(" ","",$ordre_id);
    $ordre_id = strtolower($ordre_id);
    list($table, $tmp) = explode("set", $ordre_id, 2);
    $table = trim($table);
    $r = db_fetch_array(db_select("select momssats from ordrer where id = '{$ordre_id}'", __FILE__ . " linje " . __LINE__));
    $momssats = $r['momssats'] * 1;
    $x = 0;
    $ordresum = 0;
    $momssum = 0;
    $kostsum = 0;
    $momsdiff = 0;
    $q = db_select("select * from ordrelinjer where ordre_id = '{$ordre_id}'", __FILE__ . " linje " . __LINE__);
    while ($r = db_fetch_array($q)) {
        if ($r['vare_id']) {
            $linjesum = $r['pris'] * $r['antal'] - $r['pris'] * $r['antal'] * $r['rabat'] / 100;
            $ordresum += $linjesum;
            $linjemoms = $linjesum * $r['momssats'] / 100;
            $momssum += $linjemoms;
            if ($r['momssats'] != $momssats || $r['momsfri']) {
                $momsdiff = 1;
            }
            $kostsum += $r['kostpris'] * $r['antal'];
        }
        $ordresum = afrund($ordresum, 2);
        if (!$momsdiff) {
            $momssum = $ordresum * $momssats / 100;
        }
        $momssum = afrund($momssum, 2);
    }
    transaktion('begin');
    $linje = "update ordrer set status = '2',levdate = ordredate,fakturadate = ordredate,sum='{$ordresum}',moms='{$momssum}',udskriv_til='email',mail_fakt='on',momssats='{$momssats}',kostpris='{$kostsum}',projekt='' where id = '{$ordre_id}'";
    fwrite($fp, $linje . "\n");
    $svar = db_modify($linje, __FILE__ . " linje " . __LINE__);
    list($fejl, $svar) = explode(chr(9), $svar);
    if ($fejl) {
        return $fejl . chr(9) . $svar;
    }
    $linje = "update ordrelinjer set projekt = '' where ordre_id = '{$ordre_id}'";
    fwrite($fp, $linje . "\n");
    $svar = db_modify($linje, __FILE__ . " linje " . __LINE__);
    list($fejl, $svar) = explode(chr(9), $svar);
    if ($fejl) {
        return $fejl . chr(9) . $svar;
    }
    $linje = "update ordrelinjer set leveres = antal where ordre_id = '{$ordre_id}' and vare_id>'0'";
    fwrite($fp, $linje . "\n");
    $svar = db_modify($linje, __FILE__ . " linje " . __LINE__);
    list($fejl, $svar) = explode(chr(9), $svar);
    if ($fejl) {
        return $fejl . chr(9) . $svar;
    }
    $linje = "levering({$ordre_id},'on','','on')";
    fwrite($fp, $linje . "\n");
    $svar = levering($ordre_id, 'on', '', 'on');
    if ($svar != 'OK') {
        return '1' . chr(9) . $svar;
    }
    $linje = "update ordrelinjer set leveret = antal,leveres='0' where ordre_id = '{$ordre_id}' and vare_id>'0'";
    fwrite($fp, $linje . "\n");
    $svar = db_modify($linje, __FILE__ . " linje " . __LINE__);
    $linje = "bogfor({$ordre_id},'on')";
    fwrite($fp, $linje . "\n");
    $svar = bogfor($ordre_id, 'on');
    list($fejl, $svar) = explode(chr(9), $svar);
    fwrite($fp, $fejl . " " . $svar . "\n");
    if ($fejl != 'OK') {
        $linje = "{$fejl}";
        #		fwrite($fp,$linje."\n");
        return '1' . chr(9) . $fejl;
    } else {
        transaktion('commit');
    }
    $linje = "formularprint({$ordre_id},'4','1',{$charset},'email')";
    fwrite($fp, $linje . "\n");
    $svar = formularprint($ordre_id, '4', '1', $charset, 'email');
    fwrite($fp, $linje . "Svar " . $svar . "\n");
    if ($svar && $svar != 'OK') {
        return '1' . chr(9) . $svar;
    } else {
        fclose($fp);
        return '0' . chr(9) . $ordre_id;
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:invoice.php

示例5: db_modify

         for ($x = 0; $x < count($kontonr); $x++) {
             db_modify("insert into transaktioner (kontonr,bilag,transdate,logdate,logtime,beskrivelse,debet,kredit,faktura,kladde_id,afd,ansat,projekt,valuta,valutakurs,ordre_id)\n\t\t\t\t\tvalues\n\t\t\t\t\t({$kontonr[$x]},'{$bilag}','{$transdate}','{$transdate}','{$logtime}','Produktionsordre: {$varenr['0']} ({$brugernavn})','0','{$amount[$x]}','','0','0','0','0','1','100','0')", __FILE__ . " linje " . __LINE__);
             $tjeksum += $amount[$x];
         }
         if (abs($tjeksum - $afgangsum) > 0.01) {
             print "<BODY onLoad=\"javascript:alert('Ubalance i posteringssum -kontakt Saldi teamet på tlf. 4690 2208')\">";
             print "<meta http-equiv=\"refresh\" content=\"0;URL=varekort.php?id={$id['0']}\">";
             exit;
         }
         db_modify("insert into transaktioner (kontonr,bilag,transdate,logdate,logtime,beskrivelse,debet,kredit,faktura,kladde_id,afd,ansat,projekt,valuta,valutakurs,ordre_id)\n\t\t\t\tvalues\n\t\t\t('{$tilgang}','{$bilag}','{$transdate}','{$transdate}','{$logtime}','Produktionsordre: {$varenr['0']} ({$brugernavn})','{$afgangsum}','0','','0','0','0','0','1','100','0')", __FILE__ . " linje " . __LINE__);
     }
     $diff = transtjek();
     if ($diff > 1) {
         print "<BODY onLoad=\"javascript:alert('Ubalance i transaktioner -kontakt Saldi teamet på tlf. 4690 2208')\">";
     } else {
         transaktion('commit');
     }
     print "<meta http-equiv=\"refresh\" content=\"0;URL=varekort.php?id={$id['0']}\">";
 } else {
     print "<table><tbody>";
     print "<form name=\"vareproduktion\" action=\"vareproduktion.php?antal={$antal}&samlevare={$samlevare}\" method=\"post\">";
     for ($x = 0; $x < $antal; $x++) {
         print "<tr><td><input type = \"hidden\" name=\"id[{$x}]\" value = {$id[$x]}>";
         print "<tr><td><input type = \"hidden\" name=\"ny_beholdning[{$x}]\" value = {$ny_beholdning[$x]}>";
     }
     print "<tr><td>Skriv bilagsnummer for regulering</td></tr>";
     print "<tr><td><input type = \"tekst\" name=\"bilag\" value=\"0\"></td></tr>";
     print "<tr><td><input type = \"submit\" name=\"OK\" value=\"OK\">&nbsp;";
     print "<input type = \"submit\" name=\"cancel\" value=\"Afbryd\"></td></tr>";
     print "</form>";
 }
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:31,代码来源:vareproduktion.php

示例6: overfoer_data

function overfoer_data($filnavn, $splitter, $feltnavn, $feltantal)
{
    global $charset;
    global $regnaar;
    $r1 = db_fetch_array(db_select("select max(kodenr) as kodenr from grupper where art='RA'", __FILE__ . " linje " . __LINE__));
    $regnskabsaar = $r1[kodenr];
    $fp = fopen("{$filnavn}", "r");
    if ($fp) {
        for ($y = 1; $y < 4; $y++) {
            $linje = fgets($fp);
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, ";"), 1)) {
            $semikolon++;
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, ","), 1)) {
            $komma++;
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, chr(9)), 1)) {
            $tabulator++;
        }
        $tmp = '';
        if ($komma > $semikolon && $komma > $tabulator) {
            $tmp = 'Komma';
            $feltantal = $komma;
        } elseif ($semikolon > $tabulator && $semikolon > $komma) {
            $tmp = 'Semikolon';
            $feltantal = $semikolon;
        } elseif ($tabulator > $semikolon && $tabulator > $komma) {
            $tmp = 'Tabulator';
            $feltantal = $tabulator;
        }
        if (!$splitter) {
            $splitter = $tmp;
        }
        $cols = $feltantal + 1;
    }
    fclose($fp);
    for ($y = 0; $y <= $feltantal; $y++) {
        if ($feltnavn[$y] == 'Kontonr' && $kontonr == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med Dato')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'Kontonr') {
            $kontonr = 1;
        }
        if ($feltnavn[$y] == 'Beskrivelse' && $beskrivelse == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med Beskrivelse')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'Beskrivelse') {
            $beskrivelse = 1;
        }
        if (strstr($feltnavn[$y], 'Kontotype') && $kontotype == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med Kontotype')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'Kontotype') {
            $kontotype = 1;
        }
        if (strstr($feltnavn[$y], 'Moms') && $moms == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med Moms')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'Moms') {
            $moms = 1;
        }
        if (strstr($feltnavn[$y], 'Fra_kto') && $fra_kto == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med fra_kto')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'Fra_kto') {
            $fra_kto = 1;
        }
        if (strstr($feltnavn[$y], 'primo') && $primo == 1) {
            print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med primo')\">";
            $feltnavn[$y] = '';
        } elseif ($feltnavn[$y] == 'primo') {
            $primo = 1;
        }
    }
    print "<tr><td colspan={$cols}><hr></td></tr>\n";
    if (!$splitter || $splitter == 'Semikolon') {
        $splitter = ';';
    } elseif ($splitter == 'Komma') {
        $splitter = ',';
    } elseif ($splitter == 'Tabulator') {
        $splitter = chr(9);
    }
    # print "<tr><td><span title='Angiv 1. bilagsnummer'><input type=text size=4 name=bilag value=$bilag></span></td>";
    transaktion('begin');
    #echo "delete from kontoplan where regnskabsaar='$regnskabsaar'<br>";
    db_modify("delete from kontoplan where regnskabsaar='{$regnskabsaar}'", __FILE__ . " linje " . __LINE__);
    $fp = fopen("{$filnavn}", "r");
    if ($fp) {
        $kontonumre = array();
        $x = 0;
        while (!feof($fp)) {
            $skriv_linje = 0;
            if ($linje = trim(fgets($fp))) {
                $x++;
                $skriv_linje = 1;
                if ($charset == 'UTF-8') {
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:importer_kontoplan.php

示例7: flyt_data

function flyt_data($kladde_id, $filnavn, $bilag, $modkonto)
{
    global $charset;
    transaktion('begin');
    $fp = fopen("{$filnavn}", "r");
    if ($fp) {
        $y = 0;
        $feltantal = 0;
        #	for ($y=1; $y<20; $y++) {
        while ($linje = fgets($fp)) {
            $linje = trim(utf8_encode($linje));
            if ($linje) {
                $y++;
                $skriv_linje[$y] = 1;
                list($debitor[$y], $beskrivelse[$y], , , $belob[$y], , $date[$y]) = explode(";", $linje);
                if (!is_numeric($debitor[$y])) {
                    $skriv_linje[$y] = 0;
                }
                $amount[$y] = usdecimal($belob[$y]) * 1;
                if (!$amount[$y]) {
                    $skriv_linje[$y] = 0;
                }
                list($aar, $maaned, $dag) = explode("-", $date[$y]);
                # echo "$maaned,$dag,$aar<br>";
                if (checkdate($maaned, $dag, $aar)) {
                    $dato[$y] = dkdato($date[$y]);
                } else {
                    $skriv_linje[$y] = 0;
                }
            }
        }
    }
    $linjeantal = $y;
    fclose($fp);
    for ($x = 1; $x <= $linjeantal; $x++) {
        if ($skriv_linje[$x] == 1) {
            $bilag++;
            db_modify("insert into kassekladde (bilag,transdate,beskrivelse,d_type,debet,k_type,kredit,amount,kladde_id) values ('{$bilag}','{$date[$x]}','{$beskrivelse[$x]}','F','{$modkonto}','D','{$debitor[$x]}','{$amount[$x]}', '{$kladde_id}')", __FILE__ . " linje " . __LINE__);
        }
    }
    fclose($fp);
    unlink($filnavn);
    # sletter filen.
    transaktion('commit');
    print "<meta http-equiv=\"refresh\" content=\"0;URL=kassekladde.php?kladde_id={$kladde_id}\">";
}
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:46,代码来源:pbswebimport.php

示例8: flyt_data

function flyt_data($filnavn, $leverandor, $varegrp, $rabat)
{
    global $font;
    list($kontonr, $tmp) = split(" : ", $leverandor);
    $kontonr = trim($kontonr);
    list($lev_kontonr, $tmp) = split(":", $leverandor);
    list($gruppe, $tmp) = split(":", $varegrp);
    $gruppe = trim($gruppe);
    $r = db_fetch_array(db_select("select id from adresser where kontonr = {$lev_kontonr}"));
    $lev_id = $r[id];
    $x = 0;
    $q = db_select("select varenr from varer");
    while ($r = db_fetch_array($q)) {
        $x++;
        $exist_vnr[$x] = $r['varenr'];
    }
    $fp = fopen("../temp/" . $filnavn, "r");
    if ($fp) {
        transaktion('begin');
        $x = 0;
        while (!feof($fp)) {
            $x++;
            $linje = fgets($fp);
            $felt = array();
            $felt[0] = substr($linje, 1, 10);
            $felt[1] = substr($linje, 12, 35);
            $felt[2] = substr($linje, 47, 10);
            $felt[3] = substr($linje, 58, 3);
            $felt[4] = substr($linje, 61, 3);
            $felt[5] = substr($linje, 64, 1);
            $felt[6] = substr($linje, 65, 3);
            $felt[7] = substr($linje, 6, 3);
            $felt[1] = str_replace(chr(145), "æ", $felt[1]);
            $felt[1] = str_replace(chr(155), "ø", $felt[1]);
            $felt[1] = str_replace(chr(134), "å", $felt[1]);
            $felt[1] = str_replace(chr(146), "Æ", $felt[1]);
            $felt[1] = str_replace(chr(157), "Ø", $felt[1]);
            $felt[1] = str_replace(chr(143), "Å", $felt[1]);
            for ($y = 0; $y < 6; $y++) {
                if (substr($felt[$y], 0, 1) == '"' && substr($felt[$y], -1) == '"') {
                    $felt[$y] = substr($felt[$y], 1, strlen($felt[$y]) - 2);
                }
                if ($y == 0) {
                    $varenr = trim($felt[$y]);
                    $lev_varenr = trim($felt[$y]);
                } elseif ($y == 1) {
                    $beskrivelse = addslashes(trim($felt[$y]));
                } elseif ($y == 2) {
                    $salgspris = $felt[$y] / 100;
                    if ($rabat) {
                        $kostpris = $felt[$y] / 100 - $felt[$y] / 10000 * $rabat;
                    }
                } elseif ($y == 3) {
                    $enhed = trim($felt[$y]);
                } elseif ($y == 5) {
                    if ($felt[$y] == "S") {
                        $lukket = '1';
                    } else {
                        $lukket = '0';
                    }
                }
            }
            if (in_array($varenr, $exist_vnr)) {
                db_modify("update varer set beskrivelse='{$beskrivelse}', salgspris='{$salgspris}', kostpris='{$kostpris}', enhed='{$enhed}', gruppe='{$gruppe}', lukket='{$lukket}' where varenr='{$varenr}'");
                $r = db_fetch_array(db_select("select id from varer where varenr='{$varenr}'"));
                $r2 = db_fetch_array(db_select("select id from vare_lev where vare_id='{$r['id']}' and lev_id='{$lev_id}'"));
                if ($r2[id]) {
                    db_modify("update vare_lev set kostpris={$kostpris[$y]}, lev_varenr={$lev_varenr[$y]} where id='{$r2['id']}'");
                } else {
                    db_modify("insert into vare_lev(vare_id, lev_id, lev_varenr, kostpris) values ('{$r['id']}', '{$lev_id}', '{$lev_varenr}', '{$kostpris}')");
                }
            } else {
                db_modify("insert into varer (varenr, beskrivelse, salgspris, kostpris, enhed, gruppe, lukket) values ('{$varenr}', '{$beskrivelse}', '{$salgspris}', '{$kostpris}', '{$enhed}', '{$gruppe}', '{$lukket}')");
                $r = db_fetch_array(db_select("select id from varer where varenr='{$varenr}'"));
                db_modify("insert into vare_lev(vare_id, lev_id, lev_varenr, kostpris) values ('{$r['id']}', '{$lev_id}', '{$lev_varenr}', '{$kostpris}')");
            }
        }
        transaktion('commit');
    }
    fclose($fp);
    print "</tbody></table>";
    print "</td></tr>";
}
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:83,代码来源:vvsimport.php

示例9: kopier_til_ny

function kopier_til_ny($kladde_id, $bilagsnr, $ny_dato)
{
    global $regnaar;
    global $connection;
    global $brugernavn;
    list($regnstart, $regnslut) = explode(":", regnskabsaar($regnaar));
    $fejl = 0;
    if ($bilagsnr && !is_numeric($bilagsnr) && $bilagsnr != '=') {
        #20150105-2
        $fejl = "Bilagsnr skal være numerisk eller \"-\"";
        print tekstboks($fejl);
    }
    if ($bilagsnr && !$fejl) {
        $gl_bilag = 0;
        $bilag = 0;
        $query = db_select("select kladdenote from kladdeliste where id = '{$kladde_id}' and bogfort='V'", __FILE__ . " linje " . __LINE__);
        if ($row = db_fetch_array($query)) {
            transaktion('begin');
            $kladdenote = db_escape_string($row['kladdenote']);
            #20150105
            $tidspkt = microtime();
            $kladdedate = date("Y-m-d");
            $ny_kladde_id = 1;
            $query = db_select("select id from kladdeliste where id>={$kladde_id}", __FILE__ . " linje " . __LINE__);
            while ($row = db_fetch_array($query)) {
                if ($ny_kladde_id <= $row['id']) {
                    $ny_kladde_id = $row['id'] + 1;
                }
            }
            db_modify("insert into kladdeliste (id, kladdenote, kladdedate, bogfort, oprettet_af) values ('{$ny_kladde_id}', '{$kladdenote}', '{$kladdedate}', '-', '{$brugernavn}')", __FILE__ . " linje " . __LINE__);
            $query = db_select("select * from kassekladde where kladde_id={$kladde_id} order by bilag", __FILE__ . " linje " . __LINE__);
            while ($row = db_fetch_array($query)) {
                $beskrivelse = db_escape_string($row['beskrivelse']);
                $faktura = db_escape_string($row['faktura']);
                if ($bilagsnr != "=" && $row['bilag'] && $row['bilag'] != $gl_bilag) {
                    if (!$bilag) {
                        $bilag = $bilagsnr;
                    } else {
                        $bilag++;
                    }
                    $gl_bilag = $row['bilag'];
                    $next_bilag = $bilag;
                } elseif ($bilagsnr == '=') {
                    $bilag = $row['bilag'] * 1;
                }
                $debet = $row['debet'] * 1;
                $kredit = $row['kredit'] * 1;
                $afd = $row['afd'] * 1;
                $ansat = $row['ansat'] * 1;
                $projekt = $row['projekt'];
                $valuta = $row['valuta'] * 1;
                if ($ny_dato && $ny_dato != "=") {
                    $date = usdate($ny_dato);
                } else {
                    $date = $row['transdate'];
                }
                db_modify("insert into kassekladde (bilag, transdate, beskrivelse, d_type, debet, k_type, kredit, faktura, amount, momsfri, afd, ansat, projekt, valuta, kladde_id) values ('{$bilag}', '{$date}', '{$beskrivelse}', '{$row['d_type']}', '{$debet}', '{$row['k_type']}', '{$kredit}', '{$faktura}', '{$row['amount']}', '{$row['momsfri']}', '{$afd}', '{$ansat}', '{$projekt}', '{$valuta}', '{$ny_kladde_id}')", __FILE__ . " linje " . __LINE__);
            }
            transaktion('commit');
        }
        print "<meta http-equiv=\"refresh\" content=\"0;URL=kassekladde.php?kladde_id={$ny_kladde_id}\">";
        exit;
    } else {
        $query = db_select("select MAX(bilag) as bilag from kassekladde where transdate>='{$regnstart}' and transdate<='{$regnslut}'", __FILE__ . " linje " . __LINE__);
        $row = db_fetch_array($query);
        $bilagsnr = $row['bilag'] + 1;
        $dato = date("d-m-y");
        if ($sort != 'transdate,bilag') {
            $sort = 'bilag,transdate';
        }
        print "<form name=\"Form1\" action=kassekladde.php?sort={$sort}; method=post>";
        print "<span style=center title=\"Bilagsnummer for 1. bilag. De &oslash;vrige beregnes automatisk. S&aelig;ttes et lighedstegn anvendes orginalt bilagsnummer\">Skriv 1. bilagsnr <input type=\"text\" style=\"text-align:left;width:40px;\" name=bilagsnr value={$bilagsnr}><br><br><br></span>";
        print "<span style=center title=\"S&aelig;ttes et lighedstegn, anvendes orginal bilagsdato\">Skriv dato for alle bilag <input type=\"text\" size=8 name=ny_dato value={$dato}><br><br><br></span>";
        print "<input type=hidden name=kladde_id value={$kladde_id}>";
        print "<input type=submit accesskey=\"k\" value=\"Kopi&eacute;r til ny\" name=\"submit\" onclick=\"javascript:docChange = false;\">&nbsp;<input type=button value=fortryd onClick=\"location.href='../includes/luk.php'\"><br></span>\n";
        print "</form>";
        exit;
    }
    exit;
}
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:80,代码来源:kassekladde.php

示例10: genfakt

function genfakt($id, $org_nr, $fakt_dato, $opdat_pris, $slet_gfdato)
{
    transaktion('begin');
    if ($r = db_fetch_array(db_select("select * from ordrer where id = {$id}", __FILE__ . " linje " . __LINE__))) {
        $pbs = $r['pbs'];
        $firmanavn = db_escape_string($r['firmanavn']);
        $addr1 = db_escape_string($r['addr1']);
        $addr2 = db_escape_string($r['addr2']);
        $bynavn = db_escape_string($r['bynavn']);
        $land = db_escape_string($r['land']);
        $cvrnr = db_escape_string($r['cvrnr']);
        $ean = db_escape_string($r['ean']);
        $sprog = db_escape_string($r['sprog']);
        $valuta = db_escape_string($r['valuta']);
        $projekt = db_escape_string($r['projekt']);
        $institution = db_escape_string($r['institution']);
        $notes = db_escape_string($r['notes']);
        $ref = db_escape_string($r['ref']);
        $kontakt = db_escape_string($r['kontakt']);
        $kundeordnr = db_escape_string($r['kundeordnr']);
        $lev_navn = db_escape_string($r['lev_navn']);
        $lev_addr1 = db_escape_string($r['lev_addr1']);
        $lev_addr2 = db_escape_string($r['lev_addr2']);
        $lev_bynavn = db_escape_string($r['lev_bynavn']);
        $email = db_escape_string($r['email']);
        $udskriv_til = db_escape_string($r['udskriv_til']);
        $procenttillag = db_escape_string($r['procenttillag']);
        if ($r['nextfakt']) {
            $tmp = $r['nextfakt'];
        } else {
            $tmp = date("Y-m-d");
        }
        $nextfakt = find_nextfakt($r['fakturadate'], $tmp);
        if ($fakt_dato) {
            $fakturadate = $r['nextfakt'];
        } else {
            $fakturadate = date("Y-m-d");
        }
        if ($org_nr) {
            $ordrenr = $r['ordrenr'];
        } else {
            $r2 = db_fetch_array(db_select("select MAX(ordrenr) as ordrenr from ordrer where art='DO' or art='DK'", __FILE__ . " linje " . __LINE__));
            $ordrenr = $r2['ordrenr'] + 1;
        }
        db_modify("insert into ordrer (ordrenr, konto_id, kontonr,firmanavn,addr1,addr2,postnr,bynavn,land,betalingsdage,betalingsbet,cvrnr,ean,institution,notes,art,ordredate,momssats,moms,ref,valuta,sprog,kontakt,kundeordnr,lev_navn,lev_addr1,lev_addr2,lev_postnr,lev_bynavn,levdate,fakturadate,nextfakt,sum,status,projekt,email,mail_fakt,pbs,udskriv_til,procenttillag) values \n\t\t\t\t('{$ordrenr}','{$r['konto_id']}','{$r['kontonr']}','{$firmanavn}','{$addr1}','{$addr2}','{$r['postnr']}','{$bynavn}','{$land}','{$r['betalingsdage']}','{$r['betalingsbet']}','{$cvrnr}','{$ean}','{$institution}','{$notes}','{$r['art']}','{$r['ordredate']}','{$r['momssats']}','{$r['moms']}','{$ref}','{$valuta}','{$sprog}','{$kontakt}','{$kundeordnr}','{$lev_navn}','{$lev_addr1}','{$lev_addr2}','{$r['lev_postnr']}','{$lev_bynavn}','{$fakturadate}','{$fakturadate}','{$nextfakt}','{$r['sum']}','2','{$projekt}','{$email}','{$r['mail_fakt']}','{$pbs}','{$udskriv_til}','{$procenttillag}')", __FILE__ . " linje " . __LINE__);
        $r2 = db_fetch_array(db_select("select id from ordrer where ordrenr='{$ordrenr}' and nextfakt='{$nextfakt}' and (art='DO' or art='DK') order by id desc", __FILE__ . " linje " . __LINE__));
        $ny_id = $r2['id'];
        $sum = 0;
        $x = 0;
        $q = db_select("select * from ordrelinjer where ordre_id = {$id} and (kdo!='on' or kdo is NULL) order by posnr", __FILE__ . " linje " . __LINE__);
        while ($r = db_fetch_array($q)) {
            $r['projekt'] ? $projekt = $r['projekt'] : ($projekt = '');
            if ($r['vare_id']) {
                $r2 = db_fetch_array(db_select("select gruppe from varer where id='{$r['vare_id']}'", __FILE__ . " linje " . __LINE__));
                $gruppe = $r2['gruppe'];
                $r2 = db_fetch_array(db_select("select box7 from grupper where art='VG' and kodenr='{$gruppe}'", __FILE__ . " linje " . __LINE__));
                $momsfri = $r2['box7'];
                if (!$opdat_pris) {
                    $pris = $r['pris'] * 1;
                    $kostpris = $r['kostpris'] * 1;
                } else {
                    $r2 = db_fetch_array(db_select("select salgspris,kostpris from varer where id='{$r['vare_id']}'", __FILE__ . " linje " . __LINE__));
                    $pris = $r2['salgspris'] * 1;
                    $kostpris = $r2['kostpris'] * 1;
                    $sum = $sum + $r['antal'] * $pris - $r['antal'] * $pris * $r['rabat'] / 100;
                }
                db_modify("insert into ordrelinjer (ordre_id,posnr,varenr,vare_id,beskrivelse,enhed,antal,pris,rabat,procent,lev_varenr,momsfri,samlevare,kostpris,leveres,projekt) values ('{$ny_id}','{$r['posnr']}','" . db_escape_string($r['varenr']) . "','{$r['vare_id']}','" . db_escape_string($r['beskrivelse']) . "','{$r['enhed']}','{$r['antal']}','{$pris}','{$r['rabat']}','{$r['procent']}','" . db_escape_string($r['lev_varenr]']) . "','{$momsfri}','{$r['samlevare']}','{$kostpris}','{$r['antal']}','" . db_escape_string($projekt) . "')", __FILE__ . " linje " . __LINE__);
            } else {
                db_modify("insert into ordrelinjer (ordre_id, posnr, beskrivelse) values ('{$ny_id}','{$r['posnr']}','" . db_escape_string($r['beskrivelse']) . "')", __FILE__ . " linje " . __LINE__);
            }
        }
        if ($opdat_pris) {
            db_modify("update ordrer set sum={$sum} where id='{$ny_id}'", __FILE__ . " linje " . __LINE__);
        }
        #echo "SLET : $slet_gfdato<br>";
        if ($slet_gfdato) {
            db_modify("update ordrer set nextfakt=NULL where id='{$id}'", __FILE__ . " linje " . __LINE__);
        }
    }
    transaktion('commit');
    $tmp = $ny_id . "," . $pbs;
    return $tmp;
}
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:83,代码来源:genfakturer.php

示例11: transaktion

        include "../includes/online.php";
    }
    if ($bogfor) {
        transaktion(begin);
        bogfor($kladde_id, $kladdenote, '');
        db_modify("delete from tmpkassekl where kladde_id = {$kladde_id}", __FILE__ . " linje " . __LINE__);
        transaktion(commit);
        genberegn($regnaar);
        if ($popup) {
            print "<BODY onLoad=\"javascript=opener.location.reload();\">";
        }
    } elseif ($simuler) {
        transaktion(begin);
        bogfor($kladde_id, $kladdenote, 'on');
        #		db_modify("delete from tmpkassekl where kladde_id = $kladde_id",__FILE__ . " linje " . __LINE__);
        transaktion(commit);
        if ($popup) {
            print "<BODY onLoad=\"javascript=opener.location.reload();\">";
            print "<meta http-equiv=\"refresh\" content=\"0;URL=../includes/luk.php\">";
        }
    }
    if ($funktion == 'bogfor' || $funktion == 'simuler') {
        if ($bogfor || $simuler) {
            print "<meta http-equiv=\"refresh\" content=\"0;URL=kladdeliste.php\">";
        } else {
            print "<meta http-equiv=\"refresh\" content=\"0;URL=kassekladde.php?kladde_id={$kladde_id}\">";
        }
    }
} elseif ($_POST['luk']) {
    #	if ($popup) print "<meta http-equiv=\"refresh\" content=\"0;URL=../includes/luk.php\">";
    #	else print "<meta http-equiv=\"refresh\" content=\"0;URL=kassekladde.php?kladde_id=$kladde_id\">";
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:31,代码来源:bogfor.php

示例12: flytordre

function flytordre($kladde_id, $ordre_id)
{
    global $regnaar;
    global $connection;
    global $aarstart;
    global $aarslut;
    include "../includes/forfaldsdag.php";
    transaktion("begin");
    if (!$aarstart) {
        $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 = trim($row['box2']);
            $aarstart = trim($year . $row['box1']);
            $year = trim($row['box4']);
            $aarslut = trim($year . $row['box3']);
        }
    }
    $query = db_select("select box1, box2, box3, box4, box5 from grupper where art='RB'", __FILE__ . " linje " . __LINE__);
    if ($row = db_fetch_array($query)) {
        if (trim($row['box3']) == "on") {
            $faktbill = 1;
        } else {
            $faktbill = 0;
        }
        if (trim($row['box4']) == "on") {
            $modtbill = 1;
        } else {
            $modtbill = 0;
        }
        if (trim($row['box5']) == "on") {
            $no_faktbill = 1;
            $faktbill = 0;
        } else {
            $no_faktbill = 0;
        }
    }
    $x = 0;
    $query = db_select("select * from ordrer where status=3 and id='{$ordre_id}' order by fakturadate", __FILE__ . " linje " . __LINE__);
    if ($row = db_fetch_array($query)) {
        list($year, $month, $day) = split('-', $row['fakturadate']);
        $ym = $year . $month;
        if ($ym >= $aarstart && $ym <= $aarslut) {
            $id = $row['id'];
            $art = $row['art'];
            $konto_id = $row['konto_id'];
            $kontonr = str_replace(" ", "", $row['kontonr']);
            $firmanavn = trim($row['firmanavn']);
            $modtagelse = $row['modtagelse'];
            $transdate = $row['fakturadate'];
            $forfaldsdate = usdate(forfaldsdag($transdate, $row['betalingsbet'], $row['betalingsdage']));
            $fakturanr = addslashes($row['fakturanr']);
            $ordrenr = $row['ordrenr'];
            $valuta = $row['valuta'];
            if ($valuta && $valuta != 'DKK') {
                $r = db_fetch_array(db_select("select kodenr from grupper where box1='{$valuta}' and art='VK'", __FILE__ . " linje " . __LINE__));
                $valuta = $r['kodenr'] * 1;
            } else {
                $valuta = 0;
            }
            $projekt[0] = $row['projekt'];
            $moms = $row['moms'] * 1;
            $sum = $row['sum'] + $moms;
            $ordreantal = $x;
            $q = db_select("select id, afd from ansatte where navn = '{$row['ref']}'", __FILE__ . " linje " . __LINE__);
            $r = db_fetch_array($q);
            $afd = $r['afd'] * 1;
            $ansat = $r['id'] * 1;
            if (!$konto_id) {
                $firmanavn = "Kontantsalg";
                $betalt = $row['betalt'];
                $retur = $betalt - $sum;
                $betaling1 = $row['felt_1'];
                $betalt1 = $row['felt_2'] * 1;
                $betaling2 = $row['felt_3'];
                $betalt2 = $row['felt_4'] * 1;
                $kasse = $row['felt_5'] * 1;
                $kortnavn = array();
                $kortkto = array();
                $r = db_fetch_array(db_select("select * from grupper where art = 'POS' and kodenr='{$kasse}'", __FILE__ . " linje " . __LINE__));
                $tmparray = explode(chr(9), $r['box2']);
                $kontonr = $tmparray[$kasse - 1];
                $kortnavn = explode(chr(9), $r['box5']);
                $kortkto = explode(chr(9), $r['box6']);
                $tmparray = explode(chr(9), $r['box7']);
                $momsgruppe = $tmparray[$kasse - 1];
                $z = 0;
                if ($betaling1 == 'Kontant') {
                    $kortkto1 = $kontonr;
                    $betalt1 = $betalt1 - $retur;
                    $retur = 0;
                }
                if ($betaling2 == 'Kontant') {
                    $kortkto2 = $kontonr;
                    $betalt2 = $betalt2 - $retur;
                    $retur = 0;
                }
                while ($kortkto[$z]) {
                    if ($betaling1 == $kortnavn[$z]) {
                        $kortkto1 = $kortkto[$z];
                    }
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:hentordrer.php

示例13: opdat_3_2

function opdat_3_2($under_nr, $lap_nr)
{
    global $version;
    global $db;
    global $db_id;
    global $regnskab;
    global $regnaar;
    global $db_type;
    $s_id = session_id();
    $nextver = '3.2.1';
    if ($lap_nr < "1") {
        include "../includes/connect.php";
        $r = db_fetch_array(db_select("select * from regnskab where id='1'", __FILE__ . " linje " . __LINE__));
        $tmp = $r['version'];
        if ($tmp < $nextver) {
            echo "opdaterer hovedregnskab til ver {$nextver}<br />";
            db_modify("UPDATE regnskab set version = '{$nextver}' where id = '1'", __FILE__ . " linje " . __LINE__);
        }
        include "../includes/online.php";
        transaktion('begin');
        $q = db_select("select m_rabat from ordrelinjer", __FILE__ . " linje " . __LINE__);
        $fieldType = db_field_type($q, 0);
        if ($fieldType != 'numeric') {
            if ($db_type == "mysql") {
                db_modify("ALTER TABLE ordrelinjer CHANGE m_rabat m_rabat numeric(15,3)", __FILE__ . " linje " . __LINE__);
            } else {
                db_modify("ALTER TABLE ordrelinjer ALTER column m_rabat TYPE numeric(15,3)", __FILE__ . " linje " . __LINE__);
            }
        }
        if ($db_type == "mysql") {
            db_modify("ALTER TABLE ordrelinjer CHANGE rabatart rabatart varchar(10)", __FILE__ . " linje " . __LINE__);
        } else {
            db_modify("ALTER TABLE ordrelinjer ALTER column rabatart TYPE varchar(10)", __FILE__ . " linje " . __LINE__);
        }
        echo "opdaterer til ver {$nextver}<br />";
        db_modify("UPDATE grupper set box1 = '{$nextver}' where art = 'VE'", __FILE__ . " linje " . __LINE__);
        transaktion('commit');
        include "../includes/connect.php";
        db_modify("UPDATE regnskab set version = '{$nextver}' where db = '{$db}'", __FILE__ . " linje " . __LINE__);
    }
    $nextver = '3.2.2';
    if ($lap_nr < "2") {
        include "../includes/connect.php";
        $r = db_fetch_array(db_select("select * from regnskab where id='1'", __FILE__ . " linje " . __LINE__));
        $tmp = $r['version'];
        if ($tmp < $nextver) {
            echo "opdaterer hovedregnskab til ver {$nextver}<br />";
            db_modify("UPDATE regnskab set version = '{$nextver}' where id = '1'", __FILE__ . " linje " . __LINE__);
        }
        include "../includes/online.php";
        transaktion('begin');
        if ($db_type == "mysql") {
            db_modify("CREATE TABLE IF NOT EXISTS ordretekster (id serial NOT NULL,tekst text,PRIMARY KEY (id))", __FILE__ . " linje " . __LINE__);
            db_modify("CREATE TABLE IF NOT EXISTS navigator (bruger_id integer,session_id text,side text,returside text,konto_id integer,ordre_id integer,vare_id integer)", __FILE__ . " linje " . __LINE__);
        } else {
            if (!db_fetch_array(db_select("select * from pg_tables where tablename='ordretekster'"))) {
                db_modify("CREATE TABLE ordretekster (id serial NOT NULL,tekst text,PRIMARY KEY (id))", __FILE__ . " linje " . __LINE__);
            }
            if (!db_fetch_array(db_select("select * from pg_tables where tablename='navigator'"))) {
                db_modify("CREATE TABLE navigator (bruger_id integer,session_id text,side text,returside text,konto_id integer,ordre_id integer,vare_id integer)", __FILE__ . " linje " . __LINE__);
            }
        }
        $i = 0;
        $feltnavne = array();
        $q = db_select("select * from jobkort", __FILE__ . " linje " . __LINE__);
        while ($i < db_num_fields($q)) {
            $feltnavne[$i] = db_field_name($q, $i);
            $i++;
        }
        if (!in_array('ordre_id', $feltnavne)) {
            db_modify("ALTER TABLE jobkort ADD ordre_id integer", __FILE__ . " linje " . __LINE__);
        }
        $i = 0;
        $feltnavne = array();
        $q = db_select("select * from adresser", __FILE__ . " linje " . __LINE__);
        while ($i < db_num_fields($q)) {
            $feltnavne[$i] = db_field_name($q, $i);
            $i++;
        }
        if (!in_array('status', $feltnavne)) {
            db_modify("ALTER TABLE adresser ADD status text", __FILE__ . " linje " . __LINE__);
        }
        $id1 = 0;
        $cat_id = NULL;
        $cat_beskrivelse = NULL;
        $q = db_select("select id,box1 from grupper where art='DGCAT' order by id", __FILE__ . " linje " . __LINE__);
        while ($r = db_fetch_array($q)) {
            if (!$id0) {
                $id0 = $r['id'];
            }
            $cat_id ? $cat_id .= chr(9) . $r['id'] : ($cat_id = $r['id']);
            $cat_beskrivelse ? $cat_beskrivelse .= chr(9) . db_escape_string($r['box1']) : ($cat_beskrivelse = db_escape_string($r['box1']));
        }
        if ($id0) {
            db_modify("update grupper set beskrivelse='Div DebitorInfo',art='DebInfo',box1='{$cat_id}',box2='{$cat_beskrivelse}' where id = '{$id0}'", __FILE__ . " linje " . __LINE__);
        }
        if ($db_type == "mysql") {
            db_modify("CREATE TABLE IF NOT EXISTS ordretekster (id serial NOT NULL,tekst text,PRIMARY KEY (id))", __FILE__ . " linje " . __LINE__);
            db_modify("CREATE TABLE IF NOT EXISTS navigator (bruger_id integer,session_id text,side text,returside text,konto_id integer,ordre_id integer,vare_id integer)", __FILE__ . " linje " . __LINE__);
        } else {
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:opdat_3.2.php

示例14: delfakturer

function delfakturer($ordre_id, $valg)
{
    global $dellevdate;
    # Tjekker om der er noget der kan leveres. Hvis der er nedskrives antal til der der kan leveres og der oprettes en ny ordre med resten med samme ordrenr.
    $drop = 0;
    $fakturer = 0;
    $delfakturer = 0;
    if ($valg == 'tilbud') {
        $qtxt = "select id, ordredate from ordrer where status='0' and art='DO' and id > '{$ordre_id}' order by id";
    } elseif ($valg == 'ordrer') {
        $qtxt = "select id, ordredate from ordrer where (status='1' or status='2') and art='DO' and id > '{$ordre_id}' order by id";
    } else {
        return;
    }
    if ($r = db_fetch_array($q = db_select($qtxt, __FILE__ . " linje " . __LINE__))) {
        $ordre_id = $r['id'];
        $ordredate = $r['ordredate'];
        $x = 0;
        $q = db_select("select * from ordrelinjer where ordre_id = '{$ordre_id}' order by id", __FILE__ . " linje " . __LINE__);
        while ($r = db_fetch_array($q)) {
            $x++;
            if (!$drop && $r['vare_id']) {
                $vare_id[$x] = $r['vare_id'];
                $antal[$x] = $r['antal'];
                $linje_id[$x] = $r['id'];
                if ($vare_id[$x]) {
                    if (db_fetch_array(db_select("select id from batch_salg where linje_id={$linje_id[$x]}", __FILE__ . " linje " . __LINE__))) {
                        $drop = 1;
                    } else {
                        $r2 = db_fetch_array(db_select("select varer.beholdning as beholdning, grupper.box8 as lagervare from varer, grupper where varer.id={$vare_id[$x]} and grupper.art='VG' and grupper.kodenr = varer.gruppe", __FILE__ . " linje " . __LINE__));
                        $lagervare[$x] = $r2['lagervare'];
                        $beholdning[$x] = $r2['beholdning'];
                        if ($lagervare[$x] && $beholdning[$x] > 0) {
                            $fakturer = 1;
                        }
                        #saa kan der faktureres.
                        if ($lagervare[$x] && $beholdning[$x] < $antal[$x]) {
                            #saa skal der delfaktureres
                            $delfakturer = 1;
                            $ny_antal[$x] = $antal[$x] - $beholdning[$x];
                        } elseif ($lagervare[$x]) {
                            $ny_antal[$x] = 0;
                        } else {
                            $ny_antal[$x] = 0;
                        }
                    }
                } else {
                    $ny_antal[$x] = 0;
                }
            }
        }
        if ($ordredate > $dellevdate) {
            $delfakturer = 0;
        }
    } else {
        $drop = 1;
    }
    if (!$drop && $fakturer && $delfakturer) {
        transaktion("begin");
        $r = db_fetch_array($q = db_select("select * from ordrer where id = '{$ordre_id}'", __FILE__ . " linje " . __LINE__));
        $ordrenr = db_escape_string($r['ordrenr']);
        $konto_id = db_escape_string($r['konto_id']);
        $kontonr = db_escape_string($r['kontonr']);
        $firmanavn = db_escape_string($r['firmanavn']);
        $addr1 = db_escape_string($r['addr1']);
        $addr2 = db_escape_string($r['addr2']);
        $postnr = db_escape_string($r['postnr']);
        $bynavn = db_escape_string($r['bynavn']);
        $land = db_escape_string($r['land']);
        $kontakt = db_escape_string($r['kontakt']);
        $kundeordnr = db_escape_string($r['kundeordnr']);
        $betalingsdage = db_escape_string($r['betalingsdage']);
        $betalingsbet = db_escape_string($r['betalingsbet']);
        $cvrnr = db_escape_string($r['cvrnr']);
        $ean = db_escape_string($r['ean']);
        $institution = db_escape_string($r['institution']);
        $notes = db_escape_string($r['notes']);
        $art = db_escape_string($r['art']);
        $ordredate = db_escape_string($r['ordredate']);
        $momssats = db_escape_string($r['momssats']);
        $ref = db_escape_string($r['ref']);
        $status = db_escape_string($r['status']);
        $lev_navn = db_escape_string($r['lev_navn']);
        $lev_addr1 = db_escape_string($r['lev_addr1']);
        $lev_addr2 = db_escape_string($r['lev_addr2']);
        $lev_postnr = db_escape_string($r['lev_postnr']);
        $lev_bynavn = db_escape_string($r['lev_bynavn']);
        $lev_kontakt = db_escape_string($r['lev_kontakt']);
        $valuta = db_escape_string($r['valuta']);
        $projekt = db_escape_string($r['projekt']);
        $sprog = db_escape_string($r['sprog']);
        $tidspkt = date("U");
        db_modify("insert into ordrer (ordrenr, konto_id, kontonr, firmanavn, addr1, addr2, postnr, bynavn, land, kontakt, kundeordnr, betalingsdage, betalingsbet, cvrnr, ean, institution, notes, art, ordredate, momssats, tidspkt, ref, status, lev_navn, lev_addr1, lev_addr2, lev_postnr, lev_bynavn, lev_kontakt, valuta, projekt, sprog) values ('{$ordrenr}','{$konto_id}','{$kontonr}','{$firmanavn}','{$addr1}','{$addr2}','{$postnr}','{$bynavn}','{$land}','{$kontakt}','{$kundeordnr}','{$betalingsdage}','{$betalingsbet}','{$cvrnr}','{$ean}','{$institution}','{$notes}','{$art}','{$ordredate}','{$momssats}','{$tidspkt}','{$ref}','{$status}','{$lev_navn}','{$lev_addr1}','{$lev_addr2}','{$lev_postnr}','{$lev_bynavn}','{$lev_kontakt}','{$valuta}','{$projekt}','{$sprog}')", __FILE__ . " linje " . __LINE__);
        $q = db_select("select max(id) as id from ordrer where ordrenr={$ordrenr} and art='{$art}' and tidspkt='{$tidspkt}'", __FILE__ . " linje " . __LINE__);
        $r = db_fetch_array($q);
        $ny_id = $r['id'];
        $x = 0;
        $sum = 0;
        $ny_sum = 0;
        $moms = 0;
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:massefakt.php

示例15: overfoer_data

function overfoer_data($filnavn, $splitter, $feltnavn, $feltantal, $tegnset)
{
    global $charset;
    $fp = fopen("{$filnavn}", "r");
    if ($fp) {
        for ($y = 1; $y < 4; $y++) {
            $tmp = fgets($fp);
            if ($tmp) {
                $linje = $tmp;
            }
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, ";"), 1)) {
            $semikolon++;
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, ","), 1)) {
            $komma++;
        }
        $tmp = $linje;
        while ($tmp = substr(strstr($tmp, chr(9)), 1)) {
            $tabulator++;
        }
        $tmp = '';
        if ($komma > $semikolon && $komma > $tabulator) {
            $tmp = 'Komma';
            $feltantal = $komma;
        } elseif ($semikolon > $tabulator && $semikolon > $komma) {
            $tmp = 'Semikolon';
            $feltantal = $semikolon;
        } elseif ($tabulator > $semikolon && $tabulator > $komma) {
            $tmp = 'Tabulator';
            $feltantal = $tabulator;
        }
        if (!$splitter) {
            $splitter = $tmp;
        }
        $cols = $feltantal + 1;
    }
    fclose($fp);
    $x = 0;
    $q = db_select("select * from varianter", __FILE__ . " linje " . __LINE__);
    while ($r = db_fetch_array($q)) {
        $varianter_id[$x] = $r['id'];
        $varianter_beskrivelse[$x] = strtolower($r['beskrivelse']);
        $varianter_shop_id[$x] = $r['shop_id'];
        $x++;
    }
    $q = db_select("select * from variant_varer order by variant_stregkode", __FILE__ . " linje " . __LINE__);
    while ($r = db_fetch_array($q)) {
        if ($stregkode == $r['variant_stregkode']) {
            db_modify("delete from variant_varer where id='{$r['id']}'", __FILE__ . " linje " . __LINE__);
        } else {
            $stregkode = $r['variant_stregkode'];
        }
    }
    $x = 0;
    $q = db_select("select * from variant_typer", __FILE__ . " linje " . __LINE__);
    while ($r = db_fetch_array($q)) {
        $variant_type_id[$x] = $r['id'];
        $variant_type_variant_id[$x] = $r['variant_id'];
        $variant_type_beskrivelse[$x] = strtolower($r['beskrivelse']);
        $variant_type_shop_id[$x] = $r['shop_id'];
        $x++;
    }
    $x = 0;
    $q = db_select("select varenr,id,varianter from varer", __FILE__ . " linje " . __LINE__);
    while ($r = db_fetch_array($q)) {
        $varer_id[$x] = $r['id'];
        $varer_nr[$x] = $r['varenr'];
        $varer_varianter[$x] = $r['varianter'];
        $x++;
    }
    for ($y = 0; $y <= $feltantal; $y++) {
        for ($x = 0; $x <= $felt_antal; $x++) {
            if ($felt_navn[$x] && $feltnavn[$y] == $felt_navn[$x] && $felt_aktiv[$x] == 1) {
                print "<BODY onLoad=\"javascript:alert('Der kan kun v&aelig;re 1 kolonne med {$felt_navn[$x]}')\">";
                $feltnavn[$y] = '';
            } elseif ($felt_navn[$x] && $feltnavn[$y] == $felt_navn[$x]) {
                $felt_aktiv[$x] = 1;
            }
        }
    }
    print "<tr><td colspan={$cols}><hr></td></tr>\n";
    if (!$splitter || $splitter == 'Semikolon') {
        $splitter = ';';
    } elseif ($splitter == 'Komma') {
        $splitter = ',';
    } elseif ($splitter == 'Tabulator') {
        $splitter = chr(9);
    }
    # print "<tr><td><span title='Angiv 1. bilagsnummer'><input type=text size=4 name=bilag value=$bilag></span></td>";
    transaktion('begin');
    #echo "delete from kontoplan where regnskabsaar='$regnskabsaar'<br>";
    #db_modify("delete from de where regnskabsaar='$regnskabsaar'");attrelid    	attname
    $r = db_fetch_array(db_select("SELECT relfilenode FROM pg_class WHERE relname = 'variant_varer'", __FILE__ . " linje " . __LINE__));
    $relfilenode = $r['relfilenode'] * 1;
    $r = db_fetch_array(db_select("SELECT * FROM pg_attribute WHERE attrelid= '{$relfilenode}' and attname = 'variant_salgspris'", __FILE__ . " linje " . __LINE__));
    if ($r['attisdropped'] != 'f' || !$r['attname']) {
        db_modify("alter TABLE variant_varer ADD variant_salgspris numeric(15,3)", __FILE__ . " linje " . __LINE__);
//.........这里部分代码省略.........
开发者ID:nielsrune,项目名称:saldi_ce,代码行数:101,代码来源:importer_variantvarer.php


注:本文中的transaktion函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。