Commit 9cb59348 authored by Thidaporn Laisan's avatar Thidaporn Laisan
Browse files

update patch

parent 6aa4147a
...@@ -220,6 +220,48 @@ class ExchangerateUpload extends Component ...@@ -220,6 +220,48 @@ class ExchangerateUpload extends Component
'amenddate' => $UPDATECODE_update 'amenddate' => $UPDATECODE_update
]); ]);
} }
if ($this->updatePatch) {
while(strlen($y2)<4){$y2="0".$y2;}
while(strlen($m2)<2){$m2="0".$m2;}
$UPDATECODE_update= $y2.$m2;
$Loop_pathcode .= '
Query2Var("select count(*) as countExist from conf_exchangerate where exdate=\''.$DATE1.'\' and currency =\''.$CUR.'\'");
if($countExist!=0){
exec_query("update conf_exchangerate SET finishdate=\''.$DATE2.'\'
where currency=\''.$CUR.'\' and exdate =\''.$DATE1.'\'");
}
Query2Var("select count(*) as countExistEx from conf_exchangerate_export where exdate=\''.$DATE1.'\' and currency =\''.$CUR.'\'");
if($countExistEx!=0){
exec_query("update conf_exchangerate_export SET finishdate=\''.$DATE2.'\'
where currency=\''.$CUR.'\' and exdate =\''.$DATE1.'\'");
}
Query2Var("select count(*) as countExist from conf_exchangerate where exdate=\''.$DATE1.'\' and currency =\''.$CUR.'\'");
if($countExist==0){
if($DBTYPE==\'MYSQL\'){
exec_query("insert into conf_exchangerate (currency,exdate,finishdate,rate,baht,amenddate)
VALUES (\''.$CUR.'\',\''.$DATE1.'\',\''.$DATE2.'\',\''.$FACT.'\',\''.$IMRATE.'\',\''.$UPDATECODE_update.'\')");
exec_query("insert into conf_exchangerate_export (currency,exdate,finishdate,rate,baht,amenddate)
VALUES (\''.$CUR.'\',\''.$DATE1.'\',\''.$DATE2.'\',\''.$FACT.'\',\''.$EXRATE.'\',\''.$UPDATECODE_update.'\')");
}
}
Query2Var("select count(*) as countExist from conf_exchangerate where exdate=\''.$DATE1.'\' and currency =\''.$CUR.'\'");
if($countExist==0){
if($DBTYPE==\'MSSQL\'){
exec_query("insert into conf_exchangerate ([currency],[exdate],[finishdate],[rate],[baht],[amenddate])
VALUES (\''.$CUR.'\',\''.$DATE1.'\',\''.$DATE2.'\',\''.$FACT.'\',\''.$IMRATE.'\',\''.$UPDATECODE_update.'\')");
exec_query("insert into conf_exchangerate_export ([currency],[exdate],[finishdate],[rate],[baht],[amenddate])
VALUES (\''.$CUR.'\',\''.$DATE1.'\',\''.$DATE2.'\',\''.$FACT.'\',\''.$EXRATE.'\',\''.$UPDATECODE_update.'\')");
}
}
';
}
} }
} }
} }
...@@ -248,15 +290,10 @@ class ExchangerateUpload extends Component ...@@ -248,15 +290,10 @@ class ExchangerateUpload extends Component
// Using Eloquent to get the data // Using Eloquent to get the data
$patchFiles = DB::table('tab_patch_file')->where('ptid', $next_PID)->get(); $patchFiles = DB::table('tab_patch_file')->where('ptid', $next_PID)->get();
$PATCHCODE_SERVER = '$a=1;\n';
foreach ($patchFiles as $index => $file) {
$PATCHCODE_SERVER .= "\$file_name_{$index}=\"{$file->file_name}\";\n";
$PATCHCODE_SERVER .= "\$file_data_{$index}=\"{$file->file_data}\";\n";
}
$PATCHCODE_SERVER .= "\$max=count(\$fid);";
$PATCHCODE_SERVER = str_replace("'", "''", $PATCHCODE_SERVER); $PATCHCODE_SERVER = "$"."a=1;\nQuery2Array(\"select * from tab_patch_file where ptid='".$next_PID."'\");\nfor("."$"."i=0;"."$"."i<count("."$"."fid);"."$"."i++){\n"."$"."{'file_name_'."."$"."i}="."$"."file_name["."$"."i];\n"."$"."{'file_data_'."."$"."i}="."$"."file_data["."$"."i];\n}\n"."$"."max=count("."$"."fid);";
$PATCHCODE_SERVER = str_replace("\\", "\\\\", $PATCHCODE_SERVER); $PATCHCODE_SERVER=str_replace("'","''",$PATCHCODE_SERVER);
$PATCHCODE_SERVER=str_replace("\\","\\\\",$PATCHCODE_SERVER);
$arr_cur_str = "[".implode(",",$array_cur)."]"; $arr_cur_str = "[".implode(",",$array_cur)."]";
$PATCHNAME="Update : Exchange Rate Import & Export $m2 / $y2 ".$arr_cur_str; $PATCHNAME="Update : Exchange Rate Import & Export $m2 / $y2 ".$arr_cur_str;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment