-- que se generen las remisiones de crédito

This commit is contained in:
2024-12-18 07:26:19 -07:00
parent 684c0a7730
commit 522f2a7aca
2 changed files with 90 additions and 92 deletions

View File

@@ -328,7 +328,7 @@
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" Width="100%"
EmptyDataText="No se encontraron Ventas con los filtros especificados" data-sort="true" ToolTip="Listado de Ventas"
CssClass="ScrollAD table table-striped table-hover Widthall mysmallbtn" data-heighterror="320" data-freezecols="0" data-freezerows="0" GridLines="None"
DataKeyNames="CveVenta,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio">
DataKeyNames="CveVenta,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago">
<Columns>
<asp:BoundField HeaderText="Atención" DataField="AtencionA" />
<asp:HyperLinkField HeaderText="Folio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" ItemStyle-HorizontalAlign="Center" />
@@ -482,6 +482,7 @@
</div>
</div>
</div>
<div class="chequesie1">
<div class="row">
<label class="col-md-2">Cheque:</label>
@@ -606,14 +607,17 @@
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center;">
<asp:HiddenField ID="HdnCveVenta" runat="server" />
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" />
<asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
</div>
</div>
</div>
</div>
</div>
</div>
<div class="chequesie2" id="divPagar">
<div class="row">
<div class="col-md-12" style="text-align: center;">
<asp:HiddenField ID="HdnCveVenta" runat="server" />
<asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" />
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" />
<asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
</div>
</div>
</div>
@@ -633,8 +637,7 @@
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Left">
<HeaderTemplate>
Serie - Folio
Serie - Folio
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="LBDescripcion" runat="server" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink>
@@ -656,17 +659,11 @@
<HeaderStyle CssClass="Titulos" />
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="PanelIniciarTurno" TargetControlID="btnShow"

View File

