From 09494417f1ee2a3bd1e4537a6414119bb5fd6ee2 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 20 Apr 2024 16:20:57 -0700 Subject: [PATCH] --Ferretera. facturar un ticket sobre una factura global. --- App_Code/ClsVentas.vb | 16 ++++++++++++++++ Ventas/PVCobranza.aspx.vb | 21 +++++++++++++++++++-- Ventas/Ventas.aspx.vb | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 49e53d037..de66ca490 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -739,6 +739,22 @@ Public Class ClsVentas Return Retorno End Function + Public Function UpdateVentaTicketImpreso(CveVenta As Integer, Num2 As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasTicketImpresoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@Num2", SqlDbType.Int).Value = Num2 + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index eef0ecab6..bf36fa0a1 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -286,10 +286,14 @@ Partial Class Ventas_PVCobranza 'e.Row.CssClass = "blue-madison" End If - If e.Row.DBCampo("CveCondicionEntrega").ToEntero() = 9 Then + If e.Row.DBCampo("CveCondicionEntrega").ToEntero() = 9 OrElse e.Row.DBCampo("AplicaImpresionPorAnt").ToEntero() = 1 Then e.Row.FCLinkButton("LnkImprimir").Visible = True ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkImprimir")) End If + + If e.Row.DBCampo("AplicaImpresionPorAnt").ToEntero() = 1 Then + e.Row.FCLinkButton("BtnPagar").Visible = False + End If End If End Sub @@ -777,7 +781,19 @@ Partial Class Ventas_PVCobranza pdf64 = Convert.ToBase64String(ms.ToArray()) End Using - RegistraScript($"impresionBase64('{pdf64}');", "Imprimir") + If Not String.IsNullOrEmpty(pdf64) Then + Using ObjVentas As New ClsVentas + If Not ObjVentas.UpdateVentaTicketImpreso(CveVenta, 0) Then + pdf64 = "" + Alert("No se pudo desmarcar la impresión", TipoMensaje.MsgError) + End If + End Using + End If + + If Not String.IsNullOrEmpty(pdf64) Then + RegistraScript($"impresionBase64('{pdf64}');", "Imprimir") + End If + Else Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia) End If @@ -801,6 +817,7 @@ Partial Class Ventas_PVCobranza If CveVenta > 0 Then ImpresionDirectaPDF(CveVenta) + CargaDatos() End If End Sub diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 94c375811..0c6507e01 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8621,6 +8621,11 @@ Partial Class Ventas Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6) + If Cantidad <= 0 Then + Alert("La cantidad debe ser mayor a cero", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim DescuentoManual As Decimal = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales) ObjDescuento.ImporteDescuento = DescuentoManual @@ -11973,6 +11978,12 @@ Partial Class Ventas ObjFactura.Num1 = TxtNum1.Text.Trim.ToDouble ObjFactura.Num2 = TxtNum2.Text.Trim.ToDouble ObjFactura.Num3 = If(ObjFactura.TipoDocto = "OP", DdlOrdenPago.SelectedValue.ToDouble, TxtNum3.Text.Trim.ToDouble) + 'VALOR DE MARCA PARA IMPRESION DE TICKES EN FACTURAS PAGADAS + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then + ObjFactura.Num2 = 800 + End If + End If If divcondicionespago.Visible Then ObjFactura.FechaPago = TxtFechaPago.Text.ToDate @@ -17055,13 +17066,26 @@ Partial Class Ventas 'cuando es PAGO CON DEVOLUCION If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then - + Dim SbObs As New StringBuilder For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(12, 66, 277) Then Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal + + Dim SaldoPendiente = (gvr.FCLiteral("LtlAnticipos").Text.ToDecimal - gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal).RoundSQL(2) + If SaldoPendiente > 0 Then + SbObs.AppendFormat("Folio: {0} Saldo: {1:N2} ,", gvr.DataKey("Folio").Trim(), SaldoPendiente) + End If + End If Next + 'AGREGA EN LAS OBS EL SALDO PENDIENTE + If SbObs.Length > 0 Then + SbObs.Remove(SbObs.Length - 1, 1) + TxtObsFact.Text = SbObs.ToString() + UPObservaciones.Update() + End If + LblAntAplicados.Text = String.Format("Pago con devolución: {0:C}", Amortizacion) : LblAntAplicados.Visible = True HdnAnticipos.Value = Amortizacion.RoundSQL(2).ToString() Amortizacion = 0 @@ -18495,6 +18519,14 @@ Partial Class Ventas Return False End If + 'SI NO VIENE DESDE EL MODAL + If CantidadModal = 0 Then + If TxtCantidad.Text.ToDecimal() <= 0 Then + Alert("La cantidad debe ser mayor a cero", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + 'VALIDA PROMOCIONES Dim ObjVentas As New ClsVentas If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), 1, UsuarioActual.CveEmpresa) Then