This commit is contained in:
Jorge Luis caudillo esparza
2025-05-26 13:24:14 -07:00
34 changed files with 1489 additions and 559 deletions

View File

@@ -1,11 +1,17 @@
<%@ Page Title="AF - Activo Fijo" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AF.aspx.vb" Inherits="AF_AF" ValidateRequest="false" EnableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
<asp:Literal ID="LtlTitulo" runat="server" Text="Registro de Activos Fijos"></asp:Literal>&nbsp;<asp:Literal ID="LtlActivoFijo" runat="server"></asp:Literal>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HB" runat="Server">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
@@ -1012,7 +1018,7 @@
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="50px">
<ItemTemplate>
<asp:LinkButton ID="ImgDownLoad" CssClass="btn btn-circle btn-sm blue" OnClick="ImgDownLoad_Click" runat="server"
<asp:LinkButton ID="ImgDownLoad" CssClass="btn btn-circle btn-sm blue" OnClick="ImgDownLoad_Click" runat="server"
Text="<i class='fa fa-download' style='color:white' title='Descargar formato'></i>" CausesValidation="False" />
</ItemTemplate>
</asp:TemplateField>
@@ -1591,9 +1597,8 @@
</div>
</div>
</div>
</div>
<div class="cbp-l-grid-projects-title uppercase text-center">IMAGEN</div>
<div class="cbp-l-grid-projects-desc uppercase text-center"><%# Container.ItemIndex + 1 %></div>
</div>
<div class="cbp-l-grid-projects-desc uppercase text-center"><%# Container.ItemIndex + 1 %> - <%# CType(Eval("FechaIng"), DateTime).ToString("dd/MM/yyyy") %> </div>
</div>
</ItemTemplate>
</asp:Repeater>
@@ -3753,7 +3758,108 @@
</div>
</div>
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
<%--modal parametros documentos--%>
<div id="DVDescargaDocumentoParametrosModal" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpdatePanel6" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content rowpadding">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span >&times;</span>
</button>
<h4 class="modal-title" runat="server" style="text-align: left">Parametros</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpGvParametros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvParametros" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveDocumentacionParametro,CveDocumentacion,Parametro,Descripcion " CssClass="table table-hover table-advance Widthall" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" ItemStyle-Width="60px" HeaderText="Parametro">
<ItemTemplate>
<asp:Literal ID="LtlParametro" runat="server" Text='<%# Eval("Parametro") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ControlStyle-CssClass="template" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="275" HeaderText="Descripción">
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Descripcion") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ControlStyle-CssClass="template" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="275" HeaderText="Valor">
<ItemTemplate>
<asp:TextBox ID="TxtParametro" runat="server" Text="" Width="150px" ValidationGroup="GrpDescargaFormato"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtParametro" runat="server" ControlToValidate="TxtParametro" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Parametro''</b> es necesario, por favor ingréselo." ValidationGroup="GrpDescargaFormato"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVTxtParametro" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtParametro" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%--<asp:LinkButton ID="LnkDescargaFormatoParametros" OnClick="LnkDescargaFormatoParametros_Click" ValidationGroup="GrpDescargaFormato" CssClass="btn btn-primary" runat="server">Descargar</asp:LinkButton>--%>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<%--modalupluad doc--%>
<div id="ModalUploadFirmaContratoDocumento" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:UpdatePanel ID="UpTituloFirma" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Literal ID="LtlTitulofirmaContrato" runat="server">Documentación Firma de Contrato </asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpModalFirmaContratoDocumento" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtFileFirmaContrato" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnModalFirmaContratoDocumentoUpload" runat="server" ClientIDMode="Static" Text="Aceptar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
<%-- <link href="/Metronic/assets/global/plugins/dropzone/css/dropzone.css" rel="stylesheet"/>--%>
@@ -4169,6 +4275,7 @@
setTimeout(function () { startTimer(request); }, 30000); // callback
}
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Css" runat="Server">
@@ -4183,6 +4290,9 @@
.cbp-popup-lightbox-figure {
background-color: #FFF;
}
.orange {
background-color: orangered;
}
</style>
</asp:Content>

View File

@@ -7,8 +7,7 @@ Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports ZXing
Imports Newtonsoft.Json.Linq
Partial Class AF_AF
Partial Class AF_AF
Inherits ClsPaginas
'Configuración
@@ -388,6 +387,9 @@ Partial Class AF_AF
CargaPlagaEnfermedad()
ModalidadesPaginaAF()
CargaDocumentacion()
'Configuración de Modalidad Update
BtnGuardar.Text = "Guardar Cambios"
LtlTitulo.Text = "Consulta del Activo Fijo:"
@@ -940,7 +942,7 @@ Partial Class AF_AF
TxtValorCompra.Text = ObjActivoFijo.ValorCompra.ToString.FormatoNumero
TxtFechaCompra.Text = ObjActivoFijo.FechaCompra.ToShortDateString
TxtValorCompraMN.Text = ObjActivoFijo.ValorCompraMN.ToString.FormatoNumero
If ObjActivoFijo.ValorCompra <> ObjActivoFijo.ValorCompraMN Then DivValorCompraMN.visible = True
If ObjActivoFijo.ValorCompra <> ObjActivoFijo.ValorCompraMN Then DivValorCompraMN.Visible = True
TxtFechaBaja.Text = If(ObjActivoFijo.FechaBaja = New Date(1900, 1, 1), "", ObjActivoFijo.FechaBaja.ToString("dd/MM/yyyy"))
@@ -4947,39 +4949,531 @@ Partial Class AF_AF
RegistraScript("$('#ModalContaCuenta').modal('show');")
End Sub
#Region "D O C U M E N T O S"
Private Property DTDocumentacion As DataTable
Get
If ViewState("DTDocumentacion") Is Nothing Then
ViewState("DTDocumentacion") = New DataTable
End If
Return DirectCast(ViewState("DTDocumentacion"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTDocumentacion") = value
End Set
End Property
Private Property DocumentoParametros As String
Get
If ViewState("DocumentoParametros") Is Nothing Then
Return ""
Else
Return ViewState("DocumentoParametros").ToString
End If
End Get
Set(value As String)
ViewState("DocumentoParametros") = value
End Set
End Property
'Private Sub CargaDocumentacion()
Property CveDocumentacion As Integer
Get
If ViewState("CveDocumentacion") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveDocumentacion"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveDocumentacion") = value
End Set
End Property
Property CveDocumentacionElectronica As Integer
Get
If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CvePersonalClienteDocumentacion") = value
End Set
End Property
Property ActualizarDocumentacion As Boolean
Get
If ViewState("ActualizarDocumentacion") Is Nothing Then
Return True
Else
Return DirectCast(ViewState("ActualizarDocumentacion"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("ActualizarDocumentacion") = value
End Set
End Property
' If CveActivoFijo > 0 Then
' Dim objRH As New ClsEdocumentacion()
Property Documentacion As String
Get
If ViewState("Documentacion") Is Nothing Then
Return "-1"
Else
Return ViewState("Documentacion").ToString()
End If
End Get
Set(value As String)
ViewState("Documentacion") = value
End Set
End Property
Property AdjuntoDocumentacion As String
Get
If ViewState("AdjuntoDocumentacion") Is Nothing Then
Return ""
Else
Return ViewState("AdjuntoDocumentacion").ToString()
End If
End Get
Set(value As String)
ViewState("AdjuntoDocumentacion") = value
End Set
End Property
' If objRH.DocumentacionElectronicaGet(CvePersonal, -1, -1, UsuarioActual.Empresa.CveEmpresa, -1) Then
' DTDocumentacion = objRH.DtResultados
' End If
Private Property FechaLimite As Date
Get
If ViewState("FechaLimite") Is Nothing Then
Return NowADS().AddDays(15)
Else
Return ViewState("FechaLimite").ToString().ToDate
End If
End Get
Set(value As Date)
ViewState("FechaLimite") = value
End Set
' If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then
' GvDocumentosFirma.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ")
' Else
' GvDocumentosFirma.DataSource = Nothing
' End If
End Property
Property ObservacionDocumentacion As String
Get
If ViewState("ObservacionDocumentacion") Is Nothing Then
Return ""
Else
Return ViewState("ObservacionDocumentacion").ToString()
End If
End Get
Set(value As String)
ViewState("ObservacionDocumentacion") = value
End Set
End Property
Private Sub CargaDocumentacion()
If CveActivoFijo > 0 Then
Dim objRH As New ClsEdocumentacion()
If objRH.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.Empresa.CveEmpresa, -1, CveActivoFijo:=CveActivoFijo, Modulo:=9) Then
DTDocumentacion = objRH.DtResultados
End If
If DTDocumentacion.Rows.Count > 0 Then
GvDocumentos.DataSource = DTDocumentacion
Else
GvDocumentos.DataSource = Nothing
End If
objRH.Dispose()
GvDocumentos.DataBind()
UpGvDocumentos.Update()
End If
End Sub
Protected Sub GvDocumentos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentos.RowDataBound
' If DTDocumentacion.FiltraParametros(" Modulo = 7 ").Rows.Count > 0 Then
' GVMaterialidad.DataSource = DTDocumentacion.FiltraParametros(" Modulo = 7 ")
' Else
' GVMaterialidad.DataSource = Nothing
' End If
If e.Row.RowType = DataControlRowType.DataRow Then
' GVMaterialidad.DataBind()
' GvDocumentosFirma.DataBind()
Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString()
Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato")
Dim ImgDownLoad As LinkButton = e.Row.FCLinkButton("ImgDownLoad")
Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired")
Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite")
Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False)
Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus")
Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString()
Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString()
Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString().ToEntero()
Dim separado As Char() = ".".ToString().ToCharArray
Dim array() As String = Adjunto.Split(separado)
Dim extencion As String = ""
Dim existeAdjunto As Boolean = False
Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia")
' FechaVigencia
Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString().ToEntero()
Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString() = "1", True, False)
Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False)
txtFechaLimite.Visible = If(AplicaDiasLimite, True, False)
TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False)
Dim scripMascara As String = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');"
RegistraScript(scripMascara)
If array.Length > 0 Then
extencion = array(array.Length - 1)
End If
If e.Row.DBCampo("Estatus").ToString().ToEntero() = 1 Then
chkEstatus.Checked = True
Else
chkEstatus.Checked = False
End If
If documentacionFormato = "" Then
ImgDownLoadFormato.Visible = False
Else
Dim linkDescarga As String = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato
ImgDownLoadFormato.Visible = True
ScriptManager.GetCurrent(Me.Page).RegisterPostBackControl(ImgDownLoadFormato)
End If
txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString().ToDate.ToString("dd/MM/yyyy")
If Adjunto.Trim.Length > 0 Then
Dim linkDescarga As String = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/AF/" & CveActivoFijo & "/" & Adjunto
Dim linkDescargaArchivo As String = UsuarioActual.Empresa.Ruta & "AF/" & CveActivoFijo & "/" & Adjunto
If File.Exists(linkDescargaArchivo) Then
ImgDownLoad.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(ImgDownLoad)
Else
ImgDownLoad.Visible = False
End If
Else
ImgDownLoad.Visible = False
End If
If requerido Then
ImgRequired.Text = " <a class='btn btn-circle btn-sm yelow' href='#' data-toggle='tooltip' title=' Requerido!' ><i class='fa fa-asterisk '></i></a>"
Else
' ImgRequired.Text = " <a class='btn btn-circle btn-sm grey-salt' href='#' data-toggle='tooltip' title='No obligatorio' ><i class='fa fa-asterisk '></i></a>"
End If
End If
End Sub
Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero()
Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato")
DescarFormato(DocumentacionFormato)
'Dim ObjEdoc As New ClsEdocumentacion
'If ObjEdoc.GetDocumentacionParametros(-1, CveDocumentacion, UsuarioActual.CveEmpresa) Then
' If ObjEdoc.DtResultados.Rows.Count > 0 Then
' GvParametros.DataSource = ObjEdoc.DtResultados
' ObjEdoc.Dispose()
' GvParametros.DataBind()
' UpGvParametros.Update()
' DocumentoParametros = DocumentacionFormato
' RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('show')")
' Else
' ObjEdoc.Dispose()
' DescarFormato(DocumentacionFormato)
' End If
'Else
' ObjEdoc.Dispose()
'End If
End Sub
Public Sub DescarFormato(documento As String)
Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory
Dim PathSource As String
Dim pathDesti As String
PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento
pathDesti = PathRoot & "Temp\" & CveActivoFijo & documento
If File.Exists(pathDesti) Then
File.Delete(pathDesti)
End If
File.Copy(PathSource, pathDesti)
'Dim objDoc As New clsGemBoxDocument(pathDesti)
'Dim objRH As New ClsRH
'objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa))
'objRH.Dispose()
'objDoc.Guardar(pathDesti)
Dim fileinfo As New FileInfo(pathDesti)
Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
DescargarArchivo(fileinfo.FullName)
'baseUrl = baseUrl & "/temp/" & fileinfo.Name
'RegistraScript("Download('" & baseUrl & "')")
End Sub
Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim chkEstatus As CheckBox
CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero()
CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString().ToEntero()
Documentacion = GvRow.DataKey("Documentacion")
AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString()
chkEstatus = GvRow.FCCheckBox("chkEstatus")
ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper
FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate
AdjuntoDocumentacion = GvRow.DataKey("Adjunto")
LtlTitulofirmaContrato.Text = "Subir " & Documentacion
UpTituloFirma.Update()
RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});")
End Sub
Protected Sub ImgDownLoad_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim Adjunto As String = GvRow.DataKey("Adjunto").ToString()
Dim ArchivoPath As String = UsuarioActual.Empresa.Ruta & "AF/" & CveActivoFijo & "/" & Adjunto
DescargarArchivo(ArchivoPath)
End Sub
Protected Sub DescargarArchivo(rutaArchivo As String)
If System.IO.File.Exists(rutaArchivo) Then
Dim nombreArchivo As String = System.IO.Path.GetFileName(rutaArchivo)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
Response.AddHeader("Content-Length", New System.IO.FileInfo(rutaArchivo).Length.ToString())
Response.WriteFile(rutaArchivo)
Response.End()
Else
End If
End Sub
Protected Sub LnkDescargaFormatoParametros_Click(sender As Object, e As EventArgs)
'Dim ListaTagsDocumentost As New List(Of TagsDocumentos)
'Dim ObjRH As New ClsRH
'ListaTagsDocumentost = ObjRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)
'ObjRH.Dispose()
'For Each GvRow As GridViewRow In GvParametros.Rows
' If GvRow.FCTextBox("TxtParametro").Text.Trim.Length > 0 Then
' ListaTagsDocumentost.Add(New TagsDocumentos(GvRow.DataKey("Parametro"), GvRow.FCTextBox("TxtParametro").Text))
' End If
'Next
'Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory
'Dim PathSource As String
'Dim pathDesti As String
'PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & DocumentoParametros
'pathDesti = PathRoot & "Temp\" & CveActivoFijo & DocumentoParametros
'If File.Exists(pathDesti) Then
' File.Delete(pathDesti)
'End If
'File.Copy(PathSource, pathDesti)
'Dim objDoc As New clsGemBoxDocument(pathDesti)
'objDoc.SustituirTags(ListaTagsDocumentost)
'objDoc.Guardar(pathDesti)
'Dim fileinfo As New FileInfo(pathDesti)
'Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
'baseUrl = baseUrl & "/temp/" & fileinfo.Name
'RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('hide')", "500")
'RegistraScript("Download('" & baseUrl & "')")
End Sub
Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click
Dim FileExtension As String = "-1"
Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos
Dim Filename As String = ""
For Each fileItem As Archivo In Filesgral
Try
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
Dim tempArray() As String
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\" & Documentacion & "." & FileExtension
Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\" & AdjuntoDocumentacion
If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\") Then
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "AF\" & CveActivoFijo & "\")
End If
If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then
File.Delete(rutaAdjuntoAnterior)
End If
If System.IO.File.Exists(rutaDestino) Then
System.IO.File.Delete(rutaDestino)
End If
System.IO.File.Move(fileItem.FileUrl, rutaDestino)
Dim objRH As New ClsEdocumentacion
If CveDocumentacionElectronica = -1 Then
If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, CveActivoFijo:=CveActivoFijo) > 0 Then
End If
Else
If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite, CveActivoFijo:=CveActivoFijo) Then
End If
End If
objRH.Dispose()
GuardarDocumentosFirmaContrato(CveDocumentacion)
'CargaDocumentacion()
TxtFileFirmaContrato.Text = ""
UpModalFirmaContratoDocumento.Update()
Catch ex As Exception
OnError("Error al cargar archivo", ex)
End Try
Next
RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7")
End Sub
Private Sub GuardarDocumentosFirmaContrato(Optional _CveDocumentacionExcluir As Integer = -1)
Dim hasError As Boolean = True
Dim objDocumentos As New ClsEdocumentacion
For Each dRow As GridViewRow In GvDocumentos.Rows
Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString().ToEntero()
Dim _Adjunto As String = dRow.DataKey("Adjunto")
'Dim _Documentacion As String = dRow.DataKey("Documentacion")
Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero()
Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones")
Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite")
Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia")
Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus")
Dim _estatus As Integer
_estatus = If(dRow.DataKey("Estatus").ToString().ToUpper = "TRUE", 1, 0)
Dim _FechaVigencia As Date
Dim _FechaLimite As Date
Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString().ToEntero()
Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString() = "1", True, False)
Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False)
If _TxtFechaVigencia.Text.Length = 10 Then
_FechaVigencia = _TxtFechaVigencia.Text.ToDate
Else
_FechaVigencia = Nothing
End If
If Not AplicaDiasLimite Then
_FechaLimite = MinFecha
Else
_FechaLimite = _TxtFechaLimite.Text.ToDate
End If
If Not AplicaFechaVencimiento Then
_FechaVigencia = MinFecha
End If
If Not _CveDocumentacionExcluir = _CveDocumentacion Then
Try
If _CveDocumentacionElectronica = -1 Then
If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia, CveActivoFijo:=CveActivoFijo) > 0 Then
Else
hasError = True
Exit For
End If
Else
If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia, CveActivoFijo:=CveActivoFijo) Then
Else
hasError = True
Exit For
End If
End If
hasError = False
Catch ex As Exception
hasError = True
Exit For
End Try
End If
Next
'refrescar grid datos investigacion
CargaDocumentacion()
End Sub
#End Region
' UpMaterialidad.Update()
' UPGvDocumentosFirma.Update()
' UpGvDocumentosFirma2.Update()
' End If
'End Sub
End Class

