Complementaria de clientes, validacion de usados
This commit is contained in:
@@ -3946,7 +3946,7 @@ Partial Class Ventas
|
|||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
Dim ObjUsados As New ClsVentas
|
Dim ObjUsados As New ClsVentas
|
||||||
|
|
||||||
If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
DtUsados = ObjUsados.DtResultados
|
DtUsados = ObjUsados.DtResultados
|
||||||
End If
|
End If
|
||||||
ObjUsados.Dispose()
|
ObjUsados.Dispose()
|
||||||
@@ -11299,6 +11299,9 @@ Partial Class Ventas
|
|||||||
Dim CveCuentaIVAxTrasladar As Integer = 0
|
Dim CveCuentaIVAxTrasladar As Integer = 0
|
||||||
Dim CveCuentaIVATrasladado As Integer = 0
|
Dim CveCuentaIVATrasladado As Integer = 0
|
||||||
Dim SeContabiliza As Boolean = True
|
Dim SeContabiliza As Boolean = True
|
||||||
|
|
||||||
|
Dim SimplificarPrePoliza As Boolean = False
|
||||||
|
|
||||||
If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Or (ChkAntEspecial.Checked AndAlso ObjFactura.TipoDocto = "Ant") Then
|
If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Or (ChkAntEspecial.Checked AndAlso ObjFactura.TipoDocto = "Ant") Then
|
||||||
SeContabiliza = False
|
SeContabiliza = False
|
||||||
End If
|
End If
|
||||||
@@ -12614,7 +12617,7 @@ Partial Class Ventas
|
|||||||
If CveIEPago > 0 Then
|
If CveIEPago > 0 Then
|
||||||
|
|
||||||
importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador
|
importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador
|
||||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL
|
||||||
IdCtaContable = 0
|
IdCtaContable = 0
|
||||||
CveCuenta = 0
|
CveCuenta = 0
|
||||||
CveSubProyectoContabilizar = CveSubProyectoVenta
|
CveSubProyectoContabilizar = CveSubProyectoVenta
|
||||||
@@ -12633,21 +12636,62 @@ Partial Class Ventas
|
|||||||
' CuentasContablesInvalidasSIG.AppendFormat("<br> {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero())
|
' CuentasContablesInvalidasSIG.AppendFormat("<br> {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero())
|
||||||
' CveCuentaContabilizacion = 0
|
' CveCuentaContabilizacion = 0
|
||||||
'End If
|
'End If
|
||||||
|
'MONEDA EXTRANJERA
|
||||||
|
If ObjFactura.CveMoneda > 1 Then
|
||||||
'BANCOS
|
'BANCOS
|
||||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'CLIENTES
|
'BANCOS COMPLEMENTARIA
|
||||||
|
If UsaComplementariaClientes Then
|
||||||
|
Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL
|
||||||
|
|
||||||
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 204, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 204, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'PAGO CLIENTES
|
||||||
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
'PAGO CLIENTES COMPLEMENTARIA
|
||||||
|
If UsaComplementariaClientes Then
|
||||||
|
Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL
|
||||||
|
|
||||||
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 207, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, 0, Referencia, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
SimplificarPrePoliza = True
|
||||||
|
|
||||||
|
Else
|
||||||
|
'BANCOS
|
||||||
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
'PAGO CLIENTES
|
||||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If ObjFactura.IVA <> 0 Then
|
If ObjFactura.IVA <> 0 Then
|
||||||
Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
|
Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
|
||||||
@@ -12795,7 +12839,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Simplificacion de PrePolizas
|
'Simplificacion de PrePolizas
|
||||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
|
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") OrElse SimplificarPrePoliza Then
|
||||||
If Not ObjConta.PrePolizaSimplificacion(ObjFactura.CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
If Not ObjConta.PrePolizaSimplificacion(ObjFactura.CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||||
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
@@ -27328,11 +27372,29 @@ Partial Class Ventas
|
|||||||
|
|
||||||
RemisionesLista.Clear()
|
RemisionesLista.Clear()
|
||||||
|
|
||||||
|
Dim MsgUsados As New StringBuilder
|
||||||
|
Dim UsadosValidados As Boolean = True
|
||||||
|
|
||||||
If dtSeleccionadas.Rows.Count > 0 Then
|
If dtSeleccionadas.Rows.Count > 0 Then
|
||||||
Select Case RblTipo.SelectedValue
|
Select Case RblTipo.SelectedValue
|
||||||
Case "1" 'T O T A L G E N E R A L
|
Case "1" 'T O T A L G E N E R A L
|
||||||
For Each row As DataRow In dtSeleccionadas.Rows
|
For Each row As DataRow In dtSeleccionadas.Rows
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
Using ObjUsados As New ClsVentas
|
||||||
|
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
|
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||||
|
UsadosValidados = False
|
||||||
|
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsadosValidados Then
|
||||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||||
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
IsTotalxConcepto = False
|
IsTotalxConcepto = False
|
||||||
Dim PU As Decimal = dtSeleccionadas.SUM("SubTotal").ToDecimal
|
Dim PU As Decimal = dtSeleccionadas.SUM("SubTotal").ToDecimal
|
||||||
@@ -27347,7 +27409,22 @@ Partial Class Ventas
|
|||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
Case "2" 'T O T A L X R E M I S I O N
|
Case "2" 'T O T A L X R E M I S I O N
|
||||||
For Each row As DataRow In dtSeleccionadas.Rows
|
For Each row As DataRow In dtSeleccionadas.Rows
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
Using ObjUsados As New ClsVentas
|
||||||
|
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
|
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||||
|
UsadosValidados = False
|
||||||
|
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsadosValidados Then
|
||||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||||
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
|
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
|
||||||
Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0)
|
Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0)
|
||||||
@@ -27368,17 +27445,51 @@ Partial Class Ventas
|
|||||||
For Each row As DataRow In dtSeleccionadas.Rows
|
For Each row As DataRow In dtSeleccionadas.Rows
|
||||||
sb.Append($"{row("CveVentaDetalle").ToString()},")
|
sb.Append($"{row("CveVentaDetalle").ToString()},")
|
||||||
Next
|
Next
|
||||||
For Each row As DataRow In dtSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
For Each row As DataRow In dtSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta", "Fecha", "Folio"}).Rows
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
Using ObjUsados As New ClsVentas
|
||||||
|
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
|
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||||
|
UsadosValidados = False
|
||||||
|
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsadosValidados Then
|
||||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Else
|
Else
|
||||||
For Each row As DataRow In dtSeleccionadas.Rows
|
For Each row As DataRow In dtSeleccionadas.Rows
|
||||||
sb.Append($"{row("CveVenta").ToString()},")
|
sb.Append($"{row("CveVenta").ToString()},")
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
Using ObjUsados As New ClsVentas
|
||||||
|
If ObjUsados.GetVentasUsados(row("CveVenta").ToString().ToEntero(), -1, row("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
|
If ObjUsados.DtResultados.Rows.Count > 0 Then
|
||||||
|
UsadosValidados = False
|
||||||
|
MsgUsados.AppendFormat("{0},", row("Folio").ToString())
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsadosValidados Then
|
||||||
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
sb.Remove(sb.Length - 1, 1)
|
sb.Remove(sb.Length - 1, 1)
|
||||||
|
|
||||||
|
If UsadosValidados Then
|
||||||
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
|
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
|
||||||
|
End If
|
||||||
|
|
||||||
sb.Clear()
|
sb.Clear()
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
@@ -27430,6 +27541,15 @@ Partial Class Ventas
|
|||||||
ObsPedido.Clear()
|
ObsPedido.Clear()
|
||||||
ObsInv.Clear()
|
ObsInv.Clear()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not UsadosValidados Then
|
||||||
|
If MsgUsados.Length > 0 Then
|
||||||
|
MsgUsados.Remove(MsgUsados.Length - 1, 1)
|
||||||
|
End If
|
||||||
|
Alert($"Las siguientes remisiones no se pueden facturar porque no se ha recibido el usado correspondiente:<br/><b>{MsgUsados.ToString()}<b/>", TipoMensaje.MsgAdvertencia)
|
||||||
|
BtnEmitirImprimir.Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text)
|
TxtFechaPago.Text = If(EsDiasCreditoFijo, Now.AddDays(DiasCredito).ToShortDateString, TxtFechaPago.Text)
|
||||||
@@ -28570,7 +28690,10 @@ Partial Class Ventas
|
|||||||
Else
|
Else
|
||||||
Row("PorcentajeIVA") = DrPS("IVA")
|
Row("PorcentajeIVA") = DrPS("IVA")
|
||||||
End If
|
End If
|
||||||
Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal) - Row("Descuento").ToString().ToDecimal
|
|
||||||
|
Dim PU = Row("PU").ToString().ToDecimal().RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||||
|
|
||||||
|
Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString().ToDecimal * PU) - Row("Descuento").ToString().ToDecimal
|
||||||
Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal)
|
Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal)
|
||||||
|
|
||||||
Row("IVA") = Row("PorcentajeIVA").ToString().ToDouble
|
Row("IVA") = Row("PorcentajeIVA").ToString().ToDouble
|
||||||
|
|||||||
Reference in New Issue
Block a user