This commit is contained in:
2025-01-24 20:34:56 -07:00
13 changed files with 632 additions and 203 deletions

View File

@@ -9544,91 +9544,93 @@ Public Class ClsPaginas
If Pago.TipoPago = "NC" Then ConPreP.CveConcepto = If(VentaActual.CveMoneda <> 1, 301, 251) If Pago.TipoPago = "NC" Then ConPreP.CveConcepto = If(VentaActual.CveMoneda <> 1, 301, 251)
'movimiento de pago cliente 'movimiento de pago cliente
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, ConPreP.CveConcepto, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True If Pago.ImportePagoVenta > 0 Then
'movimiento de pago cliente Complementaria If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, ConPreP.CveConcepto, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True
If Not ErrorMovtos AndAlso VentaActual.CveMoneda > 1 Then 'movimiento de pago cliente Complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, (ImporteME * TCValuacionVenta - ImporteME).RoundSQL, CveConceptoContableComplementaria, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True If Not ErrorMovtos AndAlso VentaActual.CveMoneda > 1 Then
End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, (ImporteME * TCValuacionVenta - ImporteME).RoundSQL, CveConceptoContableComplementaria, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True
If Pago.AplicaTraslado Then
'si tiene iva y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL If Pago.AplicaTraslado Then
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL 'si tiene iva y su proporcion
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 63, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
End If End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then If Pago.AplicaConceptoImpuestoPendiente Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL 'si tiene iva y su proporcion
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 63, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If End If
'si tiene IEPS y su proporcion 'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True End If
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe 'si tiene Ret ISR y su proporcion
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
End If End If
End If End If
If Pago.AplicaConceptoImpuestoPendiente Then
'si tiene iva y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
End If
'concepto pago 'concepto pago
If Pago.TipoPago = "B" AndAlso Not ErrorMovtos AndAlso AplicarConceptoAplicacion Then ' B A N C O S If Pago.TipoPago = "B" AndAlso Not ErrorMovtos AndAlso AplicarConceptoAplicacion Then ' B A N C O S
Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia) Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia)

View File

@@ -2482,7 +2482,8 @@ Public Class ClsVentas
#Region " PROMOCIONES " #Region " PROMOCIONES "
Public Function GetPromociones(CvePromocion As Integer, Fecha As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer, Public Function GetPromociones(CvePromocion As Integer, Fecha As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer,
CveSubProyecto As Integer, Optional CveMarca As Integer = -1, Optional CveUsuario As Integer = -1) As Boolean CveSubProyecto As Integer, Optional CveMarca As Integer = -1, Optional CveUsuario As Integer = -1, Optional CvePS As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PromocionesGet") DataAdapter("PA_Vta_PromocionesGet")
@@ -2496,6 +2497,7 @@ Public Class ClsVentas
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuario
.Add("@CvePS", SqlDbType.Int).Value = CvePS
End With End With
Try Try

View File

@@ -5664,9 +5664,9 @@ Namespace Modelos
''' <param name="RealizarDevolucionAlmacen"></param> ''' <param name="RealizarDevolucionAlmacen"></param>
''' <param name="ListaRemisionesCancelar"></param> ''' <param name="ListaRemisionesCancelar"></param>
''' <returns></returns> ''' <returns></returns>
Public Function CancelarFactura(RealizarDevolucionAlmacen As Integer, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False, Optional ForzarDevolucion As Boolean = False, Optional CancelacionPagos As OpcionesCancelacionPagos = OpcionesCancelacionPagos.SinPagos, Optional CveEstatusFacturaAsignado As Integer = -1, Optional CvePACEspecifico As Integer = -1) As MCancelacionVentaMensaje Public Function CancelarFactura(RealizarDevolucionAlmacen As Integer, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False, Optional ForzarDevolucion As Boolean = False, Optional CancelacionPagos As OpcionesCancelacionPagos = OpcionesCancelacionPagos.SinPagos, Optional CveEstatusFacturaAsignado As Integer = -1, Optional CvePACEspecifico As Integer = -1, Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing) As MCancelacionVentaMensaje
'Comprobante emitido con errores sin relación 'Comprobante emitido con errores sin relación
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos, ForzarDevolucion:=ForzarDevolucion, CancelacionPagos:=CancelacionPagos, CveEstatusFacturaAsignado:=CveEstatusFacturaAsignado, ValidarSAT:=ValidarSAT, CvePACEspecifico:=CvePACEspecifico) Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos, ForzarDevolucion:=ForzarDevolucion, CancelacionPagos:=CancelacionPagos, CveEstatusFacturaAsignado:=CveEstatusFacturaAsignado, ValidarSAT:=ValidarSAT, CvePACEspecifico:=CvePACEspecifico, TransaccionCompartida:=TransaccionCompartida)
End Function End Function
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Integer = 0, Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Integer = 0,
@@ -5674,7 +5674,8 @@ Namespace Modelos
Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "", Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "",
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0,
Optional CancelarBoletos As Boolean = False, Optional ForzarDevolucion As Boolean = False, Optional CancelacionPagos As OpcionesCancelacionPagos = OpcionesCancelacionPagos.SinPagos, Optional CancelarBoletos As Boolean = False, Optional ForzarDevolucion As Boolean = False, Optional CancelacionPagos As OpcionesCancelacionPagos = OpcionesCancelacionPagos.SinPagos,
Optional CvePACEspecifico As Integer = -1) As MCancelacionVentaMensaje Optional CvePACEspecifico As Integer = -1,
Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing) As MCancelacionVentaMensaje
Dim Retorno As New MCancelacionVentaMensaje() Dim Retorno As New MCancelacionVentaMensaje()
Dim ErrorList As New List(Of String) Dim ErrorList As New List(Of String)
@@ -6136,7 +6137,12 @@ Namespace Modelos
End If End If
End If End If
Dim ObjVentas As New ClsVentas() : ObjVentas.IniciaTransacSQL() Dim ObjVentas As ClsVentas = Nothing
If TransaccionCompartida IsNot Nothing Then
ObjVentas = New ClsVentas(TransaccionCompartida)
Else
ObjVentas = New ClsVentas() : ObjVentas.IniciaTransacSQL()
End If
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL()) Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
@@ -6925,7 +6931,7 @@ Namespace Modelos
OnError("Ocurrió un error al cancelar el documento", ex) OnError("Ocurrió un error al cancelar el documento", ex)
Finally Finally
If Not ErrorCancelar Then If Not ErrorCancelar Then
ObjVentas.Commit() If TransaccionCompartida Is Nothing Then ObjVentas.Commit()
If CveEstatus = 5 Then If CveEstatus = 5 Then
Dim MensajeAlert As New StringBuilder Dim MensajeAlert As New StringBuilder
@@ -6954,12 +6960,14 @@ Namespace Modelos
End If End If
Retorno.CveEstatus = CveEstatus Retorno.CveEstatus = CveEstatus
If TransaccionCompartida Is Nothing Then
ObjVentas.Dispose()
ObjBancos.Dispose()
ObjInventario.Dispose()
ObjContrato.Dispose()
ObjConta.Dispose()
End If
ObjVentas.Dispose()
ObjBancos.Dispose()
ObjInventario.Dispose()
ObjContrato.Dispose()
ObjConta.Dispose()
End Try End Try
Return Retorno Return Retorno

