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 @@
+
-
-
+
+
+
+
+
+
+
+
@@ -534,6 +541,11 @@
+
+
+
+
+
@@ -806,17 +818,14 @@
$('#<%=BtnDdlTipoAF.ClientID%>').click();
$('#HidNumChoferes').val(event.NumChoferes);
-
- <%-- if (event.NumChoferes === 2) {
- $('#<%= chkSegundoChofer.ClientID %>').prop('checked', true);
- $('#<%= DVChofer2.ClientID %>').css('display', 'block');
-
-
- } else {
- $('#<%= chkSegundoChofer.ClientID %>').prop('checked', false);
- $('#<%= DVChofer2.ClientID %>').css('display', 'none');
- }--%>
+ $('#HidRemisionSerieFolio').val(event.RemisionSerieFolio);
+ $('#HidCveVentaRemision').val(event.CveVentaRemision);
+ $('#HidRemisionSaldo').val(event.RemisionSaldo);
+
+ <%-- $('#HidRemision').text(event.RemisionSerieFolio);
+ $('#HypRemision').attr('href', '/Ventas/Ventas.aspx?CveVenta=' + event.CveVentaRemision);
+ $('#LblSaldo').text(event.RemisionSaldo.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }));--%>
if (event.NombreComercial !== null) {
@@ -828,6 +837,7 @@
$('#HidModCveCliente').val(event.CveCliente);
$('#<%=BtnModal.ClientID%>').click();
+
}
diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb
index c3c4336fe..497cbae7e 100644
--- a/Transportes/RepContratosCalendario.aspx.vb
+++ b/Transportes/RepContratosCalendario.aspx.vb
@@ -202,10 +202,22 @@ Partial Class RepContratosCalendario
End Sub
Private Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratos.RowDataBound
- If e.Row.RowType = DataControlRowType.DataRow Then
- Dim BackgroundColor As String = DataBinder.Eval(e.Row.DataItem, "BackgroundColor").ToString()
+ If e.Row.RowType = DataControlRowType.DataRow Then
+
+ Dim BackgroundColor As String = DataBinder.Eval(e.Row.DataItem, "BackgroundColor").ToString()
e.Row.BackColor = Drawing.ColorTranslator.FromHtml(BackgroundColor)
e.Row.Cells(1).Attributes.Add("data-order", e.Row.DBCampo("FechaInicial").ToDate.Ticks.ToString)
+
+ Dim BGC_Atencion As String = "#bc9b1b"
+ Dim TipoEstatus As Integer = e.Row.DataKey("TipoEstatus").ToEntero
+
+ If TipoEstatus <> 4 AndAlso TipoEstatus <> 3 Then
+ If e.Row.DataKey("CveChofer").ToEntero <= 0 Or (e.Row.DataKey("CveChofer2").ToEntero <= 0 And e.Row.DataKey("NumChoferes").ToEntero = 2) Or e.Row.DataKey("CveAF").ToEntero <= 0 Then
+ e.Row.BackColor = Drawing.ColorTranslator.FromHtml(BGC_Atencion)
+ End If
+ End If
+
+
End If
End Sub
@@ -289,10 +301,22 @@ Partial Class RepContratosCalendario
DdlTipoAF.SelectedValueExist(GvRow.DataKey("CveTipoAF"))
DdlTipoAF_SelectedIndexChanged(Nothing, Nothing)
- DdlAF.SelectedValueExist(GvRow.DataKey("CveAF"))
-
- CveContrato = GvRow.DataKey("CveContrato").ToEntero
+ DdlAF.SelectedValueExist(GvRow.DataKey("CveAF"))
+
+
+ HypRemision.Text = GvRow.DataKey("RemisionSerieFolio")
+ HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={GvRow.DataKey("CveVentaRemision")}"
+
+ If GvRow.DataKey("RemisionSaldo").ToDecimal > 0 Then
+ LblSaldo.Text = $"Saldo {GvRow.DataKey("RemisionSaldo").ToDecimal.ToString("###,###,###.00")}"
+ Else
+ LblSaldo.Text = ""
+ End If
+
+
+
+ CveContrato = GvRow.DataKey("CveContrato").ToEntero
OcultarMostrarSegundoChofer()
UpCommando.Update()
@@ -316,6 +340,19 @@ Partial Class RepContratosCalendario
OcultarMostrarSegundoChofer()
+
+
+ HypRemision.Text = HidRemisionSerieFolio.Value
+ HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={HidCveVentaRemision.Value}"
+ If HidRemisionSaldo.Value.ToDecimal > 0 Then
+ LblSaldo.Text = $"Saldo {HidRemisionSaldo.Value.ToDecimal.ToString("###,###,###.00")}"
+ Else
+ LblSaldo.Text = ""
+ End If
+
+
+
+
UpModal.Update()
RegistraScript("$('#ModalActualizar').modal('show');")