This commit is contained in:
2024-08-01 15:50:38 -07:00
5 changed files with 228 additions and 180 deletions

View File

@@ -7405,6 +7405,26 @@ Public Class ClsVentas
End Function End Function
Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaAdjuntoUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#Region "IDisposable Support" #Region "IDisposable Support"

View File

@@ -77,18 +77,22 @@
<asp:UpdatePanel ID="UPPMov" runat="server" RenderMode="Inline" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPPMov" runat="server" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvT" Width="1000px" runat="server" GridLines="None" BorderWidth="0" data-heighterror="330" data-freezecols="0" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall" <asp:GridView ID="GvT" Width="1000px" runat="server" GridLines="None" BorderWidth="0" data-heighterror="330" data-freezecols="0" CssClass="table table-advance table-hover mysmallbtn ScrollAD Widthall"
ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False" OnRowDataBound="GvT_RowDataBound" ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False" OnRowDataBound="GvT_RowDataBound"
DataKeyNames="CveTraspasoSolicitud,Folio,Fecha,CveUsuario,CveAlmacenOrigen,CveAlmacenDestino,CveTrasladoEstatus,PermisoOrigen,TraspasoEstatus,AlmacenOrigen,AlmacenDestino,Nombre" > DataKeyNames="CveTraspasoSolicitud,Folio,Fecha,CveUsuario,CveAlmacenOrigen,CveAlmacenDestino,CveTrasladoEstatus,PermisoOrigen,TraspasoEstatus,AlmacenOrigen,AlmacenDestino,Nombre" >
<Columns> <Columns>
<asp:BoundField DataField="Folio" HeaderText="Folio" ItemStyle-Width="10%" /> <asp:BoundField DataField="Folio" HeaderText="Folio" ItemStyle-Width="10%" />
<asp:BoundField DataField="AlmacenOrigen" HeaderText="Origen" /> <asp:BoundField DataField="AlmacenOrigen" HeaderText="Origen" />
<asp:BoundField DataField="AlmacenDestino" HeaderText="Destino" /> <asp:BoundField DataField="AlmacenDestino" HeaderText="Destino" />
<asp:BoundField DataField="Fecha" HeaderText="Fecha" ItemStyle-Width="10%" DataFormatString="{0:d}" /> <asp:BoundField DataField="Fecha" HeaderText="Fecha" ItemStyle-Width="10%" DataFormatString="{0:d}" />
<asp:BoundField DataField="Nombre" HeaderText="Solicitante" ItemStyle-Width="200px" /> <asp:BoundField DataField="Nombre" HeaderText="Solicitante" ItemStyle-Width="200px" />
<asp:BoundField DataField="TraspasoEstatus" HeaderText="Estatus" ItemStyle-Width="10%" /> <%--<asp:BoundField DataField="TraspasoEstatus" HeaderText="Estatus" ItemStyle-Width="10%" />--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Estatus" ItemStyle-Width="70px" >
<ItemTemplate>
<asp:Label runat="server" ID="LblTraspasoEstatus" Width="70px" Height="15px" Text='<%# Eval("TraspasoEstatus") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="CveMovimientoAlmacen" DataNavigateUrlFormatString="~/Inventarios/EntradasSalidas.aspx?CveMovimiento={0} " <asp:HyperLinkField DataNavigateUrlFields="CveMovimientoAlmacen" DataNavigateUrlFormatString="~/Inventarios/EntradasSalidas.aspx?CveMovimiento={0} "
Target="_blank" ItemStyle-Width="5%" HeaderText="Movimiento" ControlStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Left" DataTextField="FolioMovimiento" /> Target="_blank" ItemStyle-Width="5%" HeaderText="Movimiento" ControlStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Left" DataTextField="FolioMovimiento" />
@@ -128,12 +132,17 @@
<div class="row marginRowLeft"> <div class="row marginRowLeft">
<div class="col-md-6 form-group form-md-line-input input-iconright" id="Div1" runat="server"> <div class="col-md-6 form-group form-md-line-input input-iconright" id="Div1" runat="server">
<asp:DropDownList ID="DdlAlmacenOrigen" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control select2me" runat="server"></asp:DropDownList> <asp:DropDownList ID="DdlAlmacenOrigen" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control select2me" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlAlmacenOrigen_SelectedIndexChanged"></asp:DropDownList>
<label for="<%= DdlAlmacenOrigen.ClientID.ToString()%>">Almacén Origen:</label> <label for="<%= DdlAlmacenOrigen.ClientID.ToString()%>">Almacén Origen:</label>
<asp:RequiredFieldValidator ID="RfvDdlAlmacenOrigen" runat="server" InitialValue="-1" ControlToValidate="DdlAlmacenOrigen" CssClass="help-block errorimput"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacén Origen''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGeneraSolictud"></asp:RequiredFieldValidator>
</div> </div>
<div class="col-md-6 form-group form-md-line-input input-iconright" id="Div2" runat="server"> <div class="col-md-6 form-group form-md-line-input input-iconright" id="Div2" runat="server">
<asp:DropDownList ID="DdlAlmacenDestino" DataTextField="Almacen" DataValueField="CveAlmacen" Width="100%" CssClass="form-control select2me" runat="server" ></asp:DropDownList> <asp:DropDownList ID="DdlAlmacenDestino" DataTextField="Almacen" DataValueField="CveAlmacen" Width="100%" CssClass="form-control select2me" runat="server" ></asp:DropDownList>
<label for="<%= DdlAlmacenDestino.ClientID.ToString()%>">Almacén Destino:</label> <label for="<%= DdlAlmacenDestino.ClientID.ToString()%>">Almacén Destino:</label>
<asp:RequiredFieldValidator ID="RfvDdlAlmacenDestino" runat="server" InitialValue="-1" ControlToValidate="DdlAlmacenDestino" CssClass="help-block errorimput"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacén Destino''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGeneraSolictud"></asp:RequiredFieldValidator>
</div> </div>
</div> </div>
@@ -156,7 +165,9 @@
<div class="row"> <div class="row">
<div class="col-md-12" style="text-align:right!important"> <div class="col-md-12" style="text-align:right!important">
<asp:Button ID="BtnAgregarPS" runat="server" class="btn btn-success" Text="Agregar Producto" Style="margin-left: -100px;" ValidationGroup="AgregarPS"/> <%--<asp:Button ID="BtnAgregarPS" runat="server" class="btn btn-success" Text="Agregar" Style="margin-left: -100px;" ValidationGroup="AgregarPS"/>--%>
<asp:LinkButton ID="BtnAgregarPS" runat="server" CssClass="btn btn-success btn-sm" Text='<i class="fa fa-plus"></i> Agregar' Style="margin-left: -100px;" ValidationGroup="AgregarPS"/>
</div> </div>
</div> </div>
@@ -182,7 +193,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:Button runat="server" ID="BtnGuardar" align="center" Text="Guardar Solicitud" CssClass="btn btn-success" /> <asp:Button runat="server" ID="BtnGuardar" align="center" Text="Guardar Solicitud" CssClass="btn btn-success" ValidationGroup="GrpGeneraSolictud" />
<button id="LbCancelar" runat="server" type="button" class="btn default" data-dismiss="modal">Cerrar</button> <button id="LbCancelar" runat="server" type="button" class="btn default" data-dismiss="modal">Cerrar</button>
</div> </div>
</ContentTemplate> </ContentTemplate>

