Commit 86b3df65 authored by mjadhav's avatar mjadhav

changes done for taxamount receive accourding to line


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97204 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 67f21e28
......@@ -583,6 +583,7 @@ public class GenInvoiceSchedule implements Schedule {
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="";
String stateDescrReg3="",stateDescrReg2="",stateDescrReg1="";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
......@@ -923,18 +924,25 @@ public class GenInvoiceSchedule implements Schedule {
siteStatedescr=getStateDescr(conn,siteStateCode);
System.out.println("siteStatedescr "+siteStatedescr);
custStatedescr=getStateDescr(conn,stateCodeReg3);
System.out.println("custStatedescr "+custStatedescr);
custBillStatedescr=getStateDescr(conn,stateCodeReg2);
stateDescrReg3=getStateDescr(conn,stateCodeReg3);
System.out.println("stateDescrReg3 "+stateDescrReg3);
stateDescrReg2=getStateDescr(conn,stateCodeReg2);
System.out.println("stateDescrReg2 "+stateDescrReg2);
stateDescrReg1=getStateDescr(conn,stateCodeReg1);
System.out.println("stateDescrReg1 "+stateDescrReg1);
custBillStatedescr=getStateDescr(conn,custBillStateCode);
System.out.println("custBillStatedescr "+custBillStatedescr);
custDlvStatedescr=getStateDescr(conn,stateCodeReg1);
System.out.println("custDlvStateCode "+custDlvStateCode);
custBillStatedescr = custBillStatedescr == null ? " " : custBillStatedescr.trim();
custDlvStatedescr = custDlvStatedescr == null ? " " : custDlvStatedescr.trim();
stateDescrReg3 = stateDescrReg3 == null ? " " : stateDescrReg3.trim();
stateDescrReg2 = stateDescrReg2 == null ? " " : stateDescrReg2.trim();
stateDescrReg1 = stateDescrReg1 == null ? " " : stateDescrReg1.trim();
}
catch(Exception e)
......@@ -1042,7 +1050,7 @@ public class GenInvoiceSchedule implements Schedule {
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, "Province", stateDescrReg1));
//addCustDlv.appendChild(getElementValue(doc, parties, "CountryCode", dlvCountryCode));
addCustDlv.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
admCustDlv.appendChild(addCustDlv);
......@@ -1064,7 +1072,7 @@ public class GenInvoiceSchedule implements Schedule {
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, "Province", stateDescrReg2));
//addCustBill.appendChild(getElementValue(doc, parties, "CountryCode", custCountrtCode));
addCustBill.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
admCustBill.appendChild(addCustBill);
......@@ -1084,7 +1092,7 @@ public class GenInvoiceSchedule implements Schedule {
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, "Province", stateDescrReg3));
// addressbuyer.appendChild(getElementValue(doc, parties, "CountryCode", custCountrtCode));
addressbuyer.appendChild(getElementValue(doc, parties, "CountryCode", "ESP"));
administrativeCentres.appendChild(addressbuyer);
......@@ -1131,8 +1139,11 @@ public class GenInvoiceSchedule implements Schedule {
String itemCodeDet="",itemDescrDet="",quantityDet="",unitDet="",accDet="",instAmtDet="";
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 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;
double taxBaseAmtHD =0.0,taxAmtHD =0.0,taxPerscHD=0.0,totTaxBaseAmtHD=0.0,totTaxAmtHD=0.0;
double taxBaseAmtDet=0.0,taxPerscDet=0.0,taxAmtDet=0.0,totTaxBaseAmtDet=0.0,totTaxAmtDet=0.0;
int lineNo=0;
GenericUtility genericUtility = null;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null;
......@@ -1154,7 +1165,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,SALE_ORDER,DESP_ID,DUE_DATE from invoice " +
sql = " select INV_AMT,TAX_AMT,DISC_AMT,NET_AMT,CURR_CODE,TRAN_DATE ,SITE_CODE ,SALE_ORDER,DESP_ID,DUE_DATE from invoice " +
"where invoice_id=?" ;
pstmt = conn.prepareStatement(sql);
......@@ -1169,7 +1180,7 @@ public class GenInvoiceSchedule implements Schedule {
NetAmtHd = rs.getDouble("NET_AMT");
currCodeHd = rs.getString("CURR_CODE");
siteCode= rs.getString("SITE_CODE");
docStatus= rs.getString("DOC_STATUS");
//docStatus= rs.getString("DOC_STATUS");
saleOrder= rs.getString("SALE_ORDER");
despId= rs.getString("DESP_ID");
dueDateHd = rs.getDate("DUE_DATE");
......@@ -1213,7 +1224,7 @@ 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 ,(select cust_pord from sorder where sale_order=?) as cust_prod from invdet " +
"DISC_AMT,INST_AMOUNT,ACC_CODE__ITEM,QUANTITY__STDUOM,RATE__STDUOM ,LINE_NO,(select cust_pord from sorder where sale_order=?) as cust_prod from invdet " +
" where invoice_id=?" ;
pstmt = conn.prepareStatement(sql);
......@@ -1223,6 +1234,9 @@ public class GenInvoiceSchedule implements Schedule {
while (rs.next())
{
cnt++;
totTaxBaseAmtDet=0.0;
totTaxAmtDet=0.0;
System.out.println("cnt "+cnt);
itemCodeDet = rs.getString("ITEM_CODE");
itemDescrDet = rs.getString("ITEM_DESCR");
......@@ -1232,12 +1246,13 @@ public class GenInvoiceSchedule implements Schedule {
//rateDet = rs.getDouble("RATE");
rateDet = rs.getDouble("RATE__STDUOM");
discountDet = rs.getDouble("DISCOUNT");
taxAmtDet = rs.getDouble("TAX_AMT");
//taxAmtDet = rs.getDouble("TAX_AMT");
netAmtDet = rs.getDouble("NET_AMT");
discAmtDet = rs.getDouble("DISC_AMT");
instAmtDet = rs.getString("INST_AMOUNT");
accDet = rs.getString("ACC_CODE__ITEM");
purchaseOrd=rs.getString("cust_prod");
lineNo=rs.getInt("LINE_NO");
totalCost=rateDet * Integer.parseInt(quantityDet);
System.out.println("totalCost :"+totalCost);
......@@ -1284,7 +1299,7 @@ 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("tax_amt" + cnt, utilMethods.getReqDecString(taxAmtDet,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);
......@@ -1293,8 +1308,63 @@ public class GenInvoiceSchedule implements Schedule {
tempMap.put("gross_amt" + cnt, utilMethods.getReqDecString(grossAmount,6));
//tempMap.put("tot_gross_amt" + cnt, utilMethods.getReqDecString(totalGrossAmount,2));
/*-----------------changes done on 03-02-2014-----------------------------------------------*/
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' and LINE_NO = ? " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, invoiceId);
pstmt1.setInt(2, lineNo);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
taxCnt++;
//System.out.println("taxCnt :"+taxCnt);
//taxCode = rs1.getString("TAX_CODE");
//taxClass = rs1.getString("TAX_CLASS");
taxBaseAmtDet = rs1.getDouble("TAXABLE_AMT");
//taxChap = rs1.getString("TAX_CHAP");
//taxEnv = rs1.getString("TAX_ENV");
taxAmtDet = rs1.getDouble("TAX_AMT");
//exchRate = rs1.getString("EXCH_RATE");
taxPerscDet = rs1.getDouble("TAX_PERC");
//taxEffects = rs1.getString("EFFECT");
System.out.println("taxBaseAmtDet :"+taxBaseAmtDet);
System.out.println("taxAmtDet :"+taxAmtDet);
System.out.println("taxPerscDet :"+taxPerscDet);
totTaxBaseAmtDet = totTaxBaseAmtDet + taxBaseAmtDet;
totTaxAmtDet = totTaxAmtDet + taxAmtDet;
/*tempMap.put("taxBase_amt_det" + cnt, utilMethods.getReqDecString(taxBaseAmt,2));
tempMap.put("tax_amt_det" + cnt, utilMethods.getReqDecString(taxAmt,2));
tempMap.put("tax_persc_det" + cnt, utilMethods.getReqDecString(taxPersc,2));*/
tempMap.put("tax_persc_det" + cnt, utilMethods.getReqDecString(taxPerscDet,2));
tempMap.put("totTaxBaseAmtDet" + cnt, utilMethods.getReqDecString(totTaxBaseAmtDet,2));
tempMap.put("totTaxAmtDet" + cnt, utilMethods.getReqDecString(totTaxAmtDet,2));
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
/*------------------------------------------------------------------------------------------------------*/
}
}//end of while loop
rs.close();
rs = null;
pstmt.close();
......@@ -1312,31 +1382,31 @@ public class GenInvoiceSchedule implements Schedule {
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
taxCnt++;
//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");
//taxCode = rs1.getString("TAX_CODE");
//taxClass = rs1.getString("TAX_CLASS");
taxBaseAmtHD = rs1.getDouble("TAXABLE_AMT");
//taxChap = rs1.getString("TAX_CHAP");
//taxEnv = rs1.getString("TAX_ENV");
taxAmtHD = rs1.getDouble("TAX_AMT");
//exchRate = rs1.getString("EXCH_RATE");
taxPerscHD = rs1.getDouble("TAX_PERC");
//taxEffects = rs1.getString("EFFECT");
System.out.println("taxBaseAmt :"+taxBaseAmt);
System.out.println("taxAmt :"+taxAmt);
System.out.println("taxPersc :"+taxPersc);
totTaxBaseAmt = totTaxBaseAmt + taxBaseAmt;
totTaxAmt = totTaxAmt + taxAmt;
System.out.println("taxBaseAmtHD :"+taxBaseAmtHD);
System.out.println("taxAmtHD :"+taxAmtHD);
System.out.println("taxPerscHD :"+taxPerscHD);
totTaxBaseAmtHD = totTaxBaseAmtHD + taxBaseAmtHD;
totTaxAmtHD = totTaxAmtHD + taxAmtHD;
/*
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();
......@@ -1372,7 +1442,7 @@ public class GenInvoiceSchedule implements Schedule {
System.out.println("***************InvoiceHeader***********************");
Element invoiceParent = doc.createElement("Invoices");
Element invoice = doc.createElement("Invoice");
Element invoice = doc.createElement("Invocntice");
Element invoiceHeader = doc.createElement("InvoiceHeader");
invoiceHeader.appendChild(getElementValue(doc, invoiceParent, "InvoiceNumber", invoiceId));
......@@ -1403,12 +1473,12 @@ public class GenInvoiceSchedule implements Schedule {
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", utilMethods.getReqDecString(taxPerscHD,2)));
Element taxableTotAmtHD = doc.createElement("TaxableBase");
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxBaseAmt,2)));
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxBaseAmtHD,2)));
tax.appendChild(taxableTotAmtHD);
Element taxAmounttHd = doc.createElement("TaxAmount");
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxAmt,2)));
taxAmounttHd.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxAmtHD,2)));
tax.appendChild(taxAmounttHd);
//tax.appendChild(getElementValue(doc, invoiceParent, "EquivalenceSurcharge", ""));
......@@ -1469,7 +1539,7 @@ public class GenInvoiceSchedule implements Schedule {
Element invoiceTotals = doc.createElement("InvoiceTotals");
invoiceTotals.appendChild(getElementValue(doc, invoiceParent, "TotalGrossAmount",utilMethods.getReqDecString(totalGrossAmount,2)));
Element generalDiscounts = doc.createElement("GeneralDiscounts");
Element discount = doc.createElement("Discount");
Element discount = doc.createElement("DtotTaxBaseAmtDetiscount");
//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,6)));
......@@ -1510,7 +1580,7 @@ public class GenInvoiceSchedule implements Schedule {
Element invoiceLine = doc.createElement("InvoiceLine");
/*---------------------------------------------------------------------------------------------------------------------*/
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "ReceiverTransactionReference", saleOrder+"/"+purchaseOrd));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "ReceiverTransactionReference",purchaseOrd));
Element deliveryNotesReferences = doc.createElement("DeliveryNotesReferences");
Element deliveryNote = doc.createElement("DeliveryNote");
deliveryNote.appendChild(getElementValue(doc, invoiceParent, "DeliveryNoteNumber", despId));
......@@ -1557,7 +1627,7 @@ public class GenInvoiceSchedule implements Schedule {
/* Element taxesWithheldItem = doc.createElement("TaxesWithheld");
Element taxHeldItem = doc.createElement("Tax");
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxTypeCode", "01"));saleOrder+"/"+
taxHeldItem.appendChild(getElementValue(doc, invoiceParent, "TaxRate", "0.00"));
Element taxableTotAmt = doc.createElement("TaxableBase");
taxableTotAmt.appendChild(getElementValue(doc, invoiceParent, "TotalAmount","0.00"));
......@@ -1566,7 +1636,7 @@ public class GenInvoiceSchedule implements Schedule {
Element taxAmount1 = doc.createElement("TaxAmount");
taxAmount1.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", "0.00"));
taxHeldItem.appendChild(taxAmount1);
saleOrder+"/"+
taxesWithheldItem.appendChild(taxHeldItem);
invoiceLine.appendChild(taxesWithheldItem);*/
......@@ -1575,12 +1645,12 @@ public class GenInvoiceSchedule implements Schedule {
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)));
taxItem.appendChild(getElementValue(doc, invoiceParent, "TaxRate",(String) tempMap.get("tax_persc_det" + i)));
Element taxableTotAmtOutputs = doc.createElement("TaxableBase");
taxableTotAmtOutputs.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",utilMethods.getReqDecString(totTaxBaseAmt,2)));
taxableTotAmtOutputs.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("totTaxBaseAmtDet" + i)));
taxItem.appendChild(taxableTotAmtOutputs);
Element taxAmount2 = doc.createElement("TaxAmount");
taxAmount2.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", utilMethods.getReqDecString(totTaxAmt,2)));
taxAmount2.appendChild(getElementValue(doc, invoiceParent, "TotalAmount", (String) tempMap.get("totTaxAmtDet" + i)));
taxItem.appendChild(taxAmount2);
taxesOutputsItem.appendChild(taxItem);
invoiceLine.appendChild(taxesOutputsItem);
......@@ -1597,7 +1667,7 @@ public class GenInvoiceSchedule implements Schedule {
//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",utilMetsaleOrder+"/"+hods.getReqDecString(taxBaseAmt,2)));
taxableTotAmtHD.appendChild(getElementValue(doc, invoiceParent, "TotalAmount",(String) tempMap.get("taxBase_amt" + j)));
tax.appendChild(taxableTotAmtHD);
......@@ -1616,7 +1686,7 @@ public class GenInvoiceSchedule implements Schedule {
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "AdditionalLineItemInformation", "Nº Pedido:"+saleOrder+"/"+purchaseOrd+"- Nº Albarán:"+despId));
invoiceLine.appendChild(getElementValue(doc, invoiceParent, "AdditionalLineItemInformation", "Nº Pedido:"+purchaseOrd+"- Nº Albarán:"+despId+"- Nº Expediente:"));
items.appendChild(invoiceLine);
......@@ -1649,7 +1719,7 @@ public class GenInvoiceSchedule implements Schedule {
/*-----------------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));
additionalData.appendChild(getElementValue(doc, invoiceParent, "InvoiceAdditionalInformation", "Nº Pedido:"+purchaseOrd+"- Nº Albarán:"+despId+"- Nº Expediente:"));
invoice.appendChild(additionalData);
/*--------------------------------------------------------------------------------------------*/
......
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