This commit is contained in:
2023-11-24 15:53:24 -07:00
3 changed files with 129 additions and 87 deletions

View File

@@ -294,6 +294,21 @@ Partial Class General_SaldosIniciales
Exit Sub Exit Sub
End If End If
If Not dt.Columns(15).ColumnName = "IEPS" Then
Alert("El nombre de la decimosexta columna debe ser 'IEPS'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(16).ColumnName = "RetIVAPorcentaje" Then
Alert("El nombre de la decimoséptima columna debe ser 'RetIVAPorcentaje'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(17).ColumnName = "RetISRPorcentaje" Then
Alert("El nombre de la decimoctava columna debe ser 'RetISRPorcentaje'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
'If RblFormato.SelectedValue = "4" Then 'If RblFormato.SelectedValue = "4" Then
' If Not dt.Columns(15).ColumnName = "ImpuestoLocal" Then ' If Not dt.Columns(15).ColumnName = "ImpuestoLocal" Then
' Alert("El nombre de la diesciseisava columna debe ser 'ImpuestoLocal'. Favor de corregirlo", TipoMensaje.MsgError) ' Alert("El nombre de la diesciseisava columna debe ser 'ImpuestoLocal'. Favor de corregirlo", TipoMensaje.MsgError)
@@ -1430,9 +1445,7 @@ Partial Class General_SaldosIniciales
#Region "P R O V E E D O R E S - F A C T U R A S" #Region "P R O V E E D O R E S - F A C T U R A S"
Dim ObjCompras As New ClsCompras
Dim ErrorCompras As Boolean = False Dim ErrorCompras As Boolean = False
Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL())
Dim CveCompra As Integer Dim CveCompra As Integer
Dim Contador As Integer = 0 Dim Contador As Integer = 0
Dim ExisteCompra As Boolean = False Dim ExisteCompra As Boolean = False
@@ -1482,6 +1495,8 @@ Partial Class General_SaldosIniciales
TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString() TipoDocto = IIf(TipoDocto.ToUpper.Contiene("INGRESOS", "INGRESO", "ING", "FACTURA"), "Fac", "NC").ToString()
'Temporalmente SE BORRARA 'Temporalmente SE BORRARA
Dim Transaccion As String = "" 'Row("Transaccion2").ToString() Dim Transaccion As String = "" 'Row("Transaccion2").ToString()
Dim Folio2 As String = "" 'Row("Folio2").ToString() Dim Folio2 As String = "" 'Row("Folio2").ToString()
@@ -1507,8 +1522,6 @@ Partial Class General_SaldosIniciales
If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then If FechaVencimiento = "".ToDate Or FechaVencimiento < "1900/01/01".ToDate Then
FechaVencimiento = Fecha FechaVencimiento = Fecha
End If End If
'Compra
If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento, If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento,
False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal,
NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto) Then NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total, CveSubProyecto:=CveSubProyecto) Then
@@ -1533,6 +1546,8 @@ Partial Class General_SaldosIniciales
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, IVA, 14, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA.ToDecimal) Then ErrorCompras = True : Exit For If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, IVA, 14, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero(), CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeIVA.ToDecimal) Then ErrorCompras = True : Exit For
End If End If
If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, IEPS, 25, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For If IEPS > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, IEPS, 25, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For
If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, RetIVA, 15, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For If RetIVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, RetIVA, RetIVA, 15, Folio, String.Format("{0}-{1}", Serie, Folio), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveSubProyecto:=Sucursal.ToEntero()) Then ErrorCompras = True : Exit For
@@ -1541,12 +1556,18 @@ Partial Class General_SaldosIniciales
'Saldo 'Saldo
If Saldo < Total Then If Saldo < Total Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, 17, $"{Folio} SALDO INICIAL", Folio, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, 95, $"{Folio} SALDO INICIAL", Folio, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
End If End If
Encontrados = Encontrados + 1 Encontrados = Encontrados + 1
Next Next
If Not ErrorCompras Then
Next
Catch ex As Exception
OnError("Ocurrió un error al cargar los datos", ex)
ErrorCompras = True
End Try
If Not ErrorCompras Then If Not ErrorCompras Then
If Contador > 0 Then If Contador > 0 Then
Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.<br>Se Omitieron: <b>{1}</b> Compras ya que ya se encuentran registradas.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.<br>Se Omitieron: <b>{1}</b> Compras ya que ya se encuentran registradas.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion)
@@ -1557,9 +1578,7 @@ Partial Class General_SaldosIniciales
ObjCompras.Commit() ObjCompras.Commit()
TxtExcel.Text = "" TxtExcel.Text = ""
UpDatos.Update() UpDatos.Update()
Else 'C L I E N T E S - F A C T U R A S
Alert(String.Format("NO Se agregaron: <b>{0}</b> Compras.", NumRows), TipoMensaje.MsgError)
ObjCompras.RollBack()
End If End If
ObjCompras.Dispose() ObjCompras.Dispose()

