<%@ CodePage="1252" LCID="1046" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <% Session.Timeout = 20 %> <% Call ew_Header(False, EW_CHARSET) %> <% ' Define page object Dim receptor_add Set receptor_add = New creceptor_add Set Page = receptor_add ' Page init processing Call receptor_add.Page_Init() ' Page main processing Call receptor_add.Page_Main() %> <% receptor_add.ShowPageHeader() %>

<%= Language.Phrase("Add") %> <%= Language.Phrase("TblTypeTABLE") %><%= receptor.TableCaption %>

<%= Language.Phrase("GoBack") %>

<% receptor_add.ShowMessage %>

<% If receptor.REGISTRO_GERAL.Visible Then ' REGISTRO_GERAL %> > > > <%= receptor.REGISTRO_GERAL.CustomMsg %> <% End If %> <% If receptor.NOME_PACIENTE.Visible Then ' NOME_PACIENTE %> > > > <%= receptor.NOME_PACIENTE.CustomMsg %> <% End If %> <% If receptor.IDADE_PACIENTE.Visible Then ' IDADE_PACIENTE %> > > > <%= receptor.IDADE_PACIENTE.CustomMsg %> <% End If %> <% If receptor.PESO_PACIENTE.Visible Then ' PESO_PACIENTE %> > > > <%= receptor.PESO_PACIENTE.CustomMsg %> <% End If %> <% If receptor.SEXO_PACIENTE.Visible Then ' SEXO_PACIENTE %> > > <%= receptor.SEXO_PACIENTE.CustomMsg %> <% End If %> <% If receptor.NACIONALIDADE.Visible Then ' NACIONALIDADE %> > > > <%= receptor.NACIONALIDADE.CustomMsg %> <% End If %> <% If receptor.LOCAL.Visible Then ' LOCAL %> > > > <%= receptor.LOCAL.CustomMsg %> <% End If %> <% If receptor.QUARTO.Visible Then ' QUARTO %> > > > <%= receptor.QUARTO.CustomMsg %> <% End If %> <% If receptor.LEITO.Visible Then ' LEITO %> > > > <%= receptor.LEITO.CustomMsg %> <% End If %> <% If receptor.HIPOTESE_DIAGNOSTICA.Visible Then ' HIPOTESE_DIAGNOSTICA %> > > > <%= receptor.HIPOTESE_DIAGNOSTICA.CustomMsg %> <% End If %> <% If receptor.HISTORICO_TRANSFUCIONAL.Visible Then ' HISTORICO_TRANSFUCIONAL %> > > > <%= receptor.HISTORICO_TRANSFUCIONAL.CustomMsg %> <% End If %> <% If receptor.REACAO_TRANSFUCIONAL.Visible Then ' REACAO_TRANSFUCIONAL %> > > <%= receptor.REACAO_TRANSFUCIONAL.CustomMsg %> <% End If %> <% If receptor.QUAL.Visible Then ' QUAL %> > > > <%= receptor.QUAL.CustomMsg %> <% End If %> <% If receptor.GESTACAO_ABORTOS.Visible Then ' GESTACAO_ABORTOS %> > > <%= receptor.GESTACAO_ABORTOS.CustomMsg %> <% End If %> <% If receptor.QUANTOS.Visible Then ' QUANTOS %> > > > <%= receptor.QUANTOS.CustomMsg %> <% End If %> <% If receptor.ABO.Visible Then ' ABO %> > > <%= receptor.ABO.CustomMsg %> <% End If %> <% If receptor.RH.Visible Then ' RH %> > > <%= receptor.RH.CustomMsg %> <% End If %> <% If receptor.SENSIBILIDADE.Visible Then ' SENSIBILIDADE %> > > > <%= receptor.SENSIBILIDADE.CustomMsg %> <% End If %> <% If receptor.FONTE_PAGA.Visible Then ' FONTE_PAGA %> > > <%= receptor.FONTE_PAGA.CustomMsg %> <% End If %>
<%= receptor.REGISTRO_GERAL.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.NOME_PACIENTE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.IDADE_PACIENTE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.PESO_PACIENTE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.SEXO_PACIENTE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.NACIONALIDADE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.LOCAL.FldCaption %>
<%= receptor.QUARTO.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.LEITO.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.HIPOTESE_DIAGNOSTICA.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.HISTORICO_TRANSFUCIONAL.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.REACAO_TRANSFUCIONAL.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.QUAL.FldCaption %>
<%= receptor.GESTACAO_ABORTOS.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.QUANTOS.FldCaption %>
<%= receptor.ABO.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.RH.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.SENSIBILIDADE.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>
<%= receptor.FONTE_PAGA.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %>

<% If receptor.CurrentDetailTable = "mapa_transfusional" And mapa_transfusional.DetailAdd Then %>

<% End If %> <% If receptor.CurrentDetailTable = "provas_cruzadas" And provas_cruzadas.DetailAdd Then %>

<% End If %> ">

<% receptor_add.ShowPageFooter() If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <% ' Drop page object Set receptor_add = Nothing %> <% ' ----------------------------------------------------------------- ' Page Class ' Class creceptor_add ' Page ID Public Property Get PageID() PageID = "add" End Property ' Table Name Public Property Get TableName() TableName = "receptor" End Property ' Page Object Name Public Property Get PageObjName() PageObjName = "receptor_add" End Property ' Page Name Public Property Get PageName() PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl() PageUrl = ew_CurrentPage() & "?" If receptor.UseTokenInUrl Then PageUrl = PageUrl & "t=" & receptor.TableVar & "&" ' add page token End Property ' Message Public Property Get Message() Message = Session(EW_SESSION_MESSAGE) End Property Public Property Let Message(v) Dim msg msg = Session(EW_SESSION_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_MESSAGE) = msg End Property Public Property Get FailureMessage() FailureMessage = Session(EW_SESSION_FAILURE_MESSAGE) End Property Public Property Let FailureMessage(v) Dim msg msg = Session(EW_SESSION_FAILURE_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_FAILURE_MESSAGE) = msg End Property Public Property Get SuccessMessage() SuccessMessage = Session(EW_SESSION_SUCCESS_MESSAGE) End Property Public Property Let SuccessMessage(v) Dim msg msg = Session(EW_SESSION_SUCCESS_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_SUCCESS_MESSAGE) = msg End Property ' Show Message Public Sub ShowMessage() Dim sMessage sMessage = Message Call Message_Showing(sMessage, "") If sMessage <> "" Then Response.Write "

" & sMessage & "

" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session ' Success message Dim sSuccessMessage sSuccessMessage = SuccessMessage Call Message_Showing(sSuccessMessage, "success") If sSuccessMessage <> "" Then Response.Write "

" & sSuccessMessage & "

" Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session ' Failure message Dim sErrorMessage sErrorMessage = FailureMessage Call Message_Showing(sErrorMessage, "failure") If sErrorMessage <> "" Then Response.Write "

" & sErrorMessage & "

" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End Sub Dim PageHeader Dim PageFooter ' Show Page Header Public Sub ShowPageHeader() Dim sHeader sHeader = PageHeader Call Page_DataRendering(sHeader) If sHeader <> "" Then ' Header exists, display Response.Write "

" & sHeader & "

" End If End Sub ' Show Page Footer Public Sub ShowPageFooter() Dim sFooter sFooter = PageFooter Call Page_DataRendered(sFooter) If sFooter <> "" Then ' Footer exists, display Response.Write "

" & sFooter & "