View File

@@ -115,9 +115,10 @@ Partial Class Compras_RepProductosServiciosDetalle
txtFechaI.Text = If(Mes <> "-1", String.Format("01/{0}/0001", Mes), txtFechaI.Text) txtFechaI.Text = If(Mes <> "-1", String.Format("01/{0}/0001", Mes), txtFechaI.Text)
txtFechaI.Text = If(AnioMes <> "-1", String.Format("01/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4)), txtFechaI.Text) txtFechaI.Text = If(AnioMes <> "-1", String.Format("01/{0}/{1}", AnioMes.Substring(5, 1).PadLeft(2, "0"c), AnioMes.Substring(0, 4)), txtFechaI.Text)
If CveCultivo.ToEntero() > 0 AndAlso FechaI = "-1" AndAlso Anio = "-1" AndAlso Mes = "-1" AndAlso AnioMes = "-1" Then If CveCultivo.Length > 0 AndAlso FechaI = "-1" AndAlso Anio = "-1" AndAlso Mes = "-1" AndAlso AnioMes = "-1" Then
txtFechaI.Text = "01/01/1900" txtFechaI.Text = "01/01/1900"
End If End If
If Fecha <> "-1" Then If Fecha <> "-1" Then
txtFechaI.Text = Fecha txtFechaI.Text = Fecha
txtFechaF.Text = Fecha txtFechaF.Text = Fecha

View File

@@ -950,12 +950,19 @@ Partial Class Inventarios_EntradasSalidas
TieneRelacionado = Mov.TieneRelacionado TieneRelacionado = Mov.TieneRelacionado
ConceptoRelacionado = Mov.ConceptoRelacionado ConceptoRelacionado = Mov.ConceptoRelacionado
'sino existe el movimiento 'sino existe el movimiento
If (DdlConcepto.Items.FindByValue(Mov.CveConcepto.ToString()) Is Nothing) Then If (DdlConcepto.Items.FindByValue(Mov.CveConcepto.ToString()) Is Nothing) Then
Dim dr As DataRow = GlobalDTInvConceptos.FiltroPrimero(String.Format("CveConcepto = {0}", Mov.CveConcepto)) Dim dr As DataRow = GlobalDTInvConceptos.FiltroPrimero(String.Format("CveConcepto = {0}", Mov.CveConcepto))
DdlConcepto.Items.Insert(0, New ListItem(dr("Concepto").ToString, dr("CveConcepto").ToString)) ' lo genera Obj.SelectedValue = Valor.ToString DdlConcepto.Items.Insert(0, New ListItem(dr("Concepto").ToString, dr("CveConcepto").ToString)) ' lo genera Obj.SelectedValue = Valor.ToString
End If End If
'CONDICION ESPECIAL , PARA DEVOLUCIONES DE PRÉSTAMO PROVEEDORES
If DdlConcepto.SelectedValue = "29" Then
TieneRelacionado = 0 'PARA ELIMINACIÓN NO LO RELACIONE, EN EL PA, TAMBIEN SE TIENE ESTA CONSIDERACIÓN
CveMovimientoRelacionado = 0
End If
DdlConcepto.SelectedValue = Mov.CveConcepto.ToString DdlConcepto.SelectedValue = Mov.CveConcepto.ToString
ddlConcepto_SelectedIndexChanged(DdlConcepto, EventArgs.Empty) ddlConcepto_SelectedIndexChanged(DdlConcepto, EventArgs.Empty)

View File

@@ -728,14 +728,15 @@ Partial Class OC_OC
CargarCentrosDeCosto(Nothing, DdlSubProyectoEntrega, Nothing, Nothing, "Seleccione") CargarCentrosDeCosto(Nothing, DdlSubProyectoEntrega, Nothing, Nothing, "Seleccione")
If UsuarioActual.CveEmpresa = 189 Then If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then ModalidadSubProyectoGeneral = True
If ModalidadSubProyectoGeneral Then
DdlSubProyectoGral.DataSource = GlobalDTOCEstatusUsuarios(CveEmpresaActual, UsuarioActual.CveUsuario, TipoOC).FiltraParametros("", "SubProyecto", DistinctColumns:={"CveSubProyecto", "SubProyecto"}) DdlSubProyectoGral.DataSource = GlobalDTOCEstatusUsuarios(CveEmpresaActual, UsuarioActual.CveUsuario, TipoOC).FiltraParametros("", "SubProyecto", DistinctColumns:={"CveSubProyecto", "SubProyecto"})
DdlSubProyectoGral.DataBind() DdlSubProyectoGral.DataBind()
DdlSubProyectoGral.Items.Insert(0, New ListItem("-", "-1")) DdlSubProyectoGral.Items.Insert(0, New ListItem("-", "-1"))
DdlSubProyectoGral.SelectedValueExist(UsuarioActual.CveSubProyecto) DdlSubProyectoGral.SelectedValueExist(UsuarioActual.CveSubProyecto)
DdlSubProyectoEntrega.SelectedValueExist(UsuarioActual.CveSubProyecto) DdlSubProyectoEntrega.SelectedValueExist(UsuarioActual.CveSubProyecto)
ModalidadSubProyectoGeneral = True
TdProyectoSubPrpyectoDdl.Visible = False TdProyectoSubPrpyectoDdl.Visible = False
TdProyectoSubPrpyecto.Visible = False TdProyectoSubPrpyecto.Visible = False
GvD.Columns(4).Visible = False GvD.Columns(4).Visible = False
@@ -744,13 +745,10 @@ Partial Class OC_OC
DdlSubProyectoEntrega.Visible = chkSubProyectoEntrega.Checked DdlSubProyectoEntrega.Visible = chkSubProyectoEntrega.Checked
txtLugarEntrega.Visible = Not chkSubProyectoEntrega.Checked txtLugarEntrega.Visible = Not chkSubProyectoEntrega.Checked
UPPEmp.Update() UPPEmp.Update()
UPPDetalle.Update() UPPDetalle.Update()
End If End If
'CARGA YA REGISTRADO 'CARGA YA REGISTRADO
If Request("OC") IsNot Nothing AndAlso IsNumeric(Request("OC")) AndAlso Request("OC").ToEntero > 0 Then If Request("OC") IsNot Nothing AndAlso IsNumeric(Request("OC")) AndAlso Request("OC").ToEntero > 0 Then

View File

@@ -16,6 +16,9 @@
<li> <li>
<asp:LinkButton ID="LnkAccionesMaterialUtilizado" runat="server" OnClick="LnkAccionesMaterialUtilizado_Click" Visible="false"> <i class="fa fa-plus"></i> Material Utilizado</asp:LinkButton> <asp:LinkButton ID="LnkAccionesMaterialUtilizado" runat="server" OnClick="LnkAccionesMaterialUtilizado_Click" Visible="false"> <i class="fa fa-plus"></i> Material Utilizado</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton ID="BtnCancelarRemision" runat="server" Text="Cancelar Material" Visible="false" OnClick="BtnCancelarRemision_Click"/>
</li>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:PostBackTrigger ControlID="ImgImprimir" /> <asp:PostBackTrigger ControlID="ImgImprimir" />
@@ -348,7 +351,7 @@
<asp:LinkButton runat="server" ID="LnkFinalizar" Text="Finalizar" CssClass="btn btn-primary" OnClick="LnkFinalizar_Click"></asp:LinkButton> <asp:LinkButton runat="server" ID="LnkFinalizar" Text="Finalizar" CssClass="btn btn-primary" OnClick="LnkFinalizar_Click"></asp:LinkButton>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>

View File

@@ -6,6 +6,7 @@ Imports System.IO
Imports System.Data Imports System.Data
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports APP_Code_CSharp Imports APP_Code_CSharp
Imports MoreLinq.Extensions
Partial Class OS_OrdenesServicios Partial Class OS_OrdenesServicios
Inherits ClsPaginas Inherits ClsPaginas
@@ -578,8 +579,6 @@ Partial Class OS_OrdenesServicios
'GvPS.DataSource = TmpDT 'GvPS.DataSource = TmpDT
'GvPS.DataBind() 'GvPS.DataBind()
Dim tmpTipoEstatus As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", $" CveEstatusOrdenServicio = {DdlEstatusOS.SelectedValue}").ToEntero Dim tmpTipoEstatus As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", $" CveEstatusOrdenServicio = {DdlEstatusOS.SelectedValue}").ToEntero
Select Case tmpTipoEstatus Select Case tmpTipoEstatus
Case 1, 2, 3 Case 1, 2, 3
@@ -732,6 +731,10 @@ Partial Class OS_OrdenesServicios
If TipoEstatus.Contiene(1, 2, 3) Then If TipoEstatus.Contiene(1, 2, 3) Then
LnkAccionesMaterialUtilizado.Visible = True LnkAccionesMaterialUtilizado.Visible = True
End If End If
If TipoEstatus.Contiene(4) Then 'finalizada
BtnCancelarRemision.Visible = True
End If
Else Else
Alert("La Orden de Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) Alert("La Orden de Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False BtnGuardar.Enabled = False
@@ -3530,7 +3533,7 @@ Partial Class OS_OrdenesServicios
If PU > 0 Then If PU > 0 Then
CountDetalles = CountDetalles + 1 CountDetalles = CountDetalles + 1
Else Else
Alert($"Prodcuto {CodigoPS} con precio unitario en cero.", TipoMensaje.MsgAdvertencia) Alert($"Producto {CodigoPS} con precio unitario en cero.", TipoMensaje.MsgAdvertencia)
PuEnCero = True PuEnCero = True
End If End If
End If End If
@@ -3552,7 +3555,7 @@ Partial Class OS_OrdenesServicios
Return Respuesta Return Respuesta
End If End If
If ObjVentas.GetVenta(CvePedido, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.GetVenta(CvePedido, UsuarioActual.CveEmpresa) Then
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0) Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0)
CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
CveSubProyectoPedido = DbRowVenta("CveSubProyecto").ToString().ToEntero() CveSubProyectoPedido = DbRowVenta("CveSubProyecto").ToString().ToEntero()
@@ -3585,6 +3588,14 @@ Partial Class OS_OrdenesServicios
TmpDTMat.Columns.Add("Lote", GetType(String)) TmpDTMat.Columns.Add("Lote", GetType(String))
TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date)) TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date))
TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer)) TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer))
'unificar en un solo producto, y generar las salidas a esa relación
Respuesta.CveVenta = -1
Respuesta.SerieFolio = ""
Respuesta.dtdetalle = New DataTable
Alert("Remision sin detalles.", TipoMensaje.MsgAdvertencia)
Return Respuesta
For Each GvRow As GridViewRow In GvMU.Rows For Each GvRow As GridViewRow In GvMU.Rows
@@ -3594,7 +3605,6 @@ Partial Class OS_OrdenesServicios
Dim Descuento As Decimal = GvRow.DataKey("Descuento").ToDecimal Dim Descuento As Decimal = GvRow.DataKey("Descuento").ToDecimal
Dim Obs As String = GvRow.DataKey("Observaciones") Dim Obs As String = GvRow.DataKey("Observaciones")
If CantidadRegistro > 0 Then If CantidadRegistro > 0 Then
If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyectoPedido, CveVentaDetallePadre:=GvRow.DataKey("CveVentaDetalle").ToEntero) Then If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyectoPedido, CveVentaDetallePadre:=GvRow.DataKey("CveVentaDetalle").ToEntero) Then
Dim drp As DataRow = TmpDTMat.NewRow Dim drp As DataRow = TmpDTMat.NewRow
@@ -3635,6 +3645,38 @@ Partial Class OS_OrdenesServicios
End Function End Function
Private Function AgrupadoProductos(gridView As GridView) As DataTable
' Filtrar y agrupar las filas por clave3 y clave5
Dim groupedData = From row As GridViewRow In gridView.Rows.Cast(Of GridViewRow)()
Where row.RowType = DataControlRowType.DataRow
Group row By
CvePS = gridView.DataKeys(row.RowIndex)("CvePS").ToString(),
CveUM = gridView.DataKeys(row.RowIndex)("CveUM").ToString()
Into Group
Select New With {
.CvePS = CvePS,
.CveUM = CveUM,
.ValorAcumulado = Group.Sum(Function(r) Convert.ToDecimal(r.Cells(5).Text))
}
' Crear un nuevo DataTable para almacenar los resultados agrupados
Dim resultTable As New DataTable()
resultTable.Columns.Add("CvePS")
resultTable.Columns.Add("CveUM")
resultTable.Columns.Add("Cantidad", GetType(Decimal))
For Each item In groupedData
Dim newRow As DataRow = resultTable.NewRow()
newRow("CvePS") = item.CvePS
newRow("CveUM") = item.CveUM
newRow("Cantidad") = item.ValorAcumulado
resultTable.Rows.Add(newRow)
Next
Return resultTable
End Function
Friend Class RespuestaFacturacion Friend Class RespuestaFacturacion
Public Property CveVenta As Integer = -1 Public Property CveVenta As Integer = -1
Public Property SerieFolio As String = "-1" Public Property SerieFolio As String = "-1"
@@ -3786,4 +3828,77 @@ Partial Class OS_OrdenesServicios
End Try End Try
End Sub End Sub
Private Sub CancelarRemision(CveVenta As Integer, CveAlmacenDevolucion As Integer, CvePedido As Integer)
Dim LigaRedirigir As String = ""
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True, VerificaAlmacen:=True)
Try
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
Dim strMensaje As New StringBuilder()
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
Dim ListaRemisionesCancelar As New List(Of Integer)
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
Dim CancelacionPagos = Modelos.OpcionesCancelacionPagos.SinPagos
'PARA GENERAR LA DEVOLUCION DE ALMACEN SIN ESPERAR LA ACEPTACION DEL SAT
Dim GenerarDevolucionAnticipada As Boolean = True
Dim CveEstadoCancelacion As Integer = 1
Dim objos As New ClsOS
Dim ObjVenta As New ClsVentas(objos.IniciaTransacSQL)
resp = ObjFacturaCancelacion.CancelarFactura(1, ListaRemisionesCancelar, CveMotivoCancelacion:=1, Motivo:="Corrección de material utilizado", CveEstadoCancelacion:=CveEstadoCancelacion, ForzarDevolucion:=GenerarDevolucionAnticipada, CancelacionPagos:=CancelacionPagos, TransaccionCompartida:=objos.IniciaTransacSQL)
Dim HuboError As Boolean = False
If Not resp.HuboError Then
If resp.CveEstatus = 12 Then
Dim cveoo As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", $" TipoEstatus = 3").ToEntero
If objos.UpdateOrdenesServiciosEstatus(cveoo, UsuarioActual.CveUsuario, CveOS) Then
'retornar el estatus de la OS,
If Not ObjVenta.UpdateVentasDevolucionAlmacen(0, CvePedido) Then
HuboError = True
End If
Else
HuboError = True
End If
Else
'si tiene pagos
HuboError = True
End If
Else
HuboError = True
End If
strMensaje.Append(resp.Mensaje)
If Not HuboError Then
objos.Commit()
Alert(strMensaje.ToString(), resp.TipoMensaje)
Else
objos.RollBack()
Alert(strMensaje.ToString(), resp.TipoMensaje)
End If
objos.Dispose()
ObjVenta.Dispose()
Else
Alert("Ocurrió un error al generar la cancelación", TipoMensaje.MsgError)
End If
Catch ex As Exception
OnError("Ocurrió un error al cancelar", ex)
End Try
ObjFacturaCancelacion.Dispose()
UpEstatus.Update()
If Not String.IsNullOrEmpty(LigaRedirigir) Then
Response.Redirect(LigaRedirigir)
End If
End Sub
Protected Sub BtnCancelarRemision_Click(sender As Object, e As EventArgs)
CancelarRemision(CveVenta, 1, CvePedido)
End Sub
End Class End Class

