Ejemplo n.º 1
0
        public Boolean GuardarDB(Af_Poliza_x_AF_Info Info, ref int IdPoliza)
        {
            try
            {
                if (data.GuardarDB(Info, ref IdPoliza))
                {
                    foreach (var item in Info.lst_Det_cuota)
                    {
                        item.IdPoliza = IdPoliza;
                    }
                    foreach (var item in Info.lst_Det)
                    {
                        item.IdPoliza = IdPoliza;
                        if (item.observacion_det == null || item.observacion_det == "")
                        {
                            item.observacion_det = Info.observacion;
                        }
                    }

                    if (Detalle_x_Cuta_Bus.GuardarDB(Info.lst_Det_cuota))
                    {
                        Detalle_x_activo_Bus.GuardarDB(Info.lst_Det);
                    }
                }
                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("", "GuardarDB", ex.Message), ex)
                      {
                          EntityType = typeof(Af_Poliza_x_AF_Bus)
                      };
            }
        }
Ejemplo n.º 2
0
 public Boolean AnularDB(Af_Poliza_x_AF_Info Info)
 {
     try
     {
         using (EntitiesActivoFijo_FJ context = new EntitiesActivoFijo_FJ())
         {
             var Address = context.Af_Poliza_x_AF.First(minfo => minfo.IdEmpresa == Info.IdEmpresa && minfo.IdPoliza == Info.IdPoliza);
             if (Address != null)
             {
                 Address.Estado          = "I";
                 Address.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                 Address.Fecha_UltAnu    = Info.Fecha_UltAnu;
                 Address.MotivoAnulacion = Info.MotivoAnulacion;
                 context.SaveChanges();
             }
         }
         return(true);
     }
     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);
         mensaje = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.InnerException.ToString());
     }
 }
