Portal de Prosepago

This commit is contained in:
2020-09-04 16:48:50 -07:00
parent 0984313859
commit 1e06ff051a
2 changed files with 98 additions and 34 deletions

View File

@@ -564,9 +564,13 @@ Partial Class Ventas_PortalCliente
DtPagos.Columns.Add("TCVenta", GetType(Decimal))
DtPagos.Columns.Add("ImporteVenta", GetType(Decimal))
DtPagos.Columns.Add("IVA", GetType(Decimal))
DtPagos.Columns.Add("PorcentajeIVA", GetType(Decimal))
DtPagos.Columns.Add("RetIVA", GetType(Decimal))
DtPagos.Columns.Add("RetISR", GetType(Decimal))
DtPagos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
DtPagos.Columns.Add("RetISR", GetType(Decimal))
DtPagos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
DtPagos.Columns.Add("IEPS", GetType(Decimal))
DtPagos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
DtPagos.Columns.Add("TCPago", GetType(Decimal))
DtPagos.Columns.Add("ImportePago", GetType(Decimal))
DtPagos.Columns.Add("ImportePagoMX", GetType(Decimal))
@@ -584,11 +588,14 @@ Partial Class Ventas_PortalCliente
Dr("CveMoneda") = Gvr.DataKey("CveMoneda").ToEntero
Dr("TCVenta") = Gvr.DataKey("TipoCambio").ToDecimal
Dr("ImporteVenta") = Gvr.DataKey("Original").ToDecimal
Dr("IVA") = Gvr.DataKey("IVA").ToDecimal
Dr("IVA") = Gvr.DataKey("IVA").ToDecimal
Dr("PorcentajeIVA") = Gvr.DataKey("PorcentajeIVA").ToDecimal
Dr("RetIVA") = Gvr.DataKey("RetIVA").ToDecimal
Dr("RetISR") = Gvr.DataKey("RetISR").ToDecimal
Dr("IEPS") = Gvr.DataKey("IEPS").ToDecimal
Dr("PorcentajeRetIVA") = Gvr.DataKey("PorcentajeRetIVA").ToDecimal
Dr("RetISR") = Gvr.DataKey("RetISR").ToDecimal
Dr("PorcentajeRetISR") = Gvr.DataKey("PorcentajeRetISR").ToDecimal
Dr("IEPS") = Gvr.DataKey("IEPS").ToDecimal
Dr("PorcentajeIEPS") = Gvr.DataKey("PorcentajeIEPS").ToDecimal
Dr("TCPago") = If(Gvr.DataKey("CveMoneda").ToEntero = 1, 1, TCPago)
Dr("ImportePago") = Gvr.DataKey("Saldo").ToDecimal
If Gvr.DataKey("CveMoneda").ToEntero > 1 Then
@@ -615,10 +622,14 @@ Partial Class Ventas_PortalCliente
DivPagoDolares.Visible = False
End If
LbFactura.Text = Facturas.Substring(0, Facturas.Length - 2)
'LbFactura.Text = Facturas.Substring(0, Facturas.Length - 2)
TxtImporte.Text = DtPagos.SUM("ImportePagoMX").FormatoNumero(2)
RVTxtImporte.MaximumValue = DtPagos.SUM("ImportePagoMX").FormatoNumero(2)
TxtConcepto.Text = "Pago de facturas"
TxtReferencia.Text = CveCliente.ToString
TxtNombreCompleto.Text = LtlCliente.Text
RegistraScript("$('#ModalProsePago').modal()")
UpProsePago.Update()
@@ -644,11 +655,11 @@ Partial Class Ventas_PortalCliente
End Select
Dim myNameValueCollection As New NameValueCollection()
Dim Nombre = LimpiaTextoSoloLetras(LtlCliente.Text)
Dim Facturas = LimpiaTextoSoloLetrasNumeros(LbFactura.Text.Replace(",", " "))
Dim Nombre = LimpiaTextoSoloLetras(TxtNombreCompleto.Text)
myNameValueCollection.Add("nom", Nombre.Substring(0, If(Nombre.Length > 200, 200, Nombre.Length)))
myNameValueCollection.Add("con", $"Pago de facturas {Facturas.Substring(0, If(Facturas.Length > 180, 180, Facturas.Length))}")
myNameValueCollection.Add("ref", CveCliente.ToString)
myNameValueCollection.Add("con", TxtConcepto.Text)
myNameValueCollection.Add("ref", TxtReferencia.Text)
myNameValueCollection.Add("imp", TxtImporte.Text)
myNameValueCollection.Add("ema", UsuarioActual.Usuario) '
myNameValueCollection.Add("urlOk", $"{Request.Url.GetLeftPart(UriPartial.Authority)}/PortalCliente/PortalCliente.aspx?okpp=1&p={Parametro}")
@@ -746,7 +757,7 @@ Partial Class Ventas_PortalCliente
' PREPOLIZA
Dim CvePlantillaPoliza = 11
Dim FechaMovimiento As Date = Now
Dim Concepto = ""
Dim Concepto = "Prosepago"
Dim DtConceptos As New DataTable
Dim CveMonedaPago = 1
@@ -764,9 +775,13 @@ Partial Class Ventas_PortalCliente
Dim CveMonedaVenta = 1
Dim TCVenta = 0.0D
Dim IVAVenta = 0.0D
Dim RetIVAVenta = 0.0D
Dim PorcentajeIVA = 0.0D
Dim RetIVAVenta = 0.0D
Dim PorcentajeRetIVA = 0.0D
Dim RetISRVenta = 0.0D
Dim IEPSVenta = 0.0D
Dim PorcentajeRetISR = 0.0D
Dim IEPSVenta = 0.0D
Dim PorcentajeIEPS = 0.0D
Dim TCPago = 0.0D
Dim PorcentajePago = 0.0D
Dim ImportePago = 0.0D
@@ -774,6 +789,7 @@ Partial Class Ventas_PortalCliente
Dim TCGeneral = 0.0D
Dim TCFluctuacion = 0.0D
Dim CveProveedorContabilizar = -1
Dim PorcentajeImpuesto As Decimal = 0
Dim CvePrePoliza = ObjConta.AddPrePolizas("PortalCliente/Pago-Prosepago", CvePlantillaPoliza, TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal, CveMonedaPago, FechaMovimiento, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
@@ -795,6 +811,7 @@ Partial Class Ventas_PortalCliente
importeMX = 0
IdCtaContable = 0
CveCuenta = 0
PorcentajeImpuesto = 0
ConceptoMovimiento = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, LtlCliente.Text, DrPago("Factura").ToString, DrPago("Factura").ToString)
'VALORES DE LA VENTA
Referencia = DrPago("Factura").ToString
@@ -802,18 +819,22 @@ Partial Class Ventas_PortalCliente
CveVenta = DrPago("CveVenta").ToString.ToEntero
CveMonedaVenta = DrPago("CveMoneda").ToString.ToEntero
TCVenta = DrPago("TCVenta").ToString.ToDecimal
IVAVenta = DrPago("IVA").ToString.ToDecimal
RetIVAVenta = DrPago("RetIVA").ToString.ToDecimal
RetISRVenta = DrPago("RetISR").ToString.ToDecimal
IEPSVenta = DrPago("IEPS").ToString.ToDecimal
IVAVenta = DrPago("IVA").ToString.ToDecimal
PorcentajeIVA = DrPago("PorcentajeIVA").ToString.ToDecimal
RetIVAVenta = DrPago("RetIVA").ToString.ToDecimal
PorcentajeRetIVA = DrPago("PorcentajeRetIVA").ToString.ToDecimal
RetISRVenta = DrPago("RetISR").ToString.ToDecimal
PorcentajeRetISR = DrPago("PorcentajeRetISR").ToString.ToDecimal
IEPSVenta = DrPago("IEPS").ToString.ToDecimal
PorcentajeIEPS = DrPago("PorcentajeIEPS").ToString.ToDecimal
TCPago = DrPago("TCPago").ToString.ToDecimal
ImportePago = DrPago("ImportePago").ToString.ToDecimal
ImportePagoMX = DrPago("ImportePagoMX").ToString.ToDecimal
PorcentajePago = DrPago("ImportePago").ToString.ToDecimal / DrPago("ImporteVenta").ToString.ToDecimal 'EL IMPORTE PAGO ES EL IMPORTE QUE SE PAGÓ EN LA MONEDA ORIGINAL DE LA VENTA
TCFluctuacion = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", TCVenta, TCPago)
'CONFIGURACION POR CONCEPTO DE PREPOLIZA
TCFluctuacion = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", TCVenta, TCPago)
'CONFIGURACION POR CONCEPTO DE PREPOLIZA
Select Case ConceptoContable
Case 2 'PAGO CLIENTE
ImporteMovimiento = ImportePago.RoundSQL()
@@ -854,6 +875,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = IVAVenta * PorcentajePago
importeMX = ImporteMovimiento * TCVenta
End If
PorcentajeImpuesto = PorcentajeIVA
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -871,6 +893,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = IVAVenta * PorcentajePago
importeMX = ImporteMovimiento * TCFluctuacion
End If
PorcentajeImpuesto = PorcentajeIVA
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -888,6 +911,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = RetIVAVenta * PorcentajePago
importeMX = ImporteMovimiento * TCVenta
End If
PorcentajeImpuesto = PorcentajeRetIVA
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -920,6 +944,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = RetIVAVenta * PorcentajePago
importeMX = ImporteMovimiento * TCFluctuacion
End If
PorcentajeImpuesto = PorcentajeRetIVA
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -953,6 +978,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = RetISRVenta * PorcentajePago
importeMX = ImporteMovimiento * TCVenta
End If
PorcentajeImpuesto = PorcentajeRetISR
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -986,6 +1012,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = RetIVAVenta * PorcentajePago
importeMX = ImporteMovimiento * TCFluctuacion
End If
PorcentajeImpuesto = PorcentajeRetISR
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -1019,6 +1046,7 @@ Partial Class Ventas_PortalCliente
ImporteMovimiento = IEPSVenta * PorcentajePago
importeMX = ImporteMovimiento * TCVenta
End If
PorcentajeImpuesto = PorcentajeIEPS
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -1035,7 +1063,8 @@ Partial Class Ventas_PortalCliente
ElseIf CveMonedaVenta = 2 Then
ImporteMovimiento = IEPSVenta * PorcentajePago
importeMX = ImporteMovimiento * TCFluctuacion
End If
End If
PorcentajeImpuesto = PorcentajeIEPS
ImporteMovimiento = ImporteMovimiento.RoundSQL()
importeMX = importeMX.RoundSQL()
@@ -1081,7 +1110,7 @@ Partial Class Ventas_PortalCliente
'AGREGA PREPOLIZA DETALLE
If ImporteMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TCGeneral) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TCGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
TieneError = True
MensajeError.Append("No se pudo insertar el detalle de la póliza<br>")
Exit For
@@ -3438,7 +3467,7 @@ Partial Class Ventas_PortalCliente
End Sub
Private Sub EnviarCorreoPedido(ObjFactura As Modelos.Factura)
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura, ""))
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura))
Hilo.Start()
End Sub