//javascript Global Variables Declaration-Start//
//Added By : Swapan Mohan
//Purpose : Task #125 3.5x Issues
var IsDocumentInNewMode;
var ActionSignedByAuthor = false;
var PreviousDocumentId;
var PreviousScreenId;
var NextDocumentId;
var NextScreenId;
var DocumentId;
var DocumentStatus;
var DocumentStatusId;
var DocumentVersion;
var DocumentLatestVersion;
var AuthorId;
var AuthorName = "";
var LoggedInUserId;
var SignedByAuthor;
var IsDirty = false; //To varify document save operation has performed or not before any other operation.
var WorkingMode = "new"; //new=Creating new document,update=updating existing document.
var RequiresSignature = "";
var ProxyId = 0;
var ActionSignOrComplete = false; //Set varible ActionSignOrComplete=true when sign/complete button click.
var DocumentShare;
var DocumentToSign;
var AuthorChanged = 'N';
var DocumentMode = 'edit'; //edit = Document will open for update, view = document will open in view mode i.e. RDL will open
var DocumentType = '';
var DocumentVersionId = -1;
var PageTitle = "";
var LoggedInUserName = "";
var EffectiveDate = "";
var DocumentNavigationName = "";
var DocumentNavigationId = 0;
var SignerID = 0
var SignerType = '';
var SignatureId = 0;
var SignerName = '';
var DocumentContainerDirty = "False"; //To varify document save operation has performed or not before any other operation.
var ServiceId = 0;
var IsServiceNote = false;
var KeyFieldId = 0;
var KeyFieldValue = 0;
var KeyScreenId = 0;
var NoteType = 0;
var RegenratePdf = '';
//Modified by Sweety kamboj on 30April,2010
var IsDocumentExistInProxyTracking = "";
var XMLString = "";
var newAuhorId = 0;
var newAuthorName = "";
//Added By priya
var newAuhorType = "";
//End
var associatedNoteScreenId = 0;
var SignerIds = '';
var SignedPersonIds = '';
var OpenEMCodingPopup = false;
var CallBackAction = '';
//var _ScreenType = '11827' //for documents in database
//Javascript Global Variables Declaration-End
var Span_DocumentInformation_AcknowledgementComments = null;
//Global Objects declaration for document controller elements-Start.
var ButtonNew = null;
var ButtonUpdate = null;
var ButtonValidate = null; //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
var ButtonDelete = null;
var Span_DocumentInformation_PreviousDocumentDate = null;
var Span_DocumentInformation_PreviousDocumentSeprator = null;
var Span_DocumentInformation_PreviousDocumentName = null;
var Button_DocumentInformation_PreviousDocument = null;
var Button_DocumentInformation_NextDocument = null;
var Span_DocumentInformation_NextDocumentDate = null;
var Span_DocumentInformation_NextDocumentSeprator = null;
var Span_DocumentInformation_NextDocumentName = null;
var Span_DocumentInformation_GoToDocumentList = null;
var Button_DocumentInformation_Sign = null;
var Button_DocumentInformation_ToSign = null;
var Button_DocumentInformation_Complete = null;
var Button_DocumentInformation_View = null;
var Button_DocumentInformation_ShareDocument = null;
var Span_DocumentInformation_Status = null;
var TextBox_DocumentInformation_EffectiveDate = null;
var img_DocumentInformation_EffectiveDate = null;
var Span_DocumentInformation_AuthorList = null;
var Span_DocumentInformation_AuthorName = null;
var DropDownList_DocumentInformation_AuthorList = null;
var img_DocumentInformation_Author = null;
var Button_DocumentInformation_ShowSignature = null;
var Table_DocumentInformation_Signature = null;
var Span_DocumentInformation_VersionList = null;
var Div_DocumentInformation_SignedBy = null;
var DropDownList_DocumentInformation_SignerList = null;
var Button_DocumentInformation_Signer = null;
var Button_DocumentInformation_Decline = null;
var Span_DocumentInformation_SignerList = null;
var Span_DocumentInformation_AcknowledgementComments = null;
//Global Objects declaration for document controller elements-Start.
//Image Document variables
var ImageDocumentIndex = null;
var ImageDocumentCount = null;
var ImageDocumentSource = null;
var Button_ImageDocument_PreviousDocument = null;
var Button_ImageDocument_NextDocument = null;
var Span_ImageDocument_PagingInformation = null;
var Span_ImageDocument_ErrorMessage = null;
var ConfirmationMessageCaption = 'Confirmation Message';
var _AssociatedScreenTabUcPath = null;
//Created By Mahesh
var Radtabobject = null;
//Global Objects declaration for Image document container element-End
var documentAction = '';
//Added by Loveena in ref to CM/PA Unsave Changes
var _SaveDocumentCallBackFunction = "";
var _documentNavigationName = "";
var _screenAssociatedScreenId = null;
var ClientLifeEventId = null;
//Added By Daman ref: task#117 DocumentsAcknowledgement
var EnableDocumentsAcknowledgementsTools = "false";
var XmlDoc;
//Added By Sonia Ref #116
//Next and Previous Associated Screen Id's must be set
//Along with other information of previous and Next Documents
var NextScreenAssociatedScreenId = null;
var PreviousScreenAssociatedScreenId = null;
//Changes end here
//Added by Shifali in ref to task# 11 - To Be Reviewed(Harbor Development)
var DocumentAuthorId = '';
var DocumentCodeId = '';
var ReviewerId = '';
var Button_DocumentInformation_MetaData = null;
var ReviewerName = '';
//Author Action Save For To Be Reviwed
var AuthorActionSign_ToBeReviewedStatus = false;
var CurrentVersionStatusId = "";
var CurrentVersionStatusName = "";
var InProgressDocumentVersionId = 0;
//Changes ends here
//Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
var ActionValidateDocumentPageData = false; //Set varible ActionValidateDocumentPageData=true when Validate button click.
var IsLatestVersionSelected = true;
var openedDocumentVersionId = -1;
//Added by sourabh to reatin ifrmaeId
var iFrameId;
//end here
// Added by Karan Garg
// Ref task #12 Threshold Dev. Phase II
// Purpose : To store the Usercode of the clinician who has currently locked the document
var lockedbyUserName = '';
var MultipleCredentials = '';
var StaffCredentialString = '';
var Credentialdelimeter = '*';
var pagefrom = '';
// Added by Shifali
// Ref task #14 Threshold Dev. Phase III
// Purpose : To pass the Signer Type to diagnose if Client/Staff/Other user signed the document (As we need to update pdf in DB when SignerType = 'C')
var SignatureType = '';
//Changes by Shifali Ends here
// Added By Shifali
// Purpose : To disable the "Shared" checkbox when SystemConfigurations.ShareDocumentOnSave = 'Y' else leave it as its working
// Dated : 3Sept2012
// Ref task #1825 Thresholds - Bugs/Features (Offshore)
var ShareDocumentOnSave = '';
//Ends here
//Author - Sanjay Bhardwaj
//Merged from 2.x to 3.5xMerge
//Purpose - With Ref. to Task#259 SC Web Phase II - Bugs/Features Document Version Views: Refresh repository PDF
var RefreshDocumentViewsFlag = '';
var ShowInViewMode = false;
var ServiveNoteTabLoadInitiated = false;
var editClick = false;
var VersionAuthorToSign = "";
var CallSetScreenSpecificValues = false;
var checkAllowEditingByNonAuthors = null;
//Task#259
function ManageDocumentToolbarItems() {
ShowToolbarItems('Save');
ShowToolbarItems('New');
ShowToolbarItems('Close');
ShowToolbarItems('Delete');
ShowToolbarItems('Move');
ShowToolbarItems('Help');
ShowToolbarItems('Upload File');
ShowToolbarItems('Validate');
HideToolbarItems('CopyService');
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
HideToolbarItems('ScheduleFollowup');
HideToolbarItems('NumberOfTimesRescheduled');
ShowToolbarItems('FavoritePhrases');
ShowToolbarItems('AddPhrases');
HideToolbarItems('ServiceDetail');
HideToolbarItems("OpenPopUpUseNote");
HideToolbarItems('OrginalDocument');
// Code Added By Karan *****
// Purpose : Show hide the KeyPhrases icon on basis of pageresponse
// Dated : 24 Nov 2011
if (objectPageResponse.UseKeyPhrases) {
ShowToolbarItems('AddPhrases');
ShowToolbarItems('FavoritePhrases');
}
else {
HideToolbarItems('AddPhrases');
HideToolbarItems('FavoritePhrases');
}
//Added By Rahul Aneja for Help URL functionality
if (objectPageResponse.HelpURL != null && objectPageResponse.HelpURL != "") {
ShowToolbarItems('HelpURL');
// ShowToolbarItems('FavoritePhrases');
}
else {
HideToolbarItems('HelpURL');
// HideToolbarItems('FavoritePhrases');
}
HideToolbarItems('Lock');
HideToolbarItems('UnLock');
var MCG = $('[id$=HiddenFieldThirdPartyAuthForDocument]').val();
if (MCG == "Y") {
ShowToolbarItems('MCG');
}
else {
HideToolbarItems('MCG');
}
if (objectPageResponse.ObjectDocumentInformation != null) {
var metaDataId = $('[id$=HiddenFieldMetaDataId]').val();
if (objectPageResponse.ObjectDocumentInformation.DocumentId == 0 || parseInt(metaDataId) == 0) {
HideToolbarItems("MetaData");
// var ctrlMetadata = $('#Button_DocumentInformation_MetaData');
// if (ctrlMetadata.length > 0) {
// ctrlMetadata.hide();
// }
}
else {
// var ctrlMetadata = $('#Button_DocumentInformation_MetaData');
// if (ctrlMetadata.length > 0) {
if (parseInt(metaDataId) > 0) {
//ctrlMetadata.show();
ShowToolbarItems('MetaData');
}
else {
HideToolbarItems("MetaData");
}
// }
}
}
if (typeof ManageToolbarItems == 'function') {
ManageToolbarItems();
}
//Adde by Rahul Aneja ref Task#2125 in Threshold Bugs And Features On 18-Oct -2012, Why : after complete service note Service Details Icon get Hide ,To show that add this code
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.NoteType == '-1') {
ShowToolbarItems('ServiceDetail');
ShowToolbarItems("OpenPopUpUseNote");
if ($('input[id$=hiddenClinicalSummaryEnable]').val() == "Y")
ShowToolbarItems('PrintCLinicalSummary');
}
if ($('input[id$=hiddenAmendmentRequestEnable]').val() == "Y") {
ShowToolbarItems('PrintAmendmentRequests');
}
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentCodeId == '300' && $('input[id$=hiddenClinicalSummaryEnable]').val() == "Y") {
ShowToolbarItems('PrintCLinicalSummary');
}
// Function to show/hide Authorship tool
if (objectPageResponse.Action != pageActionEnum.CustomAjaxCall) {
DocumentAuthorShipTool();
}
if ($('[id$=hiddenFavouritesToolBar]').length > 0 && $('[id$=hiddenFieldCurrentScreenId]').length > 0) {
if ($('[id$=hiddenFieldCurrentScreenId]').val() && $('[id$=hiddenFavouritesToolBar]').val()) {
if ($('[id$=hiddenFavouritesToolBar]').val().indexOf("," + $('[id$=hiddenFieldCurrentScreenId]').val() + ",") > -1) {
ShowToolbarItems('NewFavourites');
ShowToolbarItems('ApplyFavourites');
}
else {
HideToolbarItems("NewFavourites");
HideToolbarItems("ApplyFavourites");
}
}
}
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentCodeId == '1506') {
ShowToolbarItems('DownloadRequisition');
}
}
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose This function is used to populate documentcontroller information.
//Jquery document's ready function to initialize the page.- Start
//Author Devinder Pal Singh
//This function will be resize the contents in document container
function ResizeDocuments() {
var hiddenContainerControlToResize = $('input[id$=hiddenContainerControlToResize]');
var ContainerControlToResize = hiddenContainerControlToResize.val();
if (hiddenContainerControlToResize.val() == "") {
ContainerControlToResize = "DivShowDetailHTML";
}
ResizeContainer(ContainerControlToResize);
}
function OpenAmendmentRequest() {
if ($('input[id$=hiddenAmendmentRequestEnable]').val() == "Y") {
window.open(GetRelativePath() + "ShowReport.aspx?FunctionName=LoadRdlAmendmentRequest&DocumentCodeId=" + objectPageResponse.ObjectDocumentInformation.DocumentCodeId + "&ClientId=" + objectPageResponse.ClientId, "", "Height=695,Width=1024,left=0,top=0");
}
}
function DocumentAuthorShipTool() {
if (objectPageResponse.ObjectDocumentInformation) {
if (objectPageResponse.ObjectDocumentInformation.AllowEditingByNonAuthors && objectPageResponse.ObjectDocumentInformation.DocumentStatusId != 22 && objectPageResponse.ObjectDocumentInformation.CurrentVersionStatusId != 22 && $('input[id$=Button_DocumentInformation_View]').attr("mode") == "edit" && objectPageResponse.ObjectDocumentInformation.AuthorId != objectPageResponse.ObjectDocumentInformation.LoggedInUserId) {
$('#BtnAuthorship').attr('disabled', false);
}
else {
$('#BtnAuthorship').attr('disabled', true);
}
}
}
//Jquery document's ready function to initialize the page.-End
function SetDocumentNextPreviousInformation(ObjectDocumentInformation) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SetDocumentNextPreviousInformation", "");
//Set Next Prevoius Document Information
var previousDocumentName = jQuery.trim(ObjectDocumentInformation.PreviousDocumentName);
if (previousDocumentName != "") {
// Old_Pattern Span_DocumentInformation_PreviousDocumentSeprator.html("|");
// New Pattern Date | Document name should be changed to Date – Document Name (date + space(1) + ‘-‘ + space(1) + DocumentName)
// Commented on March 31,2010 MKS
Span_DocumentInformation_PreviousDocumentSeprator.html(" - "); //( - )Removed and padding in left and right TD of navigation contols
if (previousDocumentName.length > 17) {
Span_DocumentInformation_PreviousDocumentDate.html(ObjectDocumentInformation.PreviousDocumentEffectiveDate)
Span_DocumentInformation_PreviousDocumentName.html(previousDocumentName.substring(0, 13) + "...");
Span_DocumentInformation_PreviousDocumentName.attr("title", previousDocumentName);
}
else {
Span_DocumentInformation_PreviousDocumentDate.html(ObjectDocumentInformation.PreviousDocumentEffectiveDate)
Span_DocumentInformation_PreviousDocumentName.html(previousDocumentName);
Span_DocumentInformation_PreviousDocumentName.attr("title", "");
}
}
else {
Span_DocumentInformation_PreviousDocumentName.html("");
Span_DocumentInformation_PreviousDocumentDate.html("");
Span_DocumentInformation_PreviousDocumentSeprator.html("");
}
var nextDocumentName = jQuery.trim(ObjectDocumentInformation.NextDocumentName);
if (nextDocumentName != "") {
// Old_Pattern Span_DocumentInformation_NextDocumentSeprator.html("|");
// New Pattern Date | Document name should be changed to Date – Document Name (date + space(1) + ‘-‘ + space(1) + DocumentName)
// Commented on March 31,2010 MKS
Span_DocumentInformation_NextDocumentSeprator.html(" - "); //( - )Removed and padding in left and right TD of navigation contols
if (nextDocumentName.length > 17) {
Span_DocumentInformation_NextDocumentDate.html(ObjectDocumentInformation.NextDocumentEffectiveDate)
Span_DocumentInformation_NextDocumentName.html(nextDocumentName.substring(0, 13) + "...");
Span_DocumentInformation_NextDocumentName.attr("title", nextDocumentName);
}
else {
Span_DocumentInformation_NextDocumentDate.html(ObjectDocumentInformation.NextDocumentEffectiveDate)
Span_DocumentInformation_NextDocumentName.html(nextDocumentName);
Span_DocumentInformation_NextDocumentName.attr("title", "");
}
}
else {
Span_DocumentInformation_NextDocumentName.html("");
Span_DocumentInformation_NextDocumentDate.html("");
Span_DocumentInformation_NextDocumentSeprator.html("");
}
PreviousDocumentId = ObjectDocumentInformation.PreviousDocumentId;
PreviousScreenId = ObjectDocumentInformation.PreviousScreenId;
NextDocumentId = ObjectDocumentInformation.NextDocumentId;
NextScreenId = ObjectDocumentInformation.NextScreenId;
//Ref 116
PreviousScreenAssociatedScreenId = ObjectDocumentInformation.PreviousScreenAssociatedScreenId;
NextScreenAssociatedScreenId = ObjectDocumentInformation.NextScreenAssociatedScreenId;
//Changes end here
if (parseInt(objectPageResponse.ObjectDocumentInformation.DocumentType) == 17) {
if (PreviousScreenId == "")
PreviousScreenId = "102";
if (NextScreenId == "")
NextScreenId = "102";
if (!PreviousScreenAssociatedScreenId > 0)
PreviousScreenAssociatedScreenId = CurrentScreenId;
if (!NextScreenAssociatedScreenId > 0)
NextScreenAssociatedScreenId = CurrentScreenId;
}
if (Button_DocumentInformation_PreviousDocument.length > 0) {
//Enable/Disable Next/Prev Document buttons-Start
if (ObjectDocumentInformation.PreviousDocumentId == "0") {
Button_DocumentInformation_PreviousDocument[0].className = "previousbuttondisable";
}
else {
Button_DocumentInformation_PreviousDocument[0].className = "previousbuttonenable";
}
}
if (Button_DocumentInformation_NextDocument.length > 0) {
if (ObjectDocumentInformation.NextDocumentId == "0") {
Button_DocumentInformation_NextDocument[0].className = "nextbuttondisable";
}
else {
Button_DocumentInformation_NextDocument[0].className = "nextbuttonenable";
}
}
//Enable/Disable Next/Prev Document buttons-End
}
//Commented By Devender Kumar 09-05-2011 To Show The Meta Data in The Popup On Clcik on View Detail Button
function ShowMetadata() {
var screenId = GetCurrentScreenID();
OpenPage(5761, 174, 'screenId=' + screenId, 2, GetRelativePath(), "T", "dialogHeight:400px; dialogWidth: 850px;dialogTitle:Metadata");
}
function SetGoToDocumentInformation(ObjectDocumentInformation) {
if (ObjectDocumentInformation.DocumentNavigationHtml == "") {
Span_DocumentInformation_GoToDocumentList.html("");
$("#category2").mcDropdown("#categorymenu");
var dd = $("#category2").mcDropdown("#categorymenu");
//Added with ref to ticket
_documentNavigationName = ObjectDocumentInformation.DocumentNavigationName;
//changes end here
if (dd.length > 0) {
dd.setText(ObjectDocumentInformation.DocumentNavigationName);
}
}
else {
Span_DocumentInformation_GoToDocumentList.html("" + ObjectDocumentInformation.DocumentNavigationHtml);
$("#category").mcDropdown("#categorymenu");
var dd = $("#category").mcDropdown("#categorymenu");
//Added with ref to ticket
_documentNavigationName = ObjectDocumentInformation.DocumentNavigationName;
//changes end here
if (dd.length > 0) {
dd.setText(ObjectDocumentInformation.DocumentNavigationName);
}
}
}
function SetDocumentGlobalVaribales(ObjectDocumentInformation) {
/*Modified By Sumanta- No need to Update History Node inside Framed(Custom) Pages*/
var newFilterString = "";
//Added By : Shifali on 7Jan2013 (Ref task# 2471 (Thresholds Bugs/Features)
// What: History node xml should not be updated if document/service note/event is not saved yet.
//Why : Because when we do new/copy service/document/event etc. then, we do not create history point, so we should not update the history node as wellby fn 'UpdateScreenHistoryNode'
var primaryKey = '';
if (ObjectDocumentInformation.NoteType == 0) {
newFilterString = "DocumentNavigationName=" + ObjectDocumentInformation.DocumentNavigationName + "^clientId=" + objectPageResponse.ClientId + "^clientName=" + objectPageResponse.ClientName + "^DocumentId=" + ObjectDocumentInformation.DocumentId;
primaryKey = ObjectDocumentInformation.DocumentId;
}
else if (ObjectDocumentInformation.NoteType == -1) {
newFilterString = "IsServiceNote=true^TabId=2^serviceId=" + ObjectDocumentInformation.KeyFieldValue + "^documentId=" + ObjectDocumentInformation.DocumentId + "^keyscreenid=29^^keyfieldvalue=" + ObjectDocumentInformation.KeyFieldValue + "^DocumentNavigationId=" + ObjectDocumentInformation.DocumentNavigationId + "^DocumentNavigationName=" + ObjectDocumentInformation.DocumentNavigationName + "^clientId=" + objectPageResponse.ClientId + "^clientName=" + objectPageResponse.ClientName;
primaryKey = ObjectDocumentInformation.KeyFieldValue;
}
else if (ObjectDocumentInformation.NoteType == -2) {
newFilterString = "IsServiceNote=true^TabId=2^EventId=" + ObjectDocumentInformation.KeyFieldValue + "^documentId=" + ObjectDocumentInformation.DocumentId + "^keyscreenid=29^keyfieldvalue=" + ObjectDocumentInformation.KeyFieldValue + "^DocumentNavigationId=" + ObjectDocumentInformation.DocumentNavigationId + "^DocumentNavigationName=" + ObjectDocumentInformation.DocumentNavigationName + "^clientId=" + objectPageResponse.ClientId + "^clientName=" + objectPageResponse.ClientName;
primaryKey = ObjectDocumentInformation.KeyFieldValue;
}
//If condition Added By : Shifali on 7Jan2013 (Ref task# 2471 (Thresholds Bugs/Features)
// What: History node xml should not be updated if document/service note/event is not saved yet.
//Why : Because when we do new/copy service/document/event etc. then, we do not create history point, so we should not update the history node as wellby fn 'UpdateScreenHistoryNode'
if (primaryKey != '' && parseInt(primaryKey) > 0) {
UpdateScreenHistoryNode(CurrentHistoryId, CurrentScreenId, "FiltersData", newFilterString);
//Added by jagdeep
//What:To clear screen action when document is allready saved.
//Why: When saving a new document screen action remained new .
UpdateScreenHistoryNode(CurrentHistoryId, CurrentScreenId, "ScreenAction", "");
}
DocumentId = ObjectDocumentInformation.DocumentId;
DocumentStatus = ObjectDocumentInformation.DocumentStatus;
DocumentVersion = ObjectDocumentInformation.DocumentVersion;
AuthorId = ObjectDocumentInformation.AuthorId;
LoggedInUserId = ObjectDocumentInformation.LoggedInUserId;
LoggedInUserName = ObjectDocumentInformation.LoggedInUserName;
EffectiveDate = ObjectDocumentInformation.DocumentEffectiveDate;
SignedByAuthor = ObjectDocumentInformation.SignedByAuthor;
DocumentStatusId = ObjectDocumentInformation.DocumentStatusId;
DocumentLatestVersion = ObjectDocumentInformation.DocumentLatestVersion;
ProxyId = ObjectDocumentInformation.ProxyId;
DocumentVersionId = ObjectDocumentInformation.DocumentVersionId;
AuthorName = ObjectDocumentInformation.Author;
DocumentNavigationName = ObjectDocumentInformation.DocumentNavigationName;
DocumentNavigationId = ObjectDocumentInformation.DocumentNavigationId;
DocumentShare = ObjectDocumentInformation.DocumentShare.toUpperCase();
DocumentToSign = ObjectDocumentInformation.ToSign;
RequiresSignature = ObjectDocumentInformation.RequiresSignature;
ServiceId = ObjectDocumentInformation.ServiceId;
IsServiceNote = ObjectDocumentInformation.IsServiceNote;
KeyFieldId = ObjectDocumentInformation.KeyFieldId;
KeyFieldValue = ObjectDocumentInformation.KeyFieldValue;
KeyScreenId = ObjectDocumentInformation.KeyScreenId;
NoteType = ObjectDocumentInformation.NoteType;
associatedNoteScreenId = ObjectDocumentInformation.AssociatedNoteScreenId;
//MOdified by Sweety Kamboj
// alert('setinfo'+ObjectDocumentInformation.IsDocumentExistInProxyTracking);
IsDocumentExistInProxyTracking = ObjectDocumentInformation.IsDocumentExistInProxyTracking;
newAuhorId = ObjectDocumentInformation.AuthorId;
newAuthorName = ObjectDocumentInformation.Author;
SignerIds = ObjectDocumentInformation.SignerIds;
SignedPersonIds = ObjectDocumentInformation.SignedPersonIds;
DocumentType = ObjectDocumentInformation.DocumentType;
//added by Shifali in ref to task# 11(To Be Reviewed)
ReviewerId = ObjectDocumentInformation.ReviewerId;
ReviewerName = ObjectDocumentInformation.ReviewerName;
CurrentVersionStatusId = ObjectDocumentInformation.CurrentVersionStatusId;
CurrentVersionStatusName = ObjectDocumentInformation.CurrentVersionStatusName;
InProgressDocumentVersionId = ObjectDocumentInformation.InProgressDocumentVersionId;
//Changes ends here
//added by shifali in ref to task# 11(TO be Reviewed Document Status)
//purpose - DocumentAuthorId,DocumentCodeId vars set as we need it when user is signing/adding the reviewer for document
DocumentAuthorId = objectPageResponse.ObjectDocumentInformation.AuthorId;
DocumentCodeId = objectPageResponse.ObjectDocumentInformation.DocumentCodeId;
// Added By Karan
// Purpose : To check wether a document code has multiple credentials
// Dated : 01/feb/2012
// Ref task #24 Threshold Dev Phase II
MultipleCredentials = objectPageResponse.ObjectDocumentInformation.MultipleCredentials;
// Added By Shifali
// Purpose : To disable the "Shared" checkbox when SystemConfigurations.ShareDocumentOnSave = 'Y' else leave it as its working
// Dated : 3Sept2012
// Ref task #1825 Thresholds - Bugs/Features (Offshore)
ShareDocumentOnSave = objectPageResponse.ObjectDocumentInformation.ShareDocumentOnSave;
VersionAuthorToSign = ObjectDocumentInformation.VersionAuthorToSign; // Added By Sachin
checkAllowEditingByNonAuthors = ObjectDocumentInformation.AllowEditingByNonAuthors;
}
function SetDocumentPermission(ObjectDocumentInformation) {
var IsMoveButton = ObjectDocumentInformation.IsMoveButton;
if (IsMoveButton == '0') {
//$("#ImgButtonMove").hide();
HideToolbarItems("Move");
}
else {
//var ImgButtonMove = $("#ImgButtonMove");
//ImgButtonMove.show();
//ImgButtonMove.attr("disabled", "");
EnableToolbarItem("Move");
ShowToolbarItems("Move");
}
}
function CreateNewGoToDocumentDropDown(CreateDropDownNewHTML) {
var $spanGoToDocument = $('#span_GoToDocumentNewList');
if ($spanGoToDocument.length > 0) {
if (GetCurrentScreenID() == 29) { $spanGoToDocument.hide(); return false; }
if (GetCurrentScreenID() == 32) { $spanGoToDocument.hide(); return false; }
$spanGoToDocument.show();
if (CreateDropDownNewHTML == '') { return false; }
GoToDocumentNewList = CreateDropDownNewHTML;
$spanGoToDocument.html(CreateDropDownNewHTML);
var objectGoToDropDown1;
if ($("#category1").length == 0) {
$("#category2").mcDropdown("#categorymenu");
objectGoToDropDown1 = $("#category2").mcDropdown("#categorymenu");
objectGoToDropDown1.setText("Create Document...");
} else {
$("#category1").mcDropdown("#categorymenu");
objectGoToDropDown1 = $("#category1").mcDropdown("#categorymenu");
objectGoToDropDown1.setText("Create Document...");
}
}
}
function SetTextNewGoToDocumentDropDown() {
var objectGoToDropDown1;
$('#span_GoToDocumentNewList').html(GoToDocumentNewList);
if ($("#category1").length == 0) {
$("#category2").mcDropdown("#categorymenu");
objectGoToDropDown1 = $("#category2").mcDropdown("#categorymenu");
objectGoToDropDown1.setText("Create Document...");
} else {
$("#category1").mcDropdown("#categorymenu");
objectGoToDropDown1 = $("#category1").mcDropdown("#categorymenu");
objectGoToDropDown1.setText("Create Document...");
}
}
/**************************************************************************************
//Author - Vikas Monga
//Purpose This function is used to populate documentcontroller information.
//Modification Details :
1) Modify by Purpose :
Mahesh Disabled SendButton except when documentstatusID is 22 */
function SetDocumentInformation(ObjectDocumentInformation) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SetDocumentInformation", "");
$("td[toolbaritem=Print] img").attr("disabled", "disabled");
//ref task# 11(Documents.Status == To Be Reviwed)
//if (ObjectDocumentInformation.DocumentStatusId == 0 && ObjectDocumentInformation.DocumentId == 0) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 0 && ObjectDocumentInformation.DocumentId == 0) {
//$('#ButtonUpload')[0].disabled = false;
}
else {
//$('#ButtonUpload')[0].disabled = true;
}
//Below if condition added by Rakesh w.r.f to task 265 Supervisor mode:- Create Document Drop Down.
if (!objectPageResponse.SupervisorMode)
CreateNewGoToDocumentDropDown(ObjectDocumentInformation.CreateDropDownNewHTML);
ReSetDocumentFrameworkControls();
SetDocumentPermission(ObjectDocumentInformation);
SetDocumentGlobalVaribales(ObjectDocumentInformation);
SetDocumentNextPreviousInformation(ObjectDocumentInformation);
SetGoToDocumentInformation(ObjectDocumentInformation);
//ref task# 11(Documents.Status == To Be Reviwed)
//Span_DocumentInformation_Status.html(ObjectDocumentInformation.DocumentStatus);
Span_DocumentInformation_Status.html(ObjectDocumentInformation.CurrentVersionStatusName);
Span_DocumentInformation_VersionList.html(ObjectDocumentInformation.VersionList); //Populate VersionList
Div_DocumentInformation_SignedBy.html(ObjectDocumentInformation.SignedBy);
Span_DocumentInformation_SignerList.html(ObjectDocumentInformation.SignerList); //Populate SignerList
Span_DocumentInformation_AcknowledgementComments.html(ObjectDocumentInformation.AcknowledgementCommentsList);
TextBox_DocumentInformation_EffectiveDate.val(ObjectDocumentInformation.DocumentEffectiveDate);
//Show author List
//ref task# 11(Documents.Status == To Be Reviwed)
// if (ObjectDocumentInformation.DocumentStatusId != 22 && ObjectDocumentInformation.DocumentStatusId != 20) {
if (ObjectDocumentInformation.CurrentVersionStatusId != 22 && ObjectDocumentInformation.CurrentVersionStatusId != 20) {
Span_DocumentInformation_AuthorList.html(ObjectDocumentInformation.AuthorList); //Populate AuthorList
$('select[id$=DropDownList_DocumentInformation_AuthorList]').val(ObjectDocumentInformation.AuthorId); //Select Document Author
// comment belwo line by Rahul Aneja on 11Mar13 to make browser generic
// img_DocumentInformation_Author.css("display", "none");
// Span_DocumentInformation_AuthorName.css("display", "none");
// Span_DocumentInformation_AuthorList.css("display", "block");
img_DocumentInformation_Author.hide();
Span_DocumentInformation_AuthorName.hide();
Span_DocumentInformation_AuthorList.show();
}
//ref task# 11(Documents.Status == To Be Reviwed)
//if (ObjectDocumentInformation.DocumentStatusId == 20) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 20) {
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.AuthorList); //Populate AuthorList
// comment belwo line by Rahul Aneja on 11Mar13 to make browser generic
// img_DocumentInformation_Author.css("display", "block");
// Span_DocumentInformation_AuthorList.css("display", "none");
// Span_DocumentInformation_AuthorName.css("display", "block");
img_DocumentInformation_Author.show();
Span_DocumentInformation_AuthorList.hide();
Span_DocumentInformation_AuthorName.show();
}
//Show author name
//ref task# 11(Documents.Status == To Be Reviwed)
// if (ObjectDocumentInformation.DocumentStatusId == 22) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 22) {
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.AuthorList); //Populate AuthorList
// comment belwo line by Rahul Aneja on 11Mar13 to make browser generic
// img_DocumentInformation_Author.css("display", "block");
// Span_DocumentInformation_AuthorList.css("display", "none");
// Span_DocumentInformation_AuthorName.css("display", "block");
img_DocumentInformation_Author.show();
Span_DocumentInformation_AuthorList.hide();
Span_DocumentInformation_AuthorName.show();
//commented by Shifali on 7Nov2011 in ref to task# 11
//purpose - as per SHS team, Send button will be enabled when DocumentShare = 'y'
// if ($('#ButtonSend').length > 0) {
// $('#ButtonSend').removeAttr("disabled"); //Enable the send button if document is signed
// }
// HideToolbarItems("Help");
}
//Open New S.note fom calender.
if (ObjectDocumentInformation.ClinicianId > 0 && ObjectDocumentInformation.KeyScreenId == 29) {
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.ClinicianName);
// comment belwo line by Rahul Aneja on 11Mar13 to make browser generic
// img_DocumentInformation_Author.css("display", "block");
//Span_DocumentInformation_AuthorList.css("display", "none");
//Span_DocumentInformation_AuthorName.css("display", "block");
img_DocumentInformation_Author.show();
Span_DocumentInformation_AuthorList.hide();
Span_DocumentInformation_AuthorName.show();
}
// AddCheck ObjectDocumentInformation.CurrentVersionStatusId != 22 w.rf to task Javed mail Send button on Documents and Ref to task 182 in 3.5x Issues
if ($('#ButtonSend').length > 0 && ObjectDocumentInformation.CurrentVersionStatusId != 22) {
$('#ButtonSend').attr("disabled", "true"); //Set the disable prop to button if document status id is not 22 Added by Mahesh S
}
//Checked/Unchecked Document share button-Start
if (ObjectDocumentInformation.DocumentShare.toUpperCase() == "Y") {
if ($('#Button_DocumentInformation_ShareDocument').length > 0) {
$('#Button_DocumentInformation_ShareDocument')[0].className = "sharechecked_btn";
}
//Added by Shifali on 7Nov2011 in ref to task# 11
//purpose - as per SHS team, Send button will be enabled when DocumentShare = 'y'
if ($('#ButtonSend').length > 0) {
$('#ButtonSend').removeAttr("disabled"); //Enable the send button if document is signed
}
//Changes by Shifali ends here
}
else {
if ($('#Button_DocumentInformation_ShareDocument').length > 0) {
$('#Button_DocumentInformation_ShareDocument')[0].className = "shareunchecked_btn";
}
}
if (ObjectDocumentInformation.DocumentType == documentTypeEnum.Image) {
SetControllerStatus(ObjectDocumentInformation, 'ImageDocument');
return;
}
if (ObjectDocumentInformation.DocumentType == documentTypeEnum.View) {
SetControllerStatus(ObjectDocumentInformation, 'ViewDocument');
return;
}
/* Philhaven Development task no 233*/
/* Added by Anto to show hide the documentcomments tool icon based on hidden field values*/
if ($("input[id$=hidden_ShowDocumentVersionComments]").val() == 'true') {
if (ObjectDocumentInformation.DocumentStatus == "Signed" && ObjectDocumentInformation.CurrentVersionStatusId != 22) {
ShowToolbarItems('DocumentComments');
}
else {
HideToolbarItems('DocumentComments');
}
}
else {
HideToolbarItems('DocumentComments');
}
/* Ends Here Philhaven Development task no 233 */
/*Move if condition on top of scan document check to disable the error icon once document marked as error - Core Bugs, 4488*/
// debugger;
if (ObjectDocumentInformation.DocumentStatusId != "22") { //Pranay
HideToolbarItems("ToDisclosure");
document.getElementById('ErrorDoc').disabled = true;
document.getElementById('ErrorDoc').className = "DisabledImageCrossBrowser";
if (ObjectDocumentInformation.DocumentStatusId == "26") {
document.getElementById('Button_DocumentInformation_ShowSignature').disabled = true;
document.getElementById('Button_DocumentInformation_ShowSignature').className = "less_detail_btn element DisabledButtonCrossBrowser";
document.getElementById('Button_DocumentInformation_View').disabled = true;
document.getElementById('Button_DocumentInformation_View').className = "less_detail_btn element DisabledButtonCrossBrowser";
}
}
else {
ShowToolbarItems("ToDisclosure");
document.getElementById('ErrorDoc').disabled = false;
document.getElementById('ErrorDoc').classList.remove("DisabledImageCrossBrowser");
}
if (ObjectDocumentInformation.DocumentType == documentTypeEnum.ScannedMedicalRecord) {
SetControllerStatus(ObjectDocumentInformation, 'ScannedMedicalRecord');
//return;
//Added following condition to allow sign of ScannedDocuments
if (ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
if (DocumentId > 0 || ObjectDocumentInformation.KeyFieldValue > 0) {
//Set Controls state incase of update WorkingMode.-Start
WorkingMode = "update";
//ButtonDelete.attr("disabled", "");
//Set Controls state incase of update WorkingMode.-End
}
}
else {
return;
}
//Ends
}
//ref task# 11(Documents.Status == To Be Reviwed)
// if (ObjectDocumentInformation.DocumentStatusId == 20) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 20) {
SetControllerStatus(ObjectDocumentInformation, 'ToDo');
if (ObjectDocumentInformation.NoteType != 0) {
ShowToolbarItems('CopyService');
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
ShowToolbarItems('ScheduleFollowup');
ShowToolbarItems('NumberOfTimesRescheduled');
}
//Function OpenURL called by Rakesh here with ref to task 542 in Sc web other billable. As when We open TODO document fron navigation if previously document was signed then in that case divShowHTMLDetail was none. So TODO document details not shown.
//OpenURL(DocumentVersionId, false);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
//commented by Shifali on 18Jan2012 in ref to not open To-Do Documents in Edit Mode, To-Do Docs will open in View/RDL MOde.
//OpenURL(InProgressDocumentVersionId, false);
//ShowToolbarItems('CopyService');
checkClientViewingStatus();
//checkPrivateWindow(); //Added By Arjun K R Task #476.01- CEI Support Go Live
//return;//commented : Task#1988 in Harbor Go Live
}
//ref task# 11(Documents.Status == To Be Reviwed)
//if (ObjectDocumentInformation.DocumentStatusId == 23) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 23) {
SetControllerStatus(ObjectDocumentInformation, 'Cancel');
checkClientViewingStatus();
//checkPrivateWindow(); //Added By Arjun K R Task #476.01- CEI Support Go Live
}
//Condition Added By Vikas Vyas in ref to Implement Service Note Architecture
if (ObjectDocumentInformation.IsServiceNote == "true") {
TextBox_DocumentInformation_EffectiveDate.attr("disabled", "true");
}
else { TextBox_DocumentInformation_EffectiveDate.attr("disabled", false); }
//Checked/Unchecked Document share button-End
//Checked/Unchecked To Sign Checkbox-Start
if (ObjectDocumentInformation.ToSign == "Y") {
if ($('#Button_DocumentInformation_ToSign').length > 0) {
$('#Button_DocumentInformation_ToSign')[0].className = "tosignchecked_btn";
}
//Modified by : Sweety Kamboj on 28 April 2010
//To disable ToSign button for proxy users
Button_DocumentInformation_ToSign.attr("disabled", "true");
}
else {
if ($('#Button_DocumentInformation_ToSign').length > 0) {
$('#Button_DocumentInformation_ToSign')[0].className = "tosignunchecked_btn";
}
}
//Checked/Unchecked To Sign Checkbox-End
//Hide or Show Signature box based on the "RequiresSignature" coulmn value.-Start
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
//Below If condition added by Rakesh for To do documents Signature controls are disabled. But EnableSignatureControls function makes it enabled
if (CurrentVersionStatusId != "20")
EnableSignatureControls();
Button_DocumentInformation_ShowSignature.show();
Button_DocumentInformation_Complete.hide();
//Modified by:Vikas Kashyap
//Date:06 Nov 2012
//Discription: What:Added one more condition For proxy staff show To sign Button, w.r.t. Task#2103 Threshold Bugs/Features
// Why:When Select Proxy user through Calander then show two button at a time(Tosign & Sign)
if (LoggedInUserId == ProxyId) {
Button_DocumentInformation_Sign.hide();
}
}
else {
Button_DocumentInformation_Sign.hide();
Button_DocumentInformation_Complete.show();
}
//Hide or Show Signature box based on the "RequiresSignature" coulmn value.-End
//commented & modified by shifali in ref to task# 11(To Be Reviewed status)
//Enable/Diable Sign button-Start
// if (ObjectDocumentInformation.SignedByAuthor == "Y") {
// //Disable the sign button if document already signer bu author
// Button_DocumentInformation_Sign.attr("disabled", "true");
// }
// else {
// Button_DocumentInformation_Sign.attr("disabled", "");
// }
if (CurrentVersionStatusId == "22" || CurrentVersionStatusId == "20" || CurrentVersionStatusId == "26") {
//Disable the sign button if document already signer bu author
Button_DocumentInformation_Sign.attr("disabled", "true");
}
else {
Button_DocumentInformation_Sign.attr("disabled", false);
}
if (ObjectDocumentInformation.MoreDetail == 'Y') {
ToggleSignatureBox();
var objRadioSigner = $("input[name$=Radio_SignerList][SignerID=" + ObjectDocumentInformation.LoggedInUserId + "]");
if (objRadioSigner.length > 0 && CurrentVersionStatusId == "22") {
objRadioSigner.attr("checked", true)
}
}
try {
// if (DocumentId <= 0) {
// if (DocumentId <= 0 && ObjectDocumentInformation.ServiceId == 0) {
if (DocumentId <= 0 && ObjectDocumentInformation.KeyFieldValue == 0) {
//Added by Vikas Vyas
//Set Controls state incase of new WorkingMode.-Start
WorkingMode = "new";
Span_DocumentInformation_Status.html("New");
ButtonDelete.attr("disabled", "true");
Button_DocumentInformation_ShareDocument.addClass('disableunchecked_btn');
//Set Controls state incase of new WorkingMode.-End
}
else {
//Set Controls state incase of update WorkingMode.-Start
WorkingMode = "update";
ButtonDelete.attr("disabled", false);
//Set Controls state incase of update WorkingMode.-End
}
if (WorkingMode == "new") {
Button_DocumentInformation_View.attr("disabled", "true");
Button_DocumentInformation_View.val('View');
HideToolbarItems("Help");
}
// Code Added by Karan// Condition for To do Document
// Ref task #12 Threshold Dev Phase II
// Dated 14 Dec 2011
else if (CurrentVersionStatusId == 20) {
if (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) {
}
else {
// Enable / Disable Button
// Code Added by Karan
// Purpose : Check from db to enable disable the edit button
// Ref task #12 Threshold Dev Phase II
if (ObjectDocumentInformation.PreventNewVersion == 0)
Button_DocumentInformation_View.attr("disabled", "true");
else if (ObjectDocumentInformation.PreventNewVersion == 1) {
// Below If condtion is added by Rakesh to disable Edit button in case of Supervisor mode is on Ref to task 939 in SCwebphaseII bugs/Features
if (objectPageResponse.SupervisorMode)
Button_DocumentInformation_View.attr("disabled", "true");
else
Button_DocumentInformation_View.attr("disabled", false);
}
}
// Code Added by Karan
// Purpose : Check from db to enable disable the edit button
// Ref task #12 Threshold Dev Phase II
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentMode == 'view') {
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
}
else if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentMode == 'edit') {
Button_DocumentInformation_View.attr("mode", "view");
Button_DocumentInformation_View.val('View');
}
// Code Added By Karan till here
}
else if (CurrentVersionStatusId == 21) {
if (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) {
Button_DocumentInformation_View.attr("disabled", false);
Button_DocumentInformation_View.attr("mode", "view");
Button_DocumentInformation_View.val('View');
}
else {
Button_DocumentInformation_View.attr("disabled", "true");
Button_DocumentInformation_View.val('Edit');
// Enable / Disable Button
// Code Added by Karan
// Purpose : Check from db to enable disable the edit button
// Ref task #12 Threshold Dev Phase II
if (ObjectDocumentInformation.PreventNewVersion == 0)
Button_DocumentInformation_View.attr("disabled", "true");
else if (ObjectDocumentInformation.PreventNewVersion == 1) {
// Below If condtion is added by Rakesh to disable Edit button in case of Supervisor mode is on Ref to task 939 in SCwebphaseII bugs/Features
if (objectPageResponse.SupervisorMode)
Button_DocumentInformation_View.attr("disabled", "true");
else
Button_DocumentInformation_View.attr("disabled", false);
}
}
// Code Added by Karan
// Purpose : Check from db to enable disable the edit button
// Ref task #12 Threshold Dev Phase II
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentMode == 'view') {
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
}
else if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentMode == 'edit') {
Button_DocumentInformation_View.attr("mode", "view");
Button_DocumentInformation_View.val('View');
}
// Code Added By Karan till here
//Condtion Added by Vikas Vyas in ref to implement Service Note Architecture
if (DocumentId <= 0 && ObjectDocumentInformation.KeyFieldValue > 0) {
// Button_DocumentInformation_View.attr("disabled", "true");
// Button_DocumentInformation_View.val('View');
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.AuthorList); //Populate AuthorList
img_DocumentInformation_Author.css("display", "block");
Span_DocumentInformation_AuthorList.css("display", "none");
Span_DocumentInformation_AuthorName.css("display", "block");
}
//End
}
//ref task# 11(Documents.Status == To Be Reviwed)
// else if (DocumentStatusId == 22) //22-Signed/complete document
else if (CurrentVersionStatusId == 22 || CurrentVersionStatusId == 26) //22-Signed/complete documen ///Pranay
{
$('#Button_DocumentInformation_ShareDocument').addClass('disablechecked_btn');
//Below Code commented By Rakesh With ref to task 137 in SC web phase II bugs TO support button edit/View - enable & disable based on sp scsp_SCDocumentPreventNewVersion as we are setting value in ObjectDocumentInformation.PreventNewVersion . To support multi staff edit functionality.
// if (RequiresSignature != 'Y') {
// Button_DocumentInformation_View.attr("disabled", "true");
// Button_DocumentInformation_View.attr("mode", "edit");
// Button_DocumentInformation_View.val('Edit');
// }
// else if (DocumentLatestVersion == DocumentVersion && (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId)) {
// Button_DocumentInformation_View.attr("disabled", "");
// Button_DocumentInformation_View.attr("mode", "edit");
// Button_DocumentInformation_View.val('Edit');
// }
// else {
// Button_DocumentInformation_View.attr("disabled", "true");
// Button_DocumentInformation_View.val('Edit');
// }
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
//Below code Commented by Rakesh wrf to task 137 to support completed events
// if (RequiresSignature != 'Y') {
// Button_DocumentInformation_View.attr("disabled", "true");
// Button_DocumentInformation_View.attr("mode", "edit");
// Button_DocumentInformation_View.val('Edit');
// }
//else
if (DocumentLatestVersion == DocumentVersion && (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId)) {
Button_DocumentInformation_View.attr("disabled", false);
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
}
else {
//Below if condition added By Rakesh With ref to task 137 in SC web phase II bugs TO support button edit/View - enable & disable based on sp scsp_SCDocumentPreventNewVersion as we are setting value in ObjectDocumentInformation.PreventNewVersion . To support multi staff edit functionality.
if (ObjectDocumentInformation.PreventNewVersion == 0)
Button_DocumentInformation_View.attr("disabled", "true");
else if (ObjectDocumentInformation.PreventNewVersion == 1) {
// Below If condtion is added by Rakesh to disable Edit button in case of Supervisor mode is on Ref to task 939 in SCwebphaseII bugs/Features
if (objectPageResponse.SupervisorMode)
Button_DocumentInformation_View.attr("disabled", "true");
else
Button_DocumentInformation_View.attr("disabled", "");
}
Button_DocumentInformation_View.val('Edit');
}
//Code changed end here
}
//Handle ToSign,Sign,complete button functionality
if (WorkingMode == "new") {
Button_DocumentInformation_ToSign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
//$('#Table_DocumentInformation_Signature').show();
EnableSignatureControls();
Button_DocumentInformation_ShowSignature.show();
Button_DocumentInformation_Complete.hide();
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Sign.hide();
Button_DocumentInformation_Complete.attr("disabled", false)
// $('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
//ref task# 11(Documents.Status == To Be Reviwed)
// else if (DocumentStatusId == "21")//Inprogress mode
else if (CurrentVersionStatusId == "21")//Inprogress mode
{
if (LoggedInUserId == AuthorId) {
//Inprogress mode- Author =Logged in user
//Disable To sign
//Enable Sign button if RequiresSignature == "Y"
//Enable Complete button if RequiresSignature == "N"
Button_DocumentInformation_ToSign.hide();
$('#ButtonDelete').attr("disabled", false);
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_Sign.attr("disabled", false);
//$('#Table_DocumentInformation_Signature').show();
//Condtion Added by Vikas Vyas in ref to implement Service Note Architecture
// if (DocumentId <= 0 && ObjectDocumentInformation.ServiceId > 0) {
if (DocumentId <= 0 && ObjectDocumentInformation.KeyFieldValue == 0) {
DisableSignatureControls();
} //End
else {
EnableSignatureControls();
}
Button_DocumentInformation_ShowSignature.show();
Button_DocumentInformation_Complete.hide();
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "");
Button_DocumentInformation_Sign.hide();
// $('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
else if (LoggedInUserId == ProxyId) {
//Inprogress mode- Logged in user =Proxy user od the document
//Enable "Tosign" button
//Hide Sign button
//Hide Complete
//Open document in view mode.
if (ObjectDocumentInformation.ToSign == "Y") {
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
}
$('#ButtonDelete').attr("disabled", "true");
Button_DocumentInformation_ToSign.show();
//Modified by Sweety Kamboj on 30April 2010
if (ObjectDocumentInformation.ToSign == "Y") {
$('#Button_DocumentInformation_ToSign')[0].className = "tosignchecked_btn";
Button_DocumentInformation_ToSign.attr("disabled", "true");
}
else {
$('#Button_DocumentInformation_ToSign')[0].className = "tosignunchecked_btn";
Button_DocumentInformation_ToSign.attr("disabled", false);
}
Button_DocumentInformation_Complete.hide();
Button_DocumentInformation_Sign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
//$('#Table_DocumentInformation_Signature').show();
//$('#Button_DocumentInformation_ShowSignature').show();
//By Vikas Vyas in ref to Implement Service Note Architecture
//if (DocumentId <= 0 && ObjectDocumentInformation.ServiceId > 0) {
if (DocumentId <= 0 && ObjectDocumentInformation.KeyFieldValue == 0) {
DisableSignatureControls();
}
else {
EnableSignatureControls();
}
}
else {
// $('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
else {
//Inprogress mode- Logged in user =Staff user of the document
//Hide "Tosign" button
//show Disabled Sign button if RequiresSignature == "Y"
//show Disabled complete button if RequiresSignature == "N"
Button_DocumentInformation_ToSign.hide();
$('#ButtonDelete').attr("disabled", "true");
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_Sign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
//$('#Table_DocumentInformation_Signature').show();
EnableSignatureControls();
Button_DocumentInformation_ShowSignature.show();
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "true");
Button_DocumentInformation_Sign.hide();
// $('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
}
//ref task# 11(Documents.Status == To Be Reviwed)
// else if (DocumentStatusId == "22") //signed or completed document
else if (CurrentVersionStatusId == "22" || CurrentVersionStatusId == "26") //signed or completed document //Pranay
{
$('#ButtonDelete').attr("disabled", "true");
if (LoggedInUserId == AuthorId) {
//signed or completed mode-Logged in user =auhor of the document
//Hide "Tosign" button
//Show disabled Sign button if RequiresSignature == "Y"
//show disabled complete button if RequiresSignature == "N"
Button_DocumentInformation_ToSign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_Sign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
//$('#Table_DocumentInformation_Signature').show();
Button_DocumentInformation_ShowSignature.show();
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "true");
Button_DocumentInformation_Sign.hide();
//$('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
else if (LoggedInUserId == ProxyId) {
//signed or completed mode-Logged in user =proxy of the document
//show disabled "Tosign" button.
//Hide Sign and complete
Button_DocumentInformation_ToSign.show();
Button_DocumentInformation_ToSign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
Button_DocumentInformation_Sign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
// $('#Table_DocumentInformation_Signature').show();
//$('#Button_DocumentInformation_ShowSignature').show();
}
else {
// $('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
else {
//signed or completed mode- Logged in user =Staff user of the document
//Hide "Tosign" button
//show Disabled Sign button if RequiresSignature == "Y"
//show Disabled complete button if RequiresSignature == "N"
Button_DocumentInformation_ToSign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_Sign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
// $('#Table_DocumentInformation_Signature').show();
//$('#Button_DocumentInformation_ShowSignature').show();
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "true");
Button_DocumentInformation_Sign.hide();
//$('#Table_DocumentInformation_Signature').hide();
DisableSignatureControls();
// $('#Button_DocumentInformation_ShowSignature').hide();
}
}
}
//added by shifali in ref to task# 11(To Be Reviewed - documents.currentversionstatus)
//purpose - Setting document controller buttons when == 25
else if (CurrentVersionStatusId == 25) //25-To Be Reviewed document
{
Button_DocumentInformation_ShareDocument.addClass('disablechecked_btn');
Button_DocumentInformation_ShareDocument.attr("disabled", "true");
if (RequiresSignature != 'Y') {
Button_DocumentInformation_View.attr("disabled", "true");
Button_DocumentInformation_View.attr("mode", "edit");
Button_DocumentInformation_View.val('Edit');
}
else if (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) {
Button_DocumentInformation_View.attr("disabled", "");
Button_DocumentInformation_View.attr("mode", "view");
Button_DocumentInformation_View.val('View');
ButtonDelete.removeAttr("disabled");
}
else {
Button_DocumentInformation_View.attr("disabled", "true");
Button_DocumentInformation_View.val('Edit');
ButtonDelete.attr("disabled", "true");
}
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.AuthorList); //Populate AuthorList
img_DocumentInformation_Author.css("display", "block");
Span_DocumentInformation_AuthorList.css("display", "none");
Span_DocumentInformation_AuthorName.css("display", "block");
}
//If document open from unsaved changes with new status.Start
if (ObjectDocumentInformation.InProgressDocumentVersionId <= 0 && ObjectDocumentInformation.AuthorId != ObjectDocumentInformation.LoggedInUserId) {
SetAuthorToolbarButtonsForNewInstance(ObjectDocumentInformation.RequiresSignature);
}
if (ObjectDocumentInformation.KeyFieldValue == 0 && (ObjectDocumentInformation.NoteType == -1 || ObjectDocumentInformation.NoteType == -2) && ObjectDocumentInformation.AuthorId != ObjectDocumentInformation.LoggedInUserId) {
SetAuthorToolbarButtonsForNewInstance(ObjectDocumentInformation.RequiresSignature);
}
//-End
//if (ObjectDocumentInformation.IsServiceNote == "true") {
if (ObjectDocumentInformation.NoteType == -1) {
img_DocumentInformation_EffectiveDate.attr("disabled", "true");
ShowToolbarItems('CopyService');
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
ShowToolbarItems('ScheduleFollowup');
ShowToolbarItems('NumberOfTimesRescheduled');
}
//Modified by Sweety Kamboj on 12 April 2010
else if (ObjectDocumentInformation.NoteType == -2) {
img_DocumentInformation_EffectiveDate.attr("disabled", "true");
ShowToolbarItems('CopyService');
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
ShowToolbarItems('ScheduleFollowup');
ShowToolbarItems('NumberOfTimesRescheduled');
}
else {
HideToolbarItems('CopyService');
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
HideToolbarItems('ScheduleFollowup');
HideToolbarItems('NumberOfTimesRescheduled');
}
EnableDisableAuthorList();
SetSummaryofCareToolbar(ObjectDocumentInformation)
//Disable edit/view button for scanned documents:Maninder
if (ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
Button_DocumentInformation_View.attr('disabled', true);
}
//ends
//Added by Pranay on 07/03 in ref Harbor857# (ObjectDocumentInformation.CurrentVersionStatusId=="26" && Action=="")
if (ObjectDocumentInformation.DocumentMode == "view" || (ObjectDocumentInformation.CurrentVersionStatusId == "26" && (objectPageResponse.Action == "" || objectPageResponse.Action == pageActionEnum.NextDocument || objectPageResponse.Action == pageActionEnum.PreviousDocument))) {
RegenratePdf = 'yes';
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, true);
//if (ObjectDocumentInformation.DocumentStatusId == 22) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 22) {
// if (ObjectDocumentInformation.DocumentStatusId == 22 && objectPageResponse.Action=="update") {
//Commented By : Swapan Mohan
//Purpose : As per Task #125 3.5x Issues to avoid multiple request to ReportViewer.aspx.cs and avoid multiple times ssp execution.
//gereratepdfaftersign();
// var myDate = new Date();j
// $.post(GetRelativePath() + "ReportViewer.aspx?ReportType=gereratepdfaftersign&DocumentVersionId=" + objectPageResponse.ObjectDocumentInformation.DocumentVersionId, 'time=' + myDate.getMinutes() + myDate.getSeconds());
}
}
else {
// OpenURL(DocumentVersionId, false);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
//OpenURL(InProgressDocumentVersionId, false);
//Added condition : Maninder
if (ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
OpenURL(InProgressDocumentVersionId, true);
}
else if (ObjectDocumentInformation.KeyScreenId == 29 && (objectPageResponse.Action == pageActionEnum.NextDocument || objectPageResponse.Action == pageActionEnum.PreviousDocument)) {
openedDocumentVersionId = InProgressDocumentVersionId;
OpenURL(openedDocumentVersionId, false);
}
else {
if (CurrentVersionStatusId != "20")
OpenURL(InProgressDocumentVersionId, false);
else {
openedDocumentVersionId = InProgressDocumentVersionId;
}
}
}
//if (ObjectDocumentInformation.IsServiceNote == "true") {
if (ObjectDocumentInformation.NoteType == -1 || ObjectDocumentInformation.NoteType == -2) {
TextBox_DocumentInformation_EffectiveDate.attr("disabled", "true");
}
//Check if document code status is 'N' Disable all the action.
//And open the document in View Mode
//Vikas Monga
if (ObjectDocumentInformation.DocumentCodeActive == 'N') {
SetControllerStatus(ObjectDocumentInformation, 'DcoumentCodeInactive');
}
//Check Client Status. If Active='Y' Disable the new button
if (ObjectDocumentInformation.ClientStatus == 'N') {
//
ButtonNew.attr("disabled", "true");
//
}
//Changes to Implement general functionality for Services and Events
if (NoteType == -1) {
EnableDisableCopyService(objectPageResponse, "Services", "ServiceId", -1);
}
if (NoteType == -2) {
EnableDisableCopyService(objectPageResponse, "Events", "EventId", -2);
}
checkClientViewingStatus();
checkPrivateWindow(); //Added By Arjun K R Task #476.01- CEI Support Go Live
//Check SuperVisorMode if its on open the document in view mode
var SMServiceId = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', DocumentId, 'ServiceId', AutoSaveXMLDom);
var SupervisorModeServiceId = GetColumnValueInXMLNodeByKeyValue('Services', 'ServiceId', SMServiceId, 'Status', AutoSaveXMLDom)
if (SuperVisorModeOn && SupervisorModeServiceId != 72 && SupervisorModeServiceId != 73) {
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, true);
}
//
//ref task# 11(Documents.Status == To Be Reviwed)
//purpose - added one new parameter 'ReviewerId'
//DisableFrameWorkControlBasedonDocumentStatus(DocumentStatusId, AuthorId, LoggedInUserId, ProxyId,ReviewerId);
DisableFrameWorkControlBasedonDocumentStatus(CurrentVersionStatusId, AuthorId, LoggedInUserId, ProxyId, ReviewerId);
//Following condition added to PreventNewVersion ba
//Modified by Sweety Kamboj on 20 May 2010
//Change DocumentStatus to DocumentStatusId
//if (ObjectDocumentInformation.DocumentStatusId == 20 || ObjectDocumentInformation.DocumentStatusId == 21 || ObjectDocumentInformation.DocumentStatusId == 22) {
if (ObjectDocumentInformation.CurrentVersionStatusId == 20 || ObjectDocumentInformation.CurrentVersionStatusId == 21 || ObjectDocumentInformation.CurrentVersionStatusId == 22 || ObjectDocumentInformation.CurrentVersionStatusId == 26) {
if (ObjectDocumentInformation.PreventNewVersion == 0)
Button_DocumentInformation_View.attr("disabled", "true");
}
else if (ObjectDocumentInformation.DocumentStatusId == 21)//this condition is imposed by Pradeep tas per task#263(Sc Web Phase II Bugs and Feature) to enable view mode for in progress documents
{
if (LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) {
Button_DocumentInformation_View.attr("disabled", "");
Button_DocumentInformation_View.attr("mode", "view");
Button_DocumentInformation_View.val('View');
}
else {
Button_DocumentInformation_View.attr("disabled", "true");
Button_DocumentInformation_View.val('Edit');
}
}
//Added by Maninder: to disable delete button if Signed
if (ObjectDocumentInformation.DocumentStatusId == "22" || ObjectDocumentInformation.DocumentStatusId == "26") {
$('#ButtonDelete').attr("disabled", true);
if (objectPageResponse.EnableDeleteButtonAfterSign == 'Y') { $('#ButtonDelete').removeAttr("disabled"); }
}
if (ObjectDocumentInformation.DocumentStatusId != "22" && ObjectDocumentInformation.OnlyAvailableOnline == 'N') {
$("#ButtonUpload").removeAttr("disabled");
}
//Maninder: Commented below lines for task#842 in Threshold Bugs/Feature
// else {
// $('#ButtonDelete').attr("disabled", false);
// }
$('#Button_DocumentInformation_View').attr("ViewMode", "N");
// Created function to disable the button for the View only permission
DisableButtonforViewMode();
//Logic For Enabling 'O' Icon
var ServiceIDMovedFrom = $('input[id$=HiddenFieldServiceIDMovedFrom]').val();
var DocuementIdMovedFrom = $('input[id$=HiddenFieldDocumentIdMovedFrom]').val();
var ScreenIdMovedFrom = $('input[id$=HiddenFieldScreenIdMovedFrom]').val();
if (ServiceIDMovedFrom > 0) {
$("#ImgOrginalNote").removeAttr("disabled");
$("#ImgOrginalNote").attr('onClick', 'OpenOldNote(' + ServiceIDMovedFrom + ',' + DocuementIdMovedFrom + ',' + ScreenIdMovedFrom + ')');
}
// Added By Sachin
if (AutoSaveXMLDom[0] != "" && AutoSaveXMLDom[0] != undefined && AutoSaveXMLDom[0].childNodes[0].selectNodes("DocumentVersions").length > 0) {
if (AutoSaveXMLDom[0].childNodes[0].selectNodes("DocumentVersions")[0].selectSingleNode("DocumentVersionId") != null) {
if (ObjectDocumentInformation.VersionAuthorToSign == 'Y' && editClick == true && AutoSaveXMLDom[0].childNodes[0].selectNodes("DocumentVersions")[0].selectSingleNode("Version").text >= 1 && CurrentVersionStatusId == '21') {
Button_DocumentInformation_Sign.attr("disabled", false);
}
}
}
// END
}
catch (ex) {
alert(ex);
}
}
function OpenOldNote(serviceId, DocumentId, DocumentScreenId) {
try {
if (serviceId > 0) { //If screen id is not found
OpenPage(5763, 29, "keyscreenid=29^TabId=2^keyfieldvalue=" + DocumentScreenId + "^DocumentId=" + DocumentId + "^MoreDetail=N", 2, GetRelativePath());
}
else {//If scren id is found
OpenPage(5763, DocumentScreenId, "DocumentId=" + DocumentId + "^MoreDetail=N", 2, GetRelativePath());
}
}
catch (err) { }
}
///Author : Mahesh S
///Created On 13, July,2010
///Description : This fuction is used to call the setClientViewingControl from application common fucuntion's js
/// for setting the controls according to client viewing mode.
function checkClientViewingStatus() {
try {
if (IsNotClientViewingMode) {
// setClientViewingControl("F") No need to call this function if client viwing is off
}
else {
setClientViewingControl("Y")
}
}
catch (err) {
}
}
//end of Call function set Cliet Viwing
function ReSetDocumentFrameworkControls() {
ButtonNew = $('#ButtonNew');
ButtonUpdate = $('#ButtonUpdate');
ButtonValidate = $('#ButtonValidate'); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
ButtonDelete = $('#ButtonDelete');
Span_DocumentInformation_PreviousDocumentDate = $('#Span_DocumentInformation_PreviousDocumentDate');
Span_DocumentInformation_PreviousDocumentSeprator = $('#Span_DocumentInformation_PreviousDocumentSeprator');
Span_DocumentInformation_PreviousDocumentName = $('#Span_DocumentInformation_PreviousDocumentName');
Button_DocumentInformation_PreviousDocument = $('#Button_DocumentInformation_PreviousDocument');
Button_DocumentInformation_NextDocument = $('#Button_DocumentInformation_NextDocument');
Span_DocumentInformation_NextDocumentDate = $('#Span_DocumentInformation_NextDocumentDate');
Span_DocumentInformation_NextDocumentSeprator = $('#Span_DocumentInformation_NextDocumentSeprator');
Span_DocumentInformation_NextDocumentName = $('#Span_DocumentInformation_NextDocumentName');
Span_DocumentInformation_GoToDocumentList = $('#Span_DocumentInformation_GoToDocumentList');
Button_DocumentInformation_Sign = $('#Button_DocumentInformation_Sign');
Button_DocumentInformation_ToSign = $('#Button_DocumentInformation_ToSign');
Button_DocumentInformation_Complete = $('#Button_DocumentInformation_Complete');
Button_DocumentInformation_View = $('#Button_DocumentInformation_View');
Button_DocumentInformation_ShareDocument = $('#Button_DocumentInformation_ShareDocument');
Span_DocumentInformation_Status = $('#Span_DocumentInformation_Status');
TextBox_DocumentInformation_EffectiveDate = $('#TextBox_DocumentInformation_EffectiveDate');
img_DocumentInformation_EffectiveDate = $('#img_DocumentInformation_EffectiveDate');
Span_DocumentInformation_AuthorList = $('#Span_DocumentInformation_AuthorList');
Span_DocumentInformation_AuthorName = $('#Span_DocumentInformation_AuthorName');
img_DocumentInformation_Author = $('#img_DocumentInformation_Author');
Button_DocumentInformation_ShowSignature = $('#Button_DocumentInformation_ShowSignature');
Table_DocumentInformation_Signature = $('#Table_DocumentInformation_Signature');
Span_DocumentInformation_VersionList = $('#Span_DocumentInformation_VersionList');
Div_DocumentInformation_SignedBy = $('#Div_DocumentInformation_SignedBy');
DropDownList_DocumentInformation_SignerList = $("select[id$=DropDownList_DocumentInformation_SignerList]");
Button_DocumentInformation_Signer = $('#Button_DocumentInformation_Signer');
Button_DocumentInformation_Decline = $('#Button_DocumentInformation_Decline');
Span_DocumentInformation_SignerList = $('#Span_DocumentInformation_SignerList');
Span_DocumentInformation_AcknowledgementComments = $('#Span_DocumentInformation_AcknowledgementComments');
DropDownList_DocumentInformation_AuthorList = $('select[id$=DropDownList_DocumentInformation_AuthorList]');
//added by Shifali to initialize controls(in ref to task# 11 To be Reviewed)
Button_DocumentInformation_MetaData = $("#Button_DocumentInformation_MetaData");
// ButtonNew.attr("disabled", false); Modified by SuryaBalan wrf 491 Corebugs Bug-Employment LIfe Event on 3-Mar-2014
// ButtonUpdate.attr("disabled", false);
ButtonValidate.attr("disabled", false); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
ButtonDelete.attr("disabled", false);
Span_DocumentInformation_PreviousDocumentDate.html("");
Span_DocumentInformation_PreviousDocumentSeprator.html("");
Span_DocumentInformation_PreviousDocumentName.html("");
Button_DocumentInformation_PreviousDocument.attr("disabled", false)
Button_DocumentInformation_NextDocument.attr("disabled", false)
Span_DocumentInformation_NextDocumentDate.html("");
Span_DocumentInformation_NextDocumentSeprator.html("");
Span_DocumentInformation_NextDocumentName.html("");
Span_DocumentInformation_GoToDocumentList.html("");
Button_DocumentInformation_Sign.hide();
Button_DocumentInformation_ToSign.hide();
Button_DocumentInformation_Complete.hide();
Button_DocumentInformation_View.show();
Button_DocumentInformation_ShareDocument.show();
Button_DocumentInformation_ShareDocument.attr("disabled", false);
Span_DocumentInformation_Status.html("");
TextBox_DocumentInformation_EffectiveDate.val("");
img_DocumentInformation_EffectiveDate.attr("disabled", false);
TextBox_DocumentInformation_EffectiveDate.attr("disabled", false)
Span_DocumentInformation_AuthorList.html("");
Span_DocumentInformation_AuthorList.attr("disabled", false)
Span_DocumentInformation_AuthorName.html("");
//img_DocumentInformation_Author
// Button_DocumentInformation_ShowSignature
// Table_DocumentInformation_Signature
Span_DocumentInformation_VersionList.html("");
Div_DocumentInformation_SignedBy.html("");
// DropDownList_DocumentInformation_SignerList
Button_DocumentInformation_Signer.attr("disabled", false);
Button_DocumentInformation_Decline.attr("disabled", false);
Button_DocumentInformation_Sign.attr("disabled", false);
Button_DocumentInformation_ToSign.attr("disabled", false);
DropDownList_DocumentInformation_SignerList.attr("disabled", false);
Button_DocumentInformation_Decline.attr("disabled", false);
Button_DocumentInformation_ShowSignature.attr("disabled", false);
Span_DocumentInformation_SignerList.html("");
Span_DocumentInformation_AcknowledgementComments.html("");
// EnableSignatureControls();
//Added by Daman
//Enable/Disable Acknowledgements Tool Buttons
XmlDoc = $.xmlDOM(objectPageResponse.ScreenDataSetXml);
if ($('#CommentsUpdate').length > 0 && $('#AcknowledgmentUdpate').length > 0) {
if (XmlDoc[0].childNodes[0].selectNodes("DocumentVersions").length > 0 && XmlDoc[0].childNodes[0].selectNodes("DocumentVersions")[0].selectNodes("DocumentAcknowledgementRequired").length > 0)
EnableDocumentsAcknowledgementsTools = XmlDoc[0].childNodes[0].selectNodes("DocumentVersions")[0].selectNodes("DocumentAcknowledgementRequired")[0].text.trim();
else
EnableDocumentsAcknowledgementsTools = "false";
if (EnableDocumentsAcknowledgementsTools == "true") {
$('#CommentsUpdate').attr('disabled', false);
$('#AcknowledgmentUdpate').attr('disabled', false);
}
else {
$('#CommentsUpdate').attr('disabled', true);
$('#AcknowledgmentUdpate').attr('disabled', true);
}
}
// Code Added By Karan *****
// Purpose : Show hide the KeyPhrases icon on basis of pageresponse
// Dated : 24 Nov 2011
// if (objectPageResponse.UseKeyPhrases) {
// ShowToolbarItems('AddPhrases');
// ShowToolbarItems('FavoritePhrases');
// }
// else {
// HideToolbarItems('AddPhrases');
// HideToolbarItems('FavoritePhrases');
// }
// //Added By Rahul Aneja for Help URL functionality
// if (objectPageResponse.HelpURL != null && objectPageResponse.HelpURL != "") {
// ShowToolbarItems('HelpURL');
// // ShowToolbarItems('FavoritePhrases');
// }
// else {
// HideToolbarItems('HelpURL');
// // HideToolbarItems('FavoritePhrases');
// }
//**********************
ManageDocumentToolbarItems();
}
function SetControllerStatus(ObjectDocumentInformation, Status) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SetControllerStatus", "Status - " + isNullORUndefined(Status) + "");
//Common Disable controls
ButtonUpdate.attr("disabled", "true");
ButtonValidate.attr("disabled", "true"); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
ButtonDelete.attr("disabled", "true");
//Added by Maninder
if (ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
enableUpdateButton();
}
else {
ButtonUpdate.attr("disabled", "true");
}
//Ends
Button_DocumentInformation_ToSign.hide();
Button_DocumentInformation_Sign.hide();
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "true");
//Added by Maninder
if (ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
Button_DocumentInformation_Complete.attr("disabled", "true");
}
else {
Button_DocumentInformation_Complete.attr("disabled", "true");
}
//ends
Button_DocumentInformation_View.attr("disabled", "true");
img_DocumentInformation_EffectiveDate.attr("disabled", "true");
TextBox_DocumentInformation_EffectiveDate.attr("disabled", "true");
Button_DocumentInformation_ShareDocument.attr("disabled", "true");
//Show author List
//if (ObjectDocumentInformation.DocumentStatusId != 22) {
if (ObjectDocumentInformation.CurrentVersionStatusId != 22) {
Span_DocumentInformation_AuthorList.attr("disabled", "true");
}
if (LoggedInUserId == ProxyId) //Show ToSign button in disable mode
{
Button_DocumentInformation_ToSign.show();
Button_DocumentInformation_ToSign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
Button_DocumentInformation_Sign.hide();
}
else {
//Show Sign/Complete button in disable mode
Button_DocumentInformation_ToSign.hide();
if (ObjectDocumentInformation.RequiresSignature == "Y") {
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_Sign.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
//Added by Maninder
if (ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
Button_DocumentInformation_Sign.attr("disabled", false);
}
else {
Button_DocumentInformation_Sign.attr("disabled", "true");
}
}
else {
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_Complete.attr("disabled", "true");
Button_DocumentInformation_Sign.hide();
//Added by Maninder
if (ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
Button_DocumentInformation_Complete.attr("disabled", false);
}
else {
Button_DocumentInformation_Complete.attr("disabled", "true");
}
//Ends
}
//Below If statement added by Rakesh w.rf. to task 344 in SC web phase II bugs/Features 9.8 - Allow Document Signatures for DocumentType = 12
if (ObjectDocumentInformation.AuthorId == LoggedInUserId && ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 12) {
Button_DocumentInformation_Sign.attr("disabled", false);
}
//Changes end here
}
//DisableSignatureControls();
switch (Status) {
case "ImageDocument":
DisableSignatureControls();
ButtonNew.attr("disabled", "true");
ImageDocumentIndex = ObjectDocumentInformation.ImageDocumentIndex;
ImageDocumentCount = ObjectDocumentInformation.ImageDocumentCount;
Button_ImageDocument_PreviousDocument = $('#Button_ImageDocument_PreviousDocument');
Button_ImageDocument_NextDocument = $('#Button_ImageDocument_NextDocument');
Span_ImageDocument_PagingInformation = $('#Span_ImageDocument_PagingInformation');
Span_ImageDocument_ErrorMessage = $('#Span_ImageDocument_ErrorMessage');
SetImageDocumentNavigationImages();
break;
case "ScannedMedicalRecord":
DisableSignatureControls();
ButtonNew.attr("disabled", "true");
//OpenScannedMedicalRecord(DocumentVersionId);
//Added by Maninder
if (ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) {
Button_DocumentInformation_Sign.attr('disabled', false);
EnableSignatureControls();
}
else
Button_DocumentInformation_Sign.attr('disabled', true);
//Ends
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
if ((ObjectDocumentInformation.DocumentStatusId == 21 && ObjectDocumentInformation.DocumentType == 17 && ObjectDocumentInformation.ReviewFormId > 0) == false) {
OpenURL(InProgressDocumentVersionId, true);
}
break;
case "ToDo":
DisableSignatureControls();
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.Author); //Populate AuthorList
img_DocumentInformation_Author.css("display", "block");
Span_DocumentInformation_AuthorList.css("display", "none");
Span_DocumentInformation_AuthorName.css("display", "block");
//Condition Added By Vikas Vyas in ref to Implement #Task #879
if (ObjectDocumentInformation.NoteType == -1 || ObjectDocumentInformation.NoteType == -2) {
enableUpdateButton();
ButtonValidate.attr("disabled", false); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
ButtonDelete.attr("disabled", false);
}
if (ObjectDocumentInformation.KeyScreenId != 29 && ObjectDocumentInformation.KeyScreenId != 32) {
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, true);
}
break;
case "Cancel":
DisableSignatureControls();
Span_DocumentInformation_AuthorName.html(" " + ObjectDocumentInformation.Author); //Populate AuthorList
img_DocumentInformation_Author.css("display", "block");
Span_DocumentInformation_AuthorList.css("display", "none");
Span_DocumentInformation_AuthorName.css("display", "block");
break;
case "DcoumentCodeInactive":
DisableSignatureControls();
ButtonNew.attr("disabled", "true");
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, true);
//$('#ImgButtonMove').attr("disabled", "true");
DisableToolbarItem("Move");
break;
case "ViewDocument":
// Added by Daman ref: #Task #816 Document Cosigning - Not brought to the signature
if (ObjectDocumentInformation.MoreDetail == 'Y') {
ToggleSignatureBox();
var objRadioSigner = $("input[name$=Radio_SignerList][SignerID=" + ObjectDocumentInformation.LoggedInUserId + "]");
if (objRadioSigner.length > 0) {
objRadioSigner.attr("checked", true)
}
}
WorkingMode = "update";
ButtonNew.attr("disabled", "true");
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, true);
gereratepdfaftersign();
//$('#ImgButtonMove').attr("disabled", "true");
DisableToolbarItem("Move");
//changes by shifali in ref to task# To Be Reviewed Status - Replace Status with CurrentVersionStatus
//DisableFrameWorkControlBasedonDocumentStatus(DocumentStatusId, AuthorId, LoggedInUserId, ProxyId);
DisableFrameWorkControlBasedonDocumentStatus(CurrentVersionStatusId, AuthorId, LoggedInUserId, ProxyId);
break;
}
}
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose Handle signature box state(Show/Hide).
function ToggleSignatureBox() {
//var mode = $("[id='" + 'Button_DocumentInformation_View' + "']")[0].value;
var mode = $("#Button_DocumentInformation_View").val();
var table_DocumentInformation_Signature = $('#Table_DocumentInformation_Signature');
var table_DocumentInformation_Acknowledgement = $('#Table_DocumentInformation_Acknowledgement');
var button_DocumentInformation_ShowSignature = $('#Button_DocumentInformation_ShowSignature');
var frameHeightToResize = 0;
//if ($('#Table_DocumentInformation_Signature')[0].style.display == 'block') {
// if (table_DocumentInformation_Signature.css('display') == 'block' || table_DocumentInformation_Acknowledgement.css('display') == 'block') {
if (table_DocumentInformation_Signature.is(':visible') == true || table_DocumentInformation_Acknowledgement.is(':visible') == true) {
// table_DocumentInformation_Signature.css('display', 'none');
// table_DocumentInformation_Acknowledgement.css('display', 'none');
table_DocumentInformation_Signature.hide();
table_DocumentInformation_Acknowledgement.hide();
button_DocumentInformation_ShowSignature.val("More Detail");
// $('#DocumentContents_ContentPlaceHolder_Middle')[0].style.height = '290px';
if (mode.toLowerCase() == 'edit') {
var frameHeight = (($(document).height() * 50) / 100);
$('#iFrameOpenURL').css('height', frameHeight);
frameHeightToResize = frameHeight;
// var i = 0
// for (i = 0; i <= document.frames.length - 1; i++) {
// if (document.frames[i].name == "iFrameOpenURL") {
// if (document.frames[i].document.getElementById("divReportViewer") != null)
// document.frames[i].document.getElementById("divReportViewer").style.height = '275px'
// }
// }
}
}
else {
button_DocumentInformation_ShowSignature.val("Less Detail");
// $('#DocumentContents_ContentPlaceHolder_Middle')[0].style.height = '250px';
// table_DocumentInformation_Signature.css('display', 'block');
table_DocumentInformation_Signature.show();
//if ($('#DivAcknowledgementComments')[0].innerText == "") {
if ($('#DivAcknowledgementComments')[0].innerText.trim() == "") {
//table_DocumentInformation_Acknowledgement.css('display', 'none');
table_DocumentInformation_Acknowledgement.hide();
}
else {
//table_DocumentInformation_Acknowledgement.css('display', 'block');
table_DocumentInformation_Acknowledgement.show();
}
if (mode.toLowerCase() == 'edit') {
var frameHeight = (($(document).height() * 42) / 100);
$('#iFrameOpenURL').css('height', frameHeight);
frameHeightToResize = frameHeight;
// var i = 0
// for (i = 0; i <= document.frames.length - 1; i++) {
// if (document.frames[i].name == "iFrameOpenURL") {
// if (document.frames[i].document.getElementById("divReportViewer") != null)
// document.frames[i].document.getElementById("divReportViewer").style.height = '235px'
// }
// }
}
}
//Added by sourabh with ref to task#223(SCWeb PhaseII): to reatin iFrameId
if ($('input[id$=hiddenContainerControlToResize]').val() != "") {
iFrameId = $('input[id$=hiddenContainerControlToResize]').val();
}
else {
$('input[id$=hiddenContainerControlToResize]').val(iFrameId);
}
//end here
if (NoteType == -1) {
if (KeyScreenTabIndex == 1) {
if ($('input[id$=hiddenContainerControlToResize]').val() == "") {
ResizeContainer('ServiceNoteTabPage_C1');
}
else {
ResizeContainer($('input[id$=hiddenContainerControlToResize]').val());
}
}
else {
ResizeContainer($('input[id$=hiddenContainerControlToResize]').val());
}
}
else {
ResizeContainer($('input[id$=hiddenContainerControlToResize]').val());
}
//--------StartCode Written by Pradeep to resize pdf viewer to avoid unwanted vertical scrool bar wrf to task 223 in Scweb phase II bugs/Features
var DivOpenURLheight = $('#DivOpenURL').height();
if (button_DocumentInformation_ShowSignature.val() == "Less Detail") {
if ($('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl').length > 0 && $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl > object').length > 0 && frameHeightToResize != 0) {
$('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl').css('height', $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height());
$('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl > object').css('height', $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height());
$('#DivOpenURL').height($('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height() + 2);
}
}
else {
if ($('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl').length > 0 && $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl > object').length > 0) {
$('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl').css('height', $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height());
$('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('span#pdfViewerControl > object').css('height', $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height());
$('#DivOpenURL').height($('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').height() + 2);
}
}
//--------End Code Written by Pradeep to resize pdf viewer to avoid unwanted vertical scrool bar
//Added by sourabh to resize report viewer to avoid unwanted vertical scrool bar
var ReportViewer = $('div#DivOpenURL').find('iframe[name=iFrameOpenURL]').contents().find('#divReportViewer');
if (button_DocumentInformation_ShowSignature.val() == "Less Detail") {
if (ReportViewer != null && ReportViewer.length > 0 && ReportViewer.find('#ReportViewer1').length > 0 && frameHeightToResize != 0) {
ReportViewer.css('height', frameHeightToResize);
ReportViewer.find('#ReportViewer1').css('height', frameHeightToResize - 4);
}
}
else {
if (ReportViewer != null && ReportViewer.length > 0 && ReportViewer.find('#ReportViewer1').length > 0) {
ReportViewer.css('height', $('#iFrameOpenURL').height() - 4);
ReportViewer.find('#ReportViewer1').css('height', $('#iFrameOpenURL').height() - 40);
}
}
//end here
// Calling funcion to handle View Only Permission functionality
DisableButtonforViewMode();
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose show signature box.
function HideSignatureBox() {
$('#Table_DocumentInformation_Signature').css('display', 'none');
$('#Table_DocumentInformation_Acknowledgement').css('display', 'none');
$('#Button_DocumentInformation_ShowSignature').val("More Detail");
// $('#DocumentContents_ContentPlaceHolder_Middle')[0].style.height = '330px';
}
function LoadDocumentInGroupService(screenId, filterData, hid, UcName) {
//added by shifali in ref to not load document if status=cancel and disableCancelNote='Y'
//check for document and related service status, if saved service status = 73 and disableCancel Notes='Y', then we
//wont load Document in Note tab.
if (DocumentToShowInGroupService(filterData) && screenId && UcName) {
//Added in ref to task #2282 for not saving the history for note tab
AddHistoryPoint = false;
try {
var grpServiceCount = AutoSaveXMLDom.find('GroupServices').length;
if (grpServiceCount > 1) {
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var dgError = new Error("Duplicate Group Service found: Method:" + methodName);
LogClientSideException(dgError, 'LoadDocumentInGroupService', 3);
}
} catch (e) {
}
PopupProcessing();
// $.post("../BasePages/Documents.aspx?scId=" + screenId, 'ajaxRequest=true' + '&UCName'+UcName+'&action=LoadDocInGroupService&requestParametersValues=' + filterData + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "", LoadDocumentCallBack);
//$.post("../BasePages/Documents.aspx?scId=" + screenId, 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName' + UcName + '&action=LoadDocInGroupService&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "", LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName' + UcName + '&action=LoadDocInGroupService&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "",
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while loading document in group service. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in LoadDocumentInGroupService - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
}
}
function LoadDocumentInGroupTemplate(screenId, filterData, hid, UcName) {
try {
var grpServiceCount = AutoSaveXMLDom.find('GroupServices').length;
if (grpServiceCount > 1) {
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var dgError = new Error("Duplicate Group Service found: Method:" + methodName);
LogClientSideException(dgError, 'LoadDocumentInGroupTemplate', 3);
}
} catch (e) {
}
AddHistoryPoint = false;
PopupProcessing();
// $.post("../BasePages/Documents.aspx?scId=" + screenId, 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName' + UcName + '&action=LoadDocInGroupTemplate&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "", LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName' + UcName + '&action=LoadDocInGroupTemplate&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "",
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while loading document in group Template. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in LoadDocumentInGroupTemplate - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
}
function LoadDocumentInBedCensus(screenId, filterData, hid, UcName) {
filterData += '^UnsavedChangeId=' + UnsavedChangeId;
if (CallBackAction != '') {
filterData += '^CallBackAction=' + CallBackAction;
}
CallBackAction = '';
// $.post("../BasePages/Documents.aspx?scId=" + screenId, 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName=' + UcName + '&action=LoadDocInBedCensus&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "", LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'ajaxRequest=true&xmlString=' + encodeText(AutoSaveXMLDom[0].xml) + '&UCName=' + UcName + '&action=LoadDocInBedCensus&requestParametersValues=' + filterData + '&isExternalURL=' + isExternalURL + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + "",
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while loading document in Bed Census. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in LoadDocumentInBedCensus - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose Get Document information.
//Changes By Sonia to add parameters related to relativePath and Page action
function LoadDocument(screenId, controltype, filterData, hid, relativePath, pageAction, pageData, containerChanged, screenTabIndex, checkForScreenHitCount) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "LoadDocument", "screenId - " + isNullORUndefined(screenId) + "^" + "controltype - " + isNullORUndefined(controltype) + "filterData - " + isNullORUndefined(filterData) + "^" + "hid - " + isNullORUndefined(hid)
+ "^" + "relativePath - " + isNullORUndefined(relativePath) + "^" + "pageAction - " + isNullORUndefined(pageAction) + "^" + "pageData - " + isNullORUndefined(pageData) + "^" + "containerChanged - " + isNullORUndefined(containerChanged)
+ "^" + "screenTabIndex - " + isNullORUndefined(screenTabIndex) + "^" + "checkForScreenHitCount - " + isNullORUndefined(checkForScreenHitCount) + "");
try {
if (relativePath == undefined || relativePath == '')
relativePath = GetRelativePath();
if (pageAction == undefined)
pageAction = pageActionEnum.None;
var historyXml = "";
if (AddHistoryPoint == true)
historyXml = $('input[id$=hiddenFieldHistoryXML]').val();
if (screenId == 755 && historyXml == "") {
historyXml = $('input[id$=hiddenFieldHistoryXML]').val();
}
//Below Code Add by Rakesh to handle & empersend charater in filter data w.rf. to task 301
filterData = filterData.replace(/&/g, "%26");
filterData = filterData.replace(/%26/g, '');
//Below Code Add by Rakesh to handle & empersend charater in filter data & history w.rf. to task 114 in SC web phase II bugs/Features
historyXml = historyXml.replace(/&/g, "%26");
try {
var grpServiceCount = AutoSaveXMLDom.find('GroupServices').length;
if (grpServiceCount > 1) {
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var dgError = new Error("Duplicate Group Service found: Method:" + methodName);
LogClientSideException(dgError, 'LoadDocument', 3);
}
} catch (e) {
}
if (checkForScreenHitCount == true && ScreenHitCount > GetScreenHitCountConfigurableValue() && pageAction != pageActionEnum.CustomAjaxCall) {
//What - Instead of calling new summary page have used a common method to Update History in session
//Code which was being used before that has been removed
//Why - To fix Dashboard jumping issue
UpdateHistoryInSessionForPostBack();
}
else {
//Modified by sourabh to resolve special character issue with ref to task#512(SC Web PhaseII)
// $.post(relativePath + "BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL,
//'ajaxRequest=true' + '&action=' + pageAction + '&TabIndex=' + screenTabIndex + '&requestParametersValues=' + filterData + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + encodeText(historyXml) + "&containerChanged=" + containerChanged + "&CurrentBannerTabIndex=" + globalBannerTabIndex,
//function (result) { LoadDocumentCallBack(result, containerChanged); });
$.ajax({
type: "POST",
url: relativePath + "BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL,
data: 'ajaxRequest=true' + '&action=' + pageAction + '&TabIndex=' + screenTabIndex + '&requestParametersValues=' + filterData + '&historyId=' + hid + '&hiddenFieldApplicationHistoryXML=' + encodeText(historyXml) + "&containerChanged=" + containerChanged + "&CurrentBannerTabIndex=" + globalBannerTabIndex + "&DFATabIndex=" + dfaTabIndex,
success: function (result) {
LoadDocumentCallBack(result, containerChanged);
},
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while loading document. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in LoadDocument - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
//end here
PopupProcessing();
}
}
catch (Ex) {
alert(Ex);
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose CallBack function for LoadDocument.
function LoadDocumentCallBack(result, containerChanged) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "LoadDocumentCallBack", "containerChanged - " + isNullORUndefined(containerChanged) + "");
SaveInProgress = "False";
CallSetScreenSpecificValues = false;
if (typeof ServiceSaveInProgress != 'undefined')
ServiceSaveInProgress = false;
try {
if (DeserailizePageResponse(result) == true) {
//By Vikas Vyas In ref to Implement Service Note Architecture
//EI#571 check whether logged in staff has the permission to access the tab, if permission denied then display a message
tabUCPathInContext = objectPageResponse.LoadedUcPath;
// if (CheckTabAuthorization() == false) { return false; }
ClientName = objectPageResponse.ClientName;
//End
if (objectPageResponse.ObjectDocumentInformation) {
DocumentInfo.DocumentCodeId = objectPageResponse.ObjectDocumentInformation.DocumentCodeId;
DocumentInfo.DocumentNavigationName = objectPageResponse.ObjectDocumentInformation.DocumentNavigationName;
DocumentInfo.DocumentViewMode = objectPageResponse.ObjectDocumentInformation.DocumentViewMode;
DFATableNamesUsedInDocuments = objectPageResponse.ObjectDocumentInformation.DFATableNames;
}
// Function to store the outerContainer Html in PDFJsContainer div
GetPDFOuterContainerHTML();
if ($("#DivOpenURL") != null && $("#DivOpenURL").length > 0) {
$("#DivOpenURL")[0].innerHTML = '';
$("#DivOpenURL").html('');
$("#DivOpenUrlContainer").hide(); // Added by Maninder
}
var bindAutoSave = false;
if (objectPageResponse.CallBackAction == pageActionEnum.New) {
Dirty = "False";
if (ApplicationId != undefined && ApplicationId == 2) {
window.external.AfterUpdateProcess(UnsavedChangeId);
}
UnsavedChangeId = 0;
SetAutoSaveInformation();
AutoSaveTimerInitialization();
// Author : Karan garg
// Purpose : Initialize the Document Unlock process timer
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
DocumentLockTimerInitialization();
ReSetautoSaveVariables();
CreateNewDocumentPage();
CallBackAction = '';
return;
}
if (objectPageResponse.CallBackAction == 'MoveDocument') {
Dirty = "False";
UnsavedChangeId = 0;
SetAutoSaveInformation();
AutoSaveTimerInitialization();
// Author : Karan garg
// Purpose : Initialize the Document Unlock process timer
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
DocumentLockTimerInitialization();
ReSetautoSaveVariables();
OpenMoveDiv();
$('#ImgButtonMoveDummy').click();
CallBackAction = '';
HidePopupProcessing();
return;
}
if (objectPageResponse.CallBackAction == 'closescreen') {
//Added by Sonia with reference to CM Unsaved changes
if (ApplicationId != undefined && ApplicationId == 2) {
window.external.AfterUpdateProcess(UnsavedChangeId);
}
//Changes end here
//added by shifali on 18th july,2010 to reset left div unsaved html
ResetUnsavedChangesList(objectPageResponse.UnsavedChangesHTML, objectPageResponse.SupervisorMode);
CallBackAction = '';
//Check if user click cloase button
//if (objectPageResponse.ObjectDocumentInformation.DocumentStatusId == 22) {
closeScreen = null;
var RelativePath = GetRelativePath();
//Changed by Sonia as on close screen previous page should get opened
//OpenPage(5764, 19, '', 2, RelativePath);
OpenPreviousPageFromHistory();
return;
// }
//
}
//Code added by Loveena in ref to Handle Unsave Changes of CM/PA Events
if (objectPageResponse.CallBackAction == "previous" || objectPageResponse.CallBackAction == "next") {
Dirty = "False";
if (ApplicationId != undefined && ApplicationId == 2) {
window.external.AfterUpdateProcess(UnsavedChangeId);
}
UnsavedChangeId = 0;
SetAutoSaveInformation();
AutoSaveTimerInitialization();
// Author : Karan garg
// Purpose : Initialize the Document Unlock process timer
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
DocumentLockTimerInitialization();
ReSetautoSaveVariables();
DocumentNavigation(objectPageResponse.CallBackAction);
CallBackAction = '';
return;
}
if (objectPageResponse.CallBackAction == pageActionEnum.GoToDocument) {
Dirty = "False";
if (ApplicationId != undefined && ApplicationId == 2) {
window.external.AfterUpdateProcess(UnsavedChangeId);
}
UnsavedChangeId = 0;
SetAutoSaveInformation();
AutoSaveTimerInitialization();
// Author : Karan garg
// Purpose : Initialize the Document Unlock process timer
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
DocumentLockTimerInitialization();
ReSetautoSaveVariables();
//DocumentNavigation(objectPageResponse.CallBackAction);
eval(_SaveDocumentCallBackFunction);
CallBackAction = '';
return;
}
ManageDocumentToolbarItems();
//Handle Action Specfic code
switch (objectPageResponse.Action) {
case pageActionEnum.ToMove:
if (objectPageResponse.UnsavedChangesDeleted == "Y") {
//$("div[id$=UnSavedChangesLeftPaneGrid]").html(objectPageResponse.UnsavedChangesHTML);
ResetUnsavedChangesList(objectPageResponse.UnsavedChangesHTML, objectPageResponse.SupervisorMode);
}
//Open Previous document if available
if (PreviousDocumentId != 0) { DocumentNavigation("previous"); }
//Open Next document if available
else if (NextDocumentId != 0) { DocumentNavigation("next"); }
//Temp code to move on client summary screen//Pending-If previous document is not available.
else {
var RelativePath = GetRelativePath();
//OpenPage(5764, 19, '', 2, RelativePath);
OpenPreviousPageFromHistory();
}
break;
case pageActionEnum.LoadDocInGroupService:
//screenid hardcoded for group services
//added by shifali in ref to task for maintaining tabindex on save
//as tabindex was being rest in framework fn 'Deserializ'
TabIndex = customTabIndex;
CurrentScreenId = 46;
$('input[id$=hiddenFieldCurrentScreenId]').val(46);
ScreenType = 5761;
var documentTables = "";
var pageResponse = objectPageResponse.ObjectDocumentInformation;
if (pageResponse != null) {
SetDocumentGlobalVaribales(pageResponse);
}
var DomTemp = $.xmlDOM(objectPageResponse.PageDataSetXml);
//DocumentsNodes = DomTemp[0].childNodes[0].selectNodes("Documents");
//Below line commented by Maninder w.r.t task#2724 in Thresholds Bugs/Feature
//var AuthorId = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'AuthorId', DomTemp[0]);
var Status = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'Status', DomTemp[0]);
var ServiceId = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'ServiceId', DomTemp[0]);
var savedServiceStatus = GetColumnValueInXMLNodeByKeyValue('Services', 'ServiceId', ServiceId, 'SavedServiceStatus', DomTemp[0]);
//Added by Maninder: To retrive AuthorId from Services.ClinicianId
var AuthorId = GetColumnValueInXMLNodeByKeyValue('Services', 'ServiceId', ServiceId, 'ClinicianId', DomTemp[0]);
var documentVersionId = GetColumnValueInXMLNodeByKeyValue('DocumentVersions', 'DocumentId', pageResponse.DocumentId, 'DocumentVersionId', DomTemp[0]);
$("#Hidden_SelectedNoteDocumentVersionID").val(documentVersionId);
var ServiceStatus = "";
var CustomTableHasRows = "";
if (objectPageResponse.ScreenProperties.CustomTableHasRows != undefined) {
CustomTableHasRows = objectPageResponse.ScreenProperties.CustomTableHasRows;
}
if (objectPageResponse.ScreenProperties.ServiceStatus != undefined) {
ServiceStatus = objectPageResponse.ScreenProperties.ServiceStatus;
}
if (Status == 22 && pageResponse.UnsavedChangeId == 0) {
//Do Nothing
}
//code commented by shifali ends here
else if (Status == 22 && ServiceId != '') {
//OpenURL(pageResponse.DocumentVersionId, true);
var myDate = new Date();
var time = myDate + myDate.getMinutes() + myDate.getSeconds();
//Following commneted by Sonia for History Management
// $('#iFrameOpenURL')[0].src = "../ReportViewer.aspx?DocumentVersionId=" + argDocumentVersionId + "&time=" + time;
//added by shifali in ref to task# 336(PDF on Sign Service Note)-Group Services/Notes.
var DivOpenURL = $("#DivOpenURL");
//Modified by RaghuM on 29Nov2012 under Task#2318 PDF- Issues.
//What-reportViewerHeight modified to correct RDL's layout
//Why-as report's layout was disturbing and showing additional scrollbar.
var reportViewerHeight = "370";
var reprotViewerWidth = DivOpenURL.width();
//DivOpenURL.css({'overflow-y', 'none'});
var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + pageResponse.DocumentVersionId + "&time=" + time + "&rpheight=" + reportViewerHeight + "&rpwidth=" + reprotViewerWidth;
var iframeReports = '';
$('#DivGroupServiceClientNotesContainer').hide();
$("#DivOpenUrlContainer").show(); //Added by Maninder
$("#DivOpenURL").html(iframeReports);
//generate/Insert PDF in DB when RDL opening first time.(task# 336)
gereratepdfaftersign(pageResponse.DocumentVersionId);
}
else if (AuthorId != LoggedInUserId && ServiceId != '') {
if (CustomTableHasRows == "True") {
//OpenURL(pageResponse.DocumentVersionId, true);
var myDate = new Date();
var time = myDate + myDate.getMinutes() + myDate.getSeconds();
//Following commneted by Sonia for History Management
// $('#iFrameOpenURL')[0].src = "../ReportViewer.aspx?DocumentVersionId=" + argDocumentVersionId + "&time=" + time;
var DivOpenURL = $("#DivOpenURL");
var reportViewerHeight = "370";
var reprotViewerWidth = DivOpenURL.width();
var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + pageResponse.DocumentVersionId + "&time=" + time + "&rpheight=" + reportViewerHeight + "&rpwidth=" + reprotViewerWidth;
var iframeReports = '';
$('#DivGroupServiceClientNotesContainer').hide();
$("#DivOpenUrlContainer").show(); // Added by Maninder
$("#DivOpenURL").html(iframeReports);
}
else {
$('#DivGroupServiceClientNotesContainer').hide();
$("#DivOpenUrlContainer").show(); //Added By Maninder
$("#DivOpenURL").html("Documentation not started - You are not the author.");
}
}
else {
$('#DivGroupServiceClientNotesContainer').show();
//added by shifali in ref to task# 369 to refresh tabs on changing author from template under group note
//tabUserControlName set to null before calling ParseResultString and after call retain the same value
var holdTabUserControlName = tabUserControlName;
tabUserControlName = '';
//ends here
if (PageControl_Group_Clients_Notes.activeTabIndex == 0) {
result = ParseResultString(result, "DivGroupNodeContents");
if ($('input[id$=HiddenFieldPageTables]', $("#DivGroupNodeContents")).length > 0) {
documentTables = $('input[id$=HiddenFieldPageTables]', $("#DivGroupNodeContents")).val().split(",");
}
}
else if (PageControl_Group_Clients_Notes.activeTabIndex == 1) {
$("#DivGroupServiceClientNotesContainer").html("");
GroupServiceClientInfo.SetActiveTab(GroupServiceClientInfo.tabs[0]);
result = ParseResultString(result, "DivGroupServiceClientNotesContainer");
//Maninder: Added check for length>0
if ($('input[id$=HiddenFieldPageTables]', $("#DivGroupServiceClientNotesContainer")).length > 0) {
documentTables = $('input[id$=HiddenFieldPageTables]', $("#DivGroupServiceClientNotesContainer")).val().split(",");
}
}
//added by shifali in ref to task# 369 to refresh tabs on changing author from template under group note
//tabUserControlName value retained after calling ParseResultString
tabUserControlName = holdTabUserControlName;
//ends here
//Added by Umesh on Sep 17 2010
var HiddenFieldPageTables = $('input[id$=HiddenFieldPageTables]');
//Maninder: Added if condition to check length of HiddenFieldPageTables. For task 833 in CentraWellness Bugs/Feature
if ($('input[id$=HiddenFieldPageTables]').length > 0) {
var groupServiceTables = HiddenFieldPageTables.val().split(",");
for (i = 0; i < documentTables.length; i++) {
var itemfound = false;
for (j = 0; j < groupServiceTables.length; j++) {
if (documentTables[i] == groupServiceTables[j]) {
itemfound = true;
}
}
if (itemfound == false) {
HiddenFieldPageTables.val(HiddenFieldPageTables.val() + "," + documentTables[i]);
}
}
}
HideSignatureBox();
//modified by shifali in ref to task# 340
//first validation of controls based on Datatype attr of controls
//e.g ValidateDate() should fire first instead of CreateAutoSave
AttachValidationEventHandlers();
PopulateControlsForGroupServices(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
//DisableClientNotesDocument(ServiceId, ServiceStatus, Status, 'DivGroupServiceClientNotesContainer');
DisableClientNotesDocument(ServiceId, ServiceStatus, savedServiceStatus, Status, 'DivGroupServiceClientNotesContainer');
bindAutoSave = false;
//added in ref to task# 535(My office banner displayed under the clients tab.)
//purpose - as we open document in Note tab for GroupService Detail page,
//each document can have tabid as Office/Client or any, so we need to reset this variable in
//LoadGroupServiceDoc callback so that, if we open client/service note, banners should refresh
globalBannerTabIndex = 1;
}
//Added By Rahul ANeja on 25 June for binding the key phrase
BindTextAreaKeyPhrase();
if ($('#ButtonFavoritePhrases').length > 0 && objectPageResponse.UseKeyPhrases == true) {
ShowFavoritePhraseDiv('#ButtonFavoritePhrases', 'DivFavoriteTooltip');
}
break;
case pageActionEnum.LoadDocInGroupTemplate:
CurrentScreenId = 1181;
$('input[id$=hiddenFieldCurrentScreenId]').val(1181);
ScreenType = 5761;
var documentTables = "";
var pageResponse = objectPageResponse.ObjectDocumentInformation;
if (pageResponse != null) {
SetDocumentGlobalVaribales(pageResponse);
}
var DomTemp = $.xmlDOM(objectPageResponse.PageDataSetXml);
var Status = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'Status', DomTemp[0]);
var ServiceId = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'ServiceId', DomTemp[0]);
var CustomTableHasRows = "";
if (objectPageResponse.ScreenProperties.CustomTableHasRows != undefined) {
CustomTableHasRows = objectPageResponse.ScreenProperties.CustomTableHasRows;
}
if (Status == 22 && pageResponse.UnsavedChangeId == 0) {
//Do Nothing
}
else {
var holdTabUserControlName = tabUserControlName;
tabUserControlName = '';
if (GroupTemplateTabPage.activeTabIndex == 0) {
result = ParseResultString(result, "DivGroupTemplateContents");
if ($('input[id$=HiddenFieldPageTables]', $("#DivGroupTemplateContents")).length > 0) {
documentTables = $('input[id$=HiddenFieldPageTables]', $("#DivGroupTemplateContents")).val().split(",");
}
}
tabUserControlName = holdTabUserControlName;
var HiddenFieldPageTables = $('input[id$=HiddenFieldPageTables]');
if ($('input[id$=HiddenFieldPageTables]').length > 0) {
var groupServiceTables = HiddenFieldPageTables.val().split(",");
for (i = 0; i < documentTables.length; i++) {
var itemfound = false;
for (j = 0; j < groupServiceTables.length; j++) {
if (documentTables[i] == groupServiceTables[j]) {
itemfound = true;
}
}
if (itemfound == false) {
HiddenFieldPageTables.val(HiddenFieldPageTables.val() + "," + documentTables[i]);
}
}
}
HideSignatureBox();
AttachValidationEventHandlers();
PopulateControlsForGroupTemplates(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
bindAutoSave = false;
globalBannerTabIndex = 1;
}
//Added By Rahul ANeja on 25 June for binding the key phrase
BindTextAreaKeyPhrase();
if ($('#ButtonFavoritePhrases').length > 0 && objectPageResponse.UseKeyPhrases == true) {
ShowFavoritePhraseDiv('#ButtonFavoritePhrases', 'DivFavoriteTooltip');
}
break;
case pageActionEnum.LoadDocInBedCensus:
var ctrlParentScreenId = $('#HiddenParentScreenId');
$('input[id$=hiddenFieldCurrentScreenId]').val(ctrlParentScreenId.val());
ScreenType = screenTypeEnum.Detail;
var documentTables = "";
var pageResponse = objectPageResponse.ObjectDocumentInformation;
if (pageResponse != null) {
SetDocumentGlobalVaribales(pageResponse);
}
var DomTemp = $.xmlDOM(objectPageResponse.PageDataSetXml);
//DocumentsNodes = DomTemp[0].childNodes[0].selectNodes("Documents");
var AuthorId = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'AuthorId', DomTemp[0]);
var Status = GetColumnValueInXMLNodeByKeyValue('Documents', 'DocumentId', pageResponse.DocumentId, 'Status', DomTemp[0]);
//Use EventId instead of BedAssignmentId
var ServiceStatus = "";
var CustomTableHasRows = "";
if (parseInt(Status) == 21 && pageResponse.DocumentId > 0) {
$('#Button_Sign').removeAttr('disabled');
}
else {
$('#Button_Sign').attr('disabled', true);
}
if (objectPageResponse.ScreenProperties.CustomTableHasRows != undefined) {
CustomTableHasRows = objectPageResponse.ScreenProperties.CustomTableHasRows;
}
// if (objectPageResponse.ScreenProperties.ServiceStatus != undefined) {
// ServiceStatus = objectPageResponse.ScreenProperties.ServiceStatus;
// }
if (Status == 22 && pageResponse.UnsavedChangeId == 0) {
//Do Nothing
$('#Button_Sign').attr('disabled', true);
}
else if (Status == 22 && BedAssignmentId != '') {
//OpenURL(pageResponse.DocumentVersionId, true);
var myDate = new Date();
var time = myDate + myDate.getMinutes() + myDate.getSeconds();
var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + pageResponse.DocumentVersionId + "&time=" + time;
var iframeReports = '';
$("#DivBedCensusNoteTabContainer").html(iframeReports);
$('#Button_Sign').attr('disabled', true);
}
else if (AuthorId != LoggedInUserId && BedAssignmentId != '') {
if (CustomTableHasRows == "True") {
var myDate = new Date();
var time = myDate + myDate.getMinutes() + myDate.getSeconds();
var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + pageResponse.DocumentVersionId + "&time=" + time;
var iframeReports = '';
$("#DivBedCensusNoteTabContainer").html(iframeReports);
}
else {
//$('#DivGroupServiceClientNotesContainer').hide();
$("#DivBedCensusNoteTabContainer").html("Documentation not started - You are not the author.");
}
}
else {
//$('#DivGroupServiceClientNotesContainer').show();
// if (PageControl_Group_Clients_Notes.activeTabIndex == 0) {
// result = ParseResultString(result, "DivBedCensusNoteTabContainer");
// documentTables = $('input[id$=HiddenFieldPageTables]', $("#DivBedCensusNoteTabContainer")).val().split(",");
// }
// else if (PageControl_Group_Clients_Notes.activeTabIndex == 1) {
$("#DivBedCensusNoteTabContainer").html("");
//GroupServiceClientInfo.SetActiveTab(GroupServiceClientInfo.tabs[0]);
result = ParseResultString(result, "DivBedCensusNoteTabContainer");
documentTables = $('input[id$=HiddenFieldPageTables]', $("#DivBedCensusNoteTabContainer")).val().split(",");
//}
var HiddenFieldPageTables = $('input[id$=HiddenFieldPageTables]');
var bedCensusTables = HiddenFieldPageTables.val().split(",");
for (i = 0; i < documentTables.length; i++) {
var itemfound = false;
for (j = 0; j < bedCensusTables.length; j++) {
if (documentTables[i] == bedCensusTables[j]) {
itemfound = true;
}
}
if (itemfound == false) {
HiddenFieldPageTables.val(HiddenFieldPageTables.val() + "," + documentTables[i]);
}
}
PopulateControls(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
// PopulateControlsForGroupServices(objectPageResponse, outputHtml);
//DisableClientNotesDocument(ServiceStatus, Status, 'DivBedCensusNoteTabContainer');
bindAutoSave = true;
SetTitleBarText('Admit');
if (objectPageResponse.CallBackAction == "SignDocumentBedCensus") {
SignBedCensusAdmitNotes(GetRelativePath(), 'BedCensus');
}
}
break;
case pageActionEnum.None:
tabUserControlName = "";
//Added by sourabh with ref to task#871 : to display top and left panel of client when request comes from Provider Access(Access Center)
if (objectPageResponse.ApplicationId == 1) {
window.parent.parent.ShowTopLeftPanel('Client');
}
//Added by Maninder for Task#9 in ThresholdPhaseII
if (objectPageResponse.ValidationInfoHTML != undefined) {
var hiddenValidationMessage = $('#hiddenValidationMessage');
hiddenValidationMessage.val('');
hiddenValidationMessage.val(objectPageResponse.ValidationInfoHTML);
ShowHideErrorMessage(objectPageResponse.ValidationInfoHTML, "true", "true", "Validations");
}
if (objectPageResponse.UnsavedChangeId == 0)
UnsavedChangeId = 0;
//Changed by shifali in ref to task# 11 (To Be Reviewed Status)
//if (objectPageResponse.ObjectDocumentInformation.DocumentStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
if (objectPageResponse.ObjectDocumentInformation.CurrentVersionStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
//Do Nothing
}
else {
if (containerChanged != undefined && containerChanged == true) {
if (!objectPageResponse.IsBannerTabChanged)
ParseResultString(result, "DivMainPageContent", "DivMainPageContent");
else
ParseResultString(result, 'DivHTMLWholePage', "CONTAINER");
}
else {
if (!objectPageResponse.IsBannerTabChanged)
ParseResultString(result, "DivMainPageContent", "DivMainPageContent");
else
result = ParseResultString(result, "DivShowDetailHTML");
}
}
HideSignatureBox();
InitializeDomObject();
PopulateControls(objectPageResponse, outputHtml);
//ResgisterScripts(result);
AttachValidationEventHandlers();
if ($('input[id$=hiddenFieldCreateNew]').length > 0 && GetCurrentScreenID() == 13 && objectPageResponse.ObjectDocumentInformation.CurrentVersionStatusId == 0) {
if ($('input[id$=hiddenFieldCreateNew]').val() == 'Yes') {
ShowHideErrorMessage("The system has already been upgraded to ICD10. You can create a new DSM 5 Diagnosis", 'true');
$('[id$=DropDownList_DocumentInformation_AuthorList]').attr("disabled", true);
$('[id$=Button_DocumentInformation_Sign]').attr("disabled", true);
$('[id$=Button_DocumentInformation_ShowSignature]').attr("disabled", true);
$('[id$=img_DocumentInformation_EffectiveDate]').attr("disabled", true);
$('[id$=TextBox_DocumentInformation_EffectiveDate]').attr("disabled", true);
$('[id$=ButtonUpdate]').attr("disabled", true);
$('[id$=DiagnosisDocumentTabPage]').attr("disabled", true);
$('[id$=TableChildControl_DiagnosesIAndII_ButtonInsert]').attr("disabled", true);
$('[id$=ButtonClear]').attr("disabled", true);
$('#ButtonAxisIV').hide();
$('#ButtonAxisIV2').show();
$('#ButtonAxisVRanges').hide();
$('#ButtonAxisVRanges2').show();
$('#ButtonStaffAxisVRanges').hide();
$('#ButtonStaffAxisVRanges2').show();
$('[id$=TableChildControl_DiagnosesIIICodes_ButtonInsert]').attr("disabled", true);
$('[id$=ButtonICDClear]').attr("disabled", true);
return false;
}
else {
ShowHideErrorMessage("", 'false');
$('[id$=DropDownList_DocumentInformation_AuthorList]').attr("disabled", false);
$('[id$=Button_DocumentInformation_Sign]').attr("disabled", false);
$('[id$=Button_DocumentInformation_ShowSignature]').attr("disabled", false);
$('[id$=img_DocumentInformation_EffectiveDate]').attr("disabled", false);
$('[id$=TextBox_DocumentInformation_EffectiveDate]').attr("disabled", false);
enableUpdateButton();
$('[id$=DiagnosisDocumentTabPage]').attr("disabled", false);
$('[id$=TableChildControl_DiagnosesIAndII_ButtonInsert]').attr("disabled", false);
$('#ButtonAxisIV').show();
$('#ButtonAxisIV2').hide();
$('#ButtonAxisVRanges').show();
$('#ButtonAxisVRanges2').hide();
$('#ButtonStaffAxisVRanges').show();
$('#ButtonStaffAxisVRanges2').hide();
$('[id$=ButtonStaffAxisVRanges]').attr("disabled", false);
$('[id$=TableChildControl_DiagnosesIIICodes_ButtonInsert]').attr("disabled", false);
$('[id$=ButtonICDClear]').attr("disabled", false);
}
}
//BindAutoSaveEvents();
bindAutoSave = true;
//cleard this field on new document call.
if (objectPageResponse.UnsavedChangeId > 0 && objectPageResponse.UnsavedWithNewStatus == "Y" && OpenedFromHistory == false) {
OpenedFromHistory = false;
if (objectPageResponse.ApplicationId == 2) {
window.external.UpdateCurrentPageFilters(objectPageResponse.UnsavedChangeId);
}
ShowMsgBox('Please save or close the existing unsaved record for this screen prior to clicking New', 'Confirmation', MessageBoxButton.OK, MessageBoxIcon.Information);
}
if (objectPageResponse.UnsavedChangeId > 0) {
if (objectPageResponse.ApplicationId == 2) {
window.external.UpdateCurrentPageFilters(objectPageResponse.UnsavedChangeId);
}
}
break;
case pageActionEnum.NextDocument:
// Author : Karan garg
// Purpose : Unlock the Document
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
UnlockDocumentOnNavigatingAway();
tabUserControlName = "";
//Changes by Shifali in ref to task# 11 (To Be Reviewed Document Status)
//if (objectPageResponse.ObjectDocumentInformation.DocumentStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
if (objectPageResponse.ObjectDocumentInformation.CurrentVersionStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
//Do Nothing
}
else {
result = ParseResultString(result, "DivShowDetailHTML");
}
HideSignatureBox();
InitializeDomObject();
PopulateControls(objectPageResponse, outputHtml);
//ResgisterScripts(result);
//HidePopupProcessing();
AttachValidationEventHandlers();
//BindAutoSaveEvents();
bindAutoSave = true;
// CreateHistoryPoint(5763, GetCurrentScreenID(), filtersData, 2, GetRelativePath(), true, objectPageResponse.Action);
//Added by Daman
//ref: ticketNo: 2162 :Events: Two instances of same events are displayed un In Progress
if (objectPageResponse.ApplicationId == 2) {
window.external.ResetExternalContainerFilters(objectPageResponse.UnsavedChangeId);
}
break;
case pageActionEnum.PreviousDocument:
// Author : Karan garg
// Purpose : Unlock the Document
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
UnlockDocumentOnNavigatingAway();
tabUserControlName = "";
//Changes by Shifali in ref to task# 11 (To Be Reviewed Document Status)
//if (objectPageResponse.ObjectDocumentInformation.DocumentStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
if (objectPageResponse.ObjectDocumentInformation.CurrentVersionStatusId == 22 && objectPageResponse.ObjectDocumentInformation.UnsavedChangeId == 0) {
//Do Nothing
}
else {
result = ParseResultString(result, "DivShowDetailHTML");
}
HideSignatureBox();
InitializeDomObject();
PopulateControls(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
//BindAutoSaveEvents();
bindAutoSave = true;
//ResgisterScripts(result);
// HidePopupProcessing();
//Added by Daman
//ref: ticketNo: 2162 :Events: Two instances of same events are displayed un In Progress
if (objectPageResponse.ApplicationId == 2) {
window.external.ResetExternalContainerFilters(objectPageResponse.UnsavedChangeId);
}
break;
case pageActionEnum.New:
// Author : Karan garg
// Purpose : Unlock the Document
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
UnlockDocumentOnNavigatingAway();
tabUserControlName = "";
//Added by sourabh with ref to task#871 : to display top and left panel of client when request comes from Provider Access(Access Center)
if (objectPageResponse.ApplicationId == 1) {
window.parent.parent.ShowTopLeftPanel('Client');
}
//Added by Maninder for Task#9 in ThresholdPhaseII
if (objectPageResponse.ValidationInfoHTML != undefined) {
var hiddenValidationMessage = $('#hiddenValidationMessage');
hiddenValidationMessage.val('');
hiddenValidationMessage.val(objectPageResponse.ValidationInfoHTML);
ShowHideErrorMessage(objectPageResponse.ValidationInfoHTML, "true", "true", "Validations");
}
if (containerChanged != undefined && containerChanged == true) {
if (!objectPageResponse.IsBannerTabChanged)
ParseResultString(result, "DivMainPageContent", "DivMainPageContent");
else
ParseResultString(result, 'DivHTMLWholePage', "CONTAINER");
}
else {
// As in case of inactive client when page postback All document controller controls clears so we first check that if length not greate than zero than call ParseResultString(result, 'DivMainPageContent', "DivMainPageContent"); With Ref to task 519 in SC web other billable
if ($('#Button_DocumentInformation_PreviousDocument').length > 0)
ParseResultString(result, "DivShowDetailHTML");
else
ParseResultString(result, 'DivMainPageContent', "DivMainPageContent");
}
HideSignatureBox();
InitializeDomObject();
PopulateControls(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
//BindAutoSaveEvents();
bindAutoSave = true;
//ResgisterScripts(result);
//HidePopupProcessing();
HideToolbarItems("Help");
ShowICD10MessageforOldDiagnosis();
if (objectPageResponse.UnsavedChangeId > 0 && objectPageResponse.UnsavedWithNewStatus == "Y" && OpenedFromHistory == false) {
OpenedFromHistory = false;
if (objectPageResponse.ApplicationId == 2) {
window.external.UpdateCurrentPageFilters(objectPageResponse.UnsavedChangeId);
}
ShowMsgBox('Please save or close the existing unsaved record for this screen prior to clicking New', 'Confirmation', MessageBoxButton.OK, MessageBoxIcon.Information);
}
if ($('#Button_DocumentInformation_PreviousDocument').length > 0)
BindScreenHelpTextWithControls();
break;
case pageActionEnum.Update:
///Done as per requirement for warning on update the documents by Sudhir Singh 28 march 2012
checkForWarnings = true;
// Author : Karan garg
// Purpose : Lock the Document on successfull saving
// Dated : 02 Dec 2011
// Ref. task #12 Threshold Dev Phase II
//LockDocument();
//This function has been written to call Customized function
tabUserControlName = "";
if (typeof PostUpdateChanges == 'function') {
var ans = PostUpdateChanges();
//Clear the unsaved change instance id.
}
//Condition Added By Vikas Vyas in ref to Implement Service Note Architecture
if (objectPageResponse.NoteType == -1) {
if (objectPageResponse.PageDataSetXml != "") {
var xmlValidateServiceNoteData = $.xmlDOM(objectPageResponse.PageDataSetXml);
if (xmlValidateServiceNoteData[0].childNodes[0].selectNodes("ValidateServiceNote").length > 0) {
//Allow creating service if the overlapping service staff are different
//Here We hve to Show Message
//Code un commented by jagdeep as ref of task #1379(Service Note - Overlapping services for staff- Thresholds - Bugs/Features (Offshore)
var ans = confirm("A service for this client for this date/time already exists. You cannot enter a duplicate service. Would you like to view the service?");
//Code commented by jagdeep as ref of task #1379(Service Note - Overlapping services for staff- Thresholds - Bugs/Features (Offshore)
// Above code comment by Rohit Katoch ref : task#1195 in Threshold Bugs and features
//var ans = confirm("streamline is busy during this time due to a service. Do you wish to schedule this service anyway?");
if (ans) {
// debugger;
//Get ServiceId and DocumentId
var serviceId = xmlValidateServiceNoteData[0].childNodes[0].selectNodes("ValidateServiceNote")[0].selectSingleNode("Column1").nodeTypedValue;
var documentId = xmlValidateServiceNoteData[0].childNodes[0].selectNodes("ValidateServiceNote")[0].selectSingleNode("Column2").nodeTypedValue
var filterData = "IsServiceNote=true^serviceId=" + serviceId + "^documentId=" + documentId + "^keyscreenid=29^TabId=2^keyfieldvalue=" + serviceId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
//LoadDocument(29, 5763, filterData, CurrentHistoryId, GetRelativePath(), pageActionEnum.None, null, false, 2);
//Added globalCurrentScreenTabIndex on 09/30/2015 for Valley Client Acceptance Testing Issues #485
LoadDocument(29, 5763, filterData, CurrentHistoryId, GetRelativePath(), pageActionEnum.None, null, false, globalCurrentScreenTabIndex);
return;
}
else {
HidePopupProcessing();
return;
}
}
}
}
//End
result = ParseResultString(result, "DivShowDetailHTML");
SetAutoSaveInformation();
PopulateControls(objectPageResponse, outputHtml);
//SetControlValue(objectPageResponse);
// $('#Button_DocumentInformation_Sign').attr("disabled", "");
//Handle update specfic code
AuthorChanged = 'N';
// IsDirty = false;
DocumentContainerDirty = "False"
//Following changes by Sonia
//Streamline Testing 7.3 - Assessment - Error when tyring to save SU tab on Annual
var parentcontrolName = "";
if (objectPageResponse.CurrentRadPageViewName != "") {
parentcontrolName = $("div[id$=" + objectPageResponse.CurrentRadPageViewName + "]");
}
AttachValidationEventHandlers(parentcontrolName);
//Changes end here
//BindAutoSaveEvents();
bindAutoSave = true;
//HidePopupProcessing();// Commented By Suhdir Singh as per task#1811 in Harbor Go Live Issues
if ((ActionSignOrComplete == true)) {
//By Vikas Vyas In ref to Implement Service Note Architecture
if (ValidateStatus() == true) {
//Update function call before sign any document
// ActionSignOrComplete = false;
//Call document Validation before sign any document
//commented by manju on 10th mar, 2013, as part of Clubing all the 3 ajax requests into single call while signing
//ValidateDocument();
LoadDocumentForValidateAndWarning();
}
}
// changes by shifali on 19 Aug,2010 in ref to get callback in Event Architecture of CM
//in order to get a return value when document has been saved successfully
if (isExternalURL == "True" || isExternalURL == true || isExternalURL == "true") {
if (objectPageResponse.ApplicationId == 2)
window.external.AfterUpdateProcess(UnsavedChangeId);
}
// Added by Shifali on 8thAug,2011 ref:task#11
//Collaborative Treatment Planning - Review Status
var XmlDoc = $.xmlDOM(objectPageResponse.ScreenDataSetXml);
var authorId = XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("AuthorId")[0].text.trim();
//var _status = XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("CurrentVersionStatusId")[0].text.trim();
if (CurrentVersionStatusId == 25 && LoggedInUserId == authorId) {
ValidateDocument();
}
//ends here
//Changes by Sonia refrence 548 in SC Web Other Billable Project
//Update History in Session after screen got saved as it will reset filters of screen
UpdateHistoryInSession();
//Changes end here
break;
case pageActionEnum.ChangeAuthor:
IsDirty = false;
if (ApplicationId != undefined && ApplicationId == 2) {
window.external.AfterUpdateProcess(UnsavedChangeId);
}
DocumentContainerDirty = "False"
SetControlValue(objectPageResponse);
//HidePopupProcessing();
break;
case pageActionEnum.EditDocument:
tabUserControlName = "";
result = ParseResultString(result, "DivShowDetailHTML");
//ResgisterScripts(result);
PopulateControls(objectPageResponse, outputHtml);
var button_DocumentInformation_View = $('#Button_DocumentInformation_View');
button_DocumentInformation_View.attr("disabled", false);
button_DocumentInformation_View.attr("mode", "view");
button_DocumentInformation_View.val('View');
AttachValidationEventHandlers();
//BindAutoSaveEvents();
bindAutoSave = true;
//HidePopupProcessing();
break;
//Sonia
case pageActionEnum.LoadServiceNoteProcedure:
$("Div[id$=DivShowNoteHTML]").html("");
// if (objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId != "") {
// associatedNoteScreenId = objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId;
// // $('input[id$=hiddenFieldCurrentScreenId]').val(associatedNoteScreenId);
// }
//
//else
//To hide Help icon in case of new Mode task#2304 in CM
if (KeyFieldValue == 0) {
HideToolbarItems("Help");
}
if (typeof SetControlStatus == 'function') {
SetControlStatus();
}
onServiceNoteActiveTabChanged();
PopulateControls(objectPageResponse, outputHtml);
associatedNoteScreenId = _screenAssociatedScreenId;
//Call function to show/hide sign/complete button.
ShowSignCompleteButtonStatus(objectPageResponse.ObjectDocumentInformation);
//HidePopupProcessing();
//Added By - Shifali(Ref Task# 477 - Move Documents: Error Occurred - Please Contact Your System Administrator)
//Purpose - To Manage the 'Move Document' toolbar item on procedure change
SetDocumentPermission(objectPageResponse.ObjectDocumentInformation);
break;
//Sonia
case pageActionEnum.LoadServiceNoteTab: //Added by Vikas Vyas in ref to implement Service Note Architecture
tabUserControlName = "";
if (typeof Loadhtml == 'function') {
Loadhtml(result);
}
else {
result = ParseResultString(result, "DivShowNoteHTML");
}
// SetTitleBarText(objectPageResponse.PageTitle)
// PageTitle = objectPageResponse.PageTitle
InitializeDomObject();
PopulateControls(objectPageResponse, outputHtml);
//AttachValidationEventHandlers(); //Commented by Maninder: Added check so as to prevent rebinding of already binded architecture level functions on Services Tab
if ($("[id=ServiceNoteTabPage_C1]").length > 0)
AttachValidationEventHandlers($("[id=ServiceNoteTabPage_C1]"));
else
AttachValidationEventHandlers();
//BindAutoSaveEvents();
if (typeof SetControlStatus == 'function') {
SetControlStatus();
}
bindAutoSave = true;
if (objectPageResponse.KeyFieldValue == 0) //if service is in new mode hide info icon.
{
HideToolbarItems("Help");
}
if (typeof BindTreatmentPlanGoalObjectiveGrid == 'function') {
BindTreatmentPlanGoalObjectiveGrid();
}
if (initiateSpellCheck == true)
DoSpellCheck();
//Added in ref. to task #638
if (objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId != "") {
var hiddenFieldHistoryXML = $('input[id$=hiddenFieldHistoryXML]');
var dom = $.xmlDOM(hiddenFieldHistoryXML.val().replace(/&/g, "&"));
if (dom.find("History[Id=" + CurrentHistoryId + "] ").length > 0) {
var newFilterString = dom.find("History[Id=" + CurrentHistoryId + "] ")[0].selectNodes("FiltersData")[0].text;
newFilterString += "^associatedNoteScreenId=" + objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId;
UpdateScreenHistoryNode(CurrentHistoryId, CurrentScreenId, "FiltersData", newFilterString);
}
}
//End
break;
case pageActionEnum.CopyService: //Added by Vikas Vyas in ref to implement (Copy Service Functionality)
tabUserControlName = "";
if (containerChanged != undefined && containerChanged == true) {
if (!objectPageResponse.IsBannerTabChanged)
ParseResultString(result, "DivMainPageContent", "DivMainPageContent");
else
ParseResultString(result, 'DivHTMLWholePage', "CONTAINER");
}
else {
ParseResultString(result, "DivShowDetailHTML");
}
HideSignatureBox();
PopulateControls(objectPageResponse, outputHtml);
AttachValidationEventHandlers();
//BindAutoSaveEvents();
bindAutoSave = true;
//ResgisterScripts(result);
//HidePopupProcessing();
HideToolbarItems("Help");
// Delete button Disabling done by Karan
// 14 March 2012
// To disable button as its in new mode after copy is done
$('#ButtonDelete').attr("disabled", "true");
break;
//New Case "ServiceConfigurationsAjaxCall" added by Shifali on 20Apr2012 in order to add new action for Service Architecture Configurations
//purpose - its purpose will be to handle ajax request for Service Architecture and will be ovveridden in Service js's only.
case pageActionEnum.ServiceConfigurationsAjaxCall:
case pageActionEnum.CustomAjaxCall:
var start = 0;
var end = 0;
var startStr = "##START##";
var endStr = "##END##";
var startIdentifier = "
" + startStr + "
";
var endIdentifier = "
" + endStr + "
";
start = result.indexOf(startIdentifier) + startIdentifier.length;
end = result.indexOf(endIdentifier);
var outputHtml = result.substr(start, end - start);
// added by Shifali on 20Apr2012 in order to add new action for Service Architecture Configurations
if (objectPageResponse.Action == pageActionEnum.ServiceConfigurationsAjaxCall) {
ServiceConfigurationsRequestCallback(outputHtml, pageActionEnum.ServiceConfigurationsAjaxCall)
}
else if (objectPageResponse.Action == pageActionEnum.CustomAjaxCall) {
//If condition added by Shifali on 11June2012
//Purpose - Added new Architecture function to show custom ajax tooltip
if (objectPageResponse.FilterData != null && objectPageResponse.FilterData != undefined && objectPageResponse.FilterData != ""
&& outputHtml != null && outputHtml != undefined && outputHtml != "") {
if (objectPageResponse.FilterData.match(new RegExp("ShowToolTip", "i")) != null) {
CustomAjaxToolTipCallBack(objectPageResponse.FilterData, outputHtml);
}
else {
CustomAjaxRequestCallback(outputHtml, pageActionEnum.CustomAjaxCall);
}
}
else {
CustomAjaxRequestCallback(outputHtml, pageActionEnum.CustomAjaxCall);
}
}
//Changes by Shifali Ends Here
HidePopupProcessing();
try {
if (typeof CrossBrowserCompatability == 'function') {
var overrideJqueryMethods = true;
CrossBrowserCompatability(null, overrideJqueryMethods);
}
} catch (ex) { }
return false;
break;
default:
break;
}
// Code Added By Karan *****
// Purpose : show/hide the keyphrases icons
// Dated : 24 Nov 2011
// if (objectPageResponse.UseKeyPhrases) {
// ShowToolbarItems('AddPhrases');
// ShowToolbarItems('FavoritePhrases');
// }
// else {
// HideToolbarItems('AddPhrases');
// HideToolbarItems('FavoritePhrases');
// }
// //Added By Rahul Aneja for Help URL functionality
// if (objectPageResponse.HelpURL != null && objectPageResponse.HelpURL != "") {
// ShowToolbarItems('HelpURL');
// // ShowToolbarItems('FavoritePhrases');
// }
// else {
// HideToolbarItems('HelpURL');
// // HideToolbarItems('FavoritePhrases');
// }
if (objectPageResponse.CallBackAction == 'CallProxy') {
CallBackAction = '';
PasswordVerificatonToSign();
}
//Following Commented by Sonia as instead of repetitive code we have moved this functionality to a common function InitializeDomObject so call has been created at same
// //Added by Umesh
// //Assign the ScreenXML into XML DOM Object
// if (objectPageResponse.ScreenDataSetXml != "") {
// AutoSaveXMLDom = $.xmlDOM(objectPageResponse.ScreenDataSetXml);
// }
InitializeDomObject();
if (typeof SetFieldsAfterDomInitialized == 'function') {
SetFieldsAfterDomInitialized();
}
//Added by Umesh
//Auto Save- Bind function on change event on each control
//Attach the events on page events for AutoSave
//Handle Document version functionality
if (objectPageResponse.UnsavedChangeId > 0) {
var button_DocumentInformation_View = $('#Button_DocumentInformation_View');
if (objectPageResponse.ObjectDocumentInformation.DocumentId > 0) {
button_DocumentInformation_View.attr("disabled", false);
}
button_DocumentInformation_View.attr("mode", "view");
button_DocumentInformation_View.val('View');
//OpenURL(DocumentVersionId, false);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
OpenURL(InProgressDocumentVersionId, false);
}
//added by shifali on 14dec,2010 in ref to avoid UnsavedChangedId reset everytime when user clicking
// on client tab under client notes
if (objectPageResponse.Action != pageActionEnum.LoadDocInGroupService && objectPageResponse.Action != pageActionEnum.LoadDocInGroupTemplate) {
SetAutoSaveInformation();
AutoSaveTimerInitialization();
// Author : Karan garg
// Purpose : Initialize the Document Unlock process timer
// Dated : 12 Dec 2011
// Ref. task #12 Threshold Dev Phase II
DocumentLockTimerInitialization();
ReSetautoSaveVariables();
}
ResizeContainer(objectPageResponse.CurrentRadPageViewName);
if ((ActionSignOrComplete == true)) {
//added by shifali in ref to task# 11(TO be Reviewed Document Status)
//purpose - DocumentAuthorId,DocumentCodeId vars set as we need it when user is signing/adding the reviewer for document
DocumentAuthorId = objectPageResponse.ObjectDocumentInformation.AuthorId;
DocumentCodeId = objectPageResponse.ObjectDocumentInformation.DocumentCodeId;
//ends here
ActionSignOrComplete = false;
// if (objectPageResponse.ObjectDocumentInformation.NoteType != null && objectPageResponse.ObjectDocumentInformation.NoteType != -1)
// PopupProcessing();
}
else {
("29" === GetCurrentScreenID()) ? PopupProcessing() : HidePopupProcessing();
}
if (ShowInViewMode == true) {
ShowInViewMode = false;
$('#Button_DocumentInformation_View').attr("disabled", false);
$('#Button_DocumentInformation_View').attr("mode", "edit");
$('#Button_DocumentInformation_View').val('Edit');
OpenURL(InProgressDocumentVersionId, true);
}
// Added by: Varinder V
// What: Shifted Permission function after the business logic which does enable/disable Lock/Unlock Button depending upon the document’s status whether locked/unlocked.(Shifted Down)
// Why: Because Permissions should apply after business logic. E.g. as per business logic, if a document is locked then ‘Unlock’ button needs to be enabled and ‘Lock’ button as disabled. But what if user is not carrying the permission to ‘Unlock’. So, permissions applied after business logic.
// Ref Task #2342 Threshold Bugs/Feature(Offshore)
// Date 11-Dec-2012
//SetScreenPermission(objectPageResponse.ScreenControlPermission, null);
//Code To hanle service note procedure call
if (objectPageResponse.Action == pageActionEnum.LoadServiceNoteTab) {
if (objectPageResponse.CurrentRadPageViewName == "") {
//added By Priya
if (NoteType == -1)
ResizeContainer("ServiceNoteTabPage_C1");
else {
ResizeContainer("EventNoteTabPage_C1");
}
}
if (typeof SetFieldsAfterNoteChange == 'function') {
SetFieldsAfterNoteChange();
}
}
if ("29" === GetCurrentScreenID() && KeyScreenTabIndex == 1 && $("div[id$=ServiceNoteTabPage_C1] #DivShowNoteHTML").html() != null && $("div[id$=ServiceNoteTabPage_C1]").html() != null)
if (($("div[id$=ServiceNoteTabPage_C1]").html().trim() == "" || $("div[id$=ServiceNoteTabPage_C1] #DivShowNoteHTML").html().trim() == "")) {
PopupProcessing();
}
else if (KeyScreenTabIndex == 1 && "29" === GetCurrentScreenID()) {
ServiveNoteTabLoadInitiated = true;
}
}
try {
var grpServiceCount = AutoSaveXMLDom.find('GroupServices').length;
if (grpServiceCount > 1) {
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var dgError = new Error("Duplicate Group Service found: Method:" + methodName);
LogClientSideException(dgError, 'LoadDocumentCallBack', 3);
}
} catch (e) {
}
try {
//This code is written by pradeep which register document specific script
//Changes by Sonia to handle pop up close for common user controls
if (typeof AddCommonUserControlsEventHandlers == 'function') {
returnVal = AddCommonUserControlsEventHandlers();
}
//changes by sonia end here
///Added By Sudhir Singh on date 24 July 2012 as per issue#233 in Threshold 3.5x Merged Issues
if (typeof AddMainEventHandlers == 'function') {
var ans = AddMainEventHandlers();
}
//Change ends here
try {
if (typeof SetScreenSpecificValues == 'function' && CallSetScreenSpecificValues == false) {
SetScreenSpecificValues(AutoSaveXMLDom, objectPageResponse.Action);
}
} catch (ex) {
LogClientSideException(ex, 'SetScreenSpecificValues-Documents');
}
try {
InjectedDFADocument.SetScreenSpecificValues(); //eii 1166
}
catch (ex) {
LogClientSideException(ex, 'InjectedDFADocument-SetScreenSpecificValues-ApplicationCommonFunctions');
}
if (typeof AddEventHandlers == 'function') {
var ans = AddEventHandlers();
}
try {
InjectedDFADocument.AddEventHandler();
}
catch (ex) {
LogClientSideException(ex, 'InjectedDFADocument-AddEventHandler-ApplicationCommonFunctions');
}
if (bindAutoSave == true) {
//BindAutoSaveEvents(); //Commented by Maninder: Added check so as to prevent rebinding of already binded functions on the Services Tab controls
if ((objectPageResponse.Action == pageActionEnum.LoadServiceNoteTab) && $("[id=ServiceNoteTabPage_C1]").length > 0)
BindAutoSaveEvents($("[id=ServiceNoteTabPage_C1]")[0].id);
else
BindAutoSaveEvents();
}
}
catch (ex)
{ }
if (NoteType == -1) {
EnableDisableCopyService(objectPageResponse, "Services", "ServiceId", -1);
}
if (NoteType == -2) {
EnableDisableCopyService(objectPageResponse, "Events", "EventId", -2);
}
//Addedd By Devi Dayal Ref # 3(ThresHold) ClientLifeEventId are addedd in the Document Table to handle ClientLifeEVent id
ClientLifeEventId = $("ClientLifeEventId", $(AutoSaveXMLDom[0], "Documents")).text();
// if (ClientLifeEventId != "") {
// filterData = "ClientLifeEventId=" + ClientLifeEventId;
// }
// Added by Karan
// Puprose : To Lock The Document on successfull opening in Edit mode
// Dated : 05 Dec 2011
// Ref to task #12 Under Threshold Dev. phase II
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentMode != undefined && objectPageResponse.ObjectDocumentInformation.DocumentMode == 'edit') {
InsertDocumentLock();
}
SetScreenToolBarItemsStatus();
SetSummaryofCareToolbar(objectPageResponse);
// Added by: Varinder V
// What: Shifted Permission function after the business logic which does enable/disable Lock/Unlock Button depending upon the document’s status whether locked/unlocked.
// Why: Because Permissions should apply after business logic. E.g. as per business logic, if a document is locked then ‘Unlock’ button needs to be enabled and ‘Lock’ button as disabled. But what if user is not carrying the permission to ‘Unlock’. So, permissions applied after business logic.
// Ref Task #2342 Threshold Bugs/Feature(Offshore)
// Date 11-Dec-2012
SetScreenPermission(objectPageResponse.ScreenControlPermission, null);
if (GetCurrentScreenID() == 29) {
switch (KeyScreenTabIndex) {
case 1:
if ($("div[id$=ServiceNoteTabPage_C1]").length > 0 && $("div[id$=ServiceNoteTabPage_C1]").html().trim() != "" && ($("div[id$=ServiceNoteTabPage_C1] #DivShowNoteHTML").html().trim() != "" ||
($("div[id$=ServiceNoteTabPage_C1] #NoteTabControls").length > 0 && $("div[id$=ServiceNoteTabPage_C1] #NoteTabControls").html().trim() != ""))) {
HidePopupProcessing();
}
else if ($("div[id$=ServiceNoteTabPage_C1]").length == 0) { HidePopupProcessing(); }
break;
case 2:
if ($("div[id$=ServiceNoteTabPage_C2]").length > 0 && $("div[id$=ServiceNoteTabPage_C2]").html().trim() != "" && $("div[id$=ServiceNoteTabPage_C2]").html().trim() != " ") {
HidePopupProcessing();
}
else if ($("div[id$=ServiceNoteTabPage_C2]").length == 0) { HidePopupProcessing(); }
break;
case 3:
if ($("div[id$=ServiceNoteTabPage_C3]").length > 0 && $("div[id$=ServiceNoteTabPage_C3]").html().trim() != "" && $("div[id$=ServiceNoteTabPage_C3]").html().trim() != " ") {
HidePopupProcessing();
}
else if ($("div[id$=ServiceNoteTabPage_C3]").length == 0) { HidePopupProcessing(); }
break;
case 4:
if ($("div[id$=ServiceNoteTabPage_C4]").length > 0 && $("div[id$=ServiceNoteTabPage_C4]").html().trim() != "" && $("div[id$=ServiceNoteTabPage_C4]").html().trim() != " ") {
HidePopupProcessing();
}
else if ($("div[id$=ServiceNoteTabPage_C4]").length == 0) { HidePopupProcessing(); }
break;
case 5:
if ($("div[id$=ServiceNoteTabPage_C5]").length > 0 && $("div[id$=ServiceNoteTabPage_C5]").html().trim() != "" && $("div[id$=ServiceNoteTabPage_C5]").html().trim() != " ") {
HidePopupProcessing();
}
else if ($("div[id$=ServiceNoteTabPage_C5]").length == 0) { HidePopupProcessing(); }
break;
default:
switch (objectPageResponse.Action) {
case pageActionEnum.LoadServiceNoteProcedure:
HidePopupProcessing();
CreateUnsavedChangesInstance();
break;
case "new":
case "update":
case "previous":
case "next":
case "CopyService":
case "":
HidePopupProcessing();
break;
default:
if (KeyScreenTabIndex == 0 && $("div[id$=ServiceNoteTabPage_C0]").length > 0 && ($("div[id$=ServiceNoteTabPage_C0]").html().trim() != "" || $("div[id$=ServiceNoteTabPage_C0]").html().trim() != " ")) {
HidePopupProcessing();
}
break;
}
}
}
//Devinder - Developer will handle screen specific fuctioality on DocumentCallbackComplete method on scree JS.
if (typeof DocumentCallbackComplete == 'function') {
DocumentCallbackComplete(objectPageResponse);
}
SetFocusToFirstControl($("#DivShowDetailHTML"));
// if (objectPageResponse.ObjectDocumentInformation != null) {
// var metaDataId = $('[id$=HiddenFieldMetaDataId]').val();
// if (objectPageResponse.ObjectDocumentInformation.DocumentId == 0 || parseInt(metaDataId) == 0) {
// HideToolbarItems("MetaData");
// // var ctrlMetadata = $('#Button_DocumentInformation_MetaData');
// // if (ctrlMetadata.length > 0) {
// // ctrlMetadata.hide();
// // }
// }
// else {
// // var ctrlMetadata = $('#Button_DocumentInformation_MetaData');
// // if (ctrlMetadata.length > 0) {
// if (parseInt(metaDataId) > 0) {
// //ctrlMetadata.show();
// ShowToolbarItems('MetaData');
// }
// else {
// HideToolbarItems("MetaData");
// }
// // }
// }
// }
//To get the Emergency Access Settings
EmergencyAccessSettings();
//Added by : Shifali
//Added On : 28May2012
//Task Ref : #859(Thresholds Bugs/Features)
//Purpose : Help Icon ToolTip on Detail screen
//Used JQuery plugin "WayfarerTooltip.js", earilier image title icon was being used which was dis-appearing within short time.
GetDetailDocumentScreenHelpIconToolTip();
//Added by AmitSr in ref to Task #100, Interact Support, SC- Client flag is not updating when you change users
//Chita Ranjan - Added condition to display ClientFlags when PageAction is New. Bear River - Support Go Live #335
if (objectPageResponse.IsBannerTabChanged == true || (objectPageResponse.Action == pageActionEnum.Update && objectPageResponse.ScreenId == 373)) {
if (objectPageResponse.Action == "None" || objectPageResponse.Action == "new" || objectPageResponse.Action == "" || (objectPageResponse.Action == pageActionEnum.Update && objectPageResponse.ScreenId == 373)) {
if (objectPageResponse.ClientNotes != null && objectPageResponse.ClientNotes != "") {
$("#div_ClientNoteImages").html("");
$("#tableClientNote_Inprogress").css("display", "block");
$("#div_ClientNoteImages").html(decodeText(objectPageResponse.ClientNotes));
}
else
$("#tableClientNote_Inprogress").css("display", "none");
}
}
try {
if (typeof CrossBrowserCompatability == 'function') {
CrossBrowserCompatability();
}
} catch (ex) { }
}
catch (ex) {
alert(ex);
ActionSignOrComplete = false;
CallBackAction = '';
HidePopupProcessing();
ShowHideErrorMessage("Error", 'false');
}
checkPrivateWindow();
if (IsLandingMeassagePopUploaded) {
HideShowIfame(0);
}
}
//Added by : Manju
//Purpose : To open 'signature window' if both ValidateDocument & CheckwarningsBeforeSign succeeds
//Dated : 10 mar, 2013
function LoadDocumentForValidateAndWarning() {
HidePopupProcessing();
if (objectPageResponse.ValidationInfoHTML == null || objectPageResponse.ValidationInfoHTML == '') {
var XmlDoc = $.xmlDOM(objectPageResponse.ScreenDataSetXml);
var authorId = XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("AuthorId")[0].text.trim();
var reviewerId = -1;
if (XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("ReviewerId").length > 0) {
reviewerId = XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("ReviewerId")[0].text.trim();
}
//var _status = XmlDoc[0].childNodes[0].selectNodes("Documents")[0].selectNodes("CurrentVersionStatusId")[0].text.trim();
if (CurrentVersionStatusId == 25 && LoggedInUserId == authorId) {
if (objectPageResponse.WarningInfoHTML != null && objectPageResponse.WarningInfoHTML != '') {
//ActionSignOrComplete = false;
OpenWarningPopup(CurrentVersionStatusId, authorId, reviewerId);
}
//Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
else if (ActionValidateDocumentPageData) {
ShowHideErrorMessage("Document Validated Successfully", 'true', '', '', 'Success');
}
else {
//if (AuthorActionSave_ToBeReviewedStatus == true) {
if (AuthorActionSign_ToBeReviewedStatus == false) {
HidePopupProcessing();
return false;
}
else if (AuthorActionSign_ToBeReviewedStatus == true) {
AuthorActionSign_ToBeReviewedStatus = false;
CompleteSignatureProcessing();
}
}
}
else {
if (objectPageResponse.WarningInfoHTML != null && objectPageResponse.WarningInfoHTML != '') {
//ActionSignOrComplete = false;
OpenWarningPopup(CurrentVersionStatusId, authorId, reviewerId);
}
//Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
else if (ActionValidateDocumentPageData) {
if (typeof AfterValidate == 'function') {
var IsInvalid = AfterValidate();
if (IsInvalid == true) return;
}
ShowHideErrorMessage("Document Validated Successfully", 'true', '', '', 'Success');
}
else {
CompleteSignatureProcessing();
}
}
}
else {
// ActionSignOrComplete = false;
var hiddenValidationMessage = $('#hiddenValidationMessage');
hiddenValidationMessage.val('');
hiddenValidationMessage.val(objectPageResponse.ValidationInfoHTML);
ShowHideErrorMessage(objectPageResponse.ValidationInfoHTML, "true", "true", "Validations");
}
} //function ends here
//Parameters added to generalize the functionality for Events and Services
function EnableDisableCopyService(objectPageResponse, TableName, PrimaryKeyColumnName, documentNoteType) {
try {
if (objectPageResponse.ScreenDataSetXml != null && objectPageResponse.ScreenDataSetXml != "") {
var xmlDom = $.xmlDOM(objectPageResponse.ScreenDataSetXml);
//Instead of TableName Parameters Name will be used
if (xmlDom[0].childNodes[0].selectNodes(TableName).length > 0) {
if (xmlDom[0].childNodes[0].selectNodes(TableName)[0].selectSingleNode(PrimaryKeyColumnName) != null) {
var PrimaryKeyColumnValue = xmlDom[0].childNodes[0].selectNodes(TableName)[0].selectSingleNode(PrimaryKeyColumnName).nodeTypedValue;
var noteStatus = GetColumnValueInXMLNodeByKeyValue(TableName, PrimaryKeyColumnName, PrimaryKeyColumnValue, 'Status', xmlDom[0]);
//Case for Copy Services
var Button_ServiceNote_CopyService = $('#Button_DocumentInformation_CopyService');
// if (IsNotClientViewingMode == true) {
if (PrimaryKeyColumnValue == 0) {
if (Button_ServiceNote_CopyService != null) {
Button_ServiceNote_CopyService.attr("disabled", true);
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
HideToolbarItems('ScheduleFollowup');
HideToolbarItems('NumberOfTimesRescheduled');
}
}
else if ((PrimaryKeyColumnValue > 0 && (noteStatus == 72 || noteStatus == 73) && documentNoteType == -1)
|| (PrimaryKeyColumnValue > 0 && (noteStatus == 2064) && documentNoteType == -2)
) {
Button_ServiceNote_CopyService.attr("disabled", true);
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
HideToolbarItems('ScheduleFollowup');
HideToolbarItems('NumberOfTimesRescheduled');
}
else if (PrimaryKeyColumnValue > 0) {
if (typeof Button_ServiceNote_CopyService.attr("DefaultDisabled") != 'undefined') {
Button_ServiceNote_CopyService.removeAttr("DefaultDisabled");
}
if (IsNotClientViewingMode == true) {
// Check for active or inactive client. ref to taskk 557 in Sc web other billable. As for Inactive client copy service should be disable. Check for objectPageResponse.Action != pageActionEnum.LoadServiceNoteTab with ref to task 572 in Sc webother billable
if (objectPageResponse.Action != pageActionEnum.LoadServiceNoteTab && (objectPageResponse.ObjectDocumentInformation.ClientStatus == 'N' || objectPageResponse.ObjectDocumentInformation.ClientStatus == "")) {
Button_ServiceNote_CopyService.attr("disabled", true);
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
HideToolbarItems('ScheduleFollowup');
HideToolbarItems('NumberOfTimesRescheduled');
}
else {
Button_ServiceNote_CopyService.attr("disabled", false);
//Added by Akwinass(21-JULY-2014) with ref to task #3 in System Improvements project
ShowToolbarItems('ScheduleFollowup');
ShowToolbarItems('NumberOfTimesRescheduled');
}
}
}
//}
//Added in ref. to task #638
if (objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId != "" && objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId !== 29) {
var hiddenFieldHistoryXML = $('input[id$=hiddenFieldHistoryXML]');
var dom = $.xmlDOM(hiddenFieldHistoryXML.val().replace(/&/g, "&"));
if (dom.find("History[Id=" + CurrentHistoryId + "] ").length > 0) {
var newFilterString = dom.find("History[Id=" + CurrentHistoryId + "] ")[0].selectNodes("FiltersData")[0].text;
if (newFilterString.indexOf('associatedNoteScreenId') == -1) {
newFilterString += "^associatedNoteScreenId=" + objectPageResponse.ObjectDocumentInformation.AssociatedNoteScreenId;
if (PrimaryKeyColumnValue != '' && parseInt(PrimaryKeyColumnValue) > 0) {
UpdateScreenHistoryNode(CurrentHistoryId, CurrentScreenId, "FiltersData", newFilterString);
}
}
}
}
//End
}
}
}
}
catch (ex) {
}
}
//Description:On the Basis of DocumentStatus Identify either we need to show Signature or not
function ValidateStatus() {
// if (IsServiceNote == "true" && ServiceId > 0 && DocumentId == 0) {
// return false;
// }
if (NoteType != 0 && KeyFieldValue > 0 && DocumentId == 0) {
return false;
}
//commented and changed by shifali in ref to task# 11(To Be Reviewed Status)
//else if (DocumentStatusId == 20) {
else if (CurrentVersionStatusId == 20) {
return false;
}
return true;
}
//Description: Enable/Disable the clientNote Tab as per Service Status
//Author:Umesh
//CreatedOn:Jul 09,2010
//function commented by shifali on 6Jan,2010
//function DisableClientNotesDocument(ServiceStatus, SignedStatus, ClientNoteDivId) {
// try {
// if (SignedStatus != 22 && ServiceStatus != "") {
// //71 = show && 75=Complete
//// if (ServiceStatus == "71" || ServiceStatus == "75") {
// if (ServiceStatus == "75") {
// $("input,select,span,textarea", $('#' + ClientNoteDivId)).not("disabled").addClass('Scheduled').attr('disabled', 'disabled');
// }
// else {
// $(".Scheduled", $('#' + ClientNoteDivId)).removeAttr('disabled', 'disabled');
// }
// }
// }
// catch (ex) {
// //alert('Documents.js -- > DisableCLientNotesDocument');
// }
//}
//Description: Enable/Disable the clientNote Tab as per Service Status
//Author:Shifali
//CreatedOn:7Jan,2011
//Purpose: Called to disable the Note tab depending on Service saved status
function DisableClientNotesDocument(ServiceId, ServiceStatus, SavedServiceStatus, SignedStatus, ClientNoteDivId) {
try {
//var clientNoteTab = $("div[id$=GroupServiceClientNoteTabPage_C1]");
//clientNoteTab.GetTab(1).SetEnabled(false);
var divServiceStatusMsg = $("#ServiceStatusMsg");
var buttonSignMyNotes = $('#ButtonSignMyNotes');
var disableCancelNotes = $("input[type='hidden'][id$='HiddenFieldDisableCancelNotes']").val();
var disableNoShowNotes = $("input[type='hidden'][id$='HiddenFieldDisableNoShowNotes']").val();
//remove disable attribute at first of Sign Button/Note tab
buttonSignMyNotes.removeAttr("disabled");
//$(".Scheduled", $('#' + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).find("span[type='button']").each(function () {
EnableSpanButton(this.id);
});
divServiceStatusMsg.attr("display", "none");
divServiceStatusMsg.html("");
//commented and modified by shifali in ref to task# 431
//if (ServiceStatus == 70 && SavedServiceStatus == 70) {//when scheduled ,Disable note tab
if (ServiceStatus == 70) {//when scheduled ,Disable note tab
//commented && modified by shifali in ref to task# 356
$("input,select,span,textarea", $('#' + ClientNoteDivId)).not("disabled").addClass('Scheduled').attr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).not("disabled").addClass('Scheduled').attr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).find("span[type='button']").each(function () {
DisableSpanButton(this.id);
});
divServiceStatusMsg.attr("display", "block");
divServiceStatusMsg.html("Client Note will be Enabled when status is changed from Scheduled.");
return false;
}
if (SavedServiceStatus == 72 && disableNoShowNotes == "Y") {
// no note tab
$("#DivGroupServiceClientNotesContainer").html("");
$("#DivGroupServiceClientNotesContainer").html("The Client's Service Status is No Show, so Note tab is not Visible.");
}
if (SavedServiceStatus == 72 && disableNoShowNotes == "N") {//Enable note tab
//commented && modified by shifali in ref to task# 356
$(".Scheduled", $('#' + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).find("span[type='button']").each(function () {
EnableSpanButton(this.id);
});
//disable sign button
buttonSignMyNotes.attr("disabled", "true");
}
if (SavedServiceStatus == 73 && disableCancelNotes == "Y") {
// no note tab
//clear html of div for client note
$("#DivGroupServiceClientNotesContainer").html("");
$("#DivGroupServiceClientNotesContainer").html("The Client's Service Status is Cancel, so Note tab is not Visible.");
}
if (SavedServiceStatus == 73 && disableCancelNotes == "N") {//Enable note tab
//commented && modified by shifali in ref to task# 356
$(".Scheduled", $('#' + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).removeAttr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).find("span[type='button']").each(function () {
EnableSpanButton(this.id);
});
//disable sign button
buttonSignMyNotes.attr("disabled", "true");
}
if (SavedServiceStatus == 76) {
//commented && modified by shifali in ref to task# 356
$("input,select,span,textarea", $('#' + ClientNoteDivId)).not("disabled").addClass('Scheduled').attr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).not("disabled").addClass('Scheduled').attr('disabled', 'disabled');
$("div", $("#" + ClientNoteDivId)).find("span[type='button']").each(function () {
DisableSpanButton(this.id);
});
}
return false;
}
catch (ex) {
}
}
function PopulateControlsForGroupServices(objectPageResponse, outputHtml) {
//SetTitleBarText(objectPageResponse.PageTitle); //Set Title Bar's Text
var dom = $.xmlDOM(objectPageResponse.PageDataSetXml)
var TempDom = dom;
//var dom = $.xmlDOM(objectPageResponse.PageDataSetXml)
// SetRequiredTextBoxColor();
// SetFormValues(dom);
//Populate Document CustomInformation -Added by Vikas
if (objectPageResponse.ObjectDocumentInformation != null) {
// SetDocumentInformation(objectPageResponse.ObjectDocumentInformation)
TabUcPath = objectPageResponse.LoadedUcPath;
}
var PermissionDom = $.xmlDOM(objectPageResponse.PagePemissions);
PageTitle = objectPageResponse.PageTitle;
RenderPagePermissions(PermissionDom);
//Set onblur attribute to required textbox(For Validation purpose) to remove or add the border color.
$("input[required='required']").blur(function () {
if (jQuery.trim($(this)[0].value) != "") {
RemovedRequiredTextBoxColor($(this))
}
});
ShowHideErrorMessage("", 'false', "", "", "", "", 'false');
//SetClientId(objectPageResponse.ClientId, objectPageResponse.ClientName); //Change Client Text
var documentRow = 'DocumentVersions>DocumentId[text=' + objectPageResponse.ObjectDocumentInformation.DocumentId + ']';
var docummentRowDom = $(documentRow, dom);
var docversionid = $('DocumentVersionId', docummentRowDom.parent()).text();
var documentVersionId = docversionid;
docversionid = 'DocumentVersionId[text=' + docversionid + ']'
// var docversionid='DocumentVersionId[text='+objectPageResponse.ObjectDocumentInformation.DocumentVersionId+']';
var documentDom = $(docversionid, dom).parent();
var xmlDataSet = new String("");
var nodesxml = "";
for (var i = 0; i < documentDom.length; i++) {
nodesxml = nodesxml + " " + documentDom[i].xml;
}
xmlDataSet = xmlDataSet + "" + nodesxml + " " + "";
var dom1 = $.xmlDOM(xmlDataSet);
if (PageControl_Group_Clients_Notes.activeTabIndex == 0) {
//commented & added by shifali in ref to call individual document level SetformValues& setScreenSpecific
//SetFormValues(dom1, "DivGroupNodeContents"); // Moved the positioning of this function. - Devinder Pal Singh
SetFormData("DivGroupNodeContents", dom1);
try {
if (typeof SetScreenSpecificValues == 'function') {
SetScreenSpecificValues(dom1, objectPageResponse.Action);
}
} catch (ex) {
LogClientSideException(ex, 'SetScreenSpecificValues-Documents');
}
// BindAutoSaveEventsForGroupServiceDocuements($("#DivGroupNodeContents"), docversionid)
BindAutoSaveEventsForGroupServiceDocuements($("#DivGroupNodeContents"), documentVersionId);
}
else if (PageControl_Group_Clients_Notes.activeTabIndex == 1) {
//commented & added by shifali in ref to call individual document level SetformValues& setScreenSpecific
//SetFormValues(dom1, "DivGroupServiceClientNotesContainer"); // Moved the positioning of this function. - Devinder Pal Singh
SetFormData("DivGroupServiceClientNotesContainer", dom1);
try {
if (typeof SetScreenSpecificValues == 'function') {
SetScreenSpecificValues(dom1, objectPageResponse.Action);
}
} catch (ex) {
LogClientSideException(ex, 'SetScreenSpecificValues-Documents');
}
// BindAutoSaveEventsForGroupServiceDocuements($("#DivGroupNodeContents"), docversionid)
BindAutoSaveEventsForGroupServiceDocuements($("#DivGroupServiceClientNotesContainer"), documentVersionId);
}
// if (objectPageResponse.ObjectDocumentInformation != null) {
// SetDocumentGlobalVaribales(objectPageResponse.ObjectDocumentInformation);
// }
}
function PopulateControls(objectPageResponse, outputHtml) {
SetTitleBarText(objectPageResponse.PageTitle); //Set Title Bar's Text
var dom = $.xmlDOM(objectPageResponse.PageDataSetXml)
//var dom = $.xmlDOM(objectPageResponse.PageDataSetXml)
// SetRequiredTextBoxColor();
// SetFormValues(dom);
//Populate Document CustomInformation -Added by Vikas
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.Action != pageActionEnum.LoadServiceNoteTab && objectPageResponse.Action != pageActionEnum.LoadServiceNoteProcedure && objectPageResponse.Action != pageActionEnum.LoadDocInBedCensus) {
SetDocumentInformation(objectPageResponse.ObjectDocumentInformation);
TabUcPath = objectPageResponse.LoadedUcPath;
}
else if (objectPageResponse.Action == pageActionEnum.LoadServiceNoteTab && KeyScreenTabIndex != 1) {
_AssociatedScreenTabUcPath = objectPageResponse.LoadedUcPath;
}
else if (objectPageResponse.Action == pageActionEnum.LoadServiceNoteTab && KeyScreenTabIndex == 1) {
TabUcPath = objectPageResponse.LoadedUcPath;
}
var PermissionDom = $.xmlDOM(objectPageResponse.PagePemissions)
PageTitle = objectPageResponse.PageTitle
RenderPagePermissions(PermissionDom);
//Set onblur attribute to required textbox(For Validation purpose) to remove or add the border color.
$("input[required='required']").blur(function () {
if (jQuery.trim($(this)[0].value) != "") {
RemovedRequiredTextBoxColor($(this))
}
});
ShowHideErrorMessage("", 'false', null, null, null, null, false);
SetClientId(objectPageResponse.ClientId, objectPageResponse.ClientName); //Change Client Text
SetFormData();
// SetFormValues(dom); // Moved the positioning of this function. - Devinder Pal Singh
try {
if (typeof SetScreenSpecificValues == 'function') {
CallSetScreenSpecificValues = true;
SetScreenSpecificValues(AutoSaveXMLDom, objectPageResponse.Action);
}
} catch (ex) {
LogClientSideException(ex, 'SetScreenSpecificValues-Documents');
}
//To handle common user control's Screen Specififc Functions
// 17 April 2012
if (typeof SetCommonUserControlScreenSpecificValues == 'function') {
SetCommonUserControlScreenSpecificValues(dom, objectPageResponse.Action);
}
CreateInitializationImages(dom);
PopulateParentChildAutoSave(objectPageResponse.AutoSaveParentChildXml);
}
function SetControlValue(objectPageResponse) {
SetTitleBarText(objectPageResponse.PageTitle); //Set Title Bar's Text
var dom = $.xmlDOM(objectPageResponse.PageDataSetXml)
//Populate Document CustomInformation -Added by Vikas
if (objectPageResponse.ObjectDocumentInformation != null) {
SetDocumentInformation(objectPageResponse.ObjectDocumentInformation)
TabUcPath = objectPageResponse.LoadedUcPath;
}
var PermissionDom = $.xmlDOM(objectPageResponse.PagePemissions)
PageTitle = objectPageResponse.PageTitle
RenderPagePermissions(PermissionDom);
//Set onblur attribute to required textbox(For Validation purpose) to remove or add the border color.
$("input[required='required']").blur(function () {
if (jQuery.trim($(this)[0].value) != "") {
RemovedRequiredTextBoxColor($(this))
}
});
ShowHideErrorMessage("", 'false');
SetClientId(objectPageResponse.ClientId, objectPageResponse.ClientName); //Change Client Text
SetFormValues(dom); // Moved the positioning of this function. - Devinder Pal Singh
//Following has sbeen added but instead of SetFormValues and SetScreenSpecificValues
//SetFormData should be called
if (typeof SetMainScreenSpecificValues == 'function') {
SetMainScreenSpecificValues(dom, objectPageResponse.Action);
}
if (typeof SetScreenSpecificValues == 'function') {
SetScreenSpecificValues(dom, objectPageResponse.Action);
}
// This try catch block added by Vichee 17Jan2014 Task Reference Core Bugs #1345
try {
if (typeof SetDiagnosisIAndIIHiddenOrderField == 'function') {
SetDiagnosisIAndIIHiddenOrderField(dom);
}
}
catch (ex) { }
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose Handle document navigation(Next Previous).
function DocumentNavigation(action) {
try {
//Added by sourabh : To close validation popup
ShowHideErrorMessage("", "false", "true", "");
documentAction = action;
//Code added by Loveena for Unsave CM/PA Changes
if ((Dirty == "True" || UnsavedChangeId > 0) && ApplicationId != undefined && (ApplicationId == 2 || ApplicationId == 1 || ApplicationId == 4)) {
ShowMsgBox('Do you want to save the current document?', ConfirmationMessageCaption, MessageBoxButton.YesNoCancel, MessageBoxIcon.Question, 'MessageBoxUnsavedEventConfirm(\'yes\',\'' + documentAction + '\')', 'MessageBoxUnsavedEventConfirm(\'no\',\'' + documentAction + '\')', undefined, undefined, undefined, undefined, 10);
return false; //False returned by sonia to Manage History as otherwise new history node is created
}
if (action == "previous") { if (PreviousDocumentId == 0 || PreviousDocumentId == undefined) return false; }
if (action == "next") { if (NextDocumentId == 0 || NextDocumentId == undefined) return false; }
// Function to store the outerContainer Html in PDFJsContainer div
GetPDFOuterContainerHTML();
//Temp Code to stop post back
if ($("#DivOpenURL") != null && $("#DivOpenURL").length > 0) {
$("#DivOpenURL")[0].innerHTML = '';
$("#DivOpenURL").html('');
$("#DivOpenUrlContainer").hide(); //Added by Maninder
}
AutoSavePageData();
var filterData = '';
var newScreenId;
var newDocumentId;
//Variable declared by Sonia ref 116 of Sc web Phase II issues
//AssociatedScreenId must be sent when request for opening previous or next document is being sent
var newassociatedScreenId = null;
//Changes end here
if (action == "previous") {
if (PreviousDocumentId == 0 || PreviousDocumentId == undefined) {
return false;
}
newScreenId = PreviousScreenId;
newDocumentId = PreviousDocumentId;
//Changes with reference to 116
//AssociatedScreenId must be sent when request for opening previous or next document is being sent
newassociatedScreenId = PreviousScreenAssociatedScreenId;
//changes end here
}
else if (action == "next") {
if (NextDocumentId == 0 || NextDocumentId == undefined) {
return false;
}
newScreenId = NextScreenId;
newDocumentId = NextDocumentId;
//Changes with reference to 116
//AssociatedScreenId must be sent when request for opening previous or next document is being sent
newassociatedScreenId = NextScreenAssociatedScreenId;
//Changes end here
}
CurrentScreenId = newScreenId;
$('input[id$=hiddenFieldCurrentScreenId]').val(newScreenId);
PopupProcessing();
// if (CurrentScreenId == "29")
if (CurrentScreenId == KeyScreenId) {
// filterData = 'IsServiceNote=true^documentId=' + newDocumentId + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName;
//Changes with reference to ticket 116
//AssociatedScreenId must be sent when request for opening previous or next document is being sent
var documentNoteType = 0;
if (KeyScreenId == 32)
documentNoteType = -2;
else
documentNoteType = -1;
filterData = 'documentId=' + newDocumentId + '^keyscreenid=' + KeyScreenId + '^keyfieldvalue=' + KeyFieldValue + '^TabId=2^notetype=' + documentNoteType + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName + '^associatedNoteScreenId=' + newassociatedScreenId;
//Changes end here
}
else {
filterData = 'documentId=' + newDocumentId + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName;
}
if (objectPageResponse.ScreenId === 29) {
if (typeof ServiceNoteTabPage != 'undefined') {
KeyScreenTabIndex = 0;
ServiceNoteTabPage.activeTabIndex = 0;
}
}
// $.post("../BasePages/Documents.aspx?scId=" + newScreenId, 'action=' + action + '&isExternalURL=' + isExternalURL + "&ajaxRequest=true&historyId=" + CurrentHistoryId + '&requestParametersValues=' + filterData, LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + newScreenId,
data: 'action=' + action + '&isExternalURL=' + isExternalURL + "&ajaxRequest=true&historyId=" + CurrentHistoryId + '&requestParametersValues=' + filterData,
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while navigate document. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in DocumentNavigation - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
}
catch (ex) {
alert(ex);
}
}
function NavigateTodocument(action) {
if (action == "previous") { if (PreviousDocumentId == 0 || PreviousDocumentId == undefined) return false; }
if (action == "next") { if (NextDocumentId == 0 || NextDocumentId == undefined) return false; }
// Function to store the outerContainer Html in PDFJsContainer div
GetPDFOuterContainerHTML();
//Temp Code to stop post back
if ($("#DivOpenURL") != null && $("#DivOpenURL").length > 0) {
$("#DivOpenURL")[0].innerHTML = '';
$("#DivOpenURL").html('');
$("#DivOpenUrlContainer").hide(); //Added by Maninder
}
AutoSavePageData();
var filterData = '';
var newScreenId;
var newDocumentId;
if (action == "previous") {
if (PreviousDocumentId == 0 || PreviousDocumentId == undefined) {
return false;
}
newScreenId = PreviousScreenId;
newDocumentId = PreviousDocumentId;
}
else if (action == "next") {
if (NextDocumentId == 0 || NextDocumentId == undefined) {
return false;
}
newScreenId = NextScreenId;
newDocumentId = NextDocumentId;
}
CurrentScreenId = newScreenId;
$('input[id$=hiddenFieldCurrentScreenId]').val(newScreenId);
PopupProcessing();
// if (CurrentScreenId == "29")
if (CurrentScreenId == KeyScreenId) {
// filterData = 'IsServiceNote=true^documentId=' + newDocumentId + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName;
filterData = 'documentId=' + newDocumentId + '^keyscreenid=' + KeyScreenId + '^keyfieldvalue=' + KeyFieldValue + '^TabId=2^notetype=-1' + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName;
}
else {
filterData = 'documentId=' + newDocumentId + '^DocumentNavigationId=' + DocumentNavigationId + '^DocumentNavigationName=' + DocumentNavigationName;
}
// $.post("../BasePages/Documents.aspx?scId=" + newScreenId, 'action=' + action + '&isExternalURL=' + isExternalURL + "&ajaxRequest=true&historyId=" + CurrentHistoryId + '&requestParametersValues=' + filterData, LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + newScreenId,
data: 'action=' + action + '&isExternalURL=' + isExternalURL + "&ajaxRequest=true&historyId=" + CurrentHistoryId + '&requestParametersValues=' + filterData,
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while navigate to document. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in NavigateTodocument - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
}
/**************************************************************************************/
/**************************************************************************************/
//Purpose Update Current opened document.
var _GlobalXmlString;
function SaveDocument(xmlString, IsRecordExistForProxy) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SaveDocument", "xmlString - " + isNullORUndefined(xmlString) + "^" + "IsRecordExistForProxy - " + isNullORUndefined(IsRecordExistForProxy) + "");
_GlobalXmlString = xmlString;
if (ValidationBeforeUpdate()) {
/* var screenId = GetCurrentScreenID();
var UserHiddenXMLschema = $('input[id$=hiddenXMLSchema]').val();
var returnValue = 'TRUE';
var filterData = '';
filterData = 'UnsavedChangeId=' + UnsavedChangeId + '^documentId=' + DocumentId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "^IsRecordExistForProxy=" + IsRecordExistForProxy + "^newAuhorId=" + newAuhorId + "^newauthorname=" + newAuthorName;
if (CallBackAction != '') {
filterData += '^CallBackAction=' + CallBackAction;
CallBackAction = '';
}
if (associatedNoteScreenId != undefined) {
filterData += "^associatedNoteScreenId=" + associatedNoteScreenId;
}
if (TabIndex != undefined) {
filterData += "&TabIndex=" + TabIndex;
}
*/
//if (DocumentStatusId == 22) {//commented by shifali in ref to task# 11(To Be Revieiwed Changes)
if (CurrentVersionStatusId == 22) {
// returnValue = window.showModalDialog("../ValidatePassword.aspx?staffId=" + LoggedInUserId, "Validate Password", "center:yes;resizable:no;dialogWidth:320px;dialogHeight:200px;");
// OpenPage(11829, 10156, 'staffId=' + LoggedInUserId + '^IsRecordExistForProxy=' + IsRecordExistForProxy, null, _ApplicationBasePath, 'T', "dialogHeight: 200px; dialogWidth: 350px;dialogTitle:Validate Password");
OpenPage(5765, 69, 'staffId=' + LoggedInUserId + '^IsRecordExistForProxy=' + IsRecordExistForProxy, null, _ApplicationBasePath, 'T', "dialogHeight: 240px; dialogWidth: 370px;dialogTitle:Validate Password");
if (closeScreen == true) {
CallBackAction = 'closescreen';
closeScreen = null;
}
return false;
}
else {
// ProcessValidatePassword(CallBackAction, IsRecordExistForProxy); //Comented after removing callback argurment
ProcessValidatePassword(IsRecordExistForProxy);
}
/*
if (returnValue != '' && returnValue != undefined) {
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'action=update&ajaxRequest=true' + '&xmlString=' + encodeText(xmlString) + '&requestParametersValues=' + filterData,
success: LoadDocumentCallBack
});
PopupProcessing();
}
*/
}
else {
closeScreen = null;
return false;
}
closeScreen = null;
return false;
}
//Created on 13 May,2010 Purpose : Process return value from modal popup
//function ProcessValidatePassword(CallBackAction, _GlobalIsRecordExistForProxy) {
function ProcessValidatePassword(_GlobalIsRecordExistForProxy) {//Removed CallbackAction argument
DocumentNavigationName = DocumentNavigationName.replace(/&/g, '');
var screenId = GetCurrentScreenID();
var UserHiddenXMLschema = $('input[id$=hiddenXMLSchema]').val();
var returnValue = 'TRUE';
var filterData = '';
var filterdataCustom = '';
if (closeScreen == true) {
CallBackAction = 'closescreen';
closeScreen = null;
}
filterData = 'UnsavedChangeId=' + UnsavedChangeId + '^documentId=' + DocumentId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "^IsRecordExistForProxy=" + _GlobalIsRecordExistForProxy + "^newAuhorId=" + newAuhorId + "^newauthorname=" + newAuthorName;
if (CallBackAction != '') {
filterData += '^CallBackAction=' + CallBackAction;
CallBackAction = '';
}
if (NoteType == -1) {
filterData += "^TabId=2";
}
if (NoteType == -2) {
filterData += "^TabId=2";
}
if (associatedNoteScreenId != undefined) {
filterData += "^associatedNoteScreenId=" + associatedNoteScreenId;
}
//Note Type check added by Sonia with ref to ticket #2088 of
//SC Web Architecture and Core Application
if (KeyScreenTabIndex != undefined && NoteType != 0) {
filterData += "^KeyScreenTabIndex=" + KeyScreenTabIndex;
}
if (KeyScreenTabName != undefined) {
filterData += "^KeyScreenTabName=" + KeyScreenTabName;
}
if (KeyScreenId != undefined) {
filterData += "^KeyScreenId=" + KeyScreenId;
}
///Done as per requirement for warning on update the documents by Sudhir Singh 28 march 2012
if (checkForWarnings != undefined) {
filterData += "^checkForWarnings=" + ((checkForWarnings == true) ? "1" : "0");
}
/* if (TabIndex != undefined) {
filterData += "&TabIndex=" + TabIndex;
}*/
//Added by Maninder: to prevent AutoSavePageData() from posting data to AjaxUnSavedChanges.aspx
AutoSaveCallSent = true;
//Added by Manju on 12th March, 2013 -
//Purpose : filterdata modified[new key/value pair added], to differentiate the call is made through save button click / sign button click
if (ActionSignOrComplete != undefined) {
filterData += "^ActionSignOrComplete=" + ActionSignOrComplete;
//filterData = filterData.replace(/&/g, '');
}
if (typeof SetFilterParameterValueOnServiceNoteSave == 'function') {
filterdataCustom = SetFilterParameterValueOnServiceNoteSave();
if (filterdataCustom) {
if (String(filterdataCustom).indexOf("^", 0) != 0)
filterdataCustom = "^" + filterdataCustom;
filterData = filterData + filterdataCustom;
}
}
// 02/02/16 - copy detail screen functionality to pass filters on save
if (typeof SetFilterParameterValueOnSave == 'function') {
filterdataCustom = SetFilterParameterValueOnSave();
if ((filterdataCustom != 'undefined') && (filterdataCustom != null) && filterdataCustom != '') {
/*Check If custom filter data not contain ^ at begeining*/
if (String(filterdataCustom).indexOf("^", 0) != 0) {
filterdataCustom = "^" + filterdataCustom;
}
filterData = filterData + filterdataCustom;
}
}
//EII 1166
if (returnValue != '' && returnValue != undefined) {
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=update&ajaxRequest=true&"&TabIndex=' + TabIndex + '&historyId=' + CurrentHistoryId + '&xmlString=' + encodeText(_GlobalXmlString) + '&requestParametersValues=' + filterData + "&BrowserWindowTimeStamp=" + $('input[id$=BrowserWindowTimeStamp]').val() + "&xml2jsonSuccess=" + xml2jsonSuccess + "&DFATabIndex=" + dfaTabIndex,
// success: LoadDocumentCallBack,
// error: AjaxCallbackOnError,
// timeout: AjaxCallTimeout
success: function (result) { AutoSaveCallSent = false; LoadDocumentCallBack(result); },
error: function (jqXHR, textStatus, errorThrown) { AutoSaveCallSent = false; AjaxCallbackOnError(jqXHR, textStatus, errorThrown) },
timeout: function (timeOut) { AutoSaveCallSent = false; AjaxCallTimeout(timeOut); }
});
PopupProcessing();
return true;
}
}
/**************************************************************************************/
//Author - Devinder pal singh
//Purpose -Update the EffectiveDate in the session dataset.
function UpdateDocumentEffectiveDate(objectTextBoxEffectiveDate) {
var screenId = GetCurrentScreenID();
var effectiveDate = $('#TextBox_DocumentInformation_EffectiveDate')[0].value;
var filterString = 'documentId=' + DocumentId + '^effectivedate=' + effectiveDate;
if (EffectiveDate == effectiveDate) {
return false;
}
//As per discussion with David for UM two in user changes effective date and set to null ref ticket 273 UM two
//Then old effective date must be restored
EffectiveDate = effectiveDate;
CreateAutoSaveXml('Documents', 'EffectiveDate', effectiveDate);
CreateAutoSaveXml('DocumentVersions', 'EffectiveDate', effectiveDate);
//As per requirement discussed by David for UM TWO event handler should be called
//As in some documents based on effective date changes some custom functionality is required ref ticket 273 UM two
if (typeof CustomEffectiveDateOnChangeEventHandler == 'function') {
CustomEffectiveDateOnChangeEventHandler(effectiveDate);
}
}
/**************************************************************************************/
//Author - Devinder pal singh
//Purpose -Sign Document
function SignDocument() {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SignDocument", "");
//What & why - If Screen is locked, we need to show warning to user as save/delete/Move/Sign is not allowed for locked screen
//Ref task# 2342 (Thresholds bugs/features)
if (CheckScreenLockedByLoggedInUser(undefined) == false) {
ShowHideErrorMessage("Information cannot be modified as it is locked", 'true', false, "", "Information");
return false;
}
/* Added by Anto in ref of Philhaven Development task no 233 */
/* To call the documents comments page while clicking the sign document button*/
var DocumentcommentStatus = AutoSaveXMLDom.find("Documents:first Status").text()
var DocumentversioncommentStatus = AutoSaveXMLDom.find("Documents:first CurrentVersionStatus").text()
if ($("input[id$=hidden_ShowDocumentVersionComments]").val() == 'true') {
if (DocumentcommentStatus == 22 && DocumentversioncommentStatus != 22) {
//editcomments = false
var ret = DocumentComments('S');
if (ret == false) {
return ret;
}
}
}
/* Philhaven Development task no 233 Ends here */
if (typeof OpenCustomPopup == 'function') {
isCustomScreen = OpenCustomPopup();
if (!isCustomScreen) {
return false;
}
}
ActionSignOrComplete = true;
ActionValidateDocumentPageData = false;
//added by shifali in ref to task# 11(To be reviewed document status)
//if (LoggedInUserId == AuthorId && DocumentStatusId == "25") {
if (LoggedInUserId == AuthorId && CurrentVersionStatusId == "25") {
AuthorActionSign_ToBeReviewedStatus = true;
}
//changes end here
SavePageData();
// if (DocumentStatusId == '22') {commented by shifali in ref to task# 11(To be reviewed document status)
if (CurrentVersionStatusId == '22') {
$('#Button_DocumentInformation_Sign').attr("disabled", "true");
}
else {
$('#Button_DocumentInformation_Sign').attr("disabled", false);
}
}
//Author - Jagdeep Hundal
//Purpose -//Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
function ValidateDocumentPageData() {
ActionSignOrComplete = true;
ActionValidateDocumentPageData = true;
SavePageData();
if (CurrentVersionStatusId == '22') {
$('#Button_DocumentInformation_Sign').attr("disabled", "true");
}
else {
$('#Button_DocumentInformation_Sign').attr("disabled", "");
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Check validation before signing document.
/*function ValidateBeforeSignDocument() {
if ($("input[name=Radio_SignerList]:checked").length > 0) {
var objectSelectRadio = $("input[name=Radio_SignerList]:checked")[0];
SignerId = objectSelectRadio.getAttribute("SignerID");
SignerType = objectSelectRadio.getAttribute("SignerType");
SignatureId = objectSelectRadio.getAttribute("SignatureId");
SignerName = objectSelectRadio.getAttribute("SignerName");
if (SignerId == AuthorId) {
SignDocument();
}
else {
$("input[name=Radio_SignerList]:checked=true")[0].focus();
//To check edit and view mode
if ($('#DivShowDetailHTML')[0].style.display != 'none') {
SignDocument();
}
else {
OpensignaturePad(SignerId, SignerType, SignatureId, SignerName);
}
}
}
}
*/
function ValidateBeforeSignDocument() {
if ($("input[name=Radio_SignerList]:checked").length > 0) {
var objectSelectRadio = $("input[name=Radio_SignerList]:checked")[0];
SignerId = objectSelectRadio.getAttribute("SignerID");
SignerType = objectSelectRadio.getAttribute("SignerType");
SignatureId = objectSelectRadio.getAttribute("SignatureId");
SignerName = objectSelectRadio.getAttribute("SignerName");
EnableCoSigner = objectSelectRadio.getAttribute("EnableCoSigner");
if (IsLatestVersionSelected == false) {
ShowMsgBox('Please select the current version before signing the document.', 'Confirmation', MessageBoxButton.OK, MessageBoxIcon.Information);
return false;
}
if (SignerId == AuthorId && SignerType != 'C') {
SignDocument();
} //EO SignerId == AuthorId
else {
//############################################## Start ##############
// Code Block added by Karan
// Purpose : Dont allow author to sign document on behalf of co-signer
//dated : 31 Jan 2012
// ref task #24 Threshold Dev Phase II
if (typeof SetFlagForCoSigner == 'function') {
SetFlagForCoSigner();
}
if (SignerType == 'S' && SignerId != LoggedInUserId && (EnableCoSigner == 'False' && RequiresSignature == 'Y')) {
ShowMsgBox('Co-Signers can only sign documents after logging in as themselves.', 'Information', MessageBoxButton.OK, MessageBoxIcon.Information);
return false;
}
//############################################### End ###############
$("input[name=Radio_SignerList]:checked=true")[0].focus();
//To check edit and view mode
if ($('#DivShowDetailHTML')[0].style.display != 'none') {
SignDocument();
}
else {
if (UnsavedChangeId > 0) {
//OpenPage(11829, 10155, '', null, GetRelativePath(), 'T', "dialogHeight:220px; dialogWidth: 450px;dialogTitle:Unsaved Versions Sign");
ShowMsgBox('The application has unsaved version of document.', 'Unsaved Versions Sign', MessageBoxButton.SaveDiscardAllCancel, MessageBoxIcon.Question, 'MessageBoxSaveDocument()', 'MessageBoxDeleteUnSavedChanges()');
//Show Pop to ask for save/discard
// var returnvalue = "C";
// if (returnvalue == "S") {
// SignDocument();
// }
// else if (returnvalue == "D") {
// //Delete from unsaved
// DeleteUnsavedChangesById(UnsavedChangeId, 'N');
// OpensignaturePad(SignerId, SignerType, SignatureId, SignerName);
// return false;
// }
// else if (returnvalue == "C" || returnvalue == 'undefined' || returnvalue == undefined) {
// return false;
// }
}
else {
OpensignaturePad(SignerId, SignerType, SignatureId, SignerName);
}
}
}
}
}
/* Not in use 21 May 2010
function OnReturnUnsavedVersionSign(returnvalue) {
if (returnvalue == "S") {
SignDocument();
}
else if (returnvalue == "D") {
//Delete from unsaved
DeleteUnsavedChangesById(UnsavedChangeId, 'N');
OpensignaturePad(SignerId, SignerType, SignatureId, SignerName);
return false;
}
else if (returnvalue == "C" || returnvalue == 'undefined' || returnvalue == undefined) {
return false;
}
}
*/
/* ****************************Modified on 21 May by Mahesh*/
function MessageBoxSaveDocument() {
SignDocument();
}
function MessageBoxDeleteUnSavedChanges() {
DeleteUnsavedChangesById(UnsavedChangeId, 'N');
OpensignaturePad(SignerId, SignerType, SignatureId, SignerName);
return false;
}
/****************************EOF Modification commented and get from backup *************************
//Author - Devinder Pal Singh.
//Purpose - Create a new document.
function CreateNewDocumentPage() {
try {
var screenId = GetCurrentScreenID();
var filterData = "";
//Call AutoSave in case of document in inprogress mode
if (DocumentId > 0) {
AutoSavePageData();
}
//Current screen have unsaved data with document status "New".
//Open a popup screen to prompt user to saved data.
if ((DocumentId == 0) && (Dirty == "True" || UnsavedChangeId != 0)) {
//Modified on 21 May, 2010
// returnValue = window.showModalDialog("../UnsavedDocumentPopup.aspx", "", "center:yes;resizable:no;dialogWidth:450px;dialogHeight:200px;");
ShowMsgBox('Do you want to save the current document?', ConfirmationMessageCaption, MessageBoxButton.YesNoCancel, MessageBoxIcon.Question, 'MessageBoxUnsavedDocumentYesOption()', 'MessageBoxUnsavedDocumentNoOption(\''+UnsavedChangeId+'\')', 'MessageBoxUnsavedDocumentCancelOption()');
}
//current screen with no unsaved data with document status "New".
if (Dirty == "False" || DocumentId > 0) {
PopupProcessing();
// if (screenId == "29") { //Condition Added by Vikas Vyas in ref to implement Service Note Architecture
if (screenId == KeyScreenId) { //Condition Added by Vikas Vyas in ref to implement Service Note Architecture
// filterData = "IsServiceNote=true^serviceId=0^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
filterData = "keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData,
success: LoadDocumentCallBack
});
}
else {
filterData = "DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData,
success: LoadDocumentCallBack
});
}
}
//For setting div scroll
SetDivScroll();
}
catch (e) {
}
}
/*******************These fucniton are used in CreateNewDocumentPage()********************/
/* Call from backuped fucntion 24 May 2010, ****************/
//Modified On 24 May
// Modifeid By Vikas Monga
//Purpose :Implement the coustom message box
function CreateNewDocumentPage() {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "CreateNewDocumentPage", "");
try {
ShowHideErrorMessage("", "false", "true", "");
var screenId = GetCurrentScreenID();
var hiddenFieldHistoryXML = $('input[id$=hiddenFieldHistoryXML]');
var dom = $.xmlDOM(hiddenFieldHistoryXML.val().replace(/&/g, "&"));
if (dom.find("History[Id=" + CurrentHistoryId + "] TabTree").text() != '') {
var jsonTreeObj = $.parseJSON(decodeText(dom.find("History[Id=" + CurrentHistoryId + "] TabTree").text()));
if (jsonTreeObj.length > 1) {
UpdateScreenHistoryNode(CurrentHistoryId, screenId, "TabTree", '')
}
}
var filterData = "";
ShowICD10MessageforOldDiagnosis();
//Call AutoSave in case of document in inprogress mode
if (DocumentId > 0) {
AutoSavePageData();
}
//Following added by Sonia ref PA Ticket 561 for CM/PA we need to give prompt to user
//In case data is not saved and user clicked on new for Documents with Id >0
if (ApplicationId != undefined && (ApplicationId == 2 || ApplicationId == 1) && (DocumentId > 0) && (Dirty == "True" || UnsavedChangeId != 0)) {
var _documentAction = pageActionEnum.New;
ShowMsgBox('Do you want to save the current document?', ConfirmationMessageCaption, MessageBoxButton.YesNoCancel, MessageBoxIcon.Question, 'MessageBoxUnsavedEventConfirm(\'yes\',\'' + _documentAction + '\')', 'MessageBoxUnsavedEventConfirm(\'no\',\'' + _documentAction + '\')');
return false; //False returned by sonia to Manage History as otherwise new history node is created
}
//Changes end here
//Current screen have unsaved data with document status "New".
//Open a popup screen to prompt user to saved data.
if ((DocumentId == 0) && (Dirty == "True" || UnsavedChangeId != 0)) {
ShowMsgBox('Do you want to save the current document?', ConfirmationMessageCaption, MessageBoxButton.YesNoCancel, MessageBoxIcon.Question, 'MessageBoxUnsavedDocumentConfirm(\'yes\')', 'MessageBoxUnsavedDocumentConfirm(\'no\')');
return false; //False returned by sonia to Manage History as otherwise new history node is created
returnValue = window.showModalDialog("../UnsavedDocumentPopup.aspx", "", "center:yes;resizable:no;dialogWidth:450px;dialogHeight:200px;");
if (returnValue == undefined) {
return false; //False returned by sonia to Manage History as otherwise new history node is created
}
if (returnValue != '' && returnValue != undefined) {
//If user select "Yes" option.
//Save the current screen instance
//Discard from unsaved list.
//open the new instance.
if (returnValue == "Yes") {
CallBackAction = pageActionEnum.New;
SavePageData();
}
if (returnValue == "No") {
DeleteUnsavedChangesById(UnsavedChangeId);
//If user select "No" option.
//Discard from unsaved list.
//open the new instance.
PopupProcessing();
if (NoteType == -1 && KeyScreenId == 0) {
KeyScreenId = screenId;
}
if (typeof OpenCustomScreen == 'function') {
isCustomScreen = OpenCustomScreen(screenId);
if (!isCustomScreen) {
return false;
}
}
if (screenId == KeyScreenId) { //Condition Added by Vikas Vyas in ref to implement Service Note/Events Architecture
// filterData = "IsServiceNote=true^serviceId=0^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
//Addedd By Devi Dayal Ref # 3(ThresHold) ClientLifeEventId are addedd in the Document Table to handle ClientLifeEVent id
filterData = "NoteType=" + NoteType + "^keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName; //+"^ClientLifeEventId=" + ClientLifeEventId;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
else {
//Addedd By Devi Dayal Ref # 3(ThresHold) ClientLifeEventId are addedd in the Document Table to handle ClientLifeEVent id
filterData = "NoteType=" + NoteType + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName; //+ "^ClientLifeEventId=" + ClientLifeEventId;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL,
data: 'action=new&ajaxRequest=true&historyId=' + CurrentHistoryId + '&requestParametersValues=' + filterData + "&isPopUp=" + IsPopupWindow,
success: LoadDocumentCallBack
});
}
}
return false; //False returned by sonia to Manage History as otherwise new history node is created
}
}
//current screen with no unsaved data with document status "New".
if (Dirty == "False" || DocumentId > 0) {
PopupProcessing();
// if (screenId == "29") { //Condition Added by Vikas Vyas in ref to implement Service Note Architecture
if (NoteType == -1 && KeyScreenId == 0) {
KeyScreenId = screenId;
}
if (typeof OpenCustomScreen == 'function') {
isCustomScreen = OpenCustomScreen(screenId);
if (!isCustomScreen) {
return false;
}
}
if (screenId == KeyScreenId) { //Condition Added by Vikas Vyas in ref to implement Service Note Architecture
// filterData = "IsServiceNote=true^serviceId=0^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
//Addedd By Devi Dayal Ref # 3(ThresHold) ClientLifeEventId are addedd in the Document Table to handle ClientLifeEVent id
filterData = "NoteType=" + NoteType + "^keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName; //+ "^ClientLifeEventId=" + ClientLifeEventId;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId + "&CurrentBannerTabIndex=" + globalBannerTabIndex,
success: LoadDocumentCallBack
});
}
else {
//Addedd By Devi Dayal Ref # 3(ThresHold) ClientLifeEventId are addedd in the Document Table to handle ClientLifeEVent id
filterData = "NoteType=" + NoteType + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName; //+ "^ClientLifeEventId=" + ClientLifeEventId;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
}
//For setting div scroll
SetDivScroll();
return false; //False returned by sonia to Manage History as otherwise new history node is created
}
catch (e) {
}
}
/***************Re create the function on 24 May,2010***************************/
function MessageBoxUnsavedDocumentConfirm(confirmResult) {
var screenId = GetCurrentScreenID();
var filterData = "";
switch (confirmResult) {
case 'yes':
CallBackAction = pageActionEnum.New;
SavePageData();
CallBackAction = '';
break;
case 'no':
DeleteUnsavedChangesById(UnsavedChangeId);
PopupProcessing();
if (typeof OpenCustomScreen == 'function') {
isCustomScreen = OpenCustomScreen(screenId);
if (!isCustomScreen) {
return false;
}
}
if (screenId == KeyScreenId) {
filterData = "NoteType=" + NoteType + "^keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "^TabId=2";
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
else {
filterData = "DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
break;
}
}
/**************************************/
/* EOf Temprorly call backuped fucntion *****************/
//Modified On 21 May
// Modifeid By Vikas Monga
//Purpose :Implement the coustom message box
function MessageBoxUnsavedDocumentYesOption() {
try {
CallBackAction = pageActionEnum.New;
SavePageData();
}
catch (err) {
LogClientSideException(err, 'Documents');
}
}
//Modified On 21 May
// Modifeid By Vikas Monga
//Purpose :Implement the coustom message box
function MessageBoxUnsavedDocumentNoOption(unsavedChangeID) {
try {
DeleteUnsavedChangesById(unsavedChangeID);
//If user select "No" option.
//Discard from unsaved list.
//open the new instance.
PopupProcessing();
var screenId = GetCurrentScreenID();
if (screenId == KeyScreenId) { //Condition Added by Vikas Vyas in ref to implement Service Note/Events Architecture
// filterData = "IsServiceNote=true^serviceId=0^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
filterData = "keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + '^TabId=2';
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
else {
filterData = "DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
}
}
catch (err) {
LogClientSideException(err, 'Documents');
}
}
//Modified On 21 May
// Modifeid By Vikas Monga
//Purpose :Implement the coustom message box
function MessageBoxUnsavedDocumentCancelOption() {
return;
}
/********************* EOF MessageBoxUnsavedDocumentNoOption ***************************/
//Created on 13 May,2010 Purpose : Process return value from modal popup on Document close
/* NOT IN USER 21 MAY 2010
function OnReturnUnSavedDocument(returnValue) {
if (returnValue == 'Cancel') {
return ;
}
if (returnValue != '' && returnValue != undefined) {
//If user select "Yes" option.
//Save the current screen instance
//Discard from unsaved list.
//open the new instance.
if (returnValue == "Yes") {
CallBackAction = pageActionEnum.New;
SavePageData();
}
if (returnValue == "No") {
DeleteUnsavedChangesById(UnsavedChangeId);
//If user select "No" option.
//Discard from unsaved list.
//open the new instance.
PopupProcessing();
var screenId = GetCurrentScreenID();
if (screenId == KeyScreenId) { //Condition Added by Vikas Vyas in ref to implement Service Note/Events Architecture
// filterData = "IsServiceNote=true^serviceId=0^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
filterData = "keyfieldvalue=0^keyscreenid=" + KeyScreenId + "^documentId=0^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + KeyScreenId,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData,
success: LoadDocumentCallBack
});
}
else {
filterData = "DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'action=new&ajaxRequest=true&requestParametersValues=' + filterData,
success: LoadDocumentCallBack
});
}
}
return;
}
}
*/
/**************************************************************************************/
//Author - Devinder Pal Singh.
//Purpose - Open Signature Image.
function ViewSignature(signatureId) {
// window.showModalDialog("../ShowSignature.aspx?signatureId=" + signatureId, "test", "center:yes;resizable:no;dialogWidth:400px;dialogHeight:250px;");
//Modified by Mahesh on 13 May, 2010
OpenPage(5765, 66, 'signatureId=' + signatureId, null, GetRelativePath(), 'T', "dialogHeight:250px; dialogWidth: 400px;dialogTitle:Signature Image");
}
//ViewSignature - End
function RetainAuthorship() {
// if (IsNotClientViewingMode) {
if ($('input[id$=Button_DocumentInformation_View]').attr("mode") == "edit" && objectPageResponse.ObjectDocumentInformation.AuthorId != objectPageResponse.ObjectDocumentInformation.LoggedInUserId) {
var ProxyId = '';
var message = "You will be able to view this document after changing the author. Would you like to continue changing the author of this document ?";
var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
ShowMsgBox(message, ConfirmationMessageCaption, MessageBoxButton.OKCancel, MessageBoxIcon.Question,
'ConfirmMessageRetainAuthorshipOK(\'' + screenId + '\',\'' + ProxyId + '\')',
parent.HidePopupProcessing());
}
//}
}
function ConfirmMessageRetainAuthorshipOK(screenId, ProxyId) {
CreateAutoSaveXml('Documents', 'AuthorId', LoggedInUserId, null, 'N');
CreateAutoSaveXml('Documents', 'ProxyId', ProxyId, null, 'N');
CreateAutoSaveXml('DocumentVersions', 'AuthorId', LoggedInUserId, null, 'N');
SavePageData();
if (objectPageResponse.ServiceId > 0) {
ChangeAuthorServiceNote(WorkingMode, LoggedInUserId, LoggedInUserName);
} else {
OpenPage(5763, objectPageResponse.ScreenId, "DocumentId=" + DocumentId, 2, GetRelativePath());
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Change Author.
//Modified By Mahesh Modified on 10 July,2010,Purpose : User can not change author when client viewing is on.
function ChangeAuthor(object) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "ChangeAuthor", "");
//Modification on 10 July for Author change
if (IsNotClientViewingMode) { //Added condition for chcec client viewing mode
//Attribute usertype=P(proxy User) and S (Staff Users)
//var newAuhorType = $('#' + object.id)[0][$('#' + object.id)[0].selectedIndex].parentNode.getAttribute('usertype');
//Changed By Priya To Declare It Globally
newAuhorType = $('#' + object.id)[0][$('#' + object.id)[0].selectedIndex].parentNode.getAttribute('usertype');
newAuhorId = $('#' + object.id)[0][$('#' + object.id)[0].selectedIndex].value;
var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
newAuthorName = $('#' + object.id)[0][$('#' + object.id)[0].selectedIndex].innerHTML;
var filterString = "newAuhorType=" + newAuhorType;
//Modified by sweety kamboj on 29 April
//Add newAuthor name in filter string
filterString += "^newAuhorId=" + newAuhorId + "^documentId=" + DocumentId + "^newauthorname=" + newAuthorName;
var ProxyId = '';
//Set Proxy ID
if (LoggedInUserId == newAuhorId || newAuhorType == 'S') {
ProxyId = '';
}
else {
ProxyId = LoggedInUserId;
}
if (WorkingMode == "new") {
//Set Author ID
CreateAutoSaveXmlObj([{ "Documents": { "AuthorId": newAuhorId, "ProxyId": ProxyId } }, { "DocumentVersions": { "AuthorId": newAuhorId } }]);
//CreateAutoSaveXml('Documents', 'AuthorId', newAuhorId);
//Code Added By Rakesh If statement to insert Change AuthorID in document version table when user change Author in case inprogress document With ref to task 137 in SC web phase II bugs/features
//CreateAutoSaveXml('DocumentVersions', 'AuthorId', newAuhorId);
//Code Added End here
//CreateAutoSaveXml('Documents', 'ProxyId', ProxyId);
if (LoggedInUserId != newAuhorId) {
if (RequiresSignature == 'Y') {
//Button_DocumentInformation_Sign.attr("disabled", "true");
Button_DocumentInformation_Sign.hide();
Button_DocumentInformation_ToSign.show();
}
else {
// Button_DocumentInformation_Complete.attr("disabled", "true");
Button_DocumentInformation_Complete.hide();
Button_DocumentInformation_ToSign.show();
}
}
else {
if (RequiresSignature == 'Y') {
Button_DocumentInformation_Sign.attr("disabled", false);
Button_DocumentInformation_Sign.show();
Button_DocumentInformation_ToSign.hide();
}
else {
//Button_DocumentInformation_Complete.attr("disabled", "");
Button_DocumentInformation_Complete.show();
Button_DocumentInformation_ToSign.hide();
}
}
//Code Added By Vikas Vyas In ref to Implement ServiceNote Architecture
if (typeof ChangeAuthorServiceNote == 'function') {
ChangeAuthorServiceNote(WorkingMode, newAuhorId, newAuthorName);
}
return;
}
var message = ''
var _xmlstr = '';
var _dirty = 'False'; // Set this flag to True if
//Discription: Made Changes w.r.t. Task#2054,Threshold Bugs/Features , (Author Pop Up)
//What: Functionality modified for documents.js use Translate function pass one ScreenId(Hardcode:738) with it.
// Show Custom Messesge For Documents.Js File messesge when change Author.
//Why: Need To show custom messesge for core part screens(Document.Js).
if (DocumentContainerDirty == "True" || Dirty == "True" || UnsavedChangeId > 0) {// Added on 21 May || UnsavedChangeId > 0
//message = 'You will not be able to view this document after changing the author until it is shared or signed or unless you are a proxy for the author.Would you like to continue changing the author of this document to [' + newAuthorName + ']?';
message = "You will not be able to view this document after changing the author until it is shared or signed or unless you are a proxy for the author.Would you like to continue changing the author of this document";
// message = 'Changes has found on the document.Do you wish to save these changes and change author of this document to[' + newAuthorName + ']?';
//Commented on 24 May 2010, this function is called in ConfirmMessageChangeAuthorOK function
// _xmlstr = GetScreenXML(); //Get Screen XML.
_dirty = 'True';
}
else {
//message = 'The document has been changed and will be saved.You will not be able to view this document after changing the author until it is shared or signed or unless you are a proxy for the author.Would you like to continue changing the author of this document to [' + newAuthorName + ']?';
message = "The document has been changed and will be saved.You will not be able to view this document after changing the author until it is shared or signed or unless you are a proxy for the author.Would you like to continue changing the author of this document";
//message = 'Do you wish to change the author of this document to [' + newAuthorName + ']?';
}
//Code Added By Vikas Vyas in ref to Implement ServiceNote Architecture
//if (typeof ValidateBeforeChangeAuthor == 'function') {
if ($('[id$=hiddenFieldCurrentScreenId]').val() == "29") {
ValidateBeforeChangeAuthor(_dirty, filterString, object, message + " to " + newAuthorName + "?", newAuhorId, ProxyId);
}
else {
if (checkAllowEditingByNonAuthors) {
var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
ConfirmMessageChangeAuthorOK(0, _dirty, screenId, encodeText(filterString), newAuhorId, ProxyId);
}
else {
ValidateBeforeChangeAuthor1(_dirty, encodeText(filterString), object, message + " to " + newAuthorName + "?", newAuhorId, ProxyId);
}
}
// }
// else {
//Modified on 24 May,2010
// ShowMsgBox(message, ConfirmationMessageCaption, MessageBoxButton.OKCancel, MessageBoxIcon.Question,
// 'ConfirmMessageChangeAuthorOK(\'' + UnsavedChangeId + '\',\'' + _dirty + '\',\'' + screenId + '\',\'' + filterString + '\',\'' + newAuhorId + '\',\'' + ProxyId + '\')',
// 'ConfirmMessageChangeAuthorCancel(\'' + object.id + '\')');
// }
/*This code is not more required after 24 May,2010
if (confirm(message) == true) {
if (UnsavedChangeId > 0) {
_dirty = 'True';
}
filterString += '^Dirty=' + _dirty + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + '^UnsavedChangeId=' + UnsavedChangeId;
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId,
data: 'action=changeauthor&ajaxRequest=true&xmlString=' + encodeText(_xmlstr) + '&requestParametersValues=' + filterString,
success: LoadDocumentCallBack
});
PopupProcessing();
}
else {
// DeSelect the autjor if user click on cancel.
$("#" + object.id).val(AuthorId);
}
*/
}
else {
// DeSelect the author if client viewing is ON. //Added by mahesh on 10 July,2010
$(object).val(AuthorId);
}
}
function ValidateBeforeChangeAuthor1(_dirty, filterString, object, message, newAuhorId, ProxyId) {
var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
ShowMsgBox(message, ConfirmationMessageCaption, MessageBoxButton.OKCancel, MessageBoxIcon.Question,
'ConfirmMessageChangeAuthorOK(\'' + UnsavedChangeId + '\',\'' + _dirty + '\',\'' + screenId + '\',\'' + filterString + '\',\'' + newAuhorId + '\',\'' + ProxyId + '\')',
'ConfirmMessageChangeAuthorCancel(\'' + object.id + '\')');
}
/*************************************************************************************/
// Modified On 24 May
// Modifeid By Vikas Monga
// Purpose :Implement the coustom message box
function ConfirmMessageChangeAuthorOK(UnsavedChangeId, _dirty, screenId, filterString, selectedAuhorId, selectedProxyId) {
try {
var _xmlstr = '';
//Changes merged from 2x to 3x --Maninder 20/10/2011
//CreateAutoSaveXmlObj([{"Documents": {"AuthorId": selectedAuhorId, "ProxyId": selectedProxyId }},{"DocumentVersions": {"AuthorId": selectedAuhorId}}], null, 'N');
CreateAutoSaveXml('Documents', 'AuthorId', selectedAuhorId, null, 'N');
CreateAutoSaveXml('Documents', 'ProxyId', selectedProxyId, null, 'N');
//Code Added By Rakesh If statement to insert Change AuthorID in document version table when user change Author in case inprogress document With ref to task 137 in SC web phase II bugs/features
CreateAutoSaveXml('DocumentVersions', 'AuthorId', selectedAuhorId, null, 'N');
//Code Added Ends here.
//Added By Vikas Vyas in ref to Implement Service Note Architecture
if (typeof ChangeAuthorServiceNote == 'function' && $('[id$=hiddenFieldCurrentScreenId]').val() != "29") {
ChangeAuthorServiceNote(WorkingMode, selectedAuhorId, newAuthorName);
}
//End
_xmlstr = GetScreenXML(true); //Added on 26 may,2010
if (DocumentContainerDirty == "True" || Dirty == "True") {
_xmlstr = GetScreenXML(true); //Get Screen XML.
}
if (UnsavedChangeId > 0) {
_dirty = 'True';
}
//to send the AssociateScreenid in the filter string
filterString += '^Dirty=' + _dirty + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" +
DocumentNavigationName + '^UnsavedChangeId=' + UnsavedChangeId;
//added to implement task no:2015 in CM support
if (NoteType == -2) {
filterString += "^TabId=2^noteType=-2^KeyScreenId=32";
}
if (NoteType == -1) {
filterString += "^TabId=2^noteType=-1^KeyScreenId=29";
}
if (associatedNoteScreenId != undefined) {
filterString += "^associatedNoteScreenId=" + associatedNoteScreenId;
}
//end
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL + "&isPopUp=" + IsPopupWindow,
data: 'action=changeauthor&ajaxRequest=true&xmlString=' + encodeText(_xmlstr) + '&requestParametersValues=' + filterString + '&historyId=' + CurrentHistoryId,
success: LoadDocumentCallBack
});
PopupProcessing();
}
catch (err) {
LogClientSideException(err, 'Documents');
}
}
// Modified On 24 May
// Modifeid By Vikas Monga
// Purpose :Implement the coustom message box
function ConfirmMessageChangeAuthorCancel(objectId) {
try {
// DeSelect the author if user click on cancel.
$("#" + objectId).val(AuthorId);
}
catch (err) {
LogClientSideException(err, 'Documents');
}
}
/*************************************************************************************/
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - CompleteDocument.
function CompleteDocument() {
ActionSignOrComplete = true;
ActionValidateDocumentPageData = false; //Added by Atul pandey on 26/october/2012 w.rf.t task #46 of project 3.5xissues
//SaveCustomDocument();
SavePageData();
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Callback function for CompleteDocument.
function ChangeAuthorCallBack(result) {
try {
DeserailizePageResponse(result);
if (objectPageResponse.RequestProcessed) {
// AuthorChanged = 'Y'
//IsDirty = true;
}
else {
// AuthorChanged = 'N';
//Log Exception
alert(objectPageResponse.ErrorInfo);
}
}
catch (ex) {
alert(ex);
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Set dropdownlist mode(Enable/disable).
function EnableDisableAuthorList() {
//if (DocumentStatusId == 22) {//commented by shifali in ref to task# 11 (To be reviewed changes)
if (CurrentVersionStatusId == 22) {
$('#DropDownList_DocumentInformation_AuthorList').attr("disabled", "true");
}
else {
$('#DropDownList_DocumentInformation_AuthorList').attr("disabled", false);
}
//disable the drop down if document type is complete with inprogress status
//commented by shifali in ref to task# 11 (To be reviewed changes)
//if (DocumentStatusId == 21 && RequiresSignature == "N") {
// Commented by Vikesh Ref Task#192 in Venture Region Support
//Allow Edits and Change Author
// Add check objectPageResponse.ObjectDocumentInformation.NoteType<>-2 so, that it will only work for events
if (CurrentVersionStatusId == 21 && RequiresSignature == "N" && objectPageResponse.ObjectDocumentInformation.NoteType != -2 && !objectPageResponse.ObjectDocumentInformation.AllowEditingByNonAuthors) {// Modified by vsinha Ref Task#714 in CEI - Support Go Live
$('#DropDownList_DocumentInformation_AuthorList').attr("disabled", false);
}
}
function OpenURL(argDocumentVersionId, OpenURLFlag, IsDocumentInNewModeOverride) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "OpenURL", "argDocumentVersionId - " + isNullORUndefined(argDocumentVersionId) + "^" + "OpenURLFlag - " + isNullORUndefined(OpenURLFlag)
+ "^" + "IsDocumentInNewModeOverride - " + isNullORUndefined(IsDocumentInNewModeOverride) + "");
if (OpenURLFlag == true) {
//Comment by : Amit Kumar Srivastava, This code is now not required, #64, SmartcareWeb Phase 3 Development,In-Progress Documents Cannot be Viewed
//added by shifali in ref to task# 11 (To be Reviewed Document Status)
//purpose:- Refresh Signer List && SignedBy List on version click in More Detail Section when status = 22
// $.post(GetRelativePath() + "AjaxScript.aspx?FunctionName=GetDocumentSignedByAndSignerListHTML" + "&DocumentId=" + DocumentId + "&DocumentVersionId=" + argDocumentVersionId +
// "&AuthorId=" + AuthorId + "&ReviewerId=" + ReviewerId,
// function(result) {
// RefreshDocumentSignedByAndSignerList(result);
// });
//Changes ends here
if (objectPageResponse.EnableDeleteButtonAfterSign == 'Y') { $('#ButtonDelete').removeAttr("disabled"); }
$("td[toolbaritem=Print] img").removeAttr("disabled");
$('#DivShowDetailHTML').hide();
var DivOpenURL = $('#DivOpenURL');
var outerContainer = $('#outerContainer');
DivOpenURL.append(outerContainer);
$('#TextBox_DocumentInformation_EffectiveDate').attr("disabled", "true");
$('#ButtonUpdate').attr("disabled", "true");
// Added by Maninder
$("#DivOpenUrlContainer").show();
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation.DocumentId != '' && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentId) > 0 && objectPageResponse.ObjectDocumentInformation.ReviewFormId != '0' && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentType) == 17 && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentStatusId) == 21)
enableUpdateButton();
else
$('#ButtonUpdate').attr("disabled", "true");
//Ends
$('#ButtonValidate').attr("disabled", "true"); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
DivOpenURL.show();
// var frameHeight = (($(document).height() * 50) / 100);
// $('#DivOpenURL').css('height', frameHeight);
$('input[id$=hiddenContainerControlToResize]').val("DivOpenURL");
ResizeDocuments();
var reportViewerHeight = DivOpenURL.height();
var reprotViewerWidth = DivOpenURL.width();
var myDate = new Date();
var time = myDate + myDate.getMinutes() + myDate.getSeconds();
PrintRequest = 0;
//Added By : Swapan Mohan
//Purpose : As per Task #125 3.5x Issues to extract IsDocumentInNewMode property value from parsed jason object ObjectPageResponse.
//Below If condition added by Rakesh w.rf to task 2926 MHA - Citrix Java Script Error in Thresolds Bugs/Features Check objectPageResponse.ObjectDocumentInformation != null
if (IsDocumentInNewModeOverride == true)
IsDocumentInNewMode = false;
else if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation != undefined)
IsDocumentInNewMode = objectPageResponse.ObjectDocumentInformation.IsDocumentInNewMode;
else
IsDocumentInNewMode = false;
//Changes end here
//Following commneted by Sonia for History Management
//$('#iFrameOpenURL')[0].src = "../ReportViewer.aspx?DocumentVersionId=" + argDocumentVersionId + "&time=" + time;
//Commented By : Swapan Mohan
//Purpose : As per Task #125 3.5x Issues passed extra parameter IsDocumentInNewMode in Query String.
//var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + argDocumentVersionId + "&time=" + time + "&rpheight=" + reportViewerHeight + "&rpwidth=" + reprotViewerWidth;
var _reportUrl = "../ReportViewer.aspx?DocumentVersionId=" + argDocumentVersionId + "&time=" + time + "&rpheight=" + reportViewerHeight + "&rpwidth=" + reprotViewerWidth + "&IsDocumentInNewMode=" + IsDocumentInNewMode;
if (RegenratePdf == 'yes') {
_reportUrl = _reportUrl + "&Regenrate=yes";
}
if (ActionSignedByAuthor == true) {
_reportUrl = _reportUrl + "&ActionSignedByAuthor=yes";
}
var ua = navigator.userAgent.toLowerCase();
// if(true){
if ((ua.search("android") > -1 || ua.search("iphone") > -1 || ua.search("ipad") > -1 || ua.search("ipod") > -1)) {
$('#outerContainer').css("display", "block");
$('#printContainer').css("display", "block");
$.getScript('../JScripts/ApplicationScripts/viewer.js', function () {
$('#DivOpenURL').attr("display", "block");
DEFAULT_URL = _reportUrl;
webViewerLoad();
});
}
else { // If not an chrome browser
$('#outerContainer').css("display", "none");
$('#printContainer').css("display", "none");
ActionSignedByAuthor = false;
RegenratePdf = '';
//Added by Maninder
if (typeof RDLDocumentTabPage != "undefined" && RDLDocumentTabPage != null) {
if (objectPageResponse.ObjectDocumentInformation != null && objectPageResponse.ObjectDocumentInformation != undefined && objectPageResponse.ObjectDocumentInformation.DocumentId != '' && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentId) > 0 && objectPageResponse.ObjectDocumentInformation.ReviewFormId != '0' && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentType) == 17 && parseInt(objectPageResponse.ObjectDocumentInformation.DocumentStatusId) == 21) {
RDLDocumentTabPage.tabs[1].SetVisible(true);
}
else {
RDLDocumentTabPage.tabs[1].SetVisible(false);
}
}
//Ends
var HiddenField_FormCollectionId = $('[id$=HiddenField_FormCollectionId]')
var formCollectionId = "";
if (HiddenField_FormCollectionId) {
formCollectionId = HiddenField_FormCollectionId.val();
}
/************** EII 533 DFA **********************/
if (objectPageResponse.ScreenId == 29 || objectPageResponse.LoadedUcPath.indexOf('DFASingleTabDocuments.ascx') != -1) {
/**To check whether the document is a single page document **/
var documentCodeId = objectPageResponse.ObjectDocumentInformation.DocumentCodeId
if (!documentCodeId) {
documentCodeId = GetFielValueFromXMLDom(AutoSaveXMLDom[0].xml, "Documents", "DocumentCodeId");
}
if (documentCodeId) {
if (objectPageResponse.ScreenId == 29) {
PopupProcessing();
$.ajax({
type: "POST",
url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAController.ashx?FunctionName=IsSinglePageDFAServiceNote" + "&DocumentCodeId=" + documentCodeId + "&DocumentVersionId=" + DocumentVersionId,
async: false,
success: function (response) {
HidePopupProcessing();
if (response != "NotSinglePageDFA")
OnSuccessMultuTabDFAReport(response);
}
});
}
else {
//Check if this is singlepage DFA, have generic RDL and formcollectionId
PopupProcessing();
$.ajax({
type: "POST",
url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAController.ashx?FunctionName=IsSinglePageDFA" + "&DocumentCodeId=" + documentCodeId + "&DocumentVersionId=" + DocumentVersionId,
async: false,
success: function (response) {
HidePopupProcessing();
if (response == "SinglePageDFA")
OnSuccessDFAReport();
}
});
}
}
}
/*********************************************************************/
/****EII 552 DFA ENHANCEMENT MULTITAB**********************/
if (formCollectionId != "" && formCollectionId != "0") {
var generateData = true;
if (typeof GenerateDFAReportData == 'function') { // added on 30Nov2021 for DFA multitab document loading slowly
generateData = GenerateDFAReportData();
}
if (generateData == true){
if (objectPageResponse.MultiTabControlName != "") {
var documentCodeId = objectPageResponse.ObjectDocumentInformation.DocumentCodeId
if (!documentCodeId) {
documentCodeId = GetFielValueFromXMLDom(AutoSaveXMLDom[0].xml, "Documents", "DocumentCodeId");
}
if (documentCodeId) {
//Check if this is MULTITAB DFA, have generic RDL and formcollectionId
PopupProcessing();
$.ajax({
type: "POST",
url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAController.ashx?FunctionName=GetDataForMultitabDFA" + "&DocumentCodeId=" + documentCodeId + "&DocumentVersionId=" + DocumentVersionId,
async: false,
success: function (response) {
HidePopupProcessing();
if (response != "NotMultiTabPageDFA")
OnSuccessMultuTabDFAReport(response);
}
});
}
}
}
}
////////////////////////////////////////////
CreateIFrameForDocumentReports(_reportUrl);
var i = 0
$('input[id$=hiddenContainerControlToResize]').val("iFrameOpenURL");
}
ResizeDocuments();
}
else {
$('#outerContainer').css("display", "none");
$('#printContainer').css("display", "none");
$("td[toolbaritem=Print] img").attr("disabled", "disabled");
//Sweety Kamboj on 2 June 2010
$('#DivShowDetailHTML').show();
var check = CheckClientViewing();
if (check) {
$('#ButtonUpdate').attr("disabled", "True");
$('#ButtonValidate').attr("disabled", "True"); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
}
else {
enableUpdateButton();
$('#ButtonValidate').attr("disabled", false); //Added By Jagdeep Hundal Ref:task No:4 in THRESHOLDSOFF2. To Add 'Validate' button to the toolbar
}
//Varun - Below line modified to fix issue in Chrome Version 67
if (Brow_ua != Brow_CHROME)
$('#DivOpenURL').hide();
//Below if condition added by Rakesh With ref to task 929 in In case of schedulted servcie Effective data text box enable
//Add the ScreenId check of 29 for disabling the Effective date #ref 868 Threshold Phase Bugs & Feature.
if ((objectPageResponse.ObjectDocumentInformation != null) && (objectPageResponse.ObjectDocumentInformation.NoteType == -1 || objectPageResponse.ObjectDocumentInformation.NoteType == -2 || objectPageResponse.ScreenId == 29)) {
TextBox_DocumentInformation_EffectiveDate.attr("disabled", "true");
}
else {
$('#TextBox_DocumentInformation_EffectiveDate').attr("disabled", false);
$('#TextBox_DocumentInformation_EffectiveDate').removeClass("disableControl");
}
//Changes end here
$('input[id$=hiddenContainerControlToResize]').val(objectPageResponse.CurrentRadPageViewName);
ResizeDocuments();
}
openedDocumentVersionId = argDocumentVersionId;
}
function OnSuccessMultuTabDFAReport(reportdata) {
var jsonobj = JSON.parse(reportdata);
var finalReportHtml = '';
$.each(jsonobj.FormHTML, function () {
var reporthtml = this.FormHTML;
var tablename = this.TableName;
$.each(jsonobj, function (key, value) {
if (tablename == key) {
var rhtml = $(reporthtml);
$("span", rhtml).before(" ");
if (value.length > 0) {
$.each(value[0], function (x, y) {
var ctrl = $("[id*=_" + x + "]", rhtml);
$(ctrl).each(function () {
var radiotext = '';
var labeltext = '';
if (this.id.toLowerCase().indexOf('radiobutton') != -1) {
//radiotext = radiotext + 'removeradio';
var c = $(rhtml).find('.dfarradio');
labeltext = $("[for=" + this.id + "]", rhtml).text();
var radioid = this.id.split('_');
if (radioid.length > 3) {
if (radioid[3].trim() == y) {
$(this).replaceWith("" + labeltext + " ");
$("[for=" + this.id + "]", rhtml).remove();
}
else {
$(this).replaceWith(" ");
$("[for=" + this.id + "]", rhtml).remove();
}
}
}
else if (this.id.toLowerCase().indexOf('checkbox') != -1) {
radiotext = radiotext + 'removeradio';
var c = $(rhtml).find('.dfacheckbox');
labeltext = $("[for=" + this.id + "]", rhtml).text();
if (y == 'Y') {
// checkboxtext = x + ',';
$(this).replaceWith("" + labeltext + " ");
$("[for=" + this.id + "]", rhtml).remove();
}
else {
$(this).replaceWith(" ");
$("[for=" + this.id + "]", rhtml).remove();
}
}
else {
var selecttext = '';
controltype = '';
if ($("[id$=" + x + "]", rhtml).is('select')) {
var optiontext = $("[id$=" + x + "]", rhtml).find('option[value="' + y + '"]').text();
selecttext = optiontext;
controltype = 'select';
}
else {
selecttext = y;
}
var ctrls = $("[id$=" + x + "]", rhtml);
if (selecttext) {
if (controltype == "select") {
$("select[id$=" + x + "]", rhtml).replaceWith("" + selecttext + " ");
}
else {
if (ctrls.attr('Datatype') == "Date") {
$(ctrls).each(function () {
if (this.tagName == "IMG") {
$(this).replaceWith(" ");
}
else if ($(this).attr("Datatype") == "Date") {
if (selecttext) {
var d = new Date(parseInt(selecttext.substr(6)));
var dstring = d.getMonth() + 1 + "/" + d.getDate() + "/" + d.getFullYear();
$(this).replaceWith("" + dstring + " ");
}
}
else {
$(this).replaceWith("" + selecttext + " ");
}
});
}
else
$(ctrls).replaceWith("" + selecttext + " ");
}
}
else
$(ctrls).replaceWith(" ");
}
});
});
finalReportHtml = finalReportHtml + " " + rhtml.html() + " ";
}
}
});
});
PopupProcessing();
$.ajax({
type: "POST",
//url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAReportController.aspx?FunctionName=SaveDFAReport" + "&DocumentVersionId=" + DocumentVersionId,
url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAController.ashx?FunctionName=SaveDFAReport" + "&DocumentVersionId=" + DocumentVersionId,
data: JSON.stringify({ 'mergedHTML': finalReportHtml }),
dataType: "JSON",
contentType: "application/json; charset=utf-8",
async: false,
success: function (reponse) {
HidePopupProcessing();
}
});
}
function OnSuccessDFAReport() {
if (objectPageResponse.LoadedUcPath.indexOf('DFASingleTabDocuments.ascx') != -1) {
var tblelist = objectPageResponse.ObjectDocumentInformation.TableList;
var tabls = tblelist.split(',');
var dochtml = $('[id$=DynamicFormsDocuments_PanelDynamicControls]').html();
if (dochtml.length > 0) {
var IDs = [];
$('[id$=DynamicFormsDocuments_PanelDynamicControls]').find('input').each(function () { IDs.push(this.id); });
$('[id$=DynamicFormsDocuments_PanelDynamicControls]').find('span').each(function () { IDs.push(this.id); });
$('[id$=DynamicFormsDocuments_PanelDynamicControls]').find('textarea').each(function () { IDs.push(this.id); });
$('[id$=DynamicFormsDocuments_PanelDynamicControls]').find('select').each(function () { IDs.push(this.id); });
var docIds = [];
$.each(IDs, function (key, value) {
var k = key;
$.each(tabls, function (i, j) {
if (value.indexOf(j) >= 0) {
docIds.push(value);
}
});
});
}
dochtml = $(dochtml);
$("span", dochtml).before(" ");
$.each(docIds, function (x, y) {
if (y.toLowerCase().indexOf('radiobutton') == -1 && y.toLowerCase().indexOf('checkbox') == -1) {
var colval = $('[id$=' + y + ']', '[id$=DynamicFormsDocuments_PanelDynamicControls]').val()
var selecttext = '';
if ($("[id$=" + y + "]", dochtml).is('select')) {
var optiontext = $("[id$=" + y + "] :selected", dochtml).text();
selecttext = optiontext;
}
else {
selecttext = $('[id$=' + y + ']', '[id$=DynamicFormsDocuments_PanelDynamicControls]').val();
}
var ctrls = $("[id$=" + y + "]", dochtml);
if (selecttext)
$(ctrls).replaceWith("" + selecttext + " ");
else
$(ctrls).replaceWith(" ");
}
else {
var colval = $('[id$=' + y + ']', '[id$=DynamicFormsDocuments_PanelDynamicControls]').val()
var ctrl = $("[id*=" + y + "]", dochtml);
var radiotext = '';
$(ctrl).each(function () {
/////
if (this.id.toLowerCase().indexOf('radiobutton') != -1) {
radiotext = radiotext + '';
var c = $(dochtml).find('.dfarradio');
labeltext = $("[for=" + this.id + "]", dochtml).text();
if ($("#" + this.id).is(":checked")) {
// checkboxtext = labeltext + ',';
$(this).replaceWith("" + labeltext + " ");
$("[for=" + this.id + "]", dochtml).remove();
}
else {
$(this).replaceWith("");
$("[for=" + this.id + "]", dochtml).remove();
}
}
else if (this.id.toLowerCase().indexOf('checkbox') != -1) {
labeltext = $("[for=" + this.id + "]", dochtml).text();
if ($("#" + this.id).is(":checked")) {
// checkboxtext = labeltext + ',';
$(this).replaceWith("" + labeltext + " ");
$("[for=" + this.id + "]", dochtml).remove();
}
else {
$(this).replaceWith(" ");
$("[for=" + this.id + "]", dochtml).remove();
}
}
});
// $(".dfarradio", dochtml).replaceWith(colval);
}
});
var mergedHTML = dochtml.html();
PopupProcessing();
var encodedHTML = escape(mergedHTML);
var dataToSend = JSON.stringify({ 'mergedHTML': $(mergedHTML)[0].outerHTML });
$.ajax({
type: "POST",
//url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAReportController.aspx?FunctionName=SaveDFAReport" + "&DocumentVersionId=" + DocumentVersionId,
url: "../ActivityPages/Admin/Detail/DfaUserInterface/DFAController.ashx?FunctionName=SaveDFAReport" + "&DocumentVersionId=" + DocumentVersionId,
data: JSON.stringify({ 'mergedHTML': $(mergedHTML)[0].outerHTML }),
dataType: "JSON",
contentType: "application/json; charset=utf-8",
async: false,
success: function (reponse) {
HidePopupProcessing();
}
});
}
}
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose - Handle View Edit mode.
// Modified by : Karan
// Purpose : Check the document lock before opening the document
// Dated : 30 Nov 2011
// Ref : task #12 Threshold Dev Phase II
function ViewEditClick(object) {
// var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
var filterData = '';
var mode = $("[id='" + object.id + "']").attr("mode");
if (mode.toLowerCase() == 'view') {
//OpenURL(DocumentVersionId, true);
//Added by Shifali on 21Nov2011 in ref task# 11 (Document Status - To Be Reviewed)
ActionValidateDocumentPageData = false
ShowInViewMode = true;
SavePageData();
//OpenURL(InProgressDocumentVersionId, true);
if (!$('#SpanErrorMessage').text()) {
$('#Button_DocumentInformation_View').attr("disabled", false);
$('#Button_DocumentInformation_View').attr("mode", "edit");
$('#Button_DocumentInformation_View').val('Edit');
} else {
ActionValidateDocumentPageData = true;
ShowInViewMode = false;
}
}
else if (mode.toLowerCase() == 'edit') {
// Code Added by Karan
// Purpose : check for the document lock when user is trying to edit the document
// Dated : 30 Nov 2011
CheckForDocumentLock();
}
}
/*************************************************************************************/
//Modified On 21 May
// Modifeid By Vikas Monga
//Purpose :Implement the coustom message box
function ConfirmMessageForEditOnSignedDocument() {
try {
/* making the editcomments variable as false when the user craetes a new version of document */
/* Added by Anto for Philhaven Development task no 233 */
editcomments = false
/* Ends here */
var screenId = $('[id$=hiddenFieldCurrentScreenId]').val();
$('#Button_DocumentInformation_View').attr("disabled", false);
$('#Button_DocumentInformation_View').attr("mode", "view");
$('#Button_DocumentInformation_View').val('View');
OpenURL(DocumentVersionId, false);
var filterData = "";
if (UnsavedChangeId == 0) {
if (screenId == 29) //ServiceNote
{
filterData = "associatedNoteScreenId= " + associatedNoteScreenId + "^KeyFieldValue=" + KeyFieldValue + "^noteType=-1^KeyScreenId=29^documentId=" + DocumentId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "&historyId=" + CurrentHistoryId;
}
else if (screenId == 32) //EventNote
{
filterData = "associatedNoteScreenId= " + associatedNoteScreenId + "^KeyFieldValue=" + KeyFieldValue + "^noteType=-2^KeyScreenId=32^documentId=" + DocumentId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "&historyId=" + CurrentHistoryId;
}
else { filterData = "documentId=" + DocumentId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName + "&historyId=" + CurrentHistoryId; }
//$.post("../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL, 'action=editdocument&ajaxRequest=true&requestParametersValues=' + filterData, LoadDocumentCallBack);
$.ajax({
type: "POST",
url: "../BasePages/Documents.aspx?scId=" + screenId + '&isExternalURL=' + isExternalURL,
data: 'action=editdocument&ajaxRequest=true&requestParametersValues=' + filterData,
success: LoadDocumentCallBack,
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while editing the signed document. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in ConfirmMessageForEditOnSignedDocument - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
PopupProcessing();
}
}
catch (err) {//alert('Error occured in JS function ');}
LogClientSideException(err, 'Documents');
}
}
/******************EOF ConfirmMessageForEditOnSignedDocument **************************/
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose - Get document based on version.
function PopulateDcoumentByVersion(object, argDocumentVersionId, argDocumentVersion, versionStatus) {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "PopulateDcoumentByVersion", "");
//commented by shifali in ref to task# 11 (To Be Reviewed Document Status)
//purpose - As in new system, the versions will be created in inprogress status, so donot return false when status==21
// if (DocumentStatusId == 21) {
//if (CurrentVersionStatusId == 21){
// return false;
// }
//if (argDocumentVersionId == DocumentVersionId) {
//if (argDocumentVersionId == InProgressDocumentVersionId) {
if (openedDocumentVersionId == argDocumentVersionId) {
if (argDocumentVersion < DocumentLatestVersion) {
IsLatestVersionSelected = false;
}
else {
IsLatestVersionSelected = true;
}
return false;
}
object.checked = true; //Sanjay Bhardwaj Merged from 2.x to 3.5xMerge Task#259 SC Web Phase II - Bugs/Features Document Version Views: Refresh repository PDF
//added by shifali in ref to task# 11 (TO be Reviewed document status)
//purpose - we need to load document instead of RDL if another version of document is not signed
// as in the new system, the version will be created in inprogress.
if (versionStatus != 22) {
var historyXml = "";
if (AddHistoryPoint == true)
historyXml = $('input[id$=hiddenFieldHistoryXML]').val();
var filterDataForDocToOpen = '';
//filterDataForDocToOpen = "documentId=" + DocumentId + "^authorId=" + AuthorId + "^documentVersionId=" + argDocumentVersionId;
//removed noteType=-1 from filterDataForDocToOpen- 2008 - core bug
filterDataForDocToOpen = "associatedNoteScreenId= " + associatedNoteScreenId + "^KeyFieldValue=" + KeyFieldValue + "^KeyScreenId=29^documentId=" + DocumentId + "^authorId=" + AuthorId + "^documentVersionId=" + argDocumentVersionId + "^DocumentNavigationId=" + DocumentNavigationId + "^DocumentNavigationName=" + DocumentNavigationName;
// $.post(GetRelativePath() + "BasePages/Documents.aspx?scId=" + GetCurrentScreenID() + '&isExternalURL=' + isExternalURL,
// 'ajaxRequest=true' + '&action=' + pageActionEnum.None + '&TabIndex=' + 2 + '&requestParametersValues=' + filterDataForDocToOpen + '&historyId=' + CurrentHistoryId + '&hiddenFieldApplicationHistoryXML=' + historyXml + "&containerChanged=" + false + "&CurrentBannerTabIndex=" + globalBannerTabIndex,
// function(result) { LoadDocumentCallBack(result, false); });
//Code Commented by Jagdeep, Modify TabIndex=2 to TabIndex=0
//$.post(GetRelativePath() + "BasePages/Documents.aspx?scId=" + GetCurrentScreenID() + '&isExternalURL=' + isExternalURL,
//'ajaxRequest=true' + '&action=' + pageActionEnum.None + '&TabIndex=' + 0 + '&requestParametersValues=' + filterDataForDocToOpen + '&historyId=' + CurrentHistoryId + '&hiddenFieldApplicationHistoryXML=' + encodeText(historyXml) + "&containerChanged=" + false + "&CurrentBannerTabIndex=" + globalBannerTabIndex,
//function (result) { LoadDocumentCallBack(result, false); });
$.ajax({
type: "POST",
url: GetRelativePath() + "BasePages/Documents.aspx?scId=" + GetCurrentScreenID() + '&isExternalURL=' + isExternalURL,
data: 'ajaxRequest=true' + '&action=' + pageActionEnum.None + '&TabIndex=' + 0 + '&requestParametersValues=' + filterDataForDocToOpen + '&historyId=' + CurrentHistoryId + '&hiddenFieldApplicationHistoryXML=' + encodeText(historyXml) + "&containerChanged=" + false + "&CurrentBannerTabIndex=" + globalBannerTabIndex,
success: function (result) { LoadDocumentCallBack(result, false); },
error: function (result, status, err) {
ShowHideErrorMessage('Error occured while loading document by version. Please contact the sytem administrator', 'true');
var methodName = arguments.callee.caller.toString();
methodName = methodName.substr('function '.length);
methodName = methodName.substr(0, methodName.indexOf('('));
var logInformation = new Error("Error occured in PopulateDcoumentByVersion - " + isNullORUndefined(AutoSaveXMLDom[0].xml) + "callerMethodName- " + isNullORUndefined(methodName));
LogClientSideException(result, 'Documents.js', 2, logInformation);
}
});
PopupProcessing();
return false;
}
//ends here
else {
DocumentVersionId = argDocumentVersionId;
if ($("#DivOpenURL") != null && $("#DivOpenURL").length > 0) {
$("#DivOpenURL")[0].innerHTML = '';
$("#DivOpenURL").html('');
$("#DivOpenUrlContainer").hide();
}
OpenURL(argDocumentVersionId, true);
}
if (RefreshDocumentViewsFlag == '') {//Sanjay Bhardwaj Merged from 2.x to 3.5xMerge Task#259 SC Web Phase II - Bugs/Features Document Version Views: Refresh repository PDF
//added by shifali on 18March,2011
gereratepdfaftersign(DocumentVersionId);
}
RefreshDocumentViewsFlag = ''; //Sanjay Bhardwaj Merged from 2.x to 3.5xMerge Task#259 SC Web Phase II - Bugs/Features Document Version Views: Refresh repository PDF
var button_DocumentInformation_View = $('#Button_DocumentInformation_View');
button_DocumentInformation_View.val('Edit');
if (argDocumentVersion < DocumentLatestVersion) {
button_DocumentInformation_View.attr("disabled", "true");
IsLatestVersionSelected = false;
}
else {
//Added By Damanpreet Kaur ref: Task#177 Document Acknowledgements and Comments
//Edit button is enabled in case when Logged in with StaffId=AcknowledgedByStaffId
if ((LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) && (versionStatus != 22)) {
//button_DocumentInformation_View.attr("disabled", "");//Commented by Pradeep on as Edit Button should be enable for latest version not for lower version
if (argDocumentVersion < DocumentLatestVersion) {
button_DocumentInformation_View.attr("disabled", "true");
}
else {
button_DocumentInformation_View.attr("disabled", "");
}
button_DocumentInformation_View.attr("mode", "view");
button_DocumentInformation_View.val('View');
}
//Else if added by Shifali in ref to task# 2015 (Thresholds Bugs/Features)
//Purpose - On switching between, Edit view button was not proper shown and enabled/disabled.
else if ((LoggedInUserId == AuthorId || ProxyId == LoggedInUserId) && (versionStatus == 22)) {
button_DocumentInformation_View.attr("mode", "edit");
button_DocumentInformation_View.val('Edit');
Button_DocumentInformation_View.attr("disabled", false);
if (objectPageResponse && objectPageResponse.ObjectDocumentInformation) {
if (objectPageResponse.ObjectDocumentInformation.PreventNewVersion == 0) {
Button_DocumentInformation_View.attr("disabled", "true");
}
}
}
else {
if (objectPageResponse && objectPageResponse.ObjectDocumentInformation) {
if (objectPageResponse.ObjectDocumentInformation.PreventNewVersion == 0)
Button_DocumentInformation_View.attr("disabled", "true");
else if (objectPageResponse.ObjectDocumentInformation.PreventNewVersion == 1) {
if (objectPageResponse.SupervisorMode)
Button_DocumentInformation_View.attr("disabled", "true");
else
Button_DocumentInformation_View.attr("disabled", "");
}
}
Button_DocumentInformation_View.val('Edit');
}
//button_DocumentInformation_View.attr("disabled", "");
IsLatestVersionSelected = true;
}
if (DocumentType == 12) {
button_DocumentInformation_View.attr("disabled", "true");
}
if (object.id == "Radio_DocumentCustomInformation_Version0" && EnableDocumentsAcknowledgementsTools == "true") {
$('#CommentsUpdate').attr('disabled', false);
$('#AcknowledgmentUdpate').attr('disabled', false);
}
else {
$('#CommentsUpdate').attr('disabled', true);
$('#AcknowledgmentUdpate').attr('disabled', true);
}
object.checked = true;
}
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose - Disable Signature box Control.
function DisableSignatureControls() {
//Below code uncommented by Rakesh as in case of when disable signer controls then below controls should also be disabled
if (CurrentVersionStatusId == "20") {
$('#Button_DocumentInformation_Signer').attr("disabled", "true");
$('#Button_DocumentInformation_Decline').attr("disabled", "true");
$("select[id$=DropDownList_DocumentInformation_SignerList]").attr("disabled", "true");
}
//changes end here
$("input[name$=Radio_SignerList]").each(function () {
$(this).attr("disabled", "true");
});
//Below If condition added by Rakesh wrf to task 137 as in case of completed events or RequireSignature ='N' versioning will be created so Document Version should not be disabled now
if (objectPageResponse.ObjectDocumentInformation.DocumentId <= 0) {
$("input[name$=Radio_DocumentCustomInformation_Version]").each(function () {
$(this).attr("disabled", "true");
});
}
$("input[name$=A_SignerList]").each(function () {
$(this).attr("disabled", "true");
});
}
/**************************************************************************************/
//Author - Devinder Pal Singh
//Purpose - Enable Signature box Control.
function EnableSignatureControls() {
$('#Button_DocumentInformation_Signer').attr("disabled", "");
$('#Button_DocumentInformation_Decline').attr("disabled", "");
$("select[id$=DropDownList_DocumentInformation_SignerList]").attr("disabled", false);
$("input[name$=Radio_SignerList]").each(function () {
$(this).attr("disabled", false);
});
$("input[name$=Radio_DocumentCustomInformation_Version]").each(function () {
$(this).attr("disabled", false);
});
$("input[name$=A_SignerList]").each(function () {
$(this).attr("disabled", false);
});
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Check validation before sending save request.
function ValidationBeforeUpdate() {
if ($('#TextBox_DocumentInformation_EffectiveDate').val() == "") {
ActionSignOrComplete = false;
ShowHideErrorMessage("Please enter document effective date", 'true');
enableUpdateButton();
return false;
}
else {
return true;
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - View Calendar in edit mode
function ViewCalendar() {
if ($('#DivShowDetailHTML').css('display') != 'none') {
return showCalendar('TextBox_DocumentInformation_EffectiveDate', '%m/%d/%Y');
}
if (WorkingMode == "new" && $("#Button_DocumentInformation_View").attr("disabled") == true) {
return showCalendar('TextBox_DocumentInformation_EffectiveDate', '%m/%d/%Y');
}
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Validate Effective Date
function ValidateEffectiveDate(elementEffectiveDate) {
//if (ValidationDate(elementEffectiveDate) == "")
if (ValidateDate(elementEffectiveDate) == true) {
UpdateDocumentEffectiveDate();
}
else {
elementEffectiveDate.value = EffectiveDate;
}
}
function CheckDateValidation(date) {
if (ValidationDate(date) == "") { }
else { date.value = ""; }
}
/**************************************************************************************/
//Author - Vikas Monga
//Purpose - Stop View Document Processing
function StopViewDocumentProcessing() {
//Commented by Sonia for History Management
//$('#iFrameOpenURL')[0].src = "";
}
/**************************************************************************************/
//Author - Priya
//Purpose - Reset scroll Position
function SetDivScroll() {
$('#DivDocumentsNaviagationAndContents').scrollTop(0);
window.scrollTo(0, 0);
}
/**************************************************************************************/
//Function SetAutoSaveInformation
//Author - Umesh Sharma
//Purpose -Set the AutoSave Information on ready and CallBack function
function SetAutoSaveInformation() {
//EI#564 - Implement Verbose Mode Logging in SmartCare Application
EventTrap("Documents", "SetAutoSaveInformation", "");
try {
var SpanConcurrencyMessage = $("#SpanConcurrencyMessage");
SpanConcurrencyMessage.html("");
var councurrencyMessage = '';
var StatusConcurrency = objectPageResponse.ServiceStatusConcurrency;
var CommentConcurrency = objectPageResponse.ServiceCommentConcurrency;
var ServiceMessage = false;
if (objectPageResponse != null) {
InitializeDomObject();
if (typeof SetFieldsAfterDomInitialized == 'function') {
SetFieldsAfterDomInitialized();
}
UnsavedRecentDocumentWithConcurrency = objectPageResponse.UnsavedRecentDocumentWithConcurrency;
UnsavedConcurrency = objectPageResponse.UnsavedConcurrency;
//If there is concurrency then show the concurrency message and disable the Delete and update button
//Assign event for each control on onchange
if (objectPageResponse.UnsavedConcurrency == "True") {
if (UnsavedRecentDocumentWithConcurrency == true) {
// ShowHideErrorMessage("The data in the database was changed since you last saved. Your unsaved changes cannot be saved. Please reopen this screen to review the current data and make changes as needed", "true");
councurrencyMessage = "
";
councurrencyMessage = councurrencyMessage + 'There is also an instance of this document in the Unsaved Changes list that cannot be modified anymore because of concurrency.';
councurrencyMessage = councurrencyMessage + "