--Ferretera. facturar un ticket sobre una factura global.

This commit is contained in:
2024-04-20 16:20:57 -07:00
parent 581af28f3b
commit 09494417f1
3 changed files with 68 additions and 3 deletions

View File

@@ -739,6 +739,22 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function 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 Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") DataAdapter("PA_Vta_VentasFechaVencimientoUpdate")

View File

@@ -286,10 +286,14 @@ Partial Class Ventas_PVCobranza
'e.Row.CssClass = "blue-madison" 'e.Row.CssClass = "blue-madison"
End If 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 e.Row.FCLinkButton("LnkImprimir").Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkImprimir")) ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkImprimir"))
End If End If
If e.Row.DBCampo("AplicaImpresionPorAnt").ToEntero() = 1 Then
e.Row.FCLinkButton("BtnPagar").Visible = False
End If
End If End If
End Sub End Sub
@@ -777,7 +781,19 @@ Partial Class Ventas_PVCobranza
pdf64 = Convert.ToBase64String(ms.ToArray()) pdf64 = Convert.ToBase64String(ms.ToArray())
End Using 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 Else
Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia) Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia)
End If End If
@@ -801,6 +817,7 @@ Partial Class Ventas_PVCobranza
If CveVenta > 0 Then If CveVenta > 0 Then
ImpresionDirectaPDF(CveVenta) ImpresionDirectaPDF(CveVenta)
CargaDatos()
End If End If
End Sub End Sub

View File

@@ -8621,6 +8621,11 @@ Partial Class Ventas
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6) 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) Dim DescuentoManual As Decimal = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
ObjDescuento.ImporteDescuento = DescuentoManual ObjDescuento.ImporteDescuento = DescuentoManual
@@ -11973,6 +11978,12 @@ Partial Class Ventas
ObjFactura.Num1 = TxtNum1.Text.Trim.ToDouble ObjFactura.Num1 = TxtNum1.Text.Trim.ToDouble
ObjFactura.Num2 = TxtNum2.Text.Trim.ToDouble ObjFactura.Num2 = TxtNum2.Text.Trim.ToDouble
ObjFactura.Num3 = If(ObjFactura.TipoDocto = "OP", DdlOrdenPago.SelectedValue.ToDouble, TxtNum3.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 If divcondicionespago.Visible Then
ObjFactura.FechaPago = TxtFechaPago.Text.ToDate ObjFactura.FechaPago = TxtFechaPago.Text.ToDate
@@ -17055,13 +17066,26 @@ Partial Class Ventas
'cuando es PAGO CON DEVOLUCION 'cuando es PAGO CON DEVOLUCION
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
Dim SbObs As New StringBuilder
For Each gvr As GridViewRow In GVAnticipos.Rows 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 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 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 End If
Next 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 LblAntAplicados.Text = String.Format("Pago con devolución: {0:C}", Amortizacion) : LblAntAplicados.Visible = True
HdnAnticipos.Value = Amortizacion.RoundSQL(2).ToString() HdnAnticipos.Value = Amortizacion.RoundSQL(2).ToString()
Amortizacion = 0 Amortizacion = 0
@@ -18495,6 +18519,14 @@ Partial Class Ventas
Return False Return False
End If 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 'VALIDA PROMOCIONES
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), 1, UsuarioActual.CveEmpresa) Then If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveCliente, DdlVendedor.SelectedValue.ToEntero(), 1, UsuarioActual.CveEmpresa) Then