Signature Box Code

From FeMR Wiki
Jump to navigation Jump to search

Below are samples of code for various functions of making a Signature Box work properly. The names highlighted in red are to be replaced with a text editing program (like Ultra Edit) to make each box function correctly using the search and replace tool.

ASP

Use an existing signature or initial. You will want to make sure that you copy the two divs below for the signature or initial. Make sure the button, Signature Div and MouseSignature names are copied from MW


                <div class="formRow">
                   <div class="col-SigButton">
                      <asp:Button ID="btnSignature1" Text="Signature" runat="server" Width="125px"/>
                      <asp:Button ID="btnSignatureEnable1" runat="server" Text="Enable Signature" Width="125px" />
                   </div>
                   <div class="col-Signature" id="DivSignature1" runat="server">
                      <cc1:MouseSignature BorderStyle="Solid"  SignPenColor="Black" BackColor="White" SignTransparent="false"  BorderWidth="2" SignPenSize="2" SignShowImageBorder="true"  BorderColor="Black"  ID="ctlSuperSignatureName" runat="server" CssClass="auto-style76" Height="250px" SignRequiredPoints="" IncludeJquery="False" SignWidth="700" Width="700px"  />
                   </div>
                </div>
 

MW Signatures

These are the naming standards for the buttons, signature div and signature control name. Make sure to increment buy number for each signature or initial.

VB - LoadSignatures

You will want to make sure the initial or signature button and the signature div are disabled and not visible

       'Hide Div / Disable Buttons
        btnSignature1.Enabled = False
        DivSignature1.Visible = False
         

Next you will copy the template to check if the signature was completed and change the column name to match the MW

    
        'Set button text

        If dsSignatureData.Tables("Signature").Rows(0).Item("chrSuperSignatureName") = "Y" Then
            btnSignature1.Text = "Signed"
            btnSignature1.BackColor = strBackColor
            btnSignature1.ForeColor = strForeColor
            btnSignatureEnable1.Visible = True
        End If  
       

Next you will copy the template to check if the signature was NOT completed and change the column name to match the MW

    'If sesLoadReason is New or Update, enable buttons and divs for required signatures
        If Session("sesLoadReason") = "New" Or Session("sesLoadReason") = "Edit" Then
        'Copy the statement below. Leave the first if statement above alone
        
            If dsSignatureData.Tables("Signature").Rows(0).Item("chrSuperSignatureName") = "N" Then
                btnSignature1.Enabled = True
                DivSignature1.Visible = True
                btnSignatureEnable1.Visible = False
            End If
 

VB - Initial/Signature Button

You can copy some existing code from the button type. For the initial or signature button, the code behind will need 3 things changed : The Bitmap CTL name The strSaveFile png name The strColumn name

Make sure that if you copy it, the button and div names under the Copy Master button comment match your MW names. Same with the btnInitialEnable* name at the bottom of the code

   '*** Copy Master Button VB Column B & C below ***
        Dim bm As Bitmap = ctlSuperSignatureName.SaveSignature("")


        Dim strSaveLoc As String
        Dim strSaveFile As String
        Dim strSaveFull As String
        Dim strBackColor As System.Drawing.Color = System.Drawing.Color.Green
        Dim strForeColor As System.Drawing.Color = System.Drawing.Color.Yellow

        strSaveLoc = "~/Drawings/" & Session("sesCurrentMedicalRecordNumber") & "/Signatures/"

        '*** Copy Master Button VB Column D & E below ***
        strSaveFile = "ctlSuperSignatureName.png"

        strSaveFull = Server.MapPath(strSaveLoc) & strSaveFile

        bm.Save(strSaveFull, ImageFormat.Png)

        'Hide Div / Disable - Paint Button
        '*** Copy Master Button VB Column H below ***

        btnSignature1.Enabled = False
        DivSignature1.Visible = False
        btnSignature1.Text = "Signed"
        btnSignature1.BackColor = strBackColor
        btnSignature1.ForeColor = strForeColor




        'Update tblSignature
        Dim strColumn As String
        Dim strRecordStatus As String
        strRecordStatus = "Y"

        '*** Copy Master Button VB Column F & G below ***
        strColumn = "chrSuperSignatureName"



        SetTableSignature(strColumn, strRecordStatus)

        btnSignatureEnable1.Visible = True

 

VB - Enable Button

You can copy some existing code from the button type. For the enable button, the code behind will need 1 thing changed : The strColumn name

Make sure that if you copy it, the button and div names under the 'Hide Div / Disable comment match your MW names. Same with the btnInitialEnable* name at the bottom of the code

'Hide Div / Disable - Paint Button
        '*** Copy Master Button VB Column H below ***
        btnSignature1.Enabled = True
        DivSignature1.Visible = True
        btnSignature1.Text = "Sign"
        btnSignature1.ForeColor = Color.Black
        btnSignature1.BackColor = Color.LightGray


        'Update tblSignature
        Dim strColumn As String
        Dim strRecordStatus As String
        strRecordStatus = "N"

        '*** Copy Master Button VB Column F & G below ***
        strColumn = "chrSuperSignatureName"


        SetTableSignature(strColumn, strRecordStatus)

        'Hide enable button
        btnSignatureEnable1.Visible = False
 

VB - DisableFields

Add the btn*****Enable here. Make sure they are not Visible

  'Signatures
        btnSignatureEnable1.Visible = False