Ejemplo n.º 3
0
        public Boolean ModificarDB(Af_Poliza_x_AF_Info Info)
        {
            try
            {
                if (data.ModificarDB(Info))
                {
                    if (Detalle_x_activo_Bus.EliminarDB(Info.IdEmpresa, Convert.ToInt32(Info.IdPoliza)))
                    {
                        Detalle_x_activo_Bus.GuardarDB(Info.lst_Det);
                    }

                    if (Detalle_x_Cuta_Bus.EliminarDB(Info.IdEmpresa, Convert.ToInt32(Info.IdPoliza)))
                    {
                        foreach (var item in Info.lst_Det_cuota)
                        {
                            item.IdPoliza = Info.IdPoliza;
                        }
                        Detalle_x_Cuta_Bus.GuardarDB(Info.lst_Det_cuota);
                    }
                    bus_Activo_fijo.Grabar_Poliza_x_Activo(Info);
                }

                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("", "ModificarDB", ex.Message), ex)
                      {
                          EntityType = typeof(Af_Poliza_x_AF_Bus)
                      };
            }
        }
        private void Get()
        {
            try
            {
                // info
                poliza_info           = new Af_Poliza_x_AF_Info();
                poliza_info.IdEmpresa = param.IdEmpresa;
                if (txtIdPoliza.Text != "")
                {
                    poliza_info.IdPoliza = Convert.ToInt32(txtIdPoliza.Text);
                }
                if (txtCodigo.Text != "")
                {
                    poliza_info.cod_poliza = txtCodigo.Text;
                }
                if (txtCodigo.Text == "")
                {
                    poliza_info.cod_poliza = " ";
                }

                poliza_info.subtotal_noIva = txt_base0.Text == "" ? 0 : Convert.ToDouble(txt_base0.EditValue);

                poliza_info.pago_contado = txt_pago_contado.Text == "" ? 0 : Convert.ToDouble(txt_pago_contado.EditValue);

                poliza_info.IdProveedor          = cmb_proveedor.get_ProveedorInfo().IdProveedor;
                poliza_info.fecha                = Convert.ToDateTime(da_fecha.EditValue);
                poliza_info.observacion          = txtobservacion.EditValue.ToString();
                poliza_info.fecha_vigencia_desde = Convert.ToDateTime(deDesde.EditValue);
                poliza_info.fecha_vigencia_hasta = Convert.ToDateTime(deHasta.EditValue);
                poliza_info.num_cuotas           = Convert.ToInt32(txt_num_cuotas.EditValue);
                poliza_info.valor_cuota          = Convert.ToDouble(txt_valorCuota.Text);
                poliza_info.fecha_1era_cuota     = Convert.ToDateTime(deFechaPrimerCuota.EditValue);
                poliza_info.suma_asegurada       = Convert.ToDouble(txtTotal.EditValue);
                poliza_info.porc_iva             = Convert.ToDouble(txtPorcIva.EditValue);
                poliza_info.iva         = Convert.ToDouble(txtIva.EditValue);
                poliza_info.Total       = Convert.ToDouble(txtTotal.EditValue);
                poliza_info.total_meses = Convert.ToInt32(txt_num_cuotas.EditValue);
                poliza_info.subtotal    = Convert.ToDouble(txt_base12.EditValue);

                //Datos para facturar
                poliza_info.IdCentroCosto = ucFa_Cliente_x_centro_costo_cmb1.Get_Info_Centro_costo() == null ? null : ucFa_Cliente_x_centro_costo_cmb1.Get_Info_Centro_costo().IdCentroCosto;
                poliza_info.IdCentroCosto_sub_centro_costo = ucFa_Cliente_x_centro_costo_cmb1.Get_Info_Centro_costo_sub_centro_costo() == null ? null : ucFa_Cliente_x_centro_costo_cmb1.Get_Info_Centro_costo_sub_centro_costo().IdCentroCosto_sub_centro_costo;

                poliza_info.lst_Det = list_Detalle_x_Activo_info.Where(v => v.check == true).ToList();
                foreach (var item in poliza_info.lst_Det)
                {
                    item.IdEmpresa = param.IdEmpresa;
                }
                poliza_info.lst_Det_cuota = list_Detalle_x_Cuota_info.ToList();
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Ejemplo n.º 5
0
 public void Set_Info(Af_Poliza_x_AF_Info info_)
 {
     try
     {
         poliza_info = info_;
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
 private void gridViewPolizas_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         info = (Af_Poliza_x_AF_Info)gridViewPolizas.GetFocusedRow();
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Ejemplo n.º 7
0
 public Boolean AnularDB(Af_Poliza_x_AF_Info Info)
 {
     try
     {
         return(data.AnularDB(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("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(Af_Poliza_x_AF_Bus)
               };
     }
 }
Ejemplo n.º 8
0
 public Boolean Grabar_Poliza_x_Activo(Af_Poliza_x_AF_Info info)
 {
     try
     {
         return(data.Grabar_Poliza_x_Activo(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("", "Grabar_Poliza_x_Activo", ex.Message), ex)
               {
                   EntityType = typeof(Af_Activo_fijo_Bus)
               };
     }
 }
Ejemplo n.º 9
0
        public Boolean GuardarDB(Af_Poliza_x_AF_Info Info, ref int IdPoliza)
        {
            try
            {
                using (EntitiesActivoFijo_FJ Context = new EntitiesActivoFijo_FJ())
                {
                    var Address = new Af_Poliza_x_AF();

                    Address.IdEmpresa            = Info.IdEmpresa;
                    Address.IdPoliza             = getId(Info.IdEmpresa);
                    Address.IdProveedor          = Info.IdProveedor;
                    Address.cod_poliza           = Info.cod_poliza;
                    Address.fecha                = Info.fecha.Date;
                    Address.observacion          = Info.observacion;
                    Address.fecha_vigencia_desde = Info.fecha_vigencia_desde.Date;
                    Address.fecha_vigencia_hasta = Info.fecha_vigencia_hasta.Date;


                    Address.num_cuotas    = Info.num_cuotas;
                    Address.valor_cuota   = Info.valor_cuota;
                    Address.IdCentroCosto = Info.IdCentroCosto;
                    Address.IdCentroCosto_sub_centro_costo = Info.IdCentroCosto_sub_centro_costo;
                    Address.fecha_1era_cuota = Info.fecha_1era_cuota;
                    Address.suma_asegurada   = Info.suma_asegurada;
                    Address.total_meses      = Info.total_meses;
                    Address.subtotal         = Info.subtotal;
                    Address.porc_iva         = Info.porc_iva;
                    Address.iva            = Info.iva;
                    Address.Total          = Info.Total;
                    Address.Estado         = "A";
                    Address.pago_contado   = Info.pago_contado;
                    Address.subtotal_noIva = Info.subtotal_noIva;
                    Context.Af_Poliza_x_AF.Add(Address);
                    Context.SaveChanges();
                    IdPoliza = Convert.ToInt32(Address.IdPoliza);
                }
                return(true);
            }
            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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 10
0
 public Boolean ModificarDB(Af_Poliza_x_AF_Info Info)
 {
     try
     {
         using (EntitiesActivoFijo_FJ context = new EntitiesActivoFijo_FJ())
         {
             var Address = context.Af_Poliza_x_AF.First(minfo => minfo.IdEmpresa == Info.IdEmpresa && minfo.IdPoliza == Info.IdPoliza);
             if (Address != null)
             {
                 Address.cod_poliza           = Info.cod_poliza;
                 Address.IdProveedor          = Info.IdProveedor;
                 Address.fecha                = Info.fecha.Date;
                 Address.observacion          = Info.observacion;
                 Address.fecha_vigencia_desde = Info.fecha_vigencia_desde.Date;
                 Address.fecha_vigencia_hasta = Info.fecha_vigencia_hasta.Date;
                 Address.num_cuotas           = Info.num_cuotas;
                 Address.valor_cuota          = Info.valor_cuota;
                 Address.fecha_1era_cuota     = Info.fecha_1era_cuota;
                 Address.suma_asegurada       = Info.suma_asegurada;
                 Address.total_meses          = Info.total_meses;
                 Address.subtotal             = Info.subtotal;
                 Address.porc_iva             = Info.porc_iva;
                 Address.iva             = Info.iva;
                 Address.Total           = Info.Total;
                 Address.cod_poliza      = Info.cod_poliza;
                 Address.pago_contado    = Info.pago_contado;
                 Address.subtotal_noIva  = Info.subtotal_noIva;
                 Address.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                 Address.Fecha_UltMod    = Info.Fecha_UltMod;
                 context.SaveChanges();
             }
         }
         return(true);
     }
     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);
         mensaje = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.InnerException.ToString());
     }
 }
Ejemplo n.º 11
0
        public List <Af_Poliza_x_AF_Info> Get_List_Poliza(int IdEmpresa, DateTime fi, DateTime ff)
        {
            List <Af_Poliza_x_AF_Info> Lst = new List <Af_Poliza_x_AF_Info>();

            try
            {
                DateTime fecha_desde = Convert.ToDateTime(fi.ToShortDateString());
                DateTime fecha_hasta = Convert.ToDateTime(ff.ToShortDateString());

                using (EntitiesActivoFijo_FJ oEnti = new EntitiesActivoFijo_FJ())
                {
                    var query = (from j in oEnti.vwaf_Af_Poliza_x_AF
                                 where j.IdEmpresa == IdEmpresa &&
                                 j.fecha_vigencia_desde >= fecha_desde &&
                                 j.fecha_vigencia_desde <= fecha_hasta
                                 select j);
                    foreach (var item in query)
                    {
                        Af_Poliza_x_AF_Info info = new Af_Poliza_x_AF_Info();
                        info.IdEmpresa            = item.IdEmpresa;
                        info.IdPoliza             = item.IdPoliza;
                        info.IdProveedor          = item.IdProveedor;
                        info.cod_poliza           = item.cod_poliza;
                        info.fecha                = item.fecha.Date;
                        info.observacion          = item.observacion;
                        info.fecha_vigencia_desde = item.fecha_vigencia_desde.Date;
                        info.fecha_vigencia_hasta = item.fecha_vigencia_hasta.Date;
                        info.num_cuotas           = item.num_cuotas;
                        info.valor_cuota          = item.valor_cuota;
                        info.fecha_1era_cuota     = item.fecha_1era_cuota;
                        info.suma_asegurada       = item.suma_asegurada;
                        info.total_meses          = item.total_meses;
                        info.subtotal             = item.subtotal;
                        info.porc_iva             = item.porc_iva;
                        info.iva               = item.iva;
                        info.total_meses       = item.total_meses;
                        info.Total             = item.Total;
                        info.Estado            = item.Estado;
                        info.cod_poliza        = item.cod_poliza;
                        info.observacion       = item.observacion;
                        info.pe_cedulaRuc      = item.pe_cedulaRuc;
                        info.pe_nombreCompleto = item.pe_nombreCompleto;
                        info.pago_contado      = item.pago_contado;
                        info.subtotal_noIva    = item.subtotal_noIva;
                        info.IdCentroCosto     = item.IdCentroCosto;
                        info.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                        Lst.Add(info);
                    }
                }


                return(Lst);
            }
            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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }