From 9dcc6683aa9f8ff519dcc0bb0313e3d7d95184b6 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 30 Jul 2024 10:07:02 -0700 Subject: [PATCH] VyA asignar uno o dos choferes --- App_Code/CalendarEvent.vb | 7 +- Ashx/CargaEventos.ashx | 14 ++- Transportes/RepContratoDetalle.aspx | 8 +- Transportes/RepContratoDetalle.aspx.vb | 10 ++ Transportes/RepContratos.aspx.vb | 112 ++++++++++++++++++++- Transportes/RepContratosCalendario.aspx | 36 ++++--- Transportes/RepContratosCalendario.aspx.vb | 47 ++++++++- 7 files changed, 210 insertions(+), 24 deletions(-) diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index f9dd8c193..6bd2224a0 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -47,6 +47,11 @@ Public Class CalendarEvent Public Property SerieFolioCompra As String Public Property CveVenta As Integer Public Property SerieFolioVenta As String + + Public Property CveVentaRemision As Integer = -1 + Public Property RemisionSerieFolio As String = "" + Public Property RemisionSaldo As Decimal = -1 + Public Property CveActivoFijo As Integer Public Property CveTipoAF As Integer @@ -65,6 +70,6 @@ Public Class CalendarEvent Public Property CveMoneda As Integer Public Property Moneda As String Public Property NumChoferes As Integer = 1 - + Public Property TipoEstatus As Integer = -1 End Class diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index 692d486d6..323dcd810 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -560,10 +560,18 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.Moneda = dr("Moneda").ToString cevent.NumChoferes = dr("NumChoferes").ToString.ToEntero - If dr("CveChofer").ToString.ToEntero <= 0 Or (dr("CveChofer2").ToString.ToEntero <= 0 And cevent.NumChoferes = 2) Or dr("CveAF").ToString.ToEntero <= 0 Then - cevent.backgroundColor = "#bc9b1b" - End If + cevent.CveVentaRemision = dr("CveVentaRemision").ToString.ToEntero + cevent.RemisionSerieFolio = dr("RemisionSerieFolio").ToString + cevent.RemisionSaldo = dr("RemisionSaldo").ToString.ToDecimal + cevent.TipoEstatus = dr("TipoEstatus").ToString.ToEntero + cevent.backgroundColor = dr("backgroundColor").ToString + Dim BGC_Atencion As String = "#bc9b1b" + If cevent.TipoEstatus <> 4 AndAlso cevent.TipoEstatus <> 3 Then + If dr("CveChofer").ToString.ToEntero <= 0 Or (dr("CveChofer2").ToString.ToEntero <= 0 And cevent.NumChoferes = 2) Or dr("CveAF").ToString.ToEntero <= 0 Then + cevent.backgroundColor = BGC_Atencion + End If + End If diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 5812337ce..55fd4775b 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -117,7 +117,13 @@
- + +
+ +
+
+ +
diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index a50e74d4c..861580b69 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -165,6 +165,16 @@ Partial Class RepContratoDetalle CveContratoEstatus = Contrato.Rows(0)("CveContratosEstatus").ToString.ToEntero DdlSubProyecto.SelectedValueExist(Contrato.Rows(0)("CveSubProyecto").ToString) + + HypRemision.Text = Contrato.Rows(0)("RemisionSerieFolio").ToString + HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ Contrato.Rows(0)("CveVentaRemision").ToString}" + + If Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal > 0 Then + LblSaldo.Text = $"Saldo { Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}" + Else + LblSaldo.Text = "" + End If + 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) BtnDescargar.Visible = True diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index f1b92413e..dcc7264f5 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -104,6 +104,9 @@ Partial Class ListadoContratos Dim Filename As String = "" Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") + Dim CveVentaRemision As Integer = -1 + Dim SerieFolioRemision As String = "" + If Not Directory.Exists(folderContratosPath) Then Directory.CreateDirectory(folderContratosPath) End If @@ -163,6 +166,23 @@ Partial Class ListadoContratos End If Anexo.Text = "" + If ErrorProceso = False Then + + Dim Respuesta As New RespuestaFacturacion() + Dim CvePS As Integer = 907783 + Respuesta = GeneraRemision(CveContrato, LbFolio.Text, TxtImporte.Text.ToDecimal, CvePS, ObjContratos.IniciaTransacSQL) + + If Respuesta.CveVenta > 0 Then + CveVentaRemision = Respuesta.CveVenta + SerieFolioRemision = Respuesta.SerieFolio + ErrorProceso = False + Else + ErrorProceso = True + Alert("se presento un error al generar la remisión", TipoMensaje.MsgAdvertencia) + End If + + End If + Else ErrorProceso = True End If @@ -177,7 +197,7 @@ Partial Class ListadoContratos If Not ErrorProceso Then ObjContratos.Commit() - Alert("Agregado Correctamente.") + Alert($"Agregado Correctamente.
Remisión Generada {SerieFolioRemision}") Else ObjContratos.RollBack() Alert("Se presento un error al guardar el contrato.", TipoMensaje.MsgAdvertencia) @@ -287,4 +307,94 @@ Partial Class ListadoContratos End Sub #End Region + +#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 + + Dim Respuesta As New RespuestaFacturacion() + Dim CveRemisionGenerada As Integer = -1 + Dim ObjVentas As New ClsVentas(TransaccionSQL) + Dim ProcesoOK As Boolean = True + Dim CveSubProyecto As Integer = DdlSubProyectoModal.SelectedValue.ToEntero + Dim CveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero + + Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, DdlClientes.SelectedValue.ToEntero, CveMoneda, "Rem") + + If ObjFactura IsNot Nothing AndAlso ProcesoOK Then + + ObjFactura.CveContrato = CveContrato + ObjFactura.Observaciones = NumContrato + + Dim TmpDTMat As New DataTable + TmpDTMat.Columns.Add("Consec", GetType(Integer)) + TmpDTMat.Columns.Add("CvePS", GetType(Integer)) + TmpDTMat.Columns.Add("CveUM", GetType(Integer)) + TmpDTMat.Columns.Add("Cantidad", GetType(Integer)) + TmpDTMat.Columns.Add("PU", GetType(Decimal)) + TmpDTMat.Columns.Add("Lote", GetType(String)) + TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date)) + TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer)) + + + Dim SubTotal As Decimal = (Importe / (1 + 0.16)).ToDecimal + + 'Dim CvePS As Integer = 907783 + Dim CantidadRegistro As Decimal = 1 + Dim PorcentajeIVA As Decimal = 0.16D + + Dim PU As Decimal = SubTotal + Dim Descuento As Decimal = 0 + Dim Obs As String = NumContrato + + + If CantidadRegistro > 0 Then + If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=PorcentajeIVA) Then + Dim drp As DataRow = TmpDTMat.NewRow + drp("CvePS") = CvePS + drp("Cantidad") = CantidadRegistro + drp("PU") = PU + TmpDTMat.Rows.Add(drp) + Else + Alert("Error al agregar producto", TipoMensaje.MsgAdvertencia) + ProcesoOK = False + End If + End If + + + If ProcesoOK Then + ObjFactura.CalculaTotales() + Dim Resp As New Modelos.Factura.MMensajeFactura + Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL) + + If Resp.CveVenta > 0 Then + Respuesta.CveVenta = Resp.CveVenta + Respuesta.SerieFolio = Resp.SerieFolio + Respuesta.dtdetalle = TmpDTMat + Else + ProcesoOK = False + End If + + End If + + Else + ProcesoOK = False + End If + Return Respuesta + + End Function + + Friend Class RespuestaFacturacion + Public Property CveVenta As Integer = -1 + Public Property SerieFolio As String = "-1" + Public Property dtdetalle As DataTable = Nothing + Public Sub New() + + End Sub + End Class + + +#End Region + End Class diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index 1f8a98c28..0b13f9ae5 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -208,7 +208,7 @@ + DataKeyNames="CveContrato,NumeroContrato,DescripcionContrato,Ubicacion,FechaInicial,FechaFinal,CveCliente,NombreComercial,CveTipoAF,Importe,ImporteMin,ImporteMax,Observaciones,CveAF,CveChofer,CveChofer2,CveContratosEstatus,CantidadPasajeros,CveMoneda,Moneda,CveSubProyecto,NumChoferes,CveVentaRemision,RemisionSerieFolio,RemisionSaldo,TipoEstatus"> @@ -336,9 +336,16 @@