示例#1
0
 public Boolean ModificarDB(ct_cbtecble_Plantilla_det_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_cbtecble_Plantilla_det.FirstOrDefault(tbCbteCble => tbCbteCble.IdEmpresa == info.IdEmpresa && tbCbteCble.IdTipoCbte == info.IdTipoCbte && tbCbteCble.secuencia == info.secuencia);
             if (contact != null)
             {
                 contact.IdCentroCosto  = info.IdCentroCosto;
                 contact.IdCtaCble      = info.IdCtaCble;
                 contact.IdTipoCbte     = info.IdTipoCbte;
                 contact.secuencia      = info.secuencia;
                 contact.dc_Valor       = info.dc_Valor;
                 contact.dc_Observacion = info.dc_Observacion;
                 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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
示例#2
0
 public Boolean EliminarDB(ct_cbtecble_Plantilla_det_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_cbtecble_Plantilla_det.FirstOrDefault(tb => tb.IdEmpresa == info.IdEmpresa && tb.IdTipoCbte == info.IdTipoCbte && tb.IdPlantilla == info.IdPlantilla && tb.secuencia == info.secuencia);
             if (contact != null)
             {
                 context.ct_cbtecble_Plantilla_det.Remove(contact);
                 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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
        public void AddRow(ct_cbtecble_Plantilla_det_Info info_det, decimal IdTransaccionSession)
        {
            List <ct_cbtecble_Plantilla_det_Info> list = get_list(IdTransaccionSession);

            if (list.Where(q => q.IdPlantilla == info_det.IdPlantilla).Count() == 0)
            {
                info_det.secuencia = list.Count == 0 ? 1 : list.Max(q => q.secuencia) + 1;
                info_det.dc_Valor  = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1;
                list.Add(info_det);
            }
        }
        //private void gridViewDiario_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        //{
        //    try
        //    {
        //        ct_cbtecble_Plantilla_det_Info row = new ct_cbtecble_Plantilla_det_Info();

        //        row = (ct_cbtecble_Plantilla_det_Info)gridViewDiario.GetFocusedRow();
        //        if (row != null)
        //        {
        //            if (e.Column == colDebe)
        //            {
        //                decimal valor = 0;
        //                valor = Math.Abs(Convert.ToDecimal(e.Value));
        //                if (Convert.ToDecimal(e.Value) < 0) gridViewDiario.SetFocusedRowCellValue(colDebe, valor);
        //                if (valor > 0)
        //                {
        //                    gridViewDiario.SetFocusedRowCellValue(colHaber, 0);
        //                }
        //            }
        //            else if (e.Column == colHaber)
        //            {
        //                decimal valor = 0;
        //                valor = Math.Abs(Convert.ToDecimal(e.Value));
        //                if (Convert.ToDecimal(e.Value) < 0) gridViewDiario.SetFocusedRowCellValue(colHaber, valor);
        //                if (valor > 0) { gridViewDiario.SetFocusedRowCellValue(colDebe, 0); }
        //            }
        //        }
        //    }
        //    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());
        //    }
        //}

        public void GetInfo()
        {
            try
            {
                int IdSecuencia = 0;
                //List_Diario = uc_GridDiarioContable.Get_Obtener_ct_Cbtecble_det();
                ListDetalle = new List <ct_cbtecble_Plantilla_det_Info>();
                List <ct_Cbtecble_det_Info> list_detalle = new List <ct_Cbtecble_det_Info>();
                List <ct_Cbtecble_det_Info> lista        = new List <ct_Cbtecble_det_Info>();
                lista        = uc_GridDiarioContable.Get_List_Cbtecble_det();
                list_detalle = lista.Where(q => q.IdCtaCble != null).ToList();


                foreach (var item in list_detalle)
                {
                    ct_cbtecble_Plantilla_det_Info Detalle_Plantilla = new ct_cbtecble_Plantilla_det_Info();
                    IdSecuencia++;
                    Detalle_Plantilla.IdEmpresa           = item.IdEmpresa;
                    Detalle_Plantilla.IdTipoCbte          = item.IdTipoCbte;
                    Detalle_Plantilla.secuencia           = IdSecuencia;
                    Detalle_Plantilla.IdCtaCble           = item.IdCtaCble;
                    Detalle_Plantilla.IdCentroCosto       = item.IdCentroCosto;
                    Detalle_Plantilla.dc_Valor            = item.dc_Valor;
                    Detalle_Plantilla.dc_Observacion      = item.dc_Observacion;
                    Detalle_Plantilla.Debe_Aux            = item.dc_Valor_D;
                    Detalle_Plantilla.Haber_Aux           = item.dc_Valor_H;
                    Detalle_Plantilla.IdPunto_cargo       = (item.IdPunto_cargo == 0) ? null : item.IdPunto_cargo;
                    Detalle_Plantilla.IdPunto_cargo_grupo = (item.IdPunto_cargo_grupo == 0) ? null : item.IdPunto_cargo_grupo;

                    ListDetalle.Add(Detalle_Plantilla);
                }

                Info_Plantilla.LstDet           = ListDetalle;
                Info_Plantilla.IdTipoCbte       = Convert.ToInt32(cmbTipoCbte.EditValue); //((ct_Cbtecble_tipo_Info)cmbTipoCbte.EditValue).IdTipoCbte;
                Info_Plantilla.IdPlantilla      = Convert.ToInt32(lbl_no_comprobante.Text);
                Info_Plantilla.cb_Fecha         = Convert.ToDateTime(dtFecha.Value.ToShortDateString());
                Info_Plantilla.cb_Observacion   = txt_concepto.Text;
                Info_Plantilla.IdUsuario        = param.IdUsuario;
                Info_Plantilla.IdUsuarioAnu     = param.IdUsuario;
                Info_Plantilla.IdUsuarioUltModi = param.IdUsuario;
                Info_Plantilla.cb_FechaTransac  = DateTime.Now;
                Info_Plantilla.cb_FechaAnu      = DateTime.Now;
                Info_Plantilla.cb_FechaUltModi  = DateTime.Now;
                Info_Plantilla.IdEmpresa        = param.IdEmpresa;
                lblAnulado.Visible = (Info_Plantilla.cb_Estado == "A") ? false : true;
            }
            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());
            }
        }
        public void UpdateRow(ct_cbtecble_Plantilla_det_Info info_det, decimal IdTransaccionSession)
        {
            int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            ct_cbtecble_Plantilla_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.secuencia == info_det.secuencia).First();

            edited_info.dc_Valor       = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1;
            edited_info.dc_Valor_debe  = info_det.dc_Valor_debe;
            edited_info.dc_Valor_haber = info_det.dc_Valor_haber;
            edited_info.dc_Observacion = info_det.dc_Observacion;

            #region Cuenta
            edited_info.IdCtaCble = info_det.IdCtaCble;
            ct_plancta_Info info_Cuenta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble);
            if (info_Cuenta != null)
            {
                edited_info.pc_Cuenta = info_Cuenta.pc_Cuenta;
            }
            #endregion

            #region Centro de costo
            edited_info.IdCentroCosto = info_det.IdCentroCosto;
            if (string.IsNullOrEmpty(info_det.IdCentroCosto))
            {
                edited_info.cc_Descripcion = string.Empty;
            }
            else
            {
                var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto);
                if (cc != null)
                {
                    edited_info.cc_Descripcion = cc.cc_Descripcion;
                }
            }
            #endregion

            #region Punto Cargo
            edited_info.IdPunto_cargo       = info_det.IdPunto_cargo;
            edited_info.IdPunto_cargo_grupo = info_det.IdPunto_cargo_grupo;
            if (info_det.IdPunto_cargo == null || info_det.IdPunto_cargo == 0)
            {
                edited_info.nom_punto_cargo = string.Empty;
            }
            else
            {
                var pc = bus_pc.GetInfo(Convert.ToInt32(SessionFixed.IdEmpresa), Convert.ToInt32(info_det.IdPunto_cargo));
                if (pc != null)
                {
                    edited_info.nom_punto_cargo = pc.nom_punto_cargo;
                }
            }
            #endregion
        }
        public void UpdateRow(ct_cbtecble_Plantilla_det_Info info_det, decimal IdTransaccionSession)
        {
            ct_cbtecble_Plantilla_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.secuencia == info_det.secuencia).First();

            edited_info.IdCtaCble           = info_det.IdCtaCble;
            edited_info.dc_Valor            = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1;
            edited_info.dc_Valor_debe       = info_det.dc_Valor_debe;
            edited_info.dc_Valor_haber      = info_det.dc_Valor_haber;
            edited_info.dc_Observacion      = info_det.dc_Observacion;
            edited_info.IdPunto_cargo       = info_det.IdPunto_cargo;
            edited_info.IdPunto_cargo_grupo = info_det.IdPunto_cargo_grupo;
            edited_info.IdCentroCosto       = info_det.IdCentroCosto;
        }
