-- 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%" <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" 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" 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> <Columns>
<asp:BoundField HeaderText="Atención" DataField="AtencionA" /> <asp:BoundField HeaderText="Atención" DataField="AtencionA" />
<asp:HyperLinkField HeaderText="Folio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" ItemStyle-HorizontalAlign="Center" /> <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>
</div> </div>
<div class="chequesie1"> <div class="chequesie1">
<div class="row"> <div class="row">
<label class="col-md-2">Cheque:</label> <label class="col-md-2">Cheque:</label>
@@ -607,9 +608,14 @@
<br /> <br />
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="chequesie2" id="divPagar">
<div class="row"> <div class="row">
<div class="col-md-12" style="text-align: center;"> <div class="col-md-12" style="text-align: center;">
<asp:HiddenField ID="HdnCveVenta" runat="server" /> <asp:HiddenField ID="HdnCveVenta" runat="server" />
<asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" />
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" /> <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" /> <asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
</div> </div>
@@ -617,8 +623,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</asp:Panel> </asp:Panel>
</div> </div>
</div> </div>
@@ -634,7 +638,6 @@
<asp:TemplateField ItemStyle-HorizontalAlign="Left"> <asp:TemplateField ItemStyle-HorizontalAlign="Left">
<HeaderTemplate> <HeaderTemplate>
Serie - Folio Serie - Folio
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="LBDescripcion" runat="server" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink> <asp:HyperLink ID="LBDescripcion" runat="server" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink>
@@ -657,16 +660,10 @@
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" /> <AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="PanelIniciarTurno" TargetControlID="btnShow" <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 TieneError As Boolean = False
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
Dim CondicionesPagoContado As Boolean = GvRow.DataKey("CondicionesPago") = "0"
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
ObjVentas.IniciaTransacSQL() ObjVentas.IniciaTransacSQL()
@@ -390,7 +391,20 @@ Partial Class Ventas_PVCobranza
TieneError = True TieneError = True
End If End If
HdnCveVenta.Value = CveVenta.ToString HdnCveVenta.Value = CveVenta.ToString
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. 'según la forma de pago va a establecer el valor para pago.
Select Case GvRow.DataKey("CveFormaPago33") Select Case GvRow.DataKey("CveFormaPago33")
Case "1" Case "1"
@@ -406,18 +420,11 @@ Partial Class Ventas_PVCobranza
Case Else Case Else
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
End Select End Select
DivContadoBancos.Visible = True
BtnPagar.Text = "Pagar"
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero Else
HdnTotal.Value = GvRow.DataKey("Saldo") DivContadoBancos.Visible = False
TxtImporteEfectivo.Focus() BtnPagar.Text = "Emitir a crédito"
LtlNombre.Text = GvRow.DataKey("AtencionA")
LtlFolio.Text = GvRow.DataKey("SerieFolio")
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
If UsuarioActual.CveEmpresa = 189 AndAlso GvRow.DataKey("TipoDocto") = "Rem" Then
DivAnticipo.Visible = True
ImgAntiPend.Visible = True
End If End If
Catch ex As Exception Catch ex As Exception
@@ -442,7 +449,9 @@ Partial Class Ventas_PVCobranza
Private Sub BtnPagar_Click(sender As Object, e As EventArgs) Handles BtnPagar.Click Private Sub BtnPagar_Click(sender As Object, e As EventArgs) Handles BtnPagar.Click
'registrar pago 'registrar pago
Dim VentaContado As Boolean = HdnVentaCondicionesPago.Value = "0"
If VentaContado Then
'validaciones 'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal() 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 If Pagado = 0 Then
@@ -454,10 +463,7 @@ Partial Class Ventas_PVCobranza
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia) Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
Dim tCveCorte As Integer = CveCorte
If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then 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) Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -474,7 +480,9 @@ Partial Class Ventas_PVCobranza
Exit Sub Exit Sub
End If End If
End If End If
End If
Dim tCveCorte As Integer = CveCorte
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero
Dim CveVentaRemision As Integer = -1 Dim CveVentaRemision As Integer = -1
@@ -531,7 +539,7 @@ Partial Class Ventas_PVCobranza
CveVentaRemision = HdnCveVenta.Value.ToEntero CveVentaRemision = HdnCveVenta.Value.ToEntero
respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen) respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen, VentaContado)
If respFactura Is Nothing Then If respFactura Is Nothing Then
MsgError = "Ocurrió un error al generar la factura" MsgError = "Ocurrió un error al generar la factura"
@@ -575,7 +583,7 @@ Partial Class Ventas_PVCobranza
End If End If
If MsgError = "" Then If MsgError = "" Then
If SaldoPendiente > 0 Then If SaldoPendiente > 0 AndAlso VentaContado Then
If respFactura IsNot Nothing Then If respFactura IsNot Nothing Then
CvePrePoliza = respFactura.Factura.CvePrePoliza CvePrePoliza = respFactura.Factura.CvePrePoliza
@@ -762,7 +770,7 @@ Partial Class Ventas_PVCobranza
UpL.Update() UpL.Update()
End Sub 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 Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim SbAlert As New StringBuilder() Dim SbAlert As New StringBuilder()
@@ -793,35 +801,28 @@ Partial Class Ventas_PVCobranza
DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer))) DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer)))
DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal))) DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
If TxtImporteCredito.Text.ToDecimal > 0 Then If VentaConta Then
DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal}) If TxtImporteCredito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
End If
If TxtImporteDebito.Text.ToDecimal > 0 Then If TxtImporteDebito.Text.ToDecimal > 0 Then DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
End If
If TxtImporteCheque.Text.ToDecimal > 0 Then If TxtImporteCheque.Text.ToDecimal > 0 Then DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
End If
If TxtImporteTransferencia.Text.ToDecimal > 0 Then If TxtImporteTransferencia.Text.ToDecimal > 0 Then DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
End If
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 PagoMaximo = DtPagos.MAX("Importe")
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero() Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
If CveFormaPago > 0 Then If CveFormaPago > 0 Then
ObjFactura.CveFormaPago33 = CveFormaPago ObjFactura.CveFormaPago33 = CveFormaPago
ObjFactura.CveMetodoPago33 = 1 ObjFactura.CveMetodoPago33 = 1
End If 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 For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(), ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),