diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 6c8520fef..e09c65bf0 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -2010,6 +2010,25 @@ Public Class ClsCompras Return Retorno End Function + Public Function GetComprasPagos(CveCompra As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_ComprasPagosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al refacturar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RefacturacionPoliza(IdPoliza As Integer, CvePrePoliza As Integer, CveCompra As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_RefacturacionPoliza") diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 3855b52f3..925c4074e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -10,7 +10,6 @@ Imports System.Threading.Tasks Imports Newtonsoft.Json Imports Extensiones Imports MoreLinq -Imports ClbNegBICFDv3_3 Partial Class Compras_Compras Inherits ClsPaginas @@ -7035,7 +7034,7 @@ Partial Class Compras_Compras 'EMPIEZA REFACTURACION If Not ErrorPrepoliza AndAlso CveCompraRefacturacion > 0 Then - ErrorBitacora = GuardaRefacturacion(ObjCompras, ObjEventos, CvePrePoliza) + ErrorBitacora = GuardaRefacturacion(ObjCompras, ObjEventos, CvePrePoliza, ObjConta, CompraActual) If ErrorBitacora Then Alert("Ocurrió un error al hacer la Refacturación", TipoMensaje.MsgError) End If @@ -13098,7 +13097,7 @@ Partial Class Compras_Compras RegistraScript(String.Format("$('#{0}').modal('hide')", DivRefacturacion.ClientID)) End Sub - Private Function GuardaRefacturacion(ByRef ObjCompra As ClsCompras, ByRef ObjEventos As ClsOIEventos, CvePrePoliza As Integer) As Boolean + Private Function GuardaRefacturacion(ByRef ObjCompra As ClsCompras, ByRef ObjEventos As ClsOIEventos, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad, ByRef CompraActual As Compra) As Boolean Dim dr As DataRow = Nothing Dim ErrorBitacora As Boolean = False Dim IdPolizaAnterior As Integer = -1 @@ -13118,8 +13117,28 @@ Partial Class Compras_Compras If ChkRefacNC.Checked Then Tipo = 2 'CONTABILIZA REFACTURACION - If Not ObjCompra.Refacturacion(CveCompraRefacturacion, CveCompra, UsuarioActual.CveEmpresa, Tipo) Then + If ObjCompra.Refacturacion(CveCompraRefacturacion, CveCompra, UsuarioActual.CveEmpresa, Tipo) Then + Dim dttpagos As DataTable + If ObjCompra.GetComprasPagos(CveCompraRefacturacion, UsuarioActual.CveEmpresa) Then + dttpagos = ObjCompra.DtResultados + + For Each drp As DataRow In dttpagos.Rows + Dim Pago As New CompraPago + Pago.ImportePago = drp("ImporteMN").ToString.ToDecimal + Pago.CveIE = drp("CveIE").ToString.ToEntero + Pago.CveMonedaPago = 1 + Pago.CveCompraAmortizacion = -1 + Pago.TipoPago = If(drp("CveIE").ToString.ToEntero > 0, "B", "NC") + + Dim ErrorMovtosCxP As Boolean = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) + Next + + End If + + Else + ErrorBitacora = True + End If diff --git a/Transportes/RepBoletos.aspx.vb b/Transportes/RepBoletos.aspx.vb index 7645b2807..11e309130 100644 --- a/Transportes/RepBoletos.aspx.vb +++ b/Transportes/RepBoletos.aspx.vb @@ -8,6 +8,7 @@ Imports Extensiones.ModExtensiones Partial Class ListadoBoletos Inherits ClsPaginas +#Region "Propiedades" Private Property CveViaje As Integer Get Return ViewState("CveViaje").ToString().ToEntero @@ -24,6 +25,9 @@ Partial Class ListadoBoletos ViewState("Ruta") = value End Set End Property +#End Region + +#Region "Carga Página" Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then If Request.QueryString("CveViaje") Is Nothing Then @@ -44,6 +48,7 @@ Partial Class ListadoBoletos ObjTransportes.Dispose() GvBoletos.DataBind() End Sub +#End Region Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 1b34d1045..b23901098 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -469,8 +469,7 @@
- - Nombre + Nombre
@@ -478,8 +477,7 @@
- - Visa + Visa
@@ -487,14 +485,14 @@
- Celular + Celular
- Observacion
@@ -502,17 +500,21 @@
- Sexo + + + +
- - Estatus + + Estatus
diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index 8ffd44810..63702d640 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -118,6 +118,10 @@ Partial Class RepContratoDetalle If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then Contrato = ObjContratos.DtResultados If Contrato IsNot Nothing AndAlso Contrato.Rows.Count > 0 Then + Dim Dolares As Decimal = Contrato.Rows(0)("Importe").ToString.ToDecimal + Dim Pesos As Decimal = Contrato.Rows(0)("ImporteMax").ToString.ToDecimal + Dim Anticipo As Decimal = Contrato.Rows(0)("ImporteMin").ToString.ToDecimal + CveContratoTipo = Contrato.Rows(0)("CveContratoTipo").ToString.ToEntero SubProyecto = Contrato.Rows(0)("SubProyecto").ToString CveMasivo = Contrato.Rows(0)("CveMasivo").ToString.ToEntero @@ -132,13 +136,12 @@ Partial Class RepContratoDetalle TxtFechaRegreso.Text = Contrato.Rows(0)("FechaFinal").ToString TxtCantidadPasajeros.Text = Contrato.Rows(0)("CantidadPasajeros").ToString DdlTipoAF.SelectedValue = If(Contrato.Rows(0)("CveTipoAF") Is Nothing, "", Contrato.Rows(0)("CveTipoAF").ToString) - TxtDolares.Text = Contrato.Rows(0)("Importe").ToString - TxtPesos.Text = Contrato.Rows(0)("ImporteMax").ToString - TxtAnticipo.Text = Contrato.Rows(0)("ImporteMin").ToString + TxtDolares.Text = Math.Round(Dolares, 2).ToString + TxtPesos.Text = Math.Round(Pesos, 2).ToString + TxtAnticipo.Text = Math.Round(Anticipo, 2).ToString CveContratoEstatus = Contrato.Rows(0)("CveContratosEstatus").ToString.ToEntero If Not IsDBNull(ObjContratos.Archivo) AndAlso ObjContratos.Archivo <> "" AndAlso ObjContratos.Archivo <> "-1" AndAlso ObjContratos.Archivo <> $"{ObjContratos.CveContrato}." Then ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "CONTRATOS", ObjContratos.Archivo) - 'A2.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CONTRATO&CveEmpresa={0}&Archivo={1}", ObjContratos.CveEmpresa, ViewState("FUrl").ToString))) BtnDescargar.Visible = True Else BtnDescargar.Visible = False @@ -194,8 +197,7 @@ Partial Class RepContratoDetalle File.Move(fileItem.FileUrl, ViewState("FUrl").ToString) TxtArchivo.Text = tempArray(1) - ' imgFileOk.Visible = True - 'ImgArchivo.Src = "/imagenes/accept.png" + Next UPAFUL.Update() @@ -302,19 +304,21 @@ Partial Class RepContratoDetalle RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar")) End Sub Protected Sub UpdateBoleto(sender As Object, e As EventArgs) - For Each boleto As DataRow In ViajeActual.Rows - If (boleto.Item("Asiento").ToString = TxtAsiento.Text) Then - Alert($"El asiento {boleto.Item("Asiento")} ya ha está ocupado", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - Next + If PnEditarViaje.Visible = True Then + For Each boleto As DataRow In ViajeActual.Rows + If (boleto.Item("Asiento").ToString = TxtAsiento.Text) Then + Alert($"El asiento {boleto.Item("Asiento")} ya ha está ocupado", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Next + End If Dim ObjTransportes As New ClsTransportes Try ObjTransportes.IniciaTransacSQL() - If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, TxtEstatus.Text.ToBool, UsuarioActual.CveUsuario, TxtSexo.Text.ToBool) Then + If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, TxtEstatus.Text.ToBool, UsuarioActual.CveUsuario, RblSexo.SelectedValue.ToBool) Then ObjTransportes.Commit() End If Catch ex As ArgumentException @@ -381,7 +385,7 @@ Partial Class RepContratoDetalle New ReportParameter("Nombre", GvRow.DataKey("Nombre")), New ReportParameter("Visa", GvRow.DataKey("Visa")), New ReportParameter("Celular", GvRow.DataKey("Celular")), - New ReportParameter("Importe", Math.Round(Importe, 1).ToString), + New ReportParameter("Importe", Math.Round(Importe, 2).ToString), New ReportParameter("TipoBoleto", "Tipo Boleto"), New ReportParameter("Agencia", "Agencia"), New ReportParameter("TelefonoAgencia", "TelefonoAgencia"), @@ -403,15 +407,19 @@ Partial Class RepContratoDetalle Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero + DdlRuta.SelectedValue = GvRow.DataKey("CveViaje") LbPartida.Text = GvRow.DataKey("Partida").ToString() LbDestino.Text = GvRow.DataKey("Destino").ToString() LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") TxtNombre.Text = GvRow.DataKey("Nombre").ToString() TxtVisa.Text = GvRow.DataKey("Visa").ToString() TxtCelular.Text = GvRow.DataKey("Celular").ToString() - TxtSexo.Text = GvRow.DataKey("Sexo").ToString() + RblSexo.SelectedValue = If(GvRow.DataKey("Sexo").ToString.ToBool, "1", "0") TxtObservacion.Text = GvRow.DataKey("Observacion").ToString() - TxtEstatus.Text = GvRow.DataKey("Estatus").ToString() + LbEstatus.Text = If(GvRow.DataKey("Estatus").ToString.ToBool, "Activo", "Cancelado") + TxtEstatus.Text = GvRow.DataKey("Estatus").ToString + LbEstatus.CssClass = If(GvRow.DataKey("Estatus").ToString.ToBool, "text-success bold", "text-danger bold") + TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() UpTabContainer.Update() UpModal.Update() @@ -432,9 +440,9 @@ Partial Class RepContratoDetalle TxtNombre.Text = GvRow.DataKey("Nombre").ToString() TxtVisa.Text = GvRow.DataKey("Visa").ToString() TxtCelular.Text = GvRow.DataKey("Celular").ToString() - TxtSexo.Text = GvRow.DataKey("Sexo").ToString() + RblSexo.SelectedValue = If(GvRow.DataKey("Sexo").ToString.ToBool, "1", "0") TxtObservacion.Text = GvRow.DataKey("Observacion").ToString() - TxtEstatus.Text = GvRow.DataKey("Estatus").ToString() + LbEstatus.Text = GvRow.DataKey("Estatus").ToString() LbCreado.Text = GvRow.DataKey("FechaIng").ToString() TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() @@ -464,7 +472,7 @@ Partial Class RepContratoDetalle TxtNombre.Text = GvRow.DataKey("Nombre").ToString() TxtVisa.Text = GvRow.DataKey("Visa").ToString() TxtCelular.Text = GvRow.DataKey("Celular").ToString() - TxtSexo.Text = GvRow.DataKey("Sexo").ToString() + RblSexo.SelectedValue = If(GvRow.DataKey("Sexo").ToString.ToBool, "1", "0") TxtObservacion.Text = GvRow.DataKey("Observacion").ToString() TxtEstatus.Text = GvRow.DataKey("Estatus").ToString() LbCreado.Text = GvRow.DataKey("FechaIng").ToString() @@ -474,7 +482,7 @@ Partial Class RepContratoDetalle Try ObjTransportes.IniciaTransacSQL() - If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, Estatus, UsuarioActual.CveUsuario, TxtSexo.Text.ToBool) Then + If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, Estatus, UsuarioActual.CveUsuario, RblSexo.SelectedValue.ToBool) Then Alert("Se ha modificado el estatus de su boleto correctamente.") ObjTransportes.Commit()