Showing paste #0xk16 by alinakazi@apache.org: (Show raw paste)
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.apache.org/royale/spark"
xmlns:mx="library://ns.apache.org/royale/mx"
xmlns:js="library://ns.apache.org/royale/basic"
xmlns:j="library://ns.apache.org/royale/jewel"
creationComplete="fn_InitModule();"
xmlns:cc="com.dbz.controls.*"
width="100%" height="100%"
layout="absolute"
xmlns:components="com.dbz.modules.components.*">
<fx:Script>
<![CDATA[
import mx.rpc.AsyncToken;
import mx.rpc.Responder;
import com.dbz.VO.INV.dbzProductionChallanDetailVO;
import com.dbz.VO.INV.dbzProductionChallanMasterVO;
import com.dbz.components.PickList;
import com.dbz.modules.INV.dbzBalanceTransferDetail;
import com.dbz.modules.components.dbzAttachmentPopup;
import com.dbz.modules.components.dbzExchangeRatesPopup;
import com.dbz.modules.components.dbzVoucherPreviewPopup;
import com.dbz.reports.view.PUR.dbzPrintPurchaseRequisition;
import com.dbz.utils.dbzDataStructure;
import com.dbz.utils.dbzUtil;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.Text;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.core.Container;
import mx.core.FlexGlobals;
import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.events.ItemClickEvent;
import mx.events.ModuleEvent;
import mx.events.ValidationResultEvent;
import mx.formatters.SwitchSymbolFormatter;
import mx.managers.CursorManager;
import mx.managers.PopUpManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.styles.StyleManager;
import org.apache.royale.reflection.describeType;
import org.apache.royale.reflection.TypeDefinition;
import mx.utils.ObjectUtil;
import spark.components.CheckBox;
import spark.components.ComboBox;
import spark.components.TextArea;
import spark.components.TextInput;
import spark.events.IndexChangeEvent;
private static const ST_DOC_ID:String = "155";
private static const SUB_TYPE:String = "1";
private static const PRODUCTION:String = "1";
private static const CONSUMPTION:String = "2";
private var bSaveRecord:Boolean = false;
private var DocumentName:String = "Balance Transfer";
private var bFetchBOM:Boolean = false;
private var bFetchCQ:Boolean = false;
private var bFetchProdoction:Boolean = false;
private var gs_DBType:String = "";
public var arrFormItems:Array = new Array();
public var bDetailNewRecord:Boolean = false;
private var lbIsTransferTo : Boolean = true;
[Bindable] public var arrDocListDP:ArrayCollection = new ArrayCollection();
private var intSelRecID:uint = 0;
private var intSelIndex:uint = 0;
private var strIsAnalysis1:String = "0";
private var strIsAnalysis2:String = "0";
private var strIsAnalysis3:String = "0";
private var strIsAnalysis4:String = "0";
private var strIsAnalysis5:String = "0";
private var strVchType:String = "";
private var bDeleteRecord:Boolean = false;
[Bindable] public var miMasterVO:Object = new dbzProductionChallanMasterVO();
[Bindable] public var miDetailVOPro:Object = new dbzProductionChallanDetailVO() ;
[Bindable] private var miDetailVOCon:Object = new dbzProductionChallanDetailVO() ;
[Bindable] private var arrProductDPTranFrom:ArrayCollection = new ArrayCollection();
[Bindable] public var arrProductDPTranTo:ArrayCollection = new ArrayCollection();
[Bindable] private var strServerMessage:String = "";
[Bindable] private var astrProdUnit:Array= new Array();
[Bindable] private var frmProdEntry:dbzBalanceTransferDetail;
[Bindable] private var frmExchangeRates:dbzExchangeRatesPopup;
[Bindable] private var frmVoucher:dbzVoucherPreviewPopup;
[Bindable] private var bCrude:Boolean = false;
[Bindable] private var arrEffectProvider:ArrayCollection =
new ArrayCollection([{label:"+",id:"+"},{label:"-", id:"-"}]);
/*
** Data provider result handlers
*/
private function fn_roPersistRH(e:ResultEvent):void {
// parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.disableUserInteraction();
strServerMessage = e.result.toString() as String;
var strNumber:String = "";
var bNew:Boolean = false;
var selIndex:uint = 0;
if (strServerMessage == "" || strServerMessage.indexOf("NUMBER:") > -1) {
if (bDeleteRecord == false) {
if (DocList.bNewRecord && strServerMessage.indexOf("NUMBER:") > -1) {
strNumber = strServerMessage.split(":")[1];
pcm_No.inputMask ="";
pcm_No.text = strNumber;
bNew = true;
}
fn_SetValuesInDocList(bNew, strNumber);
fn_EnableHandle();
DocList.fn_SaveAttachment();
pcm_No.editable = false;
}
else {
selIndex = DocList.dgDocList.selectedIndex;
DocList.arrPageData.removeItemAt(selIndex);
selIndex = selIndex - 1 >= 0? selIndex - 1 :0;
DocList.arrPageData.refresh();
DocList.dgDocList.validateNow();
DocList.dgDocList.selectedIndex = selIndex;
DocList.fn_GetFrmDataProvider();
}
}
else {
DocList.dgDocList.selectedIndex = DocList.bNewRecord ? -1 :DocList.dgDocList.selectedIndex;
Alert.show(strServerMessage);
}
// parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.restoreUserInteraction();
bDeleteRecord = false;
}
private function fn_roValidateRH(e:ResultEvent):void {
strServerMessage = e.result.toString() as String;
if (strServerMessage == "") {
fn_SaveRecord();
}
else {
Alert.show(strServerMessage);
}
}
//Function to handle the form button security policy
private function fn_roChainsResultHandler(e:ResultEvent):void {
var strAuthChains:String = e.result.toString() as String;
dbzUtil.handleFormButtons(arrFormItems, strAuthChains);
btnBOM.enabled=true;
}
private function fn_getDataCalledFromList(e:Event):void{
fn_GetDataProvider();
}
private function fn_FormatValue(item:TextInput):void {
item.text = fmtAmount.format(item.text == "" ? "0" : item.text);
}
public function fn_GetDataProvider():void {
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
if ( DocList.dgDocList.selectedItem == null ||
DocList.dgDocList.selectedItem == -1) {
fn_ResetPage();
return;
}
var responder2:Responder = new Responder(fn_roMasterRH,fn_HandleFault);
var token2:AsyncToken = roMaster.fn_GetMasterDP(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
DocList.dgDocList.selectedItem.docNo,
pcm_DocType.text);
token2.addResponder(responder2);
trace(token2);
//fn_getEfficiency();
//DocList.DocumentType.selectedItem.id.toString()
}
private function fn_roMasterRH(e:ResultEvent):void {
miMasterVO = e.result;
fn_PopulateFormWithDGItem();
}
private function fn_roDetailRHCon(e:ResultEvent):void {
if(bFetchProdoction == false){
arrProductDPTranFrom = e.result as ArrayCollection;
dgProducts_Con.dataProvider = arrProductDPTranFrom;
arrProductDPTranFrom.refresh();
dgProducts_Con.validateNow();
dgProducts_Con.selectedIndex = dbzUtil.getSelRowIndex(dgProducts_Con, "pcd_No", miDetailVOCon.pcd_No);
}
else
{
arrProductDPTranTo = e.result as ArrayCollection;
dgProducts_Prod.dataProvider = arrProductDPTranTo;
arrProductDPTranTo.refresh();
dgProducts_Prod.validateNow();
dgProducts_Prod.selectedIndex = dbzUtil.getSelRowIndex(dgProducts_Prod, "pcd_No", miDetailVOPro.pcd_No);
bFetchProdoction = false;
bFetchCQ = true;
}
fn_HandleConsBtns();
fn_HandleProdBtns();
}
private function fn_roDetailRHPro(e:ResultEvent):void {
arrProductDPTranTo = e.result as ArrayCollection;
dgProducts_Prod.dataProvider = arrProductDPTranTo;
if (parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_IS_CRUDE == "1")
fn_Reconciliation();
arrProductDPTranTo.refresh();
dgProducts_Prod.validateNow();
dgProducts_Prod.selectedIndex = dbzUtil.getSelRowIndex(dgProducts_Prod, "pcd_No", miDetailVOPro.pcd_No);
DocList.fn_PrdHandleBtns(dgProducts_Prod,false,DocList.bNewRecord,miMasterVO.pcm_Posted,
miMasterVO.pcm_VerifLevel, false);
}
/*
** Forms handlers block
*/
// Triggers when module loading finishes
private function fn_InitModule():void {
//Configure DocList
DocList.addEventListener("getRecord", fn_getDataCalledFromList);
DocList.HostFrm = this;
DocList.DocCol1.visible = true;
DocList.DocCol1.headerText = "Narration";
DocList.DocCol1.width = 150;
DocList.HostDateObject = pcm_Date;
DocList.HostDocNoObject = pcm_No;
DocList.btnVerify.uid = "10067";
DocList.btnUnverify.uid = "10068";
DocList.btnPost.uid = "10069";
DocList.btnPrint.uid = "10073";
gs_DBType = parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.DBMS.toUpperCase();
DocList.HostCurrecyObject = pcm_CurrCode;
DocList.HostExchRate1Obj = pcm_ExchRtRepcurr1;
DocList.HostExchRate2Obj = pcm_ExchRtRepcurr2;
DocList.HostExchRate3Obj = pcm_ExchRtRepcurr3;
DocList.HostExchRate4Obj = pcm_ExchRtRepcurr4;
DocList.HostExchRate5Obj = pcm_ExchRtRepcurr5;
DocList.ddCurr = pcm_CurrCode;
//DocList.ddVchrType= pcm_VchrType;
//DocList.ddVchrTypeLabel= voucherLabel;
DocList.btnNew = btnNew;
DocList.btnSave = btnSave;
DocList.btnUndo = btnUndo;
DocList.btnDelete = btnDelete;
DocList.btnAdd = btnAdd;
DocList.btnEdit = btnEdit;
DocList.btnRemove = btnRemove;
DocList.btnExchange = btnExchange;
DocList.btnVoucher = btnVoucher;
DocList.fn_InitComponent(ST_DOC_ID);
DocList.btnAttachment = btnAttachment;
// Configure ends
frmProdEntry = new dbzBalanceTransferDetail();
// if (parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_IS_CRUDE != "1"){
// VS.removeChildAt(1);
// tabBar.width = 100;
// }
frmProdEntry.addEventListener("SaveDetail", fn_UpdateProductsDG);
frmExchangeRates = new dbzExchangeRatesPopup();
frmVoucher = new dbzVoucherPreviewPopup();
arrFormItems = dbzUtil.f_GetFormItems(FormContainer, false, null, null, arrFormItems)
arrFormItems = dbzUtil.f_GetFormItems(MaterialIssueContainer, false, null, null, arrFormItems)
arrFormItems.push(pcm_DocType);
arrFormItems.push(DocList.btnVerify);
arrFormItems.push(DocList.btnUnverify);
arrFormItems.push(DocList.btnPost);
arrFormItems.push(DocList.btnPrint);
focusManager.setFocus(pcm_No);
// pcm_No.width=pcm_VchrType.width;
frmProdEntry.frmMain = this;
PopUpManager.addPopUp(frmProdEntry,this,true);
if ( parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_IS_CRUDE == "1" )
bCrude = true;
frmProdEntry.allocatedQtyTxt.visible = bCrude;
frmProdEntry.pcd_allocated_qty.visible = bCrude;
frmProdEntry.fn_initComponent(true);
} //fn_InitModule()
public function fn_GetSecurityChains(docType:String):void {
var responder9:Responder = new Responder(fn_roChainsResultHandler,fn_HandleFault);
var token9:AsyncToken = roChains.getAuthSecChains(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USER_ID,
dbzUtil.getFormBtnChains(arrFormItems),
ST_DOC_ID, docType);
token9.addResponder(responder9);
trace(token9);
}
//Set the form values with datagrid selected row
private function fn_PopulateFormWithDGItem():void {
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
btnUndo.enabled = true;
fn_SetValuesInDocList(false, "");
pcm_No.inputMask = "";
DocList.dgDocList.selectedItem == null ? fn_ResetPage() :
dbzUtil.setForm(arrFormItems, miMasterVO as Object,
org.apache.royale.reflection.describeType(dbzProductionChallanMasterVO) as TypeDefinition);
var responder6:Responder = new Responder(fn_roDetailRHCon,fn_HandleFault);
var token6:AsyncToken = roDetailCons.fn_GetDetailDP(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
pcm_No.text,
CONSUMPTION);
token6.addResponder(responder6);
trace(token6);
var responder5:Responder = new Responder(fn_roDetailRHPro,fn_HandleFault);
var token5:AsyncToken = roDetailProd.fn_GetDetailDP(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
pcm_No.text,
PRODUCTION);
token5.addResponder(responder5);
trace(token5);
fn_EnableHandle();
}
private function fn_EnableHandle():void
{
if (miMasterVO.pcm_Posted != "1")
DocList.fn_HandleVerification();
btnSave.enabled = btnSave.accessibilityEnabled== true ? true : false;
DocList.bNewRecord = DocList.dgDocList.selectedItem == null ? true : false;
bDetailNewRecord = dgProducts_Prod.selectedItem == null ? true : false;
btnDelete.enabled = btnDelete.accessibilityEnabled == true ? true : false;
pcm_No.editable = false;
btnRemove.enabled = dgProducts_Prod.selectedItem == null ? false :true;
btnEdit.enabled = dgProducts_Prod.selectedItem == null ? false :true;
pcm_CurrCode.enabled = DocList.bNewRecord == true ? true : false;
DocList.btnVerify.enabled = dgProducts_Prod.selectedItem == null ? false :true;
DocList.btnUnverify.enabled = dgProducts_Prod.selectedItem == null ? false :true;
DocList.fn_EnableHandle(arrFormItems,
dgProducts_Prod , miMasterVO.pcm_Posted, miMasterVO.pcm_VerifLevel,
DocList.bNewRecord,bDetailNewRecord,
true, false, "0");
DocList.fn_PrdHandleBtns(dgProducts_Prod,false,DocList.bNewRecord,miMasterVO.pcm_Posted,
miMasterVO.pcm_VerifLevel, false);
fn_HandleConsBtns();
fn_HandleProdBtns();
// pcm_VchrType.enabled = DocList.bNewRecord == true ? true : false;
}
private function fn_SetValuesInDocList(bNew:Boolean, strNumber:String):void{
var DocListItem:Object;
var selIndex:uint = 0;
if (bNew == true) {
DocListItem = new Object();
DocListItem.docNo = strNumber;
DocListItem.docSite = DocList.strTransSite;
DocListItem.docSiteDesc = parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.SI_DESC ;
miMasterVO.pcm_Posted = "0";
miMasterVO.pcm_Verified = "0";
miMasterVO.pcm_VerDesc = "";
}
else {
DocListItem = DocList.dgDocList.selectedItem;
DocListItem.docNo = miMasterVO.pcm_No;
}
DocListItem.docVerifPlan =miMasterVO.pcm_VerifPlan;
DocListItem.docVerifiedBy = miMasterVO.pcm_VerDesc;
DocListItem.docVerified = miMasterVO.pcm_Verified;
DocListItem.docPosted = miMasterVO.pcm_Posted;
DocListItem.docDate = miMasterVO.pcm_Date;
DocListItem.docCol1 = miMasterVO.pcm_Narration ;
if (bNew) {
DocList.arrPageData.addItem(DocListItem);
selIndex = DocList.arrPageData.length;
}
else {
selIndex = DocList.dgDocList.selectedIndex;
DocList.arrPageData.setItemAt(DocListItem, DocList.dgDocList.selectedIndex);
}
DocList.arrPageData.refresh();
DocList.dgDocList.validateNow();
DocList.dgDocList.selectedIndex = selIndex;
if (bNew || bSaveRecord) {
DocList.fn_GetFrmDataProvider();
}
bSaveRecord = false;
}
// Triggers if user want to add new record
private function fn_OpenPopup(mainApp:Object,
strTitle:String,
strDBQuery:String,
selControlCode:Object,
selControlDesc:Object,
strFormat:String,
bFormatApply:Boolean):void {
var plPopupWindow:PickList = PickList(PopUpManager.createPopUp(this, PickList, true));
//instantiate and show the title window
PopUpManager.centerPopUp(plPopupWindow);
//Set the Title of PopUp Window
plPopupWindow.applyformat =bFormatApply;
plPopupWindow.formatType = strFormat;
plPopupWindow.title = strTitle;
plPopupWindow.strDBQuery = strDBQuery;
//Set the PopUp Window Variables
plPopupWindow.parentApp = mainApp;
plPopupWindow.getDataProvider();
plPopupWindow.selControlCode = selControlCode;
plPopupWindow.selControlDesc = selControlDesc;
}
private function fn_Round(numberVal:Number, precision:int):Number {
var decimalPlaces:Number = Math.pow(10, precision);
return Math.round(decimalPlaces * numberVal) / decimalPlaces;
}
private function fn_HandleFault(e:FaultEvent):void {
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.restoreUserInteraction();
Alert.show("Status: Error"
+ "\nFault code: " + e.fault.faultCode
+ "\nFault detail: " + e.fault.faultDetail
+ "\nFault string: " + e.fault.faultString);
}
/*
** Product popup data entry
*/
private function fn_AddProduct(abOpenPopup:Boolean, abTransferTo:Boolean):void {
lbIsTransferTo = abTransferTo;
bDetailNewRecord = true;
frmProdEntry.bEditMode = false;
frmProdEntry.strDocTypeRef = ST_DOC_ID + "~" + DocList.DocumentType.selectedItem.id;
var ls_CostCenter:String = "";
var ls_CostCenterDesc:String = "";
var ls_Department:String = "";
var ls_DepartmentDesc:String = "";
frmProdEntry.frmMain = this;
if (abTransferTo == false){
intSelIndex = arrProductDPTranFrom.length;
if (intSelIndex ==1){
Alert.show("You can not add more than one product in Tranfer From.");
return;
}
}
else
intSelIndex = arrProductDPTranFrom.length;
if (abTransferTo == true) {
frmProdEntry.title = DocList.HostFrmName +" - Transfer To";
frmProdEntry.bIsTransferTo = true;
}
else {
frmProdEntry.title = DocList.HostFrmName +" - Transfer From";
frmProdEntry.bIsTransferTo = false;
}
if (abOpenPopup) {
PopUpManager.addPopUp(frmProdEntry, this, true);
PopUpManager.centerPopUp(frmProdEntry);
}
if (abTransferTo == false && arrProductDPTranTo.length > 0 ) {
ls_CostCenter = arrProductDPTranTo[0].pcd_CostCntrCode;
ls_CostCenterDesc = arrProductDPTranTo[0].pcd_CostCntrDesc;
ls_Department = arrProductDPTranTo[0].pcd_DeptCode;
ls_DepartmentDesc = arrProductDPTranTo[0].pcd_DeptDesc;
}
frmProdEntry.fn_ResetPage();
if (DocList.bNewRecord == false)
{
frmProdEntry.pcd_SiteCode.text = DocList.strTransSite;
frmProdEntry.pcd_Year.text = parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR;
frmProdEntry.pcd_Period.text = parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER;
frmProdEntry.pcd_No.text = pcm_No.text;
}
}
public function fn_EditProduct(abOpenPopup:Boolean):void {
fn_EditProduct_Common(abOpenPopup, frmProdEntry.bIsTransferTo);
}
public function fn_Reconciliation():void {
if (tabBar.selectedIndex == 1){
var nPrdQty:Number = 0;
var nQty:Number = 0;
var nQty1:Number = 0;
var nTotalQty:Number = 0;
var nTotalQty1:Number = 0;
/* gasValue.text = "0";
gasValue1.text = "0";
lpgShr.text = "0";
lpgShr1.text = "0";
gasolineShr.text = "0";
gasolineShr1.text = "0";
solventShr.text = "0";
solventShr1.text = "0";
residualGas.text = "0"; */
if ( arrProductDPTranTo.length > 0){
for (var i:int=0 ; i<arrProductDPTranTo.length ; i++) {
nQty = 0;
nQty1 = 0;
nPrdQty = Number(arrProductDPTranTo[i].pcd_Qty.split(",").join(""));
if (arrProductDPTranTo[i].pcd_IsCrude == "5" )
{
nQty = DocList.fn_RoundToPrecision(nPrdQty * 0.017,5);
/* lpgShr.text = nQty.toString()
nQty1 = DocList.fn_RoundToPrecision(nPrdQty * 47.566,5);
lpgShr1.text = nQty1.toString(); */
}
else if (arrProductDPTranTo[i].pcd_IsCrude == "8" )
{
/* nQty = DocList.fn_RoundToPrecision(nPrdQty * 0.0012,5);
gasolineShr.text = nQty.toString();
nQty1 = DocList.fn_RoundToPrecision(nPrdQty * 4.66,5);
gasolineShr1.text = nQty1.toString(); */
}
else if (arrProductDPTranTo[i].pcd_IsCrude == "7" )
{
/* nQty = DocList.fn_RoundToPrecision(nPrdQty * 0.0012,5);
solventShr.text = nQty.toString();
nQty1 = DocList.fn_RoundToPrecision(nPrdQty * 4.97,5);
solventShr1.text = nQty1.toString(); */
}
else if (arrProductDPTranTo[i].pcd_IsCrude == "3" )
{
/* nQty = DocList.fn_RoundToPrecision(nPrdQty,5);
residualGas.text = nQty.toString(); */
}
nTotalQty = nTotalQty + nQty;
nTotalQty1 = nTotalQty1 + nQty1;
}
/* gasValue.text = DocList.fn_RoundToPrecision(nTotalQty,5).toString();
gasValue1.text = DocList.fn_RoundToPrecision(nTotalQty1,5).toString(); */
}
}
}
public function fn_Calculate():void {
/* lpgShr.text = ""; */
}
public function fn_EditProduct_Common(abOpenPopup:Boolean, abTransferTo:Boolean):void {
bDetailNewRecord = false;
frmProdEntry.bEditMode = true;
frmProdEntry.bFromMaster = true;
frmProdEntry.frmMain = this;
frmProdEntry.strDocTypeRef = ST_DOC_ID + "~" + DocList.DocumentType.selectedItem.id;
if (abOpenPopup) {
PopUpManager.addPopUp(frmProdEntry, this, true);
PopUpManager.centerPopUp(frmProdEntry);
}
if (abTransferTo == true) {
if (parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_IS_CRUDE != "1")
frmProdEntry.pcd_OldPrdCode.text = dgProducts_Prod.selectedItem.pcd_PrdCode;
intSelIndex=dgProducts_Prod.selectedIndex;
frmProdEntry.bIsTransferTo = true;
frmProdEntry.fn_getValues(dgProducts_Prod);
lbIsTransferTo = true;
frmProdEntry.title = DocList.HostFrmName +" - Transfer To";
}
else {
frmProdEntry.pcd_OldPrdCode.text = dgProducts_Con.selectedItem.pcd_PrdCode;
intSelIndex=dgProducts_Con.selectedIndex;
frmProdEntry.bIsTransferTo = false;
frmProdEntry.fn_getValues(dgProducts_Con);
lbIsTransferTo = false;
frmProdEntry.title = DocList.HostFrmName +" - Transfer From";
}
frmProdEntry.focusManager.setFocus(frmProdEntry.pcd_PrdCode);
frmProdEntry.bIsTransferTo = lbIsTransferTo;
}
private function fn_DeleteProduct(bProduction:Boolean):void {
////////////////
if(bProduction == true)
{
if (arrProductDPTranTo.length <= 0)
return;
var iDeletedIndex:int = dgProducts_Prod.selectedIndex;
arrProductDPTranTo.removeItemAt(iDeletedIndex);
arrProductDPTranTo.refresh();
dgProducts_Prod.validateNow();
if (arrProductDPTranTo.length > 0 && arrProductDPTranTo.length > iDeletedIndex) // Deleted row was somewhere in the middle
dgProducts_Prod.selectedIndex = iDeletedIndex;
else if (arrProductDPTranTo.length > 0 && arrProductDPTranTo.length == iDeletedIndex) // Deleted row was second last row
dgProducts_Prod.selectedIndex = iDeletedIndex - 1;
else
dgProducts_Prod.selectedIndex = -1;
}
else
{
if (arrProductDPTranFrom.length <= 0)
return;
var iDeletedIndex1:int = dgProducts_Con.selectedIndex;
arrProductDPTranFrom.removeItemAt(iDeletedIndex1);
arrProductDPTranFrom.refresh();
dgProducts_Con.validateNow();
if (arrProductDPTranFrom.length > 0 && arrProductDPTranFrom.length > iDeletedIndex1) // Deleted row was somewhere in the middle
dgProducts_Con.selectedIndex = iDeletedIndex1;
else if (arrProductDPTranFrom.length > 0 && arrProductDPTranFrom.length == iDeletedIndex1) // Deleted row was second last row
dgProducts_Con.selectedIndex = iDeletedIndex1 - 1;
else
dgProducts_Con.selectedIndex = -1;
}
DocList.fn_PrdHandleBtns(dgProducts_Prod,false,DocList.bNewRecord,miMasterVO.pcm_Posted,
miMasterVO.pcm_VerifLevel, false);
fn_HandleConsBtns();
fn_HandleProdBtns();
/////////////////
}
private function fn_UpdateProductsDG(e:Event):void {
var detailVO:Object = new dbzProductionChallanDetailVO();
detailVO = frmProdEntry.fn_setValues();
if (bDetailNewRecord)
if (frmProdEntry.bIsTransferTo == false)
arrProductDPTranFrom.addItem(detailVO);
else
arrProductDPTranTo.addItem(detailVO);
else if (frmProdEntry.bIsTransferTo == true)
arrProductDPTranTo.setItemAt(detailVO, dgProducts_Prod.selectedIndex);
else
arrProductDPTranFrom.setItemAt(detailVO, dgProducts_Con.selectedIndex);
arrProductDPTranFrom.refresh();
arrProductDPTranTo.refresh();
dgProducts_Prod.validateNow();
dgProducts_Con.validateNow();
if (frmProdEntry.bAddMore == false)
PopUpManager.removePopUp(frmProdEntry);
else {
if (frmProdEntry.bIsTransferTo == false)
fn_AddProduct(false, false);
else
fn_AddProduct(false, true);
}
if (frmProdEntry.bIsTransferTo == true) {
dgProducts_Prod.selectedIndex = intSelIndex;
btnRemove.enabled = dgProducts_Prod.selectedItem == null ? false : true;
btnEdit.enabled = dgProducts_Prod.selectedItem == null ? false : true;
}
else {
dgProducts_Con.selectedIndex = intSelIndex;
btnRemove_Con.enabled = dgProducts_Con.selectedItem == null ? false : true;
btnEdit_Con.enabled = dgProducts_Con.selectedItem == null ? false : true;
}
bDetailNewRecord = false;
frmProdEntry.bEditMode = false;
DocList.fn_PrdHandleBtns(dgProducts_Prod,false,DocList.bNewRecord,miMasterVO.pcm_Posted,
miMasterVO.pcm_VerifLevel, false);
fn_HandleConsBtns();
fn_HandleProdBtns();
} //fn_UpdateProductsDG()
private function f_HandlePickListShortCut(e:mx.events.KeyboardEvent):void {
if (e.keyCode == 13 || e.keyCode == 113) {
//Supplier
/*
if (e.currentTarget == pcm_StorCode)
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.f_HandlePickLists(dbzDataStructure.PL_STORE,dbzDataStructure.PL_RIGHTS_ENTRY,
dbzDataStructure.PL_MODE_SIMPLE,pcm_StorCode,pcm_StorDesc);
*/
}
}
/*
** Validation block
*/
private function fn_Validate():void {
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
if (DocList.bNewRecord == false && (DocList.strTransSite != dgProducts_Prod.selectedItem.pcd_SiteCode ||
DocList.DocYear != dgProducts_Prod.selectedItem.pcd_Year ||
DocList.DocPeriod != dgProducts_Prod.selectedItem.pcd_Period ||
pcm_No.fullText != dgProducts_Prod.selectedItem.pcd_No ))
{
fn_PopulateFormWithDGItem();
Alert.show("System is busy in retrieving detail record.Please save record again.")
return;
}
if (vldCode.validate().type == ValidationResultEvent.INVALID && pcm_No.editable) {
Alert.show("You have not specified a No.");
return;
}
else if (vldDate.validate().type == ValidationResultEvent.INVALID ) {
Alert.show("You have not specified an invalid date.");
return;
}
if (arrProductDPTranFrom.length == 0) {
Alert.show("You have not entered a consumption transaction.");
return;
}
if ( parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_IS_CRUDE == "1" && DocList.bNewRecord )
{
var nAllocatedQty:Number = 0;
var nTotal:Number = 0;
var nRatio:Number = 0;
var nNewQty:Number = 0;
for (var i:int = 0; i < arrProductDPTranTo.length; i++)
{
if (Number(arrProductDPTranTo[i].pcd_Qty) == 0)
nAllocatedQty = nAllocatedQty + Number(arrProductDPTranTo[i].pcd_allocated_qty);
else
nTotal = nTotal + Number(arrProductDPTranTo[i].pcd_Qty);
}
nRatio = nAllocatedQty / nTotal;
for (var x:int = 0; x < arrProductDPTranTo.length; x++)
{
if (Number(arrProductDPTranTo[x].pcd_Qty) != 0)
{
nNewQty = (Number(arrProductDPTranTo[x].pcd_Qty) * nRatio) + Number(arrProductDPTranTo[x].pcd_Qty);
arrProductDPTranTo[x].pcd_Qty = (fn_Round(nNewQty,6)).toString();
}
}
arrProductDPTranTo.refresh();
}
//return;
setVerifPlan();
dbzUtil.setValueObject(miMasterVO as Object,
arrFormItems, org.apache.royale.reflection.describeType(dbzProductionChallanMasterVO) as TypeDefinition);
setVerifPlan();
strIsAnalysis1=parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ISANALYSIS1;
strIsAnalysis2=parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ISANALYSIS2;
strIsAnalysis3=parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ISANALYSIS3;
strIsAnalysis4=parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ISANALYSIS4;
strIsAnalysis5=parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ISANALYSIS5;
//For Production
if(strIsAnalysis1=="2"){
for (var l:int=0 ; l<arrProductDPTranTo.length ; l++) {
if (arrProductDPTranTo[l].pcd_GLAna1 == "" || arrProductDPTranTo[l].pcd_GLAna1 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS1 +" in production grid at S.No "+ (l+1));
return;
}
}
}
if (strIsAnalysis2=="2") {
for (var m:int=0 ; m<arrProductDPTranTo.length ; m++) {
if (arrProductDPTranTo[m].pcd_GLAna2 == "" || arrProductDPTranTo[m].pcd_GLAna2 == null){
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS2 +" in production grid at S.No "+ (m+1));
return;
}
}
}
if (strIsAnalysis3=="2") {
for (var n:int=0 ; n<arrProductDPTranTo.length ; n++) {
if (arrProductDPTranTo[n].pcd_GLAna3 == "" || arrProductDPTranTo[n].pcd_GLAna3 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS3 +" in production grid at S.No "+ (n+1));
return;
}
}
}
if (strIsAnalysis4=="2") {
for (var o:int=0 ; o<arrProductDPTranTo.length ; o++) {
if (arrProductDPTranTo[o].pcd_GLAna4 == "" || arrProductDPTranTo[o].pcd_GLAna4 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS4 +" in production grid at S.No "+ (o+1));
return;
}
}
}
if (strIsAnalysis5=="2") {
for (var p:int=0 ; p<arrProductDPTranTo.length ; p++) {
if (arrProductDPTranTo[p].pcd_GLAna5 == "" || arrProductDPTranTo[p].pcd_GLAna5 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS5 +" in production grid at S.No "+ (p+1));
return;
}
}
}
//For Consumption
if (strIsAnalysis1=="2") {
for (var l2:int=0 ; l2<arrProductDPTranFrom.length ; l2++) {
if (arrProductDPTranFrom[l2].pcd_GLAna1 == "" || arrProductDPTranFrom[l2].pcd_GLAna1 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS1 +" in consumption grid at S.No "+ (l2+1));
return;
}
}
}
if (strIsAnalysis2=="2") {
for (var m2:int=0 ; m2<arrProductDPTranFrom.length ; m2++) {
if (arrProductDPTranFrom[m2].pcd_GLAna2 == "" || arrProductDPTranFrom[m2].pcd_GLAna2 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS2 +" in consumption grid at S.No "+ (m2+1));
return;
}
}
}
if (strIsAnalysis3=="2") {
for (var n2:int=0 ; n2<arrProductDPTranFrom.length ; n2++) {
if (arrProductDPTranFrom[n2].pcd_GLAna3 == "" || arrProductDPTranFrom[n2].pcd_GLAna3 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS3 +" in consumption grid at S.No "+ (n2+1));
return;
}
}
}
if (strIsAnalysis4=="2") {
for (var o2:int=0 ; o2<arrProductDPTranFrom.length ; o2++) {
if (arrProductDPTranFrom[o2].pcd_GLAna4 == "" || arrProductDPTranFrom[o2].pcd_GLAna4 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS4 +" in consumption grid at S.No "+ (o2+1));
return;
}
}
}
if (strIsAnalysis5=="2") {
for (var p2:int=0 ; p2<arrProductDPTranFrom.length ; p2++) {
if (arrProductDPTranFrom[p2].pcd_GLAna5 == "" || arrProductDPTranFrom[p2].pcd_GLAna5 == null) {
Alert.show("You have not specified "+parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_ANALYSIS5 +" in consumption grid at S.No "+ (p2+1));
return;
}
}
}
// var strTransToQty:Number = 0;
// var strTransFrmQty:Number = 0;
// if ( arrProductDPTranTo.length > 0){
// for (var i:int=0 ; i<arrProductDPTranTo.length ; i++) {
// strTransToQty += Number(arrProductDPTranTo[i].pcd_Qty.split(",").join(""));
// }
// }
//
// strTransFrmQty = Number(arrProductDPTranFrom[0].pcd_Qty.split(",").join(""))
//
// if (strTransToQty > strTransFrmQty)
// {
// Alert.show("Transfer To quantity should not be greater than transfer from quantity.");
// return;
// }
//Validate entries in production
var responder8:Responder = new Responder(fn_roValidateRH,fn_HandleFault);
var token8:AsyncToken = roValidate.fn_ValidateForm(miMasterVO,
arrProductDPTranTo,
arrProductDPTranFrom,
DocList.bNewRecord,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_APPCODE ,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USER_ID,
pcm_No.text);
token8.addResponder(responder8);
trace(token8);
} //End of fn_Validate()
private function fn_SaveRecord():void {
// parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.disableUserInteraction();
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
DocList.searchText.text = "";
dbzUtil.setValueObject(miMasterVO as Object, arrFormItems, org.apache.royale.reflection.describeType(dbzProductionChallanMasterVO) as TypeDefinition);
var responder7:Responder = new Responder(fn_roPersistRH,fn_HandleFault);
var token7:AsyncToken = roPersist.fn_AddRecord(miMasterVO,
arrProductDPTranTo,
arrProductDPTranFrom,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USER_ID,
"Added New "+DocList.HostFrmName,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
pcm_No.fullText, DocList.bNewRecord);
token7.addResponder(responder7);
trace(token7);
btnSave.enabled = true;
btnDelete.enabled = true;
strServerMessage = "";
bSaveRecord = true;
bFetchCQ = false;
}
private function fn_DeleteRecord(evt:CloseEvent):void {
if (evt.detail == Alert.NO) {
return;
}
else {
// parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.disableUserInteraction();
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
if (DocList.dgDocList.selectedItem != null)
{
bDeleteRecord = true
//Delete production records
roPersist.fn_DeleteRecord( miMasterVO,
arrProductDPTranTo,
pcm_No.text,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USER_ID,
"Delete " + DocumentName,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode,
DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER);
DocList.fn_DeleteAttachments();
}
}
}
private function fn_GetSNo_Prd(currentItem:Object,colNo:int):String {
var iIndex:int = arrProductDPTranTo.getItemIndex(currentItem) + 1;
return String(iIndex);
}
private function fn_GetSNo_Con(currentItem:Object,colNo:int):String {
var iIndex:int = arrProductDPTranFrom.getItemIndex(currentItem) + 1;
return String(iIndex);
}
private function fn_ResetPage():void {
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.validateSession();
dbzUtil.clearForm(arrFormItems, new Array(pcm_DocType, pcm_VerifLevel));
miMasterVO = DocList.dgDocList.selectedItem == null ?
new dbzProductionChallanMasterVO()as Object : miMasterVO;
DocList.dgDocList.selectedIndex = -1;
bDetailNewRecord = true;
pcm_No.enabled = true;
focusManager.setFocus(pcm_No);
arrProductDPTranTo = new ArrayCollection();
arrProductDPTranFrom = new ArrayCollection();
arrProductDPTranFrom.refresh();
arrProductDPTranTo.refresh();
dgProducts_Prod.validateNow();
dgProducts_Con.validateNow();
var DetailVO:dbzProductionChallanDetailVO = new dbzProductionChallanDetailVO();
// if(DocList.DefVchrType != "") {
// pcm_VchrType.selectedIndex = dbzUtil.f_GetIndex(DocList.arrVoucherTypeDP,DocList.DefVchrType);
// }
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.handleInputs(arrFormItems, false,
new Array(btnSave, btnUndo, btnAdd,btnAdd_Con, pcm_DocType, pcm_VerifLevel, btnExchange), true);
DocList.fn_ResetPage();
pcm_No.width=126;
}
protected function btnVoucher_clickHandler(event:MouseEvent):void {
PopUpManager.addPopUp(frmVoucher, this, true);
PopUpManager.centerPopUp(frmVoucher);
frmVoucher.y = 100;
frmVoucher.setValues(ST_DOC_ID, DocList.strTransSite,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_YEAR,
parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.userParams.USR_CRNT_PER,
pcm_No.text)
}
public function f_OpenPrnWin():void {
var responder4:Responder = new Responder(fn_roPrintFormatRH,fn_HandleFault);
var token4:AsyncToken = roPrintFormat.fn_GetPrintFormat(ST_DOC_ID,DocList.DocumentType.selectedItem.id);
token4.addResponder(responder4);
trace(token4);
}
private function fn_roPrintFormatRH(e:ResultEvent):void {
var strPrintFormat:String = e.result.toString() as String;
var obj_PrnWin:dbzPrintPurchaseRequisition = new dbzPrintPurchaseRequisition();
obj_PrnWin.objMasterWindow = this;
PopUpManager.addPopUp(obj_PrnWin, this, true);
PopUpManager.centerPopUp(obj_PrnWin);
obj_PrnWin.docNoRangeCriteria.chkRangeOfDocNo.selected= true;
obj_PrnWin.docNoRangeCriteria.fromDocNo.enabled = true;
obj_PrnWin.docNoRangeCriteria.toDocNo.enabled = true;
obj_PrnWin.docNoRangeCriteria.fromDocNo.text = DocList.dgDocList.selectedItem.docNo;
obj_PrnWin.docNoRangeCriteria.toDocNo.text = DocList.dgDocList.selectedItem.docNo;
obj_PrnWin.DocumentName = DocList.HostFrmName;
obj_PrnWin.CompanyColumn = "PKG_PRODCHALLANMST.PCM_CO_CODE";
obj_PrnWin.YearColumn = "PKG_PRODCHALLANMST.PCM_YEAR";
obj_PrnWin.SiteColumn = "PKG_PRODCHALLANMST.PCM_SITE_CODE";
obj_PrnWin.DateColumn = "PKG_PRODCHALLANMST.PCM_DATE";
obj_PrnWin.CurrCodeColumn = "PKG_PRODCHALLANMST.PCM_CURR_CODE";
obj_PrnWin.DocNoColumn = "PKG_PRODCHALLANMST.PCM_NO";
obj_PrnWin.DocTypeColumn = "PKG_PRODCHALLANMST.PCM_DOCTYPE";
obj_PrnWin.DocTypeCode = DocList.DocumentType.selectedItem.id;
obj_PrnWin.PrintJRXMLName =strPrintFormat =="" ?"PrintProductionChallan":strPrintFormat;
}
protected function fn_CallBOM(bProduction:Boolean):void {
if(bProduction == false)
if (arrProductDPTranTo.length < 1)
return;
var lsBOMNo:String = "";
if(bProduction)
lsBOMNo = pcm_RCM_No.text;
if(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_MLTI_PROD_BOM == "1")
lsBOMNo = pcm_RCM_No.text;
var soDetailVOLst:Object = new dbzProductionChallanDetailVO();
if (arrProductDPTranTo.length >= 1)
soDetailVOLst = arrProductDPTranTo[0];
var responder3:Responder = new Responder(fn_roDetailRHCon,fn_HandleFault);
var token3:AsyncToken = roBOM.fn_GetBOMConsumption(parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.CompCode, pcm_Date.text, soDetailVOLst, bProduction,lsBOMNo);
token3.addResponder(responder3);
trace(token3);
}
private function fn_HandleConsBtns():void {
if (dgProducts_Con.selectedItem != null) {
btnAdd_Con.enabled=true;
btnEdit_Con.enabled=true;
btnRemove_Con.enabled=true;
}
else {
btnEdit_Con.enabled=false;
btnRemove_Con.enabled=false;
}
}
private function fn_HandleProdBtns():void {
if (dgProducts_Prod.selectedItem != null) {
btnAdd.enabled=true;
btnEdit.enabled=true;
btnRemove.enabled=true;
}
else {
btnEdit.enabled=false;
btnRemove.enabled=false;
}
}
private function fn_openPopUp():void {
//Chart of Account Reference
var popUpWinInstance:PickList = PickList(PopUpManager.createPopUp(this,PickList,true));
//instantiate and show the title window
PopUpManager.centerPopUp(popUpWinInstance);
popUpWinInstance.title="Recipe List";
if(gs_DBType == "ORACLE")
popUpWinInstance.strDBQuery = "SELECT RCM_NO , TO_CHAR(RCM_DATE, 'DD/MM/YYYY')||' ' ||RCM_BATCH_NO||' ' ||"+
"RCM_NARR FROM PKG_RECIPEMST WHERE rcm_approved >= '1'";
else
popUpWinInstance.strDBQuery = "SELECT RCM_NO , CONVERT(VARCHAR(MAX), RCM_DATE, 103)||' ' ||RCM_BATCH_NO||' ' ||"+
"RCM_NARR FROM PKG_RECIPEMST WHERE rcm_approved >= '1'";
// popUpWinInstance.strDBQuery = "SELECT RCM_NO , RCM_NARR || TO_CHAR(RCM_DATE, 'DD/MM/YYYY')||' ' ||RCM_BATCH_NO||' '"+
// " FROM PKG_RECIPEMST WHERE rcm_approved >= '1'";
popUpWinInstance.parentApp = this;
popUpWinInstance.getDataProvider();
popUpWinInstance.selControlCode = pcm_RCM_No;
popUpWinInstance.selControlDesc = null;
bFetchBOM = true;
}
private function fn_FetchBOM():void
{
if (bFetchBOM == false)
return;
fn_CallBOM(true);
bFetchProdoction = true;
}
private function fn_roVerificPlanRH(e:ResultEvent):void
{
pcm_VerifPlan.text = e.result.toString() as String;
miMasterVO.pcm_VerifPlan = pcm_VerifPlan.text;
}
private function setVerifPlan():void {
var responder1:Responder = new Responder(fn_roVerificPlanRH,fn_HandleFault);
var token1:AsyncToken = roVerificPlan.fn_getVerifPlan("SELECT DSD_VERPLAN_CODE FROM PKG_DOCSETUP_DTL WHERE " +
"DSD_DOCID='" + ST_DOC_ID + "' AND DSD_TYPE_CODE = " + DocList.DocumentType.selectedItem.id);
token1.addResponder(responder1);
trace(token1);
}
]]>
</fx:Script>
<fx:Style>
@namespace s "library://ns.apache.org/royale/spark";
@namespace mx "library://ns.apache.org/royale/mx";
s|Panel #titleDisplay {
textAlign: left;
}
</fx:Style>
<fx:Declarations>
<mx:Glow id="glowButton" duration="100"
alphaFrom="0" alphaTo="1"
blurXFrom="0.0" blurXTo="30.0"
blurYFrom="0.0" blurYTo="30.0" strength="2"
color="0xcccccc" />
<mx:Glow id="unglowButton" duration="800"
alphaFrom="1" alphaTo="0"
blurXFrom="30.0" blurXTo="0.0"
blurYFrom="30.0" blurYTo="0.0" strength="2"
color="0xcccccc" />
<mx:RemoteObject id="roVerificPlan" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBasic" fault="fn_HandleFault(event);"
result="fn_roVerificPlanRH(event);" />
<mx:RemoteObject id="roMaster" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roMasterRH(event);" />
<mx:RemoteObject id="roBOM" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roDetailRHCon(event);" />
<mx:RemoteObject id="roPrintFormat" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzUtil" fault="fn_HandleFault(event);"
result="fn_roPrintFormatRH(event);" />
<mx:RemoteObject id="roDetailProd" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roDetailRHPro(event);" />
<mx:RemoteObject id="roDetailCons" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roDetailRHCon(event);" />
<mx:RemoteObject id="roPersist" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roPersistRH(event);" />
<mx:RemoteObject id="roValidate" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBalanceTransferBO" fault="fn_HandleFault(event);"
result="fn_roValidateRH(event);" />
<mx:RemoteObject id="roChains" channelSet="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.amfChannelSet}" endpoint="http://localhost:8080/SHMA/messagebroker/websocket-amf"
destination="dbzBasic" fault="fn_HandleFault(event);"
result="fn_roChainsResultHandler(event);" />
<mx:NumberFormatter id="fmtAmount" precision="5"
useThousandsSeparator="true" useNegativeSign="true" rounding="nearest" />
<mx:DateValidator id="vldDate" source="{pcm_Date}" property="text" inputFormat="dd/mm/yyyy" required="true"/>
<mx:StringValidator id="vldCode" source="{pcm_No}" property="text" required="true"/>
</fx:Declarations>
<mx:beads>
<js:ClassAliasBead />
</mx:beads>
<s:Panel title="{DocList.HostFrmName}" height="100%" width="100%" horizontalCenter="0" top="0" >
<s:BorderContainer borderVisible="false" width="100%" height="100%" horizontalCenter="0" verticalCenter="0">
<mx:HDividedBox height="100%" width="100%" >
<s:BorderContainer width="40%" height="100%" borderVisible="true" left="0" top="0" minWidth="390">
<components:dbzDocList right="1" left="0" top="0" bottom="0" id="DocList">
</components:dbzDocList>
</s:BorderContainer>
<s:BorderContainer id="FormContainer" y="0" height="100%" borderVisible="true" width="100%" minWidth="600">
<s:TabBar x="0" y="-24" textAlign="left" dataProvider="{VS}" width="175" id="tabBar" />
<mx:ViewStack x="0" y="0" id="VS" width="100%" height="100%" creationPolicy="all" >
<s:NavigatorContent label="{DocList.HostFrmName}" width="100%" height="100%" >
<s:BorderContainer id="MaterialIssueContainer" x="0" width="100%" height="100%" borderVisible="true" y="0">
<mx:Button id="btnNew" label="New" click="fn_ResetPage();" accessibilityEnabled="false" uid="10291"
mouseChildren="false" buttonMode="true" toolTip="Enter New Record" tabIndex="15" y="3"
width="65" fontWeight="normal" cornerRadius="1" height="20" textAlign="center" right="5"/>
<mx:Button id="btnSave" label="Save" click="fn_Validate();" accessibilityEnabled="false" uid="10292"
mouseChildren="false" buttonMode="true" tabIndex="16" toolTip="Save Record" y="25"
width="65" height="20" cornerRadius="1" fontWeight="normal" textAlign="center" right="5"/>
<mx:Button id="btnUndo" label="Undo" click="DocList.fn_UndoEdition()" accessibilityEnabled="false"
uid="0" mouseChildren="false" buttonMode="true" y="47" width="65"
height="20" cornerRadius="1" tabIndex="17" fontStyle="normal" textAlign="center" right="5"/>
<mx:Button id="btnDelete" label="Delete" click="Alert.show('Are you sure you want to delete the record?',
'Delete Confirmation', Alert.YES | Alert.NO, this, fn_DeleteRecord, null, Alert.NO);"
accessibilityEnabled="false" uid="10293" mouseChildren="false" buttonMode="true"
enabled="false" tabIndex="18" y="69" width="65" height="20" cornerRadius="1"
fontWeight="normal" textAlign="center" right="5"/>
<mx:AdvancedDataGrid id="dgProducts_Prod" dataProvider="{arrProductDPTranTo}" sortExpertMode="true"
styleName="advancedDataGrid" maxWidth="{MaterialIssueContainer.width - 80}"
itemDoubleClick="fn_EditProduct(true);" verticalAlign="middle" editable="true"
horizontalScrollPolicy="auto" tabIndex="7" left="5" right="75" height="134" top="134" tabFocusEnabled="true">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="SrNo" headerText="S No." editable="false" width="40"
labelFunction="fn_GetSNo_Prd"/>
<mx:AdvancedDataGridColumn dataField="pcd_PrdCode" editable="false" headerText="Product" width="130"
labelFunction="DocList.fn_FormatProductGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_PrdDesc" headerText="Description" editable="false" width="150"/>
<mx:AdvancedDataGridColumn dataField="pcd_UnitDesc" headerText="Unit" width="40" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_Acc_Code" headerText="Account Code" editable="false" width="130"
labelFunction="DocList.fn_FormatCOAGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_AccDesc" headerText="Description" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_Qty" headerText="Quantity" editable="false" width="60" textAlign="right" labelFunction="DocList.fn_FormatQtyGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_allocated_qty" editable="false" headerText="Allocated Quantity" visible="{bCrude}" width="60" textAlign="right" labelFunction="DocList.fn_FormatQtyGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_Rate" headerText="Rate" width="60" textAlign="right" editable="false" labelFunction="DocList.fn_FormatRateGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_Amt" headerText="Amount" labelFunction="DocList.fn_FormatAmountGrid" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_StoreCode" headerText="Store Code" width="60" editable="false" labelFunction="DocList.fn_FormatStoreGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_StoreDesc" headerText="Description" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_DeptCode" headerText="Department Code" editable="false"
width="50" visible="true"/>
<mx:AdvancedDataGridColumn dataField="pcd_DeptDesc" headerText="Description" width="100" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_CostCntrCode" headerText="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_COSTCNTNAME}"
editable="false" width="130" labelFunction="DocList.fn_FormatCostCenterGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_CostCntrDesc" headerText="Description" width="150" editable="false"/>
<mx:AdvancedDataGridColumn dataField="pcd_IsCrude" headerText="Description" width="5" visible ="false"/>
</mx:columns>
</mx:AdvancedDataGrid>
<components:dbzBtnAddDetail id="btnAdd" click="fn_AddProduct(true, true)" y="134" tabIndex="19" right="5"/>
<components:dbzBtnEditDetail id="btnEdit" click="fn_EditProduct_Common(true,true);" y="166" tabIndex="20" right="5"/>
<components:dbzBtnDeleteDetail id="btnRemove" click="fn_DeleteProduct(true)" y="198" tabIndex="21" right="5"/>
<s:Label text="Transfer From" width="83" verticalAlign="bottom" textAlign="left" fontWeight="bold" left="10" top="279"/>
<mx:AdvancedDataGrid id="dgProducts_Con" dataProvider="{arrProductDPTranFrom}" sortExpertMode="true"
styleName="advancedDataGrid" maxWidth="{MaterialIssueContainer.width - 80}"
itemDoubleClick="fn_EditProduct(true);" verticalAlign="middle"
horizontalScrollPolicy="auto" tabIndex="2" top="296" bottom="5" right="75" left="5" tabFocusEnabled="false">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="SrNo" headerText="S No." editable="false" width="40"
labelFunction="fn_GetSNo_Con"/>
<mx:AdvancedDataGridColumn dataField="pcd_PrdCode" headerText="Product" width="130"
labelFunction="DocList.fn_FormatProductGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_PrdDesc" headerText="Description" width="150"/>
<mx:AdvancedDataGridColumn dataField="pcd_UnitDesc" headerText="Unit" width="40"/>
<mx:AdvancedDataGridColumn dataField="pcd_Acc_Code" headerText="Account Code" width="130"
labelFunction="DocList.fn_FormatCOAGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_AccDesc" headerText="Description"/>
<mx:AdvancedDataGridColumn dataField="pcd_Qty" headerText="Quantity" width="60" textAlign="right" labelFunction="DocList.fn_FormatQtyGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_Rate" headerText="Rate" width="60" textAlign="right" labelFunction="DocList.fn_FormatRateGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_Amt" headerText="Amount" labelFunction="DocList.fn_FormatAmountGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_StoreCode" headerText="Store Code" width="60" labelFunction="DocList.fn_FormatStoreGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_StoreDesc" headerText="Description"/>
<mx:AdvancedDataGridColumn dataField="pcd_DeptCode" headerText="Department Code" editable="false"
width="50" visible="true"/>
<mx:AdvancedDataGridColumn dataField="pcd_DeptDesc" headerText="Description" width="100"/>
<mx:AdvancedDataGridColumn dataField="pcd_CostCntrCode" headerText="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.PAR_COSTCNTNAME}"
editable="false" width="130" labelFunction="DocList.fn_FormatCostCenterGrid"/>
<mx:AdvancedDataGridColumn dataField="pcd_CostCntrDesc" headerText="Description" width="150"/>
</mx:columns>
</mx:AdvancedDataGrid>
<components:dbzBtnAddDetail id="btnAdd_Con" click="fn_AddProduct(true, false)" y="297" tabIndex="22" right="5"/>
<components:dbzBtnEditDetail id="btnEdit_Con" click="fn_EditProduct_Common(true,false);" y="329" tabIndex="23" right="5"/>
<components:dbzBtnDeleteDetail id="btnRemove_Con" click="fn_DeleteProduct(false)" y="361" tabIndex="24" right="5"/>
<mx:Button id="btnExchange" label="FC Rate" accessibilityEnabled="false" uid="0" mouseChildren="false"
buttonMode="true" click="DocList.fn_ShowExchangeRate();" cornerRadius="1"
width="65" height="20" fontWeight="normal" tabIndex="25" textAlign="center" toolTip="Show Exchange Rates" bottom="30" right="5"/>
<mx:Button id="btnVoucher" label="Voucher" accessibilityEnabled="false" uid="0" mouseChildren="false"
buttonMode="true" click="btnVoucher_clickHandler(event)" cornerRadius="1"
fontWeight="normal" tabIndex="26" textAlign="center" toolTip="Show Voucher" width="65" bottom="5" right="5" height="21"/>
<s:Label text="Transfer To" y="120" width="83" verticalAlign="bottom" textAlign="left" fontWeight="bold" left="10"/>
<s:BorderContainer x="{(MaterialIssueContainer.width - subContainerTop.width - 80)/2}" width="510" height="108" borderVisible="false" top="1" id="subContainerTop">
<s:Label text="No." y="8" width="83" verticalAlign="bottom" textAlign="right" x="7"/>
<s:Label text="Date" y="6" width="43" verticalAlign="bottom" textAlign="right" x="344"/>
<cc:MaskedTextInput id="pcm_No" x="96" y="2" width="126" height="20"
tabIndex ="10" maxChars="10" restrict="0-9"/>
<s:TextInput id="pcm_VerifPlan" editable="false" visible="false" height="20"/>
<cc:MaskedDateField id="pcm_Date" y="2" width="115" height="20" tabIndex="11" editable="true"
inputMask="{parentMxmlDocument.parentMxmlDocument.parentMxmlDocument.appParams.DATE_FORMAT}" yearNavigationEnabled="true"
x="393"/>
<!--<s:Label id="voucherLabel" text="Voucher Type" y="35" width="81" height="12" verticalAlign="bottom" textAlign="right" x="9"/>-->
<!--<s:DropDownList id="pcm_VchrType" dataProvider="{DocList.arrVoucherTypeDP}" y="31" width="144"
height="20" tabIndex="12" x="96"/>-->
<s:Label text="Currency" y="35" width="83" verticalAlign="bottom" textAlign="right" x="271"/>
<s:DropDownList id="pcm_CurrCode" dataProvider="{DocList.arrCurrencyDP}" y="31" width="148"
height="20" tabIndex="13" change="DocList.fn_SetCurrencyRates();" x="360"/>
<s:Label text="Narration" y="61" width="83" verticalAlign="bottom" textAlign="right" x="7"/>
<mx:TextArea id="pcm_Narration" y="60" height="44" maxChars="100" tabIndex="14" width="411" x="96"/>
<s:TextInput id="pcm_ExchRtRepcurr1" visible="false" x="-1" y="-8"/>
<s:TextInput id="pcm_ExchRtRepcurr2" visible="false" x="-1" y="-8"/>
<s:TextInput id="pcm_ExchRtRepcurr3" visible="false" x="-1" y="-8"/>
<s:TextInput id="pcm_ExchRtRepcurr4" visible="false" x="-1" y="-8"/>
<s:TextInput id="pcm_ExchRtRepcurr5" visible="false" x="-1" y="-8"/>
<s:TextInput id="pcm_DocType" visible="false" text = "{DocList.DocumentType.selectedItem.id}" width="33" x="-1" y="-8"/>
<s:TextInput id="pcm_VerifLevel" visible="false" text = "{DocList.VerificationLevel.selectedItem.id}" x="-1" y="-8"/>
<s:TextInput id="pcm_GLAna1" visible="false" x="-1" y="3"/>
<s:TextInput id="pcm_GLAna2" visible="false" x="-1" y="3"/>
<s:TextInput id="pcm_GLAna3" visible="false" x="-1" y="3"/>
<s:TextInput id="pcm_GLAna4" visible="false" x="-1" y="3"/>
<s:TextInput id="pcm_GLAna5" visible="false" x="-1" y="3"/>
<s:TextInput id="recUpdateNo" visible="false" x="-1" y="3"/>
<s:TextInput id="pcm_RCM_No" visible="false" x="-1" y="3" valueCommit="fn_FetchBOM()"/>
</s:BorderContainer>
<components:dbzBtnAddAttachment x="988" y="92" right="5" id="btnAttachment" click="DocList.fn_OpenAttachments(DocList.bNewRecord);"/>
<mx:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.apache.org/royale/spark"
xmlns:mx="library://ns.apache.org/royale/mx"
xmlns:js="library://ns.apache.org/royale/basic"
xmlns:j="library://ns.apache.org/royale/jewel"
accessibilityEnabled="false" uid="0" mouseChildren="true"
buttonMode="true" toolTip="Get Consumption data from Bill Of Material."
rollOverEffect="{this.enabled == true ? glowButton:false}"
rollOutEffect="{this.enabled == true ?unglowButton:false}"
icon="assets/default/images/copyrec.gif')"
id="btnBOM" click="fn_CallBOM(false)" tabIndex="21"
width="30" height="28" cornerRadius="1" right="5" y="237" enabled="true" visible="false"/>
</s:BorderContainer>
</s:NavigatorContent>
</mx:ViewStack>
</s:BorderContainer>
</mx:HDividedBox>
</s:BorderContainer>
</s:Panel>
</mx:Module>
Make a new paste