diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 6ffc5438a..2b603bb68 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -261,7 +261,7 @@ Public Class ClsClientes End Sub Public Function GetClientes(CveCliente As Integer, Nombre As String, Codigo As String, NombreCorto As String, RFC As String, Telefono As String, Mail As String, CveSubProyecto As Integer, CveEmpresa As Integer, Optional Estatus As Integer = 1, Optional Notificar As String = "-1", Optional CvePrecioLista As Integer = -1, Optional CveClienteClasificacion As Integer = -1, - Optional TipoCliente As Integer = 1, Optional CveVendedor As Integer = -1, Optional PermiteCreditoFiltro As Integer = -1) As Boolean + Optional TipoCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PermiteCreditoFiltro As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClientesGet") diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index e47da35f1..3a606dd7c 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -1,1565 +1,1563 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="IE.aspx.vb" Inherits="Bancos_IE" ValidateRequest="false" %> - - - - - - - - - - -   - - - -
  • - Listado Facturas Pagadas -
  • -
  • - Imprimir -
  • - - -
  • - Complemento Pago -
  • -
    -
    - -
  • - Actualizar Tipo Cambio -
  • - - <%--
  • - Emitir Complemento de Pago -
  • --%> - - - -
  • - Cheque Devuelto -
  • -
  • - Cancelar Movimiento -
  • -
  • - Eliminar Movimiento -
  • -
  • - Refacturar Complemento -
  • -
  • - Cancelar - - <%-- data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si" Style="color: #686868;"> - -
  • -
    -
    - - - - -
  • - Contabilizar -
  • -
  • - Descontabilizar -
  • - -
    - - - - -
    - -
  • - Envíar Comprobante Mail -
  • - - - -
  • - Ajustar -
  • -
    -
    - -
    - - - - - -
    -
    -
    -
    -
    -
    - -   - - <%----%> Comprobante -   - -
    - -
    - - - - - -
    - -
    -
    - -
    - - - - - -
    -
    - - -
    -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    -
    - - -
    -
    -
    - -
    - -
    -
    - - - - -
    - - - - - - - -
    -
    -
    - -
    - - - -
    -
    - -
    - $ - -
    -
    -
    -
    -
    Interes:
    -
    - $ - -
    -
    - -
    - -
    -
    - -
    - $ - - - -
    -
    - - - - -
    - - Clientes - Proveedor - Viaticos - Personal - - - - - - - - - - - - - - - - -
    -
    - -
    - - -
    -
    -
    -
    -
    - -
    -
    - -
    - $ - - -
    -
    -
    - - - - -
    - -
    -
    -
    -
    - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    - - - -
    - -
    - - - - - -
    -
    -
    -
    - - - -
    - - -
    - - - - - - -
    -
    -
    -
    - -
    - -
    - -
    - <%-- - -
    - - - -
    -
    -
    --%> -
    - - - -
    - -
    - -
    -
    -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - - -
    - -
    - - - - -
    -
    -
    - -
    - - - -
    -
    -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    - -
    -
    - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    - - - -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - -
    - -
    -
    - - - - - - <%-- - - - - --%> - - - - - - - - - - - - - - - - - -
    CveIE: - -
    Tipo de Documento: - - - -
    Fecha Aplicación -
    - - - - -
    - - - <%-- - - - - --%> - -
    -
    - - -
    Complemento de pago Sustituto de: - -
    -
    -
    -
    - - - -
    -
    - Cargar Comprobante - - - - - - - - - - - -
    - -
    -
    - Nota: Si ya tiene un comprobante este sera reemplazado. -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    Moneda: - - - - - -
    Registró: -
    F. Registró: -
    Tipo Cambio: -
    -
    -
    - -
    -
    -
    - - <%-- - - - --%> - - - - - - - - - <%-- - - - - - - - - - - - --%> -
    Es Abono en Cuenta: - -
    Aplica Impuestos: - -
    No Deducible: - -
    Fue Impreso: - -
    Fue Conciliado: - -
     Fecha Aplicado:  -
    -
    -
    -
    -
    - - - - - - - - -
    Depositado : - Ir -
    -
    -
    -
    - -
    -
    - - - -
    -
    - - - - -
    -
    -
    -
    - - Datos Generales Cancelación -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - -
    Usuario: - -
    Fecha Cancelación: - -
    Fecha Registro: - -
    - - - -
    -
    -
    -
    - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - - - - - - -
    - - - - - - - - - - -
    - -
    - -
    - -
    -
    -
    -
    - <%----%> - Bitacora -
    -
    -
    - <%--
    - - Agregar -
    --%> -
    - - -
    -
    -
    -
    - - - - - - Fecha - - - - - - Fecha Agenda - - - - - - Usuario - - - - - - Descripción - - - - - - Archivo - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Historial de Modificación -
    -
    -
    -
    -
    -
    -
    - - - - Fecha - - - - - - - - - - -
    -
    -
    -
    - <%-- MODAL BITACORA --%> - - - - - - - - - <%-- COMPLEMENTOS PAGO --%> - - - <%-- ACTUALIZAR TIPO CAMBIO PREPOLIZA --%> - - - - - - - - - - - - -
    - - - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="IE.aspx.vb" Inherits="Bancos_IE" ValidateRequest="false" %> + + + + + + + + + + +   + + + +
  • + Listado Facturas Pagadas +
  • +
  • + Imprimir +
  • + + +
  • + Complemento Pago +
  • +
    +
    + +
  • + Actualizar Tipo Cambio +
  • + + <%--
  • + Emitir Complemento de Pago +
  • --%> + + + +
  • + Cheque Devuelto +
  • +
  • + Cancelar Movimiento +
  • +
  • + Eliminar Movimiento +
  • +
  • + Refacturar Complemento +
  • +
  • + Cancelar + + <%-- data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si" Style="color: #686868;"> + +
  • +
    +
    + + + + +
  • + Contabilizar +
  • +
  • + Descontabilizar +
  • + +
    + + + + +
    + +
  • + Envíar Comprobante Mail +
  • + + + +
  • + Ajustar +
  • +
    +
    + +
    + + + + + +
    +
    +
    +
    +
    +
    + +   + + <%----%> Comprobante +   + +
    + +
    + + + + + +
    + +
    +
    + +
    + + + + + +
    +
    + + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + +
    +
    + + + + +
    + + + + + + + +
    +
    +
    + +
    + + + +
    +
    + +
    + $ + +
    +
    +
    +
    +
    Interes:
    +
    + $ + +
    +
    + +
    + +
    +
    + +
    + $ + + + +
    +
    + + + + +
    + + Clientes + Proveedor + Viaticos - Personal + + + + + + + + + + + + + + + + +
    +
    + +
    + + +
    +
    +
    +
    +
    + + +
    + $ + + +
    +
    +
    + + + + +
    + +
    +
    +
    +
    + + + + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + + + +
    + +
    + + + + + +
    +
    +
    +
    + + + +
    + + +
    + + + + + + +
    +
    +
    +
    + +
    + +
    + +
    + <%-- + +
    + + + +
    +
    +
    --%> +
    + + + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + + + +
    + +
    + + + + +
    +
    +
    + +
    + + + +
    +
    +
    +
    + +
    + +
    + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + +
    +
    +
    +
    + + + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + +
    + +
    +
    + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + + + + +
    CveIE: + +
    Tipo de Documento: + + + +
    Fecha Aplicación +
    + + + + +
    + + + <%-- + + + + --%> + +
    +
    + + +
    Complemento de pago Sustituto de: + +
    +
    +
    +
    + + + +
    +
    + Cargar Comprobante + + + + + + + + + + + +
    + +
    +
    + Nota: Si ya tiene un comprobante este sera reemplazado. +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    Moneda: + + + + + +
    Registró: +
    F. Registró: +
    Tipo Cambio: +
    +
    +
    + +
    +
    +
    + + <%-- + + + --%> + + + + + + + + + <%-- + + + + + + + + + + + --%> +
    Es Abono en Cuenta: + +
    Aplica Impuestos: + +
    No Deducible: + +
    Fue Impreso: + +
    Fue Conciliado: + +
     Fecha Aplicado:  +
    +
    +
    +
    +
    + + + + + + + + +
    Depositado : + Ir +
    +
    +
    +
    + +
    +
    + + + +
    +
    + + + + +
    +
    +
    +
    + + Datos Generales Cancelación +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + +
    Usuario: + +
    Fecha Cancelación: + +
    Fecha Registro: + +
    + + + +
    +
    +
    +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + + + + + + +
    + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
    +
    + <%----%> + Bitacora +
    +
    +
    + <%--
    + + Agregar +
    --%> +
    + + +
    +
    +
    +
    + + + + + + Fecha + + + + + + Fecha Agenda + + + + + + Usuario + + + + + + Descripción + + + + + + Archivo + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + Historial de Modificación +
    +
    +
    +
    +
    +
    +
    + + + + Fecha + + + + + + + + + + +
    +
    +
    +
    + <%-- MODAL BITACORA --%> + + + + + + + + + <%-- COMPLEMENTOS PAGO --%> + + + <%-- ACTUALIZAR TIPO CAMBIO PREPOLIZA --%> + + + + + + + + + + + + +
    + + + + diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 09ab57456..1eeb43303 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -2266,15 +2266,10 @@ Partial Class Bancos_IE Exit Sub End If - - - Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) - Dim ObjOC As New ClsOC(ObjIE.IniciaTransacSQL) - - ' Dim ObjContabilidad As New ClsContabilidad(ObjIE.IniciaTransacSQL) + Dim ObjOC As New ClsOC(ObjIE.IniciaTransacSQL) Dim MsgError As String = "" Dim CveConceptoContable As Integer = 30 @@ -2284,988 +2279,968 @@ Partial Class Bancos_IE Dim CvePlantillaPoliza As Integer = 3 Dim CvePrePoliza As Integer = 0 Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " - Dim Msg As New StringBuilder - - If CveIE = -1 Then - - Dim CveCuentaDeposito As Integer = 0 - If DdlCuentaDeposito.Items.Count > 0 Then - CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero - End If - - 'OBTIENE COMPROBANTE!! - ComprobanteIE = "" - Dim Comprobante As String = "" - Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos - Dim filemove As String = "" - For Each fileItem As Archivo In filesgral - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.filename - Next - - - '*****-_- INICIA: CONFIGURACION REGISTRO -_-***** - If CvePersonal > 0 Then - If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") And DDlCheques.SelectedValue.ToEntero > 0 Then - CveConceptoCompra = 29 'Comprobación Personal - Else - CveConceptoCompra = 28 'Prestamo Personal - End If - CveConceptoContable = 30 'Banco - CvePlantillaPoliza = 8 - End If - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then - If CvePersonal > 0 Then - CveConceptoCompra = 29 'Comprobacion Personal - CveConceptoContable = 30 'Bancos - CvePlantillaPoliza = 9 - ElseIf CveProveedor > 0 Then - CveConceptoCompra = 21 'Pago a Proveedor/CAncelacion Anticipos - CveConceptoContable = 30 'Bancos - CvePlantillaPoliza = 7 - End If - End If - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then - If CveCliente > 0 Then - CveConceptoCompra = 3 'Clientes - CveConceptoContable = 30 'Bancos - CvePlantillaPoliza = 12 - End If - End If - - 'Cuando es Egreso sin factura, se registra una compra tipo anticipo - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSCREDITO" Then - CveConceptoCompra = 48 'Anticipo Acreedores - CveConceptoContable = 30 'Bancos - CveCreditoDetalle = DdlCreditoDetalle.SelectedValue.ToEntero - Dim Estatus As Integer = 2 - If HdnCveTipoCredito.Value = "1" Then - Estatus = 103 - 'cuando es crediproveedores es, pago a documentos por pagar - CveConceptoCompra = 57 - End If - ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle) - - If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then - CIF = TxtImporte.Text.ToDecimal - HdnImporteCredito.Value.ToDecimal - Else - CIF = 0 - End If - - CvePlantillaPoliza = 92 - - End If - Dim AgregaPolizaSaldoInicial As Boolean = False - 'Cuando es Egreso sin factura, se registra una compra tipo anticipo - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then - Select Case RBL.SelectedValue - Case "P" 'Proveedores - If CveProveedor > 0 Then - CveConceptoCompra = 10 'Anticipo a proveedor - CveConceptoContable = 30 'Pago a Proveedor - CvePlantillaPoliza = 3 - End If - Case "DD" ' Deudores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 43 'Prestamo a deudor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 6 - End If - Case "AC" ' Acreedores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 42 'Prestamo a acreedor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 21 - End If - Case "DP" ' Documentos por pagar - If CveProveedor > 0 Then - CveConceptoCompra = 50 'Anticipo doc por pagar - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 22 - End If - Case "FE" - AgregaPolizaSaldoInicial = True - End Select - End If - - 'Nuevo Formato Charlie - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 6 - Select Case RBL.SelectedValue - Case "DD" ' Deudores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 37 'Prestamo a deudor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 45 - End If - Case "C" ' Clientes - If CveCliente > 0 Then - CveConceptoCompra = 66 'Anticipo doc por pagar - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - End If - Case "AC" ' Acreedores Diversos - If CveCliente > 0 Then - CveConceptoCompra = 41 - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - End If - End Select - End If - - '*****-_- TERMINA: CONFIGURACION REGISTRO -_-***** - - - Dim FolioFijo As Integer = 0 - Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero - Dim tImporteMonedaExtranjera As Decimal = 0 - If tCveMoneda <> 1 Then tImporteMonedaExtranjera = TxtImporte.Text.ToDecimal * GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString.ToDecimal - Dim PagueseA = "" - - If HdnCveCliente.Value.ToEntero > 0 Then - PagueseA = DdlCliente.SelectedText.ToString() - ElseIf HdnCveProveedor.Value.ToEntero > 0 Then - PagueseA = DdlProveedores.SelectedText.ToString() - ElseIf HdnCvePersonal.Value.ToEntero > 0 Then - PagueseA = DdlPersonal.SelectedItem.ToString - ElseIf DdlCreditoDetalle.SelectedValue.ToEntero > 0 Then - PagueseA = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) - End If - - If AgregaPolizaSaldoInicial Then - If AgregarSaldoInicial(TxtImporte.Text.ToDouble(), TxtFechaDocumento.Text.ToDateTime(), DdlMoneda.SelectedValue.ToEntero(), ObjMov) <= 0 Then - MsgError = "No se pudo insertar la póliza de saldo inicial." - End If - End If - - If MsgError = "" Then - - - - CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, PagueseA, TxtImporte.Text.Trim.ToDouble, DdlMoneda.SelectedValue.ToEntero, - TxtTipoCambio.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, TxtNotificarA.Text.Trim, ChkAbonoCuenta.Checked, ChkAplicaImpuestos.Checked, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=DdlEstatusIE.SelectedValue.ToString.ToEntero, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1)) - - If CveIE > 0 Then - - If DdlTipoTransaccion.SelectedValue = "1" Then FolioFijo = ObjIE.Folio.ToEntero 'cheque - CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE " + If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "") + " " + RBL.SelectedValue, CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa)) - - 'valida prepoliza - If CvePrePoliza > 0 Then - - If Not ObjIE.UpdateIEPrePoliza(MinFecha, "", -1, CvePrePoliza, CveIE, -1) Then - MsgError = "Ocurrio un error al agregar la prepoliza al IE." - End If - - Dim Conc As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) - Dim Ref As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) - - If Comprobante <> "" Then - ComprobanteIE = $"{CveIE}.{Comprobante}" - End If - - 'GUARDA COMPROBANTE - If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) - End If - - 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs - Select Case Opcion - Case "DEV" - Dim CveIEOtro As Integer = If(CveProveedor > 0 Or CvePersonal > 0, DdlIEDevolucion.SelectedValue.ToEntero, CveIE) - - If CveCliente > 0 AndAlso Not DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDouble = 0 Then - 'RMF- CASO DONDE HAY UNA DEVOLUCION Y TENGO QUE AFECTAR LAS FACTURAS QUE SE HABIAN MARCADO COMO PAGADAS TENGO QUE REGRESARLAS A PENDIENTES - Dim Mov As New ClsMovimientos - If Mov.GetMovimientosIE(2, DdlIEDevolucion.SelectedValue.ToEntero, -1, Now, Now, 1, 0, UsuarioActual.CveEmpresa) Then - Dim DtIE As DataTable = Mov.DtResultados - For Each dr As DataRow In DtIE.Rows - - If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, If(dr("TipoMovto").ToString.ToEntero = 1, False, True), If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, dr("Importe").ToString.ToDecimal), "", dr("CveConceptoContable").ToString.ToEntero, "", Now, IDCtaBeneficiario, -1, CveIE, CveCliente:=dr("CveCliente").ToString.ToEntero, CveVenta:=dr("CveVenta").ToString.ToEntero, ImporteMX:=If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, -dr("Importe").ToString.ToDecimal), ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) Then - MsgError = "no se pudo insertar el detalle de la póliza 2" - End If - Next - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) - - End If - Mov.Dispose() - - 'Devolucion de INGxC Formato Charlie - ElseIf CveCliente > 0 AndAlso DivIvaIxC.Visible Then - - Dim Mov As New ClsMovimientos - 'INGxC - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), Ref, 66, Conc, Now, IDCtaContable, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) - - If TxtIvaIxC.Text.ToDouble > 0 Then - 'Iva - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -TxtIvaIxC.Text.ToDecimal, Ref, 61, Conc, Now, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - End If - - 'Bancos - ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -TxtImporte.Text.ToDecimal, Ref, 30, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) - Mov.Dispose() - - Else - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE:=If(CveIEOtro < 0, CveIE, CveIEOtro), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) Then - MsgError = "no se pudo insertar el detalle de la póliza 2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - - End If - - - Case "INGPC" - Dim ConceptoContable As Integer - Dim TipoMovimiento As Boolean - Dim importeMovimiento As Decimal - Dim FechaMovimiento As Date = Now - Dim Concepto As String = "" - Dim Referencia As String = PagueseA - - Dim importeMX As Decimal - Dim Multiplicador As Integer - - If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then - - For Each Row As DataRow In ObjMov.DtResultados.Rows - - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) - importeMovimiento = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) - Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) - - Select Case ConceptoContable - - Case 10 - If RBL.SelectedValue = "P" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 28 - If RBL.SelectedValue = "FE" AndAlso CvePersonal > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 37 - If RBL.SelectedValue = "DD" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 41 - If RBL.SelectedValue = "AC" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 46 - - If TxtInteresMoratorio.Text.ToDecimal > 0 Then - importeMovimiento = TxtInteresMoratorio.Text.ToDecimal - importeMX = importeMovimiento - Else - importeMovimiento = 0 - importeMX = 0 - End If - - - Case 50 - If RBL.SelectedValue = "DP" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 66 - If RBL.SelectedValue = "C" AndAlso CveCliente > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal - importeMX = importeMovimiento - - 'Agregamos el IVA - If DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDecimal <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, 61, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=0) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - - End If - - End If - - Case 30 - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - - If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - - End If - - End Select - - If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, CveCuentaConta, CveCuentaBeneficiario)) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - - Next - - End If - - - Case "DevDinV" - Dim IdCtaContableAplicar = -1 - Dim ImporteAplicar = 0.0D - Dim ImporteAplicarMN = 0.0D - Dim ImporteAplicarME = 0.0D - Dim ReferenciaAplicar = ObjIE.Folio - Dim ConceptoAplicar = $"Devolución al cliente {PagueseA} {TxtImporte.Text} NC:{SerieFolioDevDin}" - - ImporteAplicar = TxtImporte.Text.ToDecimal - ImporteAplicarME = ImporteAplicar - - 'CONSIDERA COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - ImporteAplicarMN = ImporteAplicar - Else - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - End If - - 'BANCOS - IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" - Exit Select - End If - - 'BANCOS COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)) - ImporteAplicar).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - End If - - 'CANCELA NC - IdCtaContableAplicar = IDCtaBeneficiario - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 12, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=-(ImporteAplicarMN), ImporteME:=ImporteAplicarME) Then - MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" - Exit Select - End If - - 'OTROS INGRESOS/EGRESOS - - If TxtOtrosIngresosEgresos.Text.ToDecimal <> 0 Then - Dim Impo As Decimal = TxtOtrosIngresosEgresos.Text.ToDecimal - Dim TipoMovtoIE As Boolean = False - Dim CveConcIE As Integer = 78 - If Impo > 0 Then - TipoMovtoIE = True - Impo = Math.Abs(Impo) - CveConcIE = 78 + Dim Msg As New StringBuilder + + Try + If CveIE = -1 Then + + Dim CveCuentaDeposito As Integer = 0 + If DdlCuentaDeposito.Items.Count > 0 Then + CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero + End If + + 'OBTIENE COMPROBANTE!! + ComprobanteIE = "" + Dim Comprobante As String = "" + Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim filemove As String = "" + For Each fileItem As Archivo In filesgral + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.filename + Next + + + '*****-_- INICIA: CONFIGURACION REGISTRO -_-***** + If CvePersonal > 0 Then + If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") And DDlCheques.SelectedValue.ToEntero > 0 Then + CveConceptoCompra = 29 'Comprobación Personal + Else + CveConceptoCompra = 28 'Prestamo Personal + End If + CveConceptoContable = 30 'Banco + CvePlantillaPoliza = 8 + End If + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then + If CvePersonal > 0 Then + CveConceptoCompra = 29 'Comprobacion Personal + CveConceptoContable = 30 'Bancos + CvePlantillaPoliza = 9 + ElseIf CveProveedor > 0 Then + CveConceptoCompra = 21 'Pago a Proveedor/CAncelacion Anticipos + CveConceptoContable = 30 'Bancos + CvePlantillaPoliza = 7 + End If + End If + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then + If CveCliente > 0 Then + CveConceptoCompra = 3 'Clientes + CveConceptoContable = 30 'Bancos + CvePlantillaPoliza = 12 + End If + End If + + 'Cuando es Egreso sin factura, se registra una compra tipo anticipo + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSCREDITO" Then + CveConceptoCompra = 48 'Anticipo Acreedores + CveConceptoContable = 30 'Bancos + CveCreditoDetalle = DdlCreditoDetalle.SelectedValue.ToEntero + Dim Estatus As Integer = 2 + If HdnCveTipoCredito.Value = "1" Then + Estatus = 103 + 'cuando es crediproveedores es, pago a documentos por pagar + CveConceptoCompra = 57 + End If + ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle) + + If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then + CIF = TxtImporte.Text.ToDecimal - HdnImporteCredito.Value.ToDecimal + Else + CIF = 0 + End If + + CvePlantillaPoliza = 92 + + End If + Dim AgregaPolizaSaldoInicial As Boolean = False + 'Cuando es Egreso sin factura, se registra una compra tipo anticipo + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then + Select Case RBL.SelectedValue + Case "P" 'Proveedores + If CveProveedor > 0 Then + CveConceptoCompra = 10 'Anticipo a proveedor + CveConceptoContable = 30 'Pago a Proveedor + CvePlantillaPoliza = 3 + End If + Case "DD" ' Deudores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 43 'Prestamo a deudor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 6 + End If + Case "AC" ' Acreedores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 42 'Prestamo a acreedor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 21 + End If + Case "DP" ' Documentos por pagar + If CveProveedor > 0 Then + CveConceptoCompra = 50 'Anticipo doc por pagar + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 22 + End If + Case "FE" + AgregaPolizaSaldoInicial = True + End Select + End If + + 'Nuevo Formato Charlie + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 6 + Select Case RBL.SelectedValue + Case "DD" ' Deudores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 37 'Prestamo a deudor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 45 + End If + Case "C" ' Clientes + If CveCliente > 0 Then + CveConceptoCompra = 66 'Anticipo doc por pagar + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + End If + Case "AC" ' Acreedores Diversos + If CveCliente > 0 Then + CveConceptoCompra = 41 + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + End If + End Select + End If + + '*****-_- TERMINA: CONFIGURACION REGISTRO -_-***** + + + Dim FolioFijo As Integer = 0 + Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero + Dim tImporteMonedaExtranjera As Decimal = 0 + If tCveMoneda <> 1 Then tImporteMonedaExtranjera = TxtImporte.Text.ToDecimal * GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString.ToDecimal + Dim PagueseA = "" + + If HdnCveCliente.Value.ToEntero > 0 Then + PagueseA = DdlCliente.SelectedText.ToString() + ElseIf HdnCveProveedor.Value.ToEntero > 0 Then + PagueseA = DdlProveedores.SelectedText.ToString() + ElseIf HdnCvePersonal.Value.ToEntero > 0 Then + PagueseA = DdlPersonal.SelectedItem.ToString + ElseIf DdlCreditoDetalle.SelectedValue.ToEntero > 0 Then + PagueseA = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) + End If + + If AgregaPolizaSaldoInicial Then + If AgregarSaldoInicial(TxtImporte.Text.ToDouble(), TxtFechaDocumento.Text.ToDateTime(), DdlMoneda.SelectedValue.ToEntero(), ObjMov) <= 0 Then + MsgError = "No se pudo insertar la póliza de saldo inicial." + End If + End If + + If MsgError = "" Then + + + + CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, PagueseA, TxtImporte.Text.Trim.ToDouble, DdlMoneda.SelectedValue.ToEntero, + TxtTipoCambio.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, TxtNotificarA.Text.Trim, ChkAbonoCuenta.Checked, ChkAplicaImpuestos.Checked, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=DdlEstatusIE.SelectedValue.ToString.ToEntero, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1)) + + If CveIE > 0 Then + + If DdlTipoTransaccion.SelectedValue = "1" Then FolioFijo = ObjIE.Folio.ToEntero 'cheque + CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE " + If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "") + " " + RBL.SelectedValue, CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa)) + + 'valida prepoliza + If CvePrePoliza > 0 Then + + If Not ObjIE.UpdateIEPrePoliza(MinFecha, "", -1, CvePrePoliza, CveIE, -1) Then + MsgError = "Ocurrio un error al agregar la prepoliza al IE." + End If + + Dim Conc As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) + Dim Ref As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) + + If Comprobante <> "" Then + ComprobanteIE = $"{CveIE}.{Comprobante}" + End If + + 'GUARDA COMPROBANTE + If filemove <> "" Then + filemove.FilesMove(CveIE.ToString, String.Format("Empresas\{0}\IE", UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)) + End If + + 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs + Select Case Opcion + Case "DEV" + Dim CveIEOtro As Integer = If(CveProveedor > 0 Or CvePersonal > 0, DdlIEDevolucion.SelectedValue.ToEntero, CveIE) + + If CveCliente > 0 AndAlso Not DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDouble = 0 Then + 'RMF- CASO DONDE HAY UNA DEVOLUCION Y TENGO QUE AFECTAR LAS FACTURAS QUE SE HABIAN MARCADO COMO PAGADAS TENGO QUE REGRESARLAS A PENDIENTES + Dim Mov As New ClsMovimientos + If Mov.GetMovimientosIE(2, DdlIEDevolucion.SelectedValue.ToEntero, -1, Now, Now, 1, 0, UsuarioActual.CveEmpresa) Then + Dim DtIE As DataTable = Mov.DtResultados + For Each dr As DataRow In DtIE.Rows + + If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, If(dr("TipoMovto").ToString.ToEntero = 1, False, True), If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, dr("Importe").ToString.ToDecimal), "", dr("CveConceptoContable").ToString.ToEntero, "", Now, IDCtaBeneficiario, -1, CveIE, CveCliente:=dr("CveCliente").ToString.ToEntero, CveVenta:=dr("CveVenta").ToString.ToEntero, ImporteMX:=If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, -dr("Importe").ToString.ToDecimal), ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) Then + MsgError = "no se pudo insertar el detalle de la póliza 2" + End If + Next + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) + + End If + Mov.Dispose() + + 'Devolucion de INGxC Formato Charlie + ElseIf CveCliente > 0 AndAlso DivIvaIxC.Visible Then + + Dim Mov As New ClsMovimientos + 'INGxC + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), Ref, 66, Conc, Now, IDCtaContable, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) + + If TxtIvaIxC.Text.ToDouble > 0 Then + 'Iva + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -TxtIvaIxC.Text.ToDecimal, Ref, 61, Conc, Now, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) + End If + + 'Bancos + ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -TxtImporte.Text.ToDecimal, Ref, 30, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) + Mov.Dispose() + Else - TipoMovtoIE = False - Impo = Math.Abs(Impo) - CveConcIE = 211 + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE:=If(CveIEOtro < 0, CveIE, CveIEOtro), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario) Then + MsgError = "no se pudo insertar el detalle de la póliza 2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, Impo, ReferenciaAplicar, CveConcIE, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=Impo, ImporteME:=0) Then + + Case "INGPC" + Dim ConceptoContable As Integer + Dim TipoMovimiento As Boolean + Dim importeMovimiento As Decimal + Dim FechaMovimiento As Date = Now + Dim Concepto As String = "" + Dim Referencia As String = PagueseA + + Dim importeMX As Decimal + Dim Multiplicador As Integer + + If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then + + For Each Row As DataRow In ObjMov.DtResultados.Rows + + ConceptoContable = Row("CveConcepto").ToString.ToEntero + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + importeMovimiento = 0 + Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) + + Select Case ConceptoContable + + Case 10 + If RBL.SelectedValue = "P" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 28 + If RBL.SelectedValue = "FE" AndAlso CvePersonal > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 37 + If RBL.SelectedValue = "DD" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 41 + If RBL.SelectedValue = "AC" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 46 + + If TxtInteresMoratorio.Text.ToDecimal > 0 Then + importeMovimiento = TxtInteresMoratorio.Text.ToDecimal + importeMX = importeMovimiento + Else + importeMovimiento = 0 + importeMX = 0 + End If + + + Case 50 + If RBL.SelectedValue = "DP" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 66 + If RBL.SelectedValue = "C" AndAlso CveCliente > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal + importeMX = importeMovimiento + + 'Agregamos el IVA + If DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDecimal <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, 61, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=0) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + + End If + + End If + + Case 30 + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + + If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + + End If + + End Select + + If importeMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, CveCuentaConta, CveCuentaBeneficiario)) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + + Next + + End If + + + Case "DevDinV" + Dim IdCtaContableAplicar = -1 + Dim ImporteAplicar = 0.0D + Dim ImporteAplicarMN = 0.0D + Dim ImporteAplicarME = 0.0D + Dim ReferenciaAplicar = ObjIE.Folio + Dim ConceptoAplicar = $"Devolución al cliente {PagueseA} {TxtImporte.Text} NC:{SerieFolioDevDin}" + + ImporteAplicar = TxtImporte.Text.ToDecimal + ImporteAplicarME = ImporteAplicar + + 'CONSIDERA COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + ImporteAplicarMN = ImporteAplicar + Else + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + End If + + 'BANCOS + IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" + Exit Select + End If + + 'BANCOS COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)) - ImporteAplicar).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + End If + + 'CANCELA NC + IdCtaContableAplicar = IDCtaBeneficiario + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 12, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=-(ImporteAplicarMN), ImporteME:=ImporteAplicarME) Then MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" Exit Select End If + + 'IMPUESTOS + If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin) Then + Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) + Dim CveConceptoContableAplciar = -1 + Dim TipoMovtoAplicar = False + + For Each Dr As DataRow In ObjMov.DtResultados.FiltraParametros("CveConceptoContable IN (13,8,9,38)").Rows + CveConceptoContableAplciar = Dr("CveConceptoContable").ToString.ToEntero + TipoMovtoAplicar = Not CBool(Dr("TipoMovto").ToString) + ImporteAplicar = (Dr("Importe").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + ImporteAplicarMN = (Dr("ImporteMN").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + ImporteAplicarME = (Dr("ImporteME").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + IdCtaContableAplicar = Dr("IdCtaContable").ToString.ToEntero + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + Select Case CveConceptoContableAplciar + Case 13 + CveConceptoContableAplciar = 61 + Case 8 + CveConceptoContableAplciar = 62 + Case 9 + CveConceptoContableAplciar = 63 + Case 38 + CveConceptoContableAplciar = 39 + End Select + TipoMovtoAplicar = Not TipoMovtoAplicar + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + Exit Select + End If + Else + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + Exit Select + End If + + Next + End If + + Case "DevDinC" + 'asdasdasd + 'asdasdasdasd + Dim IdCtaContableAplicar = -1 + Dim ImporteAplicar = 0.0D + Dim ImporteAplicarMN = 0.0D + Dim ImporteAplicarME = 0.0D + Dim ReferenciaAplicar = ObjIE.Folio + + Dim ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {TxtImporte.Text} NC:{SerieFolioDeCDin}" + + ImporteAplicar = TxtImporte.Text.ToDecimal + ImporteAplicarME = ImporteAplicar + + + 'CONSIDERA COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + ImporteAplicarMN = ImporteAplicar + Else + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + End If + + Dim TCCompra As Decimal = 1 + Dim TCDocumento As Decimal = 1 + + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + + TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal + TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal + + If TCCompra <= 0 Then + Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia) + End If + + If TCCompra <= 0 Then + Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia) + End If + + End If + + + + 'BANCOS + IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" + Exit Select + End If + + + 'BANCOS COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + End If + + 'CANCELA NC + IdCtaContableAplicar = IDCtaBeneficiario + ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, (ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then + MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" + Exit Select + End If + + + 'NC COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + + ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL() + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + + End If + + If TCCompra <> TCDocumento Then + + Dim DiferenciaTC As Decimal = TCCompra - TCDocumento + + Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento)) + + If DiferenciaTC < 0 Then + '64 + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then + MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria" + Exit Select + End If + + Else + '65 + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then + MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria" + Exit Select + End If + + End If + + End If + + 'IMPUESTOS + + Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) + Dim CveConceptoContableAplciar = -1 + Dim TipoMovtoAplicar = False + + + Dim ObjCompras As New ClsCompras() + If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + + Dim dr As DataRow = ObjCompras.DtResultados.Rows(0) + If dr IsNot Nothing Then + + Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero + Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal + + Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal + Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal + PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal + + Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC) + Dim CveCuentaIVAxAcreditarDevDinC = 0 + Dim CveCuentaIVAAcreditableDevDinC = 0 + + Dim IdCtaIVAXAcreditarDevDinC = 0 + Dim IdCtaIVAAcreditableDevDinC = 0 + + If DTCuentas IsNot Nothing AndAlso DTCuentas.Rows.Count > 0 Then + IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero + IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero + End If + + Dim IVADevMN As Decimal = 0 + Dim IEPSDevMN As Decimal = 0 + + Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2) + + IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2) + IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2) + + Dim CveCuentaDevolucionIMPUESTOS As Integer = -1 + Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1 + + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + IVADevMN = IVADev + IEPSDevMN = IEPSDev + Else + IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2) + IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2) + End If + + Dim ErrorDevolucionImpuestos As Boolean = False + + If IVADev > 0 Then + + CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC + IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then + + CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC + IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + ErrorDevolucionImpuestos = True + End If + Else + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + ErrorDevolucionImpuestos = True + + End If + End If + + + If IEPSDev > 0 Then + 'Dim ObjContabilidad As New ClsContabilidad + If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then + Try + CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero + IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then + + If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then + Try + CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero + IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + ErrorDevolucionImpuestos = True + End If + + + Catch ex As Exception + Alert("Se presento un error al obtener las cuentas de IEPS acreditable.") + ErrorDevolucionImpuestos = True + End Try + + End If + + Else + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + ErrorDevolucionImpuestos = True + End If + + Catch ex As Exception + Alert("Se presento un error al obtener las cuentas de IEPS acreditable.") + ErrorDevolucionImpuestos = True + End Try + End If + End If + + If ErrorDevolucionImpuestos Then + MsgError = MsgError & " Error en devolución compra." + End If + + + End If + End If + + Case "EGSCREDITO" + + Dim ConceptoContable As Integer + Dim TipoMovimiento As Boolean + Dim importeMovimiento As Decimal + Dim FechaMovimiento As Date = Now + Dim Concepto As String = "" + Dim Referencia As String = PagueseA + + Dim importeMX As Decimal + Dim Multiplicador As Integer + + If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then + + For Each Row As DataRow In ObjMov.DtResultados.Rows + + ConceptoContable = Row("CveConcepto").ToString.ToEntero + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + importeMovimiento = 0 + Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) + + Select Case ConceptoContable + + Case 30 + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + Case 42 + + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + + Case 46 + If TxtInteresMoratorio.Text.ToDecimal > 0 Then + importeMovimiento = TxtInteresMoratorio.Text.ToDecimal + importeMX = importeMovimiento + Else + importeMovimiento = 0 + importeMX = 0 + End If + Case 48 + + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + + End Select + + If importeMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, CveCuentaConta, CveCuentaBeneficiario)) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + + Next + End If + + Case Else + Dim TipoMovimiento As Boolean = True + + If Opcion.Contiene("ANTC") Then + TipoMovimiento = False + End If + + If CveConceptoCompra = 10 AndAlso DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + IDCtaBeneficiario = IdCtaAnticipoExtranjera + CveCuentaConta = 0 + End If + + 'MOVIMIENTOS EGRESOS + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, TxtImporte.Text.ToDecimal - IVA - CIF, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DdlIEAcreedor.SelectedValue.ToEntero) Then + If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Ref, 19, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + MsgError = "Detalle" + End If + 'intereses pagados + If CIF > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, CIF, Ref, 46, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=CIF, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + MsgError = "Detalle" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + + 'BANCOS COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then + Dim ImporteAplicar As Decimal = TxtImporte.Text.ToDecimal + Dim ImporteAplicarMN = (ImporteAplicar * TxtTipoCambio.Text.ToDecimal - ImporteAplicar).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAplicar, Ref, 204, Conc, Now, IDCtaContableComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, CveCuenta:=CveCuentaConta, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + + If CveConceptoCompra = 10 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, ImporteAplicar, Ref, 266, Conc, Now, IdCtaAnticipoComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, CveCuenta:=0, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + End If + + + End If + + If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then + If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then + MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." + End If + End If + + End Select + + 'El movimiento 1 es el de Venta + 'Conta SIG + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then + If CveCuentaBeneficiario > 0 And CveCuentaConta > 0 Then + If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + IDPoliza = ObjMov.ContaIdPoliza + Else + Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + End If + Else + If CveCuentaConta < 1 Then + Alert("No se puede contabilizar la Prepoliza en SIG debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) + End If + If CveCuentaBeneficiario < 1 Then + Alert("No se puede contabilizar la Prepoliza en SIG debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) + End If + End If + End If + + 'Conta ContPAQ + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then + If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then + If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + IDPoliza = ObjMov.ContaIdPoliza + 'Alert(alertaContabilizacion & ObjMov.AlertaMensaje, ModExtensiones.TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + End If + Else + If IDCtaContable < 1 Then + Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) + End If + If IDCtaBeneficiario < 1 Then + Alert("No se puede contabilizar la Prepoliza debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) + End If + End If + End If + + If UsuarioActual.Empresa.UsaAC Then + Dim ConceptoRenglon, Referencia As String + Dim FolioPoliza As Integer + Dim Fecha As Date = TxtFechaDocumento.Text.ToDate + Dim TipoChq As String = "" + Dim Total As Double = TxtImporte.Text.ToDouble + + Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) + Conta.IniciaTransacSQL() + + If DdlTipoTransaccion.SelectedValue = "1" Then TipoChq = "CHQ" + ConceptoRenglon = String.Format("Anticipo {0}", PagueseA) + + IDPoliza = Conta.AddPoliza(2, ConceptoRenglon, Total, Total, UsuarioActual.CveUsuario, Fecha, ObjIE.Folio, TipoChq) + + If IDPoliza > 0 Then + FolioPoliza = Conta.Folio + Referencia = ObjIE.Folio + ConceptoRenglon = String.Format("Anticipo {0} {1}", PagueseA, TxtObservaciones.Text) + + Total = TxtImporte.Text.ToDouble + + If Not Conta.AddMovimiento(IDPoliza, IDCtaContable, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + If Not Conta.AddMovimiento(IDPoliza, IDCtaBeneficiario, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + Else + MsgError = "No se insertó el encabezado" End If + If MsgError = "" Then + Conta.Commit() + Conta.AjustaPoliza(IDPoliza) + 'actualizar la conta del IE + ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0) + Else + Conta.RollBack() + IDPoliza = 0 + End If - 'IMPUESTOS - If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin) Then - Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) - Dim CveConceptoContableAplciar = -1 - Dim TipoMovtoAplicar = False - - For Each Dr As DataRow In ObjMov.DtResultados.FiltraParametros("CveConceptoContable IN (13,8,9,38)").Rows - CveConceptoContableAplciar = Dr("CveConceptoContable").ToString.ToEntero - TipoMovtoAplicar = Not CBool(Dr("TipoMovto").ToString) - ImporteAplicar = (Dr("Importe").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - ImporteAplicarMN = (Dr("ImporteMN").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - ImporteAplicarME = (Dr("ImporteME").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - IdCtaContableAplicar = Dr("IdCtaContable").ToString.ToEntero - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then - Select Case CveConceptoContableAplciar - Case 13 - CveConceptoContableAplciar = 61 - Case 8 - CveConceptoContableAplciar = 62 - Case 9 - CveConceptoContableAplciar = 63 - Case 38 - CveConceptoContableAplciar = 39 - End Select - TipoMovtoAplicar = Not TipoMovtoAplicar - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - Exit Select - End If - Else - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - Exit Select - End If - - Next - End If - - Case "DevDinC" - 'asdasdasd - 'asdasdasdasd - Dim IdCtaContableAplicar = -1 - Dim ImporteAplicar = 0.0D - Dim ImporteAplicarMN = 0.0D - Dim ImporteAplicarME = 0.0D - Dim ReferenciaAplicar = ObjIE.Folio - - Dim ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {TxtImporte.Text} NC:{SerieFolioDeCDin}" - - ImporteAplicar = TxtImporte.Text.ToDecimal - ImporteAplicarME = ImporteAplicar - - - 'CONSIDERA COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - ImporteAplicarMN = ImporteAplicar - Else - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - End If - - Dim TCCompra As Decimal = 1 - Dim TCDocumento As Decimal = 1 - - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - - TCCompra = GlobalTipoCambio(FechaCompra).ToDecimal - TCDocumento = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToDecimal - - If TCCompra <= 0 Then - Alert("No se pudo obtener el tipo de cambio de la nota de crédito.", TipoMensaje.MsgAdvertencia) - End If - - If TCCompra <= 0 Then - Alert("No se pudo obtener el tipo de cambio del documentpo.", TipoMensaje.MsgAdvertencia) - End If - - End If - - - - 'BANCOS - IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" - Exit Select - End If - - - 'BANCOS COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCDocumento)) - ImporteAplicar).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, CveCuenta:=CveCuentaConta, TipoCambio:=TCDocumento) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - End If - - 'CANCELA NC - IdCtaContableAplicar = IDCtaBeneficiario - ImporteAplicarMN = ImporteAplicar ' (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, (ImporteAplicar), ReferenciaAplicar, 18, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=(ImporteAplicarMN), ImporteME:=ImporteAplicarME, TipoCambio:=TCCompra) Then - MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" - Exit Select - End If - - - 'NC COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - - ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TCCompra)) - ImporteAplicar).RoundSQL() - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -(ImporteAplicar), ReferenciaAplicar, 201, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-(ImporteAplicarMN), ImporteME:=-(ImporteAplicarME), CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - - End If - - If TCCompra <> TCDocumento Then - - Dim DiferenciaTC As Decimal = TCCompra - TCDocumento - - Dim DiferenciaImportes As Decimal = Math.Abs((ImporteAplicar * TCCompra) - (ImporteAplicar * TCDocumento)) - - If DiferenciaTC < 0 Then - '64 - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaImportes, ReferenciaAplicar, 64, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then - MsgError = "Ocurrió un error al registrar el asiento de ganancia cambiaria" - Exit Select - End If - - Else - '65 - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, DiferenciaImportes, ReferenciaAplicar, 65, ConceptoAplicar, Now, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=DiferenciaImportes, ImporteME:=0, CveCuenta:=CveCuentaConta, TipoCambio:=TCCompra) Then - MsgError = "Ocurrió un error al registrar el asiento de perdidada cfambiaria" - Exit Select - End If - - End If - - - - End If - - 'IMPUESTOS - - Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) - Dim CveConceptoContableAplciar = -1 - Dim TipoMovtoAplicar = False - - - Dim ObjCompras As New ClsCompras() - If ObjCompras.GetCompras(CveCompraDeCDin, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then - - Dim dr As DataRow = ObjCompras.DtResultados.Rows(0) - If dr IsNot Nothing Then - - Dim CveMonedaDev As Integer = dr("CveMoneda").ToString.ToEntero - Dim TotalCompraDev As Decimal = dr("Total").ToString.ToDecimal - - Dim IVADev As Decimal = dr("IVA").ToString.ToDecimal - Dim IEPSDev As Decimal = dr("IEPS").ToString.ToDecimal - PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal - - Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC) - Dim CveCuentaIVAxAcreditarDevDinC = 0 - Dim CveCuentaIVAAcreditableDevDinC = 0 - Dim IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero - Dim IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero - - - Dim IVADevMN As Decimal = 0 - Dim IEPSDevMN As Decimal = 0 - - - Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2) - - IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2) - IEPSDev = Math.Round(IEPSDev * PorcentajeDevolucion, 2) - - Dim CveCuentaDevolucionIMPUESTOS As Integer = -1 - Dim IdCtaIVADevolucionIMPUESTOS As Integer = -1 - - - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - IVADevMN = IVADev - IEPSDevMN = IEPSDev - Else - IVADevMN = (IVADev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2) - IEPSDevMN = (IEPSDev * If(CveMonedaDev = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL(2) - End If - - - Dim ErrorDevolucionImpuestos As Boolean = False - - If IVADev > 0 Then - - CveCuentaDevolucionIMPUESTOS = CveCuentaIVAxAcreditarDevDinC - IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then - - CveCuentaDevolucionIMPUESTOS = CveCuentaIVAAcreditableDevDinC - IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - ErrorDevolucionImpuestos = True - End If - Else - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - ErrorDevolucionImpuestos = True - - End If - End If - - - If IEPSDev > 0 Then - 'Dim ObjContabilidad As New ClsContabilidad - If ObjMov.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then - Try - CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero - IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 25, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then - - If ObjMov.GetRetCuenta(26, UsuarioActual.CveEmpresa) Then - Try - CveCuentaDevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero - IdCtaIVADevolucionIMPUESTOS = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, -IEPSDev, ReferenciaAplicar, 26, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IEPSDevMN, ImporteME:=-IEPSDev, CveCuenta:=CveCuentaDevolucionIMPUESTOS) Then - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - ErrorDevolucionImpuestos = True - End If - - - Catch ex As Exception - Alert("Se presento un error al obtener las cuentas de IEPS acreditable.") - ErrorDevolucionImpuestos = True - End Try - - End If - - Else - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - ErrorDevolucionImpuestos = True - End If - - Catch ex As Exception - Alert("Se presento un error al obtener las cuentas de IEPS acreditable.") - ErrorDevolucionImpuestos = True - End Try - End If - End If - - If ErrorDevolucionImpuestos Then - MsgError = MsgError & " Error en devolución compra." - End If - - - End If - End If - - - - Case "EGSCREDITO" - - Dim ConceptoContable As Integer - Dim TipoMovimiento As Boolean - Dim importeMovimiento As Decimal - Dim FechaMovimiento As Date = Now - Dim Concepto As String = "" - Dim Referencia As String = PagueseA - - Dim importeMX As Decimal - Dim Multiplicador As Integer - - If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then - - For Each Row As DataRow In ObjMov.DtResultados.Rows - - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) - importeMovimiento = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) - Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) - - Select Case ConceptoContable - - Case 30 - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - If tCveMoneda > 1 AndAlso UsuarioActual.CveEmpresa = 119 Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - Case 42 - - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - - - - Case 46 - If TxtInteresMoratorio.Text.ToDecimal > 0 Then - importeMovimiento = TxtInteresMoratorio.Text.ToDecimal - importeMX = importeMovimiento - Else - importeMovimiento = 0 - importeMX = 0 - End If - Case 48 - - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - - End Select - - If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, CveCuentaConta, CveCuentaBeneficiario)) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - - Next - End If - - Case Else - Dim TipoMovimiento As Boolean = True - - If Opcion.Contiene("ANTC") Then - TipoMovimiento = False - End If - - If CveConceptoCompra = 10 AndAlso DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - IDCtaBeneficiario = IdCtaAnticipoExtranjera - CveCuentaConta = 0 - End If - - 'MOVIMIENTOS EGRESOS - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaConta, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, TxtImporte.Text.ToDecimal - IVA - CIF, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DdlIEAcreedor.SelectedValue.ToEntero) Then - If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Ref, 19, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - MsgError = "Detalle" - End If - 'intereses pagados - If CIF > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, CIF, Ref, 46, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=CIF, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=CveCuentaBeneficiario, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - MsgError = "Detalle" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - - 'BANCOS COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then - Dim ImporteAplicar As Decimal = TxtImporte.Text.ToDecimal - Dim ImporteAplicarMN = (ImporteAplicar * TxtTipoCambio.Text.ToDecimal - ImporteAplicar).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAplicar, Ref, 204, Conc, Now, IDCtaContableComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, CveCuenta:=CveCuentaConta, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - - If CveConceptoCompra = 10 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, ImporteAplicar, Ref, 266, Conc, Now, IdCtaAnticipoComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, CveCuenta:=0, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - End If - - - End If - - - - If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then - If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then - MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." - End If - End If - - End Select - - 'El movimiento 1 es el de Venta - 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If CveCuentaBeneficiario > 0 And CveCuentaConta > 0 Then - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - IDPoliza = ObjMov.ContaIdPoliza - Else - Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) - End If - Else - If CveCuentaConta < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) - End If - If CveCuentaBeneficiario < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) - End If - End If - End If - - 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then - If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then - If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - IDPoliza = ObjMov.ContaIdPoliza - 'Alert(alertaContabilizacion & ObjMov.AlertaMensaje, ModExtensiones.TipoMensaje.MsgInformacion) - Else - Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) - End If - Else - If IDCtaContable < 1 Then - Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) - End If - If IDCtaBeneficiario < 1 Then - Alert("No se puede contabilizar la Prepoliza debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) - End If - End If - End If - - If UsuarioActual.Empresa.UsaAC Then - Dim ConceptoRenglon, Referencia As String - Dim FolioPoliza As Integer - Dim Fecha As Date = TxtFechaDocumento.Text.ToDate - Dim TipoChq As String = "" - Dim Total As Double = TxtImporte.Text.ToDouble - - Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) - Conta.IniciaTransacSQL() - - If DdlTipoTransaccion.SelectedValue = "1" Then TipoChq = "CHQ" - ConceptoRenglon = String.Format("Anticipo {0}", PagueseA) - - IDPoliza = Conta.AddPoliza(2, ConceptoRenglon, Total, Total, UsuarioActual.CveUsuario, Fecha, ObjIE.Folio, TipoChq) - - If IDPoliza > 0 Then - FolioPoliza = Conta.Folio - Referencia = ObjIE.Folio - ConceptoRenglon = String.Format("Anticipo {0} {1}", PagueseA, TxtObservaciones.Text) - - Total = TxtImporte.Text.ToDouble - - If Not Conta.AddMovimiento(IDPoliza, IDCtaContable, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" - - If Not Conta.AddMovimiento(IDPoliza, IDCtaBeneficiario, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" - - Else - MsgError = "No se insertó el encabezado" - End If - - If MsgError = "" Then - Conta.Commit() - - Conta.AjustaPoliza(IDPoliza) - 'actualizar la conta del IE - ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0) - Else - Conta.RollBack() - IDPoliza = 0 - End If - - Conta.Dispose() - End If - - 'Notificación de Pago - If TxtNotificarA.Text.Trim <> "" Then - NotificacionPago(CveIE, TxtNotificarA.Text.Trim) - End If - - Else - MsgError = "No se pudo insertar la póliza" - End If - - Else - MsgError = "No se insertó el encabezado" - End If - - End If - - Else - Msg.Append("El Documento se guardó correctamente.") - - End If - - 'SOLICITUD DE ANTICIPO OC - If MsgError = "" Then - MsgError = GuardaSolicitudAnticipoOC(ObjOC) - End If - - If MsgError = "" Then - 'VIATICOS - If ChkAplicaViatico.Checked Then - Dim Retorno As String = TimbrarNomina12(CvePersonal) - If Retorno <> "" Then MsgError = $"{MsgError} {Retorno}" : Msg.Clear() : CveIE = -1 - If Retorno <> "" Then - Alert(Retorno, TipoMensaje.MsgError) - End If - End If - End If - - If MsgError = "" Then - If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then - If ObjMov.ValorPolizaDescuadre > 0 Then - ' MsgError = ObjMov.MensajePolizaDescuadre - GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - End If - Else - MsgError = "No se pudo validar la prepoliza de cuadre." - End If - End If - - If MsgError = "" Then - 'IMPRIME CHEQUE - 'GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) - If Msg.ToString = "" Then - Msg.Append("El Documento se guardo correctamente") - End If - Dim Archivo As System.IO.FileInfo = Nothing - 'VERIFICA SI EXISTE EL FORMATO - If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) - ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) - If Not Archivo.Exists Then - Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)) - End If - ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) - End If - - If Archivo IsNot Nothing Then - If Archivo.Exists Then - Msg.AppendFormat("

    {1} ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) - End If - End If - - If IDPoliza > 0 Then - Msg.AppendFormat("

    Ver Póliza", IDPoliza) - End If - - 'AUTO DESCARGAR PDF PARA COMPU - If UsuarioActual.CveEmpresa.Contiene(72, 1, 2) And CveSolicitudViatico > 0 Then - If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1, 2, 6, 8, 9) Then - RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))}'", String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) - End If - End If - ObjIE.Commit() - - Else - ObjIE.RollBack() + Conta.Dispose() + End If + + 'Notificación de Pago + If TxtNotificarA.Text.Trim <> "" Then + NotificacionPago(CveIE, TxtNotificarA.Text.Trim) + End If + + Else + MsgError = "No se pudo insertar la póliza" + End If + + Else + MsgError = "No se insertó el encabezado" + End If + + End If + + Else + Msg.Append("El Documento se guardó correctamente.") + + End If + + 'SOLICITUD DE ANTICIPO OC + If MsgError = "" Then + MsgError = GuardaSolicitudAnticipoOC(ObjOC) + End If + + If MsgError = "" Then + 'VIATICOS + If ChkAplicaViatico.Checked Then + Dim Retorno As String = TimbrarNomina12(CvePersonal) + If Retorno <> "" Then MsgError = $"{MsgError} {Retorno}" : Msg.Clear() : CveIE = -1 + If Retorno <> "" Then + Alert(Retorno, TipoMensaje.MsgError) + End If + End If + End If + + If MsgError = "" Then + If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + ' MsgError = ObjMov.MensajePolizaDescuadre + GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + MsgError = "No se pudo validar la prepoliza de cuadre." + End If + End If + + If MsgError = "" Then + 'IMPRIME CHEQUE + 'GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) + If Msg.ToString = "" Then + Msg.Append("El Documento se guardo correctamente") + End If + Dim Archivo As System.IO.FileInfo = Nothing + 'VERIFICA SI EXISTE EL FORMATO + If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) + ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + If Not Archivo.Exists Then + Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", AppDomain.CurrentDomain.BaseDirectory)) + End If + ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + End If + + If Archivo IsNot Nothing Then + If Archivo.Exists Then + Msg.AppendFormat("

    {1} ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) + End If + End If + + If IDPoliza > 0 Then + Msg.AppendFormat("

    Ver Póliza", IDPoliza) + End If + + 'AUTO DESCARGAR PDF PARA COMPU + If UsuarioActual.CveEmpresa.Contiene(72, 1, 2) And CveSolicitudViatico > 0 Then + If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1, 2, 6, 8, 9) Then + RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))}'", String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) + End If + End If + + End If + Catch ex As Exception + MsgError = "Ocurrió un error al guardar el IE" + ex.ToString().GuardaLog() + End Try + + If MsgError = "" Then + ObjIE.Commit() + Else + ObjIE.RollBack() + + Alert(MsgError, TipoMensaje.MsgError) End If If Msg.ToString <> "" Then @@ -3288,7 +3263,6 @@ Partial Class Bancos_IE AccionJS = String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery) End If - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then AccionJS = $"document.location.href=""/Bancos/Creditos.aspx?CveCredito={Request("CveCredito")}"";" Alert(Msg.ToString, TipoMensaje.MsgInformacion, AccionJS) @@ -3296,18 +3270,15 @@ Partial Class Bancos_IE Alert(Msg.ToString, TipoMensaje.MsgInformacion, String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery)) End If - - - End If End If - RecargaGlobalCuentasBancarias() ObjIE.Dispose() ObjMov.Dispose() - If ObjComp IsNot Nothing Then ObjComp.Dispose() - - + ObjOC.Dispose() + If ObjComp IsNot Nothing Then ObjComp.Dispose() + + RecargaGlobalCuentasBancarias() End Sub #Region " NOTIFICACION PAGO " diff --git a/Bin/Microsoft.SqlServer.Types.dll b/Bin/Microsoft.SqlServer.Types.dll index d4dd78993..1ccde4ab4 100644 Binary files a/Bin/Microsoft.SqlServer.Types.dll and b/Bin/Microsoft.SqlServer.Types.dll differ diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 622ae3546..194981e48 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -5574,17 +5574,18 @@ Partial Class Compras_Compras End If - If TipoCambioCompra > 1 Then Concepto += $" TC:{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}" + If TipoCambioCompra > 1 AndAlso DdlMoneda.SelectedValue.ToEntero <> 1 Then Concepto += $" TC:{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}" - If TipoCambioCompra = 1 Then + If TipoCambioCompra = 1 Or DdlMoneda.SelectedValue.ToEntero = 1 Then IdCtaContable = CtaProveedor CveCuenta = CveCuentaProveedor + importeMovimiento = importeMN Else IdCtaContable = CtaProveedorComplementaria CveCuenta = CveCuentaProveedorComplementaria If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0) Then 'Cuando tiene complementaria lo dividimos en dos importeMN = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 201, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TipoCambioCompra - importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TipoCambioCompra) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento * TipoCambioCompra - importeMovimiento, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TipoCambioCompra - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TipoCambioCompra) Then ErrorPrepoliza = True End If End If @@ -5600,9 +5601,9 @@ Partial Class Compras_Compras End If importeMN = importeMovimiento * TCPago * Multiplicador - If TCPago > 1 Then Concepto += $" TC:{TCPago} ${importeMovimiento.FormatoNumero(2)}" + If TCPago > 1 AndAlso CveMonedaPago <> 1 Then Concepto += $" TC:{TCPago} ${importeMovimiento.FormatoNumero(2)}" - If TCPago = 1 Then + If TCPago = 1 Or CveMonedaPago = 1 Then IdCtaContable = IdCuentaBancaria CveCuenta = CveCuentaBancaria Else @@ -5610,7 +5611,7 @@ Partial Class Compras_Compras CveCuenta = CveCuentaBancariaComplementaria If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0) Then 'Cuando tiene complementaria lo dividimos en dos importeMN = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 201, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TCPago - importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento * TCPago - importeMovimiento, Referencia, 204, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * TCPago - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=TCPago) Then ErrorPrepoliza = True End If End If @@ -5656,7 +5657,7 @@ Partial Class Compras_Compras End If End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 14, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIva, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVA, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 14, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIva, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVA, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then ErrorPrepoliza = True End If End If @@ -5717,7 +5718,7 @@ Partial Class Compras_Compras End If End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 25, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIEPS, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIEPS, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 25, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaIEPS, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIEPS, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then ErrorPrepoliza = True End If End If @@ -5747,7 +5748,7 @@ Partial Class Compras_Compras 'Agregamos el Opuesto del 22 -> 15 If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then ErrorPrepoliza = True End If End If @@ -5801,7 +5802,7 @@ Partial Class Compras_Compras 'Agregamos el Opuesto del 184 -> 183 If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 183, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 183, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then ErrorPrepoliza = True End If End If @@ -5877,7 +5878,7 @@ Partial Class Compras_Compras 'Agregamos el Opuesto del 186 -> 185 If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 185, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 185, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioActual) Then ErrorPrepoliza = True End If End If @@ -5931,36 +5932,36 @@ Partial Class Compras_Compras If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" End If - End If - Case 23 'RetISR Acreditable - If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then - If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 1 Then - importeMovimiento = importeRetISRAcreditable - importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador - If CtaProveedorRetISR > 0 Then - IdCtaContable = CtaProveedorRetISR - CveCuenta = CveCuentaProveedorRetISR - ElseIf UsuarioActual.Empresa.Funcionalidad(316).ToEntero > 0 Then - IdCtaContable = UsuarioActual.Empresa.Funcionalidad(316).ToEntero - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - - 'Agregamos el Opuesto del 23 -> 16 - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If - End If - - If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" - End If - End If + End If + 'Case 23 'RetISR Acreditable + ' If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then + ' If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 1 Then + ' importeMovimiento = importeRetISRAcreditable + ' importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador + ' If CtaProveedorRetISR > 0 Then + ' IdCtaContable = CtaProveedorRetISR + ' CveCuenta = CveCuentaProveedorRetISR + ' ElseIf UsuarioActual.Empresa.Funcionalidad(316).ToEntero > 0 Then + ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(316).ToEntero + ' Else + ' If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then + ' If ObjConta.DtResultados.Rows.Count > 0 Then + ' IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero + ' End If + ' End If + ' End If + + ' 'Agregamos el Opuesto del 23 -> 16 + ' If importeMovimiento <> 0 Then + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 15, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + ' ErrorPrepoliza = True + ' End If + ' End If + + ' If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" + ' End If + ' End If Case 16 'Ret ISR X Acreditar If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 1 Then @@ -6003,34 +6004,34 @@ Partial Class Compras_Compras If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" End If - End If - Case 244 'RetISR Acreditable Terceros y Arrendamiento - If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then - If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 2 Then - importeMovimiento = importeRetISRAcreditable - importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador - If CtaProveedorRetISR > 0 Then - IdCtaContable = CtaProveedorRetISR - CveCuenta = CveCuentaProveedorRetISR - ElseIf UsuarioActual.Empresa.Funcionalidad(318).ToEntero > 0 Then - IdCtaContable = UsuarioActual.Empresa.Funcionalidad(318).ToEntero - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - 'Agregamos el Opuesto del 244 -> 243 - If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 243, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If - End If - If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" - End If - End If + End If + 'Case 244 'RetISR Acreditable Terceros y Arrendamiento + ' If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then + ' If DdlRetISRConcepto.Items.Count > 0 AndAlso DdlRetISRConcepto.SelectedValue.ToEntero = 2 Then + ' importeMovimiento = importeRetISRAcreditable + ' importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador + ' If CtaProveedorRetISR > 0 Then + ' IdCtaContable = CtaProveedorRetISR + ' CveCuenta = CveCuentaProveedorRetISR + ' ElseIf UsuarioActual.Empresa.Funcionalidad(318).ToEntero > 0 Then + ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(318).ToEntero + ' Else + ' If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then + ' If ObjConta.DtResultados.Rows.Count > 0 Then + ' IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero + ' End If + ' End If + ' End If + ' 'Agregamos el Opuesto del 244 -> 243 + ' If importeMovimiento <> 0 Then + ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 243, Concepto + If(tipoCambioActual > 1, $" TC: {tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}", ""), FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then + ' ErrorPrepoliza = True + ' End If + ' End If + ' If tipoCambioActual > 1 Then Concepto += $" TC:{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" + ' End If + ' End If Case 64 'Ganancia If TCPago <> 1 AndAlso TxtFechaPago.Text <> TxtFecha.Text Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria @@ -6227,8 +6228,8 @@ Partial Class Compras_Compras CostoIndirectoAcum176 += ImporteCI176 'se considera costoindirecto, para que la factura tiene en un concepto tipo servicio SumatoriaOCINV += (Dr(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total")).ToString.ToDecimal * tipoCambioActual) - (ImporteMN228 + ImporteMN229 - ImporteCI176) - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe228, Referencia, ConceptoContabilizacionME, Concepto, FechaMovimiento, IdCtaContableME, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=ImporteMN228, ImporteME:=ImporteME228, CveCuenta:=CveCuenta, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, TipoCambio:=TCAjuste, CveMovimientoAlmacen:=Dr("CveMovimientoAlmacen").ToString.ToEntero, Contabilizable:=SeContabiliza) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe229, Referencia, ConceptoContabilizacionMEComp, Concepto, FechaMovimiento, IdCtaContableMEComp, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=ImporteMN229, ImporteME:=ImporteME229, CveCuenta:=CveCuenta, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, TipoCambio:=TCAjuste, CveMovimientoAlmacen:=Dr("CveMovimientoAlmacen").ToString.ToEntero, Contabilizable:=SeContabiliza) Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe228, Referencia, ConceptoContabilizacionME, Concepto, FechaMovimiento, IdCtaContableME, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=ImporteMN228, ImporteME:=ImporteME228, CveCuenta:=CveCuenta, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, TipoCambio:=TCAjuste, CveMovimientoAlmacen:=CveMovimientoAlmacen, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe229, Referencia, ConceptoContabilizacionMEComp, Concepto, FechaMovimiento, IdCtaContableMEComp, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=ImporteMN229, ImporteME:=ImporteME229, CveCuenta:=CveCuenta, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero, TipoCambio:=TCAjuste, CveMovimientoAlmacen:=CveMovimientoAlmacen, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For End If @@ -6301,7 +6302,7 @@ Partial Class Compras_Compras Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - If importeMovimiento > 0 And ChkNCInvNC.Checked Or TxtTotal.Text.ToDecimal = 0 And ChkNCInvNC.Checked Then + If importeMovimiento > 0 Or TxtTotal.Text.ToDecimal = 0 Then RegistroCuentaPuente = True 'Conta ContPAQ If IdCtaContable = 0 Then diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 2cdfa5f01..aee05f84b 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -2941,9 +2941,11 @@ Partial Class PopUpVerFactura Dim params As New List(Of ReportParameter) Dim CveFolio = "" CreaDT() + Dim ReporteEmpresa As New System.IO.FileInfo(String.Format("{0}Formatos/OrdenServicio.rdlc", UsuarioActual.Empresa.Ruta)) If ObjOS.GetOrdenesServicios(CveOS, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - If ObjOS.DtResultados.Rows.Count > 0 Then + If ObjOS.DtResultados.Rows.Count > 0 Then + Dim dtOS As DataTable = ObjOS.DtResultados Dim dr As DataRow = dtOS.Rows(0) params.Add(New ReportParameter("Cliente", dr("Cliente").ToString)) @@ -2957,41 +2959,65 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("ClienteColonia", dr("Colonia").ToString)) params.Add(New ReportParameter("ClienteCiudad", dr("Ciudad").ToString)) params.Add(New ReportParameter("ClienteEstado", dr("Estado").ToString)) - CveFolio = dr("Folio").ToString + CveFolio = dr("Folio").ToString + + If ReporteEmpresa.Exists Then + params.Add(New ReportParameter("NoDeCliente", dr("CveCliente").ToString)) + params.Add(New ReportParameter("RFC", dr("RFC").ToString)) + params.Add(New ReportParameter("Vendedor", " ")) + params.Add(New ReportParameter("Correo", dr("Correo").ToString)) + params.Add(New ReportParameter("CodigoDeServicio", dr("CveOS").ToString)) + params.Add(New ReportParameter("Sucursal", dr("SubProyecto").ToString)) + params.Add(New ReportParameter("TipoServicio", dr("TipoServicio").ToString)) + params.Add(New ReportParameter("TipoEquipo", dr("TipoEquipo").ToString)) + params.Add(New ReportParameter("Descripcion", dr("Descripcion").ToString)) + params.Add(New ReportParameter("Copia", "Copia: Original")) + End If End If End If Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + If Not ReporteEmpresa.Exists Then + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + If ObjOS.GetOrdenesServiciosDetalle(CveOS) Then + TmpDTOS = ObjOS.DtResultados + End If + + If ObjOS.GetDetalleMateriales(-1, CveOS) Then + TmpDTMaterialesOS = ObjOS.DtResultados + End If - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - If ObjOS.GetOrdenesServiciosDetalle(CveOS) Then - TmpDTOS = ObjOS.DtResultados - End If - - If ObjOS.GetDetalleMateriales(-1, CveOS) Then - TmpDTMaterialesOS = ObjOS.DtResultados - End If - - Dim lrds As New List(Of ReportDataSource) - Dim rds As New ReportDataSource With {.Name = "DataSet2", .Value = TmpDTMaterialesOS} - Dim rds2 As New ReportDataSource With {.Name = "DataSet1", .Value = TmpDTOS} - - lrds.Add(rds) - lrds.Add(rds2) - - ImprimirPDF("Empresas/Grales/Formatos/OrdenServicio.rdlc", lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) - - ObjOS.Dispose() + Dim lrds As New List(Of ReportDataSource) + Dim rds As New ReportDataSource With {.Name = "DataSet2", .Value = TmpDTMaterialesOS} + Dim rds2 As New ReportDataSource With {.Name = "DataSet1", .Value = TmpDTOS} + + lrds.Add(rds) + lrds.Add(rds2) + ObjOS.Dispose() + + ImprimirPDF("Empresas/Grales/Formatos/OrdenServicio.rdlc", lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) + Else + Dim lrds As New List(Of ReportDataSource) + Dim rds As New ReportDataSource With {.Name = "DataSet2", .Value = TmpDTMaterialesOS} + Dim rds2 As New ReportDataSource With {.Name = "DataSet1", .Value = TmpDTOS} + + lrds.Add(rds) + lrds.Add(rds2) + ObjOS.Dispose() + + ImprimirPDF(String.Format("Empresas/{0}/Formatos/OrdenServicio.rdlc", UsuarioActual.CveEmpresa), lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) + End If End Sub Private Sub CreaDT() TmpDTOS = New DataTable diff --git a/Compras/RepNotasCredito.aspx.vb b/Compras/RepNotasCredito.aspx.vb index f5d63a35b..cd955ec5c 100644 --- a/Compras/RepNotasCredito.aspx.vb +++ b/Compras/RepNotasCredito.aspx.vb @@ -1,281 +1,281 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports Extensiones -Imports Microsoft.Reporting.WebForms - -Partial Class Compras_RepNotasCredito - Inherits ClsPaginas - -#Region "PROPIEDADES" - Private Property DtDatos As DataTable - Get - DtDatos = CType(ViewState("DtDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatos") = value - End Set - End Property -#End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedores.DataBind() - TxtFechaSaldar.Text = Now.ToShortDateString - CargaDatos() - End If - End Sub - - Private Sub CargaDatos() - Dim ObjCompras As New ClsCompras - Dim FechaI, FechaF As String - - If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1" - If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" - - - If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then - DtDatos = ObjCompras.DtResultados - CargaGrid("") - Else - Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError) - End If - - ObjCompras.Dispose() - End Sub - - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) - e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra")) - - End If - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - CargaDatos() - End Sub - - Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click - GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString) - - End Sub - - - Private Sub GenerarPDF(Optional Formato As String = "PDF") - If DtDatos IsNot Nothing Then - Dim StrFiltro As New StringBuilder - 'StrFiltro.AppendFormat(String.Format("Proveedor: {0}, Estatus: {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text)) - ' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Tipo Documento: {0}", DdlTipoComprobante.SelectedItem.Text) - If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor: {0}", DdlProveedores.SelectedItem.Text) - If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Estatus: {0}", DdlOpcion.SelectedItem.Text) - - If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio : {0}", txtFechaI.Text.ToDate.ToShortDateString) - If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin : {0}", txtFechaF.Text.ToDate.ToShortDateString) - - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - 'Dim dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"}) - Dim FechaI, FechaF As String - FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) - FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) - Dim params As New List(Of ReportParameter) - - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("FechaInicio", FechaI)) - params.Add(New ReportParameter("FechaFin", FechaF)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato) - Else - Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click - GenerarPDF() - End Sub - - Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click - For Each gr As GridViewRow In GvDatos.Rows - If gr.DataKey("CveCompra") <> "" Then - gr.FCCheckBox("Chk").Visible = True - HLSaldar.Visible = True - LnkHabilitarSaldar.Visible = False - UpDatos.Update() - End If - Next - End Sub - - Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim CvePrePoliza As Integer = 0 - Dim MsgError As String = "" - Dim IdCtaContable As Integer = 0 - Dim IdCtaContableComplementaria As Integer = 0 - Dim Importe As Decimal = 0 - Dim ImporteMN As Decimal = 0 - Dim ImporteComplementaria As Decimal = 0 - Dim CveMoneda As Integer = 0 - Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal - Dim TCCompra As Decimal = 0 - Dim Concepto As String = TxtConcepto.Text - Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119) - Dim MensajeAlert = New StringBuilder - - For Each gr As GridViewRow In GvDatos.Rows - If gr.FCCheckBox("Chk").Checked Then - IdCtaContable = 0 - IdCtaContableComplementaria = 0 - Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL - ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL - TCCompra = gr.DataKey("TipoCambio").ToDecimal - CveMoneda = gr.DataKey("CveMoneda").ToEntero - - CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 103, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If CveMoneda > 1 Then - IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero - ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL - Else - IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - - If UsaComplementaria AndAlso CveMoneda > 1 Then - ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL - IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - End If - - IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - - If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then - Dim difFluctuacion As Decimal = TC - TCCompra - Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida - Dim TipoMovtoFluctua As Boolean = True - Dim IdCtaContableFluctua As Integer - Dim CveCuenta As Integer = 0 - If difFluctuacion < 0 Then - CveConceptoFluctua = 65 - TipoMovtoFluctua = False - IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - Else - CveConceptoFluctua = 64 - TipoMovtoFluctua = True - IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria - End If - Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL) - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - End If - - If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - MsgError = ObjConta.MensajePolizaDescuadre - GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - If MensajeAlert.ToString = "" Then - MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente:
    ") - End If - MensajeAlert.AppendFormat("", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) - End If - End If - - If MsgError <> "" Then Exit For - - End If - Next - - - If MsgError = "" Then - ObjConta.Commit() - If MensajeAlert.ToString <> "" Then - Alert(MensajeAlert.ToString) - Else - Alert("Los movimientos fueron saldados correctamente.") - End If - Alert(MensajeAlert.ToString) - CargaDatos() - HLSaldar.Visible = False - RegistraScript("$('#DivSaldar').modal('hide')") - LnkHabilitarSaldar.Visible = True - Else - ObjConta.RollBack() - Alert(MsgError, TipoMensaje.MsgError) - End If - ObjConta.Dispose() - End Sub - Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) - - End Sub - - -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal) - - If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden) - End Sub - - Protected Sub CargaGrid(Orden As String) - Dim DV As DataView = Nothing - DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows) - If Orden <> String.Empty Then - GvDatos.DataSource = DV.ToTable() - Else - GvDatos.DataSource = DtDatos - End If - - GvDatos.DataBind() - UpDatos.Update() - DV.Dispose() - End Sub -#End Region - - -End Class +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class Compras_RepNotasCredito + Inherits ClsPaginas + +#Region "PROPIEDADES" + Private Property DtDatos As DataTable + Get + DtDatos = CType(ViewState("DtDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDatos") = value + End Set + End Property +#End Region + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedores.DataBind() + TxtFechaSaldar.Text = Now.ToShortDateString + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + Dim ObjCompras As New ClsCompras + Dim FechaI, FechaF As String + + If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1" + If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" + + + If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then + DtDatos = ObjCompras.DtResultados + CargaGrid("") + Else + Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError) + End If + + ObjCompras.Dispose() + End Sub + + Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) + e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra")) + + End If + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + + Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click + GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString) + + End Sub + + + Private Sub GenerarPDF(Optional Formato As String = "PDF") + If DtDatos IsNot Nothing Then + Dim StrFiltro As New StringBuilder + 'StrFiltro.AppendFormat(String.Format("Proveedor: {0}, Estatus: {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text)) + ' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Tipo Documento: {0}", DdlTipoComprobante.SelectedItem.Text) + If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor: {0}", DdlProveedores.SelectedItem.Text) + If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Estatus: {0}", DdlOpcion.SelectedItem.Text) + + If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio : {0}", txtFechaI.Text.ToDate.ToShortDateString) + If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin : {0}", txtFechaF.Text.ToDate.ToShortDateString) + + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + 'Dim dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"}) + Dim FechaI, FechaF As String + FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) + FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) + Dim params As New List(Of ReportParameter) + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("FechaInicio", FechaI)) + params.Add(New ReportParameter("FechaFin", FechaF)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato) + Else + Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click + GenerarPDF() + End Sub + + Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click + For Each gr As GridViewRow In GvDatos.Rows + If gr.DataKey("CveCompra") <> "" Then + gr.FCCheckBox("Chk").Visible = True + HLSaldar.Visible = True + LnkHabilitarSaldar.Visible = False + UpDatos.Update() + End If + Next + End Sub + + Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim CvePrePoliza As Integer = 0 + Dim MsgError As String = "" + Dim IdCtaContable As Integer = 0 + Dim IdCtaContableComplementaria As Integer = 0 + Dim Importe As Decimal = 0 + Dim ImporteMN As Decimal = 0 + Dim ImporteComplementaria As Decimal = 0 + Dim CveMoneda As Integer = 0 + Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal + Dim TCCompra As Decimal = 0 + Dim Concepto As String = TxtConcepto.Text + Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119) + Dim MensajeAlert = New StringBuilder + + For Each gr As GridViewRow In GvDatos.Rows + If gr.FCCheckBox("Chk").Checked Then + IdCtaContable = 0 + IdCtaContableComplementaria = 0 + Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL + ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL + TCCompra = gr.DataKey("TipoCambio").ToDecimal + CveMoneda = gr.DataKey("CveMoneda").ToEntero + + CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 103, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CveMoneda > 1 Then + IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero + ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL + Else + IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + + If UsaComplementaria AndAlso CveMoneda > 1 Then + ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL + IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + End If + + IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + + If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then + Dim difFluctuacion As Decimal = TC - TCCompra + Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida + Dim TipoMovtoFluctua As Boolean = True + Dim IdCtaContableFluctua As Integer + Dim CveCuenta As Integer = 0 + If difFluctuacion < 0 Then + CveConceptoFluctua = 65 + TipoMovtoFluctua = False + IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria + CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria + Else + CveConceptoFluctua = 64 + TipoMovtoFluctua = True + IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria + CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria + End If + Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + End If + + If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + MsgError = ObjConta.MensajePolizaDescuadre + GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + If MensajeAlert.ToString = "" Then + MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente:
    ") + End If + MensajeAlert.AppendFormat("", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) + End If + End If + + If MsgError <> "" Then Exit For + + End If + Next + + + If MsgError = "" Then + ObjConta.Commit() + If MensajeAlert.ToString <> "" Then + Alert(MensajeAlert.ToString) + Else + Alert("Los movimientos fueron saldados correctamente.") + End If + Alert(MensajeAlert.ToString) + CargaDatos() + HLSaldar.Visible = False + RegistraScript("$('#DivSaldar').modal('hide')") + LnkHabilitarSaldar.Visible = True + Else + ObjConta.RollBack() + Alert(MsgError, TipoMensaje.MsgError) + End If + ObjConta.Dispose() + End Sub + Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) + + End Sub + + +#Region "O R D E N A M I E N T O" + Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) + Dim Orden As String = "" + Dim Campo As String = "" + Dim Literal As Literal = Nothing + Const OrdenInicial As String = "" + Dim Arg(2) As String + + Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) + Campo = Arg(0) + Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal) + + If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then + ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) + Literal.Text = String.Format("") + Else + ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) + Literal.Text = String.Format("") + End If + Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString + ViewState("Orden") = Orden + CargaGrid(Orden) + End Sub + + Protected Sub CargaGrid(Orden As String) + Dim DV As DataView = Nothing + DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows) + If Orden <> String.Empty Then + GvDatos.DataSource = DV.ToTable() + Else + GvDatos.DataSource = DtDatos + End If + + GvDatos.DataBind() + UpDatos.Update() + DV.Dispose() + End Sub +#End Region + + +End Class diff --git a/Contabilidad/RepIVA.aspx b/Contabilidad/RepIVA.aspx index 254800fc3..fe925144c 100644 --- a/Contabilidad/RepIVA.aspx +++ b/Contabilidad/RepIVA.aspx @@ -1,268 +1,268 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %> - - - - - - - - Reporte de Impuestos - - -
  • - PDF -
  • -
  • - Excel -
  • -
  • - Ver Dlls en pesos -
  • - - - -
  • - Generar DIOT -
  • - -
    - - - -
    -
    - - - - - - - -
    -
    -
    - -
    -
    -
    - -
    -
    - - - - - - - - - - -   -
    -
    - -
    -
    - - - - - - - - - - -
    -
    - -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - -
    - - -

    IVA Trasladado

    - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - -
    -

    IEPS por Porcentaje

    - - - - - - - - - -
    -
    -

    IVA por Porcentaje

    - - - - - - - - -
    -
    -
    - -
    -
    - - - -

    IVA Acreditable

    - - - - - - - - - - - - - - - - - RetIVA
    Hon/Ser.Prof.
    -
    - - - -
    - - - - - - - - - <%-- - - - --%> - - - - - -
    -
    - -
    -

    IVA por Porcentaje

    - - - - - - - - -
    - -
    -
    -
    - -
    -
    - - - - - -
    - - - +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %> + + + + + + + + Reporte de Impuestos + + +
  • + PDF +
  • +
  • + Excel +
  • +
  • + Ver Dlls en pesos +
  • + + + +
  • + Generar DIOT +
  • + +
    + + + +
    +
    + + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +
    + + + + + + + + + + +   +
    +
    + +
    +
    + + + + + + + + + + +
    +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + + +

    IVA Trasladado

    + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +

    IEPS por Porcentaje

    + + + + + + + + + +
    +
    +

    IVA por Porcentaje

    + + + + + + + + +
    +
    +
    + +
    +
    + + + +

    IVA Acreditable

    + + + + + + + + + + + + + + + + + RetIVA
    Hon/Ser.Prof.
    +
    + + + +
    + + + + + + + + + <%-- + + + --%> + + + + + +
    +
    + +
    +

    IVA por Porcentaje

    + + + + + + + + +
    + +
    +
    +
    + +
    +
    + + + + + +
    + + + diff --git a/Contabilidad/RepIVA.aspx.cs b/Contabilidad/RepIVA.aspx.cs index 0730328b1..176f60830 100644 --- a/Contabilidad/RepIVA.aspx.cs +++ b/Contabilidad/RepIVA.aspx.cs @@ -1,316 +1,316 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI.WebControls; -using Extensiones; -using System.Data; -using static Extensiones.ModExtensiones; -using Microsoft.Reporting.WebForms; -using System.Activities.Expressions; -using System.Text; -using System.IO; - -public partial class Contabilidad_RepIVA : ClsPaginas -{ - #region PROPIEDADES - - private DataTable DtIVATrasladado - { - get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; } - set { ViewState["DtIVATrasladado"] = value; } - } - private DataTable DtIVAAcreditable - { - get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; } - set { ViewState["DtIVAAcreditable"] = value; } - } - private double TCEspecifico - { - get { return TCEspecifico = (double)ViewState["TCEspecifico"]; } - set { ViewState["TCEspecifico"] = value; } - } - - private int TipoCambio - { - get { return TipoCambio = (int)ViewState["TipoCambio"]; } - set { ViewState["TipoCambio"] = value; } - } - - #endregion - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - InicializaValores(); - - } - } - - public void InicializaValores() - { - TipoCambio = 1; - TCEspecifico = -1; - txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; - txtFechaF.Text = DateTime.Now.ToShortDateString(); - - LnkAccionesDIOT.Visible = true; - - } - - public void Consulta() - { - if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } - int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); - LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos - - ClsContabilidad ObjCont = new ClsContabilidad(); - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - GvT.DataSource = ObjCont.DtResultados; - DtIVATrasladado = ObjCont.DtResultados; - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIEPSA.DataSource = ObjCont.DtResultados; - } - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVAA.DataSource = ObjCont.DtResultados; - } - - } - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - GvA.DataSource = ObjCont.DtResultados; - DtIVAAcreditable = ObjCont.DtResultados; - if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0) - { - LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; - } - - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVA2.DataSource = ObjCont.DtResultados; - } - - - } - ObjCont.Dispose(); - GvT.DataBind(); - GvA.DataBind(); - GvIEPSA.DataBind(); - GvIVAA.DataBind(); - GvIVA2.DataBind(); - UpDatos.Update(); - } - - protected void BtnConsultar_Click(object sender, EventArgs e) - { - Consulta(); - } - - protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("CveVenta").ToEntero() < 1) - { - e.Row.CssClass = "Totales"; - } - } - } - - protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("CveCompra").ToEntero() < 1) - { - e.Row.CssClass = "Totales"; - } - if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 ) - { - Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) ); - - Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2); - if (dif > 1) - { - e.Row.ForeColor = System.Drawing.Color.Red; - e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err"; - - e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA"); - } - } - } - } - - protected void LnkPdf_Click(object sender, EventArgs e) - { - Imprimir("PDF"); - } - - protected void LnkExcel_Click(object sender, EventArgs e) - { - Imprimir("EXCEL"); - } - - public void Imprimir(String Opcion) - { - String FechaF; - if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" Fecha Final: {txtFechaF.Text}"; } - String FechaI; - if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } - if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0) - { - System.IO.FileInfo Imagen; - String logouri = ""; - - if (UsuarioActual.CveEmpresa.Contiene(119)) - { - Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta)); - logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); - } - else - { - Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)); - logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); - } - - List para = new List(); - para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)); - para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)); - para.Add(new CrystalParametro("Filtros", $"Filtros: {FechaI}{FechaF}")); - if (Imagen.Exists) - { - para.Add(new CrystalParametro("LogoPath", logouri)); - } - else - { - para.Add(new CrystalParametro("LogoPath", "")); - } - - DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); - string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; - para.Add(new CrystalParametro("Excel", Formato)); - - ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); - } - else - { - Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia); - } - } - - protected void BtnTipoCambio_Click(object sender, EventArgs e) - { - Consulta(); - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")); - } - - protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e) - { - TipoCambio = RblTipoCambio.SelectedValue.ToEntero(); - if (TipoCambio == 3) - { - LiEspecifico.Visible = true; - TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble(); - TxtEspecifico.Text = TCEspecifico.ToString(); - } - else - { - LiEspecifico.Visible = false; - } - UpBodyTipoCambio.Update(); - } - - - protected string GenerarDIOT() - { - System.Text.StringBuilder Respuesta = new System.Text.StringBuilder(); - - - - return Respuesta.ToString(); - } - - protected void LnkAccionesDIOT_Click(object sender, EventArgs e) - { - - ClsContabilidad Objconta = new ClsContabilidad(); - StringBuilder SBDIOT = new StringBuilder(); - int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); - - if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - - foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0) - { - SBDIOT.AppendLine( - Drow["TipoTercero"].ToString() + "|" + - Drow["TipoOperacion"].ToString() + "|" + - Drow["RFC"].ToString() +"|"+ - Drow["NumeroIDFiscal"].ToString() + "|" + - Drow["NombreExtranjero"].ToString() +"|"+ - Drow["PaisResidencia"].ToString() + "|" + - Drow["Nacionalidad"].ToString() +"|"+ - LV(Drow["valorActos1516"].ToString()) + "|"+ - LV(Drow["valorActos15"].ToString()) + "|" + - LV(Drow["ValorIvaNo1516"].ToString()) +"|"+ - - LV(Drow["valorActos1011"].ToString()) + "|" + - LV(Drow["valorActos10"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["ValorIvaNo10"].ToString()) + "|" + - LV(Drow["ValorIvaNo08"].ToString()) + "|" + - - LV(Drow["valorActosImp1516"].ToString()) + "|" + - LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + - - LV(Drow["valorActosImp10"].ToString()) + "|" + - LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + - - LV(Drow["IvaExentoImpo"].ToString()) + "|"+ - LV(Drow["IVACero"].ToString()) + "|" + - LV(Drow["IvaExento"].ToString()) + "|"+ - LV(Drow["IvaRetenido"].ToString()) + "|" + - LV(Drow["IvaDevoluciones"].ToString()) + "|"); - } - } - - Objconta.Dispose(); - - //MemoryStream ms = new MemoryStream(); - //TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8); - - //tw.Write(SBDIOT.ToString()); - - //tw.Flush(); - - //byte[] bytes = ms.ToArray(); - //ms.Close(); - - //Response.Clear(); - //Response.AppendHeader("Content-Length", text.Length.ToString()); - //Response.ContentType = "text/plain"; - //Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); - //Response.BinaryWrite(bytes); - //Response.End(); - - Response.Clear(); - Response.ClearHeaders(); - - Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString()); - Response.ContentType = "text/plain"; - Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); - - Response.Write(SBDIOT.ToString()); - Response.End(); - } - - protected string LV(string Valor ) - { - return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; +using static Extensiones.ModExtensiones; +using Microsoft.Reporting.WebForms; +using System.Activities.Expressions; +using System.Text; +using System.IO; + +public partial class Contabilidad_RepIVA : ClsPaginas +{ + #region PROPIEDADES + + private DataTable DtIVATrasladado + { + get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; } + set { ViewState["DtIVATrasladado"] = value; } + } + private DataTable DtIVAAcreditable + { + get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; } + set { ViewState["DtIVAAcreditable"] = value; } + } + private double TCEspecifico + { + get { return TCEspecifico = (double)ViewState["TCEspecifico"]; } + set { ViewState["TCEspecifico"] = value; } + } + + private int TipoCambio + { + get { return TipoCambio = (int)ViewState["TipoCambio"]; } + set { ViewState["TipoCambio"] = value; } + } + + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + InicializaValores(); + + } + } + + public void InicializaValores() + { + TipoCambio = 1; + TCEspecifico = -1; + txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; + txtFechaF.Text = DateTime.Now.ToShortDateString(); + + LnkAccionesDIOT.Visible = true; + + } + + public void Consulta() + { + if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } + int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); + LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos + + ClsContabilidad ObjCont = new ClsContabilidad(); + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvT.DataSource = ObjCont.DtResultados; + DtIVATrasladado = ObjCont.DtResultados; + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIEPSA.DataSource = ObjCont.DtResultados; + } + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVAA.DataSource = ObjCont.DtResultados; + } + + } + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvA.DataSource = ObjCont.DtResultados; + DtIVAAcreditable = ObjCont.DtResultados; + if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0) + { + LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; + } + + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVA2.DataSource = ObjCont.DtResultados; + } + + + } + ObjCont.Dispose(); + GvT.DataBind(); + GvA.DataBind(); + GvIEPSA.DataBind(); + GvIVAA.DataBind(); + GvIVA2.DataBind(); + UpDatos.Update(); + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + Consulta(); + } + + protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("CveVenta").ToEntero() < 1) + { + e.Row.CssClass = "Totales"; + } + } + } + + protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("CveCompra").ToEntero() < 1) + { + e.Row.CssClass = "Totales"; + } + if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 ) + { + Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) ); + + Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2); + if (dif > 1) + { + e.Row.ForeColor = System.Drawing.Color.Red; + e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err"; + + e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA"); + } + } + } + } + + protected void LnkPdf_Click(object sender, EventArgs e) + { + Imprimir("PDF"); + } + + protected void LnkExcel_Click(object sender, EventArgs e) + { + Imprimir("EXCEL"); + } + + public void Imprimir(String Opcion) + { + String FechaF; + if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" Fecha Final: {txtFechaF.Text}"; } + String FechaI; + if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } + if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0) + { + System.IO.FileInfo Imagen; + String logouri = ""; + + if (UsuarioActual.CveEmpresa.Contiene(119)) + { + Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta)); + logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); + } + else + { + Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)); + logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); + } + + List para = new List(); + para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)); + para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)); + para.Add(new CrystalParametro("Filtros", $"Filtros: {FechaI}{FechaF}")); + if (Imagen.Exists) + { + para.Add(new CrystalParametro("LogoPath", logouri)); + } + else + { + para.Add(new CrystalParametro("LogoPath", "")); + } + + DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); + string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; + para.Add(new CrystalParametro("Excel", Formato)); + + ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); + } + else + { + Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia); + } + } + + protected void BtnTipoCambio_Click(object sender, EventArgs e) + { + Consulta(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")); + } + + protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e) + { + TipoCambio = RblTipoCambio.SelectedValue.ToEntero(); + if (TipoCambio == 3) + { + LiEspecifico.Visible = true; + TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble(); + TxtEspecifico.Text = TCEspecifico.ToString(); + } + else + { + LiEspecifico.Visible = false; + } + UpBodyTipoCambio.Update(); + } + + + protected string GenerarDIOT() + { + System.Text.StringBuilder Respuesta = new System.Text.StringBuilder(); + + + + return Respuesta.ToString(); + } + + protected void LnkAccionesDIOT_Click(object sender, EventArgs e) + { + + ClsContabilidad Objconta = new ClsContabilidad(); + StringBuilder SBDIOT = new StringBuilder(); + int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); + + if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + + foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0) + { + SBDIOT.AppendLine( + Drow["TipoTercero"].ToString() + "|" + + Drow["TipoOperacion"].ToString() + "|" + + Drow["RFC"].ToString() +"|"+ + Drow["NumeroIDFiscal"].ToString() + "|" + + Drow["NombreExtranjero"].ToString() +"|"+ + Drow["PaisResidencia"].ToString() + "|" + + Drow["Nacionalidad"].ToString() +"|"+ + LV(Drow["valorActos1516"].ToString()) + "|"+ + LV(Drow["valorActos15"].ToString()) + "|" + + LV(Drow["ValorIvaNo1516"].ToString()) +"|"+ + + LV(Drow["valorActos1011"].ToString()) + "|" + + LV(Drow["valorActos10"].ToString()) + "|" + + LV(Drow["valorActosImp8"].ToString()) + "|" + + LV(Drow["ValorIvaNo10"].ToString()) + "|" + + LV(Drow["ValorIvaNo08"].ToString()) + "|" + + + LV(Drow["valorActosImp1516"].ToString()) + "|" + + LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + + + LV(Drow["valorActosImp10"].ToString()) + "|" + + LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + + + LV(Drow["IvaExentoImpo"].ToString()) + "|"+ + LV(Drow["IVACero"].ToString()) + "|" + + LV(Drow["IvaExento"].ToString()) + "|"+ + LV(Drow["IvaRetenido"].ToString()) + "|" + + LV(Drow["IvaDevoluciones"].ToString()) + "|"); + } + } + + Objconta.Dispose(); + + //MemoryStream ms = new MemoryStream(); + //TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8); + + //tw.Write(SBDIOT.ToString()); + + //tw.Flush(); + + //byte[] bytes = ms.ToArray(); + //ms.Close(); + + //Response.Clear(); + //Response.AppendHeader("Content-Length", text.Length.ToString()); + //Response.ContentType = "text/plain"; + //Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); + //Response.BinaryWrite(bytes); + //Response.End(); + + Response.Clear(); + Response.ClearHeaders(); + + Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString()); + Response.ContentType = "text/plain"; + Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); + + Response.Write(SBDIOT.ToString()); + Response.End(); + } + + protected string LV(string Valor ) + { + return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; + } } \ No newline at end of file diff --git a/Empresas/Grales/Formatos/RepClientesCxC.rpt b/Empresas/Grales/Formatos/RepClientesCxC.rpt index 85aa597c6..3e2e401dd 100644 Binary files a/Empresas/Grales/Formatos/RepClientesCxC.rpt and b/Empresas/Grales/Formatos/RepClientesCxC.rpt differ diff --git a/GPS/CatRemisionesVehiculos.aspx b/GPS/CatRemisionesVehiculos.aspx index c4e4b997e..f60e75505 100644 --- a/GPS/CatRemisionesVehiculos.aspx +++ b/GPS/CatRemisionesVehiculos.aspx @@ -1,180 +1,174 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="CatRemisionesVehiculos.aspx.vb" Inherits="GPS_CatRemisionesVehiculos" %> - - - - - - - -
  • - - Ver Remisiones - -
  • -
    - -
    - - - - - - - - - - - - -
    + diff --git a/GPS/CatRemisionesVehiculos.aspx.vb b/GPS/CatRemisionesVehiculos.aspx.vb index 69a7979ab..f2660c6f5 100644 --- a/GPS/CatRemisionesVehiculos.aspx.vb +++ b/GPS/CatRemisionesVehiculos.aspx.vb @@ -42,14 +42,12 @@ Partial Class GPS_CatRemisionesVehiculos Dim ObjTSoft As New ClsTSoft If ObjTSoft.GetRemisiones(UsuarioActual.CveCliente) Then GvRemisiones.DataSource = ObjTSoft.DtResultados - Else - GvRemisiones.DataSource = Nothing End If If ObjTSoft.GetEstatusRemisiones() Then DdlEstatus.DataSource = ObjTSoft.DtResultados End If - - ObjTSoft.Dispose() + ObjTSoft.Dispose() + DdlEstatus.DataBind() GvRemisiones.DataBind() UPConsulta.Update() @@ -91,16 +89,16 @@ Partial Class GPS_CatRemisionesVehiculos UpContratos.Update() End Sub Protected Sub BtnActualizarEstatus_Click(sender As Object, e As EventArgs) - Dim ObjSoft As New ClsTSoft - Dim TrackingNo As String = If(TxtTracking.Text <> "", TxtTracking.Text, "-1") - Dim NumRemolque As String = If(TxtNoRemolque.Text <> "", TxtNoRemolque.Text, "-1") + Dim TrackingNo As String = If(TxtTracking.Text <> "", TxtTracking.Text, "-1") + Dim NumRemolque As String = If(TxtNoRemolque.Text <> "", TxtNoRemolque.Text, "-1") + Dim ObjSoft As New ClsTSoft If ObjSoft.UpdateEstatusRemisiones(CveRemision, DdlEstatus.SelectedValue.ToEntero, TrackingNo, NumRemolque) Then Alert("El estatus se actualizó correctamente") - End If + End If + ObjSoft.Dispose() TxtNoRemolque.Text = "" TxtTracking.Text = "" - ObjSoft.Dispose() CargaDatos() RegistraScript("$('#C_BtnCerrarContrato').click();") End Sub @@ -108,17 +106,19 @@ Partial Class GPS_CatRemisionesVehiculos RegistraScript("$('#C_BtnCerrarContrato').click();") End Sub Protected Sub imgHistorial_Click(sender As Object, e As EventArgs) - Dim ObjSoft As New ClsTSoft Dim Boton = CType(sender, LinkButton) Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow) - CveRemision = Boton.CommandArgument.ToEntero + CveRemision = Boton.CommandArgument.ToEntero + + Dim ObjSoft As New ClsTSoft If ObjSoft.GETRemisionesHistorial(GvRow.DataKey("FolioRemision").ToString, GvRow.DataKey("NoEconomico").ToString) Then GVHistorico.DataSource = ObjSoft.DtResultados End If ObjSoft.Dispose() + H1.InnerText = $"Histórico Remisión: {GvRow.DataKey("FolioRemision").ToString} " GVHistorico.DataBind() UpHistorico.Update() - RegistraScript("$('#dvHistorico').modal();") + RegistraScript("$('#dvHistorico').modal('show');") End Sub End Class diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 969fe1031..20bb83ab8 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1524,6 +1524,7 @@ Partial Class Inventarios_EntradasSalidas Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & DdlConcepto.SelectedValue).ToEntero If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True + TipoMovtoOtro = Not TipoMovtoAlmacen Dim CveConceptoContable As Integer = 78 Dim CveClasificacion As Integer = -1 @@ -1538,6 +1539,7 @@ Partial Class Inventarios_EntradasSalidas Case 30 CveConceptoContable = 181 + TipoMovtoOtro = False If UsuarioActual.Empresa.Funcionalidad(342).ToEntero > 0 Then IdCtaContableOtro = UsuarioActual.Empresa.Funcionalidad(342).ToEntero End If diff --git a/Inventarios/RecepcionUsados.aspx b/Inventarios/RecepcionUsados.aspx index 672c93586..cd25a6832 100644 --- a/Inventarios/RecepcionUsados.aspx +++ b/Inventarios/RecepcionUsados.aspx @@ -65,9 +65,9 @@
  • Traspaso Almacen
  • - <%--
  • - + <%--
  • +
  • --%>
  • Ver PrePóliza @@ -94,7 +94,7 @@
    - Información del movimiento + Información del movimiento
    @@ -120,11 +120,11 @@ - <%-- -
    - - - + <%-- +
    + + +
    --%>
    @@ -151,7 +151,7 @@
    - +
    @@ -242,7 +242,7 @@
    @@ -298,7 +298,7 @@
    -   +   Sucursal: @@ -347,7 +347,7 @@ ">
    - Agregar Producto + Agregar Producto
    @@ -414,14 +414,14 @@
    - Información de registro + Información de registro
    @@ -431,7 +431,7 @@
    @@ -440,7 +440,7 @@
    @@ -453,7 +453,7 @@
    @@ -463,7 +463,7 @@
    @@ -472,7 +472,7 @@
    @@ -490,7 +490,7 @@
    - Tipo de Cambio + Tipo de Cambio
    @@ -557,9 +557,6 @@ - - - - - - @@ -597,12 +591,16 @@ - - + + + + + + @@ -612,13 +610,22 @@ - - +
    +
    +
    +
    + $ + +
    + +
    +
    +
    +

    -
    @@ -628,10 +635,8 @@ -

    -

    @@ -642,14 +647,9 @@

    -
    - -
    - - <%-- EMPIEZA: BITACORA --%> @@ -691,9 +691,7 @@
    -
    - - <%-- TERMINA: BITACORA --%> @@ -741,7 +738,6 @@ -
  • - Imprimir -
  • - -
  • - Imprimir Cotización -
  • - -
  • - Generar Anticipo -
  • - -
  • - Generar Venta -
  • -
  • - Recibir Mercancía -
  • - -
  • - Solicitar Anticipo -
  • -
  • - Agregar PS -
  • -
  • - Importar Listado -
  • -
  • - Descargar Formato -
  • -
  • - Generar por Contrato -
  • -
  • - Verificar Existencias -
  • - -
  • - -
  • - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    -
    - - Datos de Orden -
    -
    - -
    -
    -
    -
    - <%--linea 1--%> -
    - - - - -
    - - - - - - -
    -
    - <%--linea 2--%> -
    -
    - -
    - -
    -
    - -
    - -
    -
    - - - <%--linea 3--%> -
    - -
    - - - -
    -
    - <%--linea 4--%> -
    - -
    - - - - -
    -
    - <%--linea 5--%> -
    - - -
    -
    - - -
    -
    - -
    - -
    -
    - -
    +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OC.aspx.vb" EnableEventValidation="false" Inherits="OC" %> + + + + + + +
  • + Imprimir +
  • + +
  • + Imprimir Cotización +
  • + +
  • + Generar Anticipo +
  • + +
  • + Generar Venta +
  • +
  • + Recibir Mercancía +
  • + +
  • + Solicitar Anticipo +
  • +
  • + Agregar PS +
  • +
  • + Importar Listado +
  • +
  • + Descargar Formato +
  • +
  • + Generar por Contrato +
  • +
  • + Verificar Existencias +
  • + +
  • + +
  • +
    + + + +
    +
    + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    +
    + + Datos de Orden +
    +
    + +
    +
    +
    +
    + <%--linea 1--%> +
    + + + + +
    + + + + + + +
    +
    + <%--linea 2--%> +
    +
    + +
    + +
    +
    + +
    + +
    +
    + + + <%--linea 3--%> +
    + +
    + + + +
    +
    + <%--linea 4--%> +
    + +
    + + + + +
    +
    + <%--linea 5--%> +
    + + +
    +
    + + +
    +
    + +
    + +
    +
    + +
      -
    -
    -
    - <%--linea 6--%> - - -
    - -
    - -
    - - - - - - -
    -
    - -
    - -
    -
    - -
    -
    - -
    - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - -
    - -
    - - 8% - 16% - 0% - -
    -
    -
    -
    - <%--linea 7--%> -
    - <%----%> -
    - - -
    -
    - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - - Estatus -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Estatus: - - -
    -
    Cotización: - -
    Vendedor:
    F. Registro: - - - - - - -
    Contabilizada:  - -
    Capturó: -
    -
    -
    - -
    -
    - - CFDI Versión 3.3 -
    -
    Uso CFDI: - - - -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    - - Anticipo -
    -
    - -
    -
    -
    -
    -
    Folio:
    -
    - -
    -
    - $ - -
    -
    -
    -
    -
    -
    -
    -
    - - <%--PROMOCION--%> -
    -
    - - -
    -
    -
    - - PROMOCIONES -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - -
    - -
    -
    - - Historial de Seguimiento -
    -
    - -
    -
    - -
    - - - - - - - - - - - -
    "> - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - Atención! - Ver Bitácora -
    -
    - -
    -
    - - -
    -
    -
    - - DATOS DE VENTA -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    + +
    +
    +
    + <%--linea 6--%> + + +
    + +
    + +
    + + + + + + +
    +
    + +
    + +
    +
    + +
    +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    +
    + +
    +
    + + +
    + +
    + + 8% + 16% + 0% + +
    +
    +
    +
    + <%--linea 7--%> +
    + <%----%> +
    + + +
    +
    + +
    +
    +
    + + +
    + +
    + +
    +
    +
    +
    +
    + + Estatus +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Estatus: + + +
    +
    Cotización: + +
    Vendedor:
    F. Registro: + + + + + + +
    Contabilizada:  + +
    Capturó: +
    +
    +
    + +
    +
    + + CFDI Versión 3.3 +
    +
    Uso CFDI: + + + +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    +
    + + Anticipo +
    +
    + +
    +
    +
    +
    +
    Folio:
    +
    + +
    +
    + $ + +
    +
    +
    +
    +
    +
    +
    +
    + + <%--PROMOCION--%> +
    +
    + + +
    +
    +
    + + PROMOCIONES +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + +
    + +
    +
    + + Historial de Seguimiento +
    +
    + +
    +
    + +
    + + + + + + + + + + + +
    "> + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + Atención! + Ver Bitácora +
    +
    + +
    +
    + + +
    +
    +
    + + DATOS DE VENTA +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    Cliente: -
    -
    - -<%-- - --%> -
    -
    + +
    +
    + + <%-- + --%> +
    +
    Vendedor: -
    -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    + +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    Lugar Entrega: -
    -
    - - -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - -
    -
    -
    - - Presupuesto Egresos General -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - -
    -
    -
    -
    - <%--$--%> - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - <%-- style="overflow-x: auto; min-width: 980px; width: 100%;" --%> -
    - - - - - - + + +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + Presupuesto Egresos General +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + <%--$--%> + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + <%-- style="overflow-x: auto; min-width: 980px; width: 100%;" --%> +
    + + +
    Cantidad
    + + + + +
    + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - -
    Cantidad Tipo OC -
    - -
    Clasificación (+) - Producto o Servicio(+)UnidadObservación -
    - -
    Activo FijoPOAP.U.Desc.TotalComandos - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - POA + Producto o Servicio(+) + UnidadObservación +
    + +
    Activo FijoPOAP.U.Desc.TotalComandos + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + + + POA - - - - - - - - - -
    - -
    - - - - - - - - - Agregar - -
    - - <%--ActivoFijo--%> -
    - -
    - - - -
    - -
    - -
    - - - - - -
    -
    -
    -
    - - + --%> + + + + +
    +
    +
    +
    +
    +
    +
    + <%----%> + Cotizaciones Rapidas +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Subtotal: + +
    Descuento: + +
    Subtotal 2: + +
    IVA: + + + + +
    IEPS: + +
    Ret IVA: + +
    Ret ISR: + +
    Total: + + + + + + + + + + +
    +
    +
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + +
    +
    +
    +
    + +    - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - -
    "> - -
    -
    - -
    - - - - - - -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    "> + +
    +
    + +
    + + + + + + +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- - --%> - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- DIV CANCELAR OC --%> - - <%-- FIN DIV CANCELAR OC --%> - -
    -
    -
    - -
    -
    -
    - - Opciones -
    -
    - -
    -
    - - - - - - + + + + + + + + + + + + + +
    - + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- DIV CANCELAR OC --%> + + <%-- FIN DIV CANCELAR OC --%> + +
    +
    +
    + +
    +
    +
    + + Opciones +
    +
    + +
    +
    + + + + + + - - - - + + + + - - - - - + + + + + - - -
    + Asignar a: - - - - - - - - - - -
    - + + + + + + + + + + + +
    + <%--
    Cancelar
    --%> -
    - +
    + <%--
    Cancelar
    --%> -
    -
    -
    - -
    -
    -
    - - - -
    -
    -
    -
    -
    - <%----%> - Bitácora -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    - - - - - - - <%-- End Modal --%> -
    -
    - - - -
    -
    -
    - <%----%> - Historial -
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -
    - -
    +
    +
    +
    + + + + Factura + + + + + + Fecha + + + + + + Cantidad + + + + + + UM + + + + + + Clasificación + + + + + + Producto o Servicio + + + + + + Total + + + + + + Moneda + + + + + + Proveedor + + + + + + + + + +
    +
    +
    +
    +
    + + + + <%--CANCELAR--%> <%----%> - - - - - - - - + + +
    +
    + <%-- FIN OC X SURTIR --%> + + +
    + + + + + + + + + + + + + + + + + + + + - - - + + + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 6849f8e1d..4d035618e 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -174,6 +174,14 @@ Partial Class OC ViewState("NumCotizacionesGanadoras") = value End Set End Property + Private Property NumCotizacionesEvaluar As Integer + Get + NumCotizacionesEvaluar = IfNull(ViewState("NumCotizacionesEvaluar"), "-1", ViewState("NumCotizacionesEvaluar")).ToString().ToEntero() + End Get + Set(value As Integer) + ViewState("NumCotizacionesEvaluar") = value + End Set + End Property Private Property ProveedoresCotizacion As ArrayList Get ProveedoresCotizacion = DirectCast(ViewState("ProveedoresCotizacion"), ArrayList) @@ -964,7 +972,7 @@ Partial Class OC DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer)) DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double)) - DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) + 'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) ' DtDetalle.Columns.Add("ClasificacionOG", GetType(String)) @@ -1223,9 +1231,11 @@ Partial Class OC DdlPrioridad.SelectedValueExist(objOC.Prioridad.ToString) ChkCotizacion.Checked = objOC.RequiereCotizacion + If ChkCotizacion.Checked AndAlso UsuarioActual.Empresa.Funcionalidad(565) = "1" Then ChkCotizacion.Enabled = False End If + tabCotizaciones.Enabled = objOC.RequiereCotizacion tabCotizaciones.UpdatePanelID = uppOpciones.ID TxtGuia.Text = objOC.Guia @@ -1576,6 +1586,11 @@ Partial Class OC 'CARGA MOVTOS DE ALMACEN InicializaMovtosAlmacen() + If UsuarioActual.Empresa.Funcionalidad(565) = "1" And pCveOrdenCompra > 0 And TipoOC.ToUpper() = "REQ" Then + RowCotizaciones.Visible = True + UpIvas.Update() + End If + uppEstatus.Update() End Sub @@ -2058,6 +2073,12 @@ Partial Class OC Private Function ValidaGuardar() As Boolean Dim TieneError = False + 'Entrega Directa requiere Cliente y Vendedor + If ChkEntregaDirecta.Checked And Ddlcliente.SelectedValue.ToEntero <= 0 Then + Alert("Al ser una Entrega Directa es necesario seleccionar un cliente, por favor seleccione uno.") + Return True + End If + 'VALIDA QUE TENGA REGISTROS If Not GvD.Rows.Count > 0 Then Alert(String.Format("La {0} debe de tener registros", TipoLargo), TipoMensaje.MsgAdvertencia) @@ -2196,14 +2217,22 @@ Partial Class OC End If 'VALIDA QUE TENGA LAS COTIZACIONES QUE DEBEN TENER - If UsuarioActual.Empresa.Funcionalidad(565) = "1" AndAlso CveConfianzaProveedor > 0 AndAlso (TipoOC.ToUpper = "REQ" And CveEstatusFinalOK = CboE.SelectedValue.ToEntero) Then + If UsuarioActual.Empresa.Funcionalidad(565) = "1" AndAlso (TipoOC.ToUpper = "REQ" And CveEstatusFinalOK = CboE.SelectedValue.ToEntero) Then If CveConfianzaProveedor > 0 Then + 'SUMA EL TOTAL DE COTIZACIONES + For Each GvRow As GridViewRow In GvBitacoraEva.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + Me.NumCotizacionesEvaluar += 1 + End If + Next - If CveConfianzaProveedor = 1 AndAlso Me.NumCotizaciones < 1 Then - Alert("Para el proveedor seleccionado es necesario terner al menos 1 cotización.", TipoMensaje.MsgAdvertencia) + Me.NumCotizacionesEvaluar += Me.NumCotizaciones + + If CveConfianzaProveedor = 1 AndAlso Me.NumCotizacionesEvaluar < 1 Then + Alert("Para el proveedor seleccionado es necesario tener al menos 1 cotización.", TipoMensaje.MsgAdvertencia) TieneError = True - ElseIf CveConfianzaProveedor = 2 AndAlso Me.NumCotizaciones < 2 Then - Alert("Para el proveedor seleccionado es necesario terner al menos 2 cotizaciones", TipoMensaje.MsgAdvertencia) + ElseIf CveConfianzaProveedor = 2 AndAlso Me.NumCotizacionesEvaluar < 2 Then + Alert("Para el proveedor seleccionado es necesario tener al menos 2 cotizaciones", TipoMensaje.MsgAdvertencia) TieneError = True End If @@ -2222,12 +2251,6 @@ Partial Class OC End Function Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click - 'Entrega Directa requiere Cliente y Vendedor - If ChkEntregaDirecta.Checked And Ddlcliente.SelectedValue.ToEntero <= 0 Then - Alert("Al ser una Entrega Directa es necesario seleccionar un cliente, por favor seleccione uno.") - Exit Sub - End If - 'VALIDACIONES PARA GUARDAR If ValidaGuardar() Then Exit Sub @@ -4501,18 +4524,48 @@ Partial Class OC End If End If End Sub + Protected Sub GvBitacoraEva_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvBitacoraEva.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Archivo").ToString.Trim <> "" AndAlso CveOrdenCompra > 0 Then + e.Row.FCLinkButton("LinkArchivo").Visible = True + e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione + End If + End If + End Sub + Protected Sub LnkAddCotEva_Click(sender As Object, e As EventArgs) Handles LnkAddCotEva.Click + HdnEsCotizacion.Value = "1" + ChkEventoPrioridad.Visible = False + HBitacora.InnerText = "Cotización" + LblBitacora.InnerText = "Cotización" + + UPAddEventoBitacora.Update() + UpTituloBitacora.Update() + RegistraScript("$('#ModalBitacora').modal('show');") + End Sub + Protected Sub ImgAddObs_Click(sender As Object, e As EventArgs) Handles ImgAddObs.Click + HdnEsCotizacion.Value = "0" + ChkEventoPrioridad.Visible = True + HBitacora.InnerText = "Bitácora" + LblBitacora.InnerText = "Bitácora/Observaciones" + + UPAddEventoBitacora.Update() + UpTituloBitacora.Update() + RegistraScript("$('#ModalBitacora').modal('show');") + End Sub Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click If CveOrdenCompra > 0 Then - GuardaBitacora() + GuardaBitacora(HdnEsCotizacion.Value.ToEntero() > 0) Else AgregaBitacoraTemporal() End If End Sub + #Region " GUARDA DIRECTO " - Private Sub GuardaBitacora() + Private Sub GuardaBitacora(Optional EsCotizacion As Boolean = False) Dim ObjEventoBitacora As New ClsOIEventos Dim FileExtension As String = "" Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos @@ -4523,7 +4576,7 @@ Partial Class OC Next Dim descripcion As String = TxtEventoDescripcion.Text.Trim - Dim Prioridad As Integer = If(ChkEventoPrioridad.Checked, 3, 1) + Dim Prioridad As Integer = If(EsCotizacion, 4, If(ChkEventoPrioridad.Checked, 3, 1)) If ObjEventoBitacora.AddEventoBitacora(descripcion, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, CveEmpresaActual, CveOC:=CveOrdenCompra, Prioridad:=Prioridad) Then @@ -4535,7 +4588,7 @@ Partial Class OC TxtEventoDescripcion.Text = "" Anexo.Text = "[]" ChkEventoPrioridad.Checked = False - Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) + Alert($"La {If(EsCotizacion, "cotización", "bitácora/observación")} se guardó correctamente", TipoMensaje.MsgInformacion) RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") 'obtener el Evento de bitacora para enviar el correo @@ -4562,7 +4615,8 @@ Partial Class OC If ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento IN (6,2) AND CvePrioridad=3").Rows.Count > 0 Then DivEventoUrgente.Visible = True End If - GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento IN (6,2)") + GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento IN (6,2) AND CvePrioridad <> 4") + GvBitacoraEva.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CvePrioridad = 4") Else GvEB.DataSource = Nothing End If @@ -4570,7 +4624,9 @@ Partial Class OC ObjEventoBitacora.Dispose() GvEB.DataBind() + GvBitacoraEva.DataBind() UPEventoBitacora.Update() + UpIvas.Update() End Sub #End Region @@ -4638,7 +4694,7 @@ Partial Class OC ChkEventoPrioridad.Checked = False RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") - CargaEventoBitacoraTemp() + CargaEventoBitacoraTemp() End Sub @@ -4703,7 +4759,7 @@ Partial Class OC option72.Visible = True DivFolioAdicional.Visible = True generarAnticipo.Visible = True - Ddlcliente.DataSource = GlobalDTCliente(CveEmpresaActual).FiltraParametros(" Estatus = 'Activo' ") + Ddlcliente.DataSource = GlobalDTCliente(CveEmpresaActual) Ddlcliente.DataBind() Ddlcliente.Items.Insert(0, New ListItem(" - ", "-1")) DdlVendedor.DataSource = GlobalDTVendedores(CveEmpresaActual) diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index e586d230e..5ac87f648 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -247,6 +247,24 @@ Partial Class OS_OrdenesServicios ViewState("CveTecnico") = value End Set End Property + + Private Property ClienteRFC As String + Get + Return ViewState("ClienteRFC").ToString + End Get + Set(value As String) + ViewState("ClienteRFC") = value + End Set + End Property + + Private Property ClienteMail As String + Get + Return ViewState("ClienteMail").ToString + End Get + Set(value As String) + ViewState("ClienteMail") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -313,7 +331,7 @@ Partial Class OS_OrdenesServicios 'Carga OS If CveOS > 0 Then - CargaEstatusOS() + 'CargaEstatusOS() CargaDatos() 'PermisosSegunEstatus() CargaDetalles() @@ -336,11 +354,11 @@ Partial Class OS_OrdenesServicios TxtFechaRecibido.Text = Now.ToString("dd/MM/yyy") ViewState("CveOS") = -1 DdlEstatusOS.Enabled = False + CargaEstatusOS() End If hdnEsThickbox.Value = "S" hdnClientIDLink.Value = "NoDefinido" - End If End Sub @@ -417,9 +435,13 @@ Partial Class OS_OrdenesServicios DdlSubProyecto.Items.Clear() DdlSubProyecto.SelectedValue = Nothing DdlSubProyecto.DataSource = ObjOS.DtResultados.FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"}) - DdlSubProyecto.DataBind() + If CveSubProyecto > 0 Then DdlSubProyecto.SelectedValueExist(CveSubProyecto) + DdlEstatusOS.DataSource = ObjOS.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0}", CveSubProyecto), "", {"CveEstatusOrdenServicio", "EstatusOrdenServicio"}) End If + ObjOS.Dispose() + DdlSubProyecto.DataBind() + DdlEstatusOS.DataBind() End Sub Private Sub CargaTiposOrden() Dim ObjOS As New ClsOS @@ -430,11 +452,10 @@ Partial Class OS_OrdenesServicios Else DdlTipoOrdenOS.DataSource = Nothing End If - + ObjOS.Dispose() DdlTipoOrdenOS.DataBind() DdlTipoOrdenOS.Items.Insert(0, New ListItem("Seleccione", "-1")) - ObjOS.Dispose() End Sub Private Sub CargaDatos() Dim ObjOS As New ClsOS() @@ -708,6 +729,8 @@ Partial Class OS_OrdenesServicios ClienteEstado = ObjCliente.Estado TelefonoCliente = ObjCliente.Telefono TxtSolicito.Text = ObjCliente.Contacto + ClienteRFC = ObjCliente.RFC + ClienteMail = ObjCliente.Mail If ObjCliente.GetSucursales(CveCliente) Then DdlSucursalCliente.DataSource = ObjCliente.DtResultados @@ -975,11 +998,11 @@ Partial Class OS_OrdenesServicios If Not CveOS > 0 Then - + Dim bandera As Integer = DdlEstatusOS.SelectedValue.ToEntero If Not ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyecto.SelectedValue.ToEntero, TxtSolicito.Text, TxtFechaRecibido.Text.ToDateTime, TxtDescripcion.Text, UsuarioActual.CveUsuario, DdlEstatusOS.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then Errores = True End If - + CargaCliente(CveCliente) For Each Row As DataRow In TmpDT.Rows If Not Errores Then Dim Consecutivo As Integer = Row("Consecutivo").ToString.ToEntero @@ -2423,6 +2446,46 @@ Partial Class OS_OrdenesServicios ImprimirPDF("Empresas/Grales/Formatos/OrdenServicio.rdlc", lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) End Sub + + Private Sub ImprimirAlGenerar() + Dim params As New List(Of ReportParameter) + Dim report As LocalReport = New LocalReport() + + Dim dt As DataTable = TmpDT + Dim DtMateriales As DataTable = TmpDTMaterialesDetalle + + report.ReportPath = String.Format("Empresas/{0}/Formatos/FormatoOS.rdlc", UsuarioActual.CveEmpresa) + + params.Add(New ReportParameter("Cliente", NombreCliente)) + params.Add(New ReportParameter("Direccion", ClienteDireccion)) + params.Add(New ReportParameter("NoDeCliente", TxtCodigo.Text)) + params.Add(New ReportParameter("RFC", ClienteRFC)) + params.Add(New ReportParameter("Poblacion", ClienteCiudad)) + params.Add(New ReportParameter("Vendedor", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Contacto", TxtSolicito.Text)) + params.Add(New ReportParameter("Correo", ClienteMail)) + params.Add(New ReportParameter("Sucursal", DdlSubProyecto.SelectedItem.Value)) + params.Add(New ReportParameter("TipoServicio", "Reparación/Diagnostico")) + params.Add(New ReportParameter("DiaFecha", Date.Today.Day.ToString)) + params.Add(New ReportParameter("MesFecha", Date.Today.Month.ToString)) + params.Add(New ReportParameter("AñoFecha", Date.Today.Year.ToString)) + params.Add(New ReportParameter("DiaVigencia", Date.Today.Day.ToString)) + params.Add(New ReportParameter("MesVigencia", Date.Today.Month.ToString)) + params.Add(New ReportParameter("AñoVigencia", Date.Today.Year.ToString)) + params.Add(New ReportParameter("Folio", CveFolio.ToString)) + params.Add(New ReportParameter("CodigoDeServicio", CveOS.ToString)) + params.Add(New ReportParameter("FallaReportada", TxtDescripcion.Text)) + params.Add(New ReportParameter("Copia", "Copia: Cliente")) + + Dim lrds As New List(Of ReportDataSource) + Dim rds As New ReportDataSource With {.Name = "DataSet2", .Value = DtMateriales} + Dim rds2 As New ReportDataSource With {.Name = "DataSet1", .Value = dt} + + lrds.Add(rds) + lrds.Add(rds2) + + ImprimirPDF(String.Format("Empresas/{0}/Formatos/FormatoOS.rdlc", UsuarioActual.CveEmpresa), lrds, params, NombreArchivo:=String.Format("OrdenServicio-{0}", CveFolio)) + End Sub #End Region #Region "S O L I C I T A R M A T E R I A L" diff --git a/SqlServerTypes/readme.htm b/SqlServerTypes/readme.htm new file mode 100644 index 000000000..02d9ac8ce --- /dev/null +++ b/SqlServerTypes/readme.htm @@ -0,0 +1,61 @@ + + + + Microsoft.SqlServer.Types + + + +
    +

    Action required to load native assemblies

    +

    + To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial140.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr120.dll is also included in case the C++ runtime is not installed. +

    +

    + You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture). +

    +

    ASP.NET Web Sites

    +

    + For ASP.NET Web Sites, add the following block of code to the code behind file of the Web Form where you have added Report Viewer Control: +

    +    Default.aspx.cs:
    +        
    +    public partial class _Default : System.Web.UI.Page
    +    {
    +        static bool _isSqlTypesLoaded = false;
    +
    +        public _Default()
    +        {
    +            if (!_isSqlTypesLoaded)
    +            {
    +                SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~"));
    +                _isSqlTypesLoaded = true;
    +            }
    +            
    +        }
    +    }
    +
    +

    +

    ASP.NET Web Applications

    +

    + For ASP.NET Web Applications, add the following line of code to the Application_Start method in Global.asax.cs: +

        SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
    +

    +

    Desktop Applications

    +

    + For desktop applications, add the following line of code to run before any spatial operations are performed: +

        SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
    +

    +
    + + \ No newline at end of file diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index f18f5428a..7c83e3ae9 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -584,11 +584,11 @@
    -
    +
    -
    +
    diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index fc157f681..e7745f384 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1650,6 +1650,8 @@ Partial Class Clientes DivEsDistribuidor.Visible = True TabUsados.Visible = True + DivCargoUsado.Visible = True + DivBonificacionUsado.Visible = True CargaUsados() End If diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 44c9de66e..bef652533 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4641,6 +4641,8 @@ Partial Class PV End If ObjCliente.Dispose() + + RecargaGlobalCliente() End Sub #End Region @@ -4823,6 +4825,18 @@ Partial Class PV ObjPS.Dispose() End Sub + + Private Sub RecargaGlobalCliente() + Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente) + Hilo.Start() + End Sub + Private Sub GeneraGlobalDTCliente() + Dim Objclientes As New ClsClientes + If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then + Application("GlobalDTCliente") = Objclientes.DtResultados + End If + Objclientes.Dispose() + End Sub #End Region #Region "CLASIFICACIONES DETALLES" diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 2541f0c6d..c0a918e0c 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -557,7 +557,7 @@
    - + diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index caf2ca126..50e8551cf 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -2597,5 +2597,16 @@ Partial Class ProductosyServicios #End Region - + Protected Sub DdlIEPSPorcentaje_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlIEPSPorcentaje.SelectedIndexChanged + Select Case DdlIEPSPorcentaje.SelectedValue + Case "0.09" + DdlCategoriaToxicidad.SelectedValueExist("001") + Case "0.07" + DdlCategoriaToxicidad.SelectedValueExist("002") + Case "0.06" + DdlCategoriaToxicidad.SelectedValueExist("003") + Case Else + DdlCategoriaToxicidad.SelectedValueExist("000") + End Select + End Sub End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 6a2ce3a9a..b27e93fb5 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3434,6 +3434,7 @@
    +
    @@ -5762,6 +5763,10 @@
    +
    + + +
    @@ -5929,7 +5934,7 @@
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e93d30672..ff4079674 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3567,6 +3567,12 @@ Partial Class Ventas HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) 'LkNotaCredito.Visible = True HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) + 'visualizo el saldo de anticipos, para cuando se aplique una Nota de crédito, decida si afecta anticipos o a DSV + LblNCSaldoAnticipo.Visible = True + ChkAplicaNCAnticipo.Visible = True + ChkAplicaNCAnticipo.Checked = True + If DbRowVenta("SaldoAnticipo").ToString.ToDouble <= 0 Then ChkAplicaNCAnticipo.Checked = False : ChkAplicaNCAnticipo.Enabled = False + LblNCSaldoAnticipo.Text = String.Format("Saldo Anticipo: $ {0}", DbRowVenta("SaldoAnticipo").ToString.ToDouble.FormatoNumero) Case "Dev" DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev")) HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) @@ -9978,7 +9984,7 @@ Partial Class Ventas 'cuando es NC, por amortización de anticipo, no debe de registrar el concepto 11, 'pero cuando es NC y se aplicó anticipo, debe de restarle el importe - If ObjFactura.TipoDocto.Contiene("Egs") And CveAnticipo > 0 Then + If ObjFactura.TipoDocto.Contiene("Egs") And CveAnticipo > 0 AndAlso ChkAplicaNCAnticipo.Checked = True Then ConceptoContableAplicar = 11 CveVentaAplicar = CveAnticipo CveVentaAmortizacionAplicar = ObjFactura.CveVenta @@ -15840,16 +15846,18 @@ Partial Class Ventas 'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then - + Dim Importe As Decimal + Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, 6) + Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6) Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales) + Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales) + Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal + Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales) + Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 @@ -16780,7 +16788,7 @@ Partial Class Ventas End Sub Private Sub GeneraGlobalDTCliente() Dim Objclientes As New ClsClientes - If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then + If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1,TipoCliente:=-1) Then Application("GlobalDTCliente") = Objclientes.DtResultados End If Objclientes.Dispose() diff --git a/packages.config b/packages.config index ddaa3245a..745b27f24 100644 --- a/packages.config +++ b/packages.config @@ -7,7 +7,9 @@ + +