This commit is contained in:
2024-10-17 16:23:09 -07:00
7 changed files with 96 additions and 102 deletions

View File

@@ -343,60 +343,6 @@ Public Class ClsContabilidad
Public Function UpdatePrePolizasDetalleContrato(CvePrePolizaDetalle As Integer, Concepto As String, CveSubProyecto As Integer, IdCtaContable As Integer, TipoMovto As Boolean, ImporteMN As Decimal, Optional CveTipoGasto As Integer = -1,
Optional CveConceptoContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCompra As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveCliente As Integer = -1, Optional CveVenta As Integer = -1,
Optional Referencia As String = "-1", Optional CveUsuarioModifico As Integer = -1, Optional CveCuenta As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1, Optional Importe As Decimal = -1, Optional CveIE As Integer = -1,
Optional TipoCambio As Decimal = -1, Optional CveClasificacion As Integer = -1, Optional ImporteME As Decimal = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_PrePolizasDetalleContratoUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePolizaDetalle", SqlDbType.Int).Value = CvePrePolizaDetalle
.Add("@Concepto", SqlDbType.VarChar).Value = Concepto
.Add("@Referencia", SqlDbType.VarChar).Value = Referencia
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable
.Add("@TipoMovto", SqlDbType.Bit).Value = TipoMovto
.Add("@TipoCambio", SqlDbType.Decimal).Value = TipoCambio
.Add("@ImporteMN", SqlDbType.Money).Value = ImporteMN
.Add("@Importe", SqlDbType.Money).Value = Importe
.Add("@ImporteME", SqlDbType.Money).Value = ImporteME
.Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto
.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
.Add("@CveIE", SqlDbType.Int).Value = CveIE
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
If ex.Message.Contains("CuentasResultados_SubProyectos") Then
OnError("El concepto requiere que se le especifique centro de costo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
ElseIf ex.Message.Contains("50015") Then
OnError("No se puede eliminar una póliza en un ejercicio Cerrado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
Else
If ex.Message.Contains("concepto de bancos con un importe diferente") Then
OnError("No se puede editar el valor del bancos con un valor diferente a movimiento registrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
Else
OnError("Ocurrió un error al Actualizar la Prepoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End If
End If
End Try
Return Retorno
End Function
Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Integer

View File

@@ -1,22 +1,27 @@
<%@ WebHandler Language="VB" Class="SIGFacturacion" %>
<%@ WebHandler Language="VB" Class="E194" %>
Option Strict On
Option Explicit On
Imports System
Imports System.Web
Imports System.Net.Http
Imports System.Web.Http
Imports System.Data
Imports System.IO
Imports System.Net.Http
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports Extensiones
Imports System.IO
Imports Modelos
Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
Public Class E194 : Implements IHttpHandler, System.Web.SessionState.IRequiresSessionState
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
Private Property CveEmpresaFacturar As Integer = 194
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/plain"
context.Response.ContentType = "text/html"
Dim Retorno As Boolean = False
Try
@@ -38,6 +43,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
ex.GuardaLog(ex.Message)
End Try
context.Response.StatusCode = 200
If Retorno Then
context.Response.Write("True")
Else
@@ -46,12 +52,6 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
Private Function IniciaFacturacionMasiva(pCveEmpresa As String, pFechaI As String, pFechaF As String) As Boolean
Dim Retorno As Boolean = True
Dim JsonRetorno As New JObject()
@@ -278,7 +278,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
ObjFactura.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio
ObjFactura.Serie = Serie
ObjFactura.Folio = Folio.ToEntero()
ObjFactura.TipoMensajeRespuesta = TipoMensajeRespuesta.TextoLimpio
ObjFactura.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio
ObjFactura.Version = "4.0"
ObjFactura.FolioFiscal = ""
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
@@ -315,8 +315,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
ObjFactura.CveSubProyecto = CveSubProyecto
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
ObjFactura.SubProyecto = New SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
ObjFactura.SubProyectoMatriz = New SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=-1 ).FiltroPrimero("TipoSucursal=1"))
ObjFactura.SubProyecto = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
ObjFactura.SubProyectoMatriz = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=-1).FiltroPrimero("TipoSucursal=1"))
ObjFactura.SubProyectoMatriz = New Modelos.SubProyectoModel(ClsPaginas.GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=-1).FiltroPrimero("TipoSucursal=1"))
'CLIENTE
ObjFactura.CveCliente = CveCliente
@@ -426,7 +427,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
Timbre.Comprobante.Subtotal = Obj.SubTotal
Timbre.Comprobante.SubTotal = Obj.SubTotal
Timbre.Comprobante.Descuentos = Obj.Descuento
Timbre.Comprobante.Moneda = Obj.MonedaSAT
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
@@ -909,7 +910,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
' strLineaTMP = Chr(13) & Chr(10) & Day(NowADS()) & "/" & Month(NowADS()) & "/" & Year(NowADS()) & " " & Hour(NowADS()) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10)
strLineaTMP = String.Format("{0}{1}Log: {2}{3}:{4}", Chr(13), Chr(10), Str, ClsPaginas.NowADS().ToShortDateString, ClsPaginas.NowADS().ToShortTimeString)
Try
ArchivoW = New StreamWriter(String.Format("{0}\Log\LogFacturacion.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
ArchivoW = New StreamWriter(String.Format("{0}\Log\LogE194.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
Catch ex As UnauthorizedAccessException
'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError)
Exit Sub
@@ -926,7 +927,4 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
ArchivoW.Dispose()
End Sub
End Class

View File

@@ -3208,7 +3208,13 @@ Partial Class Inventarios_RecepcionUsados
CveMarca = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimeroValor("CveMarca", "").ToEntero
Dim dtt As DataTable = GlobalDTAcumGarantiasTipoUsoMeses(UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero)
Dim DtAcumMeses As DataTable = GlobalDTAcumGarantiasTipoUsoMeses(UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero)
Dim Dtt As DataTable = Nothing
If DtAcumMeses IsNot Nothing Then
''obtener siempre y cuando la fecha de inicio sea mayor
Dim strDate As Date = ($"20{TxtEtiqueta.Text.Substring(2, 2)}/{TxtEtiqueta.Text.Substring(0, 2)}/01").ToDate
Dtt = DtAcumMeses.FiltraParametros($" #{strDate.ToString("yyyy/MM/dd")}# >= FechaInicioVigencia ", "FechaInicioVigencia DESC")
End If
If dtt IsNot Nothing Then
If dtt.Rows.Count > 0 Then

View File

@@ -15,10 +15,18 @@
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
/* #C_Tab_ctl00_DdlClientes #select2-C_Tab_ctl00_DdlClientes_ddlWS-container #C_Tab_ctl00_DdlClientes_ddlWS{
width:100%!important;
}
#C_Tab_ctl00_DdlClientes{
width:100%!important;
}*/
.mx-1 {
margin: 0 5px 0 5px;
}
.disponible {
font-size: 10px;
display: inline-block;
@@ -115,6 +123,7 @@
</div>
<div class="portlet-body rowpadding">
<div class="row my-1">
<label class="col-md-4 bold text-primary">Folio</label>
<asp:TextBox class="col-md-2" runat="server" ID="TxtFolio" Text="" MaxLength="50" style="margin-left:15px" Width="120px" Height="34px"></asp:TextBox>
@@ -126,17 +135,20 @@
</div>
</div>
<div class="row my-1">
<label class="col-md-4">Cliente</label>
<div class="col-md-8">
<div class="input-group">
<ADS:Dropdownlost ID="DdlClientes" CssClass="form-control" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente"
UsaWebService="true" Enabled="false"></ADS:Dropdownlost>
<div class="input-group-addon" style="background-color: #428bca">
<asp:HyperLink id="HplAddCliente" runat="server" ForeColor="White" Text="<i class='fa fa-add'></i>"
navigateUrl="/Ventas/Clientes.aspx?CveCliente=-1"></asp:HyperLink>
</div>
<div class="row " style="border:0px!important">
<label class="col-md-4">Cliente</label>
<div class="col-md-7" >
<ADS:Dropdownlost ID="DdlClientes" data-metodo="getcliente" style ="width:100%!important"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" Width="100%" CssStyle="width: 100%;"
UsaWebService="true" Enabled="false">
</ADS:Dropdownlost>
</div>
<div class="col-md-1">
<div class="input-group-addon" style="background-color: #428bca;width:26px!important" >
<asp:HyperLink id="HplAddCliente" runat="server" ForeColor="White" Text="<i class='fa fa-add'></i>"
navigateUrl="/Ventas/Clientes.aspx?CveCliente=-1"></asp:HyperLink>
</div>
</div>
</div>

View File

@@ -173,6 +173,35 @@ Partial Class RepContratoDetalle
End Property
Private Property TipoAFOriginal As String
Get
If ViewState("TipoAFOriginal") Is Nothing Then
ViewState("TipoAFOriginal") = ""
End If
Return ViewState("TipoAFOriginal").ToString
End Get
Set(value As String)
ViewState("TipoAFOriginal") = value
End Set
End Property
Private Property FolioOriginal As String
Get
If ViewState("FolioOriginal") Is Nothing Then
ViewState("FolioOriginal") = ""
End If
Return ViewState("FolioOriginal").ToString
End Get
Set(value As String)
ViewState("FolioOriginal") = value
End Set
End Property
@@ -248,6 +277,8 @@ Partial Class RepContratoDetalle
CveMonedaOriginal = Contrato.Rows(0)("CveMoneda").ToString.ToEntero
ImporteOrigial = Importe
DescripcionOriginal = Contrato.Rows(0)("DescripcionContrato").ToString
TipoAFOriginal = DdlTipoAF.SelectedItem.Text
FolioOriginal = TxtFolio.Text.Trim
CveVentaRemision = Contrato.Rows(0)("CveVentaRemision").ToString.ToEntero
HypRemision.Text = Contrato.Rows(0)("RemisionSerieFolio").ToString
@@ -391,8 +422,10 @@ Partial Class RepContratoDetalle
If Not ErrorProceso Then
If CveSubProyectoOriginal <> DdlSubProyecto.SelectedValue.ToEntero Or CveMonedaOriginal <> DdlMoneda.SelectedValue.ToEntero Or ImporteOrigial <> TxtImporte.Text.ToDecimal Or DescripcionOriginal <> TxtDescripcion.Text Then
If Not UpdateRemision(ObjContratos.IniciaTransacSQL(), DdlSubProyecto.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtImporte.Text.ToDecimal, TxtDescripcion.Text) Then
If CveSubProyectoOriginal <> DdlSubProyecto.SelectedValue.ToEntero Or CveMonedaOriginal <> DdlMoneda.SelectedValue.ToEntero Or ImporteOrigial <> TxtImporte.Text.ToDecimal Or DescripcionOriginal <> TxtDescripcion.Text Or
TipoAFOriginal <> DdlTipoAF.SelectedItem.Text Or FolioOriginal <> TxtFolio.Text.Trim Then
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{TxtFolio.Text}"
If Not UpdateRemision(ObjContratos.IniciaTransacSQL(), DdlSubProyecto.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtImporte.Text.ToDecimal, ObsRemisionPartida) Then
ErrorProceso = True
End If
End If
@@ -554,7 +587,7 @@ Partial Class RepContratoDetalle
'End If
If Not ObjVentas.UpdateVentas(SubTotalNew, 0, IVANew, 0, TotalNew, CveMonedaNew, TC, FechaVenta, "",
If Not ObjVentas.UpdateVentas(SubTotalNew, 0, IVANew, 0, TotalNew, CveMonedaNew, TC, FechaVenta, DescripcionNew,
UsuarioActual.CveEmpresa, CveVentaRemision,
Vigencia:=FechaVenta, CondicionesPago:=-1,
PedidoContrato:="-1", AtencionA:="-1", CveMetodoPago33:=-1,
@@ -602,7 +635,7 @@ Partial Class RepContratoDetalle
For Each dRow As DataRow In DTPrePoliza.Rows
If Not ObjConta.UpdatePrePolizasDetalleContrato(dRow("CvePrePolizaDetalle").ToString.ToEntero, dRow("Concepto").ToString, dRow("CveSubProyecto").ToString.ToEntero, -1, Boolean.Parse(dRow("TipoMovto").ToString), ImporteMN:=(TotalNew * TC), Importe:=TotalNew, TipoCambio:=TC, ImporteME:=If(CveMonedaNew = 2, TotalNew, 0)) Then
If Not ObjConta.UpdatePrePolizasDetalle(dRow("CvePrePolizaDetalle").ToString.ToEntero, dRow("Concepto").ToString, dRow("CveSubProyecto").ToString.ToEntero, -1, Boolean.Parse(dRow("TipoMovto").ToString), ImporteMN:=(TotalNew * TC), Importe:=TotalNew, TipoCambio:=TC) Then
OcurrioError = True
Exit For
End If

View File

@@ -267,7 +267,7 @@
<div class="col-md-8">
<div class="input-group">
<ADS:Dropdownlost ID="DdlClientes" CssClass="form-control" data-metodo="getcliente" Width="100%" CssStyle="width: 100%;"
<ADS:Dropdownlost ID="DdlClientes" data-metodo="getcliente" Width="100%" CssStyle="width: 100%;"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente"
UsaWebService="true" Enabled="false"></ADS:Dropdownlost>
<div class="input-group-addon" style="background-color: #428bca">
@@ -288,10 +288,7 @@
<asp:DropDownList runat="server" ID="DdlSubProyectoModal" Width="100%" DataValueField="CveSubProyecto" DataTextField="SubProyecto" CssClass="select2me"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvDdlSubProyectoModal" runat="server" ControlToValidate="DdlSubProyectoModal" InitialValue="-1" ErrorMessage="Campo sub Proyecto requerido." Display="None"
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VceRfvDdlSubProyectoModal" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlSubProyectoModal" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTipoAF" Width="400px">
</ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VceRfvDdlSubProyectoModal" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlSubProyectoModal" Width="300px"></ajax:ValidatorCalloutExtender>
<%-- <div class="input-group-addon" style="background-color: #428bca">
<asp:LinkButton runat="server" ForeColor="White" Text="<i class='fa fa-add'></i>"

View File

@@ -174,9 +174,11 @@ Partial Class ListadoContratos
If ErrorProceso = False Then
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{LbFolio.Text}"
Dim Respuesta As New RespuestaFacturacion()
Dim CvePS As Integer = 907784
Respuesta = GeneraRemision(CveContrato, LbFolio.Text, TxtImporte.Text.ToDecimal, CvePS, ObjContratos.IniciaTransacSQL)
Respuesta = GeneraRemision(CveContrato, ObsRemisionPartida, TxtImporte.Text.ToDecimal, CvePS, ObjContratos.IniciaTransacSQL)
If Respuesta.CveVenta > 0 Then
CveVentaRemision = Respuesta.CveVenta
@@ -310,7 +312,7 @@ Partial Class ListadoContratos
#Region "G E N E R A R E M I S O N"
Private Function GeneraRemision(CveContrato As Integer, NumContrato As String, Importe As Decimal, CvePS As Integer, ByRef TransaccionSQL As SqlClient.SqlTransaction) As RespuestaFacturacion
Private Function GeneraRemision(CveContrato As Integer, ObsPartida As String, Importe As Decimal, CvePS As Integer, ByRef TransaccionSQL As SqlClient.SqlTransaction) As RespuestaFacturacion
Dim Respuesta As New RespuestaFacturacion()
Dim CveRemisionGenerada As Integer = -1
@@ -324,7 +326,7 @@ Partial Class ListadoContratos
If ObjFactura IsNot Nothing AndAlso ProcesoOK Then
ObjFactura.CveContrato = CveContrato
ObjFactura.Observaciones = NumContrato
ObjFactura.Observaciones = ObsPartida
ObjFactura.CveFormaPago33 = 20 ' por definir
Dim TmpDTMat As New DataTable
@@ -342,7 +344,7 @@ Partial Class ListadoContratos
Dim SubTotal As Decimal = (Importe / (1D + PorcentajeIVA))
Dim PU As Decimal = SubTotal
Dim Descuento As Decimal = 0
Dim Obs As String = NumContrato
Dim Obs As String = ObsPartida
If CantidadRegistro > 0 Then
If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=PorcentajeIVA) Then