client/conexion/Catalogos/CatPaisMoneda.vb

346 lines
16 KiB
VB.net
Raw Normal View History

Public Class CatPaisMoneda
Inherits System.Windows.Forms.Form
Dim clCmpMon As New clsComplejo()
Dim clCmpPais As New clsComplejo()
Dim Moneda As Integer
#Region " C<>digo generado por el Dise<73>ador de Windows Forms "
Public Sub New()
MyBase.New()
'El Dise<73>ador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicializaci<63>n despu<70>s de la llamada a InitializeComponent()
End Sub
'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requerido por el Dise<73>ador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Dise<73>ador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Dise<73>ador de Windows Forms.
'No lo modifique con el editor de c<>digo.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents tlbCorteCaja As System.Windows.Forms.ToolBar
Friend WithEvents btnAgrergar As System.Windows.Forms.ToolBarButton
Friend WithEvents btnSalir As System.Windows.Forms.ToolBarButton
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents cboPais As System.Windows.Forms.ComboBox
Friend WithEvents cboMoneda As System.Windows.Forms.ComboBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents C1TrueDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(CatPaisMoneda))
Me.Label1 = New System.Windows.Forms.Label
Me.tlbCorteCaja = New System.Windows.Forms.ToolBar
Me.btnAgrergar = New System.Windows.Forms.ToolBarButton
Me.btnSalir = New System.Windows.Forms.ToolBarButton
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Button1 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.cboPais = New System.Windows.Forms.ComboBox
Me.cboMoneda = New System.Windows.Forms.ComboBox
Me.C1TrueDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid
Me.GroupBox1.SuspendLayout()
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(82, 64)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(32, 16)
Me.Label1.TabIndex = 61
Me.Label1.Text = "Pa<EFBFBD>s:"
'
'tlbCorteCaja
'
Me.tlbCorteCaja.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.tlbCorteCaja.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.btnAgrergar, Me.btnSalir})
Me.tlbCorteCaja.ButtonSize = New System.Drawing.Size(75, 40)
Me.tlbCorteCaja.DropDownArrows = True
Me.tlbCorteCaja.ImageList = Me.ImageList1
Me.tlbCorteCaja.Location = New System.Drawing.Point(0, 0)
Me.tlbCorteCaja.Name = "tlbCorteCaja"
Me.tlbCorteCaja.ShowToolTips = True
Me.tlbCorteCaja.Size = New System.Drawing.Size(420, 47)
Me.tlbCorteCaja.TabIndex = 60
'
'btnAgrergar
'
Me.btnAgrergar.ImageIndex = 0
Me.btnAgrergar.Text = "Agregar"
'
'btnSalir
'
Me.btnSalir.ImageIndex = 4
Me.btnSalir.Text = "Salir"
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Turquoise
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.C1TrueDBGrid1)
Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(6, 134)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(412, 178)
Me.GroupBox1.TabIndex = 64
Me.GroupBox1.TabStop = False
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.Control
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.Location = New System.Drawing.Point(302, 324)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(104, 20)
Me.Button1.TabIndex = 82
Me.Button1.Text = "Alias ..."
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(64, 96)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(52, 16)
Me.Label2.TabIndex = 62
Me.Label2.Text = "Moneda:"
'
'cboPais
'
Me.cboPais.Location = New System.Drawing.Point(120, 62)
Me.cboPais.Name = "cboPais"
Me.cboPais.Size = New System.Drawing.Size(200, 21)
Me.cboPais.TabIndex = 65
'
'cboMoneda
'
Me.cboMoneda.Location = New System.Drawing.Point(120, 94)
Me.cboMoneda.Name = "cboMoneda"
Me.cboMoneda.Size = New System.Drawing.Size(200, 21)
Me.cboMoneda.TabIndex = 66
'
'C1TrueDBGrid1
'
Me.C1TrueDBGrid1.AllowUpdate = False
Me.C1TrueDBGrid1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.C1TrueDBGrid1.Dock = System.Windows.Forms.DockStyle.Fill
Me.C1TrueDBGrid1.GroupByCaption = "Drag a column header here to group by that column"
Me.C1TrueDBGrid1.Images.Add(CType(resources.GetObject("resource"), System.Drawing.Image))
Me.C1TrueDBGrid1.Location = New System.Drawing.Point(3, 16)
Me.C1TrueDBGrid1.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.HighlightRow
Me.C1TrueDBGrid1.Name = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PreviewInfo.Location = New System.Drawing.Point(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.Size = New System.Drawing.Size(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.ZoomFactor = 75
Me.C1TrueDBGrid1.Size = New System.Drawing.Size(406, 159)
Me.C1TrueDBGrid1.TabIndex = 0
Me.C1TrueDBGrid1.Text = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PropBag = "<?xml version=""1.0""?><Blob><Styles type=""C1.Win.C1TrueDBGrid.Design.ContextWrappe" & _
"r""><Data>Group{BackColor:ControlDark;Border:None,,0, 0, 0, 0;AlignVert:Center;}E" & _
"ditor{}Style2{}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:Aqua;}Selected{" & _
"ForeColor:HighlightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:Inactive" & _
"CaptionText;BackColor:InactiveCaption;}FilterBar{}Footer{}Caption{AlignHorz:Cent" & _
"er;}Style14{}Normal{Font:Microsoft Sans Serif, 8.25pt, style=Bold;}HighlightRow{" & _
"ForeColor:Aqua;BackColor:Highlight;}Style9{}OddRow{}RecordSelector{AlignImage:Ce" & _
"nter;}Style15{}Heading{Wrap:True;AlignVert:Center;Border:Raised,,1, 1, 1, 1;Fore" & _
"Color:ControlText;BackColor:Control;}Style8{}Style10{AlignHorz:Near;}Style11{}St" & _
"yle12{}Style13{}Style1{}</Data></Styles><Splits><C1.Win.C1TrueDBGrid.MergeView N" & _
"ame="""" CaptionHeight=""17"" ColumnCaptionHeight=""17"" ColumnFooterHeight=""17"" Marqu" & _
"eeStyle=""HighlightRow"" RecordSelectorWidth=""16"" DefRecSelWidth=""16"" VerticalScro" & _
"llGroup=""1"" HorizontalScrollGroup=""1""><Height>155</Height><CaptionStyle parent=""" & _
"Style2"" me=""Style10"" /><EditorStyle parent=""Editor"" me=""Style5"" /><EvenRowStyle " & _
"parent=""EvenRow"" me=""Style8"" /><FilterBarStyle parent=""FilterBar"" me=""Style13"" /" & _
"><FooterStyle parent=""Footer"" me=""Style3"" /><GroupStyle parent=""Group"" me=""Style" & _
"12"" /><HeadingStyle parent=""Heading"" me=""Style2"" /><HighLightRowStyle parent=""Hi" & _
"ghlightRow"" me=""Style7"" /><InactiveStyle parent=""Inactive"" me=""Style4"" /><OddRow" & _
"Style parent=""OddRow"" me=""Style9"" /><RecordSelectorStyle parent=""RecordSelector""" & _
" me=""Style11"" /><SelectedStyle parent=""Selected"" me=""Style6"" /><Style parent=""No" & _
"rmal"" me=""Style1"" /><ClientRect>0, 0, 402, 155</ClientRect><BorderSide>0</Border" & _
"Side><BorderStyle>Sunken</BorderStyle></C1.Win.C1TrueDBGrid.MergeView></Splits><" & _
"NamedStyles><Style parent="""" me=""Normal"" /><Style parent=""Normal"" me=""Heading"" /" & _
"><Style parent=""Heading"" me=""Footer"" /><Style parent=""Heading"" me=""Caption"" /><S" & _
"tyle parent=""Heading"" me=""Inactive"" /><Style parent=""Normal"" me=""Selected"" /><St" & _
"yle parent=""Normal"" me=""Editor"" /><Style parent=""Normal"" me=""HighlightRow"" /><St" & _
"yle parent=""Normal"" me=""EvenRow"" /><Style parent=""Normal"" me=""OddRow"" /><Style p" & _
"arent=""Heading"" me=""RecordSelector"" /><Style parent=""Normal"" me=""FilterBar"" /><S" & _
"tyle parent=""Caption"" me=""Group"" /></NamedStyles><vertSplits>1</vertSplits><horz" & _
"Splits>1</horzSplits><Layout>None</Layout><DefaultRecSelWidth>16</DefaultRecSelW" & _
"idth><ClientArea>0, 0, 402, 155</ClientArea><PrintPageHeaderStyle parent="""" me=""" & _
"Style14"" /><PrintPageFooterStyle parent="""" me=""Style15"" /></Blob>"
'
'CatPaisMoneda
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.White
Me.ClientSize = New System.Drawing.Size(420, 363)
Me.ControlBox = False
Me.Controls.Add(Me.cboMoneda)
Me.Controls.Add(Me.cboPais)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.tlbCorteCaja)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
Me.Name = "CatPaisMoneda"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "CatPaisMoneda"
Me.GroupBox1.ResumeLayout(False)
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub tlbCorteCaja_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tlbCorteCaja.ButtonClick
Select Case e.Button.Text
Case "Agregar"
sbGuardar()
Me.cboMoneda.Text = ""
Case "Salir"
Me.Close()
End Select
End Sub
Private Sub CatPlaza_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sbIniciaForma()
End Sub
Public Sub Entra(ByVal Id_Moneda As Integer)
Moneda = Id_Moneda
End Sub
Private Sub sbIniciaForma()
'Llena combos y grid
clCmpPais.sbLlenaCombo("spListaPais", Me.cboPais)
clCmpMon.sbLlenaCombo("spListaMoneda", Me.cboMoneda)
clCmpMon.fdtDataSetTabla("spGridPlazMoneda 0 ")
Me.C1TrueDBGrid1.SetDataBinding(clCmpMon.ds, "Table")
'clCmpMon.sbLlenaMSFGrid("spGridPlazMoneda 0", grdPaisMoneda)
Me.cboMoneda.SelectedValue = Moneda
'With grdPaisMoneda
' .set_ColWidth(0, 2400)
' .set_ColWidth(1, 2100)
'End With
End Sub
Private Sub sbGuardar()
Dim lsMensaje As String
If MsgBox("<EFBFBD>Desea guardar los cambios?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "MINDS Cliente") = MsgBoxResult.No Then Exit Sub
If fbValidaGrabar() Then
lsMensaje = "Datos guardados correctamente"
sbIniciaForma()
Else
lsMensaje = "Los datos no fueron guardados"
End If
MsgBox(lsMensaje, MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
End Sub
Private Function fbValidaGrabar() As Boolean
Dim liPais As Integer
Dim liMoneda As Integer
Dim lsSQL As String
On Error GoTo eh
fbValidaGrabar = False
If cboPais.SelectedIndex = -1 Then
MsgBox("Pa<EFBFBD>s no v<>lido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
Else
liPais = cboPais.SelectedValue
End If
If cboMoneda.SelectedIndex = -1 Then
MsgBox("Moneda no v<>lida", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
Else
liMoneda = cboMoneda.SelectedValue
End If
lsSQL = ""
lsSQL = lsSQL & "spGrabaPaisMoneda "
lsSQL = lsSQL & liPais & ", "
lsSQL = lsSQL & liMoneda
clCmpMon.sbGuardaModifica(lsSQL)
Return True
Exit Function
eh:
Return False
End Function
'Private Sub grdPaisMoneda_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPaisMoneda.DblClick
' With grdPaisMoneda
' .Col = 0
' clCmpPais.sbBuscaEnCombo(.Text, Me.cboPais)
' .Col = 1
' clCmpMon.sbBuscaEnCombo(.Text, Me.cboMoneda)
' End With
'End Sub
Private Sub cboPais_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboPais.SelectedIndexChanged
'On Error Resume Next
Try
Dim lsComando As String
Dim clCmpClas As New clsComplejo
lsComando = "spGridPlazMoneda " & Me.cboPais.SelectedValue
clCmpClas.fdtDataSetTabla(lsComando)
Me.C1TrueDBGrid1.SetDataBinding(clCmpClas.ds, "Tabla")
'clCmpClas.sbLlenaMSFGrid(lsComando, Me.grdPaisMoneda)
Catch ex As Exception
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If cboMoneda.Text <> "" Then
sbAlias()
Else
MessageBox.Show("Debe Selecionar un elemento", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Private Sub sbAlias()
Dim miAlias As New ActAlias
miAlias.Entra(13, cboMoneda.SelectedValue, Me.cboPais.SelectedValue)
miAlias.Text = "Alias Moneda"
miAlias.piCatalogo = 13
miAlias.Show()
End Sub
Private Sub C1TrueDBGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.DoubleClick
Try
With Me.C1TrueDBGrid1
.Col = 0
clCmpPais.sbBuscaEnCombo(.Columns(0).Value, Me.cboPais)
.Col = 1
clCmpMon.sbBuscaEnCombo(.Columns(1).Value, Me.cboMoneda)
End With
Catch ex As Exception
End Try
End Sub
End Class