View File

@@ -84,9 +84,10 @@ Partial Class Inventarios_TrasladoSolicitud
Private Sub CargaAlmacenes() Private Sub CargaAlmacenes()
'Cargo los almacenes 'Cargo los almacenes
DdlAlmacenOrigen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado DdlAlmacenOrigen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado
DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado 'DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado
DdlAlmacenOrigen.DataBind() DdlAlmacenOrigen.DataBind()
DdlAlmacenDestino.DataBind() DdlAlmacenOrigen.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
'DdlAlmacenDestino.DataBind()
End Sub End Sub
@@ -493,7 +494,7 @@ Partial Class Inventarios_TrasladoSolicitud
Dim FolioEntrada As Integer = 0 Dim FolioEntrada As Integer = 0
Dim TextoError As String = "" Dim TextoError As String = ""
Dim CveConceptoEntrada As Integer = 27 Dim CveConceptoEntrada As Integer = 9
'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN
@@ -527,7 +528,7 @@ Partial Class Inventarios_TrasladoSolicitud
End If End If
Next Next
'For Each Dr As DataRow In DtMovimientos.Rows 'For Each Dr As DataRow In DtMovimientos.RowsF
'Next 'Next
End If End If
@@ -550,7 +551,7 @@ Partial Class Inventarios_TrasladoSolicitud
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal()) Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal())
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=-1, If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=-1,
CveSeccionAlmacen:=-1, Serie:="-1", Lote:="-1", FechaCaducidad:=MinFecha, CveMovimientoDetalleEntrada:=-1, Observaciones:="") Then CveSeccionAlmacen:=-1, Serie:="-1", Lote:="-1", FechaCaducidad:=MinFecha, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:="") Then
ErrorMovInv = True ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada" TextoError = "Ocurrió un error al guardar los movimientos de entrada"
Exit For Exit For
@@ -621,7 +622,12 @@ Partial Class Inventarios_TrasladoSolicitud
ObjInventario.Commit() ObjInventario.Commit()
MensajeAlert.Append("Se realizó con éxito el traspaso.") MensajeAlert.Append("Se realizó con éxito el traspaso.")
MensajeAlert.AppendFormat("<br/> Folio de Salida: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}"" target=""_blank"">{0}</a></b>", FolioSalida, CveMovimientoSalida) MensajeAlert.AppendFormat("<br/> Folio de Salida: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}"" target=""_blank"">{0}</a></b>", FolioSalida, CveMovimientoSalida)
MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir Salida </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida)))
MensajeAlert.AppendFormat("<br/> Folio de Transitorio: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}"" target=""_blank"">{0}</a></b>", FolioEntrada, CveMovimientoEntrada)
MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir Transitorio </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada)))
Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, "") Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, "")
RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalSolicitud")) RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalSolicitud"))
Else Else
@@ -672,10 +678,13 @@ Partial Class Inventarios_TrasladoSolicitud
If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 1 Then If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 1 Then
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm blue" e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm blue"
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-info"
Else Else
If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 2 Then If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 2 Then
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-success"
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm green" e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm green"
Else Else
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-danger"
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm red" e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm red"
End If End If
@@ -686,4 +695,16 @@ Partial Class Inventarios_TrasladoSolicitud
End If End If
End Sub End Sub
Protected Sub DdlAlmacenOrigen_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlAlmacenDestino.ClearSelection()
DdlAlmacenDestino.SelectedValue = Nothing
DdlAlmacenDestino.Items.Clear()
DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveTipoAlmacen <> 9 AND CveAlmacen <> {DdlAlmacenOrigen.SelectedValue}")
DdlAlmacenDestino.DataBind()
DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
UpPS.Update()
End Sub
End Class End Class

