Merge branch 'master' of http://oirigoyen@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -705,8 +705,11 @@ Partial Class Contratos_Default
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
TipoContrato = DdlTipoContrato.SelectedValue.ToEntero
|
TipoContrato = DdlTipoContrato.SelectedValue.ToEntero
|
||||||
TxtDescripcionTipoContrato.Text = GlobalDTContratosTipos(UsuarioActual.CveEmpresa).FiltraParametros("CveContratoTipo = " & DdlTipoContrato.SelectedValue)(0)("Descripcion").ToString()
|
If GlobalDTContratosTipos(UsuarioActual.CveEmpresa).FiltraParametros("CveContratoTipo = " & DdlTipoContrato.SelectedValue).Rows.Count > 0 Then
|
||||||
TxtDescripcionTipoContrato.Visible = True
|
TxtDescripcionTipoContrato.Text = GlobalDTContratosTipos(UsuarioActual.CveEmpresa).FiltraParametros("CveContratoTipo = " & DdlTipoContrato.SelectedValue)(0)("Descripcion").ToString()
|
||||||
|
TxtDescripcionTipoContrato.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
CargaContratoPadre()
|
CargaContratoPadre()
|
||||||
UpProyecto.Update()
|
UpProyecto.Update()
|
||||||
@@ -725,6 +728,15 @@ Partial Class Contratos_Default
|
|||||||
TableDatosCabecera.Visible = True
|
TableDatosCabecera.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If CveTipoContrato = 25 Then
|
||||||
|
DvMax.Visible = False
|
||||||
|
DvMin.Visible = False
|
||||||
|
DvTotal.Visible = False
|
||||||
|
|
||||||
|
DivFianzas.Visible = False
|
||||||
|
DivImpuestosLocales.Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
ElseIf modalidadDetalleInt = 2 Then
|
ElseIf modalidadDetalleInt = 2 Then
|
||||||
ModalidadDetalle = 2
|
ModalidadDetalle = 2
|
||||||
|
|
||||||
@@ -737,6 +749,15 @@ Partial Class Contratos_Default
|
|||||||
TableDatosCabecera.Visible = True
|
TableDatosCabecera.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If CveTipoContrato = 25 Then
|
||||||
|
DvMax.Visible = False
|
||||||
|
DvMin.Visible = False
|
||||||
|
DvTotal.Visible = False
|
||||||
|
|
||||||
|
DivFianzas.Visible = False
|
||||||
|
DivImpuestosLocales.Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpGral.Update()
|
UpGral.Update()
|
||||||
@@ -755,11 +776,13 @@ Partial Class Contratos_Default
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Me.CveTipoContrato = DdlTipoContrato.SelectedValue.ToEntero
|
||||||
|
|
||||||
'Dim TipoMov = GlobalDTContratosTipos.FiltroPrimeroValor("TipoMovimiento", $"CveContratoTipo='{CveTipoContrato}'").ToEntero
|
'Dim TipoMov = GlobalDTContratosTipos.FiltroPrimeroValor("TipoMovimiento", $"CveContratoTipo='{CveTipoContrato}'").ToEntero
|
||||||
|
|
||||||
If rpCompra.Checked Then
|
If rpCompra.Checked Then
|
||||||
Dim CveContratoTipo = DdlTipoContrato.SelectedValue.ToEntero
|
|
||||||
Response.Redirect($"/Contratos/Presupuestos.aspx?CveContrato=-1&CveContratoTipo={CveContratoTipo}")
|
Response.Redirect($"/Contratos/Presupuestos.aspx?CveContrato=-1&CveContratoTipo={Me.CveTipoContrato}")
|
||||||
'RegistraScript("window.location='/Contratos/Presupuestos.aspx")
|
'RegistraScript("window.location='/Contratos/Presupuestos.aspx")
|
||||||
Else
|
Else
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<asp:GridView ID="GvCiclosComerciales" runat="server" DataKeyNames="CveCicloComercial, NumeroContrato, CveSubProyecto" AutoGenerateColumns="False" ShowHeader="True" EmptyDataText="No se encontraron pendientes por facturar" GridLines="none" ToolTip="Listado de Pendientes" CssClass="table table-striped table-hover Widthall">
|
<asp:GridView ID="GvCiclosComerciales" runat="server" DataKeyNames="CveCicloComercial, NumeroContrato, CveSubProyecto, FechaVenc" AutoGenerateColumns="False" ShowHeader="True" EmptyDataText="No se encontraron pendientes por facturar" GridLines="none" ToolTip="Listado de Pendientes" CssClass="table table-striped table-hover Widthall">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" headertext="" ItemStyle-Width="10%">
|
<asp:TemplateField ItemStyle-HorizontalAlign="center" headertext="" ItemStyle-Width="10%">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
|
|||||||
@@ -166,300 +166,187 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub ImgFacturarTodos_Click(sender As Object, e As EventArgs) Handles BtnFacturar.Click
|
Protected Sub ImgFacturarTodos_Click(sender As Object, e As EventArgs) Handles BtnFacturar.Click
|
||||||
|
EjecutarFacturacion()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub EjecutarFacturacion()
|
||||||
Dim FacturadoCorrecto = True
|
Dim FacturadoCorrecto = True
|
||||||
|
Dim sb As New StringBuilder()
|
||||||
|
|
||||||
For Each row As GridViewRow In GvCiclosComerciales.Rows
|
For Each row As GridViewRow In GvCiclosComerciales.Rows
|
||||||
If row.FCCheckBox("chkDis").Checked Then
|
If row.FCCheckBox("chkDis").Checked Then
|
||||||
FacturadoCorrecto = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero)
|
Dim fecha As DateTime = DateTime.Now ', row.DataKey("FechaVenc").ToString.ToDateTime()
|
||||||
|
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
|
||||||
|
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
|
||||||
|
|
||||||
|
Dim Etiqueta As String = String.Format("{0} - {1}", nombreMes, fecha.Year)
|
||||||
|
|
||||||
|
Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero, Etiqueta)
|
||||||
|
|
||||||
|
For Each Msg In Resp.Mensajes
|
||||||
|
sb.AppendFormat("{0}</br></br>", Msg)
|
||||||
|
Next
|
||||||
|
|
||||||
If Not FacturadoCorrecto Then
|
If Not FacturadoCorrecto Then
|
||||||
If Mensaje = "" Then
|
If Mensaje = "" Then
|
||||||
Alert("Ocurrió un error al facturar masivamente, por favor contacte a soporte técnico", TipoMensaje.MsgAdvertencia)
|
Alert("Ocurrió un error al facturar masivamente, por favor contacte a soporte técnico", TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
Else
|
||||||
Alert($"{Mensaje} en el contrato {row.DataKey("NumeroContrato").ToString}", TipoMensaje.MsgAdvertencia)
|
Alert($"{Mensaje} en el contrato {row.DataKey("NumeroContrato").ToString}", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
Exit For
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
If FacturadoCorrecto Then
|
|
||||||
Alert("Los periodos se facturaron correctamente")
|
If sb.ToString().Length > 0 Then
|
||||||
TxtObservaciones.Text = ""
|
Alert($"Se generaron las siguientes facturas: </br></br> {sb.ToString()}")
|
||||||
|
Else
|
||||||
|
Alert("No se generaron facturas", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CargaDatos(DdlContrato.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero)
|
CargaDatos(DdlContrato.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero)
|
||||||
RegistraScript("$('#divAgregar').modal('hide')")
|
RegistraScript("$('#divAgregar').modal('hide')")
|
||||||
UpBodyEstatus.Update()
|
UpBodyEstatus.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub btnFacturarAqui_Click(sender As Object, e As EventArgs)
|
Protected Sub btnFacturarAqui_Click(sender As Object, e As EventArgs)
|
||||||
CveCicloComercial = CType(sender, LinkButton).CommandArgument.ToEntero
|
EjecutarFacturacion()
|
||||||
CreaObjetosVenta()
|
|
||||||
|
|
||||||
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
|
|
||||||
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
|
|
||||||
ObjFactura = Nothing
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If ObjFactura.CveCliente > 0 Then
|
|
||||||
If DTDetalle.Rows.Count > 0 Then
|
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
|
||||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjContr As New ClsContratos(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjContPaq As ClsContPAQi = Nothing
|
|
||||||
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
|
||||||
ErrorList = New List(Of String)
|
|
||||||
MensajeAlert = New StringBuilder
|
|
||||||
|
|
||||||
|
|
||||||
'CONTABILIDAD AUTOMATICA Y AC
|
|
||||||
If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
|
||||||
ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
'GUARDA VENTA
|
|
||||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS)
|
|
||||||
|
|
||||||
If CveCicloComercial > 0 AndAlso ErrorList.Count = 0 Then
|
|
||||||
If Not ObjContr.CicloComercialUpdate(CveCicloComercial, True, UsuarioActual.CveEmpresa) Then
|
|
||||||
ErrorList.Add("No se pudo actualizar ")
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot")) Then
|
|
||||||
ObjVentas.Commit()
|
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
|
|
||||||
ViewState("CveVenta") = ObjFactura.CveVenta
|
|
||||||
|
|
||||||
|
|
||||||
Dim SeTimbro As Boolean = False
|
|
||||||
'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
|
|
||||||
|
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
|
||||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
|
||||||
|
|
||||||
Dim sw As New Diagnostics.Stopwatch
|
|
||||||
sw.Start()
|
|
||||||
|
|
||||||
'FACTURA INGRESO/EGRESO
|
|
||||||
Dim ObjTimbrado As New Timbrado
|
|
||||||
|
|
||||||
|
|
||||||
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
|
||||||
|
|
||||||
sw.Stop()
|
|
||||||
GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
'MENSAJE PRINCIPAL
|
|
||||||
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
|
|
||||||
|
|
||||||
|
|
||||||
If SeTimbro Then
|
|
||||||
'XML
|
|
||||||
Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
|
||||||
If File.Exists(ArchivoXML) Then
|
|
||||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", ObjFactura.CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
|
|
||||||
End If
|
|
||||||
|
|
||||||
'IMPRESION
|
|
||||||
GeneraPDFFactura(False)
|
|
||||||
Else
|
|
||||||
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir o póngase en contacto con soporte técnico.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
'MUESTA ALERT OK
|
|
||||||
Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={ObjFactura.CveCliente}&Opt=3"";")
|
|
||||||
Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion)
|
|
||||||
|
|
||||||
ObjFactura = Nothing
|
|
||||||
Else
|
|
||||||
ObjVentas.RollBack()
|
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
|
||||||
|
|
||||||
For Each ErrorItem In ErrorList
|
|
||||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
|
||||||
Next
|
|
||||||
|
|
||||||
'MUESTA ALERT ERROR
|
|
||||||
Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
|
||||||
End If
|
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
|
||||||
ObjConta.Dispose()
|
|
||||||
ObjInventario.Dispose()
|
|
||||||
ObjContr.Dispose()
|
|
||||||
ErrorList = Nothing
|
|
||||||
MensajeAlert = Nothing
|
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
|
||||||
CargaDatos(DdlContrato.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero)
|
|
||||||
Else
|
|
||||||
ObjVentas.RollBack()
|
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
|
||||||
|
|
||||||
For Each ErrorItem In ErrorList
|
|
||||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
|
||||||
Next
|
|
||||||
|
|
||||||
'MUESTA ALERT ERROR
|
|
||||||
Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
|
||||||
ObjVentas.Dispose()
|
|
||||||
ObjConta.Dispose()
|
|
||||||
ObjInventario.Dispose()
|
|
||||||
ObjContr.Dispose()
|
|
||||||
'ObjFolios.Dispose()
|
|
||||||
ErrorList = Nothing
|
|
||||||
MensajeAlert = Nothing
|
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
|
||||||
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Mensaje = "Las facturas del contrato"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function EmitirImprimir(pCveCicloComercial As Integer) As Boolean
|
Private Function EmitirImprimir(pCveCicloComercial As Integer, Etiqueta As String) As Modelos.Factura.MMensajeFactura
|
||||||
Dim retorno As Boolean = False
|
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||||
ViewState("CveCicloComercial") = pCveCicloComercial
|
ViewState("CveCicloComercial") = pCveCicloComercial
|
||||||
CreaObjetosVenta()
|
CreaObjetosVenta(Etiqueta)
|
||||||
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
|
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
|
||||||
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
|
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
|
||||||
ObjFactura = Nothing
|
ObjFactura = Nothing
|
||||||
Return False
|
Return Resp
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
If ObjFactura.CveCliente > 0 Then
|
If ObjFactura.CveCliente > 0 Then
|
||||||
If DTDetalle.Rows.Count > 0 Then
|
If DTDetalle.Rows.Count > 0 Then
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
Resp = ObjFactura.EmitirFactura()
|
||||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
|
||||||
Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
|
'Dim ObjVentas As New ClsVentas()
|
||||||
Dim ObjContr As New ClsContratos(ObjVentas.IniciaTransacSQL())
|
'Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL())
|
'Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
'Dim ObjContr As New ClsContratos(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
|
'Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjContPaq As ClsContPAQi = Nothing
|
'Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
||||||
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
'Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
|
||||||
ErrorList = New List(Of String)
|
'Dim ObjContPaq As ClsContPAQi = Nothing
|
||||||
MensajeAlert = New StringBuilder
|
''Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
||||||
|
'ErrorList = New List(Of String)
|
||||||
|
'MensajeAlert = New StringBuilder
|
||||||
|
|
||||||
|
|
||||||
'CONTABILIDAD AUTOMATICA Y AC
|
''CONTABILIDAD AUTOMATICA Y AC
|
||||||
If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
'If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
||||||
ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
|
' ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
|
|
||||||
'GUARDA VENTA
|
''GUARDA VENTA
|
||||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS)
|
'GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS)
|
||||||
|
|
||||||
If pCveCicloComercial > 0 AndAlso ErrorList.Count = 0 Then
|
'If pCveCicloComercial > 0 AndAlso ErrorList.Count = 0 Then
|
||||||
If Not ObjContr.CicloComercialUpdate(pCveCicloComercial, True, UsuarioActual.CveEmpresa) Then
|
' If Not ObjContr.CicloComercialUpdate(pCveCicloComercial, True, UsuarioActual.CveEmpresa) Then
|
||||||
ErrorList.Add("No se pudo actualizar ")
|
' ErrorList.Add("No se pudo actualizar ")
|
||||||
End If
|
' End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot")) Then
|
'If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot")) Then
|
||||||
ObjVentas.Commit()
|
' ObjVentas.Commit()
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
|
' If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
|
||||||
ViewState("CveVenta") = ObjFactura.CveVenta
|
' ViewState("CveVenta") = ObjFactura.CveVenta
|
||||||
|
|
||||||
|
|
||||||
Dim SeTimbro As Boolean = False
|
' Dim SeTimbro As Boolean = False
|
||||||
'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
|
' 'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
|
||||||
|
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
' If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
||||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
||||||
|
|
||||||
Dim sw As New Diagnostics.Stopwatch
|
' Dim sw As New Diagnostics.Stopwatch
|
||||||
sw.Start()
|
' sw.Start()
|
||||||
|
|
||||||
'FACTURA INGRESO/EGRESO
|
' 'FACTURA INGRESO/EGRESO
|
||||||
Dim ObjTimbrado As New Timbrado
|
' Dim ObjTimbrado As New Timbrado
|
||||||
|
|
||||||
|
|
||||||
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
||||||
|
|
||||||
sw.Stop()
|
' sw.Stop()
|
||||||
GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
|
' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
|
|
||||||
'MENSAJE PRINCIPAL
|
' 'MENSAJE PRINCIPAL
|
||||||
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
|
' MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
|
||||||
|
|
||||||
|
|
||||||
If SeTimbro Then
|
' If SeTimbro Then
|
||||||
'XML
|
' 'XML
|
||||||
Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
' Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||||
If File.Exists(ArchivoXML) Then
|
' If File.Exists(ArchivoXML) Then
|
||||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", ObjFactura.CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
|
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", ObjFactura.CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
'IMPRESION
|
' 'IMPRESION
|
||||||
GeneraPDFFactura(False)
|
' GeneraPDFFactura(False)
|
||||||
Else
|
' Else
|
||||||
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir o póngase en contacto con soporte técnico.")
|
' MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir o póngase en contacto con soporte técnico.")
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
'MUESTA ALERT OK
|
' 'MUESTA ALERT OK
|
||||||
Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={ObjFactura.CveCliente}&Opt=3"";")
|
' Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={ObjFactura.CveCliente}&Opt=3"";")
|
||||||
retorno = True
|
' retorno = True
|
||||||
ObjFactura = Nothing
|
' ObjFactura = Nothing
|
||||||
Else
|
' Else
|
||||||
ObjVentas.RollBack()
|
' ObjVentas.RollBack()
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
' If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
||||||
|
|
||||||
For Each ErrorItem In ErrorList
|
' For Each ErrorItem In ErrorList
|
||||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
' Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
'MUESTA ALERT ERROR
|
' 'MUESTA ALERT ERROR
|
||||||
Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
' Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
' ObjVentas.Dispose()
|
||||||
ObjConta.Dispose()
|
' ObjConta.Dispose()
|
||||||
ObjInventario.Dispose()
|
' ObjInventario.Dispose()
|
||||||
ObjContr.Dispose()
|
' ObjContr.Dispose()
|
||||||
ErrorList = Nothing
|
' ErrorList = Nothing
|
||||||
MensajeAlert = Nothing
|
' MensajeAlert = Nothing
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
' If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
||||||
Else
|
'Else
|
||||||
ObjVentas.RollBack()
|
' ObjVentas.RollBack()
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
' If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
||||||
|
|
||||||
For Each ErrorItem In ErrorList
|
' For Each ErrorItem In ErrorList
|
||||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
' Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
'MUESTA ALERT ERROR
|
' 'MUESTA ALERT ERROR
|
||||||
Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
' Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
|
||||||
ObjVentas.Dispose()
|
' ObjVentas.Dispose()
|
||||||
ObjConta.Dispose()
|
' ObjConta.Dispose()
|
||||||
ObjInventario.Dispose()
|
' ObjInventario.Dispose()
|
||||||
ObjContr.Dispose()
|
' ObjContr.Dispose()
|
||||||
'ObjFolios.Dispose()
|
' 'ObjFolios.Dispose()
|
||||||
ErrorList = Nothing
|
' ErrorList = Nothing
|
||||||
MensajeAlert = Nothing
|
' MensajeAlert = Nothing
|
||||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
' If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
||||||
End If
|
'End If
|
||||||
Else
|
Else
|
||||||
Mensaje = "No se pudo completar facturación por que no se encontraron partidas "
|
Mensaje = "No se pudo completar facturación por que no se encontraron partidas "
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
TmpDT.Clear()
|
TmpDT.Clear()
|
||||||
Return retorno
|
Return Resp
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
@@ -467,49 +354,91 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
TmpDT = New DataTable
|
TmpDT = New DataTable
|
||||||
TmpDT.Columns.Add("CveVenta", GetType(Integer))
|
TmpDT.Columns.Add("CveVenta", GetType(Integer))
|
||||||
TmpDT.Columns.Add("Consec", GetType(Integer))
|
TmpDT.Columns.Add("Consec", GetType(Integer))
|
||||||
TmpDT.Columns.Add("Cantidad", GetType(Double))
|
TmpDT.Columns.Add("Cantidad", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("Codigo", GetType(String))
|
TmpDT.Columns.Add("Codigo", GetType(String))
|
||||||
TmpDT.Columns.Add("CveUM", GetType(Integer))
|
TmpDT.Columns.Add("CveUM", GetType(Integer))
|
||||||
TmpDT.Columns.Add("UM", GetType(String))
|
TmpDT.Columns.Add("UM", GetType(String))
|
||||||
|
TmpDT.Columns.Add("SATClaveUM", GetType(String))
|
||||||
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
|
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
|
||||||
TmpDT.Columns.Add("Clasificacion", GetType(String))
|
TmpDT.Columns.Add("Clasificacion", GetType(String))
|
||||||
TmpDT.Columns.Add("CvePS", GetType(Integer))
|
TmpDT.Columns.Add("CvePS", GetType(Integer))
|
||||||
TmpDT.Columns.Add("PS", GetType(String))
|
TmpDT.Columns.Add("PS", GetType(String))
|
||||||
TmpDT.Columns.Add("CodigoPS", GetType(String))
|
TmpDT.Columns.Add("CodigoPS", GetType(String))
|
||||||
|
TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
|
||||||
|
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
||||||
|
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
|
||||||
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
|
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
|
||||||
TmpDT.Columns.Add("SerieLote", GetType(String))
|
TmpDT.Columns.Add("Serie", GetType(String))
|
||||||
|
TmpDT.Columns.Add("CuentaPredial", GetType(String))
|
||||||
TmpDT.Columns.Add("Obs", GetType(String))
|
TmpDT.Columns.Add("Obs", GetType(String))
|
||||||
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
|
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
|
||||||
TmpDT.Columns.Add("PU", GetType(Double))
|
TmpDT.Columns.Add("PU", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("IVA", GetType(Double))
|
TmpDT.Columns.Add("IVA", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("IEPS", GetType(Double))
|
TmpDT.Columns.Add("ImporteIVA", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("Descuento", GetType(Double))
|
TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("IEPS", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("Descuento", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
|
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
|
||||||
TmpDT.Columns.Add("Total", GetType(Double))
|
TmpDT.Columns.Add("TotalImporte", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("Total", GetType(Decimal))
|
||||||
|
'Para uso del módulo contable
|
||||||
|
TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
|
||||||
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
|
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
|
||||||
TmpDT.Columns.Add("Proyecto", GetType(String))
|
TmpDT.Columns.Add("Proyecto", GetType(String))
|
||||||
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
|
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||||
TmpDT.Columns.Add("SubProyecto", GetType(String))
|
TmpDT.Columns.Add("SubProyecto", GetType(String))
|
||||||
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
|
TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer))
|
||||||
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
|
||||||
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
|
|
||||||
TmpDT.Columns.Add("Observacion", GetType(String))
|
|
||||||
TmpDT.Columns.Add("SATClaveUM", GetType(String))
|
|
||||||
TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
|
|
||||||
TmpDT.Columns.Add("CuentaPredial", GetType(String))
|
|
||||||
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
|
|
||||||
TmpDT.Columns.Add("TotalImporte", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("PorcentajeIVA", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("ImporteIVA", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("PorcentajeIEPS", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("ImporteIEPS", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("ImporteRetIVA", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("PorcentajeRetISR", GetType(Double))
|
|
||||||
TmpDT.Columns.Add("ImporteRetISR", GetType(Double))
|
|
||||||
|
|
||||||
|
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
|
||||||
|
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer))
|
||||||
|
'Contratos
|
||||||
|
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
|
||||||
|
'Remisiones a Facturas
|
||||||
|
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
|
||||||
|
|
||||||
|
'Pedido2 a Facturas
|
||||||
|
TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer))
|
||||||
|
|
||||||
|
TmpDT.Columns.Add("Origen", GetType(Integer))
|
||||||
|
'Ordenes Servicio
|
||||||
|
TmpDT.Columns.Add("CveOS", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveOSDetalle", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("SeFacturara", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("Folio", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("Estatus", GetType(String))
|
||||||
|
'Ordenamiento
|
||||||
|
TmpDT.Columns.Add("Orden", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("TipoDocto", GetType(String))
|
||||||
|
'OC
|
||||||
|
TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||||
|
|
||||||
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal))
|
||||||
|
TmpDT.Columns.Add("CantidadInventario", GetType(Decimal))
|
||||||
|
|
||||||
|
TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String))
|
||||||
|
TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String))
|
||||||
|
TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
|
||||||
|
TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
|
||||||
|
|
||||||
|
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
|
Private Sub CreaObjetosVenta(Etiqueta As String, Optional VistaPrevia As Boolean = False)
|
||||||
Dim ObjFolios As New ClsGralFolios()
|
Dim ObjFolios As New ClsGralFolios()
|
||||||
Dim Folio As String = ""
|
Dim Folio As String = ""
|
||||||
Dim Serie As String = ""
|
Dim Serie As String = ""
|
||||||
@@ -518,10 +447,9 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
Dim Proyecto As String = ""
|
Dim Proyecto As String = ""
|
||||||
Dim SubProyecto As String = ""
|
Dim SubProyecto As String = ""
|
||||||
|
|
||||||
|
ObjFactura = New Modelos.Factura(UsuarioActual)
|
||||||
|
ObjFactura.DirectorioServidor = Server.MapPath("/")
|
||||||
ObjFactura = New Modelos.Factura
|
ObjFactura.CveCicloComercial = CveCicloComercial
|
||||||
Dim objContratos As New ClsContratos
|
|
||||||
Dim DR As DataRow = DTCicloComercial.FiltroPrimero($"CveCicloComercial = {CveCicloComercial}")
|
Dim DR As DataRow = DTCicloComercial.FiltroPrimero($"CveCicloComercial = {CveCicloComercial}")
|
||||||
|
|
||||||
ObjFactura.Version = "3.3"
|
ObjFactura.Version = "3.3"
|
||||||
@@ -544,7 +472,7 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
ObjFactura.MetodoPago = "Efectivo"
|
ObjFactura.MetodoPago = "Efectivo"
|
||||||
ObjFactura.FechaPago = DateTime.Today
|
ObjFactura.FechaPago = DateTime.Today
|
||||||
ObjFactura.MotivoDescuento = ""
|
ObjFactura.MotivoDescuento = ""
|
||||||
ObjFactura.Observaciones = DR("Observaciones").ToString
|
ObjFactura.Observaciones = Etiqueta + " " + TxtObservaciones.Text + " " + DR("Observaciones").ToString
|
||||||
ObjFactura.FechaEjecucion = DateTime.Today
|
ObjFactura.FechaEjecucion = DateTime.Today
|
||||||
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
|
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
|
||||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||||
@@ -589,13 +517,14 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
End If
|
End If
|
||||||
ObjFolios.Dispose()
|
ObjFolios.Dispose()
|
||||||
|
|
||||||
|
Dim objContratos As New ClsContratos
|
||||||
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then
|
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then
|
||||||
DTDetalle = objContratos.DtResultados
|
DTDetalle = objContratos.DtResultados
|
||||||
Else
|
Else
|
||||||
DTDetalle = Nothing
|
DTDetalle = Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
objContratos.Dispose()
|
objContratos.Dispose()
|
||||||
|
|
||||||
Dim DtR As DataRow
|
Dim DtR As DataRow
|
||||||
ObjFactura.SubTotal = SUM(DTDetalle, "Total").ToDecimal
|
ObjFactura.SubTotal = SUM(DTDetalle, "Total").ToDecimal
|
||||||
ObjFactura.IVA = SUM(DTDetalle, "ImporteIVA").ToDecimal
|
ObjFactura.IVA = SUM(DTDetalle, "ImporteIVA").ToDecimal
|
||||||
@@ -607,6 +536,8 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
ObjFactura.Folio = Folio.ToEntero
|
ObjFactura.Folio = Folio.ToEntero
|
||||||
|
|
||||||
For Each row As DataRow In DTDetalle.Rows
|
For Each row As DataRow In DTDetalle.Rows
|
||||||
|
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=row("CvePS").ToString().ToEntero()).FiltroPrimero("")
|
||||||
|
|
||||||
DtR = TmpDT.NewRow
|
DtR = TmpDT.NewRow
|
||||||
DtR("CveVenta") = -1
|
DtR("CveVenta") = -1
|
||||||
DtR("Codigo") = row("Codigo")
|
DtR("Codigo") = row("Codigo")
|
||||||
@@ -614,27 +545,18 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
DtR("Cantidad") = row("CantidadContratada")
|
DtR("Cantidad") = row("CantidadContratada")
|
||||||
DtR("CveUM") = row("CveUM")
|
DtR("CveUM") = row("CveUM")
|
||||||
DtR("UM") = row("UM")
|
DtR("UM") = row("UM")
|
||||||
|
DtR("SATClaveUM") = row("SATClaveUM")
|
||||||
DtR("CveClasificacion") = row("CveClasificacion")
|
DtR("CveClasificacion") = row("CveClasificacion")
|
||||||
DtR("Clasificacion") = row("Clasificacion")
|
DtR("Clasificacion") = row("Clasificacion")
|
||||||
DtR("CvePS") = row("CvePS")
|
DtR("CvePS") = row("CvePS")
|
||||||
DtR("PS") = row("PS")
|
DtR("PS") = row("PS")
|
||||||
DtR("CodigoPS") = row("CodigoPS")
|
DtR("CodigoPS") = row("CodigoPS")
|
||||||
DtR("Obs") = ""
|
|
||||||
DtR("PU") = row("PU")
|
|
||||||
DtR("Descuento") = 0
|
|
||||||
DtR("TipoDescuento") = 0
|
|
||||||
DtR("CveProyecto") = CveProyecto
|
|
||||||
DtR("Proyecto") = Proyecto
|
|
||||||
DtR("CveSubProyecto") = CveSubProyecto
|
|
||||||
DtR("SubProyecto") = SubProyecto
|
|
||||||
DtR("CveVentaDetalle") = 0
|
|
||||||
DtR("CveContratoDetalle") = row("CveContratoDetalle")
|
|
||||||
DtR("Observacion") = row("Observacion")
|
|
||||||
DtR("SATClaveUM") = row("SATClaveUM")
|
|
||||||
DtR("SATClaveProdServ") = row("SATClaveProdServ")
|
DtR("SATClaveProdServ") = row("SATClaveProdServ")
|
||||||
DtR("CuentaPredial") = row("CuentaPredial")
|
|
||||||
DtR("NoIdentificacion") = row("NoIdentificacion")
|
DtR("NoIdentificacion") = row("NoIdentificacion")
|
||||||
DtR("TotalImporte") = row("Total")
|
DtR("CveTipoPS") = DrPS("CveTipoPS")
|
||||||
|
DtR("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
||||||
|
DtR("Obs") = Etiqueta + " " + TxtObservaciones.Text + " " + row("Observacion").ToString
|
||||||
|
DtR("PU") = row("PU")
|
||||||
DtR("IVA") = row("PorcentajeIVA")
|
DtR("IVA") = row("PorcentajeIVA")
|
||||||
DtR("PorcentajeIVA") = row("PorcentajeIVA")
|
DtR("PorcentajeIVA") = row("PorcentajeIVA")
|
||||||
DtR("ImporteIVA") = row("ImporteIVA")
|
DtR("ImporteIVA") = row("ImporteIVA")
|
||||||
@@ -644,6 +566,17 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
DtR("ImporteRetIVA") = row("ImporteRetIVA")
|
DtR("ImporteRetIVA") = row("ImporteRetIVA")
|
||||||
DtR("PorcentajeRetISR") = row("PorcentajeRetISR")
|
DtR("PorcentajeRetISR") = row("PorcentajeRetISR")
|
||||||
DtR("ImporteRetISR") = row("ImporteRetISR")
|
DtR("ImporteRetISR") = row("ImporteRetISR")
|
||||||
|
DtR("Descuento") = 0
|
||||||
|
DtR("TipoDescuento") = 0
|
||||||
|
DtR("CveProyecto") = CveProyecto
|
||||||
|
DtR("Proyecto") = Proyecto
|
||||||
|
DtR("CveSubProyecto") = CveSubProyecto
|
||||||
|
DtR("SubProyecto") = SubProyecto
|
||||||
|
DtR("CveVentaDetalle") = 0
|
||||||
|
DtR("CveContratoDetalle") = row("CveContratoDetalle")
|
||||||
|
DtR("CuentaPredial") = row("CuentaPredial")
|
||||||
|
DtR("TotalImporte") = row("Total")
|
||||||
|
|
||||||
TmpDT.Rows.Add(DtR)
|
TmpDT.Rows.Add(DtR)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -954,6 +887,8 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
Multiplicador = (Row("Multiplicador").ToString.ToEntero)
|
Multiplicador = (Row("Multiplicador").ToString.ToEntero)
|
||||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "")
|
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "")
|
||||||
|
|
||||||
|
Dim PorcentajeImpuesto As Decimal = 0
|
||||||
|
|
||||||
Select Case ConceptoContable
|
Select Case ConceptoContable
|
||||||
Case 1 'Cliente
|
Case 1 'Cliente
|
||||||
If ObjFactura.TipoDocto <> "Egs" Then
|
If ObjFactura.TipoDocto <> "Egs" Then
|
||||||
@@ -1077,6 +1012,7 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
FechaMovimiento = ObjFactura.FechaPago
|
FechaMovimiento = ObjFactura.FechaPago
|
||||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar
|
||||||
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
|
||||||
|
PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIVA").ToDecimal
|
||||||
|
|
||||||
Case 38 'IEPS por Trasladar
|
Case 38 'IEPS por Trasladar
|
||||||
If Not ObjFactura.TipoDocto.Contiene("Rem") Then
|
If Not ObjFactura.TipoDocto.Contiene("Rem") Then
|
||||||
@@ -1090,6 +1026,7 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero
|
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIEPS").ToDecimal
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
@@ -1101,7 +1038,7 @@ Partial Class Contratos_FacturacionMasiva
|
|||||||
idCuentaContabilizacion = 0
|
idCuentaContabilizacion = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento)) Then
|
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), PorcentajeImpuesto:=PorcentajeImpuesto) Then
|
||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
Else
|
Else
|
||||||
ViewState("SeGuardoPrePoliza") = True
|
ViewState("SeGuardoPrePoliza") = True
|
||||||
|
|||||||
@@ -360,6 +360,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<%--ADVERTENCIA--%>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12" style="vertical-align: middle;" align="center">
|
||||||
|
<div style="z-index: 5; position: relative;">
|
||||||
|
<div id="DivTraspasoDevolucion" visible="false" clientidmode="Static" runat="server" class="alert alert-warning" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
|
||||||
|
<strong style="font-size: 20px; margin-right: 25px;">Información: </strong>
|
||||||
|
<asp:Literal Text="La mercancía sera trasladada desde el almacen seleccionado al almacén de devolución" ID="LtlTextoDevolucion" runat="server"></asp:Literal>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
@@ -418,7 +430,7 @@
|
|||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
<asp:GridView ID="GvInv" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True"
|
<asp:GridView ID="GvInv" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True"
|
||||||
DataKeyNames="EntregaDirecta,Consec,CodigoBarras,CvePS,CveUM,PU,CantidadC,CantidadF,UM,PS,CveCompraDetalle,CveOrdenCompraDetalle,PUExtranjero,AplicaSerieLote,CveClasificacion,Codigo,CveVentaDetalle,CostoIndirecto,CveTamaño,Lote,AplicaSeccion,AplicaLote,AplicaCaducidad,AplicaSerie,CveAlmacenDevolucionProveedor" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
DataKeyNames="EntregaDirecta,Consec,CodigoBarras,CvePS,CveUM,PU,CantidadC,CantidadF,UM,PS,CveCompraDetalle,CveOrdenCompraDetalle,PUExtranjero,AplicaSerieLote,CveClasificacion,Codigo,CveVentaDetalle,CostoIndirecto,CveTamaño,Lote,AplicaSeccion,AplicaLote,AplicaCaducidad,AplicaSerie" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||||
<HeaderStyle Height="58px" />
|
<HeaderStyle Height="58px" />
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField>
|
<asp:TemplateField>
|
||||||
@@ -1005,6 +1017,13 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('#DivTraspasoDevolucion')) {
|
||||||
|
$("#DivTraspasoDevolucion").pulsate("destroy");
|
||||||
|
jQuery('#DivTraspasoDevolucion').pulsate({
|
||||||
|
color: "#faebcc"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
ViewState("CveVendedor") = value
|
ViewState("CveVendedor") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
Private Property RealizarTraspasoAlmacenDevolucion() As Boolean
|
Private Property RealizarTraspasoAlmacenDevolucion As Boolean
|
||||||
Get
|
Get
|
||||||
Return If(IsNothing(ViewState("RealizarTraspasoAlmacenDevolucion")), False, CBool(ViewState("RealizarTraspasoAlmacenDevolucion")))
|
Return If(IsNothing(ViewState("RealizarTraspasoAlmacenDevolucion")), False, CBool(ViewState("RealizarTraspasoAlmacenDevolucion")))
|
||||||
End Get
|
End Get
|
||||||
@@ -926,11 +926,16 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
DtRecepcion = ObjInventario.DtResultados.Copy()
|
DtRecepcion = ObjInventario.DtResultados.Copy()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If TipoMovimiento = 2 AndAlso GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=21).Rows.Count > 0 Then
|
CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero
|
||||||
|
|
||||||
|
If TipoMovimiento = 2 AndAlso CveAlmacenDevolucionProveedor > 0 Then
|
||||||
RealizarTraspasoAlmacenDevolucion = True
|
RealizarTraspasoAlmacenDevolucion = True
|
||||||
CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero
|
|
||||||
'CreaDTAlmacenDevolucion()
|
DivTraspasoDevolucion.Visible = True
|
||||||
'CargaAlmacenes(-1, "21", CveTipoCompra)
|
LtlTextoDevolucion.Text = "La mercancía sera trasladada desde el almacen seleccionado al almacén de devolución"
|
||||||
|
ElseIf TipoMovimiento = 2 AndAlso GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=21).Rows.Count = 0 Then
|
||||||
|
LtlTextoDevolucion.Text = "La mercancía sera devuelta ha el almacen seleccionado."
|
||||||
|
DivTraspasoDevolucion.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
DtDatosDetalle = Nothing
|
DtDatosDetalle = Nothing
|
||||||
@@ -3262,7 +3267,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
Msg.AppendFormat("Movimiento de Salida: Folio: <b>{0}</b>", String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoSalidaTraspaso, FolioSalidaTraspaso))
|
Msg.AppendFormat("Movimiento de Salida: Folio: <b>{0}</b>", String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoSalidaTraspaso, FolioSalidaTraspaso))
|
||||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalidaTraspaso)))
|
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalidaTraspaso)))
|
||||||
|
|
||||||
Msg.AppendFormat("<br/>Movimiento de Entrada: Folio: <b>{0}</b>", link)
|
Msg.AppendFormat("<br/><br/>Movimiento de control: Folio: <b>{0}</b>", link)
|
||||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
|
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
|
||||||
{
|
{
|
||||||
Modelos.Factura.MCancelacionVentaMensaje retorno = null;
|
Modelos.Factura.MCancelacionVentaMensaje retorno = null;
|
||||||
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true);
|
||||||
if (EsRefacturacion)
|
if (EsRefacturacion)
|
||||||
{
|
{
|
||||||
retorno = factura.CancelarPorRefacturacion();
|
retorno = factura.CancelarPorRefacturacion();
|
||||||
|
|||||||
Reference in New Issue
Block a user