@@ -382,6 +382,7 @@ Partial Class Ventas_PVCobranza
Dim TieneError As Boolean = False
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
Dim CondicionesPagoContado As Boolean = GvRow.DataKey("CondicionesPago") = "0"
Dim ObjVentas As New ClsVentas
ObjVentas.IniciaTransacSQL()
@@ -390,36 +391,42 @@ Partial Class Ventas_PVCobranza
TieneError = True
End If
HdnCveVenta.Value = CveVenta.ToString
'según la forma de pago va a establecer el valor para pago.
Select Case GvRow.DataKey("CveFormaPago33")
Case "1"
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "2"
TxtImporteCheque.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "3"
TxtImporteTransferencia.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "4"
TxtImporteCredito.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "18"
TxtImporteDebito.Text = GvRow.DataKey("Saldo").FormatoNumero
Case Else
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
End Select
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
HdnTotal.Value = GvRow.DataKey("Saldo")
TxtImporteEfectivo.Focus()
LtlNombre.Text = GvRow.DataKey("AtencionA")
LtlFolio.Text = GvRow.DataKey("SerieFolio")
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
If UsuarioActual.CveEmpresa = 189 AndAlso GvRow.DataKey("TipoDocto") = "Rem" Then
DivAnticipo.Visible = True
ImgAntiPend.Visible = True
End If
If CondicionesPagoContado Then
'según la forma de pago va a establecer el valor para pago.
Select Case GvRow.DataKey("CveFormaPago33")
Case "1"
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "2"
TxtImporteCheque.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "3"
TxtImporteTransferencia.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "4"
TxtImporteCredito.Text = GvRow.DataKey("Saldo").FormatoNumero
Case "18"
TxtImporteDebito.Text = GvRow.DataKey("Saldo").FormatoNumero
Case Else
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
End Select
DivContadoBancos.Visible = True
BtnPagar.Text = "Pagar"
Else
DivContadoBancos.Visible = False
BtnPagar.Text = "Emitir a crédito"
End If
Catch ex As Exception
TieneError = True
End Try
@@ -442,39 +449,40 @@ Partial Class Ventas_PVCobranza
Private Sub BtnPagar_Click(sender As Object, e As EventArgs) Handles BtnPagar.Click
'registrar pago
Dim VentaContado As Boolean = HdnVentaCondicionesPago.Value = "0"
'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal()
If Pagado = 0 Then
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
Exit Sub
End If
If LtlSaldo.Text.ToDecimal() > Pagado Then
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
Exit Sub
If VentaContado Then
'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal()
If Pagado = 0 Then
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
Exit Sub
End If
If LtlSaldo.Text.ToDecimal() > Pagado Then
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then
Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DivDatosCheque.Visible AndAlso TxtImporteCheque.Text.ToDecimal() > 0 Then
If String.IsNullOrEmpty(TxtClaveAutorizacion.Text.Trim()) Then
Alert("La clave de autorización es necesaria", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If String.IsNullOrEmpty(TxtAutorizo.Text.Trim()) Then
Alert("El nombre de la persona que autorizó es necesario", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
Dim tCveCorte As Integer = CveCorte
If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then
Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DivDatosCheque.Visible AndAlso TxtImporteCheque.Text.ToDecimal() > 0 Then
If String.IsNullOrEmpty(TxtClaveAutorizacion.Text.Trim()) Then
Alert("La clave de autorización es necesaria", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If String.IsNullOrEmpty(TxtAutorizo.Text.Trim()) Then
Alert("El nombre de la persona que autorizó es necesario", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero
Dim CveVentaRemision As Integer = -1
@@ -531,7 +539,7 @@ Partial Class Ventas_PVCobranza
CveVentaRemision = HdnCveVenta.Value.ToEntero
respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen)
respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen, VentaContado)
If respFactura Is Nothing Then
MsgError = "Ocurrió un error al generar la factura"
@@ -575,7 +583,7 @@ Partial Class Ventas_PVCobranza
End If
If MsgError = "" Then
If SaldoPendiente > 0 Then
If SaldoPendiente > 0 AndAlso VentaContado Then
If respFactura IsNot Nothing Then
CvePrePoliza = respFactura.Factura.CvePrePoliza
@@ -762,7 +770,7 @@ Partial Class Ventas_PVCobranza
UpL.Update()
End Sub
Private Function GenerarFactura(CveVendedor As Integer, ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes, ObservacionesAlmacen As String) As Modelos.Factura.MMensajeFactura
Private Function GenerarFactura(CveVendedor As Integer, ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes, ObservacionesAlmacen As String, VentaConta As Boolean) As Modelos.Factura.MMensajeFactura
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim SbAlert As New StringBuilder()
@@ -793,34 +801,27 @@ Partial Class Ventas_PVCobranza
DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer)))
DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
If TxtImporteCredito.Text.ToDecimal > 0 Then
DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
End If
If VentaConta Then
If TxtImporteCredito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
If TxtImporteDebito.Text.ToDecimal > 0 Then
DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
End If
If TxtImporteDebito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
If TxtImporteCheque.Text.ToDecimal > 0 Then
DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
End If
If TxtImporteCheque.Text.ToDecimal > 0 Then DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
If TxtImporteTransferencia.Text.ToDecimal > 0 Then
DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
End If
If TxtImporteTransferencia.Text.ToDecimal > 0 Then DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
End If
If TxtImporteEfectivo.Text.ToDecimal > 0 Then DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
Dim PagoMaximo = DtPagos.MAX("Importe")
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
If CveFormaPago > 0 Then
ObjFactura.CveFormaPago33 = CveFormaPago
ObjFactura.CveMetodoPago33 = 1
Dim PagoMaximo = DtPagos.MAX("Importe")
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
If CveFormaPago > 0 Then
ObjFactura.CveFormaPago33 = CveFormaPago
ObjFactura.CveMetodoPago33 = 1
End If
Else
'venta a crédito
ObjFactura.CveFormaPago33 = 20 ' por definir
ObjFactura.CveMetodoPago33 = 3 'PPD
End If
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows