DECLARE @mydate DATETIME
SELECT @mydate = GETDATE()
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)),@mydate),101) ,
'Último día del mes anterior'
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),101) AS Date_Value,
'Primer día del mes corriente' AS Date_Type
UNION
SELECT CONVERT(VARCHAR(25),@mydate,101) AS Date_Value, 'Hoy' AS Date_Type
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))),DATEADD(mm,1,@mydate)),101) ,
'Último día del mes corriente'
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))-1),DATEADD(mm,1,@mydate)),101) ,
'Primer día del mes siguiente'
GO
Un poco de C#,JScript,VB, y CRM, Drupal, SQL , MSDCRM y MSDSL VBTools, developer, project lider, Social Media Activist, BlackBerry developer, telerik tools. (MCITP)
martes, 6 de enero de 2015
Obtener los días del mes en SQL
Para obtener los días del mes en SQL lo podemos hacer de la siguiente manera, espero les sea muy útil.
jueves, 14 de agosto de 2014
Add VB Code Inspector VS 2008
Open up Visual Studio > Tools Menu > Options > Environment > Add-In/Macro Security > Add the path "C:\Program Files(86)\CommFiles\Microsoft Shared\DynamicsSL"
Restart Visual Studio and the add-in is listed!
miércoles, 2 de julio de 2014
Call WebService and Send params VB6
' (This is Visual Basic 6 code.) Private Sub Form_Load() ' Create the SoapClient. Dim SoapClient As MSSOAPLib30.SoapClient30 Set SoapClient = New MSSOAPLib30.SoapClient30 ' Use the Init method to generate a proxy Dim WSDLPath As String WSDLPath = "http://localhost/VBCookbookWebServices/Recipe16-2.asmx?WSDL" Call SoapClient.MSSoapInit(WSDLPath) ' Call the GetDate web method to retrieve some information. MsgBox("Server returned: " & SoapClient.GetDate()) End Sub
'Other Function
Public Function XVALIDATEQR(ByVal pRfce As String, ByVal pRfcr As String, ByVal pMonto As Double, ByVal pUUID As String) As Integer Dim vSOAPcnt As New SoapClient30 Dim vResult As String Set vSOAPcnt = New SoapClient30 Call vSOAPcnt.MSSoapInit("http://urlService.asmx?wsdl") vResult = vSOAPcnt.ExpImpresa(txtrfce.Text, txtrfcr.Text, txtmonto.Text, txtUUID.Text) MsgBox ("Server returned: " & vResult) End Function
jueves, 6 de febrero de 2014
Validar UUID del SAT
WEbReference https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc
Codigo C#
ConsultaCFDI.ConsultaCFDIServiceClient oConsulta = new ConsultaCFDIServiceClient();
ConsultaCFDI.Acuse oAcuse = new Acuse();
oAcuse=oConsulta.Consulta("?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075");
MessageBox.Show("Estatus " + oAcuse.CodigoEstatus + " Estado: " + oAcuse.Estado);
Si te interesa hacer algo mas, un desarrollo integración de CFDI o validador de facturas de proveedores -> josmisu_@hotmail.com
Codigo C#
ConsultaCFDI.ConsultaCFDIServiceClient oConsulta = new ConsultaCFDIServiceClient();
ConsultaCFDI.Acuse oAcuse = new Acuse();
oAcuse=oConsulta.Consulta("?re=BEN9501023I0&rr=SARM8209281F1&tt=440.000000&id=EC609EC1-5F63-4333-A2B8-2EDC10B68075");
MessageBox.Show("Estatus " + oAcuse.CodigoEstatus + " Estado: " + oAcuse.Estado);
Si te interesa hacer algo mas, un desarrollo integración de CFDI o validador de facturas de proveedores -> josmisu_@hotmail.com
Etiquetas:
CFDI,
https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc,
SAT,
UUID,
VALIDA CFD,
VALIDA CFDI,
VALIDA FACTURA,
VALIDA SAT
miércoles, 5 de febrero de 2014
Cómo leer Archivo de LCO del SAT
Function FileToString(ByVal filePath As String) As String
Dim f As FileStream
f = New FileStream(filePath, FileMode.Open, FileAccess.Read)
Dim streamLength As Integer = Convert.ToInt32(f.Length)
Dim fileData As Byte() = New Byte(streamLength) {}
f.Read(fileData, 0, streamLength)
f.Close()
Return System.Text.Encoding.Default.GetString(fileData)
End Function
Private Function LimpiaLCO(ByVal sPath As String, ByVal sFile As String) As String
Dim RutaLCO As [String] = sPath
Dim xmlLCO As String = RutaLCO & sFile
'Dim objReader As New StreamReader(xmlLCO)
Dim sRes As String = FileToString(xmlLCO) 'objReader.ReadToEnd()
Dim posIni As Integer = sRes.LastIndexOf("<?xml", System.StringComparison.Ordinal)
Dim posFin As Integer = sRes.LastIndexOf("</lco:LCO>", System.StringComparison.Ordinal)
sRes = sRes.Substring(posIni, posFin)
posFin = sRes.LastIndexOf("</lco:LCO>", System.StringComparison.Ordinal)
sRes = sRes.Substring(0, posFin)
Dim SW As StreamWriter
Dim origName = xmlLCO.Remove(xmlLCO.Length - 4)
origName += "Clean.XML"
SW = File.CreateText(sPath)
SW.WriteLine(sRes)
SW.WriteLine("</lco:LCO>")
SW.Close()
Return origName
End Function
Private Shared Sub LoadLco(ByVal sPathFileLCO_Clean As String)
'Dim RutaLCO As [String] = sPath
Dim xmlLCO As String = sPathFileLCO_Clean ' RutaLCO & sfileClean
'Cargamos XML
Dim xdoc As XDocument = XDocument.Load(xmlLCO)
'Query
Dim LCO = From Contribuyente In xdoc.Descendants("Contribuyente") _
Select New With {Key .RFC = Contribuyente.Attribute("RFC").Value, _
Key .Certificados = Contribuyente.Descendants("Certificado")}
'Resultado
For Each Contribuyente As Object In LCO
Console.WriteLine(Contribuyente.RFC)
For Each Certificado As Object In Contribuyente.Certificados
Dim Result = ""
Dim xAttribute = Certificado.Attribute("noCertificado")
If xAttribute IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute.Value)
End If
Dim attribute = Certificado.Attribute("ValidezObligaciones")
If attribute IsNot Nothing Then
Result += " " & Convert.ToString(attribute.Value)
End If
Dim xAttribute1 = Certificado.Attribute("EstatusCertificado")
If xAttribute1 IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute1.Value)
End If
Dim attribute1 = Certificado.Attribute("FechaInicio")
If attribute1 IsNot Nothing Then
Result += " " & Convert.ToString(attribute1.Value)
End If
Dim xAttribute2 = Certificado.Attribute("FechaFinal")
If xAttribute2 IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute2.Value)
End If
MessageBox.Show(Result)
Next
Next
End Sub
Dim f As FileStream
f = New FileStream(filePath, FileMode.Open, FileAccess.Read)
Dim streamLength As Integer = Convert.ToInt32(f.Length)
Dim fileData As Byte() = New Byte(streamLength) {}
f.Read(fileData, 0, streamLength)
f.Close()
Return System.Text.Encoding.Default.GetString(fileData)
End Function
Private Function LimpiaLCO(ByVal sPath As String, ByVal sFile As String) As String
Dim RutaLCO As [String] = sPath
Dim xmlLCO As String = RutaLCO & sFile
'Dim objReader As New StreamReader(xmlLCO)
Dim sRes As String = FileToString(xmlLCO) 'objReader.ReadToEnd()
Dim posIni As Integer = sRes.LastIndexOf("<?xml", System.StringComparison.Ordinal)
Dim posFin As Integer = sRes.LastIndexOf("</lco:LCO>", System.StringComparison.Ordinal)
sRes = sRes.Substring(posIni, posFin)
posFin = sRes.LastIndexOf("</lco:LCO>", System.StringComparison.Ordinal)
sRes = sRes.Substring(0, posFin)
Dim SW As StreamWriter
Dim origName = xmlLCO.Remove(xmlLCO.Length - 4)
origName += "Clean.XML"
SW = File.CreateText(sPath)
SW.WriteLine(sRes)
SW.WriteLine("</lco:LCO>")
SW.Close()
Return origName
End Function
Private Shared Sub LoadLco(ByVal sPathFileLCO_Clean As String)
'Dim RutaLCO As [String] = sPath
Dim xmlLCO As String = sPathFileLCO_Clean ' RutaLCO & sfileClean
'Cargamos XML
Dim xdoc As XDocument = XDocument.Load(xmlLCO)
'Query
Dim LCO = From Contribuyente In xdoc.Descendants("Contribuyente") _
Select New With {Key .RFC = Contribuyente.Attribute("RFC").Value, _
Key .Certificados = Contribuyente.Descendants("Certificado")}
'Resultado
For Each Contribuyente As Object In LCO
Console.WriteLine(Contribuyente.RFC)
For Each Certificado As Object In Contribuyente.Certificados
Dim Result = ""
Dim xAttribute = Certificado.Attribute("noCertificado")
If xAttribute IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute.Value)
End If
Dim attribute = Certificado.Attribute("ValidezObligaciones")
If attribute IsNot Nothing Then
Result += " " & Convert.ToString(attribute.Value)
End If
Dim xAttribute1 = Certificado.Attribute("EstatusCertificado")
If xAttribute1 IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute1.Value)
End If
Dim attribute1 = Certificado.Attribute("FechaInicio")
If attribute1 IsNot Nothing Then
Result += " " & Convert.ToString(attribute1.Value)
End If
Dim xAttribute2 = Certificado.Attribute("FechaFinal")
If xAttribute2 IsNot Nothing Then
Result += " " & Convert.ToString(xAttribute2.Value)
End If
MessageBox.Show(Result)
Next
Next
End Sub
jueves, 30 de enero de 2014
Como obtener la Lista de usuarios del ActiveDirectory
Comando para listar el Active Directory en un Documento separado por Coma.
CSVDE -f nombredeldocumento.csv -b usuario dominio contraseña
Para listar solo por usuarios:
CSVDE -f onlyusers.csv -r "(&(objectClass=user)(objectCategory=person))"
CSVDE -f nombredeldocumento.csv -b usuario dominio contraseña
Para listar solo por usuarios:
CSVDE -f onlyusers.csv -r "(&(objectClass=user)(objectCategory=person))"
martes, 29 de octubre de 2013
RadControls for WinForms are not loaded at design-time,
PROBLEM
After you update to a new version of the Telerik WinForms suite, you start seeing RadControls for WinForms in the component tray and you are not able to select them on the form.

