Commit f60ad692 authored by mjadhav's avatar mjadhav

changes done for namespace tag


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97104 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1f87c7c1
......@@ -375,7 +375,17 @@ public class GenInvoiceSchedule implements Schedule {
icBuilder = icFactory.newDocumentBuilder();
Document document = icBuilder.newDocument();
Element mainRootElement = document.createElementNS("http://www.facturae.es/Facturae/2009/v3.2/Facturae", "Facture");
/* String xlmn="xmlns:gva=\"http://www.facturae.es/Facturae/2009/v3.2/Facturae\"\n"+"xmlns:xs="+"\"http://www.w3.org/2001/XMLSchema\"\n";
xlmn = xlmn + "xmlns:fac=\"http://www.facturae.es/Facturae/2009/v3.2/Facturae\"\nxmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"";
System.out.println(" "+xlmn);*/
//Element mainRootElement = document.createElementNS("http://www.facturae.es/Facturae/2009/v3.2/Facturae", "fac:Facturae");
Element mainRootElement = document.createElementNS("", "fac:Facturae");
mainRootElement.setAttribute("xmlns:fac", "http://www.facturae.es/Facturae/2009/v3.2/Facturae");
mainRootElement.setAttribute("xmlns:gva", "http://www.edicomgroup.com/schemas/gva/");
mainRootElement.setAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema");
mainRootElement.setAttribute("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#");
document.appendChild(mainRootElement);
// append child elements to root element
......@@ -403,7 +413,7 @@ public class GenInvoiceSchedule implements Schedule {
{
pce.printStackTrace();
System.out.println("ParserConfigurationException :"+pce.getMessage());
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR", "");
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR1", "");
return errString;
}
......@@ -411,7 +421,7 @@ public class GenInvoiceSchedule implements Schedule {
{
tfe.printStackTrace();
System.out.println("TransformerException :"+tfe.getMessage());
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR", "");
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR2", "");
return errString;
}
......@@ -419,7 +429,7 @@ public class GenInvoiceSchedule implements Schedule {
{
e.printStackTrace();
System.out.println("Exception :"+e.getMessage());
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR", "");
errString = itmDBAccessLocal.getErrorString("", "VTTRINERR3", "");
return errString;
}
......@@ -528,7 +538,7 @@ public class GenInvoiceSchedule implements Schedule {
Element totalInvoicesAmount = doc.createElement("TotalInvoicesAmount");
// totalInvoicesAmount.appendChild(getElementValue(doc, fileHeader, "TotalAmount",String.valueOf(twoDf.format(invAmt))));
totalInvoicesAmount.appendChild(getElementValue(doc, fileHeader, "TotalAmount",utilMethods.getReqDecString(invAmt, 2)));
totalInvoicesAmount.appendChild(getElementValue(doc, fileHeader, "TotalAmount",utilMethods.getReqDecString(netAmt, 2)));
batch.appendChild(totalInvoicesAmount);
Element totalOutstandingAmount = doc.createElement("TotalOutstandingAmount");
......@@ -760,7 +770,7 @@ public class GenInvoiceSchedule implements Schedule {
Element taxIdfbuyerParty = doc.createElement("TaxIdentification");
taxIdfbuyerParty.appendChild(getElementValue(doc, parties, "PersonTypeCode", "J"));
taxIdfbuyerParty.appendChild(getElementValue(doc, parties, "ResidenceTypeCode", "R"));
taxIdfbuyerParty.appendChild(getElementValue(doc, parties, "TaxIdentificationNumber", custTaxreg));
taxIdfbuyerParty.appendChild(getElementValue(doc, parties, "TaxIdentificationNumber", custTaxreg.replaceAll("-","")));
buyerParty.appendChild(taxIdfbuyerParty);
Element administrativeCentresparent = doc.createElement("AdministrativeCentres");
......@@ -834,10 +844,14 @@ public class GenInvoiceSchedule implements Schedule {
legalEntity.appendChild(getElementValue(doc, parties, "CorporateName", siteDescr));
//legalEntity.appendChild(getElementValue(doc, parties, "TradeName", ""));
Element addlegalEntity = doc.createElement("AddressInSpain");
addlegalEntity.appendChild(getElementValue(doc, parties, "Address",siteAdd1));
/*addlegalEntity.appendChild(getElementValue(doc, parties, "Address",siteAdd1));
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, "Province", siteStatedescr));*/
addlegalEntity.appendChild(getElementValue(doc, parties, "Address",custAdd1));
addlegalEntity.appendChild(getElementValue(doc, parties, "PostCode", custPin));
addlegalEntity.appendChild(getElementValue(doc, parties, "Town", custCity));
addlegalEntity.appendChild(getElementValue(doc, parties, "Province", custStatedescr));
addlegalEntity.appendChild(getElementValue(doc, parties, "CountryCode","ESP"));
legalEntity.appendChild(addlegalEntity);
buyerParty.appendChild(legalEntity);
......@@ -862,11 +876,11 @@ public class GenInvoiceSchedule implements Schedule {
String itemCodeDet="",itemDescrDet="",quantityDet="",unitDet="",accDet="",instAmtDet="";
String rate="",unitRate="",discountInv="",taxEffects="",siteCode="",paymentMeans="",accToBeCredited="",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;
double taxAmtDet=0.00,netAmtDet=0.00,discAmtDet=0.00,taxAmt=0.00,taxPersc=0.00,discountDet=0.00,totalCost=0.0;
GenericUtility genericUtility = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int cnt=0;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null;
int cnt=0,taxCnt=0;
int totalAmt=0,amtWitoutTax=0;
HashMap<String, String> tempMap = new HashMap<String, String>();
SimpleDateFormat sdf = null;
......@@ -943,6 +957,7 @@ public class GenInvoiceSchedule implements Schedule {
while (rs.next())
{
cnt++;
System.out.println("cnt "+cnt);
itemCodeDet = rs.getString("ITEM_CODE");
itemDescrDet = rs.getString("ITEM_DESCR");
quantityDet = rs.getString("QUANTITY");
......@@ -955,6 +970,9 @@ public class GenInvoiceSchedule implements Schedule {
instAmtDet = rs.getString("INST_AMOUNT");
accDet = rs.getString("ACC_CODE__ITEM");
totalCost=rateDet * Integer.parseInt(quantityDet);
System.out.println("totalCost :"+totalCost);
itemCodeDet = itemCodeDet == null ? " " : itemCodeDet.trim();
itemDescrDet = itemDescrDet == null ? " " : itemDescrDet.trim();
......@@ -978,10 +996,11 @@ public class GenInvoiceSchedule implements Schedule {
tempMap.put("rate" + cnt, utilMethods.getReqDecString(rateDet, 6));
tempMap.put("discount" + cnt, utilMethods.getReqDecString(discountDet, 4));
tempMap.put("tax_amt" + cnt, utilMethods.getReqDecString(taxAmtDet,2));
tempMap.put("net_amt" + cnt, utilMethods.getReqDecString(netAmtDet,2));
tempMap.put("disc_amt" + cnt, utilMethods.getReqDecString(discAmtDet,2));
tempMap.put("net_amt" + cnt, utilMethods.getReqDecString(netAmtDet,6));
tempMap.put("disc_amt" + cnt, utilMethods.getReqDecString(discAmtDet,6));
tempMap.put("installment_amt" + cnt, instAmtDet);
tempMap.put("acc_code" + cnt, accDet);
tempMap.put("total_cost" + cnt, utilMethods.getReqDecString(totalCost,6));
}
......@@ -992,7 +1011,7 @@ public class GenInvoiceSchedule implements Schedule {
sql = " select TAX_CODE,TAX_CLASS,TAXABLE_AMT ,TAX_CHAP,TAX_ENV,TAX_AMT,EXCH_RATE ,TAX_PERC,EFFECT " +
/*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);
......@@ -1014,7 +1033,46 @@ public class GenInvoiceSchedule implements Schedule {
rs.close();
rs = null;
pstmt.close();
pstmt = null;
pstmt = null;*/
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' " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
taxCnt++;
System.out.println("taxCnt :"+taxCnt);
taxCode = rs1.getString("TAX_CODE");
taxClass = rs1.getString("TAX_CLASS");
taxBaseAmt = rs1.getDouble("TAXABLE_AMT");
taxChap = rs1.getString("TAX_CHAP");
taxEnv = rs1.getString("TAX_ENV");
taxAmt = rs1.getDouble("TAX_AMT");
exchRate = rs1.getString("EXCH_RATE");
taxPersc = rs1.getDouble("TAX_PERC");
taxEffects = rs1.getString("EFFECT");
System.out.println("taxBaseAmt :"+taxBaseAmt);
System.out.println("taxAmt :"+taxAmt);
System.out.println("taxPersc :"+taxPersc);
tempMap.put("taxBase_amt" + taxCnt, utilMethods.getReqDecString(taxBaseAmt,2));
tempMap.put("tax_amt" + taxCnt, utilMethods.getReqDecString(taxAmt,2));
tempMap.put("tax_persc" + taxCnt, utilMethods.getReqDecString(taxPersc,2));
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
currCodeHd = currCodeHd == null ? " " : currCodeHd.trim();
invoiceISOCode = invoiceISOCode == null ? " " : invoiceISOCode.trim();
......@@ -1065,8 +1123,8 @@ public class GenInvoiceSchedule implements Schedule {
invoiceIssueData.appendChild(getElementValue(doc, invoiceParent, "LanguageName", "es"));
invoice.appendChild(invoiceIssueData);
System.out.println("***************TaxesOutputs***********************");
Element taxesOutputs = doc.createElement("TaxesOutputs");
System.out.println("***************TaxesOutputs***(((((****************");
/* Element taxesOutputs = doc.createElement("TaxesOutputs");
Element tax = doc.createElement("Tax");
tax.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
System.out.println("test 000");
......@@ -1074,14 +1132,43 @@ public class GenInvoiceSchedule implements Schedule {
Element taxableTotAmtHD = doc.createElement("TaxableBase");
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
tax.appendChild(taxableTotAmtHD);
//tax.appendChild(getElementValue(doc, invoiceParent, "TaxableBase",utilMethods.getReqDecString(taxBaseAmt,2)));
tax.appendChild(getElementValue(doc, invoiceParent, "TaxAmount",utilMethods.getReqDecString(taxAmt,2)));
Element taxAmounttHd = doc.createElement("TaxAmount");
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxAmt,2)));
tax.appendChild(taxAmounttHd);
//tax.appendChild(getElementValue(doc, invoiceParent, "EquivalenceSurcharge", ""));
Element equivalenceSurcharge = doc.createElement("EquivalenceSurcharge");
equivalenceSurcharge.appendChild(getElementValue(doc, invoiceParent, "EquivalenceSurchargeAmount", "0.00"));
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");
System.out.println("taxCnt#########@@@@@"+taxCnt);
for(int j = 1; j <= taxCnt ;j++)
{
System.out.println("fo header !!!!!"+taxCnt);
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)));
tax.appendChild(getElementValue(doc, invoiceParent, "TaxRate",(String) tempMap.get("tax_persc" + j)));
Element taxableTotAmtHD = doc.createElement("TaxableBase");
//taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("taxBase_amt" + j)));
tax.appendChild(taxableTotAmtHD);
Element taxAmounttHd = doc.createElement("TaxAmount");
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("tax_amt" + j)));
tax.appendChild(taxAmounttHd);
Element equivalenceSurcharge = doc.createElement("EquivalenceSurchargeAmount");
equivalenceSurcharge.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", "0.00"));
tax.appendChild(equivalenceSurcharge);
taxesOutputs.appendChild(tax);
}
invoice.appendChild(taxesOutputs);
Element taxesWithheld = doc.createElement("TaxesWithheld");
Element taxHeld = doc.createElement("Tax");
......@@ -1090,8 +1177,11 @@ public class GenInvoiceSchedule implements Schedule {
Element TaxableBaseHD = doc.createElement("TaxableBase");
TaxableBaseHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount","0.00"));
taxHeld.appendChild(TaxableBaseHD);
//taxHeld.appendChild(getElementValue(doc, invoiceParent, "TaxableBase", "0.00" ));
taxHeld.appendChild(getElementValue(doc, invoiceParent, "TaxAmount","0.00"));
Element TaxAmountWithheld = doc.createElement("TaxAmount");
TaxAmountWithheld.appendChild(getElementValue(doc, invoiceParent, "TotalAmount","0.00"));
taxHeld.appendChild(TaxAmountWithheld);
taxesWithheld.appendChild(taxHeld);
invoice.appendChild(taxesWithheld);
......@@ -1101,7 +1191,7 @@ public class GenInvoiceSchedule implements Schedule {
Element discount = doc.createElement("Discount");
//discount.appendChild(getElementValue(doc, invoiceParent, "DiscountReason", "Sales Promotions"));
discount.appendChild(getElementValue(doc, invoiceParent, "DiscountReason", "Descuentos Varios"));
discount.appendChild(getElementValue(doc, invoiceParent, "DiscountAmount", utilMethods.getReqDecString(discAmtHd,2)));
discount.appendChild(getElementValue(doc, invoiceParent, "DiscountAmount", utilMethods.getReqDecString(discAmtHd,6)));
generalDiscounts.appendChild(discount);
invoiceTotals.appendChild(generalDiscounts);
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalGeneralDiscounts", utilMethods.getReqDecString(discAmtHd,2)));
......@@ -1109,6 +1199,7 @@ public class GenInvoiceSchedule implements Schedule {
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalGrossAmountBeforeTaxes", utilMethods.getReqDecString(NetAmtHd,2)));
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalTaxOutputs",utilMethods.getReqDecString(taxAmtHd,2)));
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalTaxesWithheld","0.00" ));
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "InvoiceTotal",utilMethods.getReqDecString(NetAmtHd,2)));
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalOutstandingAmount",utilMethods.getReqDecString(NetAmtHd,2)));
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalExecutableAmount",utilMethods.getReqDecString(NetAmtHd,2)));
......@@ -1117,6 +1208,7 @@ public class GenInvoiceSchedule implements Schedule {
Element items = doc.createElement("Items");
System.out.println("cnt@@@@@"+cnt);
for(int i = 1; i<= cnt ; i++)
{
......@@ -1131,6 +1223,8 @@ public class GenInvoiceSchedule implements Schedule {
System.out.println("TaxRate :"+i+": "+utilMethods.getReqDecString(taxPersc,2));
System.out.println("TaxableBase :"+i+": "+utilMethods.getReqDecString(taxBaseAmt,2));
System.out.println("TaxAmount :"+i+": "+(String) tempMap.get("tax_amt" + i));
System.out.println("total cost :"+i+": "+(String) tempMap.get("total_cost" + i));
Element invoiceLine = doc.createElement("InvoiceLine");
......@@ -1139,7 +1233,7 @@ public class GenInvoiceSchedule implements Schedule {
//invoiceLine.appendChild(getElementValue(doc, invoiceParent, "UnitOfMeasure", (String) tempMap.get("unit" + i)));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "UnitOfMeasure", "01"));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "UnitPriceWithoutTax",(String) tempMap.get("rate" + i)));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "TotalCost",(String) tempMap.get("net_amt" + i)));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "TotalCost",(String) tempMap.get("total_cost" + i)));
Element discountsAndRebates = doc.createElement("DiscountsAndRebates");
Element discountItem = doc.createElement("Discount");
......@@ -1176,13 +1270,16 @@ public class GenInvoiceSchedule implements Schedule {
Element taxableTotAmt = doc.createElement("TaxableBase");
taxableTotAmt.appendChild(getElementValue(doc, invoiceParent, "TotalAmount","0.00"));
taxHeldItem.appendChild(taxableTotAmt);
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxAmount", "0.00"));
taxesWithheldItem.appendChild(taxHeldItem);
invoiceLine.appendChild(taxesWithheldItem);
Element taxAmount1 = doc.createElement("TaxAmount");
taxAmount1.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", "0.00"));
taxHeldItem.appendChild(taxAmount1);
taxesWithheldItem.appendChild(taxHeldItem);
invoiceLine.appendChild(taxesWithheldItem);
/*
Element taxesOutputsItem = doc.createElement("TaxesOutputs");
Element taxItem = doc.createElement("Tax");
taxItem.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
......@@ -1190,10 +1287,38 @@ public class GenInvoiceSchedule implements Schedule {
Element taxableTotAmtOutputs = doc.createElement("TaxableBase");
taxableTotAmtOutputs.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
taxItem.appendChild(taxableTotAmtOutputs);
taxItem.appendChild(getElementValue(doc, invoiceParent, "TaxAmount", (String) tempMap.get("tax_amt" + i)));
Element taxAmount2 = doc.createElement("TaxAmount");
taxAmount2.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", (String) tempMap.get("tax_amt" + i)));
taxItem.appendChild(taxAmount2);
taxesOutputsItem.appendChild(taxItem);
invoiceLine.appendChild(taxesOutputsItem);
invoiceLine.appendChild(taxesOutputsItem);*/
System.out.println("taxCnt!!!!!@@@@@"+taxCnt);
Element taxesOutputs1 = doc.createElement("TaxesOutputs");
for(int j = 1; j <= taxCnt ;j++)
{
System.out.println("inside for loop!!!!!");
System.out.println("inside for loop taxCnt!!!!!"+taxCnt);
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)));
tax.appendChild(getElementValue(doc, invoiceParent, "TaxRate",(String) tempMap.get("tax_persc" + j)));
Element taxableTotAmtHD = doc.createElement("TaxableBase");
//taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(taxBaseAmt,2)));
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("taxBase_amt" + j)));
tax.appendChild(taxableTotAmtHD);
Element taxAmounttHd = doc.createElement("TaxAmount");
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("tax_amt" + j)));
tax.appendChild(taxAmounttHd);
Element equivalenceSurcharge = doc.createElement("EquivalenceSurchargeAmount");
equivalenceSurcharge.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", "0.00"));
tax.appendChild(equivalenceSurcharge);
taxesOutputs1.appendChild(tax);
}
invoiceLine.appendChild(taxesOutputs1);
......@@ -1206,7 +1331,7 @@ public class GenInvoiceSchedule implements Schedule {
}//end of for loop
invoice.appendChild(items);
System.out.println("===PaymentDetails====");
System.out.println("===PaymentDetails@@@@@@====");
Element paymentDetails = doc.createElement("PaymentDetails");
Element installment = doc.createElement("Installment");
installment.appendChild(getElementValue(doc, invoiceParent, "InstallmentDueDate", sdf.format(invoiceDtHd)));
......
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