Package AlMaGe

Source Code of AlMaGe.CreatePayrolls

package AlMaGe;

import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;

import com.itextpdf.text.DocumentException;

import AlMaGe.DataMgr;
import AlMaGe.export.PDFExport;
import AlMaGe.export.PDFExport.PDF;
import AlMaGe.PersIDGehAus;


public class CreatePayrolls {
  public ArrayList<PersIDGehAus> persIDGehAusID = new ArrayList<PersIDGehAus>();
 
  public CreatePayrolls(String filePath, PDF whatsNext, Date date) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, MalformedURLException, DocumentException, IOException {
    ResultSet rs = DataMgr.getInstance().getResultSet("SELECT  `personen`.`PersID`, " +
                                "`gehaltausgezahlt`.`GehAusID` " +
                            "FROM `personen` " +
                              "LEFT JOIN `gehaltausgezahlt` " +
                                "ON (`personen`.`PersID` = `gehaltausgezahlt`.`PersID`) " +
                            "WHERE (`personen`.`LoeschDat` IS NULL)" +
                            "ORDER BY    `personen`.`PersID` ASC, " +
                                  "`gehaltausgezahlt`.`GehAusID` DESC");
    while(rs.next()){
      if(persIDGehAusID.size() > 0){
        if(persIDGehAusID.get(persIDGehAusID.size()-1).getPersID() != rs.getInt("PersID")){
          if(rs.getInt("GehAusID") != 0){
            persIDGehAusID.add(new PersIDGehAus(rs.getInt("PersID"), rs.getInt("GehAusID")));
          }else{
            persIDGehAusID.add(new PersIDGehAus(rs.getInt("PersID"), 0));
          }
        }
      }else{
        if(rs.getInt("GehAusID") != 0){
          persIDGehAusID.add(new PersIDGehAus(rs.getInt("PersID"), rs.getInt("GehAusID")));
        }else{
          persIDGehAusID.add(new PersIDGehAus(rs.getInt("PersID"), 0));
        }
      }
    }
    int[][] persAndAusgezID = new int[persIDGehAusID.size()][2];
    for(int i = 0; i < persIDGehAusID.size(); i++){
      persAndAusgezID[i][0] = persIDGehAusID.get(i).getGehAusID();
      persAndAusgezID[i][1] = persIDGehAusID.get(i).getPersID();
     
      DataMgr.getInstance().setStatement("INSERT INTO `gehaltausgezahlt` ( `GehAusID`, " +
                                        "`PersID`, " +
                                        "`BuchungsDat`, " +
                                        "`GehBrutto`," +
                                        "`GehNetto`, " +
                                        "`RVAN`, " +
                                        "`RVANProz`, " +
                                        "`RVAG`, " +
                                        "`RVAGProz`, " +
                                        "`KVAN`, " +
                                        "`KVANProz`, " +
                                        "`KVAG`, " +
                                        "`KVAGProz`, " +
                                        "`ALVAN`, " +
                                        "`ALVANProz`, " +
                                        "`ALVAG`, " +
                                        "`ALVAGProz`, " +
                                        "`PVAN`, " +
                                        "`PVANProz`, " +
                                        "`PVAG`, " +
                                        "`PVAGProz`, " +
                                        "`LSt`, " +
                                        "`KiSt`, " +
                                        "`Soli`, " +
                                        "`sonstBezug`, " +
                                        "`sonstAbzug`)" +
                                    "VALUES ('"+persIDGehAusID.get(i).getGehAusID()+"', " +
                                        "'"+persIDGehAusID.get(i).getPersID()+"', " +
                                        "'"+new java.sql.Date(date.getTime())+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getGehBrutto()+"'," +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getNetto()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getRVAN()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getRVANProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getRVAG()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getRVAGProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKVAN()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKVANProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKVAG()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKVAGProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getALVAN()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getALVANProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getALVAG()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getALVAGProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getPVAN()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getPVANProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getPVAG()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getPVAGProz()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getLSt()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKiSt()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getKiSt()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getSonstBezug()+"', " +
                                        "'"+persIDGehAusID.get(i).getAbrechnungsDaten().getSonstAbzug()+"')");
    }
    new PDFExport(persAndAusgezID, filePath, whatsNext);
   
  }
}
TOP

Related Classes of AlMaGe.CreatePayrolls

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.