Commit 2c653ec9 authored by psawant's avatar psawant

Sales Forecast Wizard implementation

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198711 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 06be76d3
package ibase.webitm.ejb.fin;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class SalesForecastPosWizEJB extends ValidatorEJB
{
public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
Document dom = null;
String retString="";
E12GenericUtility genericUtility =new E12GenericUtility();
try
{
int count = 1;
int ctr;
String childNodeName = "";
String columnValue ="";
dom = genericUtility.parseString(domString);
NodeList parentNodeList = dom.getElementsByTagName("Detail2");
int parentNodeListLength = parentNodeList.getLength();
HashMap<Integer, HashMap<String, String> > updateSalesForecastMap = new HashMap<>();
for(int parent = 0; parent < parentNodeListLength; parent++)
{
HashMap<String, String> detailInfoMap = new HashMap<>();
Node parentNode = parentNodeList.item(parent);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
String quantity="",itemCode="",prdCode="",tranIdDet="";
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
Node childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
columnValue = "";
if( childNode.getFirstChild() != null)
{
columnValue = childNode.getFirstChild().getNodeValue().trim();
}
if(childNodeName == "quantity")
{
quantity = columnValue;
}
else if(childNodeName == "tran_id")
{
tranIdDet = columnValue;
}
else if(childNodeName == "item_code")
{
itemCode = columnValue;
}
else if(childNodeName == "prd_code__for")
{
prdCode = columnValue;
}
}
detailInfoMap.put("Quantity", quantity);
detailInfoMap.put("ItemCode", itemCode);
detailInfoMap.put("TranId", tranIdDet);
detailInfoMap.put("PrdCode", prdCode);
updateSalesForecastMap.put(count, detailInfoMap);
count++;
}
updateSalesForecastDet(updateSalesForecastMap,conn);
}
catch( Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return retString;
}
private void updateSalesForecastDet(HashMap<Integer, HashMap<String, String> > updateSalesForecastMap, Connection conn) throws ITMException, RemoteException
{
PreparedStatement pstmt = null;
try
{
String sql = "UPDATE SALESFORECAST_DET SET QUANTITY= ? WHERE TRAN_ID = ? AND ITEM_CODE = ? and PRD_CODE__FOR = ?";
pstmt = conn.prepareStatement(sql);
for (Map.Entry <Integer, HashMap <String, String>> detailMap: updateSalesForecastMap.entrySet())
{
int key = detailMap.getKey();
HashMap<String, String> detailInfoMap = detailMap.getValue();
pstmt.setString(1, detailInfoMap.get("Quantity"));
pstmt.setString(2, detailInfoMap.get("TranId"));
pstmt.setString(3, detailInfoMap.get("ItemCode"));
pstmt.setString(4, detailInfoMap.get("PrdCode"));
pstmt.addBatch();
}
pstmt.executeBatch();
}
catch(Exception exp)
{
BaseLogger.log("3",null,null,"Exception : updateSalesForecastDet :==>\n");
throw new ITMException(exp);
}
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
BaseLogger.log("3",null,null,"Exception :SalesForecastWizEJB :defaultDataWiz :==>\n"+e.getMessage());
throw new ITMException(e);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
$PBExportHeader$d_salesforecast_det_brow.srd
$PBExportComments$Browse datawindow for salesforecast detail
release 9;
datawindow(units=1 timer_interval=0 color=79741120 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 24 print.margin.right = 24 print.margin.top = 24 print.margin.bottom = 24 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
header(height=24 color="536870912" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=21 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=tran_id dbname="salesforecast_det.tran_id" )
column=(type=char(10) updatewhereclause=yes name=item_code dbname="salesforecast_det.item_code" )
column=(type=char(6) updatewhereclause=yes name=prd_code__plan dbname="salesforecast_det.prd_code__plan" )
column=(type=char(6) updatewhereclause=yes name=prd_code__for dbname="salesforecast_det.prd_code__for" )
column=(type=char(3) updatewhereclause=yes name=unit dbname="salesforecast_det.unit" )
column=(type=decimal(3) updatewhereclause=yes name=quantity dbname="salesforecast_det.quantity" )
column=(type=char(60) updatewhereclause=yes name=remarks dbname="salesforecast_det.remarks" )
column=(type=char(130) updatewhereclause=yes name=item_descr dbname="item.descr" )
column=(type=number updatewhereclause=yes name=quantity_2 dbname="quantity_2" )
column=(type=number updatewhereclause=yes name=quantity_3 dbname="quantity_3" )
column=(type=number updatewhereclause=yes name=quantity_4 dbname="quantity_4" )
column=(type=char(6) updatewhereclause=yes name=prd_2 dbname="prd_2" )
column=(type=char(6) updatewhereclause=yes name=prd_3 dbname="prd_3" )
column=(type=char(6) updatewhereclause=yes name=prd_4 dbname="prd_4" )
column=(type=decimal(3) updatewhereclause=yes name=quantity_org dbname="salesforecast_det.quantity_org" )
retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"salesforecast_det~" ) TABLE(NAME=~"item~" ) COLUMN(NAME=~"salesforecast_det.tran_id~") COLUMN(NAME=~"salesforecast_det.item_code~") COLUMN(NAME=~"salesforecast_det.prd_code__plan~") COLUMN(NAME=~"salesforecast_det.prd_code__for~") COLUMN(NAME=~"salesforecast_det.unit~") COLUMN(NAME=~"salesforecast_det.quantity~") COLUMN(NAME=~"salesforecast_det.remarks~") COLUMN(NAME=~"item.descr~") COMPUTE(NAME=~"0.000 as quantity_2~") COMPUTE(NAME=~"0.000 as quantity_3~") COMPUTE(NAME=~"0.000 as quantity_4~") COMPUTE(NAME=~"' ' as prd_2~") COMPUTE(NAME=~"' ' as prd_3~") COMPUTE(NAME=~"' ' as prd_4~") COLUMN(NAME=~"salesforecast_det.quantity_org~") JOIN (LEFT=~"salesforecast_det.item_code~" OP =~"=~"RIGHT=~"item.item_code~" )WHERE( EXP1 =~"salesforecast_det.tran_id~" OP =~"=~" EXP2 =~":mtran_id~" ) ) ARG(NAME = ~"mtran_id~" TYPE = string) " arguments=(("mtran_id", string)) )
text(band=header alignment="0" text="Item Code" border="6" color="0" x="3" y="4" height="16" width="79" html.valueishtml="0" name=item_code_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Prd Code" border="6" color="0" x="372" y="4" height="16" width="49" html.valueishtml="0" name=prd_code_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Description" border="6" color="0" x="86" y="4" height="16" width="283" html.valueishtml="0" name=item_descr_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="1" text="Quantity" border="6" color="0" x="424" y="4" height="16" width="75" html.valueishtml="0" name=quantity_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Unit" border="6" color="0" x="502" y="4" height="16" width="28" html.valueishtml="0" name=unit_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="0" tabsequence=32766 border="5" color="0" x="3" y="2" height="17" width="79" format="[general]" html.valueishtml="0" name=item_code visible="1" edit.limit=10 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=3 alignment="0" tabsequence=32766 border="5" color="0" x="372" y="2" height="17" width="49" format="[general]" html.valueishtml="0" name=prd_code__plan visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=8 alignment="0" tabsequence=32766 border="5" color="0" x="86" y="2" height="17" width="283" format="[general]" html.valueishtml="0" name=item_descr visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=6 alignment="1" tabsequence=32766 border="5" color="0" x="424" y="2" height="17" width="75" format="[general]" html.valueishtml="0" name=quantity visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=5 alignment="0" tabsequence=32766 border="5" color="0" x="502" y="2" height="17" width="28" format="[general]" html.valueishtml="0" name=unit visible="1" edit.limit=3 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
\ No newline at end of file
$PBExportHeader$d_salesforecast_hdr_brow.srd
$PBExportComments$Browse datawindow for salesforecast
release 9;
datawindow(units=1 timer_interval=0 color=79741120 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 24 print.margin.right = 24 print.margin.top = 24 print.margin.bottom = 24 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
header(height=21 color="536870912" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=20 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=tran_id dbname="salesforecast_hdr.tran_id" )
column=(type=datetime updatewhereclause=yes name=tran_date dbname="salesforecast_hdr.tran_date" )
column=(type=char(5) updatewhereclause=yes name=site_code dbname="salesforecast_hdr.site_code" )
column=(type=char(1) updatewhereclause=yes name=confirmed dbname="salesforecast_hdr.confirmed" )
column=(type=char(6) updatewhereclause=yes name=prd_code__from dbname="salesforecast_hdr.prd_code__from" )
column=(type=char(6) updatewhereclause=yes name=prd_code__to dbname="salesforecast_hdr.prd_code__to" )
column=(type=char(5) updatewhereclause=yes name=item_ser dbname="salesforecast_hdr.item_ser" )
column=(type=char(10) updatewhereclause=yes name=emp_code__aprv dbname="salesforecast_hdr.emp_code__aprv" )
retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"salesforecast_hdr~" ) COLUMN(NAME=~"salesforecast_hdr.tran_id~") COLUMN(NAME=~"salesforecast_hdr.tran_date~") COLUMN(NAME=~"salesforecast_hdr.site_code~") COLUMN(NAME=~"salesforecast_hdr.confirmed~") COLUMN(NAME=~"salesforecast_hdr.prd_code__from~") COLUMN(NAME=~"salesforecast_hdr.prd_code__to~") COLUMN(NAME=~"salesforecast_hdr.item_ser~") COLUMN(NAME=~"salesforecast_hdr.emp_code__aprv~")WHERE( EXP1 =~"salesforecast_hdr.tran_date~" OP =~">=~" EXP2 =~":mdate_from~" LOGIC =~"and~" ) WHERE( EXP1 =~"salesforecast_hdr.tran_date~" OP =~"<=~" EXP2 =~":mdate_to~" ) ) ARG(NAME = ~"mdate_from~" TYPE = datetime) ARG(NAME = ~"mdate_to~" TYPE = datetime) " arguments=(("mdate_from", datetime),("mdate_to", datetime)) )
text(band=header alignment="0" text="Tran Date" border="6" color="0" x="107" y="3" height="16" width="54" html.valueishtml="0" name=tran_date_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Site Code" border="6" color="0" x="165" y="3" height="16" width="51" html.valueishtml="0" name=site_code_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Prd Code From" border="6" color="0" x="220" y="3" height="16" width="82" html.valueishtml="0" name=prd_code__from_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Prd Code To" border="6" color="0" x="306" y="3" height="16" width="70" html.valueishtml="0" name=prd_code__to_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Item Ser" border="6" color="0" x="380" y="3" height="16" width="43" html.valueishtml="0" name=item_ser_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Confirmed" border="6" color="0" x="427" y="3" height="16" width="26" html.valueishtml="0" name=confirmed_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Approved by" border="6" color="0" x="457" y="3" height="16" width="88" html.valueishtml="0" name=emp_code__aprv_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="0" text="Tran Id" border="6" color="0" x="4" y="3" height="16" width="99" html.valueishtml="0" name=tran_id_t visible="1" font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="0" tabsequence=20 border="5" color="0" x="107" y="1" height="16" width="54" format="[shortdate] [time]" html.valueishtml="0" name=tran_date visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=3 alignment="0" tabsequence=30 border="5" color="0" x="165" y="1" height="16" width="51" format="[general]" html.valueishtml="0" name=site_code visible="1" edit.limit=5 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=5 alignment="0" tabsequence=50 border="5" color="0" x="220" y="1" height="16" width="82" format="[general]" html.valueishtml="0" name=prd_code__from visible="1" edit.limit=6 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=6 alignment="0" tabsequence=60 border="5" color="0" x="306" y="1" height="16" width="70" format="[general]" html.valueishtml="0" name=prd_code__to visible="1" edit.limit=6 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=7 alignment="0" tabsequence=70 border="5" color="0" x="380" y="1" height="16" width="43" format="[general]" html.valueishtml="0" name=item_ser visible="1" edit.limit=5 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=4 alignment="0" tabsequence=40 border="5" color="0" x="427" y="1" height="16" width="26" format="[general]" html.valueishtml="0" name=confirmed visible="1" edit.limit=1 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=8 alignment="0" tabsequence=80 border="5" color="0" x="457" y="1" height="16" width="88" format="[general]" html.valueishtml="0" name=emp_code__aprv visible="1" edit.limit=10 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
column(band=detail id=1 alignment="0" tabsequence=10 border="5" color="0" x="4" y="1" height="16" width="99" format="[general]" html.valueishtml="0" name=tran_id visible="1" edit.limit=10 edit.case=any edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="Times New Roman" font.height="-10" font.weight="400" font.family="1" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
\ No newline at end of file
var oldQuantity = 0 ;
function setActionVal ( value )
{
document.getElementById("action").value = value;
var prdCodeFrom = document.getElementById( "Detail1.1.prd_code__from").value;
var prdCodeTo = document.getElementById( "Detail1.1.prd_code__to").value;
if(prdCodeFrom == null || prdCodeFrom.length == 0)
{
alert("Period code from cannot be blank ");
}
else if(prdCodeTo == null || prdCodeTo.length == 0)
{
alert("Period code to cannot be blank ");
}
if (prdCodeFrom.length > 0 && prdCodeTo.length > 0 )
{
return true;
}
else
{
return false;
}
}
function checkActionVal( value )
{
document.getElementById("action").value = value;
return true;
}
function setOldQuantity ( element )
{
oldQuantity = element.value ;
console.log(" Quantity "+oldQuantity);
}
function quantitySet ( element )
{
var quantityVal = element.value ;
console.log(" quantityVal 111 "+quantityVal);
console.log(" Quantity 111 "+oldQuantity);
if( quantityVal == "" || quantityVal < 0 || quantityVal.length > 14)
{
alert("Quantity cannot be Empty or less than zero or length should be less than 14");
element.value = oldQuantity ;
console.log(" quantityVal 123 "+quantityVal);
element.focus();
}
return quantityVal;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function')
{
window.onload = func;
}
else
{
window.onload = function()
{
if (oldonload)
{
oldonload();
}
func();
}
}
}
addLoadEvent(setDivHeight);
function setDivHeight()
{
if(document.getElementById("dataDiv") != null)
{
document.getElementById("dataDiv").style.height = (window.innerHeight - 120 ) + "px";
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
function doHideMsg(str)
{
document.getElementById(str).style.display = 'none';
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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