View File

@@ -28,25 +28,61 @@
<div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px;"> <div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px;">
<div class="tools"> <div class="tools">
<asp:Button Text="Consultar" ID="BtnConsultar" CssClass="btn btn-primary" OnClick="BtnConsultar_Click" runat="server" /> <asp:Button Text="Consultar" ID="BtnConsultar" CssClass="btn btn-primary" OnClick="BtnConsultar_Click" runat="server" />
</div> <a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption "> <div class="titlefiltros caption ">
<div class="row" style="padding-top: 10px;"> <div class="row" style="padding-top: 10px;">
<label class="col-md-1 truncate">Sucursal:</label>
<div class="col-md-2 "> <div class="col-md-1">
<%-- <asp:DropDownList ID="DdlSucursal" runat="server" CssClass="select2me" DataTextField="Sucursal" DataValueField="CveSucursal" Width="200px" ValidationGroup="GrpGuardar"></asp:DropDownList>--%> <asp:Label runat="server" ID="LblSubProyecto" class="truncate"></asp:Label>:
</div>
<div class="col-md-2 ">
<asp:DropDownList ID="DdlSubProyecto" runat="server" CssClass="select2me" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="200px" ValidationGroup="GrpGuardar"></asp:DropDownList> <asp:DropDownList ID="DdlSubProyecto" runat="server" CssClass="select2me" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="200px" ValidationGroup="GrpGuardar"></asp:DropDownList>
</div> </div>
<label class="col-md-1 truncate">Estatus:</label>
<div class="col-md-2"> <asp:Label runat="server" ID="Label1" class="col-md-1 truncate">Cliente:</asp:Label>
<asp:DropDownList ID="DdlEstatus" runat="server" CssClass="select2me" Width="100px" ValidationGroup="GrpGuardar"> <div class="col-md-2 ">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem> <ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width:100%;">
<asp:ListItem Text="Activo" Value="1" Selected="True"></asp:ListItem> </ADS:Dropdownlost>
<asp:ListItem Text="Inactivo" Value="0"></asp:ListItem>
</asp:DropDownList>
</div> </div>
<asp:Label runat="server" ID="Label2" class="col-md-1 truncate">Vendedor:</asp:Label>
<div class="col-md-2 ">
<asp:DropDownList ID="DdlVendedor" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" runat="server" Width="100%"></asp:DropDownList>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="portlet-body" style="display: none">
<div class="row">
<label class="col-md-1 truncate">Estatus:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlEstatus" runat="server" CssClass="select2me" Width="100px" ValidationGroup="GrpGuardar">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Activo" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Inactivo" Value="0"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:Label runat="server" ID="Label3" class="col-md-1 truncate">Marca:</asp:Label>
<div class="col-md-2 ">
<asp:DropDownList ID="DdlMarca" DataTextField="Marca" DataValueField="CveMarca" CssClass="select2me" runat="server" Width="100%"></asp:DropDownList>
</div>
<asp:Label runat="server" ID="Label4" class="col-md-1 truncate">Producto:</asp:Label>
<div class="col-md-2">
<ADS:Dropdownlost runat="server" Enabled="true" ID="DdlPS" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
</div>
</div>
</div> </div>
</asp:Panel> </asp:Panel>
</ContentTemplate> </ContentTemplate>
@@ -69,6 +105,10 @@
<asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' NavigateUrl ='<%# Eval("CvePromocion", "/Ventas/Promociones.aspx?CvePromocion={0}") %>' CssClass="Texto"></asp:HyperLink> <asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' NavigateUrl ='<%# Eval("CvePromocion", "/Ventas/Promociones.aspx?CvePromocion={0}") %>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="NombreComercial" HeaderText="Cliente" />
<asp:BoundField DataField="Vendedor" HeaderText="Vendedor" />
<asp:BoundField DataField="Marca" HeaderText="Marca" />
<asp:BoundField DataField="FechaInicio" DataFormatString="{0:d}" HeaderText="F. Inicio" ItemStyle-Width="80px" /> <asp:BoundField DataField="FechaInicio" DataFormatString="{0:d}" HeaderText="F. Inicio" ItemStyle-Width="80px" />
<asp:BoundField DataField="FechaFin" DataFormatString="{0:d}" HeaderText="F. Fin" ItemStyle-Width="80px" /> <asp:BoundField DataField="FechaFin" DataFormatString="{0:d}" HeaderText="F. Fin" ItemStyle-Width="80px" />
<asp:BoundField DataField="SubProyecto" HeaderText="Sucursal" ItemStyle-Width="125px" /> <asp:BoundField DataField="SubProyecto" HeaderText="Sucursal" ItemStyle-Width="125px" />

