本文整理汇总了PHP中transaktion函数的典型用法代码示例。如果您正苦于以下问题:PHP transaktion函数的具体用法?PHP transaktion怎么用?PHP transaktion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transaktion函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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øjreklik her: <a href='../temp/{$db}.sql'>{$db}.sql</a></td></tr>";
print "<tr><td align=center>{$font} Væ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æ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\"> ";
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æ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æ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æ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æ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æ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æ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 øvrige beregnes automatisk. Sæ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æ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ér til ny\" name=\"submit\" onclick=\"javascript:docChange = false;\"> <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 =
|
请发表评论