--Correciones de generacion de remision
This commit is contained in:
@@ -1274,7 +1274,7 @@ Namespace Modelos
|
|||||||
ObjFactura.FechaEjecucion = DateTime.Today
|
ObjFactura.FechaEjecucion = DateTime.Today
|
||||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||||
ObjFactura.CondicionesPago = 0
|
ObjFactura.CondicionesPago = 0
|
||||||
ObjFactura.TipoDocumento = "Factura"
|
ObjFactura.TipoDocumento = ObjFactura.TipodeComprobante
|
||||||
|
|
||||||
'Totales, Y se llena TmpDTImpuestos
|
'Totales, Y se llena TmpDTImpuestos
|
||||||
'CLIENTE
|
'CLIENTE
|
||||||
|
|||||||
@@ -79,11 +79,13 @@ Partial Class Boletos
|
|||||||
Dim ObjViaje As New ClsTransportes
|
Dim ObjViaje As New ClsTransportes
|
||||||
|
|
||||||
If ObjContratos.GetContratos(CveViaje, UsuarioActual.CveEmpresa) Then
|
If ObjContratos.GetContratos(CveViaje, UsuarioActual.CveEmpresa) Then
|
||||||
Contrato = ObjContratos.DtResultados
|
Contrato = ObjContratos.DtResultados.Copy()
|
||||||
|
|
||||||
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
|
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||||
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
|
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
|
||||||
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
|
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
|
||||||
DtPasajeros = New DataTable
|
DtPasajeros = New DataTable
|
||||||
|
DtPasajeros.Columns.Add("CveViajePasajero", GetType(Integer))
|
||||||
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
||||||
DtPasajeros.Columns.Add("Nombre", GetType(String))
|
DtPasajeros.Columns.Add("Nombre", GetType(String))
|
||||||
DtPasajeros.Columns.Add("Visa", GetType(String))
|
DtPasajeros.Columns.Add("Visa", GetType(String))
|
||||||
@@ -115,6 +117,9 @@ Partial Class Boletos
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
ObjContratos.Dispose()
|
||||||
|
ObjViaje.Dispose()
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ObjContratos.Dispose()
|
ObjContratos.Dispose()
|
||||||
ObjViaje.Dispose()
|
ObjViaje.Dispose()
|
||||||
@@ -122,8 +127,6 @@ Partial Class Boletos
|
|||||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjContratos.Dispose()
|
|
||||||
ObjViaje.Dispose()
|
|
||||||
|
|
||||||
'Boletos Vendidos
|
'Boletos Vendidos
|
||||||
|
|
||||||
@@ -172,16 +175,16 @@ Partial Class Boletos
|
|||||||
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
|
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
|
||||||
End If
|
End If
|
||||||
If ImporteR > 0 Then
|
If ImporteR > 0 Then
|
||||||
ViewState("Importe") = ImporteR
|
ViewState("Importe") = ImporteR
|
||||||
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
|
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
|
||||||
LbCostos.Visible = True
|
LbCostos.Visible = True
|
||||||
BtnAgregarPasajero.Visible = True
|
BtnAgregarPasajero.Visible = True
|
||||||
Else
|
Else
|
||||||
ViewState("Importe") = 0
|
ViewState("Importe") = 0
|
||||||
BtnAgregarPasajero.Visible = False
|
BtnAgregarPasajero.Visible = False
|
||||||
LbCostos.Visible = False
|
LbCostos.Visible = False
|
||||||
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
|
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjDestinos.Dispose()
|
ObjDestinos.Dispose()
|
||||||
|
|
||||||
@@ -231,9 +234,18 @@ Partial Class Boletos
|
|||||||
Sexo = dr("CveSexo").ToString.ToBool
|
Sexo = dr("CveSexo").ToString.ToBool
|
||||||
Obs = dr("Observaciones").ToString
|
Obs = dr("Observaciones").ToString
|
||||||
|
|
||||||
If ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
Dim CveViajePasajero = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
|
||||||
ObjTransporte.Commit()
|
If Not CveViajePasajero > 1 Then
|
||||||
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If CveViajePasajero < 1 Then
|
||||||
|
TieneError = True
|
||||||
|
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
dr("CveViajePasajero") = CveViajePasajero
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
@@ -245,8 +257,11 @@ Partial Class Boletos
|
|||||||
TieneError = Retorno.TieneError
|
TieneError = Retorno.TieneError
|
||||||
|
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
If Retorno.CveVenta > 0 AndAlso Not Retorno.TieneError Then
|
|
||||||
SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
If Not Retorno.TieneError Then
|
||||||
|
If Retorno.CveVenta <= 0 Then
|
||||||
|
Retorno.TieneError = True
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||||
@@ -259,6 +274,12 @@ Partial Class Boletos
|
|||||||
Else
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||||
|
For Each Mensaje As String In Retorno.Mensajes
|
||||||
|
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||||
|
Next
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
TieneError = True
|
TieneError = True
|
||||||
@@ -278,19 +299,26 @@ Partial Class Boletos
|
|||||||
ObjTransporte.RollBack()
|
ObjTransporte.RollBack()
|
||||||
ObjTransporte.Dispose()
|
ObjTransporte.Dispose()
|
||||||
Else
|
Else
|
||||||
SbAlert.Append("El boleto se genero correctamente.")
|
ObjTransporte.Commit()
|
||||||
DtPasajeros.Clear()
|
|
||||||
|
|
||||||
ObjTransporte.Dispose()
|
ObjTransporte.Dispose()
|
||||||
|
|
||||||
DdlPartida.SelectedValueExist("-1")
|
SbAlert.Append("El boleto se genero correctamente.")
|
||||||
DdlDestino.SelectedValueExist("-1")
|
|
||||||
|
DtPasajeros.Clear()
|
||||||
|
GvB.DataSource = DtPasajeros
|
||||||
|
GvB.DataBind()
|
||||||
|
|
||||||
|
DdlPartida.SelectedIndex = -1
|
||||||
|
'DdlPartida.SelectedValueExist("-1")
|
||||||
|
|
||||||
|
DdlDestino.SelectedIndex = -1
|
||||||
|
'DdlDestino.SelectedValueExist("-1")
|
||||||
|
|
||||||
AsientoSeleccionado = ""
|
AsientoSeleccionado = ""
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||||
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
UpPanel.Update()
|
UpPanel.Update()
|
||||||
@@ -369,50 +397,69 @@ Partial Class Boletos
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
Dim Retorno As New Modelos.Factura.MMensajeFactura
|
||||||
|
|
||||||
Dim CveCliente As Integer = 1154164
|
Dim CveCliente As Integer = 1154164
|
||||||
Dim CveMoneda As Integer = 2
|
Dim CveMoneda As Integer = 2
|
||||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
|
Dim CveSubProyecto As Integer = -1
|
||||||
|
|
||||||
|
Dim CvePSBoleto As Integer = 912720
|
||||||
|
|
||||||
|
If EsProduccion Then
|
||||||
|
CvePSBoleto = 986337
|
||||||
|
CveCliente = 1172306
|
||||||
|
End If
|
||||||
|
|
||||||
If CveCliente <= 0 Then
|
If CveCliente <= 0 Then
|
||||||
Retorno.Mensajes.Add("No se pudo cargar el cliente")
|
Retorno.Mensajes.Add("No se pudo cargar el cliente")
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveSubProyecto <= 0 Then
|
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, -1, CveCliente, CveMoneda, "Rem")
|
||||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
|
||||||
Return Retorno
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
If ObjFactura IsNot Nothing Then
|
||||||
|
'TOMA EL SUBPROYECTO DEL CLIENTE
|
||||||
|
CveSubProyecto = ObjFactura.Cliente.CveSubProyecto
|
||||||
|
|
||||||
Dim CvePSBoleto As Integer = 912720
|
If CveSubProyecto <= 0 Then
|
||||||
|
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||||
For Each Dr As DataRow In DtPasajeros.Rows
|
|
||||||
Dim Obs = Dr("Nombre").ToString
|
|
||||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
|
||||||
If Importe <= 0 Then
|
|
||||||
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0)
|
ObjFactura.CveSubProyecto = CveSubProyecto
|
||||||
Next
|
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||||
|
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||||
|
ObjFactura.SetSubProyecto()
|
||||||
|
ObjFactura.SetSubProyectoMatriz()
|
||||||
|
|
||||||
ObjFactura.CalculaTotales()
|
For Each Dr As DataRow In DtPasajeros.Rows
|
||||||
|
Dim Obs = Dr("Nombre").ToString
|
||||||
|
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||||
|
If Importe <= 0 Then
|
||||||
|
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
||||||
|
Return Retorno
|
||||||
|
End If
|
||||||
|
|
||||||
Try
|
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0, CveViajePasajero:=Dr("CveViajePasajero").ToString().ToEntero())
|
||||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
Next
|
||||||
Catch ex As Exception
|
|
||||||
Retorno = Nothing
|
|
||||||
GuardaLog(ex.ToString())
|
|
||||||
End Try
|
|
||||||
|
|
||||||
If ObjFactura IsNot Nothing Then
|
ObjFactura.CalculaTotales()
|
||||||
ObjFactura.Dispose()
|
|
||||||
|
Try
|
||||||
|
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||||
|
Catch ex As Exception
|
||||||
|
Retorno = Nothing
|
||||||
|
GuardaLog(ex.ToString())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
If ObjFactura IsNot Nothing Then
|
||||||
|
ObjFactura.Dispose()
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Retorno.Mensajes.Add("No se pudo generar la factura")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user