-- que se generen las remisiones de crédito
This commit is contained in:
@@ -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>
|
||||||
@@ -606,14 +607,17 @@
|
|||||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-md-12" style="text-align: center;">
|
</div>
|
||||||
<asp:HiddenField ID="HdnCveVenta" runat="server" />
|
</div>
|
||||||
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" />
|
<div class="chequesie2" id="divPagar">
|
||||||
<asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
|
<div class="row">
|
||||||
</div>
|
<div class="col-md-12" style="text-align: center;">
|
||||||
</div>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -633,8 +637,7 @@
|
|||||||
<Columns>
|
<Columns>
|
||||||
<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>
|
||||||
@@ -656,17 +659,11 @@
|
|||||||
<HeaderStyle CssClass="Titulos" />
|
<HeaderStyle CssClass="Titulos" />
|
||||||
<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"
|
||||||
|
|||||||
@@ -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,36 +391,42 @@ Partial Class Ventas_PVCobranza
|
|||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
HdnCveVenta.Value = CveVenta.ToString
|
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
|
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||||
HdnTotal.Value = GvRow.DataKey("Saldo")
|
HdnTotal.Value = GvRow.DataKey("Saldo")
|
||||||
TxtImporteEfectivo.Focus()
|
TxtImporteEfectivo.Focus()
|
||||||
LtlNombre.Text = GvRow.DataKey("AtencionA")
|
LtlNombre.Text = GvRow.DataKey("AtencionA")
|
||||||
LtlFolio.Text = GvRow.DataKey("SerieFolio")
|
LtlFolio.Text = GvRow.DataKey("SerieFolio")
|
||||||
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
||||||
|
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 189 AndAlso GvRow.DataKey("TipoDocto") = "Rem" Then
|
If UsuarioActual.CveEmpresa = 189 AndAlso GvRow.DataKey("TipoDocto") = "Rem" Then
|
||||||
DivAnticipo.Visible = True
|
DivAnticipo.Visible = True
|
||||||
ImgAntiPend.Visible = True
|
ImgAntiPend.Visible = True
|
||||||
End If
|
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
|
Catch ex As Exception
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End Try
|
End Try
|
||||||
@@ -442,39 +449,40 @@ 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"
|
||||||
|
|
||||||
'validaciones
|
If VentaContado Then
|
||||||
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal()
|
'validaciones
|
||||||
If Pagado = 0 Then
|
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal()
|
||||||
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
If Pagado = 0 Then
|
||||||
Exit Sub
|
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
||||||
End If
|
Exit Sub
|
||||||
|
End If
|
||||||
If LtlSaldo.Text.ToDecimal() > Pagado Then
|
|
||||||
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
|
If LtlSaldo.Text.ToDecimal() > Pagado Then
|
||||||
Exit Sub
|
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
|
End If
|
||||||
|
|
||||||
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
|
|
||||||
Dim tCveCorte As Integer = CveCorte
|
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 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,34 +801,27 @@ 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
|
If TxtImporteEfectivo.Text.ToDecimal > 0 Then DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
|
||||||
DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
Dim PagoMaximo = DtPagos.MAX("Importe")
|
||||||
Dim PagoMaximo = DtPagos.MAX("Importe")
|
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
|
||||||
|
If CveFormaPago > 0 Then
|
||||||
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
|
ObjFactura.CveFormaPago33 = CveFormaPago
|
||||||
|
ObjFactura.CveMetodoPago33 = 1
|
||||||
If CveFormaPago > 0 Then
|
End If
|
||||||
ObjFactura.CveFormaPago33 = CveFormaPago
|
Else
|
||||||
ObjFactura.CveMetodoPago33 = 1
|
'venta a crédito
|
||||||
|
ObjFactura.CveFormaPago33 = 20 ' por definir
|
||||||
|
ObjFactura.CveMetodoPago33 = 3 'PPD
|
||||||
End If
|
End If
|
||||||
|
|
||||||
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
|
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
|
||||||
|
|||||||
Reference in New Issue
Block a user