public ActionResult Nuevo(int IdEmpresa)
        {
            tb_banco_procesos_bancarios_x_empresa_Info model = new tb_banco_procesos_bancarios_x_empresa_Info();

            cargar_combos();
            return(View(model));
        }
        public bool modificarDB(tb_banco_procesos_bancarios_x_empresa_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_banco_procesos_bancarios_x_empresa Entity = Context.tb_banco_procesos_bancarios_x_empresa.FirstOrDefault(q => q.IdProceso == info.IdProceso && q.IdEmpresa == info.IdEmpresa);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdProceso_bancario_tipo = info.IdProceso_bancario_tipo;
                    Entity.IdBanco        = info.IdBanco;
                    Entity.NombreProceso  = info.NombreProceso;
                    Entity.Codigo_Empresa = info.Codigo_Empresa;
                    Entity.Se_contabiliza = info.Se_contabiliza;
                    Entity.IdTipoNota     = info.IdTipoNota;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        public bool ModificarDB(ba_Archivo_Transferencia_Info info)
        {
            try
            {
                bool res = false;

                if (oData.ModificarDB(info))
                {
                    if (oData_det.EliminarDB(info.IdEmpresa, info.IdArchivo))
                    {
                        foreach (var item in info.Lst_Archivo_Transferencia_Det)
                        {
                            item.IdArchivo            = info.IdArchivo;
                            item.IdEstadoRegistro_cat = "REG_EMITI";
                            item.IdProceso_bancario   = info.IdProceso_bancario;
                        }
                        res = oData_det.GrabarDB(info.Lst_Archivo_Transferencia_Det);
                    }
                    info_procesos_x_empresa = bus_procesos_x_empresa.Get_info_proceso_bancario_x_empresa(info.IdEmpresa, info.IdProceso_bancario);
                }

                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_List_Archivo_transferencia", ex.Message), ex)
                      {
                          EntityType = typeof(ba_Archivo_Transferencia_Bus)
                      };
            }
        }
Example #4
0
        private List <tb_banco_procesos_bancarios_x_empresa_Info> Get_procesos_x_banco()
        {
            try
            {
                List <tb_banco_procesos_bancarios_x_empresa_Info> Lista = new List <tb_banco_procesos_bancarios_x_empresa_Info>();

                foreach (var item in blist_procesos_bancarios_x_empresa)
                {
                    tb_banco_procesos_bancarios_x_empresa_Info info = new tb_banco_procesos_bancarios_x_empresa_Info();

                    info.IdEmpresa = param.IdEmpresa;
                    info.IdProceso_bancario_tipo = item.IdProceso_bancario_tipo;
                    info.IdBanco                    = txtId.Text == "" ? 0 : Convert.ToInt32(txtId.Text);
                    info.cod_banco                  = txtCodigoLegal.Text;
                    info.Codigo_Empresa             = item.Codigo_Empresa;
                    info.Secuencial_detalle_inicial = item.Secuencial_detalle_inicial;
                    info.IdTipoNota                 = item.IdTipoNota;
                    info.Se_contabiliza             = item.Se_contabiliza;

                    Lista.Add(info);
                }

                return(Lista);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show("Error comunicarse con Sistemas " + ex.Message + " ", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(new List <tb_banco_procesos_bancarios_x_empresa_Info>());
            }
        }
Example #5
0
 public bool guardarDB(tb_banco_procesos_bancarios_x_empresa_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_banco_procesos_bancarios_x_empresa Entity = new tb_banco_procesos_bancarios_x_empresa
             {
                 IdEmpresa     = info.IdEmpresa,
                 NombreProceso = info.NombreProceso,
                 IdProceso     = info.IdProceso = get_id(info.IdEmpresa),
                 // IdProceso = info.IdProceso = get_id(),
                 IdBanco = info.IdBanco,
                 IdProceso_bancario_tipo = info.IdProceso_bancario_tipo,
                 Codigo_Empresa          = info.Codigo_Empresa,
                 estado         = info.estado = "A",
                 IdTipoNota     = info.IdTipoNota,
                 Se_contabiliza = info.Se_contabiliza
             };
             Context.tb_banco_procesos_bancarios_x_empresa.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public tb_banco_procesos_bancarios_x_empresa_Info get_info(int IdEmpresa, int IdProceso)
        {
            try
            {
                tb_banco_procesos_bancarios_x_empresa_Info info = new tb_banco_procesos_bancarios_x_empresa_Info();
                using (Entities_general Context = new Entities_general())
                {
                    tb_banco_procesos_bancarios_x_empresa Entity = Context.tb_banco_procesos_bancarios_x_empresa.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdProceso == IdProceso);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new tb_banco_procesos_bancarios_x_empresa_Info
                    {
                        IdBanco = Entity.IdBanco,
                        IdProceso_bancario_tipo = Entity.IdProceso_bancario_tipo,
                        estado         = Entity.estado,
                        Codigo_Empresa = Entity.Codigo_Empresa,
                        NombreProceso  = Entity.NombreProceso
                    };
                }
                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public ActionResult Anular(tb_banco_procesos_bancarios_x_empresa_Info model)
 {
     if (!bus_proceso_x_empresa.anularDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Nuevo(tb_banco_procesos_bancarios_x_empresa_Info model)
 {
     model.IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
     if (!bus_proceso_x_empresa.guardarDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Example #9
0
        private void Generar_Archivo_Transferencia()
        {
            try
            {
                ro_Archivos_Bancos_Generacion_Bus oRo_Archivos_Bancos_Generacion_Bus = new ro_Archivos_Bancos_Generacion_Bus();
                _Info.rutaArchivo = sfdDoc.FileName;
                _Info.ro_rol_detalle.Clear();

                if (oListro_Rol_Detalle_Info.Count() == 0)
                {
                    MessageBox.Show("No hay Datos ", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                else
                {
                    if (oListro_Rol_Detalle_Info.Where(v => v.check == true).Count() == 0)
                    {
                        MessageBox.Show("No ha seleccionado ningun registro ", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                }

                info_Cuenta_Banco     = ucBa_Proceso_x_Banco1.get_BaCuentaInfo();
                info_proceso_Bancario = ucBa_Proceso_x_Banco1.get_Proceso_Info();

                _Info.ro_rol_detalle = oListro_Rol_Detalle_Info.Where(v => v.check == true && v.pagacheque == false).ToList();

                foreach (var item in oListro_Rol_Detalle_Info)
                {
                    item.Valor = Convert.ToDouble(item.PendientePago);

                    if (info_Cuenta_Banco.CodigoLegal == "17")
                    {
                        item.NombreCompleto = item.NombreCompleto.Replace("Ñ", "N");
                        item.NombreCompleto = item.NombreCompleto.Replace("Á", "A");
                        item.NombreCompleto = item.NombreCompleto.Replace("É", "E");
                        item.NombreCompleto = item.NombreCompleto.Replace("Í", "I");
                        item.NombreCompleto = item.NombreCompleto.Replace("Ó", "O");
                        item.NombreCompleto = item.NombreCompleto.Replace("Ú", "U");



                        item.NombreCompleto = item.NombreCompleto.Replace("á", "a");
                        item.NombreCompleto = item.NombreCompleto.Replace("é", "e");
                        item.NombreCompleto = item.NombreCompleto.Replace("ó", "o");
                        item.NombreCompleto = item.NombreCompleto.Replace("í", "i");
                        item.NombreCompleto = item.NombreCompleto.Replace("ú", "u");
                    }
                }
                bus_archivo.GrabarBD(_Info.ro_rol_detalle, info_Cuenta_Banco, info_proceso_Bancario, _Info.rutaArchivo, "", txtCodEmpresa.EditValue.ToString(), ref mensaje);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Example #10
0
        void pu_CargarArchivo(string ruta)
        {
            try
            {
                info_Cuenta_Banco     = ucBa_Proceso_x_Banco1.get_BaCuentaInfo();
                info_proceso_Bancario = ucBa_Proceso_x_Banco1.get_Proceso_Info();


                string a           = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                string nom_archivo = "";

                string rutaTemp = a + "/" + nom_archivo + ".biz";


                //NOMBRE AUTOMATICO


                sfdDoc.FileName = oRo_Archivos_Bancos_Generacion_Bus.pu_GenerarNombreArchivo(Convert.ToDecimal(txtIdArchivo.Text == "" ? 1 : Convert.ToDecimal(txtIdArchivo.Text)), info_Cuenta_Banco, info_proceso_Bancario, Convert.ToDateTime(dteFecha.EditValue), cmbDivision.EditValue == null ? "" : cmbDivision.Text.Trim());
                nom_archivo     = sfdDoc.FileName;
                if (sfdDoc.ShowDialog() == DialogResult.OK)
                {
                    if (File.Exists(sfdDoc.FileName))
                    {
                        File.Delete(sfdDoc.FileName);
                    }

                    Generar_Archivo_Transferencia();


                    try
                    {
                        readBuffer = System.IO.File.ReadAllBytes(sfdDoc.FileName);
                    }
                    catch (Exception)
                    {
                    }
                    if (readBuffer == null)
                    {
                        readBuffer = new byte[000];
                    }
                    MessageBox.Show("El archivo se genero correctamente en: " + sfdDoc.FileName, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtNomArchivo.Text = nom_archivo;
                    txtRuta.Text       = sfdDoc.FileName;
                    txtRuta.EditValue  = sfdDoc.FileName;
                    if (MessageBox.Show("Desea ver el Archivo...?", "INFORMACION", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Process.Start(sfdDoc.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        public ActionResult Anular(int IdEmpresa = 0, int IdProceso = 0)
        {
            cargar_combos();
            tb_banco_procesos_bancarios_x_empresa_Info model = bus_proceso_x_empresa.get_info(IdEmpresa, IdProceso);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Example #12
0
 public bool anularDB(tb_banco_procesos_bancarios_x_empresa_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #13
0
        public void UpdateRow(tb_banco_procesos_bancarios_x_empresa_Info info_det, decimal IdTransaccionSession)
        {
            tb_banco_procesos_bancarios_x_empresa_Info edited_info = get_list(IdTransaccionSession).Where(m => m.IdProceso == info_det.IdProceso).First();

            edited_info.IdBanco        = info_det.IdBanco;
            edited_info.IdEmpresa      = info_det.IdEmpresa;
            edited_info.IdTipoNota     = info_det.IdTipoNota;
            edited_info.NombreProceso  = info_det.NombreProceso;
            edited_info.Se_contabiliza = info_det.Se_contabiliza;
            edited_info.CodigoLegal    = info_det.CodigoLegal;
            edited_info.Codigo_Empresa = info_det.Codigo_Empresa;
            edited_info.Descripcion    = info_det.Descripcion;
        }
        public List <tb_banco_procesos_bancarios_x_empresa_Info> Get_list_procesos_bancarios_x_empresa(int IdEmpresa, int IdBanco_financiero)
        {
            try
            {
                List <tb_banco_procesos_bancarios_x_empresa_Info> Lista = new List <tb_banco_procesos_bancarios_x_empresa_Info>();

                using (EntitiesGeneral Context = new EntitiesGeneral())
                {
                    var lst = from q in Context.vwtb_tb_banco_procesos_bancarios
                              where q.IdEmpresa == IdEmpresa &&
                              q.IdBanco == IdBanco_financiero
                              select q;

                    foreach (var item in lst)
                    {
                        tb_banco_procesos_bancarios_x_empresa_Info info = new tb_banco_procesos_bancarios_x_empresa_Info();
                        info.IdEmpresa = item.IdEmpresa;
                        info.IdProceso_bancario_tipo = item.IdProceso_bancario_tipo;
                        info.cod_Proceso             = (ebanco_procesos_bancarios_tipo)Enum.Parse(typeof(ebanco_procesos_bancarios_tipo), item.IdProceso_bancario_tipo);

                        info.IdBanco        = item.IdBanco;
                        info.cod_banco      = item.cod_banco;
                        info.Codigo_Empresa = item.Codigo_Empresa;

                        info.Iniciales_Archivo          = item.Iniciales_Archivo;
                        info.nom_proceso_bancario       = item.nom_proceso_bancario;
                        info.Secuencial_detalle_inicial = item.Secuencial_detalle_inicial;
                        info.Se_contabiliza             = item.Se_contabiliza;
                        info.IdTipoNota = item.IdTipoNota;
                        info.Tipo_Proc  = item.Tipo_Proc;

                        Lista.Add(info);
                    }
                }

                return(Lista);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #15
0
 public bool GuardarDB(tb_banco_procesos_bancarios_x_empresa_Info Info)
 {
     try
     {
         return(oData.GuardarDB(Info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GuardarDB", ex.Message), ex)
               {
                   EntityType = typeof(tb_banco_procesos_bancarios_x_empresa_Bus)
               };
     }
 }
Example #16
0
        public void AddRow(tb_banco_procesos_bancarios_x_empresa_Info info_det, decimal IdTransaccionSession)
        {
            List <tb_banco_procesos_bancarios_x_empresa_Info> list = get_list(IdTransaccionSession);

            info_det.IdProceso      = info_det.IdProceso;
            info_det.IdBanco        = info_det.IdBanco;
            info_det.IdEmpresa      = info_det.IdEmpresa;
            info_det.IdTipoNota     = info_det.IdTipoNota;
            info_det.NombreProceso  = info_det.NombreProceso;
            info_det.Se_contabiliza = info_det.Se_contabiliza;
            info_det.CodigoLegal    = info_det.CodigoLegal;
            info_det.Codigo_Empresa = info_det.Codigo_Empresa;
            info_det.Descripcion    = info_det.Descripcion;
            list.Add(info_det);
        }
Example #17
0
        public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] tb_banco_procesos_bancarios_x_empresa_Info info_det)
        {
            int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);

            if (ModelState.IsValid)
            {
                info_det.IdEmpresa = IdEmpresa;
                info_det.IdBanco   = Convert.ToInt32(Session["IdBancoPro"]);
                bus_banco_det.modificarDB(info_det);
                List_Det.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            }
            var model = List_Det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));

            cargar_combos_Detalle();
            return(PartialView("_GridViewPartial_proceso_bancario", model));
        }
        public bool GuardarDB(tb_banco_procesos_bancarios_x_empresa_Info Info)
        {
            try
            {
                try
                {
                    using (EntitiesGeneral Context = new EntitiesGeneral())
                    {
                        tb_banco_procesos_bancarios_x_empresa Entity = new tb_banco_procesos_bancarios_x_empresa();

                        Entity.IdEmpresa = Info.IdEmpresa;
                        Entity.IdProceso_bancario_tipo = Info.IdProceso_bancario_tipo;
                        Entity.IdBanco                    = Info.IdBanco;
                        Entity.cod_banco                  = Info.cod_banco;
                        Entity.Codigo_Empresa             = Info.Codigo_Empresa;
                        Entity.Secuencial_detalle_inicial = Info.Secuencial_detalle_inicial;
                        Entity.IdTipoNota                 = Info.IdTipoNota;
                        Entity.Se_contabiliza             = Info.Se_contabiliza;

                        Context.tb_banco_procesos_bancarios_x_empresa.Add(Entity);
                        Context.SaveChanges();
                    }
                    return(true);
                }
                catch (DbEntityValidationException ex)
                {
                    string arreglo = ToString();
                    tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                    tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                    oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                    mensaje = ex.ToString() + " " + ex.Message;
                    mensaje = "Error al Grabar" + ex.Message;
                    throw new Exception(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #19
0
        public tb_banco_procesos_bancarios_x_empresa_Info get_Proceso_Info()
        {
            try
            {
                if (cmbProceso.EditValue != null)
                {
                    infoProceso = List_Proceso_x_Banco.FirstOrDefault(v => v.IdProceso_bancario_tipo == Convert.ToString(cmbProceso.EditValue));
                }

                return(infoProceso);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                return(new tb_banco_procesos_bancarios_x_empresa_Info());
            }
        }
Example #20
0
 public bool anularDB(tb_banco_procesos_bancarios_x_empresa_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_banco_procesos_bancarios_x_empresa Entity = Context.tb_banco_procesos_bancarios_x_empresa.FirstOrDefault(q => q.IdProceso == info.IdProceso && q.IdEmpresa == info.IdEmpresa);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.estado = info.estado = "I";
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #21
0
 public bool modificarDB(tb_banco_procesos_bancarios_x_empresa_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             var list = Context.tb_banco_procesos_bancarios_x_empresa.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdProceso == info.IdProceso).FirstOrDefault();
             if (list != null)
             {
                 list.IdProceso_bancario_tipo = info.IdProceso_bancario_tipo;
                 list.IdBanco        = info.IdBanco;
                 list.NombreProceso  = info.NombreProceso;
                 list.Codigo_Empresa = info.Codigo_Empresa;
                 list.Se_contabiliza = info.Se_contabiliza;
                 list.IdTipoNota     = info.IdTipoNota;
             }
             else
             {
                 Context.tb_banco_procesos_bancarios_x_empresa.Add(new tb_banco_procesos_bancarios_x_empresa
                 {
                     IdEmpresa               = info.IdEmpresa,
                     IdBanco                 = info.IdBanco,
                     IdProceso               = info.IdProceso = get_id(info.IdEmpresa),
                     Codigo_Empresa          = info.Codigo_Empresa,
                     IdProceso_bancario_tipo = info.IdProceso_bancario_tipo,
                     IdTipoNota              = info.IdTipoNota,
                     NombreProceso           = info.NombreProceso,
                     Se_contabiliza          = info.Se_contabiliza
                 });
             }
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #22
0
        public tb_banco_procesos_bancarios_x_empresa_Info get_info(int IdEmpresa, int IdProceso)
        {
            try
            {
                tb_banco_procesos_bancarios_x_empresa_Info info = new tb_banco_procesos_bancarios_x_empresa_Info();
                using (SqlConnection connection = new SqlConnection(ConexionERP.GetConnectionString()))
                {
                    connection.Open();
                    SqlCommand command = new SqlCommand();
                    command.Connection  = connection;
                    command.CommandText = "SELECT [IdEmpresa],[IdProceso],[IdProceso_bancario_tipo],[IdBanco],[Codigo_Empresa],[IdTipoNota],[Se_contabiliza],[estado],[NombreProceso],[Academico],[ERP],[TipoFiltro]"
                                          + " FROM[dbo].[tb_banco_procesos_bancarios_x_empresa]"
                                          + " WHERE IdProceso = " + IdProceso.ToString() + " and IdEmpresa = " + IdEmpresa.ToString();

                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        info = new tb_banco_procesos_bancarios_x_empresa_Info
                        {
                            IdEmpresa = Convert.ToInt32(reader["IdEmpresa"]),
                            IdProceso = Convert.ToInt32(reader["IdProceso"]),
                            IdBanco   = Convert.ToInt32(reader["IdBanco"]),
                            IdProceso_bancario_tipo = Convert.ToString(reader["IdProceso_bancario_tipo"]),
                            NombreProceso           = Convert.ToString(reader["NombreProceso"]),
                            Codigo_Empresa          = Convert.ToString(reader["Codigo_Empresa"]),
                            estado     = Convert.ToString(reader["estado"]),
                            TipoFiltro = Convert.ToString(reader["TipoFiltro"]),
                            IdTipoNota = reader["IdTipoNota"] == DBNull.Value ? null : (int?)reader["IdTipoNota"]
                        };
                    }
                    reader.Close();
                }
                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #23
0
        public Boolean Guardar_Archivo_BG(Archivo_Banco_Guayaquil_Pagos_Info info, tb_banco_procesos_bancarios_x_empresa_Info proceso_info, string patch, string nombre_file, string carSeparador)
        {
            try
            {
                switch (proceso_info.cod_Proceso)
                {
                case ebanco_procesos_bancarios_tipo.PAGOS_MULTICASH:
                    if (Validar_Linea_archivo_Multichast_BG(info))
                    {
                        Generar_archivo_Multichast_BG(info, patch, nombre_file, carSeparador);
                    }

                    break;

                case ebanco_procesos_bancarios_tipo.NCR:
                    if (Validar_Linea_archivo_NCR_BG(info))
                    {
                        Generar_archivo_NCR_BG(info, patch, nombre_file, carSeparador);
                    }

                    break;



                default:
                    break;
                }
                return(true);
            }

            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarBD", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Archivo_Banco_Pichincha_Pago_Bus)
                      };
            }
        }
Example #24
0
        private byte[] GetPagoProvBB(ba_Archivo_Transferencia_Info info, ref string NombreArchivo, ba_Banco_Cuenta_Info banco, tb_banco_procesos_bancarios_x_empresa_Info proceso)
        {
            try
            {
                info.Extension = ".BIZ";
                var empresa = bus_empresa.get_info(info.IdEmpresa);
                NombreArchivo = empresa.NombreComercial + info.Fecha.ToString("yyyyMMdd") + "01";
                System.IO.File.Delete(rutafile + NombreArchivo + info.Extension);
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(rutafile + NombreArchivo + info.Extension, true))
                {
                    var ListaA = info.Lst_det.Where(v => v.Valor > 0).GroupBy(q => new { q.num_cta_acreditacion, q.Secuencial_reg_x_proceso, q.pe_cedulaRuc, q.CodigoLegalBanco, q.IdTipoCta_acreditacion_cat, q.IdTipoDocumento, q.Nom_Beneficiario, q.pr_correo, q.IdPersona, q.IdBanco_acreditacion, q.pr_direccion }).Select(q => new
                    {
                        num_cta_acreditacion       = q.Key.num_cta_acreditacion,
                        Secuencial_reg_x_proceso   = q.Key.Secuencial_reg_x_proceso,
                        pe_cedulaRuc               = q.Key.pe_cedulaRuc,
                        CodigoLegalBanco           = q.Key.CodigoLegalBanco,
                        IdTipoCta_acreditacion_cat = q.Key.IdTipoCta_acreditacion_cat,
                        IdTipoDocumento            = q.Key.IdTipoDocumento,
                        Nom_Beneficiario           = q.Key.Nom_Beneficiario,
                        pr_correo            = q.Key.pr_correo,
                        IdPersona            = q.Key.IdPersona,
                        IdBanco_acreditacion = q.Key.IdBanco_acreditacion,
                        pr_direccion         = q.Key.pr_direccion,
                        Valor = q.Sum(g => g.Valor)
                    }).ToList();
                    int Secuencia = 1;
                    //foreach (var item in info.Lst_det.Where(v => v.Valor > 0).ToList())
                    foreach (var item in ListaA)
                    {
                        string linea        = "";
                        double valor        = Convert.ToDouble(item.Valor);
                        double valorEntero  = Math.Floor(valor);
                        double valorDecimal = Convert.ToDouble((valor - valorEntero).ToString("N2")) * 100;

                        linea += "BZDET";
                        linea += Secuencia.ToString("000000");
                        linea += item.IdPersona.ToString().PadRight(18, ' ');
                        linea += (item.IdTipoDocumento == "CED" ? "C" : (item.IdTipoDocumento == "RUC" ? "R" : "P"));
                        linea += item.pe_cedulaRuc.Trim().Length > 14 ? item.pe_cedulaRuc.Trim().Substring(0, 14) : item.pe_cedulaRuc.Trim().PadRight(14, ' ');
                        linea += (string.IsNullOrEmpty(item.Nom_Beneficiario) ? "" : (item.Nom_Beneficiario.Trim().Length > 60 ? item.Nom_Beneficiario.Trim().Substring(0, 60) : item.Nom_Beneficiario.Trim())).PadRight(60, ' ');
                        linea += (!string.IsNullOrEmpty(item.num_cta_acreditacion) ? (proceso.IdBanco == item.IdBanco_acreditacion ? "CUE" : "COB") : "PEF");
                        linea += "001";
                        linea += (!string.IsNullOrEmpty(item.num_cta_acreditacion) ? (proceso.IdBanco == item.IdBanco_acreditacion ? "34" : item.CodigoLegalBanco) : "  ");
                        linea += (!string.IsNullOrEmpty(item.num_cta_acreditacion) ? (proceso.IdBanco == item.IdBanco_acreditacion ? (item.IdTipoCta_acreditacion_cat == "COR" ? "03" : "04") : item.CodigoLegalBanco) : "  ");
                        linea += (!string.IsNullOrEmpty(item.num_cta_acreditacion) ? item.num_cta_acreditacion.Trim() : "").PadRight(20, ' ');
                        linea += "1";
                        linea += (valorEntero.ToString() + valorDecimal.ToString().PadLeft(2, '0')).PadLeft(15, '0');
                        var Referencia = string.Empty;
                        foreach (var refe in info.Lst_det.Where(q => q.pe_cedulaRuc == item.pe_cedulaRuc).ToList())
                        {
                            if (!string.IsNullOrEmpty(refe.Referencia))
                            {
                                Referencia += ((string.IsNullOrEmpty(refe.Referencia) ? "" : "/") + refe.Referencia);
                            }
                        }
                        linea += (string.IsNullOrEmpty(Referencia) ? "" : (Referencia.Length > 60 ? Referencia.Substring(0, 60) : Referencia.Trim())).PadRight(60, ' ');
                        linea += item.Secuencial_reg_x_proceso.ToString().PadLeft(15, '0');
                        linea += ("").PadRight(15, '0');                          //Numero de comprobante de retencion
                        linea += ("").PadRight(15, '0');                          //Numero de comprobante de IVA
                        linea += ("").PadRight(20, '0');                          //Numero de factura SRI
                        linea += ("").PadRight(10, ' ');                          //Codigo de grupo
                        linea += ("").PadRight(50, ' ');                          //Descripcion del grupo
                        linea += (!string.IsNullOrEmpty(item.pr_direccion) ? (item.pr_direccion.Trim().Length > 50 ? item.pr_direccion.Trim().Substring(0, 50) : item.pr_direccion.Trim().PadRight(50, ' ')) : "").PadRight(50, ' ');
                        linea += ("").PadRight(20, ' ');                          //Telefono
                        linea += "PRO";
                        linea += ("").PadRight(10, ' ');                          //Numero de autorizacion SRI
                        linea += ("").PadRight(10, ' ');                          //Fecha de validez
                        linea += ("").PadRight(10, ' ');                          //REFERENCIA
                        linea += ("").PadRight(1, ' ');                           //Seña de control de horario de atención
                        linea += (proceso.Codigo_Empresa ?? "").PadRight(5, ' '); //Codigo de la empresa asignado por el banco
                        linea += ("").PadRight(6, ' ');                           //Codigo de sub-empresa quien ordena el pago
                        linea += "RPA";
                        file.WriteLine(linea);
                    }
                }
                byte[] filebyte = System.IO.File.ReadAllBytes(rutafile + NombreArchivo + info.Extension);
                return(filebyte);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public Boolean Guardar_Archivo_Banco_Pichinca(Archivo_Banco_Pichincha_Pago_Info info, tb_banco_procesos_bancarios_x_empresa_Info info_proceso, string patch, string nombre_file, string carSeparador)
        {
            try
            {
                switch (info_proceso.cod_Proceso)
                {
                case ebanco_procesos_bancarios_tipo.TRANSF_BANCARIA_BP:

                    if (Validar_Linea_archivo_BP(info))
                    {
                        Generar_archivo_BP(info, patch, nombre_file, carSeparador);
                    }
                    break;

                case ebanco_procesos_bancarios_tipo.PAGO_PROVEEDORES_BP:
                    if (Validar_Linea_archivo_BP(info))
                    {
                        Generar_archivo_BP(info, patch, nombre_file, carSeparador);
                    }
                    break;

                default:
                    break;
                }
                return(true);
            }

            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarBD", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Archivo_Banco_Pichincha_Pago_Bus)
                      };
            }
        }
Example #26
0
        public bool Contabilizar_proceso(ba_Archivo_Transferencia_Info info_archivo, tb_banco_procesos_bancarios_x_empresa_Info info_procesos_x_empresa, string Origen)
        {
            try
            {
                bool res = false;
                if (info_archivo.Contabilizado != true)
                {
                    decimal IdCbteCble  = 0;
                    decimal Valor_total = 0;
                    string  Observacion = "";
                    int     cont        = 0;

                    info_Cbtecble_ban             = new ba_Cbte_Ban_Info();
                    info_cbte_ban_tipo_x_cbtecble = bus_cbte_ban_tipo_x_cbtecble.Get_info_Cbte_Ban_tipo_x_ct_CbteCble_tipo(info_archivo.IdEmpresa, "NDBA");
                    info_banco_cta = bus_banco_cta.Get_Info_Banco_Cuenta(info_archivo.IdEmpresa, info_archivo.IdBanco);

                    List <cp_orden_pago_cancelaciones_Info> list_op_cancelaciones    = new List <cp_orden_pago_cancelaciones_Info>();
                    List <ba_Archivo_Transferencia_Det>     list_archivo_detalle_act = new List <ba_Archivo_Transferencia_Det>();

                    switch (info_archivo.IdProceso_bancario)
                    {
                    case "PAGO_PROVEEDORES_BOL":
                        #region Pago a proveedores del bolivariano
                        var list_secuenciales = (from q in info_archivo.Lst_Archivo_Transferencia_Det
                                                 group q by new { q.Secuencial_reg_x_proceso }
                                                 into secuenciales
                                                 select new
                        {
                            secuencial = secuenciales.Key.Secuencial_reg_x_proceso == null ? 0 : Convert.ToDecimal(secuenciales.Key.Secuencial_reg_x_proceso)
                        });

                        foreach (var item in list_secuenciales.OrderBy(q => q.secuencial))
                        {
                            //OBTENGO LA LISTA DE OP PARA HACER DIARIOS POR PROVEEDOR
                            list_op_cancelaciones = new List <cp_orden_pago_cancelaciones_Info>();
                            List <decimal> list_op = new List <decimal>();


                            foreach (var det_archivo in info_archivo.Lst_Archivo_Transferencia_Det.Where(q => q.Secuencial_reg_x_proceso == item.secuencial).ToList())
                            {
                                list_op.Add(det_archivo.IdOrdenPago == null ? 0 : (decimal)det_archivo.IdOrdenPago);
                            }
                            List <cp_orden_pago_det_Info> list_op_det = new List <cp_orden_pago_det_Info>();
                            cp_orden_pago_det_Bus         bus_op_det  = new cp_orden_pago_det_Bus();

                            //OBTENGO LA LISTA DE LAS OP PARA MATAR CON LA NDBA
                            list_op_det = bus_op_det.Get_list_orden_pago_con_cta_acreedora(info_archivo.IdEmpresa, list_op);

                            #region Armo cabecera diario
                            info_Cbtecble_ban.info_Cbtecble      = new ct_Cbtecble_Info();
                            info_Cbtecble_ban.IdEmpresa          = info_Cbtecble_ban.info_Cbtecble.IdEmpresa = info_archivo.IdEmpresa;
                            info_Cbtecble_ban.IdTipocbte         = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte = info_cbte_ban_tipo_x_cbtecble.IdTipoCbteCble;
                            info_Cbtecble_ban.IdCbteCble         = info_Cbtecble_ban.info_Cbtecble.IdCbteCble = 0;
                            info_Cbtecble_ban.IdPeriodo          = info_Cbtecble_ban.info_Cbtecble.IdPeriodo = (info_archivo.Fecha.Year * 100) + info_archivo.Fecha.Month;
                            info_Cbtecble_ban.cb_Fecha           = info_Cbtecble_ban.info_Cbtecble.cb_Fecha = info_archivo.Fecha;
                            info_Cbtecble_ban.cb_secuencia       = info_Cbtecble_ban.info_Cbtecble.Secuencia = 0;
                            info_Cbtecble_ban.info_Cbtecble.Anio = info_archivo.Fecha.Year;
                            info_Cbtecble_ban.info_Cbtecble.Mes  = info_archivo.Fecha.Month;
                            info_Cbtecble_ban.IdUsuario          = info_Cbtecble_ban.info_Cbtecble.IdUsuario = info_archivo.IdUsuario;
                            info_Cbtecble_ban.Fecha_Transac      = info_Cbtecble_ban.info_Cbtecble.cb_FechaTransac = DateTime.Now;

                            info_Cbtecble_ban.IdSucursal       = info_Cbtecble_ban.info_Cbtecble.IdSucursal = 1;
                            info_Cbtecble_ban.cb_ChequeImpreso = "N"; info_Cbtecble_ban.info_Cbtecble.Mayorizado = "N";
                            info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info = new List <ct_Cbtecble_det_Info>();
                            info_Cbtecble_ban.Estado = info_Cbtecble_ban.info_Cbtecble.Estado = "A";
                            #endregion

                            #region Armo detalle diario
                            Valor_total = 0;
                            Observacion = "OB# " + item.secuencial + " NDBA x " + info_archivo.IdProceso_bancario + " # " + info_archivo.IdArchivo.ToString();

                            cont = 0;
                            foreach (var det_op in list_op_det)
                            {
                                if (cont == 0)
                                {
                                    Observacion += " " + det_op.IdTipo_Persona + ": [" + det_op.IdEntidad.ToString() + "] " + det_op.pr_nombre.Trim();
                                    cont++;
                                }

                                //validacion si llega una op para adjuntar como referencia
                                if (det_op.Referencia == null)
                                {
                                    Observacion += ", OP#" + det_op.IdOrdenPago;
                                }
                                else
                                {
                                    Observacion += ", " + det_op.Referencia;
                                }

                                Valor_total += Convert.ToDecimal(Math.Round(det_op.Valor_a_pagar, 2, MidpointRounding.AwayFromZero));

                                ct_Cbtecble_det_Info Debe = new ct_Cbtecble_det_Info();
                                Debe.IdEmpresa      = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                                Debe.IdTipoCbte     = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                                Debe.IdCbteCble     = 0;
                                Debe.secuencia      = 0;
                                Debe.IdCtaCble      = det_op.IdCtaCble_Acreedora;
                                Debe.dc_Valor       = Convert.ToDouble(Math.Round(Convert.ToDecimal(det_op.Valor_a_pagar), 2, MidpointRounding.AwayFromZero));
                                Debe.dc_Observacion = "OB# " + item.secuencial + " NDBA x " + info_archivo.IdProceso_bancario + " # " + info_archivo.IdArchivo.ToString() + " " + det_op.IdTipo_Persona + ": [" + det_op.IdEntidad.ToString() + "] " + det_op.pr_nombre.Trim() + " " + det_op.Referencia;
                                info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info.Add(Debe);

                                //Cabecera de cbte bancario necesita id proveedor
                                info_Cbtecble_ban.IdProveedor = det_op.IdEntidad;

                                #region Cancelaciones x op
                                cp_orden_pago_cancelaciones_Info info_op_cancelaciones = new cp_orden_pago_cancelaciones_Info();

                                info_op_cancelaciones.IdEmpresa        = info_archivo.IdEmpresa;
                                info_op_cancelaciones.Idcancelacion    = 0;
                                info_op_cancelaciones.Secuencia        = 0;
                                info_op_cancelaciones.IdEmpresa_op     = det_op.IdEmpresa;
                                info_op_cancelaciones.IdOrdenPago_op   = det_op.IdOrdenPago;
                                info_op_cancelaciones.Secuencia_op     = det_op.Secuencia;
                                info_op_cancelaciones.IdEmpresa_cxp    = det_op.IdEmpresa_cxp;
                                info_op_cancelaciones.IdTipoCbte_cxp   = det_op.IdTipoCbte_cxp;
                                info_op_cancelaciones.IdCbteCble_cxp   = det_op.IdCbteCble_cxp;
                                info_op_cancelaciones.MontoAplicado    = det_op.Valor_a_pagar;
                                info_op_cancelaciones.SaldoActual      = 0;
                                info_op_cancelaciones.SaldoAnterior    = 0;
                                info_op_cancelaciones.Observacion      = "Canc./ de OP con Archivo bancario x " + info_archivo.IdProceso_bancario + " #" + info_archivo.IdArchivo.ToString();
                                info_op_cancelaciones.fechaTransaccion = info_archivo.Fecha;

                                list_op_cancelaciones.Add(info_op_cancelaciones);
                                #endregion
                            }

                            ct_Cbtecble_det_Info Haber = new ct_Cbtecble_det_Info();
                            Haber.IdEmpresa         = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                            Haber.IdTipoCbte        = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                            Haber.IdCbteCble        = 0;
                            Haber.secuencia         = 0;
                            Haber.IdCtaCble         = info_banco_cta.IdCtaCble;
                            Haber.dc_Valor          = Convert.ToDouble(Math.Round(Valor_total, 2, MidpointRounding.AwayFromZero)) * -1;
                            Haber.dc_Observacion    = Observacion;
                            Haber.dc_para_conciliar = true;
                            info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info.Add(Haber);
                            #endregion

                            info_Cbtecble_ban.cb_Valor       = info_Cbtecble_ban.info_Cbtecble.cb_Valor = Convert.ToDouble(Math.Round(Valor_total, 2, MidpointRounding.AwayFromZero));
                            info_Cbtecble_ban.cb_Observacion = info_Cbtecble_ban.info_Cbtecble.cb_Observacion = Observacion;
                            IdCbteCble = 0;

                            #region Grabar
                            if (bus_Cbtecble_conta.GrabarDB(info_Cbtecble_ban.info_Cbtecble, ref IdCbteCble, ref mensaje_error))
                            {
                                info_Cbtecble_ban.IdBanco    = info_archivo.IdBanco;
                                info_Cbtecble_ban.IdCbteCble = IdCbteCble;
                                info_Cbtecble_ban.IdTipoNota = info_procesos_x_empresa.IdTipoNota;

                                bus_Cbtecble_ban.GrabarDB(info_Cbtecble_ban, ref mensaje_error);

                                var list_agrup = (from q in list_op_cancelaciones
                                                  group q by new
                                {
                                    q.IdEmpresa,
                                    q.Idcancelacion,
                                    q.Secuencia,
                                    q.IdEmpresa_op,
                                    q.IdOrdenPago_op,
                                    q.Secuencia_op,
                                    q.IdEmpresa_cxp,
                                    q.IdTipoCbte_cxp,
                                    q.IdCbteCble_cxp,
                                    q.MontoAplicado,
                                    q.SaldoActual,
                                    q.SaldoAnterior,
                                    q.Observacion,
                                    q.fechaTransaccion
                                }
                                                  into Lista_agrupada
                                                  select new
                                {
                                    Lista_agrupada.Key.IdEmpresa,
                                    Lista_agrupada.Key.Idcancelacion,
                                    Lista_agrupada.Key.Secuencia,
                                    Lista_agrupada.Key.IdEmpresa_op,
                                    Lista_agrupada.Key.IdOrdenPago_op,
                                    Lista_agrupada.Key.Secuencia_op,
                                    Lista_agrupada.Key.IdEmpresa_cxp,
                                    Lista_agrupada.Key.IdTipoCbte_cxp,
                                    Lista_agrupada.Key.IdCbteCble_cxp,
                                    Lista_agrupada.Key.MontoAplicado,
                                    Lista_agrupada.Key.SaldoActual,
                                    Lista_agrupada.Key.SaldoAnterior,
                                    Lista_agrupada.Key.Observacion,
                                    Lista_agrupada.Key.fechaTransaccion
                                });
                                list_op_cancelaciones = new List <cp_orden_pago_cancelaciones_Info>();
                                foreach (var cancelacion in list_agrup)
                                {
                                    cp_orden_pago_cancelaciones_Info info_can = new cp_orden_pago_cancelaciones_Info();
                                    info_can.IdEmpresa        = cancelacion.IdEmpresa;
                                    info_can.Idcancelacion    = cancelacion.Idcancelacion;
                                    info_can.Secuencia        = cancelacion.Secuencia;
                                    info_can.IdEmpresa_op     = cancelacion.IdEmpresa_op;
                                    info_can.IdOrdenPago_op   = cancelacion.IdOrdenPago_op;
                                    info_can.Secuencia_op     = cancelacion.Secuencia_op;
                                    info_can.IdEmpresa_cxp    = cancelacion.IdEmpresa_cxp;
                                    info_can.IdTipoCbte_cxp   = cancelacion.IdTipoCbte_cxp;
                                    info_can.IdCbteCble_cxp   = cancelacion.IdCbteCble_cxp;
                                    info_can.MontoAplicado    = cancelacion.MontoAplicado;
                                    info_can.SaldoActual      = cancelacion.SaldoActual;
                                    info_can.SaldoAnterior    = cancelacion.SaldoAnterior;
                                    info_can.Observacion      = cancelacion.Observacion;
                                    info_can.fechaTransaccion = cancelacion.fechaTransaccion;
                                    info_can.IdEmpresa_pago   = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                                    info_can.IdTipoCbte_pago  = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                                    info_can.IdCbteCble_pago  = IdCbteCble;
                                    list_op_cancelaciones.Add(info_can);
                                }
                                bus_op_cancelaciones.GuardarDB(list_op_cancelaciones, info_archivo.IdEmpresa, ref mensaje_error);
                            }

                            #endregion
                        }
                        res = true;
                        info_archivo.Contabilizado = true;
                        #endregion
                        break;

                    default:
                        if (info_archivo.Origen_Archivo != "RRHH")
                        {
                            #region Pago a proveedores que tengan op

                            //OBTENGO LA LISTA DE OP PARA HACER DIARIOS POR PROVEEDOR

                            List <decimal> list_op_x_canc = new List <decimal>();
                            foreach (var det_archivo in info_archivo.Lst_Archivo_Transferencia_Det)
                            {
                                list_op_x_canc.Add(det_archivo.IdOrdenPago == null ? 0 : (decimal)det_archivo.IdOrdenPago);
                            }
                            List <cp_orden_pago_det_Info> list_op_det_x_cancelar = new List <cp_orden_pago_det_Info>();
                            cp_orden_pago_det_Bus         bus_op_det_x_cancelar  = new cp_orden_pago_det_Bus();
                            //OBTENGO LA LISTA DE LAS OP PARA MATAR CON LA NDBA
                            list_op_det_x_cancelar = bus_op_det_x_cancelar.Get_list_orden_pago_con_cta_acreedora(info_archivo.IdEmpresa, list_op_x_canc);

                            foreach (var det_op in list_op_det_x_cancelar)
                            {
                                list_op_cancelaciones = new List <cp_orden_pago_cancelaciones_Info>();
                                #region Armo cabecera diario
                                info_Cbtecble_ban.info_Cbtecble      = new ct_Cbtecble_Info();
                                info_Cbtecble_ban.IdEmpresa          = info_Cbtecble_ban.info_Cbtecble.IdEmpresa = info_archivo.IdEmpresa;
                                info_Cbtecble_ban.IdTipocbte         = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte = info_cbte_ban_tipo_x_cbtecble.IdTipoCbteCble;
                                info_Cbtecble_ban.IdCbteCble         = info_Cbtecble_ban.info_Cbtecble.IdCbteCble = 0;
                                info_Cbtecble_ban.IdPeriodo          = info_Cbtecble_ban.info_Cbtecble.IdPeriodo = (info_archivo.Fecha.Year * 100) + info_archivo.Fecha.Month;
                                info_Cbtecble_ban.cb_Fecha           = info_Cbtecble_ban.info_Cbtecble.cb_Fecha = info_archivo.Fecha;
                                info_Cbtecble_ban.cb_secuencia       = info_Cbtecble_ban.info_Cbtecble.Secuencia = 0;
                                info_Cbtecble_ban.info_Cbtecble.Anio = info_archivo.Fecha.Year;
                                info_Cbtecble_ban.info_Cbtecble.Mes  = info_archivo.Fecha.Month;
                                info_Cbtecble_ban.IdUsuario          = info_Cbtecble_ban.info_Cbtecble.IdUsuario = info_archivo.IdUsuario;
                                info_Cbtecble_ban.Fecha_Transac      = info_Cbtecble_ban.info_Cbtecble.cb_FechaTransac = DateTime.Now;

                                info_Cbtecble_ban.IdSucursal       = info_Cbtecble_ban.info_Cbtecble.IdSucursal = 1;
                                info_Cbtecble_ban.cb_ChequeImpreso = "N"; info_Cbtecble_ban.info_Cbtecble.Mayorizado = "N";
                                info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info = new List <ct_Cbtecble_det_Info>();
                                info_Cbtecble_ban.Estado = info_Cbtecble_ban.info_Cbtecble.Estado = "A";
                                #endregion

                                #region Armo detalle diario
                                Valor_total = 0;
                                Observacion = info_archivo.IdProceso_bancario + " # " + info_archivo.IdArchivo.ToString();

                                cont = 0;

                                if (cont == 0)
                                {
                                    Observacion += " " + det_op.IdTipo_Persona + ": [" + det_op.IdEntidad.ToString() + "] " + det_op.pr_nombre.Trim();
                                    cont++;
                                }
                                Observacion += ", " + det_op.Referencia;
                                Valor_total += Convert.ToDecimal(Math.Round(det_op.Valor_a_pagar, 2, MidpointRounding.AwayFromZero));

                                ct_Cbtecble_det_Info Debe = new ct_Cbtecble_det_Info();
                                Debe.IdEmpresa      = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                                Debe.IdTipoCbte     = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                                Debe.IdCbteCble     = 0;
                                Debe.secuencia      = 0;
                                Debe.IdCtaCble      = det_op.IdCtaCble_Acreedora;
                                Debe.dc_Valor       = Convert.ToDouble(Math.Round(Convert.ToDecimal(det_op.Valor_a_pagar), 2, MidpointRounding.AwayFromZero));
                                Debe.dc_Observacion = info_archivo.IdProceso_bancario + " # " + info_archivo.IdArchivo.ToString() + " " + det_op.IdTipo_Persona + ": [" + det_op.IdEntidad.ToString() + "] " + det_op.pr_nombre.Trim() + " " + det_op.Referencia;
                                info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info.Add(Debe);

                                //Cabecera de cbte bancario necesita id proveedor
                                info_Cbtecble_ban.IdProveedor = det_op.IdEntidad;

                                #region Cancelaciones x op
                                cp_orden_pago_cancelaciones_Info info_op_cancelaciones = new cp_orden_pago_cancelaciones_Info();

                                info_op_cancelaciones.IdEmpresa        = info_archivo.IdEmpresa;
                                info_op_cancelaciones.Idcancelacion    = 0;
                                info_op_cancelaciones.Secuencia        = 0;
                                info_op_cancelaciones.IdEmpresa_op     = det_op.IdEmpresa;
                                info_op_cancelaciones.IdOrdenPago_op   = det_op.IdOrdenPago;
                                info_op_cancelaciones.Secuencia_op     = det_op.Secuencia;
                                info_op_cancelaciones.IdEmpresa_cxp    = det_op.IdEmpresa_cxp;
                                info_op_cancelaciones.IdTipoCbte_cxp   = det_op.IdTipoCbte_cxp;
                                info_op_cancelaciones.IdCbteCble_cxp   = det_op.IdCbteCble_cxp;
                                info_op_cancelaciones.MontoAplicado    = det_op.Valor_a_pagar;
                                info_op_cancelaciones.SaldoActual      = 0;
                                info_op_cancelaciones.SaldoAnterior    = 0;
                                info_op_cancelaciones.Observacion      = "Canc./ de OP con Archivo bancario x " + info_archivo.IdProceso_bancario + " #" + info_archivo.IdArchivo.ToString();
                                info_op_cancelaciones.fechaTransaccion = info_archivo.Fecha;

                                list_op_cancelaciones.Add(info_op_cancelaciones);
                                #endregion


                                ct_Cbtecble_det_Info Haber_op = new ct_Cbtecble_det_Info();
                                Haber_op.IdEmpresa         = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                                Haber_op.IdTipoCbte        = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                                Haber_op.IdCbteCble        = 0;
                                Haber_op.secuencia         = 0;
                                Haber_op.IdCtaCble         = info_banco_cta.IdCtaCble;
                                Haber_op.dc_Valor          = Convert.ToDouble(Math.Round(Valor_total, 2, MidpointRounding.AwayFromZero)) * -1;
                                Haber_op.dc_Observacion    = Observacion;
                                Haber_op.dc_para_conciliar = true;
                                info_Cbtecble_ban.info_Cbtecble._cbteCble_det_lista_info.Add(Haber_op);
                                #endregion

                                info_Cbtecble_ban.cb_Valor       = info_Cbtecble_ban.info_Cbtecble.cb_Valor = Convert.ToDouble(Math.Round(Valor_total, 2, MidpointRounding.AwayFromZero));
                                info_Cbtecble_ban.cb_Observacion = info_Cbtecble_ban.info_Cbtecble.cb_Observacion = Observacion;
                                IdCbteCble = 0;

                                #region Grabar
                                if (bus_Cbtecble_conta.GrabarDB(info_Cbtecble_ban.info_Cbtecble, ref IdCbteCble, ref mensaje_error))
                                {
                                    info_Cbtecble_ban.IdBanco    = info_archivo.IdBanco;
                                    info_Cbtecble_ban.IdCbteCble = IdCbteCble;
                                    info_Cbtecble_ban.IdTipoNota = info_procesos_x_empresa.IdTipoNota;

                                    bus_Cbtecble_ban.GrabarDB(info_Cbtecble_ban, ref mensaje_error);

                                    ba_Archivo_Transferencia_Det_Info info_archivo_det = new ba_Archivo_Transferencia_Det_Info();

                                    info_archivo_det = info_archivo.Lst_Archivo_Transferencia_Det.FirstOrDefault(q => q.IdEmpresa_OP == det_op.IdEmpresa && q.IdOrdenPago == det_op.IdOrdenPago && q.Secuencia_OP == det_op.Secuencia);
                                    if (info_archivo_det != null)
                                    {
                                        info_archivo_det.IdEmpresa_pago  = info_Cbtecble_ban.IdEmpresa;
                                        info_archivo_det.IdTipoCbte_pago = info_Cbtecble_ban.IdTipocbte;
                                        info_archivo_det.IdCbteCble_pago = info_Cbtecble_ban.IdCbteCble;
                                        bus_archivo_det.ModificarDB(info_archivo_det);
                                    }

                                    var list_agrup = (from q in list_op_cancelaciones
                                                      group q by new
                                    {
                                        q.IdEmpresa,
                                        q.Idcancelacion,
                                        q.Secuencia,
                                        q.IdEmpresa_op,
                                        q.IdOrdenPago_op,
                                        q.Secuencia_op,
                                        q.IdEmpresa_cxp,
                                        q.IdTipoCbte_cxp,
                                        q.IdCbteCble_cxp,
                                        q.MontoAplicado,
                                        q.SaldoActual,
                                        q.SaldoAnterior,
                                        q.Observacion,
                                        q.fechaTransaccion
                                    }
                                                      into Lista_agrupada
                                                      select new
                                    {
                                        Lista_agrupada.Key.IdEmpresa,
                                        Lista_agrupada.Key.Idcancelacion,
                                        Lista_agrupada.Key.Secuencia,
                                        Lista_agrupada.Key.IdEmpresa_op,
                                        Lista_agrupada.Key.IdOrdenPago_op,
                                        Lista_agrupada.Key.Secuencia_op,
                                        Lista_agrupada.Key.IdEmpresa_cxp,
                                        Lista_agrupada.Key.IdTipoCbte_cxp,
                                        Lista_agrupada.Key.IdCbteCble_cxp,
                                        Lista_agrupada.Key.MontoAplicado,
                                        Lista_agrupada.Key.SaldoActual,
                                        Lista_agrupada.Key.SaldoAnterior,
                                        Lista_agrupada.Key.Observacion,
                                        Lista_agrupada.Key.fechaTransaccion
                                    });
                                    list_op_cancelaciones = new List <cp_orden_pago_cancelaciones_Info>();
                                    foreach (var cancelacion in list_agrup)
                                    {
                                        cp_orden_pago_cancelaciones_Info info_can = new cp_orden_pago_cancelaciones_Info();
                                        info_can.IdEmpresa        = cancelacion.IdEmpresa;
                                        info_can.Idcancelacion    = cancelacion.Idcancelacion;
                                        info_can.Secuencia        = cancelacion.Secuencia;
                                        info_can.IdEmpresa_op     = cancelacion.IdEmpresa_op;
                                        info_can.IdOrdenPago_op   = cancelacion.IdOrdenPago_op;
                                        info_can.Secuencia_op     = cancelacion.Secuencia_op;
                                        info_can.IdEmpresa_cxp    = cancelacion.IdEmpresa_cxp;
                                        info_can.IdTipoCbte_cxp   = cancelacion.IdTipoCbte_cxp;
                                        info_can.IdCbteCble_cxp   = cancelacion.IdCbteCble_cxp;
                                        info_can.MontoAplicado    = cancelacion.MontoAplicado;
                                        info_can.SaldoActual      = cancelacion.SaldoActual;
                                        info_can.SaldoAnterior    = cancelacion.SaldoAnterior;
                                        info_can.Observacion      = cancelacion.Observacion;
                                        info_can.fechaTransaccion = cancelacion.fechaTransaccion;
                                        info_can.IdEmpresa_pago   = info_Cbtecble_ban.info_Cbtecble.IdEmpresa;
                                        info_can.IdTipoCbte_pago  = info_Cbtecble_ban.info_Cbtecble.IdTipoCbte;
                                        info_can.IdCbteCble_pago  = IdCbteCble;
                                        list_op_cancelaciones.Add(info_can);
                                    }
                                    bus_op_cancelaciones.GuardarDB(list_op_cancelaciones, info_archivo.IdEmpresa, ref mensaje_error);
                                }
                            }

                            #endregion

                            res = true;
                            info_archivo.Contabilizado = true;
                            #endregion
                        }

                        break;
                    }
                    Actualizar_estado_contabilizacion(info_archivo);
                }

                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_List_Archivo_transferencia", ex.Message), ex)
                      {
                          EntityType = typeof(ba_Archivo_Transferencia_Bus)
                      };
            }
        }
Example #27
0
        private byte[] get_NCR_OTRO(ro_archivos_bancos_generacion_Info info, string NombreArchivo)
        {
            try
            {
                tb_banco_procesos_bancarios_x_empresa_Info info_proceso = new tb_banco_procesos_bancarios_x_empresa_Info();
                info_proceso = bus_procesos_bancarios.get_info(info.IdEmpresa, info.IdProceso);

                try
                {
                    System.IO.File.Delete(rutafile + NombreArchivo + ".txt");
                }
                catch (Exception)
                {
                }
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(rutafile + NombreArchivo + ".txt", true))
                {
                    foreach (var item in info.detalle.Where(v => v.Valor > 0))
                    {
                        if (item.pe_cedulaRuc == "0912646684")
                        {
                        }

                        item.em_NumCta = item.em_NumCta.Trim();
                        string linea        = "";
                        double valor        = Convert.ToDouble(item.Valor);
                        double valorEntero  = Math.Floor(valor);
                        double valorDecimal = Convert.ToDouble((valor - valorEntero).ToString("N2")) * 100;

                        if (item.em_tipoCta == "COR" || item.em_tipoCta == "AHO")
                        {
                            if (item.em_tipoCta == "AHO")
                            {
                                linea += "A";
                            }
                            else
                            {
                                linea += "C";
                            }

                            linea += item.em_NumCta.PadLeft(10, '0');
                            linea += (valorEntero.ToString() + valorDecimal.ToString().PadLeft(2, '0')).PadLeft(15, '0');

                            linea += "XX";
                            linea += "Y";
                            linea += "01";
                            linea += "                    ";
                            if (item.pe_nombreCompleto.Length > 18)
                            {
                                linea += cl_funciones.QuitarTildes(item.pe_nombreCompleto).Substring(0, 17) + " ";
                            }
                            else
                            {
                                linea += cl_funciones.QuitarTildes(item.pe_nombreCompleto).PadRight(18, ' ');
                            }
                            linea += info_proceso.Codigo_Empresa;
                        }

                        file.WriteLine(linea);
                    }
                }
                byte[] filebyte = System.IO.File.ReadAllBytes(rutafile + NombreArchivo + ".txt");
                return(filebyte);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #28
0
        public Boolean Guardar_Archivo_Banco_Bolivariano(Archivo_Banco_Bolivariano_pago_proveedores_Info info, tb_banco_procesos_bancarios_x_empresa_Info Info_proceso, string patch, string nombre_file)
        {
            try
            {
                if (Validar_Linea_archivo_BB(info))
                {
                    switch (Info_proceso.cod_Proceso)
                    {
                    case ebanco_procesos_bancarios_tipo.ROL_ELECTRONICO_BG:
                        break;


                    case ebanco_procesos_bancarios_tipo.TRANSF_BANCARIA_BP:
                        break;

                    case ebanco_procesos_bancarios_tipo.PAGO_PROVEEDORES_BOL:    // pago a proveedores banco bolivariano
                        Generar_archivo_pago_proveedores_BB(info, patch, nombre_file);
                        break;

                    case ebanco_procesos_bancarios_tipo.PREAVISO_CHEQ:
                        break;

                    case ebanco_procesos_bancarios_tipo.PAGO_BANCO_PACIFICO_BPA:
                        break;

                    default:
                        break;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Generar_archivo", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Archivo_Banco_Bolivariano_pago_proveedores_Bus)
                      };
            }
        }
Example #29
0
        public Boolean Guardar_Archivo_BG(List <Archivo_Banco_Guayaquil_Pagos_Info> Lista, tb_banco_procesos_bancarios_x_empresa_Info proceso_info, string patch, string nombre_file, string carSeparador)
        {
            try
            {
                switch (proceso_info.cod_Proceso)
                {
                case ebanco_procesos_bancarios_tipo.ROL_ELECTRONICO_BG:

                    if (Validar_Linea_archivo_Rol_electronico_BG(Lista))
                    {
                        Generar_archivo_Rol_electronico_BG(Lista, patch, nombre_file, carSeparador);
                    }
                    break;

                default:
                    break;
                }



                return(true);
            }

            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarBD", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Archivo_Banco_Pichincha_Pago_Bus)
                      };
            }
        }
Example #30
0
        public string pu_GenerarNombreArchivo(decimal secuencia, ba_Banco_Cuenta_Info Banco, tb_banco_procesos_bancarios_x_empresa_Info Proceso_Bancario, DateTime fechaGeneracion, string division = "")
        {
            try
            {
                string valorDevolver = "";
                string secuenci_file = "";
                ro_Archivo_Bancos_Generacion_Detalle_Bus oRo_Archivo_Bancos_Generacion_Detalle_Bus = new ro_Archivo_Bancos_Generacion_Detalle_Bus();
                string          sec             = oRo_Archivo_Bancos_Generacion_Detalle_Bus.pu_RellenarCaracter(secuencia.ToString(), "0", 5);
                tb_Empresa_Bus  oTb_Empresa_Bus = new tb_Empresa_Bus();
                tb_Empresa_Info EmpreInfo       = new tb_Empresa_Info();
                EmpreInfo = oTb_Empresa_Bus.Get_Info_Empresa(param.IdEmpresa);
                switch (Banco.CodigoLegal)
                {
                case "34":     //BANCO BOLIVARIANO

                    valorDevolver = EmpreInfo.em_nombre + fechaGeneracion.ToString("yyyyMMdd") + Convert.ToInt32(sec) + ".BIZ";
                    break;

                case "30":     //BANCO PACIFICO

                    EmpreInfo     = oTb_Empresa_Bus.Get_Info_Empresa(param.IdEmpresa);
                    valorDevolver = EmpreInfo.em_nombre + fechaGeneracion.ToString("yyyyMMdd") + Convert.ToInt32(sec) + ".txt";
                    break;


                case "17":     //BANCO GUAYAQUIL

                    switch (Proceso_Bancario.cod_Proceso)
                    {
                    case ebanco_procesos_bancarios_tipo.NCR:
                        secuenci_file = Archivo_Bus.GetId_codigoArchivo(param.IdEmpresa, fechaGeneracion).ToString();
                        valorDevolver = Proceso_Bancario.Iniciales_Archivo + secuenci_file.Substring(0, 8) + Proceso_Bancario.Codigo_Empresa + "_" + secuenci_file.Substring(9, secuenci_file.Length - 9);
                        valorDevolver = valorDevolver.Replace(" ", "");
                        break;

                    case ebanco_procesos_bancarios_tipo.PAGOS_MULTICASH:
                        EmpreInfo     = oTb_Empresa_Bus.Get_Info_Empresa(param.IdEmpresa);
                        valorDevolver = Proceso_Bancario.Iniciales_Archivo + "_" + fechaGeneracion.Year.ToString() + fechaGeneracion.Month.ToString().PadLeft(2, '0') + fechaGeneracion.Day.ToString().PadLeft(2, '0') + "_" + secuencia.ToString().PadLeft(2, '0') + ".txt";
                        break;

                    case ebanco_procesos_bancarios_tipo.ROL_ELECTRONICO_BG:
                        secuenci_file = Archivo_Bus.GetId_codigoArchivo(param.IdEmpresa, fechaGeneracion).ToString();
                        string codigo_empresa = Proceso_Bancario.Codigo_Empresa;
                        valorDevolver = Proceso_Bancario.Iniciales_Archivo + secuenci_file.Substring(0, 8) + codigo_empresa + "_" + secuenci_file.Substring(9, secuenci_file.Length - 9);
                        break;

                    case ebanco_procesos_bancarios_tipo.NCR_OTROS_BCO:
                        secuenci_file = Archivo_Bus.GetId_codigoArchivo(param.IdEmpresa, fechaGeneracion).ToString();
                        valorDevolver = Proceso_Bancario.Iniciales_Archivo + secuenci_file.Substring(0, 8) + Proceso_Bancario.Codigo_Empresa + "_" + secuenci_file.Substring(9, secuenci_file.Length - 9);
                        valorDevolver = valorDevolver.Replace(" ", "");
                        break;

                    default:
                        break;
                    }
                    break;

                case "10":     //BANCO PICHINCHA

                    switch (Proceso_Bancario.cod_Proceso)
                    {
                    case ebanco_procesos_bancarios_tipo.TRANSF_BANCARIA_BP:
                        secuenci_file = Archivo_Bus.GetId_codigoArchivo(param.IdEmpresa, fechaGeneracion).ToString();
                        valorDevolver = Proceso_Bancario.Iniciales_Archivo + secuenci_file.Substring(0, 8) + Proceso_Bancario.cod_banco + "_" + secuenci_file.Substring(9, secuenci_file.Length - 9);
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }



                return(valorDevolver);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "pu_GenerarNombreArchivo", ex.Message), ex)
                      {
                          EntityType = typeof(ro_Archivos_Bancos_Generacion_Bus)
                      };
            }
        }