View File

@@ -22,21 +22,57 @@ Partial Class Ventas_CatPromociones
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
InicializaControles()
'ImgAddPromocion.Attributes.Add("OnClick", "window.location = '/Ventas/Promociones.aspx'")
'CARGA SUCURSALES
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
CargaDatos() CargaDatos()
End If End If
End Sub End Sub
Private Sub InicializaControles()
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyecto)
GvDatos.Columns(6).HeaderText = LblSubProyecto.Text
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedor.DataBind()
DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then
DdlMarca.DataSource = ObjPS.DtResultados
End If
ObjPS.Dispose()
DdlMarca.DataBind()
DdlMarca.Items.Insert(0, New ListItem("Todos", "-1"))
DdlClientes.setEsWebService(True)
'CARGA PS
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
DdlPS.IncluyeTodos = True
If Not DdlPS.UsaWebService AndAlso CType(DdlPS.DataSource, DataTable) Is Nothing Then
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
DdlPS.DataBind()
End If
End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetPromociones(-1, MinFecha, -1, -1, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, CveUsuario:=UsuarioActual.CveUsuario) Then Dim CveCliente As Integer = If(DdlClientes.SelectedValue.ToEntero > 0, DdlClientes.SelectedValue.ToEntero, -1)
Dim CvePS As Integer = If(DdlPS.SelectedValue.ToEntero > 0, DdlPS.SelectedValue.ToEntero, -1)
If ObjVentas.GetPromociones(-1, MinFecha, DdlVendedor.SelectedValue.ToEntero, CveCliente, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero, CveUsuario:=UsuarioActual.CveUsuario,
CveMarca:=DdlMarca.SelectedValue.ToEntero, CvePS:=CvePS) Then
DtDatos = ObjVentas.DtResultados DtDatos = ObjVentas.DtResultados
Else Else
DtDatos = Nothing DtDatos = Nothing

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,CondicionesPago,PlazoCobranza"> DataKeyNames="CveVenta,CveCliente,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza">
<Columns> <Columns>
<%--<asp:BoundField HeaderText="Atención" DataField="AtencionA" />--%> <%--<asp:BoundField HeaderText="Atención" DataField="AtencionA" />--%>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left">
@@ -441,6 +441,7 @@
<div class="col-md-6"> <div class="col-md-6">
<asp:Panel runat="server" ID="PnlContado" DefaultButton="BtnPagar" Visible="false"> <asp:Panel runat="server" ID="PnlContado" DefaultButton="BtnPagar" Visible="false">
<div class="row"> <div class="row">
<div class="note note-success"> <div class="note note-success">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
@@ -461,11 +462,11 @@
</b> </b>
</div> </div>
<div class="col-md-1" style="text-align: right;"> <div class="col-md-1" style="text-align: right;">
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" /> <asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div> <div>
@@ -590,8 +591,22 @@
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label> <label>
<asp:Literal ID="LtlTipoAnticipo" runat="server"></asp:Literal></label> <asp:UpdatePanel ID="UPPCobranza" runat="server" UpdateMode="Conditional">
<asp:HiddenField ID="HdnTipoAmortizacion" runat="server" Value="" /> <ContentTemplate>
<div class="row">
<div class="col-md-6">
<asp:Literal ID="LtlTipoAnticipo" runat="server"></asp:Literal></label>
<asp:HiddenField ID="HdnTipoAmortizacion" runat="server" Value="" />
<asp:LinkButton ID="LnkCxC" runat="server" CssClass="btn btn-xs btn-success" Text="Cobranza" OnClick="LnkCxC_Click" />
</div>
<div class="col-md-6">
<asp:TextBox ID="TxtCxCAplicado" CssClass="form-control input-sm TextBoxAsLabel" runat="server" MaxLength="12" Width="100px" Enabled="false" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
</div> </div>
</div> </div>
@@ -623,39 +638,45 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div class="chequesie2"> <asp:UpdatePanel runat="server" ID="UPPTotalesContado" UpdateMode="Conditional">
<div class="row"> <ContentTemplate>
<label class="col-md-1">Total:</label> <div class="chequesie2">
<div class="col-md-3 input-icon"> <div class="row">
<i style="margin: 0px;">$</i> <label class="col-md-1">Total:</label>
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox> <div class="col-md-3 input-icon">
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," /> <i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," />
</div> </div>
<label id="lblCambio" class="col-md-1">Cambio:</label> <label id="lblCambio" class="col-md-1">Cambio:</label>
<div class="col-md-3 input-icon"> <div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i> <i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox> <asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," /> <ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br /> <br />
</div> </div>
<label id="lblCambio2" class="col-md-1">Sob/falt:</label> <label id="lblCambio2" class="col-md-1">Sob/falt:</label>
<div class="col-md-3 input-icon"> <div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i> <i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox> <asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<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>
</div> </ContentTemplate>
</asp:UpdatePanel>
</div> </div>
</div> </div>
<div class="chequesie2" id="divPagar"> <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="HdnCveCliente" runat="server" />
<asp:HiddenField ID="HdnPlazoCobranza" runat="server" /> <asp:HiddenField ID="HdnPlazoCobranza" runat="server" />
<asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" /> <asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" />
<asp:HiddenField ID="HdnCveIE" 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>
@@ -1305,6 +1326,105 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" /> <asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
<asp:UpdatePanel runat="server" ID="UPPCxC" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div id="divCxC" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 700px;">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label runat="server">Cuentas por cobrar:&nbsp;<asp:Literal ID="Literal1" runat="server"></asp:Literal></asp:Label>
</h4>
</div>
<div class="modal-body">
<div class="row" id="Div5" runat="server" visible="false">
<b>
<label class="col-md-2">Fecha:</label></b>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80% !important; padding: 0px;">
<asp:TextBox ID="TextBox1" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true" MaxLength="10" AutoPostBack="true" OnTextChanged="TxtFechaAnticipoCliente_TextChanged"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LinkButton1" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TxtFechaAnticipoCliente" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaAnticipoCliente" PopupButtonID="ImgFechaAnticipoCliente" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TxtFechaAnticipoCliente" Display="None" Operator="DataTypeCheck" Type="Date" ValidationGroup="VGAnticiposClientes" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)."></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server" Enabled="True" HighlightCssClass="vco" TargetControlID="CvFechaAnticipoCliente" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<br />
<div style="max-height: 300px; overflow-y: auto;">
<div class="row" style="margin-left: 0px; text-align: right" align="left">
<div class="col-md-2">
<asp:LinkButton ID="LinkButton2" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-refresh'></i> Actualizar" runat="server" OnClick="LnkRecargaAnticipos_Click" />
</div>
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaCxC" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaCxC','{0}')", GvCxC.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<br />
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente"
CssClass=" table table-striped table-hover Widthall mysmallbtn" data-height="300" GridLines="None"
DataKeyNames=" CveVenta,PorcentajeIVA,TipoDocto,CveSubProyecto,CveMoneda,TipoCambio, Fecha,SerieFolio, SubTotal,IVA,Total,IEPS,RetIVA,RetISR, CveCliente,Saldo">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="Chk" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Folio</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFactura" runat="server" Text='<%# Eval("SerieFolio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Saldo</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>Moneda Venta</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="MonedaVenta" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Moneda</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAbreviatura" runat="server" Text='<%# Eval("Abreviatura") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAplicarCxC" runat="server" Text="Aceptar" class="btn btn-primary" OnClick="BtnAplicarCxC_Click" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</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 src="/Scripts/PrintJS/print.min.js"></script>
@@ -1424,6 +1544,7 @@
let totalDebito = ToDouble($get("TxtImporteDebito").value); let totalDebito = ToDouble($get("TxtImporteDebito").value);
let totalCheque = ToDouble($get("TxtImporteCheque").value); let totalCheque = ToDouble($get("TxtImporteCheque").value);
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value); let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
let totalCobranza = ToDouble($get("TxtCxCAplicado").value);
let TotalOtrosContado = 0; let TotalOtrosContado = 0;
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia; let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia;
@@ -1435,7 +1556,7 @@
total = total + totalAnticipos + TotalOtrosContado; total = total + totalAnticipos + TotalOtrosContado;
} }
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value); let totalVenta = ToDouble($get('HdnTotal').value) + totalCobranza;// - ToDouble($get('HdnTotal').value);
if (total > totalVenta) { if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:"; lblCambio.innerHTML = "Cambio:";

View File

@@ -505,6 +505,7 @@ Partial Class Ventas_PVCobranza
TieneError = True TieneError = True
End If End If
HdnCveVenta.Value = CveVenta.ToString HdnCveVenta.Value = CveVenta.ToString
HdnCveCliente.Value = GvRow.DataKey("CveCliente")
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()
@@ -574,12 +575,12 @@ Partial Class Ventas_PVCobranza
Exit Sub Exit Sub
End If End If
If LtlSaldo.Text.ToDecimal() > Pagado Then If LtlSaldo.Text.ToDecimal + TxtCxCAplicado.Text.ToDecimal > Pagado Then
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
If PagadoSinEfectivo > LtlSaldo.Text.ToDecimal() Then If PagadoSinEfectivo > (LtlSaldo.Text.ToDecimal() + TxtCxCAplicado.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
End If End If
@@ -652,8 +653,9 @@ Partial Class Ventas_PVCobranza
Dim Fecha As Date = DbRowVenta("Fecha").ToString.ToDate 'NowADS() Dim Fecha As Date = DbRowVenta("Fecha").ToString.ToDate 'NowADS()
Dim MsgError As String = "" Dim MsgError As String = ""
Dim SaldoPendiente As Decimal = DbRowVenta("Saldo").ToString.ToDecimal Dim SaldoPendienteVenta As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
Dim SaldoTotalInicial As Decimal = DbRowVenta("Saldo").ToString.ToDecimal Dim SaldoTotalInicialVenta As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
Dim SaldoPendientePagos As Decimal = TxtImporteContado.Text.ToDecimal
Dim PagoAplicado As Decimal = 0 Dim PagoAplicado As Decimal = 0
Dim ObjVentas2 As New ClsVentas() Dim ObjVentas2 As New ClsVentas()
@@ -686,7 +688,7 @@ Partial Class Ventas_PVCobranza
If HdnTipoAmortizacion.Value = "4" Then If HdnTipoAmortizacion.Value = "4" Then
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe") PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
SaldoPendiente = SaldoPendiente - PagoAplicado SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
@@ -716,7 +718,7 @@ Partial Class Ventas_PVCobranza
End If End If
Else Else
PagoAplicado += respNC.Factura.Total PagoAplicado += respNC.Factura.Total
SaldoPendiente = SaldoPendiente - PagoAplicado SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
@@ -732,7 +734,7 @@ Partial Class Ventas_PVCobranza
End If End If
If MsgError = "" Then If MsgError = "" Then
If SaldoPendiente > 0 AndAlso VentaContado Then If SaldoPendienteVenta > 0 AndAlso VentaContado Then
If respFactura IsNot Nothing Then If respFactura IsNot Nothing Then
CvePrePoliza = respFactura.Factura.CvePrePoliza CvePrePoliza = respFactura.Factura.CvePrePoliza
@@ -741,36 +743,40 @@ Partial Class Ventas_PVCobranza
End If End If
If CvePrePoliza > 0 Then If CvePrePoliza > 0 Then
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteCredito.Text.ToDecimal SaldoPendienteVenta -= TxtImporteCredito.Text.ToDecimal
SaldoPendientePagos -= TxtImporteCredito.Text.ToDecimal
PagoAplicado += TxtImporteCredito.Text.ToDecimal PagoAplicado += TxtImporteCredito.Text.ToDecimal
End If End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteDebito.Text.ToDecimal SaldoPendienteVenta -= TxtImporteDebito.Text.ToDecimal
SaldoPendientePagos -= TxtImporteDebito.Text.ToDecimal
PagoAplicado += TxtImporteDebito.Text.ToDecimal PagoAplicado += TxtImporteDebito.Text.ToDecimal
End If End If
If SaldoPendiente > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then If SaldoPendientePagos > 0 AndAlso TxtImporteCheque.Text.ToDecimal > 0 Then
Dim Obs As String = "" Dim Obs As String = ""
If DivDatosCheque.Visible Then If DivDatosCheque.Visible Then
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}" Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
End If End If
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto) MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteCheque.Text.ToDecimal SaldoPendienteVenta -= TxtImporteCheque.Text.ToDecimal
SaldoPendientePagos -= TxtImporteCheque.Text.ToDecimal
PagoAplicado += TxtImporteCheque.Text.ToDecimal PagoAplicado += TxtImporteCheque.Text.ToDecimal
End If End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal SaldoPendienteVenta -= TxtImporteTransferencia.Text.ToDecimal
SaldoPendientePagos -= TxtImporteTransferencia.Text.ToDecimal
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
End If End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteOtrosContado.Text.ToDecimal > 0 Then If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteOtrosContado.Text.ToDecimal > 0 Then
Dim CveConceptroOtros As Integer = -1 Dim CveConceptroOtros As Integer = -1
Select Case DdlOtroFormaPago.SelectedValue Select Case DdlOtroFormaPago.SelectedValue
@@ -782,24 +788,27 @@ Partial Class Ventas_PVCobranza
CveConceptroOtros = 8 CveConceptroOtros = 8
End Select End Select
MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteOtrosContado.Text.ToDecimal SaldoPendienteVenta -= TxtImporteOtrosContado.Text.ToDecimal
SaldoPendientePagos -= TxtImporteOtrosContado.Text.ToDecimal
PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal
End If End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
PagoAplicado += PagoEfectivo PagoAplicado += PagoEfectivo
If PagoAplicado >= SaldoTotalInicial Then If PagoAplicado >= SaldoPendientePagos Then
TxtCambio.Text = (PagoAplicado - SaldoTotalInicial).FormatoNumero TxtCambio.Text = (PagoAplicado - SaldoPendientePagos).FormatoNumero
PagoEfectivo = SaldoPendiente PagoEfectivo = SaldoPendientePagos
End If End If
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) If SaldoPendienteVenta < 0 Then SaldoPendienteVenta = 0
SaldoPendiente -= PagoEfectivo MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, SaldoPendienteVenta, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendienteVenta -= PagoEfectivo
SaldoPendientePagos -= PagoEfectivo
End If End If
If SaldoPendiente > 0 Then If SaldoPendienteVenta > 0 Then
MsgError = "Tiene saldo pendiente por aplicar" MsgError = "Tiene saldo pendiente por aplicar"
End If End If
@@ -819,8 +828,50 @@ Partial Class Ventas_PVCobranza
End If End If
End If End If
If MsgError = "" Then
Dim CveIEPago As Integer = HdnCveIE.Value.ToEntero
'registrar los pagos a cobranza
For Each gvr As GridViewRow In GvCxC.Rows
If gvr.FCCheckBox("Chk").Checked Then
Dim VentaCxC As New Venta(UsuarioActual)
VentaCxC.CveVenta = gvr.DataKey("CveVenta").ToEntero
VentaCxC.TipoDocto = gvr.DataKey("TipoDocto")
VentaCxC.Fecha = gvr.DataKey("Fecha").ToDate
VentaCxC.CveCliente = gvr.DataKey("CveCliente").ToEntero
VentaCxC.CveMoneda = gvr.DataKey("CveMoneda").ToEntero
VentaCxC.SerieFolio = gvr.DataKey("SerieFolio")
VentaCxC.ClienteNombre = "sss" 'gvr.DataKey("ClienteNombre")
VentaCxC.TC = gvr.DataKey("TipoCambio").ToDecimal
VentaCxC.Total = gvr.DataKey("Total").ToDecimal
VentaCxC.IVA = gvr.DataKey("IVA").ToDecimal
VentaCxC.IEPS = gvr.DataKey("IEPS").ToDecimal
VentaCxC.RetIVA = gvr.DataKey("RetIVA").ToDecimal
VentaCxC.RetISR = gvr.DataKey("RetISR").ToDecimal
VentaCxC.PorcentajeIVA = gvr.DataKey("PorcentajeIVA").ToDecimal
VentaCxC.UsuarioActual = UsuarioActual
VentaCxC.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
Dim Pago As New VentaPago
Pago.ImportePagoVenta = gvr.DataKey("Saldo").ToDecimal
Pago.ImportePago = gvr.DataKey("Saldo").ToDecimal
Pago.CveIE = CveIEPago
Pago.CveMonedaPago = VentaCxC.CveMoneda
Pago.Fecha = NowADS()
Pago.Referencia = VentaCxC.SerieFolio
Pago.TipoPago = "XXX"
Dim ErrorConta As Boolean = AplicaPrePolizaPagoVenta(VentaCxC, Pago, CvePrePoliza, ObjConta)
If ErrorConta Then
MsgError = "Error en aplicación de pago en cobranza"
End If
End If
Next
End If
Else Else
MsgError = "Error al registrar prepólizas" MsgError = "Error al registrar prepólizas"
End If End If
Else Else
'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO 'SI NO TIENE SALDO PENDIENTE NO GENERAR POLIZA PARA EL PAGO
@@ -1020,6 +1071,7 @@ Partial Class Ventas_PVCobranza
TxtImporteTransferencia.Text = "" TxtImporteTransferencia.Text = ""
TxtImporteOtrosContado.Text = "" TxtImporteOtrosContado.Text = ""
TxtCambio.Text = "" TxtCambio.Text = ""
TxtCxCAplicado.Text = ""
TxtClaveAutorizacion.Text = "" TxtClaveAutorizacion.Text = ""
TxtAutorizo.Text = "" TxtAutorizo.Text = ""
TxtNCDev.Text = "" TxtNCDev.Text = ""
@@ -1028,7 +1080,6 @@ Partial Class Ventas_PVCobranza
CveCliente = -1 CveCliente = -1
CveVendedor = -1 CveVendedor = -1
If TmpDTAnticiposNCIxCCliente IsNot Nothing Then If TmpDTAnticiposNCIxCCliente IsNot Nothing Then
TmpDTAnticiposNCIxCCliente.Clear() TmpDTAnticiposNCIxCCliente.Clear()
TmpDTAnticiposNCIxCCliente = Nothing TmpDTAnticiposNCIxCCliente = Nothing
@@ -1216,12 +1267,12 @@ Partial Class Ventas_PVCobranza
For Each dr As DataRow In DtAnticipos.Rows For Each dr As DataRow In DtAnticipos.Rows
SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}", SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString, dr("CveIE").ToString,
dr("CveVenta").ToString, dr("CveVenta").ToString,
Retorno.Factura.CveCliente, Retorno.Factura.CveCliente,
Retorno.CveVenta, Retorno.CveVenta,
Retorno.Factura.Total, Retorno.Factura.Total,
(Retorno.Factura.Total - Retorno.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>") (Retorno.Factura.Total - Retorno.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>")
Next Next
@@ -1488,7 +1539,7 @@ Partial Class Ventas_PVCobranza
Return MsgErrorTimbrado Return MsgErrorTimbrado
End Function End Function
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImporteAbonoVenta As Decimal, ImporteBancos As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
Dim Retorno As String = "" Dim Retorno As String = ""
If CveBancoCuenta > 0 Then If CveBancoCuenta > 0 Then
Dim CveIEPago As Integer = 0 Dim CveIEPago As Integer = 0
@@ -1496,25 +1547,31 @@ Partial Class Ventas_PVCobranza
If String.IsNullOrEmpty(Obs) Then If String.IsNullOrEmpty(Obs) Then
Obs = VentaActual.SerieFolio Obs = VentaActual.SerieFolio
End If End If
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto) CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteBancos, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
If CveIEPago > 0 Then If CveIEPago > 0 Then
Dim Pago As New VentaPago Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
Pago.ImportePagoVenta = ImportePago
Pago.ImportePago = ImportePago If ImporteBancos > 0 Then
Pago.CveIE = CveIEPago Dim Pago As New VentaPago
Pago.CveMonedaPago = VentaActual.CveMoneda Pago.ImportePagoVenta = tImportePago
Pago.Fecha = NowADS() Pago.ImportePago = ImporteBancos
Pago.Referencia = VentaActual.SerieFolio Pago.CveIE = CveIEPago
Pago.CveMonedaPago = VentaActual.CveMoneda
Pago.Fecha = NowADS()
Pago.Referencia = VentaActual.SerieFolio
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
End If
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
If ErrorConta Then If ErrorConta Then
Retorno = "Error en aplicación de pago" Retorno = "Error en aplicación de pago"
End If End If
Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3)))) Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3))))
If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImportePago) Then If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImporteBancos) Then
Retorno = "Error en aplicación de pago.." Retorno = "Error en aplicación de pago.."
ErrorConta = True ErrorConta = True
End If End If
HdnCveIE.Value = CveIEPago.ToString
Else Else
Retorno = "Pago en Bancos no registrado" Retorno = "Pago en Bancos no registrado"
ErrorConta = True ErrorConta = True
@@ -2918,6 +2975,44 @@ Partial Class Ventas_PVCobranza
End Sub End Sub
Protected Sub LnkCxC_Click(sender As Object, e As EventArgs)
CargaCxC(1, HdnCveCliente.Value.ToEntero) 'solo pesos
End Sub
Private Sub CargaCxC(pCveMoneda As Integer, pCveCliente As Integer)
Dim Mov As New ClsMovimientos
Dim FechaI As String = IfNull(Request("FechaI"), "-1").ToString
Dim FechaF As String = IfNull(Request("FechaF"), "-1").ToString
Dim FechaCorte As Date = NowADS().AddYears(1).ToShortDateString.ToString.ToDate
If Mov.GetCxCClienteDetalle(pCveCliente, FechaI, FechaF, pCveMoneda, -1, UsuarioActual.CveEmpresa, -1, FechaCorte:=FechaCorte) Then
Dim TmpCxCAux As DataTable
TmpCxCAux = Mov.DtResultados.FiltraParametros("Saldo > 0 AND TipoDocto = 'Ing'", "Fecha,SerieFolio")
GvCxC.DataSource = Mov.DtResultados.FiltraParametros("Saldo > 0 AND TipoDocto = 'Ing'", "Fecha,SerieFolio")
End If
Mov.Dispose()
GvCxC.DataBind()
TxtCxCAplicado.Text = ""
UPPCxC.Update()
RegistraScript("$('#divCxC').modal('show');", "AE2")
End Sub
Protected Sub BtnAplicarCxC_Click(sender As Object, e As EventArgs)
Dim SaldoCxC As Decimal = 0
For Each GvRow As GridViewRow In GvCxC.Rows
If GvRow.FCCheckBox("Chk") IsNot Nothing AndAlso GvRow.FCCheckBox("Chk").Checked Then
SaldoCxC += GvRow.DataKey("Saldo").ToDecimal
End If
Next
TxtCxCAplicado.Text = (SaldoCxC).FormatoNumero
TxtImporteContado.Text = (LtlSaldo.Text.ToDecimal + SaldoCxC).FormatoNumero
RegistraScript("$('#divCxC').hide();", "AE21")
UPPCobranza.Update()
UPPTotalesContado.update
End Sub
End Class End Class
Public Class MRespuestaSAT Public Class MRespuestaSAT

