jueves, 30 de abril de 2020

miércoles, 29 de abril de 2020

else if sql


IF(@Var1 Condition1)
     BEGIN
      /*Your Code Goes here*/
     END

ELSE IF(@Var1 Condition2)
      BEGIN
        /*Your Code Goes here*/ 
      END 

    ELSE      --<--- Default Task if none of the above is true
     BEGIN
       /*Your Code Goes here*/
     END


fuente

martes, 28 de abril de 2020

warning sql

Warning: Null value is eliminated by an aggregate or other SET operation


Solución

SUM(CASE WHEN t1.tipo_DTE IS NULL THEN 0 ELSE 1 END)

fuente

Separador de miles sql

SELECT CAST(CONVERT(VARCHAR, CAST(123456 AS MONEY), 1) AS VARCHAR)
SELECT REPLACE(CONVERT(VARCHAR, CONVERT(MONEY, 123456), 1), '.00', '')


DECLARE @BigNumber BIGINT
SET @BigNumber = 1234567891234

SELECT REPLACE(CONVERT(VARCHAR,CONVERT(MONEY,@BigNumber),1), '.00','')



fuente
fuente2

boleta nodo sucursal

tabla patron_SII

INSERT INTO patron_SII(
id_patronSII,valores_posibles,mascara_out,descripcion,obligatorio_FA,obligatorio_FE,obligatorio_NC,obligatorio_ND,obligatorio_FC,obligatorio_GD,
nodoxml,valor_min_num,valor_max_num,largo_max_cad,obligatorio_FX,obligatorio_DX,obligatorio_CX,obligatorio_BA,obligatorio_BE)
VALUES ('sucursal','*','c','nombre sucursal','0','0','0','0','0','0','DTE/Documento/Encabezado/Emisor/Sucursal','0','0','20','0','0','0','0','0')


string(descendant::*[local-name()='Sucursal'])
<Sucursal>mall alameda</Sucursal>
máximo 20 caracteres

formato dte, página 16,17 elemento n°41

lunes, 27 de abril de 2020

Estado de una celda

 Private Sub dgv_tareas_CurrentCellDirtyStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgv_tareas.CurrentCellDirtyStateChanged
        If DataGridView1.IsCurrentCellDirty Then
            DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
        End If
    End Sub


fuente

miércoles, 22 de abril de 2020

Fecha Incrementar

Private avanza As Integer = 1

    Private Sub btn_fechas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_fechas.Click

        ' Fecha inicial y fecha actual
        ' Fecha inicial y fecha final



        Dim dt1 As String = "01-04-2020"
        Dim dt2 As String = "19-04-2020"


        Dim FechaInicial As DateTime = Convert.ToDateTime(dt1)
        Dim FechaFinal As DateTime = Convert.ToDateTime(dt2)

        Dim FechaInicialTemp As DateTime = FechaInicial
        Dim FechaFinalTemp As DateTime = FechaFinal

        While True
            If FechaInicial = FechaFinal Then
                avanza = -1
            End If

            Select Case avanza
                Case 0
                    FechaInicialTemp = FechaInicialTemp.AddDays(-1)
                    If FechaInicialTemp <= FechaInicial Then
                        'FechaInicialTemp = FechaInicialTemp.AddDays(1)
                        avanza = 1
                    End If
                    'MessageBox.Show(FechaInicialTemp)
                    WriteDate(FechaInicialTemp)
                Case 1
                    FechaInicialTemp = FechaInicialTemp.AddDays(1)
                    If FechaInicialTemp >= FechaFinal Then
                        avanza = 0
                    End If
                    WriteDate(FechaInicialTemp)
                    'MessageBox.Show(FechaInicialTemp)
                Case Else
                    'MessageBox.Show(FechaInicial)
                    Continue While
            End Select
        End While
    End Sub

viernes, 3 de abril de 2020

Eliminar botón cerrar

Protected Overrides ReadOnly Property CreateParams As CreateParams

        Get
            Const CS_NOCLOSE As Integer = 512
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ClassStyle = (cp.ClassStyle Or CS_NOCLOSE)
            Return cp
        End Get
    End Property

fuente

llamar a CellMouseClick

 Dim b As MouseEventArgs = New MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, MousePosition.X, MousePosition.Y, 0)
        Dim args As System.Windows.Forms.DataGridViewCellMouseEventArgs = New System.Windows.Forms.DataGridViewCellMouseEventArgs(0, principal.dgv_procesos.CurrentRow.Index, MousePosition.X, MousePosition.Y, b)

principal.dgv_procesos_CellMouseClick(sender, args)