private void GeneraProrrateo(DateTime _fechaDesde, DateTime _fechaHasta, double PorcentVenezuela) { try { if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "EGES") { BLL.Procedures.GENERAPRORRATEOEMPRESA _proEgesac = new BLL.Procedures.GENERAPRORRATEOEMPRESA(); _proEgesac.ItemList(_fechaDesde, _fechaHasta, PorcentVenezuela); //TAMBIEN GRABO LA FECHA QUE SE PRORRATEO.. SBDAEGESEntities _ModEges = new SBDAEGESEntities(); USR_ControlProrrateoEmpresaEGES _control = new USR_ControlProrrateoEmpresaEGES { FechaProrrateoEmpresa = _fechaDesde, Anio = _fechaDesde.Year, Mes = _fechaDesde.Month }; _ModEges.USR_ControlProrrateoEmpresaEGES.Add(_control); _ModEges.SaveChanges(); //FIN GRABA FECHA DE PRORRATEO MessageBox.Show("El prorrateo de facturas para la Empresa EGESAC se generó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.toolStripButtonSave.Enabled = true; } if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "RSC") { BLL.Procedures.GENERAPRORRATEOEMPRESA_RSC _proEgesac = new BLL.Procedures.GENERAPRORRATEOEMPRESA_RSC(); _proEgesac.ItemList(_fechaDesde, _fechaHasta); //TAMBIEN GRABO LA FECHA QUE SE PRORRATEO.. SBDARSCEntities _ModRsc = new SBDARSCEntities(); USR_ControlProrrateoEmpresa _control = new USR_ControlProrrateoEmpresa { FechaProrrateoEmpresa = _fechaDesde, Anio = _fechaDesde.Year, Mes = _fechaDesde.Month }; _ModRsc.USR_ControlProrrateoEmpresa.Add(_control); _ModRsc.SaveChanges(); //FIN GRABA FECHA DE PRORRATEO MessageBox.Show("El prorrateo de facturas para la Empresa RSC se generó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.toolStripButtonSave.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//FIN PERMISOS private void CargarConceptos() { try { if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "EGES") { BLL.Procedures.TRAECONCEPTOCTACONTABLE _conc = new BLL.Procedures.TRAECONCEPTOCTACONTABLE(); Entities.Procedures.TRAECONCEPTOCTACONTABLE _itemSeleccion = new Entities.Procedures.TRAECONCEPTOCTACONTABLE(); _conceptos = _conc.ItemList(); //GUARDO EN ESTA LISTA var q = (dynamic)null; q = (from item in _conceptos select item).ToList <Entities.Procedures.TRAECONCEPTOCTACONTABLE>(); //Limpia el combo this.comboBoxConcepto.SuspendLayout(); this.comboBoxConcepto.DataSource = null; this.comboBoxConcepto.Items.Clear(); //Carga el item de Seleccion _itemSeleccion.con_desc = "<Seleccione un Concepto>"; _itemSeleccion.con_cod = "0"; //_ItemsArtDep = _prod.ItemList(); q.Insert(0, _itemSeleccion); //Carga el combo this.comboBoxConcepto.DisplayMember = BLL.Procedures.TRAECONCEPTOCTACONTABLE.ColumnNames.CON_DESC; this.comboBoxConcepto.ValueMember = BLL.Procedures.TRAECONCEPTOCTACONTABLE.ColumnNames.CON_COD; this.comboBoxConcepto.DataSource = q; this.comboBoxConcepto.ResumeLayout(); } else { SBDARSCEntities _Mod = new SBDARSCEntities(); var _listObj = (from T in _Mod.TraeConceptoCtaContable() orderby T.con_Cod select T).ToList(); TraeConceptoCtaContable_Result _itemSeleccion = new TraeConceptoCtaContable_Result(); _conceptosR = _listObj; //GUARDO EN ESTA LISTA var q = (dynamic)null; q = (from item in _conceptosR select item).ToList <TraeConceptoCtaContable_Result>(); //Limpia el combo this.comboBoxConcepto.SuspendLayout(); this.comboBoxConcepto.DataSource = null; this.comboBoxConcepto.Items.Clear(); //Carga el item de Seleccion _itemSeleccion.con_Desc = "<Seleccione un Concepto>"; _itemSeleccion.con_Cod = "0"; //_ItemsArtDep = _prod.ItemList(); q.Insert(0, _itemSeleccion); //Carga el combo this.comboBoxConcepto.DisplayMember = "con_Desc"; this.comboBoxConcepto.ValueMember = "con_Cod"; this.comboBoxConcepto.DataSource = q; this.comboBoxConcepto.ResumeLayout(); } } catch (Exception ex) { //MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButtonSave_Click(object sender, EventArgs e) { try { if (VerificarDatos()) { SBDAEGESEntities _Mod = new SBDAEGESEntities(); //eges SBDARSCEntities _ModR = new SBDARSCEntities(); //rsc USR_ConceptoSubCuenta _con = new USR_ConceptoSubCuenta(); _con.concepto = _codigoConc; _con.subCuenta = Convert.ToInt32(comboBoxSubCuenta.SelectedValue); if (comboBoxSubCuenta.SelectedIndex == 0) { DialogResult _result = MessageBox.Show("No seleccionó ninguna sub cuenta a este concepto, desea continuar de todos modos ?", "Mensaje", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (_result == System.Windows.Forms.DialogResult.OK) { _con.subCuenta = 0; } else { return; } } if (_idSubCuenta == 0) //ESTOY ASOCIANDO UN NUEVO CONCEPTO A UNA SUBCUENTA { if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "EGES") { _Mod.USR_ConceptoSubCuenta.Add(_con); _Mod.SaveChanges(); } else { _ModR.USR_ConceptoSubCuenta.Add(_con); _ModR.SaveChanges(); } } else //ESTOY ACTUALIZANBDO UN CONCEPTO CON UNA NUEVA CUENTA.. { _con.Id = _idSubCuenta; if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "EGES") { _Mod.Entry(_con).State = System.Data.Entity.EntityState.Modified; _Mod.SaveChanges(); } else { _ModR.Entry(_con).State = System.Data.Entity.EntityState.Modified; _ModR.SaveChanges(); } } MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); CargarConceptos(); _idSubCuenta = 0; _codigoConc = string.Empty; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void comboBoxConcepto_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboBoxConcepto.SelectedIndex > 0) { Nuevo(); _codigoConc = comboBoxConcepto.SelectedValue.ToString(); //textBoxSubCuenta.Text = _conceptos.Find(x => x.con_cod.Contains(_codigoConc)).descripsubcuenta; // DESCRIPCION SUB CUENTA //comboBoxSubCuenta.SelectedValue = _conceptos.Find(x => x.con_cod.Contains(_codigoConc)).subcuenta.ToString(); // NRO. SUB CUENTA if (Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim() == "EGES") { labelCuentaContable.Text = _conceptos.Find(x => x.con_cod.Contains(_codigoConc)).cappla_cuentacpra.ToString(); // CUENTA CONTABLE labelDescripCtaContable.Text = _conceptos.Find(x => x.con_cod.Contains(_codigoConc)).cta_descrip.ToString(); // DESCRIPCION CUENTA CONTABLE labelCodigoConcepto.Text = _codigoConc; //RECUPERO SI ESTE CONCEPTO TIENE UNA SUB CUENTA ASOCIADA SBDAEGESEntities _Mod = new SBDAEGESEntities(); var _listObj = (from T in _Mod.USR_ConceptoSubCuenta where T.concepto == _codigoConc select T).SingleOrDefault(); if (_listObj == null) { comboBoxSubCuenta.SelectedIndex = 0; _idSubCuenta = 0; } else { comboBoxSubCuenta.SelectedValue = _listObj.subCuenta; _idSubCuenta = _listObj.Id; } } else { labelCuentaContable.Text = _conceptosR.Find(x => x.con_Cod.Contains(_codigoConc)).cappla_CuentaCpra.ToString(); // CUENTA CONTABLE labelDescripCtaContable.Text = _conceptosR.Find(x => x.con_Cod.Contains(_codigoConc)).cta_descrip.ToString(); // DESCRIPCION CUENTA CONTABLE labelCodigoConcepto.Text = _codigoConc; //RECUPERO SI ESTE CONCEPTO TIENE UNA SUB CUENTA ASOCIADA SBDARSCEntities _Mod = new SBDARSCEntities(); var _listObj = (from T in _Mod.USR_ConceptoSubCuenta where T.concepto == _codigoConc select T).SingleOrDefault(); if (_listObj == null) { comboBoxSubCuenta.SelectedIndex = 0; _idSubCuenta = 0; } else { comboBoxSubCuenta.SelectedValue = _listObj.subCuenta; _idSubCuenta = _listObj.Id; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void toolStripButtonSave_Click(object sender, EventArgs e) { try { if (textBoxDescripSub.Text != string.Empty) { SBDAEGESEntities _Mod = new SBDAEGESEntities(); SBDARSCEntities _ModRsc = new SBDARSCEntities(); USR_ArticuloSubCuenta _sub = new USR_ArticuloSubCuenta { Descripcion = textBoxDescripSub.Text, //esDeProducto = true }; //TABLA EGES if (_cuentaId == 0) { _Mod.USR_ArticuloSubCuenta.Add(_sub); _Mod.SaveChanges(); //ahora grabo en tabla de RSCÇ _ModRsc.USR_ArticuloSubCuenta.Add(_sub); _ModRsc.SaveChanges(); textBoxDescripSub.Text = string.Empty; _cuentaId = 0; TraeSubCuentas(); MessageBox.Show("Sub Cuenta creada correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _sub.subCuenta = _cuentaId; _Mod.Entry(_sub).State = System.Data.Entity.EntityState.Modified; _Mod.SaveChanges(); //ACTUALIZO EN TABLA RSCÇ _sub.subCuenta = _cuentaId; _ModRsc.Entry(_sub).State = System.Data.Entity.EntityState.Modified; _ModRsc.SaveChanges(); textBoxDescripSub.Text = string.Empty; _cuentaId = 0; TraeSubCuentas(); MessageBox.Show("Sub Cuenta actualizada correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Debe ingresar una descripción", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }