Commit b0096a54 authored by mjadhav's avatar mjadhav

add DIR3 codes as per instruction


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97174 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c403d6e6
......@@ -78,6 +78,7 @@ public class GenInvoiceSchedule implements Schedule {
private String invLocFilePath="";
private String invBackupFilePath="";
private String invPort="";
static String accToBeCredited="";
......@@ -98,7 +99,7 @@ public class GenInvoiceSchedule implements Schedule {
public String schedule(String scheduleParamXML) throws Exception {
// TODO Auto-generated method stub
System.out.println("scheduleParamXML @!!!::::"+scheduleParamXML);
System.out.println("scheduleParamXML=####===!!::::"+scheduleParamXML);
ibase.utility.UserInfoBean userInfo = null;
String disparmLoginSiteCode = "";
Connection conn = null;
......@@ -456,7 +457,7 @@ public class GenInvoiceSchedule implements Schedule {
private static Node getFileHeader(Document doc,String invoiceId ,Connection conn) {
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql="",invType="",currencyCode="",invoiceISOCode="";
String sql="",invType="",currencyCode="",invoiceISOCode="",finEntity="",siteCode="",siteRegNo="";
double invAmt=0.0,netAmt=0.0;
DecimalFormat twoDf = new DecimalFormat("#.00");
DecimalFormat fourDf = new DecimalFormat("#.0000");
......@@ -464,7 +465,7 @@ public class GenInvoiceSchedule implements Schedule {
UtilMethods utilMethods= new UtilMethods();
try
{
sql = "select INV_AMT,INV_TYPE ,NET_AMT,CURR_CODE from invoice where invoice_id=? " ;
sql = "select INV_AMT,INV_TYPE ,NET_AMT,CURR_CODE,site_code,FIN_ENTITY,SITE_CODE from invoice where invoice_id=? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
......@@ -475,6 +476,8 @@ public class GenInvoiceSchedule implements Schedule {
invType = rs.getString("INV_TYPE");
netAmt=rs.getDouble("NET_AMT");
currencyCode=rs.getString("CURR_CODE");
finEntity=rs.getString("FIN_ENTITY");
siteCode=rs.getString("SITE_CODE");
}
rs.close();
......@@ -482,7 +485,7 @@ public class GenInvoiceSchedule implements Schedule {
pstmt.close();
pstmt = null;
siteRegNo=getSiteRegData(conn,"TAXNO1",siteCode,finEntity);
sql = "select iso4217 from currency where curr_code=? " ;
......@@ -503,6 +506,8 @@ public class GenInvoiceSchedule implements Schedule {
invType = invType == null ? " " : invType.trim();
currencyCode = currencyCode == null ? " " : currencyCode.trim();
invoiceISOCode = invoiceISOCode == null ? " " : invoiceISOCode.trim();
finEntity = finEntity == null ? " " : finEntity.trim();
siteRegNo = siteRegNo == null ? " " : siteRegNo.trim();
}
catch(Exception e)
......@@ -538,7 +543,7 @@ public class GenInvoiceSchedule implements Schedule {
fileHeader.appendChild(thirdParty);
Element batch = doc.createElement("Batch");
batch.appendChild(getElementValue(doc, fileHeader, "BatchIdentifier",invoiceId));
batch.appendChild(getElementValue(doc, fileHeader, "BatchIdentifier",siteRegNo+invoiceId));
batch.appendChild(getElementValue(doc, fileHeader, "InvoicesCount","1"));
Element totalInvoicesAmount = doc.createElement("TotalInvoicesAmount");
......@@ -574,28 +579,15 @@ public class GenInvoiceSchedule implements Schedule {
String custDlvAdd1="",custDlvAdd2="",custDlvAdd3="",custDlvCity="",custDlvStateCode="",custDlvPin="",custDlvCounty="";
String custBillStatedescr="",custDlvStatedescr="";
String custDlvreg_1="",custDlvreg_2="",custDlvreg_3="",custBillreg_1="",custBillreg_2="",custBillreg_3="",custCodereg_1="",custCodereg_2="",custCodereg_3="";
String nameReg1="",add1Reg1="",add2Reg1="",add3Reg1="",cityReg1="",pinReg1="",countyReg1="",stateCodeReg1="";
String nameReg2="",add1Reg2="",add2Reg2="",add3Reg2="",cityReg2="",pinReg2="",countyReg2="",stateCodeReg2="";
String nameReg3="",add1Reg3="",add2Reg3="",add3Reg3="",cityReg3="",pinReg3="",countyReg3="",stateCodeReg3="";
String compLocation="",sheet="",folio="",volume="",addRegData="",finEntity="";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
/*sql = "select SITE_CODE,CUST_CODE,CUST_CODE__BIL from invoice where invoice_id=? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
rs = pstmt.executeQuery();
if (rs.next())
{
custCode = rs.getString("cust_code");
siteCode=rs.getString("SITE_CODE");
custCodeBil=rs.getString("CUST_CODE__BIL");
System.out.println("custCode "+custCode);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
*/
/*sql = " select i.SITE_CODE,i.CUST_CODE,i.CUST_CODE__BIL,d.cust_code__dlv ,d.DLV_ADD1 " +
......@@ -633,7 +625,7 @@ public class GenInvoiceSchedule implements Schedule {
sql = "select reg_no from siteregno where site_code=? and REF_CODE='TAXNO1' " ;
/* sql = "select reg_no from siteregno where site_code=? and REF_CODE='TAXNO1' " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
......@@ -646,10 +638,11 @@ public class GenInvoiceSchedule implements Schedule {
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("siteRegNo @@@@@@@@@@@@"+siteRegNo);
pstmt = null;*/
sql = "select AREA_CODE,ADD1,ADD2,CITY,PIN,STATE_CODE,CONTACT_PERSON,DESCR from site where SITE_CODE =?" ;
sql = "select AREA_CODE,ADD1,ADD2,CITY,PIN,STATE_CODE,CONTACT_PERSON,DESCR,FIN_ENTITY from site where SITE_CODE =?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
......@@ -664,12 +657,35 @@ public class GenInvoiceSchedule implements Schedule {
siteStateCode=rs.getString("STATE_CODE");
siteContactPersion=rs.getString("CONTACT_PERSON");
siteDescr=rs.getString("DESCR");
finEntity=rs.getString("FIN_ENTITY");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
finEntity = finEntity == null ? " " : finEntity.trim();
siteRegNo=getSiteRegData(conn,"TAXNO1",siteCode,finEntity);
System.out.println("siteRegNo @@@@@@@@@@@@"+siteRegNo);
compLocation=getSiteRegData(conn,"REG1",siteCode,finEntity);
sheet=getSiteRegData(conn,"REG2",siteCode,finEntity);
folio=getSiteRegData(conn,"REG3",siteCode,finEntity);
volume=getSiteRegData(conn,"REG4",siteCode,finEntity);
addRegData=getSiteRegData(conn,"REG5",siteCode,finEntity);
accToBeCredited=getSiteRegData(conn,"ACCTNO",siteCode,finEntity);
//System.out.println("paymentMeans : "+paymentMeans);
System.out.println("accToBeCredited : "+accToBeCredited);
accToBeCredited = accToBeCredited == null ? " " : accToBeCredited.trim();
compLocation = compLocation == null ? " " : compLocation.trim();
sheet = sheet == null ? " " : sheet.trim();
folio = folio == null ? " " : folio.trim();
volume = volume == null ? " " : volume.trim();
addRegData = addRegData == null ? " " : addRegData.trim();
......@@ -745,9 +761,120 @@ public class GenInvoiceSchedule implements Schedule {
custBillreg_1 = custBillreg_1 == null ? " " : custBillreg_1.trim();
custBillreg_2 = custBillreg_2 == null ? " " : custBillreg_2.trim();
custBillreg_3 = custBillreg_3 == null ? " " : custBillreg_3.trim();
sql = "select cust_name,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,COUNT_CODE,REGISTR_1,REGISTR_2,REGISTR_3 from customer where CUST_CODE=?" ;
/*-----------------changed done dated 29-01-2015-------------------------*/
sql = "select cust_name,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,COUNT_CODE from customer where CUST_CODE=?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custBillreg_1);
rs = pstmt.executeQuery();
if (rs.next())
{
nameReg1 = rs.getString("CUST_NAME");
add1Reg1 = rs.getString("ADDR1");
add2Reg1 = rs.getString("ADDR2");
add3Reg1 = rs.getString("ADDR3");
cityReg1 = rs.getString("CITY");
stateCodeReg1 = rs.getString("STATE_CODE");
pinReg1 = rs.getString("PIN");
countyReg1 = rs.getString("COUNT_CODE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
nameReg1 = nameReg1 == null ? " " : nameReg1.trim();
add1Reg1 = add1Reg1 == null ? " " : add1Reg1.trim();
add2Reg1 = add2Reg1 == null ? " " : add2Reg1.trim();
add3Reg1 = add3Reg1 == null ? " " : add3Reg1.trim();
cityReg1 = cityReg1 == null ? " " : cityReg1.trim();
stateCodeReg1 = stateCodeReg1 == null ? " " : stateCodeReg1.trim();
pinReg1 = pinReg1 == null ? " " : pinReg1.trim();
countyReg1 = countyReg1 == null ? " " : countyReg1.trim();
sql = "select cust_name,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,COUNT_CODE from customer where CUST_CODE=?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custBillreg_2);
rs = pstmt.executeQuery();
if (rs.next())
{
nameReg2 = rs.getString("CUST_NAME");
add1Reg2 = rs.getString("ADDR1");
add2Reg2 = rs.getString("ADDR2");
add3Reg2 = rs.getString("ADDR3");
cityReg2 = rs.getString("CITY");
stateCodeReg2 = rs.getString("STATE_CODE");
pinReg2 = rs.getString("PIN");
countyReg2 = rs.getString("COUNT_CODE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
nameReg2 = nameReg2 == null ? " " : nameReg2.trim();
add1Reg2 = add1Reg2 == null ? " " : add1Reg2.trim();
add2Reg2 = add2Reg2 == null ? " " : add2Reg2.trim();
add3Reg2 = add3Reg2 == null ? " " : add3Reg2.trim();
cityReg2 = cityReg2 == null ? " " : cityReg2.trim();
stateCodeReg2 = stateCodeReg2 == null ? " " : stateCodeReg2.trim();
pinReg2 = pinReg2 == null ? " " : pinReg2.trim();
countyReg2 = countyReg2 == null ? " " : countyReg2.trim();
sql = "select cust_name,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,COUNT_CODE from customer where CUST_CODE=?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custBillreg_3);
rs = pstmt.executeQuery();
if (rs.next())
{
nameReg3 = rs.getString("CUST_NAME");
add1Reg3 = rs.getString("ADDR1");
add2Reg3 = rs.getString("ADDR2");
add3Reg3 = rs.getString("ADDR3");
cityReg3 = rs.getString("CITY");
stateCodeReg3 = rs.getString("STATE_CODE");
pinReg3 = rs.getString("PIN");
countyReg3 = rs.getString("COUNT_CODE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
nameReg3 = nameReg3 == null ? " " : nameReg3.trim();
add1Reg3 = add1Reg3 == null ? " " : add1Reg3.trim();
add2Reg3 = add2Reg3 == null ? " " : add2Reg3.trim();
add3Reg3 = add3Reg3 == null ? " " : add3Reg3.trim();
cityReg3 = cityReg3 == null ? " " : cityReg3.trim();
stateCodeReg3 = stateCodeReg3 == null ? " " : stateCodeReg3.trim();
pinReg3 = pinReg3 == null ? " " : pinReg3.trim();
countyReg3 = countyReg3 == null ? " " : countyReg3.trim();
/*-------------------------------------------------------------------------------------*/
/* sql = "select cust_name,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,COUNT_CODE,REGISTR_1,REGISTR_2,REGISTR_3 from customer where CUST_CODE=?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCodeDlv);
......@@ -771,7 +898,7 @@ public class GenInvoiceSchedule implements Schedule {
rs = null;
pstmt.close();
pstmt = null;
*/
custDlvAdd1 = custDlvAdd1 == null ? " " : custDlvAdd1.trim();
custDlvAdd2 = custDlvAdd2 == null ? " " : custDlvAdd2.trim();
custDlvAdd3 = custDlvAdd3 == null ? " " : custDlvAdd3.trim();
......@@ -791,15 +918,21 @@ public class GenInvoiceSchedule implements Schedule {
siteStatedescr=getStateDescr(conn,siteStateCode);
System.out.println("siteStatedescr "+siteStatedescr);
custStatedescr=getStateDescr(conn,custState);
custStatedescr=getStateDescr(conn,stateCodeReg3);
System.out.println("custStatedescr "+custStatedescr);
custBillStatedescr=getStateDescr(conn,custBillStateCode);
custBillStatedescr=getStateDescr(conn,stateCodeReg2);
System.out.println("custBillStatedescr "+custBillStatedescr);
custDlvStatedescr=getStateDescr(conn,custDlvStateCode);
custDlvStatedescr=getStateDescr(conn,stateCodeReg1);
System.out.println("custDlvStateCode "+custDlvStateCode);
custBillStatedescr = custBillStatedescr == null ? " " : custBillStatedescr.trim();
custDlvStatedescr = custDlvStatedescr == null ? " " : custDlvStatedescr.trim();
......@@ -861,6 +994,20 @@ public class GenInvoiceSchedule implements Schedule {
Element individual = doc.createElement("LegalEntity");
individual.appendChild(getElementValue(doc, parties, "CorporateName", siteDescr));
/*----------------------changed done dated 29-jan-2015-----------------------------------------*/
Element registrationData = doc.createElement("RegistrationData");
registrationData.appendChild(getElementValue(doc, parties, "RegisterOfCompaniesLocation",compLocation));
registrationData.appendChild(getElementValue(doc, parties, "Sheet",sheet));
registrationData.appendChild(getElementValue(doc, parties, "Folio",folio));
registrationData.appendChild(getElementValue(doc, parties, "Volume",volume));
registrationData.appendChild(getElementValue(doc, parties, "AdditionalRegistrationData",addRegData));
individual.appendChild(registrationData);
/*------------------------------------------------------------------------------------------------*/
Element addressInSpain = doc.createElement("AddressInSpain");
addressInSpain.appendChild(getElementValue(doc, parties, "Address", siteAdd1));
addressInSpain.appendChild(getElementValue(doc, parties, "PostCode", sitePin));
......@@ -887,14 +1034,14 @@ public class GenInvoiceSchedule implements Schedule {
admCustDlv.appendChild(getElementValue(doc, parties, "CentreCode", custBillreg_1));
admCustDlv.appendChild(getElementValue(doc, parties, "RoleTypeCode", "01"));
// administrativeCentres.appendChild(getElementValue(doc, parties, "RoleTypeCode", "03"));
if(custNameDlv != "")
if(nameReg1 != "")
{
admCustDlv.appendChild(getElementValue(doc, parties, "Name", custNameDlv));
admCustDlv.appendChild(getElementValue(doc, parties, "Name", nameReg1));
}
Element addCustDlv = doc.createElement("AddressInSpain");
addCustDlv.appendChild(getElementValue(doc, parties, "Address", custDlvAdd1));
addCustDlv.appendChild(getElementValue(doc, parties, "PostCode", custDlvPin));
addCustDlv.appendChild(getElementValue(doc, parties, "Town", custDlvCity));
addCustDlv.appendChild(getElementValue(doc, parties, "Address", add1Reg1));
addCustDlv.appendChild(getElementValue(doc, parties, "PostCode", pinReg1));
addCustDlv.appendChild(getElementValue(doc, parties, "Town", cityReg1));
addCustDlv.appendChild(getElementValue(doc, parties, "Province", custDlvStatedescr));
//addCustDlv.appendChild(getElementValue(doc, parties, "CountryCode", dlvCountryCode));
addCustDlv.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
......@@ -909,14 +1056,14 @@ public class GenInvoiceSchedule implements Schedule {
// }
admCustBill.appendChild(getElementValue(doc, parties, "RoleTypeCode", "02"));
// administrativeCentres.appendChild(getElementValue(doc, parties, "RoleTypeCode", "03"));
if(custNameBill != "")
if(nameReg2 != "")
{
admCustBill.appendChild(getElementValue(doc, parties, "Name", custNameBill));
admCustBill.appendChild(getElementValue(doc, parties, "Name", nameReg2));
}
Element addCustBill = doc.createElement("AddressInSpain");
addCustBill.appendChild(getElementValue(doc, parties, "Address", custBillAdd1));
addCustBill.appendChild(getElementValue(doc, parties, "PostCode", custBillPin));
addCustBill.appendChild(getElementValue(doc, parties, "Town", custBillCity));
addCustBill.appendChild(getElementValue(doc, parties, "Address", add1Reg2));
addCustBill.appendChild(getElementValue(doc, parties, "PostCode", pinReg2));
addCustBill.appendChild(getElementValue(doc, parties, "Town", cityReg2));
addCustBill.appendChild(getElementValue(doc, parties, "Province", custBillStatedescr));
//addCustBill.appendChild(getElementValue(doc, parties, "CountryCode", custCountrtCode));
addCustBill.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
......@@ -929,14 +1076,14 @@ public class GenInvoiceSchedule implements Schedule {
administrativeCentres.appendChild(getElementValue(doc, parties, "CentreCode", custBillreg_3));
administrativeCentres.appendChild(getElementValue(doc, parties, "RoleTypeCode", "03"));
// administrativeCentres.appendChild(getElementValue(doc, parties, "RoleTypeCode", "03"));
if(custName != "")
if(nameReg3 != "")
{
administrativeCentres.appendChild(getElementValue(doc, parties, "Name", custName));
administrativeCentres.appendChild(getElementValue(doc, parties, "Name", nameReg3));
}
Element addressbuyer = doc.createElement("AddressInSpain");
addressbuyer.appendChild(getElementValue(doc, parties, "Address", custAdd1));
addressbuyer.appendChild(getElementValue(doc, parties, "PostCode", custPin));
addressbuyer.appendChild(getElementValue(doc, parties, "Town", custCity));
addressbuyer.appendChild(getElementValue(doc, parties, "Address", add1Reg3));
addressbuyer.appendChild(getElementValue(doc, parties, "PostCode", pinReg3));
addressbuyer.appendChild(getElementValue(doc, parties, "Town", cityReg3));
addressbuyer.appendChild(getElementValue(doc, parties, "Province", custStatedescr));
// addressbuyer.appendChild(getElementValue(doc, parties, "CountryCode", custCountrtCode));
addressbuyer.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
......@@ -956,7 +1103,7 @@ public class GenInvoiceSchedule implements Schedule {
addlegalEntity.appendChild(getElementValue(doc, parties, "PostCode", sitePin));
addlegalEntity.appendChild(getElementValue(doc, parties, "Town", sitecity));
addlegalEntity.appendChild(getElementValue(doc, parties, "Province", siteStatedescr));*/
addlegalEntity.appendChild(getElementValue(doc, parties, "Address",custBillAdd1));
addlegalEntity.appendChild(getElementValue(doc, parties, "Address",custBillAdd2));
addlegalEntity.appendChild(getElementValue(doc, parties, "PostCode", custBillPin));
addlegalEntity.appendChild(getElementValue(doc, parties, "Town", custBillCity));
addlegalEntity.appendChild(getElementValue(doc, parties, "Province", custBillStatedescr));
......@@ -977,14 +1124,15 @@ public class GenInvoiceSchedule implements Schedule {
private static Node getInvoiceElement(Document doc,String invoiceId,Connection conn) {
String sql="";
String sql="",purchaseOrd="",saleOrder="",despId="",phyAttrib_10="";
String custCode="",currencyCode="",itemCode="",itemDescr="",quantity="",unit="";
String taxCode="",taxClass="",taxBase="",taxChap="",taxEnv="",exchRate="",discAmt="";
String currCodeHd="",invoiceISOCode="";
String itemCodeDet="",itemDescrDet="",quantityDet="",unitDet="",accDet="",instAmtDet="";
String rate="",unitRate="",discountInv="",taxEffects="",siteCode="",paymentMeans="",accToBeCredited="",docStatus="";
String rate="",unitRate="",discountInv="",taxEffects="",siteCode="",paymentMeans="",docStatus="";
double taxBaseAmt=0.00,taxAmtHd=0.00 ,NetAmtHd=0.00,discAmtHd=0.00,invoiceAmtHd=0.00,rateDet=0.00;
double taxAmtDet=0.00,netAmtDet=0.00,discAmtDet=0.00,taxAmt=0.00,taxPersc=0.00,discountDet=0.00,totalCost=0.0,grossAmount=0.0,totalGrossAmount=0.0;
double totTaxBaseAmt=0.0,totTaxAmt=0.0;
GenericUtility genericUtility = null;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null;
......@@ -992,7 +1140,7 @@ public class GenInvoiceSchedule implements Schedule {
int totalAmt=0,amtWitoutTax=0;
HashMap<String, String> tempMap = new HashMap<String, String>();
SimpleDateFormat sdf = null;
Date invoiceDtHd=null;
Date invoiceDtHd=null,dueDateHd=null;
DecimalFormat twoDf = new DecimalFormat("#.00");
DecimalFormat fourDf = new DecimalFormat("#.0000");
DecimalFormat sixDf = new DecimalFormat("#.000000");
......@@ -1006,7 +1154,7 @@ public class GenInvoiceSchedule implements Schedule {
sdf=new SimpleDateFormat("yyyy-MM-dd");
sql = " select INV_AMT,TAX_AMT,DISC_AMT,NET_AMT,CURR_CODE,TRAN_DATE ,SITE_CODE ,DOC_STATUS from invoice " +
sql = " select INV_AMT,TAX_AMT,DISC_AMT,NET_AMT,CURR_CODE,TRAN_DATE ,SITE_CODE ,DOC_STATUS,SALE_ORDER,DESP_ID,DUE_DATE from invoice " +
"where invoice_id=?" ;
pstmt = conn.prepareStatement(sql);
......@@ -1022,6 +1170,9 @@ public class GenInvoiceSchedule implements Schedule {
currCodeHd = rs.getString("CURR_CODE");
siteCode= rs.getString("SITE_CODE");
docStatus= rs.getString("DOC_STATUS");
saleOrder= rs.getString("SALE_ORDER");
despId= rs.getString("DESP_ID");
dueDateHd = rs.getDate("DUE_DATE");
}
rs.close();
......@@ -1030,12 +1181,18 @@ public class GenInvoiceSchedule implements Schedule {
pstmt = null;
//2014-03-12
saleOrder = saleOrder == null ? " " : saleOrder.trim();
despId = despId == null ? " " : despId.trim();
System.out.println("invoiceDtHd : "+invoiceDtHd);
System.out.println("dueDateHd : "+dueDateHd);
//paymentMeans=getSiteRegvalue(conn,"IBAN",siteCode);
accToBeCredited=getSiteRegvalue(conn,"ACCTNO",siteCode);
//System.out.println("paymentMeans : "+paymentMeans);
System.out.println("accToBeCredited : "+accToBeCredited);
System.out.println("currencyCode : "+currCodeHd);
sql = "select iso4217 from currency where curr_code=? " ;
......@@ -1056,11 +1213,12 @@ public class GenInvoiceSchedule implements Schedule {
sql = " select ITEM_CODE,ITEM_DESCR,QUANTITY,UNIT,RATE,DISCOUNT,TAX_AMT,NET_AMT ," +
"DISC_AMT,INST_AMOUNT,ACC_CODE__ITEM,QUANTITY__STDUOM,RATE__STDUOM from invdet " +
"DISC_AMT,INST_AMOUNT,ACC_CODE__ITEM,QUANTITY__STDUOM,RATE__STDUOM ,(select cust_pord from sorder where sale_order=?) as cust_prod from invdet " +
" where invoice_id=?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
pstmt.setString(1, saleOrder);
pstmt.setString(2, invoiceId);
rs = pstmt.executeQuery();
while (rs.next())
{
......@@ -1079,6 +1237,7 @@ public class GenInvoiceSchedule implements Schedule {
discAmtDet = rs.getDouble("DISC_AMT");
instAmtDet = rs.getString("INST_AMOUNT");
accDet = rs.getString("ACC_CODE__ITEM");
purchaseOrd=rs.getString("cust_prod");
totalCost=rateDet * Integer.parseInt(quantityDet);
System.out.println("totalCost :"+totalCost);
......@@ -1098,11 +1257,28 @@ public class GenInvoiceSchedule implements Schedule {
// discAmtDet = discAmtDet == null ? " " : discAmtDet.trim();
instAmtDet = instAmtDet == null ? " " : instAmtDet.trim();
accDet = accDet == null ? " " : accDet.trim();
purchaseOrd = purchaseOrd == null ? " " : purchaseOrd.trim();
sql = "select PHY_ATTRIB_10 from tarodev.item where item_code= ? " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCodeDet);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
phyAttrib_10 = rs1.getString("PHY_ATTRIB_10");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
phyAttrib_10 = phyAttrib_10 == null ? " " : phyAttrib_10.trim();
tempMap.put("item_code" + cnt, itemCodeDet);
tempMap.put("item_descr" + cnt, itemDescrDet);
tempMap.put("item_descr" + cnt, phyAttrib_10+"-"+itemDescrDet);
tempMap.put("quantity" + cnt, quantityDet);
tempMap.put("unit" + cnt, unitDet);
......@@ -1126,30 +1302,6 @@ public class GenInvoiceSchedule implements Schedule {
/*sql = " select TAX_CODE,TAX_CLASS,TAXABLE_AMT ,TAX_CHAP,TAX_ENV,TAX_AMT,EXCH_RATE ,TAX_PERC,EFFECT " +
" from taxtran where tran_id= ? and tran_code='S-INV' and tax_amt <> '0' and tax_perc <>'0' " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
rs = pstmt.executeQuery();
if (rs.next())
{
taxCode = rs.getString("TAX_CODE");
taxClass = rs.getString("TAX_CLASS");
taxBaseAmt = rs.getDouble("TAXABLE_AMT");
taxChap = rs.getString("TAX_CHAP");
taxEnv = rs.getString("TAX_ENV");
taxAmt = rs.getDouble("TAX_AMT");
exchRate = rs.getString("EXCH_RATE");
taxPersc = rs.getDouble("TAX_PERC");
taxEffects = rs.getString("EFFECT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;*/
sql = " select TAX_CODE,TAX_CLASS,TAXABLE_AMT ,TAX_CHAP,TAX_ENV,TAX_AMT,EXCH_RATE ,TAX_PERC,EFFECT " +
......@@ -1177,6 +1329,9 @@ public class GenInvoiceSchedule implements Schedule {
System.out.println("taxAmt :"+taxAmt);
System.out.println("taxPersc :"+taxPersc);
totTaxBaseAmt = totTaxBaseAmt + taxBaseAmt;
totTaxAmt = totTaxAmt + taxAmt;
tempMap.put("taxBase_amt" + taxCnt, utilMethods.getReqDecString(taxBaseAmt,2));
tempMap.put("tax_amt" + taxCnt, utilMethods.getReqDecString(taxAmt,2));
......@@ -1227,10 +1382,15 @@ public class GenInvoiceSchedule implements Schedule {
Element invoiceIssueData = doc.createElement("InvoiceIssueData");
invoiceIssueData.appendChild(getElementValue(doc, invoiceParent, "IssueDate",sdf.format(invoiceDtHd)));
/*
//removed on dated 29-jan-2015
Element invoicingPeriod = doc.createElement("InvoicingPeriod");
invoicingPeriod.appendChild(getElementValue(doc, invoiceParent, "StartDate",sdf.format(invoiceDtHd)));
invoicingPeriod.appendChild(getElementValue(doc, invoiceParent, "EndDate",sdf.format(invoiceDtHd)));
invoiceIssueData.appendChild(invoicingPeriod);
*/
invoiceIssueData.appendChild(getElementValue(doc, invoiceParent, "InvoiceCurrencyCode", invoiceISOCode));
//invoiceIssueData.appendChild(getElementValue(doc, invoiceParent, "InvoiceCurrencyCode", "EUR"));
//invoiceIssueData.appendChild(getElementValue(doc, invoiceParent, "TaxCurrencyCode", "EUR"));
......@@ -1239,26 +1399,29 @@ public class GenInvoiceSchedule implements Schedule {
invoice.appendChild(invoiceIssueData);
System.out.println("***************TaxesOutputs***(((((****************");
/* Element taxesOutputs = doc.createElement("TaxesOutputs");
Element taxesOutputs = doc.createElement("TaxesOutputs");
Element tax = doc.createElement("Tax");
tax.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
System.out.println("test 000");
tax.appendChild(getElementValue(doc, invoiceParent, "TaxRate", utilMethods.getReqDecString(taxPersc,2)));
Element taxableTotAmtHD = doc.createElement("TaxableBase");
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxBaseAmt,2)));
tax.appendChild(taxableTotAmtHD);
Element taxAmounttHd = doc.createElement("TaxAmount");
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxAmt,2)));
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxAmt,2)));
tax.appendChild(taxAmounttHd);
//tax.appendChild(getElementValue(doc, invoiceParent, "EquivalenceSurcharge", ""));
Element equivalenceSurcharge = doc.createElement("EquivalenceSurchargeAmount");
/*Element equivalenceSurcharge = doc.createElement("EquivalenceSurchargeAmount");
equivalenceSurcharge.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", "0.00"));
tax.appendChild(equivalenceSurcharge);
*/
taxesOutputs.appendChild(tax);
invoice.appendChild(taxesOutputs);
*/
Element taxesOutputs = doc.createElement("TaxesOutputs");
/* Element taxesOutputs = doc.createElement("TaxesOutputs");
System.out.println("taxCnt#########@@@@@"+taxCnt);
for(int j = 1; j <= taxCnt ;j++)
{
......@@ -1283,9 +1446,9 @@ public class GenInvoiceSchedule implements Schedule {
tax.appendChild(equivalenceSurcharge);
taxesOutputs.appendChild(tax);
}
invoice.appendChild(taxesOutputs);
invoice.appendChild(taxesOutputs);*/
Element taxesWithheld = doc.createElement("TaxesWithheld");
/*Element taxesWithheld = doc.createElement("TaxesWithheld");
Element taxHeld = doc.createElement("Tax");
taxHeld.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode","01" ));
taxHeld.appendChild(getElementValue(doc, invoiceParent, "TaxRate","0.00" ));
......@@ -1299,6 +1462,8 @@ public class GenInvoiceSchedule implements Schedule {
taxesWithheld.appendChild(taxHeld);
invoice.appendChild(taxesWithheld);
*/
System.out.println("totalGrossAmount :"+totalGrossAmount);
Element invoiceTotals = doc.createElement("InvoiceTotals");
......@@ -1344,6 +1509,14 @@ public class GenInvoiceSchedule implements Schedule {
Element invoiceLine = doc.createElement("InvoiceLine");
/*---------------------------------------------------------------------------------------------------------------------*/
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "ReceiverTransactionReference", saleOrder+"/"+purchaseOrd));
Element deliveryNotesReferences = doc.createElement("DeliveryNotesReferences");
Element deliveryNote = doc.createElement("DeliveryNote");
deliveryNote.appendChild(getElementValue(doc, invoiceParent, "DeliveryNoteNumber", despId));
deliveryNotesReferences.appendChild(deliveryNote);
invoiceLine.appendChild(deliveryNotesReferences);
/*----------------------------------------------------------------------------------------------------------------------*/
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "ItemDescription", (String) tempMap.get("item_descr" + i)));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "Quantity", (String) tempMap.get("quantity" + i)));
//invoiceLine.appendChild(getElementValue(doc, invoiceParent, "UnitOfMeasure", (String) tempMap.get("unit" + i)));
......@@ -1382,7 +1555,7 @@ public class GenInvoiceSchedule implements Schedule {
Element taxesWithheldItem = doc.createElement("TaxesWithheld");
/* Element taxesWithheldItem = doc.createElement("TaxesWithheld");
Element taxHeldItem = doc.createElement("Tax");
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxRate", "0.00"));
......@@ -1395,24 +1568,24 @@ public class GenInvoiceSchedule implements Schedule {
taxHeldItem.appendChild(taxAmount1);
taxesWithheldItem.appendChild(taxHeldItem);
invoiceLine.appendChild(taxesWithheldItem);
invoiceLine.appendChild(taxesWithheldItem);*/
/*
Element taxesOutputsItem = doc.createElement("TaxesOutputs");
Element taxItem = doc.createElement("Tax");
taxItem.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
taxItem.appendChild(getElementValue(doc, invoiceParent, "TaxRate",utilMethods.getReqDecString(taxPersc,2)));
Element taxableTotAmtOutputs = doc.createElement("TaxableBase");
taxableTotAmtOutputs.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
taxableTotAmtOutputs.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxBaseAmt,2)));
taxItem.appendChild(taxableTotAmtOutputs);
Element taxAmount2 = doc.createElement("TaxAmount");
taxAmount2.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", (String) tempMap.get("tax_amt" + i)));
taxAmount2.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", utilMethods.getReqDecString(totTaxAmt,2)));
taxItem.appendChild(taxAmount2);
taxesOutputsItem.appendChild(taxItem);
invoiceLine.appendChild(taxesOutputsItem);*/
invoiceLine.appendChild(taxesOutputsItem);
System.out.println("taxCnt!!!!!@@@@@"+taxCnt);
/* System.out.println("taxCnt!!!!!@@@@@"+taxCnt);
Element taxesOutputs1 = doc.createElement("TaxesOutputs");
for(int j = 1; j <= taxCnt ;j++)
{
......@@ -1437,11 +1610,13 @@ public class GenInvoiceSchedule implements Schedule {
tax.appendChild(equivalenceSurcharge);
taxesOutputs1.appendChild(tax);
}
invoiceLine.appendChild(taxesOutputs1);
invoiceLine.appendChild(taxesOutputs1);*/
//invoiceLine.appendChild(getElementValue(doc, invoiceParent, "AdditionalLineItemInformation", " "));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "AdditionalLineItemInformation", "Nº Pedido:"+saleOrder+"/"+purchaseOrd+"- Nº Albarán:"+despId));
items.appendChild(invoiceLine);
......@@ -1453,8 +1628,16 @@ public class GenInvoiceSchedule implements Schedule {
System.out.println("===PaymentDetails@@@@@@====");
Element paymentDetails = doc.createElement("PaymentDetails");
Element installment = doc.createElement("Installment");
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentDueDate", sdf.format(invoiceDtHd)));
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentAmount",String.valueOf( NetAmtHd)));
if(dueDateHd != null)
{
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentDueDate", sdf.format(dueDateHd)));
}
else
{
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentDueDate", ""));
}
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentAmount",utilMethods.getReqDecString(NetAmtHd,2)));
installment.appendChild(getElementValue(doc, invoiceParent, "PaymentMeans", "04"));
Element accountToBeCredited = doc.createElement("AccountToBeCredited");
accountToBeCredited.appendChild(getElementValue(doc, invoiceParent, "IBAN",accToBeCredited.replaceAll("-","")));
......@@ -1464,6 +1647,11 @@ public class GenInvoiceSchedule implements Schedule {
invoice.appendChild(paymentDetails);
/*-----------------added on dated 29-jan-2015--------------------------*/
Element additionalData = doc.createElement("AdditionalData");
additionalData.appendChild(getElementValue(doc, invoiceParent, "InvoiceAdditionalInformation", "Nº Pedido:"+saleOrder+"/"+purchaseOrd+"- Nº Albarán:"+despId));
invoice.appendChild(additionalData);
/*--------------------------------------------------------------------------------------------*/
invoiceParent.appendChild(invoice);
......@@ -1483,7 +1671,7 @@ public class GenInvoiceSchedule implements Schedule {
}
public static String getSiteRegvalue(Connection conn,String col1,String siteCode)
/*public static String getSiteRegvalue(Connection conn,String col1,String siteCode)
{
String result="",sql="";
PreparedStatement pstmt = null;
......@@ -1512,7 +1700,7 @@ public class GenInvoiceSchedule implements Schedule {
}
return result;
}
}*/
public static String getStateDescr(Connection conn,String col1)
......@@ -1665,6 +1853,40 @@ public class GenInvoiceSchedule implements Schedule {
System.out.println("original file delete successful !");
}
public static String getSiteRegData(Connection conn,String col1,String siteCode,String col2)
{
String result="",sql="";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
sql = "select reg_no from siteregno where site_code=? and REF_CODE=? and fin_entity=? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, col1);
pstmt.setString(3, col2);
rs = pstmt.executeQuery();
if (rs.next())
{
result = rs.getString("reg_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return result;
}
/*----------------------------------------------------------------------------------------------*/
......
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