View File

@@ -4299,7 +4299,8 @@
<br /> <br />
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" /> <asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" />
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" Visible="false" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar el archivo?" data-btn-ok-label="si" /> <asp:LinkButton ID="BtnEliminarAdjunto" runat="server" Visible="false" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar el archivo?" data-btn-ok-label="si" />
<asp:LinkButton ID="BtnReemplazarAdjunto" runat="server" Visible="false" AlternateText="Reemplazar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm blue" Text="<i class='fa-upload fa' style=' color: white;'></i>" data-toggle="modal" data-target="#ModalAdjuntar" /> &nbsp;&nbsp;
<asp:LinkButton ID="BtnReemplazarAdjunto" runat="server" Visible="false" AlternateText="Reemplazar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-sm blue" Text="<i class='fa-upload fa' style=' color: white;'></i>" data-toggle="modal" data-target="#ModalAdjuntar" />
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -5023,7 +5023,7 @@ Partial Class Ventas
If Adjunto <> "" Then If Adjunto <> "" Then
BtnArchivoAdjunto.Text = Adjunto BtnArchivoAdjunto.Text = Adjunto
BtnArchivoAdjunto.Visible = True BtnArchivoAdjunto.Visible = True
BtnEliminarAdjunto.Visible = False BtnEliminarAdjunto.Visible = True
BtnAdjuntar.Visible = False BtnAdjuntar.Visible = False
BtnReemplazarAdjunto.Visible = True BtnReemplazarAdjunto.Visible = True
End If End If
@@ -6007,7 +6007,7 @@ Partial Class Ventas
ObjUsados.Dispose() ObjUsados.Dispose()
BtnsFacturar.Visible = True BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
'VERIFICA SI YA SE FACTURO COMPLETAMENTE 'VERIFICA SI YA SE FACTURO COMPLETAMENTE
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
@@ -6075,7 +6075,7 @@ Partial Class Ventas
If DbRowVenta("TipoDocto").ToString().Contiene("Ped") Then If DbRowVenta("TipoDocto").ToString().Contiene("Ped") Then
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR 'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
If TmpDT.SUM("CantidadFacturadaPed2") < TmpDT.SUM("Cantidad") Then If TmpDT.SUM("CantidadFacturadaPed2") < TmpDT.SUM("Cantidad") Then
BtnsFacturar.Visible = True BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
'bloquear la facturación de remisiones que no estén surtidas 'bloquear la facturación de remisiones que no estén surtidas
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
@@ -15630,7 +15630,7 @@ Partial Class Ventas
If DT.Rows.Count > 0 Then If DT.Rows.Count > 0 Then
'Se agrega movimiento separado por la cuenta de ventas (ER) 'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each Row2 As DataRow In DT.Rows For Each Row2 As DataRow In DT.Rows
importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal) * ValorMultiplicador
importeMX = importeMovimiento * tipoCambio * Multiplicador importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago FechaMovimiento = ObjFactura.FechaPago
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}" Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
@@ -36306,12 +36306,16 @@ Partial Class Ventas
End If End If
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path) My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
If File.Exists(Path) AndAlso Me.CveVenta > 0 Then If File.Exists(Path) Then
Using ObjVta As New ClsVentasTemp If Me.CveVenta > 0 Then
Using ObjVta As New ClsVentas
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then
Alert("Documento cargado", TipoMensaje.MsgInformacion) Alert("Documento cargado", TipoMensaje.MsgInformacion)
End If End If
End Using End Using
Else
Alert("Documento cargado", TipoMensaje.MsgInformacion)
End If
End If End If
BtnAdjuntar.Visible = False BtnAdjuntar.Visible = False
@@ -36360,9 +36364,20 @@ Partial Class Ventas
Dim objVentas As New ClsVentas Dim objVentas As New ClsVentas
Dim Path As String Dim Path As String
Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto) Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto)
If File.Exists(Path) Then If File.Exists(Path) Then
File.Delete(Path) File.Delete(Path)
If Me.CveVenta > 0 Then
Using ObjVta As New ClsVentas
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, "", UsuarioActual.CveEmpresa) Then
Alert("Documento eliminado", TipoMensaje.MsgInformacion)
End If End If
End Using
End If
End If
BtnAdjuntar.Visible = True BtnAdjuntar.Visible = True
BtnArchivoAdjunto.Text = "" BtnArchivoAdjunto.Text = ""
BtnArchivoAdjunto.Visible = False BtnArchivoAdjunto.Visible = False
@@ -38927,181 +38942,161 @@ Partial Class Ventas
End Sub End Sub
Public Class ClsVentasTemp 'Public Class ClsVentasTemp
Implements IDisposable ' Implements IDisposable
#Region "Campos" ' 'SQL
' Private SqlConexion As SqlClient.SqlConnection
' Private SqlAdapter As SqlClient.SqlDataAdapter
' Private SqlCommand As SqlClient.SqlCommand
' Private SqlTransacc As SqlClient.SqlTransaction
' Private Data As DataTable
' Private Dataset As DataSet
'SQL ' 'Atributos de la clase
Private SqlConexion As SqlClient.SqlConnection ' Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
Private SqlAdapter As SqlClient.SqlDataAdapter ' Private CveConexion As Integer = 0
Private SqlCommand As SqlClient.SqlCommand ' Private EsTransaccionCompartida As Boolean = False
Private SqlTransacc As SqlClient.SqlTransaction
Private Data As DataTable
Private Dataset As DataSet
'Atributos de la clase ' Public ReadOnly Property DtResultados() As DataTable
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes ' Get
Private CveConexion As Integer = 0 ' DtResultados = Data
Private EsTransaccionCompartida As Boolean = False ' End Get
' End Property
#End Region
#Region "Propiedades"
Public ReadOnly Property DtResultados() As DataTable
Get
DtResultados = Data
End Get
End Property
#End Region
Public Function IniciaTransacSQL() As SqlClient.SqlTransaction
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
Return SqlTransacc
End Function
Public Sub Commit()
SqlTransacc.Commit()
End Sub
Public Sub RollBack()
SqlTransacc.Rollback()
End Sub
Sub New(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
If TransaccionCompartida Is Nothing Then
SqlConexion = New SqlClient.SqlConnection
SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
Try
SqlConexion.Open()
Catch ex As Exception
OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
End Try
Else
SqlConexion = TransaccionCompartida.Connection
SqlTransacc = TransaccionCompartida
EsTransaccionCompartida = True
End If
SqlAdapter = New SqlClient.SqlDataAdapter("", SqlConexion)
ConexionAdd()
End Sub
Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure)
With SqlAdapter.SelectCommand
.Parameters.Clear()
.CommandText = pStrSQL
.CommandType = TipoComando
End With
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
Data = New DataTable
End Sub
#Region "Conexiones"
Private Sub ConexionAdd()
If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
DataAdapter("PA_Sis_RegistrarConexion")
With SqlAdapter.SelectCommand.Parameters
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
.Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
End With
SqlAdapter.Fill(Data)
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
Catch ex As Exception
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
End If
End Sub
Private Sub ConexionClose()
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
Try
SqlAdapter.Fill(Data)
Catch ex As Exception
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
CveConexion = 0
End If
End Sub
#End Region
Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean ' Public Function IniciaTransacSQL() As SqlClient.SqlTransaction
Dim Retorno As Boolean = False ' If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
DataAdapter("PA_Vta_VentaAdjuntoUpdate") ' Return SqlTransacc
' End Function
With SqlAdapter.SelectCommand.Parameters ' Public Sub Commit()
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta ' SqlTransacc.Commit()
.Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto ' End Sub
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa ' Public Sub RollBack()
End With ' SqlTransacc.Rollback()
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#Region "IDisposable Support"
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
' End Sub ' End Sub
' This code added by Visual Basic to correctly implement the disposable pattern. ' Sub New(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. ' If TransaccionCompartida Is Nothing Then
ConexionClose() ' SqlConexion = New SqlClient.SqlConnection
Dispose(True) ' SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
GC.SuppressFinalize(Me)
End Sub ' Try
#End Region ' SqlConexion.Open()
End Class ' Catch ex As Exception
' OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
' End Try
' Else
' SqlConexion = TransaccionCompartida.Connection
' SqlTransacc = TransaccionCompartida
' EsTransaccionCompartida = True
' End If
' SqlAdapter = New SqlClient.SqlDataAdapter("", SqlConexion)
' ConexionAdd()
' End Sub
' Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure)
' With SqlAdapter.SelectCommand
' .Parameters.Clear()
' .CommandText = pStrSQL
' .CommandType = TipoComando
' End With
' If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
' Data = New DataTable
' End Sub
' Private Sub ConexionAdd()
' If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
' Try
' DataAdapter("PA_Sis_RegistrarConexion")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
' .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
' .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
' End With
' SqlAdapter.Fill(Data)
' CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
' Catch ex As Exception
' OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' End If
' End Sub
' Private Sub ConexionClose()
' If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
' DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
' Try
' SqlAdapter.Fill(Data)
' Catch ex As Exception
' OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' CveConexion = 0
' End If
' End Sub
' Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Vta_VentaAdjuntoUpdate")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
' .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
' End Function
' ' IDisposable
' Protected Overridable Sub Dispose(disposing As Boolean)
' If Not Me.disposedValue Then
' If disposing Then
' ' TODO: dispose managed state (managed objects).
' If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
' If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
' If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
' If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
' If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
' If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
' If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
' End If
' ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' ' TODO: set large fields to null.
' End If
' Me.disposedValue = True
' End Sub
' ' This code added by Visual Basic to correctly implement the disposable pattern.
' Public Sub Dispose() Implements IDisposable.Dispose
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
' ConexionClose()
' Dispose(True)
' GC.SuppressFinalize(Me)
' End Sub
'End Class
End Class End Class