" End If End Sub ' ----------------------- ' Validate Page request ' Public Function IsPageRequest() If receptor.UseTokenInUrl Then IsPageRequest = False If Not (ObjForm Is Nothing) Then IsPageRequest = (receptor.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (receptor.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function ' ----------------------------------------------------------------- ' Class initialize ' - init objects ' - open ADO connection ' Private Sub Class_Initialize() If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Initialize language object If IsEmpty(Language) Then Set Language = New cLanguage Call Language.LoadPhrases() End If ' Initialize table object If IsEmpty(receptor) Then Set receptor = New creceptor Set Table = receptor ' Initialize urls ' Initialize other table object If IsEmpty(mapa_transfusional) Then Set mapa_transfusional = New cmapa_transfusional ' Initialize other table object If IsEmpty(provas_cruzadas) Then Set provas_cruzadas = New cprovas_cruzadas ' Initialize form object Set ObjForm = Nothing ' Intialize page id (for backward compatibility) EW_PAGE_ID = "add" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "receptor" ' Open connection to the database If IsEmpty(Conn) Then Call ew_Connect() End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Init ' - called before page main ' - check Security ' - set up response header ' - call page load events ' Sub Page_Init() ' Create form object Set ObjForm = New cFormObj ' Global page loading event (in userfn7.asp) Call Page_Loading() ' Page load event, used in current page Call Page_Load() End Sub ' ----------------------------------------------------------------- ' Class terminate ' - clean up page object ' Private Sub Class_Terminate() Call Page_Terminate("") End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url ' Sub Page_Terminate(url) ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn60.asp) Call Page_Unloaded() Dim sRedirectUrl sReDirectUrl = url Call Page_Redirecting(sReDirectUrl) If Not (Conn Is Nothing) Then Conn.Close ' Close Connection Set Conn = Nothing Set receptor = Nothing Set ObjForm = Nothing ' Go to url if specified If sReDirectUrl <> "" Then If Response.Buffer Then Response.Clear Response.Redirect sReDirectUrl End If End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- Dim DbMasterFilter, DbDetailFilter Dim Priv Dim OldRecordset Dim CopyRecord ' ----------------------------------------------------------------- ' Page main processing ' Sub Page_Main() ' Process form if post back If ObjForm.GetValue("a_add")&"" <> "" Then receptor.CurrentAction = ObjForm.GetValue("a_add") ' Get form action CopyRecord = LoadOldRecord() ' Load old recordset Call LoadFormValues() ' Load form values ' Set up detail parameters SetUpDetailParms() ' Validate Form If Not ValidateForm() Then receptor.CurrentAction = "I" ' Form error, reset action receptor.EventCancelled = True ' Event cancelled Call RestoreFormValues() ' Restore form values FailureMessage = gsFormError End If ' Not post back Else ' Load key values from QueryString CopyRecord = True If Request.QueryString("ID").Count > 0 Then receptor.ID.QueryStringValue = Request.QueryString("ID") Call receptor.SetKey("ID", receptor.ID.CurrentValue) ' Set up key Else Call receptor.SetKey("ID", "") ' Clear key CopyRecord = False End If If CopyRecord Then receptor.CurrentAction = "C" ' Copy Record Else receptor.CurrentAction = "I" ' Display Blank Record Call LoadDefaultValues() ' Load default values End If End If ' Set up detail parameters SetUpDetailParms() ' Perform action based on action code Select Case receptor.CurrentAction Case "I" ' Blank record, no action required Case "C" ' Copy an existing record If Not LoadRow() Then ' Load record based on key FailureMessage = Language.Phrase("NoRecord") ' No record found Call Page_Terminate("receptorlist.asp") ' No matching record, return to list End If Case "A" ' Add new record receptor.SendEmail = True ' Send email on add success If AddRow(OldRecordset) Then ' Add successful SuccessMessage = Language.Phrase("AddSuccess") ' Set up success message Dim sReturnUrl If receptor.CurrentDetailTable <> "" Then ' Master/detail add sReturnUrl = receptor.DetailUrl Else sReturnUrl = receptor.ReturnUrl End If If ew_GetPageName(sReturnUrl) = "receptorview.asp" Then sReturnUrl = receptor.ViewUrl ' View paging, return to view page with keyurl directly Call Page_Terminate(sReturnUrl) ' Clean up and return Else receptor.EventCancelled = True ' Event cancelled Call RestoreFormValues() ' Add failed, restore form values End If End Select ' Render row based on row type receptor.RowType = EW_ROWTYPE_ADD ' Render add type ' Render row Call receptor.ResetAttrs() Call RenderRow() End Sub ' ----------------------------------------------------------------- ' Function Get upload files ' Function GetUploadFiles() ' Get upload data Dim index, confirmPage index = ObjForm.Index ' Save form index ObjForm.Index = 0 confirmPage = (ObjForm.GetValue("a_confirm") & "" <> "") ObjForm.Index = index ' Restore form index End Function ' ----------------------------------------------------------------- ' Load default values ' Function LoadDefaultValues() receptor.REGISTRO_GERAL.CurrentValue = Null receptor.REGISTRO_GERAL.OldValue = receptor.REGISTRO_GERAL.CurrentValue receptor.NOME_PACIENTE.CurrentValue = Null receptor.NOME_PACIENTE.OldValue = receptor.NOME_PACIENTE.CurrentValue receptor.IDADE_PACIENTE.CurrentValue = Null receptor.IDADE_PACIENTE.OldValue = receptor.IDADE_PACIENTE.CurrentValue receptor.PESO_PACIENTE.CurrentValue = Null receptor.PESO_PACIENTE.OldValue = receptor.PESO_PACIENTE.CurrentValue receptor.SEXO_PACIENTE.CurrentValue = Null receptor.SEXO_PACIENTE.OldValue = receptor.SEXO_PACIENTE.CurrentValue receptor.NACIONALIDADE.CurrentValue = BRASILEIRA receptor.LOCAL.CurrentValue = Null receptor.LOCAL.OldValue = receptor.LOCAL.CurrentValue receptor.QUARTO.CurrentValue = Null receptor.QUARTO.OldValue = receptor.QUARTO.CurrentValue receptor.LEITO.CurrentValue = Null receptor.LEITO.OldValue = receptor.LEITO.CurrentValue receptor.HIPOTESE_DIAGNOSTICA.CurrentValue = Null receptor.HIPOTESE_DIAGNOSTICA.OldValue = receptor.HIPOTESE_DIAGNOSTICA.CurrentValue receptor.HISTORICO_TRANSFUCIONAL.CurrentValue = IGNORADO receptor.REACAO_TRANSFUCIONAL.CurrentValue = Null receptor.REACAO_TRANSFUCIONAL.OldValue = receptor.REACAO_TRANSFUCIONAL.CurrentValue receptor.QUAL.CurrentValue = Null receptor.QUAL.OldValue = receptor.QUAL.CurrentValue receptor.GESTACAO_ABORTOS.CurrentValue = Null receptor.GESTACAO_ABORTOS.OldValue = receptor.GESTACAO_ABORTOS.CurrentValue receptor.QUANTOS.CurrentValue = Null receptor.QUANTOS.OldValue = receptor.QUANTOS.CurrentValue receptor.ABO.CurrentValue = Null receptor.ABO.OldValue = receptor.ABO.CurrentValue receptor.RH.CurrentValue = Null receptor.RH.OldValue = receptor.RH.CurrentValue receptor.SENSIBILIDADE.CurrentValue = Null receptor.SENSIBILIDADE.OldValue = receptor.SENSIBILIDADE.CurrentValue receptor.FONTE_PAGA.CurrentValue = Null receptor.FONTE_PAGA.OldValue = receptor.FONTE_PAGA.CurrentValue End Function ' ----------------------------------------------------------------- ' Load form values ' Function LoadFormValues() ' Load values from form If Not receptor.REGISTRO_GERAL.FldIsDetailKey Then receptor.REGISTRO_GERAL.FormValue = ObjForm.GetValue("x_REGISTRO_GERAL") If Not receptor.NOME_PACIENTE.FldIsDetailKey Then receptor.NOME_PACIENTE.FormValue = ObjForm.GetValue("x_NOME_PACIENTE") If Not receptor.IDADE_PACIENTE.FldIsDetailKey Then receptor.IDADE_PACIENTE.FormValue = ObjForm.GetValue("x_IDADE_PACIENTE") If Not receptor.PESO_PACIENTE.FldIsDetailKey Then receptor.PESO_PACIENTE.FormValue = ObjForm.GetValue("x_PESO_PACIENTE") If Not receptor.SEXO_PACIENTE.FldIsDetailKey Then receptor.SEXO_PACIENTE.FormValue = ObjForm.GetValue("x_SEXO_PACIENTE") If Not receptor.NACIONALIDADE.FldIsDetailKey Then receptor.NACIONALIDADE.FormValue = ObjForm.GetValue("x_NACIONALIDADE") If Not receptor.LOCAL.FldIsDetailKey Then receptor.LOCAL.FormValue = ObjForm.GetValue("x_LOCAL") If Not receptor.QUARTO.FldIsDetailKey Then receptor.QUARTO.FormValue = ObjForm.GetValue("x_QUARTO") If Not receptor.LEITO.FldIsDetailKey Then receptor.LEITO.FormValue = ObjForm.GetValue("x_LEITO") If Not receptor.HIPOTESE_DIAGNOSTICA.FldIsDetailKey Then receptor.HIPOTESE_DIAGNOSTICA.FormValue = ObjForm.GetValue("x_HIPOTESE_DIAGNOSTICA") If Not receptor.HISTORICO_TRANSFUCIONAL.FldIsDetailKey Then receptor.HISTORICO_TRANSFUCIONAL.FormValue = ObjForm.GetValue("x_HISTORICO_TRANSFUCIONAL") If Not receptor.REACAO_TRANSFUCIONAL.FldIsDetailKey Then receptor.REACAO_TRANSFUCIONAL.FormValue = ObjForm.GetValue("x_REACAO_TRANSFUCIONAL") If Not receptor.QUAL.FldIsDetailKey Then receptor.QUAL.FormValue = ObjForm.GetValue("x_QUAL") If Not receptor.GESTACAO_ABORTOS.FldIsDetailKey Then receptor.GESTACAO_ABORTOS.FormValue = ObjForm.GetValue("x_GESTACAO_ABORTOS") If Not receptor.QUANTOS.FldIsDetailKey Then receptor.QUANTOS.FormValue = ObjForm.GetValue("x_QUANTOS") If Not receptor.ABO.FldIsDetailKey Then receptor.ABO.FormValue = ObjForm.GetValue("x_ABO") If Not receptor.RH.FldIsDetailKey Then receptor.RH.FormValue = ObjForm.GetValue("x_RH") If Not receptor.SENSIBILIDADE.FldIsDetailKey Then receptor.SENSIBILIDADE.FormValue = ObjForm.GetValue("x_SENSIBILIDADE") If Not receptor.FONTE_PAGA.FldIsDetailKey Then receptor.FONTE_PAGA.FormValue = ObjForm.GetValue("x_FONTE_PAGA") End Function ' ----------------------------------------------------------------- ' Restore form values ' Function RestoreFormValues() Call LoadOldRecord() receptor.REGISTRO_GERAL.CurrentValue = receptor.REGISTRO_GERAL.FormValue receptor.NOME_PACIENTE.CurrentValue = receptor.NOME_PACIENTE.FormValue receptor.IDADE_PACIENTE.CurrentValue = receptor.IDADE_PACIENTE.FormValue receptor.PESO_PACIENTE.CurrentValue = receptor.PESO_PACIENTE.FormValue receptor.SEXO_PACIENTE.CurrentValue = receptor.SEXO_PACIENTE.FormValue receptor.NACIONALIDADE.CurrentValue = receptor.NACIONALIDADE.FormValue receptor.LOCAL.CurrentValue = receptor.LOCAL.FormValue receptor.QUARTO.CurrentValue = receptor.QUARTO.FormValue receptor.LEITO.CurrentValue = receptor.LEITO.FormValue receptor.HIPOTESE_DIAGNOSTICA.CurrentValue = receptor.HIPOTESE_DIAGNOSTICA.FormValue receptor.HISTORICO_TRANSFUCIONAL.CurrentValue = receptor.HISTORICO_TRANSFUCIONAL.FormValue receptor.REACAO_TRANSFUCIONAL.CurrentValue = receptor.REACAO_TRANSFUCIONAL.FormValue receptor.QUAL.CurrentValue = receptor.QUAL.FormValue receptor.GESTACAO_ABORTOS.CurrentValue = receptor.GESTACAO_ABORTOS.FormValue receptor.QUANTOS.CurrentValue = receptor.QUANTOS.FormValue receptor.ABO.CurrentValue = receptor.ABO.FormValue receptor.RH.CurrentValue = receptor.RH.FormValue receptor.SENSIBILIDADE.CurrentValue = receptor.SENSIBILIDADE.FormValue receptor.FONTE_PAGA.CurrentValue = receptor.FONTE_PAGA.FormValue End Function ' ----------------------------------------------------------------- ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = receptor.KeyFilter ' Call Row Selecting event Call receptor.Row_Selecting(sFilter) ' Load sql based on filter receptor.CurrentFilter = sFilter sSql = receptor.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRow(sSql) If RsRow.Eof Then LoadRow = False Else LoadRow = True RsRow.MoveFirst Call LoadRowValues(RsRow) ' Load row values End If RsRow.Close Set RsRow = Nothing End Function ' ----------------------------------------------------------------- ' Load row values from recordset ' Sub LoadRowValues(RsRow) Dim sDetailFilter If RsRow.Eof Then Exit Sub ' Call Row Selected event Call receptor.Row_Selected(RsRow) receptor.ID.DbValue = RsRow("ID") receptor.REGISTRO_GERAL.DbValue = RsRow("REGISTRO_GERAL") receptor.NOME_PACIENTE.DbValue = RsRow("NOME_PACIENTE") receptor.IDADE_PACIENTE.DbValue = RsRow("IDADE_PACIENTE") receptor.PESO_PACIENTE.DbValue = RsRow("PESO_PACIENTE") receptor.SEXO_PACIENTE.DbValue = RsRow("SEXO_PACIENTE") receptor.NACIONALIDADE.DbValue = RsRow("NACIONALIDADE") receptor.LOCAL.DbValue = RsRow("LOCAL") receptor.QUARTO.DbValue = RsRow("QUARTO") receptor.LEITO.DbValue = RsRow("LEITO") receptor.HIPOTESE_DIAGNOSTICA.DbValue = RsRow("HIPOTESE_DIAGNOSTICA") receptor.HISTORICO_TRANSFUCIONAL.DbValue = RsRow("HISTORICO_TRANSFUCIONAL") receptor.REACAO_TRANSFUCIONAL.DbValue = RsRow("REACAO_TRANSFUCIONAL") receptor.QUAL.DbValue = RsRow("QUAL") receptor.GESTACAO_ABORTOS.DbValue = RsRow("GESTACAO_ABORTOS") receptor.QUANTOS.DbValue = RsRow("QUANTOS") receptor.ABO.DbValue = RsRow("ABO") receptor.RH.DbValue = RsRow("RH") receptor.SENSIBILIDADE.DbValue = RsRow("SENSIBILIDADE") receptor.FONTE_PAGA.DbValue = RsRow("FONTE_PAGA") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If receptor.GetKey("ID")&"" <> "" Then receptor.ID.CurrentValue = receptor.GetKey("ID") ' ID Else bValidKey = False End If ' Load old recordset If bValidKey Then receptor.CurrentFilter = receptor.KeyFilter Dim sSql sSql = receptor.SQL Set OldRecordset = ew_LoadRecordset(sSql) Call LoadRowValues(OldRecordset) ' Load row values Else OldRecordset = Null End If LoadOldRecord = bValidKey End Function ' ----------------------------------------------------------------- ' Render row values based on field settings ' Sub RenderRow() ' Initialize urls ' Call Row Rendering event Call receptor.Row_Rendering() ' --------------------------------------- ' Common render codes for all row types ' --------------------------------------- ' ID ' REGISTRO_GERAL ' NOME_PACIENTE ' IDADE_PACIENTE ' PESO_PACIENTE ' SEXO_PACIENTE ' NACIONALIDADE ' LOCAL ' QUARTO ' LEITO ' HIPOTESE_DIAGNOSTICA ' HISTORICO_TRANSFUCIONAL ' REACAO_TRANSFUCIONAL ' QUAL ' GESTACAO_ABORTOS ' QUANTOS ' ABO ' RH ' SENSIBILIDADE ' FONTE_PAGA ' ----------- ' View Row ' ----------- If receptor.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID receptor.ID.ViewValue = receptor.ID.CurrentValue receptor.ID.CssStyle = "text-align:center;" receptor.ID.ViewCustomAttributes = "" ' REGISTRO_GERAL receptor.REGISTRO_GERAL.ViewValue = receptor.REGISTRO_GERAL.CurrentValue receptor.REGISTRO_GERAL.CssStyle = "text-align:center;" receptor.REGISTRO_GERAL.ViewCustomAttributes = "" ' NOME_PACIENTE receptor.NOME_PACIENTE.ViewValue = receptor.NOME_PACIENTE.CurrentValue receptor.NOME_PACIENTE.CssStyle = "text-align:center;" receptor.NOME_PACIENTE.ViewCustomAttributes = "" ' IDADE_PACIENTE receptor.IDADE_PACIENTE.ViewValue = receptor.IDADE_PACIENTE.CurrentValue receptor.IDADE_PACIENTE.CssStyle = "text-align:center;" receptor.IDADE_PACIENTE.ViewCustomAttributes = "" ' PESO_PACIENTE receptor.PESO_PACIENTE.ViewValue = receptor.PESO_PACIENTE.CurrentValue receptor.PESO_PACIENTE.CssStyle = "text-align:center;" receptor.PESO_PACIENTE.ViewCustomAttributes = "" ' SEXO_PACIENTE If Not IsNull(receptor.SEXO_PACIENTE.CurrentValue) Then Select Case receptor.SEXO_PACIENTE.CurrentValue Case "MASCULINO" receptor.SEXO_PACIENTE.ViewValue = ew_IIf(receptor.SEXO_PACIENTE.FldTagCaption(1) <> "", receptor.SEXO_PACIENTE.FldTagCaption(1), "MASCULINO") Case "FEMININO" receptor.SEXO_PACIENTE.ViewValue = ew_IIf(receptor.SEXO_PACIENTE.FldTagCaption(2) <> "", receptor.SEXO_PACIENTE.FldTagCaption(2), "FEMININO") Case Else receptor.SEXO_PACIENTE.ViewValue = receptor.SEXO_PACIENTE.CurrentValue End Select Else receptor.SEXO_PACIENTE.ViewValue = Null End If receptor.SEXO_PACIENTE.CssStyle = "text-align:center;" receptor.SEXO_PACIENTE.ViewCustomAttributes = "" ' NACIONALIDADE receptor.NACIONALIDADE.ViewValue = receptor.NACIONALIDADE.CurrentValue receptor.NACIONALIDADE.CssStyle = "text-align:center;" receptor.NACIONALIDADE.ViewCustomAttributes = "" ' LOCAL receptor.LOCAL.ViewValue = receptor.LOCAL.CurrentValue receptor.LOCAL.CssStyle = "text-align:center;" receptor.LOCAL.ViewCustomAttributes = "" ' QUARTO receptor.QUARTO.ViewValue = receptor.QUARTO.CurrentValue receptor.QUARTO.CssStyle = "text-align:center;" receptor.QUARTO.ViewCustomAttributes = "" ' LEITO receptor.LEITO.ViewValue = receptor.LEITO.CurrentValue receptor.LEITO.CssStyle = "text-align:center;" receptor.LEITO.ViewCustomAttributes = "" ' HIPOTESE_DIAGNOSTICA receptor.HIPOTESE_DIAGNOSTICA.ViewValue = receptor.HIPOTESE_DIAGNOSTICA.CurrentValue receptor.HIPOTESE_DIAGNOSTICA.CssStyle = "text-align:center;" receptor.HIPOTESE_DIAGNOSTICA.ViewCustomAttributes = "" ' HISTORICO_TRANSFUCIONAL receptor.HISTORICO_TRANSFUCIONAL.ViewValue = receptor.HISTORICO_TRANSFUCIONAL.CurrentValue receptor.HISTORICO_TRANSFUCIONAL.CssStyle = "text-align:center;" receptor.HISTORICO_TRANSFUCIONAL.ViewCustomAttributes = "" ' REACAO_TRANSFUCIONAL If Not IsNull(receptor.REACAO_TRANSFUCIONAL.CurrentValue) Then Select Case receptor.REACAO_TRANSFUCIONAL.CurrentValue Case "NÃO" receptor.REACAO_TRANSFUCIONAL.ViewValue = ew_IIf(receptor.REACAO_TRANSFUCIONAL.FldTagCaption(1) <> "", receptor.REACAO_TRANSFUCIONAL.FldTagCaption(1), "NÃO") Case "SIM" receptor.REACAO_TRANSFUCIONAL.ViewValue = ew_IIf(receptor.REACAO_TRANSFUCIONAL.FldTagCaption(2) <> "", receptor.REACAO_TRANSFUCIONAL.FldTagCaption(2), "SIM") Case Else receptor.REACAO_TRANSFUCIONAL.ViewValue = receptor.REACAO_TRANSFUCIONAL.CurrentValue End Select Else receptor.REACAO_TRANSFUCIONAL.ViewValue = Null End If receptor.REACAO_TRANSFUCIONAL.CssStyle = "text-align:center;" receptor.REACAO_TRANSFUCIONAL.ViewCustomAttributes = "" ' QUAL receptor.QUAL.ViewValue = receptor.QUAL.CurrentValue receptor.QUAL.CssStyle = "text-align:center;" receptor.QUAL.ViewCustomAttributes = "" ' GESTACAO_ABORTOS If Not IsNull(receptor.GESTACAO_ABORTOS.CurrentValue) Then Select Case receptor.GESTACAO_ABORTOS.CurrentValue Case "NÃO" receptor.GESTACAO_ABORTOS.ViewValue = ew_IIf(receptor.GESTACAO_ABORTOS.FldTagCaption(1) <> "", receptor.GESTACAO_ABORTOS.FldTagCaption(1), "NÃO") Case "SIM" receptor.GESTACAO_ABORTOS.ViewValue = ew_IIf(receptor.GESTACAO_ABORTOS.FldTagCaption(2) <> "", receptor.GESTACAO_ABORTOS.FldTagCaption(2), "SIM") Case Else receptor.GESTACAO_ABORTOS.ViewValue = receptor.GESTACAO_ABORTOS.CurrentValue End Select Else receptor.GESTACAO_ABORTOS.ViewValue = Null End If receptor.GESTACAO_ABORTOS.CssStyle = "text-align:center;" receptor.GESTACAO_ABORTOS.ViewCustomAttributes = "" ' QUANTOS receptor.QUANTOS.ViewValue = receptor.QUANTOS.CurrentValue receptor.QUANTOS.CssStyle = "text-align:center;" receptor.QUANTOS.ViewCustomAttributes = "" ' ABO If Not IsNull(receptor.ABO.CurrentValue) Then Select Case receptor.ABO.CurrentValue Case "A" receptor.ABO.ViewValue = ew_IIf(receptor.ABO.FldTagCaption(1) <> "", receptor.ABO.FldTagCaption(1), "A") Case "B" receptor.ABO.ViewValue = ew_IIf(receptor.ABO.FldTagCaption(2) <> "", receptor.ABO.FldTagCaption(2), "B") Case "AB" receptor.ABO.ViewValue = ew_IIf(receptor.ABO.FldTagCaption(3) <> "", receptor.ABO.FldTagCaption(3), "AB") Case "O" receptor.ABO.ViewValue = ew_IIf(receptor.ABO.FldTagCaption(4) <> "", receptor.ABO.FldTagCaption(4), "O") Case Else receptor.ABO.ViewValue = receptor.ABO.CurrentValue End Select Else receptor.ABO.ViewValue = Null End If receptor.ABO.CssStyle = "font-weight:bold;text-align:center;" receptor.ABO.ViewCustomAttributes = "" ' RH If Not IsNull(receptor.RH.CurrentValue) Then Select Case receptor.RH.CurrentValue Case "NEG" receptor.RH.ViewValue = ew_IIf(receptor.RH.FldTagCaption(1) <> "", receptor.RH.FldTagCaption(1), "NEG") Case "POS" receptor.RH.ViewValue = ew_IIf(receptor.RH.FldTagCaption(2) <> "", receptor.RH.FldTagCaption(2), "POS") Case Else receptor.RH.ViewValue = receptor.RH.CurrentValue End Select Else receptor.RH.ViewValue = Null End If receptor.RH.CssStyle = "font-weight:bold;text-align:center;" receptor.RH.ViewCustomAttributes = "" ' SENSIBILIDADE receptor.SENSIBILIDADE.ViewValue = receptor.SENSIBILIDADE.CurrentValue receptor.SENSIBILIDADE.CssStyle = "text-align:center;" receptor.SENSIBILIDADE.ViewCustomAttributes = "" ' FONTE_PAGA If Not IsNull(receptor.FONTE_PAGA.CurrentValue) Then Select Case receptor.FONTE_PAGA.CurrentValue Case "SUS" receptor.FONTE_PAGA.ViewValue = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(1) <> "", receptor.FONTE_PAGA.FldTagCaption(1), "SUS") Case "CONVÊNIO" receptor.FONTE_PAGA.ViewValue = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(2) <> "", receptor.FONTE_PAGA.FldTagCaption(2), "CONVÊNIO") Case "PARTICULAR" receptor.FONTE_PAGA.ViewValue = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(3) <> "", receptor.FONTE_PAGA.FldTagCaption(3), "PARTICULAR") Case Else receptor.FONTE_PAGA.ViewValue = receptor.FONTE_PAGA.CurrentValue End Select Else receptor.FONTE_PAGA.ViewValue = Null End If receptor.FONTE_PAGA.CssStyle = "text-align:center;" receptor.FONTE_PAGA.ViewCustomAttributes = "" ' View refer script ' REGISTRO_GERAL receptor.REGISTRO_GERAL.LinkCustomAttributes = "" receptor.REGISTRO_GERAL.HrefValue = "" receptor.REGISTRO_GERAL.TooltipValue = "" ' NOME_PACIENTE receptor.NOME_PACIENTE.LinkCustomAttributes = "" receptor.NOME_PACIENTE.HrefValue = "" receptor.NOME_PACIENTE.TooltipValue = "" ' IDADE_PACIENTE receptor.IDADE_PACIENTE.LinkCustomAttributes = "" receptor.IDADE_PACIENTE.HrefValue = "" receptor.IDADE_PACIENTE.TooltipValue = "" ' PESO_PACIENTE receptor.PESO_PACIENTE.LinkCustomAttributes = "" receptor.PESO_PACIENTE.HrefValue = "" receptor.PESO_PACIENTE.TooltipValue = "" ' SEXO_PACIENTE receptor.SEXO_PACIENTE.LinkCustomAttributes = "" receptor.SEXO_PACIENTE.HrefValue = "" receptor.SEXO_PACIENTE.TooltipValue = "" ' NACIONALIDADE receptor.NACIONALIDADE.LinkCustomAttributes = "" receptor.NACIONALIDADE.HrefValue = "" receptor.NACIONALIDADE.TooltipValue = "" ' LOCAL receptor.LOCAL.LinkCustomAttributes = "" receptor.LOCAL.HrefValue = "" receptor.LOCAL.TooltipValue = "" ' QUARTO receptor.QUARTO.LinkCustomAttributes = "" receptor.QUARTO.HrefValue = "" receptor.QUARTO.TooltipValue = "" ' LEITO receptor.LEITO.LinkCustomAttributes = "" receptor.LEITO.HrefValue = "" receptor.LEITO.TooltipValue = "" ' HIPOTESE_DIAGNOSTICA receptor.HIPOTESE_DIAGNOSTICA.LinkCustomAttributes = "" receptor.HIPOTESE_DIAGNOSTICA.HrefValue = "" receptor.HIPOTESE_DIAGNOSTICA.TooltipValue = "" ' HISTORICO_TRANSFUCIONAL receptor.HISTORICO_TRANSFUCIONAL.LinkCustomAttributes = "" receptor.HISTORICO_TRANSFUCIONAL.HrefValue = "" receptor.HISTORICO_TRANSFUCIONAL.TooltipValue = "" ' REACAO_TRANSFUCIONAL receptor.REACAO_TRANSFUCIONAL.LinkCustomAttributes = "" receptor.REACAO_TRANSFUCIONAL.HrefValue = "" receptor.REACAO_TRANSFUCIONAL.TooltipValue = "" ' QUAL receptor.QUAL.LinkCustomAttributes = "" receptor.QUAL.HrefValue = "" receptor.QUAL.TooltipValue = "" ' GESTACAO_ABORTOS receptor.GESTACAO_ABORTOS.LinkCustomAttributes = "" receptor.GESTACAO_ABORTOS.HrefValue = "" receptor.GESTACAO_ABORTOS.TooltipValue = "" ' QUANTOS receptor.QUANTOS.LinkCustomAttributes = "" receptor.QUANTOS.HrefValue = "" receptor.QUANTOS.TooltipValue = "" ' ABO receptor.ABO.LinkCustomAttributes = "" receptor.ABO.HrefValue = "" receptor.ABO.TooltipValue = "" ' RH receptor.RH.LinkCustomAttributes = "" receptor.RH.HrefValue = "" receptor.RH.TooltipValue = "" ' SENSIBILIDADE receptor.SENSIBILIDADE.LinkCustomAttributes = "" receptor.SENSIBILIDADE.HrefValue = "" receptor.SENSIBILIDADE.TooltipValue = "" ' FONTE_PAGA receptor.FONTE_PAGA.LinkCustomAttributes = "" receptor.FONTE_PAGA.HrefValue = "" receptor.FONTE_PAGA.TooltipValue = "" ' --------- ' Add Row ' --------- ElseIf receptor.RowType = EW_ROWTYPE_ADD Then ' Add row ' REGISTRO_GERAL receptor.REGISTRO_GERAL.EditCustomAttributes = "" receptor.REGISTRO_GERAL.EditValue = ew_HtmlEncode(receptor.REGISTRO_GERAL.CurrentValue) ' NOME_PACIENTE receptor.NOME_PACIENTE.EditCustomAttributes = "" receptor.NOME_PACIENTE.EditValue = ew_HtmlEncode(receptor.NOME_PACIENTE.CurrentValue) ' IDADE_PACIENTE receptor.IDADE_PACIENTE.EditCustomAttributes = "" receptor.IDADE_PACIENTE.EditValue = ew_HtmlEncode(receptor.IDADE_PACIENTE.CurrentValue) ' PESO_PACIENTE receptor.PESO_PACIENTE.EditCustomAttributes = "" receptor.PESO_PACIENTE.EditValue = ew_HtmlEncode(receptor.PESO_PACIENTE.CurrentValue) ' SEXO_PACIENTE receptor.SEXO_PACIENTE.EditCustomAttributes = "" Redim arwrk(1, 1) arwrk(0, 0) = "MASCULINO" arwrk(1, 0) = ew_IIf(receptor.SEXO_PACIENTE.FldTagCaption(1) <> "", receptor.SEXO_PACIENTE.FldTagCaption(1), "MASCULINO") arwrk(0, 1) = "FEMININO" arwrk(1, 1) = ew_IIf(receptor.SEXO_PACIENTE.FldTagCaption(2) <> "", receptor.SEXO_PACIENTE.FldTagCaption(2), "FEMININO") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.SEXO_PACIENTE.EditValue = arwrk ' NACIONALIDADE receptor.NACIONALIDADE.EditCustomAttributes = "" receptor.NACIONALIDADE.EditValue = ew_HtmlEncode(receptor.NACIONALIDADE.CurrentValue) ' LOCAL receptor.LOCAL.EditCustomAttributes = "" receptor.LOCAL.EditValue = ew_HtmlEncode(receptor.LOCAL.CurrentValue) ' QUARTO receptor.QUARTO.EditCustomAttributes = "" receptor.QUARTO.EditValue = ew_HtmlEncode(receptor.QUARTO.CurrentValue) ' LEITO receptor.LEITO.EditCustomAttributes = "" receptor.LEITO.EditValue = ew_HtmlEncode(receptor.LEITO.CurrentValue) ' HIPOTESE_DIAGNOSTICA receptor.HIPOTESE_DIAGNOSTICA.EditCustomAttributes = "" receptor.HIPOTESE_DIAGNOSTICA.EditValue = ew_HtmlEncode(receptor.HIPOTESE_DIAGNOSTICA.CurrentValue) ' HISTORICO_TRANSFUCIONAL receptor.HISTORICO_TRANSFUCIONAL.EditCustomAttributes = "" receptor.HISTORICO_TRANSFUCIONAL.EditValue = ew_HtmlEncode(receptor.HISTORICO_TRANSFUCIONAL.CurrentValue) ' REACAO_TRANSFUCIONAL receptor.REACAO_TRANSFUCIONAL.EditCustomAttributes = "" Redim arwrk(1, 1) arwrk(0, 0) = "NÃO" arwrk(1, 0) = ew_IIf(receptor.REACAO_TRANSFUCIONAL.FldTagCaption(1) <> "", receptor.REACAO_TRANSFUCIONAL.FldTagCaption(1), "NÃO") arwrk(0, 1) = "SIM" arwrk(1, 1) = ew_IIf(receptor.REACAO_TRANSFUCIONAL.FldTagCaption(2) <> "", receptor.REACAO_TRANSFUCIONAL.FldTagCaption(2), "SIM") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.REACAO_TRANSFUCIONAL.EditValue = arwrk ' QUAL receptor.QUAL.EditCustomAttributes = "" receptor.QUAL.EditValue = ew_HtmlEncode(receptor.QUAL.CurrentValue) ' GESTACAO_ABORTOS receptor.GESTACAO_ABORTOS.EditCustomAttributes = "" Redim arwrk(1, 1) arwrk(0, 0) = "NÃO" arwrk(1, 0) = ew_IIf(receptor.GESTACAO_ABORTOS.FldTagCaption(1) <> "", receptor.GESTACAO_ABORTOS.FldTagCaption(1), "NÃO") arwrk(0, 1) = "SIM" arwrk(1, 1) = ew_IIf(receptor.GESTACAO_ABORTOS.FldTagCaption(2) <> "", receptor.GESTACAO_ABORTOS.FldTagCaption(2), "SIM") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.GESTACAO_ABORTOS.EditValue = arwrk ' QUANTOS receptor.QUANTOS.EditCustomAttributes = "" receptor.QUANTOS.EditValue = ew_HtmlEncode(receptor.QUANTOS.CurrentValue) ' ABO receptor.ABO.EditCustomAttributes = "" Redim arwrk(1, 3) arwrk(0, 0) = "A" arwrk(1, 0) = ew_IIf(receptor.ABO.FldTagCaption(1) <> "", receptor.ABO.FldTagCaption(1), "A") arwrk(0, 1) = "B" arwrk(1, 1) = ew_IIf(receptor.ABO.FldTagCaption(2) <> "", receptor.ABO.FldTagCaption(2), "B") arwrk(0, 2) = "AB" arwrk(1, 2) = ew_IIf(receptor.ABO.FldTagCaption(3) <> "", receptor.ABO.FldTagCaption(3), "AB") arwrk(0, 3) = "O" arwrk(1, 3) = ew_IIf(receptor.ABO.FldTagCaption(4) <> "", receptor.ABO.FldTagCaption(4), "O") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.ABO.EditValue = arwrk ' RH receptor.RH.EditCustomAttributes = "" Redim arwrk(1, 1) arwrk(0, 0) = "NEG" arwrk(1, 0) = ew_IIf(receptor.RH.FldTagCaption(1) <> "", receptor.RH.FldTagCaption(1), "NEG") arwrk(0, 1) = "POS" arwrk(1, 1) = ew_IIf(receptor.RH.FldTagCaption(2) <> "", receptor.RH.FldTagCaption(2), "POS") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.RH.EditValue = arwrk ' SENSIBILIDADE receptor.SENSIBILIDADE.EditCustomAttributes = "" receptor.SENSIBILIDADE.EditValue = ew_HtmlEncode(receptor.SENSIBILIDADE.CurrentValue) ' FONTE_PAGA receptor.FONTE_PAGA.EditCustomAttributes = "" Redim arwrk(1, 2) arwrk(0, 0) = "SUS" arwrk(1, 0) = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(1) <> "", receptor.FONTE_PAGA.FldTagCaption(1), "SUS") arwrk(0, 1) = "CONVÊNIO" arwrk(1, 1) = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(2) <> "", receptor.FONTE_PAGA.FldTagCaption(2), "CONVÊNIO") arwrk(0, 2) = "PARTICULAR" arwrk(1, 2) = ew_IIf(receptor.FONTE_PAGA.FldTagCaption(3) <> "", receptor.FONTE_PAGA.FldTagCaption(3), "PARTICULAR") arwrk = ew_AddItemToArray(arwrk, 0, Array("", Language.Phrase("PleaseSelect"))) receptor.FONTE_PAGA.EditValue = arwrk ' Edit refer script ' REGISTRO_GERAL receptor.REGISTRO_GERAL.HrefValue = "" ' NOME_PACIENTE receptor.NOME_PACIENTE.HrefValue = "" ' IDADE_PACIENTE receptor.IDADE_PACIENTE.HrefValue = "" ' PESO_PACIENTE receptor.PESO_PACIENTE.HrefValue = "" ' SEXO_PACIENTE receptor.SEXO_PACIENTE.HrefValue = "" ' NACIONALIDADE receptor.NACIONALIDADE.HrefValue = "" ' LOCAL receptor.LOCAL.HrefValue = "" ' QUARTO receptor.QUARTO.HrefValue = "" ' LEITO receptor.LEITO.HrefValue = "" ' HIPOTESE_DIAGNOSTICA receptor.HIPOTESE_DIAGNOSTICA.HrefValue = "" ' HISTORICO_TRANSFUCIONAL receptor.HISTORICO_TRANSFUCIONAL.HrefValue = "" ' REACAO_TRANSFUCIONAL receptor.REACAO_TRANSFUCIONAL.HrefValue = "" ' QUAL receptor.QUAL.HrefValue = "" ' GESTACAO_ABORTOS receptor.GESTACAO_ABORTOS.HrefValue = "" ' QUANTOS receptor.QUANTOS.HrefValue = "" ' ABO receptor.ABO.HrefValue = "" ' RH receptor.RH.HrefValue = "" ' SENSIBILIDADE receptor.SENSIBILIDADE.HrefValue = "" ' FONTE_PAGA receptor.FONTE_PAGA.HrefValue = "" End If If receptor.RowType = EW_ROWTYPE_ADD Or receptor.RowType = EW_ROWTYPE_EDIT Or receptor.RowType = EW_ROWTYPE_SEARCH Then ' Add / Edit / Search row Call receptor.SetupFieldTitles() End If ' Call Row Rendered event If receptor.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call receptor.Row_Rendered() End If End Sub ' ----------------------------------------------------------------- ' Validate form ' Function ValidateForm() ' Initialize gsFormError = "" ' Check if validation required If Not EW_SERVER_VALIDATE Then ValidateForm = (gsFormError = "") Exit Function End If If Not IsNull(receptor.REGISTRO_GERAL.FormValue) And receptor.REGISTRO_GERAL.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.REGISTRO_GERAL.FldCaption) End If If Not ew_CheckInteger(receptor.REGISTRO_GERAL.FormValue) Then Call ew_AddMessage(gsFormError, receptor.REGISTRO_GERAL.FldErrMsg) End If If Not IsNull(receptor.NOME_PACIENTE.FormValue) And receptor.NOME_PACIENTE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.NOME_PACIENTE.FldCaption) End If If Not IsNull(receptor.IDADE_PACIENTE.FormValue) And receptor.IDADE_PACIENTE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.IDADE_PACIENTE.FldCaption) End If If Not ew_CheckInteger(receptor.IDADE_PACIENTE.FormValue) Then Call ew_AddMessage(gsFormError, receptor.IDADE_PACIENTE.FldErrMsg) End If If Not IsNull(receptor.PESO_PACIENTE.FormValue) And receptor.PESO_PACIENTE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.PESO_PACIENTE.FldCaption) End If If Not IsNull(receptor.SEXO_PACIENTE.FormValue) And receptor.SEXO_PACIENTE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.SEXO_PACIENTE.FldCaption) End If If Not IsNull(receptor.NACIONALIDADE.FormValue) And receptor.NACIONALIDADE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.NACIONALIDADE.FldCaption) End If If Not IsNull(receptor.QUARTO.FormValue) And receptor.QUARTO.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.QUARTO.FldCaption) End If If Not IsNull(receptor.LEITO.FormValue) And receptor.LEITO.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.LEITO.FldCaption) End If If Not IsNull(receptor.HIPOTESE_DIAGNOSTICA.FormValue) And receptor.HIPOTESE_DIAGNOSTICA.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.HIPOTESE_DIAGNOSTICA.FldCaption) End If If Not IsNull(receptor.HISTORICO_TRANSFUCIONAL.FormValue) And receptor.HISTORICO_TRANSFUCIONAL.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.HISTORICO_TRANSFUCIONAL.FldCaption) End If If Not IsNull(receptor.REACAO_TRANSFUCIONAL.FormValue) And receptor.REACAO_TRANSFUCIONAL.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.REACAO_TRANSFUCIONAL.FldCaption) End If If Not IsNull(receptor.GESTACAO_ABORTOS.FormValue) And receptor.GESTACAO_ABORTOS.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.GESTACAO_ABORTOS.FldCaption) End If If Not IsNull(receptor.ABO.FormValue) And receptor.ABO.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.ABO.FldCaption) End If If Not IsNull(receptor.RH.FormValue) And receptor.RH.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.RH.FldCaption) End If If Not IsNull(receptor.SENSIBILIDADE.FormValue) And receptor.SENSIBILIDADE.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.SENSIBILIDADE.FldCaption) End If If Not IsNull(receptor.FONTE_PAGA.FormValue) And receptor.FONTE_PAGA.FormValue&"" = "" Then Call ew_AddMessage(gsFormError, Language.Phrase("EnterRequiredField") & " - " & receptor.FONTE_PAGA.FldCaption) End If ' Validate detail grid If receptor.CurrentDetailTable = "mapa_transfusional" And mapa_transfusional.DetailAdd Then Dim mapa_transfusional_grid Set mapa_transfusional_grid = new cmapa_transfusional_grid ' get detail page object Call mapa_transfusional_grid.ValidateGridForm() Set mapa_transfusional_grid = Nothing End If If receptor.CurrentDetailTable = "provas_cruzadas" And provas_cruzadas.DetailAdd Then Dim provas_cruzadas_grid Set provas_cruzadas_grid = new cprovas_cruzadas_grid ' get detail page object Call provas_cruzadas_grid.ValidateGridForm() Set provas_cruzadas_grid = Nothing End If ' Return validate result ValidateForm = (gsFormError = "") ' Call Form Custom Validate event Dim sFormCustomError sFormCustomError = "" ValidateForm = ValidateForm And Form_CustomValidate(sFormCustomError) If sFormCustomError <> "" Then Call ew_AddMessage(gsFormError, sFormCustomError) End If End Function ' ----------------------------------------------------------------- ' Add record ' Function AddRow(RsOld) If Not EW_DEBUG_ENABLED Then On Error Resume Next Dim Rs, sSql, sFilter Dim RsNew Dim bInsertRow Dim RsChk Dim sIdxErrMsg ' Clear any previous errors Err.Clear If receptor.REGISTRO_GERAL.CurrentValue <> "" Then ' Check field with unique index sFilter = "(`REGISTRO_GERAL` = " & ew_AdjustSql(receptor.REGISTRO_GERAL.CurrentValue) & ")" Set RsChk = receptor.LoadRs(sFilter) If Not (RsChk Is Nothing) Then sIdxErrMsg = Replace(Language.Phrase("DupIndex"), "%f", receptor.REGISTRO_GERAL.FldCaption) sIdxErrMsg = Replace(sIdxErrMsg, "%v", receptor.REGISTRO_GERAL.CurrentValue) FailureMessage = sIdxErrMsg RsChk.Close Set RsChk = Nothing AddRow = False Exit Function End If End If ' Begin transaction If receptor.CurrentDetailTable <> "" Then conn.BeginTrans ' Add new record sFilter = "(0 = 1)" receptor.CurrentFilter = sFilter sSql = receptor.SQL Set Rs = Server.CreateObject("ADODB.Recordset") Rs.CursorLocation = EW_CURSORLOCATION Rs.Open sSql, Conn, 1, EW_RECORDSET_LOCKTYPE Rs.AddNew If Err.Number <> 0 Then Message = Err.Description Rs.Close Set Rs = Nothing AddRow = False Exit Function End If ' Field REGISTRO_GERAL Call receptor.REGISTRO_GERAL.SetDbValue(Rs, receptor.REGISTRO_GERAL.CurrentValue, 0, False) ' Field NOME_PACIENTE Call receptor.NOME_PACIENTE.SetDbValue(Rs, receptor.NOME_PACIENTE.CurrentValue, "", False) ' Field IDADE_PACIENTE Call receptor.IDADE_PACIENTE.SetDbValue(Rs, receptor.IDADE_PACIENTE.CurrentValue, 0, False) ' Field PESO_PACIENTE Call receptor.PESO_PACIENTE.SetDbValue(Rs, receptor.PESO_PACIENTE.CurrentValue, "", False) ' Field SEXO_PACIENTE Call receptor.SEXO_PACIENTE.SetDbValue(Rs, receptor.SEXO_PACIENTE.CurrentValue, "", False) ' Field NACIONALIDADE Call receptor.NACIONALIDADE.SetDbValue(Rs, receptor.NACIONALIDADE.CurrentValue, "", False) ' Field LOCAL Call receptor.LOCAL.SetDbValue(Rs, receptor.LOCAL.CurrentValue, Null, False) ' Field QUARTO Call receptor.QUARTO.SetDbValue(Rs, receptor.QUARTO.CurrentValue, "", False) ' Field LEITO Call receptor.LEITO.SetDbValue(Rs, receptor.LEITO.CurrentValue, "", False) ' Field HIPOTESE_DIAGNOSTICA Call receptor.HIPOTESE_DIAGNOSTICA.SetDbValue(Rs, receptor.HIPOTESE_DIAGNOSTICA.CurrentValue, "", False) ' Field HISTORICO_TRANSFUCIONAL Call receptor.HISTORICO_TRANSFUCIONAL.SetDbValue(Rs, receptor.HISTORICO_TRANSFUCIONAL.CurrentValue, "", False) ' Field REACAO_TRANSFUCIONAL Call receptor.REACAO_TRANSFUCIONAL.SetDbValue(Rs, receptor.REACAO_TRANSFUCIONAL.CurrentValue, "", False) ' Field QUAL Call receptor.QUAL.SetDbValue(Rs, receptor.QUAL.CurrentValue, Null, False) ' Field GESTACAO_ABORTOS Call receptor.GESTACAO_ABORTOS.SetDbValue(Rs, receptor.GESTACAO_ABORTOS.CurrentValue, "", False) ' Field QUANTOS Call receptor.QUANTOS.SetDbValue(Rs, receptor.QUANTOS.CurrentValue, Null, False) ' Field ABO Call receptor.ABO.SetDbValue(Rs, receptor.ABO.CurrentValue, "", False) ' Field RH Call receptor.RH.SetDbValue(Rs, receptor.RH.CurrentValue, "", False) ' Field SENSIBILIDADE Call receptor.SENSIBILIDADE.SetDbValue(Rs, receptor.SENSIBILIDADE.CurrentValue, "", False) ' Field FONTE_PAGA Call receptor.FONTE_PAGA.SetDbValue(Rs, receptor.FONTE_PAGA.CurrentValue, "", False) ' Check recordset update error If Err.Number <> 0 Then FailureMessage = Err.Description Rs.Close Set Rs = Nothing AddRow = False Exit Function End If ' Call Row Inserting event bInsertRow = receptor.Row_Inserting(RsOld, Rs) If bInsertRow Then ' Clone new recordset object Set RsNew = ew_CloneRs(Rs) Rs.Update If Err.Number <> 0 Then FailureMessage = Err.Description AddRow = False Else AddRow = True End If Else Rs.CancelUpdate If receptor.CancelMessage <> "" Then FailureMessage = receptor.CancelMessage receptor.CancelMessage = "" Else FailureMessage = Language.Phrase("InsertCancelled") End If AddRow = False End If Rs.Close Set Rs = Nothing If AddRow Then receptor.ID.DbValue = RsNew("ID") End If ' Add detail records If AddRow Then If receptor.CurrentDetailTable = "mapa_transfusional" And mapa_transfusional.DetailAdd Then mapa_transfusional.REGISTRO_GERAL.SessionValue = receptor.REGISTRO_GERAL.CurrentValue ' Set master key Dim mapa_transfusional_grid Set mapa_transfusional_grid = New cmapa_transfusional_grid ' get detail page object AddRow = mapa_transfusional_grid.GridInsert Set mapa_transfusional_grid = Nothing End If If receptor.CurrentDetailTable = "provas_cruzadas" And provas_cruzadas.DetailAdd Then provas_cruzadas.REGISTRO_GERAL.SessionValue = receptor.REGISTRO_GERAL.CurrentValue ' Set master key Dim provas_cruzadas_grid Set provas_cruzadas_grid = New cprovas_cruzadas_grid ' get detail page object AddRow = provas_cruzadas_grid.GridInsert Set provas_cruzadas_grid = Nothing End If End If ' Commit/Rollback transaction If receptor.CurrentDetailTable <> "" Then If AddRow Then Conn.CommitTrans ' Commit transaction Else Conn.RollbackTrans ' Rollback transaction End If End If If AddRow Then ' Call Row Inserted event Call receptor.Row_Inserted(RsOld, RsNew) End If If IsObject(RsNew) Then RsNew.Close Set RsNew = Nothing End If End Function ' Set up detail parms based on QueryString Sub SetUpDetailParms() Dim sDetailTblVar, bValidDetail bValidDetail = False ' Get the keys for master table If Request.QueryString(EW_TABLE_SHOW_DETAIL).Count > 0 Then sDetailTblVar = Request.QueryString(EW_TABLE_SHOW_DETAIL) receptor.CurrentDetailTable = sDetailTblVar Else sDetailTblVar = receptor.CurrentDetailTable End If If sDetailTblVar <> "" Then If sDetailTblVar = "mapa_transfusional" Then If IsEmpty(mapa_transfusional) Then Set mapa_transfusional = New cmapa_transfusional End If If mapa_transfusional.DetailAdd Then If CopyRecord Then mapa_transfusional.CurrentMode = "copy" Else mapa_transfusional.CurrentMode = "add" End If mapa_transfusional.CurrentAction = "gridadd" ' Save current master table to detail table mapa_transfusional.CurrentMasterTable = receptor.TableVar mapa_transfusional.StartRecordNumber = 1 mapa_transfusional.REGISTRO_GERAL.FldIsDetailKey = True mapa_transfusional.REGISTRO_GERAL.CurrentValue = receptor.REGISTRO_GERAL.CurrentValue mapa_transfusional.REGISTRO_GERAL.SessionValue = mapa_transfusional.REGISTRO_GERAL.CurrentValue End If End If If sDetailTblVar = "provas_cruzadas" Then If IsEmpty(provas_cruzadas) Then Set provas_cruzadas = New cprovas_cruzadas End If If provas_cruzadas.DetailAdd Then If CopyRecord Then provas_cruzadas.CurrentMode = "copy" Else provas_cruzadas.CurrentMode = "add" End If provas_cruzadas.CurrentAction = "gridadd" ' Save current master table to detail table provas_cruzadas.CurrentMasterTable = receptor.TableVar provas_cruzadas.StartRecordNumber = 1 provas_cruzadas.REGISTRO_GERAL.FldIsDetailKey = True provas_cruzadas.REGISTRO_GERAL.CurrentValue = receptor.REGISTRO_GERAL.CurrentValue provas_cruzadas.REGISTRO_GERAL.SessionValue = provas_cruzadas.REGISTRO_GERAL.CurrentValue End If End If End If End Sub ' Page Load event Sub Page_Load() 'Response.Write "Page Load" End Sub ' Page Unload event Sub Page_Unload() 'Response.Write "Page Unload" End Sub ' Page Redirecting event Sub Page_Redirecting(url) 'url = newurl End Sub ' Message Showing event ' typ = ""|"success"|"failure" Sub Message_Showing(msg, typ) ' Example: 'If typ = "success" Then msg = "your success message" End Sub ' Page Data Rendering event Sub Page_DataRendering(header) ' Example: 'header = "your header" End Sub ' Page Data Rendered event Sub Page_DataRendered(footer) ' Example: 'footer = "your footer" End Sub ' Form Custom Validate event Function Form_CustomValidate(CustomError) 'Return error message in CustomError Form_CustomValidate = True End Function End Class %>