Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -815,7 +815,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||||
|
<script src="/Scripts/PrintJS/print.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function impresionDirecta(urlPDF) {
|
||||||
|
printJS({ printable: urlPDF, type: 'pdf', showModal: true });
|
||||||
|
}
|
||||||
function CalculaTotalPagoContado() {
|
function CalculaTotalPagoContado() {
|
||||||
debugger;
|
debugger;
|
||||||
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
||||||
|
|||||||
@@ -234,16 +234,22 @@ Partial Class Ventas_PVCobranza
|
|||||||
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
ObjVentas.IniciaTransacSQL()
|
ObjVentas.IniciaTransacSQL()
|
||||||
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
|
||||||
|
Try
|
||||||
|
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
HdnCveVenta.Value = CveVenta.ToString
|
||||||
|
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||||
|
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||||
|
HdnTotal.Value = GvRow.DataKey("Saldo")
|
||||||
|
TxtImporteEfectivo.Focus()
|
||||||
|
LtlNombre.Text = GvRow.DataKey("DescripcionVenta")
|
||||||
|
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
||||||
|
Catch ex As Exception
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End Try
|
||||||
HdnCveVenta.Value = CveVenta.ToString
|
|
||||||
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
|
||||||
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
|
|
||||||
HdnTotal.Value = GvRow.DataKey("Saldo")
|
|
||||||
TxtImporteEfectivo.Focus()
|
|
||||||
LtlNombre.Text = GvRow.DataKey("DescripcionVenta")
|
|
||||||
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
|
||||||
'carga información para cobranza
|
'carga información para cobranza
|
||||||
|
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
@@ -270,10 +276,15 @@ Partial Class Ventas_PVCobranza
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero
|
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero
|
||||||
|
|
||||||
|
Dim DbRowVenta As DataRow = Nothing
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.FiltroPrimero("")
|
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
|
||||||
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
|
If DbRowVenta IsNot Nothing Then
|
||||||
Dim VentaActual As New Venta(UsuarioActual)
|
Dim VentaActual As New Venta(UsuarioActual)
|
||||||
VentaActual.CveVenta = CveVenta
|
VentaActual.CveVenta = CveVenta
|
||||||
|
|
||||||
@@ -293,54 +304,77 @@ Partial Class Ventas_PVCobranza
|
|||||||
VentaActual.UsuarioActual = UsuarioActual
|
VentaActual.UsuarioActual = UsuarioActual
|
||||||
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
|
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
|
||||||
|
|
||||||
Dim ObjConta As New ClsContabilidad
|
|
||||||
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
|
||||||
Dim ObjVentas2 As New ClsVentas(ObjConta.IniciaTransacSQL())
|
|
||||||
|
|
||||||
Dim CvePrePoliza As Integer
|
Dim CvePrePoliza As Integer
|
||||||
Dim Fecha As Date = NowADS()
|
Dim Fecha As Date = NowADS()
|
||||||
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
|
||||||
Dim Mensaje As String = ""
|
Dim MsgError As String = ""
|
||||||
Dim SaldoPendiente As Decimal = VentaActual.Total
|
Dim SaldoPendiente As Decimal = VentaActual.Total
|
||||||
|
|
||||||
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 5, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim ObjConta As New ClsContabilidad
|
||||||
|
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL())
|
||||||
|
Dim ObjVentas2 As New ClsVentas(ObjConta.IniciaTransacSQL())
|
||||||
|
Try
|
||||||
|
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 5, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
If CvePrePoliza > 0 Then
|
If CvePrePoliza > 0 Then
|
||||||
|
|
||||||
If PagoEfectivo > 0 Then
|
If PagoEfectivo > 0 Then
|
||||||
If PagoEfectivo > VentaActual.Total Then
|
If PagoEfectivo > VentaActual.Total Then
|
||||||
TxtCambio.Text = (VentaActual.Total - PagoEfectivo).FormatoNumero
|
TxtCambio.Text = (VentaActual.Total - PagoEfectivo).FormatoNumero
|
||||||
PagoEfectivo = VentaActual.Total
|
PagoEfectivo = VentaActual.Total
|
||||||
|
End If
|
||||||
|
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
|
End If
|
||||||
|
SaldoPendiente -= PagoEfectivo
|
||||||
|
If SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
||||||
|
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
|
PagoEfectivo = TxtImporteCredito.Text.ToDecimal
|
||||||
|
End If
|
||||||
|
SaldoPendiente -= PagoEfectivo
|
||||||
|
If SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
||||||
|
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
|
PagoEfectivo = TxtImporteDebito.Text.ToDecimal
|
||||||
|
End If
|
||||||
|
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||||
|
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
||||||
|
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
Mensaje = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
|
||||||
End If
|
|
||||||
SaldoPendiente -= PagoEfectivo
|
|
||||||
If SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
|
||||||
Mensaje = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
|
||||||
PagoEfectivo = TxtImporteCredito.Text.ToDecimal
|
|
||||||
End If
|
|
||||||
SaldoPendiente -= PagoEfectivo
|
|
||||||
If SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
|
||||||
Mensaje = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
|
||||||
PagoEfectivo = TxtImporteDebito.Text.ToDecimal
|
|
||||||
End If
|
|
||||||
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
|
|
||||||
Mensaje = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2)
|
|
||||||
PagoEfectivo = TxtImporteCheque.Text.ToDecimal
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Mensaje = "Error al registrar prepólizas"
|
MsgError = "Error al registrar prepólizas"
|
||||||
End If
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgError = "Error al registrar el pago"
|
||||||
|
GuardaLog(ex.ToString())
|
||||||
|
End Try
|
||||||
|
|
||||||
If Mensaje = "" Then
|
If MsgError = "" Then
|
||||||
PnlContado.Visible = False
|
|
||||||
ObjConta.Commit()
|
ObjConta.Commit()
|
||||||
CargaDatos()
|
|
||||||
Alert($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>", TipoMensaje.MsgInformacion)
|
Alert($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1®ENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>", TipoMensaje.MsgInformacion)
|
||||||
Else
|
Else
|
||||||
ObjConta.RollBack()
|
ObjConta.RollBack()
|
||||||
|
Alert(MsgError, TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
ObjConta.Dispose()
|
||||||
|
ObjIE.Dispose()
|
||||||
|
ObjVentas2.Dispose()
|
||||||
|
|
||||||
|
If MsgError = "" Then
|
||||||
|
Try
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
ImpresionDirectaPDF(HdnCveVenta.Value.ToEntero)
|
||||||
|
End If
|
||||||
|
|
||||||
|
PnlContado.Visible = False
|
||||||
|
HdnCveVenta.Value = ""
|
||||||
|
CargaDatos()
|
||||||
|
Catch ex As Exception
|
||||||
|
GuardaLog(ex.ToString())
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert("Ocurrió un error al cargar la venta", TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -498,4 +532,33 @@ Partial Class Ventas_PVCobranza
|
|||||||
End If
|
End If
|
||||||
ObjPVenta.Dispose()
|
ObjPVenta.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ImpresionDirectaPDF(CveVenta As Integer)
|
||||||
|
Dim ObjFactura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||||
|
|
||||||
|
Dim ExistePDF As Boolean = False
|
||||||
|
Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||||
|
|
||||||
|
If System.IO.File.Exists(ArchivoPDF) Then
|
||||||
|
ExistePDF = True
|
||||||
|
Else
|
||||||
|
'REGENERAR EL PDF
|
||||||
|
Try
|
||||||
|
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||||
|
If System.IO.File.Exists(ArchivoPDF) Then
|
||||||
|
ExistePDF = True
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ExistePDF Then
|
||||||
|
Dim urlPDF As String = $"/Ashx/SIGDesc.ashx?metodo=descargarPDFVenta&CveVenta={CveVenta}"
|
||||||
|
RegistraScript($"impresionDirecta('{urlPDF}');", "Imprimir")
|
||||||
|
Else
|
||||||
|
Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user