--Merge Ventas

This commit is contained in:
2022-06-09 19:20:12 -07:00
16 changed files with 189 additions and 357 deletions

View File

@@ -209,9 +209,8 @@ Partial Class RepRemisiones
If DdlVendedor.GetSelectedText <> "" Then StrFiltro.AppendFormat("&emsp;<b>Vendedor</b>: {0}", DdlVendedor.GetSelectedText)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim FechaI, FechaF As String
FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
@@ -222,9 +221,10 @@ Partial Class RepRemisiones
params.Add(New ReportParameter("FechaFin", FechaF))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If

View File

@@ -239,9 +239,8 @@ Partial Class RepRemisionesDetalle
If txtFechaF.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString)
If TxtFechaVencimiento.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Vencimiento al</b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim FechaI = "", FechaF = ""
@@ -252,8 +251,8 @@ Partial Class RepRemisionesDetalle
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If

View File

@@ -14904,45 +14904,45 @@ Partial Class Ventas
ImprimirbytesPDF(PdfFactura(ObjFactura, Guardar:=False, SubReportData:=CartaPorte), "Factura", "PDF")
Select Case ConversionRemision
Case "*"
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Next
Case "*"
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
Next
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TipoCambioRemision, NumeroDecimales)).FormatoNumero
End If
Next
Case "/"
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Next
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TipoCambioRemision, NumeroDecimales)).FormatoNumero
End If
Next
Case "/"
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
Next
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TipoCambioRemision, NumeroDecimales)).FormatoNumero
End If
Next
Case Else
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TipoCambioRemision, NumeroDecimales)).FormatoNumero
End If
Next
Case Else
End Select
End Select
End Sub
@@ -15363,9 +15363,9 @@ Partial Class Ventas
'End If
'Dim Now As DateTime = New DateTime(2020, 2, 19)
Try
CvePrepoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CvePrePoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrepoliza > 0 Then
If CvePrePoliza > 0 Then
Dim tipoCambioPago As Decimal = 1
Dim tipoCambioVenta As Decimal = 1
Dim tipoCambioVentaValuacion As Decimal = 1
@@ -15478,7 +15478,7 @@ Partial Class Ventas
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -15511,7 +15511,7 @@ Partial Class Ventas
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -15522,7 +15522,7 @@ Partial Class Ventas
Dim Importe13 = gvr.DataKey("IVA").ToDecimal
Dim Importe8 = gvr.DataKey("RetIVA").ToDecimal
Dim Importe9 = gvr.DataKey("RetISR").ToDecimal
If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrepoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then
If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrePoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then
ErrorConta = True
End If
End If
@@ -15569,7 +15569,7 @@ Partial Class Ventas
IdCtaContable = IdCtaContComplementaria
importeMX = importeMovimiento
ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -15580,7 +15580,7 @@ Partial Class Ventas
IdCtaContable = IdCtaContMonedaExtranjera
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -15588,8 +15588,8 @@ Partial Class Ventas
'AMORTIZA NC CONTRA ANTICIPO A CLIENTES
If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal)
If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveSubProyecto:=CveSubProyectoVenta) Then
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -15611,23 +15611,23 @@ Partial Class Ventas
If importeMovimiento <> 0 Then
' Agregamos el 2
If tipoCambioPago = 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else 'Cuando son dolares
If importeMovimiento <> 0 Then
If IdCtaContComplementaria > 0 Or 0 > 0 Then
'Agregamos la Complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -15643,14 +15643,14 @@ Partial Class Ventas
'Agregamos el 13
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos el 61
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -15664,14 +15664,14 @@ Partial Class Ventas
'Agregamos el 38
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos el 39
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -15704,7 +15704,7 @@ Partial Class Ventas
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -15855,7 +15855,7 @@ Partial Class Ventas
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1,
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1,
CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, CveIE:=CveIEAnticipo,
PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
@@ -15870,13 +15870,13 @@ Partial Class Ventas
ErrorConta = True
End If
If Not ErrorConta AndAlso SimplificaPrePoliza AndAlso Not ObjConta.PrePolizaSimplificacion(CvePrepoliza, UsuarioActual.CveEmpresa) Then
If Not ErrorConta AndAlso SimplificaPrePoliza AndAlso Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
End If
If ObjConta.ValidacionPrePolizaCuadre(CvePrepoliza, 3) Then
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 3) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Ventas/Ventas-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrepoliza}", "LogPrePolizas")
GuardaLogAD($"Ventas/Ventas-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
ErrorConta = True
End If
@@ -18368,6 +18368,10 @@ Partial Class Ventas
Dim ClienteRetIVA = Me.ClienteRetIVA
If ClienteRetIVA <= 0 AndAlso DrPS("RetIVA").ToString.ToDecimal > 0 Then
ClienteRetIVA = DrPS("RetIVA").ToString.ToDecimal
DdlTipoRetencion.Enabled = True
End If
If ClienteRetIVA <= 0 Then
If CBool(DrPS("EsOutSourcing").ToString()) Then
@@ -18389,8 +18393,6 @@ Partial Class Ventas
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
@@ -18564,253 +18566,9 @@ Partial Class Ventas
OnError("Ocurrió un error al agregar el producto/servicio", ex)
End Try
Return Retorno
End Function
'Private Function AgregarProductoServicioCotizacion(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
' PU As Decimal, Descuento As Decimal, PorcentajeIVA As Decimal, ImporteIVA As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "",
' Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
' Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "",
' Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
' Optional ImporteProntoPago As Decimal = 0) As Boolean
' Dim Retorno As Boolean = False
' Try
' If Not CvePS > 0 Then
' Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
' Return False
' End If
' Dim Row As DataRow = Nothing
' Dim TotalCalculableImpuestos As Decimal = 0
' PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
' Descuento = Descuento.RoundSQL(NumeroDecimales)
' If Not TmpDT.Columns.Contains("RetIVA") Then
' TmpDT.Columns.Add("RetIVA", GetType(Decimal))
' End If
' Row = TmpDT.NewRow()
' Row("CveProyecto") = CveProyecto
' Row("Proyecto") = Proyecto
' Row("CveSubProyecto") = CveSubProyecto
' Row("SubProyecto") = SubProyecto
' Row("Serie") = Serie
' Row("TiempoEntrega") = TiempoEntrega
' If Modalidad = "U" Then
' Row("Orden") = Index
' Else
' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
' If ConsecutivoActual < 0 Then
' ConsecutivoActual = 0
' End If
' Row("Orden") = ConsecutivoActual + 1
' End If
' Row("Cantidad") = Cantidad
' Row("CveUM") = CveUM
' Row("UM") = UM
' Row("CveClasificacion") = CveClasificacion
' Row("Clasificacion") = Clasificacion
' Row("CvePS") = CvePS
' Row("Obs") = Obs
' Dim DrPS As DataRow = Nothing
' DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
' If DrPS Is Nothing Then
' Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
' Return False
' End If
' If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then
' 'VALIDA CLAVESAT
' If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA
' If DrPS("SATClavePS").ToString() = "" Then
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin producto SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
' Return False
' ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin Unidad Medida SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
' Return False
' End If
' 'If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
' ' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
' ' Return False
' 'End If
' End If
' Else
' If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
' Return False
' End If
' End If
' 'verifica si tiene ventaminima
' If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then
' 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
' If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then
' Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString()))
' Return False
' End If
' End If
' 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
' Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
' If Not ClienteDesglosaIEPS Then
' If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
' PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
' VentaDesglosaIEPS = True
' End If
' DrPS("IEPSPorcentaje") = 0
' End If
' 'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
' If FacturaDesglosoIEPS Then
' VentaDesglosaIEPS = True
' End If
' TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
' Row("PU") = PU
' Row("Codigo") = DrPS("Codigo")
' Row("NoIdentificacion") = DrPS("Codigo")
' Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
' Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
' Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
' Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
' If Modalidad = "U" Then
' Row("Consec") = Index
' Else
' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
' If ConsecutivoActual < 0 Then
' ConsecutivoActual = 0
' End If
' Row("Consec") = ConsecutivoActual + 1
' End If
' Row("PS") = DrPS("PS")
' Row("CodigoPS") = DrPS("PSCodigo").ToString()
' Row("CveTipoPS") = DrPS("CveTipoPS")
' Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
' Row("CveTamaño") = DrPS("CveTamaño")
' If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
' If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
' Row("PorcentajeIVA") = PorcentajeIVA
' Dim ClienteRetIVA = Me.ClienteRetIVA
' If ClienteRetIVA <= 0 Then
' If CBool(DrPS("EsOutSourcing").ToString()) Then
' ClienteRetIVA = 0.06D
' DdlTipoRetencion.SelectedValueExist("4")
' ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
' ClienteRetIVA = 0.106667D
' ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
' ClienteRetIVA = 0.04D
' End If
' End If
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
' TrRetIVA.Style.Add("display", "")
' DdlTipoRetencion.Visible = True
' Row("IVA") = PorcentajeIVA
' Row("ImporteIVA") = (ImporteIVA).RoundSQL(NumeroDecimales)
' Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
' Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
' Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
' Row("PorcentajeRetIVA") = ClienteRetIVA
' Row("PorcentajeRetISR") = ClienteRetISR
' Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
' Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
' Row("IEPS") = Row("ImporteIEPS")
' Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
' Row("TipoDescuento") = HdnTipoDescuento.Value
' Row("CvePromocionDetalle") = CvePromocionDetalle
' Row("Total") = (Cantidad * PU)
' Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
' 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
' ' Row("IdCtaContVentas") = IdCtaContable
' ' Row("AplicaParaConcepto") = AplicaParaConcepto
' Row("SATClaveProdServ") = DrPS("SATClavePS")
' Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
' If UsuarioActual.Empresa.UsaAC Then
' Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
' End If
' Row("EntregaDirecta") = EntregaDirecta
' 'Contratos
' Row("CveContratoDetalle") = CveContratoDetalle
' Row("CveVentaDetalle") = CveVentaDetalle
' Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
' Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
' Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
' Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
' Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
' Row("CuentaPredial") = CuentaPredial
' Row("EsOutSourcing") = DrPS("EsOutSourcing")
' Row("EsCargo") = EsCargo
' If ImporteProntoPago > 0 Then
' Row("ImporteProntoPago") = ImporteProntoPago
' Row("TieneProntoPago") = "Si"
' 'SOLO DEBE MOSTRASE SI EL PAGO ES DE CONTADO
' If RBLPago.SelectedValue = "2" Then
' GvPS.Columns(22).Visible = True
' thProntoPago.Visible = True
' thProntoPago2.Visible = True
' End If
' End If
' If UsuarioActual.CveEmpresa = 119 Then
' If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
' 'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
' If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
' If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then
' Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString()}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
' Return False
' End If
' End If
' 'ACTIVA PRODUCTOS DE LA MISMA MONEDA
' If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
' DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString())
' CambiaMoneda()
' DdlMoneda.Enabled = False
' End If
' End If
' End If
' 'RECARGAR GV
' TmpDT.Rows.Add(Row)
' Retorno = True
' Catch ex As Exception
' Retorno = False
' OnError("Ocurrió un error al agregar el producto/servicio", ex)
' End Try
' Return Retorno
'End Function
#End Region
#Region "D A T A - T A B L E S"