View File

@@ -203,7 +203,7 @@
<asp:DropDownList ID="DdlAFPadres" runat="server" AppendDataBoundItems="true" DataTextField="CodigoDescripcion" DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline input-sm select2me" Width="200px"></asp:DropDownList>
</div>
</div>
<div class="row">
<div class="row" id="DVTipoGrupo" runat="server" visible="false">
<div class="col-md-1">Tipo Grupo:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlAFTipoGrupo" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" Width="100%" runat="server" DataTextField="NombreCompleto" DataValueField="CvePersonal">

View File

@@ -71,6 +71,9 @@ Partial Class AF_CatAF
CargaPersonalizacion()
If UsuarioActual.CveEmpresa = 13 Then
DVTipoGrupo.Visible = True
End If
End If

View File

@@ -7,7 +7,7 @@ Public Class BundleConfig
bundles.Add(New ScriptBundle("~/bundles/jquery").Include(
"~/Metronic/assets/global/plugins/jquery.min.js"
))
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", Nothing, New ScriptResourceDefinition with {.Path = "~/bundles/jquery"})
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", Nothing, New ScriptResourceDefinition With {.Path = "~/bundles/jquery"})
@@ -170,7 +170,7 @@ Public Class BundleConfig
"~/Scripts/WebForms/TreeView.js",
"~/Scripts/WebForms/WebParts.js"))
ScriptManager.ScriptResourceMapping.AddDefinition("WebFormsBundle", new ScriptResourceDefinition With {.Path = "~/bundles/WebFormsJs"})
ScriptManager.ScriptResourceMapping.AddDefinition("WebFormsBundle", New ScriptResourceDefinition With {.Path = "~/bundles/WebFormsJs"})
' Order is very important for these files to work, they have explicit dependencies
bundles.Add(New ScriptBundle("~/bundles/MsAjaxJs").Include(

View File

@@ -252,7 +252,8 @@ Public Class ClsEdocumentacion
#Region "D O C U M E N T A C I O N - E L E C T R O N I C A"
Public Function DocumentacionElectronicaGet(CvePersonal As Integer, CveCliente As Integer, CveProveedor As Integer, CveEmpresa As Integer, CveDocumentacionTipo As Integer, Optional CveVenta As Integer = -1, Optional Modulo As Integer = 1, Optional Periodo As Integer = -1) As Boolean
Public Function DocumentacionElectronicaGet(CvePersonal As Integer, CveCliente As Integer, CveProveedor As Integer, CveEmpresa As Integer, CveDocumentacionTipo As Integer, Optional CveVenta As Integer = -1, Optional Modulo As Integer = 1,
Optional Periodo As Integer = -1, Optional CveActivoFijo As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Edoc_DocumentacionElectronicaGet")
@@ -266,6 +267,7 @@ Public Class ClsEdocumentacion
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@Periodo", SqlDbType.Int).Value = Periodo
.Add("@Modulo", SqlDbType.Int).Value = Modulo
.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo
End With
Try
@@ -279,7 +281,8 @@ Public Class ClsEdocumentacion
End Function
Public Function DocumentacionElectronicaAdd(CveDocumentacion As Integer, CvePersonal As Integer, CveCliente As Integer, CveProveedor As Integer, Estatus As Integer, Observacion As String, Adjunto As String,
CveUsuario As Integer, FechaLimite As Date, Optional FechaVigencia As Date = Nothing, Optional CveVenta As Integer = -1, Optional Observacion2 As String = "-1", Optional Periodo As Integer = 190001) As Integer
CveUsuario As Integer, FechaLimite As Date, Optional FechaVigencia As Date = Nothing, Optional CveVenta As Integer = -1, Optional Observacion2 As String = "-1",
Optional Periodo As Integer = 190001, Optional CveActivoFijo As Integer = -1) As Integer
Dim Retorno As Integer = 0
@@ -299,6 +302,7 @@ Public Class ClsEdocumentacion
.Add("@FechaLimite", SqlDbType.Date).Value = FechaLimite
.Add("@FechaVigencia", SqlDbType.Date).Value = FechaVigencia
.Add("@Periodo", SqlDbType.Int).Value = Periodo
.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo
.Add("@CveDocumentacionElectronica", SqlDbType.Int).Direction = ParameterDirection.Output
'FechaVigencia
End With
@@ -315,7 +319,8 @@ Public Class ClsEdocumentacion
Public Function DocumentacionElectronicaUpdate(CveDocumentacionElectronica As Integer, CveDocumentacion As Integer, CvePersonal As Integer, CveCliente As Integer, CveProveedor As Integer, Estatus As Integer,
Observacion As String, Adjunto As String, CveUsuario As Integer, FechaLimite As Date, Optional FechaVigencia As Date = Nothing, Optional Observacion2 As String = "-1") As Boolean
Observacion As String, Adjunto As String, CveUsuario As Integer, FechaLimite As Date, Optional FechaVigencia As Date = Nothing, Optional Observacion2 As String = "-1",
Optional CveActivoFijo As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Edoc_DocumentacionElectronicaUpdate")
@@ -333,6 +338,7 @@ Public Class ClsEdocumentacion
.Add("@CveUsuario", SqlDbType.VarChar).Value = CveUsuario
.Add("@FechaLimite", SqlDbType.Date).Value = FechaLimite
.Add("@FechaVigencia", SqlDbType.Date).Value = FechaVigencia
.Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo
'
End With

View File

@@ -6096,8 +6096,14 @@ Public Class ClsVentas
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch Ex1 As SqlException
If Ex1.Message.Contains("vigente") Then
Alert("Ya existe una solicitud vigente", TipoMensaje.MsgAdvertencia)
Else
Me.OnError("Ocurrió un error al guardar la autorización.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
Catch ex As Exception
OnError("Ocurrió un error al obtener los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
OnError("Ocurrió un error al guardar la autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function

View File

@@ -164,11 +164,10 @@ Partial Class Bancos_CuentasBancariasDetalle
If DdlTipoCuenta.SelectedValue.ToEntero = 1 Then 'Caja Chica
IdPadre = UsuarioActual.Empresa.Funcionalidad(218).ToEntero
Else
Dim tesstr = UsuarioActual.Empresa.Funcionalidad(209)
IdPadre = UsuarioActual.Empresa.Funcionalidad(209).ToEntero
End If
If IdPadre = 0 Then IdPadre = -1
If IdPadre = 0 Then IdPadre = 1
If Conta.GetCuentasRecursiva(IdPadre, 1) Then
dt = Conta.DtResultados

View File

@@ -275,7 +275,7 @@
</div>
</div>
</div>
<div class="row" runat="server" id="rowComisiones" visible="false">
<div class="row" runat="server" id="rowComisiones" visible="false">
<label class="col-md-2" runat="server" id="lblpagocomisiones">Comisiones:</label>
<div class="col-md-3">
<asp:DropDownList ID="DdlOtrosPagos" Width="100%" CssClass="form-control input-sm select2me" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlOtrosPagos_SelectedIndexChanged">
@@ -289,7 +289,7 @@
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtDDImporte" FilterType="Custom, Numbers" ValidChars="+-.," />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>

View File

@@ -1758,14 +1758,16 @@ Partial Class Compras_eFacturas
If RutaPDF = "" Then
Dim Hilo As New System.Threading.Thread(Sub() ProcesarPDF(UsuarioActual, a, FF))
'no valida nada solo lo crea y lo pone en la carpeta, no importa si ya existe
If SobreEscribirPDFSiExiste Then
Dim Hilo As New System.Threading.Thread(Sub() ProcesarPDF(UsuarioActual, a, FF))
Hilo.Start()
Else
'si no existe el pdf, lo procesa
If Not File.Exists(RutaPDF) Then
If Not File.Exists(PDfDestino) Then
Dim Hilo As New System.Threading.Thread(Sub() ProcesarPDF(UsuarioActual, a, FF))
Hilo.Start()
End If
End If
@@ -3050,7 +3052,7 @@ Partial Class Compras_eFacturas
End If
If SeVerifico Then
SubirFacturas(ListComprimidos, ListXML, ListPDF, Validada:=1, SobreEscribirPDFSiExiste:=False)
SubirFacturas(ListComprimidos, ListXML, ListPDF, Validada:=1,SobreEscribirPDFSiExiste:=False)
End If
'If UsuarioActual.CveRol = 1 Then

View File

@@ -39,8 +39,8 @@
<table width="100%">
<tr>
<td>Tipo Reporte:</td>
<td>
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server">
<td colspan="2">
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoReporte_SelectedIndexChanged">
<asp:ListItem Text="Catálogo Cuentas" Value="1"></asp:ListItem>
<asp:ListItem Text="Balanza Comprobación" Value="2"></asp:ListItem>
</asp:DropDownList>
@@ -54,21 +54,30 @@
<td>Periodo: </td>
<td>
<asp:DropDownList ID="DdlPeriodo" CssClass="form-control input-sm select2me" runat="server">
<asp:ListItem Text="Enero" Value="1"></asp:ListItem>
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
<asp:ListItem Text="Abril" Value="4"></asp:ListItem>
<asp:ListItem Text="Mayo" Value="5"></asp:ListItem>
<asp:ListItem Text="Junio" Value="6"></asp:ListItem>
<asp:ListItem Text="Julio" Value="7"></asp:ListItem>
<asp:ListItem Text="Agosto" Value="8"></asp:ListItem>
<asp:ListItem Text="Septiembre" Value="9"></asp:ListItem>
<asp:ListItem Text="Enero" Value="01"></asp:ListItem>
<asp:ListItem Text="Febrero" Value="02"></asp:ListItem>
<asp:ListItem Text="Marzo" Value="03"></asp:ListItem>
<asp:ListItem Text="Abril" Value="04"></asp:ListItem>
<asp:ListItem Text="Mayo" Value="05"></asp:ListItem>
<asp:ListItem Text="Junio" Value="06"></asp:ListItem>
<asp:ListItem Text="Julio" Value="07"></asp:ListItem>
<asp:ListItem Text="Agosto" Value="08"></asp:ListItem>
<asp:ListItem Text="Septiembre" Value="09"></asp:ListItem>
<asp:ListItem Text="Octubre" Value="10"></asp:ListItem>
<asp:ListItem Text="Noviembre" Value="11"></asp:ListItem>
<asp:ListItem Text="Diciembre" Value="12"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr id="trTipoEnvio" runat="server" visible="false">
<td>Tipo Envío:</td>
<td colspan="2">
<asp:DropDownList ID="DdlTipoEnvío" CssClass="form-control input-sm select2me" runat="server">
<asp:ListItem Text="Normal" Value="N"></asp:ListItem>
<asp:ListItem Text="Complementaria" Value="C"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<hr />

View File

@@ -1,9 +1,20 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.IO
Imports Extensiones
Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Security.Cryptography.X509Certificates
Imports System.Text
Imports System.Xml
Imports System.Xml.Xsl
Imports System.Data
Imports CrystalDecisions.Web
Imports DocumentFormat.OpenXml.Wordprocessing
Imports Org.BouncyCastle.Asn1
Imports Org.BouncyCastle.Tls.Crypto.Impl
Partial Class Contabilidad_ContabilidadElectronica
Inherits ClsPaginas
@@ -91,11 +102,11 @@ Partial Class Contabilidad_ContabilidadElectronica
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Dim objconta As New ClsContabilidad
If objconta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
DtCuentas = objconta.DtResultados
DtCuentas = objconta.DtResultados.FiltraParametros("CodigoSAT <> ''")
End If
objconta.Dispose()
Else
Dim ObjConpaq As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConpaq As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConpaq.GetCuentasElectronica(MinFecha, FechaF) Then
DtCuentas = ObjConpaq.DtResultados
End If
@@ -108,14 +119,11 @@ Partial Class Contabilidad_ContabilidadElectronica
'CABECERA
Str.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")
Str.Append("<catalogocuentas:Catalogo xsi:schemaLocation=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas/CatalogoCuentas_1_3.xsd"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" Version=""1.3"" ")
Str.Append("<catalogocuentas:Catalogo xsi:schemaLocation=""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas/CatalogoCuentas_1_3.xsd"" Version=""1.3"" ")
Str.AppendFormat("RFC=""{0}"" ", UsuarioActual.Empresa.RFC)
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue)
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue.PadLeft(2, "0"c))
Str.AppendFormat("Anio=""{0}"" ", DdlEjercicio.SelectedValue)
Str.AppendFormat("Sello=""{0}"" ", "123")
Str.AppendFormat("noCertificado=""{0}"" ", "123")
Str.AppendFormat("Certificado=""{0}"" ", "1234567890")
Str.Append("xmlns:catalogocuentas=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas"">")
Str.Append("xmlns:catalogocuentas=""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">")
'DETALLES
For Each Dr As DataRow In DtCuentas.Rows
@@ -126,7 +134,7 @@ Partial Class Contabilidad_ContabilidadElectronica
Str.AppendFormat("Desc=""{0}"" ", HttpUtility.HtmlEncode(Dr("Nombre").ToString))
Str.AppendFormat("SubCtaDe=""{0}"" ", Dr("CodigoPadre").ToString)
Str.AppendFormat("Nivel=""{0}"" ", Dr("Nivel").ToString)
Str.AppendFormat("Natur=""{0}"" ", Dr("Tipo").ToString)
Str.AppendFormat("Natur=""{0}"" ", If(Dr("Tipo").ToString.Contiene("A", "C", "D", "G", "H"), "D", "A")) 'Atributo requerido para expresar la naturaleza de la cuenta o subcuenta. (D - Deudora, A - Acreedora). ( Activo = D ) ( Pasivo = A ) ( Capital = A ) ( Ingreso = A ) ( Costo = D ) ( Gasto = D ) ( Resultado Integral de Financiamiento = D y/o A ) ( Cuentas de orden = D y/o A ). Existen cuentas de Activo, Pasivo y Capital que por su naturaleza pueden presentarse de manera Deudora o Acreedora.
Else
Str.AppendFormat("CodAgrup=""{0}"" ", Dr("CodAgrup").ToString)
Str.AppendFormat("NumCta=""{0}"" ", Dr("NumCta").ToString)
@@ -147,31 +155,113 @@ Partial Class Contabilidad_ContabilidadElectronica
ArchivoCuentas = $"{UsuarioActual.Empresa.Ruta}/ContabilidadElectronica/{ UsuarioActual.Empresa.RFC}{DdlEjercicio.SelectedValue}{DdlPeriodo.SelectedValue.PadLeft(2, "0"c)}CT.xml"
'SOBREESCRIBE
If System.IO.File.Exists(ArchivoCuentas) Then
System.IO.File.Delete(ArchivoCuentas)
End If
If System.IO.File.Exists(ArchivoCuentas) Then System.IO.File.Delete(ArchivoCuentas)
Dim fs As FileStream = File.Create(ArchivoCuentas)
Dim info As Byte() = New UTF8Encoding(True).GetBytes(Str.ToString)
fs.Write(info, 0, info.Length)
fs.Close()
Dim Archivo As New System.IO.FileInfo(ArchivoCuentas)
'DESCARGA XML
Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
If IO.File.Exists(ArchivoCuentas) Then
DescargaZIP.AddFile(ArchivoCuentas, "")
End If
DescargaZIP.Save(Response.OutputStream)
Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}CT.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
Response.ContentType = "application/zip"
Response.End()
'Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
'If IO.File.Exists(ArchivoCuentas) Then DescargaZIP.AddFile(ArchivoCuentas, "")
'generar el sello
'SellarXML(Str.ToString, ArchivoCuentas, 1)
'DescargaZIP.Save(Response.OutputStream)
'Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}CT.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
'Response.ContentType = "application/zip"
'Response.End()
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/xml"
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(ArchivoCuentas)
'HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
Archivo = Nothing
End If
End Sub
Private Function SellarXML(xmltexto As String, ArchivoCuentas As String, Opcion As Integer) As String
Dim ArchivoLLave As String = $"{UsuarioActual.Empresa.Ruta}Certificados\{UsuarioActual.Empresa.ArchivoKey}"
Dim Archivopfx As String = $"{UsuarioActual.Empresa.Ruta}Certificados\{UsuarioActual.Empresa.FielPFX }"
Dim Clavepfx As String = UsuarioActual.Empresa.FielPassword
Dim xsltPath As String
Select Case Opcion
Case 1
xsltPath = $"{AppDomain.CurrentDomain.BaseDirectory}Temp\CatalogoCuentas_1_3.xslt"
Case 2
xsltPath = $"{AppDomain.CurrentDomain.BaseDirectory}Temp\BalanzaComprobacion_1_3.xslt"
End Select
If Not File.Exists(ArchivoLLave) Then
Alert("El archivo de llave privada no existe", TipoMensaje.MsgError)
End If
' 1. Cargar y transformar el XML para obtener la Cadena Original
Dim originalCadena As String = GenerarCadenaOriginal(xmltexto, xsltPath)
' 2. Cargar tu certificado PFX (incluye la clave privada)
Dim cert As New X509Certificate2(Archivopfx, Clavepfx, X509KeyStorageFlags.MachineKeySet)
' 3. Firmar la cadena con SHA256
Dim selloBytes As Byte()
Using rsa As RSA = cert.GetRSAPrivateKey()
selloBytes = rsa.SignData(
Encoding.UTF8.GetBytes(originalCadena),
HashAlgorithmName.SHA256,
RSASignaturePadding.Pkcs1)
End Using
Dim selloBase64 As String = Convert.ToBase64String(selloBytes)
' 4. Obtener el certificado (público) en Base64 y el número de certificado
Dim certBase64 As String = Convert.ToBase64String(cert.RawData)
Dim noCertificado As String = cert.GetSerialNumberString()
' 5. Insertar atributos en el XML
Dim xmlDoc As New XmlDocument()
xmlDoc.PreserveWhitespace = True ' conserva espacios y saltos
xmlDoc.LoadXml(xmltexto)
Dim root As XmlElement = xmlDoc.DocumentElement
root.SetAttribute("Sello", selloBase64)
root.SetAttribute("noCertificado", noCertificado)
root.SetAttribute("certificado", certBase64)
' 6. Guardar archivo sellado
Dim StrFinal As String = xmlDoc.OuterXml
Dim fs As FileStream = File.Create(ArchivoCuentas)
Dim info As Byte() = New UTF8Encoding(True).GetBytes(StrFinal)
fs.Write(info, 0, info.Length)
fs.Close()
'xmlDoc.Save(ArchivoCuentas)
Return StrFinal
End Function
''' <summary>
''' Aplica el XSLT para generar la Cadena Original según SAT.
''' </summary>
Function GenerarCadenaOriginal(xmlContenido As String, xsltFile As String) As String
' Carga la transformación XSLT
Dim xslt As New XslCompiledTransform()
xslt.Load(xsltFile)
' Prepara un StringReader sobre el contenido del XML
Using sr As New StringReader(xmlContenido),
xr As XmlReader = XmlReader.Create(sr),
sw As New StringWriter()
' Ejecuta la transformación
xslt.Transform(xr, Nothing, sw)
' Devuelve la cadena original (trim para quitar saltos extra)
Return sw.ToString().Trim()
End Using
End Function
Private Sub GeneraBalanza()
Dim FechaI As Date = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, "0"c), DdlEjercicio.SelectedValue).ToDate
Dim FechaF As Date = FechaI.LastDayOfMonth
@@ -186,10 +276,10 @@ Partial Class Contabilidad_ContabilidadElectronica
If DtCuentas IsNot Nothing Then
Dim Deudor As Decimal = DtCuentas.SUM("SaldoAD")
Dim Acreedor As Decimal = DtCuentas.SUM("SaldoAA")
If Deudor <> Acreedor Then
Alert("los Saldos Actuales no cuadran.", TipoMensaje.MsgError)
Exit Sub
End If
'If Deudor <> Acreedor Then
' Alert("los Saldos Actuales no cuadran.", TipoMensaje.MsgError)
' Exit Sub
'End If
End If
Else
Dim ObjConpaq As New ClsContPAQi(UsuarioActual.Empresa)
@@ -204,24 +294,25 @@ Partial Class Contabilidad_ContabilidadElectronica
'CABECERA
Str.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")
Str.Append("<BCE:Balanza xsi:schemaLocation=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/BalanzaComprobacion/BalanzaComprobacion_1_3.xsd"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" Version=""1.3"" ")
Str.Append("<bnc:Balanza ")
Str.Append("xmlns:bnc =""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/BalanzaComprobacion"" ")
Str.Append("xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ")
Str.Append("xsi:schemaLocation=""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/BalanzaComprobacion http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/BalanzaComprobacion/BalanzaComprobacion_1_3.xsd"" ")
Str.Append("Version=""1.3"" ")
Str.AppendFormat("RFC=""{0}"" ", UsuarioActual.Empresa.RFC)
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue)
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue.PadLeft(2, "0"c))
Str.AppendFormat("Anio=""{0}"" ", DdlEjercicio.SelectedValue)
Str.AppendFormat("TipoEnvio=""{0}"" ", "C")
Str.AppendFormat("FechaModBal=""{0}"" ", FechaF.ToString("yyyy-MM-dd"))
Str.AppendFormat("Sello=""{0}"" ", "123")
Str.AppendFormat("noCertificado=""{0}"" ", "123")
Str.AppendFormat("Certificado=""{0}"" ", "1234567890")
Str.Append("xmlns:BCE=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/BalanzaComprobacion"">")
Str.AppendFormat("TipoEnvio=""{0}"" ", DdlTipoEnvío.SelectedValue)
'SOLO CUANDO ES COMPLEMENTARIA
If DdlTipoEnvío.SelectedValue = "C" Then Str.AppendFormat("FechaModBal=""{0}""", FechaF.ToString("yyyy-MM-dd"))
Str.AppendFormat(">")
'DETALLES
For Each Dr As DataRow In DtCuentas.Rows
Str.Append("<BCE:Ctas ")
For Each Dr As DataRow In DtCuentas.FiltraParametros("Codigo <> ''").Rows
Str.Append("<bnc:Ctas ")
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Str.AppendFormat("NumCta=""{0}"" ", Dr("Codigo").ToString)
Str.AppendFormat("NumCta=""{0}"" ", Dr("Codigo").ToString.Replace("-", ""))
Str.AppendFormat("SaldoIni=""{0}"" ", Dr("SaldoInicial").ToString)
Str.AppendFormat("Debe=""{0}"" ", Dr("Cargos").ToString)
Str.AppendFormat("Haber=""{0}"" ", Dr("Abonos").ToString)
@@ -236,12 +327,10 @@ Partial Class Contabilidad_ContabilidadElectronica
Str.Append("/>")
Next
DtCuentas.Dispose()
'FIN
Str.Append("</BCE:Balanza>")
Str.Append("</bnc:Balanza>")
'GUARDA ARHIVO
ArchivoBalanza = Server.MapPath(String.Format("~/Empresas/{0}/ContabilidadElectronica/{1}{2}{3}BN.xml", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
@@ -251,30 +340,50 @@ Partial Class Contabilidad_ContabilidadElectronica
'SOBREESCRIBE
If System.IO.File.Exists(ArchivoBalanza) Then System.IO.File.Delete(ArchivoBalanza)
Dim fs As FileStream = File.Create(ArchivoBalanza)
Dim info As Byte() = New UTF8Encoding(True).GetBytes(Str.ToString)
fs.Write(info, 0, info.Length)
fs.Close()
Dim Archivo As New System.IO.FileInfo(ArchivoBalanza)
'DESCARGA XML
Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/xml"
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(ArchivoBalanza)
'HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
Archivo = Nothing
If IO.File.Exists(ArchivoBalanza) Then
DescargaZIP.AddFile(ArchivoBalanza, "")
End If
''SOBREESCRIBE
'If System.IO.File.Exists(ArchivoBalanza) Then System.IO.File.Delete(ArchivoBalanza)
''DESCARGA XML
'Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
''generar el sello
'SellarXML(Str.ToString, ArchivoBalanza, 2)
DescargaZIP.Save(Response.OutputStream)
Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}BN.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
Response.ContentType = "application/zip"
Response.End()
'If IO.File.Exists(ArchivoBalanza) Then
' DescargaZIP.AddFile(ArchivoBalanza, "")
'End If
'DescargaZIP.Save(Response.OutputStream)
'Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}BN.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
'Response.ContentType = "application/zip"
'Response.End()
End If
End Sub
#End Region
Protected Sub DdlTipoReporte_SelectedIndexChanged(sender As Object, e As EventArgs)
If DdlTipoReporte.SelectedValue = "1" Then
trTipoEnvio.Visible = False
ElseIf DdlTipoReporte.SelectedValue = "2" Then
trTipoEnvio.Visible = True
End If
End Sub
End Class

View File

@@ -30,9 +30,9 @@
<li>
<asp:LinkButton ID="LnkTxtDIOT" OnClick="LnkTxtDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar DIOT</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcelDIOT" OnClick="LnkExcelDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel DIOT</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcelDIOT" OnClick="LnkExcelDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel DIOT</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkTxtDIOT" />
@@ -174,7 +174,7 @@
<div id="DvTipo" class="col-md-6">
<h4><b>IEPS por Porcentaje</b></h4>
<asp:GridView ID="GvIEPSA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"
OnRowDataBound="GvIEPSA_RowDataBound" DataKeyNames="PorcentajeIEPS" >
OnRowDataBound="GvIEPSA_RowDataBound" DataKeyNames="PorcentajeIEPS">
<Columns>
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIEPS" />
<asp:BoundField HeaderText="Categoría" DataField="Categoria" />
@@ -187,8 +187,8 @@
<div class="col-md-6">
<h4><b>IVA por Porcentaje</b></h4>
<asp:GridView ID="GvIVAA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"
OnRowDataBound="GvIVAA_RowDataBound" DataKeyNames="PorcentajeIVA" >
<Columns>
OnRowDataBound="GvIVAA_RowDataBound" DataKeyNames="PorcentajeIVA">
<Columns>
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
@@ -213,7 +213,7 @@
<asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" />
<asp:BoundField HeaderText="F.Compra" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Right" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" />
<%-- <asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<%-- <asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="SubTotal al 16%." runat="server">SubTotal <br/>16%</asp:Label>
@@ -222,7 +222,7 @@
<asp:Label runat="server" Text='<%# Eval("Actos16", "{0:N2}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="IVA SubTotal Importación 16%." runat="server">SubTotal <br/> Imp. 16%</asp:Label>
@@ -231,16 +231,16 @@
<asp:Label runat="server" Text='<%# Eval("ActosImp16", "{0:N2}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<%-- <asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="SubTotal al 8%." runat="server">SubTotal <br/>8%</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("AcredFN", "{0:N2}") %>'></asp:Label>
<asp:Label runat="server" Text='<%# Eval("ActosFN", "{0:N2}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<%-- <asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="SubTotal al 0%." runat="server">SubTotal <br/>0%</asp:Label>
@@ -318,6 +318,14 @@
<asp:Label runat="server" Text='<%# Eval("ValorIvaNoDeducible08", "{0:N2}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="IVA SubTotal Importación No Tangibles 16%." runat="server">SubTotal <br/> Imp. No Tan.16%</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("ActosImpNotan16", "{0:N2}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
@@ -325,7 +333,7 @@
<div class="col-md-6">
<h4><b>IVA por Porcentaje</b></h4>
<asp:GridView ID="GvIVA2" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"
OnRowDataBound="GvIVA2_RowDataBound" DataKeyNames="PorcentajeIVA" >
OnRowDataBound="GvIVA2_RowDataBound" DataKeyNames="PorcentajeIVA">
<Columns>
<asp:BoundField HeaderText="Tipo" DataField="TipoIVA" />
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
@@ -337,7 +345,7 @@
<div class="col-md-6" id="divRetIVA" runat="server" visible="false">
<h4><b>Ret IVA</b></h4>
<asp:GridView ID="GvRetIVA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" Width="400px" GridLines="None" AutoGenerateColumns="false"
OnRowDataBound="GvRetIVA_RowDataBound" DataKeyNames="TipoRetIVA" >
OnRowDataBound="GvRetIVA_RowDataBound" DataKeyNames="TipoRetIVA">
<Columns>
<asp:BoundField HeaderText="Tipo" DataField="TipoRetIVA" />
<asp:BoundField HeaderText="Base" DataField="BaseRetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />

View File

@@ -333,124 +333,152 @@ public partial class Contabilidad_RepIVA : ClsPaginas
protected void LnkTxtDIOT_Click(object sender, EventArgs e)
{
ClsContabilidad Objconta = new ClsContabilidad();
StringBuilder SBDIOT = new StringBuilder();
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, -1, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
using (var Objconta = new ClsContabilidad())
{
if (txtFechaI.Text.ToDate() < "2024/12/31".ToDate()) // años anteriores al enero 2025
if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, -1, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
{
foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0)
if (txtFechaI.Text.ToDate() < "2024/12/31".ToDate()) // años anteriores al enero 2025
{
SBDIOT.AppendLine(
Drow["TipoTercero"].ToString() + "|" +
Drow["TipoOperacion"].ToString() + "|" +
Drow["RFC"].ToString() + "|" +
Drow["NumeroIDFiscal"].ToString() + "|" +
Drow["NombreExtranjero"].ToString() + "|" +
Drow["PaisResidencia"].ToString() + "|" +
Drow["Nacionalidad"].ToString() + "|" +
LV(Drow["valorActos1516"].ToString()) + "|" +
LV(Drow["valorActos15"].ToString()) + "|" +
LV(Drow["ValorIvaNo1516"].ToString()) + "|" +
foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0)
{
SBDIOT.AppendLine(
Drow["TipoTercero"].ToString() + "|" +
Drow["TipoOperacion"].ToString() + "|" +
Drow["RFC"].ToString() + "|" +
Drow["NumeroIDFiscal"].ToString() + "|" +
Drow["NombreExtranjero"].ToString() + "|" +
Drow["PaisResidencia"].ToString() + "|" +
Drow["Nacionalidad"].ToString() + "|" +
LV(Drow["valorActos1516"].ToString()) + "|" +
LV(Drow["valorActos15"].ToString()) + "|" +
LV(Drow["ValorIvaNo1516"].ToString()) + "|" +
LV(Drow["valorActos1011"].ToString()) + "|" +
LV(Drow["valorActos10"].ToString()) + "|" +
LV(Drow["valorActosImp8"].ToString()) + "|" +
LV(Drow["ValorIvaNo10"].ToString()) + "|" +
LV(Drow["ValorIvaNo08"].ToString()) + "|" +
LV(Drow["valorActos1011"].ToString()) + "|" +
LV(Drow["valorActos10"].ToString()) + "|" +
LV(Drow["valorActosImp8"].ToString()) + "|" +
LV(Drow["ValorIvaNo10"].ToString()) + "|" +
LV(Drow["ValorIvaNo08"].ToString()) + "|" +
LV(Drow["valorActosImp1516"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp16"].ToString()) + "|" +
LV(Drow["valorActosImp1516"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp16"].ToString()) + "|" +
LV(Drow["valorActosImp10"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp10"].ToString()) + "|" +
LV(Drow["valorActosImp10"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp10"].ToString()) + "|" +
LV(Drow["IvaExentoImpo"].ToString()) + "|" +
LV(Drow["IVACero"].ToString()) + "|" +
LV(Drow["IvaExento"].ToString()) + "|" +
LV(Drow["IvaRetenido"].ToString()) + "|" +
LV(Drow["IvaDevoluciones"].ToString()) + "|");
LV(Drow["IvaExentoImpo"].ToString()) + "|" +
LV(Drow["IVACero"].ToString()) + "|" +
LV(Drow["IvaExento"].ToString()) + "|" +
LV(Drow["IvaRetenido"].ToString()) + "|" +
LV(Drow["IvaDevoluciones"].ToString()) + "|");
}
}
}
else
{
DataTable dtt = new DataTable();
dtt = Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 AND ( ActosFN > 0 OR ActosFS > 0 OR Actos16 > 0 OR ActosImp16 > 0 OR ActosImpNotan16 > 0 OR DATasa0 > 0 OR DANoObjetoTN > 0 OR DANoObjetoNoTN > 0 OR NoAcredFN > 0 OR NoAcredNoFN > 0 OR NoAcredNo16 > 0 )");
//acumula los prov, globales en un solo registro
dtt = AcumularYReemplazar(dtt);
foreach (DataRow Drow in dtt.Rows)
else
{
SBDIOT.AppendLine(
Drow["TipoTercero"].ToString() + "|" +
Drow["TipoOperacion"].ToString() + "|" +
Drow["RFC_DIOT"].ToString() + "|" +
Drow["NumeroIDFiscal"].ToString() + "|" +
Drow["NombreExtranjero"].ToString() + "|" +
Drow["PaisResidenciaFiscal"].ToString() + "|" +
Drow["Jurisdiccion"].ToString() + "|" +
// 3.2 valor de los actos o actividades
LV(Drow["ActosFN"].ToString()) + "|" + // actos norte
LV(Drow["ActosDevFN"].ToString()) + "|" + // desc norte
LV(Drow["ActosFS"].ToString()) + "|" + // actos sur
LV(Drow["ActosDevFS"].ToString()) + "|" + // desc sur
LV(Drow["Actos16"].ToString()) + "|" + // 16%
LV(Drow["ActosDev16"].ToString()) + "|" + // desc 16%
LV(Drow["ActosImp16"].ToString()) + "|" + // importacion 16%
LV(Drow["ActosImpDev16"].ToString()) + "|" + // desc importacion 16%
LV(Drow["ActosImpNotan16"].ToString()) + "|" + // importacion intangibles 16%
LV(Drow["ActosImpNotanDev16"].ToString()) + "|" + // desc intangibles 16%
// 3.3 IVA Acreditable
LV(Drow["AcredFN"].ToString()) + "|" + // actos norte
LV(Drow["AcreNoFN"].ToString()) + "|" + // proporcion actos norte
LV(Drow["AcredFS"].ToString()) + "|" + // actos sur
LV(Drow["AcredNoFS"].ToString()) + "|" + // proporcion actos sur
LV(Drow["Acred16"].ToString()) + "|" + // 16%
LV(Drow["AcredIva16"].ToString()) + "|" + // proporcion 16%
LV(Drow["AcredImp16"].ToString()) + "|" + // importacion 16%
LV(Drow["AcredNoImp16"].ToString()) + "|" + // proporción importacion 16%
LV(Drow["AcredImpIntan16"].ToString()) + "|" + // intangibles 16%
LV(Drow["AcredNoImpIntan16"].ToString()) + "|" + // proporcion intangibles 16%
// 3.4 IVA NO Acreditable
LV(Drow["NoAcredFN"].ToString()) + "|" +
LV(Drow["NoAcredNoFN"].ToString()) + "|" +
LV(Drow["NoAcredExentaFN"].ToString()) + "|" +
LV(Drow["NoAcredNoObjetoFN"].ToString()) + "|" +
LV(Drow["NoAcredFS"].ToString()) + "|" +
LV(Drow["NoAcredNoFS"].ToString()) + "|" +
LV(Drow["NoAcredExentaFS"].ToString()) + "|" +
LV(Drow["NoAcredNoObjetoFS"].ToString()) + "|" +
LV(Drow["NoAcred16"].ToString()) + "|" +
LV(Drow["NoAcredNo16"].ToString()) + "|" +
LV(Drow["NoAcredExenta16"].ToString()) + "|" +
LV(Drow["NoAcredNoObjeto16"].ToString()) + "|" +
DataTable dtt = new DataTable();
dtt = Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 AND ( ActosFN > 0 OR ActosFS > 0 OR Actos16 > 0 OR ActosImp16 > 0 OR ActosImpNotan16 > 0 OR DATasa0 > 0 OR DANoObjetoTN > 0 OR DANoObjetoNoTN > 0 OR NoAcredFN > 0 OR NoAcredNoFN > 0 OR NoAcredNo16 > 0 )");
//acumula los prov, globales en un solo registro
dtt = AcumularYReemplazar(dtt);
LV(Drow["NoAcredTan16"].ToString()) + "|" +
LV(Drow["NoAcredTanNo16"].ToString()) + "|" +
LV(Drow["NoAcredTanExenta16"].ToString()) + "|" +
LV(Drow["NoAcredTanNoObjeto16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntan16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanNo16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanExenta16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanNoObjeto16"].ToString()) + "|" +
// 3.5 datos adicionales
LV(Drow["DAIvaRetenido"].ToString()) + "|" + // VA retenido por el contribuyente
LV(Drow["DAIvaExentoImpo"].ToString()) + "|" + //Actos o actividades pagados en la importación de bienes y servicios por los que no se pagara el IVA (Exentos)
LV(Drow["DAIvaExento"].ToString()) + "|" + // Actos o actividades pagados por los que no se pagará el IVA(Exentos)
LV(Drow["DATasa0"].ToString()) + "|" + // Demás actos o actividades pagados a la tasa del 0%
LV(Drow["DANoObjetoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA realizados en
LV(Drow["DANoObjetoNoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA por no contar on establecimiento en territorio nacion
(Drow["DAManifiesto"].ToString())); // Manifiesto que se dio efectos fiscales a los comprobantes que amparan las operaciones realizadas con el proveedor
var dtSinTipoOperacion = dtt.FiltraParametros("GrpId = 1 AND ISNULL(TipoOperacion,'') = ''");
if (dtSinTipoOperacion != null && dtSinTipoOperacion.Rows.Count > 0)
{
var SbSinTipo = new StringBuilder();
SbSinTipo.Append("Los siguientes proveedores no tienen especificado el tipo de operación:<br/>");
foreach (DataRow row in dtSinTipoOperacion.Rows)
{
SbSinTipo.AppendFormat("{0}-{1} <br/>", row["RFC"], row["RazonSocial"]);
}
Alert(SbSinTipo.ToString(), TipoMensaje.MsgAdvertencia);
}
else
{
foreach (DataRow Drow in dtt.Rows)
{
SBDIOT.AppendLine(
Drow["TipoTercero"].ToString() + "|" +
Drow["TipoOperacion"].ToString() + "|" +
Drow["RFC_DIOT"].ToString() + "|" +
Drow["NumeroIDFiscal"].ToString() + "|" +
Drow["NombreExtranjero"].ToString() + "|" +
Drow["PaisResidenciaFiscal"].ToString() + "|" +
Drow["Jurisdiccion"].ToString() + "|" +
// 3.2 valor de los actos o actividades
LV(Drow["ActosFN"].ToString()) + "|" + // actos norte
LV(Drow["ActosDevFN"].ToString()) + "|" + // desc norte
LV(Drow["ActosFS"].ToString()) + "|" + // actos sur
LV(Drow["ActosDevFS"].ToString()) + "|" + // desc sur
LV(Drow["Actos16"].ToString()) + "|" + // 16%
LV(Drow["ActosDev16"].ToString()) + "|" + // desc 16%
LV(Drow["ActosImp16"].ToString()) + "|" + // importacion 16%
LV(Drow["ActosImpDev16"].ToString()) + "|" + // desc importacion 16%
LV(Drow["ActosImpNotan16"].ToString()) + "|" + // importacion intangibles 16%
LV(Drow["ActosImpNotanDev16"].ToString()) + "|" + // desc intangibles 16%
// 3.3 IVA Acreditable
LV(Drow["AcredFN"].ToString()) + "|" + // actos norte
LV(Drow["AcreNoFN"].ToString()) + "|" + // proporcion actos norte
LV(Drow["AcredFS"].ToString()) + "|" + // actos sur
LV(Drow["AcredNoFS"].ToString()) + "|" + // proporcion actos sur
LV(Drow["Acred16"].ToString()) + "|" + // 16%
LV(Drow["AcredIva16"].ToString()) + "|" + // proporcion 16%
LV(Drow["AcredImp16"].ToString()) + "|" + // importacion 16%
LV(Drow["AcredNoImp16"].ToString()) + "|" + // proporción importacion 16%
LV(Drow["AcredImpIntan16"].ToString()) + "|" + // intangibles 16%
LV(Drow["AcredNoImpIntan16"].ToString()) + "|" + // proporcion intangibles 16%
// 3.4 IVA NO Acreditable
LV(Drow["NoAcredFN"].ToString()) + "|" +
LV(Drow["NoAcredNoFN"].ToString()) + "|" +
LV(Drow["NoAcredExentaFN"].ToString()) + "|" +
LV(Drow["NoAcredNoObjetoFN"].ToString()) + "|" +
LV(Drow["NoAcredFS"].ToString()) + "|" +
LV(Drow["NoAcredNoFS"].ToString()) + "|" +
LV(Drow["NoAcredExentaFS"].ToString()) + "|" +
LV(Drow["NoAcredNoObjetoFS"].ToString()) + "|" +
LV(Drow["NoAcred16"].ToString()) + "|" +
LV(Drow["NoAcredNo16"].ToString()) + "|" +
LV(Drow["NoAcredExenta16"].ToString()) + "|" +
LV(Drow["NoAcredNoObjeto16"].ToString()) + "|" +
LV(Drow["NoAcredTan16"].ToString()) + "|" +
LV(Drow["NoAcredTanNo16"].ToString()) + "|" +
LV(Drow["NoAcredTanExenta16"].ToString()) + "|" +
LV(Drow["NoAcredTanNoObjeto16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntan16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanNo16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanExenta16"].ToString()) + "|" +
LV(Drow["NoAcredImpIntanNoObjeto16"].ToString()) + "|" +
// 3.5 datos adicionales
LV(Drow["DAIvaRetenido"].ToString()) + "|" + // VA retenido por el contribuyente
LV(Drow["DAIvaExentoImpo"].ToString()) + "|" + //Actos o actividades pagados en la importación de bienes y servicios por los que no se pagara el IVA (Exentos)
LV(Drow["DAIvaExento"].ToString()) + "|" + // Actos o actividades pagados por los que no se pagará el IVA(Exentos)
LV(Drow["DATasa0"].ToString()) + "|" + // Demás actos o actividades pagados a la tasa del 0%
LV(Drow["DANoObjetoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA realizados en
LV(Drow["DANoObjetoNoTN"].ToString()) + "|" + // Actos o actividades no objeto del IVA por no contar on establecimiento en territorio nacion
(Drow["DAManifiesto"].ToString())); // Manifiesto que se dio efectos fiscales a los comprobantes que amparan las operaciones realizadas con el proveedor
}
Response.Clear();
Response.ClearHeaders();
Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString());
Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{txtFechaI.Text.ToDate().ToString("ddMMyyyy")}_{txtFechaI.Text.ToDate().ToString("ddMMyyyy")}.txt");
Response.Write(SBDIOT.ToString());
Response.End();
}
}
}
}
Objconta.Dispose();
//MemoryStream ms = new MemoryStream();
//TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8);
@@ -469,15 +497,7 @@ public partial class Contabilidad_RepIVA : ClsPaginas
//Response.BinaryWrite(bytes);
//Response.End();
Response.Clear();
Response.ClearHeaders();
Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString());
Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
Response.Write(SBDIOT.ToString());
Response.End();
}
static DataTable AcumularYReemplazar(DataTable dt)

View File

@@ -103,6 +103,7 @@ Catalogo Documentacion Tipo
<asp:ListItem Value="2">Clientes</asp:ListItem>
<asp:ListItem Value="4">Proveedor</asp:ListItem> <%-- Nota: EL tipo Tres es tipo Auditoria de documentos de proveedor usadon el portal prveedor y --%>
<asp:ListItem Value="8">Inicio</asp:ListItem>
<asp:ListItem Value="9">Activos Fijos</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvEdocmodulo" InitialValue="-1" runat="server" ControlToValidate="DdlEdocmodulo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Modulo''</b> es necesario, por favor ingréselo." ValidationGroup="VGMEdoc"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoEdocmodulo" runat="server" HighlightCssClass="vco" TargetControlID="RfvEdocmodulo"></ajax:ValidatorCalloutExtender>

View File

@@ -813,6 +813,16 @@
/*----------------------------------------
ANCHO DE COLUMNAS DE IMPORTES (AÑO, MES, ETC)
-----------------------------------------*/
/* Ancho libre para primeras columnas (Sucursal, Vendedor, etc.) */
.custom-grid td:first-child,
.custom-grid th:first-child {
width: auto !important;
min-width: auto !important;
max-width: none !important;
}
.custom-grid td:nth-child(2),
.custom-grid td:nth-child(3),
.custom-grid td:nth-child(4),
@@ -830,7 +840,6 @@
.custom-grid th:nth-child(4),
.custom-grid th:nth-child(5) {
text-align: center !important;
}
/* Asegurar ancho libre para primera columna */

View File

@@ -787,7 +787,7 @@
<asp:UpdatePanel ID="UpProductoCaducidad" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div runat="server" id="DivImprimir" style="text-align: right" visible="false">
<asp:HyperLink ID="ImprimirQR" runat="server"><i class="fa fa-file-pdf-o" style="font-weight: bold;"></i>Imprimir QR</asp:HyperLink>
<asp:HyperLink ID="HplImprimirQR" runat="server"><i class="fa fa-file-pdf-o" style="font-weight: bold;"></i> Imprimir QR</asp:HyperLink>
</div>
<asp:GridView ID="GvProductoCaducidad" Width="98%" runat="server" ShowHeader="true" EmptyDataText="No hay registros." AutoGenerateColumns="False" AllowPaging="False"

View File

@@ -261,11 +261,6 @@ Partial Class Inventarios_Kardex
#Region " CARGA DATOS "
Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click
CargaDatos()
Dim almacenes As String = ddlAlmacen.GetSelectedValues()
If almacenes = "" Then
almacenes = "-1"
End If
ImprimirQR.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Etiqueta2&CvePS={0}&PS={1}&CveAlmacen={2}&Modalidad={3}", ddlProducto2.SelectedValue.ToEntero, ddlProducto2.SelectedText.ToString, almacenes, "Individual")))
End Sub
Private Sub CargaDatos()
@@ -412,10 +407,6 @@ Partial Class Inventarios_Kardex
DivIndicadorL2.Visible = True
End If
End Sub
Private Function CargarKardex(CvePS As Integer) As DataTable
@@ -441,7 +432,6 @@ Partial Class Inventarios_Kardex
LtIndicador_UCPesos.Text = dr("UltimoCosto").ToString.FormatoNumero()
LtIndicador_UCDolares.Text = (dr("UltimoCosto").ToString.ToDecimal / TC).FormatoNumero
End If
End If
Dim CveTiposAlmacen As String = ""
@@ -493,6 +483,12 @@ Partial Class Inventarios_Kardex
UpOCS.Update()
End If
Dim almacenes As String = ddlAlmacen.GetSelectedValues()
If almacenes = "" Then
almacenes = "-1"
End If
HplImprimirQR.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Etiqueta2&CvePS={0}&PS={1}&CveAlmacen={2}&Modalidad={3}", ddlProducto2.SelectedValue.ToEntero, ddlProducto2.SelectedText.ToString, almacenes, "Individual")))
UpIndicadores.Update()
GvM.Attributes.Add("data-heighterror", "430")

View File

@@ -201,6 +201,14 @@ Partial Class LogIn
Usuario = Nothing
End If
If Usuario IsNot Nothing Then '' consideración especial, para el Grupo Adsistemas
If Usuario.CveUsuario.Contiene(2, 93, 1537, 1538, 1360) Then 'JM,RM,OI,JP,JC cambia la cuenta por la de un admin
Dim tUsuario As Usuario = ObjUsuario.GetUsuarioDetalle(100, Usuario.CveEmpresa) 'ObjUsuario.ValidaUsuario(txtUsuario.Text, Encripta(TxtContraseña.Text.Trim), GrupoEmpresa:=tGrupoEmpresa)
tUsuario = ObjUsuario.ValidaUsuario(tUsuario.Usuario, tUsuario.Contraseña, GrupoEmpresa:=tGrupoEmpresa)
If tUsuario IsNot Nothing Then Usuario = tUsuario
End If
End If
ADSSessionConfig.sessionUser = Usuario
ADSSessionConfig.sessionDpage = False
ObjUsuario.Dispose()

View File

@@ -1446,16 +1446,14 @@
<div class="actions">
<div style="display:inline-block;width:296px">
<div style="display:inline-block;width:186px">
<asp:DropDownList ID="ddlmvtoperfiltroestatus" runat="server" Class="form-control input-sm select2me" Width="100%" ValidationGroup="GrpGuardar">
<div style="display:inline-block;width:296px">Activos:
<div style="display:inline-block;width:125px">
<asp:DropDownList ID="ddlmvtoperfiltroestatus" AutoPostBack="true" OnSelectedIndexChanged="ddlmvtoperfiltroestatus_SelectedIndexChanged" runat="server" Class="form-control input-sm select2me" Width="100%" ValidationGroup="GrpGuardar">
<asp:ListItem Value="-1" Text="Todos"></asp:ListItem>
<asp:ListItem Value="1" Text="Activo"></asp:ListItem>
<asp:ListItem Value="0" Text="Inactivo"></asp:ListItem>
<asp:ListItem Value="1" Text="Si" Selected="True"></asp:ListItem>
<asp:ListItem Value="0" Text="No"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:LinkButton ID="LnkFiltro" OnClick="LnkFiltro_Click" CssClass="btn btn-primary" runat="server">Filtrar</asp:LinkButton>
</div>
</div>
<div class="btn-group">
<asp:LinkButton ID="LnkAddMovtoPermanente" OnClick="LnkAddMovtoPermanente_Click" CssClass="btn yellow-gold" runat="server">Agregar</asp:LinkButton>
@@ -1510,7 +1508,7 @@
CssClass="lnkMovotPermanente" runat="server" Text='<%# Eval("FechaInicioAplicacion", "{0:dd/MM/yyyy}")%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Activo">
<asp:TemplateField HeaderText="Activo" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton data-toggle="tooltip" title="Editar" OnClick="LnkEditarMovtoPermanente_Click"
CssClass="lnkMovotPermanente" runat="server" Text='<%# (Eval("Estatus").ToString()=="1" ? "Si" : "No") %>'></asp:LinkButton>

View File

@@ -7866,8 +7866,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
DdlConcepto.DataBind();
//DdlConcepto.Items.Insert(0, new ListItem("Seleccione", "-1"));
}
protected void LnkFiltro_Click(object sender, EventArgs e)
private void CargaMovtoPermanente()
{
int estatus = ddlmvtoperfiltroestatus.SelectedValue.ToEntero();
using (ClsNominas ObjMovt = new ClsNominas())
@@ -7883,20 +7882,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
GVMovtoPermanente.DataBind();
UpMovtosPermanentes.Update();
}
private void CargaMovtoPermanente()
{
ddlmvtoperfiltroestatus.SelectedValue = "-1";
using (ClsNominas ObjMovt = new ClsNominas())
{
ObjMovt.GetMovtoPermanente(UsuarioActual.CveEmpresa, SRCvePersonal);
GVMovtoPermanente.DataSource = ObjMovt.DtResultados;
}
GVMovtoPermanente.DataBind();
UpMovtosPermanentes.Update();
}
protected void DdlTipo_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -12519,4 +12504,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
protected void ddlmvtoperfiltroestatus_SelectedIndexChanged(object sender, EventArgs e)
{
CargaMovtoPermanente();
}
}

View File

@@ -71,20 +71,15 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
}
protected void CargaCombos()
{
using (ClsRH orh = new ClsRH())
{
if (orh.GetPersonal(-1, UsuarioActual.CveEmpresa))
{
DDlPersonal.DataSource = orh.DtResultados;
}
DDlPersonal.DataBind();
}
{
DDlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa);
DDlPersonal.DataBind();
using (ClsNominas onom = new ClsNominas())
{
if (onom.GetConceptos(UsuarioActual.CveEmpresa))
{
DDLConcepto.DataSource = onom.DtResultados;
DDLConcepto.DataSource = onom.DtResultados.FiltraParametros(" FormulaTotal = 'FNC.[MovimientosPermanentes]' OR Concepto like '%FONACOT%'");
}
DDLConcepto.DataBind();
}

View File

@@ -96,6 +96,8 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas
CargaTiposPeriodo();
CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto, "");//DdlSubProyecto
divddlproyeto.Visible = DdlProyecto.Visible;
DdlTurno.DataSource = get_GlobalDTTurno(UsuarioActual.CveEmpresa);
DdlTurno.DataBind();
//CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing)
}
}

View File

@@ -309,6 +309,19 @@
background: #f8f9fa;
cursor: pointer;
}
/* Alinear celda y contenido a la derecha */
.celda-derecha {
text-align: right !important;
}
.txt-merma {
/* Ancho reducido al 50% */
margin-left: 30px !important; /* Mueve el TextBox a la derecha dentro de la celda */
display: block !important; /* Permite que margin-left:auto funcione */
/* Alinea el texto interno a la derecha */
}
</style>
</asp:Content>
@@ -338,7 +351,7 @@
<div class="labeltruncate labeltext labelbold">
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<div class="form-group">
<label for="<%= DdlClientes.ClientID.ToString()%>">Cliente</label>
<ADS:Dropdownlost ID="DdlClientes" runat="server"
CssClassDdl="form-control" DataTextField="NombreComercial"
@@ -346,88 +359,85 @@
DataValueField="CveCliente" Enabled="false" />
</div>
</div>
</div>
<!-- Centro de Costo -->
<div class="portlet-body form">
<div class="labeltruncate labeltext labelbold">
<div class="row">
<div class="col-md-16">
<div class="form-group form-md-line-input input-iconright">
<asp:Label ID="LblProyecto" runat="server">
<label>Proyecto:</label>
</asp:Label>
<div runat="server" id="DivProyecto">
<asp:DropDownList ID="DdlProyecto" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="form-control select2me" Style="width: 100%;"></asp:DropDownList>
</div>
<asp:Label ID="LblSubProyecto" runat="server" class="col-md-2">
<label>Subproyecto:</label>
</asp:Label>
<div runat="server" id="DivSubProyecto" class="col-md-4">
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="form-control select2me" Style="width: 100%;"></asp:DropDownList>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Descripción -->
<div class="row">
<div class="col-md-10">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescripcion" runat="server"
CssClass="form-control"
Style="width: 95%; height: 40px;"
ValidationGroup="GrpGuardar"
TextMode="MultiLine"
Rows="2"
MaxLength="1000" />
<asp:RequiredFieldValidator ID="RFVDescripcion" runat="server"
ControlToValidate="TxtDescripcion"
ErrorMessage="Descripción requerida"
Display="None"
CssClass="text-danger"
ValidationGroup="GrpGuardar" />
<label for="<%= TxtDescripcion.ClientID.ToString()%>">Descripcion</label>
</div>
</div>
</div>
<!-- Fecha -->
<div class="form-section">
<div class="row">
<!-- Columna Fecha-->
<div class="col-md-3">
<div class="form-group">
<div class="col-md-1">
<label class="mb-0">Fecha</label>
<label>Fecha</label>
<div class="input-group input-sm input-small date date-picker" style="height: 30px;" data-date-format="dd/mm/yyyy">
<asp:TextBox ID="Txtfecha" runat="server"
CssClass="form-control"
style="margin-top: -6px;"
Width="100%"
CausesValidation="true"
MaxLength="10"></asp:TextBox>
<span class="input-group-btn">
<asp:LinkButton ID="imgCalendarioF" class="btn default " style="margin-top: -11px; height: 29px;" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
<asp:TextBox Width="80px" ID="Txtfecha" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="Txtfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="Txtfecha" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="Txtfecha" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="Txtfecha" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
<!-- Centro de Costo -->
<div class="portlet-body form" style="margin-top: -15px;">
<div class="labeltruncate labeltext labelbold">
<div class="row">
<div class="col-md-16">
<div class="form-group">
<asp:Label ID="LblProyecto" runat="server">
<label>Proyecto:</label>
</asp:Label>
<div runat="server" id="DivProyecto">
<asp:DropDownList ID="DdlProyecto" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="form-control select2me" Style="width: 100%;"></asp:DropDownList>
</div>
<asp:Label ID="LblSubProyecto" runat="server" class="col-md-2">
<label>Subproyecto:</label>
</asp:Label>
<div runat="server" id="DivSubProyecto" class="col-md-4">
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="form-control select2me" Style="width: 100%;"></asp:DropDownList>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="Txtfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="Txtfecha" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="Txtfecha" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="Txtfecha" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</div>
<!-- Descripción -->
<div class="row">
<div class="col-md-10">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescripcion" runat="server"
CssClass="form-control"
Style="width: 95%; height: 40px;"
ValidationGroup="GrpGuardar"
TextMode="MultiLine"
Rows="2"
MaxLength="1000" />
<asp:RequiredFieldValidator ID="RFVDescripcion" runat="server"
ControlToValidate="TxtDescripcion"
ErrorMessage="Descripción requerida"
Display="None"
CssClass="text-danger"
ValidationGroup="GrpGuardar" />
<label for="<%= TxtDescripcion.ClientID.ToString()%>">Descripcion</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
@@ -437,23 +447,17 @@
</div>
<div class="portlet-body form">
<asp:TextBox ID="TxtEstatus" runat="server" CssClass="form-control" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVEstatus" runat="server"
ControlToValidate="TxtEstatus"
Display="Dynamic"
ErrorMessage="Estatus requerido"
CssClass="text-danger"
ValidationGroup="GrpGuardar" />
<asp:Label ID="TxtEstatus" runat="server" CssClass="form-control" Width="150px"></asp:Label>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<!-- GridViews -->
<asp:UpdatePanel ID="UpGvDatosOP" runat="server" UpdateMode="Conditional">
<asp:UpdatePanel ID="UpGvDatosOP" runat="server" UpdateMode="Conditional" style="margin-top: -170px;">
<ContentTemplate>
<div class="row">
@@ -466,13 +470,15 @@
</div>
<div class="portlet-body">
<div class="row">
<label class="col-md-1" style="max-width: 70px;">Producto</label>
<div id="PanelProducto" runat="server">
<asp:label ID="LblProducto" class="col-md-1" runat="server" style="max-width: 70px;" Text="Producto"></asp:label>
<div class="col-md-3">
<ADS:Dropdownlost ID="DdlPS" runat="server" Width="100%" CssStyle="width: 100%;"
CssClass="select2me"
CssClassDdl="form-control" DataTextField="PSCodigo"
DataValueField="CvePS" Enabled="false" />
</div>
</div>
<div class="col-md-4 d-flex align-items-center" style="gap: 10px;">
<asp:LinkButton ID="BtnAgregarProducto" runat="server"
CssClass="btn btn-primary"
@@ -760,31 +766,39 @@
</div>
</div>
<!-- Área de acción: Guardar, Terminar y Cancelar -->
<asp:UpdatePanel runat="server" ID="UpBtns" UpdateMode="Conditional">
<ContentTemplate>
<div class="row mt-4">
<div class="col-md-12 d-flex justify-content-end align-items-center">
<!-- Botón Guardar -->
<asp:Button
ID="BtnGuardarOP" runat="server"
Text="Guardar Orden de Producción"
CssClass="btn btn-success me-2"
OnClick="BtnGuardarOP_Click"
ValidationGroup="GrpGuardar" />
<!-- Botón para Guardar la OP -->
<div class="form-group" style="margin-top: 20px;">
<asp:Button ID="BtnGuardarOP" runat="server" Text="Guardar Orden de Producción"
CssClass="btn btn-success" OnClick="BtnGuardarOP_Click"
ValidationGroup="GrpGuardar" />
</div>
<!-- Botones Derecha: Terminar y Cancelar -->
<div class="row mt-4">
<div class="col-md-12 d-flex justify-content-end">
<asp:Button ID="BtnFinalizarOP" runat="server" Text="Terminar"
CssClass="btn btn-success mr-2" OnClick="BtnFinalizarOP_Click"
Visible="false" />
</div>
</div>
<div class="row mt-4">
<div class="col-md-12 d-flex justify-content-end">
<asp:Button ID="BtnCancelarOP" runat="server" Text="Cancelar OP"
CssClass="btn btn-danger" Visible="false"
OnClick="BtnCancelarOP_Click" />
</div>
</div>
<asp:Button
ID="BtnFinalizarOP" runat="server"
Text="Terminar"
CssClass="btn btn-success mr-2"
OnClick="BtnFinalizarOP_Click"
Visible="false" />
<asp:Button
ID="BtnCancelarOP" runat="server"
Text="Cancelar OP"
CssClass="btn btn-danger"
OnClick="BtnCancelarOP_Click"
Visible="false" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DVModalFinalizarOP" class="modal ADS fade" role="dialog" data-backdrop="static">
<div class="modal-dialog" style="width: 750px;">
@@ -838,11 +852,13 @@
<asp:TextBox ID="TxtCantidadPT" runat="server"
Text='<%# Bind("Cantidad") %>'
CssClass="form-control"
style="text-align: right;"
TextMode="Number"
min="0"
step="1"
data-original='<%# Eval("Cantidad") %>'
onchange="validarCantidad(this)" />
onchange="validarCantidad(this)"
ItemStyle-HorizontalAlign="Right"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
@@ -856,17 +872,18 @@
CssClass="table table-striped table-hover" GridLines="None" Width="100%">
<Columns>
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" />
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"/>
<asp:TemplateField HeaderText="Devolución">
<ItemTemplate>
<asp:TextBox ID="TxtDevolucionMP" runat="server"
Text="0"
CssClass="form-control"
style="width: 50%; text-align: right; margin-left: 38px; display: block;"
TextMode="Number"
min="0"
step="1"
data-original='<%# Eval("Cantidad") %>'
onchange="validarCantidad(this)" />
onchange="validarCantidad(this)"
/>
</ItemTemplate>
</asp:TemplateField>
@@ -929,13 +946,17 @@
<asp:TemplateField HeaderText="Merma">
<ItemTemplate>
<asp:TextBox ID="TxtMerma" runat="server" Text="0"
CssClass="form-control" TextMode="Number" step="0.01" min="0" />
CssClass="txt-merma" TextMode="Number" step="0.01" min="0"
style="width: 50%; text-align: right;"
onchange="calcularDevolucion(this);"
data-original='<%# Eval("Cantidad")%>'
/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Devolución">
<asp:TemplateField HeaderText="Devolución" ItemStyle-CssClass="celda-derecha">
<ItemTemplate>
<asp:TextBox ID="TxtDevolucionCancel" runat="server" Text="0"
CssClass="form-control" TextMode="Number" step="0.01" min="0" />
<asp:Label ID="LblDevolucion" runat="server" Text='<%# Eval("Cantidad", "{0:N2}") %>' CssClass="devolucion-label" style="text-align: right;"/>
<asp:HiddenField ID="HfDevolucion" runat="server" Value='<%# Eval("Cantidad", "{0:N2}") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
@@ -969,7 +990,20 @@
}
}
function calcularDevolucion(input) {
var cantidadOriginal = parseFloat(input.dataset.original) || 0; // Usar dataset.original
var merma = parseFloat(input.value) || 0;
if (merma > cantidadOriginal) {
input.value = cantidadOriginal.toFixed(2);
merma = cantidadOriginal;
}
var devolucion = cantidadOriginal - merma;
var row = input.closest('tr');
row.querySelector('.devolucion-label').innerText = devolucion.toFixed(2);
row.querySelector('[id$="HfDevolucion"]').value = devolucion.toFixed(2);
}
</script>
</asp:Content>

View File

@@ -21,6 +21,15 @@ Partial Class OP_OP
End Set
End Property
Private Property CveEstatusInicial As Integer
Get
Return ViewState("CveEstatusInicial").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveEstatusInicial") = value
End Set
End Property
Private Property DtPS As DataTable
Get
Return DirectCast(ViewState("DtPS"), DataTable)
@@ -103,6 +112,11 @@ Partial Class OP_OP
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CveOP = If(Request("CveOP") <> "", Request("CveOP").ToString.ToEntero, "-1".ToEntero)
If Not CveOP > 0 Then
TxtEstatus.Text = GlobalDTOPEstatus(UsuarioActual.CveEmpresa).FiltroPrimeroValor("EstatusOP", "TipoEstatus=1")
End If
CveEstatusInicial = GlobalDTOPEstatus(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOP", "TipoEstatus=1").ToEntero()
TipoEstatus = -1
CreaPS()
SetValues()
@@ -132,8 +146,6 @@ Partial Class OP_OP
DtMP.Columns.Add("UnidadMedida", GetType(String))
DtMP.Columns.Add("Cantidad", GetType(Decimal))
DtMP.Columns.Add("Surtido", GetType(Decimal))
'DtMP.Columns.Add("CvePSProducto", GetType(Integer))
'DtMP.Columns.Add("CveAlmacenDestino", GetType(Integer))
DtMO = New DataTable()
DtMO.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI
@@ -152,7 +164,6 @@ Partial Class OP_OP
DtCI.Columns.Add("productoMateriaPrima", GetType(String))
DtCI.Columns.Add("CvePSProducto", GetType(Integer))
DtCI.Columns.Add("Cantidad", GetType(Decimal))
'DtCI.Columns.Add("Costo", GetType(Decimal))
DtCI.Columns.Add("ImporteCostoIndirecto", GetType(Decimal))
DtCI.Columns.Add("Total", GetType(Decimal))
@@ -166,7 +177,7 @@ Partial Class OP_OP
CargarProductos()
CargaDatos()
If TipoEstatus = 3 Then
If TipoEstatus = 3 Or TipoEstatus = 4 Then
DeshabilitarControles() ' Deshabilita todos los controles relevantes
Else
If CveOP = -1 Then ' Nueva OP
@@ -199,14 +210,20 @@ Partial Class OP_OP
UpOP.Update()
UpGvDatosOP.Update()
UpBtns.Update()
End Sub
Private Sub DeshabilitarControles()
' Deshabilitar DropDownLists
DdlClientes.Enabled = False
DdlProyecto.Enabled = False
DdlSubProyecto.Enabled = False
DdlPS.Enabled = False
DdlClientes.ddl.Enabled = False
DdlClientes.ddlWS.Disabled = True
DdlPS.ddl.Visible = False
DdlPS.ddlWS.Visible = False
LblProducto.Visible = False
' Deshabilitar TextBox y Date
TxtDescripcion.Enabled = False
@@ -219,10 +236,16 @@ Partial Class OP_OP
BtnSimularMP.Visible = False
BtnGuardarOP.Visible = False
BtnFinalizarOP.Visible = False
BtnCancelarOP.Visible = False
LnkSolicitarMP.Visible = False
GvProductos.Columns(3).Visible = False
UpOP.Update()
UpGvDatosOP.Update()
UpBtns.Update()
UpModalCancelar.Update()
End Sub
Private Sub CargaDatos()
@@ -298,7 +321,6 @@ Partial Class OP_OP
newRow("Tipo") = "CI"
newRow("CvePS") = rowCI("CvePS").ToString().ToEntero()
newRow("CvePSProducto") = rowCI("CvePSProducto").ToString().ToEntero()
'newRow("CvePSMateriaPrima") = rowCI("CvePSMateriaPrima").ToString().ToEntero()
newRow("productoMateriaPrima") = rowCI("producto").ToString
newRow("ImporteCostoIndirecto") = rowCI("ImporteCostoIndirecto").ToString.ToDecimal()
newRow("Total") = rowCI("ImporteCostoIndirecto")
@@ -306,11 +328,18 @@ Partial Class OP_OP
Next
End If
End If
End If
ObjOP.Dispose()
ActualizarGrids()
End If
' Validar si la OP está Terminada (3) o Cancelada (4)
If TipoEstatus = 3 Or TipoEstatus = 4 Then
DeshabilitarControles()
End If
End Sub
Private Sub CargarClientes()
@@ -402,7 +431,6 @@ Partial Class OP_OP
rowCI("Tipo") = "CI"
rowCI("CvePS") = CvePS
rowCI("CvePSProducto") = drCI("CvePSProducto").ToString()
'rowCI("CvePSMateriaPrima") = drCI("CvePSMateriaPrima").ToString().ToEntero()
rowCI("productoMateriaPrima") = drCI("productoMateriaPrima").ToString()
rowCI("ImporteCostoIndirecto") = drCI("ImporteCostoIndirecto").ToString().ToDecimal()
rowCI("Total") = rowCI("ImporteCostoIndirecto")
@@ -912,9 +940,26 @@ Partial Class OP_OP
DdlAlmacenMermas.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
DdlAlmacenMermas.DataBind()
' Cargar MP
GvMPCancelacion.DataSource = DtMP.FiltraParametros("Tipo = 'MP'")
' 1. Crear copia del DataTable
Dim dtMPCopy As DataTable = DtMP.FiltraParametros("Tipo = 'MP'").Copy()
' 2. Agregar columna "Devolucion" como NO READONLY
If Not dtMPCopy.Columns.Contains("Devolucion") Then
Dim colDevolucion As New DataColumn("Devolucion", GetType(Decimal))
colDevolucion.ReadOnly = False
dtMPCopy.Columns.Add(colDevolucion)
End If
' 3. Asignar valores manualmente
For Each row As DataRow In dtMPCopy.Rows
row("Devolucion") = row("Cantidad")
Next
' 4. Configurar GridView
GvMPCancelacion.DataSource = dtMPCopy
GvMPCancelacion.DataBind()
ViewState("DtMPCancelacion") = dtMPCopy
RegistraScript("$('#DVModalCancelarOP').modal('show');")
UpModalCancelar.Update()
@@ -931,9 +976,9 @@ Partial Class OP_OP
Dim ObjInventario As New ClsInventarios()
Dim CveMovimientoSalida As Integer = 1
Dim CveMovEntradaDev As Integer = 0
Dim CveMovMerma As Integer = 1
Dim TieneError As Boolean = False
Dim MensajeError As String = ""
Dim CveMovMerma As Integer = 0
Dim ErrorMovInv As Boolean = False
Dim TextoError As String = ""
ObjInventario.IniciaTransacSQL()
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
Dim ObjOP As New ClsOP(ObjInventario.IniciaTransacSQL())
@@ -942,12 +987,14 @@ Partial Class OP_OP
Dim TotalMP As Decimal = 0
Dim TotalDevoluciones As Decimal = 0
Dim TotalMermas As Decimal = 0
' Obtener folios de movimientos
Dim folioDevolucion = 0
Dim folioMerma = 0
Dim Fecha As DateTime = NowADS()
Try
' Validaciones
If DdlAlmacenSalidaMP.SelectedValue = "-1" OrElse
DdlAlmacenDevolucionCancel.SelectedValue = "-1" Then
@@ -957,81 +1004,162 @@ Partial Class OP_OP
' 1. Movimiento de Salida MP
CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenSalidaMP.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Cancelación OP #" & LblFolio.Text, Modulo:="OP/CancelanciónSalida")
' 2. Registrar detalles y obtener PU (Igual que en Finalizar)
Dim DtMPCancelacion As DataTable = Nothing
If CveMovimientoSalida > 0 Then
For Each row As GridViewRow In GvMPCancelacion.Rows
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
Dim Cantidad As Decimal = CDec(row.Cells(2).Text)
' Registrar con PU=0 temporalmente
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, 0) Then
ErrorMovInv = True
Exit For
End If
Next
End If
' Obtener PU reales del movimiento
If Not ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
ErrorMovInv = True
End If
DtMPCancelacion = ObjInventario.DtResultados.Copy()
' 3. Recalcular totales con PU reales (Clave)
TotalMP = DtMPCancelacion.SUMD("Total")
' 2. Movimiento de Entrada Devoluciones
CveMovEntradaDev = ObjInventario.AddMovimiento(DdlAlmacenDevolucionCancel.SelectedValue.ToEntero(), TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="OP/CancelaciónEntrada", CveMovimientoRelacionado:=CveMovimientoSalida)
folioDevolucion = ObjInventario.Folio
' 3. Procesar cada material
For Each row As GridViewRow In GvMPCancelacion.Rows
Dim Cantidad As Decimal = CDec(row.Cells(2).Text)
Dim Merma As Decimal = row.FCTextBox("TxtMerma").Text.ToDecimal()
Dim Devolucion As Decimal = row.FCTextBox("TxtDevolucionCancel").Text.ToDecimal()
If (Merma + Devolucion) > Cantidad Then
Throw New Exception("La suma de merma y devolución no puede exceder la cantidad")
End If
TotalMP += Cantidad
TotalDevoluciones += Devolucion
TotalMermas += Merma
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
' Registrar salida
ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, 0)
' Registrar devolución
If Devolucion > 0 Then
ObjInventario.AddMovimientoDetalle(CveMovEntradaDev, Devolucion, CveUM, CvePS, 0)
End If
Next
' 4. Registrar mermas si existen
If DdlAlmacenMermas.SelectedValue <> "-1" Then
CveMovMerma = ObjInventario.AddMovimiento(DdlAlmacenMermas.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="OP/CancelaciónMerma", CveMovimientoRelacionado:=CveMovimientoSalida)
If Not ErrorMovInv Then
For Each row As GridViewRow In GvMPCancelacion.Rows
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
Dim Merma As Decimal = row.FCTextBox("TxtMerma").Text.ToDecimal()
If Merma > 0 Then
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
ObjInventario.AddMovimientoDetalle(CveMovMerma, Merma, CveUM, CvePS, 0)
TotalMermas += Merma
Dim Cantidad As Decimal = CDec(row.Cells(2).Text)
Dim Devolucion As Decimal = Cantidad - Merma ' Cálculo automático
Dim PU As Decimal = DtMPCancelacion.FiltroPrimeroValor("PU", $"CvePS = {CvePS} AND CveUM = {CveUM}").ToDecimal()
' Actualizar devoluciones con PU correcto
If Devolucion > 0 Then
ObjInventario.AddMovimientoDetalle(CveMovEntradaDev, Devolucion, CveUM, CvePS, PU)
TotalDevoluciones += Devolucion * PU
End If
If Devolucion < 0 Then
Throw New Exception($"Devolución negativa en {row.Cells(0).Text}")
End If
Next
End If
Dim TieneMerma As Boolean = False
For Each row As GridViewRow In GvMPCancelacion.Rows
If row.FCTextBox("TxtMerma").Text.ToDecimal() > 0 Then
TieneMerma = True
Exit For
End If
Next
' 4. Registrar mermas si existen
If TieneMerma Then
If DdlAlmacenMermas.SelectedValue = "-1" Then
Alert("Seleccione almacén para mermas", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim GeneraSalidaMerma As Boolean = False
If GeneraSalidaMerma = True Then
CveMovMerma = ObjInventario.AddMovimiento(DdlAlmacenMermas.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="OP/CancelaciónMerma", CveMovimientoRelacionado:=CveMovimientoSalida)
folioMerma = ObjInventario.Folio
If CveMovMerma > 0 Then
For Each row As GridViewRow In GvMPCancelacion.Rows
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
Dim PU As Decimal = DtMPCancelacion.FiltroPrimeroValor("PU", $"CvePS = {CvePS} AND CveUM = {CveUM}").ToDecimal()
Dim Merma As Decimal = row.FCTextBox("TxtMerma").Text.ToDecimal()
Dim Cantidad As Decimal = CDec(row.Cells(2).Text)
If Merma > 0 Then
ObjInventario.AddMovimientoDetalle(CveMovMerma, Merma, CveUM, CvePS, PU)
End If
' Validaciones
If Merma > Cantidad Then
ErrorMovInv = True
End If
Next
If Not ObjInventario.GetMovimientosDetalle(CveMovMerma, UsuarioActual.CveEmpresa) Then
ErrorMovInv = True
End If
TotalMermas = DtMPCancelacion.SUMD("Total")
End If
Else
TotalMermas = TotalMP - TotalDevoluciones
End If
End If
' 5. Generar pólizas contables
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OP/Cancelacion", 53, 0, 0, 1, Fecha,
If Not ErrorMovInv Then
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OP/Cancelacion", 53, 0, 0, 1, Fecha,
"Cancelación OP #" & LblFolio.Text,
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
' Salida MP (Abono 68)
ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalMP, TotalMP, 68, "Cancelación MP OP #" & LblFolio.Text, "Cancelación MP OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovimientoSalida)
' Salida MP (Abono 68)
If CvePrePoliza > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalMP, TotalMP, 68, "Cancelación MP OP #" & LblFolio.Text, "Cancelación MP OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovimientoSalida) Then
ErrorMovInv = True
End If
' Entrada Devoluciones (Cargo 68)
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalDevoluciones, TotalDevoluciones, 68, "Devoluciones Cancelación OP #" & LblFolio.Text, "Devoluciones Cancelación OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovEntradaDev) Then
ErrorMovInv = True
End If
' Entrada Devoluciones (Cargo 68)
ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalDevoluciones, TotalDevoluciones, 68, "Devoluciones Cancelación OP #" & LblFolio.Text, "Devoluciones Cancelación OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovEntradaDev)
If TotalMermas > 0 Then
' Salida Mermas (Abono 68)
ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalMermas, TotalMermas, 68, "Mermas Cancelación OP #" & LblFolio.Text, "Mermas Cancelación OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovMerma)
' Cargo Mermas (95)
ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalMermas, TotalMermas, 95, "Ajuste Mermas Cancelación OP #" & LblFolio.Text, "Ajuste Mermas Cancelación OP #" & LblFolio.Text)
If TotalMermas > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalMermas, TotalMermas, 95, "Mermas Cancelación OP #" & LblFolio.Text, "Mermas Cancelación OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovMerma) Then
ErrorMovInv = True
End If
End If
' 6. Actualizar estatus OP
' 6. Actualizar estatus OP
If Not ErrorMovInv Then
If ObjOP.UpdateEstatusOP(CveOP, CveEstatusCancelacion, UsuarioActual.CveEmpresa) Then
ObjInventario.Commit()
TxtEstatus.Text = EstatusCancelacion
PanelProducto.Visible = False
DeshabilitarControles()
If ObjOP.UpdateEstatusOP(CveOP, CveEstatusCancelacion, UsuarioActual.CveEmpresa) Then
ObjInventario.Commit()
TxtEstatus.Text = "Cancelado"
BtnCancelarOP.Visible = False
UpOP.Update()
RegistraScript("$('#DVModalCancelarOP').modal('hide');")
Alert("OP cancelada correctamente", TipoMensaje.MsgInformacion)
Dim linkDevolucion = $"<a class='Texto' href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={CveMovEntradaDev}'>{folioDevolucion}</a>"
Dim mensaje = $"OP cancelada correctamente.<br/>Devolución: {linkDevolucion}"
' Validar si existe movimiento de merma
If CveMovMerma > 0 Then
Dim linkMerma = $"<a class='Texto' href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={CveMovMerma}'>{folioMerma}</a>"
mensaje &= $"<br/>Merma: {linkMerma}"
End If
RegistraScript("$('#DVModalCancelarOP').modal('hide');")
Alert(mensaje, TipoMensaje.MsgInformacion)
Else
ObjInventario.RollBack()
Alert("Error al actualizar el estatus.", TipoMensaje.MsgError)
End If
Else
Throw New Exception("Error al actualizar el estatus de la OP")
ObjInventario.RollBack()
Alert($"Error contable: {TextoError}", TipoMensaje.MsgError)
End If
Catch ex As Exception
@@ -1112,10 +1240,6 @@ Partial Class OP_OP
Dim CveMovimientoEntrada As Integer = 0
Dim IDPoliza As Integer = 0
Dim FolioSalida As Integer = 0
'Dim CveMovimientoVirtualEntrada As Integer = 0
'Dim CveMovimientoVirtualSalida As Integer = 0
'Dim FolioVirtualEntrada As Integer = 0
'Dim FolioVirtualSalida As Integer = 0
Dim FolioEntrada As Integer = 0
Dim Fecha As DateTime = NowADS()
Dim ErrorMovInv As Boolean = False
@@ -1124,7 +1248,6 @@ Partial Class OP_OP
Dim TipoMovimientoDev As Integer = 33
Dim CveConceptoEntrada As Integer = 9
Dim TotalCostoMP As Decimal = 0
'Dim TotalDevoluciones As Decimal = 0
Dim CveMovimientoDev As Integer = 0
Dim CostoDevoluciones As Decimal = 0
@@ -1222,8 +1345,8 @@ Partial Class OP_OP
For Each row As GridViewRow In GvMPUtilizada.Rows
Dim Devolucion As Decimal = row.FCTextBox("TxtDevolucionMP").Text.ToDecimal()
If Devolucion > 0 Then
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero 'GvMPUtilizada.DataKeys(row.RowIndex)("CvePSMateriaPrima").ToString.ToEntero()
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero 'GvMPUtilizada.DataKeys(row.RowIndex)("CveUMMateriaPrima").ToString.ToEntero()
Dim CvePS As Integer = row.DataKey("CvePSMateriaPrima").ToEntero
Dim CveUM As Integer = row.DataKey("CveUMMateriaPrima").ToEntero
Dim PU As Decimal = DtMPAlmacen.FiltroPrimeroValor("PU", $"CvePS = {CvePS} AND CveUM = {CveUM}").ToDecimal()
@@ -1253,8 +1376,7 @@ Partial Class OP_OP
If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then
Dim CostoTotalProduccion As Decimal = TotalMPProducto + TotalMOProducto + TotalCIProducto
Dim CostoPTAjustado As Decimal = CostoTotalProduccion - CostoDevoluciones
'Dim CantidadPT As Decimal = DtPS.AsEnumerable().Sum(Function(r) r.Field(Of Decimal)("Cantidad"))
'Dim PU_PT As Decimal = If(CantidadPT > 0, CostoPTAjustado / CantidadPT, 0)
For Each rowPT As DataRow In DtPS.Select("Tipo = 'Producto'")
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, rowPT("Cantidad").ToString.ToDecimal(), rowPT("CveUM").ToString.ToEntero(), rowPT("CvePS").ToString.ToEntero(), rowPT("Costo").ToString.ToDecimal()) Then
@@ -1288,14 +1410,6 @@ Partial Class OP_OP
ErrorMovInv = True
End If
End If
'If Not ErrorMovInv Then
'If Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then
'ErrorMovInv = True : TextoError = "Error en validación de póliza"
'ElseIf ObjConta.ValorPolizaDescuadre > 0 Then
' ErrorMovInv = True : TextoError = "Descuadre en póliza contable"
'End If
'End If
End If
End If
End If
@@ -1306,16 +1420,12 @@ Partial Class OP_OP
ObjInventario.Commit()
TxtEstatus.Text = EstatusFinalizar
DeshabilitarControles()
UpOP.Update()
UpGvDatosOP.Update()
Alert("Orden de producción finalizada.<br/>" & "<a class='Texto' href='/Inventarios/EntradasSalidas.aspx?CveMovimiento=" & CveMovimientoEntrada & "'>" & FolioEntrada & "</a>",
TipoMensaje.MsgInformacion)
RegistraScript("$('#DVModalFinalizarOP').modal('hide');")
Else
ObjInventario.RollBack()
Alert("Error al actualizar el estatus.", TipoMensaje.MsgError)
@@ -1326,9 +1436,6 @@ Partial Class OP_OP
Alert($"Error contable: {TextoError}", TipoMensaje.MsgError)
End If
Catch ex As Exception
ObjInventario.RollBack()
Alert($"Error crítico: {ex.Message}", TipoMensaje.MsgError)

View File

@@ -673,7 +673,12 @@
<asp:Literal ID="LtlCorreo" runat="server" Text='<%# Eval("Correo") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" Visible="false">
<HeaderTemplate>Fecha Baja</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFechaBaja" runat="server" Text='<%# Eval("FechaBaja", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
@@ -868,7 +873,9 @@
<div class="col-md-3">
<asp:CheckBox ID="ChkCLABE" runat="server" Text="CLABE" />
</div>
<div class="col-md-3">
<asp:CheckBox ID="ChkFechaBaja" runat="server" Text="Fecha Baja" />
</div>
</div>
</div>
<div class="modal-footer">

View File

@@ -399,6 +399,7 @@ Partial Class RH_CatPersonal
GvDatos.Columns(47).Visible = ChkCuentaBancaria.Checked
GvDatos.Columns(48).Visible = ChkCLABE.Checked
GvDatos.Columns(49).Visible = ChkCorreo.Checked
GvDatos.Columns(50).Visible = ChkFechaBaja.Checked
If (GvDatos.Rows.Count > 0) Then
GvDatos.UseAccessibleHeader = True

View File

@@ -8,7 +8,6 @@ Imports Extensiones
Partial Class Ventas_ClientesAbonar
Inherits ClsPaginas
#Region "Propiedades"
Private Property CveCorte As Integer
Get
@@ -834,7 +833,7 @@ Partial Class Ventas_ClientesAbonar
Exit Sub
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso RblTipoPago.SelectedValue = "3" Then
If RblTipoPago.SelectedValue = "3" Then
Dim DtSaldo As DataTable = Nothing
Dim ObjMovto As New ClsMovimientos
If ObjMovto.GetIngresosSaldosDetalle(CveCliente, -1, UsuarioActual.CveEmpresa) Then
@@ -859,10 +858,17 @@ Partial Class Ventas_ClientesAbonar
Next
ImporteAbonar += TxtAnticipo.Text.ToDecimal()
If ImporteRef.RoundSQL(2) <> ImporteAbonar.RoundSQL(2) Then
If ImporteRef.RoundSQL(2) < ImporteAbonar.RoundSQL(2) Then
Alert("El importe abonado es mayor al saldo del ingreso por comprobar, especifique un valor correcto.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso ImporteRef.RoundSQL(2) <> ImporteAbonar.RoundSQL(2) Then
Alert("El importe abonado es diferente al saldo del ingreso", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert("No se pudieron validar los saldos", TipoMensaje.MsgError)
Exit Sub

View File

@@ -228,6 +228,16 @@ Partial Class Ventas_FacturacionGlobal
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero())
Next
Dim SbObs As New StringBuilder
If txtFechaI.Text.Trim() <> txtFechaF.Text.Trim() Then
SbObs.AppendFormat("Periodo: {0} al {1}", txtFechaI.Text, txtFechaF.Text)
ElseIf txtFechaI.Text.Trim() = txtFechaF.Text.Trim() Then
SbObs.AppendFormat("Periodo: {0}", txtFechaI.Text)
End If
ObjFactura.Observaciones = SbObs.ToString()
ObjFactura.CalculaTotales()
ObjFactura.PreparaTimbre()

View File

@@ -6726,10 +6726,10 @@ Partial Class PV
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
' Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
Alert("El uso cfdi del cliente no puede ser <b>'S01 - Sin efectos fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)

View File

@@ -111,14 +111,12 @@ Partial Class Ventas_RepVentas
Opcion = "-1"
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.TienePermisoProceso(386) Then
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso (UsuarioActual.TienePermisoProceso(386) OrElse UsuarioActual.CveUsuario.Contiene(4159)) Then
LiSabana.Visible = True
DdlProveedores.setEsWebService(True)
DdlProveedores.Attributes.Add("data-metodo", "getproveedores")
DdlProveedores.SelectedText = "Todos"
DdlProveedores.SelectedValue = "-1"
End If
If UsuarioActual.CveEmpresa = 72 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1614, 1517) Then

View File

@@ -4322,10 +4322,24 @@
<td>
<asp:TextBox ID="TxtObsAlmacen" runat="server" Rows="2" TextMode="MultiLine" Width="100%" CssClass="form-control input-sm"></asp:TextBox></td>
</tr>
<tr align="left" id="TrKilometraje" runat="server" visible="false">
<td>Kilometraje&nbsp;
<asp:TextBox ID="TxtKilometraje" runat="server" Width="250px" CssClass="form-control input-sm" MaxLength="6" CausesValidation="true" Text="000000"></asp:TextBox>
<ajax:MaskedEditExtender ID="MEEKilometraje" runat="server" TargetControlID="TxtKilometraje" ClearMaskOnLostFocus="false" MaskType="Number" Mask="999999" MessageValidatorTip="true" InputDirection="LeftToRight" ErrorTooltipEnabled="True"></ajax:MaskedEditExtender>
<tr align="center" id="TrKilometraje" runat="server" visible="false">
<td>
<div class="row">
<div class="col-md-2">
Kilometraje&nbsp;
<asp:TextBox ID="TxtKilometraje" runat="server" Width="65px" CssClass="form-control input-sm" MaxLength="6" CausesValidation="true" Text="000000"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVKilometraje" runat="server" ControlToValidate="TxtKilometraje" ValidationExpression="^\d{4,6}$" ErrorMessage="Debe tener entre 4 y 6 dígitos numéricos." Display="Dynamic" ForeColor="Red" />
<%--<ajax:MaskedEditExtender ID="MEEKilometraje" runat="server" TargetControlID="TxtKilometraje" ClearMaskOnLostFocus="false" MaskType="Number" Mask="999999" MessageValidatorTip="true" InputDirection="LeftToRight" ErrorTooltipEnabled="True"></ajax:MaskedEditExtender>--%>
</div>
<div class="col-md-5">
Próxima Rotación y Balanceo:<br />
<asp:Label runat="server" ID="LblRotacion" Text=""></asp:Label>
</div>
<div class="col-md-5">
Próxima Alineación:<br />
<asp:Label runat="server" ID="LblAlineacion" Text=""></asp:Label>
</div>
</div>
</td>
</tr>
<tr align="left" id="trCorreoNotif1" runat="server" visible="false">
@@ -4350,21 +4364,6 @@
<tr align="left" id="trPaqueteriaDirectaLabel" runat="server" visible="false">
<td id="Td4" runat="server">Tipo de Entrega:&nbsp;<b>Entrega Directa</b></td>
</tr>
<tr align="left" id="trRotacion" runat="server" visible="false">
<td id="Td3" runat="server">Próxima Rotación y Balanceo:&nbsp;</td>
</tr>
<tr align="left" id="trRotacionlbl" runat="server" visible="false">
<td>
<asp:Label runat="server" ID="LblRotacion" Text=""></asp:Label></td>
</tr>
<tr align="left" id="trAlineacion" runat="server" visible="false">
<td id="Td7" runat="server">Próxima Alineación:&nbsp;</td>
</tr>
<tr align="left" id="trAlineacionlbl" runat="server" visible="false">
<td>
<asp:Label runat="server" ID="LblAlineacion" Text=""></asp:Label></td>
</tr>
<%--<tr align="left" id="TrObsMedico1" visible="false" runat="server">
<td>Médico:&nbsp;</td>

View File

@@ -3487,7 +3487,7 @@ Partial Class Ventas
DivContadoOtros.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
DivMesesSinIntereses.Visible = True
DivDdlCuentaTarjetaCredito.Attributes.Add("class", "col-md-4")
@@ -3591,10 +3591,6 @@ Partial Class Ventas
'End If
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
trRotacion.Visible = True
trRotacionlbl.Visible = True
trAlineacion.Visible = True
trAlineacionlbl.Visible = True
Dim FechaRotaAlinea As Date = TxtFecha.Text.ToDate
LblRotacion.Text = FechaRotaAlinea.AddMonths(6).ToShortDateString
@@ -6043,7 +6039,11 @@ Partial Class Ventas
'ACTIVA EDITAR
'SOLO LA PUEDE EDITAR CON PROCESO | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
If (UsuarioActual.TienePermisoProceso(202) OrElse UsuarioActual.TienePermisoProceso(302)) And TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
If DbRowVenta("TipoDocto").ToString = "Rem" AndAlso (UsuarioActual.TienePermisoProceso(202) OrElse UsuarioActual.TienePermisoProceso(302)) AndAlso TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
BtnPermisoEditarRemision.Visible = True
End If
If DbRowVenta("TipoDocto").ToString = "Rem" AndAlso (UsuarioActual.TienePermisoProceso(302)) Then
BtnPermisoEditarRemision.Visible = True
End If
@@ -8969,10 +8969,14 @@ Partial Class Ventas
End If
'cuando ya tiene una salida, no se puede cambiar el producto
If e.Row.DBCampo("CantidadInventario").ToDouble > 0 Then
If e.Row.DBCampo("CantidadInventario").ToDouble > 0 OrElse e.Row.DBCampo("CantidadFacturadaRem").ToDecimal > 0 Then
e.Row.FCDropDownList("DdlClasificacion").Enabled = False
e.Row.FCDropDownLost("DdlPS").Enabled = False
e.Row.FCDropDownLost("DdlPS").ddlWS.Attributes.Add("disabled", "disabled")
If e.Row.DBCampo("CantidadFacturadaRem").ToDecimal > 0 AndAlso SaldoVenta = 0 Then
e.Row.FCTextBox("TxtPrecio").Enabled = False
e.Row.FCTextBox("TxtDescuento").Enabled = False
End If
End If
e.Row.FCTextBox("TxtTiempoEntrega").Enabled = False
@@ -9075,6 +9079,16 @@ Partial Class Ventas
e.Row.FCLinkButton("imgD").Visible = False
End If
End If
'EN SMS NO DEBE PODER EDITAR LOS PS
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
If ModalidadEdicion Then
e.Row.FCLinkButton("imgE").Visible = True
e.Row.FCLinkButton("imgD").Visible = False
Else
e.Row.FCLinkButton("imgE").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
End If
End If
If (UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1") AndAlso e.Row.DBCampo("CvePrecioLista").ToEntero() > 0 Then
@@ -10020,9 +10034,9 @@ Partial Class Ventas
End If
End If
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then
If TxtKilometraje.Text.Length < 6 Then
Alert("El kilometraje debe tener 6 digitos.", TipoMensaje.MsgAdvertencia)
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso TrKilometraje.Visible Then
If TxtKilometraje.Text.Length < 4 OrElse TxtKilometraje.Text.Length > 6 Then
Alert("El kilometraje debe tener de 4 a 6 dígitos.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
@@ -13329,7 +13343,7 @@ Partial Class Ventas
ObjFactura.EsGarantia = Me.EsGarantia
ObjFactura.Bloqueada = Me.Bloqueada
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso TrKilometraje.Visible Then
ObjFactura.Kilometraje = TxtKilometraje.Text.Trim.ToDecimal()
End If
@@ -18779,7 +18793,7 @@ Partial Class Ventas
End If
Else
If drPS("CveTipoPS").ToString() = "1" Then 'Si es servicio
If UsuarioActual.Empresa.Funcionalidad(558).ToString() = "1" Then 'Si es Empresa llantera
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then 'Si es Empresa llantera
TxtPrecio.Enabled = True
Else
'TxtPrecio.Enabled = False
@@ -25222,7 +25236,7 @@ Partial Class Ventas
End If
Case 2 'CONTADO
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") OrElse (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") OrElse (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") OrElse (UsuarioActual.Empresa.Funcionalidad(558) = "1" And DdlTipoComprobante.SelectedValue = "Cot") OrElse (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
DivContado.Visible = True
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
DivTransferencia.Visible = False
@@ -25496,7 +25510,7 @@ Partial Class Ventas
DrCredito("Tipo") = "Tarjeta de Crédito"
DrCredito("CveMetodoPago") = 4
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
DrCredito("MesesSinIntereses") = DDlMesesSinIntereses.SelectedValue.ToEntero()
Else
DrCredito("MesesSinIntereses") = -1
@@ -25592,7 +25606,7 @@ Partial Class Ventas
DrCredito("Observaciones") = ""
DrCredito("Tipo") = "Tarjeta de Crédito"
DrCredito("CveMetodoPago") = 4
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 Then
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
DrCredito("MesesSinIntereses") = DdlMesesSinIntereses2.SelectedValue.ToEntero()
Else
DrCredito("MesesSinIntereses") = -1
@@ -26324,10 +26338,10 @@ Partial Class Ventas
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
' Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
'If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
' Alert("El uso cfdi del cliente no puede ser <b>'S01 - Sin efectos fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
@@ -35999,7 +36013,7 @@ Partial Class Ventas
SeEstaFActurandoVentaMedica = True
End If
If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And RBLPago.SelectedValue.ToEntero() = 2 Then
If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558) = "1" And RBLPago.SelectedValue.ToEntero() = 2 Then
Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia)
Else
Dim FolioFijo As Integer = 0
@@ -39567,10 +39581,9 @@ Partial Class Ventas
TxtFechaPago.Enabled = False
imgCalendario.Visible = False
TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString()
End If
TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString()
Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero()
Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero()
Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal()
@@ -39693,25 +39706,15 @@ Partial Class Ventas
End If
End If
Dim OrdenCompra As String = "-1"
If UsuarioActual.CveEmpresa = 119 Then
Dim arrayStr As String() = DdlLineaAdicional.SelectedItem.Text.Split(":"c)
If arrayStr.Length > 0 Then
Dim OrdenCompraTmp As String = arrayStr(0).Replace("IMP", "").Trim
If TxtOrdenCompra.Text.Trim.Length > 0 Then
If OrdenCompraTmp.ToUpper <> TxtOrdenCompra.Text.Trim.ToUpper Then
OrdenCompra = $"{TxtOrdenCompra.Text}, {OrdenCompraTmp}"
End If
Else
OrdenCompra = $"{OrdenCompraTmp}"
End If
End If
End If
Dim OrdenCompra As String = TxtOrdenCompra.Text
Using ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), CveVenta, "", 1, UsuarioActual.CveEmpresa, OrdenCompra:=OrdenCompra) Then
Try
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
Catch ex As Exception
End Try
Alert("Se actualizó la linea adicional de crédito de la venta")
End If
End Using