View File

@@ -10004,9 +10004,6 @@
function Recargar() { function Recargar() {
$('#BtnRefrescarPagina').click(); $('#BtnRefrescarPagina').click();
} }
function BtnAplicaNuevaNC() {
$('#BtnAplicaNuevaNC').click();
}
function BtnAplicaNuevaNC() { function BtnAplicaNuevaNC() {
$('#BtnAplicaNuevaNC').click(); $('#BtnAplicaNuevaNC').click();

View File

@@ -2282,6 +2282,15 @@ Partial Class Ventas
ViewState("TieneBloqueoPorAutorizacion") = value ViewState("TieneBloqueoPorAutorizacion") = value
End Set End Set
End Property End Property
Private Property EsNCDevolucionEfectivo As Boolean
Get
Return If(IsNothing(ViewState("EsNCDevolucionEfectivo")), False, CType(ViewState("EsNCDevolucionEfectivo"), Boolean))
End Get
Set(value As Boolean)
ViewState("EsNCDevolucionEfectivo") = value
End Set
End Property
#End Region #End Region
'#Region "AuxiliarConta" '#Region "AuxiliarConta"
@@ -4564,6 +4573,7 @@ Partial Class Ventas
Dim DtAntRelacionados As DataTable = Nothing Dim DtAntRelacionados As DataTable = Nothing
Dim SerieFolioPadre As String Dim SerieFolioPadre As String
Dim DbRowVenta As DataRow = Nothing Dim DbRowVenta As DataRow = Nothing
Dim DtVentasRelacionadas As DataTable = Nothing
'CARGA DTs DE VENTAS 'CARGA DTs DE VENTAS
If CveVenta > 0 Then If CveVenta > 0 Then
@@ -4578,10 +4588,16 @@ Partial Class Ventas
End If End If
If DbRowVenta IsNot Nothing Then If DbRowVenta IsNot Nothing Then
If ObjVentas.GetVentasRelacionadas(CveVenta, 1, UsuarioActual.CveEmpresa) Then If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa, TipoRelacion:=1) Then
DtAntRelacionados = ObjVentas.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Ant','Egs','Dev')") DtAntRelacionados = ObjVentas.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Ant','Egs','Dev')")
End If End If
If DbRowVenta("TipoDocto").ToString() = "Egs" Then
If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa, TipoRelacion:=2) Then
DtVentasRelacionadas = ObjVentas.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Ant','Egs','Dev')")
End If
End If
'CargaDetalle 'CargaDetalle
If ObjVentas.GetVentaDetalle(CveVenta) Then If ObjVentas.GetVentaDetalle(CveVenta) Then
TmpDT = ObjVentas.DtResultados.Copy() TmpDT = ObjVentas.DtResultados.Copy()
@@ -4848,6 +4864,12 @@ Partial Class Ventas
Trsaldo.Visible = True Trsaldo.Visible = True
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
'SI NO TIENE INGRESOS RELACIONADOS, SE TOMARA COMO DEVOLUCION DE EFECTIVO
If DtVentasRelacionadas IsNot Nothing AndAlso DtVentasRelacionadas.Rows.Count = 0 Then
EsNCDevolucionEfectivo = True
End If
Case "Rem" Case "Rem"
'IPP 15 Julio 2017 'IPP 15 Julio 2017
Trsaldo.Visible = True Trsaldo.Visible = True
@@ -12356,11 +12378,14 @@ Partial Class Ventas
Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
If Timbre.Comprobante.TipoComprobante = "E" Then If Timbre.Comprobante.TipoComprobante = "E" Then
If Not EsNCDevolucionEfectivo OrElse HdnFolioFiscalNC.Value.ToString() <> "" Then
If Obj.TipoDocto = "Egs" Then If Obj.TipoDocto = "Egs" Then
Timbre.CFDIRelacionados.TipoRelacion = "01" Timbre.CFDIRelacionados.TipoRelacion = "01"
Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso"
End If End If
End If
If Obj.TipoDocto = "Dev" Then If Obj.TipoDocto = "Dev" Then
Timbre.CFDIRelacionados.TipoRelacion = "03" Timbre.CFDIRelacionados.TipoRelacion = "03"
Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso"
@@ -27440,6 +27465,7 @@ Partial Class Ventas
End Sub End Sub
Private Sub BtnAplicaNuevaNC_Click(sender As Object, e As EventArgs) Handles BtnAplicaNuevaNC.Click Private Sub BtnAplicaNuevaNC_Click(sender As Object, e As EventArgs) Handles BtnAplicaNuevaNC.Click
Me.EsNCDevolucionEfectivo = True
AplicarNotaCreditoDesdeVenta(AplicaNuevoDocumento:=True) AplicarNotaCreditoDesdeVenta(AplicaNuevoDocumento:=True)
End Sub End Sub