-- carga de partidas sobre facturas ya registradas
This commit is contained in:
@@ -309,24 +309,24 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
|
||||
If RblFormato.SelectedValue = "18" Then
|
||||
If Not dt.Columns(17).ColumnName = "Cantidad" Then
|
||||
If Not dt.Columns(18).ColumnName = "Cantidad" Then
|
||||
Alert("El nombre de la Decimoctava columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(18).ColumnName = "Codigo" Then
|
||||
If Not dt.Columns(19).ColumnName = "Codigo" Then
|
||||
Alert("El nombre de la Decimonovena columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(19).ColumnName = "PU" Then
|
||||
If Not dt.Columns(20).ColumnName = "PU" Then
|
||||
Alert("El nombre de la Vigésima columna debe ser 'PU'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(20).ColumnName = "IVADetalle" Then
|
||||
If Not dt.Columns(21).ColumnName = "IVADetalle" Then
|
||||
Alert("El nombre de la Vigésimo primera columna debe ser 'IVADetalle'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(21).ColumnName = "IEPS" Then
|
||||
If Not dt.Columns(22).ColumnName = "IEPS" Then
|
||||
Alert("El nombre de la Vigésimo segunda columna debe ser 'IEPS'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -2535,7 +2535,7 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
|
||||
Dim DTFoliosFiscales As DataTable = dt.FiltraParametros("", "", {"Folio Fiscal"})
|
||||
Dim DTFoliosFiscales As DataTable = dt.FiltraParametros("[Folio Fiscal] <> ''", "", {"Folio Fiscal"})
|
||||
|
||||
For Each drFolioFiscal As DataRow In DTFoliosFiscales.Rows
|
||||
Dim FolioFiscalActual As String = drFolioFiscal("Folio Fiscal").ToString
|
||||
@@ -2622,7 +2622,6 @@ Partial Class General_SaldosIniciales
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
If Vendedor <> "" Then
|
||||
CveVendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString().ToEntero()
|
||||
If Not CveVendedor > 0 Then CveVendedor = 0
|
||||
@@ -2648,7 +2647,6 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If TipoCambio = "" Then TipoCambio = "1"
|
||||
|
||||
If Not CveClienteSucursal > 0 Then CveClienteSucursal = -1
|
||||
@@ -2663,15 +2661,32 @@ Partial Class General_SaldosIniciales
|
||||
ErrorVentas = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim VentayaRegistrada As Boolean = False
|
||||
If Not ErrorVentas Then
|
||||
'Venta
|
||||
If CveCliente > 0 Then
|
||||
|
||||
|
||||
If TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
||||
GuardaLog(Serie & "-" & Folio)
|
||||
If Not EsDetalle Then
|
||||
CveVenta = 0
|
||||
Dim contador As Integer = 0
|
||||
'verificar si existe la venta, si existe obtener el cveventa y limpiar su contenido para carga de lo nuevo.
|
||||
If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, TipoDocto, Serie, Folio, "-1", -1, -1, -1, -1, "2000-01-01", Now.ToShortDateString, FolioFiscalActual, CveUsuarioConsulta:=100) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
contador = 1
|
||||
CveVenta = ObjVentas.DtResultados.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
VentayaRegistrada = True
|
||||
VentasAgregadas += 1
|
||||
'limpieza de las partidas
|
||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||
For Each dr As DataRow In ObjVentas.DtResultados.Rows
|
||||
ObjVentas.RemoveVentasDetalle(CveVenta, dr("CveVentaDetalle").ToString.ToEntero)
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
If Not EsDetalle AndAlso CveVenta = 0 Then
|
||||
If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero(), CveClienteSucursal, SubTotal, 0, Amortizacion, IVA, RetIVA, RetISR, Total, CveMoneda, TipoCambio.ToDecimal,
|
||||
0, 0, 0, FechaVencimiento, Fecha, "", "", Fecha, CveVendedor, Folio2, "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, 0, CvePrePoliza,
|
||||
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero(), CveSubProyectoEjecucion:=Sucursal.ToEntero(),
|
||||
@@ -2685,10 +2700,8 @@ Partial Class General_SaldosIniciales
|
||||
CveVenta = ObjVentas.CveVenta
|
||||
End If
|
||||
|
||||
|
||||
For Each dRowDetalle As DataRow In dt.FiltraParametros($"[Folio Fiscal]='{FolioFiscalActual}'").Rows
|
||||
|
||||
|
||||
Dim CantidadDetalle As Decimal = dRowDetalle("Cantidad").ToString.ToDecimal 'digo PU IVADetalle
|
||||
Dim PuDetalle As Decimal = dRowDetalle("PU").ToString.ToDecimal
|
||||
Dim IVADetalle As Decimal = dRowDetalle("IVADetalle").ToString.ToDecimal
|
||||
@@ -2697,7 +2710,7 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
Dim CodigoDetalle As String = dRowDetalle("Codigo").ToString
|
||||
If CodigoDetalle.Trim.Length > 0 Then
|
||||
Dim DrDetalles As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = '{CodigoDetalle}'")
|
||||
Dim DrDetalles As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo = '{CodigoDetalle}'")
|
||||
|
||||
If DrDetalles IsNot Nothing Then
|
||||
CvePS = DrDetalles("CvePS").ToString().ToEntero()
|
||||
@@ -2722,61 +2735,61 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
Next
|
||||
|
||||
|
||||
Dim ConceptoContable As Integer = 1
|
||||
Dim ConceptoContablePago As Integer = 2
|
||||
If TipoDocto = "Egs" Then
|
||||
ConceptoContable = 12
|
||||
ConceptoContablePago = 91
|
||||
End If
|
||||
|
||||
If FolioFiscalActual <> "" Then
|
||||
If Not ObjVentas.UpdateVentaFolioFiscal(FolioFiscalActual, CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
If Not VentayaRegistrada Then
|
||||
Dim ConceptoContable As Integer = 1
|
||||
Dim ConceptoContablePago As Integer = 2
|
||||
If TipoDocto = "Egs" Then
|
||||
ConceptoContable = 12
|
||||
ConceptoContablePago = 91
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim UsaComplementaria As Boolean = False
|
||||
If FolioFiscalActual <> "" Then
|
||||
If Not ObjVentas.UpdateVentaFolioFiscal(FolioFiscalActual, CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then UsaComplementaria = True
|
||||
Dim UsaComplementaria As Boolean = False
|
||||
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, SubTotal, 4, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero(), PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Total, ConceptoContable, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then UsaComplementaria = True
|
||||
|
||||
If IVA > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, IVA, 13, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, SubTotal, 4, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero(), PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Total, ConceptoContable, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
|
||||
If IEPS > 0 Then
|
||||
'AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio, 38, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS)
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, IEPS, 38, Folio.ToString, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If IVA > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, IVA, 13, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
If IEPS > 0 Then
|
||||
'AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio, 38, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS)
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, IEPS, 38, Folio.ToString, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
|
||||
If RetIVA > 0 Then
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
If RetIVA > 0 Then
|
||||
|
||||
If RetISR > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If ImpuestoLocal > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, ImpuestoLocal, 27, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
If RetISR > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If ImpuestoLocal > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, ImpuestoLocal, 27, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
If UsaComplementaria Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Total * TipoCambio.ToDecimal - Total, 203, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, TipoCambio:=TipoCambio.ToDecimal, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
If UsaComplementaria Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Total * TipoCambio.ToDecimal - Total, 203, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, TipoCambio:=TipoCambio.ToDecimal, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, ConceptoContablePago, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, 95, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Total - Saldo, ConceptoContablePago, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Total - Saldo, 95, Folio.ToString(), Folio.ToString(), CveVenta:=CveVenta, CveCliente:=CveCliente, Contabilizable:=False) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorVentas Then
|
||||
@@ -2801,9 +2814,6 @@ Partial Class General_SaldosIniciales
|
||||
'ErrorVentas = True
|
||||
'Exit For
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
@@ -2829,7 +2839,6 @@ Partial Class General_SaldosIniciales
|
||||
EsDetalle = False
|
||||
End If
|
||||
|
||||
|
||||
Dim SubTotal As Decimal = 0
|
||||
Dim IVA As Decimal = 0
|
||||
Dim Total As Decimal = 0
|
||||
@@ -2979,7 +2988,6 @@ Partial Class General_SaldosIniciales
|
||||
'Venta
|
||||
If CveCliente > 0 Then
|
||||
|
||||
|
||||
If TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
||||
GuardaLog(Serie & "-" & Folio)
|
||||
If Not EsDetalle Then
|
||||
@@ -3150,13 +3158,8 @@ Partial Class General_SaldosIniciales
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'**********************************************************************************************************************************************************************************
|
||||
|
||||
|
||||
|
||||
If Not ErrorVentas Then
|
||||
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
|
||||
Reference in New Issue
Block a user