View File

@@ -1824,6 +1824,7 @@
<ContentTemplate> <ContentTemplate>
<asp:TextBox ID="TxtTotal" runat="server" CssClass="TextBoxAsLabel" ClientIDMode="Static" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox> <asp:TextBox ID="TxtTotal" runat="server" CssClass="TextBoxAsLabel" ClientIDMode="Static" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox>
<asp:HiddenField ID="HdnVentaSaldo" runat="server" ClientIDMode="Static" Value="0" /> <asp:HiddenField ID="HdnVentaSaldo" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnVentaSaldoOriginal" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnCveVenta" runat="server" ClientIDMode="Static" Value="0" /> <asp:HiddenField ID="HdnCveVenta" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnSubTotalDescuestos" runat="server" ClientIDMode="Static" Value="0" /> <asp:HiddenField ID="HdnSubTotalDescuestos" runat="server" ClientIDMode="Static" Value="0" />
@@ -10854,7 +10855,7 @@
if (totalAnt > SaldoCompra) { if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2); txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
$get('HdnVentaSaldo').value = 0.00; //$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo"); alert("El Importe no debe de exceder a el saldo");
} }
@@ -10864,7 +10865,7 @@
} else { } else {
$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value); //$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = ""; txt.value = "";
} }
@@ -10915,7 +10916,7 @@
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$get('HdnVentaSaldo').value = Total - FnSumaValoresAnt(); //$get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
} }
function FnSumaValoresAnt() { function FnSumaValoresAnt() {