diff --git a/App_Code/ClsExportaciones.vb b/App_Code/ClsExportaciones.vb index 492523b4b..72509a08e 100644 --- a/App_Code/ClsExportaciones.vb +++ b/App_Code/ClsExportaciones.vb @@ -120,12 +120,13 @@ Public Class ClsExportaciones End Sub #Region "EXPORTACIONES" - Public Function GetExportacion(Optional CveExportacion As Integer = -1, Optional CveEmpresa As Integer = -1, Optional FechaInicio As Date = MinFecha, Optional FechaFin As Date = MaxFecha) As Boolean + Public Function GetExportacion(Optional CveExportacion As Integer = -1, Optional CveEmpresa As Integer = -1, Optional EsExportacion As Integer = 1, Optional FechaInicio As Date = MinFecha, Optional FechaFin As Date = MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Exp_ExportacionesRep") With SqlAdapter.SelectCommand.Parameters .Add("@CveExportacion", SqlDbType.Int).Value = CveExportacion .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@EsExportacion", SqlDbType.Bit).Value = EsExportacion .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin End With @@ -142,7 +143,7 @@ Public Class ClsExportaciones CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, CveAgente As Integer, ClaveAduana As Integer, CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, Sello3 As String, SCAC As String, CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, CveDirConsignatario As Integer, - CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer) As Integer + CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer, ITN As String, Vinculacion As Boolean) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Exp_ExportacionesAdd") With SqlAdapter.SelectCommand.Parameters @@ -174,6 +175,8 @@ Public Class ClsExportaciones .Add("@Notas", SqlDbType.VarChar).Value = Notas .Add("@CvePedimento", SqlDbType.Int).Value = CvePedimento .Add("@CveAgenteExtranjero", SqlDbType.Int).Value = CveAgenteExtranjero + .Add("@ITN", SqlDbType.VarChar).Value = ITN + .Add("@Vinculacion", SqlDbType.Bit).Value = Vinculacion .Add("@CveExportacion", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -191,7 +194,7 @@ Public Class ClsExportaciones CveClienteExportador As Integer, CveClienteImportador As Integer, CveClienteConsignatario As Integer, CveAgente As Integer, ClaveAduana As Integer, CveProveedor As Integer, MedioTransporte As Integer, TipoContenedor As Integer, Sello1 As String, Sello2 As String, Sello3 As String, SCAC As String, CAAT As String, ContenedorPlaca As String, CveEmpresa As Integer, CveUsuario As Integer, CveDirExportador As Integer, CveDirConsignatario As Integer, - CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer) As Boolean + CveIncoterm As Integer, Notas As String, CvePedimento As Integer, CveAgenteExtranjero As Integer, ITN As String, Vinculacion As Boolean) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Exp_ExportacionesUpdate") With SqlAdapter.SelectCommand.Parameters @@ -224,6 +227,8 @@ Public Class ClsExportaciones .Add("@Notas", SqlDbType.VarChar).Value = Notas .Add("@CvePedimento", SqlDbType.Int).Value = CvePedimento .Add("@CveAgenteExtranjero", SqlDbType.Int).Value = CveAgenteExtranjero + .Add("@ITN", SqlDbType.VarChar).Value = ITN + .Add("@Vinculacion", SqlDbType.Bit).Value = Vinculacion End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4e6967359..65e819be0 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10591,7 +10591,7 @@ Public Class ClsPaginas PaginaDict.Add("/CxC/RepCxCPeriodo.aspx".ToUpper(), 887) #End Region #Region "Exportaciones" - PaginaDict.Add("/Export/RepExportaciones.aspx".ToUpper(), 77) + 'PaginaDict.Add("/Export/RepExportaciones.aspx".ToUpper(), 77) PaginaDict.Add("/Export/ExpDetalle.aspx".ToUpper(), 77) #End Region #Region "Finanzas" @@ -11362,6 +11362,12 @@ Public Class ClsPaginas Case Else : Retorno = 9 End Select End If + If Pagina.ToUpper() = ("/Export/RepExportaciones.aspx").ToUpper() Then + Select Case Request("Opcion") + Case "I" : Retorno = 85 + Case Else : Retorno = 77 + End Select + End If Return Retorno End Function #End Region diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index bf2ccb6ec..3d6d102d3 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -5042,7 +5042,7 @@ - + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index dc292aa46..b9ee9e5b3 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -15524,6 +15524,9 @@ Partial Class Compras_Compras End If End If + Dim ivaPorcentaje As Decimal = DTOCGV.MAX("IVAPorcentaje").ToDecimal + Dim IVAPorcentajeTmp As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal + If DTOCGV.MAX("IVAPorcentaje").ToDecimal <> TmpDT.MAX("IVAPorcentaje").ToDecimal Then Alert("La orden de compra(s) tiene diferentes tasa de IVA.", TipoMensaje.MsgAdvertencia) End If diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index a3e2ddbda..634f7cc68 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -5890,7 +5890,14 @@ Partial Class Compras_Proveedores Private Sub CargaTipoTransaccion() + + + If GlobalDTDIOTTipoOperacion IsNot Nothing AndAlso GlobalDTDIOTTipoOperacion.Rows.Count = 0 Then + GlobalDTDIOTTipoOperacion = Nothing + End If + Dim Filtro As String = "" + Select Case DDlDIOTTipoTercero.SelectedValue Case "1" Filtro = "AplicaProvNacional = 1" @@ -5900,8 +5907,11 @@ Partial Class Compras_Proveedores Filtro = "AplicaProvGlobal = 1" End Select + GlobalDTDIOTTipoOperacion.FiltraParametros(Filtro) + DdlDIOTTipoOperacion.DataSource = GlobalDTDIOTTipoOperacion.FiltraParametros(Filtro) DdlDIOTTipoOperacion.DataBind() + End Sub diff --git a/Contabilidad/DiarioPagos.aspx b/Contabilidad/DiarioPagos.aspx index 6c193ac59..7c2ba64e9 100644 --- a/Contabilidad/DiarioPagos.aspx +++ b/Contabilidad/DiarioPagos.aspx @@ -695,6 +695,7 @@ + diff --git a/Export/ExpDetalle.aspx b/Export/ExpDetalle.aspx index bb3d6d95d..cd4946771 100644 --- a/Export/ExpDetalle.aspx +++ b/Export/ExpDetalle.aspx @@ -174,6 +174,13 @@ +
+ +
+ + +
+
@@ -210,6 +217,13 @@ +
+ +
+ + +
+
@@ -436,72 +450,72 @@
-
-
-
- - Incrementables -
-
-
+
+
+
+ + Incrementables +
+
+
+
-
-
- -
-
-
-
- -
- - - +
+
-
- -
- - - +
+
+ +
+ + + +
-
-
- -
- - - +
+ +
+ + + +
-
-
- -
- - - +
+ +
+ + + +
-
-
- -
- - - +
+ +
+ + + +
-
-
- -
- +
+ +
+ + + +
+
+
+ +
+ +
-
@@ -521,48 +535,48 @@
- -
+ +
- -
+ +
- -
+ +
- -
+ +
- -
+ +
- -
+ +
diff --git a/Export/ExpDetalle.aspx.cs b/Export/ExpDetalle.aspx.cs index af4c7a036..f9b41f66e 100644 --- a/Export/ExpDetalle.aspx.cs +++ b/Export/ExpDetalle.aspx.cs @@ -1,9 +1,10 @@ using ADSNetLibrary.Helpers; using CrystalDecisions.ReportAppServer.DataDefModel; - //using DocumentFormat.OpenXml.Wordprocessing; using Extensiones; using HigLabo.Core; +using iText.IO.Font.Otf; +using Microsoft.Reporting.WebForms; using Profact.TimbraCFDI; using Profact.TimbraCFDI.Complementos.ComercioExterior10; using StackExchange.Redis; @@ -13,6 +14,7 @@ using System.Activities.Expressions; using System.Activities.Statements; using System.Collections.Generic; using System.Data; +using System.Globalization; using System.IO; using System.Linq; using System.Web; @@ -122,12 +124,12 @@ public partial class Export_ExpDetalle : ClsPaginas { LblExp.Text = DTExportaciones.FiltroPrimeroValor("CveExportacion"); - string CveVenta = Exportaciones.DtResultados.FiltroPrimeroValor("CveVenta"); + string CveVenta = DTExportaciones.FiltroPrimeroValor("CveVenta"); if (CveVenta != "" && CveVenta != "-1") { if (DdlVentas.Items.FindByValue(CveVenta) == null) { - string Folio = Exportaciones.DtResultados.FiltroPrimeroValor("SerieFolio"); + string Folio = DTExportaciones.FiltroPrimeroValor("SerieFolio"); DdlVentas.Items.Insert(1, new ListItem(Folio, CveVenta)); } DdlVentas.SelectedValue = CveVenta; @@ -148,8 +150,10 @@ public partial class Export_ExpDetalle : ClsPaginas DdlExp.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteExportador"); DdlImp.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveClienteImportador"); DdlImp.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteImportador"); + TxtITN.Text = DTExportaciones.FiltroPrimeroValor("ITN"); DdlCon.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveClienteConsignatario"); DdlCon.SelectedText = DTExportaciones.FiltroPrimeroValor("ClienteConsignatario"); + CkbVinculacion.Checked = ModExtensiones.ToBool(DTExportaciones.FiltroPrimeroValor("Vinculacion")); DdlAgenteMex.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveAgente"); DdlAgenteExt.SelectedValue = DTExportaciones.FiltroPrimeroValor("CveAgenteExtranjero"); @@ -172,16 +176,16 @@ public partial class Export_ExpDetalle : ClsPaginas DataTable DTGastos = Gastos.DtResultados; if (DTGastos.Rows.Count > 0) { - TxtIncFletes.Text = DTGastos.FiltroPrimeroValor("IncFletes"); - TxtIncSeguro.Text = DTGastos.FiltroPrimeroValor("IncSeguro"); - TxtIncEmbalajes.Text = DTGastos.FiltroPrimeroValor("IncEmbalajes"); - TxtIncEmbalaje.Text = DTGastos.FiltroPrimeroValor("IncEmbalaje"); - TxtIncConexos.Text = DTGastos.FiltroPrimeroValor("IncConexos"); - TxtDecFlete.Text = DTGastos.FiltroPrimeroValor("DecFlete"); - TxtDecSeguro.Text = DTGastos.FiltroPrimeroValor("DecSeguro"); - TxtDecCarga.Text = DTGastos.FiltroPrimeroValor("DecCarga"); - TxtDecDescarga.Text = DTGastos.FiltroPrimeroValor("DecDescarga"); - TxtDecOtros.Text = DTGastos.FiltroPrimeroValor("DecOtros"); + TxtIncFletes.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncFletes")).ToString("#,###.####"); + TxtIncSeguro.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncSeguro")).ToString("#,###.####"); + TxtIncEmbalajes.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncEmbalajes")).ToString("#,###.####"); + TxtIncEmbalaje.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncEmbalaje")).ToString("#,###.####"); + TxtIncConexos.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncConexos")).ToString("#,###.####"); + TxtDecFlete.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecFlete")).ToString("#,###.####"); + TxtDecSeguro.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecSeguro")).ToString("#,###.####"); + TxtDecCarga.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecCarga")).ToString("#,###.####"); + TxtDecDescarga.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecDescarga")).ToString("#,###.####"); + TxtDecOtros.Text = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecOtros")).ToString("#,###.####"); } } Gastos.Dispose(); @@ -327,6 +331,7 @@ public partial class Export_ExpDetalle : ClsPaginas return; } + string ITN = TxtITN.Text; string NumeroPedimento = TxtNumPed.Text; DateTime FechaPedimento = TxtFechaPedim.Text.ToDate(); int CveVenta = DdlVentas.Text.ToEntero(); @@ -348,6 +353,7 @@ public partial class Export_ExpDetalle : ClsPaginas int CveUsuario = UsuarioActual.CveUsuario; int CveDirExportador = DdlDirExp.Text.ToEntero(); int CveDirConsignatario = DdlDirCon.Text.ToEntero(); + bool Vinculacion = CkbVinculacion.Checked; int CveIncoterm = DdlIncoterm.Text.ToEntero(); string Notas = TxtNotas.Text; int CvePedimento = DdlClavePedimento.Text.ToEntero(); @@ -396,7 +402,9 @@ public partial class Export_ExpDetalle : ClsPaginas CveIncoterm, Notas, CvePedimento, - CveAgenteExtranjero + CveAgenteExtranjero, + ITN, + Vinculacion ); if (ExportacionGuardada != -1) { @@ -470,7 +478,9 @@ public partial class Export_ExpDetalle : ClsPaginas CveIncoterm, Notas, CvePedimento, - CveAgenteExtranjero + CveAgenteExtranjero, + ITN, + Vinculacion ); if (Continuar) { @@ -899,9 +909,192 @@ public partial class Export_ExpDetalle : ClsPaginas UpPSS.Update(); } - protected void ImprimirReporte(string Formato = "PDF") + protected void ImprimirReporte() { - FileInfo Archivo = new FileInfo(string.Format("{0}Empresas/Grales/Formatos/FacturaImportacion.mrt", UsuarioActual.Empresa.Ruta)); + //FileInfo Archivo = new FileInfo(string.Format("{0}Empresas/Grales/Formatos/FacturaImportacion.mrt", UsuarioActual.Empresa.Ruta)); + + int CveEmpresa = UsuarioActual.CveEmpresa; + DataTable DTExportaciones = new DataTable(); + ClsExportaciones Exportaciones = new ClsExportaciones(); + if (Exportaciones.GetExportacion(CveExportacion, CveEmpresa)) + { + DTExportaciones = Exportaciones.DtResultados; + if (DTExportaciones.Rows.Count > 0) + { + DataRow RowExp = DTExportaciones.Rows[0]; + string ClienteExportador = DTExportaciones.FiltroPrimeroValor("ClienteExportador"); + string DirExportador = DTExportaciones.FiltroPrimeroValor("DirExportador"); + string ClienteImortador = DTExportaciones.FiltroPrimeroValor("ClienteImportador"); + string RFCImp = DTExportaciones.FiltroPrimeroValor("RFCImp"); + string NumFactura = DTExportaciones.FiltroPrimeroValor("SerieFolio"); + string ClaveSATPedimento = DTExportaciones.FiltroPrimeroValor("ClaveSATPedimento"); + string ITN = DTExportaciones.FiltroPrimeroValor("ITN"); + string Vinculacion = DTExportaciones.FiltroPrimeroValor("Vinculacion") == "True" ? "SI" : "NO"; + string FechaFact = ""; + string NumSemana = ""; + if (RowExp["FechaFact"] != DBNull.Value) + { + DateTime fechaf = Convert.ToDateTime(RowExp["FechaFact"]); + FechaFact = fechaf.ToString("dd/MM/yyyy"); + + CultureInfo cultura = CultureInfo.CurrentCulture; + System.Globalization.Calendar calendario = cultura.Calendar; + int numeroSemana = calendario.GetWeekOfYear( + fechaf, + cultura.DateTimeFormat.CalendarWeekRule, + cultura.DateTimeFormat.FirstDayOfWeek + ); + NumSemana = numeroSemana.ToString(); + } + string TipoCambio = ModExtensiones.ToDecimal(DTExportaciones.FiltroPrimeroValor("TipoCambio")).ToString("#,###.####"); + string MedioTransporte = DTExportaciones.FiltroPrimeroValor("MedioTransporte"); + string TipoContenedor = DTExportaciones.FiltroPrimeroValor("TipoContenedor"); + string ClienteConsignatario = DTExportaciones.FiltroPrimeroValor("ClienteConsignatario"); + string DirConsignatario = DTExportaciones.FiltroPrimeroValor("DirConsignatario"); + string RFCCon = DTExportaciones.FiltroPrimeroValor("RFCCon"); + + decimal IncFletes = 0.00m; + decimal IncSeguro = 0.00m; + decimal IncEmbalajes = 0.00m; + decimal IncEmbalaje = 0.00m; + decimal IncConexos = 0.00m; + decimal DecFlete = 0.00m; + decimal DecSeguro = 0.00m; + decimal DecCarga = 0.00m; + decimal DecDescarga = 0.00m; + decimal DecOtros = 0.00m; + decimal TotalInc = 0.00m; + decimal TotalDec = 0.00m; + + string ContenedorPlaca = DTExportaciones.FiltroPrimeroValor("ContenedorPlaca"); + string Proveedor = DTExportaciones.FiltroPrimeroValor("Proveedor"); + string SCAC = DTExportaciones.FiltroPrimeroValor("SCAC"); + string CAAT = DTExportaciones.FiltroPrimeroValor("CAAT"); + string ClaveAduana = DTExportaciones.FiltroPrimeroValor("ClaveSATAduanaSeccionDescripcion"); + ClaveAduana = ClaveAduana != " - - " ? ClaveAduana : ""; + string ClaveSATIncoterm = DTExportaciones.FiltroPrimeroValor("ClaveSATIncoterm"); + string Patente = DTExportaciones.FiltroPrimeroValor("Patente"); + string AgenteExt = DTExportaciones.FiltroPrimeroValor("AgenteExt"); + string TaxId = DTExportaciones.FiltroPrimeroValor("TaxId"); + + List para = new List(); + para.Add(new ReportParameter("CveExportacion", CveExportacion.ToString())); + para.Add(new ReportParameter("ClienteExportador", ClienteExportador)); + para.Add(new ReportParameter("DirExportador", DirExportador)); + para.Add(new ReportParameter("ClienteImportador", ClienteImortador)); + para.Add(new ReportParameter("RFCImp", RFCImp)); + para.Add(new ReportParameter("NumFactura", NumFactura)); + para.Add(new ReportParameter("ClaveSATPedimento", ClaveSATPedimento)); + para.Add(new ReportParameter("ITN", ITN)); + para.Add(new ReportParameter("Vinculacion", Vinculacion)); + para.Add(new ReportParameter("FechaFact", FechaFact)); + para.Add(new ReportParameter("NumSemana", NumSemana)); + para.Add(new ReportParameter("TipoCambio", TipoCambio)); + para.Add(new ReportParameter("MedioTransporte", MedioTransporte)); + para.Add(new ReportParameter("TipoContenedor", TipoContenedor)); + para.Add(new ReportParameter("ClienteConsignatario", ClienteConsignatario)); + para.Add(new ReportParameter("DirConsignatario", DirConsignatario)); + para.Add(new ReportParameter("RFCCon", RFCCon)); + + ClsExportaciones Gastos = new ClsExportaciones(); + if (Gastos.GetGastos(CveExportacion)) + { + DataTable DTGastos = Gastos.DtResultados; + if (DTGastos.Rows.Count > 0) + { + IncFletes = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncFletes")); + IncSeguro = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncSeguro")); + IncEmbalajes = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncEmbalajes")); + IncEmbalaje = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncEmbalaje")); + IncConexos = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("IncConexos")); + DecFlete = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecFlete")); + DecSeguro = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecSeguro")); + DecCarga = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecCarga")); + DecDescarga = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecDescarga")); + DecOtros = ModExtensiones.ToDecimal(DTGastos.FiltroPrimeroValor("DecOtros")); + TotalInc = IncFletes + IncSeguro + IncEmbalajes + IncEmbalaje + IncConexos; + TotalDec = DecFlete + DecSeguro + DecCarga + DecDescarga + DecOtros; + } + } + Gastos.Dispose(); + + para.Add(new ReportParameter("IncFletes", IncFletes.ToString("#,###.####"))); + para.Add(new ReportParameter("IncSeguro", IncSeguro.ToString("#,###.####"))); + para.Add(new ReportParameter("IncEmbalajes", IncEmbalajes.ToString("#,###.####"))); + para.Add(new ReportParameter("IncEmbalaje", IncEmbalaje.ToString("#,###.####"))); + para.Add(new ReportParameter("IncConexos", IncConexos.ToString("#,###.####"))); + para.Add(new ReportParameter("TotalInc", TotalInc.ToString("#,###.####"))); + para.Add(new ReportParameter("DecFlete", DecFlete.ToString("#,###.####"))); + para.Add(new ReportParameter("DecSeguro", DecSeguro.ToString("#,###.####"))); + para.Add(new ReportParameter("DecCarga", DecCarga.ToString("#,###.####"))); + para.Add(new ReportParameter("DecDescarga", DecDescarga.ToString("#,###.####"))); + para.Add(new ReportParameter("DecOtros", DecOtros.ToString("#,###.####"))); + para.Add(new ReportParameter("TotalDec", TotalDec.ToString("#,###.####"))); + + para.Add(new ReportParameter("ContenedorPlaca", ContenedorPlaca)); + para.Add(new ReportParameter("Proveedor", Proveedor)); + para.Add(new ReportParameter("SCAC", SCAC)); + para.Add(new ReportParameter("CAAT", CAAT)); + para.Add(new ReportParameter("ClaveAduana", ClaveAduana)); + para.Add(new ReportParameter("ClaveSATIncoterm", ClaveSATIncoterm)); + para.Add(new ReportParameter("Patente", Patente)); + para.Add(new ReportParameter("AgenteExt", AgenteExt)); + para.Add(new ReportParameter("TaxId", TaxId)); + + List lrds = new List(); + ReportDataSource RDSExportaciones = new ReportDataSource(); + RDSExportaciones.Name = "DsExportaciones"; + RDSExportaciones.Value = DTExportaciones; + lrds.Add(RDSExportaciones); + + DataTable DTPartidas = new DataTable(); + ClsExportaciones Partidas = new ClsExportaciones(); + if (Partidas.GetPartidas(UsuarioActual.CveEmpresa, CveExportacion)) + { + DTPartidas = Partidas.DtResultados; + if (DTPartidas.Rows.Count > 0) + { + DTPartidas.Columns.Add("ValorUnitarioUSD", typeof(decimal)); + DTPartidas.Columns.Add("ValorUnitarioMN", typeof(decimal)); + DTPartidas.Columns["ValorUnitarioUSD"].DefaultValue = 0.0m; + DTPartidas.Columns["ValorUnitarioMN"].DefaultValue = 0.0m; + DataRow RowPartida = DTPartidas.Rows[0]; + decimal cantidad = Convert.ToDecimal(RowPartida["Cantidad"]); + if (cantidad > 0) + { + RowPartida["ValorUnitarioUSD"] = Convert.ToDecimal(RowPartida["Precio"]) / cantidad; + RowPartida["ValorUnitarioMN"] = Convert.ToDecimal(RowPartida["ValorTotalMXP"]) / cantidad; + } + ReportDataSource RDSPartidas = new ReportDataSource(); + RDSPartidas.Name = "DsPartidas"; + RDSPartidas.Value = DTPartidas; + lrds.Add(RDSPartidas); + } + } + + string NombreArchivo = $"Exportacion_{CveExportacion}"; + string CveVenta = DTExportaciones.FiltroPrimeroValor("CveVenta"); ; + if (CveVenta != "" && CveVenta != "-1") + { + NombreArchivo = NumFactura; + } + + string Formato = "FormatoExportacion.mrt"; + para.Add(new ReportParameter("Formato", "PDF")); + string Ruta = ModExtensiones.DirectorioBaseEmpresas + $@"Empresas\{UsuarioActual.CveEmpresa}\Formatos\{Formato}"; + + var bytes = StreamBytesStimul("Facturas", Ruta, lrds, para, NombreArchivo: NombreArchivo, Formato: "PDF", NombreDataSource: "Datos"); + + string Extension = "pdf"; + ImprimirbytesPDF(bytes, NombreArchivo, Formato, Content_Disposition: "attachment", Extension: Extension); + Ruta.GuardaLogAD(); + } + else + { + Alert("No se encontró la exportación", ModExtensiones.TipoMensaje.MsgAdvertencia); + } + } + Exportaciones.Dispose(); } protected void LBImprimir_Click(object sender, EventArgs e) { diff --git a/Export/RepExportaciones.aspx.cs b/Export/RepExportaciones.aspx.cs index 7a71cc001..474c146de 100644 --- a/Export/RepExportaciones.aspx.cs +++ b/Export/RepExportaciones.aspx.cs @@ -1,11 +1,13 @@ using DocumentFormat.OpenXml.Wordprocessing; using Extensiones; +using HigLabo.Core; using StackExchange.Redis; using System; using System.Activities; using System.Activities.Expressions; using System.Activities.Statements; using System.Collections.Generic; +using System.EnterpriseServices.Internal; using System.Linq; using System.Web; using System.Web.UI; @@ -13,6 +15,7 @@ using System.Web.UI.WebControls; using static Microsoft.EntityFrameworkCore.DbLoggerCategory; using static Stimulsoft.Report.Export.DeflaterHuffman; + public partial class Export_RepExportaciones : ClsPaginas { #region Propiedades @@ -21,18 +24,33 @@ public partial class Export_RepExportaciones : ClsPaginas get { return (ViewState["CveExportacion"] == null) ? -1 : Convert.ToInt32(ViewState["CveExportacion"]); } set { ViewState["CveExportacion"] = value; } } + + private bool EsImportacion + { + get{ return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); } + set { ViewState["EsImportacion"] = value; } + } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { + EsImportacion = false; + + if (Request["Opcion"] != null) + { + if (Request["Opcion"] == "I") + EsImportacion = true; + } + LtlPeriodoseleccionado.Text = EsImportacion ? "Importaciones" : "Exportaciones"; CargaExportaciones(); } } protected void CargaExportaciones() { ClsExportaciones Exportaciones = new ClsExportaciones(); - if (Exportaciones.GetExportacion(-1, UsuarioActual.CveEmpresa)) + int EsExportacion = EsImportacion ? 0 : 1; // 0 = importación, 1 = exportación + if (Exportaciones.GetExportacion(-1, UsuarioActual.CveEmpresa, EsExportacion)) { GVExportaciones.DataSource = Exportaciones.DtResultados; GVExportaciones.DataBind(); diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 36d0bbeb0..17bbe038d 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -794,7 +794,7 @@ Partial Class General_SaldosIniciales Dim DTCuentasContables As New DataTable - If UsuarioActual.Empresa.TipoContabilizacion = 1 Or UsuarioActual.CveEmpresa.Contiene(172, 174) Then + If UsuarioActual.Empresa.TipoContabilizacion = 1 Or UsuarioActual.CveEmpresa.Contiene(172, 174, 184) Then Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then @@ -1445,7 +1445,7 @@ Partial Class General_SaldosIniciales If CobranzaTelefono.Trim.Length > 10 Then CobranzaTelefono = "" - Dim FormaPago As String = If(dt.Columns.Contains("Forma Pago"), Row("Forma Pago").ToString(), "") + Dim FormaPago As String = If(dt.Columns.Contains("FormaPago"), Row("FormaPago").ToString(), "") Dim CveFormaPago33 As Integer = 99 Select Case FormaPago diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index e3f74c920..c73ea4d84 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -2569,7 +2569,8 @@
- + @@ -6028,53 +6029,103 @@