diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb
index eed0dc218..e83e9f36d 100644
--- a/Bancos/IE.aspx.vb
+++ b/Bancos/IE.aspx.vb
@@ -4304,6 +4304,12 @@ Partial Class Bancos_IE
End If
End If
+ If Not ErrorCompra Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ErrorCompra = True
+ End If
+ End If
+
If Not ErrorCompra Then
Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion)
ObjAC.Commit()
@@ -4660,8 +4666,8 @@ Partial Class Bancos_IE
ObjGral.Dispose()
If Borrar = True Then
Dim ObjAC As ClsContPAQi = Nothing
- Dim Banc As New ClsBancos
- Banc.IniciaTransacSQL()
+ Dim Banc As New ClsBancos
+ Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
Dim ErrorCompra = False
@@ -4680,6 +4686,13 @@ Partial Class Bancos_IE
End If
End If
+ If Not ErrorCompra Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ErrorCompra = True
+ End If
+ End If
+
+
If Not ErrorCompra Then
If Not Banc.EliminarBancos_IE(UsuarioActual.CveUsuario, CveIE) Then
ErrorCompra = True
@@ -4698,6 +4711,7 @@ Partial Class Bancos_IE
If ObjAC IsNot Nothing Then ObjAC.Dispose()
Banc.Dispose()
+ ObjConta.Dispose()
End If
Else
Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion)
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index cc75184c1..fea2e0d27 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -7760,6 +7760,7 @@ Partial Class Compras_Compras
Dim ObjAC As ClsContPAQi = Nothing
Dim Comp As New ClsCompras()
Dim ObjEventos As New ClsOIEventos(Comp.IniciaTransacSQL())
+ Dim ObjConta As New ClsContabilidad(Comp.IniciaTransacSQL())
Dim ErrorCompra = False
@@ -7781,6 +7782,12 @@ Partial Class Compras_Compras
Next
End If
+ If Not ErrorCompra Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ErrorCompra = True
+ End If
+ End If
+
If Not ErrorCompra Then
If Not Comp.DeleteCompra(CveCompra, False) Then
ErrorCompra = True
@@ -7799,6 +7806,7 @@ Partial Class Compras_Compras
If ObjAC IsNot Nothing Then ObjAC.Dispose()
Comp.Dispose()
+ ObjConta.Dispose()
End Sub
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
@@ -12857,6 +12865,12 @@ Partial Class Compras_Compras
End If
End If
+ If Not ErrorCompra Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ErrorCompra = True
+ End If
+ End If
+
If Not ErrorCompra Then
Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion)
ObjAC.Commit()
diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb
index 1eaef6527..e283fc11f 100644
--- a/Contabilidad/PopUpAuxiliar.aspx.vb
+++ b/Contabilidad/PopUpAuxiliar.aspx.vb
@@ -247,6 +247,12 @@ Partial Class PopUpAuxiliar
Dim TieneError = False
+ If Not TieneError Then
+ If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then
+ TieneError = True
+ End If
+ End If
+
If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then
TieneError = True
End If
@@ -266,6 +272,7 @@ Partial Class PopUpAuxiliar
If Not ObjContPaq.RemovePoliza(IdPoliza) Then
TieneError = True
End If
+
End If
End If
End If
diff --git a/Empresas/Grales/Formatos/RepProductosServicios.rdlc b/Empresas/Grales/Formatos/RepProductosServicios.rdlc
index 31340a20b..e7890ec50 100644
--- a/Empresas/Grales/Formatos/RepProductosServicios.rdlc
+++ b/Empresas/Grales/Formatos/RepProductosServicios.rdlc
@@ -33,6 +33,7 @@
+ LightGrey
2pt
2pt
2pt
@@ -47,19 +48,19 @@
- 2.71123cm
+ 2.36727cm
- 2.71123cm
+ 2.63186cm
- 2.71123cm
+ 2.55248cm
- 2.71123cm
+ 2.12915cm
- 2.71123cm
+ 2.49956cm
@@ -77,13 +78,15 @@
=Fields!Cantidad.Value
@@ -92,6 +95,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -111,12 +115,16 @@
=Fields!SubTotal.Value
-
+
SubTotal
@@ -124,6 +132,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -143,12 +152,16 @@
=Fields!Descuento.Value
-
+
Descuento
@@ -156,6 +169,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -175,12 +189,16 @@
=Fields!IVA.Value
-
+
IVA
@@ -188,6 +206,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -207,12 +226,16 @@
=Fields!Total.Value
-
+
Total
@@ -220,6 +243,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -260,6 +284,7 @@
DimGray
+ LightGrey
2pt
2pt
2pt
@@ -295,6 +320,7 @@
DimGray
+ LightGrey
2pt
2pt
2pt
@@ -330,6 +356,7 @@
DimGray
+ LightGrey
2pt
2pt
2pt
@@ -365,6 +392,7 @@
DimGray
+ LightGrey
2pt
2pt
2pt
@@ -400,6 +428,7 @@
DimGray
+ LightGrey
2pt
2pt
2pt
@@ -419,13 +448,8 @@
=Fields!GPO.Value
-
-
- =Fields!GPO.Value
-
-
- 5.42245cm
+ 6.79828cm
true
@@ -436,7 +460,9 @@
=Fields!GPO.Value
@@ -448,6 +474,7 @@
+ =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent")
2pt
2pt
2pt
@@ -893,6 +920,10 @@
Total
System.Double
+
+ Orden
+ System.String
+
DataSet
diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb
index 5219336c1..cb508eee9 100644
--- a/Inventarios/EntradasSalidas.aspx.vb
+++ b/Inventarios/EntradasSalidas.aspx.vb
@@ -244,6 +244,14 @@ Partial Class Inventarios_EntradasSalidas
ViewState("Tipo") = value
End Set
End Property
+ Private Property CvePrePoliza As Integer
+ Get
+ Return CType(ViewState("CvePrePoliza"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("CvePrePoliza") = value
+ End Set
+ End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -256,6 +264,7 @@ Partial Class Inventarios_EntradasSalidas
EstatusAlmacenCompra = -1
EsConsumoInterno = False
EsNuevoMov = False
+ CvePrePoliza = -1
CreaDT()
CargaCombos()
@@ -579,6 +588,7 @@ Partial Class Inventarios_EntradasSalidas
If DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero > 0 Then
HplPrePoliza.Visible = True
HplPrePoliza.NavigateUrl = String.Format("/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}", DtMov.Rows(0)("CvePrePoliza"))
+ CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero
Else
If UsuarioActual.CveRol = 1 Then
BtnGeneraPrepoliza.Visible = True
@@ -1035,14 +1045,10 @@ Partial Class Inventarios_EntradasSalidas
Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles BtnRemove.Click
Dim Borrar As Boolean = False
If Not TxtDescripcion.Text = "" Then
- Dim ObjGral As New ClsGenerales
- ObjGral.IniciaTransacSQL()
- If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Inventarios", TxtFolio.Text + " / " + DdlConcepto.SelectedItem.Text) Then
- Borrar = True
- End If
Dim Inv As New ClsInventarios
- Inv.IniciaTransacSQL()
+ Dim Conta As New ClsContabilidad(Inv.IniciaTransacSQL())
+ Dim ObjGral As New ClsGenerales(Inv.IniciaTransacSQL())
Dim TieneError = False
@@ -1052,6 +1058,9 @@ Partial Class Inventarios_EntradasSalidas
ObjConta.IniciaTransacSQL()
End If
+ If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Inventarios", TxtFolio.Text + " / " + DdlConcepto.SelectedItem.Text) Then
+ TieneError = True
+ End If
If Inv.MovimientoRemove(CveMovimiento, UsuarioActual.CveEmpresa) Then
If HdnIdPoliza.Value.ToEntero > 0 Then
@@ -1063,10 +1072,15 @@ Partial Class Inventarios_EntradasSalidas
TieneError = True
End If
+ If Not TieneError Then
+ If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ TieneError = True
+ End If
+ End If
+
If Not TieneError Then
If ObjConta IsNot Nothing Then ObjConta.Commit()
Inv.Commit()
- ObjGral.Commit()
Alert("Movimientos Eliminado", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divDescripcion"))
@@ -1074,7 +1088,6 @@ Partial Class Inventarios_EntradasSalidas
Else
If ObjConta IsNot Nothing Then ObjConta.RollBack()
Inv.RollBack()
- ObjGral.RollBack()
Alert("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.", TipoMensaje.MsgError)
End If
@@ -1083,6 +1096,7 @@ Partial Class Inventarios_EntradasSalidas
If ObjConta IsNot Nothing Then ObjConta.Dispose()
Inv.Dispose()
ObjGral.Dispose()
+ Conta.Dispose()
End If
End Sub
#End Region
diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb
index 01d4b6852..76700abb6 100644
--- a/Inventarios/RecepcionUsados.aspx.vb
+++ b/Inventarios/RecepcionUsados.aspx.vb
@@ -633,7 +633,7 @@ Partial Class Inventarios_RecepcionUsados
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
Dim Inv As New ClsInventarios
- Inv.IniciaTransacSQL()
+ Dim Conta As New ClsContabilidad(Inv.IniciaTransacSQL())
Dim TieneError = False
@@ -654,6 +654,12 @@ Partial Class Inventarios_RecepcionUsados
TieneError = True
End If
+ 'If Not TieneError Then
+ ' If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ' TieneError = True
+ ' End If
+ 'End If
+
If Not TieneError Then
If ObjConta IsNot Nothing Then ObjConta.Commit()
Inv.Commit()
@@ -670,6 +676,7 @@ Partial Class Inventarios_RecepcionUsados
If ObjConta IsNot Nothing Then ObjConta.Dispose()
Inv.Dispose()
+ Conta.Dispose()
End Sub
#End Region
diff --git a/Ventas/RepProductosServicios.aspx.vb b/Ventas/RepProductosServicios.aspx.vb
index b9125ff52..648d3cfdf 100644
--- a/Ventas/RepProductosServicios.aspx.vb
+++ b/Ventas/RepProductosServicios.aspx.vb
@@ -476,8 +476,8 @@ Partial Class Ventas_RepProductosServicios
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
- params.Add(New ReportParameter("FechaInicio", FechaI.ToShortDateString))
- params.Add(New ReportParameter("FechaFin", FechaF.ToShortDateString))
+ params.Add(New ReportParameter("FechaInicio", If(txtFechaI.Text <> "", FechaI.ToShortDateString, "")))
+ params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, "")))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 7f4141744..77dc78ae2 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -13860,778 +13860,784 @@ Partial Class Ventas
#End Region
#End Region
-#Region "M E T O D O S"
- Private Sub CargaOtrosConceptos()
- Dim ObjVentas As New ClsVentas
- If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then
- GVOtrosConceptos.DataSource = ObjVentas.DtResultados
- GVOtrosConceptos.DataBind()
- UpOtrosConceptos.Update()
- End If
- ObjVentas.Dispose()
- End Sub
- Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer
- Dim Retorno As Integer = 0
- Dim IDPoliza As Integer = 0
-
- Dim ErrorAC As Boolean = False
- 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
- Dim Fecha As Date = factura.Fecha
- Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
- Dim Paridad As Integer = 1
- Dim TipoMovto As Boolean = False
-
- If CancelacionIngreso Then
- Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
- Paridad = -1
- TipoMovto = True
- End If
-
- Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
-
- IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
- Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
- 'Dim Importe As Double = TxtTotal.Text.ToDouble
- Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes
- Dim CtaISSSTESON As Integer = 643
- Dim CtaISPT As Integer = 1745
- ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
-
- If IDPoliza > 0 Then
-
- 'Orden de PAGO
- If factura.TipoDocto = "OP" Then
-
- If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
- 'ISSSTESON
-
- If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
-
- Else
- 'ISPT
-
- If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- End If
-
- ' NORMAL
- Else
- Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
- Group gvr By Grp = New With {
- Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
- } Into Group
- Select Grp.CvePresupuestoIngreso,
- TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
-
-
- 'Select Case TipoComprobante
- ' Case "Ing", "Egs"
- For Each grp In Detalles
- dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
- Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
-
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'CARGO la deuda del cliente
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'abono,
- If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Next
-
- 'Case "OP", "Com"
- ' Dim Importe As Decimal = 0
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
-
- ' End If
- ' End If
- 'End Select
- End If
-
- Else
- ErrorAC = True
-
- End If
-
- If Not ErrorAC Then
- ObjAC.AjustaPoliza(IDPoliza)
-
- Retorno = IDPoliza
- Else
-
- Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
- End If
-
- ' ObjAC.Dispose()
-
- Return Retorno
-
- End Function
- Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer
- Dim Retorno As Integer = 0
- Dim IDPoliza As Integer = 0
-
- Dim ErrorAC As Boolean = False
- 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
- Dim Fecha As Date = TxtFecha.Text.ToDate
- Dim Concepto As String = String.Format("GD {0}", NombreCliente)
- Dim Paridad As Integer = 1
- Dim TipoMovto As Boolean = False
-
- If CancelacionIngreso Then
- Concepto = String.Format("Cancelación GD {0}", NombreCliente)
- Paridad = -1
- TipoMovto = True
- End If
-
- Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1)
-
- IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha)
- Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
- 'Dim Importe As Double = TxtTotal.Text.ToDouble
- Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero
- Dim CtaISSSTESON As Integer = 643
- Dim CtaISPT As Integer = 1745
- ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
-
- If IDPoliza > 0 Then
-
- 'Orden de PAGO
- If DdlTipoComprobante.SelectedValue.ToString = "OP" Then
-
- If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
- 'ISSSTESON
-
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
-
- Else
- 'ISPT
-
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- End If
-
- ' NORMAL
- Else
- Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
- Group gvr By Grp = New With {
- Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
- } Into Group
- Select Grp.CvePresupuestoIngreso,
- TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
-
-
- 'Select Case TipoComprobante
- ' Case "Ing", "Egs"
- For Each grp In Detalles
- dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
- Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
-
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'CARGO la deuda del cliente
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'abono,
- If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Next
-
- 'Case "OP", "Com"
- ' Dim Importe As Decimal = 0
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
-
- ' End If
- ' End If
- 'End Select
- End If
-
- Else
- ErrorAC = True
-
- End If
-
- If Not ErrorAC Then
- ObjAC.AjustaPoliza(IDPoliza)
-
- Retorno = IDPoliza
- Else
-
- Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError)
- End If
-
- ' ObjAC.Dispose()
-
- Return Retorno
-
- End Function
- Private Sub SetValues()
- ViewState("TipoCambio") = 1
-
- If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "")
- If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "")
-
- If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto
- TxtPS.Enabled = False
- DivDdlTipo.Visible = True
- DivTxtModelo.Visible = True
- DivTxtAdicional.Visible = True
- DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();")
- DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();")
- TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
- TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
-
- CargaClasificacionesDetalles()
- ClasificacionModal()
-
- End If
-
- If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM
- RBLPago.Items.RemoveAt(2)
- End If
-
-
- End Sub
- Private Sub SetPermisos()
- If CveVenta < 1 Then
- 'Puede cotizar
- If Not UsuarioActual.TienePermisoProceso(59) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
- End If
-
- 'Puede Hacer NC
- If Not UsuarioActual.TienePermisoProceso(175) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
- End If
-
- 'Puede Hacer Devolución
- If Not UsuarioActual.TienePermisoProceso(264) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
- End If
-
- 'Puede facturar
- If Not UsuarioActual.TienePermisoProceso(60) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
- End If
-
- 'Puede remisionar
- If Not UsuarioActual.TienePermisoProceso(199) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- LnkFacturarRemision.Visible = False
- LnkRemisiones.Visible = False
- End If
-
- '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS
- ''Puede remisionar
- 'If Not UsuarioActual.TienePermisoProceso(199) Then
- ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- 'End If
-
- ''MODO SOLO LECTURA
- 'If DdlTipoComprobante.Items.Count = 0 Then
- ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1"))
- ' TrBotones.Visible = False
- 'End If
-
- ConfiguraTipoDocto()
- End If
- End Sub
- Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
-
- Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
- Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
- Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal
- Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal
- Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal
- Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal
- Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal
- Dim Total As Decimal = 0
- Dim TotalImpuestosLocales As Decimal = 0
-
- If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
- If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
- For Each dr As DataRow In TmpDT.Rows
- dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
- Next
-
- If TmpDTImpuestos IsNot Nothing Then
- For Each dr2 As DataRow In TmpDTImpuestos.Rows
- dr2("Importe") = 0
- Next
- TmpDTImpuestos.AcceptChanges()
- End If
-
- TmpDT.AcceptChanges()
- TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal
- TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal
- TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal
- TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal
- TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal
- End If
- End If
-
- If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then
- If TotalSubTotal <> TotalAmortizacion Then
- For Each drt As DataRow In TmpDTImpuestos.Rows
- drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100
- Next
- End If
-
- GvImpuestosLocales2.DataSource = TmpDTImpuestos
- GvImpuestosLocales2.DataBind()
- End If
-
- For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
- If gvr.RowType = DataControlRowType.DataRow Then
-
- If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
- If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local
- TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
- Else
- TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
- End If
- End If
- End If
- Next
-
- 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False
- If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False
- If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False
- If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False
-
- If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then
- TotalAmortizacion = 0
- End If
-
-
- Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
- LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
- TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2)
- LblDescuentos.Text = TotalDescuentos.FormatoNumero
- TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2)
- TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2)
- TxtRetISR.Text = TotalRetISR.FormatoNumero(2)
- TxtIVA.Text = TotalIVA.FormatoNumero
- TxtIEPS.Text = TotalIEPS.FormatoNumero
- TxtTotal.Text = Total.FormatoNumero
-
- LblAmort.Text = TxtSubTotal.Text
- If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
- HdnVentaSaldo.Value = Total.ToString
- Else
- HdnVentaSaldo.Value = SaldoVenta.ToString
- End If
- HdnIVAOriginal.Value = TxtIVA.Text
-
- 'JJMQ 20160506: Se agrego para la validacion de pago de contado.
- CVImporteContado.ValueToCompare = Total.ToString
-
- If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then
- Alert($"Los siguientes conceptos hace falta especificar clave SAT
{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia)
- MensajeCveSAT.Clear()
- End If
-
- Dim view As DataView = New DataView(TmpDT)
- view.Sort = "Consec"
- GvPS.DataSource = view
- GvPS.DataBind()
-
- 'RECARGA GV INVENTARIO
- If Not CveVenta > 0 Then
- DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
- CargaGVInv(DtInv)
- End If
-
- UpContado.Update()
- UpPS.Update()
- RegistraScript("BorraDescuentos();", "BorraDescuentos")
- End Sub
- Private Function ValidaAdendaFEMSA() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaFEMSA Then
- Retorno = True
- Else
- If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then
- Retorno = False
- Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then
- Retorno = False
- Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then
- Retorno = False
- Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
- End If
-
- Return Retorno
- End Function
- Private Function ValidaComplementoDetallista() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaDetallista Then
- Retorno = True
- Else
- If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then
- Retorno = False
- Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "")
- ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then
- Retorno = False
- Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then
- Retorno = False
- Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then
- Retorno = False
- Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
- End If
-
- Return Retorno
- End Function
- Private Function ValidaComplementoFord() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaFord Then
- Retorno = True
- Else
- If TxtFordGSDB.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- If LstFordASN.Items.Count = 0 Then
- Retorno = True
- 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
-
- End If
- End If
-
- Return Retorno
- End Function
- Private Sub VinculaCotizacionVenta()
- Dim ObjVentas As New ClsVentas()
- ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero)
- ObjVentas.Dispose()
- End Sub
- Private Sub GeneraAddenda7Eleven(Archivo As String)
- Dim cfdi As String = ""
- Dim SB As New StringBuilder
- Try
- Using sr As New StreamReader(Archivo)
-
- cfdi = sr.ReadToEnd()
-
- End Using
- Catch e As Exception
- Alert("The file could not be read:", TipoMensaje.MsgError)
-
- End Try
-
-
- cfdi = cfdi.Replace("", "")
-
- SB.Append(cfdi)
-
- SB.Append("")
- SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim)
- SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd"))
-
- For Each Row As DataRow In TmpDT.Rows
-
- SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero())
-
- Next
-
- SB.Append("")
-
-
- Using outfile As New StreamWriter(Archivo)
- outfile.Write(SB.ToString())
- End Using
-
- 'Exit Sub
-
-
-
- 'Dim MyXmlDocument As New XmlDocument()
-
- 'MyXmlDocument.Load("C:/Temp/aaa.xml")
- 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable)
- 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3")
- 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas")
- 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
- 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd")
-
- 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "")
- 'Prov.SetAttribute("Clave", "3125")
-
- 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi")
- 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones")
- 'Recepciones.Prefix = "cfdi"
- 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion")
- 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim)
- 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim)
- 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM"))
-
- 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos")
- ''dentro de un ciclo
- 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto")
- 'Producto.SetAttribute("codigo", "cod1")
- 'Producto.SetAttribute("descripcion", "prod1")
- 'Producto.SetAttribute("cantidad", "99")
- 'Producto.SetAttribute("precio", "2000")
- 'Productos.AppendChild(Producto)
- ''fin de ciclo
-
- 'Recepcion.AppendChild(Productos)
-
- 'Recepciones.AppendChild(Recepcion)
-
- 'ParentElement.AppendChild(Prov)
-
- 'ParentElement.AppendChild(Recepciones)
-
-
- 'MyXmlDocument.DocumentElement.AppendChild(ParentElement)
- 'MyXmlDocument.Save("C:/Temp/aa.xml")
-
- End Sub
- Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged
- For Each dr As DataRow In TmpDT.Rows
- dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue
- Next
-
- GvPS.DataSource = TmpDT
- GvPS.DataBind()
-
- UpPS.Update()
- End Sub
- Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs)
- Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList)
- Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero
-
- If UsuarioActual.Empresa.UsaAC Then
- TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue
- End If
- TmpDT.AcceptChanges()
- End Sub
- Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click
- If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub
- LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim))
- TxtFordASN.Text = ""
- TxtFordASN.Focus()
- End Sub
- Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click
- LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex)
-
- End Sub
- Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
- GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False)
- End Sub
- Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged
-
- Dim ObjClientes As New ClsClientes()
-
- Dim Nombre As String = "-1"
- Dim Codigo As String = "-1"
- Dim NombreCorto As String = "-1"
- Dim RFC As String = "-1"
- Dim Telefono As String = "-1"
- Dim Mail As String = "-1"
-
- If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim
-
- If Codigo <> "-1" Then
- If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
- If ObjClientes.DtResultados.Rows.Count > 0 Then
- If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then
- TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
- UpFacturar.Update()
- Exit Sub
- ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then
- TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
- UpFacturar.Update()
- Exit Sub
- Else
- HdnCveCliente.Value = ObjClientes.CveCliente.ToString
- End If
- BtnBuscarCliente_Click(sender, e)
- Else
- Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia)
- TxtCodigo.Text = ""
- LblCliente.Text = "Cliente"
- LblDireccion.Text = "Dirección"
- LblColonia.Text = "Colonia"
- LblCiudad.Text = "Ciudad"
- LblEstado.Text = "Estado"
- LblCP.Text = "00000"
- LblRFC.Text = "AAA010101AAA"
- LblTelefono.Text = "9999999999"
- trsucursalciente.Visible = False
- End If
- End If
- ObjClientes.Dispose()
-
- End If
- End Sub
- Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged
- ViewState("EstablecioFolio") = True
- End Sub
- Private Sub ConfiguraTipoDocto()
-
- 'Esconde Todo
- TdOrdenPago.Visible = False
- Tr33.Visible = False
-
- 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017
- Tr33.Visible = True
-
- If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
- BtnEmitirImprimir.Text = "Emitir e Imprimir"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then
- BtnEmitirImprimir.Text = "Emitir e Imprimir"
- 'TdReferencia.Style.Remove("display")
- ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then
- BtnEmitirImprimir.Text = "Cotizar"
- 'TdReferencia.Style.Add("display", "none")
-
- 'FACTURACION 3.3
- Tr33.Visible = True
-
- ElseIf DdlTipoComprobante.SelectedValue = "Com" Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then
- BtnEmitirImprimir.Text = "Registrar"
- TdOrdenPago.Visible = True
- End If
-
- UpFacturar.Update()
-
- End Sub
- Private Sub EliminaPoliza()
- Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
- ObjAC.IniciaTransacSQL()
- Dim ObjConta As New ClsContabilidad
- ObjConta.IniciaTransacSQL()
-
- Dim ErrorMovimiento = False
-
- 'Elimina la poliza
- If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then
- If Not ObjAC.RemovePoliza(IdPoliza) Then
+#Region "M E T O D O S"
+ Private Sub CargaOtrosConceptos()
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then
+ GVOtrosConceptos.DataSource = ObjVentas.DtResultados
+ GVOtrosConceptos.DataBind()
+ UpOtrosConceptos.Update()
+ End If
+ ObjVentas.Dispose()
+ End Sub
+ Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer
+ Dim Retorno As Integer = 0
+ Dim IDPoliza As Integer = 0
+
+ Dim ErrorAC As Boolean = False
+ 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
+ Dim Fecha As Date = factura.Fecha
+ Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
+ Dim Paridad As Integer = 1
+ Dim TipoMovto As Boolean = False
+
+ If CancelacionIngreso Then
+ Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
+ Paridad = -1
+ TipoMovto = True
+ End If
+
+ Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
+
+ IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
+ Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
+ 'Dim Importe As Double = TxtTotal.Text.ToDouble
+ Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes
+ Dim CtaISSSTESON As Integer = 643
+ Dim CtaISPT As Integer = 1745
+ ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
+
+ If IDPoliza > 0 Then
+
+ 'Orden de PAGO
+ If factura.TipoDocto = "OP" Then
+
+ If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
+ 'ISSSTESON
+
+ If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+
+ Else
+ 'ISPT
+
+ If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ End If
+
+ ' NORMAL
+ Else
+ Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
+ Group gvr By Grp = New With {
+ Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
+ } Into Group
+ Select Grp.CvePresupuestoIngreso,
+ TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
+
+
+ 'Select Case TipoComprobante
+ ' Case "Ing", "Egs"
+ For Each grp In Detalles
+ dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
+ Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
+
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'CARGO la deuda del cliente
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'abono,
+ If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Next
+
+ 'Case "OP", "Com"
+ ' Dim Importe As Decimal = 0
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
+
+ ' End If
+ ' End If
+ 'End Select
+ End If
+
+ Else
+ ErrorAC = True
+
+ End If
+
+ If Not ErrorAC Then
+ ObjAC.AjustaPoliza(IDPoliza)
+
+ Retorno = IDPoliza
+ Else
+
+ Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
+ End If
+
+ ' ObjAC.Dispose()
+
+ Return Retorno
+
+ End Function
+ Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer
+ Dim Retorno As Integer = 0
+ Dim IDPoliza As Integer = 0
+
+ Dim ErrorAC As Boolean = False
+ 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
+ Dim Fecha As Date = TxtFecha.Text.ToDate
+ Dim Concepto As String = String.Format("GD {0}", NombreCliente)
+ Dim Paridad As Integer = 1
+ Dim TipoMovto As Boolean = False
+
+ If CancelacionIngreso Then
+ Concepto = String.Format("Cancelación GD {0}", NombreCliente)
+ Paridad = -1
+ TipoMovto = True
+ End If
+
+ Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1)
+
+ IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha)
+ Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
+ 'Dim Importe As Double = TxtTotal.Text.ToDouble
+ Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero
+ Dim CtaISSSTESON As Integer = 643
+ Dim CtaISPT As Integer = 1745
+ ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
+
+ If IDPoliza > 0 Then
+
+ 'Orden de PAGO
+ If DdlTipoComprobante.SelectedValue.ToString = "OP" Then
+
+ If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
+ 'ISSSTESON
+
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+
+ Else
+ 'ISPT
+
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ End If
+
+ ' NORMAL
+ Else
+ Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
+ Group gvr By Grp = New With {
+ Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
+ } Into Group
+ Select Grp.CvePresupuestoIngreso,
+ TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
+
+
+ 'Select Case TipoComprobante
+ ' Case "Ing", "Egs"
+ For Each grp In Detalles
+ dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
+ Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
+
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'CARGO la deuda del cliente
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'abono,
+ If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Next
+
+ 'Case "OP", "Com"
+ ' Dim Importe As Decimal = 0
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
+
+ ' End If
+ ' End If
+ 'End Select
+ End If
+
+ Else
+ ErrorAC = True
+
+ End If
+
+ If Not ErrorAC Then
+ ObjAC.AjustaPoliza(IDPoliza)
+
+ Retorno = IDPoliza
+ Else
+
+ Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError)
+ End If
+
+ ' ObjAC.Dispose()
+
+ Return Retorno
+
+ End Function
+ Private Sub SetValues()
+ ViewState("TipoCambio") = 1
+
+ If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "")
+ If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "")
+
+ If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto
+ TxtPS.Enabled = False
+ DivDdlTipo.Visible = True
+ DivTxtModelo.Visible = True
+ DivTxtAdicional.Visible = True
+ DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();")
+ DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();")
+ TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
+ TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
+
+ CargaClasificacionesDetalles()
+ ClasificacionModal()
+
+ End If
+
+ If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM
+ RBLPago.Items.RemoveAt(2)
+ End If
+
+
+ End Sub
+ Private Sub SetPermisos()
+ If CveVenta < 1 Then
+ 'Puede cotizar
+ If Not UsuarioActual.TienePermisoProceso(59) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
+ End If
+
+ 'Puede Hacer NC
+ If Not UsuarioActual.TienePermisoProceso(175) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
+ End If
+
+ 'Puede Hacer Devolución
+ If Not UsuarioActual.TienePermisoProceso(264) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
+ End If
+
+ 'Puede facturar
+ If Not UsuarioActual.TienePermisoProceso(60) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
+ End If
+
+ 'Puede remisionar
+ If Not UsuarioActual.TienePermisoProceso(199) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ LnkFacturarRemision.Visible = False
+ LnkRemisiones.Visible = False
+ End If
+
+ '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS
+ ''Puede remisionar
+ 'If Not UsuarioActual.TienePermisoProceso(199) Then
+ ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ 'End If
+
+ ''MODO SOLO LECTURA
+ 'If DdlTipoComprobante.Items.Count = 0 Then
+ ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1"))
+ ' TrBotones.Visible = False
+ 'End If
+
+ ConfiguraTipoDocto()
+ End If
+ End Sub
+ Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
+
+ Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
+ Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
+ Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal
+ Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal
+ Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal
+ Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal
+ Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal
+ Dim Total As Decimal = 0
+ Dim TotalImpuestosLocales As Decimal = 0
+
+ If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
+ If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
+ For Each dr As DataRow In TmpDT.Rows
+ dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
+ Next
+
+ If TmpDTImpuestos IsNot Nothing Then
+ For Each dr2 As DataRow In TmpDTImpuestos.Rows
+ dr2("Importe") = 0
+ Next
+ TmpDTImpuestos.AcceptChanges()
+ End If
+
+ TmpDT.AcceptChanges()
+ TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal
+ TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal
+ TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal
+ TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal
+ TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal
+ End If
+ End If
+
+ If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then
+ If TotalSubTotal <> TotalAmortizacion Then
+ For Each drt As DataRow In TmpDTImpuestos.Rows
+ drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100
+ Next
+ End If
+
+ GvImpuestosLocales2.DataSource = TmpDTImpuestos
+ GvImpuestosLocales2.DataBind()
+ End If
+
+ For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
+ If gvr.RowType = DataControlRowType.DataRow Then
+
+ If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
+ If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local
+ TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
+ Else
+ TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
+ End If
+ End If
+ End If
+ Next
+
+ 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False
+ If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False
+ If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False
+ If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False
+
+ If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then
+ TotalAmortizacion = 0
+ End If
+
+
+ Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
+ LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
+ TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2)
+ LblDescuentos.Text = TotalDescuentos.FormatoNumero
+ TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2)
+ TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2)
+ TxtRetISR.Text = TotalRetISR.FormatoNumero(2)
+ TxtIVA.Text = TotalIVA.FormatoNumero
+ TxtIEPS.Text = TotalIEPS.FormatoNumero
+ TxtTotal.Text = Total.FormatoNumero
+
+ LblAmort.Text = TxtSubTotal.Text
+ If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
+ HdnVentaSaldo.Value = Total.ToString
+ Else
+ HdnVentaSaldo.Value = SaldoVenta.ToString
+ End If
+ HdnIVAOriginal.Value = TxtIVA.Text
+
+ 'JJMQ 20160506: Se agrego para la validacion de pago de contado.
+ CVImporteContado.ValueToCompare = Total.ToString
+
+ If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then
+ Alert($"Los siguientes conceptos hace falta especificar clave SAT
{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia)
+ MensajeCveSAT.Clear()
+ End If
+
+ Dim view As DataView = New DataView(TmpDT)
+ view.Sort = "Consec"
+ GvPS.DataSource = view
+ GvPS.DataBind()
+
+ 'RECARGA GV INVENTARIO
+ If Not CveVenta > 0 Then
+ DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
+ CargaGVInv(DtInv)
+ End If
+
+ UpContado.Update()
+ UpPS.Update()
+ RegistraScript("BorraDescuentos();", "BorraDescuentos")
+ End Sub
+ Private Function ValidaAdendaFEMSA() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaFEMSA Then
+ Retorno = True
+ Else
+ If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then
+ Retorno = False
+ Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then
+ Retorno = False
+ Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then
+ Retorno = False
+ Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Function ValidaComplementoDetallista() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaDetallista Then
+ Retorno = True
+ Else
+ If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then
+ Retorno = False
+ Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "")
+ ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then
+ Retorno = False
+ Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then
+ Retorno = False
+ Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then
+ Retorno = False
+ Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Function ValidaComplementoFord() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaFord Then
+ Retorno = True
+ Else
+ If TxtFordGSDB.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ If LstFordASN.Items.Count = 0 Then
+ Retorno = True
+ 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Sub VinculaCotizacionVenta()
+ Dim ObjVentas As New ClsVentas()
+ ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero)
+ ObjVentas.Dispose()
+ End Sub
+ Private Sub GeneraAddenda7Eleven(Archivo As String)
+ Dim cfdi As String = ""
+ Dim SB As New StringBuilder
+ Try
+ Using sr As New StreamReader(Archivo)
+
+ cfdi = sr.ReadToEnd()
+
+ End Using
+ Catch e As Exception
+ Alert("The file could not be read:", TipoMensaje.MsgError)
+
+ End Try
+
+
+ cfdi = cfdi.Replace("", "")
+
+ SB.Append(cfdi)
+
+ SB.Append("")
+ SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim)
+ SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd"))
+
+ For Each Row As DataRow In TmpDT.Rows
+
+ SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero())
+
+ Next
+
+ SB.Append("")
+
+
+ Using outfile As New StreamWriter(Archivo)
+ outfile.Write(SB.ToString())
+ End Using
+
+ 'Exit Sub
+
+
+
+ 'Dim MyXmlDocument As New XmlDocument()
+
+ 'MyXmlDocument.Load("C:/Temp/aaa.xml")
+ 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable)
+ 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3")
+ 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas")
+ 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
+ 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd")
+
+ 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "")
+ 'Prov.SetAttribute("Clave", "3125")
+
+ 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi")
+ 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones")
+ 'Recepciones.Prefix = "cfdi"
+ 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion")
+ 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim)
+ 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim)
+ 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM"))
+
+ 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos")
+ ''dentro de un ciclo
+ 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto")
+ 'Producto.SetAttribute("codigo", "cod1")
+ 'Producto.SetAttribute("descripcion", "prod1")
+ 'Producto.SetAttribute("cantidad", "99")
+ 'Producto.SetAttribute("precio", "2000")
+ 'Productos.AppendChild(Producto)
+ ''fin de ciclo
+
+ 'Recepcion.AppendChild(Productos)
+
+ 'Recepciones.AppendChild(Recepcion)
+
+ 'ParentElement.AppendChild(Prov)
+
+ 'ParentElement.AppendChild(Recepciones)
+
+
+ 'MyXmlDocument.DocumentElement.AppendChild(ParentElement)
+ 'MyXmlDocument.Save("C:/Temp/aa.xml")
+
+ End Sub
+ Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged
+ For Each dr As DataRow In TmpDT.Rows
+ dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue
+ Next
+
+ GvPS.DataSource = TmpDT
+ GvPS.DataBind()
+
+ UpPS.Update()
+ End Sub
+ Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs)
+ Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList)
+ Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero
+
+ If UsuarioActual.Empresa.UsaAC Then
+ TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue
+ End If
+ TmpDT.AcceptChanges()
+ End Sub
+ Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click
+ If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub
+ LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim))
+ TxtFordASN.Text = ""
+ TxtFordASN.Focus()
+ End Sub
+ Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click
+ LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex)
+
+ End Sub
+ Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
+ GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False)
+ End Sub
+ Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged
+
+ Dim ObjClientes As New ClsClientes()
+
+ Dim Nombre As String = "-1"
+ Dim Codigo As String = "-1"
+ Dim NombreCorto As String = "-1"
+ Dim RFC As String = "-1"
+ Dim Telefono As String = "-1"
+ Dim Mail As String = "-1"
+
+ If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim
+
+ If Codigo <> "-1" Then
+ If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
+ If ObjClientes.DtResultados.Rows.Count > 0 Then
+ If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then
+ TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
+ UpFacturar.Update()
+ Exit Sub
+ ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then
+ TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
+ UpFacturar.Update()
+ Exit Sub
+ Else
+ HdnCveCliente.Value = ObjClientes.CveCliente.ToString
+ End If
+ BtnBuscarCliente_Click(sender, e)
+ Else
+ Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia)
+ TxtCodigo.Text = ""
+ LblCliente.Text = "Cliente"
+ LblDireccion.Text = "Dirección"
+ LblColonia.Text = "Colonia"
+ LblCiudad.Text = "Ciudad"
+ LblEstado.Text = "Estado"
+ LblCP.Text = "00000"
+ LblRFC.Text = "AAA010101AAA"
+ LblTelefono.Text = "9999999999"
+ trsucursalciente.Visible = False
+ End If
+ End If
+ ObjClientes.Dispose()
+
+ End If
+ End Sub
+ Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged
+ ViewState("EstablecioFolio") = True
+ End Sub
+ Private Sub ConfiguraTipoDocto()
+
+ 'Esconde Todo
+ TdOrdenPago.Visible = False
+ Tr33.Visible = False
+
+ 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017
+ Tr33.Visible = True
+
+ If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
+ BtnEmitirImprimir.Text = "Emitir e Imprimir"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then
+ BtnEmitirImprimir.Text = "Emitir e Imprimir"
+ 'TdReferencia.Style.Remove("display")
+ ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then
+ BtnEmitirImprimir.Text = "Cotizar"
+ 'TdReferencia.Style.Add("display", "none")
+
+ 'FACTURACION 3.3
+ Tr33.Visible = True
+
+ ElseIf DdlTipoComprobante.SelectedValue = "Com" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ TdOrdenPago.Visible = True
+ End If
+
+ UpFacturar.Update()
+
+ End Sub
+ Private Sub EliminaPoliza()
+ Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
+ ObjAC.IniciaTransacSQL()
+ Dim ObjConta As New ClsContabilidad
+ ObjConta.IniciaTransacSQL()
+
+ Dim ErrorMovimiento = False
+
+ 'Elimina la poliza
+ If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then
+ If Not ObjAC.RemovePoliza(IdPoliza) Then
+ ErrorMovimiento = True
+ End If
+ End If
+
+ 'Desasocia la poliza
+ If Not ErrorMovimiento Then
+ If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then
+ ErrorMovimiento = True
+ End If
+ End If
+
+ If Not ErrorMovimiento Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
ErrorMovimiento = True
End If
- End If
-
- 'Desasocia la poliza
- If Not ErrorMovimiento Then
- If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then
- ErrorMovimiento = True
- End If
- End If
-
- If Not ErrorMovimiento Then
- Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion)
- ObjAC.Commit()
- ObjConta.Commit()
- BtnDescontabilizar.Visible = False
- Else
- Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError)
- ObjAC.RollBack()
- ObjConta.RollBack()
- End If
-
- ObjAC.Dispose()
- ObjConta.Dispose()
-
- End Sub
- Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs)
- Dim Ddl As DropDownList = CType(sender, DropDownList)
- Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow)
- gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1)
- gvr.FCDropDownList("DdlUnidadMedida").DataBind()
-
- End Sub
- Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
+ End If
+
+ If Not ErrorMovimiento Then
+ Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion)
+ ObjAC.Commit()
+ ObjConta.Commit()
+ BtnDescontabilizar.Visible = False
+ Else
+ Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError)
+ ObjAC.RollBack()
+ ObjConta.RollBack()
+ End If
+
+ ObjAC.Dispose()
+ ObjConta.Dispose()
+
+ End Sub
+ Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs)
+ Dim Ddl As DropDownList = CType(sender, DropDownList)
+ Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow)
+ gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1)
+ gvr.FCDropDownList("DdlUnidadMedida").DataBind()
+
+ End Sub
+ Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
Dim OcurrioError As Boolean = False
Try
Dim DtMovimientos As DataTable
@@ -14906,9 +14912,9 @@ Partial Class Ventas
Try
'If ValorInventario <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
- OcurrioError = True
- Exit For
- End If
+ OcurrioError = True
+ Exit For
+ End If
'End If
Catch ex As Exception
OcurrioError = True