From 5261cf1bd347046add0a253c7f277385f8220059 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 12 Feb 2024 18:26:16 -0700 Subject: [PATCH] --Correciones de facturacion global --- Ventas/FacturacionGlobal.aspx | 12 +++++---- Ventas/FacturacionGlobal.aspx.vb | 42 ++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/Ventas/FacturacionGlobal.aspx b/Ventas/FacturacionGlobal.aspx index 03f285bb6..ff74a30ee 100644 --- a/Ventas/FacturacionGlobal.aspx +++ b/Ventas/FacturacionGlobal.aspx @@ -111,6 +111,8 @@
+ +
@@ -185,7 +187,7 @@ - + @@ -210,7 +212,7 @@
- +
@@ -233,7 +235,7 @@
- +

@@ -242,7 +244,7 @@
- +

@@ -252,7 +254,7 @@ - +
diff --git a/Ventas/FacturacionGlobal.aspx.vb b/Ventas/FacturacionGlobal.aspx.vb index 370b40595..18ff563b0 100644 --- a/Ventas/FacturacionGlobal.aspx.vb +++ b/Ventas/FacturacionGlobal.aspx.vb @@ -49,6 +49,10 @@ Partial Class Ventas_FacturacionGlobal DdlAnio.Items.Add(New ListItem(Anio.ToString(), Anio.ToString())) DdlAnio.Items.Add(New ListItem(AnioAnterior.ToString(), AnioAnterior.ToString())) + + txtFechaI.Text = Now.AddDays(-1).ToString("dd/MM/yyyy") + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + End Sub Protected Sub DdlPeriodo_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -58,6 +62,7 @@ Partial Class Ventas_FacturacionGlobal DdlMes.DataSource = GlobalDTGralSATMeses().FiltraParametros("ISNULL(CveSATPeriodicidad,0) <> 5") End If DdlMes.DataBind() + DdlMes.Items.Insert(0, New ListItem("Seleccione", "-1")) UPFiltros.Update() End Sub @@ -128,8 +133,15 @@ Partial Class Ventas_FacturacionGlobal Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CveVenta").ToEntero() > 0 Then - e.Row.FCCheckBox("chkDis").Visible = True + If e.Row.DBCampo("Saldo").ToDecimal() > 0 Then + e.Row.FCCheckBox("chkDis").Enabled = False + e.Row.FCCheckBox("chkDis").ToolTip = "No se puede seleccionar esta remisión porque no ha sido pagada" + Else + e.Row.FCCheckBox("chkDis").Enabled = True + e.Row.FCCheckBox("chkDis").CssClass = "ChkAllEvt" + End If Else + e.Row.FCCheckBox("chkDis").Visible = False e.Row.CssClass = "Totales" End If End If @@ -137,7 +149,7 @@ Partial Class Ventas_FacturacionGlobal Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Dim CveCliente As Integer = UsuarioActual.Empresa.Funcionalidad(714).ToEntero() - Dim CveMoneda As Integer = -1 + Dim CveMoneda As Integer = 1 Dim SbRemisiones As New StringBuilder() Dim RemisionesLista As New List(Of Integer) @@ -171,6 +183,26 @@ Partial Class Ventas_FacturacionGlobal End If ObjClientes.Dispose() + If DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0 Then + Alert("No se pudieron cargar las remsiones para facturar", TipoMensaje.MsgError) + Exit Sub + End If + + If DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0 Then + Alert("No se pudieron cargar los pagos", TipoMensaje.MsgError) + Exit Sub + End If + + If Me.CveSubProyecto <= 0 Then + Alert("No se pudo cargar la sucursal", TipoMensaje.MsgError) + Exit Sub + End If + + If CveCliente <= 0 Then + Alert("No se pudo cargar el cliente", TipoMensaje.MsgError) + Exit Sub + End If + Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, Me.CveSubProyecto, CveCliente, CveMoneda, "Ing") ObjFactura.EsFacturaGlobal = True ObjFactura.CveSATPeriodicidad = DdlPeriodo.SelectedValue.ToEntero() @@ -188,6 +220,12 @@ Partial Class Ventas_FacturacionGlobal ObjFactura.CalculaTotales() ObjFactura.PreparaTimbre() + + If ObjFactura.Total <> DtPagos.SUMD("Importe") Then + Alert("Los pagos no coinciden con el total de la factura", TipoMensaje.MsgError) + Exit Sub + End If + 'ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPs = 2") Dim SbAlert As New StringBuilder()