diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 5f783d5de..dfdc4803e 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1316,7 +1316,7 @@ Public Class ClsBancos Return Retorno End Function Public Function UpdateBancos_IE(FechaDocumento As DateTime, FechaAplicado As DateTime?, CveIE As Integer, Optional Folio As String = "-1", Optional CveCuentaDeposito As Integer = -1, Optional CveCuenta As Integer = -1, - Optional Observaciones As String = "-1") As Boolean + Optional Observaciones As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_IEUpdate") @@ -1335,9 +1335,9 @@ Public Class ClsBancos .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - - + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index f718db096..e83e9f36d 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -424,32 +424,6 @@ Partial Class Bancos_IE End Property - Private Property CuentaOld As String - Get - Return CType(ViewState("CuentaOld"), String) - End Get - Set(value As String) - ViewState("CuentaOld") = value - End Set - End Property - Private Property FechaOld As String - Get - Return CType(ViewState("FechaOld"), String) - End Get - Set(value As String) - ViewState("FechaOld") = value - End Set - End Property - - Private Property FolioOld As String - Get - Return CType(ViewState("FolioOld"), String) - End Get - Set(value As String) - ViewState("FolioOld") = value - End Set - End Property - #Region "CANCELACIÓN COMPLEMENTO MODAL V2" @@ -1120,13 +1094,9 @@ Partial Class Bancos_IE UpGuardar.Update() - End If - - ' DATOS PARA LA BITACORA - CuentaOld = LblCuenta.Text - FechaOld = TxtFechaDocumento.Text - FolioOld = TxtFolio.Text - + End If + + End If 'If CveIE > 0 Then @@ -3724,45 +3694,23 @@ Partial Class Bancos_IE Dim IE As New ClsBancos IE.IniciaTransacSQL() - Dim ObjGral As New ClsGenerales - ObjGral.IniciaTransacSQL() Dim FechaAplicado As DateTime? = Nothing Dim OcurrioError As Boolean = False Dim CveCuentaDepositoUpdate As Integer = If(DdlCuentaDeposito.SelectedValue.ToEntero.ToEntero = 0, -1, DdlCuentaDeposito.SelectedValue.ToEntero.ToEntero) - If IE.UpdateBancos_IE(TxtFechaDocumento.Text.ToDate, FechaAplicado, CveIE, TxtFolio.Text, CveCuentaDeposito:=CveCuentaDepositoUpdate, CveCuenta:=DdlCuenta.SelectedValue.ToEntero, - Observaciones:=TxtObservaciones.Text) Then - 'Agrega a la Bitacora - If CuentaOld <> DdlCuenta.SelectedItem.Text Then - If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, CveIE, DdlCuenta.SelectedItem.Text, CuentaOld, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "Cuenta", "Banco", TxtFolio.Text + " / " + Cuenta) Then - OcurrioError = True - End If - End If - If FechaOld <> TxtFechaDocumento.Text.Trim Then - If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, CveIE, TxtFechaDocumento.Text.Trim, FechaOld, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "Fecha", "Banco", TxtFolio.Text + " / " + Cuenta) Then - OcurrioError = True - End If - End If - If FolioOld <> TxtFolio.Text.Trim Then - If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, CveIE, TxtFolio.Text.Trim, FolioOld, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "Número", "Banco", TxtFolio.Text + " / " + Cuenta) Then - OcurrioError = True - End If - End If - Else + If Not IE.UpdateBancos_IE(TxtFechaDocumento.Text.ToDate, FechaAplicado, CveIE, TxtFolio.Text, CveCuentaDeposito:=CveCuentaDepositoUpdate, CveCuenta:=DdlCuenta.SelectedValue.ToEntero, + Observaciones:=TxtObservaciones.Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then OcurrioError = True End If If OcurrioError Then IE.RollBack() - ObjGral.RollBack() Else IE.Commit() - ObjGral.Commit() Alert("La Actualización del documento se realizó correctamente", TipoMensaje.MsgInformacion, $"document.location.href=""IE.aspx?CveIE={CveIE}""") End If IE.Dispose() - ObjGral.Dispose() End Sub Protected Sub ImgUpdateCuentaDeposito_Click(sender As Object, e As ImageClickEventArgs) @@ -4356,6 +4304,12 @@ Partial Class Bancos_IE End If End If + If Not ErrorCompra Then + If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + ErrorCompra = True + End If + End If + If Not ErrorCompra Then Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion) ObjAC.Commit() @@ -4712,8 +4666,8 @@ Partial Class Bancos_IE ObjGral.Dispose() If Borrar = True Then Dim ObjAC As ClsContPAQi = Nothing - Dim Banc As New ClsBancos - Banc.IniciaTransacSQL() + Dim Banc As New ClsBancos + Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) Dim ErrorCompra = False @@ -4732,6 +4686,13 @@ Partial Class Bancos_IE End If End If + If Not ErrorCompra Then + If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + ErrorCompra = True + End If + End If + + If Not ErrorCompra Then If Not Banc.EliminarBancos_IE(UsuarioActual.CveUsuario, CveIE) Then ErrorCompra = True @@ -4750,6 +4711,7 @@ Partial Class Bancos_IE If ObjAC IsNot Nothing Then ObjAC.Dispose() Banc.Dispose() + ObjConta.Dispose() End If Else Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index cc75184c1..fea2e0d27 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7760,6 +7760,7 @@ Partial Class Compras_Compras Dim ObjAC As ClsContPAQi = Nothing Dim Comp As New ClsCompras() Dim ObjEventos As New ClsOIEventos(Comp.IniciaTransacSQL()) + Dim ObjConta As New ClsContabilidad(Comp.IniciaTransacSQL()) Dim ErrorCompra = False @@ -7781,6 +7782,12 @@ Partial Class Compras_Compras Next End If + If Not ErrorCompra Then + If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + ErrorCompra = True + End If + End If + If Not ErrorCompra Then If Not Comp.DeleteCompra(CveCompra, False) Then ErrorCompra = True @@ -7799,6 +7806,7 @@ Partial Class Compras_Compras If ObjAC IsNot Nothing Then ObjAC.Dispose() Comp.Dispose() + ObjConta.Dispose() End Sub Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click @@ -12857,6 +12865,12 @@ Partial Class Compras_Compras End If End If + If Not ErrorCompra Then + If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + ErrorCompra = True + End If + End If + If Not ErrorCompra Then Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion) ObjAC.Commit() diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index 1eaef6527..e283fc11f 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -247,6 +247,12 @@ Partial Class PopUpAuxiliar Dim TieneError = False + If Not TieneError Then + If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then + TieneError = True + End If + End If + If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then TieneError = True End If @@ -266,6 +272,7 @@ Partial Class PopUpAuxiliar If Not ObjContPaq.RemovePoliza(IdPoliza) Then TieneError = True End If + End If End If End If diff --git a/Empresas/137/Formatos/RepClientesCxC.rpt b/Empresas/137/Formatos/RepClientesCxC.rpt new file mode 100644 index 000000000..132388990 Binary files /dev/null and b/Empresas/137/Formatos/RepClientesCxC.rpt differ diff --git a/Empresas/143/Formatos/Remision.rdlc b/Empresas/143/Formatos/Remision.rdlc new file mode 100644 index 000000000..0d407b6b9 --- /dev/null +++ b/Empresas/143/Formatos/Remision.rdlc @@ -0,0 +1,5555 @@ + + + + + + true + + + + + Tipo + + + + + + + Textbox3 + 0.90692in + 5.85473in + 0.5cm + 2.24597in + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + Fecha y hora de emisión + + + + + + + + + + + + + + + + Textbox3 + 0.46414in + 5.85473in + 0.5cm + 2.24597in + 1 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =IIF(Parameters!Serie.Value.ToString="",Parameters!Folio.Value,Parameters!Serie.Value & "-" &Parameters!Folio.Value) + + + + + + + Textbox3 + 0.22455in + 5.85473in + 0.60856cm + 2.24597in + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!TipoDocumento.Value + + + + + + + Textbox3 + 0.07295cm + 5.85473in + 0.5cm + 2.24597in + 3 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + SERVICIOS GASTRONOMICOS DE HERMOSILLO SA DE CV + + + + + + + + + R.F.C SGH1602157P0 + + + + + + + Textbox4 + 1.06055in + 0.51102in + 4.75251in + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox3 + 0.66099in + 5.85473in + 0.25114in + 2.24597in + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!Tipo.Value & Parameters!Ref.Value + + + + + + + Textbox3 + 1.10364in + 5.85473in + 0.25635in + 2.24597in + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + Domicilio Fiscal + + + + + + + + + CALLE LA BILBAINA 60, + + + + + + + + + LA RIOJA RESIDENCIAL, HERMOSILLO, SONORA + + + + + + + Textbox10 + 0.51102in + 1.80776in + 0.65513in + 2.01842in + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + Lugar de Expedición + + + + + + + + + =Parameters!DomicilioSucursal.Value + + + + + + + Textbox10 + 0.52491in + 3.82618in + 0.65513in + 1.98688in + 8 + + + Top + + + + true + true + + + + + Nombre + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!ClienteCodigo.Value + " - " + Parameters!ClienteNombre.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Dirección + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!ClienteDireccion.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Ciudad + + + + + + + + 1.25pt + + 2pt + 2pt + 2pt + 2pt + + + + true + + + + + =Parameters!ClienteLugar.Value + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 1.75416cm + + + 1.66039cm + + + 2.05295cm + + + 1.89126cm + + + 8.33453cm + + + 1.78174cm + + + 2.47543cm + + + + + 0.52063cm + + + + + true + + + + + Cantidad + + + + + + + Textbox34 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + Unidad + + + + + + + Textbox53 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SAT UM + + + + + + + Textbox1 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SAT PS + + + + + + + Textbox8 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Descripción + + + + + + + Textbox15 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + P. Unitario + + + + + + + Textbox84 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + Importe + + + + + + + + + + + + + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.57355cm + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad1 + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!UM.Value + + + + + + + UM1 + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SATClaveUM.Value + + + + + + + SATClaveUM + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SATClaveProdServ.Value + + + + + + + SATClaveProdServ + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PS.Value & " " & Fields!Obs.Value + + + + + + + UnidadMedida + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PU.Value + + + + + + + PU1 + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Cantidad.Value*Fields!PU.Value + + + + + + + Textbox88 + + + + + + + + + 2pt + 2pt + 2pt + 2pt + es-MX + + + + + + + + 0.20313cm + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + After + + + + + =Fields!PS.Value Is Nothing + + + + Before + + + + DsOC + 4.5569cm + 0.2872cm + 1.29731cm + 19.95046cm + 15 + + + + + + true + + + + + RFC: + + + + =Parameters!ClienteRFC.Value + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + External + =Parameters!QR.Value + FitProportional + 0.03297in + 1.3497in + 1.5531in + + + + + + true + true + + + + + Folio Fiscal: + + + + + + + Textbox54 + 0.00077in + 1.63683in + 0.18056in + 4.03672in + 1 + + + + + + + White + + + + + + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + No. Serie del Certificado del SAT: + + + + + + + Textbox54 + 0.19522in + 1.63683in + 0.18056in + 4.03672in + 2 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora de certificación: + + + + + + + Textbox54 + 0.39377in + 1.63683in + 0.19444in + 4.03672in + 3 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Certificado del Contribuyente: + + + + + + + Textbox54 + 0.59938in + 1.63683in + 0.19445in + 4.03672in + 4 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FolioFiscal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaCertificacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CertificadoContribuyente.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Regímen: Regímen General de Ley Personas Morales; Condiciones de pago: + + + + =IIF(Parameters!CondicionPago.Value.ToString="","No Identificado",Parameters!CondicionPago.Value) + + + + ; Método de Pago: + + + + =IIF(Parameters!MetodoPago.Value.ToString="","No Identificado",Parameters!MetodoPago.Value) + + + + ; Num. Cta Pago: + + + + =IIF(Parameters!NumCta.Value="0" Orelse Parameters!NumCta.Value="","No Identificado",Parameters!NumCta.Value) + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Éste documento es una representacion impresa de un CFDi + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + true + true + + + + + P A G A R E con Folio + + + + =Parameters!Serie.Value + + + + - + + + + =Parameters!Folio.Value + + + + Por éste pagare prometo (emos) pagar incondicionalmente a la orden de + + + + SERVICIOS GASTRONOMICOS DE HERMOSILLO SA DE CV + + + + , a su vencimiento el + + + + =Parameters!Vencimiento.Value + + + + , en Hermosillo, Sonora o en el domicilio señalado a elección del acreedor o tenedor la cantidad de $ + + + + =Parameters!Total.Value + + + + SON: ( + + + + =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + ). Valor recibido a mi (nuestra) entera satisfacción. la falta de pago de éste documento a su vencimiento dará derecho a + + + + SERVICIOS GASTRONOMICOS DE HERMOSILLO SA DE CV + + + + o tenedor, desde el día siguiente a cobrar el 10% mensual de interes moratorios hasta su total liquidación y los gastos judiciales que se ocasionen. Lugar y Fecha de Suscripción: Hermosillo, Sonora a + + + + =CDATE(Parameters!Fecha.Value).ToString("dd/MM/yyyy") + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Dirección: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteDireccion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Acepto de conformidad + + + + + + 2pt + 2pt + 2pt + 2pt + + + + 0.08375cm + 0cm + 0.57653cm + 6 + + + + + + 0.71971cm + 0cm + 0.57653cm + 7 + + + + + + 1.35545cm + 0cm + 0.57653cm + 8 + + + + + + 1.66152cm + 0cm + 0.57653cm + 9 + + + + + + 2.29748cm + 0cm + 0.57653cm + 10 + + + + + + 2.93322cm + 0cm + 0.57653cm + 11 + + + + + + 3.60266cm + 0cm + 0.57653cm + 12 + + + + + + 4.23862cm + 0cm + 0.57653cm + 13 + + + + + + 4.87436cm + 0cm + 0.57653cm + 14 + + + + + + 5.18043cm + 0cm + 0.57653cm + 15 + + + + + + 5.81639cm + 0cm + 0.57653cm + 16 + + + + + + 6.45213cm + 0cm + 0.57653cm + 17 + + + + + + 7.13239cm + 0cm + 0.57653cm + 18 + + + + + + 7.76835cm + 0cm + 0.57653cm + 19 + + + + + + 8.40409cm + 0cm + 0.57653cm + 20 + + + + + + 8.71016cm + 0cm + 0.57653cm + 21 + + + + + + 9.34612cm + 0cm + 0.57653cm + 22 + + + + + + 9.98186cm + 0cm + 0.57653cm + 23 + + + + + + 14.06281cm + 0cm + 0.57653cm + 24 + + + + + + 14.69877cm + 0cm + 0.57653cm + 25 + + + + + + 15.33451cm + 0cm + 0.57653cm + 26 + + + + + + 15.64058cm + 0cm + 0.57653cm + 27 + + + + + + 16.27654cm + 0cm + 0.57653cm + 28 + + + + + + 16.91228cm + 0cm + 0.57653cm + 29 + + + + + + 10.60588cm + 0cm + 0.57653cm + 30 + + + + + + 11.24184cm + 0cm + 0.57653cm + 31 + + + + + + 11.87758cm + 0cm + 0.57653cm + 32 + + + + + + 12.18365cm + 0cm + 0.57653cm + 33 + + + + + + 12.81961cm + 0cm + 0.57653cm + 34 + + + + + + 13.45535cm + 0cm + 0.57653cm + 35 + + + + + + 18.40663cm + 0cm + 0.57653cm + 36 + + + + + + 19.04259cm + 0cm + 0.57653cm + 37 + + + + + + 17.74353cm + 0cm + 0.57653cm + 38 + + + + + + 3.41069cm + 15.04347cm + 0cm + 4.87315cm + 39 + + + + + + true + 3.64746cm + 3.92471cm + 20.0948cm + 11 + + = (Parameters!AplicaPagare.Value="0" OrElse Parameters!AplicaPagare.Value="") + + + + + + + true + 12.24321cm + 0.13086cm + 7.57217cm + 20.1133cm + 17 + + + + + + + + true + true + + + + + CFDI Relacionados + + + + + + + Textbox5 + 0.30801cm + 0.54004cm + 20.1133cm + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo Relación: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoRelacionTexto.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Folio Fiscal: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FolioFiscalRelacionado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + 19.92121cm + 0.13086cm + 1.82156cm + 20.1133cm + 18 + + =Microsoft.VisualBasic.Interaction.iif(Parameters!TipoRelacionTexto.Value <> "" Or Parameters!FolioFiscalRelacionado.Value <> "", False, True) + + + + + + + + + + 3.34839cm + + + 10.97948cm + + + + + 0.6cm + + + + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + + Textbox128 + + + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + 0.6cm + + + + + true + true + + + + + Importe con letra: + + + + + + + Textbox126 + + + + + 1pt + + + + 1pt + + + + 1pt + + + + 1pt + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + ="SON: " & Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + + + + Textbox127 + + + + + 1pt + + + + 1pt + + + + 1pt + + + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + Forma de pago: + + + + + + + Textbox130 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!FormaPago.Value + + + + + + + Textbox131 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + Uso CFDI: + + + + + + + Textbox14 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!UsoCFDI.Value + + + + + + + Textbox15 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.96667cm + + + + + true + true + + + + + Sello digital del CFDI: + + + + + + + Textbox132 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!SelloCFDI.Value + + + + + + + Textbox133 + + + Top + 2pt + 2pt + 2pt + 2pt + + + + + + + + 1.09898cm + + + + + true + true + + + + + Sello del SAT: + + + + + + + Textbox134 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Parameters!SelloSAT.Value + + + + + + + Textbox135 + + + Top + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + Cadena original del complemento de certificación digital del SAT: + + + + + + + Textbox136 + + + LightGrey + Middle + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + 1.11168cm + + + + + true + true + + + + + =Parameters!CadenaOriginal.Value + + + + + + + Textbox138 + + + Top + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + DsOC + 5.96004cm + 0.21461cm + 6.17733cm + 14.32787cm + 19 + + + + + + + + + 0.82345in + + + 0.70198in + + + 0.70575in + + + + + 0.19645in + + + + + true + true + + + + + Impuesto + + + + + + + Textbox22 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tasa + + + + + + + Textbox15 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox29 + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.14436in + + + + + true + true + + + + + =Fields!Impuesto.Value + + + + + + + Cantidad1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!tasa.Value + + + + + + + UM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Codigo + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSet3 + 2.65269in + 5.87207in + 0.34081in + 2.23118in + 20 + + + + + + + + + 3.12155cm + + + + + 0.6cm + + + + + true + true + + + + + =Sum(Fields!Importe.Value) + + + + + + + Importe + + + 2pt + 2pt + 2pt + 2pt + es-MX + + + + + + + + + + + + + + + + + + + =Fields!ImpuestoLocal.Value + + + + 2.50276cm + + + true + true + + + + + =Fields!ImpuestoLocal.Value + + + + + + LightGrey + 2pt + 2pt + 2pt + 2pt + + + + + + + + DataSet1 + 5.99532cm + 14.91885cm + 0.6cm + 5.62431cm + 21 + + + + + + 21.83098cm + + LightGrey 2pt 2pt 2pt @@ -47,19 +48,19 @@ - 2.71123cm + 2.36727cm - 2.71123cm + 2.63186cm - 2.71123cm + 2.55248cm - 2.71123cm + 2.12915cm - 2.71123cm + 2.49956cm @@ -77,13 +78,15 @@ =Fields!Cantidad.Value @@ -92,6 +95,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -111,12 +115,16 @@ =Fields!SubTotal.Value - SubTotal @@ -124,6 +132,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -143,12 +152,16 @@ =Fields!Descuento.Value - Descuento @@ -156,6 +169,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -175,12 +189,16 @@ =Fields!IVA.Value - IVA @@ -188,6 +206,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -207,12 +226,16 @@ =Fields!Total.Value - Total @@ -220,6 +243,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -260,6 +284,7 @@ DimGray + LightGrey 2pt 2pt 2pt @@ -295,6 +320,7 @@ DimGray + LightGrey 2pt 2pt 2pt @@ -330,6 +356,7 @@ DimGray + LightGrey 2pt 2pt 2pt @@ -365,6 +392,7 @@ DimGray + LightGrey 2pt 2pt 2pt @@ -400,6 +428,7 @@ DimGray + LightGrey 2pt 2pt 2pt @@ -419,13 +448,8 @@ =Fields!GPO.Value - - - =Fields!GPO.Value - - - 5.42245cm + 6.79828cm true @@ -436,7 +460,9 @@ =Fields!GPO.Value @@ -448,6 +474,7 @@ + =IIF(Fields!Orden.Value = "","CornflowerBlue","Transparent") 2pt 2pt 2pt @@ -893,6 +920,10 @@ Total System.Double + + Orden + System.String + DataSet diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index bdaa04205..8997c6309 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1525,11 +1525,13 @@ Partial Class General_SaldosIniciales ObjMovimientos.IniciaTransacSQL() Dim OcurrioError As Boolean = False Dim contadorMovimientos As Integer = 0 + Dim listadoMovimientos As String = "" Try For Each almacenSinRepetir As DataRow In dt.FiltraParametros("", DistinctColumns:={"Almacen"}).Rows Dim almacenActual As String = almacenSinRepetir("Almacen").ToString Dim CveAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero Dim movimientoCabecera As Integer = ObjMovimientos.AddMovimiento(CveAlmacen, 1, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) + listadoMovimientos += $"movimiento con folio {ObjMovimientos.Folio}
" If CveAlmacen > 0 Then contadorMovimientos += 1 For Each nuevaEntrada As DataRow In dt.FiltraParametros($"Almacen = '{almacenActual}'").Rows @@ -1565,7 +1567,7 @@ Partial Class General_SaldosIniciales If Not OcurrioError Then ObjMovimientos.Commit() - Alert($"Se cargaron correctamente {contadorMovimientos} movimientos") + Alert($"Se cargaron correctamente {contadorMovimientos} movimientos

{listadoMovimientos}") Else Alert("Ocurrió un error al cargar las existencias", TipoMensaje.MsgError) ObjMovimientos.RollBack() diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 5219336c1..cb508eee9 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -244,6 +244,14 @@ Partial Class Inventarios_EntradasSalidas ViewState("Tipo") = value End Set End Property + Private Property CvePrePoliza As Integer + Get + Return CType(ViewState("CvePrePoliza"), Integer) + End Get + Set(value As Integer) + ViewState("CvePrePoliza") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -256,6 +264,7 @@ Partial Class Inventarios_EntradasSalidas EstatusAlmacenCompra = -1 EsConsumoInterno = False EsNuevoMov = False + CvePrePoliza = -1 CreaDT() CargaCombos() @@ -579,6 +588,7 @@ Partial Class Inventarios_EntradasSalidas If DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero > 0 Then HplPrePoliza.Visible = True HplPrePoliza.NavigateUrl = String.Format("/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}", DtMov.Rows(0)("CvePrePoliza")) + CvePrePoliza = DtMov.Rows(0)("CvePrePoliza").ToString.ToEntero Else If UsuarioActual.CveRol = 1 Then BtnGeneraPrepoliza.Visible = True @@ -1035,14 +1045,10 @@ Partial Class Inventarios_EntradasSalidas Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles BtnRemove.Click Dim Borrar As Boolean = False If Not TxtDescripcion.Text = "" Then - Dim ObjGral As New ClsGenerales - ObjGral.IniciaTransacSQL() - If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Inventarios", TxtFolio.Text + " / " + DdlConcepto.SelectedItem.Text) Then - Borrar = True - End If Dim Inv As New ClsInventarios - Inv.IniciaTransacSQL() + Dim Conta As New ClsContabilidad(Inv.IniciaTransacSQL()) + Dim ObjGral As New ClsGenerales(Inv.IniciaTransacSQL()) Dim TieneError = False @@ -1052,6 +1058,9 @@ Partial Class Inventarios_EntradasSalidas ObjConta.IniciaTransacSQL() End If + If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Inventarios", TxtFolio.Text + " / " + DdlConcepto.SelectedItem.Text) Then + TieneError = True + End If If Inv.MovimientoRemove(CveMovimiento, UsuarioActual.CveEmpresa) Then If HdnIdPoliza.Value.ToEntero > 0 Then @@ -1063,10 +1072,15 @@ Partial Class Inventarios_EntradasSalidas TieneError = True End If + If Not TieneError Then + If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + TieneError = True + End If + End If + If Not TieneError Then If ObjConta IsNot Nothing Then ObjConta.Commit() Inv.Commit() - ObjGral.Commit() Alert("Movimientos Eliminado", TipoMensaje.MsgInformacion) RegistraScript(String.Format("$('#{0}').modal('hide');", "divDescripcion")) @@ -1074,7 +1088,6 @@ Partial Class Inventarios_EntradasSalidas Else If ObjConta IsNot Nothing Then ObjConta.RollBack() Inv.RollBack() - ObjGral.RollBack() Alert("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.", TipoMensaje.MsgError) End If @@ -1083,6 +1096,7 @@ Partial Class Inventarios_EntradasSalidas If ObjConta IsNot Nothing Then ObjConta.Dispose() Inv.Dispose() ObjGral.Dispose() + Conta.Dispose() End If End Sub #End Region diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 01d4b6852..76700abb6 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -633,7 +633,7 @@ Partial Class Inventarios_RecepcionUsados Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click Dim Inv As New ClsInventarios - Inv.IniciaTransacSQL() + Dim Conta As New ClsContabilidad(Inv.IniciaTransacSQL()) Dim TieneError = False @@ -654,6 +654,12 @@ Partial Class Inventarios_RecepcionUsados TieneError = True End If + 'If Not TieneError Then + ' If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + ' TieneError = True + ' End If + 'End If + If Not TieneError Then If ObjConta IsNot Nothing Then ObjConta.Commit() Inv.Commit() @@ -670,6 +676,7 @@ Partial Class Inventarios_RecepcionUsados If ObjConta IsNot Nothing Then ObjConta.Dispose() Inv.Dispose() + Conta.Dispose() End Sub #End Region diff --git a/Ventas/RepProductosServicios.aspx.vb b/Ventas/RepProductosServicios.aspx.vb index b9125ff52..648d3cfdf 100644 --- a/Ventas/RepProductosServicios.aspx.vb +++ b/Ventas/RepProductosServicios.aspx.vb @@ -476,8 +476,8 @@ Partial Class Ventas_RepProductosServicios Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("FechaInicio", FechaI.ToShortDateString)) - params.Add(New ReportParameter("FechaFin", FechaF.ToShortDateString)) + params.Add(New ReportParameter("FechaInicio", If(txtFechaI.Text <> "", FechaI.ToShortDateString, ""))) + params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, ""))) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index ac1669fe6..f4a9a4008 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13863,778 +13863,784 @@ Partial Class Ventas #End Region #End Region -#Region "M E T O D O S" - Private Sub CargaOtrosConceptos() - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then - GVOtrosConceptos.DataSource = ObjVentas.DtResultados - GVOtrosConceptos.DataBind() - UpOtrosConceptos.Update() - End If - ObjVentas.Dispose() - End Sub - Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer - Dim Retorno As Integer = 0 - Dim IDPoliza As Integer = 0 - - Dim ErrorAC As Boolean = False - 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - Dim Fecha As Date = factura.Fecha - Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre) - Dim Paridad As Integer = 1 - Dim TipoMovto As Boolean = False - - If CancelacionIngreso Then - Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre) - Paridad = -1 - TipoMovto = True - End If - - Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1) - - IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha) - Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue)) - 'Dim Importe As Double = TxtTotal.Text.ToDouble - Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes - Dim CtaISSSTESON As Integer = 643 - Dim CtaISPT As Integer = 1745 - ' Dim NombreCliente As String = ViewState("NombreCliente").ToString - - If IDPoliza > 0 Then - - 'Orden de PAGO - If factura.TipoDocto = "OP" Then - - If DdlOrdenPago.SelectedValue.ToEntero = 1 Then - 'ISSSTESON - - If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - - Else - 'ISPT - - If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - End If - - ' NORMAL - Else - Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() - Group gvr By Grp = New With { - Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero - } Into Group - Select Grp.CvePresupuestoIngreso, - TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) - - - 'Select Case TipoComprobante - ' Case "Ing", "Egs" - For Each grp In Detalles - dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) - Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) - - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - 'CARGO la deuda del cliente - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - 'abono, - If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Next - - 'Case "OP", "Com" - ' Dim Importe As Decimal = 0 - ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then - ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then - - ' End If - ' End If - 'End Select - End If - - Else - ErrorAC = True - - End If - - If Not ErrorAC Then - ObjAC.AjustaPoliza(IDPoliza) - - Retorno = IDPoliza - Else - - Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError) - End If - - ' ObjAC.Dispose() - - Return Retorno - - End Function - Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer - Dim Retorno As Integer = 0 - Dim IDPoliza As Integer = 0 - - Dim ErrorAC As Boolean = False - 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() - Dim Fecha As Date = TxtFecha.Text.ToDate - Dim Concepto As String = String.Format("GD {0}", NombreCliente) - Dim Paridad As Integer = 1 - Dim TipoMovto As Boolean = False - - If CancelacionIngreso Then - Concepto = String.Format("Cancelación GD {0}", NombreCliente) - Paridad = -1 - TipoMovto = True - End If - - Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1) - - IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha) - Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue)) - 'Dim Importe As Double = TxtTotal.Text.ToDouble - Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero - Dim CtaISSSTESON As Integer = 643 - Dim CtaISPT As Integer = 1745 - ' Dim NombreCliente As String = ViewState("NombreCliente").ToString - - If IDPoliza > 0 Then - - 'Orden de PAGO - If DdlTipoComprobante.SelectedValue.ToString = "OP" Then - - If DdlOrdenPago.SelectedValue.ToEntero = 1 Then - 'ISSSTESON - - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - - Else - 'ISPT - - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then - If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - End If - - ' NORMAL - Else - Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() - Group gvr By Grp = New With { - Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero - } Into Group - Select Grp.CvePresupuestoIngreso, - TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) - - - 'Select Case TipoComprobante - ' Case "Ing", "Egs" - For Each grp In Detalles - dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) - Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) - - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - 'CARGO la deuda del cliente - If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - 'abono, - If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Else - ErrorAC = True - End If - Next - - 'Case "OP", "Com" - ' Dim Importe As Decimal = 0 - ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then - ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then - - ' End If - ' End If - 'End Select - End If - - Else - ErrorAC = True - - End If - - If Not ErrorAC Then - ObjAC.AjustaPoliza(IDPoliza) - - Retorno = IDPoliza - Else - - Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError) - End If - - ' ObjAC.Dispose() - - Return Retorno - - End Function - Private Sub SetValues() - ViewState("TipoCambio") = 1 - - If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "") - If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "") - - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto - TxtPS.Enabled = False - DivDdlTipo.Visible = True - DivTxtModelo.Visible = True - DivTxtAdicional.Visible = True - DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();") - DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();") - TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();") - TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();") - - CargaClasificacionesDetalles() - ClasificacionModal() - - End If - - If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM - RBLPago.Items.RemoveAt(2) - End If - - - End Sub - Private Sub SetPermisos() - If CveVenta < 1 Then - 'Puede cotizar - If Not UsuarioActual.TienePermisoProceso(59) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot")) - End If - - 'Puede Hacer NC - If Not UsuarioActual.TienePermisoProceso(175) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) - End If - - 'Puede Hacer Devolución - If Not UsuarioActual.TienePermisoProceso(264) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) - End If - - 'Puede facturar - If Not UsuarioActual.TienePermisoProceso(60) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) - End If - - 'Puede remisionar - If Not UsuarioActual.TienePermisoProceso(199) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - LnkFacturarRemision.Visible = False - LnkRemisiones.Visible = False - End If - - '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS - ''Puede remisionar - 'If Not UsuarioActual.TienePermisoProceso(199) Then - ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - 'End If - - ''MODO SOLO LECTURA - 'If DdlTipoComprobante.Items.Count = 0 Then - ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1")) - ' TrBotones.Visible = False - 'End If - - ConfiguraTipoDocto() - End If - End Sub - Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True) - - Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal - Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal - Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal - Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal - Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal - Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal - Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal - Dim Total As Decimal = 0 - Dim TotalImpuestosLocales As Decimal = 0 - - If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos - If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then - For Each dr As DataRow In TmpDT.Rows - dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0 - Next - - If TmpDTImpuestos IsNot Nothing Then - For Each dr2 As DataRow In TmpDTImpuestos.Rows - dr2("Importe") = 0 - Next - TmpDTImpuestos.AcceptChanges() - End If - - TmpDT.AcceptChanges() - TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal - TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal - TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal - TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal - TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal - End If - End If - - If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then - If TotalSubTotal <> TotalAmortizacion Then - For Each drt As DataRow In TmpDTImpuestos.Rows - drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100 - Next - End If - - GvImpuestosLocales2.DataSource = TmpDTImpuestos - GvImpuestosLocales2.DataBind() - End If - - For Each gvr As GridViewRow In GvImpuestosLocales2.Rows - If gvr.RowType = DataControlRowType.DataRow Then - - If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then - If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local - TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal - Else - TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal - End If - End If - End If - Next - - 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False - If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False - If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False - If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False - - If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then - TotalAmortizacion = 0 - End If - - - Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales) - LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2) - TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2) - LblDescuentos.Text = TotalDescuentos.FormatoNumero - TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2) - TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2) - TxtRetISR.Text = TotalRetISR.FormatoNumero(2) - TxtIVA.Text = TotalIVA.FormatoNumero - TxtIEPS.Text = TotalIEPS.FormatoNumero - TxtTotal.Text = Total.FormatoNumero - - LblAmort.Text = TxtSubTotal.Text - If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then - HdnVentaSaldo.Value = Total.ToString - Else - HdnVentaSaldo.Value = SaldoVenta.ToString - End If - HdnIVAOriginal.Value = TxtIVA.Text - - 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - CVImporteContado.ValueToCompare = Total.ToString - - If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then - Alert($"Los siguientes conceptos hace falta especificar clave SAT

{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia) - MensajeCveSAT.Clear() - End If - - Dim view As DataView = New DataView(TmpDT) - view.Sort = "Consec" - GvPS.DataSource = view - GvPS.DataBind() - - 'RECARGA GV INVENTARIO - If Not CveVenta > 0 Then - DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") - CargaGVInv(DtInv) - End If - - UpContado.Update() - UpPS.Update() - RegistraScript("BorraDescuentos();", "BorraDescuentos") - End Sub - Private Function ValidaAdendaFEMSA() As Boolean - Dim Retorno As Boolean = False - - If Not AplicaFEMSA Then - Retorno = True - Else - If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then - Retorno = False - Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then - Retorno = False - Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) - ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then - Retorno = False - Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) - ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then - Retorno = False - Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then - Retorno = False - Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then - Retorno = False - Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) - ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then - Retorno = False - Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) - Else - Retorno = True - End If - End If - - Return Retorno - End Function - Private Function ValidaComplementoDetallista() As Boolean - Dim Retorno As Boolean = False - - If Not AplicaDetallista Then - Retorno = True - Else - If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then - Retorno = False - Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "") - ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then - Retorno = False - Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then - Retorno = False - Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then - Retorno = False - Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia) - ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then - Retorno = False - Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) - ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then - Retorno = False - Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) - Else - Retorno = True - End If - End If - - Return Retorno - End Function - Private Function ValidaComplementoFord() As Boolean - Dim Retorno As Boolean = False - - If Not AplicaFord Then - Retorno = True - Else - If TxtFordGSDB.Text.Trim.Length = 0 Then - Retorno = False - Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia) - Else - If LstFordASN.Items.Count = 0 Then - Retorno = True - 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia) - Else - Retorno = True - End If - - End If - End If - - Return Retorno - End Function - Private Sub VinculaCotizacionVenta() - Dim ObjVentas As New ClsVentas() - ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero) - ObjVentas.Dispose() - End Sub - Private Sub GeneraAddenda7Eleven(Archivo As String) - Dim cfdi As String = "" - Dim SB As New StringBuilder - Try - Using sr As New StreamReader(Archivo) - - cfdi = sr.ReadToEnd() - - End Using - Catch e As Exception - Alert("The file could not be read:", TipoMensaje.MsgError) - - End Try - - - cfdi = cfdi.Replace("", "") - - SB.Append(cfdi) - - SB.Append("") - SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim) - SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd")) - - For Each Row As DataRow In TmpDT.Rows - - SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero()) - - Next - - SB.Append("") - - - Using outfile As New StreamWriter(Archivo) - outfile.Write(SB.ToString()) - End Using - - 'Exit Sub - - - - 'Dim MyXmlDocument As New XmlDocument() - - 'MyXmlDocument.Load("C:/Temp/aaa.xml") - 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable) - 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3") - 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas") - 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") - 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd") - - 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "") - 'Prov.SetAttribute("Clave", "3125") - - 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi") - 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones") - 'Recepciones.Prefix = "cfdi" - 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion") - 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim) - 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim) - 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM")) - - 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos") - ''dentro de un ciclo - 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto") - 'Producto.SetAttribute("codigo", "cod1") - 'Producto.SetAttribute("descripcion", "prod1") - 'Producto.SetAttribute("cantidad", "99") - 'Producto.SetAttribute("precio", "2000") - 'Productos.AppendChild(Producto) - ''fin de ciclo - - 'Recepcion.AppendChild(Productos) - - 'Recepciones.AppendChild(Recepcion) - - 'ParentElement.AppendChild(Prov) - - 'ParentElement.AppendChild(Recepciones) - - - 'MyXmlDocument.DocumentElement.AppendChild(ParentElement) - 'MyXmlDocument.Save("C:/Temp/aa.xml") - - End Sub - Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged - For Each dr As DataRow In TmpDT.Rows - dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue - Next - - GvPS.DataSource = TmpDT - GvPS.DataBind() - - UpPS.Update() - End Sub - Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs) - Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList) - Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero - - If UsuarioActual.Empresa.UsaAC Then - TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue - End If - TmpDT.AcceptChanges() - End Sub - Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click - If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub - LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim)) - TxtFordASN.Text = "" - TxtFordASN.Focus() - End Sub - Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click - LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex) - - End Sub - Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click - GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False) - End Sub - Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged - - Dim ObjClientes As New ClsClientes() - - Dim Nombre As String = "-1" - Dim Codigo As String = "-1" - Dim NombreCorto As String = "-1" - Dim RFC As String = "-1" - Dim Telefono As String = "-1" - Dim Mail As String = "-1" - - If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim - - If Codigo <> "-1" Then - If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then - TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False - UpFacturar.Update() - Exit Sub - ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then - TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False - UpFacturar.Update() - Exit Sub - Else - HdnCveCliente.Value = ObjClientes.CveCliente.ToString - End If - BtnBuscarCliente_Click(sender, e) - Else - Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia) - TxtCodigo.Text = "" - LblCliente.Text = "Cliente" - LblDireccion.Text = "Dirección" - LblColonia.Text = "Colonia" - LblCiudad.Text = "Ciudad" - LblEstado.Text = "Estado" - LblCP.Text = "00000" - LblRFC.Text = "AAA010101AAA" - LblTelefono.Text = "9999999999" - trsucursalciente.Visible = False - End If - End If - ObjClientes.Dispose() - - End If - End Sub - Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged - ViewState("EstablecioFolio") = True - End Sub - Private Sub ConfiguraTipoDocto() - - 'Esconde Todo - TdOrdenPago.Visible = False - Tr33.Visible = False - - 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017 - Tr33.Visible = True - - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then - BtnEmitirImprimir.Text = "Emitir e Imprimir" - 'TdReferencia.Style.Add("display", "none") - ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then - BtnEmitirImprimir.Text = "Emitir e Imprimir" - 'TdReferencia.Style.Remove("display") - ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then - BtnEmitirImprimir.Text = "Registrar" - 'TdReferencia.Style.Add("display", "none") - ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then - BtnEmitirImprimir.Text = "Registrar" - 'TdReferencia.Style.Add("display", "none") - ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then - BtnEmitirImprimir.Text = "Cotizar" - 'TdReferencia.Style.Add("display", "none") - - 'FACTURACION 3.3 - Tr33.Visible = True - - ElseIf DdlTipoComprobante.SelectedValue = "Com" Then - BtnEmitirImprimir.Text = "Registrar" - 'TdReferencia.Style.Add("display", "none") - ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then - BtnEmitirImprimir.Text = "Registrar" - TdOrdenPago.Visible = True - End If - - UpFacturar.Update() - - End Sub - Private Sub EliminaPoliza() - Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - - Dim ErrorMovimiento = False - - 'Elimina la poliza - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then - If Not ObjAC.RemovePoliza(IdPoliza) Then +#Region "M E T O D O S" + Private Sub CargaOtrosConceptos() + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then + GVOtrosConceptos.DataSource = ObjVentas.DtResultados + GVOtrosConceptos.DataBind() + UpOtrosConceptos.Update() + End If + ObjVentas.Dispose() + End Sub + Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer + Dim Retorno As Integer = 0 + Dim IDPoliza As Integer = 0 + + Dim ErrorAC As Boolean = False + 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() + Dim Fecha As Date = factura.Fecha + Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre) + Dim Paridad As Integer = 1 + Dim TipoMovto As Boolean = False + + If CancelacionIngreso Then + Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre) + Paridad = -1 + TipoMovto = True + End If + + Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1) + + IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha) + Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue)) + 'Dim Importe As Double = TxtTotal.Text.ToDouble + Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes + Dim CtaISSSTESON As Integer = 643 + Dim CtaISPT As Integer = 1745 + ' Dim NombreCliente As String = ViewState("NombreCliente").ToString + + If IDPoliza > 0 Then + + 'Orden de PAGO + If factura.TipoDocto = "OP" Then + + If DdlOrdenPago.SelectedValue.ToEntero = 1 Then + 'ISSSTESON + + If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + + Else + 'ISPT + + If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + End If + + ' NORMAL + Else + Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() + Group gvr By Grp = New With { + Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero + } Into Group + Select Grp.CvePresupuestoIngreso, + TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) + + + 'Select Case TipoComprobante + ' Case "Ing", "Egs" + For Each grp In Detalles + dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) + Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) + + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + 'CARGO la deuda del cliente + If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + 'abono, + If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + Else + ErrorAC = True + End If + Else + ErrorAC = True + End If + Next + + 'Case "OP", "Com" + ' Dim Importe As Decimal = 0 + ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then + ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then + + ' End If + ' End If + 'End Select + End If + + Else + ErrorAC = True + + End If + + If Not ErrorAC Then + ObjAC.AjustaPoliza(IDPoliza) + + Retorno = IDPoliza + Else + + Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError) + End If + + ' ObjAC.Dispose() + + Return Retorno + + End Function + Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer + Dim Retorno As Integer = 0 + Dim IDPoliza As Integer = 0 + + Dim ErrorAC As Boolean = False + 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() + Dim Fecha As Date = TxtFecha.Text.ToDate + Dim Concepto As String = String.Format("GD {0}", NombreCliente) + Dim Paridad As Integer = 1 + Dim TipoMovto As Boolean = False + + If CancelacionIngreso Then + Concepto = String.Format("Cancelación GD {0}", NombreCliente) + Paridad = -1 + TipoMovto = True + End If + + Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1) + + IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha) + Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue)) + 'Dim Importe As Double = TxtTotal.Text.ToDouble + Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero + Dim CtaISSSTESON As Integer = 643 + Dim CtaISPT As Integer = 1745 + ' Dim NombreCliente As String = ViewState("NombreCliente").ToString + + If IDPoliza > 0 Then + + 'Orden de PAGO + If DdlTipoComprobante.SelectedValue.ToString = "OP" Then + + If DdlOrdenPago.SelectedValue.ToEntero = 1 Then + 'ISSSTESON + + If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + + Else + 'ISPT + + If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then + If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + End If + + ' NORMAL + Else + Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)() + Group gvr By Grp = New With { + Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero + } Into Group + Select Grp.CvePresupuestoIngreso, + TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble) + + + 'Select Case TipoComprobante + ' Case "Ing", "Egs" + For Each grp In Detalles + dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso)) + Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text) + + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + 'CARGO la deuda del cliente + If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + 'abono, + If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then + ErrorAC = True + End If + Else + ErrorAC = True + End If + Else + ErrorAC = True + End If + Else + ErrorAC = True + End If + Next + + 'Case "OP", "Com" + ' Dim Importe As Decimal = 0 + ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then + ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then + + ' End If + ' End If + 'End Select + End If + + Else + ErrorAC = True + + End If + + If Not ErrorAC Then + ObjAC.AjustaPoliza(IDPoliza) + + Retorno = IDPoliza + Else + + Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError) + End If + + ' ObjAC.Dispose() + + Return Retorno + + End Function + Private Sub SetValues() + ViewState("TipoCambio") = 1 + + If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "") + If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "") + + If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto + TxtPS.Enabled = False + DivDdlTipo.Visible = True + DivTxtModelo.Visible = True + DivTxtAdicional.Visible = True + DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();") + DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();") + TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();") + TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();") + + CargaClasificacionesDetalles() + ClasificacionModal() + + End If + + If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM + RBLPago.Items.RemoveAt(2) + End If + + + End Sub + Private Sub SetPermisos() + If CveVenta < 1 Then + 'Puede cotizar + If Not UsuarioActual.TienePermisoProceso(59) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot")) + End If + + 'Puede Hacer NC + If Not UsuarioActual.TienePermisoProceso(175) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) + End If + + 'Puede Hacer Devolución + If Not UsuarioActual.TienePermisoProceso(264) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) + End If + + 'Puede facturar + If Not UsuarioActual.TienePermisoProceso(60) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) + End If + + 'Puede remisionar + If Not UsuarioActual.TienePermisoProceso(199) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + LnkFacturarRemision.Visible = False + LnkRemisiones.Visible = False + End If + + '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS + ''Puede remisionar + 'If Not UsuarioActual.TienePermisoProceso(199) Then + ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + 'End If + + ''MODO SOLO LECTURA + 'If DdlTipoComprobante.Items.Count = 0 Then + ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1")) + ' TrBotones.Visible = False + 'End If + + ConfiguraTipoDocto() + End If + End Sub + Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True) + + Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal + Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal + Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal + Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal + Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal + Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal + Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal + Dim Total As Decimal = 0 + Dim TotalImpuestosLocales As Decimal = 0 + + If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos + If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then + For Each dr As DataRow In TmpDT.Rows + dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0 + Next + + If TmpDTImpuestos IsNot Nothing Then + For Each dr2 As DataRow In TmpDTImpuestos.Rows + dr2("Importe") = 0 + Next + TmpDTImpuestos.AcceptChanges() + End If + + TmpDT.AcceptChanges() + TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal + TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal + TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal + TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal + TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal + End If + End If + + If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then + If TotalSubTotal <> TotalAmortizacion Then + For Each drt As DataRow In TmpDTImpuestos.Rows + drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100 + Next + End If + + GvImpuestosLocales2.DataSource = TmpDTImpuestos + GvImpuestosLocales2.DataBind() + End If + + For Each gvr As GridViewRow In GvImpuestosLocales2.Rows + If gvr.RowType = DataControlRowType.DataRow Then + + If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then + If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local + TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal + Else + TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal + End If + End If + End If + Next + + 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False + If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False + If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False + If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False + + If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then + TotalAmortizacion = 0 + End If + + + Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales) + LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2) + TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2) + LblDescuentos.Text = TotalDescuentos.FormatoNumero + TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2) + TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2) + TxtRetISR.Text = TotalRetISR.FormatoNumero(2) + TxtIVA.Text = TotalIVA.FormatoNumero + TxtIEPS.Text = TotalIEPS.FormatoNumero + TxtTotal.Text = Total.FormatoNumero + + LblAmort.Text = TxtSubTotal.Text + If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then + HdnVentaSaldo.Value = Total.ToString + Else + HdnVentaSaldo.Value = SaldoVenta.ToString + End If + HdnIVAOriginal.Value = TxtIVA.Text + + 'JJMQ 20160506: Se agrego para la validacion de pago de contado. + CVImporteContado.ValueToCompare = Total.ToString + + If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then + Alert($"Los siguientes conceptos hace falta especificar clave SAT

{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia) + MensajeCveSAT.Clear() + End If + + Dim view As DataView = New DataView(TmpDT) + view.Sort = "Consec" + GvPS.DataSource = view + GvPS.DataBind() + + 'RECARGA GV INVENTARIO + If Not CveVenta > 0 Then + DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") + CargaGVInv(DtInv) + End If + + UpContado.Update() + UpPS.Update() + RegistraScript("BorraDescuentos();", "BorraDescuentos") + End Sub + Private Function ValidaAdendaFEMSA() As Boolean + Dim Retorno As Boolean = False + + If Not AplicaFEMSA Then + Retorno = True + Else + If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then + Retorno = False + Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then + Retorno = False + Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) + ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then + Retorno = False + Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) + ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then + Retorno = False + Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then + Retorno = False + Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then + Retorno = False + Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) + ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then + Retorno = False + Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia) + Else + Retorno = True + End If + End If + + Return Retorno + End Function + Private Function ValidaComplementoDetallista() As Boolean + Dim Retorno As Boolean = False + + If Not AplicaDetallista Then + Retorno = True + Else + If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then + Retorno = False + Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "") + ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then + Retorno = False + Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then + Retorno = False + Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then + Retorno = False + Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia) + ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then + Retorno = False + Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) + ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then + Retorno = False + Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia) + Else + Retorno = True + End If + End If + + Return Retorno + End Function + Private Function ValidaComplementoFord() As Boolean + Dim Retorno As Boolean = False + + If Not AplicaFord Then + Retorno = True + Else + If TxtFordGSDB.Text.Trim.Length = 0 Then + Retorno = False + Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia) + Else + If LstFordASN.Items.Count = 0 Then + Retorno = True + 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia) + Else + Retorno = True + End If + + End If + End If + + Return Retorno + End Function + Private Sub VinculaCotizacionVenta() + Dim ObjVentas As New ClsVentas() + ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero) + ObjVentas.Dispose() + End Sub + Private Sub GeneraAddenda7Eleven(Archivo As String) + Dim cfdi As String = "" + Dim SB As New StringBuilder + Try + Using sr As New StreamReader(Archivo) + + cfdi = sr.ReadToEnd() + + End Using + Catch e As Exception + Alert("The file could not be read:", TipoMensaje.MsgError) + + End Try + + + cfdi = cfdi.Replace("", "") + + SB.Append(cfdi) + + SB.Append("") + SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim) + SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd")) + + For Each Row As DataRow In TmpDT.Rows + + SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero()) + + Next + + SB.Append("") + + + Using outfile As New StreamWriter(Archivo) + outfile.Write(SB.ToString()) + End Using + + 'Exit Sub + + + + 'Dim MyXmlDocument As New XmlDocument() + + 'MyXmlDocument.Load("C:/Temp/aaa.xml") + 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable) + 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3") + 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas") + 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") + 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd") + + 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "") + 'Prov.SetAttribute("Clave", "3125") + + 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi") + 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones") + 'Recepciones.Prefix = "cfdi" + 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion") + 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim) + 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim) + 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM")) + + 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos") + ''dentro de un ciclo + 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto") + 'Producto.SetAttribute("codigo", "cod1") + 'Producto.SetAttribute("descripcion", "prod1") + 'Producto.SetAttribute("cantidad", "99") + 'Producto.SetAttribute("precio", "2000") + 'Productos.AppendChild(Producto) + ''fin de ciclo + + 'Recepcion.AppendChild(Productos) + + 'Recepciones.AppendChild(Recepcion) + + 'ParentElement.AppendChild(Prov) + + 'ParentElement.AppendChild(Recepciones) + + + 'MyXmlDocument.DocumentElement.AppendChild(ParentElement) + 'MyXmlDocument.Save("C:/Temp/aa.xml") + + End Sub + Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged + For Each dr As DataRow In TmpDT.Rows + dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue + Next + + GvPS.DataSource = TmpDT + GvPS.DataBind() + + UpPS.Update() + End Sub + Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList) + Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero + + If UsuarioActual.Empresa.UsaAC Then + TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue + End If + TmpDT.AcceptChanges() + End Sub + Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click + If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub + LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim)) + TxtFordASN.Text = "" + TxtFordASN.Focus() + End Sub + Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click + LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex) + + End Sub + Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click + GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False) + End Sub + Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged + + Dim ObjClientes As New ClsClientes() + + Dim Nombre As String = "-1" + Dim Codigo As String = "-1" + Dim NombreCorto As String = "-1" + Dim RFC As String = "-1" + Dim Telefono As String = "-1" + Dim Mail As String = "-1" + + If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim + + If Codigo <> "-1" Then + If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then + TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False + UpFacturar.Update() + Exit Sub + ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then + TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False + UpFacturar.Update() + Exit Sub + Else + HdnCveCliente.Value = ObjClientes.CveCliente.ToString + End If + BtnBuscarCliente_Click(sender, e) + Else + Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia) + TxtCodigo.Text = "" + LblCliente.Text = "Cliente" + LblDireccion.Text = "Dirección" + LblColonia.Text = "Colonia" + LblCiudad.Text = "Ciudad" + LblEstado.Text = "Estado" + LblCP.Text = "00000" + LblRFC.Text = "AAA010101AAA" + LblTelefono.Text = "9999999999" + trsucursalciente.Visible = False + End If + End If + ObjClientes.Dispose() + + End If + End Sub + Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged + ViewState("EstablecioFolio") = True + End Sub + Private Sub ConfiguraTipoDocto() + + 'Esconde Todo + TdOrdenPago.Visible = False + Tr33.Visible = False + + 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017 + Tr33.Visible = True + + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then + BtnEmitirImprimir.Text = "Emitir e Imprimir" + 'TdReferencia.Style.Add("display", "none") + ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then + BtnEmitirImprimir.Text = "Emitir e Imprimir" + 'TdReferencia.Style.Remove("display") + ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then + BtnEmitirImprimir.Text = "Registrar" + 'TdReferencia.Style.Add("display", "none") + ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then + BtnEmitirImprimir.Text = "Registrar" + 'TdReferencia.Style.Add("display", "none") + ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then + BtnEmitirImprimir.Text = "Cotizar" + 'TdReferencia.Style.Add("display", "none") + + 'FACTURACION 3.3 + Tr33.Visible = True + + ElseIf DdlTipoComprobante.SelectedValue = "Com" Then + BtnEmitirImprimir.Text = "Registrar" + 'TdReferencia.Style.Add("display", "none") + ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then + BtnEmitirImprimir.Text = "Registrar" + TdOrdenPago.Visible = True + End If + + UpFacturar.Update() + + End Sub + Private Sub EliminaPoliza() + Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) + ObjAC.IniciaTransacSQL() + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + + Dim ErrorMovimiento = False + + 'Elimina la poliza + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then + If Not ObjAC.RemovePoliza(IdPoliza) Then + ErrorMovimiento = True + End If + End If + + 'Desasocia la poliza + If Not ErrorMovimiento Then + If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then + ErrorMovimiento = True + End If + End If + + If Not ErrorMovimiento Then + If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then ErrorMovimiento = True End If - End If - - 'Desasocia la poliza - If Not ErrorMovimiento Then - If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then - ErrorMovimiento = True - End If - End If - - If Not ErrorMovimiento Then - Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion) - ObjAC.Commit() - ObjConta.Commit() - BtnDescontabilizar.Visible = False - Else - Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError) - ObjAC.RollBack() - ObjConta.RollBack() - End If - - ObjAC.Dispose() - ObjConta.Dispose() - - End Sub - Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs) - Dim Ddl As DropDownList = CType(sender, DropDownList) - Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow) - gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1) - 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 + End If + + If Not ErrorMovimiento Then + Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion) + ObjAC.Commit() + ObjConta.Commit() + BtnDescontabilizar.Visible = False + Else + Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError) + ObjAC.RollBack() + ObjConta.RollBack() + End If + + ObjAC.Dispose() + ObjConta.Dispose() + + End Sub + Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs) + Dim Ddl As DropDownList = CType(sender, DropDownList) + Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow) + gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1) + 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 Dim OcurrioError As Boolean = False Try Dim DtMovimientos As DataTable @@ -14909,9 +14915,9 @@ Partial Class Ventas Try 'If ValorInventario <> 0 Then If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then - OcurrioError = True - Exit For - End If + OcurrioError = True + Exit For + End If 'End If Catch ex As Exception OcurrioError = True