SOLUTION
The design-time capabilities of RadControls for WinForms are implemented in the Telerik.WinControls.UI.Design.dll assembly. If decide to use our installer to install the WinForms suite on your machine, this assembly is automatically installed in your Global Assemly Cache. The same is the situation if you decide to upgrade your Telerik version via ourVisual Studio Extensions - the Telerik.WinControls.UI.Design assembly will be set in your GAC. However, if you decide to upgrade Telerik assembly references manually by downloading the archive file that contains assemblies only, please be aware that these two approaches do not install the Design assembly in your GAC automatically.
So, to resolve this case, you should simply install the Telerik.WinControls.UI.Design.dll assembly manually in your GAC. If you have downloaded the archive file that contains the Telerik WinForms assemblies, you can find this assembly there. If you decide to follow the Upgrade Wizard approach, then you can find the assembly at: %APPDATA%\Telerik\Updates
If this still does not resolve the issue, please make sure that all references to Telerik assemblies point to assemblies having the latest version. As we provide two builds - one for .NET 2.0 and one for .NET 4.0 it is also
important to make sure that the referenced assemblies end up by the same number - .20 or .40.
After you update to a new version of the Telerik WinForms suite, you start seeing RadControls for WinForms in the component tray and you are not able to select them on the form.

SOLUTION
The design-time capabilities of RadControls for WinForms are implemented in the Telerik.WinControls.UI.Design.dll assembly. If decide to use our installer to install the WinForms suite on your machine, this assembly is automatically installed in your Global Assemly Cache. The same is the situation if you decide to upgrade your Telerik version via ourVisual Studio Extensions - the Telerik.WinControls.UI.Design assembly will be set in your GAC. However, if you decide to upgrade Telerik assembly references manually by downloading the archive file that contains assemblies only, please be aware that these two approaches do not install the Design assembly in your GAC automatically.
So, to resolve this case, you should simply install the Telerik.WinControls.UI.Design.dll assembly manually in your GAC. If you have downloaded the archive file that contains the Telerik WinForms assemblies, you can find this assembly there. If you decide to follow the Upgrade Wizard approach, then you can find the assembly at: %APPDATA%\Telerik\Updates
If this still does not resolve the issue, please make sure that all references to Telerik assemblies point to assemblies having the latest version. As we provide two builds - one for .NET 2.0 and one for .NET 4.0 it is also
important to make sure that the referenced assemblies end up by the same number - .20 or .40.
Suscribirse a:
Entradas (Atom)