示例#7
0
 public Boolean EliminarDB(ct_cbtecble_Plantilla_det_Info Info)
 {
     try
     {
         return(Data.EliminarDB(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("", "EliminarDB", ex.Message), ex)
               {
                   EntityType = typeof(ct_cbtecble_Plantilla_det_Bus)
               };
     }
 }
示例#8
0
        public Boolean GrabarDB(ct_cbtecble_Plantilla_det_Info Info)
        {
            try
            {
                using (EntitiesDBConta contexto = new EntitiesDBConta())
                {
                    ct_cbtecble_Plantilla_det address_tabla = new ct_cbtecble_Plantilla_det();
                    address_tabla.IdEmpresa   = Info.IdEmpresa;
                    address_tabla.IdTipoCbte  = Info.IdTipoCbte;
                    address_tabla.IdCtaCble   = Info.IdCtaCble;
                    address_tabla.IdPlantilla = Info.IdPlantilla;

                    if (Info.IdCentroCosto != "")
                    {
                        address_tabla.IdCentroCosto = Info.IdCentroCosto;
                    }

                    address_tabla.secuencia = Info.secuencia;
                    address_tabla.dc_Valor  = Info.dc_Valor;
                    if (Info.Debe_Aux > 0)
                    {
                        address_tabla.dc_Valor = Info.Debe_Aux;
                    }
                    if (Info.Haber_Aux > 0)
                    {
                        address_tabla.dc_Valor = Info.Haber_Aux * -1;
                    }

                    address_tabla.dc_Observacion      = (Info.dc_Observacion == null) ? "" : Info.dc_Observacion;
                    address_tabla.IdPunto_cargo       = Info.IdPunto_cargo;
                    address_tabla.IdPunto_cargo_grupo = Info.IdPunto_cargo_grupo;
                    contexto.ct_cbtecble_Plantilla_det.Add(address_tabla);

                    contexto.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
示例#9
0
        public List <ct_cbtecble_Plantilla_det_Info> Get_list_Planilla_det(int IdEmpresa, int idTipoCbte, decimal IdPlantilla)
        {
            try
            {
                List <ct_cbtecble_Plantilla_det_Info> lM = new List <ct_cbtecble_Plantilla_det_Info>();
                EntitiesDBConta OECbtecble_det           = new EntitiesDBConta();
                var             selectPla_det            = from C in OECbtecble_det.ct_cbtecble_Plantilla_det
                                                           where C.IdEmpresa == IdEmpresa && C.IdTipoCbte == idTipoCbte && C.IdPlantilla == IdPlantilla
                                                           select C;


                foreach (var item in selectPla_det)
                {
                    ct_cbtecble_Plantilla_det_Info Cbt = new ct_cbtecble_Plantilla_det_Info();
                    Cbt.IdEmpresa     = item.IdEmpresa;
                    Cbt.IdTipoCbte    = item.IdTipoCbte;
                    Cbt.secuencia     = item.secuencia;
                    Cbt.IdCtaCble     = item.IdCtaCble;
                    Cbt.IdCentroCosto = item.IdCentroCosto;
                    Cbt.dc_Valor      = item.dc_Valor;

                    Cbt.Debe_Aux  = (item.dc_Valor > 0) ? item.dc_Valor :0;
                    Cbt.Haber_Aux = (item.dc_Valor < 0) ? item.dc_Valor * -1 : 0;

                    Cbt.dc_Observacion      = item.dc_Observacion;
                    Cbt.IdPunto_cargo       = item.IdPunto_cargo;
                    Cbt.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo;


                    lM.Add(Cbt);
                }

                return(lM);
            }
            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();
                throw new Exception(ex.ToString());
            }
        }
        public void AddRow(ct_cbtecble_Plantilla_det_Info info_det, decimal IdTransaccionSession)
        {
            List <ct_cbtecble_Plantilla_det_Info> list = get_list(IdTransaccionSession);

            //if (list.Where(q => q.IdPlantilla == info_det.IdPlantilla).Count() == 0)
            //{
            info_det.secuencia = list.Count == 0 ? 1 : list.Max(q => q.secuencia) + 1;
            info_det.dc_Valor  = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1;

            #region Centro de costo
            if (string.IsNullOrEmpty(info_det.IdCentroCosto))
            {
                info_det.cc_Descripcion = string.Empty;
            }
            else
            {
                var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto);
                if (cc != null)
                {
                    info_det.cc_Descripcion = cc.cc_Descripcion;
                }
            }
            #endregion

            #region Punto de cargo
            if (info_det.IdPunto_cargo == null || info_det.IdPunto_cargo == 0)
            {
                info_det.nom_punto_cargo = string.Empty;
            }
            else
            {
                var pc = bus_pc.GetInfo(Convert.ToInt32(SessionFixed.IdEmpresa), Convert.ToInt32(info_det.IdPunto_cargo));
                if (pc != null)
                {
                    info_det.nom_punto_cargo = pc.nom_punto_cargo;
                }
            }
            #endregion

            list.Add(info_det);
            //}
        }
        public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ct_cbtecble_Plantilla_det_Info info_det)
        {
            int IdEmpresa = Convert.ToInt32(Session["IdEmpresa"]);

            if (info_det != null)
            {
                if (info_det.IdCtaCble != "")
                {
                    ct_plancta_Info info_Cuenta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble);
                    if (info_Cuenta != null)
                    {
                        info_det.IdCtaCble = info_Cuenta.IdCtaCble;
                        info_det.pc_Cuenta = info_Cuenta.pc_Cuenta;
                    }
                }
            }
            CbteCble_PlantillaDet_Lista.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            var model = CbteCble_PlantillaDet_Lista.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));

            return(PartialView("_GridViewPartial_ComprobanteContablePlantillaDet", model));
        }
        public ActionResult CmbCuentaContable()
        {
            ct_cbtecble_Plantilla_det_Info model = new ct_cbtecble_Plantilla_det_Info();

            return(PartialView("_CmbCuentaContable", model));
        }