Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -11383,6 +11383,7 @@ Partial Class Compras_Compras
|
||||
|
||||
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
|
||||
|
||||
|
||||
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer))
|
||||
|
||||
@@ -12380,6 +12381,10 @@ Partial Class Compras_Compras
|
||||
Protected Sub DivirInsumo(sender As Object, e As EventArgs)
|
||||
Dim index2 As Integer = 0
|
||||
|
||||
If Not TmpDT.Columns.Contains("Importe") Then
|
||||
TmpDT.Columns.Add("Importe", GetType(Decimal))
|
||||
End If
|
||||
|
||||
'LLena el AF vinculado para no perderlo
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
If GvAFInsumos.Rows(index2).FCHiddenField("HdnCveAF").Value.ToEntero > 0 Then
|
||||
|
||||
@@ -907,213 +907,240 @@ Partial Class PopUpVerFactura
|
||||
Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, Parametros("EXT").ToString, Parametros("TIPODOCTO").ToString, Parametros("FOLIO").ToString, Exten)
|
||||
Dim Archivo As New System.IO.FileInfo(Path)
|
||||
|
||||
If Archivo.Exists Then
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "application/xml", "application/pdf")
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(Path)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
If Archivo.Exists Then
|
||||
DescargarArchivoPDFTraslado(Archivo, Path)
|
||||
Else
|
||||
|
||||
If Exten = "pdf" Then
|
||||
GeneraPDFFactura(Parametros("CVEMOVIMIENTO").ToString.ToEntero)
|
||||
Archivo = New System.IO.FileInfo(Path)
|
||||
If Archivo.Exists Then
|
||||
DescargarArchivoPDFTraslado(Archivo, Path)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Archivo = Nothing
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DescargarArchivoPDFTraslado(Archivo As System.IO.FileInfo, path As String)
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "application/xml", "application/pdf")
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(path)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
End Sub
|
||||
|
||||
'Protected Sub LnkGenerarPDF_Click(sender As Object, e As EventArgs)
|
||||
' GeneraPDFFactura()
|
||||
'End Sub
|
||||
'Private Sub GeneraPDFFactura()
|
||||
' Try
|
||||
' Dim objFactura = CreaObjetosVenta()
|
||||
' PdfFactura(objFactura)
|
||||
' objFactura.Dispose()
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al generar el PDF", ex)
|
||||
' End Try
|
||||
'End Sub
|
||||
Private Sub GeneraPDFFactura(CveMovimiento As Integer)
|
||||
Try
|
||||
Dim objFactura = CreaObjetosTraslado(CveMovimiento)
|
||||
If objFactura IsNot Nothing Then
|
||||
PdfFactura(objFactura)
|
||||
objFactura.Dispose()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el PDF", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Private Function CreaObjetosTraslado() As Modelos.Factura
|
||||
' Dim ObjFactura = New Modelos.Factura
|
||||
' ObjFactura.Version = "3.3"
|
||||
' ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
||||
' ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
' ObjFactura.TipoCambio = 0
|
||||
' ObjFactura.ConvertirPesos = False
|
||||
' ObjFactura.TipoCambio = 0
|
||||
' ObjFactura.CveMoneda = 1
|
||||
' ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
' ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1")
|
||||
' ObjFactura.MonedaAbreviatura = GlobalDTMonedas.FiltroPrimeroValor("Abreviatura", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
' ObjFactura.TipoDocto = "Tra"
|
||||
' ObjFactura.RefDocto = ""
|
||||
' ObjFactura.Folio = Folio.ToEntero
|
||||
' ObjFactura.Serie = "Tra"
|
||||
' ObjFactura.CveMesa = -1
|
||||
' ObjFactura.Fecha = Now
|
||||
' ObjFactura.CvePrePoliza = -1
|
||||
' ObjFactura.FechaPago = Now
|
||||
' ObjFactura.MotivoDescuento = ""
|
||||
' ObjFactura.Observaciones = ""
|
||||
' ObjFactura.FechaEjecucion = Now
|
||||
' ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||
' ObjFactura.CveCondicionEntrega = -1
|
||||
' ObjFactura.CondicionEntrega = ""
|
||||
' ObjFactura.NumeroCuenta = ""
|
||||
' ObjFactura.CondicionesPago = 0
|
||||
' ObjFactura.FormaPago = 0
|
||||
' ObjFactura.PedidoContrato = ""
|
||||
' ObjFactura.OrdenCompra = ""
|
||||
' ObjFactura.NumeroContrato = ""
|
||||
' ObjFactura.NumeroDescripcionContrato = ""
|
||||
' ObjFactura.DescripcionContrato = ""
|
||||
' ObjFactura.CveCorte = -1
|
||||
' ObjFactura.TipoDocumento = "Traspaso"
|
||||
' ObjFactura.Alfa1 = ""
|
||||
' ObjFactura.Alfa2 = ""
|
||||
' ObjFactura.Alfa3 = ""
|
||||
' ObjFactura.Descuento = 0
|
||||
' ObjFactura.Amortizacion = 0
|
||||
' ObjFactura.CveContrato = 0
|
||||
' ObjFactura.CveVendedor = 0
|
||||
' ObjFactura.FechaVencimiento = Now
|
||||
' ObjFactura.TipoEstatus = 0
|
||||
' ObjFactura.Det_OrdenCompra = ""
|
||||
' ObjFactura.Inv_CveEstatusEntrega = 0
|
||||
' ObjFactura.FormaPago33 = ""
|
||||
' ObjFactura.MetodoPago33 = ""
|
||||
' ObjFactura.UsoCFDI = ""
|
||||
' ObjFactura.CveClienteSucursal = 0
|
||||
' Dim CveSubProyecto As Integer = -1
|
||||
' If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then
|
||||
' CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
' End If
|
||||
' ObjFactura.CveSubProyecto = CveSubProyecto
|
||||
' ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||
' ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||
Private Function CreaObjetosTraslado(CveMovimiento As Integer) As Modelos.Factura
|
||||
Dim Folio As Integer = -1
|
||||
Dim CveAlmacen As Integer = 0
|
||||
Dim DtDetalle As DataTable = Nothing
|
||||
|
||||
' ObjFactura.SubTotal = 0
|
||||
' ObjFactura.Descuento = 0
|
||||
' ObjFactura.Amortizacion = 0
|
||||
' ObjFactura.IVA = 0
|
||||
' ObjFactura.RetIVA = 0
|
||||
' ObjFactura.RetISR = 0
|
||||
' ObjFactura.IEPS = 0
|
||||
' ObjFactura.Total = 0
|
||||
' ObjFactura.RFCReceptor = "XAXX010101000"
|
||||
Using ObjMovimientos As New ClsInventarios
|
||||
If ObjMovimientos.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjMovimientos.DtResultados.Rows.Count = 1 Then
|
||||
Folio = ObjMovimientos.Folio
|
||||
CveAlmacen = ObjMovimientos.CveAlmacen
|
||||
End If
|
||||
|
||||
' Dim dt As DataTable = DtMovimientos.Copy
|
||||
If ObjMovimientos.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
DtDetalle = ObjMovimientos.DtResultados.Copy
|
||||
End If
|
||||
End Using
|
||||
|
||||
' dt.Columns.Add("TotalImporte", Type.GetType("System.Double"))
|
||||
' dt.Columns.Add("Descuento", Type.GetType("System.Double"))
|
||||
' dt.Columns.Add("UM")
|
||||
' dt.Columns.Add("SATClaveUM")
|
||||
' dt.Columns.Add("SATClaveProdServ")
|
||||
' dt.Columns.Add("Noidentificacion")
|
||||
' dt.Columns.Add("CuentaPredial")
|
||||
' dt.Columns.Add("Obs")
|
||||
' dt.Columns.Add("ImporteIVA", Type.GetType("System.Double"))
|
||||
' dt.Columns.Add("PorcentajeIVA", Type.GetType("System.Double"))
|
||||
If Folio > 0 AndAlso DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0 Then
|
||||
Dim ObjFactura = New Modelos.Factura
|
||||
ObjFactura.Version = "3.3"
|
||||
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
||||
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjFactura.TipoCambio = 0
|
||||
ObjFactura.ConvertirPesos = False
|
||||
ObjFactura.TipoCambio = 0
|
||||
ObjFactura.CveMoneda = 1
|
||||
ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1")
|
||||
ObjFactura.MonedaAbreviatura = GlobalDTMonedas.FiltroPrimeroValor("Abreviatura", $"CveMoneda = {ObjFactura.CveMoneda} ")
|
||||
ObjFactura.TipoDocto = "Tra"
|
||||
ObjFactura.RefDocto = ""
|
||||
ObjFactura.Folio = Folio
|
||||
ObjFactura.Serie = "Tra"
|
||||
ObjFactura.CveMesa = -1
|
||||
ObjFactura.Fecha = Now
|
||||
ObjFactura.CvePrePoliza = -1
|
||||
ObjFactura.FechaPago = Now
|
||||
ObjFactura.MotivoDescuento = ""
|
||||
ObjFactura.Observaciones = ""
|
||||
ObjFactura.FechaEjecucion = Now
|
||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||
ObjFactura.CveCondicionEntrega = -1
|
||||
ObjFactura.CondicionEntrega = ""
|
||||
ObjFactura.NumeroCuenta = ""
|
||||
ObjFactura.CondicionesPago = 0
|
||||
ObjFactura.FormaPago = 0
|
||||
ObjFactura.PedidoContrato = ""
|
||||
ObjFactura.OrdenCompra = ""
|
||||
ObjFactura.NumeroContrato = ""
|
||||
ObjFactura.NumeroDescripcionContrato = ""
|
||||
ObjFactura.DescripcionContrato = ""
|
||||
ObjFactura.CveCorte = -1
|
||||
ObjFactura.TipoDocumento = "Traspaso"
|
||||
ObjFactura.Alfa1 = ""
|
||||
ObjFactura.Alfa2 = ""
|
||||
ObjFactura.Alfa3 = ""
|
||||
ObjFactura.Descuento = 0
|
||||
ObjFactura.Amortizacion = 0
|
||||
ObjFactura.CveContrato = 0
|
||||
ObjFactura.CveVendedor = 0
|
||||
ObjFactura.FechaVencimiento = Now
|
||||
ObjFactura.TipoEstatus = 0
|
||||
ObjFactura.Det_OrdenCompra = ""
|
||||
ObjFactura.Inv_CveEstatusEntrega = 0
|
||||
ObjFactura.FormaPago33 = ""
|
||||
ObjFactura.MetodoPago33 = ""
|
||||
ObjFactura.UsoCFDI = ""
|
||||
ObjFactura.CveClienteSucursal = 0
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {CveAlmacen}").Rows.Count > 0 Then
|
||||
CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {CveAlmacen}").Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
End If
|
||||
ObjFactura.CveSubProyecto = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||
|
||||
ObjFactura.SubTotal = 0
|
||||
ObjFactura.Descuento = 0
|
||||
ObjFactura.Amortizacion = 0
|
||||
ObjFactura.IVA = 0
|
||||
ObjFactura.RetIVA = 0
|
||||
ObjFactura.RetISR = 0
|
||||
ObjFactura.IEPS = 0
|
||||
ObjFactura.Total = 0
|
||||
ObjFactura.RFCReceptor = "XAXX010101000"
|
||||
|
||||
|
||||
' For Each Row As DataRow In dt.Rows
|
||||
' Row("TotalImporte") = Row("Total")
|
||||
' Row("Descuento") = 0
|
||||
' Row("UM") = Row("UnidadMedida")
|
||||
' Row("SATClaveUM") = Row("SATClaveUnidadMedida")
|
||||
' Row("SATClaveProdServ") = Row("SATClavePS")
|
||||
' Row("Noidentificacion") = Row("Codigo")
|
||||
' Row("CuentaPredial") = ""
|
||||
' Row("Obs") = Row("Observaciones")
|
||||
' Row("ImporteIVA") = 0
|
||||
' Row("PorcentajeIVA") = 0
|
||||
' Next
|
||||
|
||||
' 'DETALLES
|
||||
' ObjFactura.DtDetalle = dt
|
||||
DtDetalle.Columns.Add("TotalImporte", Type.GetType("System.Double"))
|
||||
DtDetalle.Columns.Add("Descuento", Type.GetType("System.Double"))
|
||||
DtDetalle.Columns.Add("UM")
|
||||
DtDetalle.Columns.Add("SATClaveUM")
|
||||
DtDetalle.Columns.Add("SATClaveProdServ")
|
||||
DtDetalle.Columns.Add("Noidentificacion")
|
||||
DtDetalle.Columns.Add("CuentaPredial")
|
||||
DtDetalle.Columns.Add("Obs")
|
||||
DtDetalle.Columns.Add("ImporteIVA", Type.GetType("System.Double"))
|
||||
DtDetalle.Columns.Add("PorcentajeIVA", Type.GetType("System.Double"))
|
||||
|
||||
' 'SUBPROYECTO
|
||||
' ObjFactura.SetSubProyectoMatriz(Me)
|
||||
' ObjFactura.SetSubProyecto(Me)
|
||||
|
||||
' ObjFactura.Inv_CveMovimiento = Me.CveMovimiento
|
||||
For Each Row As DataRow In DtDetalle.Rows
|
||||
Row("TotalImporte") = Row("Total")
|
||||
Row("Descuento") = 0
|
||||
Row("UM") = Row("UnidadMedida")
|
||||
Row("SATClaveUM") = Row("SATClaveUnidadMedida")
|
||||
Row("SATClaveProdServ") = Row("SATClavePS")
|
||||
Row("Noidentificacion") = Row("Codigo")
|
||||
Row("CuentaPredial") = ""
|
||||
Row("Obs") = Row("Observaciones")
|
||||
Row("ImporteIVA") = 0
|
||||
Row("PorcentajeIVA") = 0
|
||||
Next
|
||||
|
||||
' ObjFactura.Timbre = PreParaTimbreTraslado(ObjFactura)
|
||||
'DETALLES
|
||||
ObjFactura.DtDetalle = DtDetalle
|
||||
|
||||
' Return ObjFactura
|
||||
'End Function
|
||||
'Private Function PreParaTimbreTraslado(Obj As Modelos.Factura) As CFDITimbre
|
||||
' Dim Timbre As New CFDITimbre
|
||||
' Timbre.Comprobante.TipoComprobante = "T"
|
||||
' Timbre.Comprobante.Folio = Obj.Folio.ToString
|
||||
' Timbre.Comprobante.Serie = Obj.Serie
|
||||
' Timbre.Comprobante.Fecha = Obj.Fecha
|
||||
' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
||||
' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
||||
' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
||||
' Timbre.Comprobante.Subtotal = Obj.SubTotal
|
||||
' Timbre.Comprobante.Descuentos = Obj.Descuento
|
||||
' Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
||||
' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
||||
' Timbre.Comprobante.Total = Obj.Total
|
||||
'SUBPROYECTO
|
||||
ObjFactura.SetSubProyectoMatriz(Me)
|
||||
ObjFactura.SetSubProyecto(Me)
|
||||
|
||||
' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
|
||||
' Timbre.Comprobante.Confirmacion = ""
|
||||
ObjFactura.Inv_CveMovimiento = CveMovimiento
|
||||
|
||||
' Timbre.Receptor.RFC = "XAXX010101000"
|
||||
' Timbre.Receptor.Nombre = UsuarioActual.Empresa.Empresa
|
||||
' Timbre.Receptor.UsoCFDI = "P01"
|
||||
ObjFactura.Timbre = PreParaTimbreTraslado(ObjFactura)
|
||||
Return ObjFactura
|
||||
End If
|
||||
|
||||
' Dim totSubTotal As Decimal = Obj.SubTotal
|
||||
' Dim totIVA As Decimal = Obj.IVA
|
||||
' Dim totRetIVA As Decimal = Obj.RetIVA
|
||||
' Dim totRetISR As Decimal = Obj.RetISR
|
||||
' Dim i As Integer = 1
|
||||
Return Nothing
|
||||
|
||||
' 'DETALLES
|
||||
' Dim tPS As String = ""
|
||||
End Function
|
||||
Private Function PreParaTimbreTraslado(Obj As Modelos.Factura) As CFDITimbre
|
||||
Dim Timbre As New CFDITimbre
|
||||
Timbre.Comprobante.TipoComprobante = "T"
|
||||
Timbre.Comprobante.Folio = Obj.Folio.ToString
|
||||
Timbre.Comprobante.Serie = Obj.Serie
|
||||
Timbre.Comprobante.Fecha = Obj.Fecha
|
||||
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
||||
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
||||
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
||||
Timbre.Comprobante.Subtotal = Obj.SubTotal
|
||||
Timbre.Comprobante.Descuentos = Obj.Descuento
|
||||
Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
||||
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
||||
Timbre.Comprobante.Total = Obj.Total
|
||||
|
||||
' For Each drr As DataRow In Obj.DtDetalle.Rows
|
||||
' If drr("PS").ToString.Length = 1 Then
|
||||
' tPS = drr("Obs").ToString
|
||||
' Else
|
||||
' If drr("PS").ToString.Length = 0 Then
|
||||
' tPS = ""
|
||||
' Else
|
||||
' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
|
||||
' End If
|
||||
' End If
|
||||
Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
|
||||
Timbre.Comprobante.Confirmacion = ""
|
||||
|
||||
' 'CONDICIONANTE, ESPECIAL
|
||||
' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO
|
||||
Timbre.Receptor.RFC = "XAXX010101000"
|
||||
Timbre.Receptor.Nombre = UsuarioActual.Empresa.Empresa
|
||||
Timbre.Receptor.UsoCFDI = "P01"
|
||||
|
||||
' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
|
||||
' .Descripcion = tPS,
|
||||
' .ValorUnitario = drr("PU").ToString.ToDecimal,
|
||||
' .Importe = drr("TotalImporte").ToString.ToDecimal,
|
||||
' .Descuento = drr("Descuento").ToString.ToDecimal,
|
||||
' .Unidad = drr("UM").ToString,
|
||||
' .ClaveUnidad = drr("SATClaveUM").ToString,
|
||||
' .ClaveProdServ = drr("SATClaveProdServ").ToString,
|
||||
' .Noidentificacion = drr("Noidentificacion").ToString,
|
||||
' .CuentaPredial = drr("CuentaPredial").ToString}
|
||||
' 'VERIFICA SUMA SUBTOTALES
|
||||
' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES
|
||||
' concepto.Importe = totSubTotalW
|
||||
' End If
|
||||
' totSubTotal = totSubTotal - concepto.Importe
|
||||
Dim totSubTotal As Decimal = Obj.SubTotal
|
||||
Dim totIVA As Decimal = Obj.IVA
|
||||
Dim totRetIVA As Decimal = Obj.RetIVA
|
||||
Dim totRetISR As Decimal = Obj.RetISR
|
||||
Dim i As Integer = 1
|
||||
|
||||
' 'SIEMPRE ESTAMOS AGREGANDO EL IVA
|
||||
' 'concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
|
||||
'DETALLES
|
||||
Dim tPS As String = ""
|
||||
|
||||
' Timbre.Conceptos.Add(concepto)
|
||||
' i += 1
|
||||
' Next
|
||||
' Return Timbre
|
||||
'End Function
|
||||
For Each drr As DataRow In Obj.DtDetalle.Rows
|
||||
If drr("PS").ToString.Length = 1 Then
|
||||
tPS = drr("Obs").ToString
|
||||
Else
|
||||
If drr("PS").ToString.Length = 0 Then
|
||||
tPS = ""
|
||||
Else
|
||||
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
|
||||
End If
|
||||
End If
|
||||
|
||||
'CONDICIONANTE, ESPECIAL
|
||||
If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO
|
||||
|
||||
Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
|
||||
.Descripcion = tPS,
|
||||
.ValorUnitario = drr("PU").ToString.ToDecimal,
|
||||
.Importe = drr("TotalImporte").ToString.ToDecimal,
|
||||
.Descuento = drr("Descuento").ToString.ToDecimal,
|
||||
.Unidad = drr("UM").ToString,
|
||||
.ClaveUnidad = drr("SATClaveUM").ToString,
|
||||
.ClaveProdServ = drr("SATClaveProdServ").ToString,
|
||||
.Noidentificacion = drr("Noidentificacion").ToString,
|
||||
.CuentaPredial = drr("CuentaPredial").ToString}
|
||||
'VERIFICA SUMA SUBTOTALES
|
||||
If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES
|
||||
concepto.Importe = totSubTotal
|
||||
End If
|
||||
totSubTotal = totSubTotal - concepto.Importe
|
||||
|
||||
'SIEMPRE ESTAMOS AGREGANDO EL IVA
|
||||
'concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
|
||||
|
||||
Timbre.Conceptos.Add(concepto)
|
||||
i += 1
|
||||
Next
|
||||
Return Timbre
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -11600,7 +11600,7 @@ Partial Class Ventas
|
||||
'INVENTARIOS
|
||||
If ErrorList.Count = 0 Then
|
||||
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjVentas, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
End If
|
||||
End If
|
||||
@@ -13230,7 +13230,7 @@ Partial Class Ventas
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
|
||||
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjVentas As ClsVentas, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Try
|
||||
|
||||
@@ -13239,7 +13239,7 @@ Partial Class Ventas
|
||||
If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
For Each CveRemision As Integer In RemisionesLista
|
||||
'El almacen general es el Primer Almacen de Material en la Sucursal
|
||||
If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then
|
||||
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -18665,7 +18665,7 @@ Partial Class Ventas
|
||||
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
|
||||
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjVentas As ClsVentas, 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
|
||||
@@ -18747,9 +18747,9 @@ Partial Class Ventas
|
||||
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
||||
Else
|
||||
If TieneMovimientosContrato Then
|
||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||
Else
|
||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -18761,26 +18761,12 @@ Partial Class Ventas
|
||||
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
|
||||
Dim CveConceptoSalidaAlmacen As Integer = 3
|
||||
Dim CveAlmacenParaSalida As Integer = CveAlmacenEntrada
|
||||
|
||||
'SALIDA DEFINITIVA DEL SISTEMA
|
||||
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
||||
CveConceptoSalidaAlmacen = 40
|
||||
CveAlmacenParaSalida = CveAlmacenSalida
|
||||
AplicaMovimientoDetalleEntrada = True
|
||||
''Le damos salida normal
|
||||
'If ConSalida Then
|
||||
' GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 40, CveMoneda, CveVenta, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
|
||||
' If Not GeneroMovimientoAlmacen Then
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
' If Not GeneroMovimientoAlmacen Then
|
||||
' OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura)
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
Else
|
||||
'Le damos salida de apartado por traspaso
|
||||
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
||||
@@ -18820,19 +18806,10 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
Alert("Error traspaso almacen(sin Movtos. Detalle). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
|
||||
End If
|
||||
|
||||
MovDetalle.Dispose()
|
||||
|
||||
'VERIFICA QUE SE HAYA GENERADO MOVIMIENTO DE ALMACEN
|
||||
If Not OcurrioError Then
|
||||
OcurrioError = Not GeneroMovimientoAlmacen
|
||||
End If
|
||||
|
||||
If OcurrioError Then
|
||||
Exit For
|
||||
End If
|
||||
@@ -18841,12 +18818,6 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If OcurrioError Then
|
||||
@@ -18854,6 +18825,24 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
'VERIFICA QUE SE HAYA GENERADO MOVIMIENTO DE ALMACEN
|
||||
If Not OcurrioError Then
|
||||
OcurrioError = Not GeneroMovimientoAlmacen
|
||||
End If
|
||||
|
||||
'VERIFICA SI YA SE GENERARON LAS SALIDAS DE ALMACEN NECESARIAS
|
||||
If Not OcurrioError AndAlso RemisionesLista.Count > 0 AndAlso DtRemConceptosSurtidos IsNot Nothing Then
|
||||
If DtRemConceptosSurtidos.SUMD("Surtido") <> DtRemConceptosSurtidos.SUMD("Cantidad") Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ConSalida Then
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
@@ -18862,31 +18851,59 @@ Partial Class Ventas
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'LIMPIAR EL DT DE CONCEPTOS SURTIDOS
|
||||
If DtRemConceptosSurtidos IsNot Nothing Then
|
||||
DtRemConceptosSurtidos.Clear()
|
||||
DtRemConceptosSurtidos = Nothing
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
OnError("Ocurrió un error al realizar el traspaso", ex)
|
||||
End Try
|
||||
Return Not OcurrioError
|
||||
End Function
|
||||
Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable
|
||||
Private Function CuadrarFacturaMovimientos(ByRef ObjVentas As ClsVentas, CveRemision As Integer, MovDetalle As DataTable) As DataTable
|
||||
Dim MovDTCuadrados As New DataTable
|
||||
MovDTCuadrados = MovDetalle.Clone
|
||||
MovDTCuadrados.Clear()
|
||||
|
||||
'Llenamos el DT solo si es primera llamada
|
||||
If DtRemConceptosSurtidos Is Nothing Then
|
||||
DtRemConceptosSurtidos = New DataTable
|
||||
DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal))
|
||||
DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal))
|
||||
Dim DtDetalleRemision As DataTable = Nothing
|
||||
Dim StrCveVentasDetalle As New StringBuilder()
|
||||
|
||||
For Each dr As DataRow In DtRemisionesTmpDT.Rows
|
||||
Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow
|
||||
dtr("CveVentaDetalle") = dr("CveVentaDetalle")
|
||||
dtr("Cantidad") = dr("Cantidad")
|
||||
dtr("Surtido") = 0
|
||||
DtRemConceptosSurtidos.Rows.Add(dtr)
|
||||
If ObjVentas.GetVentaDetalle(CveRemision) Then
|
||||
DtDetalleRemision = ObjVentas.DtResultados.FiltraParametros("", DistinctColumns:={"CveVenta", "CveVentaDetalle"})
|
||||
End If
|
||||
|
||||
For Each RowDetalle As DataRow In DtDetalleRemision.Rows
|
||||
StrCveVentasDetalle.AppendFormat("{0},", RowDetalle("CveVentaDetalle"))
|
||||
Next
|
||||
|
||||
If StrCveVentasDetalle.Length > 0 Then
|
||||
StrCveVentasDetalle.Remove(StrCveVentasDetalle.Length - 1, 1)
|
||||
End If
|
||||
|
||||
If DtDetalleRemision IsNot Nothing Then
|
||||
|
||||
DtRemConceptosSurtidos = New DataTable
|
||||
DtRemConceptosSurtidos.Columns.Add("CveRemision", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal))
|
||||
DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal))
|
||||
|
||||
'VERIFICA SOLO LOS QUE SON TIPO PRODUCTOS
|
||||
For Each dr As DataRow In DtRemisionesTmpDT.FiltraParametros($"CveTipoPS = 2 AND CveVentaDetalle IN ({StrCveVentasDetalle.ToString()})").Rows
|
||||
Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow
|
||||
dtr("CveRemision") = CveRemision
|
||||
dtr("CveVentaDetalle") = dr("CveVentaDetalle")
|
||||
dtr("Cantidad") = dr("Cantidad")
|
||||
dtr("Surtido") = 0
|
||||
DtRemConceptosSurtidos.Rows.Add(dtr)
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
For Each dr As DataRow In MovDetalle.Rows
|
||||
@@ -29633,6 +29650,9 @@ Partial Class Ventas
|
||||
LbAgregar.Enabled = True
|
||||
LnkAgregarPyME.Enabled = True
|
||||
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgDescTotal.Visible = False
|
||||
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
|
||||
|
||||
TxtMotivoDescuento.Enabled = True
|
||||
|
||||
Reference in New Issue
Block a user