Attribute VB_Name = "Modulo_Func_Contrato"
Function creacontrato(rut_apoderado As String, aggno_matricula As String, tipo_pago As String, silencioso As Boolean, codensnumletra As String) As Boolean
creacontrato = False
 Dim objRS As ADODB.Recordset
 Set objRS = New ADODB.Recordset
 Dim var_sql As String
 var_sql = "select valor from cfg where param = 'CODBC'"
 objRS.Open var_sql, conn
      var_sql = objRS("valor")
 objRS.Close
    
If var_sql = "HUE001" Or var_sql = "ALT001" Then
If Trim(rut_apoderado) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea_hue
        Form_ContratoCrea_hue.Hide
        Form_ContratoCrea_hue.agno.Text = aggno_matricula
        Form_ContratoCrea_hue.run_apo.Text = rut_apoderado
        Form_ContratoCrea_hue.tpago.Text = tipo_pago
        Form_ContratoCrea_hue.codnumlet = codensnumletra
        If silencioso Then
            Form_ContratoCrea_hue.opm.Text = "N"
        Else
            Form_ContratoCrea_hue.opm.Text = "S"
        End If
        Form_ContratoCrea_hue.Command1_Click
        
        Unload Form_ContratoCrea_hue
        creacontrato = True
End If
Else
If Trim(rut_apoderado) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.run_apo.Text = rut_apoderado
        Form_ContratoCrea.tpago.Text = tipo_pago
        Form_ContratoCrea.codnumlet = codensnumletra
        If silencioso Then
            Form_ContratoCrea.opm.Text = "N"
        Else
            Form_ContratoCrea.opm.Text = "S"
        End If
        Form_ContratoCrea.Command1_Click
        
        Unload Form_ContratoCrea
        creacontrato = True
End If
        
End If



End Function

Function impcontratosolo(rut_apoderado As String, aggno_matricula As String, tipo_pago As String, regenerar As Boolean) As Boolean
impcontratosolo = False

If Trim(rut_apoderado) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.run_apo.Text = rut_apoderado
        Form_ContratoCrea.tpago.Text = tipo_pago
        Form_ContratoCrea.codnumlet = " "
        If regenerar Then
            Form_ContratoCrea.opm.Text = "S"
        Else
            Form_ContratoCrea.opm.Text = "N"
        End If
        Form_ContratoCrea.Command1_Click
        Unload Form_ContratoCrea
        impcontratosolo = True
End If
End Function

Function impcontratoscurso(codnumletra As String, aggno_matricula As String) As Boolean
impcontratoscurso = False

If Trim(codnumletra) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.tpago.Text = tipo_pago
        Form_ContratoCrea.codnumlet = codnumletra
        Form_ContratoCrea.Command4_Click
        Unload Form_ContratoCrea
        impcontratoscurso = True
End If
End Function

Function creacartaaviso(rut_apoderado As String, aggno_matricula As String, codensnumletra As String) As Boolean
creacartaaviso = False

If Trim(rut_apoderado) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.run_apo.Text = rut_apoderado
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.codnumlet = codensnumletra
        Form_ContratoCrea.Command3_Click
        Unload Form_ContratoCrea
        creacartaaviso = True
End If
End Function

Function impcartaaviso(aggno_matricula As String, codensnumletra As String) As Boolean
impcartaaviso = False

If Trim(codensnumletra) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.codnumlet = codensnumletra
        Form_ContratoCrea.Command5_Click
        Unload Form_ContratoCrea
        impcartaaviso = True
End If
End Function

Function creacartaaviso2(rut_apoderado As String, aggno_matricula As String, codensnumletra As String) As Boolean
creacartaaviso2 = False

If Trim(rut_apoderado) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.run_apo.Text = rut_apoderado
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.codnumlet = codensnumletra
        Form_ContratoCrea.Command7_Click
        Unload Form_ContratoCrea
        creacartaaviso2 = True
End If
End Function

Function impcartaaviso2(aggno_matricula As String, codensnumletra As String) As Boolean
impcartaaviso2 = False

If Trim(codensnumletra) <> "" And Trim(aggno_matricula) <> "" Then
        Load Form_ContratoCrea
        Form_ContratoCrea.Hide
        Form_ContratoCrea.agno.Text = aggno_matricula
        Form_ContratoCrea.codnumlet = codensnumletra
        Form_ContratoCrea.Command8_Click
        Unload Form_ContratoCrea
        impcartaaviso2 = True
End If
End Function
