-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 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 0){ // for (var i:int=0 ; i 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); } ]]> @namespace s "library://ns.apache.org/royale/spark"; @namespace mx "library://ns.apache.org/royale/mx"; s|Panel #titleDisplay { textAlign: left; }