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); } }
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 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); } }