public DataSet GetAll(string empresaid, tb_co_Flujoefectivo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoFlujoefectivo_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@fefectivoorden", SqlDbType.Char, 1).Value = BE.fefectivoorden; cmd.Parameters.Add("@fefectivoid", SqlDbType.Char, 4).Value = BE.fefectivoid; cmd.Parameters.Add("@fefectivoname", SqlDbType.VarChar, 100).Value = BE.fefectivoname; cmd.Parameters.Add("@fefectivoformula", SqlDbType.VarChar, 100).Value = BE.fefectivoformula; //cmd.Parameters.Add("@importe", SqlDbType.Decimal).Value = BE.importe; cmd.Parameters.Add("@fetitulo", SqlDbType.Bit).Value = BE.fetitulo; cmd.Parameters.Add("@incluir_blanco", SqlDbType.Int).Value = BE.incluir_blanco; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Delete(string empresaid, tb_co_Flujoefectivo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoFlujoefectivo_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@fefectivoorden", SqlDbType.Char, 1).Value = BE.fefectivoorden; cmd.Parameters.Add("@fefectivoid", SqlDbType.Char, 4).Value = BE.fefectivoid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetOne(string empresaid, tb_co_Flujoefectivo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoFlujoefectivo_SELECT", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@fefectivoorden", SqlDbType.Char, 1).Value = BE.fefectivoorden; cmd.Parameters.Add("@fefectivoid", SqlDbType.Char, 4).Value = BE.fefectivoid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_co_Flujoefectivo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoFlujoefectivo_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@fefectivoorden", SqlDbType.Char, 1).Value = BE.fefectivoorden; cmd.Parameters.Add("@fefectivoid", SqlDbType.Char, 4).Value = BE.fefectivoid; cmd.Parameters.Add("@fefectivoname", SqlDbType.VarChar, 100).Value = BE.fefectivoname; cmd.Parameters.Add("@fefectivoformula", SqlDbType.VarChar, 100).Value = BE.fefectivoformula; cmd.Parameters.Add("@importe", SqlDbType.Decimal).Value = BE.importe; cmd.Parameters.Add("@fetitulo", SqlDbType.Bit).Value = BE.fetitulo; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Validacion() { string xmsg = ""; decimal ntotmarcados = VariablesPublicas.StringtoDecimal(lbltotregistros.Text); string xcodigo = "..."; decimal vmnpagosoles = 0; decimal vmnpagodolares = 0; int ncontador = 0; decimal vmncambio = VariablesPublicas.StringtoDecimal(txtTipCamb.Text); if (ntotmarcados == 0) { xmsg = "Seleccione al menos 1 documento a cancelar"; } else { vmnpagosoles = VariablesPublicas.StringtoDecimal(lbltotalpagosoles.Text); vmnpagodolares = VariablesPublicas.StringtoDecimal(lbltotalpagodolares.Text); if (vmnpagosoles == 0 & vmnpagodolares == 0) { xmsg = "Digite montos a cancelar"; } else { if (txtCodsubdiario.Text.Trim().Length > 0) { xcodigo = txtCodsubdiario.Text; } try { DataTable cursortipvoucher = new DataTable(); tb_co_tipodiarioBL BL = new tb_co_tipodiarioBL(); tb_co_tipodiario BE = new tb_co_tipodiario(); BE.perianio = VariablesPublicas.perianio; BE.diarioid = xcodigo; cursortipvoucher = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (tmptabla.Rows.Count == 0) { xmsg = "Ingrese Sub-Diario "; } if (txtcuentaid.Text.Trim().Length == 0) { xmsg = "Sub-Diario no relacinado con cuenta contable"; } } } if (vmncambio == 0) { xmsg = "Ingrese tipo de cambio"; txtTipCamb.Focus(); } DataTable cursorformaspagos = new DataTable(); try { tb_co_tabla01_mediopagoBL BL = new tb_co_tabla01_mediopagoBL(); tb_co_tabla01_mediopago BE = new tb_co_tabla01_mediopago(); BE.codigoid = cboFpago.SelectedValue.ToString(); cursorformaspagos = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (cursorformaspagos.Rows.Count == 0) { xmsg = "Seleccione Medio de Pago"; cboFpago.Focus(); } if (txtNumpago.Text.Trim().Length == 0) { xmsg = "Ingrese Nº de Cheque/Operación"; txtNumpago.Focus(); } DataTable cursorfefectivo = new DataTable(); string xFefectivo = ".."; if (cboFefectivo.Text.ToString().Trim().Length > 0) { xFefectivo = cboFefectivo.SelectedValue.ToString(); } try { tb_co_FlujoefectivoBL BL = new tb_co_FlujoefectivoBL(); tb_co_Flujoefectivo BE = new tb_co_Flujoefectivo(); BE.fefectivoid = xFefectivo; cursorfefectivo = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (cursorfefectivo.Rows.Count == 0) { xmsg = "Seleccione Flujo de Efectivo"; cboFefectivo.Focus(); } // Validan Detalles seleccinados if (xmsg.Length == 0) { for (ncontador = 0; ncontador <= DocumentosPendientes.Rows.Count - 1; ncontador++) { if (Convert.ToBoolean(DocumentosPendientes.Rows[ncontador]["selecciona"]) == true) { if (Convert.ToDecimal(DocumentosPendientes.Rows[ncontador]["pagosoles"]) == 0 & Convert.ToDecimal(DocumentosPendientes.Rows[ncontador]["pagodolares"]) == 0) { xmsg = "Ingrese monto a cancelar"; if (DocumentosPendientes.Rows[ncontador]["monedap"].ToString() == "1") { examinar.CurrentCell = examinar.Rows[ncontador].Cells["pagosoles"]; } else { examinar.CurrentCell = examinar.Rows[ncontador].Cells["pagodolares"]; } examinar.CurrentCell.ReadOnly = true; examinar.BeginEdit(true); examinar.CurrentCell.ReadOnly = false; break; } } } } if (xmsg.Length == 0) { if (!PuedeEditarEliminar(" Grabar Asiento Tesoreria ", VariablesPublicas.PADL(fEmision.Value.Month.ToString(), 2, "0"))) { xmsg = "..."; } } if (xmsg.Length > 0 & !(xmsg == "...")) { XtraMessageBox.Show(xmsg, "Validación", MessageBoxButtons.OK, MessageBoxIcon.Question); } return xmsg.Length == 0; }
private BindingSource NewMethodFlujoe() { tb_co_FlujoefectivoBL BL = new tb_co_FlujoefectivoBL(); tb_co_Flujoefectivo BE = new tb_co_Flujoefectivo(); DataTable table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; DataRowCollection rows = table.Rows; object[] cell; Dictionary<string, string> dic = new Dictionary<string, string>(); BindingSource binding = new BindingSource(); foreach (DataRow item in rows) { cell = item.ItemArray; dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[2].ToString()); cell = null; } binding.DataSource = dic; return binding; }