registerthird_batch_init_ok.java

来自「一个ERP强大系统的源码」· Java 代码 · 共 276 行 · 第 1/2 页

JAVA
276
字号
/*
 *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.
 *
 *这个文件是恩信科技ERP软件的组成部分。
 *版权所有(C)2006-2010 北京恩信创业科技有限公司/http://www.nseer.com
 *
 *这一程序是自由软件,你可以遵照自由软件基金会出版的GNU通用公共许可
 *证条款来修改和重新发布这一程序。或者用许可证的第二版,或者(根据你的选
 *择)用任何更新的版本。
 *
 *发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特定目
 *的的隐含的担保。更详细的情况请参阅GNU通用公共许可证。
 *你应该已经和程序一起收到一份GNU通用公共许可证的副本。如果还没有,
 *写信给:
 *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 registerThird_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;
String first_kind_ID="";
String first_kind_name="";
String second_kind_ID="";
String second_kind_name="";
String third_kind_ID="";
String third_kind_name="";
java.util.Date now = new java.util.Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String time=formatter.format(now);
for(int i=0;i<cols.length;i++){
String sql88="select * from finance_config_file_third_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");
third_kind_ID=rs88.getString("third_kind_ID");
third_kind_name=rs88.getString("third_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_third_kind set init_tag='1' where first_kind_ID='"+first_kind_ID+"' and  second_kind_ID='"+second_kind_ID+"' and  third_kind_ID='"+third_kind_ID+"'";
finance_db.executeUpdate(sql0);


String sql000="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(sql000);

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+"' and  third_kind_ID='"+third_kind_ID+"'";
ResultSet rs=finance_db1.executeQuery(sql);//防止rs结果集被冲掉,必须再定义一个finance_db1
if(rs.next()){

//如果在明细账有记录,就要对总账的三条记录进行更新,即减去原值加上新值。
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(sql1);
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);
double current_balance_sum=rs1.getDouble("current_balance_sum")-rs.getDouble("current_balance_sum")+Double.parseDouble(current_balance_sum1);

double debit_month_sum=rs1.getDouble("debit_month_sum")-rs.getDouble("debit_month_sum")+Double.parseDouble(debit_year_sum1);
double loan_month_sum=rs1.getDouble("loan_month_sum")-rs.getDouble("loan_month_sum")+Double.parseDouble(loan_year_sum1);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?