?? registersecond_batch_init_ok.java
字號(hào):
/*
*this file is part of nseer erp
*Copyright (C)2006-2010 Nseer(Beijing) Technology co.LTD/http://www.nseer.com
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either
*version 2 of the License, or (at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software
*Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*這個(gè)文件是恩信科技ERP軟件的組成部分。
*版權(quán)所有(C)2006-2010 北京恩信創(chuàng)業(yè)科技有限公司/http://www.nseer.com
*
*這一程序是自由軟件,你可以遵照自由軟件基金會(huì)出版的GNU通用公共許可
*證條款來(lái)修改和重新發(fā)布這一程序。或者用許可證的第二版,或者(根據(jù)你的選
*擇)用任何更新的版本。
*
*發(fā)布這一程序的目的是希望它有用,但沒(méi)有任何擔(dān)保。甚至沒(méi)有適合特定目
*的的隱含的擔(dān)保。更詳細(xì)的情況請(qǐng)參閱GNU通用公共許可證。
*你應(yīng)該已經(jīng)和程序一起收到一份GNU通用公共許可證的副本。如果還沒(méi)有,
*寫(xiě)信給:
*The Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
*MA02139, USA
*/
package finance.config.account_init;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import javax.servlet.*;
import java.io.* ;
import include.nseer_db.*;
import java.text.*;
import include.nseer_cookie.counter;
import include.get_name_from_ID.getFiveNameFromID;
import include.get_name_from_ID.getNameFromID;
import include.nseer_cookie.exchangeString;
import validata.ValidataNumbers;
public class registerSecond_batch_init_ok extends HttpServlet{
ServletContext application;
HttpSession session;
public synchronized void service(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException{
HttpSession dbSession=request.getSession();
JspFactory _jspxFactory=JspFactory.getDefaultFactory();
PageContext pageContext = _jspxFactory.getPageContext(this,request,response,"",true,8192,true);
ServletContext dbApplication=dbSession.getServletContext();
nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
nseer_db_backup1 finance_db1 = new nseer_db_backup1(dbApplication);
getFiveNameFromID getNameFromID=new getFiveNameFromID();
getNameFromID getNameFromID1=new getNameFromID();
exchangeString ex=new exchangeString();
counter count=new counter(dbApplication);
ValidataNumbers validata=new ValidataNumbers();
try{
String[] cols=(String[])dbSession.getAttribute("init_cols");
if(finance_db.conn((String)dbSession.getAttribute("unit_db_name"))&&finance_db1.conn((String)dbSession.getAttribute("unit_db_name"))){
int p=0;
java.util.Date now = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String time=formatter.format(now);
String first_kind_ID="";
String first_kind_name="";
String second_kind_ID="";
String second_kind_name="";
for(int i=0;i<cols.length;i++){
String sql88="select * from finance_config_file_second_kind where id='"+cols[i]+"' ";
ResultSet rs88=finance_db1.executeQuery(sql88);
if(rs88.next()){
first_kind_ID=rs88.getString("first_kind_ID");
first_kind_name=rs88.getString("first_kind_name");
second_kind_ID=rs88.getString("second_kind_ID");
second_kind_name=rs88.getString("second_kind_name");
}
String last_year_balance_sum1="0";
String debit_year_sum1="0";
String loan_year_sum1="0";
String current_balance_sum1="0";
String last_year_balance_amount="0";
String debit_year_amount="0";
String loan_year_amount="0";
String current_balance_amount="0";
String finance_time=time;
String account_finished_finance_time=time.substring(0,7);
String finance_time_month="";
String finance_time_year="";
String finance_time1="";
finance_time_month=finance_time.substring(5,7);
finance_time_year=finance_time.substring(0,4);
finance_time1=finance_time_year+"-"+finance_time_month;
String sql0="update finance_config_file_second_kind set init_tag='1' where first_kind_ID='"+first_kind_ID+"' and second_kind_ID='"+second_kind_ID+"'";
finance_db.executeUpdate(sql0);
String sql00="update finance_config_file_first_kind set init_tag='1' where first_kind_ID='"+first_kind_ID+"'";
finance_db.executeUpdate(sql00);
String sql="select * from finance_account_details where first_kind_ID='"+first_kind_ID+"' and second_kind_ID='"+second_kind_ID+"'";
ResultSet rs=finance_db1.executeQuery(sql);//防止rs結(jié)果即被沖掉,必須再定義一個(gè)finance_db1
if(rs.next()){
//如果在明細(xì)賬有記錄,就要對(duì)總賬的三條記錄進(jìn)行更新,即減去原值加上新值。
String sql1="select * from finance_account where first_kind_ID='"+first_kind_ID+"' and second_kind_ID='' and third_kind_ID=''";
ResultSet rs1=finance_db.executeQuery(sql);
if(rs1.next()){
double last_year_balance_sum=rs1.getDouble("last_year_balance_sum")-rs.getDouble("last_year_balance_sum")+Double.parseDouble(last_year_balance_sum1);
double debit_year_sum=rs1.getDouble("debit_year_sum")-rs.getDouble("debit_year_sum")+Double.parseDouble(debit_year_sum1);
double loan_year_sum=rs1.getDouble("loan_year_sum")-rs.getDouble("loan_year_sum")+Double.parseDouble(loan_year_sum1);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -