Esempio n. 1
0
        public bool Guardar_DB(ro_Remplazo_x_emplado_Info info, ref int Id_Remplazo, ref decimal id_novedad)
        {
            try
            {
                decimal iddiario = 0;
                decimal idop     = 0;
                if (data.Guardar_DB(info, ref Id_Remplazo))
                {
                    if (info.Descuenta_rol == true)
                    {
                        ro_Empleado_Novedad_Info info_novedad = new ro_Empleado_Novedad_Info();
                        info_novedad = Get_novedad_info(info);
                        if (novedad_bus.GrabarDB(info_novedad, ref id_novedad, ref error))
                        {
                            info_novedad.InfoNovedadDet.IdNovedad = id_novedad;
                            info_novedad.InfoNovedadDet.IdEmpresa = info.IdEmpresa;
                            if (novedad_det_bus.GrabarDB(info_novedad.InfoNovedadDet, ref error))
                            {
                                info.IdNovedad   = id_novedad;
                                info.Id_remplazo = Id_Remplazo;
                                Modificar_DB_IdNovedad(info);
                            }
                        }
                    }

                    GetOrdenPao(info);
                    GetAsientoContable(info);
                    if (bus_ct.GrabarDB(infocont, ref iddiario, ref mensaje))
                    {
                        foreach (var item in CabOP.Detalle)
                        {
                            item.IdTipoCbte_cxp = infocont.IdTipoCbte;
                            item.IdCbteCble_cxp = iddiario;
                        }

                        if (bus_op.GuardaDB(CabOP, ref idop, ref mensaje))
                        {
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                mensaje = ex.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(), "", mensaje, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(mensaje);
            }
        }
Esempio n. 2
0
        public bool GrabarDB()
        {
            try
            {
                Get_OrdenPago();
                Get_Comprobante_contable();
                Get_Historico_cancelacion();
                bool    bandera_sigrabo = false;
                decimal id_OP           = 0;
                decimal id_detalle_OP   = 0;
                string  mensajeError    = "";
                int     idliquidacion   = 0;
                decimal IdCbteCble      = 0;
                if (Bus_Orden_pago.GuardaDB(Info_Orden_Pago, ref id_OP, ref mensajeError))
                {
                    int sec = 0;
                    if (Bus_comprobante_contable.GrabarDB(Info_comprobante_Contable, ref IdCbteCble, ref mensajeError))
                    {
                        cp_orden_pago_det_Bus detalle = new cp_orden_pago_det_Bus();

                        foreach (var item in Info_Orden_Pago.Detalle)
                        {
                            item.IdOrdenPago    = id_OP;
                            item.IdEmpresa      = Info_comprobante_Contable.IdEmpresa;
                            item.IdEmpresa_cxp  = param.IdEmpresa;
                            item.IdCbteCble_cxp = IdCbteCble;
                            item.IdTipoCbte_cxp = Info_comprobante_Contable.IdTipoCbte;

                            if (detalle.ModificarDB(item, ref id_detalle_OP, ref mensajeError))
                            {
                                Info_historico_cancelacion.IdEmpresa    = param.IdEmpresa;
                                Info_historico_cancelacion.IdOrdenPago  = id_OP;
                                Info_historico_cancelacion.IdEmpresa_OP = Info_Orden_Pago.IdEmpresa;
                                if (Bus_liquidacion_vacaciones.GrabarBD(Info_historico_cancelacion))
                                {
                                    bandera_sigrabo = true;
                                    if (bandera_sigrabo)
                                    {
                                        foreach (var item_ in Info_historico_cancelacion.detalle)
                                        {
                                            sec = sec + 1;
                                            if
                                            (sec == 1)
                                            {
                                                bus_detalle.Eliminar(item_);
                                            }
                                            item_.Sec                    = sec;
                                            item_.IdEmpresa              = Info_historico_cancelacion.IdEmpresa;
                                            item_.IdEmpleado             = Convert.ToInt32(Info_historico_cancelacion.IdEmpleado);
                                            item_.IdSolicitud_Vacaciones = Info_historico_cancelacion.IdSolicitud_Vacaciones;
                                            item_.IdNominatipo           = Info_historico_cancelacion.IdNomina_Tipo;
                                            bandera_sigrabo              = bus_detalle.Guardar_DB(item_);
                                        }

                                        if (MessageBox.Show("¿Desea imprimir la novedad?", "REMPLAZO POR EMPLEADO " + param.Nombre_sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                        {
                                            Imprimir(Info_historico_cancelacion.IdEmpresa, Info_historico_cancelacion.IdEmpleado, Info_historico_cancelacion.IdSolicitud_Vacaciones);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return(bandera_sigrabo);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log_Error_bus.Log_Error(ex.ToString());
                return(false);
            }
        }
        public Boolean GrabarDB(ref caj_Caja_Movimiento_Info info, ref string MensajeError)
        {
            try
            {
                Boolean res = true;
                // grabar diario caja
                ct_Cbtecble_Bus CbteCble_Data = new ct_Cbtecble_Bus();
                decimal         idCbteCble    = 0;

                if (CbteCble_Data.GrabarDB(info.Info_CbteCble_x_Caja_Movi, ref idCbteCble, ref MensajeError))
                {
                    //  GrabarDB caja
                    info.IdCbteCble = idCbteCble;
                    info.IdTipocbte = info.Info_CbteCble_x_Caja_Movi.IdTipoCbte;
                    string IdTipo_Docu = string.Empty;
                    if (info.cm_Signo == "+")
                    {
                        IdTipo_Docu = "RECIB_CAJA";
                    }
                    else
                    {
                        IdTipo_Docu = "VALE_CAJA";
                    }

                    info.IdPeriodo = info.Info_CbteCble_x_Caja_Movi.IdPeriodo;
                    if (data.GrabarDB(info, ref MensajeError))
                    {
                        string mensaje = "";
                        cp_orden_pago_cancelaciones_Bus bus_pagoCance = new cp_orden_pago_cancelaciones_Bus();

                        foreach (var item in info.List_OrdenCan)
                        {
                            if (item.IdOrdenPago_op > 0)
                            {
                                item.IdEmpresa_pago  = info.Info_CbteCble_x_Caja_Movi.IdEmpresa;
                                item.IdCbteCble_pago = idCbteCble;
                                item.IdTipoCbte_pago = info.Info_CbteCble_x_Caja_Movi.IdTipoCbte;
                                bus_pagoCance.GuardarDB(item, info.Info_CbteCble_x_Caja_Movi.IdEmpresa, ref mensaje);
                            }
                            else
                            {
                                //// no hay OP hay q generarla
                                cp_orden_pago_Bus             BusOP            = new cp_orden_pago_Bus();
                                cp_orden_pago_Info            InfoOP           = new cp_orden_pago_Info();
                                cp_orden_pago_det_Info        Info_det_OP      = new cp_orden_pago_det_Info();
                                List <cp_orden_pago_det_Info> List_Info_det_OP = new List <cp_orden_pago_det_Info>();
                                decimal IdOP = 0;

                                InfoOP.IdEmpresa          = info.Info_CbteCble_x_Caja_Movi.IdEmpresa;
                                InfoOP.IdEntidad          = Convert.ToDecimal(item.IdEntidad);
                                InfoOP.IdEstadoAprobacion = "APRO";
                                InfoOP.IdFormaPago        = "EFEC";
                                InfoOP.IdTipo_Persona     = item.IdTipo_Persona;
                                InfoOP.IdOrdenPago        = 0;
                                InfoOP.IdPersona          = item.IdPersona;
                                InfoOP.IdTipo_op          = item.IdTipo_op;
                                InfoOP.Observacion        = "O/P x Generada por Cruze con EG/Cja..";
                                InfoOP.Saldo           = 0;
                                InfoOP.Total_cancelado = Convert.ToDecimal(item.MontoAplicado);
                                InfoOP.Total_OP        = Convert.ToDecimal(item.MontoAplicado);

                                /////////////

                                Info_det_OP.IdEmpresa   = InfoOP.IdEmpresa;
                                Info_det_OP.IdOrdenPago = 0;
                                Info_det_OP.Secuencia   = 1;

                                Info_det_OP.IdEmpresa_cxp  = item.IdEmpresa_cxp;
                                Info_det_OP.IdTipoCbte_cxp = item.IdTipoCbte_cxp;
                                Info_det_OP.IdCbteCble_cxp = item.IdCbteCble_cxp;

                                Info_det_OP.Valor_a_pagar = item.MontoAplicado;
                                Info_det_OP.Referencia    = "";

                                Info_det_OP.IdFormaPago        = "EFEC";
                                Info_det_OP.Fecha_Pago         = DateTime.Now;
                                Info_det_OP.IdEstadoAprobacion = "APRO";

                                Info_det_OP.Idbanco = 1;

                                Info_det_OP.IdUsuario_Aproba  = "";
                                Info_det_OP.fecha_hora_Aproba = DateTime.Now;
                                Info_det_OP.Motivo_aproba     = "x conciliacion con NC cxp";

                                List_Info_det_OP.Add(Info_det_OP);
                                InfoOP.Detalle = List_Info_det_OP;

                                BusOP.GuardaDB(InfoOP, ref IdOP, ref mensaje);



                                item.IdEmpresa_pago  = info.Info_CbteCble_x_Caja_Movi.IdEmpresa;
                                item.IdCbteCble_pago = info.Info_CbteCble_x_Caja_Movi.IdCbteCble;
                                item.IdTipoCbte_pago = info.Info_CbteCble_x_Caja_Movi.IdTipoCbte;
                                item.IdEmpresa_op    = InfoOP.IdEmpresa;
                                item.IdOrdenPago_op  = IdOP;
                                item.Secuencia_op    = Info_det_OP.Secuencia;
                                item.Observacion     = "Cruze /Egr Caja";
                                bus_pagoCance.GuardarDB(item, info.Info_CbteCble_x_Caja_Movi.IdEmpresa, ref mensaje);

                                //info.DetalleMovCaja

                                caj_Caja_Movimiento_det_Bus BusDetCaja = new caj_Caja_Movimiento_det_Bus();
                                BusDetCaja.ModificarDB_IdOP_x_Det(info.Info_CbteCble_x_Caja_Movi.IdEmpresa, info.Info_CbteCble_x_Caja_Movi.IdCbteCble, info.Info_CbteCble_x_Caja_Movi.IdTipoCbte, item.Secuencia, InfoOP.IdEmpresa, IdOP, ref mensaje);
                            }
                        }
                    }
                    else
                    {
                        res = false;
                    }
                }
                else
                {
                    res = false;
                }
                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("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(caj_Caja_Movimiento_Bus)
                      };
            }
        }
Esempio n. 4
0
        public bool GrabarDB()
        {
            try
            {
                Get_OrdenPago();
                Get_Comprobante_contable();
                Get_Historico_cancelacion();
                bool    bandera_sigrabo = false;
                decimal id_OP           = 0;
                decimal id_detalle_OP   = 0;
                string  mensajeError    = "";
                int     IdSolicitud     = 0;

                decimal IdCbteCble = 0;
                if (Bus_Orden_pago.GuardaDB(Info_Orden_Pago, ref id_OP, ref mensajeError))
                {
                    int sec = 0;
                    if (Bus_comprobante_contable.GrabarDB(Info_comprobante_Contable, ref IdCbteCble, ref mensajeError))
                    {
                        cp_orden_pago_det_Bus detalle = new cp_orden_pago_det_Bus();

                        foreach (var item in Info_Orden_Pago.Detalle)
                        {
                            item.IdOrdenPago    = id_OP;
                            item.IdEmpresa      = Info_comprobante_Contable.IdEmpresa;
                            item.IdEmpresa_cxp  = param.IdEmpresa;
                            item.IdCbteCble_cxp = IdCbteCble;
                            item.IdTipoCbte_cxp = Info_comprobante_Contable.IdTipoCbte;

                            if (detalle.ModificarDB(item, ref id_detalle_OP, ref mensajeError))
                            {
                                Info_historico_cancelacion.IdEmpresa    = param.IdEmpresa;
                                Info_historico_cancelacion.IdOrdenPago  = id_OP;
                                Info_historico_cancelacion.IdEmpresa_OP = Info_Orden_Pago.IdEmpresa;
                                if (Bus_liquidacion_vacaciones.GrabarBD(Info_historico_cancelacion))
                                {
                                    bandera_sigrabo = true;
                                    if (bandera_sigrabo)
                                    {
                                        foreach (var item_ in Info_historico_cancelacion.detalle)
                                        {
                                            item_.IdSolicitud_Vacaciones = IdSolicitud;
                                            sec = sec + 1;
                                            if
                                            (sec == 1)
                                            {
                                                bus_detalle.Eliminar(item_);
                                            }
                                            item_.Sec        = sec;
                                            item_.IdEmpresa  = Info_historico_cancelacion.IdEmpresa;
                                            item_.IdEmpleado = Convert.ToInt32(Info_historico_cancelacion.IdEmpleado);

                                            item_.IdNominatipo = Info_historico_cancelacion.IdNomina_Tipo;
                                            bandera_sigrabo    = bus_detalle.Guardar_DB(item_);
                                        }

                                        foreach (var item_nov in lista_novedas)
                                        {
                                            if (item_nov.check == true)
                                            {
                                                ro_Historico_Liquidacion_Vacaciones_Det_DescNovedad_Info info_ = new ro_Historico_Liquidacion_Vacaciones_Det_DescNovedad_Info();
                                                info_.IdEmpresa              = item_nov.IdEmpresa;
                                                info_.IdNomina_tipo          = item_nov.IdNomina;
                                                info_.IdEmpleado             = item_nov.IdEmpleado;
                                                info_.IdNomina_Tipo_Liq      = item_nov.IdNominaLiqui;
                                                info_.IdSolicitud_Vacaciones = IdSolicitud;
                                                info_.IdNovedad              = item_nov.IdNovedad;
                                                info_.Secuencia              = item_nov.Secuencia;
                                                info_.IdRubro = item_nov.IdRubro;
                                                info_.Valor   = item_nov.Valor;
                                                bus_detalle_nov.Guardar_DB(info_);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return(bandera_sigrabo);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log_Error_bus.Log_Error(ex.ToString());
                return(false);
            }
        }